telegram-tt/dist/4.ded982f1890cbc30b91c.js
Alexander Zinchuk 3abec60083 [Build]
2021-07-13 17:33:18 +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 Bn}));var s=a(2),n=a(1),c=a(0),o=(a(84),a(39)),r=a(7),i=a(51),l=a(4);function d(e){const{chatId:t,threadId:a}=Object(r.z)(e)||{};return t&&a?(e=Object(o.Y)(e,t,a,!1),e=Object(o.t)(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.Y)(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.t)(e,s,n,i.a)),e=Object(o.Y)(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.X)(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.x)(e,n,c,"replyStack",[]),e=d(e=Object(o.n)(e)),e={...e,messages:{...e.messages,contentToBeScheduled:void 0},...n!==e.forwardMessages.toChatId&&{forwardMessages:{}}},Object(s.g)(e)),Object(o.N)(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(3),h=a(5);let O;Object(s.b)("setScrollOffset",(e,t,a)=>{const{chatId:s,threadId:n,scrollOffset:c}=a;return Object(o.x)(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.x)(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.x)(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.Kb)(e,t,a);if(!s||!n)return;const c=Object(m.g)(n,t=>Boolean(s[t]&&Object(r.b)(e,s[t],a).canEdit));return c?Object(o.x)(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.Kb)(e,n,c);if(!o||!i)return;const l=Object(r.ob)(e,n,c);let d;if(Object(r.Y)(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.Fb)(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.X)(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.Fb)(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.nb)(e,n,c);if(i&&0!==i.length){const a=i.pop();e=Object(o.x)(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:j}=a;if(void 0!==d){const t=Object(r.K)(e,m,d);t&&t.length&&([j]=t)}const g=Object(r.z)(e),f=!g||n!==g.chatId||c!==g.threadId||i!==g.type;if(O&&(clearTimeout(O),O=void 0),O=window.setTimeout(()=>{let e=Object(s.e)();e=Object(o.P)(e),e=Object(o.O)(e),Object(s.g)(e)},l?500:1500),e=Object(o.P)(e,n,j,l),e=Object(o.O)(e,void 0),h){const t=Object(r.nb)(e,n,c)||[];e=Object(o.x)(e,n,c,"replyStack",[...t,h])}f&&(e=Object(o.O)(e,u.b.Static));const p=Object(r.Kb)(e,n,c);if(p&&p.includes(j))return Object(s.g)(e),void t.openChat({id:n,threadId:c});if(f&&(e=Object(o.x)(e,n,c,"viewportIds",void 0)),e=Object(o.x)(e,n,c,"outlyingIds",void 0),p&&!f){const t=j>p[0]?u.b.Down:u.b.Up;e=Object(o.O)(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.bb)(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.m)(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:m}=d;e=Object(o.G)(e,b,u,m,n,c,i,l),Object(s.g)(e),e.shouldShowContextMenuHint&&(t.disableContextMenuHint(),t.showNotification({message:`To **edit** or **reply**, close this menu. Then ${h.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.n),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.R)(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.R)(e,{recentlyFoundChatIds:[s]});const c=n.filter(e=>e!==s);return c.unshift(s),c.length>10&&c.pop(),Object(o.R)(e,{recentlyFoundChatIds:c})}),Object(s.b)("clearRecentlyFoundChats",e=>Object(o.R)(e,{recentlyFoundChatIds:void 0})),Object(s.b)("setGlobalSearchContent",(e,t,a)=>{const{content:s}=a;return Object(o.S)(e,s)}),Object(s.b)("setGlobalSearchChatId",(e,t,a)=>{const{id:s}=a;return Object(o.R)(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.fb)(e,void 0)),Object(s.b)("setSettingOption",(e,t,a)=>Object(o.v)(e,a)),Object(s.b)("setThemeSettings",(e,t,a)=>{const{theme:s,...n}=a;return Object(o.w)(e,s,n)});var j=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(!h.k&&!h.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(j.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.h)(e);return Object(o.i)(t)});a(85);var g=a(10),f=a(9);const p=Object(f.h)(e=>e(),1e3,!0),I=Object(f.h)(e=>e(),3e3,!0),v=Object(f.a)(e=>e(),500,!1,!0);async function y(e,t,a){const c=await Object(g.a)("fetchChats",{limit:n.k,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.f)(i,Object(m.c)(c.users,"id")),i=Object(o.M)(i,Object(m.c)(c.chats,"id")),i=Object(o.I)(i,e,r),i=Object(o.J)(i,e,c),Object.keys(c.draftsById).map(Number).forEach(e=>{i=Object(o.x)(i,e,b.MAIN_THREAD_ID,"draft",c.draftsById[e])}),Object.keys(c.replyingToById).map(Number).forEach(e=>{i=Object(o.x)(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 C(e){const t=await Object(g.a)("fetchFullChat",e);if(!t)return;const{users:a,fullInfo:n}=t;let c=Object(s.e)();a&&(c=Object(o.f)(c,Object(m.c)(a,"id"))),c=Object(o.H)(c,e.id,{fullInfo:n}),Object(s.g)(c)}async function w(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(g.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.H)(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.Fb;c++){await Object(f.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.Eb)(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.ob)(o)&&!o.isMin&&t.requestChatUpdate({chatId:s});else if(s===c)Object(g.a)("fetchChat",{type:"self"});else{const t=Object(r.Jb)(e,s);t&&Object(g.a)("fetchChat",{type:"user",user:t})}if(n!==b.MAIN_THREAD_ID){Object(r.Hb)(e,s,n)||t.requestThreadInfoUpdate({chatId:s,threadId:n})}}),Object(s.b)("openSupportChat",(e,t)=>{const a=Object(r.Cb)(e);t.openChat({id:a?a.id:-1}),a||(async()=>{const e=await Object(g.a)("fetchChat",{type:"support"});e&&t.openChat({id:e.chatId})})()}),Object(s.b)("openTipsChat",(e,t)=>{t.openChatByUsername({username:n.Eb})}),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.O)(e,t.id)).sort((e,t)=>e.lastMessage.date-t.lastMessage.date)[0]:void 0;p(c?()=>y(s,c.id,c.lastMessage.date):()=>y(s))}),Object(s.b)("loadFullChat",(e,t,a)=>{const{chatId:s,force:n}=a,c=Object(r.g)(e,s);c&&(n?C(c):v(()=>C(c)))}),Object(s.b)("loadTopChats",()=>{I(()=>y("active"))}),Object(s.b)("requestChatUpdate",(e,t,a)=>{const{serverTimeOffset:s}=e,{chatId:n}=a,c=Object(r.g)(e,n);c&&Object(g.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.H)(e,c,{isMuted:i})),Object(g.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(g.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.H)(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(g.a)("editChatPhoto",{chatId:r,accessHash:i,photo:n})}(n,l.map(t=>Object(r.Jb)(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(g.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.Jb)(e,n);if(!c||!o)return;await Object(g.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(g.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(g.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(g.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(g.a)("createGroupChat",{title:e,users:t});if(!n)return;const{id:c}=n;let r=Object(s.e)();r=Object(o.H)(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(g.a)("editChatPhoto",{chatId:c,photo:a})}(n,c.map(t=>Object(r.Jb)(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.O)(e,s,c),{pinnedChatIds:n,includedChatIds:o}=t,i=a?[s,...n||[]]:(n||[]).filter(e=>e!==s),l=[s,...o];Object(g.a)("editChatFolder",{id:c,folderUpdate:{...t,pinnedChatIds:i,includedChatIds:l}})}}else{const t=Object(r.k)(e,s),a=Object(r.O)(e,s,"archived"===t?n.i:void 0);Object(g.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(g.a)("toggleChatArchived",{chat:c,folderId:Object(l.jb)(c)?0:n.i})}),Object(s.b)("loadChatFolders",()=>{!async function(){const e=await Object(g.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(g.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(g.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(g.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(g.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(g.a)("markMessageListRead",{serverTimeOffset:n,chat:c,threadId:b.MAIN_THREAD_ID}):Object(g.a)("toggleDialogUnread",{chat:c,hasUnreadMark:!c.hasUnreadMark}))}),Object(s.b)("openTelegramLink",(e,t,a)=>{const{url:s}=a;let c=n.jb.exec(s);if(c){const e=c[1];(async()=>{const a=await Object(g.a)("openChatByInvite",e);a&&t.openChat({id:a.chatId})})()}else{c=n.kb.exec(s);const e=c[1],a=c[2]?Number(c[2]):void 0;w(t,e,a)}}),Object(s.b)("acceptInviteConfirmation",(e,t,a)=>{const{hash:s}=a;(async()=>{const e=await Object(g.a)("importChatInvite",{hash:s});e&&t.openChat({id:e.id})})()}),Object(s.b)("openChatByUsername",(e,t,a)=>{const{username:s}=a;w(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.kb)(c)){if(c=await Object(g.a)("migrateChat",c),!c)return;t.openChat({id:c.id})}Object(g.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(g.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.Jb)(e,c);d&&b&&(async()=>{if(Object(l.kb)(d)){if(d=await Object(g.a)("migrateChat",d),!d)return;t.openChat({id:d.id})}await Object(g.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.H)(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.Jb)(e,c);b&&u&&(async()=>{if(Object(l.kb)(b)){if(b=await Object(g.a)("migrateChat",b),!b)return;t.openChat({id:b.id})}await Object(g.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.H)(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.bb)(Object(s.e)(),u.f.InProgress)),await Promise.all([d.title!==c?Object(g.a)("updateChatTitle",d,c):void 0,d.fullInfo&&d.fullInfo.about!==i?Object(g.a)("updateChatAbout",d,i):void 0,l?Object(g.a)("editChatPhoto",{chatId:n,accessHash:d.accessHash,photo:l}):void 0]),Object(s.g)(Object(o.bb)(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(g.a)("toggleSignatures",{chat:c,isEnabled:n})}),Object(s.b)("loadGroupsForDiscussion",()=>{(async()=>{const e=await Object(g.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.kb)(o)){if(o=await Object(g.a)("migrateChat",o),!o)return;t.openChat({id:o.id})}let{fullInfo:e}=o;if(!e){const t=await Object(g.a)("fetchFullChat",o);if(!t)return;e=t.fullInfo}e.isPreHistoryHidden&&await Object(g.a)("togglePreHistoryHidden",{chat:o,isEnabled:!1}),Object(g.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(g.a)("setDiscussionGroup",{channel:n}),c&&C(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.kb)(a))return;const n=a.fullInfo&&a.fullInfo.members&&a.fullInfo.members.length||void 0,c=await Object(g.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.f)(e,Object(m.c)(d,"id")),e=Object(o.H)(e,a.id,{fullInfo:{...a.fullInfo,members:[...(a.fullInfo||{}).members||[],...i||[]]}}),Object(s.g)(e))})()});var E=a(152);const M=new Map,S=Object(f.h)(e=>e(),1e3,!0);async function k(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.W/2)+1);break;case u.e.Forwards:b=-(n.W+1)}const h=await Object(g.a)("fetchMessages",{chat:Object(r.Gb)(Object(s.e)(),d,t),offsetId:a,addOffset:b,limit:n.W,threadId:t});if(!h)return;const{messages:O,users:j,chats:f,threadInfos:p}=h,I=Object(m.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.db)(y,d,t,v):Object(o.V)(y,d,t,v),y=Object(o.f)(y,Object(m.c)(j,"id")),y=Object(o.c)(y,Object(m.c)(f,"id")),y=Object(o.lb)(y,d,p);let C=Object(r.Z)(y,d,t);const w=Object(r.hb)(y,d,t);if(i&&C&&w&&Object(m.b)(C,w)&&(y=Object(o.V)(y,d,t,w),C=Object(r.Z)(y,d,t),y=Object(o.x)(y,d,t,"outlyingIds",void 0),i=!1),!l){const e=i?w:C,{newViewportIds:s}=N(e,a,c);y=Object(o.z)(y,d,t,s)}Object(s.g)(y)}function N(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.W,i=o+n.W-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.W}return{newViewportIds:l,areSomeLocal:d,areAllLocal:b}}async function T(e){let t;const a=e.attachment?(e,n)=>{M.has(n)||(t=n,M.set(n,a));const c=Object(s.e)();Object(s.g)({...c,fileUploads:{byMessageLocalId:{...c.fileUploads.byMessageLocalId,[n]:{progress:e}}}})}:void 0;(e.replyingTo||h.e)&&await Object(f.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.Hb)(n,e.chat.id,o)),await Object(g.a)("sendMessage",e,a),a&&t&&M.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.Kb)(e,i,l),m=Object(r.Z)(e,i,l),h=Object(r.hb)(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}=N(r,a,s);if(j&&(e=Object(o.z)(e,i,l,O)),async function(e,t,a,s,n,c,o,r){t||await k(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.J)(e,i)||Object(r.mb)(e,i,l),a=Boolean(t&&m&&!m.includes(t)),s=(a?h:m)||[],{newViewportIds:b,areSomeLocal:O,areAllLocal:j}=N(s,t,u.e.Around);O&&b.length>=n.W&&(e=Object(o.z)(e,i,l,b)),j||k(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(g.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.L)(t,e.id,a,{...n,replyToMessageId:void 0}),Object(s.g)(t)}return}let c=Object(s.e)();c=Object(o.L)(c,e.id,t,n.message),c=Object(o.f)(c,Object(m.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.ob)(e,c,o),noWebPage:Object(r.db)(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;T({...t,attachment:e?e[0]:void 0})}else if(u){const{text:e,entities:t,attachments:a,...s}=d,c=Object(m.n)(a,n.M);for(let a=0;a<c.length;a++){const[n,...o]=c[a],r=`${Date.now()}${a}`;T({...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=>{T({...s,attachment:e,groupedId:r})})}}else{const{text:e,entities:t,attachments:a,replyingTo:s,...n}=d;e&&T({...n,text:e,entities:t,replyingTo:s}),a.forEach(e=>{T({...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(g.a)("editMessage",{chat:b,message:u,text:n,entities:c,noWebPage:Object(r.db)(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&&M.get(c.previousLocalId||c.id);o&&Object(g.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(g.a)("saveDraft",{chat:d,text:i,entities:l,replyToMsgId:Object(r.ob)(e,s,n)}),e=Object(o.x)(e,s,n,"draft",c),e=Object(o.H)(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(g.a)("clearDraft",i),e=Object(o.x)(e,s,n,"draft",void 0),e=Object(o.H)(e,s,{draftDate:void 0})}),Object(s.b)("toggleMessageWebPage",(e,t,a)=>{const{chatId:s,threadId:n,noWebPage:c}=a;return Object(o.x)(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(g.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(g.a)("unpinAllMessages",{chat:e});let t=Object(s.e)();t=Object(o.x)(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(g.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(g.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(g.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(g.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.Gb)(e,c,o);if(!i)return;const{maxId:l}=a;S(()=>{Object(g.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(g.a)("markMessagesRead",{chat:s,messageIds:n})}),Object(s.b)("loadWebPagePreview",(e,t,a)=>{const{text:n}=a;!async function(e){const t=await Object(g.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(g.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(g.a)("loadPollOptionResults",{chat:e,messageId:t,option:a,offset:n,limit:c});if(!i)return;let l=Object(s.e)();l=Object(o.f)(l,Object(m.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(g.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(g.a)("fetchScheduledHistory",{chat:e,hash:t});if(!a)return;const{hash:n,messages:c}=a,r=Object(m.c)(c,"id"),i=Object.keys(r).map(Number).sort((e,t)=>t-e);let l=Object(s.e)();l=Object(o.u)(l,e.id,r,n),l=Object(o.x)(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(g.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.rb)(e,o.id,n);o&&i&&Object(g.a)("rescheduleMessage",{chat:o,message:i,scheduledAt:c})}),Object(s.b)("requestThreadInfoUpdate",(e,t,a)=>{const{chatId:s,threadId:n}=a,c=Object(r.Gb)(e,s,n);c&&Object(g.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(g.a)("fetchPinnedMessages",{chat:e});if(!t)return;const{messages:a,chats:n,users:c}=t,r=Object(m.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.x)(l,e.id,b.MAIN_THREAD_ID,"pinnedIds",i),l=Object(o.f)(l,Object(m.c)(c,"id")),l=Object(o.c)(l,Object(m.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(g.a)("fetchMessageLink",{chat:c,message:o});e&&Object(E.c)(e.link)})()});var P=a(53);const A=Object(f.h)(e=>e(),500,!1);async function x(e,t){const a=await Object(g.a)("searchGifs",{query:e,offset:t});a&&Object(s.g)(Object(o.Q)(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(g.a)("fetchStickerSets",{hash:e});if(!t)return;Object(s.g)(Object(o.ib)(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(f.f)(500)})()}),Object(s.b)("loadRecentStickers",e=>{const{hash:t}=e.stickers.recent||{};!async function(e=0){const t=await Object(g.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(g.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(g.a)("fetchFeaturedStickers",{hash:e});if(!t)return;Object(s.g)(Object(o.ib)(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.zb)(e,n);if(!t)return;c=t.accessHash}!async function(e,t){const a=await Object(g.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.hb)(i,n.id,{...n,stickers:c,packs:r});const l=i.stickers.forEmoji.emoji;l&&r[l]&&(i=Object(o.o)(i));Object(s.g)(i)}(n,c)}),Object(s.b)("loadAnimatedEmojis",()=>{!async function(){const e=await Object(g.a)("fetchAnimatedEmojis");if(!e)return;const{set:t,stickers:a}=e;Object(s.g)(Object(o.q)(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(g.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(g.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(g.a)("faveSticker",{sticker:e,unfave:!0})}(n)}),Object(s.b)("toggleStickerSet",(e,t,a)=>{const{stickerSetId:s}=a,n=Object(r.zb)(e,s);if(!n)return;const{accessHash:c,installedDate:o}=n;Object(g.a)(o?"uninstallStickerSet":"installStickerSet",{stickerSetId:s,accessHash:c})}),Object(s.b)("loadEmojiKeywords",(e,t,a)=>{const{language:n}=a;let c=Object(r.G)(e,n);c&&c.isLoading||(Object(s.g)({...e,emojiKeywords:{...e.emojiKeywords,[n]:{...c,isLoading:!0}}}),(async()=>{const t=await Object(g.a)("fetchEmojiKeywords",{language:n,fromVersion:c?c.version:0});e=Object(s.e)(),c=Object(r.G)(e,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&&A(()=>{!async function(e,t=0){const a=await Object(g.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(P.a)(a,e)&&i.unshift(t)}});Object(s.g)(Object(o.ib)(n,"search",a.hash,a.sets,i))}(n)})}),Object(s.b)("setGifSearchQuery",(e,t,a)=>{const{query:s}=a;"string"==typeof s&&A(()=>{x(s)})}),Object(s.b)("searchMoreGifs",e=>{const{query:t,offset:a}=e.gifs.search;"string"==typeof t&&A(()=>{x(t,a)})}),Object(s.b)("loadStickersForEmoji",(e,t,a)=>{const{emoji:n}=a,{hash:c}=e.stickers.forEmoji;A(()=>{!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(g.a)("fetchStickersForEmoji",{emoji:e,hash:t});if(a=Object(s.e)(),!n||a.stickers.forEmoji.emoji!==e)return;a=Object(o.jb)(a,e,n.stickers,n.hash),Object(s.g)(a)}(n,c)})}),Object(s.b)("clearStickersForEmoji",e=>({...e,stickers:{...e.stickers,forEmoji:{}}}));var R=a(38);const L=Object(f.h)(e=>e(),500,!1);async function D(e="",t,a,c,i,l){let d;if(c){const s=await Object(g.a)("searchMessagesLocal",{chatOrUser:c,query:e,type:t,limit:n.z,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(g.a)("searchMessagesGlobal",{query:e,offsetRate:a,limit:n.z,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.T)(b,{messages:!1}));const{messages:h,users:O,chats:j,totalCount:f,nextRate:p}=d;j.length&&(b=Object(o.c)(b,Object(m.c)(j,"id"))),O.length&&(b=Object(o.f)(b,Object(m.c)(O,"id"))),h.length&&(b=Object(o.d)(b,h)),b=Object(o.U)(b,h,f,t,p),Object(s.g)(b)}async function F(){const e=await Object(g.a)("fetchChats",{limit:n.k,archived:!0,withPinned:!0,serverTimeOffset:Object(s.e)().serverTimeOffset});if(!e)return;let t=Object(s.e)();t=Object(o.ob)(t,Object(m.c)(e.users,"id")),t=Object(o.M)(t,Object(m.c)(e.chats,"id")),t=Object(o.r)(t,"archived",e.chatIds),t=Object(o.J)(t,"archived",e),Object(s.g)(t)}async function B(){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.Jb)(e,t)).filter(Boolean),c=await Object(g.a)("fetchUsers",{users:n});c&&(e=Object(s.e)(),e=Object(o.ob)(e,Object(m.c)(c,"id")),Object(s.g)(e))}function H(e){return Object(g.a)("fetchMessages",{chat:e,threadId:b.MAIN_THREAD_ID,offsetId:e.lastReadInboxMessageId,addOffset:-(Math.round(n.W/2)+1),limit:n.W})}Object(s.b)("setGlobalSearchQuery",(e,t,a)=>{const{chatId:n}=e.globalSearch,{query:c}=a;c&&!n&&L(()=>{!async function(e){const t=await Object(g.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.T)(a,{chats:!1}));const{localChats:c,localUsers:i,globalChats:l,globalUsers:d}=t;(c.length||l.length)&&(a=Object(o.c)(a,Object(m.c)([...c,...l],"id")));(i.length||d.length)&&(a=Object(o.f)(a,Object(m.c)([...i,...d],"id")));a=Object(o.T)(a,{chats:!1}),a=Object(o.R)(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(R.m)(n):n,i=Object(o.R)(e,{date:n,query:"",resultsByType:{...e.globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}});Object(s.g)(i);const{chatId:l}=e.globalSearch;D("","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(R.m)(o):o,{type:l}=a,{nextOffsetId:d}=n&&n[l]||{};D(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 h;if(a!==b.MAIN_THREAD_ID){const s=Object(r.Fb)(e,t,a);h=s?s.topMessageId:void 0}!async function(e,t,a,c,i){const l=await Object(g.a)("searchMessagesLocal",{chatOrUser:e,type:"text",query:c,topMessageId:a,limit:n.Y,offsetId:i});if(!l)return;const{messages:d,users:b,totalCount:u,nextOffsetId:h}=l,O=Object(m.c)(d,"id"),j=Object.keys(O).map(Number);let f=Object(s.e)();const p=Object(r.B)(f);if(!p||c&&c!==p.query)return;f=Object(o.b)(f,e.id,O),f=Object(o.f)(f,Object(m.c)(b,"id")),f=Object(o.Z)(f,e.id,t,j,u,h),Object(s.g)(f)}(c,a,h,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(g.a)("searchMessagesLocal",{chatOrUser:e,type:t,limit:n.qb,offsetId:a});if(!c)return;const{messages:i,users:l,totalCount:d,nextOffsetId:b}=c,u=Object(m.c)(i,"id"),h=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.f)(O,Object(m.c)(l,"id")),O=Object(o.W)(O,e.id,t,h,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(g.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.bb)(e,u.f.InProgress),e=Object(o.ab)(e,n,{isUsernameAvailable:void 0}),Object(s.g)(e);const t=await Object(g.a)("checkChatUsername",{username:c});e=Object(s.e)(),e=Object(o.bb)(e,t?u.f.Complete:u.f.Error),e=Object(o.ab)(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.bb)(e,u.f.InProgress),Object(s.g)(e),Object(l.kb)(c)){if(c=await Object(g.a)("migrateChat",c),!c)return;t.openChat({id:c.id})}const a=await Object(g.a)("setChatUsername",{chat:c,username:i});e=Object(s.e)(),e=Object(o.bb)(e,a?u.f.Complete:u.f.Error),e=Object(o.ab)(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(g.a)("updatePrivateLink",{chat:a})}),Object(s.b)("sync",(e,t)=>{!async function(e){n.q&&console.log(">>> START SYNC");await Object(g.a)("fetchCurrentUser");const t=await async function(){const e=await Object(g.a)("fetchChats",{limit:n.k,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.Jb)(t,e)).filter(Boolean),h=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)&&h.push(e),Object(l.nb)(O)){const e=Object(r.Jb)(t,O);e&&!d.includes(O)&&u.push(e)}}u.push(...e.users),h.push(...e.chats),t=Object(o.s)(t,Object(m.c)(h,"id")),t=Object(o.r)(t,"active",e.chatIds),t={...t,chats:{...t.chats}},t=Object(o.J)(t,"active",e),Object.keys(e.draftsById).map(Number).forEach(a=>{t=Object(o.x)(t,a,b.MAIN_THREAD_ID,"draft",e.draftsById[a])}),Object.keys(e.replyingToById).map(Number).forEach(a=>{t=Object(o.x)(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.Fb)(n,c,i);if(e&&l===c){const s=n.messages.byChatId[c],r=Object(m.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(m.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.M)(n,Object(m.c)(e.chats,"id")),n=Object(o.lb)(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.x)(n,e,b.MAIN_THREAD_ID,"draft",l[e])}),e?n=Object(o.y)(n,Object(m.c)(a,"id")):a&&(n=Object(o.ob)(n,Object(m.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.q&&console.log(">>> FINISH SYNC");e()}(t.afterSync)}),Object(s.b)("afterSync",(e,t)=>{!async function(e){n.q&&console.log(">>> START AFTER-SYNC");e.loadFavoriteStickers(),await Promise.all([B(),F()]),await Object(g.a)("fetchCurrentUser"),n.q&&console.log(">>> FINISH AFTER-SYNC")}(t)});const U=Object(f.a)(e=>e(),500,!1,!0);function q(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.nb)(e))return;const{id:t,accessHash:a}=n[e]||{};return t?{id:t,accessHash:a}:void 0},b=e=>{if(Object(l.nb)(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.Jb)(e,s);if(!n)return;const{id:c,accessHash:o}=n;U(()=>Object(g.a)("fetchFullUser",{id:c,accessHash:o}))}),Object(s.b)("loadUser",(e,t,a)=>{const{userId:n}=a,c=Object(r.Jb)(e,n);c&&(async()=>{const t=await Object(g.a)("fetchUsers",{users:[c]});t&&(e=Object(s.e)(),e=Object(o.ob)(e,Object(m.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(g.a)("fetchTopUsers",{hash:e});if(!t)return;const{hash:a,ids:n,users:c}=t;let r=Object(s.e)();r=Object(o.f)(r,Object(m.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(g.a)("fetchContactList",{hash:e});if(!t)return;let a=Object(o.f)(Object(s.e)(),Object(m.c)(t.users,"id"));a=Object(o.c)(a,Object(m.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(g.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.Jb)(c,e);if(!i)return;Object(s.d)().updateChatMutedState({chatId:e,isMuted:t}),Object(s.g)(Object(o.bb)(Object(s.e)(),u.f.InProgress));await Object(g.a)("updateContact",{phone:i.phoneNumber,firstName:a,lastName:n})&&Object(s.g)(Object(o.nb)(Object(s.e)(),i.id,{firstName:a,lastName:n}));Object(s.g)(Object(o.bb)(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.Jb)(t,e);if(!a)return;const{id:n,accessHash:c}=a;await Object(g.a)("deleteUser",{id:n,accessHash:c})}(n)}),Object(s.b)("loadProfilePhotos",(e,t,a)=>{const{profileId:n}=a,c=Object(l.nb)(n),i=c?Object(r.Jb)(e,n):void 0,d=c?void 0:Object(r.g)(e,n);(async()=>{const e=await Object(g.a)("fetchProfilePhotos",i,d);if(!e||!e.photos)return;let t=Object(s.e)();c?t=Object(o.nb)(t,n,{photos:e.photos}):(t=Object(o.f)(t,Object(m.c)(e.users,"id")),t=Object(o.H)(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.jb)||c.value.match(n.kb)?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(g.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(g.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(g.a)("updateProfilePhoto",n),c||i||l){if(await Object(g.a)("updateProfile",{firstName:c,lastName:i,about:l})){e=Object(s.e)();const a=t&&Object(r.Jb)(e,t);a&&Object(s.g)(Object(o.nb)(e,a.id,{firstName:c,lastName:i,fullInfo:{...a.fullInfo,bio:l}}))}}if(d){await Object(g.a)("updateUsername",d)&&t&&Object(s.g)(Object(o.nb)(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(g.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(g.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(g.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(g.a)("fetchBlockedContacts");if(!e)return;let t=Object(s.e)();e.users&&e.users.length&&(t=Object(o.f)(t,Object(m.c)(e.users,"id"))),e.chats&&e.chats.length&&(t=Object(o.M)(t,Object(m.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(g.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.nb)(n)){const t=Object(r.Jb)(e,n);if(!t)return;c=t.accessHash}(async()=>{if(!await Object(g.a)("unblockContact",n,c))return;const e=Object(s.e)();Object(s.g)(Object(o.p)(e,n))})()}),Object(s.b)("loadAuthorizations",()=>{(async()=>{const e=await Object(g.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(g.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(g.a)("terminateAllAuthorizations"))return;const e=Object(s.e)();Object(s.g)({...e,activeSessions:e.activeSessions.filter(e=>e.isCurrent)})})()}),Object(s.b)("loadNotificationExceptions",()=>{Object(g.a)("fetchNotificationExceptions")}),Object(s.b)("loadNotificationSettings",e=>{const{serverTimeOffset:t}=e;(async()=>{const e=await Object(g.a)("fetchNotificationSettings",{serverTimeOffset:t});e&&Object(s.g)(Object(o.v)(Object(s.e)(),e))})()}),Object(s.b)("updateNotificationSettings",(e,t,a)=>{const{peerType:n,isSilent:c,shouldShowPreviews:r}=a;(async()=>{await Object(g.a)("updateNotificationSettings",n,{isSilent:c,shouldShowPreviews:r})&&Object(s.g)(Object(o.cb)(Object(s.e)(),n,c,r))})()}),Object(s.b)("updateContactSignUpNotification",(e,t,a)=>{const{isSilent:n}=a;(async()=>{await Object(g.a)("updateContactSignUpNotification",n)&&Object(s.g)(Object(o.v)(Object(s.e)(),{hasContactJoinedNotifications:!n}))})()}),Object(s.b)("loadLanguages",()=>{(async()=>{const e=await Object(g.a)("fetchLanguages");e&&Object(s.g)(Object(o.v)(Object(s.e)(),{languages:e}))})()}),Object(s.b)("loadPrivacySettings",()=>{(async()=>{const[e,t,a,n,c]=await Promise.all([Object(g.a)("fetchPrivacySettings","phoneNumber"),Object(g.a)("fetchPrivacySettings","lastSeen"),Object(g.a)("fetchPrivacySettings","profilePhoto"),Object(g.a)("fetchPrivacySettings","forwards"),Object(g.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=q(e,{visibility:c,allowedIds:[...o.allowUserIds,...o.allowChatIds],deniedIds:[...o.blockUserIds,...o.blockChatIds]});(async()=>{const e=await Object(g.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=q(e,{visibility:r.visibility,allowedIds:c?o:[...r.allowUserIds,...r.allowChatIds],deniedIds:c?[...r.blockUserIds,...r.blockChatIds]:o});(async()=>{const e=await Object(g.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(g.a)("updateIsOnline",a)}),Object(s.b)("loadContentSettings",()=>{(async()=>{const e=await Object(g.a)("fetchContentSettings");e&&Object(s.g)(Object(o.v)(Object(s.e)(),e))})()}),Object(s.b)("updateContentSettings",(e,t,a)=>{(async()=>{Object(s.g)(Object(o.v)(Object(s.e)(),{isSensitiveEnabled:a}));await Object(g.a)("updateContentSettings",a)||Object(s.g)(Object(o.v)(Object(s.e)(),{isSensitiveEnabled:!a}))})()}),Object(s.b)("loadPasswordInfo",()=>{(async()=>{const e=await Object(g.a)("getPasswordInfo");if(!e)return;let t=Object(s.e)();t=Object(o.v)(t,{hasPassword:e.hasPassword}),t=Object(o.mb)(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.mb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(g.a)("checkPassword",n);Object(s.g)(Object(o.mb)(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.mb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(g.a)("clearPassword",n);Object(s.g)(Object(o.mb)(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.mb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(g.a)("updatePassword",n,c,r,i);Object(s.g)(Object(o.mb)(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.mb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(g.a)("updateRecoveryEmail",n,c);Object(s.g)(Object(o.mb)(Object(s.e)(),{isLoading:!1,waitingEmailCodeLength:void 0})),e&&r()})()}),Object(s.b)("provideTwoFaEmailCode",(e,t,a)=>{const{code:s}=a;Object(g.a)("provideRecoveryEmailCode",s)}),Object(s.b)("clearTwoFaError",e=>Object(o.mb)(e,{error:void 0}));var G=a(61);Object(s.b)("validateRequestedInfo",(e,t,a)=>{const{requestInfo:n,saveInfo:c}=a,i=Object(r.ib)(e);i&&async function(e,t,a){const n=await Object(g.a)("validateRequestedInfo",{messageId:e,requestInfo:t,shouldSave:a});if(!n)return;const{id:c,shippingOptions:r}=n;if(!c)return;let i=Object(o.E)(Object(s.e)(),c);r?(i=Object(o.gb)(i,r),i=Object(o.C)(i,u.i.Shipping)):i=Object(o.C)(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(g.a)("getPaymentForm",{messageId:e});if(!t)return;let a=Object(o.B)(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.C)(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(g.a)("getReceipt",t);if(!n)return;let c=Object(s.e)();const i=Object(r.l)(c,a,e);c=Object(o.D)(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.lb)(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(G.b)(c.error),t=Object(s.e)();return void Object(s.g)({...t,payment:{...t.payment,error:{...e}}})}let r=Object(o.F)(Object(s.e)(),{type:c.type,id:c.id});r=Object(o.C)(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.ib)(e),l=Object(r.jb)(e),d=Object(r.lb)(e),b=Object(r.Bb)(e);i&&d&&async function(e,t,a,n){if(await Object(g.a)("sendPaymentForm",{messageId:e,credentials:t,requestedInfoId:a,shippingOptionId:n})){const e=Object(o.h)(Object(s.e)());Object(s.g)(Object(o.i)(e))}}(i,{save:c,data:b},l,n)}),Object(s.b)("setPaymentStep",(e,t,a={})=>Object(o.C)(e,a.step||u.i.ShippingInfo)),Object(s.b)("setInvoiceMessageInfo",(e,t,a)=>Object(o.A)(e,a));a(86);var _=a(31),z=a(78);const W=Object(f.h)(e=>e(),1e3,!0);Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateChat":{a.noTopChatsRequest||Object(r.N)(e,a.id)||t.loadTopChats();const n=Object(o.H)(e,a.id,a.chat,a.newProfilePhoto);Object(s.g)(n);const c=Object(r.r)(n);W(()=>Object(z.a)(c));break}case"updateChatJoin":{const n=Object(r.k)(e,a.id);if(!n)break;e=Object(o.I)(e,n,[a.id]),e=Object(o.H)(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.r)(e,t,n.filter(e=>e!==a.id))),e=Object(o.H)(e,a.id,{isNotJoined:!0}),Object(s.g)(e);break}case"updateChatInbox":Object(s.g)(Object(o.H)(e,a.id,a.chat));break;case"updateChatTypingStatus":{const{id:t,typingStatus:n}=a;Object(s.g)(Object(o.H)(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.H)(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.H)(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(z.a)(m),Object(_.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.H)(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.H)(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.L){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.K)(e,t,n));break}case"updateChatFolder":{const{id:t,folder:n}=a,{byId:c,orderedIds:o}=e.chatFolders,r=n?{...c,[t]:n}:Object(m.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.H)(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.H)(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.x)(e,t,b.MAIN_THREAD_ID,"draft",n),e=Object(o.x)(e,t,b.MAIN_THREAD_ID,"replyingToId",r),e=Object(o.H)(e,t,{draftDate:c}),Object(s.g)(e));break}case"showInvite":{const{data:e}=a;t.showDialog({data:e});break}}});function $(e,t,a,s,n=!1){const c=n?Object(r.rb)(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.eb)(e,t,a,s):Object(o.L)(e,t,a,s)}function V(e,t){const{id:a,chatId:s}=t,n=Object(r.g)(e,s);if(n&&n.unreadCount&&!Object(r.Z)(e,s,b.MAIN_THREAD_ID))return e;if(e=Object(o.V)(e,s,b.MAIN_THREAD_ID,[a]),Object(r.Y)(e,s,b.MAIN_THREAD_ID)){const t=Object(r.I)(e,s,b.MAIN_THREAD_ID),n=Object(o.g)(e,s,b.MAIN_THREAD_ID,a),c=Object(r.Kb)(n,s,b.MAIN_THREAD_ID);t&&!c.includes(t)||(e=n)}const{threadInfo:c,firstMessageId:i}=Object(r.Eb)(e,s,t)||{};return!i&&Object(l.wb)(t)||c&&(e=Object(o.V)(e,s,c.threadId,[a]),Object(r.Y)(e,s,c.threadId)&&(e=Object(o.g)(e,s,c.threadId,a),i||(e=Object(o.x)(e,s,c.threadId,"firstMessageId",t.id)),c.lastMessageId||(e=Object(o.x)(e,s,c.threadId,"threadInfo",{...c,lastMessageId:t.id})))),e}function K(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.H)(e,t,{lastMessage:a})}function Q(e,t){const a=Object(r.n)(e,t),s=Object(r.Z)(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=Q(n=Object(o.L)(n,e,t,{isDeleting:!0}),e);a&&(n=K(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.Eb)(n,e,a)||{};s&&c.push(s.threadId)}),Object(m.o)(c).forEach(t=>{a.requestThreadInfoUpdate({chatId:e,threadId:t})}),void setTimeout(()=>{Object(s.g)(Object(o.j)(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=Q(n=Object(o.L)(n,t,e,{isDeleting:!0}),t);a&&(n=K(n,t,a,!0)),setTimeout(()=>{Object(s.g)(Object(o.j)(Object(s.e)(),t,[e]))},350)}}),Object(s.g)(n),Object(m.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=V(e=$(e,n,c,i),i),i.threadInfo&&(e=Object(o.kb)(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.Eb)(e,n,i)||{};a&&t.requestThreadInfoUpdate({chatId:n,threadId:a.threadId}),Object(l.wb)(i)||setTimeout(()=>{Object(s.g)(K(Object(s.e)(),n,d))},350)}else Object(s.g)(K(Object(s.e)(),n,d));Object(r.N)(e,n)||t.loadTopChats();break}case"newScheduledMessage":{const{chatId:t,id:n,message:c}=a;e=$(e,t,n,c,!0);const i=Object(r.qb)(e,t)||[];e=Object(o.x)(e,t,b.MAIN_THREAD_ID,"scheduledIds",Object(m.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=$(e,t,n,c);const i=Object(r.l)(e,t,n);c.threadInfo&&(e=Object(o.kb)(e,c.threadInfo.chatId,c.threadInfo.threadId,c.threadInfo)),e=K(e,t,i),Object(s.g)(e);break}case"updateScheduledMessage":{const{chatId:t,id:n,message:c}=a;if(!Object(r.rb)(e,t,n))return;e=$(e,t,n,c,!0);const i=Object.keys(Object(r.sb)(e,t)||{}).map(Number).sort((e,t)=>t-e);e=Object(o.x)(e,t,b.MAIN_THREAD_ID,"scheduledIds",i),Object(s.g)(e);break}case"updateMessageSendSucceeded":{const{chatId:t,localId:n,message:c}=a;e=V(e,c);const i=Object(r.l)(e,t,n);e=Object(o.j)(e,t,[n]),c.isScheduled&&(e=Object(o.k)(e,t,[n])),e=Object(o.L)(e,t,c.id,{...i,...c,previousLocalId:n});const l=Object(r.l)(e,t,c.id);e=K(e,t,l),Object(s.g)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:n,message:c}=a,i=Object(r.qb)(e,t)||[];e=Object(o.x)(e,t,b.MAIN_THREAD_ID,"scheduledIds",[...i,c.id]);const l=Object(r.rb)(e,t,n);e=Object(o.k)(e,t,[n]),e=Object(o.eb)(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.kb)(e,t)||[],l=n?[...i,...c].sort((e,t)=>t-e):i.filter(e=>!c.includes(e));Object(s.g)(Object(o.x)(e,t,b.MAIN_THREAD_ID,"pinnedIds",l));break}case"updateThreadInfo":{const{chatId:t,threadId:n,threadInfo:c,firstMessageId:i}=a,l={...Object(r.Fb)(e,t,n),...c};if(!l.threadId)return;e=Object(o.kb)(e,t,n,l),i&&(e=Object(o.x)(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.nb)(n)&&(e=Object(o.j)(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.eb)(n,e,t,{isDeleting:!0})}),Object(s.g)(n),setTimeout(()=>{n=Object(o.k)(Object(s.e)(),e,t);const a=Object(r.sb)(n,e);n=Object(o.x)(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.L)(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.L)(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.L)(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.L)(e,i.chatId,i.id,{content:{...i.content,poll:{...l,results:{...l.results,recentVoterIds:m,totalVoters:h,results:O}}}}));break}}});const Y=Object(f.h)((function(){let e=Object(s.e)();X.forEach(([t,a])=>{e=Object(o.nb)(e,t,{status:a})}),Object(s.g)(e),X=[]}),3e3,!0);let X=[];Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"deleteUser":return Object(o.l)(e,a.id);case"updateUser":return Object(o.nb)(e,a.id,a.user);case"updateUserStatus":return s=a.userId,n=a.status,X.push([s,n]),void Y();case"updateUserFullInfo":{const{id:t,fullInfo:s}=a,n=e.users.byId[t];if(!n)return;return Object(o.nb)(e,t,{fullInfo:{...n.fullInfo,...s}})}}var s,n}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateStickerSet":return Object(o.hb)(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.p)(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.cb)(e,a.peerType,a.isSilent,a.shouldShowPreviews);case"updateNotifyExceptions":{const{id:t,isMuted:n,isSilent:c,shouldShowPreviews:r}=a;e.chats.byId[t]&&(e=Object(o.H)(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 Z=a(49),ee=a(8),te=a(37),ae=a(122);function se(e){Object(c.n)(()=>Object(f.c)(e),[e])}var ne=a(48),ce=a(110);var oe=a(36),re=a(26),ie=a(44),le=a(63),de=a(42),be=a(23),ue=a(153),me=a(140);a(197);var he=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(ee.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 Oe=[0,1,2];var je=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.Db)(e),animationLevel:i}},(e,t)=>Object(m.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:m,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(re.a)(),S=e===u.d.ChatList,k={date:void 0},N={id:void 0},T=Object(c.p)(()=>f?Object(R.a)(new Date(1e3*f)):void 0,[f]),P=Object(c.p)(()=>S&&v?Object.values(v).reduce((e,t)=>Object(l.jb)(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(be.a,{round:!0,ripple:S&&!h.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(ee.a)("animated-menu-icon",!S&&"state-back",O&&"no-animation")})),[S,M,d,O]),L=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(ie.a)(t,I===n.e)},[I,E,p]),B=Object(c.m)(e=>{e.stopPropagation();const t=0===I?2:0;Oe.forEach((e,a)=>{document.body.classList.toggle("animation-level-"+a,t===a)}),E({animationLevel:t})},[I,E]),H=Boolean(g)||e===u.d.GlobalSearch||e===u.d.Contacts,U=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(le.a,{trigger:x,footer:`${n.g} alpha ${n.h}`},c.a.createElement(de.a,{icon:"saved-messages",onClick:D},M("SavedMessages")),c.a.createElement(de.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(de.a,{icon:"user",onClick:o},M("Contacts")),c.a.createElement(de.a,{icon:"settings",onClick:s},M("Settings")),c.a.createElement(de.a,{icon:"darkmode",onClick:F},c.a.createElement("span",{className:"menu-item-name"},M("lng_menu_night_mode")),c.a.createElement(he,{id:"darkmode",label:M("dark"===p?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===p,noAnimation:!0})),c.a.createElement(de.a,{icon:"animations",onClick:B},c.a.createElement("span",{className:"menu-item-name capitalize"},M("Appearance.Animations").toLowerCase()),c.a.createElement(he,{id:"animations",label:"Toggle Animations",checked:I>0})),c.a.createElement(de.a,{icon:"help",onClick:C},M("TelegramFeatures")),c.a.createElement(de.a,{icon:"bug",href:n.y},"Report Bug"),A&&c.a.createElement(c.a.Fragment,null,c.a.createElement(de.a,{icon:"char-K",href:"https://web.telegram.org/k/",onClick:()=>{localStorage.setItem("kz_version",JSON.stringify("K"))}},"Switch to K Version"),c.a.createElement(de.a,{icon:"char-W",href:"https://web.telegram.org/?legacy=1"},"Switch to Old Version"))),c.a.createElement(ue.a,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:g||f?"with-picker-item":"",value:t||b,focused:H,isLoading:m,placeholder:U,autoComplete:"off",canClose:Boolean(g||f),onChange:a,onReset:d,onFocus:L},T&&c.a.createElement(me.a,{icon:"calendar",title:T,canClose:!0,isMinimized:Boolean(g),className:"search-date",onClick:w,clickArg:k}),g&&c.a.createElement(me.a,{chatOrUserId:g,onClick:i,canClose:!0,clickArg:N}))))})),ge=a(21);a(199);var fe=Object(c.h)(()=>{const e=Object(re.a)();return c.a.createElement("div",{id:"ConnectionState",dir:e.isRtl?"rtl":void 0},c.a.createElement(ge.a,{color:"black"}),c.a.createElement("div",{className:"state-text"},e("WaitingForNetwork")))}),pe=a(131),Ie=a(52),ve=a(28),ye=(e,t,a)=>{const s=Object(c.q)(),n=(e=>Object(c.p)(()=>Object(f.h)(e=>e(),e),[e]))(t),o=Object(ve.a)();return Object(Ie.a)(()=>{let t=!0;n(()=>{s.current=e(),t||o()}),t=!1},a),s.current},Ce=a(35),we=a(168),Ee=a(189);var Me=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.fb)(e),notifyExceptions:Object(r.eb)(e),activeChatFolder:c,currentUserId:o}},(e,t)=>Object(m.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(re.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=ye(()=>{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(m.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&&h.m&&I&&I.length)return Object(pe.b)(j.current,{onSwipe:(e,t)=>{t===pe.a.Left?u(Math.min(r+1,I.length-1)):t===pe.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(ne.a)(()=>{y.current&&u(0)}):void 0,[r,u]),Object(Ce.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(te.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(Ee.a,{folderType:"folder",folderId:t.id,noChatsText:g("FilterNoChatsToDisplay"),isActive:e}):c.a.createElement(Ee.a,{folderType:"all",isActive:e})}return c.a.createElement("div",{className:"ChatFolders"},I&&I.length?c.a.createElement(we.a,{tabs:I,activeTab:r,onSwitchTab:v}):C?c.a.createElement("div",{className:Object(ee.a)("tabs-placeholder",w)}):void 0,c.a.createElement(ce.a,{ref:j,name:g.isRtl?"slide-reversed":"slide",activeKey:r,renderCount:I?I.length:void 0},E))})),Se=a(12),ke=a(20),Ne=a(17);var Te=Object(c.h)(e=>{const t=Object(ke.a)(Se.a.Extra,"LeftSearch");return t?c.a.createElement(t,e):c.a.createElement(Ne.a,null)});var Pe=Object(c.h)(e=>{const t=Object(ke.a)(Se.a.Extra,"ContactList");return t?c.a.createElement(t,e):c.a.createElement(Ne.a,null)}),Ae=a(54);a(210);let xe;var Re=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(re.a)(),i=Object(ee.a)("NewChatButton",e&&"revealed",n&&"menu-is-open"),l=Object(c.m)(()=>{xe&&(clearTimeout(xe),xe=void 0)},[]),d=Object(c.m)(()=>{xe&&(clearTimeout(xe),xe=void 0),xe=window.setTimeout(()=>{o(!1)},750)},[]);return c.a.createElement("div",{className:i,onMouseEnter:l,onMouseLeave:d},c.a.createElement(be.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(Ae.a,{isOpen:n,positionX:"right",positionY:"bottom",autoClose:!0,onClose:()=>{o(!1)}},c.a.createElement(de.a,{icon:"channel",onClick:a},r("NewChannel")),c.a.createElement(de.a,{icon:"group",onClick:s},r("NewGroup")),c.a.createElement(de.a,{icon:"user",onClick:t},r("NewMessageTitle"))))}),Le=a(157);a(211);const De=Object.keys(u.d).length/2;let Fe;var Be=Object(s.h)(e=>Object(m.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)(h.m),m=!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,Fe&&(clearTimeout(Fe),Fe=void 0),Fe=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||h.m)&&b(!0),()=>{t&&(clearTimeout(t),t=void 0)}},[e]);const[C,w,E]=function(){const[e,t]=Object(oe.a)(!1);Object(c.n)(()=>{const e=window.setTimeout(t,2592e5);return()=>{clearTimeout(e)}},[t]);const{shouldRender:a,transitionClassNames:s}=Object(te.a)(e);return[a,s,()=>{window.location.reload()}]}(),M=Object(re.a)();return c.a.createElement("div",{id:"LeftColumn-main",onMouseEnter:h.m?void 0:v,onMouseLeave:h.m?void 0:y},c.a.createElement(je,{content:e,contactsFilter:s,onSearchQuery:o,onSelectSettings:j,onSelectContacts:g,onSelectArchived:I,onReset:i,shouldSkipTransition:n}),c.a.createElement(Le.a,{isOpen:m,isCustom:!0,className:"connection-state-wrapper opacity-transition slow"},()=>c.a.createElement(fe,null)),c.a.createElement(ce.a,{name:n?"none":"zoom-fade",renderCount:De,activeKey:e,shouldCleanup:!0,cleanupExceptionKey:u.d.ChatList,className:m?"pull-down":void 0},n=>{switch(e){case u.d.ChatList:return c.a.createElement(Me,null);case u.d.GlobalSearch:return c.a.createElement(Te,{searchQuery:t,searchDate:a,isActive:n,onReset:i});case u.d.Contacts:return c.a.createElement(Pe,{filter:s,isActive:n,onReset:i});default:return}}),C&&c.a.createElement(be.a,{fluid:!0,pill:!0,className:Object(ee.a)("btn-update",w),onClick:E},M("lng_update_telegram")),c.a.createElement(Re,{isShown:d,onNewPrivateChat:g,onNewChannel:f,onNewGroup:p}))});var He=Object(c.h)(e=>{const t=Object(ke.a)(Se.a.Extra,"Settings");return t?c.a.createElement(t,e):c.a.createElement(Ne.a,null)});var Ue=Object(c.h)(e=>{const t=Object(ke.a)(Se.a.Extra,"NewChat");return t?c.a.createElement(t,e):c.a.createElement(Ne.a,null)});var qe,Ge=Object(c.h)(e=>{const t=Object(ke.a)(Se.a.Extra,"ArchivedChats");return t?c.a.createElement(t,e):c.a.createElement(Ne.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"}(qe||(qe={}));const _e=Object.keys(qe).length/2;var ze=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(m.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,m]=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=qe.Main;switch(b){case u.d.Archived:v=qe.Archived;break;case u.d.Settings:v=qe.Settings;break;case u.d.NewChannelStep1:case u.d.NewChannelStep2:v=qe.NewChannel;break;case u.d.NewGroupStep1:case u.d.NewGroupStep2:v=qe.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?(m(u.d.ChatList),f(""),n({query:""}),i({date:void 0}),o({id:void 0}),r(),setTimeout(()=>{I(Date.now())},250)):m(u.d.GlobalSearch)}else m(u.d.NewChannelStep1);else m(u.d.NewGroupStep1)},[b,a,O,n,i,o,r]),C=Object(c.m)(t=>{b!==u.d.Contacts?(m(u.d.GlobalSearch),t!==e&&n({query:t})):f(t)},[b,e,n]);Object(c.n)(()=>b!==u.d.ChatList||0===a?Object(ne.a)(()=>y()):void 0,[a,b,y]),Object(c.n)(()=>{d(),O===u.m.Privacy&&l()},[d,l,O]);const w=e=>{m(u.d.Settings),j(e)};return c.a.createElement(ce.a,{id:"LeftColumn",name:s?"none":h.o,renderCount:_e,activeKey:v,shouldCleanup:!0,cleanupExceptionKey:qe.Main},a=>{switch(v){case qe.Archived:return c.a.createElement(Ge,{isActive:a,onReset:y,onContentChange:m});case qe.Settings:return c.a.createElement(He,{isActive:a,currentScreen:O,onScreenSelect:w,onReset:y,shouldSkipTransition:s});case qe.NewChannel:return c.a.createElement(Ue,{key:p,isActive:a,isChannel:!0,content:b,onContentChange:m,onReset:y});case qe.NewGroup:return c.a.createElement(Ue,{key:p,isActive:a,content:b,onContentChange:m,onReset:y});default:return c.a.createElement(Be,{content:b,searchQuery:e,searchDate:t,contactsFilter:g,onContentChange:m,onSearchQuery:C,onReset:y,shouldSkipTransition:s})}})})),We=a(138),$e=a(11),Ve=a(13),Ke=a(56);var Qe=()=>{const[e,t]=Object(c.r)(Ke.a.get());return Object(c.n)(()=>{const e=Object(f.h)(()=>{t(Ke.a.get())},250,!1);return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),e},Je=a(174);function Ye(e,t){const a=e<=n.eb?16:32,s=function(e){if(e>n.bb){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.ab){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.eb?54:64,o=t?s-a-c:s-a,r=e>n.eb?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 Xe=a(133),Ze=a(143),et=a(134),tt=a(50),at=a(108),st=a(124);var nt=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(ke.a)(Se.a.Extra,"HeaderMenuContainer",!t);return a?c.a.createElement(a,e):void 0});var ct=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.lb)(n));if(n&&n.isRestricted)return{noMenu:!0};const o=Object(r.Q)(e,t),i="thread"===s&&a===b.MAIN_THREAD_ID,d="thread"===s&&a!==b.MAIN_THREAD_ID,u=Object(r.X)(e),m=Boolean(Object(r.M)(e,t)),O=Boolean(i&&n&&(c||Object(l.pb)(n))&&n.isNotJoined),j=i||d,g=i&&!o&&!O,f=!Object(r.T)(e),p=i&&!O;return{noMenu:!(h.k&&O||h.k&&j||g||f||p),isChannel:c,isRightColumnShown:u,canStartBot:m,canSubscribe:O,canSearch:j,canMute:g,canSelect:f,canLeave:p}},(e,t)=>Object(m.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:m,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)(()=>{m({command:"/start"})},[m]),M=Object(c.m)(()=>{if(O(),h.k){document.querySelector("#MobileSearch input").focus()}else setTimeout(()=>{const e=document.querySelector(".RightHeader .SearchInput input");e&&e.focus()},400)},[O]),S=Object(re.a)();return c.a.createElement("div",{className:"HeaderActions"},!h.k&&o&&c.a.createElement(be.a,{size:"tiny",ripple:!0,fluid:!0,onClick:w},S(s?"Subscribe":"Join Group")),!h.k&&n&&c.a.createElement(be.a,{size:"tiny",ripple:!0,fluid:!0,onClick:E},S("BotStart")),!h.k&&r&&c.a.createElement(be.a,{round:!0,ripple:b,color:"translucent",size:"smaller",onClick:M,ariaLabel:"Search in this chat"},c.a.createElement("i",{className:"icon-search"})),(h.k||!o)&&c.a.createElement(be.a,{ref:j,className:g?"active":"",round:!0,ripple:!h.k,size:"smaller",color:"translucent",disabled:a,ariaLabel:"More actions",onClick:v},c.a.createElement("i",{className:"icon-more"})),p&&c.a.createElement(nt,{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}))})),ot=a(114),rt=a(24),it=a(107),lt=a(45);function dt(e){const t=e&&Object(l.F)(e),{sticker:a}=e&&e.content||{},s=t&&a&&!Object(h.s)()&&t.includes("image/webp"),[o,r]=Object(c.r)(lt.a),i=e&&e.id;return Object(c.o)(()=>{s&&Object(lt.c)("b64-"+i,t).then(r).catch(e=>{n.q&&console.error(e)})},[i,s,t]),s?o:t}var bt=a(116),ut=a(43);function mt(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 ht=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=mt(0,0,2,t,1)+mt(0,12,2,t+1,1)+mt(0,25,2,t,1);else for(let e=0;e<a;e++)s+=mt(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(ee.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 Ot=Object(c.h)(({message:e,count:t,index:a,customTitle:s,className:n,onUnpinMessage:o,onClick:r,onAllPinnedClick:i})=>{const d=Object(re.a)(),b=dt(e),u=Object(it.a)(Object(l.E)(e,"pictogram")),m=Object(l.O)(d,e,Boolean(b)),[h,O,j]=Object(oe.a)(),g=Object(c.m)(()=>{j(),o&&o(e.id)},[j,o,e.id]);return c.a.createElement("div",{className:Object(ee.a)("HeaderPinnedMessage-wrapper",n)},t>1&&c.a.createElement(be.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(be.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(bt.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(ht,{count:t,index:a}),b&&function(e,t){const{width:a,height:s}=Object(ot.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(rt.a)(m))),c.a.createElement(ut.a,null)))}),jt=a(55),gt=a(175);a(215);var ft=Object(s.h)((e,{message:t})=>({sender:Object(r.vb)(e,t)}),(e,t)=>Object(m.l)(t,["focusMessage","closeAudioPlayer"]))(({message:e,className:t,noUi:a,sender:s,focusMessage:n,closeAudioPlayer:o})=>{const r=Object(re.a)(),i=s?Object(l.X)(r,s):void 0,d=jt.c(Object(l.E)(e,"inline")),{playPause:b,isPlaying:u}=Object(gt.a)(Object(l.C)(e),Object(l.q)(e),d,void 0,void 0,!0),m=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(ee.a)("AudioPlayer",t),dir:r.isRtl?"rtl":void 0},c.a.createElement(be.a,{round:!0,ripple:!h.k,color:"translucent",size:"smaller",className:Object(ee.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:m},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(rt.a)(t||s)),a&&c.a.createElement("div",{className:"subtitle",dir:"auto"},Object(rt.a)(a)))}(j):function(e,t){return c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"title",dir:"auto"},t&&Object(rt.a)(t)),c.a.createElement("div",{className:"subtitle",dir:"auto"},e))}(r("AttachAudio"),i),c.a.createElement(ut.a,null)),c.a.createElement(be.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 pt=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.Gb)(e,t,a);let j;if("pinned"===s){const a=Object(r.kb)(e,t);j=a&&a.length}else if("scheduled"===s){const a=Object(r.qb)(e,t);j=a&&a.length}else if("thread"===s&&a!==b.MAIN_THREAD_ID){const s=Object(r.Fb)(e,t,a);s&&(j=s.messagesCount)}const g={typingStatus:d,isLeftColumnShown:n,isRightColumnShown:Object(r.X)(e),isSelectModeActive:Object(r.T)(e),audioMessage:h,chat:l,chatsById:i,originChatId:O?O.id:t,messagesCount:j,isChatWithSelf:Object(r.Q)(e,t),isChatWithBot:l&&Object(r.P)(e,l),lastSyncTime:c,notifySettings:Object(r.fb)(e),notifyExceptions:Object(r.eb)(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.Hb)(e,t,a),n=s?Object(r.l)(e,t,s):void 0,c=n?Object(r.L)(e,n):void 0;return{...g,pinnedMessageIds:s,canUnpin:!1,topMessageSender:c}}const p=Object(r.kb)(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(m.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:m,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(re.a)(),[D,F]=Object(c.r)(0),B=Array.isArray(o)?o[D]:o,H=r&&B?r[B]:void 0,U=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(Ze.a)(e,B,H);const{width:_}=Qe(),z=_<=n.ab,W=h.l&&O,$=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]),J=Object(c.m)(()=>{if(H){T({chatId:H.chatId,threadId:t,messageId:H.id});const e=Object(Xe.a)(U,D+1);F(e)}},[H,T,t,U,D]),Y=Object(c.m)(()=>{P({id:e,threadId:b.MAIN_THREAD_ID,type:"pinned"})},[P,e]),X=Object(c.m)(e=>{if(h.k){const e=document.getElementById(n.w);e&&e.blur()}t!==b.MAIN_THREAD_ID||"thread"!==a?("scheduled"===a&&m&&R(),P({id:I,threadId:b.MAIN_THREAD_ID})):h.k||W?(e.stopPropagation(),P({id:void 0})):x()},[P,I,t,a,x,m,R,W]),Z=Object(c.p)(()=>{if(!z||!p)return;let e=!1;const t=Object.values(p).reduce((t,a)=>{if(Object(l.jb)(a))return t;const s=a.unreadCount||0;return!s||Object(l.Gb)(a,E,M)&&!a.unreadMentionsCount||(e=!0),t+s},0);return t?{isActive:e,totalCount:t}:void 0},[z,p,E,M]),ae=_>=n.ab&&_<n.lb||_>n.eb&&_<n.ab&&(!q||q>30),se=ae||_>n.bb&&_<n.mb,{shouldRender:ne,transitionClassNames:oe}=Object(te.a)(Boolean(g)),ie=Object(et.a)(g),{shouldRender:le,transitionClassNames:de}=Object(te.a)(H&&!ne),ue=Object(et.a)(H),me=Object(et.a)(G),he=le&&ue||ne&&ie;function Oe(){return"thread"===a&&t===b.MAIN_THREAD_ID?c.a.createElement(c.a.Fragment,null,z&&je(W,Z),c.a.createElement("div",{className:"chat-info-wrapper",onClick:K},Object(l.nb)(e)?c.a.createElement(at.a,{userId:e,typingStatus:u,withFullInfo:C,withMediaViewer:!0,withUpdatingStatus:!0,noRtl:!0}):c.a.createElement(st.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(be.a,{round:!0,size:"smaller",color:"translucent",onClick:X,ariaLabel:e?"Close":"Back"},c.a.createElement("div",{className:Object(ee.a)("animated-close-icon",!e&&"state-back")})),t&&c.a.createElement("div",{className:"unread-count "+(t.isActive?"active":"")},Object(tt.b)(t.totalCount)))}return Object(c.n)(()=>{const e=$.current;if(e)return se&&he?void(j||ae?(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,ae,j]),c.a.createElement("div",{className:"MiddleHeader",ref:$},c.a.createElement(ce.a,{name:S?"none":"slide-fade",activeKey:"thread"===a?t:1},Oe),c.a.createElement("div",{className:"header-tools"},le&&ue&&!ne&&c.a.createElement(Ot,{key:e,message:ue,count:U,index:D,customTitle:me,className:de,onUnpinMessage:i?Q:void 0,onClick:J,onAllPinnedClick:Y}),ne&&ie&&c.a.createElement(ft,{key:Object(l.C)(ie),message:ie,className:oe}),c.a.createElement(ct,{chatId:e,threadId:t,messageListType:a})))})),It=a(159);function vt(e){return"albumId"in e}function yt(e,t){let a,s=[],n={originalDate:e[0].date,datetime:Number(Object(R.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(R.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.fb)(o)||Object(l.fb)(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 Ct(e){!h.k&&document.activeElement&&document.activeElement.id===n.w&&e.target===e.currentTarget&&e.preventDefault()}var wt=a(106);function Et(){const[e,t]=Object(oe.a)(!1),a=(s=1e3,n=!1,Object(c.p)(()=>Object(f.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(f.b)(()=>{document.body.classList.add("is-scrolling-messages")}),a(()=>{Object(f.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 Mt=a(154),St=a(125);var kt=({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(wt.a)({rootRef:e,margin:n.V},t=>{if(!s||!o)return;const a=t.find(({isIntersecting:e})=>e);if(!a)return;const{target:n}=a;"backwards-trigger"===n.className?(Object(Mt.a)(e.current),o()):"forwards-trigger"===n.className&&(Object(Mt.a)(e.current),s())});Object(wt.c)(u,j),Object(wt.c)(m,j);const{observe:g,freeze:f,unfreeze:p}=Object(wt.a)({rootRef:e,margin:50},O);Object(wt.c)(h,g);const{observe:I,freeze:v,unfreeze:y}=Object(wt.a)({rootRef:e},O);return Object(wt.c)(h,I),Object(Ie.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"}))},Nt=a(144),Tt=a(145);function Pt(e){return"number"==typeof e}function At(e,t){return e?t?238:175:100}function xt(e,t){const a=Object(l.xb)(e),s=Object(l.sb)(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(ot.g)(n,a,s,o,t):Object(ot.i)(c,a,s,t),d=At(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 Rt=0,Lt=1,Dt=2,Ft=4,Bt=8;function Ht(e,t){return e.reduce((e,t)=>e+t,t)}function Ut(e,t,a){return e<t?t:e>a?a:e}function qt(e){const t={width:0,height:0};return e.forEach(({dimensions:e,sides:a})=>{a&Dt&&(t.width=e.width+e.x),a&Ft&&(t.height=e.height+e.y)}),t}function Gt(e,t,a,s){const n=s.messages.map(e=>{const t=xt(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(ot.j)(e,t,!1,a)-(t?2.5:0)*ot.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?Ut(e,1,2.75):Ut(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=Rt|(0===e?Lt:Rt)|(e===O-1?Ft:Rt)|(0===l?Bt:Rt)|(l===t-1?Dt:Rt),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:Bt|Lt|Dt},{dimensions:{x:0,y:c+s,width:a,height:c},sides:Bt|Ft|Dt}]}(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:Lt|Bt|Ft},{dimensions:{x:c+s,y:0,width:c,height:o},sides:Lt|Dt|Ft}]}(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:Lt|Bt|Ft},{dimensions:{x:i+n,y:0,width:r,height:l},sides:Lt|Dt|Ft}]}(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:Lt|Bt|Ft},{dimensions:{x:d+a,y:0,width:l,height:i},sides:Lt|Dt},{dimensions:{x:d+a,y:i+a,width:l,height:r},sides:Ft|Dt}]}(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:Bt|Lt|Dt},{dimensions:{x:0,y:o+n,width:r,height:i},sides:Ft|Bt},{dimensions:{x:r+n,y:o+n,width:c-r-n,height:i},sides:Ft|Dt}]}(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:Bt|Lt|Dt},{dimensions:{x:0,y:o+a,width:i,height:b},sides:Ft|Bt},{dimensions:{x:i+a,y:o+a,width:d,height:b},sides:Ft},{dimensions:{x:i+a+d+a,y:o+a,width:l,height:b},sides:Dt|Ft}]}(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:Lt|Bt|Ft},{dimensions:{x:o+s,y:0,width:b,height:i},sides:Lt|Dt},{dimensions:{x:o+s,y:i+s,width:b,height:l},sides:Dt},{dimensions:{x:o+s,y:i+l+2*s,width:b,height:d},sides:Ft|Dt}]}(e)}(b),{layout:d,containerStyle:qt(d)}}let _t;function zt(e){return _t||(_t=document.createElement("span"),_t.style.font='400 12px "Roboto", -apple-system, "Apple Color Emoji", BlinkMacSystemFont, "Helvetica Neue", sans-serif',_t.style.whiteSpace="nowrap",_t.style.position="absolute",_t.style.left="-999px",_t.style.opacity=".01",document.body.appendChild(_t)),_t.innerHTML=e,_t.offsetWidth}function Wt(e,t,a,s,n){Object(c.o)(()=>{if(a&&e.current){const t=e.current.closest(".MessageList");Object(St.a)(t,e.current,n?"end":"centerOrTop",20,void 0===s?1200:1e3,s)}},[e,t,a,s,n])}var $t=a(111),Vt=a(68);var Kt=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(ke.a)(Se.a.Extra,"ContextMenuContainer",!t);return a?c.a.createElement(a,e):void 0});var Qt=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.V)(e,t),{direction:d,noHighlight:b}=i&&e.focusedMessage||{},u=Object(r.g)(e,t.chatId);return{sender:u&&(Object(l.lb)(u)||a===t.chatId)?u:a?Object(r.Jb)(e,a):void 0,...s&&{targetUser:Object(r.Jb)(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(wt.c)(m,t),Object(Ze.a)(e.chatId,e.replyToMessageId,i),Wt(m,e.chatId,d,b,u);const h=Object(re.a)(),O=s<=0,[j,g]=Object(oe.a)(O);Object(c.n)(()=>{O||setTimeout(g,10*s)},[s,g,O]);const{transitionClassNames:f}=Object(te.a)(j,void 0,O,!1),p=Object(Vt.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(Nt.a)(m),M=void 0!==v;if(a)return c.a.createElement("span",{className:"embedded-action-message"},Object(rt.a)(p));const S=Object(ee.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=>{Ct(e),y(e)},onContextMenu:C},c.a.createElement("span",null,p),v&&c.a.createElement(Kt,{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(wt.b)(i,o),b=Object(it.a)(t&&Object(l.E)(t,"pictogram"),!d),u=t&&"sticker-reply-thumb"+t.id,m=dt(t),h=Boolean(t&&Object(l.J)(t)),O=Object(re.a)(),j=a&&Object(l.X)(O,a);return c.a.createElement("div",{ref:i,className:Object(ee.a)("EmbeddedMessage",e),onClick:t?r:void 0},m&&function(e,t,a,s){const{width:n,height:o}=Object(ot.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.fb)(t)?c.a.createElement(Qt,{message:t,isEmbedded:!0}):Object(rt.a)(Object(l.O)(O,t,Boolean(m))):n||" "),c.a.createElement("div",{className:"message-title",dir:"auto"},Object(rt.a)(j||s||" "))))},Yt=a(160),Xt=a(167),Zt=a(172);a(221);var ea=Object(c.h)(({message:e,outgoingStatus:t,signature:a,onClick:s})=>{const n=Object(re.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(tt.b)(e.views)),c.a.createElement("i",{className:"icon-channelviews"})),a&&c.a.createElement("span",{className:"message-signature"},Object(rt.a)(a)),c.a.createElement("span",{className:"message-time"},e.isEdited&&n("EditedMessage")+" ",Object(R.h)(1e3*e.date)),t&&c.a.createElement(Zt.a,{status:t}))}),ta=a(113),aa=a(115),sa=a(161);a(222);var na=({message:e,observeIntersection:t,observeIntersectionForPlaying:a,shouldLoop:s,lastSyncTime:o})=>{const r=Object(c.q)(null),[i,d,b]=Object(oe.a)(),u=e.content.sticker,{isAnimated:m,stickerSetId:h}=u,O=h===n.T,j=Object(wt.b)(r,t),g=Object(wt.b)(r,a),f=u.isPreloadedGlobally?"sticker"+u.id:Object(l.E)(e,"inline"),p=dt(e),I=Object(it.a)(f,!j,Object(l.D)(e,"inline",!0),o),v=Boolean(I),[y,C]=Object(oe.a)(v),w=m?y:v,{shouldRenderFullMedia:E,transitionClassNames:M}=Object(ta.a)(w,"slow"),{width:S,height:k}=Object(ot.n)(u),N=Object(ee.a)("thumbnail",!p&&"empty"),T=Object(ee.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(ee.a)("full-media",M)}),m&&v&&c.a.createElement(aa.a,{key:f,className:Object(ee.a)("full-media",M),id:f,animationData:I,size:S,play:g,noLoop:!s,onLoad:C}),c.a.createElement(sa.a,{isOpen:i,fromSticker:u,onClose:b}))},ca=a(128),oa=a(119),ra=a(162);function ia(e,t){return Object(ra.a)(Object(l.F)(e),Boolean(t),h.k&&!h.c)}var la=a(27);const da=Promise.resolve("rgba(255,255,255,1)");function ba(e,t,a,s){return s?da: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 ua=a(120);var ma=({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(wt.b)(j,a),[p,I]=Object(c.r)(n),v=p&&f,{mediaData:y,downloadProgress:C}=Object(oa.a)(Object(l.E)(t,d),!v),w=g||y,E=ia(t,w),{isUploading:M,isTransferring:S,transferProgress:k}=Object(l.r)(t,i||C,v&&!w),N=!1===Object(la.a)(p),{shouldRender:T,transitionClassNames:P}=Object(te.a)(S,void 0,N,"slow"),{shouldRenderThumb:A,shouldRenderFullMedia:x,transitionClassNames:R}=Object(ta.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.xb)(t);Object(c.o)(()=>{if(!m)return;const e=j.current.closest(".message-content");w?ba(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:H}=b||xt(t,s),U=Object(ee.a)("media-inner",!M&&!u&&"interactive",H&&"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:U,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(ua.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),"%"))},ha=a(136),Oa=a(135);function ja(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(Oa.a)(e.current)},[e]);Object(Z.a)(s,n)}var ga=a(146),fa=(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(Oa.a)(e.current),a.current=!1,s.current=!1},[t,e]),r=Object(c.m)(()=>{Object(f.b)(o)},[o]);document.hasFocus()||n(),Object(ae.a)(n,r)};function pa(){return(pa=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 Ia=({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(wt.b)(m,a),[f,p]=Object(c.r)(n),I=Boolean(f&&g&&i),[v,y]=Object(c.r)(o),C=Object(it.a)(Object(l.E)(t,"pictogram"),!(g&&i),Object(l.D)(t,"pictogram"),i),w=ia(t),{mediaData:E,downloadProgress:M}=Object(oa.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(ha.a)(!n),{isUploading:P,isTransferring:A,transferProgress:x}=Object(l.r)(t,r||M,I&&!N),L=!1===Object(la.a)(f),{shouldRender:D,transitionClassNames:F}=Object(te.a)(A,void 0,L),{shouldRenderThumb:B,transitionClassNames:H}=Object(ta.a)(S,"slow"),[U,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.xb)(t),W=Object(l.sb)(t),{width:$,height:V}=d||Object(ot.i)(O,z,W,s);ja(h,Boolean(k&&o)),fa(h,v),Object(ga.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(ee.a)("media-inner dark",!P&&"interactive"),J=Object(ee.a)("full-media",H),Y=d?`width: ${$}px; height: ${V}px; left: ${d.x}px; top: ${d.y}px;`:"",X=k,Z=f&&!v&&!D,ae=!f;return c.a.createElement("div",{ref:m,id:e,className:Q,style:Y,onClick:P?void 0:K},(!k||B||X)&&c.a.createElement("canvas",{ref:w,className:"thumbnail",style:`width: ${$}px; height: ${V}px;`}),C&&c.a.createElement("img",{src:C,className:"thumbnail",style:`width: ${$}px; height: ${V}px;`,alt:""}),X&&c.a.createElement("video",pa({ref:h,className:J,width:$,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(ua.a,{progress:x,onClick:P?K:void 0})),ae&&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(R.e)(Math.max(_-U,0))))},va=a(18);a(224);var ya=Object(s.h)((e,{contact:t})=>({user:Object(r.Jb)(e,t.userId)}),(e,t)=>Object(m.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(ee.a)("Contact",Boolean(r)&&"interactive"),onClick:r?i:void 0},c.a.createElement($t.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(va.c)(o))))}),Ca=a(47);var wa=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(Ca.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})))}),Ea=a(121),Ma=a(180);a(227);function Sa(e,t){return t>0?(e/t*100).toFixed():0}var ka=({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?Sa(r.votersCount,a||0):0,[b,u]=Object(c.r)(o?0:d),m=Object(c.q)(null),h=r?Sa(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(ee.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(rt.a)(e.text)),c.a.createElement("div",{className:Object(ee.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 Na=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(m.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(R.e)(v),a.firstElementChild.setAttribute("stroke-dashoffset","-"+e)}else e.innerHTML=`\n <span>${Object(R.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]),L=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]),H=Object(c.m)(()=>{f(!0)},[]),U=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(re.a)();return c.a.createElement("div",{className:"Poll",dir:q.isRtl?"auto":"ltr"},g&&t.results.solution&&c.a.createElement(Ma.a,{message:Object(Tt.b)(t.results.solution,t.results.solutionEntities),duration:5e3,onDismiss:U,containerId:"#middle-column-portals"}),c.a.createElement("div",{className:"poll-question"},Object(rt.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($t.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(be.a,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:g,onClick:H,ariaLabel:"Show Solution"},c.a.createElement("i",{className:"icon-lamp"}))),S&&c.a.createElement("div",{className:"poll-answers"},N?c.a.createElement(wa,{options:A,onChange:D,disabled:e.isScheduled||m,loadingOptions:m?O:void 0,round:!0}):c.a.createElement(Ea.a,{name:"poll-"+l,options:A,onChange:L,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(ka,{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(be.a,{isText:!0,disabled:0===O.length,size:"tiny",onClick:F},q("PollSubmitVotes")),k&&c.a.createElement(be.a,{isText:!0,size:"tiny",onClick:B},q("PollViewResults")))})),Ta=a(40),Pa=a(58);a(229);var Aa=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}=xt(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(Ta.a)(f,170),C=Object(ee.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(ma,{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(Pa.a,{className:"site-name",url:O,text:h||j}),!o&&g&&c.a.createElement("p",{className:"site-title"},Object(rt.a)(g)),y&&c.a.createElement("p",{className:"site-description"},Object(rt.a)(y,["emoji","br"]))),!o&&I&&c.a.createElement(Ia,{message:e,observeIntersection:t,noAvatars:a,shouldAutoLoad:s,shouldAutoPlay:n,lastSyncTime:r,onClick:v?m:void 0,onCancelUpload:d}))});a(230);var xa=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(rt.a)(a)),s&&c.a.createElement("p",null,Object(rt.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(rt.a)(n,["emoji","br"]))))});function Ra(e){return Object(c.h)(Object(s.h)((e,t)=>{const{message:a}=t;return{isInSelectMode:Object(r.T)(e),isSelected:Object(r.W)(e,a.id)}},(e,t)=>Object(m.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(ee.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 La=Ra(ma),Da=Ra(Ia);var Fa=Object(s.h)(e=>({uploadsById:e.fileUploads.byMessageLocalId}),(e,t)=>Object(m.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&Bt&&I&Ft));return c.a.createElement(La,{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(Da,{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 Ba(){return(Ba=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 Ua=({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(wt.b)(o,t),[u,m]=Object(c.r)(a&&s),h=Boolean(u&&b&&n),{mediaData:O,downloadProgress:j}=Object(oa.a)(Object(l.E)(e,"inline"),!h,Object(l.D)(e,"inline"),n),g=ia(e,O),{isBuffered:f,bufferingHandlers:p}=Object(ha.a)(),I=u&&!f,v=!1===Object(la.a)(u),{shouldRender:y,transitionClassNames:C}=Object(te.a)(I||!f,void 0,v),{shouldRenderThumb:w,transitionClassNames:E}=Object(ta.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(Oa.a)(i.current),requestAnimationFrame(()=>{r.current.innerHTML=""})},A=(x=P,()=>{Ha&&Ha(),Ha=x});var x;Object(c.n)(()=>{i.current&&(T?Object(Oa.a)(i.current):i.current.pause())},[T]),ja(i,T),fa(i,Boolean(O)),Object(ga.a)(i,[O]);const L=Object(c.m)(()=>{if(!O)return void m(e=>!e);const e=i.current;M?e.paused?Object(Oa.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(ee.a)("full-media",E);return c.a.createElement("div",{ref:o,className:"RoundVideo media-inner",onClick:L},(w||O)&&c.a.createElement("div",{className:"thumbnail-wrapper"},c.a.createElement("canvas",{ref:g,className:"thumbnail",style:`width: ${ot.e}px; height: ${ot.e}px`})),O&&c.a.createElement("div",{className:"video-wrapper"},c.a.createElement("video",Ba({ref:i,className:F,width:ot.e,height:ot.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(ua.a,{progress:j})),!O&&!u&&c.a.createElement("i",{className:"icon-large-play"}),c.a.createElement("div",{className:"message-media-duration"},M?Object(R.e)(i.current.currentTime):Object(R.e)(d.duration),(!M||i.current.paused)&&c.a.createElement("i",{className:"icon-muted-chat"})))};a(233);var qa=({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(be.a,{size:"tiny",ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>t({button:e})},e.text,"url"===e.type&&!e.value.match(n.kb)&&c.a.createElement("i",{className:"icon-arrow-right"}))))));a(234);var Ga=Object(c.h)(Object(s.h)((e,{message:t})=>{const{threadId:a,chatId:s}=t.threadInfo,n=Object(r.Fb)(e,s,a)||t.threadInfo,{byId:c}=e.users,{byId:o}=e.chats;return{threadInfo:n,usersById:c,chatsById:o}},(e,t)=>Object(m.l)(t,["openChat"]))(({disabled:e,threadInfo:t,usersById:a,chatsById:s,openChat:n})=>{const o=Object(re.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.nb)(e)?a[e]:s[e]).filter(Boolean);const j=Boolean(u&&b&&u<b);return c.a.createElement("div",{"data-cnt":Object(tt.b)(d),className:Object(ee.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($t.a,{key:e.id,size:"small",user:Object(l.nb)(e.id)?e:void 0,chat:Object(l.nb)(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 _a(e){const t=Wa(e.currentTarget);t&&t.setAttribute("data-is-document-group-hover","")}function za(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 $a=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.Q)(e,h),I=f&&Object(l.lb)(f),v=!p&&Object(l.gb)(c),y=i||d||v?Object(r.vb)(e,c):void 0,C=Object(r.L)(e,c),w=O?Object(r.Jb)(e,O):void 0,E=b?Object(r.Hb)(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.vb)(e,k),T=Object(r.Ib)(e,c),P="thread"===u&&(o?o.messages.some(t=>Object(r.V)(e,t)):Object(r.V)(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.W)(e,t)):Object(r.W)(e,m),{theme:Object(r.Db)(e),forceSenderName:v,sender:y,originSender:C,botSender:w,shouldHideReply:S,isThreadTop:M,replyMessage:k,replyMessageSender:N,...g&&{outgoingStatus:Object(r.gb)(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.T)(e),isSelected:F,isGroupSelected:!!c.groupedId&&!c.isInAlbum&&Object(r.R)(e,h,c.groupedId),threadId:b,isPinnedList:"pinned"===u,shouldAutoLoadMedia:f?Object(r.wb)(e,c,f,y):void 0,shouldAutoPlayMedia:Object(r.xb)(e,c),shouldLoopStickers:Object(r.yb)(e)}},(e,t)=>Object(m.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:m,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:H,isInSelectMode:U,isSelected:q,isGroupSelected:G,threadId:_,messageListType:z,isPinnedList:W,shouldAutoLoadMedia:$,shouldAutoPlayMedia:V,shouldLoopStickers:K,focusMessage:Q,openMediaViewer:J,openAudioPlayer:Y,openUserInfo:X,openChat:Z,cancelSendingMessage:ae,markMessagesRead:se,sendPollVote:ne,toggleMessageSelection:ce,setReplyingToId:ie,openForwardMenu:le,clickInlineButton:de,disableContextMenuHint:ue})=>{const me=Object(c.q)(null),he=Object(c.q)(null),Oe=Object(c.q)(null);Object(wt.c)(he,t);const{isContextMenuOpen:je,contextMenuPosition:ge,handleBeforeContextMenu:fe,handleContextMenu:pe,handleContextMenuClose:Ie,handleContextMenuHide:ve}=Object(Nt.a)(me,!1,!0);Object(c.n)(()=>{je&&ue()},[je,ue]);const ye=m<=0,[Ce,we]=Object(oe.a)(ye);Object(c.n)(()=>{ye||setTimeout(we,10*m)},[m,we,ye]);const{transitionClassNames:Ee}=Object(te.a)(Ce,void 0,ye,!1),{chatId:Me,id:Se,threadInfo:ke}=e,Ne=Object(l.wb)(e),Te=Object(l.xb)(e),Pe="scheduled"===z||e.isScheduled,Ae=Object(l.yb)(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:He,photo:Ue,video:qe,audio:Ge,voice:_e,document:ze,sticker:We,contact:$e,poll:Ve,webPage:Ke,invoice:Qe}=Object(l.v)(e),Je=Object(l.x)(e),Ye=Object(Tt.a)(e,B,Pt(Je)),Xe=void 0!==ge,et=D&&e.adminTitle||Re&&!De&&Re.adminTitle||void 0,tt=Object(c.p)(()=>et?zt(et):void 0,[et]),at=!(Xe||U||R)&&(!Fe||f),st=at&&D&&!Pe,nt=Boolean(at&&(Re&&(Re.isChannelPost||L&&!Te)&&Re.fromMessageId||W)),ct=!Re||!L&&y?y:C,it=Re?C:y,lt=Object(ee.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",U&&"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 Pt(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:Je,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(Ze.a)(Me,Ae?e.replyToMessageId:void 0,S,e.id),Wt(me,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)(()=>{ie({messageId:Se})},[ie,Se]),jt=Object(c.m)(e=>{e.stopPropagation()},[]),gt=Object(c.m)(()=>{ct&&(Object(l.nb)(ct.id)?X({id:ct.id}):Z({id:ct.id}))},[ct,X,Z]),ft=Object(c.m)(()=>{it&&(Object(l.nb)(it.id)?X({id:it.id}):Z({id:it.id}))},[it,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)(()=>{J({chatId:Me,threadId:_,messageId:Se,origin:Pe?u.h.ScheduledInline:u.h.Inline})},[Me,_,Se,J,Pe]),yt=Object(c.m)(()=>{Y({chatId:Me,messageId:Se})},[Me,Se,Y]),Et=Object(c.m)(e=>{J({chatId:Me,threadId:_,messageId:e,origin:Pe?u.h.ScheduledAlbum:u.h.Album})},[Me,_,J,Pe]),Mt=Object(c.m)(e=>{const t=e.target;(t.classList.contains("text-content")||t.classList.contains("Message"))&&(h.b?setTimeout(()=>{pe(e)},150):pe(e))},[pe]),St=Object(c.m)(()=>{se({messageIds:[Se]})},[Se,se]),kt=Object(c.m)(()=>{ae({chatId:Me,messageId:Se})},[ae,Me,Se]),Rt=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]),Ht=Object(re.a)();let Ut,qt="",_t=!1;const Vt=Object(c.p)(()=>Be?Gt(Te,Boolean(De),Boolean(o),n):void 0,[Be,Te,De,o,n]),Qt=De?28:0;if(Be||!Ue&&!qe)Vt&&(Ut=Math.max(At(Boolean(He),bt),Vt.containerStyle.width),Ut-Vt.containerStyle.width>18&&(_t=!0));else{let t;Ue?t=xt(e,o).width:qe&&(t=qe.isRound?ot.e:xt(e,o).width),t&&(Ut=Math.max(At(Boolean(He),bt),t),Ut-t>18&&(_t=!0))}return Ut&&(qt=`width: ${Ut+Qt}px`),c.a.createElement("div",{ref:me,id:"message"+Se,className:lt,style:tt?`--meta-safe-author-width: ${tt}px`:void 0,"data-message-id":Se,onClick:U?ht:h.b?Mt:void 0,onDoubleClick:U?void 0:Ot,onMouseDown:U?void 0:e=>{Ct(e),Ne||fe(e)},onContextMenu:U||Ne?void 0:pe,onMouseEnter:Fe&&!f?_a:void 0,onMouseLeave:Fe&&!f?za: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(ee.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.nb)(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($t.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:U&&Fe?ht:void 0},c.a.createElement("div",{className:dt,style:qt,dir:"auto"},De&&!Je&&(!Fe||g)&&c.a.createElement("div",{className:"message-title"},Ht("ForwardedMessage")),function(){const t=Object(ee.a)("content-inner",De&&!Je&&"forwarded-message",Ae&&"reply-message",_t&&"no-media-corners"),r=j&&!Ye&&!De&&!xe,d=!Ke&&!H&&Ye;return c.a.createElement("div",{className:t,onDoubleClick:jt,dir:"auto"},function(){if(Je||!(i&&!Ue&&!qe||De||Le||v)||Fe&&!g)return;let t,a;it?(t=Object(l.X)(Ht,it),De||(a="color-"+Object(l.Z)(it))):Re&&Re.hiddenUserName&&(t=Re.hiddenUserName);return c.a.createElement("div",{className:"message-title",dir:"ltr"},t?c.a.createElement("span",{className:Object(ee.a)(it&&"interactive",a),onClick:it?ft:void 0,dir:"auto"},Object(rt.a)(t)):w?void 0:" ",w&&c.a.createElement(c.a.Fragment,null,c.a.createElement("span",{className:"via"},Ht("ViaBot")),c.a.createElement("span",{className:"interactive",onClick:pt},Object(rt.a)("@"+w.username))),Re&&Re.isLinkedChannelPost?c.a.createElement("span",{className:"admin-title",dir:"auto"},Ht("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}),We&&c.a.createElement(na,{message:e,observeIntersection:a,observeIntersectionForPlaying:s,shouldLoop:K,lastSyncTime:F}),H&&c.a.createElement(ca.a,{isInline:!0,sticker:H,observeIntersection:a,lastSyncTime:F,forceLoadPreview:Ne}),Be&&c.a.createElement(Fa,{album:n,albumLayout:Vt,observeIntersection:a,shouldAutoLoad:$,shouldAutoPlay:V,isOwn:Te,hasCustomAppendix:r,lastSyncTime:F,onMediaClick:Et}),!Be&&Ue&&c.a.createElement(ma,{message:e,observeIntersection:a,noAvatars:o,shouldAutoLoad:$,uploadProgress:T,shouldAffectAppendix:r,onClick:vt,onCancelUpload:kt}),!Be&&qe&&qe.isRound&&c.a.createElement(Ua,{message:e,observeIntersection:a,shouldAutoLoad:$,shouldAutoPlay:V,lastSyncTime:F}),!Be&&qe&&!qe.isRound&&c.a.createElement(Ia,{message:e,observeIntersection:a,noAvatars:o,shouldAutoLoad:$,shouldAutoPlay:V,uploadProgress:T,lastSyncTime:F,onClick:vt,onCancelUpload:kt}),(Ge||_e)&&c.a.createElement(Xt.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(Yt.a,{message:e,observeIntersection:a,uploadProgress:T,isSelectable:Fe,isSelected:q,onMediaClick:vt,onCancelUpload:kt}),$e&&c.a.createElement(ya,{contact:$e}),Ve&&c.a.createElement(Na,{message:e,poll:Ve,onSendVote:Rt}),!H&&Ye&&c.a.createElement("p",{className:"text-content "+(d?"with-meta":""),dir:"auto"},Ye,d&&c.a.createElement(ea,{message:e,outgoingStatus:N,signature:et,onClick:ht})),Ke&&c.a.createElement(Aa,{message:e,observeIntersection:a,noAvatars:o,shouldAutoLoad:$,shouldAutoPlay:V,lastSyncTime:F,onMediaClick:vt,onCancelMediaTransfer:kt}),Qe&&c.a.createElement(xa,{message:e}))}(),(!Fe||f)&&!(!Ke&&!H&&Ye)&&c.a.createElement(ea,{message:e,outgoingStatus:N,signature:et,onClick:ht}),st?c.a.createElement(be.a,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:Ht("lng_context_forward_msg"),onClick:f?Lt:Dt},c.a.createElement("i",{className:"icon-share-filled"})):nt?c.a.createElement(be.a,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:W?Ft:Bt},c.a.createElement("i",{className:"icon-arrow-right"})):void 0,bt&&c.a.createElement(Ga,{message:e,disabled:d}),ut&&c.a.createElement("div",{className:"svg-appendix",ref:Oe})),e.inlineButtons&&c.a.createElement(qa,{message:e,onClick:de})),ge&&c.a.createElement(Kt,{isOpen:je,anchor:ge,message:e,album:n,messageListType:z,onClose:Ie,onCloseAnimationEnd:ve}))}));a(236);const Va=h.b?1e3:350,Ka=h.k?300:500,Qa=Object(f.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.sb)(e,t):Object(r.n)(e,t),i=Object(r.Hb)(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.J)(e,t),O=a===b.MAIN_THREAD_ID&&!c&&!n.unreadCount&&!h&&m&&!m.groupedId;let j;if(Object(r.M)(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.lb)(n),isChatWithSelf:Object(r.Q)(e,t),messageIds:c,messagesById:o,firstUnreadId:Object(r.I)(e,t,a),isViewportNewest:"thread"!==s||Object(r.Y)(e,t,a),threadFirstMessageId:Object(r.H)(e,t,a),focusingId:h,isSelectModeActive:Object(r.T)(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(m.l)(t,["loadViewportMessages","markMessageListRead","markMessagesRead","setScrollOffset","openHistoryCalendar"]))(({chatId:e,threadId:t,type:a,hasTools:o,onFabToggle:i,onNotchToggle:d,isChatLoaded:b,isChannelChat:h,canPost:O,isReady:j,isChatWithSelf:g,messageIds:p,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:L,threadTopMessageId:D,hasLinkedChat:F,openHistoryCalendar:B})=>{const H=Object(c.q)(null),U=Object(c.q)("thread"===a&&Object(r.tb)(Object(s.e)(),e,t)||0),q=Object(c.q)(),G=Object(c.q)(),_=Object(c.q)(),z=Object(c.q)(),W=Object(c.q)(),$=Object(c.q)(),V=Object(c.q)(!1),K=Object(c.q)(Boolean(x)),[Q,J]=Object(c.r)(),[Y,X]=Object(c.r)(Boolean(M)),te=Boolean(p);Object(Ie.a)(()=>{te&&Object(f.e)(()=>{K.current=!1})},[te]),Object(Ie.a)(()=>{W.current=v,z.current||(z.current=v)},[v]);const{observe:se}=Object(wt.a)({rootRef:H,throttleMs:Va,margin:Ka}),{observe:ne,freeze:ce,unfreeze:oe}=Object(wt.a)({rootRef:H},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)}),W.current&&t>=W.current&&T({maxId:t}),s.length&&P({messageIds:s})});Object(ae.a)(ce,oe),Object(Ie.a)(()=>{$.current=M},[M]);const{observe:ie}=Object(wt.a)({rootRef:H,throttleMs:Va});Object(c.n)(()=>{M?X(!0):setTimeout(()=>{X(!1)},200)},[M]);const le=Object(c.p)(()=>{if(!p||!I)return;const e=!D||p[0]&&C!==p[0]?p:[D,...p];if(!e.length)return;const t=e.map(e=>I[e]).filter(Boolean);return yt(Object(m.k)(t,["date","id"]),z.current)},[p,I,C,D]),[de,be,ue]=Object(c.p)(()=>"thread"===a?[Object(f.a)(()=>N({direction:u.e.Backwards}),1e3,!0,!1),Object(f.a)(()=>N({direction:u.e.Forwards}),1e3,!0,!1),Object(f.a)(()=>N({direction:u.e.Around}),1e3,!0,!1)]:[],[N,p]),{isScrolled:me,updateStickyDates:he}=Et(),Oe=Object(c.m)(()=>{if(V.current)return void(V.current=!1);const s=H.current;$.current||he(s,o),Qa(()=>{Object(f.b)(()=>{s.parentElement&&(U.current=s.scrollHeight-s.scrollTop,"thread"===a&&A({chatId:e,threadId:t,scrollOffset:U.current}))})})},[he,o,a,A,e,t]);Object(c.n)(()=>{if(!("ResizeObserver"in window))return;const e=new ResizeObserver(([e])=>{e.target.offsetParent&&J(e.contentRect.height)});return e.observe(H.current),()=>{e.disconnect()}},[]);const{height:je}=Qe();Object(c.n)(()=>{j&&(H.current.dataset.normalHeight=String(H.current.offsetHeight))},[je,j]),Object(c.n)(()=>{if(!ue||!b||w||M)return;const e=H.current;(!p||p.length<n.W/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&ue()},[b,p,ue,M,w]),Object(Ie.a)(()=>{if(!p||!_.current||!j)return;const e=_.current.filter(e=>p.includes(Number(e.dataset.messageId))),t=e[1]||e[0];t&&(q.current=t.id,G.current=t.getBoundingClientRect().top)},[p,y,Q,o,j]),Object(It.a)(([e,t,a])=>{const s=H.current;if(_.current=Array.from(s.querySelectorAll(".message-list-item")),!s.offsetParent)return;const c=y&&p&&p.length<n.W/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=U.current,b=_.current[_.current.length-1],u=b?b.offsetHeight:0,m=y&&t&&d-(a||l)-u<=100;let h;const O=p&&e&&p[0]!==e[0],j=p&&e&&p[p.length-1]!==e[e.length-1],g=p&&$.current===p[p.length-1];if(m&&j&&!O&&!g&&(b&&Object(f.b)(()=>{Object(St.a)(s,b,"end",20,void 0,void 0,void 0,!0)}),h=i-l,U.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(St.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(Mt.a)(s,h),$.current||(V.current=!0,Object(f.b)(()=>{V.current=!1})),U.current=Math.max(i-h,l)},[p,y,Q,o]),Object(c.n)(()=>{(!k||k>0)&&Object(Z.b)(200+n.c)},[k,S]);const ge=Object(re.a)(),fe=Boolean(e&&Object(l.nb)(e)),pe=Boolean(!fe&&!h||g),ve=Boolean(!pe||h),ye=Object(ee.a)("MessageList custom-scroll",ve&&"no-avatars",!O&&"no-composer","pinned"===a&&"type-pinned",S&&"select-mode-active",Y&&"has-focusing",me&&"scrolled",!j&&"is-animating");return c.a.createElement("div",{ref:H,className:ye,onScroll:Oe,onMouseDown:Ct},w?c.a.createElement("div",{className:"empty"},c.a.createElement("span",null,E?E.text:"This is a private "+(h?"channel":"chat"))):L?c.a.createElement("div",{className:"empty rich"},c.a.createElement("span",null,Object(rt.a)(ge(L),["br","emoji","links"]))):p&&!le?c.a.createElement("div",{className:"empty"},c.a.createElement("span",null,ge("NoMessages"))):p&&le||x?c.a.createElement(kt,{containerRef:H,className:"messages-container",messageIds:p||[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,h,O,j,g,f,p,I){const v=c.a.createElement("div",{className:Object(ee.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(m.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&&!vt(t[0])&&Object(l.fb)(t[0])){const e=t[0],s=n===f.length-1&&j===p.length-1;return Object(m.e)([e.id===b.current&&v,c.a.createElement(Qt,{key:e.id,message:e,observeIntersection:a,appearanceOrder:y-++C,isLastInList:s})])}let I;return Object(m.h)(t.map((w,E)=>{const M=vt(w)?w.mainMessage:w,S=vt(w)?w:void 0,k=Object(l.xb)(M),N=vt(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&&!vt(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"!==h?R:`${M.date}_${R}`;return Object(m.e)([M.id===b.current?v:void 0,c.a.createElement($a,{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:h,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:Ct,teactFastList:!0},c.a.createElement("div",{className:Object(ee.a)("sticky-date",!f&&"interactive"),key:"date-header",onMouseDown:Ct,onClick:f?void 0:()=>I({selectedAt:t.datetime})},c.a.createElement("span",{dir:"auto"},f&&t.originalDate===n.nb&&e("MessageScheduledUntilOnline"),f&&t.originalDate!==n.nb&&e("MessageScheduledOn",Object(R.c)(e,t.datetime,void 0,!0)),!f&&Object(R.c)(e,t.datetime))),Object(m.h)(w))});return Object(m.h)(w)}(ge,le||yt([x]),ne,se,ie,pe,ve,q,z,t,a,D,0,F,!!le&&"scheduled"===a,!le||!K.current,B)):c.a.createElement(Ne.a,{color:"white"}))}));a(237);var Ya=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(m.l)(t,["focusNextReply"]))(({isShown:e,canPost:t,messageListType:a,unreadCount:s,focusNextReply:n})=>{const o=Object(re.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(St.a)(e,a,"end",20)}},[e,a,n]),l=Object(ee.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(be.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(tt.b)(s))))})),Xa=a(129),Za=a(137);async function es(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(Ve.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),es(e,c,!0,s)):es(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(Ve.h)(n);r={width:e,height:t,duration:a}}i=await Object(Ve.c)(n)}return{blobUrl:n,filename:e,mimeType:c,size:o,quick:r,previewBlobUrl:i,...s}}var ts=a(181);let as;h.e&&(as=document.createElement("input"),as.classList.add("for-ios-autocapitalization-fix"),document.body.appendChild(as));var ss=a.p+"c0155344d336103c2b6a0b28cc510750.js";const ns={encoderPath:ss,reuseWorker:!0},cs={type:"audio/ogg"};let os,rs,is;async function ls(){return os||(os=a.e(10).then(a.t.bind(null,318,7)),rs=(await os).default,is=new rs(ns)),os}async function ds(e){await async function(){await ls(),await is.start()}();const t=Date.now();let a;const s=[],n=[];is.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}}(is,t=>{n.push(255*t),e(t)});return{stop:()=>new Promise((e,o)=>{is.onstop=()=>{e({blob:new Blob(s,cs),duration:Math.round(((a||Date.now())-t)/1e3),waveform:n})},is.onerror=o;const r=Math.max(0,t+1e3-Date.now());setTimeout(()=>{is.stop(),c()},r)}),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout(()=>{is.pause(),a=Date.now(),c()},e)}}}const bs=["image/png","image/jpeg","image/gif"];function us(e){const{text:t,entities:a}=e||{};if(!t)return"";const s=Object(Tt.b)(t,a,void 0,void 0,!0);return Array.isArray(s)?s.join(""):s}let ms,hs;var Os=a(65);var js=a(182),gs=a(190);var fs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(ke.a)(Se.a.Extra,"DeleteMessageModal",!t);return a?c.a.createElement(a,e):void 0});function ps(){return(ps=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 Is,vs=!0;var ys=Object(c.h)(({onActivate:e,...t})=>{const a=Object(c.q)(!1),s=Object(c.m)(()=>{if(a.current=!0,vs)return vs=!1,void e();Is&&(clearTimeout(Is),Is=void 0),Is=window.setTimeout(()=>{a.current&&e()},200)},[e]),n=Object(c.m)(()=>{a.current=!1},[]);return c.a.createElement(be.a,ps({},t,{onMouseEnter:h.m?void 0:s,onMouseLeave:h.m?void 0:n,onClick:h.m?e:void 0}))});var Cs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(ke.a)(Se.a.Extra,"AttachMenu",!t);return a?c.a.createElement(a,e):void 0});var ws=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(ke.a)(Se.a.Extra,"SymbolMenu",!t);return a?c.a.createElement(a,e):void 0});var Es=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(ke.a)(Se.a.Extra,"MentionTooltip",!t);return a?c.a.createElement(a,e):void 0});var Ms=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(ke.a)(Se.a.Extra,"CustomSendMenu",!t);return a?c.a.createElement(a,e):void 0});var Ss=e=>{const{isOpen:t}=e,a=Object(ke.a)(Se.a.Extra,"StickerTooltip",!t);return a?c.a.createElement(a,e):void 0},ks=a(183);var Ns=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(ke.a)(Se.a.Extra,"BotKeyboardMenu",!t);return a?c.a.createElement(a,e):void 0}),Ts=a(184),Ps=a(118);a(239);var As=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.ob)(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.L)(e,h)),O||(O=Object(r.vb)(e,h))}else m&&(O=Object(l.nb)(c)?Object(r.Jb)(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(m.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(Ps.a)([o],o?300:void 0),{shouldRender:m,transitionClassNames:h}=Object(te.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(ne.a)(O):void 0,[b,O]);const j=Object(c.m)(()=>{l({chatId:a.chatId,messageId:a.id})},[l,a]),g=Object(ee.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(be.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 xs=Object(c.h)(e=>{const{attachments:t}=e,a=Object(ke.a)(Se.a.Extra,"AttachmentModal",!t.length);return a?c.a.createElement(a,e):void 0});var Rs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(ke.a)(Se.a.Extra,"PollModal",!t);return a?c.a.createElement(a,e):void 0});var Ls=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(ke.a)(Se.a.Extra,"DropArea",!t);return a?c.a.createElement(a,e):void 0});a(240);const Ds=new RegExp(n.hb,"i");var Fs=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a})=>{const s=Object(r.db)(e,t,a);return{webPagePreview:e.webPagePreview,noWebPage:s}},(e,t)=>Object(m.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(Za.a)(a),s=t&&t.find(({type:e})=>e===b.ApiMessageEntityTypes.TextUrl);if(s)return s.url;const n=e.match(Ds);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(Ie.a)(()=>{i(),l({chatId:e,threadId:t})},[e]);const u=Boolean(n&&a.length&&!o&&!s),{shouldRender:m,transitionClassNames:h}=Object(te.a)(u),O=Object(et.a)(n);if(!m||!O)return;const{photo:j,...g}=O,f={content:{webPage:g}};return c.a.createElement("div",{className:Object(ee.a)("WebPagePreview",h)},c.a.createElement("div",null,c.a.createElement(be.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(Aa,{message:f,inPreview:!0})))})),Bs=a(123);var Hs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(ke.a)(Se.a.Extra,"CalendarModal",!t);return a?c.a.createElement(a,e):void 0});var Us=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(ke.a)(Se.a.Extra,"PaymentModal",!t);return a?c.a.createElement(a,e):void 0});var qs,Gs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(ke.a)(Se.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"}(qs||(qs={}));var _s=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const n=Object(r.g)(e,t),c=n&&Object(r.p)(e,n),o=n?Object(r.P)(e,n):void 0,i=Object(r.Q)(e,t),d=o&&Object(r.cb)(e,t),u=Object(r.qb)(e,t),{language:m}=e.settings.byKey,h=Object(r.G)(e,"en"),O="en"!==m?Object(r.G)(e,m):void 0;return{editingMessage:Object(r.E)(e,t,a,s),connectionState:e.connectionState,draft:Object(r.C)(e,t,a),chat:n,isChatWithBot:o,isChatWithSelf:i,canScheduleUntilOnline:!i&&!o&&n&&c&&Object(l.nb)(t)&&c.status&&Boolean(c.status.wasOnline),isRightColumnShown:Object(r.X)(e),isSelectModeActive:Object(r.T)(e),withScheduledButton:a===b.MAIN_THREAD_ID&&"thread"===s&&Boolean(u&&u.length),shouldSchedule:"scheduled"===s,botKeyboardMessageId:d?d.id:void 0,isForwarding:t===e.forwardMessages.toChatId,canSuggestMembers:n&&Object(l.mb)(n),isPollModalOpen:e.isPollModalOpen,stickersForEmoji:e.stickers.forEmoji.stickers,groupChatMembers:n&&n.fullInfo&&n.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:m,baseEmojiKeywords:h?h.keywords:void 0,emojiKeywords:O?O.keywords:void 0,serverTimeOffset:e.serverTimeOffset}},(e,t)=>Object(m.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:m,draft:O,chat:j,connectionState:g,isChatWithBot:p,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:L,contentToBeScheduled:D,shouldSuggestStickers:F,language:B,baseEmojiKeywords:H,emojiKeywords:U,serverTimeOffset:q,recentEmojis:G,sendMessage:_,editMessage:z,saveDraft:W,clearDraft:$,showDialog:V,setStickerSearchQuery:K,setGifSearchQuery:Q,forwardMessages:J,openPollModal:Y,closePollModal:X,loadScheduledHistory:Z,closePaymentModal:te,openChat:ce,clearReceipt:ie,addRecentEmoji:le,loadEmojiKeywords:de})=>{const ue=Object(c.q)(null),[me,he]=Object(c.r)(""),Oe=Object(c.q)(),je=Object(la.a)(e),[fe,pe,Ie]=Object(oe.a)(),[ve,ye]=Object(c.r)(),Ce=Object(re.a)(),we=Object(c.q)(me);Object(c.n)(()=>{we.current=me},[me]),Object(c.n)(()=>{Oe.current=void 0},[d]),Object(c.n)(()=>{d&&L&&u===b.MAIN_THREAD_ID&&r&&Z()},[r,d,Z,L,u]),Object(c.o)(()=>{ue.current&&(ue.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),pe())},[D,pe]);const[Ee,Me]=Object(c.r)([]),[Se,ke,Ne]=Object(oe.a)(),[Te,Pe,Ae]=Object(oe.a)(),[xe,Re,Le]=Object(oe.a)(),[De,Fe,Be]=Object(oe.a)(),[He,Ue]=Object(oe.a)(),[qe,Ge,_e]=Object(oe.a)(),{startRecordingVoice:ze,stopRecordingVoice:$e,pauseRecordingVoice:Ve,activeVoiceRecording:Ke,currentRecordTime:Qe,recordButtonRef:Je,startRecordTimeRef:Ye}=(()=>{const e=Object(c.q)(null),[t,a]=Object(c.r)(),s=Object(c.q)(),[n,o]=Object(c.r)();Object(c.n)(()=>{h.e&&ls()},[]);const r=Object(c.m)(async()=>{try{const{stop:t,pause:n}=await ds(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(ne.a)(l):void 0,[t,l]),{startRecordingVoice:r,pauseRecordingVoice:i,stopRecordingVoice:l,activeVoiceRecording:t,currentRecordTime:n,recordButtonRef:e,startRecordTimeRef:s}})(),Xe=i?qs.Edit:!h.n||Ke||me&&!Ee.length||C?qs.Send:qs.Record,Ze=!t,{isMentionTooltipOpen:et,mentionFilter:tt,closeMentionTooltip:at,insertMention:st,mentionFilteredMembers:nt}=Object(gs.a)(w&&!Ee.length,me,he,void 0,P,A,x),{isContextMenuOpen:ct,handleContextMenu:ot,handleContextMenuClose:it,handleContextMenuHide:lt}=Object(Nt.a)(Je,!(Xe===qs.Send&&Ze)),dt=Object(c.p)(()=>Object(l.b)(j,p),[j,p]),bt=j&&Object(l.ib)(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=h.d&&1===Object(Os.a)(t)||!h.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),me,T,!r),{isEmojiTooltipOpen:Ot,closeEmojiTooltip:jt,filteredEmojis:gt,insertEmoji:ft}=Object(js.a)(Boolean(F&&dt.canSendStickers&&!Ee.length),me,G,void 0,he,H,U,!r),pt=Object(c.m)((e,t=n.w)=>{const a=window.getSelection(),s=document.getElementById(t),c=Object(rt.a)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");if(a.rangeCount){const e=a.getRangeAt(0);if(Object(ts.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}`),h.k||requestAnimationFrame(()=>{Object(Xa.a)(s)})},[]),It=Object(c.m)(()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if(Object(ts.a)(t,n.w))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(),h.k?setTimeout(()=>Le(),350):Le()},[ht,Ie,at,jt,Le]),yt=Object(la.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(us(a.content.text)),requestAnimationFrame(()=>{const e=document.getElementById(n.w);Object(Xa.a)(e,!0)})):t("")},[a,t]);return Object(c.m)(()=>{const{text:t,entities:n}=Object(Za.a)(e.current);a&&(t||Object(l.eb)(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(Za.a)(o.current)}):d({chatId:e,threadId:t})},[d,i,o,l]),u=Object(c.p)(()=>Object(f.a)(e=>e(),n.v,!1),[t]),m=Object(la.a)(t),h=Object(la.a)(a);Object(c.n)(()=>(ms=t,hs=a,()=>{ms=void 0,hs=void 0,b(t,a)}),[t,a,b]),Object(c.n)(()=>{t===m&&a===h||e&&(r(us(e)),requestAnimationFrame(()=>{const e=document.getElementById(n.w);Object(Xa.a)(e,!0)}))},[t,a,e,r,b,m,h]);const O=Object(la.a)(s);Object(c.n)(()=>{t&&a&&m===t&&h===a&&O!==s&&(s.length?u(()=>{ms===t&&hs===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(ae.a)(j),se(j)})(O,d,u,me,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.w,n.x].includes(c.id))return;const{items:o}=s.clipboardData,r=Array.from(o).find(e=>bs.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 es(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=>es(e.name,e,t))))},[]),Et=Object(c.m)(async(e,t)=>{Me([...Ee,...await Promise.all(e.map(e=>es(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 es("wonderful-voice-message.ogg",t,!1,{voice:{duration:s,waveform:n}})]}}const{text:s,entities:c}=Object(Za.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.w);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(R.e)(s)),isSlowMode:!0,hasErrorKey:!1}}),void o.blur()}}_({text:s,entities:c,attachments:a,scheduledAt:t,isSilent:e})}var r;C&&J(),Oe.current=Math.floor(Date.now()/1e3)+q,$({chatId:d,localOnly:!0}),h.e&&o===document.activeElement&&(r=o,as.focus(),r.focus()),requestAnimationFrame(vt)},[g,Ee,Ke,C,q,$,d,vt,$e,V,ut,bt,_,J,Ce]),kt=Object(c.m)(e=>{e={...e,isPreloadedGlobally:!0},t?(ye({sticker:e}),pe()):(_({sticker:e}),requestAnimationFrame(vt))},[t,pe,_,vt]),Tt=Object(c.m)(e=>{t?(ye({gif:e}),pe()):(_({gif:e}),requestAnimationFrame(vt))},[t,pe,_,vt]),Pt=Object(c.m)(e=>{t?(ye({poll:e}),X(),pe()):(_({poll:e}),X())},[X,pe,_,t]),At=Object(c.m)(()=>{t?(ye({isSilent:!0}),pe()):St(!0)},[St,pe,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.nb),!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.w);h.k&&e===document.activeElement?(e.blur(),setTimeout(()=>{Re()},100)):Re()},[Re]),Bt=Object(c.m)(()=>{ce({id:d,threadId:u,type:"scheduled"})},[ce,d,u]);Object(c.n)(()=>{v&&h.k&&Le()},[v,Le]),Object(c.n)(()=>{r&&(y?Ge():setTimeout(()=>{_e()},200))},[y,_e,Ge,r]);const Ht=Object(c.m)(()=>{switch(Xe){case qs.Send:t?(Ke&&Ve(),pe()):(St(),requestAnimationFrame(vt));break;case qs.Record:ze();break;case qs.Edit:Ct()}},[Xe,vt,t,ze,Ct,Ke,pe,Ve,St]),Ut=Xe===qs.Record&&!dt.canAttachMedia,qt=Object(la.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 Wt="SendMessage";switch(Xe){case qs.Edit:Wt="Save edited message";break;case qs.Record:Wt=Ut?"Conversation.DefaultRestrictedMedia":"AccDescrVoiceMessage"}const $t=Object(ee.a)("Composer",!y&&"shown",qe&&"hover-disabled"),Vt=Object(ee.a)("mobile-symbol-menu-button",He?xe&&"menu-opened":xe&&"is-loading"),Kt=Xe===qs.Edit?Ct:t?pe:St;return c.a.createElement("div",{className:$t},dt.canAttachMedia&&r&&c.a.createElement(Bs.a,{containerId:"#middle-column-portals"},c.a.createElement(Ls,{isOpen:e!==We.a.None,withQuick:[e,je].includes(We.a.QuickFile),onHide:o,onFileSelect:wt})),c.a.createElement(xs,{attachments:Ee,caption:Ee.length?me:"",canSuggestMembers:w,groupChatMembers:P,currentUserId:A,usersById:x,recentEmojis:G,onCaptionUpdate:he,language:B,emojiKeywords:U,addRecentEmoji:le,loadEmojiKeywords:de,onSend:t?pe:St,onFileAppend:Et,onClear:Mt}),c.a.createElement(Rs,{isOpen:Boolean(E),onClear:X,onSend:Pt}),c.a.createElement(Us,{isOpen:Boolean(M),onClose:te}),c.a.createElement(Gs,{isOpen:Boolean(S),onClose:ie}),Gt&&c.a.createElement(fs,{isOpen:De,isSchedule:"scheduled"===m,onClose:Be,message:Gt}),c.a.createElement(Es,{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:ue}),c.a.createElement(As,null),c.a.createElement(Fs,{chatId:d,threadId:u,messageText:Ee.length?"":me,disabled:!dt.canAttachEmbedLinks}),c.a.createElement("div",{className:"message-input-wrapper"},h.k?c.a.createElement(be.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"}),!He&&c.a.createElement(ge.a,{color:"gray"})):c.a.createElement(ys,{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(Ts.a,{id:"message-input-text",html:Ee.length?"":me,placeholder:Ke&&window.innerWidth<=600?"":Ce("Message"),shouldSetFocus:xe,shouldSuppressFocus:h.k&&xe,shouldSuppressTextFormatter:Ot||et,onUpdate:he,onSend:Kt,onSuppressedFocus:Le}),N&&c.a.createElement(be.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(ys,{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(ys,{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(R.i)(Qe-Ye.current)),c.a.createElement(Ss,{isOpen:mt,onStickerSelect:kt}),c.a.createElement(ks.a,{isOpen:Ot,emojis:gt,onClose:jt,onEmojiSelect:ft,addRecentEmoji:le,loadEmojiKeywords:de,language:B}),c.a.createElement(Cs,{isOpen:Te,allowedAttachmentOptions:dt,onFileSelect:wt,onPollCreate:Y,onClose:Ae}),k&&c.a.createElement(Ns,{messageId:k,isOpen:Se,onClose:Ne}),c.a.createElement(ws,{isOpen:xe,allowedAttachmentOptions:dt,onLoad:Ue,onClose:Le,onEmojiSelect:pt,onStickerSelect:kt,onGifSelect:Tt,onRemoveSymbol:It,onSearchOpen:Dt,addRecentEmoji:le}))),Ke&&c.a.createElement(be.a,{round:!0,color:"danger",className:"cancel",onClick:$e,ariaLabel:"Cancel voice recording"},c.a.createElement("i",{className:"icon-delete"})),c.a.createElement(be.a,{ref:Je,round:!0,color:"secondary",className:`${Xe} ${Ke?"recording":""}`,disabled:Ut,ariaLabel:Ce(Wt),onClick:Ht,onContextMenu:Xe===qs.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(Ms,{isOpen:ct,onSilentSend:I?void 0:At,onScheduleSend:t?void 0:pe,onClose:it,onCloseAnimationEnd:lt}),c.a.createElement(Hs,{isOpen:fe,withTimePicker:!0,selectedAt:_t.getTime(),maxAt:Object(R.k)(zt),isFutureMode:!0,secondButtonLabel:a?"Send When Online":void 0,onClose:Lt,onSubmit:xt,onSecondButtonClick:a?Rt:void 0}))}));var zs=Object(c.h)(e=>{const{isActive:t}=e,a=Object(ke.a)(Se.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(ke.a)(Se.a.Extra,"MessageSelectToolbar",!t);return a?c.a.createElement(a,e):void 0});var $s=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(ke.a)(Se.a.Extra,"UnpinAllMessagesModal",!t);return a?c.a.createElement(a,e):void 0});a(242);const Vs=h.k?450+n.c:void 0;function Ks(e){return"file"===e.kind&&e.type&&n.m.includes(e.type)}var Qs=Object(c.h)(Object(s.h)(e=>{const t=Object(r.Db)(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.X)(e),isBackgroundBlurred:a,isMobileSearchActive:Boolean(h.k&&Object(r.B)(e)),isSelectModeActive:Object(r.T)(e),animationLevel:e.settings.byKey.animationLevel};if(!o||!d.active)return u;const{chatId:m,threadId:O,type:j}=o,g=Object(r.g)(e,m),f=Object(r.kb)(e,m),{chatId:p,messageId:I}=e.audioPlayer,v=g&&Object(l.d)(g,O),y=Object(r.M)(e,m),C="pinned"===j,w="scheduled"===j,E=Object(r.Gb)(e,m,O);return{...u,chatId:m,threadId:O,messageListType:j,originChatId:E?E.id:m,isPrivate:Object(l.nb)(m),canPost:!C&&(!g||v)&&(!y||h.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(m.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:m,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}=Qe(),[A,x]=Object(c.r)(We.a.None),[R,L]=Object(c.r)(),[D,F]=Object(c.r)(),[B,H]=Object(c.r)(!1),[U,q]=Object(c.r)(!h.k||C===n.f),G=d&&(P<n.eb||p&&P>n.bb&&P<n.mb||P>=n.ab&&P<n.lb),_=Object(Je.a)(e,Vs),z=Object(Je.a)(t,Vs),W=Object(Je.a)(a,Vs),$=Object(Je.a)(i,Vs),V=Object(Je.a)(G,Vs),K=Object(Je.a)(R,Vs);Object(c.n)(()=>e?Object(ne.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(h.m)return;const{items:t}=e.dataTransfer||{},a=t&&Array.from(t).every(Ks);x(a?We.a.QuickFile:We.a.Document)},[]),J=Object(c.m)(()=>{x(We.a.None)},[]),Y=Object(c.m)(()=>{H(!0)},[]),X=Object(c.m)(()=>{H(!1)},[]),Z=Object(c.m)(()=>{S({chatId:e}),X(),M({id:e})},[S,M,X,e]),te=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):$e.c(n.n,e,$e.a.Blob).then(e=>{const t=URL.createObjectURL(e);Object(Ve.g)(t).then(()=>{s(`url(${t})`)})}))},[t,e]),t?a:void 0})(O,m),se=Object(ee.a)(V&&"has-header-tools",m&&"custom-bg-image",j&&"custom-bg-color",m&&I&&"blurred",h.p?"mask-image-disabled":"mask-image-enabled"),oe=Object(ee.a)("messaging-disabled",!y&&"shown"),{composerHiddenScale:ie,toolbarHiddenScale:le,composerTranslateX:de,toolbarTranslateX:ue,unpinHiddenScale:me,toolbarForUnpinHiddenScale:he}=Object(c.p)(()=>Ye(P,$),[$,P]),Oe=Object(re.a)(),je=Object(ee.a)("middle-column-footer",!$&&"no-composer",$&&D&&!y&&"with-notch"),ge=()=>{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(Ce.a)(_&&z,ge,M,{id:e,threadId:b.MAIN_THREAD_ID});const fe=_&&z!==b.MAIN_THREAD_ID;return Object(Ce.a)(fe||o||r,ge,M,{id:e,threadId:z}),Object(Ce.a)(v,N),Object(Ce.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: ${ie};\n --toolbar-hidden-scale: ${le};\n --unpin-hidden-scale: ${me};\n --toolbar-unpin-hidden-scale: ${he};\n --composer-translate-x: ${de}px;\n --toolbar-translate-x: ${ue}px;\n --pattern-color: ${g};\n --theme-background-color:\n ${j||("dark"===O?n.o:n.J)};\n `,onClick:h.l&&f?te: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:$?Q:void 0},c.a.createElement(pt,{chatId:_,threadId:z,messageListType:W,isReady:U}),c.a.createElement(ce.a,{name:E?"none":C===n.e?"slide":"fade",activeKey:"thread"===W&&z===b.MAIN_THREAD_ID?1:2,shouldCleanup:!0},()=>c.a.createElement(c.a.Fragment,null,c.a.createElement(Ja,{key:`${_}-${z}-${W}`,chatId:_,threadId:z,type:W,canPost:$,hasTools:V,onFabToggle:L,onNotchToggle:F,isReady:U}),c.a.createElement("div",{className:je},$&&c.a.createElement(_s,{chatId:_,threadId:z,messageListType:W,dropAreaState:A,onDropHide:J,isReady:U}),o&&c.a.createElement("div",{className:"unpin-button-container",dir:Oe.isRtl?"rtl":void 0},c.a.createElement(be.a,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:Y},c.a.createElement("i",{className:"icon-unpin"}),c.a.createElement("span",null,Oe("Chat.Pinned.UnpinAll",u,"i")))),!o&&!$&&l&&c.a.createElement("div",{className:oe},c.a.createElement("div",{className:"messaging-disabled-inner"},c.a.createElement("span",null,l))),c.a.createElement(Ws,{messageListType:W,isActive:y,canPost:$})))),c.a.createElement(Ya,{isShown:K,canPost:$})),h.k&&c.a.createElement(zs,{isActive:Boolean(v)})),e&&c.a.createElement($s,{isOpen:B,chatId:e,pinnedMessagesCount:u,onClose:X,onUnpin:Z}))}));a(243);const Js=Object(f.a)(e=>e(),200,!1);var Ys;!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"}(Ys||(Ys={}));var Xs=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.lb)(i);return{canManage:Boolean(!s&&a&&i&&!Object(r.Q)(e,i.id)&&(Object(l.nb)(i.id)||(Object(l.ib)(i)||i.isCreator)&&!i.isNotJoined)),isChannel:d,messageSearchQuery:n,stickerSearchQuery:c,gifSearchQuery:o}},(e,t)=>Object(m.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:m,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(re.a)(),x=t?i===u.k.Profile?Ys.Profile:i===u.k.SharedMedia?Ys.SharedMedia:i===u.k.MemberList?Ys.MemberList:-1:a?Ys.Search:r?Ys.PollResults:n?Ys.StickerSearch:o?Ys.GifSearch:s?l===u.g.Initial?Ys.ManageInitial:l===u.g.ChatPrivacyType?Ys.ManageChatPrivacyType:l===u.g.Discussion?Ys.ManageDiscussion:l===u.g.ChannelSubscribers?Ys.ManageChannelSubscribers:l===u.g.GroupPermissions?Ys.ManageGroupPermissions:l===u.g.ChatAdministrators?Ys.ManageChatAdministrators:l===u.g.GroupRemovedUsers?Ys.ManageGroupRemovedUsers:l===u.g.GroupUserPermissionsCreate?Ys.ManageGroupUserPermissionsCreate:l===u.g.GroupUserPermissions?Ys.ManageGroupUserPermissions:l===u.g.GroupRecentActions?Ys.ManageGroupRecentActions:l===u.g.ChatAdminRights?Ys.ManageGroupAdminRights:l===u.g.GroupMembers?Ys.ManageGroupMembers:void 0:void 0,L=null!==(E=Object(et.a)(x,!0))&&void 0!==E?E:-1;function D(){if(-1!==L)switch(L){case Ys.PollResults:return c.a.createElement("h3",null,A("PollResults"));case Ys.Search:return c.a.createElement(c.a.Fragment,null,c.a.createElement(ue.a,{parentContainerClassName:"RightSearch",value:O,onChange:S}),c.a.createElement(be.a,{round:!0,size:"smaller",color:"translucent",onClick:()=>C({selectedAt:Object(R.k)(Date.now())}),ariaLabel:"Search messages by date"},c.a.createElement("i",{className:"icon-calendar"})));case Ys.ManageInitial:return c.a.createElement("h3",null,A("Edit"));case Ys.ManageChatPrivacyType:return c.a.createElement("h3",null,A(b?"ChannelTypeHeader":"GroupTypeHeader"));case Ys.ManageDiscussion:return c.a.createElement("h3",null,A("Discussion"));case Ys.ManageChatAdministrators:return c.a.createElement("h3",null,A("ChannelAdministrators"));case Ys.ManageGroupRecentActions:return c.a.createElement("h3",null,A("Group.Info.AdminLog"));case Ys.ManageGroupAdminRights:return c.a.createElement("h3",null,A("EditAdminRights"));case Ys.ManageGroupPermissions:return c.a.createElement("h3",null,A("ChannelPermissions"));case Ys.ManageGroupRemovedUsers:return c.a.createElement("h3",null,A("ChannelBlockedUsers"));case Ys.ManageGroupUserPermissionsCreate:return c.a.createElement("h3",null,A("ChannelAddException"));case Ys.ManageGroupUserPermissions:return c.a.createElement("h3",null,A("UserRestrictions"));case Ys.StickerSearch:return c.a.createElement(ue.a,{value:j,placeholder:A("SearchStickersHint"),onChange:k});case Ys.GifSearch:return c.a.createElement(ue.a,{value:g,placeholder:A("SearchGifsTitle"),onChange:N});case Ys.SharedMedia:return c.a.createElement("h3",null,A("SharedMedia"));case Ys.ManageChannelSubscribers:return c.a.createElement("h3",null,A("ChannelSubscribers"));case Ys.MemberList:case Ys.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(be.a,{round:!0,color:"translucent",size:"smaller",ariaLabel:A("Edit"),onClick:y},c.a.createElement("i",{className:"icon-edit"}))))}}const F=h.k||x===Ys.SharedMedia||x===Ys.MemberList||s,B=Object(ee.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(be.a,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:m,ariaLabel:A(F?"Common.Back":"Common.Close")},c.a.createElement("div",{ref:M,className:B})),c.a.createElement(ce.a,{name:T||w?"none":"slide-fade",activeKey:L},D))})),Zs=a(127);function en(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.Ib)(r.map(({userId:e})=>e),i,void 0,h)},[r,h,i]),[g,f,p]=function(e,t,a,s){const[c,o]=Object(Zs.a)(a?t:void 0,s,void 0,n.S),r=!c||!s||c[0]===s[0];return[c,o,!r]}(0,t,m,j),[I,v,y]=tn("media",O,a,m,d,b),[C,w,E]=tn("documents",O,a,m,d,b),[M,S,k]=tn("links",O,a,m,d,b),[N,T,P]=tn("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 tn(e,t,a,s,o,r){const i=Object(c.q)();Object(Ie.a)(()=>{t===e&&o&&r&&(i.current=Object(l.w)(o,r,e).reverse())},[o,r,t,e]);const[d,b]=Object(Zs.a)(s?a:void 0,i.current,void 0,"media"===e?n.qb:n.Y);return[d,b,!(!d||!i.current||d[0]===i.current[0])]}var an=a(59);const sn=Object(f.h)(e=>e(),250,!1);let nn=!1;var cn=a(112),on=a(105);var rn=a(132),ln=a(191);a(244);var dn=Object(c.h)(({chat:e,user:t,photo:a,isFirstPhoto:s,isSavedMessages:n,lastSyncTime:o,onClick:r})=>{const i=Object(re.a)(),d=t&&Object(l.rb)(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(it.a)(m,!1,b.ApiMediaFormat.BlobUrl,o),O=Object(it.a)(!h&&s?u("normal",!0):void 0,!1,b.ApiMediaFormat.BlobUrl,o),j=Object(ln.a)(!h&&a&&a.thumbnail&&a.thumbnail.dataUri),g=h||O||j,f=Object(la.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(tt.c)(e,2):void 0}else if(!g&&e){const t=Object(l.k)(i,e);p=t&&Object(tt.c)(t,Object(l.nb)(e.id)?2:1)}else p=c.a.createElement("div",{className:"spinner-wrapper"},c.a.createElement(ge.a,{color:"white"}));const I=Object(ee.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(rt.a)(p,["hq_emoji"]):p)});a(245);var bn=Object(c.h)(Object(s.h)((e,{userId:t,forceShowSelf:a})=>{const{lastSyncTime:s,serverTimeOffset:n}=e,c=Object(r.Jb)(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(m.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:m}=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(re.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=>{jt.c(`photo${e.id}?size=c`)||jt.b(`photo${e.id}?size=c`,b.ApiMediaFormat.BlobUrl)})},[a,t])}(0,j,f);const C=Object(c.m)(()=>{r({avatarOwnerId:d||m,profilePhotoIndex:f,origin:u.h.ProfileAvatar})},[r,d,m,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(pe.b)(e,{excludedClosestSelector:".navigation",onSwipe:h.m?(e,t)=>{t===pe.a.Right?w():t===pe.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(dn,{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(ce.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(rt.a)(O)),S&&c.a.createElement(rn.a,null)),!a&&(e?c.a.createElement("div",{className:"status "+(Object(l.Bb)(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.lb)(t)?y("Subscribers",t.membersCount,"i"):y("Members",t.membersCount,"i")))))}));var un=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.nb)(t)?Object(r.Jb)(e,t):void 0,c=s&&Object(l.Gb)(s,Object(r.fb)(e),Object(r.eb)(e));return{lastSyncTime:a,chat:s,user:n,canInviteUsers:s&&(!Object(l.lb)(s)&&!Object(l.Cb)(s,"inviteUsers")||Object(l.p)(s,"inviteUsers")),isMuted:c}},(e,t)=>Object(m.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,username:g}=a||{},f=Object(re.a)();Object(c.n)(()=>{e&&b&&r({userId:b})},[r,b,e]);const p=Object(c.m)(()=>{d({chatId:j,isMuted:!o})},[j,o,d]);if(!a||a.isRestricted||O&&!s)return;function I(e,t){Object(E.c)(e),i({message:t+" was copied"})}const v=h&&Object(va.c)(h),y=Object(l.g)(a),C=0===y.indexOf("http")?y:"http://"+y,w=m||g,M=u&&u.bio||Object(l.f)(a);return c.a.createElement("div",{className:"ChatExtra"},v&&!!v.length&&c.a.createElement(on.a,{icon:"phone",multiline:!0,narrow:!0,ripple:!0,onClick:()=>I(v,f("Phone"))},c.a.createElement("span",{className:"title",dir:"auto"},v),c.a.createElement("span",{className:"subtitle"},f("Phone"))),w&&c.a.createElement(on.a,{icon:"mention",multiline:!0,narrow:!0,ripple:!0,onClick:()=>I("@"+w,f("Username"))},c.a.createElement("span",{className:"title",dir:"auto"},Object(rt.a)(w)),c.a.createElement("span",{className:"subtitle"},f("Username"))),M&&!!M.length&&c.a.createElement(on.a,{icon:"info",multiline:!0,narrow:!0,isStatic:!0},c.a.createElement("span",{className:"title",dir:"auto"},Object(rt.a)(M,["br","links","emoji"])),c.a.createElement("span",{className:"subtitle"},f(b?"UserBio":"Info"))),n&&!w&&!!y.length&&c.a.createElement(on.a,{icon:"mention",multiline:!0,narrow:!0,ripple:!0,onClick:()=>I(y,f("SetUrlPlaceholder"))},c.a.createElement("div",{className:"title"},c.a.createElement(Pa.a,{url:C,className:"title",text:y})),c.a.createElement("span",{className:"subtitle"},f("SetUrlPlaceholder"))),c.a.createElement(on.a,{icon:"unmute",ripple:!0,onClick:p},c.a.createElement("span",null,f("Notifications")),c.a.createElement(he,{id:"group-notifications",label:b?"Toggle User Notifications":"Toggle Chat Notifications",checked:!o,inactive:!0})))})),mn=a(165),hn=a(185),On=a(117);a(249);const jn=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"}];function gn(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > div.active > .${e}-list > .scroll-item`].join(", ")}var fn=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.mb)(s),u=s&&Object(l.lb)(s),m=b||u&&Object(l.ib)(s),h=s&&s.fullInfo&&s.fullInfo.members,O=m&&s&&s.fullInfo&&!s.fullInfo.canViewMembers;let j;return a?j=a:Object(l.nb)(t)&&(j=t),{theme:Object(r.Db)(e),isChannel:u,resolvedUserId:j,chatMessages:n,foundIds:i,mediaSearchType:c,hasMembersTab:m,areMembersHidden:O,...m&&h&&{members:h,usersById:d},isRightColumnShown:Object(r.X)(e),isRestricted:s&&s.isRestricted,lastSyncTime:e.lastSyncTime,serverTimeOffset:e.serverTimeOffset}},(e,t)=>Object(m.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:m,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(re.a)(),[x,R]=Object(c.r)(0),L=Object(c.p)(()=>[...m?[{type:"members",title:o?"ChannelSubscribers":"GroupMembers"}]:[],...jn],[m,o]),D=L[x].type,[F,B,H,U]=en(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(an.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),nn=!0,Object(St.a)(a,n,"start",void 0,void 0,void 0,300),setTimeout(()=>{nn=!1},350))}},[t,s]),Object(an.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||(nn=!0,Object(St.a)(n,n.firstElementChild,"start",void 0,2*n.offsetHeight),setTimeout(()=>{nn=!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)(()=>{nn||n()},[n,t]),{handleScroll:Object(c.m)(()=>{nn||sn(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(),$()},[z,$]);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]),J=Object(c.m)(e=>{E({chatId:K,messageId:e})},[K,E]),Y=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&&h.m)return Object(pe.b)(P.current,{onSwipe:(e,t)=>{t===pe.a.Left?R(Math.min(x+1,L.length-1)):t===pe.a.Right&&R(Math.max(0,x-1))}})},[x,L.length]);const ee="members"===F||!m&&"media"===F;ee?Z=f?0:1e3:B||(Z=n.rb);const te=Object(Ps.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(ge.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(On.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(mn.a,{key:e,message:i[e],onClick:Q})):"documents"===F?B.map(e=>i[e]&&c.a.createElement(Yt.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(hn.a,{key:e,message:i[e],onMessageClick:X})):"audio"===F?B.map(e=>i[e]&&c.a.createElement(Xt.a,{key:e,theme:s,message:i[e],target:"sharedMedia",date:i[e].date,lastSyncTime:I,className:"scroll-item",onPlay:J,onDateClick:X})):"members"===F?B.map((e,t)=>c.a.createElement(on.a,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>Y(e)},c.a.createElement(at.a,{userId:e,forceShowSelf:!0}))):void 0)}return c.a.createElement(cn.a,{ref:T,className:"Profile custom-scroll",itemSelector:gn(F),items:te?B:void 0,cacheBuster:W,sensitiveArea:n.gb,preloadBackwards:te?"members"===F?n.S:n.qb:0,noScrollRestoreOnTop:!0,noFastList:!0,onLoadMore:H,onScroll:G},!U&&function(e,t){return c.a.createElement("div",{className:"profile-info"},c.a.createElement(bn,{userId:t||e,forceShowSelf:t!==e}),c.a.createElement(un,{chatOrUserId:t||e,forceShowSelf:t!==e}))}(e,r),!p&&c.a.createElement("div",{className:"shared-media"},c.a.createElement(ce.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(we.a,{big:!0,activeTab:x,tabs:L,onSwitchTab:R})))}));var pn=Object(c.h)(e=>{const t=Object(ke.a)(Se.a.Extra,"RightSearch");return t?c.a.createElement(t,e):c.a.createElement(Ne.a,null)});var In=Object(c.h)(e=>{const t=Object(ke.a)(Se.a.Extra,"Management");return t?c.a.createElement(t,e):c.a.createElement(Ne.a,null)});var vn=Object(c.h)(()=>{const e=Object(ke.a)(Se.a.Extra,"StickerSearch");return e?c.a.createElement(e,null):c.a.createElement(Ne.a,null)});var yn=Object(c.h)(()=>{const e=Object(ke.a)(Se.a.Extra,"GifSearch");return e?c.a.createElement(e,null):c.a.createElement(Ne.a,null)});var Cn=Object(c.h)(()=>{const e=Object(ke.a)(Se.a.Extra,"PollResults");return e?c.a.createElement(e,null):c.a.createElement(Ne.a,null)});a(250);const wn=Object.keys(u.l).length/2,En=Object.keys(u.g).length/2;function Mn(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}var Sn=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.pb)(e),chatId:t,threadId:a,currentProfileUserId:e.users.selectedId,isChatSelected:Boolean(t&&s),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations}},(e,t)=>Object(m.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}=Qe(),[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.bb,[L,D]=Object(c.r)(!S),F=null!==(j=Object(et.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:Mn(),d();break;case u.l.StickerSearch:Mn(),b({query:void 0});break;case u.l.GifSearch:Mn(),m({query:void 0});break;case u.l.PollResults:h()}},[e,M,r,l,h,I,i,d,b,m]),H=Object(c.m)((e,t)=>{C(e),E(t)},[]);function U(e){if(-1!==F)switch(F){case u.l.ChatInfo:case u.l.UserInfo:return c.a.createElement(fn,{key:s||t,chatId:t,userId:s,profileState:f,onProfileStateChange:p});case u.l.Search:return c.a.createElement(pn,{chatId:t,threadId:a,onClose:B,isActive:S&&e});case u.l.Management:return c.a.createElement(In,{chatId:t,currentScreen:I,isPromotedByCurrentUser:w,selectedChatMemberId:y,onScreenSelect:v,onChatMemberSelect:H,isActive:S&&e,onClose:B});case u.l.StickerSearch:return c.a.createElement(vn,{onClose:B,isActive:S&&e});case u.l.GifSearch:return c.a.createElement(yn,{onClose:B,isActive:S&&e});case u.l.PollResults:return c.a.createElement(Cn,{onClose:B,isActive:S&&e})}}return Object(c.n)(()=>S?Object(ne.a)(B):void 0,[S,B]),Object(c.n)(()=>{setTimeout(()=>{D(!S)},300)},[S]),Object(c.n)(()=>{S&&R&&B()},[R]),Object(It.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(Ce.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(Xs,{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(ce.a,{name:L||O?"none":"zoom-fade",renderCount:wn+En,activeKey:T?wn+I:F,shouldCleanup:!0,cleanupExceptionKey:u.l.ChatInfo},U)))}));var kn=Object(c.h)(({isOpen:e})=>{const t=Object(ke.a)(Se.a.Extra,"MediaViewer",!e);return t?c.a.createElement(t,null):void 0});var Nn=Object(c.h)(({isOpen:e})=>{const t=Object(ke.a)(Se.a.Extra,"Notifications",!e);return t?c.a.createElement(t,null):void 0});var Tn=Object(c.h)(({isOpen:e})=>{const t=Object(ke.a)(Se.a.Extra,"Dialogs",!e);return t?c.a.createElement(t,null):void 0});var Pn=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(ke.a)(Se.a.Extra,"ForwardPicker",!t);return a?c.a.createElement(a,e):void 0});var An=Object(c.h)(e=>{const{url:t}=e,a=Object(ke.a)(Se.a.Extra,"SafeLinkModal",!t);return a?c.a.createElement(a,e):void 0});var xn=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(ke.a)(Se.a.Extra,"HistoryCalendar",!t);return a?c.a.createElement(a,e):void 0});a(251);let Rn,Ln,Dn=!1;function Fn(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 Bn=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.X)(e),isMediaViewerOpen:Object(r.U)(e),isForwardModalOpen:Object(r.S)(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(m.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.q&&!Dn&&(Dn=!0,console.log(">>> RENDER MAIN")),Object(c.n)(()=>{e&&(p(!0),j(),g(),f())},[e,j,f,g,p]);const{transitionClassNames:I}=Object(te.a)(!t,void 0,!0,void 0,O),{transitionClassNames:v}=Object(te.a)(a,void 0,!0,void 0,O),y=Object(ee.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(Z.b)(350+n.c),Rn&&(clearTimeout(Rn),Rn=void 0),Rn=window.setTimeout(()=>{document.body.classList.remove("animating-right-column"),Rn=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(Ln),Ln=window.setInterval(()=>{if(document.title.includes(n.E))Fn(!1);else{if(t%2==0){const t=Object(r.r)(Object(s.e)())-e;t>0&&(document.title=`${t} notification${t>1?"s":""}`,Fn(!0))}else document.title=n.fb,Fn(!1);t++}},1e3)},[p]),w=Object(c.m)(()=>{p(!0),clearInterval(Ln),Ln=void 0,document.title.includes(n.E)||(document.title=n.fb),Fn(!1)},[p]);function E(e){e.preventDefault(),e.stopPropagation()}return Object(ae.a)(C,w),se(C),c.a.createElement("div",{id:"Main",className:y,onDrop:E,onDragOver:E},c.a.createElement(ze,null),c.a.createElement(Qs,null),c.a.createElement(Sn,null),c.a.createElement(kn,{isOpen:o}),c.a.createElement(Pn,{isOpen:i}),c.a.createElement(Nn,{isOpen:d}),c.a.createElement(Tn,{isOpen:b}),u&&c.a.createElement(ft,{key:u.id,message:u,noUi:!0}),c.a.createElement(An,{url:m}),c.a.createElement(xn,{isOpen:h}))}));n.q&&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.ded982f1890cbc30b91c.js.map