telegram-tt/dist/3.1b30732320c249d64957.js
Alexander Zinchuk ce5e40e03e [Build]
2021-04-19 00:17:33 +03:00

1 line
195 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([[3],{105:function(e,t,a){"use strict";function s(e){const t=e.length;let a=e[0],s=e[0];for(let n=0;n<t;n++){const t=e[n];t>a?a=t:t<s&&(s=t)}return{max:a,min:s}}function n(e){return[].concat.apply([],e)}function c(e){const t=[],a=e.length;for(let s=0,n=e[0].length;s<n;s++){t[s]=0;for(let n=0;n<a;n++)t[s]+=e[n][s]}return t}function r(e,t){return new Proxy({},{get:(a,s)=>void 0!==a[s]?a[s]:void 0!==t[s]?t[s]:e[s]})}function o(e,t,a=!0){let s,n,c=null;return(...r)=>{s=!0,n=r,c||(a&&(s=!1,e(...n)),c=window.setInterval(()=>{if(!s)return window.clearInterval(c),void(c=null);s=!1,e(...n)},t))}}function i(e){let t,a=!1;return function(...s){t=s,a||(a=!0,requestAnimationFrame(()=>{a=!1,e(...t)}))}}function l(e,t,a=!0,s=!0){let n=null;return function(){n?(clearTimeout(n),n=null):a&&e(),n=setTimeout(()=>{s&&e(),n=null},t)}}a.d(t,"b",(function(){return s})),a.d(t,"c",(function(){return n})),a.d(t,"e",(function(){return c})),a.d(t,"d",(function(){return r})),a.d(t,"f",(function(){return o})),a.d(t,"g",(function(){return i})),a.d(t,"a",(function(){return l}))},185:function(e,t,a){},186:function(e,t,a){},187:function(e,t,a){},199:function(e,t,a){},200:function(e,t,a){},201:function(e,t,a){},204:function(e,t,a){},205:function(e,t,a){},206:function(e,t,a){},210:function(e,t,a){},211:function(e,t,a){},213:function(e,t,a){},216:function(e,t,a){},217:function(e,t,a){},218:function(e,t,a){},219:function(e,t,a){},220:function(e,t,a){},221:function(e,t,a){},222:function(e,t,a){},223:function(e,t,a){},224:function(e,t,a){},225:function(e,t,a){},226: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){},236:function(e,t,a){},237:function(e,t,a){},238:function(e,t,a){},91:function(e,t,a){"use strict";a.r(t),a.d(t,"Main",(function(){return yn}));var s=a(2),n=a(1),c=a(0),r=(a(74),a(38)),o=a(6);Object(s.b)("openChat",(e,t,a)=>{const{id:n,threadId:c,type:i}=a,l=Object(o.y)(e);return!l||l.chatId===n&&l.threadId===c&&l.type===i||(e=Object(r.m)(e),e={...e,messages:{...e.messages,contentToBeScheduled:void 0},...n!==e.forwardMessages.toChatId&&{forwardMessages:{}}},Object(s.g)(e)),Object(r.L)(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}));var i=a(5),l=a(18),d=a(3);let b;Object(s.b)("setScrollOffset",(e,t,a)=>{const{chatId:s,threadId:n,scrollOffset:c}=a;return Object(r.v)(e,s,n,"scrollOffset",c)}),Object(s.b)("setReplyingToId",(e,t,a)=>{const{messageId:s}=a,n=Object(o.y)(e);if(!n)return;const{chatId:c,threadId:i}=n;return Object(r.v)(e,c,i,"replyingToId",s)}),Object(s.b)("setEditingId",(e,t,a)=>{const{messageId:s}=a,n=Object(o.y)(e);if(!n)return;const{chatId:c,threadId:i,type:l}=n,d="scheduled"===l?"editingScheduledId":"editingId";return Object(r.v)(e,c,i,d,s)}),Object(s.b)("editLastMessage",e=>{const{chatId:t,threadId:a}=Object(o.y)(e)||{};if(!t||!a)return;const s=Object(o.m)(e,t),n=Object(o.Db)(e,t,a);if(!s||!n)return;const c=Object(d.g)(n,t=>Boolean(s[t]&&Object(o.b)(e,s[t],a).canEdit));return c?Object(r.v)(e,t,a,"editingId",c):void 0}),Object(s.b)("openMediaViewer",(e,t,a)=>{const{chatId:s,threadId:n,messageId:c,avatarOwnerId:r,origin:o}=a;return{...e,mediaViewer:{chatId:s,threadId:n,messageId:c,avatarOwnerId:r,origin:o},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(o.V)(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(o.y)(e);if(!a)return;const{chatId:s,threadId:n}=a;let c;if(n===i.MAIN_THREAD_ID){const t=Object(o.f)(e,s);c=t&&t.lastMessage?t.lastMessage.id:void 0}else{const t=Object(o.yb)(e,s,n);c=t?t.lastMessageId:void 0}c&&t.focusMessage({chatId:s,threadId:n,messageId:c,noHighlight:!0})}),Object(s.b)("focusMessage",(e,t,a)=>{const{chatId:n,threadId:c=i.MAIN_THREAD_ID,messageListType:d="thread",noHighlight:u,groupedId:m,groupedChatId:h}=a;let{messageId:O}=a;if(void 0!==m){const t=Object(o.I)(e,h,m);t&&t.length&&([O]=t)}const j=Object(o.y)(e),g=!j||n!==j.chatId||c!==j.threadId||d!==j.type;b&&(clearTimeout(b),b=void 0),b=window.setTimeout(()=>{let e=Object(s.e)();e=Object(r.N)(e),e=Object(r.M)(e),Object(s.g)(e)},2e3),e=Object(r.N)(e,n,O,u),e=Object(r.M)(e,void 0),g&&(e=Object(r.M)(e,l.b.Static));const f=Object(o.Db)(e,n,c);if(f&&f.includes(O))return Object(s.g)(e),void t.openChat({id:n,threadId:c});if(g&&(e=Object(r.v)(e,n,c,"viewportIds",void 0)),e=Object(r.v)(e,n,c,"outlyingIds",void 0),f&&!g){const t=O>f[0]?l.b.Down:l.b.Up;e=Object(r.M)(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 r;return c&&(r=Object(o.Z)(e,s,c)),{...e,forwardMessages:{fromChatId:s,messageIds:r||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()}),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(o.r)(e);return n?Object(r.l)(e,n.id,s):e}),Object(s.b)("toggleMessageSelection",(e,t,a)=>{const{messageId:s,groupedId:n,childMessageIds:c,withShift:i}=a,l=Object(o.y)(e);if(!l)return;const{chatId:d,threadId:b,type:u}=l;return Object(r.E)(e,d,b,u,s,n,c,i)}),Object(s.b)("exitMessageSelectMode",r.m),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(r.P)(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(r.P)(e,{recentlyFoundChatIds:[s]});const c=n.filter(e=>e!==s);return c.unshift(s),c.length>10&&c.pop(),Object(r.P)(e,{recentlyFoundChatIds:c})}),Object(s.b)("clearRecentlyFoundChats",e=>Object(r.P)(e,{recentlyFoundChatIds:void 0})),Object(s.b)("setGlobalSearchContent",(e,t,a)=>{const{content:s}=a;return Object(r.Q)(e,s)}),Object(s.b)("setGlobalSearchChatId",(e,t,a)=>{const{id:s}=a;return Object(r.P)(e,{chatId:s,query:void 0,resultsByType:void 0})});var u=a(44),m=a(4);Object(s.b)("openLocalTextSearch",e=>{const{chatId:t,threadId:a}=Object(o.y)(e)||{};if(t&&a)return Object(r.W)(e,t,a,!0)}),Object(s.b)("closeLocalTextSearch",e=>{const{chatId:t,threadId:a}=Object(o.y)(e)||{};if(t&&a)return e=Object(r.W)(e,t,a,!1),e=Object(r.s)(e,t,a,void 0)}),Object(s.b)("setLocalTextSearchQuery",(e,t,a)=>{const{chatId:s,threadId:n}=Object(o.y)(e)||{};if(!s||!n)return;const{query:c}=a,i=Object(m.a)(s,n),{query:l}=e.localTextSearch.byChatThreadKey[i]||{};return c!==l&&(e=Object(r.s)(e,s,n,u.a)),e=Object(r.W)(e,s,n,!0,c)}),Object(s.b)("setLocalMediaSearchType",(e,t,a)=>{const{chatId:s}=Object(o.y)(e)||{};if(!s)return;const{mediaType:n}=a;return Object(r.V)(e,s,n)}),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(r.db)(e,void 0)),Object(s.b)("setSettingOption",(e,t,a)=>Object(r.u)(e,a));var h=a(7),O=a(158);Object(s.b)("toggleChatInfo",e=>({...e,isChatInfoShown:!e.isChatInfoShown})),Object(s.b)("toggleManagement",e=>{const{chatId:t}=Object(o.y)(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(o.y)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!1}}}}}),Object(s.b)("toggleStatistics",e=>({...e,isStatisticsShown:!e.isStatisticsShown})),Object(s.b)("openChat",(e,t,a)=>{if(!h.f)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)("showError",(e,t,a)=>{const{error:s}=a;if(!Object(O.a)(s))return e;const n=[...e.errors],c=n.findIndex(e=>e.message===s.message);return-1!==c&&n.splice(c,1),n.push(s),{...e,errors:n}}),Object(s.b)("dismissError",e=>{const t=[...e.errors];return t.pop(),{...e,errors:t}}),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(r.g)(e);return Object(r.h)(t)});a(75);var j=a(11),g=a(9);const f=Object(g.g)(e=>e(),1e3,!0),p=Object(g.g)(e=>e(),3e3,!0),I=Object(g.a)(e=>e(),500,!1,!0),v=Object(g.a)(e=>e(),500,!1,!0);async function y(e,t,a){const c=await Object(j.a)("fetchChats",{limit:n.i,offsetDate:a,archived:"archived"===e,withPinned:void 0===Object(s.e)().chats.orderedPinnedIds[e]});if(!c)return;const{chatIds:o}=c;o.length>0&&o[0]===t&&o.shift();let l=Object(s.e)();l=Object(r.e)(l,Object(d.c)(c.users,"id")),l=Object(r.K)(l,Object(d.c)(c.chats,"id")),l=Object(r.G)(l,e,o),l=Object(r.H)(l,e,c),Object.keys(c.draftsById).map(Number).forEach(e=>{l=Object(r.v)(l,e,i.MAIN_THREAD_ID,"draft",c.draftsById[e])}),Object.keys(c.replyingToById).map(Number).forEach(e=>{l=Object(r.v)(l,e,i.MAIN_THREAD_ID,"replyingToId",c.replyingToById[e])}),0!==o.length||l.chats.isFullyLoaded[e]||(l={...l,chats:{...l.chats,isFullyLoaded:{...l.chats.isFullyLoaded,[e]:!0}}}),Object(s.g)(l)}async function C(e){const t=await Object(j.a)("fetchFullChat",e);if(!t)return;const{users:a,fullInfo:n}=t;let c=Object(s.e)();a&&(c=Object(r.e)(c,Object(d.c)(a,"id"))),c=Object(r.F)(c,e.id,{fullInfo:n}),Object(s.g)(c)}async function w(e,t,a){const n=Object(s.e)(),c=Object(o.h)(n,t);if(c&&!c.isMin)return void(a?e.focusMessage({chatId:c.id,messageId:a}):e.openChat({id:c.id}));const i=Object(o.r)(n);e.openChat({id:-1});const l=await Object(j.a)("getChatByUsername",t);if(!l)return i&&e.openChat({id:i.id}),void e.showNotification({message:"User does not exist"});Object(s.g)(Object(r.F)(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.rb;c++){await Object(g.e)(200);const{byId:n,listIds:{active:c},orderedPinnedIds:{active:r}}=Object(s.e)().chats;if(!c)return;const{chatId:l}=Object(o.y)(e)||{},{pinnedChats:d,otherChats:b}=Object(m.Ab)(n,c,r),u=[...d,...b].find(({id:e})=>e!==l&&!a.includes(e));if(!u)return;a.push(u.id),t.loadViewportMessages({chatId:u.id,threadId:i.MAIN_THREAD_ID}),h.k&&t.loadPinnedMessages({chatId:u.id})}})()}),Object(s.b)("openChat",(e,t,a)=>{const{id:s,threadId:n}=a,{currentUserId:c}=e,r=Object(o.f)(e,s);if(r&&r.hasUnreadMark&&t.toggleChatUnread({id:s}),r)Object(m.mb)(r)&&!r.isMin&&t.requestChatUpdate({chatId:s});else if(s===c)Object(j.a)("fetchChat",{type:"self"});else{const t=Object(o.Cb)(e,s);t&&Object(j.a)("fetchChat",{type:"user",user:t})}if(n!==i.MAIN_THREAD_ID){Object(o.Ab)(e,s,n)||t.requestThreadInfoUpdate({chatId:s,threadId:n})}}),Object(s.b)("openSupportChat",(e,t)=>{const a=Object(o.wb)(e);t.openChat({id:a?a.id:-1}),a||(async()=>{const e=await Object(j.a)("fetchChat",{type:"support"});e&&t.openChat({id:e.chatId})})()}),Object(s.b)("openTipsChat",(e,t)=>{t.openChatByUsername({username:n.qb})}),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(o.M)(e,t.id)).sort((e,t)=>e.lastMessage.date-t.lastMessage.date)[0]:void 0;f(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(o.f)(e,s);c&&(n?C(c):I(()=>C(c)))}),Object(s.b)("loadSuperGroupOnlines",(e,t,a)=>{const{chatId:s}=a,n=Object(o.f)(e,s);n&&v(()=>Object(j.a)("fetchSuperGroupOnlines",n))}),Object(s.b)("loadTopChats",()=>{p(()=>y("active"))}),Object(s.b)("requestChatUpdate",(e,t,a)=>{const{chatId:s}=a,n=Object(o.f)(e,s);n&&Object(j.a)("requestChatUpdate",n)}),Object(s.b)("updateChatMutedState",(e,t,a)=>{const{chatId:s,isMuted:n}=a,c=Object(o.f)(e,s);c&&Object(j.a)("updateChatMutedState",{chat:c,isMuted:n})}),Object(s.b)("createChannel",(e,t,a)=>{const{title:n,about:c,photo:i,memberIds:d}=a;!async function(e,t,a,n){Object(s.g)({...Object(s.e)(),chatCreation:{progress:l.a.InProgress}});const c=await Object(j.a)("createChannel",{title:e,about:a,users:t});if(!c)return;const{id:o,accessHash:i}=c;let d=Object(s.e)();d=Object(r.F)(d,o,c),d={...d,chatCreation:{...d.chatCreation,progress:c?l.a.Complete:l.a.Error}},Object(s.g)(d),Object(s.d)().openChat({id:o}),o&&i&&n&&await Object(j.a)("editChatPhoto",{chatId:o,accessHash:i,photo:n})}(n,d.map(t=>Object(o.Cb)(e,t)).filter(Boolean),c,i)}),Object(s.b)("joinChannel",(e,t,a)=>{const{chatId:s}=a,n=Object(o.f)(e,s);if(!n)return;const{id:c,accessHash:r}=n;c&&r&&Object(j.a)("joinChannel",{channelId:c,accessHash:r})}),Object(s.b)("leaveChannel",(e,t,a)=>{const{chatId:s}=a,n=Object(o.f)(e,s);if(!n)return;const{id:c,accessHash:r}=n;c&&r&&Object(j.a)("leaveChannel",{channelId:c,accessHash:r})}),Object(s.b)("deleteChannel",(e,t,a)=>{const{chatId:s}=a,n=Object(o.f)(e,s);if(!n)return;const{id:c,accessHash:r}=n;c&&r&&Object(j.a)("deleteChannel",{channelId:c,accessHash:r})}),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:l.a.InProgress}});const n=await Object(j.a)("createGroupChat",{title:e,users:t});if(!n)return;const{id:c}=n;let o=Object(s.e)();o=Object(r.F)(o,c,n),o={...o,chatCreation:{...o.chatCreation,progress:n?l.a.Complete:l.a.Error}},Object(s.g)(o),Object(s.d)().openChat({id:c}),c&&a&&await Object(j.a)("editChatPhoto",{chatId:c,photo:a})}(n,c.map(t=>Object(o.Cb)(e,t)).filter(Boolean),i)}),Object(s.b)("toggleChatPinned",(e,t,a)=>{const{id:s,folderId:c}=a,r=Object(o.f)(e,s);if(r)if(c){const t=Object(o.i)(e,c);if(t){const a=!Object(o.M)(e,s,c),{pinnedChatIds:n,includedChatIds:r}=t,i=a?[s,...n||[]]:(n||[]).filter(e=>e!==s),l=[s,...r];Object(j.a)("editChatFolder",{id:c,folderUpdate:{...t,pinnedChatIds:i,includedChatIds:l}})}}else{const t=Object(o.j)(e,s),a=Object(o.M)(e,s,"archived"===t?n.g:void 0);Object(j.a)("toggleChatPinned",{chat:r,shouldBePinned:!a})}}),Object(s.b)("toggleChatArchived",(e,t,a)=>{const{id:s}=a,c=Object(o.f)(e,s);c&&Object(j.a)("toggleChatArchived",{chat:c,folderId:Object(m.hb)(c)?0:n.g})}),Object(s.b)("loadChatFolders",()=>{!async function(){const e=await Object(j.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(j.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(o.i)(e,s);c&&Object(j.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:r}=e.chatFolders;!async function(e,t){const{id:a,description:n,...c}=e;if(await Object(j.a)("editChatFolder",{id:t+1,folderUpdate:{id:t+1,...c}}),!n)return;const r=Object(s.e)(),{recommended:o}=r.chatFolders;o&&Object(s.g)({...r,chatFolders:{...r.chatFolders,recommended:o.filter(({id:e})=>e!==a)}})}(c,r&&r.length?Math.max.apply(Math.max,r):n.g)}),Object(s.b)("deleteChatFolder",(e,t,a)=>{const{id:s}=a;Object(o.i)(e,s)&&async function(e){await Object(j.a)("deleteChatFolder",e)}(s)}),Object(s.b)("toggleChatUnread",(e,t,a)=>{const{id:s}=a,n=Object(o.f)(e,s);n&&(n.unreadCount?Object(j.a)("markMessageListRead",{chat:n,threadId:i.MAIN_THREAD_ID}):Object(j.a)("toggleDialogUnread",{chat:n,hasUnreadMark:!n.hasUnreadMark}))}),Object(s.b)("openTelegramLink",(e,t,a)=>{const{url:s}=a,c=n.X.exec(s);w(t,c[1],c[2]?Number(c[2]):void 0)}),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(o.f)(e,s);c&&(async()=>{if(Object(m.ib)(c)){if(c=await Object(j.a)("migrateChat",c),!c)return;t.openChat({id:c.id})}Object(j.a)("togglePreHistoryHidden",{chat:c,isEnabled:n})})()}),Object(s.b)("updateChatDefaultBannedRights",(e,t,a)=>{const{chatId:s,bannedRights:n}=a,c=Object(o.f)(e,s);c&&Object(j.a)("updateChatDefaultBannedRights",{chat:c,bannedRights:n})}),Object(s.b)("updateChatMemberBannedRights",(e,t,a)=>{const{chatId:n,userId:c,bannedRights:i}=a;let l=Object(o.f)(e,n);const d=Object(o.Cb)(e,c);l&&d&&(async()=>{if(Object(m.ib)(l)){if(l=await Object(j.a)("migrateChat",l),!l)return;t.openChat({id:l.id})}await Object(j.a)("updateChatMemberBannedRights",{chat:l,user:d,bannedRights:i});const e=Object(s.e)(),a=Object(o.f)(e,n);if(!a||!a.fullInfo)return;const{members:b,kickedMembers:u}=a.fullInfo,h=!!i.viewMessages,O=!Object.keys(i).length;Object(s.g)(Object(r.F)(e,n,{fullInfo:{...a.fullInfo,...b&&h&&{members:b.filter(e=>e.userId!==c)},...b&&!h&&{members:b.map(e=>e.userId===c?{...e,bannedRights:i}:e)},...O&&u&&{kickedMembers:u.filter(e=>e.userId!==c)}}}))})()}),Object(s.b)("updateChatAdmin",(e,t,a)=>{const{chatId:n,userId:c,adminRights:i,customTitle:l}=a;let d=Object(o.f)(e,n);const b=Object(o.Cb)(e,c);d&&b&&(async()=>{if(Object(m.ib)(d)){if(d=await Object(j.a)("migrateChat",d),!d)return;t.openChat({id:d.id})}await Object(j.a)("updateChatAdmin",{chat:d,user:b,adminRights:i,customTitle:l});const e=Object(s.e)(),a=Object(o.f)(e,n);if(!a||!a.fullInfo)return;const{adminMembers:u}=a.fullInfo,h=!Object.keys(i).length;Object(s.g)(Object(r.F)(e,n,{fullInfo:{...a.fullInfo,...u&&h&&{adminMembers:u.filter(e=>e.userId!==c)},...u&&!h&&{adminMembers:u.map(e=>e.userId===c?{...e,adminRights:i,customTitle:l}:e)}}}))})()}),Object(s.b)("updateChat",(e,t,a)=>{const{chatId:n,title:c,about:i,photo:d}=a,b=Object(o.f)(e,n);b&&(async()=>{Object(s.g)(Object(r.Z)(Object(s.e)(),l.f.InProgress)),await Promise.all([b.title!==c?Object(j.a)("updateChatTitle",b,c):void 0,b.fullInfo&&b.fullInfo.about!==i?Object(j.a)("updateChatAbout",b,i):void 0,d?Object(j.a)("editChatPhoto",{chatId:n,accessHash:b.accessHash,photo:d}):void 0]),Object(s.g)(Object(r.Z)(Object(s.e)(),l.f.Complete))})()}),Object(s.b)("toggleSignatures",(e,t,a)=>{const{chatId:s,isEnabled:n}=a,c=Object(o.f)(e,s);c&&Object(j.a)("toggleSignatures",{chat:c,isEnabled:n})}),Object(s.b)("loadGroupsForDiscussion",()=>{(async()=>{const e=await Object(j.a)("fetchGroupsForDiscussion");if(!e)return;const t=e.reduce((e,t)=>(t&&(e[t.id]=t),e),{}),a=Object(r.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(o.f)(e,s);let r=Object(o.f)(e,n);c&&r&&(async()=>{if(Object(m.ib)(r)){if(r=await Object(j.a)("migrateChat",r),!r)return;t.openChat({id:r.id})}let{fullInfo:e}=r;if(!e){const t=await Object(j.a)("fetchFullChat",r);if(!t)return;e=t.fullInfo}e.isPreHistoryHidden&&await Object(j.a)("togglePreHistoryHidden",{chat:r,isEnabled:!1}),Object(j.a)("setDiscussionGroup",{channel:c,chat:r})})()}),Object(s.b)("unlinkDiscussionGroup",(e,t,a)=>{const{channelId:s}=a,n=Object(o.f)(e,s);if(!n)return;let c;n.fullInfo&&n.fullInfo.linkedChatId&&(c=Object(o.f)(e,n.fullInfo.linkedChatId)),(async()=>{await Object(j.a)("setDiscussionGroup",{channel:n}),c&&C(c)})()});var E=a(159);const M=new Map;async function S(e,t,a,c,i=!1,b=!1){const u=e.id;let m;switch(c){case l.e.Backwards:m=void 0;break;case l.e.Around:m=-(Math.round(n.N/2)+1);break;case l.e.Forwards:m=-(n.N+1)}const h=await Object(j.a)("fetchMessages",{chat:Object(o.zb)(Object(s.e)(),u,t),offsetId:a,addOffset:m,limit:n.N,threadId:t});if(!h)return;const{messages:O,users:g,chats:f,threadInfos:p,firstMessageId:I}=h,v=Object(d.c)(O,"id"),y=Object.keys(v).map(Number);let C=Object(s.e)();C=Object(r.b)(C,u,v),C=i?Object(r.bb)(C,u,t,y):Object(r.T)(C,u,t,y),C=Object(r.e)(C,Object(d.c)(g,"id")),C=Object(r.c)(C,Object(d.c)(f,"id")),C=Object(r.jb)(C,u,p),I&&(C=Object(r.v)(C,u,t,"firstMessageId",I));let w=Object(o.X)(C,u,t);const E=Object(o.cb)(C,u,t);if(i&&w&&E&&Object(d.b)(w,E)&&(C=Object(r.T)(C,u,t,E),w=Object(o.X)(C,u,t),C=Object(r.v)(C,u,t,"outlyingIds",void 0),i=!1),!b){const e=i?E:w,{newViewportIds:s}=k(e,a,c);C=Object(r.x)(C,u,t,s)}Object(s.g)(C)}function k(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,r=a===l.e.Backwards?c:c+1||s,o=r-n.N,i=r+n.N-1,d=e.slice(Math.max(0,o),i+1);let b,u;switch(a){case l.e.Backwards:b=r>0,u=o>=0;break;case l.e.Forwards:b=r<s,u=i<=s-1;break;case l.e.Around:default:b=d.length>0,u=d.length===n.N}return{newViewportIds:d,areSomeLocal:b,areAllLocal:u}}async function N(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&&await Object(g.f)();const n=Object(s.e)(),c=Object(o.y)(n);if(!c)return;const{threadId:r}=c;e.replyingTo||r===i.MAIN_THREAD_ID||(e.replyingTo=Object(o.Ab)(n,e.chat.id,r)),await Object(j.a)("sendMessage",e,a),a&&t&&M.delete(t)}Object(s.b)("loadViewportMessages",(e,t,a)=>{const{direction:s=l.e.Around,isBudgetPreload:c=!1}=a||{};let{chatId:i,threadId:d}=a||{};if(!i){const t=Object(o.y)(e);if(!t)return;i=t.chatId,d=t.threadId}const b=Object(o.f)(e,i);if(!b||b.isRestricted)return;const u=Object(o.Db)(e,i,d),m=Object(o.X)(e,i,d),h=Object(o.cb)(e,i,d);if(u&&u.length&&s!==l.e.Around){const a=s===l.e.Backwards?u[0]:u[u.length-1],n=Boolean(h),o=n?h:m,{newViewportIds:O,areSomeLocal:j,areAllLocal:g}=k(o,a,s);if(j&&(e=Object(r.x)(e,i,d,O)),async function(e,t,a,s,n,c,r,o){t||await S(n,c,o,r,a,s);s||(await Promise.resolve(),e.loadViewportMessages({chatId:n.id,threadId:c,direction:r,isBudgetPreload:!0}))}(t,g,n,c,b,d,s,a),c)return}else{const t=Object(o.H)(e,i)||Object(o.hb)(e,i,d),a=Boolean(t&&m&&!m.includes(t)),s=(a?h:m)||[],{newViewportIds:u,areSomeLocal:O,areAllLocal:j}=k(s,t,l.e.Around);O&&u.length>=n.N&&(e=Object(r.x)(e,i,d,u)),j||S(b,d,t,l.e.Around,a,c)}return e}),Object(s.b)("loadMessage",(e,t,a)=>{const{chatId:n,messageId:c,replyOriginForId:l}=a,b=Object(o.f)(e,n);b&&async function(e,t,a){const n=await Object(j.a)("fetchMessage",{chat:e,messageId:t});if(!n)return;if(n===i.MESSAGE_DELETED){if(a){let t=Object(s.e)();const n=Object(o.k)(t,e.id,a);t=Object(r.J)(t,e.id,a,{...n,replyToMessageId:void 0}),Object(s.g)(t)}return}let c=Object(s.e)();c=Object(r.J)(c,e.id,t,n.message),c=Object(r.e)(c,Object(d.c)(n.users,"id")),Object(s.g)(c)}(b,c,l)}),Object(s.b)("sendMessage",(e,t,a)=>{const s=Object(o.y)(e);if(!s)return;const{chatId:c,threadId:r,type:i}=s;if("scheduled"===i&&!a.scheduledAt)return{...e,messages:{...e.messages,contentToBeScheduled:a}};const l=Object(o.f)(e,c);t.setReplyingToId({messageId:void 0});const b={...a,chat:l,replyingTo:Object(o.ib)(e,c,r)},u=!a.attachments||a.attachments.length<=1,m=!u&&a.attachments&&a.attachments.length>1;if(u){const{attachments:e,...t}=b;N({...t,attachment:e?e[0]:void 0})}else if(m){const{text:e,entities:t,attachments:a,...s}=b,c=Object(d.n)(a,n.F);for(let a=0;a<c.length;a++){const[n,...r]=c[a],o=`${Date.now()}${a}`;N({...s,text:0===a?e:void 0,entities:0===a?t:void 0,attachment:n,groupedId:r.length>0?o:void 0}),r.forEach(e=>{N({...s,attachment:e,groupedId:o})})}}else{const{text:e,entities:t,attachments:a,replyingTo:s,...n}=b;e&&N({...n,text:e,entities:t,replyingTo:s}),a.forEach(e=>{N({...n,attachment:e})})}}),Object(s.b)("editMessage",(e,t,a)=>{const{text:s,entities:n}=a,c=Object(o.y)(e);if(!c)return;const{chatId:r,threadId:i,type:l}=c,d=Object(o.f)(e,r),b=Object(o.D)(e,r,i,l);d&&b&&(Object(j.a)("editMessage",{chat:d,message:b,text:s,entities:n}),t.setEditingId({messageId:void 0}))}),Object(s.b)("cancelSendingMessage",(e,t,a)=>{const{chatId:s,messageId:n}=a,c=Object(o.k)(e,s,n),r=c&&M.get(c.previousLocalId||c.id);r&&Object(j.b)(r),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:l,entities:d}=c,b=Object(o.f)(e,s);return n===i.MAIN_THREAD_ID&&Object(j.a)("saveDraft",{chat:b,text:l,entities:d,replyToMsgId:Object(o.ib)(e,s,n)}),Object(r.v)(e,s,n,"draft",c)}),Object(s.b)("clearDraft",(e,t,a)=>{const{chatId:s,threadId:n,localOnly:c}=a;if(!Object(o.B)(e,s,n))return;const l=Object(o.f)(e,s);return c||n!==i.MAIN_THREAD_ID||Object(j.a)("clearDraft",l),Object(r.v)(e,s,n,"draft",void 0)}),Object(s.b)("pinMessage",(e,t,a)=>{const s=Object(o.r)(e);if(!s)return;const{messageId:n,isUnpin:c,isOneSide:r,isSilent:i}=a;Object(j.a)("pinMessage",{chat:s,messageId:n,isUnpin:c,isOneSide:r,isSilent:i})}),Object(s.b)("unpinAllMessages",(e,t,a)=>{const n=Object(o.f)(e,a.chatId);n&&async function(e){await Object(j.a)("unpinAllMessages",{chat:e});let t=Object(s.e)();t=Object(r.v)(t,e.id,i.MAIN_THREAD_ID,"pinnedIds",[]),Object(s.g)(t)}(n)}),Object(s.b)("deleteMessages",(e,t,a)=>{const{messageIds:s,shouldDeleteForAll:n}=a,c=Object(o.y)(e);if(!c)return;const{chatId:r,threadId:i}=c,l=Object(o.f)(e,r);Object(j.a)("deleteMessages",{chat:l,messageIds:s,shouldDeleteForAll:n});const d=Object(o.C)(e,r,i);s.includes(d)&&t.setEditingId({messageId:void 0})}),Object(s.b)("deleteScheduledMessages",(e,t,a)=>{const{messageIds:s}=a,n=Object(o.y)(e);if(!n)return;const{chatId:c}=n,r=Object(o.f)(e,c);Object(j.a)("deleteScheduledMessages",{chat:r,messageIds:s});const i=Object(o.E)(e,c);s.includes(i)&&t.setEditingId({messageId:void 0})}),Object(s.b)("deleteHistory",(e,t,a)=>{const{chatId:s,maxId:n,shouldDeleteForAll:c}=a,r=Object(o.f)(e,s);r&&Object(j.a)("deleteHistory",{chat:r,shouldDeleteForAll:c,maxId:n})}),Object(s.b)("markMessageListRead",(e,t,a)=>{const s=Object(o.y)(e);if(!s)return;const{chatId:n,threadId:c}=s,r=Object(o.zb)(e,n,c);if(!r)return;const{maxId:i}=a;Object(j.a)("markMessageListRead",{chat:r,threadId:c,maxId:i})}),Object(s.b)("markMessagesRead",(e,t,a)=>{const s=Object(o.r)(e);if(!s)return;const{messageIds:n}=a;Object(j.a)("markMessagesRead",{chat:s,messageIds:n})}),Object(s.b)("loadWebPagePreview",(e,t,a)=>{const{text:n}=a;!async function(e){const t=await Object(j.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,r=Object(o.f)(e,s);r&&Object(j.a)("sendPollVote",{chat:r,messageId:n,options:c})}),Object(s.b)("loadPollOptionResults",(e,t,a)=>{const{chat:n,messageId:c,option:o,offset:i,limit:l,shouldResetVoters:b}=a;!async function(e,t,a,n,c,o){const i=await Object(j.a)("loadPollOptionResults",{chat:e,messageId:t,option:a,offset:n,limit:c});if(!i)return;let l=Object(s.e)();l=Object(r.e)(l,Object(d.c)(i.users,"id"));const{voters:b}=l.pollResults;Object(s.g)({...l,pollResults:{...l.pollResults,voters:{...b,[a]:[...!o&&b&&b[a]?b[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,o,i,l,b)}),Object(s.b)("forwardMessages",e=>{const{fromChatId:t,messageIds:a,toChatId:n}=e.forwardMessages,c=t?Object(o.f)(e,t):void 0,r=n?Object(o.f)(e,n):void 0,i=t&&a?a.sort((e,t)=>e-t).map(a=>Object(o.k)(e,t,a)).filter(Boolean):void 0;c&&r&&i&&i.length&&function(e,t,a){Object(j.a)("forwardMessages",{fromChat:e,toChat:t,messages:a}),Object(s.g)({...Object(s.e)(),forwardMessages:{}})}(c,r,i)}),Object(s.b)("loadScheduledHistory",e=>{const t=Object(o.r)(e);if(!t)return;const{hash:a}=e.scheduledMessages.byChatId[t.id]||{};!async function(e,t){const a=await Object(j.a)("fetchScheduledHistory",{chat:e,hash:t});if(!a)return;const{hash:n,messages:c}=a,o=Object(d.c)(c,"id"),l=Object.keys(o).map(Number).sort((e,t)=>t-e);let b=Object(s.e)();b=Object(r.t)(b,e.id,o,n),b=Object(r.v)(b,e.id,i.MAIN_THREAD_ID,"scheduledIds",l),Object(s.g)(b)}(t,a)}),Object(s.b)("sendScheduledMessages",(e,t,a)=>{const{chatId:s,id:n}=a,c=Object(o.f)(e,s);c&&Object(j.a)("sendScheduledMessages",{chat:c,ids:[n]})}),Object(s.b)("rescheduleMessage",(e,t,a)=>{const{chatId:s,messageId:n,scheduledAt:c}=a,r=Object(o.f)(e,s),i=r&&Object(o.lb)(e,r.id,n);r&&i&&Object(j.a)("rescheduleMessage",{chat:r,message:i,scheduledAt:c})}),Object(s.b)("requestThreadInfoUpdate",(e,t,a)=>{const{chatId:s,threadId:n}=a,c=Object(o.zb)(e,s,n);c&&Object(j.a)("requestThreadInfoUpdate",{chat:c,threadId:n})}),Object(s.b)("loadPinnedMessages",(e,t,a)=>{const{chatId:n}=a,c=Object(o.f)(e,n);c&&async function(e){const t=await Object(j.a)("fetchPinnedMessages",{chat:e});if(!t)return;const{messages:a,chats:n,users:c}=t,o=Object(d.c)(a,"id"),l=Object.keys(o).map(Number).sort((e,t)=>t-e);let b=Object(s.e)();b=Object(r.b)(b,e.id,o),b=Object(r.v)(b,e.id,i.MAIN_THREAD_ID,"pinnedIds",l),b=Object(r.e)(b,Object(d.c)(c,"id")),b=Object(r.c)(b,Object(d.c)(n,"id")),Object(s.g)(b)}(c)}),Object(s.b)("loadMessageLink",(e,t,a)=>{const{messageId:s,chatId:n}=a,c=Object(o.f)(e,n),r=Object(o.k)(e,n,s);c&&r&&(async()=>{const e=await Object(j.a)("fetchMessageLink",{chat:c,message:r});e&&Object(E.c)(e.link)})()});var P=a(46);const T=Object(g.g)(e=>e(),500,!1);async function A(e,t){const a=await Object(j.a)("searchGifs",{query:e,offset:t});a&&Object(s.g)(Object(r.O)(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(j.a)("fetchStickerSets",{hash:e});if(!t)return;Object(s.g)(Object(r.gb)(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(g.e)(500)})()}),Object(s.b)("loadRecentStickers",e=>{const{hash:t}=e.stickers.recent||{};!async function(e=0){const t=await Object(j.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(j.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(j.a)("fetchFeaturedStickers",{hash:e});if(!t)return;Object(s.g)(Object(r.gb)(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(o.tb)(e,n);if(!t)return;c=t.accessHash}!async function(e,t){const a=await Object(j.a)("fetchStickers",{stickerSetId:e,accessHash:t});if(!a)return;const{set:n,stickers:c,packs:o}=a;let i=Object(s.e)();i=Object(r.fb)(i,n.id,{...n,stickers:c,packs:o});const l=i.stickers.forEmoji.emoji;l&&o[l]&&(i=Object(r.n)(i));Object(s.g)(i)}(n,c)}),Object(s.b)("loadAnimatedEmojis",()=>{!async function(){const e=await Object(j.a)("fetchAnimatedEmojis");if(!e)return;const{set:t,stickers:a}=e;Object(s.g)(Object(r.p)(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(j.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(j.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(j.a)("faveSticker",{sticker:e,unfave:!0})}(n)}),Object(s.b)("toggleStickerSet",(e,t,a)=>{const{stickerSetId:s}=a,n=Object(o.tb)(e,s);if(!n)return;const{accessHash:c,installedDate:r}=n;Object(j.a)(r?"uninstallStickerSet":"installStickerSet",{stickerSetId:s,accessHash:c})}),Object(s.b)("setStickerSearchQuery",(e,t,a)=>{const{query:n}=a;n&&T(()=>{!async function(e,t=0){const a=await Object(j.a)("searchStickers",{query:e,hash:t});if(!a)return;const n=Object(s.e)(),{setsById:c,added:o}=n.stickers,i=a.sets.map(({id:e})=>e);o.setIds&&o.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(r.gb)(n,"search",a.hash,a.sets,i))}(n)})}),Object(s.b)("setGifSearchQuery",(e,t,a)=>{const{query:s}=a;"string"==typeof s&&T(()=>{A(s)})}),Object(s.b)("searchMoreGifs",e=>{const{query:t,offset:a}=e.gifs.search;"string"==typeof t&&T(()=>{A(t,a)})}),Object(s.b)("loadStickersForEmoji",(e,t,a)=>{const{emoji:n}=a,{hash:c}=e.stickers.forEmoji;T(()=>{!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(j.a)("fetchStickersForEmoji",{emoji:e,hash:t});if(a=Object(s.e)(),!n||a.stickers.forEmoji.emoji!==e)return;a=Object(r.hb)(a,e,n.stickers,n.hash),Object(s.g)(a)}(n,c)})}),Object(s.b)("clearStickersForEmoji",e=>({...e,stickers:{...e.stickers,forEmoji:{}}}));var x=a(28);const R=Object(g.g)(e=>e(),500,!1);async function L(e="",t,a,c,i,l){let b;if(c){const s=await Object(j.a)("searchMessagesLocal",{chatOrUser:c,query:e,type:t,limit:n.u,offsetId:a,minDate:l,maxDate:i});if(s){const{messages:e,users:t,totalCount:a,nextOffsetId:n}=s;b={messages:e,users:t,chats:[],totalCount:a,nextRate:n}}}else b=await Object(j.a)("searchMessagesGlobal",{query:e,offsetRate:a,limit:n.u,type:t,maxDate:i,minDate:l});let u=Object(s.e)();const m=Object(o.t)(u);if(!b||""!==e&&e!==m)return void Object(s.g)(Object(r.R)(u,{messages:!1}));const{messages:h,users:O,chats:g,totalCount:f,nextRate:p}=b;g.length&&(u=Object(r.c)(u,Object(d.c)(g,"id"))),O.length&&(u=Object(r.e)(u,Object(d.c)(O,"id"))),h.length&&(u=Object(r.d)(u,h)),u=Object(r.S)(u,h,f,t,p),Object(s.g)(u)}async function F(){const e=await Object(j.a)("fetchChats",{limit:n.i,archived:!0,withPinned:!0});if(!e)return;let t=Object(s.e)();t=Object(r.mb)(t,Object(d.c)(e.users,"id")),t=Object(r.K)(t,Object(d.c)(e.chats,"id")),t=Object(r.q)(t,"archived",e.chatIds),t=Object(r.H)(t,"archived",e),Object(s.g)(t)}async function D(){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(o.Cb)(e,t)).filter(Boolean),c=await Object(j.a)("fetchUsers",{users:n});c&&(e=Object(s.e)(),e=Object(r.mb)(e,Object(d.c)(c,"id")),Object(s.g)(e))}Object(s.b)("setGlobalSearchQuery",(e,t,a)=>{const{chatId:c}=e.globalSearch,{query:i}=a;i&&!c&&R(()=>{!async function(e){const t=await Object(j.a)("searchChats",{query:e,limit:n.u});let a=Object(s.e)();const c=Object(o.t)(a);if(!t||!c||e!==c)return void Object(s.g)(Object(r.R)(a,{chats:!1}));const{localChats:i,localUsers:l,globalChats:b,globalUsers:u}=t;(i.length||b.length)&&(a=Object(r.c)(a,Object(d.c)([...i,...b],"id")));(l.length||u.length)&&(a=Object(r.e)(a,Object(d.c)([...l,...u],"id")));a=Object(r.R)(a,{chats:!1}),a=Object(r.P)(a,{localResults:{chats:i,users:l},globalResults:{...a.globalSearch.globalResults,chats:b,users:u}}),Object(s.g)(a)}(i)})}),Object(s.b)("setGlobalSearchDate",(e,t,a)=>{const{date:n}=a,c=n?Object(x.m)(n):n,i=Object(r.P)(e,{date:n,query:"",resultsByType:{...e.globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}});Object(s.g)(i);const{chatId:l}=e.globalSearch;L("","text",void 0,l?Object(o.f)(e,l):void 0,c,n)}),Object(s.b)("searchMessagesGlobal",(e,t,a)=>{const{query:s,resultsByType:n,chatId:c,date:r}=e.globalSearch,i=r?Object(x.m)(r):r,{type:l}=a,{nextOffsetId:d}=n&&n[l]||{};L(s,l,d,c?Object(o.f)(e,c):void 0,i,r)}),Object(s.b)("searchTextMessagesLocal",e=>{const{chatId:t,threadId:a}=Object(o.y)(e)||{},c=t?Object(o.f)(e,t):void 0,l=Object(o.A)(e);if(!c||!l||!a)return;const{query:b,results:u}=l,m=u?u.nextOffsetId:void 0;let h;if(a!==i.MAIN_THREAD_ID){const s=Object(o.yb)(e,t,a);h=s?s.topMessageId:void 0}!async function(e,t,a,c,i){const l=await Object(j.a)("searchMessagesLocal",{chatOrUser:e,type:"text",query:c,topMessageId:a,limit:n.P,offsetId:i});if(!l)return;const{messages:b,users:u,totalCount:m,nextOffsetId:h}=l,O=Object(d.c)(b,"id"),g=Object.keys(O).map(Number);let f=Object(s.e)();const p=Object(o.A)(f);if(!p||c&&c!==p.query)return;f=Object(r.b)(f,e.id,O),f=Object(r.e)(f,Object(d.c)(u,"id")),f=Object(r.X)(f,e.id,t,g,m,h),Object(s.g)(f)}(c,a,h,b,m)}),Object(s.b)("searchMediaMessagesLocal",e=>{const t=Object(o.w)(e),a=t?e.users.byId[t]||e.chats.byId[t]:void 0,c=Object(o.v)(e);if(!a||!c)return;const{currentType:i,resultsByType:l}=c,b=i&&l&&l[i],u=b?b.nextOffsetId:void 0;i&&async function(e,t,a){const c=await Object(j.a)("searchMessagesLocal",{chatOrUser:e,type:t,limit:n.cb,offsetId:a});if(!c)return;const{messages:i,users:l,totalCount:b,nextOffsetId:u}=c,m=Object(d.c)(i,"id"),h=Object.keys(m).map(Number);let O=Object(s.e)();if(!Object(o.v)(O))return;O=Object(r.b)(O,e.id,m),O=Object(r.e)(O,Object(d.c)(l,"id")),O=Object(r.U)(O,e.id,t,h,b,u),Object(s.g)(O)}(a,i,u)}),Object(s.b)("searchMessagesByDate",(e,t,a)=>{const{timestamp:n}=a,{chatId:c}=Object(o.y)(e)||{};if(!c)return;const r=Object(o.f)(e,c);r&&async function(e,t){const a=await Object(j.a)("findFirstMessageIdAfterDate",{chat:e,timestamp:t});if(!a)return;Object(s.d)().focusMessage({chatId:e.id,messageId:a})}(r,n)}),Object(s.b)("checkPublicLink",(e,t,a)=>{const{chatId:n}=Object(o.y)(e)||{};if(!n)return;if(e.management.progress===l.f.InProgress)return;const{username:c}=a;(async()=>{e=Object(r.Z)(e,l.f.InProgress),e=Object(r.Y)(e,n,{isUsernameAvailable:void 0}),Object(s.g)(e);const t=await Object(j.a)("checkChatUsername",{username:c});e=Object(s.e)(),e=Object(r.Z)(e,t?l.f.Complete:l.f.Error),e=Object(r.Y)(e,n,{isUsernameAvailable:t}),Object(s.g)(e)})()}),Object(s.b)("updatePublicLink",(e,t,a)=>{const{chatId:n}=Object(o.y)(e)||{};let c=n&&Object(o.f)(e,n);if(!n||!c)return;const{username:i}=a;(async()=>{if(e=Object(r.Z)(e,l.f.InProgress),Object(s.g)(e),Object(m.ib)(c)){if(c=await Object(j.a)("migrateChat",c),!c)return;t.openChat({id:c.id})}const a=await Object(j.a)("setChatUsername",{chat:c,username:i});e=Object(s.e)(),e=Object(r.Z)(e,a?l.f.Complete:l.f.Error),e=Object(r.Y)(e,n,{isUsernameAvailable:void 0}),Object(s.g)(e)})()}),Object(s.b)("updatePrivateLink",e=>{const{chatId:t}=Object(o.y)(e)||{},a=t&&Object(o.f)(e,t);t&&a&&Object(j.a)("updatePrivateLink",{chat:a})}),Object(s.b)("sync",(e,t)=>{!async function(e){n.m&&console.log(">>> START SYNC");await Object(j.a)("fetchCurrentUser");const t=await async function(){const e=await Object(j.a)("fetchChats",{limit:n.i,withPinned:!0});if(!e)return;let t=Object(s.e)();const{recentlyFoundChatIds:a}=t.globalSearch,{userIds:c}=t.contactList||{},{currentUserId:l}=t,b=[...a||[],...c||[],...l?[l]:[]],u=b.map(e=>Object(o.Cb)(t,e)).filter(Boolean),h=b.map(e=>Object(o.f)(t,e)).filter(Boolean),{chatId:O}=Object(o.y)(t)||{};if(O){const e=Object(o.f)(t,O);if(e&&!b.includes(O)&&h.push(e),Object(m.lb)(O)){const e=Object(o.Cb)(t,O);e&&!b.includes(O)&&u.push(e)}}u.push(...e.users),h.push(...e.chats),t=Object(r.r)(t,Object(d.c)(h,"id")),t=Object(r.q)(t,"active",e.chatIds),t={...t,chats:{...t.chats}},t=Object(r.H)(t,"active",e),Object.keys(e.draftsById).map(Number).forEach(a=>{t=Object(r.v)(t,a,i.MAIN_THREAD_ID,"draft",e.draftsById[a])}),Object.keys(e.replyingToById).map(Number).forEach(a=>{t=Object(r.v)(t,a,i.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||[],c=Object(s.e)();const{chatId:l}=Object(o.y)(c)||{},b=Object.keys(c.messages.byChatId).map(Number).reduce((e,t)=>{const a=Object(o.B)(c,t,i.MAIN_THREAD_ID);return a?{...e,[t]:a}:e},{});if(l){const e=await(u=c.chats.byId[l],Object(j.a)("fetchMessages",{chat:u,threadId:i.MAIN_THREAD_ID,offsetId:u.lastReadInboxMessageId,addOffset:-(Math.round(n.N/2)+1),limit:n.N}));c=Object(s.e)();const{chatId:b}=Object(o.y)(c)||{};if(e&&b===l){const s=c.messages.byChatId[l],n=Object(d.c)(e.messages,"id"),o=Object.keys(n).map(Number);c={...c,messages:{...c.messages,byChatId:{[l]:{byId:n,threadsById:{[i.MAIN_THREAD_ID]:{...s&&s.threadsById[i.MAIN_THREAD_ID],listedIds:o,viewportIds:o,outlyingIds:void 0}}}}}},c=Object(r.K)(c,Object(d.c)(e.chats,"id")),c=Object(r.jb)(c,l,e.threadInfos),t=!0,a=Array.prototype.concat(a,e.users)}}var u;t||(c={...c,messages:{...c.messages,byChatId:{}}});Object.keys(b).map(Number).forEach(e=>{c=Object(r.v)(c,e,i.MAIN_THREAD_ID,"draft",b[e])}),e?c=Object(r.w)(c,Object(d.c)(a,"id")):a&&(c=Object(r.mb)(c,Object(d.c)(a,"id")));Object(s.g)(c)}(t),Object(s.g)({...Object(s.e)(),lastSyncTime:Date.now()}),n.m&&console.log(">>> FINISH SYNC");e()}(t.afterSync)}),Object(s.b)("afterSync",(e,t)=>{!async function(e){n.m&&console.log(">>> START AFTER-SYNC");e.loadFavoriteStickers(),await Promise.all([D(),F()]),await Object(j.a)("fetchCurrentUser"),n.m&&console.log(">>> FINISH AFTER-SYNC")}(t)});const B=Object(g.a)(e=>e(),500,!1,!0);function U(e,{visibility:t,allowedIds:a,deniedIds:s}){const{users:{byId:n},chats:{byId:c}}=e,r={visibility:t};let o,i;const l=e=>{if(!Object(m.lb)(e))return;const{id:t,accessHash:a}=n[e]||{};return t?{id:t,accessHash:a}:void 0},d=e=>{if(Object(m.lb)(e))return;const t=c[e];return t?{id:t.id}:void 0};return"contacts"!==t&&"nobody"!==t||(o=a.map(l).filter(Boolean),i=a.map(d).filter(Boolean),o.length>0&&(r.allowedUsers=o),i.length>0&&(r.allowedChats=i)),"everybody"!==t&&"contacts"!==t||(o=s.map(l).filter(Boolean),i=s.map(d).filter(Boolean),o.length>0&&(r.blockedUsers=o),i.length>0&&(r.blockedChats=i)),r}Object(s.b)("loadFullUser",(e,t,a)=>{const{userId:s}=a,n=Object(o.Cb)(e,s);if(!n)return;const{id:c,accessHash:r}=n;B(()=>Object(j.a)("fetchFullUser",{id:c,accessHash:r}))}),Object(s.b)("loadUser",(e,t,a)=>{const{userId:n}=a,c=Object(o.Cb)(e,n);c&&(async()=>{const t=await Object(j.a)("fetchUsers",{users:[c]});t&&(e=Object(s.e)(),e=Object(r.mb)(e,Object(d.c)(t,"id")),Object(s.g)(e))})()}),Object(s.b)("loadTopUsers",e=>{const{hash:t,lastRequestedAt:a}=e.topPeers;(!a||Date.now()-a>6e4)&&async function(e){const t=await Object(j.a)("fetchTopUsers",{hash:e});if(!t)return;const{hash:a,ids:n,users:c}=t;let o=Object(s.e)();o=Object(r.e)(o,Object(d.c)(c,"id")),o={...o,topPeers:{...o.topPeers,hash:a,userIds:n,lastRequestedAt:Date.now()}},Object(s.g)(o)}(t)}),Object(s.b)("loadContactList",e=>{const{hash:t}=e.contactList||{};!async function(e){const t=await Object(j.a)("fetchContactList",{hash:e});if(!t)return;let a=Object(r.e)(Object(s.e)(),Object(d.c)(t.users,"id"));a=Object(r.c)(a,Object(d.c)(t.chats,"id"));const n=e=>e.lastName||e.firstName||"",c=new Intl.Collator("en-US"),o=t.users.sort((e,t)=>c.compare(n(e),n(t))).filter(e=>!e.isSelf);Object(s.g)({...a,contactList:{hash:t.hash,userIds:o.map(e=>e.id)}})}(t)}),Object(s.b)("loadCurrentUser",()=>{Object(j.a)("fetchCurrentUser")}),Object(s.b)("updateContact",(e,t,a)=>{const{userId:n,isMuted:c,firstName:i,lastName:d}=a;!async function(e,t,a,n){const c=Object(s.e)(),i=Object(o.Cb)(c,e);if(!i)return;Object(s.d)().updateChatMutedState({chatId:e,isMuted:t}),Object(s.g)(Object(r.Z)(Object(s.e)(),l.f.InProgress));await Object(j.a)("updateContact",{phone:i.phoneNumber,firstName:a,lastName:n})&&Object(s.g)(Object(r.lb)(Object(s.e)(),i.id,{firstName:a,lastName:n}));Object(s.g)(Object(r.Z)(Object(s.e)(),l.f.Complete))}(n,c,i,d)}),Object(s.b)("deleteUser",(e,t,a)=>{const{userId:n}=a;!async function(e){const t=Object(s.e)(),a=Object(o.Cb)(t,e);if(!a)return;const{id:n,accessHash:c}=a;await Object(j.a)("deleteUser",{id:n,accessHash:c})}(n)}),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.X)?t.openTelegramLink({url:c.value}):window.open(c.value);break;case"callback":{const t=Object(o.r)(e);if(!t)return;!async function(e,t,a){const n=await Object(j.a)("answerCallbackButton",{chatId:e.id,accessHash:e.accessHash,messageId:t,data:a});if(!n||!n.message)return;const{message:c,alert:r}=n;r?Object(s.d)().showError({error:{message:c}}):Object(s.d)().showNotification({message:c})}(t,c.messageId,c.value);break}case"requestPoll":t.openPollModal();break;case"buy":{const a=Object(o.r)(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(o.k)(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(o.r)(e);n&&c&&async function(e,t,a){await Object(j.a)("sendMessage",{chat:e,text:a})}(c,0,s)}),Object(s.b)("updateProfile",(e,t,a)=>{const{photo:n,firstName:c,lastName:i,bio:d,username:b}=a;(async()=>{const{currentUserId:t}=e;if(t){if(Object(s.g)({...Object(s.e)(),profileEdit:{progress:l.j.InProgress}}),n&&await Object(j.a)("updateProfilePhoto",n),c||i||d){if(await Object(j.a)("updateProfile",{firstName:c,lastName:i,about:d})){e=Object(s.e)();const a=t&&Object(o.Cb)(e,t);a&&Object(s.g)(Object(r.lb)(e,a.id,{firstName:c,lastName:i,fullInfo:{...a.fullInfo,bio:d}}))}}if(b){await Object(j.a)("updateUsername",b)&&t&&Object(s.g)(Object(r.lb)(Object(s.e)(),t,{username:b}))}Object(s.g)({...Object(s.e)(),profileEdit:{progress:l.j.Complete}})}})()}),Object(s.b)("checkUsername",(e,t,a)=>{const{username:n}=a;(async()=>{if(e.profileEdit&&e.profileEdit.progress===l.j.InProgress)return;Object(s.g)({...e,profileEdit:{progress:e.profileEdit?e.profileEdit.progress:l.j.Idle,isUsernameAvailable:void 0}});const t=await Object(j.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(j.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:l.n,document:{fileName:"",size:n.size,mimeType:n.type,previewBlobUrl:c}},...e.settings.loadedWallpapers||[]]}}),(async()=>{const t=await Object(j.a)("uploadWallpaper",n);if(!t)return;const{wallpaper:a}=t;if(!(e=Object(s.e)()).settings.loadedWallpapers)return;const r=e.settings.loadedWallpapers[0];if(!r||r.slug!==l.n)return;const o={...a,document:{...a.document,previewBlobUrl:c}};Object(s.g)({...e,settings:{...e.settings,loadedWallpapers:[o,...e.settings.loadedWallpapers.slice(1)]}})})()}),Object(s.b)("loadBlockedContacts",()=>{(async()=>{const e=await Object(j.a)("fetchBlockedContacts");if(!e)return;let t=Object(s.e)();e.users&&e.users.length&&(t=Object(r.e)(t,Object(d.c)(e.users,"id"))),e.chats&&e.chats.length&&(t=Object(r.K)(t,Object(d.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(j.a)("blockContact",n))return;const e=Object(s.e)();Object(s.g)(Object(r.a)(e,n))})()}),Object(s.b)("unblockContact",(e,t,a)=>{const{contactId:n}=a;let c;if(Object(m.lb)(n)){const t=Object(o.Cb)(e,n);if(!t)return;c=t.accessHash}(async()=>{if(!await Object(j.a)("unblockContact",n,c))return;const e=Object(s.e)();Object(s.g)(Object(r.o)(e,n))})()}),Object(s.b)("loadAuthorizations",()=>{(async()=>{const e=await Object(j.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(j.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(j.a)("terminateAllAuthorizations"))return;const e=Object(s.e)();Object(s.g)({...e,activeSessions:e.activeSessions.filter(e=>e.isCurrent)})})()}),Object(s.b)("loadNotificationsSettings",()=>{(async()=>{const e=await Object(j.a)("loadNotificationsSettings");e&&Object(s.g)(Object(r.u)(Object(s.e)(),e))})()}),Object(s.b)("updateNotificationSettings",(e,t,a)=>{const{peerType:n,isSilent:c,isShowPreviews:o}=a;(async()=>{await Object(j.a)("updateNotificationSettings",n,{isSilent:c,isShowPreviews:o})&&Object(s.g)(Object(r.ab)(Object(s.e)(),n,c,o))})()}),Object(s.b)("updateContactSignUpNotification",(e,t,a)=>{const{isSilent:n}=a;(async()=>{await Object(j.a)("updateContactSignUpNotification",n)&&Object(s.g)(Object(r.u)(Object(s.e)(),{hasContactJoinedNotifications:!n}))})()}),Object(s.b)("loadLanguages",()=>{(async()=>{const e=await Object(j.a)("fetchLanguages");e&&Object(s.g)(Object(r.u)(Object(s.e)(),{languages:e}))})()}),Object(s.b)("loadPrivacySettings",()=>{(async()=>{const[e,t,a,n,c]=await Promise.all([Object(j.a)("fetchPrivacySettings","phoneNumber"),Object(j.a)("fetchPrivacySettings","lastSeen"),Object(j.a)("fetchPrivacySettings","profilePhoto"),Object(j.a)("fetchPrivacySettings","forwards"),Object(j.a)("fetchPrivacySettings","chatInvite")]);if(!(e&&t&&a&&n&&c))return;const r=Object(s.e)();r.settings.privacy.phoneNumber=e,r.settings.privacy.lastSeen=t,r.settings.privacy.profilePhoto=a,r.settings.privacy.forwards=n,r.settings.privacy.chatInvite=c,Object(s.g)(r)})()}),Object(s.b)("setPrivacyVisibility",(e,t,a)=>{const{privacyKey:n,visibility:c}=a,{privacy:{[n]:r}}=e.settings;if(!r)return;const o=U(e,{visibility:c,allowedIds:[...r.allowUserIds,...r.allowChatIds],deniedIds:[...r.blockUserIds,...r.blockChatIds]});(async()=>{const e=await Object(j.a)("setPrivacySettings",n,o);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:r}=a,{privacy:{[n]:o}}=e.settings;if(!o)return;const i=U(e,{visibility:o.visibility,allowedIds:c?r:[...o.allowUserIds,...o.allowChatIds],deniedIds:c?[...o.blockUserIds,...o.blockChatIds]:r});(async()=>{const e=await Object(j.a)("setPrivacySettings",n,i);if(e){const t=Object(s.e)();t.settings.privacy[n]=e,Object(s.g)(t)}})()}),Object(s.b)("loadPasswordInfo",()=>{(async()=>{const e=await Object(j.a)("getPasswordInfo");if(!e)return;let t=Object(s.e)();t=Object(r.u)(t,{hasPassword:e.hasPassword}),t=Object(r.kb)(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(r.kb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("checkPassword",n);Object(s.g)(Object(r.kb)(Object(s.e)(),{isLoading:!1})),e&&c()})()}),Object(s.b)("clearPassword",(e,t,a)=>{const{currentPassword:n,onSuccess:c}=a;Object(s.g)(Object(r.kb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("clearPassword",n);Object(s.g)(Object(r.kb)(Object(s.e)(),{isLoading:!1})),e&&c()})()}),Object(s.b)("updatePassword",(e,t,a)=>{const{currentPassword:n,password:c,hint:o,email:i,onSuccess:l}=a;Object(s.g)(Object(r.kb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("updatePassword",n,c,o,i);Object(s.g)(Object(r.kb)(Object(s.e)(),{isLoading:!1})),e&&l()})()}),Object(s.b)("updateRecoveryEmail",(e,t,a)=>{const{currentPassword:n,email:c,onSuccess:o}=a;Object(s.g)(Object(r.kb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("updateRecoveryEmail",n,c);Object(s.g)(Object(r.kb)(Object(s.e)(),{isLoading:!1,waitingEmailCodeLength:void 0})),e&&o()})()}),Object(s.b)("provideTwoFaEmailCode",(e,t,a)=>{const{code:s}=a;Object(j.a)("provideRecoveryEmailCode",s)}),Object(s.b)("clearTwoFaError",e=>Object(r.kb)(e,{error:void 0}));var H=a(54);Object(s.b)("validateRequestedInfo",(e,t,a)=>{const{requestInfo:n,saveInfo:c}=a,i=Object(o.db)(e);i&&async function(e,t,a){const n=await Object(j.a)("validateRequestedInfo",{messageId:e,requestInfo:t,shouldSave:a});if(!n)return;const{id:c,shippingOptions:o}=n;if(!c)return;let i=Object(r.C)(Object(s.e)(),c);o?(i=Object(r.eb)(i,o),i=Object(r.A)(i,l.i.Shipping)):i=Object(r.A)(i,l.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(j.a)("getPaymentForm",{messageId:e});if(!t)return;let a=Object(r.z)(Object(s.e)(),t),n=l.i.PaymentInfo;a.payment.invoice&&(a.payment.invoice.shippingAddressRequested||a.payment.invoice.nameRequested||a.payment.invoice.phoneRequested||a.payment.invoice.emailRequested)&&(n=l.i.ShippingInfo);a=Object(r.A)(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(j.a)("getReceipt",t);if(!n)return;let c=Object(s.e)();const i=Object(o.k)(c,a,e);c=Object(r.B)(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(o.gb)(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(H.b)(c.error),t=Object(s.e)();return void Object(s.g)({...t,payment:{...t.payment,error:{...e}}})}let o=Object(r.D)(Object(s.e)(),{type:c.type,id:c.id});o=Object(r.A)(o,l.i.Checkout),Object(s.g)(o)}(i,n)}),Object(s.b)("sendPaymentForm",(e,t,a)=>{const{shippingOptionId:n,saveCredentials:c}=a,i=Object(o.db)(e),l=Object(o.eb)(e),d=Object(o.gb)(e),b=Object(o.vb)(e);i&&d&&async function(e,t,a,n){if(await Object(j.a)("sendPaymentForm",{messageId:e,credentials:t,requestedInfoId:a,shippingOptionId:n})){const e=Object(r.g)(Object(s.e)());Object(s.g)(Object(r.h)(e))}}(i,{save:c,data:b},l,n)}),Object(s.b)("setPaymentStep",(e,t,a={})=>Object(r.A)(e,a.step||l.i.ShippingInfo)),Object(s.b)("setInvoiceMessageInfo",(e,t,a)=>Object(r.y)(e,a));a(76);Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateChat":Object(o.L)(e,a.id)||t.loadTopChats(),Object(s.g)(Object(r.F)(e,a.id,a.chat));break;case"updateChatJoin":{const n=Object(o.j)(e,a.id);if(!n)break;e=Object(r.G)(e,n,[a.id]),e=Object(r.F)(e,a.id,{isNotJoined:!1}),Object(s.g)(e);const c=Object(o.f)(e,a.id);c&&t.requestChatUpdate({chatId:c.id});break}case"updateChatLeave":{const t=Object(o.j)(e,a.id);if(!t)break;const{[t]:n}=e.chats.listIds;n&&(e=Object(r.q)(e,t,n.filter(e=>e!==a.id))),e=Object(r.F)(e,a.id,{isNotJoined:!0}),Object(s.g)(e);break}case"updateChatInbox":Object(s.g)(Object(r.F)(e,a.id,a.chat));break;case"updateChatTypingStatus":{const{id:t,typingStatus:n}=a;Object(s.g)(Object(r.F)(e,t,{typingStatus:n})),setTimeout(()=>{const e=Object(s.e)(),a=Object(o.f)(e,t);a&&n&&a.typingStatus&&a.typingStatus.timestamp===n.timestamp&&Object(s.g)(Object(r.F)(e,t,{typingStatus:void 0}))},6e3);break}case"newMessage":{if(a.message.senderId===e.currentUserId)return;const t=Object(o.f)(e,a.chatId);if(!t)return;Object(s.g)(Object(r.F)(e,a.chatId,{unreadCount:t.unreadCount?t.unreadCount+1:1,...a.message.hasUnreadMention&&{unreadMentionsCount:t.unreadMentionsCount?t.unreadMentionsCount+1:1}}));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(o.p)(e,t),n=Object(o.f)(e,s);n&&n.unreadMentionsCount&&(e=Object(r.F)(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(r.F)(e,a.id,{fullInfo:{...n.fullInfo,...t}}));break}case"updatePinnedChatIds":{const{ids:t,folderId:c}=a,r=c===n.g?"archived":"active";e={...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[r]:t.length?t:void 0}}},Object(s.g)(e);break}case"updateChatPinned":{const{id:t,isPinned:c}=a,r=Object(o.j)(e,t);if(r){const{[r]:a}=e.chats.orderedPinnedIds;let s=a||[];if(c){if(!s.includes(t)){if("active"===r&&s.length>=n.E){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,[r]:s.length?s:void 0}}}}Object(s.g)(e);break}case"updateChatListType":{const{id:t,folderId:n}=a;Object(s.g)(Object(r.I)(e,t,n));break}case"updateChatFolder":{const{id:t,folder:n}=a,{byId:c,orderedIds:r}=e.chatFolders,o=n?{...c,[t]:n}:Object(d.l)(c,Object.keys(c).map(Number).filter(e=>e!==t)),i=n?r&&r.includes(t)?r:[...r||[],t]:r?r.filter(e=>e!==t):void 0;Object(s.g)({...e,chatFolders:{...e.chatFolders,byId:o,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:o}=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&&o){const e=l.findIndex(e=>e.userId===o);e>-1&&(l.slice(e,1),i=!0)}if(i){const n=l.filter(({isOwner:e,isAdmin:t})=>e||t);Object(s.g)(Object(r.F)(e,a.id,{membersCount:l.length,fullInfo:{...t.fullInfo,members:l,adminMembers:n}}))}break}}});function q(e,t,a,s,n=!1){const c=n?Object(o.lb)(e,t,a):Object(o.k)(e,t,a);if(c&&s.content){const{photo:e,video:t,sticker:a,document:n}=Object(m.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(r.cb)(e,t,a,s):Object(r.J)(e,t,a,s)}function G(e,t){const{id:a,chatId:s}=t;e=Object(r.T)(e,s,i.MAIN_THREAD_ID,[a]),Object(o.W)(e,s,i.MAIN_THREAD_ID)&&(e=Object(r.f)(e,s,i.MAIN_THREAD_ID,a));const{threadInfo:n,firstMessageId:c}=Object(o.xb)(e,s,t)||{};return!c&&Object(m.sb)(t)||n&&(e=Object(r.T)(e,s,n.threadId,[a]),Object(o.W)(e,s,n.threadId)&&(e=Object(r.f)(e,s,n.threadId,a),c||(e=Object(r.v)(e,s,n.threadId,"firstMessageId",t.id)),n.lastMessageId||(e=Object(r.v)(e,s,n.threadId,"threadInfo",{...n,lastMessageId:t.id})))),e}function _(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(r.F)(e,t,{lastMessage:a})}function z(e,t){const a=Object(o.m)(e,t),s=Object(o.X)(e,t,i.MAIN_THREAD_ID);if(!a||!s)return;let n=s.length;for(;n--;){const e=a[s[n]];if(!e.isDeleting)return e}}function V(e,t,a,n){if(e){t.forEach(t=>{const a=z(n=Object(r.J)(n,e,t,{isDeleting:!0}),e);a&&(n=_(n,e,a,!0))}),Object(s.g)(n),a.requestChatUpdate({chatId:e});const c=[];return t.forEach(t=>{const a=Object(o.k)(n,e,t);if(!a)return;const{threadInfo:s}=Object(o.xb)(n,e,a)||{};s&&c.push(s.threadId)}),Object(d.o)(c).forEach(t=>{a.requestThreadInfoUpdate({chatId:e,threadId:t})}),void setTimeout(()=>{Object(s.g)(Object(r.i)(Object(s.e)(),e,t))},350)}const c=[];t.forEach(e=>{const t=Object(o.p)(n,e);if(t){c.push(t);const a=z(n=Object(r.J)(n,t,e,{isDeleting:!0}),t);a&&(n=_(n,t,a,!0)),setTimeout(()=>{Object(s.g)(Object(r.i)(Object(s.e)(),t,[e]))},350)}}),Object(s.g)(n),Object(d.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=G(e=q(e,n,c,i),i),i.threadInfo&&(e=Object(r.ib)(e,i.threadInfo.chatId,i.threadInfo.threadId,i.threadInfo)),Object(s.g)(e);const l=Object(o.k)(e,n,c);if(Object(o.a)(e,n,i)){if(i.isOutgoing&&(!i.content||!i.content.action)){const a=Object(o.y)(e);a&&t.focusMessage({chatId:n,threadId:a.threadId,messageId:i.id,noHighlight:!0})}const{threadInfo:a}=Object(o.xb)(e,n,i)||{};a&&t.requestThreadInfoUpdate({chatId:n,threadId:a.threadId}),i.isOutgoing||setTimeout(()=>{Object(s.g)(_(Object(s.e)(),n,l))},350)}else Object(s.g)(_(Object(s.e)(),n,l));Object(o.L)(e,n)||t.loadTopChats();break}case"newScheduledMessage":{const{chatId:t,id:n,message:c}=a;e=q(e,t,n,c,!0);const l=Object(o.kb)(e,t)||[];e=Object(r.v)(e,t,i.MAIN_THREAD_ID,"scheduledIds",Object(d.o)([...l,n])),Object(s.g)(e);break}case"updateMessage":{const{chatId:t,id:n,message:c}=a;if(!Object(o.k)(e,t,n))return;e=q(e,t,n,c);const i=Object(o.k)(e,t,n);c.threadInfo&&(e=Object(r.ib)(e,c.threadInfo.chatId,c.threadInfo.threadId,c.threadInfo)),e=_(e,t,i),Object(s.g)(e);break}case"updateScheduledMessage":{const{chatId:t,id:n,message:c}=a;if(!Object(o.lb)(e,t,n))return;e=q(e,t,n,c,!0);const l=Object.keys(Object(o.mb)(e,t)||{}).map(Number).sort((e,t)=>t-e);e=Object(r.v)(e,t,i.MAIN_THREAD_ID,"scheduledIds",l),Object(s.g)(e);break}case"updateMessageSendSucceeded":{const{chatId:t,localId:n,message:c}=a;e=G(e,c);const i=Object(o.k)(e,t,n);e=Object(r.i)(e,t,[n]),c.isScheduled&&(e=Object(r.j)(e,t,[n])),e=Object(r.J)(e,t,c.id,{...i,...c,previousLocalId:n});const l=Object(o.k)(e,t,c.id);e=_(e,t,l),Object(s.g)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:n,message:c}=a,l=Object(o.kb)(e,t)||[];e=Object(r.v)(e,t,i.MAIN_THREAD_ID,"scheduledIds",[...l,c.id]);const d=Object(o.lb)(e,t,n);e=Object(r.j)(e,t,[n]),e=Object(r.cb)(e,t,c.id,{...d,...c,previousLocalId:n}),Object(s.g)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:n,messageIds:c}=a,l=Object(o.fb)(e,t)||[],d=n?[...l,...c]:l.filter(e=>!c.includes(e));Object(s.g)(Object(r.v)(e,t,i.MAIN_THREAD_ID,"pinnedIds",d));break}case"updateThreadInfo":{const{chatId:t,threadId:n,threadInfo:c}=a,i={...Object(o.yb)(e,t,n),...c};if(!i.threadId)return;e=Object(r.ib)(e,t,n,i),Object(s.g)(e);break}case"resetMessages":{const{id:n}=a,c=Object(o.m)(e,n);c&&!Object(m.lb)(n)&&(e=Object(r.i)(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;V(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(r.cb)(n,e,t,{isDeleting:!0})}),Object(s.g)(n),setTimeout(()=>{n=Object(r.j)(Object(s.e)(),e,t);const a=Object(o.mb)(n,e);n=Object(r.v)(n,e,i.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;V(s,Object.keys(e.messages.byChatId[s].byId).map(Number),t,e);break}case"updateCommonBoxMessages":{const{ids:t,messageUpdate:n}=a;t.forEach(t=>{const a=Object(o.p)(e,t);a&&(e=Object(r.J)(e,a,t,n))}),Object(s.g)(e);break}case"updateChannelMessages":{const{channelId:t,ids:n,messageUpdate:c}=a;n.forEach(a=>{e=Object(r.J)(e,t,a,c)}),Object(s.g)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:n}=a,c=Object(o.l)(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(r.J)(e,c.chatId,c.id,{content:{...c.content,poll:t}}))}break}case"updateMessagePollVote":{const{pollId:t,userId:n,options:c}=a,i=Object(o.l)(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(r.J)(e,i.chatId,i.id,{content:{...i.content,poll:{...l,results:{...l.results,recentVoterIds:m,totalVoters:h,results:O}}}}));break}}});var $=a(105);const W=Object($.f)((function(){let e=Object(s.e)();Q.forEach(([t,a])=>{e=Object(r.lb)(e,t,{status:a})}),Object(s.g)(e),Q=[]}),3e3,!0);let Q=[];Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"deleteUser":return Object(r.k)(e,a.id);case"updateUser":return Object(r.lb)(e,a.id,a.user);case"updateUserStatus":return s=a.userId,n=a.status,Q.push([s,n]),void W();case"updateUserFullInfo":{const{id:t,fullInfo:s}=a,n=e.users.byId[t];if(!n)return;return Object(r.lb)(e,t,{fullInfo:{...n.fullInfo,...s}})}}var s,n}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateStickerSet":return Object(r.fb)(e,a.id,a.stickerSet)}}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updatePeerBlocked":return a.isBlocked?Object(r.a)(Object(s.e)(),a.id):Object(r.o)(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(r.ab)(e,a.peerType,a.isSilent,a.isShowPreviews)}}),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 K=a(43),Y=a(8),J=a(27),X=a(125),Z=a(42),ee=a(100),te=a(66),ae=a(93),se=a(56),ne=a(32),ce=a(31),re=a(143),oe=a(127);a(185);var ie=Object(c.h)(({id:e,name:t,value:a,label:s,checked:n=!1,disabled:r,onChange:o,onCheck:i})=>{const l=Object(c.m)(e=>{o&&o(e),i&&i(e.currentTarget.checked)},[o,i]),d=Object(Y.a)("Switcher",r&&"disabled");return c.a.createElement("label",{className:d,title:s},c.a.createElement("input",{type:"checkbox",id:e,name:t,value:a,checked:n,disabled:r,onChange:l}),c.a.createElement("span",{className:"widget"}))});a(186);const le=[0,1,2];var de=Object(c.h)(Object(s.h)(e=>{const{query:t,fetchingStatus:a,chatId:s,date:n}=e.globalSearch,{currentUserId:c}=e,{byId:r}=e.chats,{theme:o,animationLevel:i}=e.settings.byKey;return{searchQuery:t,isLoading:!!a&&Boolean(a.chats||a.messages),currentUserId:c,chatsById:r,globalSearchChatId:s,searchDate:n,theme:o,animationLevel:i}},(e,t)=>Object(d.l)(t,["openChat","openTipsChat","setGlobalSearchDate","setGlobalSearchChatId","setSettingOption"]))(({content:e,contactsFilter:t,onSearchQuery:a,onSelectSettings:s,onSelectContacts:r,onSelectArchived:o,setGlobalSearchChatId:i,onReset:d,searchQuery:b,isLoading:u,currentUserId:O,globalSearchChatId:j,searchDate:g,theme:f,animationLevel:p,chatsById:I,openChat:v,openTipsChat:y,setGlobalSearchDate:C,setSettingOption:w})=>{const E=e===l.d.ChatList,M={date:void 0},S={id:void 0},k=Object(c.p)(()=>g?Object(x.a)(new Date(1e3*g)):void 0,[g]),N=Object(c.p)(()=>E&&I?Object.values(I).reduce((e,t)=>Object(m.hb)(t)&&t.unreadCount?e+1:e,0):0,[E,I]),P=Object(c.p)(()=>({onTrigger:e,isOpen:t})=>c.a.createElement(ce.a,{round:!0,ripple:E&&!h.f,size:"smaller",color:"translucent",className:t?"active":"",onClick:E?e:()=>d(),ariaLabel:E?"Open menu":"Return to chat list"},c.a.createElement("div",{className:Object(Y.a)("animated-menu-icon",!E&&"state-back")})),[E,d]),T=Object(c.m)(()=>{b||a("")},[b,a]),A=Object(c.m)(()=>{v({id:O})},[O,v]),R=Object(c.m)(e=>{e.stopPropagation();const t="light"===f?"dark":"light";w({theme:t,customBackground:"dark"===t?"#0F0F0F":void 0}),Object(te.a)(t,p>0)},[p,w,f]),L=Object(c.m)(e=>{e.stopPropagation();const t=0===p?2:0;le.forEach((e,a)=>{document.body.classList.toggle("animation-level-"+a,t===a)}),w({animationLevel:t})},[p,w]),F=Object(ae.a)(),D=Boolean(j)||e===l.d.GlobalSearch||e===l.d.Contacts,B=e===l.d.Contacts?F("SearchFriends"):F("Search");return c.a.createElement("div",{className:"LeftMainHeader"},c.a.createElement("div",{id:"LeftMainHeader",className:"left-header"},c.a.createElement(se.a,{trigger:P,footer:n.f},c.a.createElement(ne.a,{icon:"saved-messages",onClick:A},F("SavedMessages")),c.a.createElement(ne.a,{icon:"archive",onClick:o},c.a.createElement("span",{className:"menu-item-name"},F("ArchivedChats")),N>0&&c.a.createElement("div",{className:"archived-badge"},N)),c.a.createElement(ne.a,{icon:"user",onClick:r},F("Contacts")),c.a.createElement(ne.a,{icon:"settings",onClick:s},F("Settings")),c.a.createElement(ne.a,{icon:"darkmode",onClick:R},c.a.createElement("span",{className:"menu-item-name"},"Dark Mode"),c.a.createElement(ie,{id:"darkmode",label:"Toggle Dark Mode",checked:"dark"===f})),c.a.createElement(ne.a,{icon:"animations",onClick:L},c.a.createElement("span",{className:"menu-item-name capitalize"},F("Appearance.Animations").toLowerCase()),c.a.createElement(ie,{id:"animations",label:"Toggle Animations",checked:p>0})),c.a.createElement(ne.a,{icon:"help",onClick:y},"Telegram Features"),c.a.createElement(ne.a,{icon:"bug",href:n.t},"Report Bug")),c.a.createElement(re.a,{inputId:"telegram-search-input",className:j||g?"with-picker-item":"",value:t||b,focused:D,isLoading:u,placeholder:B,canClose:Boolean(j||g),onChange:a,onReset:d,onFocus:T},k&&c.a.createElement(oe.a,{icon:"calendar",title:k,canClose:!0,isMinimized:Boolean(j),className:"search-date",onClick:C,clickArg:M}),j&&c.a.createElement(oe.a,{chatOrUserId:j,onClick:i,canClose:!0,clickArg:S}))))})),be=a(20);a(187);var ue=Object(s.h)(e=>Object(d.l)(e,["connectionState"]))(({connectionState:e})=>{const t=Object(ae.a)();return"connectionStateConnecting"===e&&c.a.createElement("div",{id:"ConnectionState"},c.a.createElement(be.a,{color:"black"}),c.a.createElement("div",{className:"state-text"},t("WaitingForNetwork")))}),me=a(128),he=a(102),Oe=a(29),je=(e,t,a)=>{const s=Object(c.q)(),n=(e=>Object(c.p)(()=>Object(g.g)(e=>e(),e),[e]))(t),r=Object(Oe.a)();return Object(he.a)(()=>{let t=!0;n(()=>{s.current=e(),t||r()}),t=!1},a),s.current},ge=a(157),fe=a(177);var pe=Object(c.h)(Object(s.h)(e=>{const{chats:{byId:t},users:{byId:a},chatFolders:{byId:s,orderedIds:n},lastSyncTime:c}=e;return{chatsById:t,usersById:a,chatFoldersById:s,orderedFolderIds:n,lastSyncTime:c}},(e,t)=>Object(d.l)(t,["loadChatFolders"]))(({chatsById:e,usersById:t,chatFoldersById:a,orderedFolderIds:s,lastSyncTime:n,loadChatFolders:r})=>{const o=Object(c.q)(null),[i,l]=Object(c.r)(0);Object(c.n)(()=>{n&&r()},[n,r]);const b=Object(c.p)(()=>s?s.map(e=>a[e]||{}).filter(Boolean):void 0,[a,s]),u=je(()=>{if(!b||!b.length)return;const a=Object.keys(e).map(Number),s=b.map(s=>{const{unreadDialogsCount:n,hasActiveDialogs:c}=Object(m.p)(e,t,s,a)||{};return{id:s.id,badgeCount:n,isBadgeActive:c}});return Object(d.c)(s,"id")},3e3,[b,e,t]),O=Object(c.p)(()=>{if(b&&b.length)return[{title:"All"},...b.map(e=>({title:e.title,...u&&u[e.id]}))]},[b,u]),j=Object(c.m)(e=>{l(e)},[]);Object(c.n)(()=>{O&&O.length&&i>=O.length&&l(0)},[i,O]),Object(c.n)(()=>{if(o.current&&h.k&&O&&O.length)return Object(me.b)(o.current,{onSwipe:(e,t)=>{t===me.a.Left?l(Math.min(i+1,O.length-1)):t===me.a.Right&&l(Math.max(0,i-1))}})},[i,O]);const{shouldRender:g,transitionClassNames:f}=Object(J.a)(!s,void 0,!0),p=Object(ae.a)();function I(){const e=Object.values(a).find(({title:e})=>e===O[i].title);return e&&0!==i?c.a.createElement(fe.a,{folderType:"folder",folderId:e.id,noChatsText:p("FilterNoChatsToDisplay")}):c.a.createElement(fe.a,{folderType:"all"})}return c.a.createElement("div",{className:"ChatFolders"},O&&O.length?c.a.createElement(ge.a,{tabs:O,activeTab:i,onSwitchTab:j}):g?c.a.createElement("div",{className:Object(Y.a)("tabs-placeholder",f)}):void 0,c.a.createElement(ee.a,{ref:o,name:"slide",activeKey:i,renderCount:O?O.length:void 0},I))})),Ie=a(12),ve=a(17),ye=a(16);var Ce=e=>{const t=Object(ve.a)(Ie.a.Extra,"LeftSearch");return t?c.a.createElement(t,e):c.a.createElement(ye.a,null)};var we=e=>{const t=Object(ve.a)(Ie.a.Extra,"ContactList");return t?c.a.createElement(t,e):c.a.createElement(ye.a,null)},Ee=a(47);a(199);let Me;var Se=Object(c.h)(({isShown:e,onNewPrivateChat:t,onNewChannel:a,onNewGroup:s})=>{const[n,r]=Object(c.r)(!1);Object(c.n)(()=>{e||r(!1)},[e]);const o=Object(ae.a)(),i=Object(Y.a)("NewChatButton",e&&"revealed",n&&"menu-is-open"),l=Object(c.m)(()=>{Me&&(clearTimeout(Me),Me=void 0)},[]),d=Object(c.m)(()=>{Me&&(clearTimeout(Me),Me=void 0),Me=window.setTimeout(()=>{r(!1)},750)},[]);return c.a.createElement("div",{className:i,onMouseEnter:l,onMouseLeave:d},c.a.createElement(ce.a,{round:!0,color:"primary",className:n?"active":"",onClick:()=>{r(!n)},ariaLabel:n?"Close":"Create new chat",tabIndex:-1},c.a.createElement("i",{className:"icon-new-chat-filled"}),c.a.createElement("i",{className:"icon-close"})),c.a.createElement(Ee.a,{isOpen:n,positionX:"right",positionY:"bottom",autoClose:!0,onClose:()=>{r(!1)}},c.a.createElement(ne.a,{icon:"channel",onClick:a},o("NewChannel")),c.a.createElement(ne.a,{icon:"group",onClick:s},o("NewGroup")),c.a.createElement(ne.a,{icon:"user",onClick:t},"New Private Chat")))});a(200);const ke=Object.keys(l.d).length/2;let Ne;var Pe=Object(c.h)(({content:e,searchQuery:t,searchDate:a,contactsFilter:s,onSearchQuery:n,onContentChange:r,onReset:o})=>{const[i,d]=Object(c.r)(h.k),b=Object(c.q)(!1),u=Object(c.m)(()=>{r(l.d.Settings)},[r]),m=Object(c.m)(()=>{r(l.d.Contacts)},[r]),O=Object(c.m)(()=>{r(l.d.NewChannelStep1)},[r]),j=Object(c.m)(()=>{r(l.d.NewGroupStep1)},[r]),g=Object(c.m)(()=>{r(l.d.Archived)},[r]),f=Object(c.m)(()=>{e===l.d.ChatList&&(b.current=!0,d(!0))},[e]),p=Object(c.m)(()=>{b.current=!1,Ne&&(clearTimeout(Ne),Ne=void 0),Ne=window.setTimeout(()=>{b.current||d(!1)},250)},[]);return Object(c.n)(()=>{let t;return e!==l.d.ChatList?t=window.setTimeout(()=>{d(!1)},250):(b.current||h.k)&&d(!0),()=>{t&&(clearTimeout(t),t=void 0)}},[e]),c.a.createElement("div",{id:"LeftColumn-main",onMouseEnter:h.k?void 0:f,onMouseLeave:h.k?void 0:p},c.a.createElement(de,{content:e,contactsFilter:s,onSearchQuery:n,onSelectSettings:u,onSelectContacts:m,onSelectArchived:g,onReset:o}),c.a.createElement(ue,null),c.a.createElement(ee.a,{name:"zoom-fade",renderCount:ke,activeKey:e},()=>{switch(e){case l.d.ChatList:return c.a.createElement(pe,null);case l.d.GlobalSearch:return c.a.createElement(Ce,{searchQuery:t,searchDate:a,onReset:o});case l.d.Contacts:return c.a.createElement(we,{filter:s});default:return}}),c.a.createElement(Se,{isShown:i,onNewPrivateChat:m,onNewChannel:O,onNewGroup:j}))});var Te=e=>{const t=Object(ve.a)(Ie.a.Extra,"Settings");return t?c.a.createElement(t,e):c.a.createElement(ye.a,null)};var Ae=e=>{const t=Object(ve.a)(Ie.a.Extra,"NewChat");return t?c.a.createElement(t,e):c.a.createElement(ye.a,null)};var xe,Re=e=>{const t=Object(ve.a)(Ie.a.Extra,"ArchivedChats");return t?c.a.createElement(t,e):c.a.createElement(ye.a,null)};a(201);!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"}(xe||(xe={}));const Le=Object.keys(xe).length/2;var Fe=Object(c.h)(Object(s.h)(e=>{const{query:t,date:a}=e.globalSearch;return{searchQuery:t,searchDate:a}},(e,t)=>Object(d.l)(t,["setGlobalSearchQuery","setGlobalSearchChatId","resetChatCreation","setGlobalSearchDate","loadPasswordInfo","clearTwoFaError"]))(({searchQuery:e,searchDate:t,setGlobalSearchQuery:a,setGlobalSearchChatId:s,resetChatCreation:n,setGlobalSearchDate:r,loadPasswordInfo:o,clearTwoFaError:i})=>{const[d,b]=Object(c.r)(l.d.ChatList),[u,m]=Object(c.r)(l.m.Main),[O,j]=Object(c.r)(""),[g,f]=Object(c.r)(0);let p=xe.Main;switch(d){case l.d.Archived:p=xe.Archived;break;case l.d.Settings:p=xe.Settings;break;case l.d.NewChannelStep1:case l.d.NewChannelStep2:p=xe.NewChannel;break;case l.d.NewGroupStep1:case l.d.NewGroupStep2:p=xe.NewGroup}const I=Object(c.m)(e=>{if(d!==l.d.NewGroupStep2||e){if(d===l.d.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(d===l.d.Settings)switch(u){case l.m.EditProfile:case l.m.Folders:case l.m.General:case l.m.Notifications:case l.m.Privacy:case l.m.Language:return void m(l.m.Main);case l.m.GeneralChatBackground:return void m(l.m.General);case l.m.GeneralChatBackgroundColor:return void m(l.m.GeneralChatBackground);case l.m.PrivacyPhoneNumber:case l.m.PrivacyLastSeen:case l.m.PrivacyProfilePhoto:case l.m.PrivacyForwarding:case l.m.PrivacyGroupChats:case l.m.PrivacyActiveSessions:case l.m.PrivacyBlockedUsers:case l.m.TwoFaDisabled:case l.m.TwoFaEnabled:case l.m.TwoFaCongratulations:return void m(l.m.Privacy);case l.m.PrivacyPhoneNumberAllowedContacts:case l.m.PrivacyPhoneNumberDeniedContacts:return void m(l.m.PrivacyPhoneNumber);case l.m.PrivacyLastSeenAllowedContacts:case l.m.PrivacyLastSeenDeniedContacts:return void m(l.m.PrivacyLastSeen);case l.m.PrivacyProfilePhotoAllowedContacts:case l.m.PrivacyProfilePhotoDeniedContacts:return void m(l.m.PrivacyProfilePhoto);case l.m.PrivacyForwardingAllowedContacts:case l.m.PrivacyForwardingDeniedContacts:return void m(l.m.PrivacyForwarding);case l.m.PrivacyGroupChatsAllowedContacts:case l.m.PrivacyGroupChatsDeniedContacts:return void m(l.m.PrivacyGroupChats);case l.m.TwoFaNewPassword:return void m(l.m.TwoFaDisabled);case l.m.TwoFaNewPasswordConfirm:return void m(l.m.TwoFaNewPassword);case l.m.TwoFaNewPasswordHint:return void m(l.m.TwoFaNewPasswordConfirm);case l.m.TwoFaNewPasswordEmail:return void m(l.m.TwoFaNewPasswordHint);case l.m.TwoFaNewPasswordEmailCode:return void m(l.m.TwoFaNewPasswordEmail);case l.m.TwoFaChangePasswordCurrent:case l.m.TwoFaTurnOff:case l.m.TwoFaRecoveryEmailCurrentPassword:return void m(l.m.TwoFaEnabled);case l.m.TwoFaChangePasswordNew:return void m(l.m.TwoFaChangePasswordCurrent);case l.m.TwoFaChangePasswordConfirm:return void m(l.m.TwoFaChangePasswordNew);case l.m.TwoFaChangePasswordHint:return void m(l.m.TwoFaChangePasswordConfirm);case l.m.TwoFaRecoveryEmail:return void m(l.m.TwoFaRecoveryEmailCurrentPassword);case l.m.TwoFaRecoveryEmailCode:return void m(l.m.TwoFaRecoveryEmail);case l.m.FoldersCreateFolder:case l.m.FoldersEditFolder:return void m(l.m.Folders)}b(l.d.ChatList),j(""),a({query:""}),r({date:void 0}),s({id:void 0}),n(),setTimeout(()=>{f(Date.now())},250)}else b(l.d.NewGroupStep1)},[d,a,s,r,n,u]),v=Object(c.m)(t=>{d!==l.d.Contacts?(b(l.d.GlobalSearch),t!==e&&a({query:t})):j(t)},[d,a,e]);return Object(c.n)(()=>d!==l.d.ChatList?Object(Z.a)(()=>I()):void 0,[d,I]),Object(c.n)(()=>{i(),u===l.m.Privacy&&o()},[i,o,u]),c.a.createElement(ee.a,{id:"LeftColumn",name:h.f?"slide-layers":"push-slide",renderCount:Le,activeKey:p},()=>{switch(p){case xe.Archived:return c.a.createElement(Re,{onReset:I});case xe.Settings:return c.a.createElement(Te,{currentScreen:u,onScreenSelect:m,onReset:I});case xe.NewChannel:return c.a.createElement(Ae,{key:g,isChannel:!0,content:d,onContentChange:b,onReset:I});case xe.NewGroup:return c.a.createElement(Ae,{key:g,content:d,onContentChange:b,onReset:I});default:return c.a.createElement(Pe,{content:d,searchQuery:e,searchDate:t,contactsFilter:O,onContentChange:b,onSearchQuery:v,onReset:I})}})})),De=a(124),Be=a(13),Ue=a(49);var He=()=>{const[e,t]=Object(c.r)(Ue.a.get());return Object(c.n)(()=>{const e=Object(g.g)(()=>{t(Ue.a.get())},250,!1);return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),e},qe=a(37);function Ge(e,t){const a=Object(qe.a)(e,!0),s=Object(c.q)(),n=Object(Oe.a)(),r=null!=e;return r&&s.current&&(clearTimeout(s.current),s.current=void 0),Object(he.a)(()=>{t&&!r&&a&&!s.current&&(s.current=window.setTimeout(()=>{s.current=void 0,n()},t))},[e]),s.current&&t&&!r?a:e}function _e(e,t){const a=e<=n.V?16:32,s=function(e){if(e>n.S){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.R){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.V?54:64,r=t?s-a-c:s-a,o=e>n.V?Math.min(s-a,512):s-a,i=o/r,l=r/o;return{composerHiddenScale:i,toolbarHiddenScale:l,composerTranslateX:t?c/2*l:0,toolbarTranslateX:t?c/2*-1*i:0}}var ze=a(133),Ve=a(130);function $e(e,t=!1,a=!1){const s=Object(qe.a)(e,t);return a||null!=e?e:s}var We=a(45),Qe=a(96),Ke=a(111);var Ye=e=>{const{isOpen:t}=e,a=Object(ve.a)(Ie.a.Extra,"HeaderMenuContainer",!t);return a?c.a.createElement(a,e):void 0};var Je=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const n=Object(o.f)(e,t),c=Boolean(n&&Object(m.jb)(n));if(n&&n.isRestricted)return{noMenu:!0};const r=Object(o.O)(e,t),l="thread"===s&&a===i.MAIN_THREAD_ID,d="thread"===s&&a!==i.MAIN_THREAD_ID,b=Object(o.V)(e),u=Boolean(Object(o.K)(e,t)),O=Boolean(l&&n&&(c||Object(m.nb)(n))&&n.isNotJoined),j=l||d,g=l&&!r&&!O,f=!Object(o.R)(e),p=l&&!O;return{noMenu:!(h.f&&O||h.f&&j||g||f||p),isChannel:c,isRightColumnShown:b,canStartBot:u,canSubscribe:O,canSearch:j,canMute:g,canSelect:f,canLeave:p}},(e,t)=>Object(d.l)(t,["joinChannel","sendBotCommand","openLocalTextSearch"]))(({chatId:e,threadId:t,noMenu:a,isChannel:s,canStartBot:n,canSubscribe:r,canSearch:o,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.f){document.querySelector("#MobileSearch input").focus()}else setTimeout(()=>{const e=document.querySelector(".RightHeader .SearchInput input");e&&e.focus()},400)},[O]),S=Object(ae.a)();return c.a.createElement("div",{className:"HeaderActions"},!h.f&&r&&c.a.createElement(ce.a,{size:"tiny",ripple:!0,fluid:!0,onClick:w},S(s?"Subscribe":"Join Group")),!h.f&&n&&c.a.createElement(ce.a,{size:"tiny",ripple:!0,fluid:!0,onClick:E},S("Start")),!h.f&&o&&c.a.createElement(ce.a,{round:!0,ripple:b,color:"translucent",size:"smaller",onClick:M,ariaLabel:"Search in this chat"},c.a.createElement("i",{className:"icon-search"})),(h.f||!r)&&c.a.createElement(ce.a,{ref:j,className:g?"active":"",round:!0,ripple:!h.f,size:"smaller",color:"translucent",disabled:a,ariaLabel:"More actions",onClick:v},c.a.createElement("i",{className:"icon-more"})),p&&c.a.createElement(Ye,{chatId:e,threadId:t,isOpen:g,anchor:p,isChannel:s,canSubscribe:r,canSearch:o,canMute:i,canSelect:l,canLeave:d,onSubscribeChannel:w,onSearchClick:M,onClose:y,onCloseAnimationEnd:C}))})),Xe=a(104),Ze=a(35),et=a(97),tt=a(34);function at(e){const t=e&&Object(m.E)(e),{sticker:a}=e&&e.content||{},s=t&&a&&!Object(h.o)()&&t.includes("image/webp"),[r,o]=Object(c.r)(tt.a),i=e&&e.id;return Object(c.o)(()=>{s&&Object(tt.c)("b64-"+i,t).then(o).catch(e=>{n.m&&console.error(e)})},[i,s,t]),s?r:t}var st=a(107),nt=a(33),ct=a(36);function rt(e,t,a,s,n){return`M${e},${t+n}a${n},${n},0,0,1,\n ${a},0v${s-2*n}a${n},${n},0,0,1,${-a},0Z`}var ot=Object(c.h)(({count:e,index:t})=>{const a=Object(c.q)(null),s=Object(c.p)(()=>function(e,t){const a=e-t-1,s=function(e){let t=8;1===e?t=36:2===e?t=17:3===e?t=11:(4===e||e>3)&&(t=7.5);return t}(e),n=function(e,t){let a=36;1===e?a=36:2===e?a=17:3===e?a=1===t?12:11:(4===e||e>3)&&(a=7.5);return a}(e,a),c=function(e,t){return e<=3?36:t*e+2*(e-1)}(e,s),r="clipPath"+e,o=function(e,t,a){let s="";if(3===a)s=rt(0,0,2,t,1)+rt(0,12,2,t+1,1)+rt(0,25,2,t,1);else for(let e=0;e<a;e++)s+=rt(0,(t+2)*e,2,t,1);return`<clipPath id="${e}">\n <path d="${s}" />\n </clipPath>`}(r,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:o,markTranslateY:i,trackTranslateY:l,trackHeight:c,clipPathId:r}}(e,t),[e,t]);if(Object(c.n)(()=>{if(!a.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:n,markTranslateY:c,clipPathId:r,clipPath:o}=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("#${r}")`;const d=s.querySelector("svg"),b=s.querySelector("div"),u=s.querySelector("defs");d||i&&(i.innerHTML=`<svg height="0" width="0"><defs> ${o} </defs></svg>`),u&&(u.innerHTML=o),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:r,markHeight:o,markTranslateY:i,clipPathId:l}=s;return c.a.createElement("div",{className:Object(Y.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(-${r}px);`},c.a.createElement("span",null),c.a.createElement("div",{className:"pinned-message-border-mark",style:`height: ${o}px; transform: translateY(${i}px);`})))});var it=Object(c.h)(({message:e,count:t,index:a,customTitle:s,className:n,onUnpinMessage:r,onClick:o,onAllPinnedClick:i})=>{const l=at(e),d=Object(et.a)(Object(m.D)(e,"pictogram")),b=Object(m.M)(e,Boolean(l)),[u,h,O]=Object(ct.a)(),j=Object(c.m)(()=>{O(),r&&r(e.id)},[O,r,e.id]),g=Object(ae.a)();return c.a.createElement("div",{className:Object(Y.a)("HeaderPinnedMessage-wrapper",n)},t>1&&c.a.createElement(ce.a,{round:!0,size:"smaller",color:"translucent",className:"pin-list-button",ariaLabel:g("EventLogFilterPinnedMessages"),onClick:i},c.a.createElement("i",{className:"icon-pin-list"})),r&&c.a.createElement(ce.a,{round:!0,size:"smaller",color:"translucent",ariaLabel:g("UnpinMessageAlertTitle"),className:"unpin-button",onClick:h},c.a.createElement("i",{className:"icon-close"})),c.a.createElement(st.a,{isOpen:u,onClose:O,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:j}),c.a.createElement("div",{className:"HeaderPinnedMessage",onClick:o},c.a.createElement(ot,{count:t,index:a}),l&&function(e,t){const{width:a,height:s}=Object(Xe.k)();return c.a.createElement("img",{src:t||e,width:a,height:s,alt:""})}(l,d),c.a.createElement("div",{className:"message-text"},c.a.createElement("div",{className:"title"},s||`${g("PinnedMessage")} ${a>0?"#"+(t-a):""}`),c.a.createElement("p",null,Object(Ze.a)(b))),c.a.createElement(nt.a,null)))}),lt=a(48),dt=a(165);a(204);var bt=Object(s.h)((e,{message:t})=>{const a=Object(o.pb)(e,t);return{senderName:a?Object(m.U)(a):void 0}},(e,t)=>Object(d.l)(t,["focusMessage","closeAudioPlayer"]))(({message:e,className:t,senderName:a,focusMessage:s,closeAudioPlayer:n})=>{const r=lt.c(Object(m.D)(e,"inline")),{playPause:o,isPlaying:i}=Object(dt.a)(Object(m.A)(e),Object(m.r)(e),r,void 0,void 0,!0),l=Object(c.m)(()=>{s({chatId:e.chatId,messageId:e.id})},[s,e.chatId,e.id]),d=Object(c.m)(()=>{i&&o(),n()},[n,i,o]),b=Object(ae.a)(),u=Object(m.u)(e);return c.a.createElement("div",{className:Object(Y.a)("AudioPlayer",t)},c.a.createElement(ce.a,{round:!0,ripple:!h.f,color:"translucent",size:"smaller",className:Object(Y.a)("toggle-play",i?"pause":"play"),onClick:o,ariaLabel:i?"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:l},u?function(e){const{title:t,performer:a,fileName:s}=e;return c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"title"},Object(Ze.a)(t||s)),a&&c.a.createElement("div",{className:"subtitle"},Object(Ze.a)(a)))}(u):function(e,t){return c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"title"},t&&Object(Ze.a)(t)),c.a.createElement("div",{className:"subtitle"},e))}(b("AttachAudio"),a),c.a.createElement(nt.a,null)),c.a.createElement(ce.a,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:d,ariaLabel:"Close player"},c.a.createElement("i",{className:"icon-close"})))});a(205);var ut=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const{isLeftColumnShown:n,lastSyncTime:c}=e,{byId:r}=e.chats,l=Object(o.f)(e,t),{typingStatus:d}=l||{},{chatId:b,messageId:u}=e.audioPlayer,h=b&&u?Object(o.k)(e,b,u):void 0,O=Object(o.zb)(e,t,a);let j;if("pinned"===s){const a=Object(o.fb)(e,t);j=a&&a.length}else if("scheduled"===s){const a=Object(o.kb)(e,t);j=a&&a.length}else if("thread"===s&&a!==i.MAIN_THREAD_ID){const s=Object(o.yb)(e,t,a);s&&(j=s.messagesCount)}let g={typingStatus:d,isLeftColumnShown:n,isRightColumnShown:Object(o.V)(e),isSelectModeActive:Object(o.R)(e),audioMessage:h,chatTitleLength:l&&Object(m.l)(l).length,chatsById:r,originChatId:O?O.id:t,messagesCount:j,isChatWithSelf:Object(o.O)(e,t),isChatWithBot:l&&Object(o.N)(e,l),lastSyncTime:c};const f=Object(o.m)(e,t);if("thread"===s&&f)if(a===i.MAIN_THREAD_ID){const s=Object(o.fb)(e,t);if(s&&s.length){const t=f[s[0]],{canUnpin:n}=t&&Object(o.b)(e,t,a)||{};g={...g,pinnedMessageIds:s,messagesById:f,canUnpin:n}}}else{const s=Object(o.Ab)(e,t,a),n=s?Object(o.k)(e,t,s):void 0,c=n?Object(o.J)(e,n):void 0,r=c?Object(m.U)(c):void 0;g={...g,pinnedMessageIds:s,messagesById:f,canUnpin:!1,topMessageTitle:r}}return g},(e,t)=>Object(d.l)(t,["openChatWithInfo","pinMessage","focusMessage","openChat","loadPinnedMessages","toggleLeftColumn","exitMessageSelectMode"]))(({chatId:e,threadId:t,messageListType:a,pinnedMessageIds:s,messagesById:r,canUnpin:o,topMessageTitle:l,typingStatus:d,isSelectModeActive:b,isLeftColumnShown:u,isRightColumnShown:O,audioMessage:j,chatTitleLength:g,chatsById:f,originChatId:p,messagesCount:I,isChatWithSelf:v,isChatWithBot:y,lastSyncTime:C,openChatWithInfo:w,pinMessage:E,focusMessage:M,openChat:S,loadPinnedMessages:k,toggleLeftColumn:N,exitMessageSelectMode:P})=>{const[T,A]=Object(c.r)(0),x=Array.isArray(s)?s[T]:s,R=r&&x?r[x]:void 0,L=Array.isArray(s)?s.length:s?1:0;Object(c.n)(()=>{t===i.MAIN_THREAD_ID&&C&&k({chatId:e})},[e,k,C,t]),Object(c.n)(()=>{A(0)},[e]),Object(c.n)(()=>{A(L?Object(ze.a)(L,T):-1)},[L,T]),Object(Ve.a)(e,x,R);const{width:F}=He(),D=F<=n.R,B=F>=n.V&&u,U=Object(c.q)(null),H=Object(c.q)(!0),q=Object(c.m)(()=>{w({id:e})},[w,e]),G=Object(c.m)(t=>{E({chatId:e,messageId:t,isUnpin:!0})},[E,e]),_=Object(c.m)(()=>{if(R){M({chatId:R.chatId,threadId:t,messageId:R.id});const e=Object(ze.a)(L,T+1);A(e)}},[R,M,t,L,T]),z=Object(c.m)(()=>{S({id:e,threadId:i.MAIN_THREAD_ID,type:"pinned"})},[S,e]),V=Object(c.m)(()=>{if(h.f){const e=document.getElementById(n.r);e&&e.blur()}t!==i.MAIN_THREAD_ID||"thread"!==a?("scheduled"===a&&b&&P(),S({id:p,threadId:i.MAIN_THREAD_ID})):h.f?S({id:void 0}):N()},[S,p,t,a,N,b,P]),$=Object(c.p)(()=>{if(!D||!f)return;let e=!1;const t=Object.values(f).reduce((t,a)=>{if(Object(m.hb)(a))return t;const s=a.unreadCount||0;return!s||a.isMuted&&!a.unreadMentionsCount||(e=!0),t+s},0);return t?{isActive:e,totalCount:t}:void 0},[D,f]),W=F>=n.R&&F<n.Y||F>n.V&&F<n.R&&(!g||g>30),Q=W||F>n.S&&F<n.Z,{shouldRender:K,transitionClassNames:X}=Object(J.a)(Boolean(j)),Z=$e(j),{shouldRender:te,transitionClassNames:se}=Object(J.a)(R&&!K),ne=$e(R),re=$e(l),oe=te&&ne||K&&Z;Object(c.n)(()=>{const e=U.current;if(e)return Q&&oe?void(O||W?(H.current&&(e.classList.add("tools-stacked","animated"),H.current=!1),setTimeout(()=>{e.classList.remove("animated")},350)):(e.classList.remove("tools-stacked"),H.current=!0)):(e.classList.remove("tools-stacked","animated"),void(H.current=!0))},[Q,oe,W,O]);const ie=Object(ae.a)();function le(){return"thread"===a&&t===i.MAIN_THREAD_ID?c.a.createElement(c.a.Fragment,null,D&&de(B,$),c.a.createElement("div",{className:"chat-info-wrapper",onClick:q},Object(m.lb)(e)?c.a.createElement(Qe.a,{userId:e,typingStatus:d,withFullInfo:y,withMediaViewer:!0,withUpdatingStatus:!0}):c.a.createElement(Ke.a,{chatId:e,typingStatus:d,withMediaViewer:!0,withFullInfo:!0,withUpdatingStatus:!0}))):"thread"===a?c.a.createElement(c.a.Fragment,null,de(),c.a.createElement("h3",null,ie("CommentsCount",I))):"pinned"===a?c.a.createElement(c.a.Fragment,null,de(),c.a.createElement("h3",null,ie("PinnedMessagesCount",I))):"scheduled"===a?c.a.createElement(c.a.Fragment,null,de(),c.a.createElement("h3",null,v?ie("Reminders"):ie("messages",I))):void 0}function de(e=!1,t){return c.a.createElement("div",{className:"back-button"},c.a.createElement(ce.a,{round:!0,size:"smaller",color:"translucent",onClick:V,ariaLabel:e?"Close":"Back"},c.a.createElement("div",{className:Object(Y.a)("animated-close-icon",!e&&"state-back")})),t&&c.a.createElement("div",{className:"unread-count "+(t.isActive?"active":"")},Object(We.b)(t.totalCount)))}return c.a.createElement("div",{className:"MiddleHeader",ref:U},c.a.createElement(ee.a,{name:"slide-fade",activeKey:"thread"===a?t:1},le),c.a.createElement("div",{className:"header-tools"},te&&ne&&!K&&c.a.createElement(it,{key:e,message:ne,count:L,index:T,customTitle:re,className:se,onUnpinMessage:o?G:void 0,onClick:_,onAllPinnedClick:z}),K&&Z&&c.a.createElement(bt,{key:Object(m.A)(Z),message:Z,className:X}),c.a.createElement(Je,{chatId:e,threadId:t,messageListType:a})))})),mt=a(150);function ht(e){return"albumId"in e}function Ot(e,t){let a,s=[],n={originalDate:e[0].date,datetime:Number(Object(x.j)(1e3*e[0].date)),senderGroups:[s]};const c=[n];return e.forEach((r,o)=>{r.isInAlbum?a?(a.messages.push(r),r.content.text&&(a.mainMessage=r)):a={albumId:r.groupedId,messages:[r],mainMessage:r}:s.push(r);const i=e[o+1];if(!a||i&&i.groupedId&&i.groupedId===a.albumId||(s.push(a),a=void 0),i){const e=Number(Object(x.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||r.senderId!==i.senderId||r.isOutgoing!==i.isOutgoing||Object(m.db)(r)||Object(m.db)(i)||r.forwardInfo&&i.forwardInfo&&(r.forwardInfo.senderUserId!==i.forwardInfo.senderUserId||r.forwardInfo.fromChatId!==i.forwardInfo.fromChatId||r.forwardInfo.hiddenUserName!==i.forwardInfo.hiddenUserName)||r.inlineButtons||i.inlineButtons)&&(s=[],n.senderGroups.push(s))}}),c}var jt=a(95);function gt(){const[e,t]=Object(ct.a)(!1),a=(s=1e3,n=!1,Object(c.p)(()=>Object(g.a)(e=>e(),s,n,r),[s,n,r]));var s,n,r;return{isScrolled:e,updateStickyDates:Object(c.m)((e,s)=>{t(),document.body.classList.contains("is-scrolling-messages")||Object(g.b)(()=>{document.body.classList.add("is-scrolling-messages")}),a(()=>{Object(g.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 ft=a(145),pt=a(115);let It=!1;var vt=({containerRef:e,className:t,messageIds:a,containerHeight:s,listItemElementsRef:r,focusingId:o,anchorIdRef:i,anchorTopRef:l,loadMoreForwards:d,loadMoreBackwards:b,isViewportNewest:u,firstUnreadId:m,onFabToggle:h,children:O})=>{const j=Object(c.q)(null),g=Object(c.q)(null),f=Object(c.q)(null),p=Object(c.m)(()=>{if(It)return;if(!a||!a.length)return void h(!1);if(!u)return void h(!0);const{offsetHeight:t,scrollHeight:s,scrollTop:n}=e.current,c=s-n-t;h(m?!(0===c):!(c<=50))},[a,u,e,h,m]),{observe:I,freeze:v,unfreeze:y}=Object(jt.a)({rootRef:e,margin:n.M},t=>{if(!d||!b)return;const a=t.find(({isIntersecting:e})=>e);if(!a)return;const{target:s}=a;"backwards-trigger"===s.className?(Object(ft.a)(e.current),b()):"forwards-trigger"===s.className&&s.dataset.isActive&&(Object(ft.a)(e.current),d())});Object(jt.c)(j,I),Object(jt.c)(g,I);const{observe:C,freeze:w,unfreeze:E}=Object(jt.a)({rootRef:e,margin:50},([{target:e}])=>{e.dataset.isActive&&p()});return Object(jt.c)(f,C),Object(he.a)(()=>{o?(v(),w()):(E(),y())},[o]),Object(he.a)(()=>{if(!r.current)return;const e=r.current.filter(e=>a.includes(Number(e.dataset.messageId))),t=e[1]||e[0];t&&(i.current=t.id,l.current=t.getBoundingClientRect().top)},[a,s]),Object(he.a)(()=>{It=!0,setTimeout(()=>{It=!1},100)},[a]),Object(c.n)(p,[m]),c.a.createElement("div",{className:t,teactFastList:!0},c.a.createElement("div",{ref:j,key:"backwards-trigger",className:"backwards-trigger"}),O,c.a.createElement("div",{ref:g,key:"forwards-trigger",className:"forwards-trigger","data-is-active":!u}),c.a.createElement("div",{ref:f,key:"fab-trigger",className:"fab-trigger","data-is-active":u}))},yt=a(132),Ct=a(135);function wt(e){return"number"==typeof e}function Et(e){return e?175:100}function Mt(e){const t=Object(m.tb)(e),a=Object(m.qb)(e),s=Object(m.G)(e)||Object(m.Q)(e),n=Object(m.O)(e),c=Boolean(Object(m.Q)(e)),{width:r,height:o}=s?Object(Xe.f)(s,t,a,c):Object(Xe.h)(n,t,a),i=Et(Boolean(Object(m.N)(e)));let l=1;r<i&&i-r<12&&(l=i/r),o*l<90&&90-o*l<12&&(l=90/o);const d=Math.round(r*l),b=Math.round(o*l);return{width:d,height:b,isSmall:d<i||b<90}}const St=0,kt=1,Nt=2,Pt=4,Tt=8;function At(e,t){return e.reduce((e,t)=>e+t,t)}function xt(e,t,a){return e<t?t:e>a?a:e}function Rt(e){const t={width:0,height:0};return e.forEach(({dimensions:e,sides:a})=>{a&Nt&&(t.width=e.width+e.x),a&Pt&&(t.height=e.height+e.y)}),t}function Lt(e,t,a,s){const c=a.messages.map(e=>{const t=Mt(e);return t.width/t.height});const r=function(e){return e.map(e=>e>1.2?"w":e<.8?"n":"q").join("")}(c),o=function(e){return e.reduce((e,t)=>t+e,1)/e.length}(c),i=c.length,l=c.some(e=>e>2),d=function(e,t,a){return a<=n.V?a/100*69-(t?1.625:0)*Xe.c:((e?30:29)-(t?1.625:0))*Xe.c}(e,t,s);let b;const u={ratios:c,proportions:r,averageRatio:o,maxWidth:d,minWidth:100,maxHeight:d,spacing:2};return b=i>=5||l?function({ratios:e,averageRatio:t,maxWidth:a,minWidth:s,spacing:n,maxHeight:c=4*a/3}){const r=function(e,t){return e.map(e=>t>1.1?xt(e,1,2.75):xt(e,.6667,1))}(e,t),o=e.length,i=new Array(o),l=[],d=e=>{const t=[];let s=0;e.forEach(e=>{t.push(((e,t)=>{const s=At(r.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!==o;++e){const t=o-e;e<=3&&t<=3&&d([e,t])}for(let e=1;e!==o-1;++e)for(let a=1;a!==o-e;++a){const s=o-e-a;e<=3&&a<=(t<.85?4:3)&&s<=3&&d([e,a,s])}for(let e=1;e!==o-1;++e)for(let t=1;t!==o-e;++t)for(let a=1;a!==o-e-t;++a){const s=o-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],r=a.length,o=At(t,0)+n*(r-1),i=Math.min(...t)<s?1.5:1,d=(()=>{for(let e=1;e!==r;++e)if(a[e-1]>a[e])return 1.5;return 1})(),m=Math.abs(o-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 o=0;for(let l=0;l!==t;++l){const d=St|(0===e?kt:St)|(e===O-1?Pt:St)|(0===l?Tt:St)|(l===t-1?Nt:St),b=r[j],u=l===t-1?a-o:Math.round(b*s);i[j]={dimensions:{x:o,y:g,width:u,height:c},sides:d},o+=u+n,++j}g+=c+n}return i}(u):2===i?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:Tt|kt|Nt},{dimensions:{x:0,y:c+s,width:a,height:c},sides:Tt|Pt|Nt}]}(e):"ww"===a||"qq"===a?function(e){const{ratios:t,maxWidth:a,spacing:s,maxHeight:n}=e,c=(a-s)/2,r=Math.round(Math.min(c/t[0],Math.min(c/t[1],n)));return[{dimensions:{x:0,y:0,width:c,height:r},sides:kt|Tt|Pt},{dimensions:{x:c+s,y:0,width:c,height:r},sides:kt|Nt|Pt}]}(e):function(e){const{ratios:t,minWidth:a,maxWidth:s,spacing:n,maxHeight:c}=e,r=Math.round(1.5*a),o=Math.min(Math.round(Math.max(.4*(s-n),(s-n)/t[0]/(1/t[0]+1/t[1]))),s-n-r),i=s-o-n,l=Math.min(c,Math.round(Math.min(i/t[0],o/t[1])));return[{dimensions:{x:0,y:0,width:i,height:l},sides:kt|Tt|Pt},{dimensions:{x:i+n,y:0,width:o,height:l},sides:kt|Nt|Pt}]}(e)}(u):3===i?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:a,ratios:s,maxWidth:n,minWidth:c}=e,r=t,o=Math.round(Math.min((t-a)/2,s[1]*(n-a)/(s[2]+s[1]))),i=r-o-a,l=Math.max(c,Math.round(Math.min((n-a)/2,Math.min(o*s[2],i*s[1])))),d=Math.min(Math.round(r*s[0]),n-a-l);return[{dimensions:{x:0,y:0,width:d,height:r},sides:kt|Tt|Pt},{dimensions:{x:d+a,y:0,width:l,height:i},sides:kt|Nt},{dimensions:{x:d+a,y:i+a,width:l,height:o},sides:Pt|Nt}]}(e):function(e){const{maxWidth:t,ratios:a,maxHeight:s,spacing:n}=e,c=t,r=Math.round(Math.min(c/a[0],.66*(s-n))),o=(t-n)/2,i=Math.min(s-r-n,Math.round(Math.min(o/a[1],o/a[2])));return[{dimensions:{x:0,y:0,width:c,height:r},sides:Tt|kt|Nt},{dimensions:{x:0,y:r+n,width:o,height:i},sides:Pt|Tt},{dimensions:{x:o+n,y:r+n,width:c-o-n,height:i},sides:Pt|Nt}]}(e)}(u):function(e){const{proportions:t}=e;return"w"===t[0]?function({maxWidth:e,ratios:t,spacing:a,maxHeight:s,minWidth:n}){const c=e,r=Math.round(Math.min(c/t[0],.66*(s-a))),o=Math.round((e-2*a)/(t[1]+t[2]+t[3])),i=Math.max(n,Math.round(Math.min(.4*(e-2*a),o*t[1]))),l=Math.round(Math.max(Math.max(n,.33*(e-2*a)),o*t[3])),d=c-i-l-2*a,b=Math.min(s-r-a,o);return[{dimensions:{x:0,y:0,width:c,height:r},sides:Tt|kt|Nt},{dimensions:{x:0,y:r+a,width:i,height:b},sides:Pt|Tt},{dimensions:{x:i+a,y:r+a,width:d,height:b},sides:Pt},{dimensions:{x:i+a+d+a,y:r+a,width:l,height:b},sides:Nt|Pt}]}(e):function({maxHeight:e,ratios:t,maxWidth:a,spacing:s,minWidth:n}){const c=e,r=Math.round(Math.min(c*t[0],.6*(a-s))),o=Math.round((e-2*s)/(1/t[1]+1/t[2]+1/t[3])),i=Math.round(o/t[1]),l=Math.round(o/t[2]),d=c-i-l-2*s,b=Math.max(n,Math.min(a-r-s,o));return[{dimensions:{x:0,y:0,width:r,height:c},sides:kt|Tt|Pt},{dimensions:{x:r+s,y:0,width:b,height:i},sides:kt|Nt},{dimensions:{x:r+s,y:i+s,width:b,height:l},sides:Nt},{dimensions:{x:r+s,y:i+l+2*s,width:b,height:d},sides:Pt|Nt}]}(e)}(u),{layout:b,containerStyle:Rt(b)}}let Ft;function Dt(e){return Ft||(Ft=document.createElement("span"),Ft.style.font='400 12px Roboto, "Helvetica Neue", "Apple Color Emoji", sans-serif',Ft.style.whiteSpace="nowrap",Ft.style.position="absolute",Ft.style.left="-999px",Ft.style.opacity=".01",document.body.appendChild(Ft)),Ft.innerHTML=e,Ft.offsetWidth}function Bt(e,t,a,s,n){Object(c.o)(()=>{if(a&&e.current){const t=e.current.closest(".MessageList");Object(pt.a)(t,e.current,n?"end":"center",20,void 0===s?1500:1e3,s)}},[e,t,a,s,n])}var Ut=a(99),Ht=a(178);var qt=e=>{const{isOpen:t}=e,a=Object(ve.a)(Ie.a.Extra,"ContextMenuContainer",!t);return a?c.a.createElement(a,e):void 0};var Gt=Object(c.h)(Object(s.h)((e,{message:t})=>{const a=t.senderId,{targetUserId:s,targetChatId:n}=t.content.action||{},c=t.replyToMessageId,r=c?Object(o.k)(e,t.chatId,c):void 0,i=Object(o.T)(e,t),{direction:l,noHighlight:d}=i&&e.focusedMessage||{},b=Object(o.f)(e,t.chatId);return{sender:b&&(Object(m.jb)(b)||a===t.chatId)?b:a?Object(o.Cb)(e,a):void 0,...s&&{targetUser:Object(o.Cb)(e,s)},targetChatId:n,targetMessage:r,isFocused:i,...i&&{focusDirection:l,noFocusHighlight:d}}})(({message:e,observeIntersection:t,isEmbedded:a,sender:s,targetUser:n,targetMessage:r,targetChatId:o,isFocused:i,focusDirection:l,noFocusHighlight:d})=>{const b=Object(c.q)(null);Object(jt.c)(b,t),Object(Ve.a)(e.chatId,e.replyToMessageId,r),Bt(b,e.chatId,i,l,d),Object(ae.a)();const u=Object(Ht.a)(e,s,n,r,o,a?{isEmbedded:!0,asPlain:!0}:void 0),{isContextMenuOpen:m,contextMenuPosition:h,handleBeforeContextMenu:O,handleContextMenu:j,handleContextMenuClose:g,handleContextMenuHide:f}=Object(yt.a)(b),p=void 0!==h;return a?c.a.createElement("span",{className:"embedded-action-message"},Object(Ze.a)(u)):c.a.createElement("div",{ref:b,id:"message"+e.id,className:Object(Y.a)("ActionMessage message-list-item",i&&!d&&"focused",p&&"has-menu-open"),"data-message-id":e.id,onMouseDown:O,onContextMenu:j},c.a.createElement("span",null,u),h&&c.a.createElement(qt,{isOpen:m,anchor:h,message:e,messageListType:"thread",onClose:g,onCloseAnimationEnd:f}))}));a(206);var _t=({className:e,message:t,sender:a,title:s,customText:n,observeIntersection:r,onClick:o})=>{const i=Object(c.q)(null),l=Object(jt.b)(i,r),d=Object(et.a)(t&&Object(m.D)(t,"pictogram"),!l),b=t&&"sticker-reply-thumb"+t.id,u=at(t);Object(ae.a)();const h=a&&Object(m.U)(a);return c.a.createElement("div",{ref:i,className:Object(Y.a)("EmbeddedMessage",e),onClick:t?o:void 0},u&&function(e,t,a){const{width:s,height:n}=Object(Xe.k)();return c.a.createElement("img",{id:e,src:a||t,width:s,height:n,alt:""})}(b,u,d),c.a.createElement("div",{className:"message-text"},c.a.createElement("div",{className:"message-title"},Object(Ze.a)(h||s||" ")),c.a.createElement("p",null,t?Object(m.db)(t)?c.a.createElement(Gt,{message:t,isEmbedded:!0}):Object(Ze.a)(Object(m.M)(t,Boolean(u))):n||" ")))},zt=a(151),Vt=a(156),$t=a(162);a(210);var Wt=({message:e,outgoingStatus:t,signature:a,onClick:s})=>{const n=Object(ae.a)();return c.a.createElement("span",{className:"MessageMeta",onClick:s},Boolean(e.views)&&c.a.createElement(c.a.Fragment,null,c.a.createElement("span",{className:"message-views"},Object(We.b)(e.views)),c.a.createElement("i",{className:"icon-channelviews"})),a&&c.a.createElement("span",{className:"message-signature"},Object(Ze.a)(a)),c.a.createElement("span",{className:"message-time"},e.isEdited&&n("EditedMessage")+" ",Object(x.h)(1e3*e.date)),t&&c.a.createElement($t.a,{status:t}))},Qt=a(103),Kt=a(106),Yt=a(152);a(211);var Jt=({message:e,observeIntersection:t,observeIntersectionForPlaying:a,shouldLoop:s,lastSyncTime:r})=>{const o=Object(c.q)(null),[i,l,d]=Object(ct.a)(),b=e.content.sticker,{isAnimated:u,stickerSetId:h}=b,O=h===n.K,j=Object(jt.b)(o,t),g=Object(jt.b)(o,a),f=b.isPreloadedGlobally?"sticker"+b.id:Object(m.D)(e,"inline"),p=at(e),I=Object(et.a)(f,!j,Object(m.C)(e,"inline",!0),r),v=Boolean(I),[y,C]=Object(ct.a)(v),w=u?y:v,{shouldRenderFullMedia:E,transitionClassNames:M}=Object(Qt.a)(w,"slow"),{width:S,height:k}=Object(Xe.l)(b),N=Object(Y.a)("thumbnail",!p&&"empty"),P=Object(Y.a)("Sticker media-inner",O&&"inactive");return c.a.createElement("div",{ref:o,className:P,onClick:O?void 0:l},!w&&c.a.createElement("img",{id:"sticker-thumb-"+e.id,src:p,width:S,height:k,alt:"",className:N}),!u&&E&&c.a.createElement("img",{id:"sticker-"+e.id,src:I,width:S,height:k,alt:"",className:Object(Y.a)("full-media",M)}),u&&v&&c.a.createElement(Kt.a,{key:f,className:Object(Y.a)("full-media",M),id:f,animationData:I,size:S,play:g,noLoop:!s,onLoad:C}),c.a.createElement(Yt.a,{isOpen:i,fromSticker:b,onClose:d}))},Xt=a(119),Zt=a(112),ea=a(136);function ta(e,t){return Object(ea.a)(Object(m.E)(e),Boolean(t),h.f?n.C:void 0)}var aa=async(e,t,a,s)=>s?"rgba(255,255,255,1)":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,r=a.height-1;return`rgba(${Array.from(n.getImageData(c,r,1,1).data).join(",")})`}(e,t);var sa=a(113);var na=({id:e,message:t,observeIntersection:a,shouldAutoLoad:s,isInSelectMode:n,isSelected:r,uploadProgress:o,size:i="inline",dimensions:l,shouldAffectAppendix:d,onClick:b,onCancelUpload:u})=>{const h=Object(c.q)(null),O=(Object(m.G)(t)||Object(m.Q)(t)).blobUrl,j=Object(jt.b)(h,a),[g,f]=Object(c.r)(s),p=g&&j,{mediaData:I,downloadProgress:v}=Object(Zt.a)(Object(m.D)(t,i),!p),y=O||I,C=ta(t,y),{isUploading:w,isTransferring:E,transferProgress:M}=Object(m.s)(t,o||v,p&&!y),S=!1===Object(qe.a)(g),{shouldRender:k,transitionClassNames:N}=Object(J.a)(E,void 0,S,"slow"),{shouldRenderThumb:P,shouldRenderFullMedia:T,transitionClassNames:A}=Object(Qt.a)(y,"slow"),x=Object(c.m)(()=>{w?u&&u(t):y?b&&b(t.id):f(e=>!e)},[y,w,t,u,b]),R=Object(m.tb)(t);Object(c.o)(()=>{if(!d)return;const e=h.current.closest(".message-content");y?aa(y,R,0,r).then(t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute("data-has-custom-appendix","")}):e.classList.add("has-appendix-thumb")},[y,R,d,n,r]);const{width:L,height:F,isSmall:D}=l||Mt(t),B=Object(Y.a)("media-inner",!w&&"interactive",D&&"small-image",L===F&&"square-image"),U=Object(Y.a)("thumbnail",!C&&"empty"),H=l?`width: ${L}px; height: ${F}px; left: ${l.x}px; top: ${l.y}px;`:"";return c.a.createElement("div",{id:e,ref:h,className:B,style:H,onClick:w?void 0:x},P&&c.a.createElement("img",{src:C,className:U,width:L,height:F,alt:""}),T&&c.a.createElement("img",{src:y,className:"full-media "+A,width:L,height:F,alt:""}),k&&c.a.createElement("div",{className:"media-loading "+N},c.a.createElement(sa.a,{progress:M,onClick:w?x:void 0})),!y&&!g&&c.a.createElement("i",{className:"icon-download"}),E&&c.a.createElement("span",{className:"message-upload-progress"},Math.round(100*M),"%"))},ca=a(121),ra=a(134);function oa(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(ra.a)(e.current)},[e]);Object(K.a)(s,n)}var ia=a(137);function la(){return(la=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 da=({id:e,message:t,observeIntersection:a,shouldAutoLoad:s,shouldAutoPlay:n,uploadProgress:r,lastSyncTime:o,dimensions:i,onClick:l,onCancelUpload:d})=>{const b=Object(c.q)(null),u=Object(c.q)(null),h=t.content.video,O=h.blobUrl,j=Boolean(O)||Object(m.b)(h),g=Object(jt.b)(b,a),[f,p]=Object(c.r)(s),I=Boolean(f&&g&&o),[v,y]=Object(c.r)(n),C=Object(et.a)(Object(m.D)(t,"pictogram"),!(g&&o),Object(m.C)(t,"pictogram"),o),w=ta(t,C),{mediaData:E,downloadProgress:M}=Object(Zt.a)(Object(m.D)(t,"inline"),!I,Object(m.C)(t,"inline"),o),S=C||w,k=O||E,N=Boolean(j&&g&&k),{isBuffered:P,bufferingHandlers:T}=Object(ca.a)(!s),{isUploading:A,isTransferring:R,transferProgress:L}=Object(m.s)(t,r||M,I&&j&&!P),F=!1===Object(qe.a)(f),{shouldRender:D,transitionClassNames:B}=Object(J.a)(R,void 0,F),{shouldRenderThumb:U,transitionClassNames:H}=Object(Qt.a)(k,"slow"),[q,G]=Object(c.r)(0),_=Object(c.m)(e=>{G(Math.max(0,e.currentTarget.currentTime-1))},[]),z=Object(m.tb)(t),V=Object(m.qb)(t),{width:$,height:W}=i||Object(Xe.h)(h,z,V);oa(u,N),Object(ia.a)(u,[N]);const Q=Object(c.m)(()=>{A?d&&d(t):j&&!k?p(e=>!e):j&&k&&!v?(y(!0),u.current.play()):l&&l(t.id)},[A,j,k,v,l,d,t]),K=Object(Y.a)("media-inner dark",!A&&"interactive"),X=Object(Y.a)("thumbnail",!S&&"empty"),Z=Object(Y.a)("full-media",H),ee=S?`background-image: url(${S}); background-size: cover`:"",te=i?`width: ${$}px; height: ${W}px; left: ${i.x}px; top: ${i.y}px;`:"",ae=N,se=!j&&E,ne=!j||f&&!v&&!D,ce=j&&!f;return c.a.createElement("div",{ref:b,id:e,className:K,style:te,onClick:A?void 0:Q},(U||!N)&&c.a.createElement("img",{src:S,className:X,width:$,height:W,alt:""}),ae&&c.a.createElement("video",la({ref:u,className:Z,width:$,height:W,autoPlay:v,muted:!0,loop:!0,playsInline:!0,style:ee},T,{onTimeUpdate:_}),c.a.createElement("source",{src:k})),se&&c.a.createElement("img",{src:E,className:"full-media "+H,width:$,height:W,alt:""}),ne&&c.a.createElement("i",{className:"icon-large-play"}),D&&c.a.createElement("div",{className:"media-loading "+B},c.a.createElement(sa.a,{progress:L,onClick:A?Q:void 0})),ce&&c.a.createElement("i",{className:"icon-download"}),R&&!j?c.a.createElement("span",{className:"message-upload-progress"},Math.round(100*L),"%"):R&&j?c.a.createElement("span",{className:"message-upload-progress"},"..."):c.a.createElement("div",{className:"message-media-duration"},h.isGif?"GIF":Object(x.e)(h.duration-q)))},ba=a(19);a(213);var ua=Object(s.h)((e,{contact:t})=>({user:Object(o.Cb)(e,t.userId)}),(e,t)=>Object(d.l)(t,["openUserInfo"]))(({contact:e,user:t,openUserInfo:a})=>{const{firstName:s,lastName:n,phoneNumber:r,userId:o}=e,i=Object(c.m)(()=>{a({id:o})},[a,o]);return c.a.createElement("div",{className:Object(Y.a)("Contact",Boolean(o)&&"interactive"),onClick:o?i:void 0},c.a.createElement(Ut.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(ba.c)(r))))}),ma=a(40);var ha=Object(c.h)(({id:e,options:t,selected:a=[],disabled:s,round:n,loadingOptions:r,onChange:o})=>{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),o(s)},[o,i]);return c.a.createElement("div",{id:e,className:"radio-group"},t.map(e=>c.a.createElement(ma.a,{label:e.label,subLabel:e.subLabel,value:e.value,checked:-1!==a.indexOf(e.value),disabled:s,round:n,isLoading:r?-1!==r.indexOf(e.value):void 0,onChange:d})))}),Oa=a(117),ja=a(170);a(216);function ga(e,t){return t>0?(e/t*100).toFixed():0}var fa=({answer:e,voteResults:t,totalVoters:a,maxVotersCount:s,correctResults:n,shouldAnimate:r})=>{const o=t&&t.find(t=>t.option===e.option),i=0===n.length||-1!==n.indexOf(e.option),l=n.length>0&&i||o&&o.isChosen,d=o?ga(o.votersCount,a||0):0,[b,u]=Object(c.r)(r?0:d),m=Object(c.q)(null),h=o?ga(o.votersCount,s||0):0,O=b<d;if(Object(c.n)(()=>{r&&u(d)},[r,d]),Object(c.n)(()=>{const e=m.current;if(e&&r){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,r]),!t||!o)return;const j=`width: ${h}%; transform:scaleX(${O?0:1})`;return c.a.createElement("div",{className:"PollOption"},c.a.createElement("div",{className:"poll-option-share "+("100"===d?"limit-width":"")},d,"%",l&&c.a.createElement("span",{className:Object(Y.a)("poll-option-chosen",!i&&"wrong",r&&"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"},Object(Ze.a)(e.text)),c.a.createElement("div",{className:Object(Y.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(217);var pa=Object(c.h)(Object(s.h)((e,{poll:t})=>{const{recentVoterIds:a}=t.results,{byId:s}=e.users;return a&&0!==a.length?{recentVoterIds:a,usersById:s}:{}},(e,t)=>Object(d.l)(t,["loadMessage","openPollResults"]))(({message:e,poll:t,recentVoterIds:a,usersById:s,loadMessage:n,onSendVote:r,openPollResults:o})=>{const{id:i,chatId:l}=e,{summary:d,results:b}=t,[u,m]=Object(c.r)(!1),[h,O]=Object(c.r)([]),[j,g]=Object(c.r)(!1),[f,p]=Object(c.r)(!1),[I,v]=Object(c.r)(!d.closed&&d.closeDate&&d.closeDate>0?Math.min(d.closeDate-Math.floor(Date.now()/1e3),d.closePeriod):0),y=Object(c.q)(null),{results:C,totalVoters:w}=b,E=C&&C.some(e=>e.isChosen),M=!d.closed&&!E,S=!M&&d.isPublic&&Number(b.totalVoters)>0,k=M&&d.multipleChoice,N=C?Math.max(...C.map(e=>e.votersCount)):w,P=C?C.reduce((e,t)=>(t.isCorrect&&e.push(t.option),e),[]):[],T=d.answers.map(e=>({label:e.text,value:e.option,hidden:Boolean(d.quiz&&d.closePeriod&&I<=0)}));Object(c.n)(()=>{u&&t.results.results&&t.results.results.some(e=>e.isChosen)&&m(!1)},[u,t.results.results]),Object(c.n)(()=>{I>0&&setTimeout(()=>v(I-1),1e3);const e=y.current;if(e){const t=12*Math.PI,a=e.lastElementChild,s=e.firstElementChild;if(I<=5&&e.classList.add("hurry-up"),a&&s){const e=(d.closePeriod-I)/d.closePeriod*t;s.textContent=Object(x.e)(I),a.firstElementChild.setAttribute("stroke-dashoffset","-"+e)}else e.innerHTML=`\n <span>${Object(x.e)(I)}</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>`}},[I,d.closePeriod]),Object(c.n)(()=>{d.quiz&&(I<=0||E&&!d.closed)&&n({chatId:l,messageId:i})},[l,I,E,n,i,d.closed,d.quiz]),Object(c.n)(()=>{let e;return d.quiz&&!d.closed&&d.closePeriod&&d.closePeriod>0&&(e=window.setTimeout(()=>{n({chatId:l,messageId:i})},1e3*d.closePeriod)),()=>{e&&window.clearTimeout(e)}},[M,l,n,i,d.closePeriod,d.closed,d.quiz]);const A=Object(c.p)(()=>a?a.reduce((e,t)=>{const a=s[t];return a&&e.push(a),e},[]):[],[s,a]),R=Object(c.m)(e=>{O([e]),m(!0),p(!0),r([e])},[r]),L=Object(c.m)(e=>{O(e)},[]),F=Object(c.m)(()=>{m(!0),p(!0),r(h)},[r,h]),D=Object(c.m)(()=>{o({chatId:l,messageId:i})},[l,i,o]),B=Object(c.m)(()=>{g(!0)},[]),U=Object(c.m)(()=>{g(!1),p(!1)},[]);Object(c.n)(()=>{if(f&&E&&d.quiz&&b.results&&t.results.solution){b.results.find(e=>e.isChosen&&e.isCorrect)||g(!0)}},[E,f,b.results,d.quiz,t.results.solution]);const H=Object(ae.a)();return c.a.createElement("div",{className:"Poll"},j&&t.results.solution&&c.a.createElement(ja.a,{message:Object(Ct.b)(t.results.solution,t.results.solutionEntities),duration:5e3,onDismiss:U}),c.a.createElement("div",{className:"poll-question"},Object(Ze.a)(d.question)),c.a.createElement("div",{className:"poll-type"},function(e){if(void 0===e.isPublic)return" ";if(e.quiz)return e.isPublic?"Quiz":"Anonymous Quiz";if(e.closed)return"Final results";return e.isPublic?"Poll":"Anonymous Poll"}(d),A.length>0&&c.a.createElement("div",{className:"poll-recent-voters"},A.map(e=>c.a.createElement(Ut.a,{size:"micro",user:e}))),I>0&&M&&c.a.createElement("div",{ref:y,className:"poll-countdown"}),d.quiz&&t.results.solution&&!M&&c.a.createElement(ce.a,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:j,onClick:B,ariaLabel:"Show Solution"},c.a.createElement("i",{className:"icon-lamp"}))),M&&c.a.createElement("div",{className:"poll-answers"},k?c.a.createElement(ha,{options:T,onChange:L,disabled:e.isScheduled||u,loadingOptions:u?h:void 0,round:!0}):c.a.createElement(Oa.a,{name:"poll-"+i,options:T,onChange:R,disabled:e.isScheduled||u,loadingOption:u?h[0]:void 0})),!M&&c.a.createElement("div",{className:"poll-results"},d.answers.map((function(e){return c.a.createElement(fa,{key:e.option,shouldAnimate:f,answer:e,voteResults:C,totalVoters:w,maxVotersCount:N,correctResults:P})}))),!S&&!k&&c.a.createElement("div",{className:"poll-voters-count"},function(e,t){if(!t)return e?"No answers yet":"No voters yet";return e?t+" answered":t+" voted"}(d.quiz,b.totalVoters)),k&&c.a.createElement(ce.a,{isText:!0,disabled:0===h.length,size:"tiny",onClick:F},H("PollSubmitVotes")),S&&c.a.createElement(ce.a,{isText:!0,size:"tiny",onClick:D},H("PollViewResults")))})),Ia=a(146),va=a(52);a(218);var ya=Object(c.h)(({message:e,observeIntersection:t,shouldAutoLoad:a,inPreview:s,onMediaClick:n,onCancelMediaTransfer:r})=>{const o=Object(m.P)(e);let i=!1;if(o&&o.photo){const{width:t,height:a}=Mt(e);i=t===a}const l=Object(c.m)(()=>{o&&(i||o.hasDocument)?window.open(o.url):n&&n()},[o,i,n]);if(!o)return;const{siteName:d,url:b,displayUrl:u,title:h,description:O,photo:j}=o,g=Object(Ia.a)(O,170),f=["WebPage",j?i&&"with-square-photo":!s&&"without-photo"].filter(Boolean).join(" ");return c.a.createElement("div",{className:f,"data-initial":(d||u)[0]},j&&c.a.createElement(na,{message:e,observeIntersection:t,shouldAutoLoad:a,size:i?"pictogram":"inline",onClick:l,onCancelUpload:r}),c.a.createElement("div",{className:"WebPage-text"},c.a.createElement(va.a,{className:"site-name",url:b,text:d||u}),h&&c.a.createElement("p",{className:"site-title"},Object(Ze.a)(h)),g&&c.a.createElement("p",{className:"site-description"},Object(Ze.a)(g,["emoji","br"]))))});a(219);var Ca=Object(c.h)(({message:e})=>{const t=Object(m.z)(e),{title:a,text:s,description:n,photoUrl:r}=t;return c.a.createElement("div",{className:"Invoice"},a&&c.a.createElement("p",{className:"title"},Object(Ze.a)(a)),s&&c.a.createElement("p",null,Object(Ze.a)(s,["emoji","br"])),c.a.createElement("div",{className:"description "+(r?"has-image":"")},r&&c.a.createElement("img",{className:"invoice-image",src:r,alt:""}),n&&c.a.createElement("p",{className:"description-text"},Object(Ze.a)(n,["emoji","br"]))))});function wa(e){return Object(c.h)(Object(s.h)((e,t)=>{const{message:a}=t;return{isInSelectMode:Object(o.R)(e),isSelected:Object(o.U)(e,a.id)}},(e,t)=>Object(d.l)(t,["toggleMessageSelection"]))(t=>{const{isInSelectMode:a,isSelected:s,message:n,toggleMessageSelection:r,dimensions:o}=t,i=Object(c.m)(e=>{e.stopPropagation(),r({messageId:n.id,withShift:e&&e.shiftKey})},[r,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(Y.a)("album-item-select-wrapper",s&&"is-selected"),style:o?`left: ${o.x}px; top: ${o.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(220);const Ea=wa(na),Ma=wa(da);var Sa=Object(s.h)(e=>({uploadsById:e.fileUploads.byMessageLocalId}),(e,t)=>Object(d.l)(t,["cancelSendingMessage"]))(({album:e,observeIntersection:t,shouldAutoLoad:a,shouldAutoPlay:s,hasCustomAppendix:n,lastSyncTime:r,isOwn:o,albumLayout:i,onMediaClick:l,uploadsById:d,cancelSendingMessage:b})=>{const u=e.messages.length,h=Object(c.m)(e=>{b({chatId:e.chatId,messageId:e.id})},[b]);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,b){const{photo:O,video:j}=Object(m.v)(e),g=d[e.previousLocalId||e.id],f=g?g.progress:void 0,{dimensions:p,sides:I}=i.layout[b];if(O){const s=n&&(o?b===u-1:Boolean(I&Tt&&I&Pt));return c.a.createElement(Ea,{id:"album-media-"+e.id,message:e,observeIntersection:t,shouldAutoLoad:a,shouldAffectAppendix:s,uploadProgress:f,dimensions:p,onClick:l,onCancelUpload:h})}if(j)return c.a.createElement(Ma,{id:"album-media-"+e.id,message:e,observeIntersection:t,shouldAutoLoad:a,shouldAutoPlay:s,uploadProgress:f,lastSyncTime:r,dimensions:p,onClick:l,onCancelUpload:h})})))});a(221);function ka(){return(ka=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 Na=({message:e,observeIntersection:t,shouldAutoLoad:a,shouldAutoPlay:s,lastSyncTime:n})=>{const r=Object(c.q)(null),o=Object(c.q)(null),i=Object(c.q)(null),l=e.content.video,d=Object(jt.b)(r,t),[b,u]=Object(c.r)(a&&s),h=Boolean(b&&d&&n),{mediaData:O,downloadProgress:j}=Object(Zt.a)(Object(m.D)(e,"inline"),!h,Object(m.C)(e,"inline"),n),g=ta(e,O),{isBuffered:f,bufferingHandlers:p}=Object(ca.a)(),I=b&&!f,v=!1===Object(qe.a)(b),{shouldRender:y,transitionClassNames:C}=Object(J.a)(I||!f,void 0,v),{shouldRenderThumb:w,transitionClassNames:E}=Object(Qt.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=o.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 P=Boolean(O&&d);Object(c.n)(()=>{i.current&&(P?Object(ra.a)(i.current):i.current.pause())},[P]),oa(i,P),Object(ia.a)(i,[O]);const T=Object(c.m)(()=>{if(!O)return void u(e=>!e);const e=i.current;M?e.paused?Object(ra.a)(e):e.pause():(e.currentTime=0,S(!0))},[M,O]),A=Object(c.m)(e=>{const t=e.currentTarget;N(t.currentTime/t.duration)},[]),R=Object(c.m)(()=>{S(!1),N(0),Object(ra.a)(i.current),requestAnimationFrame(()=>{o.current.innerHTML=""})},[]),L=Object(Y.a)("full-media",E);return c.a.createElement("div",{ref:r,className:"RoundVideo media-inner",onClick:T},w&&c.a.createElement("div",{className:"thumbnail-wrapper"},c.a.createElement("img",{src:g,className:"thumbnail",width:Xe.d,height:Xe.d,alt:""})),O&&c.a.createElement("div",{className:"video-wrapper"},c.a.createElement("video",ka({ref:i,className:L,width:Xe.d,height:Xe.d,autoPlay:!0,muted:!M,loop:!M,playsInline:!0,poster:g,onEnded:M?R:void 0},p,{onTimeUpdate:M?A:void 0}),c.a.createElement("source",{src:O}))),c.a.createElement("div",{className:"progress",ref:o}),y&&c.a.createElement("div",{className:"media-loading "+C},c.a.createElement(sa.a,{progress:j})),!O&&!b&&c.a.createElement("i",{className:"icon-large-play"}),c.a.createElement("div",{className:"message-media-duration"},M?Object(x.e)(i.current.currentTime):Object(x.e)(l.duration),(!M||i.current.paused)&&c.a.createElement("i",{className:"icon-muted-chat"})))};a(222);var Pa=({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(ce.a,{size:"tiny",ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>t({button:e})},e.text)))));a(223);var Ta=Object(c.h)(Object(s.h)((e,{message:t})=>{const{threadId:a,chatId:s}=t.threadInfo,n=Object(o.yb)(e,s,a)||t.threadInfo,{byId:c}=e.users,{byId:r}=e.chats;return{threadInfo:n,usersById:c,chatsById:r}},(e,t)=>Object(d.l)(t,["openChat"]))(({disabled:e,threadInfo:t,usersById:a,chatsById:s,openChat:n})=>{const{threadId:r,chatId:o,messagesCount:i,lastMessageId:l,lastReadInboxMessageId:d,recentReplierIds:b}=t,u=Object(c.m)(()=>{n({id:o,threadId:r})},[n,o,r]);if(void 0===i)return;const h=b&&b.map(e=>Object(m.lb)(e)?a[e]:s[e]).filter(Boolean);const O=Boolean(d&&l&&d<l);return c.a.createElement("div",{"data-cnt":Object(We.b)(i),className:Object(Y.a)("CommentButton",O&&"has-unread",e&&"disabled"),onClick:u},c.a.createElement("i",{className:"icon-comments-sticker"}),(!h||0===h.length)&&c.a.createElement("i",{className:"icon-comments"}),h&&h.length>0&&c.a.createElement("div",{className:"recent-repliers"},h.map(e=>c.a.createElement(Ut.a,{key:e.id,size:"small",user:Object(m.lb)(e.id)?e:void 0,chat:Object(m.lb)(e.id)?void 0:e}))),c.a.createElement("div",{className:"label"},function(e){if(0===e)return"Leave a Comment";if(1===e)return"1 Comment";return Object(We.a)(e)+" Comments"}(i)),c.a.createElement("i",{className:"icon-next"}))}));a(224);function Aa(e){const t=Ra(e.currentTarget);t&&t.setAttribute("data-is-document-group-hover","")}function xa(e){const t=Ra(e.currentTarget);t&&t.removeAttribute("data-is-document-group-hover")}function Ra(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var La=Object(c.h)(Object(s.h)((e,t)=>{const{focusedMessage:a,forwardMessages:s,lastSyncTime:n}=e,{message:c,album:r,withSenderName:i,withAvatar:l,threadId:d,messageListType:b}=t,{id:u,chatId:h,viaBotId:O,replyToMessageId:j,isOutgoing:g}=c,f=Object(o.f)(e,h),p=Object(o.O)(e,h),I=f&&Object(m.jb)(f),v=!p&&Object(m.eb)(c),y=i||l||v?Object(o.pb)(e,c):void 0,C=Object(o.J)(e,c),w=O?Object(o.Cb)(e,O):void 0,E=d?Object(o.Ab)(e,h,d):void 0,M=c.id===E,S=j===E,k=j&&!S?Object(o.k)(e,h,j):void 0,N=k&&Object(o.pb)(e,k),P=Object(o.Bb)(e,c),T="thread"===b&&(r?r.messages.some(t=>Object(o.T)(e,t)):Object(o.T)(e,c)),{direction:A,noHighlight:x}=T&&a||{},R=s.messageIds&&s.messageIds.includes(u),{query:L}=Object(o.A)(e)||{},F=Object(m.K)(c);let D;return D=r&&r.messages?r.messages.every(({id:t})=>Object(o.U)(e,t)):Object(o.U)(e,u),{forceSenderName:v,sender:y,originSender:C,botSender:w,shouldHideReply:S,isThreadTop:M,replyMessage:k,replyMessageSender:N,...g&&{outgoingStatus:Object(o.bb)(e,c,"scheduled"===b)},..."number"==typeof P&&{uploadProgress:P},isFocused:T,...T&&{focusDirection:A,noFocusHighlight:x},isForwarding:R,isChatWithSelf:p,isChannel:I,lastSyncTime:n,highlight:L,isSingleEmoji:Boolean(F),animatedEmoji:F?Object(o.c)(e,F):void 0,isInSelectMode:Object(o.R)(e),isSelected:D,isGroupSelected:!!c.groupedId&&!c.isInAlbum&&Object(o.P)(e,h,c.groupedId),threadId:d,isPinnedList:"pinned"===b,shouldAutoLoadMedia:f?Object(o.qb)(e,c,f,y):void 0,shouldAutoPlayMedia:Object(o.rb)(e,c),shouldLoopStickers:Object(o.sb)(e)}},(e,t)=>Object(d.l)(t,["focusMessage","openMediaViewer","openAudioPlayer","cancelSendingMessage","openUserInfo","openChat","markMessagesRead","sendPollVote","toggleMessageSelection","setReplyingToId","openForwardMenu","clickInlineButton"]))(({message:e,observeIntersectionForBottom:t,observeIntersectionForMedia:a,observeIntersectionForAnimatedStickers:s,album:n,withAvatar:r,withSenderName:o,noComments:d,isFirstInGroup:b,isLastInGroup:u,isFirstInDocumentGroup:h,isLastInDocumentGroup:O,isLastInList:j,forceSenderName:g,sender:f,originSender:p,botSender:I,isThreadTop:v,shouldHideReply:y,replyMessage:C,replyMessageSender:w,outgoingStatus:E,uploadProgress:M,isFocused:S,focusDirection:k,noFocusHighlight:N,isForwarding:P,isChatWithSelf:T,isChannel:A,lastSyncTime:x,highlight:R,animatedEmoji:L,isInSelectMode:F,isSelected:D,isGroupSelected:B,threadId:U,messageListType:H,isPinnedList:q,shouldAutoLoadMedia:G,shouldAutoPlayMedia:_,shouldLoopStickers:z,focusMessage:V,openMediaViewer:$,openAudioPlayer:W,openUserInfo:Q,openChat:K,cancelSendingMessage:J,markMessagesRead:X,sendPollVote:Z,toggleMessageSelection:ee,setReplyingToId:te,openForwardMenu:se,clickInlineButton:ne})=>{const re=Object(c.q)(null),oe=Object(c.q)(null),ie=Object(c.q)(null);Object(jt.c)(oe,t);const{width:le}=He(),{isContextMenuOpen:de,contextMenuPosition:be,handleBeforeContextMenu:ue,handleContextMenu:me,handleContextMenuClose:he,handleContextMenuHide:Oe}=Object(yt.a)(re),{chatId:je,id:ge,threadInfo:fe}=e,pe=Object(m.tb)(e),Ie="scheduled"===H||e.isScheduled,ve=Object(m.ub)(e)&&!y,ye=Boolean(fe)&&"thread"===H,{forwardInfo:Ce,viaBotId:we}=e,Ee=Ce&&!T&&!Ce.isLinkedChannelPost,Me=!!e.groupedId&&!e.isInAlbum,Se=Boolean(n)&&n.messages.length>1,{text:ke,photo:Ne,video:Pe,audio:Te,voice:Ae,document:xe,sticker:Re,contact:Le,poll:Fe,webPage:De,invoice:Be}=Object(m.v)(e),Ue=Object(m.x)(e),qe=Object(Ct.a)(e,R,wt(Ue)),Ge=void 0!==be,_e=Object(Y.a)("Message message-list-item",b&&"first-in-group",u&&"last-in-group",h&&"first-in-document-group",O&&"last-in-document-group",j&&"last-in-list",pe&&"own",Boolean(e.views)&&"has-views",e.isEdited&&"was-edited",ve&&"has-reply",Ge&&"has-menu-open",S&&!N&&"focused",P&&"is-forwarding",e.isDeleting&&"is-deleting",Me&&"is-in-document-group",Se&&"is-album",e.hasUnreadMention&&"has-unread-mention",D&&"is-selected",F&&"is-in-selection-mode",v&&"is-thread-top",Boolean(e.inlineButtons)&&"has-inline-buttons"),ze=function(e,{hasReply:t,customShape:a,isLastInGroup:s,asForwarded:n,hasThread:c,forceSenderName:r,hasComments:o}={}){const{text:i,photo:l,video:d,audio:b,voice:u,document:h,poll:O,webPage:j,contact:g}=Object(m.v)(e),f=["message-content"],p=(l||d)&&!i,I=Boolean(e.viaBotId);return wt(a)?f.push("emoji-only emoji-only-"+a):i&&f.push("text"),a&&(f.push("custom-shape"),d&&d.isRound&&f.push("round"),o&&f.push("has-comments")),l||d?f.push("media"):b?f.push("audio"):u?f.push("voice"):h?f.push("document"):g?f.push("contact"):O?f.push("poll"):j&&(f.push("web-page"),j.photo&&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"),r&&f.push("force-sender-name"),a||(f.push("has-shadow"),(t||n||!p||I||r)&&f.push("has-solid-background"),!s||!l&&p||f.push("has-appendix")),f.join(" ")}(e,{hasReply:ve,customShape:Ue,isLastInGroup:u,asForwarded:Ee,hasThread:ye,forceSenderName:g,hasComments:e.threadInfo&&e.threadInfo.messagesCount>0}),$e=!Ce||!T&&f?f:p,We=Ce?p:f,Qe=A&&e.adminTitle||Ce&&!Ee&&Ce.adminTitle||void 0;Object(Ve.a)(je,ve?e.replyToMessageId:void 0,C,e.id),Bt(re,je,S,k,N),Object(c.n)(()=>{ie.current&&(ie.current.innerHTML=pe?'<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>')},[pe]);const Ke=Object(c.m)(t=>{t.stopPropagation(),ee({messageId:ge,groupedId:e.groupedId})},[ge,e.groupedId,ee]),Ye=Object(c.m)(e=>{const t=Se&&n&&n.messages?{messageId:ge,childMessageIds:n.messages.map(({id:e})=>e),withShift:e&&e.shiftKey}:{messageId:ge,withShift:e&&e.shiftKey};ee(t)},[ee,ge,Se,n]),Je=Object(c.m)(()=>{te({messageId:ge})},[te,ge]),et=Object(c.m)(e=>{e.stopPropagation()},[]),tt=Object(c.m)(()=>{$e&&(Object(m.lb)($e.id)?Q({id:$e.id}):K({id:$e.id}))},[$e,Q,K]),at=Object(c.m)(()=>{We&&(Object(m.lb)(We.id)?Q({id:We.id}):K({id:We.id}))},[We,Q,K]),st=Object(c.m)(()=>{I&&Q({id:I.id})},[I,Q]),nt=Object(c.m)(()=>{V({chatId:je,threadId:U,messageId:e.replyToMessageId})},[V,je,U,e.replyToMessageId]),ct=Object(c.m)(()=>{$({chatId:je,threadId:U,messageId:ge,origin:Ie?l.h.ScheduledInline:l.h.Inline})},[je,U,ge,$,Ie]),rt=Object(c.m)(()=>{W({chatId:je,messageId:ge})},[je,ge,W]),ot=Object(c.m)(e=>{$({chatId:je,threadId:U,messageId:e,origin:Ie?l.h.ScheduledAlbum:l.h.Album})},[je,U,$,Ie]),it=Object(c.m)(()=>{X({messageIds:[ge]})},[ge,X]),lt=Object(c.m)(()=>{J({chatId:je,messageId:ge})},[J,je,ge]),dt=Object(c.m)(e=>{Z({chatId:je,messageId:ge,options:e})},[je,ge,Z]),bt=Object(c.m)(()=>{se({fromChatId:je,groupedId:e.groupedId})},[se,je,e.groupedId]),ut=Object(c.m)(()=>{if(n&&n.messages){const e=n.messages.map(({id:e})=>e);se({fromChatId:je,messageIds:e})}else se({fromChatId:je,messageIds:[ge]})},[n,se,je,ge]),mt=Object(c.m)(()=>{V({chatId:je,threadId:i.MAIN_THREAD_ID,messageId:ge})},[V,je,ge]),ht=Object(c.m)(()=>{V(Me?{chatId:Ce.fromChatId,groupedId:e.groupedId,groupedChatId:je}:{chatId:Ce.fromChatId,messageId:Ce.fromMessageId})},[V,Ce,e,je,Me]),Ot=Object(ae.a)();let gt,ft="";const pt=Object(c.p)(()=>Se?Lt(pe,Boolean(Ee),n,le):void 0,[Se,le,pe,Ee,n]),It=Ee?28:0;if(Se||!Ne&&!Pe)pt&&(gt=Math.max(Et(Boolean(ke)),pt.containerStyle.width));else{let t;Ne?t=Mt(e).width:Pe&&(t=Pe.isRound?Xe.d:Mt(e).width),t&&(gt=Math.max(Et(Boolean(ke)),t))}gt&&(ft=`width: ${gt+It}px`);const vt=Object(c.p)(()=>Qe?Dt(Qe):void 0,[Qe]),St=!(Ge||F||P)&&(!Me||O),kt=St&&A&&!Ie,Nt=St&&(Ce&&(Ce.isChannelPost||T&&!pe)&&Ce.fromMessageId||q),Pt=e.threadInfo&&(!Me||O)&&"thread"===H&&!d;return c.a.createElement("div",{ref:re,id:"message"+ge,className:_e,style:vt?`--meta-safe-author-width: ${vt}px`:void 0,"data-message-id":ge,onClick:F?Ye:void 0,onDoubleClick:F?void 0:Je,onMouseDown:F?void 0:ue,onContextMenu:F?void 0:me,onMouseEnter:Me&&!O?Aa:void 0,onMouseLeave:Me&&!O?xa:void 0},c.a.createElement("div",{ref:oe,className:"bottom-marker","data-message-id":ge,"data-last-message-id":n?n.messages[n.messages.length-1].id:void 0,"data-has-unread-mention":e.hasUnreadMention}),!Me&&c.a.createElement("div",{className:"message-select-control"},D&&c.a.createElement("i",{className:"icon-select"})),O&&c.a.createElement("div",{className:Object(Y.a)("message-select-control group-select",B&&"is-selected"),onClick:Ke},B&&c.a.createElement("i",{className:"icon-select"})),r&&function(){const e=$e&&Object(m.lb)($e.id),t=$e&&e?$e:void 0,a=$e&&!e?$e:void 0,s=!$e&&Ce?Ce.hiddenUserName:void 0;return c.a.createElement(Ut.a,{size:"small",user:t,chat:a,text:s,lastSyncTime:x,onClick:t||a?tt:void 0})}(),c.a.createElement("div",{className:"message-content-wrapper",onClick:F&&Me?Ye:void 0},c.a.createElement("div",{className:ze,style:ft},ze.includes("has-appendix")&&c.a.createElement("div",{className:"svg-appendix",ref:ie}),Ee&&!Ue&&(!Me||h)&&c.a.createElement("div",{className:"message-title"},Ot("ForwardedMessage")),function(){const t=Object(Y.a)("content-inner",Ee&&!Ue&&"forwarded-message",ve&&"reply-message"),r=u&&!qe&&!Ee&&!ye;return c.a.createElement("div",{className:t,onDoubleClick:et},function(){if(Ue||!(o&&!Ne&&!Pe||Ee||we||g)||Me&&!h)return;let t,a;We?(t=Object(m.U)(We),Ee||(a="color-"+Object(m.X)(We))):Ce&&Ce.hiddenUserName&&(t=Ce.hiddenUserName);return c.a.createElement("div",{className:"message-title"},t?c.a.createElement("span",{className:Object(Y.a)(We&&"interactive",a),onClick:We?at:void 0},Object(Ze.a)(t)):I?void 0:" ",I&&c.a.createElement(c.a.Fragment,null,c.a.createElement("span",{className:"via"},Ot("ViaBot")),c.a.createElement("span",{className:"interactive",onClick:st},Object(Ze.a)("@"+I.username))),Ce&&Ce.isLinkedChannelPost?c.a.createElement("span",{className:"admin-title"},Ot("DiscussChannel")):e.adminTitle&&!A?c.a.createElement("span",{className:"admin-title"},e.adminTitle):void 0)}(),ve&&c.a.createElement(_t,{message:C,sender:w,observeIntersection:a,onClick:nt}),Re&&c.a.createElement(Jt,{message:e,observeIntersection:a,observeIntersectionForPlaying:s,shouldLoop:z,lastSyncTime:x}),L&&c.a.createElement(Xt.a,{isInline:!0,sticker:L,observeIntersection:a,lastSyncTime:x}),Se&&c.a.createElement(Sa,{album:n,albumLayout:pt,observeIntersection:a,shouldAutoLoad:G,shouldAutoPlay:_,isOwn:pe,hasCustomAppendix:r,lastSyncTime:x,onMediaClick:ot}),!Se&&Ne&&c.a.createElement(na,{message:e,observeIntersection:a,shouldAutoLoad:G,uploadProgress:M,shouldAffectAppendix:r,onClick:ct,onCancelUpload:lt}),!Se&&Pe&&Pe.isRound&&c.a.createElement(Na,{message:e,observeIntersection:a,shouldAutoLoad:G,shouldAutoPlay:_,lastSyncTime:x}),!Se&&Pe&&!Pe.isRound&&c.a.createElement(da,{message:e,observeIntersection:a,shouldAutoLoad:G,shouldAutoPlay:_,uploadProgress:M,lastSyncTime:x,onClick:ct,onCancelUpload:lt}),(Te||Ae)&&c.a.createElement(Vt.a,{message:e,uploadProgress:M,lastSyncTime:x,isSelectable:Me,isSelected:D,onPlay:rt,onReadMedia:!Ae||pe&&!T?void 0:it,onCancelUpload:lt}),xe&&c.a.createElement(zt.a,{message:e,observeIntersection:a,uploadProgress:M,isSelectable:Me,isSelected:D,onCancelUpload:lt}),Le&&c.a.createElement(ua,{contact:Le}),Fe&&c.a.createElement(pa,{message:e,poll:Fe,onSendVote:dt}),!L&&qe&&c.a.createElement("p",{className:"text-content"},qe),De&&c.a.createElement(ya,{message:e,observeIntersection:a,shouldAutoLoad:G,onMediaClick:ct,onCancelMediaTransfer:lt}),Be&&c.a.createElement(Ca,{message:e}))}(),(!Me||O)&&c.a.createElement(Wt,{message:e,outgoingStatus:E,signature:Qe,onClick:Ye}),kt?c.a.createElement(ce.a,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Forward message",onClick:O?bt:ut},c.a.createElement("i",{className:"icon-share-filled"})):Nt?c.a.createElement(ce.a,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:q?mt:ht},c.a.createElement("i",{className:"icon-arrow-right"})):void 0,Pt&&c.a.createElement(Ta,{message:e,disabled:d})),e.inlineButtons&&c.a.createElement(Pa,{message:e,onClick:ne})),be&&c.a.createElement(qt,{isOpen:de,anchor:be,message:e,album:n,messageListType:H,onClose:he,onCloseAnimationEnd:Oe}))}));a(225);const Fa=h.b?1e3:350,Da=h.f?300:500,Ba=Object(g.a)(e=>e(),200,!1),Ua=Object(g.j)(e=>e());function Ha(e,t,a,s,r,o,i,l,b,u,h,O,j,g=!1){const f=c.a.createElement("div",{className:Object(Y.a)("unread-divider","local-action-message"),key:"unread-messages"},c.a.createElement("span",null,e("UnreadMessages"))),p=t.map((t,p,I)=>{const v=t.senderGroups.map((t,n,g)=>{if(1===t.length&&!ht(t[0])&&Object(m.db)(t[0])){const e=t[0];return Object(d.e)([e.id===l.current&&f,c.a.createElement(Gt,{key:e.id,message:e,observeIntersection:a})])}let v;return Object(d.h)(t.map((y,C)=>{const w=ht(y)?y.mainMessage:y,E=ht(y)?y:void 0,M=Object(m.tb)(w),S=ht(y),k=t[C+1];w.previousLocalId&&i.current==="message"+w.previousLocalId&&(i.current="message"+w.id);const N=!S&&w.groupedId?w.groupedId:void 0,P=k&&!ht(k)?k.groupedId:void 0,T={isFirstInGroup:0===C,isLastInGroup:C===t.length-1,isFirstInDocumentGroup:Boolean(N&&N!==v),isLastInDocumentGroup:Boolean(N&&N!==P),isLastInList:C===t.length-1&&n===g.length-1&&p===I.length-1};v=N;const A=w.id===l.current&&l.current!==O||w.id===h&&l.current===O,x=Object(m.F)(w),R="scheduled"!==u?x:`${w.date}_${x}`;return Object(d.e)([A&&f,c.a.createElement(La,{key:R,message:w,observeIntersectionForBottom:a,observeIntersectionForMedia:s,observeIntersectionForAnimatedStickers:r,album:E,withAvatar:T.isLastInGroup&&o&&!M&&!(w.id===h),withSenderName:T.isFirstInGroup&&o&&!M,threadId:b,messageListType:u,noComments:!1===j,isFirstInGroup:T.isFirstInGroup,isLastInGroup:T.isLastInGroup,isFirstInDocumentGroup:T.isFirstInDocumentGroup,isLastInDocumentGroup:T.isLastInDocumentGroup,isLastInList:T.isLastInList}),w.id===h&&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,teactFastList:!0},c.a.createElement("div",{className:"sticky-date",key:"date-header"},c.a.createElement("span",null,g&&t.originalDate===n.ab&&e("MessageScheduledUntilOnline"),g&&t.originalDate!==n.ab&&e("MessageScheduledOn",Object(x.c)(t.datetime,void 0,!0)),!g&&Object(x.c)(t.datetime))),Object(d.h)(v))});return Object(d.h)(p)}var qa=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,type:s})=>{const n=Object(o.f)(e,t);if(!n)return{};const c=Object(o.x)(e,t,a,s),r="scheduled"===s?Object(o.mb)(e,t):Object(o.m)(e,t),l=Object(o.Ab)(e,t,a);if(a!==i.MAIN_THREAD_ID&&!(r&&l&&r[l]))return{};const{isRestricted:d,restrictionReason:b,lastMessage:u}=n,h=Object(o.H)(e,t),O=a===i.MAIN_THREAD_ID&&!c&&!n.unreadCount&&!h&&u&&!u.groupedId;let j;if(Object(o.K)(e,t)){const a=Object(o.g)(e,t);j=a.fullInfo?a.fullInfo.botDescription||"NoMessages":"Updating bot info..."}return{isChatLoaded:!0,isRestricted:d,restrictionReason:b,isChannelChat:Object(m.jb)(n),canPost:Object(m.e)(n,a),isChatWithSelf:Object(o.O)(e,t),messageIds:c,messagesById:r,firstUnreadId:Object(o.G)(e,t,a),isViewportNewest:"thread"!==s||Object(o.W)(e,t,a),threadFirstMessageId:Object(o.F)(e,t,a),focusingId:h,isSelectModeActive:Object(o.R)(e),animationLevel:e.settings.byKey.animationLevel,...O&&{lastMessage:u},botDescription:j,threadTopMessageId:l,hasLinkedChat:n.fullInfo&&"linkedChatId"in n.fullInfo?Boolean(n.fullInfo.linkedChatId):void 0}},(e,t)=>Object(d.l)(t,["loadViewportMessages","markMessageListRead","markMessagesRead","setScrollOffset"]))(({chatId:e,threadId:t,type:a,hasTools:r,onFabToggle:i,isChatLoaded:b,isChannelChat:u,canPost:O,bottomOffset:j,isChatWithSelf:f,messageIds:p,messagesById:I,firstUnreadId:v,isViewportNewest:y,threadFirstMessageId:C,isRestricted:w,restrictionReason:E,focusingId:M,isSelectModeActive:S,animationLevel:k,loadViewportMessages:N,markMessageListRead:P,markMessagesRead:T,setScrollOffset:A,lastMessage:x,botDescription:R,threadTopMessageId:L,hasLinkedChat:F})=>{const D=Object(c.q)(null),B=Object(c.q)(),U=Object(c.q)(),H=Object(c.q)(),q=Object(c.q)(),G=Object(c.q)(),_=Object(c.q)(),z=Object(c.q)(),V=Object(c.q)(!1),[$,W]=Object(c.r)(),[Q,J]=Object(c.r)(Boolean(M));Object(he.a)(()=>{U.current=void 0,G.current=v,B.current="thread"===a&&Object(o.nb)(Object(s.e)(),e,t)||0},[Boolean(p)]),Object(he.a)(()=>{_.current=v},[v]);const{observe:X,freeze:Z,unfreeze:ee}=Object(jt.a)({rootRef:D,throttleMs:Fa,margin:Da}),{observe:te,freeze:se,unfreeze:ne}=Object(jt.a)({rootRef:D},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,r=Number(c.lastMessageId||c.messageId);r>t&&(t=r),c.hasUnreadMention&&s.push(r)}),_.current&&t>=_.current&&P({maxId:t}),s.length&&T({messageIds:s})});Object(he.a)(()=>{z.current=M,M?(Z(),se()):(ne(),ee())},[M]);const{observe:ce}=Object(jt.a)({rootRef:D,throttleMs:Fa});Object(c.n)(()=>{M?J(!0):setTimeout(()=>{J(!1)},200)},[M]);const re=Object(c.p)(()=>{if(!p||!I)return;const e=!L||p[0]&&C!==p[0]?p:[L,...p];if(!e.length)return;const t=e.map(e=>I[e]);return Ot(Object(d.k)(t,["date","id"]),G.current)},[p,I,C,L]),[oe,ie,le]=Object(c.p)(()=>"thread"===a?[Object(g.a)(()=>N({direction:l.e.Backwards}),1e3,!0,!1),Object(g.a)(()=>N({direction:l.e.Forwards}),1e3,!0,!1),Object(g.a)(()=>N({direction:l.e.Around}),1e3,!0,!1)]:[],[N,p]),{isScrolled:de,updateStickyDates:be}=gt(),ue=Object(c.m)(()=>{if(V.current)return void(V.current=!1);const s=D.current;z.current||be(s,r),Ba(()=>{Object(g.b)(()=>{s.parentElement&&(B.current=s.scrollHeight-s.scrollTop,"thread"===a&&A({chatId:e,threadId:t,scrollOffset:B.current}))})})},[be,r,a,A,e,t]);Object(c.n)(()=>{if(!("ResizeObserver"in window))return;const e=new ResizeObserver(([e])=>{e.target.offsetParent&&W(e.contentRect.height)});return e.observe(D.current),()=>{e.disconnect()}},[]),Object(c.o)(()=>{h.d&&Ua(()=>{if(!D.current.querySelector(".AnimatedSticker.is-playing"))return;const e=D.current.style;e.webkitOverflowScrolling="auto"===e.webkitOverflowScrolling?"":"auto"})}),Object(c.n)(()=>{if(!le||!b||w||M)return;const e=D.current;(!p||p.length<n.N/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&le()},[b,p,le,M,w]),Object(mt.a)(([e,t,a])=>{const s=D.current;if(q.current=Array.from(s.querySelectorAll(".message-list-item")),!s.offsetParent)return;const c=y&&p&&p.length<n.N/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:o,scrollHeight:i,offsetHeight:l}=s,d=B.current,b=q.current[q.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];if(m&&j&&!O&&(b&&Object(g.b)(()=>{Object(pt.a)(s,b,"end",20)}),h=i-l,B.current=Math.max(i-h,l),!c))return;const f=void 0!==a&&a!==$,I=U.current&&s.querySelector("#"+U.current),v=!I&&G.current&&s.querySelector(".unread-divider");if(m&&f)h=i-l;else if(I){h=o+(I.getBoundingClientRect().top-(H.current||0))}else h=v?v.offsetTop-(r?60:10):i-d;Object(ft.a)(s,h),z.current||(V.current=!0,Object(g.b)(()=>{V.current=!1})),B.current=Math.max(i-h,l)},[p,y,$,r]),Object(c.n)(()=>{(!k||k>0)&&Object(K.b)(200+n.c)},[k,S]);const me=Object(ae.a)(),Oe=Boolean(e&&Object(m.lb)(e)),je=Boolean(!Oe&&!u||f),ge=Object(Y.a)("MessageList custom-scroll",!je&&"no-avatars",u&&"no-avatars",(!O||"none"!==j)&&"bottom-padding","none"!==j&&"bottom-padding-"+j,S&&"select-mode-active",Q&&"has-focusing",de&&"scrolled");return c.a.createElement("div",{ref:D,className:ge,onScroll:ue},w?c.a.createElement("div",{className:"empty"},c.a.createElement("span",null,E?E.text:"This is a private "+(u?"channel":"chat"))):R?c.a.createElement("div",{className:"empty rich"},c.a.createElement("span",null,Object(Ze.a)(me(R),["br","emoji","links"]))):p&&re?c.a.createElement(vt,{containerRef:D,className:"messages-container",messageIds:p,containerHeight:$,listItemElementsRef:q,focusingId:M,anchorIdRef:U,anchorTopRef:H,loadMoreForwards:ie,loadMoreBackwards:oe,isViewportNewest:y,firstUnreadId:v,onFabToggle:i},re&&Ha(me,re,te,X,ce,je,U,G,t,a,L,C,F,"scheduled"===a)):p?c.a.createElement("div",{className:"empty"},c.a.createElement("span",null,me("NoMessages"))):x?c.a.createElement("div",{className:"messages-container"},Ha(me,Ot([x]),te,X,ce,je,U,G,t,a,L,C,F,!1)):c.a.createElement(ye.a,{color:"white"}))}));a(226);var Ga=Object(c.h)(Object(s.h)(e=>{const t=Object(o.y)(e);if(!t)return{};const{chatId:a,threadId:s,type:n}=t,c=Object(o.f)(e,a);return{messageListType:n,canPost:c&&Object(m.e)(c,s),unreadCount:c&&s===i.MAIN_THREAD_ID&&"thread"===n?c.unreadCount:void 0}},(e,t)=>Object(d.l)(t,["focusLastMessage"]))(({isShown:e,messageListType:t,canPost:a,unreadCount:s,focusLastMessage:n})=>{const r=Object(c.q)(null),o=Object(c.m)(()=>{if(e)if("thread"===t)n();else{const e=r.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),a=t[t.length-1];if(!a)return;Object(pt.a)(e,a,"end",20)}},[e,t,n]),i=Object(Y.a)("ScrollDownButton",e&&"revealed",!a&&"no-composer");return c.a.createElement("div",{ref:r,className:i},c.a.createElement("div",{className:"ScrollDownButton-inner"},c.a.createElement(ce.a,{color:"secondary",round:!0,onClick:o,ariaLabel:"Scroll to bottom"},c.a.createElement("i",{className:"icon-arrow-down"})),Boolean(s)&&c.a.createElement("div",{className:"unread-count"},Object(We.b)(s))))})),_a=a(122),za=a(123),Va=a(14);async function $a(e,t,a,s){const n=URL.createObjectURL(t),{type:c,size:r}=t;let o,i;if(c.startsWith("image/"))if(a){const a=await Object(Va.g)(n),{width:r,height:i}=a;if(r>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),$a(e,c,!0,s)):$a(e,t,!1,s)}o={width:r,height:i}}else i=n;else if(c.startsWith("video/")){if(r<10485760){const{videoWidth:e,videoHeight:t,duration:a}=await Object(Va.h)(n);o={width:e,height:t,duration:a}}i=await Object(Va.c)(n)}return{blobUrl:n,filename:e,mimeType:c,size:r,quick:o,previewBlobUrl:i,...s}}var Wa=a(171),Qa=a.p+"8ccc0b555efcec3616377aea078dda16.js";const Ka={encoderPath:Qa,reuseWorker:!0},Ya={type:"audio/ogg"};let Ja,Xa,Za;async function es(){return Ja||(Ja=a.e(10).then(a.t.bind(null,304,7)),Xa=(await Ja).default,Za=new Xa(Ka)),Ja}async function ts(e){await async function(){await es(),await Za.start()}();const t=Date.now();let a;const s=[],n=[];Za.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 r=!1;return function e(){if(r)return;s.getByteFrequencyData(c);const a=c.reduce((e,t)=>e+t,0),o=a/n/255;t(o<.1?0:o),requestAnimationFrame(e)}(),()=>{r=!0}}(Za,t=>{n.push(255*t),e(t)});return{stop:()=>new Promise((e,r)=>{Za.onstop=()=>{e({blob:new Blob(s,Ya),duration:Math.round(((a||Date.now())-t)/1e3),waveform:n})},Za.onerror=r;const o=Math.max(0,t+1e3-Date.now());setTimeout(()=>{Za.stop(),c()},o)}),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout(()=>{Za.pause(),a=Date.now(),c()},e)}}}const as=["image/png","image/jpeg","image/gif"];function ss(e){const{text:t,entities:a}=e||{};if(!t)return"";const s=Object(Ct.b)(t,a,void 0,void 0,!0);return Array.isArray(s)?s.join(""):s}let ns,cs;var rs=a(58);var os=a(179);var is=e=>{const{isOpen:t}=e,a=Object(ve.a)(Ie.a.Extra,"DeleteMessageModal",!t);return a?c.a.createElement(a,e):void 0};function ls(){return(ls=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 ds,bs=!0;var us=Object(c.h)(({onActivate:e,...t})=>{const a=Object(c.q)(!1),s=Object(c.m)(()=>{if(a.current=!0,bs)return bs=!1,void e();ds&&(clearTimeout(ds),ds=void 0),ds=window.setTimeout(()=>{a.current&&e()},200)},[e]),n=Object(c.m)(()=>{a.current=!1},[]);return c.a.createElement(ce.a,ls({},t,{onMouseEnter:h.k?void 0:s,onMouseLeave:h.k?void 0:n,onClick:h.k?e:void 0}))});var ms=e=>{const{isOpen:t}=e,a=Object(ve.a)(Ie.a.Extra,"AttachMenu",!t);return a?c.a.createElement(a,e):void 0};var hs=e=>{const{isOpen:t}=e,a=Object(ve.a)(Ie.a.Extra,"SymbolMenu",!t);return a?c.a.createElement(a,e):void 0};var Os=e=>{const{isOpen:t}=e,a=Object(ve.a)(Ie.a.Extra,"MentionMenu",!t);return a?c.a.createElement(a,e):void 0};var js=e=>{const{isOpen:t}=e,a=Object(ve.a)(Ie.a.Extra,"CustomSendMenu",!t);return a?c.a.createElement(a,e):void 0};var gs=e=>{const{isOpen:t}=e,a=Object(ve.a)(Ie.a.Extra,"EmojiTooltip",!t);return a?c.a.createElement(a,e):void 0};var fs=e=>{const{isOpen:t}=e,a=Object(ve.a)(Ie.a.Extra,"BotKeyboardMenu",!t);return a?c.a.createElement(a,e):void 0},ps=a(172),Is=a(109);a(228);var vs=Object(c.h)(Object(s.h)(e=>{const{chatId:t,threadId:a,type:s}=Object(o.y)(e)||{};if(!t||!a||!s)return{};const{currentUserId:n,forwardMessages:{fromChatId:c,toChatId:r,messageIds:i}}=e,l=Object(o.ib)(e,t,a),d="scheduled"===s?Object(o.E)(e,t):Object(o.C)(e,t,a),b=e.settings.byKey.animationLevel>=1,u=r===t;let h,O;if(l?h=Object(o.k)(e,t,l):d?h=Object(o.D)(e,t,a,s):u&&1===i.length&&(h=Object(o.k)(e,c,i[0])),l&&h){const{forwardInfo:a}=h,s=t===n;a&&(a.isChannelPost||s)&&(O=Object(o.J)(e,h)),O||(O=Object(o.pb)(e,h))}else u&&(O=Object(m.lb)(c)?Object(o.Cb)(e,c):Object(o.f)(e,c));return{replyingToId:l,editingId:d,message:h,sender:O,shouldAnimate:b,forwardedMessagesCount:u?i.length:void 0}},(e,t)=>Object(d.l)(t,["setReplyingToId","setEditingId","focusMessage","exitForwardMode"]))(({replyingToId:e,editingId:t,message:a,sender:s,shouldAnimate:n,forwardedMessagesCount:r,setReplyingToId:o,setEditingId:i,focusMessage:l,exitForwardMode:d})=>{const b=Boolean((e||t)&&a||s&&r),u=Object(Is.a)([r],r?300:void 0),{shouldRender:m,transitionClassNames:h}=Object(J.a)(u&&b,void 0,!n,void 0,!n),O=Object(c.m)(()=>{e?o({messageId:void 0}):t?i({messageId:void 0}):r&&d()},[e,t,r,o,i,d]);Object(c.n)(()=>b?Object(Z.a)(O):void 0,[b,O]);const j=Object(c.m)(()=>{l({chatId:a.chatId,messageId:a.id})},[l,a]),g=Object(Y.a)("ComposerEmbeddedMessage",h),f=r&&r>1?r+" forwarded messages":void 0;if(m)return c.a.createElement("div",{className:g},c.a.createElement("div",null,c.a.createElement(ce.a,{round:!0,color:"translucent",ariaLabel:"Cancel replying",onClick:O},c.a.createElement("i",{className:"icon-close"})),c.a.createElement(_t,{className:"inside-input",message:a,sender:s,customText:f,title:t?"Edit Message":void 0,onClick:j})))}));var ys=e=>{const{attachments:t}=e,a=Object(ve.a)(Ie.a.Extra,"AttachmentModal",!t.length);return a?c.a.createElement(a,e):void 0};var Cs=e=>{const{isOpen:t}=e,a=Object(ve.a)(Ie.a.Extra,"PollModal",!t);return a?c.a.createElement(a,e):void 0};var ws=e=>{const{isOpen:t}=e,a=Object(ve.a)(Ie.a.Extra,"DropArea",!t);return a?c.a.createElement(a,e):void 0};a(229);const Es=/https?:\/\/(www.)?([a-zA-Z0-9.-]{2,256})([a-zA-Z/.-]{1,256})([?|#][=&#a-zA-Z0-9]{2,128})?/;var Ms=Object(c.h)(Object(s.h)(e=>Object(d.l)(e,["webPagePreview"]),(e,t)=>Object(d.l)(t,["loadWebPagePreview","clearWebPagePreview"]))(({chatId:e,messageText:t,webPagePreview:a,loadWebPagePreview:s,clearWebPagePreview:n})=>{const r=Object(c.p)(()=>{const{text:e,entities:a}=Object(za.a)(t),s=a&&a.find(({type:e})=>e===i.ApiMessageEntityTypes.TextUrl);if(s)return s.url;const n=e.match(Es);return n?n[0]:void 0},[t]);if(Object(c.n)(()=>{r?s({text:r}):n()},[n,r,s]),Object(he.a)(()=>{n()},[e]),!a||!t.length)return;const{photo:o,...l}=a,d={content:{webPage:l}};return c.a.createElement("div",{className:"WebPagePreview"},c.a.createElement(ya,{message:d,inPreview:!0}))})),Ss=a(114);var ks=e=>{const{isOpen:t}=e,a=Object(ve.a)(Ie.a.Extra,"CalendarModal",!t);return a?c.a.createElement(a,e):void 0};var Ns=e=>{const{isOpen:t}=e,a=Object(ve.a)(Ie.a.Extra,"PaymentModal",!t);return a?c.a.createElement(a,e):void 0};var Ps,Ts=e=>{const{isOpen:t}=e,a=Object(ve.a)(Ie.a.Extra,"ReceiptModal",!t);return a?c.a.createElement(a,e):void 0};a(230);!function(e){e.Send="send",e.Record="record",e.Edit="edit"}(Ps||(Ps={}));var As=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const n=Object(o.f)(e,t),c=n&&Object(o.o)(e,n),r=n?Object(o.N)(e,n):void 0,l=Object(o.O)(e,t),d=r&&Object(o.ab)(e,t),b=Object(o.kb)(e,t);return{editingMessage:Object(o.D)(e,t,a,s),connectionState:e.connectionState,draft:Object(o.B)(e,t,a),chat:n,isChatWithBot:r,isChatWithSelf:l,canScheduleUntilOnline:!l&&!r&&n&&c&&Object(m.lb)(t)&&c.status&&Boolean(c.status.wasOnline),isRightColumnShown:Object(o.V)(e),isSelectModeActive:Object(o.R)(e),withScheduledButton:a===i.MAIN_THREAD_ID&&"thread"===s&&Boolean(b&&b.length),shouldSchedule:"scheduled"===s,botKeyboardMessageId:d?d.id:void 0,isForwarding:t===e.forwardMessages.toChatId,canSuggestMembers:n&&Object(m.kb)(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}},(e,t)=>Object(d.l)(t,["sendMessage","editMessage","saveDraft","clearDraft","showError","setStickerSearchQuery","setGifSearchQuery","forwardMessages","openPollModal","closePollModal","closePaymentModal","clearReceipt","loadScheduledHistory","openChat"]))(({dropAreaState:e,shouldSchedule:t,canScheduleUntilOnline:a,onDropHide:r,editingMessage:o,chatId:l,threadId:d,messageListType:b,draft:u,chat:O,connectionState:j,isChatWithBot:f,isChatWithSelf:p,isRightColumnShown:I,isSelectModeActive:v,isForwarding:y,canSuggestMembers:C,isPollModalOpen:w,isPaymentModalOpen:E,isReceiptModalOpen:M,botKeyboardMessageId:S,withScheduledButton:k,stickersForEmoji:N,groupChatMembers:P,currentUserId:T,usersById:A,lastSyncTime:R,contentToBeScheduled:L,shouldSuggestStickers:F,sendMessage:D,editMessage:B,saveDraft:U,clearDraft:H,showError:q,setStickerSearchQuery:G,setGifSearchQuery:_,forwardMessages:z,openPollModal:V,closePollModal:$,loadScheduledHistory:W,closePaymentModal:Q,openChat:K,clearReceipt:J})=>{const X=Object(c.q)(null),[ee,te]=Object(c.r)(""),se=Object(c.q)(),ne=Object(qe.a)(e),[re,oe,ie]=Object(ct.a)(),[le,de]=Object(c.r)(),ue=Object(c.q)(ee);Object(c.n)(()=>{ue.current=ee},[ee]),Object(c.n)(()=>{se.current=void 0},[l]),Object(c.n)(()=>{l&&R&&d===i.MAIN_THREAD_ID&&W()},[l,W,R,d]),Object(c.n)(()=>{X.current&&(X.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)(()=>{L&&(de(L),oe())},[L,oe]);const[me,he]=Object(c.r)([]),[Oe,je,ge]=Object(ct.a)(),[fe,pe,Ie]=Object(ct.a)(),[ve,ye,Ce]=Object(ct.a)(),[we,Ee,Me]=Object(ct.a)(),[Se,ke]=Object(ct.a)(),[Ne,Pe,Te]=Object(ct.a)(),{startRecordingVoice:Ae,stopRecordingVoice:xe,pauseRecordingVoice:Re,activeVoiceRecording:Le,currentRecordTime:Fe,recordButtonRef:Be,startRecordTimeRef:Ue}=(()=>{const e=Object(c.q)(null),[t,a]=Object(c.r)(),s=Object(c.q)(),[n,r]=Object(c.r)();Object(c.n)(()=>{h.d&&es()},[]);const o=Object(c.m)(async()=>{try{const{stop:t,pause:n}=await ts(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)`),r(Date.now()))});s.current=Date.now(),r(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,r(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(Z.a)(l):void 0,[t,l]),{startRecordingVoice:o,pauseRecordingVoice:i,stopRecordingVoice:l,activeVoiceRecording:t,currentRecordTime:n,recordButtonRef:e,startRecordTimeRef:s}})(),He=o?Ps.Edit:!h.l||Le||ee&&!me.length||y?Ps.Send:Ps.Record,Ge=!t,{isMentionMenuOpen:_e,mentionFilter:ze,closeMentionMenu:Ve,insertMention:$e,mentionFilteredMembers:We}=Object(os.a)(C&&!me.length,ee,te,void 0,P,T,A),{isContextMenuOpen:Qe,handleContextMenu:Ke,handleContextMenuClose:Ye,handleContextMenuHide:Je}=Object(yt.a)(Be,!(He===Ps.Send&&Ge)),Xe=Object(c.p)(()=>Object(m.c)(O,f),[O,f]),et=O&&Object(m.gb)(O),tt=Object(m.k)(O),{isEmojiTooltipOpen:at,closeEmojiTooltip:st}=function(e,t,a){const{loadStickersForEmoji:n,clearStickersForEmoji:r}=Object(s.d)(),o=h.c&&1===Object(rs.a)(t)||!h.c&&Boolean(t.match(/^<img.[^>]*?>$/g)),i=Boolean(a)&&o;return Object(c.n)(()=>{e&&o?n({emoji:t}):!i&&o||r()},[t,o,r,n,e]),{isEmojiTooltipOpen:i,closeEmojiTooltip:r}}(Boolean(F&&Xe.canSendStickers&&!me.length),ee,N),nt=Object(c.m)(e=>{const t=window.getSelection(),a=document.getElementById(n.r),s=Object(Ze.a)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");if(t.rangeCount){const n=t.getRangeAt(0);if(Object(Wa.a)(n))return void(h.c?document.execCommand("insertText",!1,e):(!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))}}(s),a.dispatchEvent(new Event("input",{bubbles:!0}))));te(`${ue.current}${s}`),h.f||requestAnimationFrame(()=>{Object(_a.a)(a)})}else te(`${ue.current}${s}`)},[]),rt=Object(c.m)(()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if(Object(Wa.a)(t))return void document.execCommand("delete",!1)}te(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 r=t.innerHTML;return document.body.removeChild(t),r}(ue.current))},[]),ot=Object(c.m)(()=>{te(""),he([]),st(),ie(),de(void 0),Ve(),h.f?setTimeout(()=>Ce(),350):Ce()},[st,ie,Ve,Ce]),it=Object(qe.a)(l);Object(c.n)(()=>{it&&l!==it&&(xe(),ot())},[l,it,ot,xe]);const lt=((e,t,a,s,r,o)=>{Object(c.n)(()=>{a?(t(ss(a.content.text)),requestAnimationFrame(()=>{const e=document.getElementById(n.r);Object(_a.a)(e,!0)})):t("")},[a,t]);return Object(c.m)(()=>{const{text:t,entities:n}=Object(za.a)(e.current);a&&(t||Object(m.cb)(a)?(o({messageId:a.id,text:t,entities:n}),s()):r())},[o,a,e,r,s])})(ue,te,o,ot,Ee,B);((e,t,a,s,r,o,i,l,d)=>{const b=Object(c.m)((e,t)=>{r.current.length&&!i?l({chatId:e,threadId:t,draft:Object(za.a)(r.current)}):d({chatId:e,threadId:t})},[d,i,r,l]),u=Object(c.p)(()=>Object(g.a)(e=>e(),n.q,!1),[t]),m=Object(qe.a)(t),h=Object(qe.a)(a);Object(c.n)(()=>(ns=t,cs=a,()=>{ns=void 0,cs=void 0,b(t,a)}),[t,a,b]),Object(c.n)(()=>{t===m&&a===h||e&&(o(ss(e)),requestAnimationFrame(()=>{const e=document.getElementById(n.r);Object(_a.a)(e,!0)}))},[t,a,e,o,b,m,h]);const O=Object(qe.a)(s);Object(c.n)(()=>{t&&a&&m===t&&h===a&&O!==s&&(s.length?u(()=>{ns===t&&cs===a&&b(t,a)}):b(t,a))},[t,s,m,O,h,u,a,b]),Object(c.n)(()=>{function e(){t&&a&&b(t,a)}return window.addEventListener("blur",e),()=>{window.removeEventListener("blur",e)}},[t,a,b])})(u,l,d,ee,ue,te,o,U,H),((e,t,a)=>{Object(c.n)(()=>{async function s(s){if(!s.clipboardData)return;const c=document.activeElement;if(!c||![n.r,n.s].includes(c.id))return;const{items:r}=s.clipboardData,o=Array.from(r).find(e=>as.includes(e.type)),i=o&&o.getAsFile(),l=s.clipboardData.getData("text").substring(0,4096);if(i||l){if(s.preventDefault(),i&&!a){const e=await $a(i.name,i,!0);t(t=>[...t,e])}l&&e(l)}}return document.addEventListener("paste",s,!1),()=>{document.removeEventListener("paste",s,!1)}},[e,a,t])})(nt,he,o);const dt=Object(c.m)(async(e,t)=>{he(await Promise.all(e.map(e=>$a(e.name,e,t))))},[]),bt=Object(c.m)(()=>{he([])},[]),ut=Object(c.m)(async(e=!1,t)=>{if("connectionStateReady"!==j)return;let a=me;if(Le){const e=await xe();if(e){const{blob:t,duration:s,waveform:n}=e;a=[await $a("wonderful-voice-message.ogg",t,!1,{voice:{duration:s,waveform:n}})]}}const{text:s,entities:c}=Object(za.a)(ue.current);if(a.length||s||y)if(a.length&&s&&s.length>1024){const e=s.length-1024;q({error:{message:"CAPTION_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":e,"{PLURAL_S}":e>1?"s":""}}})}else{if(a.length||s){if(tt&&!et){const e=Math.floor(Date.now()/1e3),t=se.current&&Math.floor(e-se.current),a=tt.nextSendDate&&tt.nextSendDate>e;if(t&&t<tt.seconds||a){const s=a?tt.nextSendDate-e:tt.seconds-t;q({error:{message:`A wait of ${s} seconds is required before sending another message in this chat`,isSlowMode:!0}});return void document.getElementById(n.r).blur()}}D({text:s,entities:c,attachments:a,scheduledAt:t,isSilent:e})}y&&z(),se.current=Math.floor(Date.now()/1e3),H({chatId:l,localOnly:!0}),requestAnimationFrame(ot)}},[Le,me,j,l,tt,y,et,D,xe,ot,H,q,z]),mt=Object(c.m)(e=>{e={...e,isPreloadedGlobally:!0},t?(de({sticker:e}),oe()):(D({sticker:e}),requestAnimationFrame(ot))},[t,oe,D,ot]),ht=Object(c.m)(e=>{t?(de({gif:e}),oe()):(D({gif:e}),requestAnimationFrame(ot))},[t,oe,D,ot]),Ot=Object(c.m)(e=>{t?(de({poll:e}),$(),oe()):(D({poll:e}),$())},[$,oe,D,t]),jt=Object(c.m)(()=>{t?(de({isSilent:!0}),oe()):ut(!0)},[ut,oe,t]),gt=Object(c.m)(e=>{const{isSilent:t,...a}=le||{},s=Math.round(Math.max(e.getTime(),Date.now()+6e4)/1e3);le&&0!==Object.keys(a).length?(D({...le,scheduledAt:s}),requestAnimationFrame(ot)):ut(!!t,s),ie()},[ie,ut,ot,le,D]),ft=Object(c.m)(()=>{gt(new Date(1e3*n.ab))},[gt]),pt=Object(c.m)(()=>{ie(),de(void 0)},[ie]),It=Object(c.m)(e=>{"stickers"===e?(G({query:""}),_({query:void 0})):(_({query:""}),G({query:void 0}))},[G,_]),vt=Object(c.m)(()=>{const e=document.getElementById(n.r);h.f&&e===document.activeElement?(e.blur(),setTimeout(()=>{ye()},100)):ye()},[ye]),Ct=Object(c.m)(()=>{K({id:l,threadId:d,type:"scheduled"})},[K,l,d]);Object(c.n)(()=>{I&&h.f&&Ce()},[I,Ce]),Object(c.n)(()=>{v?Pe():setTimeout(()=>{Te()},200)},[v,Te,Pe]);const wt=Object(c.m)(()=>{switch(He){case Ps.Send:t?(Le&&Re(),oe()):(ut(),requestAnimationFrame(ot));break;case Ps.Record:Ae();break;case Ps.Edit:lt()}},[He,ot,t,Ae,lt,Le,oe,Re,ut]),Et=Object(ae.a)(),Mt=He===Ps.Record&&!Xe.canAttachMedia,St=Object(qe.a)(o,!0),kt=o||St,Nt=new Date;Nt.setSeconds(0),Nt.setMilliseconds(0);const Pt=new Date;Pt.setFullYear(Pt.getFullYear()+1);let Tt="Send message";switch(He){case Ps.Edit:Tt="Save edited message";break;case Ps.Record:Tt=Mt?"Posting media content is not allowed in this group.":"Record a voice message"}const At=Object(Y.a)("Composer",!v&&"shown",Ne&&"hover-disabled"),xt=Object(Y.a)("mobile-symbol-menu-button",Se?ve&&"menu-opened":ve&&"is-loading");return c.a.createElement("div",{className:At},Xe.canAttachMedia&&c.a.createElement(Ss.a,{containerId:"#middle-column-portals"},c.a.createElement(ws,{isOpen:e!==De.a.None,withQuick:[e,ne].includes(De.a.QuickFile),onHide:r,onFileSelect:dt})),c.a.createElement(ys,{attachments:me,caption:me.length?ee:"",canSuggestMembers:C,groupChatMembers:P,currentUserId:T,usersById:A,onCaptionUpdate:te,onSend:t?oe:ut,onClear:bt}),c.a.createElement(Cs,{isOpen:Boolean(w),onClear:$,onSend:Ot}),c.a.createElement(Ns,{isOpen:Boolean(E),onClose:Q}),c.a.createElement(Ts,{isOpen:Boolean(M),onClose:J}),kt&&c.a.createElement(is,{isOpen:we,isSchedule:"scheduled"===b,onClose:Me,message:kt}),c.a.createElement(Os,{isOpen:_e,filter:ze,onClose:Ve,onInsertUserName:$e,filteredChatMembers:We,usersById:A}),c.a.createElement("div",{id:"message-compose"},c.a.createElement("div",{className:"svg-appendix",ref:X}),c.a.createElement(vs,null),Xe.canAttachEmbedLinks&&c.a.createElement(Ms,{chatId:l,messageText:me.length?"":ee}),c.a.createElement("div",{className:"message-input-wrapper"},h.f?c.a.createElement(ce.a,{className:xt,round:!0,color:"translucent",onClick:ve?Ce:vt,ariaLabel:"Choose emoji, sticker or GIF"},c.a.createElement("i",{className:"icon-smile"}),c.a.createElement("i",{className:"icon-keyboard"}),c.a.createElement(be.a,{color:"gray"})):c.a.createElement(us,{className:""+(ve?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:ye,ariaLabel:"Choose emoji, sticker or GIF"},c.a.createElement("i",{className:"icon-smile"})),c.a.createElement(ps.a,{id:"message-input-text",html:me.length?"":ee,placeholder:Le&&window.innerWidth<=600?"":Et("Message"),shouldSetFocus:ve,shouldSupressFocus:h.f&&ve,onUpdate:te,onSend:He===Ps.Edit?lt:t?oe:ut,onSupressedFocus:Ce}),k&&c.a.createElement(ce.a,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:Ct,ariaLabel:"Open scheduled messages"},c.a.createElement("i",{className:"icon-schedule"})),S&&!Le&&!o&&c.a.createElement(us,{className:""+(Oe?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:je,ariaLabel:"Open bot command keyboard"},c.a.createElement("i",{className:"icon-bot-command"})),!Le&&!o&&c.a.createElement(us,{className:""+(fe?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:pe,ariaLabel:"Add an attachment"},c.a.createElement("i",{className:"icon-attach"})),Le&&Fe&&c.a.createElement("span",{className:"recording-state"},Object(x.i)(Fe-Ue.current)),c.a.createElement(gs,{isOpen:at,onStickerSelect:mt}),c.a.createElement(ms,{isOpen:fe,allowedAttachmentOptions:Xe,onFileSelect:dt,onPollCreate:V,onClose:Ie}),S&&c.a.createElement(fs,{messageId:S,isOpen:Oe,onClose:ge}),c.a.createElement(hs,{isOpen:ve,allowedAttachmentOptions:Xe,onLoad:ke,onClose:Ce,onEmojiSelect:nt,onStickerSelect:mt,onGifSelect:ht,onRemoveSymbol:rt,onSearchOpen:It}))),Le&&c.a.createElement(ce.a,{round:!0,color:"danger",className:"cancel",onClick:xe,ariaLabel:"Cancel voice recording"},c.a.createElement("i",{className:"icon-delete"})),c.a.createElement(ce.a,{ref:Be,round:!0,color:"secondary",className:`${He} ${Le?"recording":""}`,disabled:Mt,ariaLabel:Tt,onClick:wt,onContextMenu:He===Ps.Send&&Ge?Ke:void 0},c.a.createElement("i",{className:"icon-send"}),c.a.createElement("i",{className:"icon-microphone-alt"}),c.a.createElement("i",{className:"icon-check"})),Ge&&c.a.createElement(js,{isOpen:Qe,onSilentSend:p?void 0:jt,onScheduleSend:t?void 0:oe,onClose:Ye,onCloseAnimationEnd:Je}),c.a.createElement(ks,{isOpen:re,withTimePicker:!0,selectedAt:Nt.getTime(),maxAt:Object(x.k)(Pt),isFutureMode:!0,secondButtonLabel:a?"Send When Online":void 0,onClose:pt,onSubmit:gt,onSecondButtonClick:a?ft:void 0}))}));var xs=e=>{const{isActive:t}=e,a=Object(ve.a)(Ie.a.Extra,"MobileSearch",!t,!0);return a?c.a.createElement(a,e):void 0};var Rs=e=>{const{isActive:t}=e,a=Object(ve.a)(Ie.a.Extra,"MessageSelectToolbar",!t);return a?c.a.createElement(a,e):void 0};var Ls=e=>{const{isOpen:t}=e,a=Object(ve.a)(Ie.a.Extra,"UnpinAllMessagesModal",!t);return a?c.a.createElement(a,e):void 0};a(231);const Fs=h.f?450+n.c:void 0;function Ds(e){return"file"===e.kind&&e.type&&n.k.includes(e.type)}var Bs=Object(c.h)(Object(s.h)(e=>{const{isBackgroundBlurred:t,customBackground:a}=e.settings.byKey,s=Boolean((a||"").match(/^#[a-f\d]{6,8}$/i)),n=Object(o.y)(e),{chats:{listIds:c}}=e;if(!n||!c.active)return{customBackground:a,isBackgroundBlurred:t,isCustomBackgroundColor:s};const{chatId:r,threadId:i,type:l}=n,d=Object(o.f)(e,r),b=Object(o.fb)(e,r),{chatId:u,messageId:O}=e.audioPlayer,j=d&&Object(m.e)(d,i),g=Object(o.K)(e,r),f="pinned"===l;return{chatId:r,threadId:i,messageListType:l,isPrivate:Object(m.lb)(r),canPost:!f&&(!d||j)&&(!g||h.f),isPinnedMessageList:f,messageSendingRestrictionReason:d&&Object(m.J)(d),hasPinnedOrAudioMessage:Boolean(b&&b.length)||Boolean(u&&O),customBackground:a,isCustomBackgroundColor:s,isRightColumnShown:Object(o.V)(e),isBackgroundBlurred:t,isMobileSearchActive:Boolean(h.f&&Object(o.A)(e)),isSelectModeActive:Object(o.R)(e),animationLevel:e.settings.byKey.animationLevel}},(e,t)=>Object(d.l)(t,["openChat","unpinAllMessages","loadUser"]))(({chatId:e,threadId:t,messageListType:a,isPrivate:s,isPinnedMessageList:r,canPost:o,messageSendingRestrictionReason:l,hasPinnedOrAudioMessage:d,customBackground:b,isCustomBackgroundColor:u,isRightColumnShown:m,isBackgroundBlurred:O,isMobileSearchActive:j,isSelectModeActive:g,animationLevel:f,openChat:p,unpinAllMessages:I,loadUser:v})=>{const{width:y}=He(),[C,w]=Object(c.r)(De.a.None),[E,M]=Object(c.r)(!1),[S,k]=Object(c.r)(!1),N=Ge(e,Fs),P=Ge(t,Fs),T=Ge(a,Fs),A=Ge(o,Fs);Object(c.n)(()=>e?Object(Z.a)(()=>{p({id:void 0})}):void 0,[e,p]),Object(c.n)(()=>{w(De.a.None)},[e]),Object(c.n)(()=>{s&&v({userId:e})},[e,s,v]);const x=Object(c.m)(e=>{if(h.k)return;const{items:t}=e.dataTransfer||{},a=t&&Array.from(t).every(Ds);w(a?De.a.QuickFile:De.a.Document)},[]),R=Object(c.m)(()=>{w(De.a.None)},[]),L=Object(c.m)(()=>{k(!0)},[]),F=Object(c.m)(()=>{k(!1)},[]),D=Object(c.m)(()=>{I({chatId:e}),F(),p({id:e})},[I,p,F,e]),B=(e=>{const[t,a]=Object(c.r)(e);return Object(c.n)(()=>{e&&(e.startsWith("#")?a(e):Be.c(n.l,n.l,Be.a.Blob).then(e=>{a("url("+URL.createObjectURL(e))}))},[e]),t})(b),U=d&&(y<n.V||m&&y>n.S&&y<n.Z||y>=n.R&&y<n.Y),H=Object(Y.a)(U&&"has-header-tools",b&&!u&&"custom-bg-image",b&&u&&"custom-bg-color",b&&O&&"blurred",h.m?"mask-image-enabled":"mask-image-disabled"),q=Object(Y.a)("messaging-disabled",!g&&"shown"),{composerHiddenScale:G,toolbarHiddenScale:_,composerTranslateX:z,toolbarTranslateX:V}=Object(c.p)(()=>_e(y,A),[A,y]),$=Object(ae.a)();return c.a.createElement("div",{id:"MiddleColumn",className:H,style:`\n --composer-hidden-scale: ${G};\n --toolbar-hidden-scale: ${_};\n --composer-translate-x: ${z}px;\n --toolbar-translate-x: ${V}px;\n `},c.a.createElement("div",{id:"middle-column-bg",style:B?"--custom-background: "+B:void 0}),c.a.createElement("div",{id:"middle-column-portals"}),N&&P&&c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"messages-layout",onDragEnter:A?x:void 0},c.a.createElement(ut,{chatId:N,threadId:P,messageListType:T}),c.a.createElement(ee.a,{name:f===n.e?"slide":"fade",activeKey:"thread"===T&&P===i.MAIN_THREAD_ID?1:2,shouldCleanup:!0},()=>c.a.createElement(c.a.Fragment,null,c.a.createElement(qa,{key:`${N}-${P}-${T}`,chatId:N,threadId:P,type:T,hasTools:U,onFabToggle:M,bottomOffset:A?"none":r?"big":"small"}),c.a.createElement("div",{className:Object(Y.a)("middle-column-footer",!A&&"no-composer")},A&&c.a.createElement(As,{chatId:N,threadId:P,messageListType:T,dropAreaState:C,onDropHide:R}),r&&c.a.createElement("div",{className:"unpin-button-container"},c.a.createElement(ce.a,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:L},c.a.createElement("i",{className:"icon-unpin"}),c.a.createElement("span",null,$("Chat.PanelHidePinnedMessages")))),!r&&!A&&l&&c.a.createElement("div",{className:q},c.a.createElement("div",{className:"messaging-disabled-inner"},c.a.createElement("span",null,l))),c.a.createElement(Rs,{messageListType:T,isActive:g,canPost:A})))),c.a.createElement(Ga,{isShown:E})),h.f&&c.a.createElement(xs,{isActive:Boolean(j)})),e&&c.a.createElement(Ls,{isOpen:S,chatId:e,onClose:F,onUnpin:D}))}));a(232);const Us=Object(g.a)(e=>e(),200,!1);var Hs;!function(e){e[e.Profile=0]="Profile",e[e.MemberList=1]="MemberList",e[e.SharedMedia=2]="SharedMedia",e[e.Search=3]="Search",e[e.Statistics=4]="Statistics",e[e.Management=5]="Management",e[e.ManageInitial=6]="ManageInitial",e[e.ManageChannelSubscribers=7]="ManageChannelSubscribers",e[e.ManageChatAdministrators=8]="ManageChatAdministrators",e[e.ManageChatPrivacyType=9]="ManageChatPrivacyType",e[e.ManageDiscussion=10]="ManageDiscussion",e[e.ManageGroupPermissions=11]="ManageGroupPermissions",e[e.ManageGroupRemovedUsers=12]="ManageGroupRemovedUsers",e[e.ManageGroupUserPermissionsCreate=13]="ManageGroupUserPermissionsCreate",e[e.ManageGroupUserPermissions=14]="ManageGroupUserPermissions",e[e.ManageGroupRecentActions=15]="ManageGroupRecentActions",e[e.ManageGroupAdminRights=16]="ManageGroupAdminRights",e[e.ManageGroupMembers=17]="ManageGroupMembers",e[e.StickerSearch=18]="StickerSearch",e[e.GifSearch=19]="GifSearch",e[e.PollResults=20]="PollResults"}(Hs||(Hs={}));var qs=Object(c.h)(Object(s.h)((e,{chatId:t,isProfile:a,isManagement:s})=>{const{query:n}=Object(o.A)(e)||{},{query:c}=Object(o.z)(e)||{},{query:r}=Object(o.s)(e)||{},i=t?Object(o.f)(e,t):void 0,l=i&&Object(m.jb)(i);return{canManage:Boolean(!s&&a&&i&&!Object(o.O)(e,i.id)&&(Object(m.lb)(i.id)||(Object(m.gb)(i)||i.isCreator)&&!i.isNotJoined)),isChannel:l,messageSearchQuery:n,stickerSearchQuery:c,gifSearchQuery:r}},(e,t)=>Object(d.l)(t,["setLocalTextSearchQuery","setStickerSearchQuery","setGifSearchQuery","searchTextMessagesLocal","toggleManagement","searchMessagesByDate"]))(({isColumnOpen:e,isProfile:t,isSearch:a,isManagement:s,isStatistics:n,isStickerSearch:r,isGifSearch:o,isPollResults:i,profileState:d,managementScreen:b,canManage:u,isChannel:m,onClose:O,messageSearchQuery:j,stickerSearchQuery:g,gifSearchQuery:f,setLocalTextSearchQuery:p,setStickerSearchQuery:I,setGifSearchQuery:v,searchTextMessagesLocal:y,toggleManagement:C,searchMessagesByDate:w})=>{var E;const M=Object(c.q)(null),[S,k,N]=Object(ct.a)(),P=Object(c.m)(e=>{p({query:e}),e.length&&Us(y)},[y,p]),T=Object(c.m)(e=>{w({timestamp:e.valueOf()/1e3}),N()},[N,w]),A=Object(c.m)(e=>{I({query:e})},[I]),x=Object(c.m)(e=>{v({query:e})},[v]),[R,L]=Object(c.r)(!e);Object(c.n)(()=>{setTimeout(()=>{L(!e)},300)},[e]);const F=Object(ae.a)(),D=t?d===l.k.Profile?Hs.Profile:d===l.k.SharedMedia?Hs.SharedMedia:d===l.k.MemberList?Hs.MemberList:-1:a?Hs.Search:i?Hs.PollResults:r?Hs.StickerSearch:o?Hs.GifSearch:s?b===l.g.Initial?Hs.ManageInitial:b===l.g.ChatPrivacyType?Hs.ManageChatPrivacyType:b===l.g.Discussion?Hs.ManageDiscussion:b===l.g.ChannelSubscribers?Hs.ManageChannelSubscribers:b===l.g.GroupPermissions?Hs.ManageGroupPermissions:b===l.g.ChatAdministrators?Hs.ManageChatAdministrators:b===l.g.GroupRemovedUsers?Hs.ManageGroupRemovedUsers:b===l.g.GroupUserPermissionsCreate?Hs.ManageGroupUserPermissionsCreate:b===l.g.GroupUserPermissions?Hs.ManageGroupUserPermissions:b===l.g.GroupRecentActions?Hs.ManageGroupRecentActions:b===l.g.ChatAdminRights?Hs.ManageGroupAdminRights:b===l.g.GroupMembers?Hs.ManageGroupMembers:void 0:n?Hs.Statistics:void 0,B=null!==(E=$e(D,!0))&&void 0!==E?E:-1;function U(){if(-1!==B)switch(B){case Hs.PollResults:return c.a.createElement("h3",null,F("PollResults"));case Hs.Search:return c.a.createElement(c.a.Fragment,null,c.a.createElement(re.a,{value:j,onChange:P}),c.a.createElement(ce.a,{round:!0,size:"smaller",color:"translucent",onClick:k,ariaLabel:"Search messages by date"},c.a.createElement("i",{className:"icon-calendar"})));case Hs.ManageInitial:return c.a.createElement("h3",null,F("Edit"));case Hs.ManageChatPrivacyType:return c.a.createElement("h3",null,F(m?"ChannelTypeHeader":"GroupTypeHeader"));case Hs.ManageDiscussion:return c.a.createElement("h3",null,F("Discussion"));case Hs.ManageChatAdministrators:return c.a.createElement("h3",null,F("ChannelAdministrators"));case Hs.ManageGroupRecentActions:return c.a.createElement("h3",null,F("Group.Info.AdminLog"));case Hs.ManageGroupAdminRights:return c.a.createElement("h3",null,F("EditAdminRights"));case Hs.ManageGroupPermissions:return c.a.createElement("h3",null,F("ChannelPermissions"));case Hs.ManageGroupRemovedUsers:return c.a.createElement("h3",null,F("ChannelBlockedUsers"));case Hs.ManageGroupUserPermissionsCreate:return c.a.createElement("h3",null,F("ChannelAddException"));case Hs.ManageGroupUserPermissions:return c.a.createElement("h3",null,F("UserRestrictions"));case Hs.StickerSearch:return c.a.createElement(re.a,{value:g,placeholder:"Search Stickers",onChange:A});case Hs.GifSearch:return c.a.createElement(re.a,{value:f,placeholder:F("SearchGifsTitle"),onChange:x});case Hs.Statistics:return c.a.createElement("h3",null,F("Statistics"));case Hs.SharedMedia:return c.a.createElement("h3",null,F("SharedMedia"));case Hs.ManageChannelSubscribers:return c.a.createElement("h3",null,F("ChannelSubscribers"));case Hs.MemberList:case Hs.ManageGroupMembers:return c.a.createElement("h3",null,F("GroupMembers"));default:return c.a.createElement(c.a.Fragment,null,c.a.createElement("h3",null,F("Info")),c.a.createElement("section",{className:"tools"},u&&c.a.createElement(ce.a,{round:!0,color:"translucent",size:"smaller",ariaLabel:F("Edit"),onClick:C},c.a.createElement("i",{className:"icon-edit"}))))}}const H=h.f||D===Hs.SharedMedia||D===Hs.MemberList||s,q=Object(Y.a)("animated-close-icon",R&&"no-transition");return Object(c.n)(()=>{M.current.classList.toggle("state-back",H)},[H]),c.a.createElement("div",{className:"RightHeader"},c.a.createElement(ce.a,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:O,ariaLabel:F(H?"Common.Back":"Common.Close")},c.a.createElement("div",{ref:M,className:q})),c.a.createElement(ee.a,{name:R?"none":"slide-fade",activeKey:B},U),!h.f&&c.a.createElement(ks,{isOpen:S,isPastMode:!0,submitButtonLabel:F("JumpToDate"),onClose:N,onSubmit:T}))})),Gs=a(118);function _s(e,t,a,s,r,o){const i=Object(c.q)();Object(he.a)(()=>{t===e&&r&&o&&(i.current=Object(m.w)(r,o,e).reverse())},[r,o,t,e]);const[l,d]=Object(Gs.a)(s?a:void 0,i.current,void 0,"media"===e?n.cb:n.P);return[l,d,!(!l||!i.current||l[0]===i.current[0])]}var zs=a(51);const Vs=Object(g.g)(e=>e(),250,!1);let $s=!1;var Ws=a(101),Qs=a(94);var Ks=Object(c.h)(Object(s.h)((e,{userId:t})=>{const{lastSyncTime:a}=e;return{lastSyncTime:a,user:Object(o.Cb)(e,t)}},(e,t)=>Object(d.l)(t,["loadFullUser"]))(({lastSyncTime:e,user:t,forceShowSelf:a,loadFullUser:s})=>{const{id:n,fullInfo:r,username:o,phoneNumber:i,isSelf:l}=t||{};Object(c.n)(()=>{e&&s({userId:n})},[s,n,e]);const d=Object(ae.a)();if(!t||l&&!a)return;const b=r&&r.bio,u=i&&Object(ba.c)(i);return c.a.createElement("div",{className:"ChatExtra"},b&&!!b.length&&c.a.createElement("div",{className:"item"},c.a.createElement("i",{className:"icon-info"}),c.a.createElement("div",null,c.a.createElement("p",{className:"title"},Object(Ze.a)(b,["br","links","emoji"])),c.a.createElement("p",{className:"subtitle"},d("UserBio")))),o&&!!o.length&&c.a.createElement("div",{className:"item"},c.a.createElement("i",{className:"icon-mention"}),c.a.createElement("div",null,c.a.createElement("p",{className:"title"},Object(Ze.a)(o)),c.a.createElement("p",{className:"subtitle"},d("Username")))),u&&!!u.length&&c.a.createElement("div",{className:"item"},c.a.createElement("i",{className:"icon-phone"}),c.a.createElement("div",null,c.a.createElement("p",{className:"title"},u),c.a.createElement("p",{className:"subtitle"},d("Phone")))))}));var Ys=Object(c.h)(Object(s.h)((e,{chatId:t})=>{const a=Object(o.f)(e,t);return{chat:a,canInviteUsers:a&&(!Object(m.jb)(a)&&!Object(m.yb)(a,"inviteUsers")||Object(m.q)(a,"inviteUsers"))}})(({chat:e,canInviteUsers:t})=>{const a=Object(ae.a)();if(!e||e.isRestricted)return;const s=Object(m.g)(e),n=Object(m.h)(e),r=0===n.indexOf("http")?n:"http://"+n;return c.a.createElement("div",{className:"ChatExtra"},s&&!!s.length&&c.a.createElement("div",{className:"item"},c.a.createElement("i",{className:"icon-info"}),c.a.createElement("div",null,c.a.createElement("p",{className:"title"},Object(Ze.a)(s,["br","links","emoji"])),c.a.createElement("p",{className:"subtitle"},a("Info")))),t&&!!n.length&&c.a.createElement("div",{className:"item"},c.a.createElement("i",{className:"icon-mention"}),c.a.createElement("div",null,c.a.createElement(va.a,{url:r,className:"title",text:n}),c.a.createElement("p",{className:"subtitle"},a("SetUrlPlaceholder")))))})),Js=a(154),Xs=a(173),Zs=a(108);a(236);const en=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"}];function tn(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > div.active > .${e}-list > .scroll-item`].join(", ")}var an=Object(c.h)(Object(s.h)((e,{chatId:t,userId:a})=>{const s=Object(o.f)(e,t),n=Object(o.m)(e,a||t),{currentType:c,resultsByType:r}=Object(o.v)(e)||{},{foundIds:i}=r&&c&&r[c]||{},{byId:l}=e.users,d=s&&Object(m.kb)(s),b=s&&Object(m.jb)(s),u=d||b&&Object(m.gb)(s),h=s&&s.fullInfo&&s.fullInfo.members,O=u&&s&&s.fullInfo&&!s.fullInfo.canViewMembers;let j;return a?j=a:Object(m.lb)(t)&&(j=t),{isChannel:b,resolvedUserId:j,chatMessages:n,foundIds:i,mediaSearchType:c,hasMembersTab:u,areMembersHidden:O,...u&&h&&{members:h,usersById:l},isRightColumnShown:Object(o.V)(e),isRestricted:s&&s.isRestricted,lastSyncTime:e.lastSyncTime}},(e,t)=>Object(d.l)(t,["setLocalMediaSearchType","searchMediaMessagesLocal","openMediaViewer","openAudioPlayer","openUserInfo","focusMessage"]))(({chatId:e,profileState:t,onProfileStateChange:a,isChannel:s,resolvedUserId:r,chatMessages:o,foundIds:d,mediaSearchType:b,hasMembersTab:u,areMembersHidden:O,members:j,usersById:g,isRightColumnShown:f,isRestricted:p,lastSyncTime:I,setLocalMediaSearchType:v,searchMediaMessagesLocal:y,openMediaViewer:C,openAudioPlayer:w,openUserInfo:E,focusMessage:M})=>{const S=Object(c.q)(null),k=Object(c.q)(null),[N,P]=Object(c.r)(0),T=Object(c.p)(()=>[...u?[{type:"members",title:s?"ChannelSubscribers":"GroupMembers"}]:[],...en],[u,s]),A=T[N].type,[x,R,L,F]=function(e,t,a,s,n,r,o,i,l,d){const b="members"!==a&&s?s:a,u=Object(c.p)(()=>{if(n&&r)return Object(m.W)(n.map(({userId:e})=>e),r)},[n,r]),[h,O,j]=_s("media",b,t,d,o,i),[g,f,p]=_s("documents",b,t,d,o,i),[I,v,y]=_s("links",b,t,d,o,i),[C,w,E]=_s("audio",b,t,d,o,i);let M,S,k=!1;switch(b){case"members":M=u,S=void 0;break;case"media":M=h,S=O,k=j;break;case"documents":M=g,S=f,k=p;break;case"links":M=I,S=v,k=y;break;case"audio":M=C,S=w,k=E}return[b,M,S,k]}(0,y,A,b,j,g,o,d,0,I),D=T.findIndex(({type:e})=>e===x),{handleScroll:B}=function(e,t,a,s){Object(zs.a)(([a])=>{if(a&&a!==t){const a=e.current,n=a.querySelector(".TabList");a.scrollTop<n.offsetTop&&(s("members"===t?l.k.MemberList:l.k.SharedMedia),$s=!0,Object(pt.a)(a,n,"start",void 0,void 0,void 0,300),setTimeout(()=>{$s=!1},350))}},[t,s]),Object(zs.a)(([t])=>{if(a!==l.k.Profile||a===t)return;const n=e.current;if(!n)return;const c=n.querySelector(".TabList");!c||c.offsetTop>n.scrollTop||($s=!0,Object(pt.a)(n,n.firstElementChild,"start",void 0,2*n.offsetHeight),setTimeout(()=>{$s=!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=l.k.Profile;a.scrollTop>=n.offsetTop&&(c="members"===t?l.k.MemberList:l.k.SharedMedia),s(c)},[e,s,t]);return Object(c.n)(()=>{$s||n()},[n,t]),{handleScroll:Object(c.m)(()=>{$s||Vs(n)},[n])}}(S,A,t,a),{applyTransitionFix:U,releaseTransitionFix:H}=function(e){return Object(c.n)(()=>{function t(){const t=e.current,a=t.querySelector(".Transition"),s=t.querySelector(".TabList");a&&s&&(a.style.minHeight=t.offsetHeight-s.offsetHeight+"px")}return t(),window.addEventListener("resize",t,!1),()=>{window.removeEventListener("resize",t,!1)}},[e]),{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])}}(S),[q,G]=(()=>{const[e,t]=Object(c.r)(!1);return[e,Object(c.m)(()=>{t(e=>!e)},[])]})(),_=Object(c.m)(()=>{H(),G()},[H,G]);Object(c.n)(()=>{v({mediaType:A})},[v,A]);const z=r||e,V=Object(c.m)(e=>{C({chatId:z,threadId:i.MAIN_THREAD_ID,messageId:e,origin:l.h.SharedMedia})},[z,C]),$=Object(c.m)(e=>{w({chatId:z,messageId:e})},[z,w]),W=Object(c.m)(e=>{E({id:e})},[E]),Q=Object(c.m)(e=>{M({chatId:z,messageId:e})},[z,M]);let K;Object(c.n)(()=>{if(k.current&&h.k)return Object(me.b)(k.current,{onSwipe:(e,t)=>{t===me.a.Left?P(Math.min(N+1,T.length-1)):t===me.a.Right&&P(Math.max(0,N-1))}})},[N,T.length]);const Y="members"===x||!u&&"media"===x;Y?K=f?0:1e3:R||(K=n.db);const J=Object(Is.a)([e,x],K);function X(){if(!R||!J||!o){const e=Y&&R&&!J;return c.a.createElement("div",{className:"content empty-list"},!e&&c.a.createElement(be.a,null))}if(!R.length){let e;switch(x){case"members":e=O?"You have no access to group members list.":"No members found";break;case"documents":e="No documents found.";break;case"links":e="No links found.";break;case"audio":e="No audio found.";break;default:e="No media found."}return c.a.createElement("div",{className:"content empty-list"},c.a.createElement(Zs.a,{text:e}))}return c.a.createElement("div",{className:`content ${x}-list`,teactFastList:!0},"media"===x?R.map(e=>o[e]&&c.a.createElement(Js.a,{key:e,message:o[e],onClick:V})):"documents"===x?R.map(e=>o[e]&&c.a.createElement(zt.a,{key:e,message:o[e],withDate:!0,smaller:!0,className:"scroll-item",onDateClick:Q})):"links"===x?R.map(e=>o[e]&&c.a.createElement(Xs.a,{key:e,message:o[e],onMessageClick:Q})):"audio"===x?R.map(e=>o[e]&&c.a.createElement(Vt.a,{key:e,renderingFor:"sharedMedia",message:o[e],date:o[e].date,lastSyncTime:I,className:"scroll-item",onPlay:$,onDateClick:Q})):"members"===x?R.map((e,t)=>c.a.createElement(Qs.a,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>W(e)},c.a.createElement(Qe.a,{userId:e,forceShowSelf:!0}))):void 0)}return c.a.createElement(Ws.a,{ref:S,className:"Profile custom-scroll",itemSelector:tn(x),items:R,cacheBuster:q,preloadBackwards:n.cb,isDisabled:"members"===A,noFastList:!0,onLoadMore:L,onScroll:B},!F&&function(e,t){return c.a.createElement("div",{className:"profile-info"},t?c.a.createElement(c.a.Fragment,null,c.a.createElement(Qe.a,{userId:t,avatarSize:"jumbo",forceShowSelf:t!==e,withMediaViewer:!0,withFullInfo:!0}),c.a.createElement(Ks,{userId:t,forceShowSelf:t!==e})):c.a.createElement(c.a.Fragment,null,c.a.createElement(Ke.a,{chatId:e,avatarSize:"jumbo",withMediaViewer:!0,withFullInfo:!0}),c.a.createElement(Ys,{chatId:e})))}(e,r),!p&&c.a.createElement("div",{className:"shared-media"},c.a.createElement(ee.a,{ref:k,name:"slide",activeKey:D,renderCount:T.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:U,onStop:_},X),c.a.createElement(ge.a,{activeTab:N,tabs:T,onSwitchTab:P})))}));var sn=e=>{const t=Object(ve.a)(Ie.a.Extra,"RightSearch");return t?c.a.createElement(t,e):c.a.createElement(ye.a,null)};var nn=e=>{const t=Object(ve.a)(Ie.a.Extra,"Management");return t?c.a.createElement(t,e):c.a.createElement(ye.a,null)};var cn=()=>{const e=Object(ve.a)(Ie.a.Extra,"Statistics");return e?c.a.createElement(e,null):c.a.createElement(ye.a,null)};var rn=()=>{const e=Object(ve.a)(Ie.a.Extra,"StickerSearch");return e?c.a.createElement(e,null):c.a.createElement(ye.a,null)};var on=()=>{const e=Object(ve.a)(Ie.a.Extra,"GifSearch");return e?c.a.createElement(e,null):c.a.createElement(ye.a,null)};var ln=()=>{const e=Object(ve.a)(Ie.a.Extra,"PollResults");return e?c.a.createElement(e,null):c.a.createElement(ye.a,null)};a(237);const dn=Object.keys(l.l).length/2,bn=Object.keys(l.g).length/2;function un(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}var mn=Object(c.h)(Object(s.h)(e=>{const{chatId:t,threadId:a}=Object(o.y)(e)||{},s=Object(o.d)(e);return{contentKey:Object(o.jb)(e),chatId:t,threadId:a,currentProfileUserId:e.users.selectedId,isChatSelected:Boolean(t&&s)}},(e,t)=>Object(d.l)(t,["openUserInfo","toggleChatInfo","toggleManagement","toggleStatistics","closeLocalTextSearch","setStickerSearchQuery","setGifSearchQuery","closePollResults"]))(({contentKey:e,chatId:t,threadId:a,currentProfileUserId:s,isChatSelected:r,toggleChatInfo:o,toggleManagement:i,toggleStatistics:d,openUserInfo:b,closeLocalTextSearch:u,setStickerSearchQuery:m,setGifSearchQuery:h,closePollResults:O})=>{var j;const{width:g}=He(),[f,p]=Object(c.r)(l.k.Profile),[I,v]=Object(c.r)(l.g.Initial),[y,C]=Object(c.r)(),[w,E]=Object(c.r)(),M=f!==l.k.Profile,S=void 0!==e,k=e===l.l.ChatInfo||e===l.l.UserInfo,N=e===l.l.Search,P=e===l.l.Management,T=e===l.l.Statistics,A=e===l.l.StickerSearch,x=e===l.l.GifSearch,R=e===l.l.PollResults,L=g<=n.S,[F,D]=Object(c.r)(!S),B=null!==(j=$e(e,!0,!r))&&void 0!==j?j:-1,U=Object(c.m)(()=>{switch(e){case l.l.ChatInfo:if(M){p(l.k.Profile);break}o();break;case l.l.UserInfo:if(M){p(l.k.Profile);break}b({id:void 0});break;case l.l.Management:switch(I){case l.g.Initial:i();break;case l.g.ChatPrivacyType:case l.g.Discussion:case l.g.GroupPermissions:case l.g.GroupType:case l.g.ChatAdministrators:case l.g.ChannelSubscribers:case l.g.GroupMembers:v(l.g.Initial);break;case l.g.GroupUserPermissionsCreate:case l.g.GroupRemovedUsers:case l.g.GroupUserPermissions:v(l.g.GroupPermissions),C(void 0),E(void 0);break;case l.g.ChatAdminRights:case l.g.GroupRecentActions:v(l.g.ChatAdministrators)}break;case l.l.Statistics:d();break;case l.l.Search:un(),u();break;case l.l.StickerSearch:case l.l.GifSearch:un(),m({query:void 0}),h({query:void 0});break;case l.l.PollResults:O()}},[e,M,o,b,d,O,I,i,u,m,h]),H=Object(c.m)((e,t)=>{C(e),E(t)},[]);function q(){if(-1!==B)switch(B){case l.l.ChatInfo:case l.l.UserInfo:return c.a.createElement(an,{key:s||t,chatId:t,userId:s,profileState:f,onProfileStateChange:p});case l.l.Search:return c.a.createElement(sn,{chatId:t,threadId:a});case l.l.Management:return c.a.createElement(nn,{chatId:t,currentScreen:I,isPromotedByCurrentUser:w,selectedChatMemberId:y,onScreenSelect:v,onChatMemberSelect:H});case l.l.Statistics:return c.a.createElement(cn,null);case l.l.StickerSearch:return c.a.createElement(rn,null);case l.l.GifSearch:return c.a.createElement(on,null);case l.l.PollResults:return c.a.createElement(ln,null)}}return Object(c.n)(()=>S?Object(Z.a)(U):void 0,[S,U]),Object(c.n)(()=>{setTimeout(()=>{D(!S)},300)},[S]),Object(c.n)(()=>{S&&L&&U()},[L]),Object(mt.a)(([a,s])=>{(a===l.l.ChatInfo&&e===l.l.UserInfo||a===l.l.UserInfo&&e===l.l.ChatInfo||s!==t)&&(p(l.k.Profile),v(l.g.Initial))},[e,t]),c.a.createElement("div",{id:"RightColumn-wrapper",className:r?void 0:"is-hidden"},L&&c.a.createElement("div",{className:"overlay-backdrop",onClick:U}),c.a.createElement("div",{id:"RightColumn"},c.a.createElement(qs,{chatId:t,isColumnOpen:S,isProfile:k,isSearch:N,isManagement:P,isStatistics:T,isStickerSearch:A,isGifSearch:x,isPollResults:R,profileState:f,managementScreen:I,onClose:U}),c.a.createElement(ee.a,{name:F?"none":"zoom-fade",renderCount:dn+bn,activeKey:P?dn+I:B},q)))}));var hn=Object(c.h)(({isOpen:e})=>{const t=Object(ve.a)(Ie.a.Extra,"MediaViewer",!e);return t?c.a.createElement(t,null):void 0});var On=e=>{const{isOpen:t}=e,a=Object(ve.a)(Ie.a.Extra,"ForwardPicker",!t);return a?c.a.createElement(a,e):void 0};var jn=({isOpen:e})=>{const t=Object(ve.a)(Ie.a.Extra,"Notifications",!e);return t?c.a.createElement(t,null):void 0};var gn=({isOpen:e})=>{const t=Object(ve.a)(Ie.a.Extra,"Errors",!e);return t?c.a.createElement(t,null):void 0};a(238);let fn,pn,In=!1;function vn(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 yn=Object(c.h)(Object(s.h)(e=>({animationLevel:e.settings.byKey.animationLevel,lastSyncTime:e.lastSyncTime,isLeftColumnShown:e.isLeftColumnShown,isRightColumnShown:Object(o.V)(e),isMediaViewerOpen:Object(o.S)(e),isForwardModalOpen:Object(o.Q)(e),hasNotifications:Boolean(e.notifications.length),hasErrors:Boolean(e.errors.length)}),(e,t)=>Object(d.l)(t,["loadAnimatedEmojis"]))(({lastSyncTime:e,loadAnimatedEmojis:t,isLeftColumnShown:a,isRightColumnShown:r,isMediaViewerOpen:i,isForwardModalOpen:l,animationLevel:d,hasNotifications:b,hasErrors:u})=>{n.m&&!In&&(In=!0,console.log(">>> RENDER MAIN")),Object(c.n)(()=>{e&&t()},[e,t]);const{transitionClassNames:m}=Object(J.a)(!a,void 0,!0),{transitionClassNames:h}=Object(J.a)(r,void 0,!0),O=Object(Y.a)(m.replace(/([\w-]+)/g,"middle-column-$1"),h.replace(/([\w-]+)/g,"right-column-$1"));function j(e){e.preventDefault(),e.stopPropagation()}return Object(c.n)(()=>{document.body.classList.toggle("is-middle-column-open",O.includes("middle-column-open")),document.body.classList.toggle("is-right-column-shown",O.includes("right-column-open"))},[O]),Object(c.n)(()=>{d>0&&(document.body.classList.add("animating-right-column"),Object(K.b)(350+n.c),fn&&(clearTimeout(fn),fn=void 0),fn=window.setTimeout(()=>{document.body.classList.remove("animating-right-column"),fn=void 0},350+n.c))},[d,r]),Object(X.a)(()=>{const e=Object(o.q)(Object(s.e)());let t=0;pn=window.setInterval(()=>{if(t%2==0){const t=Object(o.q)(Object(s.e)())-e;t>0&&(document.title=`${t} notification${t>1?"s":""}`,vn(!0))}else document.title="Telegram",vn(!1);t++},1e3)},()=>{clearInterval(pn),pn=void 0,document.title="Telegram",vn(!1)}),c.a.createElement("div",{id:"Main",className:O,onDrop:j,onDragOver:j},c.a.createElement(Fe,null),c.a.createElement(Bs,null),c.a.createElement(mn,null),c.a.createElement(hn,{isOpen:i}),c.a.createElement(On,{isOpen:l}),c.a.createElement(jn,{isOpen:b}),c.a.createElement(gn,{isOpen:u}))}));n.m&&console.log(">>> FINISH LOAD MAIN BUNDLE"),Object(s.d)().initApi()}}]);