mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-11 16:49:44 +01:00
2 lines
204 KiB
JavaScript
2 lines
204 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{188:function(e,t,a){},189:function(e,t,a){},190:function(e,t,a){},201:function(e,t,a){},202:function(e,t,a){},203:function(e,t,a){},206:function(e,t,a){},207:function(e,t,a){},208:function(e,t,a){},212:function(e,t,a){},213:function(e,t,a){},215: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){},227:function(e,t,a){},228:function(e,t,a){},230:function(e,t,a){},231:function(e,t,a){},232:function(e,t,a){},233:function(e,t,a){},234:function(e,t,a){},235:function(e,t,a){},236:function(e,t,a){},240:function(e,t,a){},241:function(e,t,a){},242:function(e,t,a){},95:function(e,t,a){"use strict";a.r(t),a.d(t,"Main",(function(){return Tc}));var s=a(2),c=a(1),n=a(0),r=(a(77),a(41)),o=a(6);window.addEventListener("popstate",e=>{if(!e.state)return;const{chatId:t,threadId:a,messageListType:c}=e.state;Object(s.d)().openChat({id:t,threadId:a,type:c,noPushState:!0})}),Object(s.b)("openChat",(e,t,a)=>{const{id:c,threadId:n=-1,type:i="thread",noPushState:l}=a,d=Object(o.y)(e);return d&&d.chatId===c&&d.threadId===n&&d.type===i||(e=Object(r.m)(e),e={...e,messages:{...e.messages,contentToBeScheduled:void 0},...c!==e.forwardMessages.toChatId&&{forwardMessages:{}}},Object(s.g)(e),l||window.history.pushState({chatId:c,threadId:n,messageListType:i},"")),Object(r.L)(e,c,n,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(19),d=a(3);let b;Object(s.b)("setScrollOffset",(e,t,a)=>{const{chatId:s,threadId:c,scrollOffset:n}=a;return Object(r.v)(e,s,c,"scrollOffset",n)}),Object(s.b)("setReplyingToId",(e,t,a)=>{const{messageId:s}=a,c=Object(o.y)(e);if(!c)return;const{chatId:n,threadId:i}=c;return Object(r.v)(e,n,i,"replyingToId",s)}),Object(s.b)("setEditingId",(e,t,a)=>{const{messageId:s}=a,c=Object(o.y)(e);if(!c)return;const{chatId:n,threadId:i,type:l}=c,d="scheduled"===l?"editingScheduledId":"editingId";return Object(r.v)(e,n,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),c=Object(o.Eb)(e,t,a);if(!s||!c)return;const n=Object(d.g)(c,t=>Boolean(s[t]&&Object(o.b)(e,s[t],a).canEdit));return n?Object(r.v)(e,t,a,"editingId",n):void 0}),Object(s.b)("openMediaViewer",(e,t,a)=>{const{chatId:s,threadId:c,messageId:n,avatarOwnerId:r,profilePhotoIndex:o,origin:i}=a;return{...e,mediaViewer:{chatId:s,threadId:c,messageId:n,avatarOwnerId:r,profilePhotoIndex:o,origin:i},forwardMessages:{}}}),Object(s.b)("closeMediaViewer",e=>({...e,mediaViewer:{}})),Object(s.b)("openAudioPlayer",(e,t,a)=>{const{chatId:s,threadId:c,messageId:n}=a;return{...e,audioPlayer:{chatId:s,threadId:c,messageId:n}}}),Object(s.b)("closeAudioPlayer",e=>({...e,audioPlayer:{}})),Object(s.b)("openPollResults",(e,t,a)=>{const{chatId:c,messageId:n}=a;Object(o.V)(e)?c===e.pollResults.chatId&&n===e.pollResults.messageId||Object(s.g)({...e,pollResults:{chatId:c,messageId:n,voters:{}}}):window.setTimeout(()=>{const e=Object(s.e)();Object(s.g)({...e,pollResults:{chatId:c,messageId:n,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:c}=a;let n;if(c===i.MAIN_THREAD_ID){const t=Object(o.f)(e,s);n=t&&t.lastMessage?t.lastMessage.id:void 0}else{const t=Object(o.zb)(e,s,c);n=t?t.lastMessageId:void 0}n&&t.focusMessage({chatId:s,threadId:c,messageId:n,noHighlight:!0})}),Object(s.b)("focusMessage",(e,t,a)=>{const{chatId:c,threadId:n=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||c!==j.chatId||n!==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,c,O,u),e=Object(r.M)(e,void 0),g&&(e=Object(r.M)(e,l.b.Static));const f=Object(o.Eb)(e,c,n);if(f&&f.includes(O))return Object(s.g)(e),void t.openChat({id:c,threadId:n});if(g&&(e=Object(r.v)(e,c,n,"viewportIds",void 0)),e=Object(r.v)(e,c,n,"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:c,threadId:n}),t.loadViewportMessages()}),Object(s.b)("openForwardMenu",(e,t,a)=>{const{fromChatId:s,messageIds:c,groupedId:n}=a;let r;return n&&(r=Object(o.Z)(e,s,n)),{...e,forwardMessages:{fromChatId:s,messageIds:r||c,isModalShown:!0}}}),Object(s.b)("exitForwardMode",e=>{Object(s.g)({...e,forwardMessages:{}})}),Object(s.b)("setForwardChatId",(e,t,a)=>{const{id:c}=a;Object(s.g)({...e,forwardMessages:{...e.forwardMessages,toChatId:c,isModalShown:!1}}),t.openChat({id:c}),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||{},c=Object(o.r)(e);return c?Object(r.l)(e,c.id,s):e}),Object(s.b)("toggleMessageSelection",(e,t,a)=>{const{messageId:s,groupedId:c,childMessageIds:n,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,c,n,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:c}=e.globalSearch;return Object(r.P)(e,{globalResults:{},localResults:{},resultsByType:void 0,...s?{fetchingStatus:{chats:!c,messages:!0}}:{fetchingStatus:void 0},query:s})}),Object(s.b)("addRecentlyFoundChatId",(e,t,a)=>{const{id:s}=a,{recentlyFoundChatIds:c}=e.globalSearch;if(!c)return Object(r.P)(e,{recentlyFoundChatIds:[s]});const n=c.filter(e=>e!==s);return n.unshift(s),n.length>10&&n.pop(),Object(r.P)(e,{recentlyFoundChatIds:n})}),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(47),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:c}=Object(o.y)(e)||{};if(!s||!c)return;const{query:n}=a,i=Object(m.a)(s,c),{query:l}=e.localTextSearch.byChatThreadKey[i]||{};return n!==l&&(e=Object(r.s)(e,s,c,u.a)),e=Object(r.W)(e,s,c,!0,n)}),Object(s.b)("setLocalMediaSearchType",(e,t,a)=>{const{chatId:s}=Object(o.y)(e)||{};if(!s)return;const{mediaType:c}=a;return Object(r.V)(e,s,c)}),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(8),O=a(161);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)("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:c}=e;if(!c)return{...e,recentEmojis:[s]};const n=c.filter(e=>e!==s);return n.unshift(s),n.length>18&&n.pop(),{...e,recentEmojis:n}}),Object(s.b)("addRecentSticker",(e,t,a)=>{const{sticker:s}=a,{recent:c}=e.stickers;if(!c)return{...e,stickers:{...e.stickers,recent:{hash:0,stickers:[s]}}};const n=c.stickers.filter(e=>e.id!==s.id);return n.unshift(s),{...e,stickers:{...e.stickers,recent:{...c,stickers:n}}}}),Object(s.b)("showNotification",(e,t,a)=>{const s=a,c=[...e.notifications],n=c.findIndex(e=>e.message===s.message);return-1!==n&&c.splice(n,1),c.push(s),{...e,notifications:c}}),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 c=[...e.errors],n=c.findIndex(e=>e.message===s.message);return-1!==n&&c.splice(n,1),c.push(s),{...e,errors:c}}),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(78);var j=a(10),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);async function v(e,t,a){const n=await Object(j.a)("fetchChats",{limit:c.i,offsetDate:a,archived:"archived"===e,withPinned:void 0===Object(s.e)().chats.orderedPinnedIds[e]});if(!n)return;const{chatIds:o}=n;o.length>0&&o[0]===t&&o.shift();let l=Object(s.e)();l=Object(r.e)(l,Object(d.c)(n.users,"id")),l=Object(r.K)(l,Object(d.c)(n.chats,"id")),l=Object(r.G)(l,e,o),l=Object(r.H)(l,e,n),Object.keys(n.draftsById).map(Number).forEach(e=>{l=Object(r.v)(l,e,i.MAIN_THREAD_ID,"draft",n.draftsById[e])}),Object.keys(n.replyingToById).map(Number).forEach(e=>{l=Object(r.v)(l,e,i.MAIN_THREAD_ID,"replyingToId",n.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 y(e){const t=await Object(j.a)("fetchFullChat",e);if(!t)return;const{users:a,fullInfo:c}=t;let n=Object(s.e)();a&&(n=Object(r.e)(n,Object(d.c)(a,"id"))),n=Object(r.F)(n,e.id,{fullInfo:c}),Object(s.g)(n)}async function C(e,t,a){const c=Object(s.e)(),n=Object(o.h)(c,t);if(n&&!n.isMin)return void(a?e.focusMessage({chatId:n.id,messageId:a}):e.openChat({id:n.id}));const i=Object(o.r)(c);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 n=0;n<c.Bb;n++){await Object(g.e)(200);const{byId:c,listIds:{active:n},orderedPinnedIds:{active:r}}=Object(s.e)().chats;if(!n)return;const{chatId:l}=Object(o.y)(e)||{},{pinnedChats:d,otherChats:b}=Object(m.Ab)(c,n,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:c}=a,{currentUserId:n}=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===n)Object(j.a)("fetchChat",{type:"self"});else{const t=Object(o.Db)(e,s);t&&Object(j.a)("fetchChat",{type:"user",user:t})}if(c!==i.MAIN_THREAD_ID){Object(o.Bb)(e,s,c)||t.requestThreadInfoUpdate({chatId:s,threadId:c})}}),Object(s.b)("openSupportChat",(e,t)=>{const a=Object(o.xb)(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:c.Ab})}),Object(s.b)("loadMoreChats",(e,t,a)=>{const{listType:s="active"}=a,c=e.chats.listIds[s];if(e.chats.isFullyLoaded[s])return;const n=c?c.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(n?()=>v(s,n.id,n.lastMessage.date):()=>v(s))}),Object(s.b)("loadFullChat",(e,t,a)=>{const{chatId:s,force:c}=a,n=Object(o.f)(e,s);n&&(c?y(n):I(()=>y(n)))}),Object(s.b)("loadTopChats",()=>{p(()=>v("active"))}),Object(s.b)("requestChatUpdate",(e,t,a)=>{const{chatId:s}=a,c=Object(o.f)(e,s);c&&Object(j.a)("requestChatUpdate",c)}),Object(s.b)("updateChatMutedState",(e,t,a)=>{const{chatId:s,isMuted:c}=a,n=Object(o.f)(e,s);n&&Object(j.a)("updateChatMutedState",{chat:n,isMuted:c})}),Object(s.b)("createChannel",(e,t,a)=>{const{title:c,about:n,photo:i,memberIds:d}=a;!async function(e,t,a,c){Object(s.g)({...Object(s.e)(),chatCreation:{progress:l.a.InProgress}});const n=await Object(j.a)("createChannel",{title:e,about:a,users:t});if(!n)return;const{id:o,accessHash:i}=n;let d=Object(s.e)();d=Object(r.F)(d,o,n),d={...d,chatCreation:{...d.chatCreation,progress:n?l.a.Complete:l.a.Error}},Object(s.g)(d),Object(s.d)().openChat({id:o}),o&&i&&c&&await Object(j.a)("editChatPhoto",{chatId:o,accessHash:i,photo:c})}(c,d.map(t=>Object(o.Db)(e,t)).filter(Boolean),n,i)}),Object(s.b)("joinChannel",(e,t,a)=>{const{chatId:s}=a,c=Object(o.f)(e,s);if(!c)return;const{id:n,accessHash:r}=c;n&&r&&Object(j.a)("joinChannel",{channelId:n,accessHash:r})}),Object(s.b)("leaveChannel",(e,t,a)=>{const{chatId:s}=a,c=Object(o.f)(e,s);if(!c)return;const{id:n,accessHash:r}=c;n&&r&&Object(j.a)("leaveChannel",{channelId:n,accessHash:r})}),Object(s.b)("deleteChannel",(e,t,a)=>{const{chatId:s}=a,c=Object(o.f)(e,s);if(!c)return;const{id:n,accessHash:r}=c;n&&r&&Object(j.a)("deleteChannel",{channelId:n,accessHash:r})}),Object(s.b)("createGroupChat",(e,t,a)=>{const{title:c,memberIds:n,photo:i}=a;!async function(e,t,a){Object(s.g)({...Object(s.e)(),chatCreation:{progress:l.a.InProgress}});const c=await Object(j.a)("createGroupChat",{title:e,users:t});if(!c)return;const{id:n}=c;let o=Object(s.e)();o=Object(r.F)(o,n,c),o={...o,chatCreation:{...o.chatCreation,progress:c?l.a.Complete:l.a.Error}},Object(s.g)(o),Object(s.d)().openChat({id:n}),n&&a&&await Object(j.a)("editChatPhoto",{chatId:n,photo:a})}(c,n.map(t=>Object(o.Db)(e,t)).filter(Boolean),i)}),Object(s.b)("toggleChatPinned",(e,t,a)=>{const{id:s,folderId:n}=a,r=Object(o.f)(e,s);if(r)if(n){const t=Object(o.i)(e,n);if(t){const a=!Object(o.M)(e,s,n),{pinnedChatIds:c,includedChatIds:r}=t,i=a?[s,...c||[]]:(c||[]).filter(e=>e!==s),l=[s,...r];Object(j.a)("editChatFolder",{id:n,folderUpdate:{...t,pinnedChatIds:i,includedChatIds:l}})}}else{const t=Object(o.j)(e,s),a=Object(o.M)(e,s,"archived"===t?c.g:void 0);Object(j.a)("toggleChatPinned",{chat:r,shouldBePinned:!a})}}),Object(s.b)("toggleChatArchived",(e,t,a)=>{const{id:s}=a,n=Object(o.f)(e,s);n&&Object(j.a)("toggleChatArchived",{chat:n,folderId:Object(m.hb)(n)?0:c.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:c}=a,n=Object(o.i)(e,s);n&&Object(j.a)("editChatFolder",{id:s,folderUpdate:{id:s,emoticon:n.emoticon,pinnedChatIds:n.pinnedChatIds,...c}})}),Object(s.b)("addChatFolder",(e,t,a)=>{const{folder:n}=a,{orderedIds:r}=e.chatFolders;!async function(e,t){const{id:a,description:c,...n}=e;if(await Object(j.a)("editChatFolder",{id:t+1,folderUpdate:{id:t+1,...n}}),!c)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)}})}(n,r&&r.length?Math.max.apply(Math.max,r):c.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,c=Object(o.f)(e,s);c&&(c.unreadCount?Object(j.a)("markMessageListRead",{chat:c,threadId:i.MAIN_THREAD_ID}):Object(j.a)("toggleDialogUnread",{chat:c,hasUnreadMark:!c.hasUnreadMark}))}),Object(s.b)("openTelegramLink",(e,t,a)=>{const{url:s}=a;let n=c.gb.exec(s);if(n){const e=n[1];(async()=>{const a=await Object(j.a)("openChatByInvite",e);a&&t.openChat({id:a.id})})()}else{n=c.hb.exec(s);const e=n[1],a=n[2]?Number(n[2]):void 0;C(t,e,a)}}),Object(s.b)("openChatByUsername",(e,t,a)=>{const{username:s}=a;C(t,s)}),Object(s.b)("togglePreHistoryHidden",(e,t,a)=>{const{chatId:s,isEnabled:c}=a;let n=Object(o.f)(e,s);n&&(async()=>{if(Object(m.ib)(n)){if(n=await Object(j.a)("migrateChat",n),!n)return;t.openChat({id:n.id})}Object(j.a)("togglePreHistoryHidden",{chat:n,isEnabled:c})})()}),Object(s.b)("updateChatDefaultBannedRights",(e,t,a)=>{const{chatId:s,bannedRights:c}=a,n=Object(o.f)(e,s);n&&Object(j.a)("updateChatDefaultBannedRights",{chat:n,bannedRights:c})}),Object(s.b)("updateChatMemberBannedRights",(e,t,a)=>{const{chatId:c,userId:n,bannedRights:i}=a;let l=Object(o.f)(e,c);const d=Object(o.Db)(e,n);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,c);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,c,{fullInfo:{...a.fullInfo,...b&&h&&{members:b.filter(e=>e.userId!==n)},...b&&!h&&{members:b.map(e=>e.userId===n?{...e,bannedRights:i}:e)},...O&&u&&{kickedMembers:u.filter(e=>e.userId!==n)}}}))})()}),Object(s.b)("updateChatAdmin",(e,t,a)=>{const{chatId:c,userId:n,adminRights:i,customTitle:l}=a;let d=Object(o.f)(e,c);const b=Object(o.Db)(e,n);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,c);if(!a||!a.fullInfo)return;const{adminMembers:u}=a.fullInfo,h=!Object.keys(i).length;Object(s.g)(Object(r.F)(e,c,{fullInfo:{...a.fullInfo,...u&&h&&{adminMembers:u.filter(e=>e.userId!==n)},...u&&!h&&{adminMembers:u.map(e=>e.userId===n?{...e,adminRights:i,customTitle:l}:e)}}}))})()}),Object(s.b)("updateChat",(e,t,a)=>{const{chatId:c,title:n,about:i,photo:d}=a,b=Object(o.f)(e,c);b&&(async()=>{Object(s.g)(Object(r.Z)(Object(s.e)(),l.f.InProgress)),await Promise.all([b.title!==n?Object(j.a)("updateChatTitle",b,n):void 0,b.fullInfo&&b.fullInfo.about!==i?Object(j.a)("updateChatAbout",b,i):void 0,d?Object(j.a)("editChatPhoto",{chatId:c,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:c}=a,n=Object(o.f)(e,s);n&&Object(j.a)("toggleSignatures",{chat:n,isEnabled:c})}),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:c}=a,n=Object(o.f)(e,s);let r=Object(o.f)(e,c);n&&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:n,chat:r})})()}),Object(s.b)("unlinkDiscussionGroup",(e,t,a)=>{const{channelId:s}=a,c=Object(o.f)(e,s);if(!c)return;let n;c.fullInfo&&c.fullInfo.linkedChatId&&(n=Object(o.f)(e,c.fullInfo.linkedChatId)),(async()=>{await Object(j.a)("setDiscussionGroup",{channel:c}),n&&y(n)})()}),Object(s.b)("loadMoreMembers",e=>{(async()=>{const{chatId:t}=Object(o.y)(e)||{},a=t?Object(o.f)(e,t):void 0;if(!a||Object(m.ib)(a))return;const c=a.fullInfo&&a.fullInfo.members&&a.fullInfo.members.length||void 0,n=await Object(j.a)("fetchMembers",a.id,a.accessHash,"recent",c);if(!n)return;const{members:i,users:l}=n;i&&i.length&&(e=Object(s.e)(),e=Object(r.e)(e,Object(d.c)(l,"id")),e=Object(r.F)(e,a.id,{fullInfo:{...a.fullInfo,members:[...(a.fullInfo||{}).members||[],...i||[]]}}),Object(s.g)(e))})()});var E=a(147);const w=new Map;async function M(e,t,a,n,i=!1,b=!1){const u=e.id;let m;switch(n){case l.e.Backwards:m=void 0;break;case l.e.Around:m=-(Math.round(c.U/2)+1);break;case l.e.Forwards:m=-(c.U+1)}const h=await Object(j.a)("fetchMessages",{chat:Object(o.Ab)(Object(s.e)(),u,t),offsetId:a,addOffset:m,limit:c.U,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 E=Object(o.X)(C,u,t);const w=Object(o.db)(C,u,t);if(i&&E&&w&&Object(d.b)(E,w)&&(C=Object(r.T)(C,u,t,w),E=Object(o.X)(C,u,t),C=Object(r.v)(C,u,t,"outlyingIds",void 0),i=!1),!b){const e=i?w:E,{newViewportIds:s}=S(e,a,n);C=Object(r.x)(C,u,t,s)}Object(s.g)(C)}function S(e,t,a){const{length:s}=e,n=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?n:n+1||s,o=r-c.U,i=r+c.U-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===c.U}return{newViewportIds:d,areSomeLocal:b,areAllLocal:u}}async function k(e){let t;const a=e.attachment?(e,c)=>{w.has(c)||(t=c,w.set(c,a));const n=Object(s.e)();Object(s.g)({...n,fileUploads:{byMessageLocalId:{...n.fileUploads.byMessageLocalId,[c]:{progress:e}}}})}:void 0;e.replyingTo&&await Object(g.f)();const c=Object(s.e)(),n=Object(o.y)(c);if(!n)return;const{threadId:r}=n;e.replyingTo||r===i.MAIN_THREAD_ID||(e.replyingTo=Object(o.Bb)(c,e.chat.id,r)),await Object(j.a)("sendMessage",e,a),a&&t&&w.delete(t)}Object(s.b)("loadViewportMessages",(e,t,a)=>{const{direction:s=l.e.Around,isBudgetPreload:n=!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.Eb)(e,i,d),m=Object(o.X)(e,i,d),h=Object(o.db)(e,i,d);if(u&&u.length&&s!==l.e.Around){const a=s===l.e.Backwards?u[0]:u[u.length-1],c=Boolean(h),o=c?h:m,{newViewportIds:O,areSomeLocal:j,areAllLocal:g}=S(o,a,s);if(j&&(e=Object(r.x)(e,i,d,O)),async function(e,t,a,s,c,n,r,o){t||await M(c,n,o,r,a,s);s||(await Promise.resolve(),e.loadViewportMessages({chatId:c.id,threadId:n,direction:r,isBudgetPreload:!0}))}(t,g,c,n,b,d,s,a),n)return}else{const t=Object(o.H)(e,i)||Object(o.ib)(e,i,d),a=Boolean(t&&m&&!m.includes(t)),s=(a?h:m)||[],{newViewportIds:u,areSomeLocal:O,areAllLocal:j}=S(s,t,l.e.Around);O&&u.length>=c.U&&(e=Object(r.x)(e,i,d,u)),j||M(b,d,t,l.e.Around,a,n)}return e}),Object(s.b)("loadMessage",(e,t,a)=>{const{chatId:c,messageId:n,replyOriginForId:l}=a,b=Object(o.f)(e,c);b&&async function(e,t,a){const c=await Object(j.a)("fetchMessage",{chat:e,messageId:t});if(!c)return;if(c===i.MESSAGE_DELETED){if(a){let t=Object(s.e)();const c=Object(o.k)(t,e.id,a);t=Object(r.J)(t,e.id,a,{...c,replyToMessageId:void 0}),Object(s.g)(t)}return}let n=Object(s.e)();n=Object(r.J)(n,e.id,t,c.message),n=Object(r.e)(n,Object(d.c)(c.users,"id")),Object(s.g)(n)}(b,n,l)}),Object(s.b)("sendMessage",(e,t,a)=>{const s=Object(o.y)(e);if(!s)return;const{chatId:n,threadId:r,type:i}=s;if("scheduled"===i&&!a.scheduledAt)return{...e,messages:{...e.messages,contentToBeScheduled:a}};const l=Object(o.f)(e,n);t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:n,threadId:r,value:!1});const b={...a,chat:l,replyingTo:Object(o.jb)(e,n,r),noWebPage:Object(o.bb)(e,n,r)},u=!a.attachments||a.attachments.length<=1,m=!u&&a.attachments&&a.attachments.length>1;if(u){const{attachments:e,...t}=b;k({...t,attachment:e?e[0]:void 0})}else if(m){const{text:e,entities:t,attachments:a,...s}=b,n=Object(d.n)(a,c.K);for(let a=0;a<n.length;a++){const[c,...r]=n[a],o=`${Date.now()}${a}`;k({...s,text:0===a?e:void 0,entities:0===a?t:void 0,attachment:c,groupedId:r.length>0?o:void 0}),r.forEach(e=>{k({...s,attachment:e,groupedId:o})})}}else{const{text:e,entities:t,attachments:a,replyingTo:s,...c}=b;e&&k({...c,text:e,entities:t,replyingTo:s}),a.forEach(e=>{k({...c,attachment:e})})}}),Object(s.b)("editMessage",(e,t,a)=>{const{text:s,entities:c}=a,n=Object(o.y)(e);if(!n)return;const{chatId:r,threadId:i,type:l}=n,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:c}),t.setEditingId({messageId:void 0}))}),Object(s.b)("cancelSendingMessage",(e,t,a)=>{const{chatId:s,messageId:c}=a,n=Object(o.k)(e,s,c),r=n&&w.get(n.previousLocalId||n.id);r&&Object(j.b)(r),t.apiUpdate({"@type":"deleteMessages",ids:[c],chatId:s})}),Object(s.b)("saveDraft",(e,t,a)=>{const{chatId:s,threadId:c,draft:n}=a;if(!n)return;const{text:l,entities:d}=n,b=Object(o.f)(e,s);return c===i.MAIN_THREAD_ID&&Object(j.a)("saveDraft",{chat:b,text:l,entities:d,replyToMsgId:Object(o.jb)(e,s,c)}),Object(r.v)(e,s,c,"draft",n)}),Object(s.b)("clearDraft",(e,t,a)=>{const{chatId:s,threadId:c,localOnly:n}=a;if(!Object(o.B)(e,s,c))return;const l=Object(o.f)(e,s);return n||c!==i.MAIN_THREAD_ID||Object(j.a)("clearDraft",l),Object(r.v)(e,s,c,"draft",void 0)}),Object(s.b)("toggleMessageWebPage",(e,t,a)=>{const{chatId:s,threadId:c,noWebPage:n}=a;return Object(r.v)(e,s,c,"noWebPage",n)}),Object(s.b)("pinMessage",(e,t,a)=>{const s=Object(o.r)(e);if(!s)return;const{messageId:c,isUnpin:n,isOneSide:r,isSilent:i}=a;Object(j.a)("pinMessage",{chat:s,messageId:c,isUnpin:n,isOneSide:r,isSilent:i})}),Object(s.b)("unpinAllMessages",(e,t,a)=>{const c=Object(o.f)(e,a.chatId);c&&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)}(c)}),Object(s.b)("deleteMessages",(e,t,a)=>{const{messageIds:s,shouldDeleteForAll:c}=a,n=Object(o.y)(e);if(!n)return;const{chatId:r,threadId:i}=n,l=Object(o.f)(e,r);Object(j.a)("deleteMessages",{chat:l,messageIds:s,shouldDeleteForAll:c});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,c=Object(o.y)(e);if(!c)return;const{chatId:n}=c,r=Object(o.f)(e,n);Object(j.a)("deleteScheduledMessages",{chat:r,messageIds:s});const i=Object(o.E)(e,n);s.includes(i)&&t.setEditingId({messageId:void 0})}),Object(s.b)("deleteHistory",(e,t,a)=>{const{chatId:s,maxId:c,shouldDeleteForAll:n}=a,r=Object(o.f)(e,s);r&&Object(j.a)("deleteHistory",{chat:r,shouldDeleteForAll:n,maxId:c})}),Object(s.b)("markMessageListRead",(e,t,a)=>{const s=Object(o.y)(e);if(!s)return;const{chatId:c,threadId:n}=s,r=Object(o.Ab)(e,c,n);if(!r)return;const{maxId:i}=a;Object(j.a)("markMessageListRead",{chat:r,threadId:n,maxId:i})}),Object(s.b)("markMessagesRead",(e,t,a)=>{const s=Object(o.r)(e);if(!s)return;const{messageIds:c}=a;Object(j.a)("markMessagesRead",{chat:s,messageIds:c})}),Object(s.b)("loadWebPagePreview",(e,t,a)=>{const{text:c}=a;!async function(e){const t=await Object(j.a)("fetchWebPagePreview",{message:e});Object(s.g)({...Object(s.e)(),webPagePreview:t})}(c)}),Object(s.b)("clearWebPagePreview",e=>{if(e.webPagePreview)return{...e,webPagePreview:void 0}}),Object(s.b)("sendPollVote",(e,t,a)=>{const{chatId:s,messageId:c,options:n}=a,r=Object(o.f)(e,s);r&&Object(j.a)("sendPollVote",{chat:r,messageId:c,options:n})}),Object(s.b)("loadPollOptionResults",(e,t,a)=>{const{chat:c,messageId:n,option:o,offset:i,limit:l,shouldResetVoters:b}=a;!async function(e,t,a,c,n,o){const i=await Object(j.a)("loadPollOptionResults",{chat:e,messageId:t,option:a,offset:c,limit:n});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||""}}})}(c,n,o,i,l,b)}),Object(s.b)("forwardMessages",e=>{const{fromChatId:t,messageIds:a,toChatId:c}=e.forwardMessages,n=t?Object(o.f)(e,t):void 0,r=c?Object(o.f)(e,c):void 0,i=t&&a?a.sort((e,t)=>e-t).map(a=>Object(o.k)(e,t,a)).filter(Boolean):void 0;n&&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:{}})}(n,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:c,messages:n}=a,o=Object(d.c)(n,"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,c),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:c}=a,n=Object(o.f)(e,s);n&&Object(j.a)("sendScheduledMessages",{chat:n,ids:[c]})}),Object(s.b)("rescheduleMessage",(e,t,a)=>{const{chatId:s,messageId:c,scheduledAt:n}=a,r=Object(o.f)(e,s),i=r&&Object(o.mb)(e,r.id,c);r&&i&&Object(j.a)("rescheduleMessage",{chat:r,message:i,scheduledAt:n})}),Object(s.b)("requestThreadInfoUpdate",(e,t,a)=>{const{chatId:s,threadId:c}=a,n=Object(o.Ab)(e,s,c);n&&Object(j.a)("requestThreadInfoUpdate",{chat:n,threadId:c})}),Object(s.b)("loadPinnedMessages",(e,t,a)=>{const{chatId:c}=a,n=Object(o.f)(e,c);n&&async function(e){const t=await Object(j.a)("fetchPinnedMessages",{chat:e});if(!t)return;const{messages:a,chats:c,users:n}=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)(n,"id")),b=Object(r.c)(b,Object(d.c)(c,"id")),Object(s.g)(b)}(n)}),Object(s.b)("loadMessageLink",(e,t,a)=>{const{messageId:s,chatId:c}=a,n=Object(o.f)(e,c),r=Object(o.k)(e,c,s);n&&r&&(async()=>{const e=await Object(j.a)("fetchMessageLink",{chat:n,message:r});e&&Object(E.c)(e.link)})()});var N=a(48);const P=Object(g.g)(e=>e(),500,!1);async function T(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:c}=a;let{stickerSetAccessHash:n}=a;if(!n){const t=Object(o.ub)(e,c);if(!t)return;n=t.accessHash}!async function(e,t){const a=await Object(j.a)("fetchStickers",{stickerSetId:e,accessHash:t});if(!a)return;const{set:c,stickers:n,packs:o}=a;let i=Object(s.e)();i=Object(r.fb)(i,c.id,{...c,stickers:n,packs:o});const l=i.stickers.forEmoji.emoji;l&&o[l]&&(i=Object(r.n)(i));Object(s.g)(i)}(c,n)}),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:c}=a;c&&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})}(c)}),Object(s.b)("toggleStickerSet",(e,t,a)=>{const{stickerSetId:s}=a,c=Object(o.ub)(e,s);if(!c)return;const{accessHash:n,installedDate:r}=c;Object(j.a)(r?"uninstallStickerSet":"installStickerSet",{stickerSetId:s,accessHash:n})}),Object(s.b)("setStickerSearchQuery",(e,t,a)=>{const{query:c}=a;c&&P(()=>{!async function(e,t=0){const a=await Object(j.a)("searchStickers",{query:e,hash:t});if(!a)return;const c=Object(s.e)(),{setsById:n,added:o}=c.stickers,i=a.sets.map(({id:e})=>e);o.setIds&&o.setIds.forEach(t=>{if(!i.includes(t)){const{title:a}=n[t]||{};a&&Object(N.a)(a,e)&&i.unshift(t)}});Object(s.g)(Object(r.gb)(c,"search",a.hash,a.sets,i))}(c)})}),Object(s.b)("setGifSearchQuery",(e,t,a)=>{const{query:s}=a;"string"==typeof s&&P(()=>{T(s)})}),Object(s.b)("searchMoreGifs",e=>{const{query:t,offset:a}=e.gifs.search;"string"==typeof t&&P(()=>{T(t,a)})}),Object(s.b)("loadStickersForEmoji",(e,t,a)=>{const{emoji:c}=a,{hash:n}=e.stickers.forEmoji;P(()=>{!async function(e,t=0){let a=Object(s.e)();Object(s.g)({...a,stickers:{...a.stickers,forEmoji:{...a.stickers.forEmoji,emoji:e}}});const c=await Object(j.a)("fetchStickersForEmoji",{emoji:e,hash:t});if(a=Object(s.e)(),!c||a.stickers.forEmoji.emoji!==e)return;a=Object(r.hb)(a,e,c.stickers,c.hash),Object(s.g)(a)}(c,n)})}),Object(s.b)("clearStickersForEmoji",e=>({...e,stickers:{...e.stickers,forEmoji:{}}}));var A=a(33);const x=Object(g.g)(e=>e(),500,!1);async function R(e="",t,a,n,i,l){let b;if(n){const s=await Object(j.a)("searchMessagesLocal",{chatOrUser:n,query:e,type:t,limit:c.x,offsetId:a,minDate:l,maxDate:i});if(s){const{messages:e,users:t,totalCount:a,nextOffsetId:c}=s;b={messages:e,users:t,chats:[],totalCount:a,nextRate:c}}}else b=await Object(j.a)("searchMessagesGlobal",{query:e,offsetRate:a,limit:c.x,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 L(){const e=await Object(j.a)("fetchChats",{limit:c.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 F(){let e=Object(s.e)();const{recentlyFoundChatIds:t}=e.globalSearch,{userIds:a}=e.contactList||{};if(!(a&&a.length||t&&t.length))return;const c=[...t||[],...a||[]].map(t=>Object(o.Db)(e,t)).filter(Boolean),n=await Object(j.a)("fetchUsers",{users:c});n&&(e=Object(s.e)(),e=Object(r.mb)(e,Object(d.c)(n,"id")),Object(s.g)(e))}Object(s.b)("setGlobalSearchQuery",(e,t,a)=>{const{chatId:c}=e.globalSearch,{query:n}=a;n&&!c&&x(()=>{!async function(e){const t=await Object(j.a)("searchChats",{query:e});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:n,localUsers:i,globalChats:l,globalUsers:b}=t;(n.length||l.length)&&(a=Object(r.c)(a,Object(d.c)([...n,...l],"id")));(i.length||b.length)&&(a=Object(r.e)(a,Object(d.c)([...i,...b],"id")));a=Object(r.R)(a,{chats:!1}),a=Object(r.P)(a,{localResults:{chatIds:n.map(({id:e})=>e),userIds:i.map(({id:e})=>e)},globalResults:{...a.globalSearch.globalResults,chatIds:b.map(({id:e})=>e),userIds:l.map(({id:e})=>e)}}),Object(s.g)(a)}(n)})}),Object(s.b)("setGlobalSearchDate",(e,t,a)=>{const{date:c}=a,n=c?Object(A.m)(c):c,i=Object(r.P)(e,{date:c,query:"",resultsByType:{...e.globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}});Object(s.g)(i);const{chatId:l}=e.globalSearch;R("","text",void 0,l?Object(o.f)(e,l):void 0,n,c)}),Object(s.b)("searchMessagesGlobal",(e,t,a)=>{const{query:s,resultsByType:c,chatId:n,date:r}=e.globalSearch,i=r?Object(A.m)(r):r,{type:l}=a,{nextOffsetId:d}=c&&c[l]||{};R(s,l,d,n?Object(o.f)(e,n):void 0,i,r)}),Object(s.b)("searchTextMessagesLocal",e=>{const{chatId:t,threadId:a}=Object(o.y)(e)||{},n=t?Object(o.f)(e,t):void 0,l=Object(o.A)(e);if(!n||!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.zb)(e,t,a);h=s?s.topMessageId:void 0}!async function(e,t,a,n,i){const l=await Object(j.a)("searchMessagesLocal",{chatOrUser:e,type:"text",query:n,topMessageId:a,limit:c.W,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||n&&n!==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)}(n,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,n=Object(o.v)(e);if(!a||!n)return;const{currentType:i,resultsByType:l}=n,b=i&&l&&l[i],u=b?b.nextOffsetId:void 0;i&&async function(e,t,a){const n=await Object(j.a)("searchMessagesLocal",{chatOrUser:e,type:t,limit:c.mb,offsetId:a});if(!n)return;const{messages:i,users:l,totalCount:b,nextOffsetId:u}=n,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:c}=a,{chatId:n}=Object(o.y)(e)||{};if(!n)return;const r=Object(o.f)(e,n);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,c)}),Object(s.b)("checkPublicLink",(e,t,a)=>{const{chatId:c}=Object(o.y)(e)||{};if(!c)return;if(e.management.progress===l.f.InProgress)return;const{username:n}=a;(async()=>{e=Object(r.Z)(e,l.f.InProgress),e=Object(r.Y)(e,c,{isUsernameAvailable:void 0}),Object(s.g)(e);const t=await Object(j.a)("checkChatUsername",{username:n});e=Object(s.e)(),e=Object(r.Z)(e,t?l.f.Complete:l.f.Error),e=Object(r.Y)(e,c,{isUsernameAvailable:t}),Object(s.g)(e)})()}),Object(s.b)("updatePublicLink",(e,t,a)=>{const{chatId:c}=Object(o.y)(e)||{};let n=c&&Object(o.f)(e,c);if(!c||!n)return;const{username:i}=a;(async()=>{if(e=Object(r.Z)(e,l.f.InProgress),Object(s.g)(e),Object(m.ib)(n)){if(n=await Object(j.a)("migrateChat",n),!n)return;t.openChat({id:n.id})}const a=await Object(j.a)("setChatUsername",{chat:n,username:i});e=Object(s.e)(),e=Object(r.Z)(e,a?l.f.Complete:l.f.Error),e=Object(r.Y)(e,c,{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){c.o&&console.log(">>> START SYNC");await Object(j.a)("fetchCurrentUser");const t=await async function(){const e=await Object(j.a)("fetchChats",{limit:c.i,withPinned:!0});if(!e)return;let t=Object(s.e)();const{recentlyFoundChatIds:a}=t.globalSearch,{userIds:n}=t.contactList||{},{currentUserId:l}=t,b=[...a||[],...n||[],...l?[l]:[]],u=b.map(e=>Object(o.Db)(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.Db)(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||[],n=Object(s.e)();const{chatId:l}=Object(o.y)(n)||{},b=Object.keys(n.messages.byChatId).map(Number).reduce((e,t)=>{const a=Object(o.B)(n,t,i.MAIN_THREAD_ID);return a?{...e,[t]:a}:e},{});if(l){const e=await(u=n.chats.byId[l],Object(j.a)("fetchMessages",{chat:u,threadId:i.MAIN_THREAD_ID,offsetId:u.lastReadInboxMessageId,addOffset:-(Math.round(c.U/2)+1),limit:c.U}));n=Object(s.e)();const{chatId:b}=Object(o.y)(n)||{};if(e&&b===l){const s=n.messages.byChatId[l],c=Object(d.c)(e.messages,"id"),o=Object.keys(c).map(Number);n={...n,messages:{...n.messages,byChatId:{[l]:{byId:c,threadsById:{[i.MAIN_THREAD_ID]:{...s&&s.threadsById[i.MAIN_THREAD_ID],listedIds:o,viewportIds:o,outlyingIds:void 0}}}}}},n=Object(r.K)(n,Object(d.c)(e.chats,"id")),n=Object(r.jb)(n,l,e.threadInfos),t=!0,a=Array.prototype.concat(a,e.users)}}var u;t||(n={...n,messages:{...n.messages,byChatId:{}}});Object.keys(b).map(Number).forEach(e=>{n=Object(r.v)(n,e,i.MAIN_THREAD_ID,"draft",b[e])}),e?n=Object(r.w)(n,Object(d.c)(a,"id")):a&&(n=Object(r.mb)(n,Object(d.c)(a,"id")));Object(s.g)(n)}(t),Object(s.g)({...Object(s.e)(),lastSyncTime:Date.now()}),c.o&&console.log(">>> FINISH SYNC");e()}(t.afterSync)}),Object(s.b)("afterSync",(e,t)=>{!async function(e){c.o&&console.log(">>> START AFTER-SYNC");e.loadFavoriteStickers(),await Promise.all([F(),L()]),await Object(j.a)("fetchCurrentUser"),c.o&&console.log(">>> FINISH AFTER-SYNC")}(t)});const D=Object(g.a)(e=>e(),500,!1,!0);function B(e,{visibility:t,allowedIds:a,deniedIds:s}){const{users:{byId:c},chats:{byId:n}}=e,r={visibility:t};let o,i;const l=e=>{if(!Object(m.lb)(e))return;const{id:t,accessHash:a}=c[e]||{};return t?{id:t,accessHash:a}:void 0},d=e=>{if(Object(m.lb)(e))return;const t=n[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,c=Object(o.Db)(e,s);if(!c)return;const{id:n,accessHash:r}=c;D(()=>Object(j.a)("fetchFullUser",{id:n,accessHash:r}))}),Object(s.b)("loadUser",(e,t,a)=>{const{userId:c}=a,n=Object(o.Db)(e,c);n&&(async()=>{const t=await Object(j.a)("fetchUsers",{users:[n]});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:c,users:n}=t;let o=Object(s.e)();o=Object(r.e)(o,Object(d.c)(n,"id")),o={...o,topPeers:{...o.topPeers,hash:a,userIds:c,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 c=e=>e.lastName||e.firstName||"",n=new Intl.Collator("en-US"),o=t.users.sort((e,t)=>n.compare(c(e),c(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:c,isMuted:n,firstName:i,lastName:d}=a;!async function(e,t,a,c){const n=Object(s.e)(),i=Object(o.Db)(n,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:c})&&Object(s.g)(Object(r.lb)(Object(s.e)(),i.id,{firstName:a,lastName:c}));Object(s.g)(Object(r.Z)(Object(s.e)(),l.f.Complete))}(c,n,i,d)}),Object(s.b)("deleteUser",(e,t,a)=>{const{userId:c}=a;!async function(e){const t=Object(s.e)(),a=Object(o.Db)(t,e);if(!a)return;const{id:c,accessHash:n}=a;await Object(j.a)("deleteUser",{id:c,accessHash:n})}(c)}),Object(s.b)("loadProfilePhotos",(e,t,a)=>{const{profileId:c}=a,n=Object(m.lb)(c),i=n?Object(o.Db)(e,c):void 0,l=n?void 0:Object(o.f)(e,c);(async()=>{const e=await Object(j.a)("fetchProfilePhotos",i,l);if(!e||!e.photos)return;let t=Object(s.e)();n?t=Object(r.lb)(t,c,{photos:e.photos}):(t=Object(r.e)(t,Object(d.c)(e.users,"id")),t=Object(r.F)(t,c,{photos:e.photos})),Object(s.g)(t)})()}),Object(s.b)("clickInlineButton",(e,t,a)=>{const{button:n}=a;switch(n.type){case"command":t.sendBotCommand({command:n.value});break;case"url":n.value.match(c.gb)||n.value.match(c.hb)?t.openTelegramLink({url:n.value}):window.open(n.value);break;case"callback":{const t=Object(o.r)(e);if(!t)return;!async function(e,t,a){const c=await Object(j.a)("answerCallbackButton",{chatId:e.id,accessHash:e.accessHash,messageId:t,data:a});if(!c||!c.message)return;const{message:n,alert:r}=c;r?Object(s.d)().showError({error:{message:n}}):Object(s.d)().showNotification({message:n})}(t,n.messageId,n.value);break}case"requestPoll":t.openPollModal();break;case"buy":{const a=Object(o.r)(e),{messageId:s,value:c}=n;if(!a)return;c?t.getReceipt({receiptMessageId:c,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:c}=e,n=Object(o.r)(e);c&&n&&async function(e,t,a){await Object(j.a)("sendMessage",{chat:e,text:a})}(n,0,s)}),Object(s.b)("updateProfile",(e,t,a)=>{const{photo:c,firstName:n,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}}),c&&await Object(j.a)("updateProfilePhoto",c),n||i||d){if(await Object(j.a)("updateProfile",{firstName:n,lastName:i,about:d})){e=Object(s.e)();const a=t&&Object(o.Db)(e,t);a&&Object(s.g)(Object(r.lb)(e,a.id,{firstName:n,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:c}=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",c);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 c=a,n=URL.createObjectURL(c);Object(s.g)({...e,settings:{...e.settings,loadedWallpapers:[{slug:l.n,document:{fileName:"",size:c.size,mimeType:c.type,previewBlobUrl:n}},...e.settings.loadedWallpapers||[]]}}),(async()=>{const t=await Object(j.a)("uploadWallpaper",c);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:n}};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:c}=a;(async()=>{if(!await Object(j.a)("blockContact",c))return;const e=Object(s.e)();Object(s.g)(Object(r.a)(e,c))})()}),Object(s.b)("unblockContact",(e,t,a)=>{const{contactId:c}=a;let n;if(Object(m.lb)(c)){const t=Object(o.Db)(e,c);if(!t)return;n=t.accessHash}(async()=>{if(!await Object(j.a)("unblockContact",c,n))return;const e=Object(s.e)();Object(s.g)(Object(r.o)(e,c))})()}),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:c}=a;(async()=>{if(!await Object(j.a)("terminateAuthorization",c))return;const e=Object(s.e)();Object(s.g)({...e,activeSessions:e.activeSessions.filter(e=>e.hash!==c)})})()}),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:c,isSilent:n,isShowPreviews:o}=a;(async()=>{await Object(j.a)("updateNotificationSettings",c,{isSilent:n,isShowPreviews:o})&&Object(s.g)(Object(r.ab)(Object(s.e)(),c,n,o))})()}),Object(s.b)("updateContactSignUpNotification",(e,t,a)=>{const{isSilent:c}=a;(async()=>{await Object(j.a)("updateContactSignUpNotification",c)&&Object(s.g)(Object(r.u)(Object(s.e)(),{hasContactJoinedNotifications:!c}))})()}),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,c,n]=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&&c&&n))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=c,r.settings.privacy.chatInvite=n,Object(s.g)(r)})()}),Object(s.b)("setPrivacyVisibility",(e,t,a)=>{const{privacyKey:c,visibility:n}=a,{privacy:{[c]:r}}=e.settings;if(!r)return;const o=B(e,{visibility:n,allowedIds:[...r.allowUserIds,...r.allowChatIds],deniedIds:[...r.blockUserIds,...r.blockChatIds]});(async()=>{const e=await Object(j.a)("setPrivacySettings",c,o);if(e){const t=Object(s.e)();t.settings.privacy[c]=e,Object(s.g)(t)}})()}),Object(s.b)("setPrivacySettings",(e,t,a)=>{const{privacyKey:c,isAllowList:n,contactsIds:r}=a,{privacy:{[c]:o}}=e.settings;if(!o)return;const i=B(e,{visibility:o.visibility,allowedIds:n?r:[...o.allowUserIds,...o.allowChatIds],deniedIds:n?[...o.blockUserIds,...o.blockChatIds]:r});(async()=>{const e=await Object(j.a)("setPrivacySettings",c,i);if(e){const t=Object(s.e)();t.settings.privacy[c]=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:c,onSuccess:n}=a;Object(s.g)(Object(r.kb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("checkPassword",c);Object(s.g)(Object(r.kb)(Object(s.e)(),{isLoading:!1})),e&&n()})()}),Object(s.b)("clearPassword",(e,t,a)=>{const{currentPassword:c,onSuccess:n}=a;Object(s.g)(Object(r.kb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("clearPassword",c);Object(s.g)(Object(r.kb)(Object(s.e)(),{isLoading:!1})),e&&n()})()}),Object(s.b)("updatePassword",(e,t,a)=>{const{currentPassword:c,password:n,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",c,n,o,i);Object(s.g)(Object(r.kb)(Object(s.e)(),{isLoading:!1})),e&&l()})()}),Object(s.b)("updateRecoveryEmail",(e,t,a)=>{const{currentPassword:c,email:n,onSuccess:o}=a;Object(s.g)(Object(r.kb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("updateRecoveryEmail",c,n);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 U=a(56);Object(s.b)("validateRequestedInfo",(e,t,a)=>{const{requestInfo:c,saveInfo:n}=a,i=Object(o.eb)(e);i&&async function(e,t,a){const c=await Object(j.a)("validateRequestedInfo",{messageId:e,requestInfo:t,shouldSave:a});if(!c)return;const{id:n,shippingOptions:o}=c;if(!n)return;let i=Object(r.C)(Object(s.e)(),n);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,c,n)}),Object(s.b)("getPaymentForm",(e,t,a)=>{const{messageId:c}=a;c&&async function(e){const t=await Object(j.a)("getPaymentForm",{messageId:e});if(!t)return;let a=Object(r.z)(Object(s.e)(),t),c=l.i.PaymentInfo;a.payment.invoice&&(a.payment.invoice.shippingAddressRequested||a.payment.invoice.nameRequested||a.payment.invoice.phoneRequested||a.payment.invoice.emailRequested)&&(c=l.i.ShippingInfo);a=Object(r.A)(a,c),Object(s.g)(a)}(c)}),Object(s.b)("getReceipt",(e,t,a)=>{const{receiptMessageId:c,chatId:n,messageId:i}=a;i&&c&&n&&async function(e,t,a){const c=await Object(j.a)("getReceipt",t);if(!c)return;let n=Object(s.e)();const i=Object(o.k)(n,a,e);n=Object(r.B)(n,c,i),Object(s.g)(n)}(i,c,n)}),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 c=Object(o.hb)(e);if(!c)return;const{credentials:n}=a,{data:i}=n;!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}),c=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}}),n=await c.json();if(n.error){const e=Object(U.b)(n.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:n.type,id:n.id});o=Object(r.A)(o,l.i.Checkout),Object(s.g)(o)}(i,c)}),Object(s.b)("sendPaymentForm",(e,t,a)=>{const{shippingOptionId:c,saveCredentials:n}=a,i=Object(o.eb)(e),l=Object(o.fb)(e),d=Object(o.hb)(e),b=Object(o.wb)(e);i&&d&&async function(e,t,a,c){if(await Object(j.a)("sendPaymentForm",{messageId:e,credentials:t,requestedInfoId:a,shippingOptionId:c})){const e=Object(r.g)(Object(s.e)());Object(s.g)(Object(r.h)(e))}}(i,{save:n,data:b},l,c)}),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(79);var H=a(26);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,a.newProfilePhoto));break;case"updateChatJoin":{const c=Object(o.j)(e,a.id);if(!c)break;e=Object(r.G)(e,c,[a.id]),e=Object(r.F)(e,a.id,{isNotJoined:!1}),Object(s.g)(e);const n=Object(o.f)(e,a.id);n&&t.requestChatUpdate({chatId:n.id});break}case"updateChatLeave":{const t=Object(o.j)(e,a.id);if(!t)break;const{[t]:c}=e.chats.listIds;c&&(e=Object(r.q)(e,t,c.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:c}=a;Object(s.g)(Object(r.F)(e,t,{typingStatus:c})),setTimeout(()=>{const e=Object(s.e)(),a=Object(o.f)(e,t);a&&c&&a.typingStatus&&a.typingStatus.timestamp===c.timestamp&&Object(s.g)(Object(r.F)(e,t,{typingStatus:void 0}))},6e3);break}case"newMessage":{const{message:c}=a,{chatId:n}=Object(o.y)(e)||{};if(c.senderId===e.currentUserId&&!c.isFromScheduled)return;const i=Object(o.f)(e,a.chatId);if(!i)return;const l=a.chatId===n;l?setTimeout(()=>{t.requestChatUpdate({chatId:a.chatId})},1e3):Object(s.g)(Object(r.F)(e,a.chatId,{unreadCount:i.unreadCount?i.unreadCount+1:1,...a.message.hasUnreadMention&&{unreadMentionsCount:i.unreadMentionsCount?i.unreadMentionsCount+1:1}})),Object(H.b)({chat:i,message:c,isActiveChat:l});break}case"updateCommonBoxMessages":case"updateChannelMessages":{const{ids:t,messageUpdate:c}=a;if(!1!==c.hasUnreadMention)return;t.forEach(t=>{const s="channelId"in a?a.channelId:Object(o.p)(e,t),c=Object(o.f)(e,s);c&&c.unreadMentionsCount&&(e=Object(r.F)(e,s,{unreadMentionsCount:c.unreadMentionsCount-1}))}),Object(s.g)(e);break}case"updateChatFullInfo":{const{fullInfo:t}=a,c=e.chats.byId[a.id];if(!c)return;Object(s.g)(Object(r.F)(e,a.id,{fullInfo:{...c.fullInfo,...t}}));break}case"updatePinnedChatIds":{const{ids:t,folderId:n}=a,r=n===c.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:n}=a,r=Object(o.j)(e,t);if(r){const{[r]:a}=e.chats.orderedPinnedIds;let s=a||[];if(n){if(!s.includes(t)){if("active"===r&&s.length>=c.J){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:c}=a;Object(s.g)(Object(r.I)(e,t,c));break}case"updateChatFolder":{const{id:t,folder:c}=a,{byId:n,orderedIds:r}=e.chatFolders,o=c?{...n,[t]:c}:Object(d.l)(n,Object.keys(n).map(Number).filter(e=>e!==t)),i=c?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:c,addedMember:n,deletedMemberId:o}=a;if(!t)return;let i=!1,l=t.fullInfo&&t.fullInfo.members?[...t.fullInfo.members]:[];if(c)l=c,i=!0;else if(n)l.length&&l.some(e=>e.userId===n.userId)||(l.push(n),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 c=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:c}}))}break}case"deleteProfilePhotos":{const{chatId:t,ids:c}=a,n=e.chats.byId[t];n&&n.photos&&Object(s.g)(Object(r.F)(e,t,{photos:n.photos.filter(e=>!c.includes(e.id))}));break}}});function q(e,t,a,s,c=!1){const n=c?Object(o.mb)(e,t,a):Object(o.k)(e,t,a);if(n&&s.content){const{photo:e,video:t,sticker:a,document:c}=Object(m.v)(n);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:c&&s.content.document&&(s.content.document.previewBlobUrl=c.previewBlobUrl)}return c?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:c,firstMessageId:n}=Object(o.yb)(e,s,t)||{};return!n&&Object(m.sb)(t)||c&&(e=Object(r.T)(e,s,c.threadId,[a]),Object(o.W)(e,s,c.threadId)&&(e=Object(r.f)(e,s,c.threadId,a),n||(e=Object(r.v)(e,s,c.threadId,"firstMessageId",t.id)),c.lastMessageId||(e=Object(r.v)(e,s,c.threadId,"threadInfo",{...c,lastMessageId:t.id})))),e}function _(e,t,a,s=!1){const{chats:c}=e,n=c.byId[t]&&c.byId[t].lastMessage;if(n&&!s){if(!(n.id===a.id||n.id===a.previousLocalId||a.id>n.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 c=s.length;for(;c--;){const e=a[s[c]];if(!e.isDeleting)return e}}function V(e,t,a,c){if(e){t.forEach(t=>{const a=z(c=Object(r.J)(c,e,t,{isDeleting:!0}),e);a&&(c=_(c,e,a,!0))}),Object(s.g)(c),a.requestChatUpdate({chatId:e});const n=[];return t.forEach(t=>{const a=Object(o.k)(c,e,t);if(!a)return;const{threadInfo:s}=Object(o.yb)(c,e,a)||{};s&&n.push(s.threadId)}),Object(d.o)(n).forEach(t=>{a.requestThreadInfoUpdate({chatId:e,threadId:t})}),void setTimeout(()=>{Object(s.g)(Object(r.i)(Object(s.e)(),e,t))},350)}const n=[];t.forEach(e=>{const t=Object(o.p)(c,e);if(t){n.push(t);const a=z(c=Object(r.J)(c,t,e,{isDeleting:!0}),t);a&&(c=_(c,t,a,!0)),setTimeout(()=>{Object(s.g)(Object(r.i)(Object(s.e)(),t,[e]))},350)}}),Object(s.g)(c),Object(d.o)(n).forEach(e=>{a.requestChatUpdate({chatId:e})})}Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"newMessage":{const{chatId:c,id:n,message:i}=a;e=G(e=q(e,c,n,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,c,n);if(Object(o.a)(e,c,i)){if(i.isOutgoing&&(!i.content||!i.content.action)){const a=Object(o.y)(e);a&&t.focusMessage({chatId:c,threadId:a.threadId,messageId:i.id,noHighlight:!0})}const{threadInfo:a}=Object(o.yb)(e,c,i)||{};a&&t.requestThreadInfoUpdate({chatId:c,threadId:a.threadId}),i.isOutgoing||setTimeout(()=>{Object(s.g)(_(Object(s.e)(),c,l))},350)}else Object(s.g)(_(Object(s.e)(),c,l));Object(o.L)(e,c)||t.loadTopChats();break}case"newScheduledMessage":{const{chatId:t,id:c,message:n}=a;e=q(e,t,c,n,!0);const l=Object(o.lb)(e,t)||[];e=Object(r.v)(e,t,i.MAIN_THREAD_ID,"scheduledIds",Object(d.o)([...l,c])),Object(s.g)(e);break}case"updateMessage":{const{chatId:t,id:c,message:n}=a;if(!Object(o.k)(e,t,c))return;e=q(e,t,c,n);const i=Object(o.k)(e,t,c);n.threadInfo&&(e=Object(r.ib)(e,n.threadInfo.chatId,n.threadInfo.threadId,n.threadInfo)),e=_(e,t,i),Object(s.g)(e);break}case"updateScheduledMessage":{const{chatId:t,id:c,message:n}=a;if(!Object(o.mb)(e,t,c))return;e=q(e,t,c,n,!0);const l=Object.keys(Object(o.nb)(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:c,message:n}=a;e=G(e,n);const i=Object(o.k)(e,t,c);e=Object(r.i)(e,t,[c]),n.isScheduled&&(e=Object(r.j)(e,t,[c])),e=Object(r.J)(e,t,n.id,{...i,...n,previousLocalId:c});const l=Object(o.k)(e,t,n.id);e=_(e,t,l),Object(s.g)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:c,message:n}=a,l=Object(o.lb)(e,t)||[];e=Object(r.v)(e,t,i.MAIN_THREAD_ID,"scheduledIds",[...l,n.id]);const d=Object(o.mb)(e,t,c);e=Object(r.j)(e,t,[c]),e=Object(r.cb)(e,t,n.id,{...d,...n,previousLocalId:c}),Object(s.g)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:c,messageIds:n}=a,l=Object(o.gb)(e,t)||[],d=c?[...l,...n]:l.filter(e=>!n.includes(e));Object(s.g)(Object(r.v)(e,t,i.MAIN_THREAD_ID,"pinnedIds",d));break}case"updateThreadInfo":{const{chatId:t,threadId:c,threadInfo:n}=a,i={...Object(o.zb)(e,t,c),...n};if(!i.threadId)return;e=Object(r.ib)(e,t,c,i),Object(s.g)(e);break}case"resetMessages":{const{id:c}=a,n=Object(o.m)(e,c);n&&!Object(m.lb)(c)&&(e=Object(r.i)(e,c,Object.keys(n).map(Number)),Object(s.g)(e),t.loadFullChat({chatId:c,force:!0}));break}case"deleteMessages":{const{ids:s,chatId:c}=a;V(c,s,t,e);break}case"deleteScheduledMessages":{const{ids:t,chatId:c}=a;!function(e,t,a,c){if(!e)return;t.forEach(t=>{c=Object(r.cb)(c,e,t,{isDeleting:!0})}),Object(s.g)(c),setTimeout(()=>{c=Object(r.j)(Object(s.e)(),e,t);const a=Object(o.nb)(c,e);c=Object(r.v)(c,e,i.MAIN_THREAD_ID,"scheduledIds",Object.keys(a||{}).map(Number)),Object(s.g)(c)},350)}(c,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:c}=a;t.forEach(t=>{const a=Object(o.p)(e,t);a&&(e=Object(r.J)(e,a,t,c))}),Object(s.g)(e);break}case"updateChannelMessages":{const{channelId:t,ids:c,messageUpdate:n}=a;c.forEach(a=>{e=Object(r.J)(e,t,a,n)}),Object(s.g)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:c}=a,n=Object(o.l)(e,t);if(n&&n.content.poll){const t={...n.content.poll,...c},{results:a}=t.results||{};if(a&&!a.some(e=>e.isChosen)){const{results:e}=n.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,n.chatId,n.id,{content:{...n.content,poll:t}}))}break}case"updateMessagePollVote":{const{pollId:t,userId:c,options:n}=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(c),n.forEach(t=>{const a=O.find(e=>e.option===t),s=O.findIndex(e=>e.option===t),n=a?{...a}:{option:t,votersCount:0};n.votersCount+=1,c===e.currentUserId&&(n.isChosen=!0),s?O[s]=n:O.push(n)}),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}}});const $=Object(g.g)((function(){let e=Object(s.e)();W.forEach(([t,a])=>{e=Object(r.lb)(e,t,{status:a})}),Object(s.g)(e),W=[]}),3e3,!0);let W=[];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,c=a.status,W.push([s,c]),void $();case"updateUserFullInfo":{const{id:t,fullInfo:s}=a,c=e.users.byId[t];if(!c)return;return Object(r.lb)(e,t,{fullInfo:{...c.fullInfo,...s}})}}var s,c}),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 Q=a(45),K=a(7),Y=a(32),J=a(125),Z=a(44),X=a(104),ee=a(71),te=a(98),ae=a(58),se=a(37),ce=a(29),ne=a(148),re=a(134);a(188);var oe=Object(n.h)(({id:e,name:t,value:a,label:s,checked:c=!1,disabled:r,inactive:o,onChange:i,onCheck:l})=>{const d=Object(n.m)(e=>{i&&i(e),l&&l(e.currentTarget.checked)},[i,l]),b=Object(K.a)("Switcher",r&&"disabled",o&&"inactive");return n.a.createElement("label",{className:b,title:s},n.a.createElement("input",{type:"checkbox",id:e,name:t,value:a,checked:c,disabled:r,onChange:d}),n.a.createElement("span",{className:"widget"}))});a(189);const ie=[0,1,2];var le=Object(n.h)(Object(s.h)(e=>{const{query:t,fetchingStatus:a,chatId:s,date:c}=e.globalSearch,{currentUserId:n}=e,{byId:r}=e.chats,{theme:o,animationLevel:i}=e.settings.byKey;return{searchQuery:t,isLoading:!!a&&Boolean(a.chats||a.messages),currentUserId:n,chatsById:r,globalSearchChatId:s,searchDate:c,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:E})=>{const w=e===l.d.ChatList,M={date:void 0},S={id:void 0},k=Object(n.p)(()=>g?Object(A.a)(new Date(1e3*g)):void 0,[g]),N=Object(n.p)(()=>w&&I?Object.values(I).reduce((e,t)=>Object(m.hb)(t)&&t.unreadCount?e+1:e,0):0,[w,I]),P=Object(n.p)(()=>({onTrigger:e,isOpen:t})=>n.a.createElement(ce.a,{round:!0,ripple:w&&!h.f,size:"smaller",color:"translucent",className:t?"active":"",onClick:w?e:()=>d(),ariaLabel:w?"Open menu":"Return to chat list"},n.a.createElement("div",{className:Object(K.a)("animated-menu-icon",!w&&"state-back")})),[w,d]),T=Object(n.m)(()=>{b||a("")},[b,a]),x=Object(n.m)(()=>{v({id:O})},[O,v]),R=Object(n.m)(e=>{e.stopPropagation();const t="light"===f?"dark":"light",a="dark"===t;E({theme:t,customBackground:a?c.m:void 0,patternColor:a?c.n:c.s}),Object(ee.a)(t,p>0)},[p,E,f]),L=Object(n.m)(e=>{e.stopPropagation();const t=0===p?2:0;ie.forEach((e,a)=>{document.body.classList.toggle("animation-level-"+a,t===a)}),E({animationLevel:t})},[p,E]),F=Object(te.a)(),D=Boolean(j)||e===l.d.GlobalSearch||e===l.d.Contacts,B=e===l.d.Contacts?F("SearchFriends"):F("Search");return n.a.createElement("div",{className:"LeftMainHeader"},n.a.createElement("div",{id:"LeftMainHeader",className:"left-header"},n.a.createElement(ae.a,{trigger:P,footer:c.f},n.a.createElement(se.a,{icon:"saved-messages",onClick:x},F("SavedMessages")),n.a.createElement(se.a,{icon:"archive",onClick:o},n.a.createElement("span",{className:"menu-item-name"},F("ArchivedChats")),N>0&&n.a.createElement("div",{className:"archived-badge"},N)),n.a.createElement(se.a,{icon:"user",onClick:r},F("Contacts")),n.a.createElement(se.a,{icon:"settings",onClick:s},F("Settings")),n.a.createElement(se.a,{icon:"darkmode",onClick:R},n.a.createElement("span",{className:"menu-item-name"},"Dark Mode"),n.a.createElement(oe,{id:"darkmode",label:"Toggle Dark Mode",checked:"dark"===f})),n.a.createElement(se.a,{icon:"animations",onClick:L},n.a.createElement("span",{className:"menu-item-name capitalize"},F("Appearance.Animations").toLowerCase()),n.a.createElement(oe,{id:"animations",label:"Toggle Animations",checked:p>0})),n.a.createElement(se.a,{icon:"help",onClick:y},"Telegram Features"),n.a.createElement(se.a,{icon:"bug",href:c.w},"Report Bug")),n.a.createElement(ne.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&&n.a.createElement(re.a,{icon:"calendar",title:k,canClose:!0,isMinimized:Boolean(j),className:"search-date",onClick:C,clickArg:M}),j&&n.a.createElement(re.a,{chatOrUserId:j,onClick:i,canClose:!0,clickArg:S}))))})),de=a(20);a(190);var be=Object(s.h)(e=>Object(d.l)(e,["connectionState"]))(({connectionState:e})=>{const t=Object(te.a)();return"connectionStateConnecting"===e&&n.a.createElement("div",{id:"ConnectionState"},n.a.createElement(de.a,{color:"black"}),n.a.createElement("div",{className:"state-text"},t("WaitingForNetwork")))}),ue=a(126),me=a(107),he=a(34),Oe=(e,t,a)=>{const s=Object(n.q)(),c=(e=>Object(n.p)(()=>Object(g.g)(e=>e(),e),[e]))(t),r=Object(he.a)();return Object(me.a)(()=>{let t=!0;c(()=>{s.current=e(),t||r()}),t=!1},a),s.current},je=a(160),ge=a(181);var fe=Object(n.h)(Object(s.h)(e=>{const{chats:{byId:t},users:{byId:a},chatFolders:{byId:s,orderedIds:c},lastSyncTime:n}=e;return{chatsById:t,usersById:a,chatFoldersById:s,orderedFolderIds:c,lastSyncTime:n}},(e,t)=>Object(d.l)(t,["loadChatFolders"]))(({chatsById:e,usersById:t,chatFoldersById:a,orderedFolderIds:s,lastSyncTime:c,loadChatFolders:r})=>{const o=Object(n.q)(null),[i,l]=Object(n.r)(0);Object(n.n)(()=>{c&&r()},[c,r]);const b=Object(n.p)(()=>s?s.map(e=>a[e]||{}).filter(Boolean):void 0,[a,s]),u=Oe(()=>{if(!b||!b.length)return;const a=Object.keys(e).map(Number),s=b.map(s=>{const{unreadDialogsCount:c,hasActiveDialogs:n}=Object(m.p)(e,t,s,a)||{};return{id:s.id,badgeCount:c,isBadgeActive:n}});return Object(d.c)(s,"id")},3e3,[b,e,t]),O=Object(n.p)(()=>{if(b&&b.length)return[{title:"All"},...b.map(e=>({title:e.title,...u&&u[e.id]}))]},[b,u]),j=Object(n.m)(e=>{l(e)},[]);Object(n.n)(()=>{O&&O.length&&i>=O.length&&l(0)},[i,O]),Object(n.n)(()=>{if(o.current&&h.k&&O&&O.length)return Object(ue.b)(o.current,{onSwipe:(e,t)=>{t===ue.a.Left?l(Math.min(i+1,O.length-1)):t===ue.a.Right&&l(Math.max(0,i-1))}})},[i,O]);const{shouldRender:g,transitionClassNames:f}=Object(Y.a)(!s,void 0,!0),p=Object(te.a)();function I(){const e=Object.values(a).find(({title:e})=>e===O[i].title);return e&&0!==i?n.a.createElement(ge.a,{folderType:"folder",folderId:e.id,noChatsText:p("FilterNoChatsToDisplay")}):n.a.createElement(ge.a,{folderType:"all"})}return n.a.createElement("div",{className:"ChatFolders"},O&&O.length?n.a.createElement(je.a,{tabs:O,activeTab:i,onSwitchTab:j}):g?n.a.createElement("div",{className:Object(K.a)("tabs-placeholder",f)}):void 0,n.a.createElement(X.a,{ref:o,name:"slide",activeKey:i,renderCount:O?O.length:void 0},I))})),pe=a(12),Ie=a(17),ve=a(16);var ye=Object(n.h)(e=>{const t=Object(Ie.a)(pe.a.Extra,"LeftSearch");return t?n.a.createElement(t,e):n.a.createElement(ve.a,null)});var Ce=Object(n.h)(e=>{const t=Object(Ie.a)(pe.a.Extra,"ContactList");return t?n.a.createElement(t,e):n.a.createElement(ve.a,null)}),Ee=a(49);a(201);let we;var Me=Object(n.h)(({isShown:e,onNewPrivateChat:t,onNewChannel:a,onNewGroup:s})=>{const[c,r]=Object(n.r)(!1);Object(n.n)(()=>{e||r(!1)},[e]);const o=Object(te.a)(),i=Object(K.a)("NewChatButton",e&&"revealed",c&&"menu-is-open"),l=Object(n.m)(()=>{we&&(clearTimeout(we),we=void 0)},[]),d=Object(n.m)(()=>{we&&(clearTimeout(we),we=void 0),we=window.setTimeout(()=>{r(!1)},750)},[]);return n.a.createElement("div",{className:i,onMouseEnter:l,onMouseLeave:d},n.a.createElement(ce.a,{round:!0,color:"primary",className:c?"active":"",onClick:()=>{r(!c)},ariaLabel:c?"Close":"Create new chat",tabIndex:-1},n.a.createElement("i",{className:"icon-new-chat-filled"}),n.a.createElement("i",{className:"icon-close"})),n.a.createElement(Ee.a,{isOpen:c,positionX:"right",positionY:"bottom",autoClose:!0,onClose:()=>{r(!1)}},n.a.createElement(se.a,{icon:"channel",onClick:a},o("NewChannel")),n.a.createElement(se.a,{icon:"group",onClick:s},o("NewGroup")),n.a.createElement(se.a,{icon:"user",onClick:t},"New Private Chat")))});a(202);const Se=Object.keys(l.d).length/2;let ke;var Ne=Object(n.h)(({content:e,searchQuery:t,searchDate:a,contactsFilter:s,onSearchQuery:c,onContentChange:r,onReset:o})=>{const[i,d]=Object(n.r)(h.k),b=Object(n.q)(!1),u=Object(n.m)(()=>{r(l.d.Settings)},[r]),m=Object(n.m)(()=>{r(l.d.Contacts)},[r]),O=Object(n.m)(()=>{r(l.d.NewChannelStep1)},[r]),j=Object(n.m)(()=>{r(l.d.NewGroupStep1)},[r]),g=Object(n.m)(()=>{r(l.d.Archived)},[r]),f=Object(n.m)(()=>{e===l.d.ChatList&&(b.current=!0,d(!0))},[e]),p=Object(n.m)(()=>{b.current=!1,ke&&(clearTimeout(ke),ke=void 0),ke=window.setTimeout(()=>{b.current||d(!1)},250)},[]);return Object(n.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]),n.a.createElement("div",{id:"LeftColumn-main",onMouseEnter:h.k?void 0:f,onMouseLeave:h.k?void 0:p},n.a.createElement(le,{content:e,contactsFilter:s,onSearchQuery:c,onSelectSettings:u,onSelectContacts:m,onSelectArchived:g,onReset:o}),n.a.createElement(be,null),n.a.createElement(X.a,{name:"zoom-fade",renderCount:Se,activeKey:e},()=>{switch(e){case l.d.ChatList:return n.a.createElement(fe,null);case l.d.GlobalSearch:return n.a.createElement(ye,{searchQuery:t,searchDate:a,onReset:o});case l.d.Contacts:return n.a.createElement(Ce,{filter:s});default:return}}),n.a.createElement(Me,{isShown:i,onNewPrivateChat:m,onNewChannel:O,onNewGroup:j}))});var Pe=Object(n.h)(e=>{const t=Object(Ie.a)(pe.a.Extra,"Settings");return t?n.a.createElement(t,e):n.a.createElement(ve.a,null)});var Te=Object(n.h)(e=>{const t=Object(Ie.a)(pe.a.Extra,"NewChat");return t?n.a.createElement(t,e):n.a.createElement(ve.a,null)});var Ae,xe=Object(n.h)(e=>{const t=Object(Ie.a)(pe.a.Extra,"ArchivedChats");return t?n.a.createElement(t,e):n.a.createElement(ve.a,null)});a(203);!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"}(Ae||(Ae={}));const Re=Object.keys(Ae).length/2;var Le=Object(n.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:c,setGlobalSearchDate:r,loadPasswordInfo:o,clearTwoFaError:i})=>{const[d,b]=Object(n.r)(l.d.ChatList),[u,m]=Object(n.r)(l.m.Main),[O,j]=Object(n.r)(""),[g,f]=Object(n.r)(0);let p=Ae.Main;switch(d){case l.d.Archived:p=Ae.Archived;break;case l.d.Settings:p=Ae.Settings;break;case l.d.NewChannelStep1:case l.d.NewChannelStep2:p=Ae.NewChannel;break;case l.d.NewGroupStep1:case l.d.NewGroupStep2:p=Ae.NewGroup}const I=Object(n.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}),c(),setTimeout(()=>{f(Date.now())},250)}else b(l.d.NewGroupStep1)},[d,a,s,r,c,u]),v=Object(n.m)(t=>{d!==l.d.Contacts?(b(l.d.GlobalSearch),t!==e&&a({query:t})):j(t)},[d,a,e]);return Object(n.n)(()=>d!==l.d.ChatList?Object(Z.a)(()=>I()):void 0,[d,I]),Object(n.n)(()=>{i(),u===l.m.Privacy&&o()},[i,o,u]),n.a.createElement(X.a,{id:"LeftColumn",name:h.f?"slide-layers":"push-slide",renderCount:Re,activeKey:p},()=>{switch(p){case Ae.Archived:return n.a.createElement(xe,{onReset:I});case Ae.Settings:return n.a.createElement(Pe,{currentScreen:u,onScreenSelect:m,onReset:I});case Ae.NewChannel:return n.a.createElement(Te,{key:g,isChannel:!0,content:d,onContentChange:b,onReset:I});case Ae.NewGroup:return n.a.createElement(Te,{key:g,content:d,onContentChange:b,onReset:I});default:return n.a.createElement(Ne,{content:d,searchQuery:e,searchDate:t,contactsFilter:O,onContentChange:b,onSearchQuery:v,onReset:I})}})})),Fe=a(132),De=a(13),Be=a(52);var Ue=()=>{const[e,t]=Object(n.r)(Be.a.get());return Object(n.n)(()=>{const e=Object(g.g)(()=>{t(Be.a.get())},250,!1);return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),e},He=a(167);function qe(e,t){const a=e<=c.cb?16:32,s=function(e){if(e>c.Z){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>c.Y){const t=Math.min(Math.max(.4*e,288),424);return Math.min(e-t,728)}if(e>728)return 728;return e}(e),n=e<=c.cb?54:64,r=t?s-a-n:s-a,o=e>c.cb?Math.min(s-a,512):s-a,i=o/r,l=r/o;return{composerHiddenScale:i,toolbarHiddenScale:l,composerTranslateX:t?n/2*l:0,toolbarTranslateX:t?n/2*-1*i:0,unpinHiddenScale:o/258,toolbarForUnpinHiddenScale:258/o}}var Ge=a(128),_e=a(137),ze=a(40);function Ve(e,t=!1,a=!1){const s=Object(ze.a)(e,t);return a||null!=e?e:s}var $e=a(46),We=a(102),Qe=a(117);var Ke=Object(n.h)(e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"HeaderMenuContainer",!t);return a?n.a.createElement(a,e):void 0});var Ye=Object(n.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const c=Object(o.f)(e,t),n=Boolean(c&&Object(m.jb)(c));if(c&&c.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&&c&&(n||Object(m.nb)(c))&&c.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:n,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:c,canSubscribe:r,canSearch:o,canMute:i,canSelect:l,canLeave:d,isRightColumnShown:b,joinChannel:u,sendBotCommand:m,openLocalTextSearch:O})=>{const j=Object(n.q)(null),[g,f]=Object(n.r)(!1),[p,I]=Object(n.r)(void 0),v=Object(n.m)(()=>{f(!0);const e=j.current.getBoundingClientRect();I({x:e.right,y:e.bottom})},[]),y=Object(n.m)(()=>{f(!1)},[]),C=Object(n.m)(()=>{I(void 0)},[]),E=Object(n.m)(()=>{u({chatId:e})},[u,e]),w=Object(n.m)(()=>{m({command:"/start"})},[m]),M=Object(n.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(te.a)();return n.a.createElement("div",{className:"HeaderActions"},!h.f&&r&&n.a.createElement(ce.a,{size:"tiny",ripple:!0,fluid:!0,onClick:E},S(s?"Subscribe":"Join Group")),!h.f&&c&&n.a.createElement(ce.a,{size:"tiny",ripple:!0,fluid:!0,onClick:w},S("Start")),!h.f&&o&&n.a.createElement(ce.a,{round:!0,ripple:b,color:"translucent",size:"smaller",onClick:M,ariaLabel:"Search in this chat"},n.a.createElement("i",{className:"icon-search"})),(h.f||!r)&&n.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},n.a.createElement("i",{className:"icon-more"})),p&&n.a.createElement(Ke,{chatId:e,threadId:t,isOpen:g,anchor:p,isChannel:s,canSubscribe:r,canSearch:o,canMute:i,canSelect:l,canLeave:d,onSubscribeChannel:E,onSearchClick:M,onClose:y,onCloseAnimationEnd:C}))})),Je=a(109),Ze=a(22),Xe=a(101),et=a(39);function tt(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(n.r)(et.a),i=e&&e.id;return Object(n.o)(()=>{s&&Object(et.c)("b64-"+i,t).then(o).catch(e=>{c.o&&console.error(e)})},[i,s,t]),s?r:t}var at=a(111),st=a(38),ct=a(31);function nt(e,t,a,s,c){return`M${e},${t+c}a${c},${c},0,0,1,\n ${a},0v${s-2*c}a${c},${c},0,0,1,${-a},0Z`}var rt=Object(n.h)(({count:e,index:t})=>{const a=Object(n.q)(null),s=Object(n.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),c=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),n=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=nt(0,0,2,t,1)+nt(0,12,2,t+1,1)+nt(0,25,2,t,1);else for(let e=0;e<a;e++)s+=nt(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,n);return{markHeight:c,clipPath:o,markTranslateY:i,trackTranslateY:l,trackHeight:n,clipPathId:r}}(e,t),[e,t]);if(Object(n.n)(()=>{if(!a.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:c,markTranslateY:n,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=c+"px",b.style.transform=`translateY(${n}px)`)}},[s]),1===e)return n.a.createElement("div",{className:"pinned-message-border"},n.a.createElement("div",{className:"pinned-message-border-wrapper-1",ref:a}));const{trackHeight:c,trackTranslateY:r,markHeight:o,markTranslateY:i,clipPathId:l}=s;return n.a.createElement("div",{className:Object(K.a)("pinned-message-border",e>4&&"pinned-message-border-mask")},n.a.createElement("div",{className:"pinned-message-border-wrapper",ref:a,style:`clip-path: url("#${l}"); width: 2px;\n height: ${c}px; transform: translateY(-${r}px);`},n.a.createElement("span",null),n.a.createElement("div",{className:"pinned-message-border-mark",style:`height: ${o}px; transform: translateY(${i}px);`})))});var ot=Object(n.h)(({message:e,count:t,index:a,customTitle:s,className:c,onUnpinMessage:r,onClick:o,onAllPinnedClick:i})=>{const l=tt(e),d=Object(Xe.a)(Object(m.D)(e,"pictogram")),b=Object(m.M)(e,Boolean(l)),[u,h,O]=Object(ct.a)(),j=Object(n.m)(()=>{O(),r&&r(e.id)},[O,r,e.id]),g=Object(te.a)();return n.a.createElement("div",{className:Object(K.a)("HeaderPinnedMessage-wrapper",c)},t>1&&n.a.createElement(ce.a,{round:!0,size:"smaller",color:"translucent",className:"pin-list-button",ariaLabel:g("EventLogFilterPinnedMessages"),onClick:i},n.a.createElement("i",{className:"icon-pin-list"})),r&&n.a.createElement(ce.a,{round:!0,size:"smaller",color:"translucent",ariaLabel:g("UnpinMessageAlertTitle"),className:"unpin-button",onClick:h},n.a.createElement("i",{className:"icon-close"})),n.a.createElement(at.a,{isOpen:u,onClose:O,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:j}),n.a.createElement("div",{className:"HeaderPinnedMessage",onClick:o},n.a.createElement(rt,{count:t,index:a}),l&&function(e,t){const{width:a,height:s}=Object(Je.k)();return n.a.createElement("img",{src:t||e,width:a,height:s,alt:""})}(l,d),n.a.createElement("div",{className:"message-text"},n.a.createElement("div",{className:"title"},s||`${g("PinnedMessage")} ${a>0?"#"+(t-a):""}`),n.a.createElement("p",null,Object(Ze.a)(b))),n.a.createElement(st.a,null)))}),it=a(50),lt=a(168);a(206);var dt=Object(s.h)((e,{message:t})=>{const a=Object(o.qb)(e,t);return{senderName:a?Object(m.V)(a):void 0}},(e,t)=>Object(d.l)(t,["focusMessage","closeAudioPlayer"]))(({message:e,className:t,noUi:a,senderName:s,focusMessage:c,closeAudioPlayer:r})=>{const o=it.c(Object(m.D)(e,"inline")),{playPause:i,isPlaying:l}=Object(lt.a)(Object(m.A)(e),Object(m.r)(e),o,void 0,void 0,!0),d=Object(n.m)(()=>{c({chatId:e.chatId,messageId:e.id})},[c,e.chatId,e.id]),b=Object(n.m)(()=>{l&&i(),r()},[r,l,i]),u=Object(te.a)();if(a)return;const O=Object(m.u)(e);return n.a.createElement("div",{className:Object(K.a)("AudioPlayer",t)},n.a.createElement(ce.a,{round:!0,ripple:!h.f,color:"translucent",size:"smaller",className:Object(K.a)("toggle-play",l?"pause":"play"),onClick:i,ariaLabel:l?"Pause audio":"Play audio"},n.a.createElement("i",{className:"icon-play"}),n.a.createElement("i",{className:"icon-pause"})),n.a.createElement("div",{className:"AudioPlayer-content",onClick:d},O?function(e){const{title:t,performer:a,fileName:s}=e;return n.a.createElement(n.a.Fragment,null,n.a.createElement("div",{className:"title"},Object(Ze.a)(t||s)),a&&n.a.createElement("div",{className:"subtitle"},Object(Ze.a)(a)))}(O):function(e,t){return n.a.createElement(n.a.Fragment,null,n.a.createElement("div",{className:"title"},t&&Object(Ze.a)(t)),n.a.createElement("div",{className:"subtitle"},e))}(u("AttachAudio"),s),n.a.createElement(st.a,null)),n.a.createElement(ce.a,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:b,ariaLabel:"Close player"},n.a.createElement("i",{className:"icon-close"})))});a(207);var bt=Object(n.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const{isLeftColumnShown:c,lastSyncTime:n}=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.Ab)(e,t,a);let j;if("pinned"===s){const a=Object(o.gb)(e,t);j=a&&a.length}else if("scheduled"===s){const a=Object(o.lb)(e,t);j=a&&a.length}else if("thread"===s&&a!==i.MAIN_THREAD_ID){const s=Object(o.zb)(e,t,a);s&&(j=s.messagesCount)}let g={typingStatus:d,isLeftColumnShown:c,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:n};const f=Object(o.m)(e,t);if("thread"===s&&f)if(a===i.MAIN_THREAD_ID){const s=Object(o.gb)(e,t);if(s&&s.length){const t=f[s[0]],{canUnpin:c}=t&&Object(o.b)(e,t,a)||{};g={...g,pinnedMessageIds:s,messagesById:f,canUnpin:c}}}else{const s=Object(o.Bb)(e,t,a),c=s?Object(o.k)(e,t,s):void 0,n=c?Object(o.J)(e,c):void 0,r=n?Object(m.V)(n):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:E,pinMessage:w,focusMessage:M,openChat:S,loadPinnedMessages:k,toggleLeftColumn:N,exitMessageSelectMode:P})=>{const[T,A]=Object(n.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(n.n)(()=>{t===i.MAIN_THREAD_ID&&C&&k({chatId:e})},[e,k,C,t]),Object(n.n)(()=>{A(0)},[e]),Object(n.n)(()=>{A(L?Object(Ge.a)(L,T):-1)},[L,T]),Object(_e.a)(e,x,R);const{width:F}=Ue(),D=F<=c.Y,B=F>=c.cb&&u,U=Object(n.q)(null),H=Object(n.q)(!0),q=Object(n.m)(()=>{E({id:e})},[E,e]),G=Object(n.m)(t=>{w({chatId:e,messageId:t,isUnpin:!0})},[w,e]),_=Object(n.m)(()=>{if(R){M({chatId:R.chatId,threadId:t,messageId:R.id});const e=Object(Ge.a)(L,T+1);A(e)}},[R,M,t,L,T]),z=Object(n.m)(()=>{S({id:e,threadId:i.MAIN_THREAD_ID,type:"pinned"})},[S,e]),V=Object(n.m)(()=>{if(h.f){const e=document.getElementById(c.u);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(n.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>=c.Y&&F<c.ib||F>c.cb&&F<c.Y&&(!g||g>30),Q=W||F>c.Z&&F<c.jb,{shouldRender:J,transitionClassNames:Z}=Object(Y.a)(Boolean(j)),ee=Ve(j),{shouldRender:ae,transitionClassNames:se}=Object(Y.a)(R&&!J),ne=Ve(R),re=Ve(l),oe=ae&&ne||J&ⅇObject(n.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(te.a)();function le(){return"thread"===a&&t===i.MAIN_THREAD_ID?n.a.createElement(n.a.Fragment,null,D&&de(B,$),n.a.createElement("div",{className:"chat-info-wrapper",onClick:q},Object(m.lb)(e)?n.a.createElement(We.a,{userId:e,typingStatus:d,withFullInfo:y,withMediaViewer:!0,withUpdatingStatus:!0}):n.a.createElement(Qe.a,{chatId:e,typingStatus:d,withMediaViewer:!0,withFullInfo:!0,withUpdatingStatus:!0}))):"thread"===a?n.a.createElement(n.a.Fragment,null,de(),n.a.createElement("h3",null,ie("CommentsCount",I))):"pinned"===a?n.a.createElement(n.a.Fragment,null,de(),n.a.createElement("h3",null,ie("PinnedMessagesCount",I))):"scheduled"===a?n.a.createElement(n.a.Fragment,null,de(),n.a.createElement("h3",null,v?ie("Reminders"):ie("messages",I))):void 0}function de(e=!1,t){return n.a.createElement("div",{className:"back-button"},n.a.createElement(ce.a,{round:!0,size:"smaller",color:"translucent",onClick:V,ariaLabel:e?"Close":"Back"},n.a.createElement("div",{className:Object(K.a)("animated-close-icon",!e&&"state-back")})),t&&n.a.createElement("div",{className:"unread-count "+(t.isActive?"active":"")},Object($e.b)(t.totalCount)))}return n.a.createElement("div",{className:"MiddleHeader",ref:U},n.a.createElement(X.a,{name:"slide-fade",activeKey:"thread"===a?t:1},le),n.a.createElement("div",{className:"header-tools"},ae&&ne&&!J&&n.a.createElement(ot,{key:e,message:ne,count:L,index:T,customTitle:re,className:se,onUnpinMessage:o?G:void 0,onClick:_,onAllPinnedClick:z}),J&&ee&&n.a.createElement(dt,{key:Object(m.A)(ee),message:ee,className:Z}),n.a.createElement(Ye,{chatId:e,threadId:t,messageListType:a})))})),ut=a(153);function mt(e){return"albumId"in e}function ht(e,t){let a,s=[],c={originalDate:e[0].date,datetime:Number(Object(A.j)(1e3*e[0].date)),senderGroups:[s]};const n=[c];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(A.j)(1e3*i.date));c.datetime!==e?(c={originalDate:i.date,datetime:e,senderGroups:[]},n.push(c),s=[],c.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=[],c.senderGroups.push(s))}}),n}var Ot=a(100);function jt(){const[e,t]=Object(ct.a)(!1),a=(s=1e3,c=!1,Object(n.p)(()=>Object(g.a)(e=>e(),s,c,r),[s,c,r]));var s,c,r;return{isScrolled:e,updateStickyDates:Object(n.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:c}=e,n=a-s;return-c<=n&&n<=(t?60:10)})}(e,s);a&&a.classList.add("stuck"),document.body.classList.remove("is-scrolling-messages")})})},[t,a])}}var gt=a(149),ft=a(118);let pt=!1;var It=({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(n.q)(null),g=Object(n.q)(null),f=Object(n.q)(null),p=Object(n.m)(()=>{if(pt)return;if(!a||!a.length)return void h(!1);if(!u)return void h(!0);const{offsetHeight:t,scrollHeight:s,scrollTop:c}=e.current,n=s-c-t;h(m?!(0===n):!(n<=50))},[a,u,e,h,m]),{observe:I,freeze:v,unfreeze:y}=Object(Ot.a)({rootRef:e,margin:c.T},t=>{if(!d||!b)return;const a=t.find(({isIntersecting:e})=>e);if(!a)return;const{target:s}=a;"backwards-trigger"===s.className?(Object(gt.a)(e.current),b()):"forwards-trigger"===s.className&&s.dataset.isActive&&(Object(gt.a)(e.current),d())});Object(Ot.c)(j,I),Object(Ot.c)(g,I);const{observe:C,freeze:E,unfreeze:w}=Object(Ot.a)({rootRef:e,margin:50},([{target:e}])=>{e.dataset.isActive&&p()});return Object(Ot.c)(f,C),Object(me.a)(()=>{o?(v(),E()):(w(),y())},[o]),Object(me.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(me.a)(()=>{pt=!0,setTimeout(()=>{pt=!1},100)},[a]),Object(n.n)(p,[m]),n.a.createElement("div",{className:t,teactFastList:!0},n.a.createElement("div",{ref:j,key:"backwards-trigger",className:"backwards-trigger"}),O,n.a.createElement("div",{ref:g,key:"forwards-trigger",className:"forwards-trigger","data-is-active":!u}),n.a.createElement("div",{ref:f,key:"fab-trigger",className:"fab-trigger","data-is-active":u}))},vt=a(138),yt=a(139);function Ct(e){return"number"==typeof e}function Et(e){return e?175:100}function wt(e){const t=Object(m.tb)(e),a=Object(m.qb)(e),s=Object(m.G)(e)||Object(m.Q)(e),c=Object(m.O)(e),n=Boolean(Object(m.Q)(e)),{width:r,height:o}=s?Object(Je.f)(s,t,a,n):Object(Je.h)(c,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 Mt=0,St=1,kt=2,Nt=4,Pt=8;function Tt(e,t){return e.reduce((e,t)=>e+t,t)}function At(e,t,a){return e<t?t:e>a?a:e}function xt(e){const t={width:0,height:0};return e.forEach(({dimensions:e,sides:a})=>{a&kt&&(t.width=e.width+e.x),a&Nt&&(t.height=e.height+e.y)}),t}function Rt(e,t,a,s){const n=a.messages.map(e=>{const t=wt(e);return t.width/t.height});const r=function(e){return e.map(e=>e>1.2?"w":e<.8?"n":"q").join("")}(n),o=function(e){return e.reduce((e,t)=>t+e,1)/e.length}(n),i=n.length,l=n.some(e=>e>2),d=function(e,t,a){return a<=c.cb?a/100*69-(t?1.625:0)*Je.c:((e?30:29)-(t?1.625:0))*Je.c}(e,t,s);let b;const u={ratios:n,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:c,maxHeight:n=4*a/3}){const r=function(e,t){return e.map(e=>t>1.1?At(e,1,2.75):At(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=Tt(r.slice(e,e+t),0);return(a-(t-1)*c)/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=Tt(t,0)+c*(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-n)*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],n=Math.round(s);let o=0;for(let l=0;l!==t;++l){const d=Mt|(0===e?St:Mt)|(e===O-1?Nt:Mt)|(0===l?Pt:Mt)|(l===t-1?kt:Mt),b=r[j],u=l===t-1?a-o:Math.round(b*s);i[j]={dimensions:{x:o,y:g,width:u,height:n},sides:d},o+=u+c,++j}g+=n+c}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:c}=e,n=Math.round(Math.min(a/t[0],Math.min(a/t[1],(c-s)/2)));return[{dimensions:{x:0,y:0,width:a,height:n},sides:Pt|St|kt},{dimensions:{x:0,y:n+s,width:a,height:n},sides:Pt|Nt|kt}]}(e):"ww"===a||"qq"===a?function(e){const{ratios:t,maxWidth:a,spacing:s,maxHeight:c}=e,n=(a-s)/2,r=Math.round(Math.min(n/t[0],Math.min(n/t[1],c)));return[{dimensions:{x:0,y:0,width:n,height:r},sides:St|Pt|Nt},{dimensions:{x:n+s,y:0,width:n,height:r},sides:St|kt|Nt}]}(e):function(e){const{ratios:t,minWidth:a,maxWidth:s,spacing:c,maxHeight:n}=e,r=Math.round(1.5*a),o=Math.min(Math.round(Math.max(.4*(s-c),(s-c)/t[0]/(1/t[0]+1/t[1]))),s-c-r),i=s-o-c,l=Math.min(n,Math.round(Math.min(i/t[0],o/t[1])));return[{dimensions:{x:0,y:0,width:i,height:l},sides:St|Pt|Nt},{dimensions:{x:i+c,y:0,width:o,height:l},sides:St|kt|Nt}]}(e)}(u):3===i?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:a,ratios:s,maxWidth:c,minWidth:n}=e,r=t,o=Math.round(Math.min((t-a)/2,s[1]*(c-a)/(s[2]+s[1]))),i=r-o-a,l=Math.max(n,Math.round(Math.min((c-a)/2,Math.min(o*s[2],i*s[1])))),d=Math.min(Math.round(r*s[0]),c-a-l);return[{dimensions:{x:0,y:0,width:d,height:r},sides:St|Pt|Nt},{dimensions:{x:d+a,y:0,width:l,height:i},sides:St|kt},{dimensions:{x:d+a,y:i+a,width:l,height:o},sides:Nt|kt}]}(e):function(e){const{maxWidth:t,ratios:a,maxHeight:s,spacing:c}=e,n=t,r=Math.round(Math.min(n/a[0],.66*(s-c))),o=(t-c)/2,i=Math.min(s-r-c,Math.round(Math.min(o/a[1],o/a[2])));return[{dimensions:{x:0,y:0,width:n,height:r},sides:Pt|St|kt},{dimensions:{x:0,y:r+c,width:o,height:i},sides:Nt|Pt},{dimensions:{x:o+c,y:r+c,width:n-o-c,height:i},sides:Nt|kt}]}(e)}(u):function(e){const{proportions:t}=e;return"w"===t[0]?function({maxWidth:e,ratios:t,spacing:a,maxHeight:s,minWidth:c}){const n=e,r=Math.round(Math.min(n/t[0],.66*(s-a))),o=Math.round((e-2*a)/(t[1]+t[2]+t[3])),i=Math.max(c,Math.round(Math.min(.4*(e-2*a),o*t[1]))),l=Math.round(Math.max(Math.max(c,.33*(e-2*a)),o*t[3])),d=n-i-l-2*a,b=Math.min(s-r-a,o);return[{dimensions:{x:0,y:0,width:n,height:r},sides:Pt|St|kt},{dimensions:{x:0,y:r+a,width:i,height:b},sides:Nt|Pt},{dimensions:{x:i+a,y:r+a,width:d,height:b},sides:Nt},{dimensions:{x:i+a+d+a,y:r+a,width:l,height:b},sides:kt|Nt}]}(e):function({maxHeight:e,ratios:t,maxWidth:a,spacing:s,minWidth:c}){const n=e,r=Math.round(Math.min(n*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=n-i-l-2*s,b=Math.max(c,Math.min(a-r-s,o));return[{dimensions:{x:0,y:0,width:r,height:n},sides:St|Pt|Nt},{dimensions:{x:r+s,y:0,width:b,height:i},sides:St|kt},{dimensions:{x:r+s,y:i+s,width:b,height:l},sides:kt},{dimensions:{x:r+s,y:i+l+2*s,width:b,height:d},sides:Nt|kt}]}(e)}(u),{layout:b,containerStyle:xt(b)}}let Lt;function Ft(e){return Lt||(Lt=document.createElement("span"),Lt.style.font='400 12px Roboto, "Helvetica Neue", "Apple Color Emoji", sans-serif',Lt.style.whiteSpace="nowrap",Lt.style.position="absolute",Lt.style.left="-999px",Lt.style.opacity=".01",document.body.appendChild(Lt)),Lt.innerHTML=e,Lt.offsetWidth}function Dt(e,t,a,s,c){Object(n.o)(()=>{if(a&&e.current){const t=e.current.closest(".MessageList");Object(ft.a)(t,e.current,c?"end":"center",20,void 0===s?1500:1e3,s)}},[e,t,a,s,c])}var Bt=a(105),Ut=a(62);var Ht=Object(n.h)(e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"ContextMenuContainer",!t);return a?n.a.createElement(a,e):void 0});var qt=Object(n.h)(Object(s.h)((e,{message:t})=>{const a=t.senderId,{targetUserId:s,targetChatId:c}=t.content.action||{},n=t.replyToMessageId,r=n?Object(o.k)(e,t.chatId,n):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.Db)(e,a):void 0,...s&&{targetUser:Object(o.Db)(e,s)},targetChatId:c,targetMessage:r,isFocused:i,...i&&{focusDirection:l,noFocusHighlight:d}}})(({message:e,observeIntersection:t,isEmbedded:a,appearanceOrder:s=0,sender:c,targetUser:r,targetMessage:o,targetChatId:i,isFocused:l,focusDirection:d,noFocusHighlight:b})=>{const u=Object(n.q)(null);Object(Ot.c)(u,t),Object(_e.a)(e.chatId,e.replyToMessageId,o),Dt(u,e.chatId,l,d,b),Object(te.a)();const m=s<=0,[h,O]=Object(ct.a)(m);Object(n.n)(()=>{m||setTimeout(O,10*s)},[s,O,m]);const{transitionClassNames:j}=Object(Y.a)(h,void 0,m,!1),g=Object(Ut.a)(e,c,r,o,i,a?{isEmbedded:!0,asPlain:!0}:void 0),{isContextMenuOpen:f,contextMenuPosition:p,handleBeforeContextMenu:I,handleContextMenu:v,handleContextMenuClose:y,handleContextMenuHide:C}=Object(vt.a)(u),E=void 0!==p;return a?n.a.createElement("span",{className:"embedded-action-message"},Object(Ze.a)(g)):n.a.createElement("div",{ref:u,id:"message"+e.id,className:Object(K.a)("ActionMessage message-list-item",l&&!b&&"focused",E&&"has-menu-open",j),"data-message-id":e.id,onMouseDown:I,onContextMenu:v},n.a.createElement("span",null,g),p&&n.a.createElement(Ht,{isOpen:f,anchor:p,message:e,messageListType:"thread",onClose:y,onCloseAnimationEnd:C}))}));a(208);var Gt=({className:e,message:t,sender:a,title:s,customText:c,observeIntersection:r,onClick:o})=>{const i=Object(n.q)(null),l=Object(Ot.b)(i,r),d=Object(Xe.a)(t&&Object(m.D)(t,"pictogram"),!l),b=t&&"sticker-reply-thumb"+t.id,u=tt(t);Object(te.a)();const h=a&&Object(m.V)(a);return n.a.createElement("div",{ref:i,className:Object(K.a)("EmbeddedMessage",e),onClick:t?o:void 0},u&&function(e,t,a){const{width:s,height:c}=Object(Je.k)();return n.a.createElement("img",{id:e,src:a||t,width:s,height:c,alt:""})}(b,u,d),n.a.createElement("div",{className:"message-text"},n.a.createElement("div",{className:"message-title"},Object(Ze.a)(h||s||" ")),n.a.createElement("p",null,t?Object(m.db)(t)?n.a.createElement(qt,{message:t,isEmbedded:!0}):Object(Ze.a)(Object(m.M)(t,Boolean(u))):c||" ")))},_t=a(154),zt=a(159),Vt=a(164);a(212);var $t=Object(n.h)(({message:e,outgoingStatus:t,signature:a,onClick:s})=>{const c=Object(te.a)();return n.a.createElement("span",{className:"MessageMeta",onClick:s},Boolean(e.views)&&n.a.createElement(n.a.Fragment,null,n.a.createElement("span",{className:"message-views"},Object($e.b)(e.views)),n.a.createElement("i",{className:"icon-channelviews"})),a&&n.a.createElement("span",{className:"message-signature"},Object(Ze.a)(a)),n.a.createElement("span",{className:"message-time"},e.isEdited&&c("EditedMessage")+" ",Object(A.h)(1e3*e.date)),t&&n.a.createElement(Vt.a,{status:t}))}),Wt=a(108),Qt=a(110),Kt=a(155);a(213);var Yt=({message:e,observeIntersection:t,observeIntersectionForPlaying:a,shouldLoop:s,lastSyncTime:r})=>{const o=Object(n.q)(null),[i,l,d]=Object(ct.a)(),b=e.content.sticker,{isAnimated:u,stickerSetId:h}=b,O=h===c.R,j=Object(Ot.b)(o,t),g=Object(Ot.b)(o,a),f=b.isPreloadedGlobally?"sticker"+b.id:Object(m.D)(e,"inline"),p=tt(e),I=Object(Xe.a)(f,!j,Object(m.C)(e,"inline",!0),r),v=Boolean(I),[y,C]=Object(ct.a)(v),E=u?y:v,{shouldRenderFullMedia:w,transitionClassNames:M}=Object(Wt.a)(E,"slow"),{width:S,height:k}=Object(Je.l)(b),N=Object(K.a)("thumbnail",!p&&"empty"),P=Object(K.a)("Sticker media-inner",O&&"inactive");return n.a.createElement("div",{ref:o,className:P,onClick:O?void 0:l},!E&&n.a.createElement("img",{id:"sticker-thumb-"+e.id,src:p,width:S,height:k,alt:"",className:N}),!u&&w&&n.a.createElement("img",{id:"sticker-"+e.id,src:I,width:S,height:k,alt:"",className:Object(K.a)("full-media",M)}),u&&v&&n.a.createElement(Qt.a,{key:f,className:Object(K.a)("full-media",M),id:f,animationData:I,size:S,play:g,noLoop:!s,onLoad:C}),n.a.createElement(Kt.a,{isOpen:i,fromSticker:b,onClose:d}))},Jt=a(122),Zt=a(114),Xt=a(140);function ea(e,t){return Object(Xt.a)(Object(m.E)(e),Boolean(t),h.f?c.H:void 0)}var ta=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"),c=s.getContext("2d");s.width=a.width,s.height=a.height,c.drawImage(a,0,0,a.width,a.height);const n=t?a.width-1:0,r=a.height-1;return`rgba(${Array.from(c.getImageData(n,r,1,1).data).join(",")})`}(e,t);var aa=a(115);var sa=({id:e,message:t,observeIntersection:a,shouldAutoLoad:s,isInSelectMode:c,isSelected:r,uploadProgress:o,size:i="inline",dimensions:l,shouldAffectAppendix:d,onClick:b,onCancelUpload:u})=>{const h=Object(n.q)(null),O=(Object(m.G)(t)||Object(m.Q)(t)).blobUrl,j=Object(Ot.b)(h,a),[g,f]=Object(n.r)(s),p=g&&j,{mediaData:I,downloadProgress:v}=Object(Zt.a)(Object(m.D)(t,i),!p),y=O||I,C=ea(t,y),{isUploading:E,isTransferring:w,transferProgress:M}=Object(m.s)(t,o||v,p&&!y),S=!1===Object(ze.a)(g),{shouldRender:k,transitionClassNames:N}=Object(Y.a)(w,void 0,S,"slow"),{shouldRenderThumb:P,shouldRenderFullMedia:T,transitionClassNames:A}=Object(Wt.a)(y,"slow"),x=Object(n.m)(()=>{E?u&&u(t):y?b&&b(t.id):f(e=>!e)},[y,E,t,u,b]),R=Object(m.tb)(t);Object(n.o)(()=>{if(!d)return;const e=h.current.closest(".message-content");y?ta(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,c,r]);const{width:L,height:F,isSmall:D}=l||wt(t),B=Object(K.a)("media-inner",!E&&"interactive",D&&"small-image",L===F&&"square-image"),U=Object(K.a)("thumbnail",!C&&"empty"),H=l?`width: ${L}px; height: ${F}px; left: ${l.x}px; top: ${l.y}px;`:"";return n.a.createElement("div",{id:e,ref:h,className:B,style:H,onClick:E?void 0:x},P&&n.a.createElement("img",{src:C,className:U,width:L,height:F,alt:""}),T&&n.a.createElement("img",{src:y,className:"full-media "+A,width:L,height:F,alt:""}),k&&n.a.createElement("div",{className:"media-loading "+N},n.a.createElement(aa.a,{progress:M,onClick:E?x:void 0})),!y&&!g&&n.a.createElement("i",{className:"icon-download"}),w&&n.a.createElement("span",{className:"message-upload-progress"},Math.round(100*M),"%"))},ca=a(130),na=a(129);function ra(e,t){const a=Object(n.q)();a.current=t;const s=Object(n.m)(()=>{e.current&&e.current.pause()},[e]),c=Object(n.m)(()=>{e.current&&a.current&&Object(na.a)(e.current)},[e]);Object(Q.a)(s,c)}var oa=a(141),ia=(e,t=!1)=>{const a=Object(n.q)(!1),s=Object(n.q)(!1),c=Object(n.m)(()=>{s.current=!0,t&&e.current&&(a.current||(a.current=!e.current.paused),e.current.pause())},[t,e]),r=Object(n.m)(()=>{t&&e.current&&a.current&&document.body.contains(e.current)&&Object(na.a)(e.current),a.current=!1,s.current=!1},[t,e]),o=Object(n.m)(()=>{Object(g.b)(r)},[r]);document.hasFocus()||c(),Object(J.a)(c,o)};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:c,uploadProgress:r,lastSyncTime:o,dimensions:i,onClick:l,onCancelUpload:d})=>{const b=Object(n.q)(null),u=Object(n.q)(null),h=t.content.video,O=h.blobUrl,j=Boolean(O)||Object(m.b)(h),g=Object(Ot.b)(b,a),[f,p]=Object(n.r)(s),I=Boolean(f&&g&&o),[v,y]=Object(n.r)(c),C=Object(Xe.a)(Object(m.D)(t,"pictogram"),!(g&&o),Object(m.C)(t,"pictogram"),o),E=ea(t,C),{mediaData:w,downloadProgress:M}=Object(Zt.a)(Object(m.D)(t,"inline"),!I,Object(m.C)(t,"inline"),o),S=C||E,k=O||w,N=Boolean(j&&g&&k),{isBuffered:P,bufferingHandlers:T}=Object(ca.a)(!s),{isUploading:x,isTransferring:R,transferProgress:L}=Object(m.s)(t,r||M,I&&j&&!P),F=!1===Object(ze.a)(f),{shouldRender:D,transitionClassNames:B}=Object(Y.a)(R,void 0,F),{shouldRenderThumb:U,transitionClassNames:H}=Object(Wt.a)(k,"slow"),[q,G]=Object(n.r)(0),_=Object(n.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(Je.h)(h,z,V);ra(u,Boolean(N&&c)),ia(u,v),Object(oa.a)(u,[N]);const Q=Object(n.m)(()=>{x?d&&d(t):j&&!k?p(e=>!e):j&&k&&!v?(y(!0),u.current.play()):l&&l(t.id)},[x,j,k,v,l,d,t]),J=Object(K.a)("media-inner dark",!x&&"interactive"),Z=Object(K.a)("thumbnail",!S&&"empty"),X=Object(K.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&&w,ce=!j||f&&!v&&!D,ne=j&&!f;return n.a.createElement("div",{ref:b,id:e,className:J,style:te,onClick:x?void 0:Q},(U||!N)&&n.a.createElement("img",{src:S,className:Z,width:$,height:W,alt:""}),ae&&n.a.createElement("video",la({ref:u,className:X,width:$,height:W,autoPlay:v,muted:!0,loop:!0,playsInline:!0,style:ee},T,{onTimeUpdate:_}),n.a.createElement("source",{src:k})),se&&n.a.createElement("img",{src:w,className:"full-media "+H,width:$,height:W,alt:""}),ce&&n.a.createElement("i",{className:"icon-large-play"}),D&&n.a.createElement("div",{className:"media-loading "+B},n.a.createElement(aa.a,{progress:L,onClick:x?Q:void 0})),ne&&n.a.createElement("i",{className:"icon-download"}),R&&!j?n.a.createElement("span",{className:"message-upload-progress"},Math.round(100*L),"%"):R&&j?n.a.createElement("span",{className:"message-upload-progress"},"..."):n.a.createElement("div",{className:"message-media-duration"},h.isGif?"GIF":Object(A.e)(h.duration-q)))},ba=a(18);a(215);var ua=Object(s.h)((e,{contact:t})=>({user:Object(o.Db)(e,t.userId)}),(e,t)=>Object(d.l)(t,["openUserInfo"]))(({contact:e,user:t,openUserInfo:a})=>{const{firstName:s,lastName:c,phoneNumber:r,userId:o}=e,i=Object(n.m)(()=>{a({id:o})},[a,o]);return n.a.createElement("div",{className:Object(K.a)("Contact",Boolean(o)&&"interactive"),onClick:o?i:void 0},n.a.createElement(Bt.a,{size:"large",user:t,text:s||c}),n.a.createElement("div",{className:"contact-info"},n.a.createElement("div",{className:"contact-name"},s," ",c),n.a.createElement("div",{className:"contact-phone"},Object(ba.c)(r))))}),ma=a(43);var ha=Object(n.h)(({id:e,options:t,selected:a=[],disabled:s,round:c,loadingOptions:r,onChange:o})=>{const[i,l]=Object(n.r)([]),d=Object(n.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 n.a.createElement("div",{id:e,className:"radio-group"},t.map(e=>n.a.createElement(ma.a,{label:e.label,subLabel:e.subLabel,value:e.value,checked:-1!==a.indexOf(e.value),disabled:s,round:c,isLoading:r?-1!==r.indexOf(e.value):void 0,onChange:d})))}),Oa=a(120),ja=a(173);a(218);function ga(e,t){return t>0?(e/t*100).toFixed():0}var fa=({answer:e,voteResults:t,totalVoters:a,maxVotersCount:s,correctResults:c,shouldAnimate:r})=>{const o=t&&t.find(t=>t.option===e.option),i=0===c.length||-1!==c.indexOf(e.option),l=c.length>0&&i||o&&o.isChosen,d=o?ga(o.votersCount,a||0):0,[b,u]=Object(n.r)(r?0:d),m=Object(n.q)(null),h=o?ga(o.votersCount,s||0):0,O=b<d;if(Object(n.n)(()=>{r&&u(d)},[r,d]),Object(n.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 n.a.createElement("div",{className:"PollOption"},n.a.createElement("div",{className:"poll-option-share "+("100"===d?"limit-width":"")},d,"%",l&&n.a.createElement("span",{className:Object(K.a)("poll-option-chosen",!i&&"wrong",r&&"animate")},n.a.createElement("i",{className:i?"icon-check":"icon-close"}))),n.a.createElement("div",{className:"poll-option-right"},n.a.createElement("div",{className:"poll-option-text"},Object(Ze.a)(e.text)),n.a.createElement("div",{className:Object(K.a)("poll-option-answer",l&&!i&&"wrong")},n.a.createElement("div",{className:"poll-option-corner",ref:m}),n.a.createElement("div",{className:"poll-option-line",style:j}))))};a(219);var pa=Object(n.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:c,onSendVote:r,openPollResults:o})=>{const{id:i,chatId:l}=e,{summary:d,results:b}=t,[u,m]=Object(n.r)(!1),[h,O]=Object(n.r)([]),[j,g]=Object(n.r)(!1),[f,p]=Object(n.r)(!1),[I,v]=Object(n.r)(!d.closed&&d.closeDate&&d.closeDate>0?Math.min(d.closeDate-Math.floor(Date.now()/1e3),d.closePeriod):0),y=Object(n.q)(null),{results:C,totalVoters:E}=b,w=C&&C.some(e=>e.isChosen),M=!d.closed&&!w,S=!M&&d.isPublic&&Number(b.totalVoters)>0,k=M&&d.multipleChoice,N=C?Math.max(...C.map(e=>e.votersCount)):E,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(n.n)(()=>{u&&t.results.results&&t.results.results.some(e=>e.isChosen)&&m(!1)},[u,t.results.results]),Object(n.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(A.e)(I),a.firstElementChild.setAttribute("stroke-dashoffset","-"+e)}else e.innerHTML=`\n <span>${Object(A.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(n.n)(()=>{d.quiz&&(I<=0||w&&!d.closed)&&c({chatId:l,messageId:i})},[l,I,w,c,i,d.closed,d.quiz]),Object(n.n)(()=>{let e;return d.quiz&&!d.closed&&d.closePeriod&&d.closePeriod>0&&(e=window.setTimeout(()=>{c({chatId:l,messageId:i})},1e3*d.closePeriod)),()=>{e&&window.clearTimeout(e)}},[M,l,c,i,d.closePeriod,d.closed,d.quiz]);const x=Object(n.p)(()=>a?a.reduce((e,t)=>{const a=s[t];return a&&e.push(a),e},[]):[],[s,a]),R=Object(n.m)(e=>{O([e]),m(!0),p(!0),r([e])},[r]),L=Object(n.m)(e=>{O(e)},[]),F=Object(n.m)(()=>{m(!0),p(!0),r(h)},[r,h]),D=Object(n.m)(()=>{o({chatId:l,messageId:i})},[l,i,o]),B=Object(n.m)(()=>{g(!0)},[]),U=Object(n.m)(()=>{g(!1),p(!1)},[]);Object(n.n)(()=>{if(f&&w&&d.quiz&&b.results&&t.results.solution){b.results.find(e=>e.isChosen&&e.isCorrect)||g(!0)}},[w,f,b.results,d.quiz,t.results.solution]);const H=Object(te.a)();return n.a.createElement("div",{className:"Poll"},j&&t.results.solution&&n.a.createElement(ja.a,{message:Object(yt.b)(t.results.solution,t.results.solutionEntities),duration:5e3,onDismiss:U}),n.a.createElement("div",{className:"poll-question"},Object(Ze.a)(d.question)),n.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),x.length>0&&n.a.createElement("div",{className:"poll-recent-voters"},x.map(e=>n.a.createElement(Bt.a,{size:"micro",user:e}))),I>0&&M&&n.a.createElement("div",{ref:y,className:"poll-countdown"}),d.quiz&&t.results.solution&&!M&&n.a.createElement(ce.a,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:j,onClick:B,ariaLabel:"Show Solution"},n.a.createElement("i",{className:"icon-lamp"}))),M&&n.a.createElement("div",{className:"poll-answers"},k?n.a.createElement(ha,{options:T,onChange:L,disabled:e.isScheduled||u,loadingOptions:u?h:void 0,round:!0}):n.a.createElement(Oa.a,{name:"poll-"+i,options:T,onChange:R,disabled:e.isScheduled||u,loadingOption:u?h[0]:void 0})),!M&&n.a.createElement("div",{className:"poll-results"},d.answers.map((function(e){return n.a.createElement(fa,{key:e.option,shouldAnimate:f,answer:e,voteResults:C,totalVoters:E,maxVotersCount:N,correctResults:P})}))),!S&&!k&&n.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&&n.a.createElement(ce.a,{isText:!0,disabled:0===h.length,size:"tiny",onClick:F},H("PollSubmitVotes")),S&&n.a.createElement(ce.a,{isText:!0,size:"tiny",onClick:D},H("PollViewResults")))})),Ia=a(35),va=a(53);a(220);var ya=Object(n.h)(({message:e,observeIntersection:t,shouldAutoLoad:a,inPreview:s,onMediaClick:c,onCancelMediaTransfer:r})=>{const o=Object(m.P)(e);let i=!1;if(o&&o.photo){const{width:t,height:a}=wt(e);i=t===a}const l=Object(n.m)(()=>{o&&(i||o.hasDocument)?window.open(o.url):c&&c()},[o,i,c]);if(!o)return;const{siteName:d,url:b,displayUrl:u,title:h,description:O,photo:j}=o,g=Object(Ia.a)(O,170),f=Object(K.a)("WebPage",j?i&&"with-square-photo":!s&&"without-photo");return n.a.createElement("div",{className:f,"data-initial":(d||u)[0]},j&&n.a.createElement(sa,{message:e,observeIntersection:t,shouldAutoLoad:a,size:i?"pictogram":"inline",onClick:l,onCancelUpload:r}),n.a.createElement("div",{className:"WebPage-text"},n.a.createElement(va.a,{className:"site-name",url:b,text:d||u}),!s&&h&&n.a.createElement("p",{className:"site-title"},Object(Ze.a)(h)),g&&n.a.createElement("p",{className:"site-description"},Object(Ze.a)(g,["emoji","br"]))))});a(221);var Ca=Object(n.h)(({message:e})=>{const t=Object(m.z)(e),{title:a,text:s,description:c,photoUrl:r}=t;return n.a.createElement("div",{className:"Invoice"},a&&n.a.createElement("p",{className:"title"},Object(Ze.a)(a)),s&&n.a.createElement("p",null,Object(Ze.a)(s,["emoji","br"])),n.a.createElement("div",{className:"description "+(r?"has-image":"")},r&&n.a.createElement("img",{className:"invoice-image",src:r,alt:""}),c&&n.a.createElement("p",{className:"description-text"},Object(Ze.a)(c,["emoji","br"]))))});function Ea(e){return Object(n.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:c,toggleMessageSelection:r,dimensions:o}=t,i=Object(n.m)(e=>{e.stopPropagation(),r({messageId:c.id,withShift:e&&e.shiftKey})},[r,c]),l=Object(n.p)(()=>({...t,isInSelectMode:a,isSelected:s,dimensions:{...t.dimensions,x:0,y:0},onClick:a?void 0:t.onClick}),[t,a,s]);return n.a.createElement("div",{className:Object(K.a)("album-item-select-wrapper",s&&"is-selected"),style:o?`left: ${o.x}px; top: ${o.y}px;`:"",onClick:a?i:void 0},a&&n.a.createElement("div",{className:"message-select-control"},s&&n.a.createElement("i",{className:"icon-select"})),n.a.createElement(e,l))}))}a(222);const wa=Ea(sa),Ma=Ea(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:c,lastSyncTime:r,isOwn:o,albumLayout:i,onMediaClick:l,uploadsById:d,cancelSendingMessage:b})=>{const u=e.messages.length,h=Object(n.m)(e=>{b({chatId:e.chatId,messageId:e.id})},[b]);const{width:O,height:j}=i.containerStyle;return n.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=c&&(o?b===u-1:Boolean(I&Pt&&I&Nt));return n.a.createElement(wa,{id:"album-media-"+e.id,message:e,observeIntersection:t,shouldAutoLoad:a,shouldAffectAppendix:s,uploadProgress:f,dimensions:p,onClick:l,onCancelUpload:h})}if(j)return n.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(223);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)}let Na;var Pa=({message:e,observeIntersection:t,shouldAutoLoad:a,shouldAutoPlay:s,lastSyncTime:c})=>{const r=Object(n.q)(null),o=Object(n.q)(null),i=Object(n.q)(null),l=e.content.video,d=Object(Ot.b)(r,t),[b,u]=Object(n.r)(a&&s),h=Boolean(b&&d&&c),{mediaData:O,downloadProgress:j}=Object(Zt.a)(Object(m.D)(e,"inline"),!h,Object(m.C)(e,"inline"),c),g=ea(e,O),{isBuffered:f,bufferingHandlers:p}=Object(ca.a)(),I=b&&!f,v=!1===Object(ze.a)(b),{shouldRender:y,transitionClassNames:C}=Object(Y.a)(I||!f,void 0,v),{shouldRenderThumb:E,transitionClassNames:w}=Object(Wt.a)(O,"slow"),[M,S]=Object(n.r)(!1),[k,N]=Object(n.r)(0);Object(n.n)(()=>{if(!M)return;const e=188*Math.PI,t=e-k*e,a=i.current,s=o.current,c=s.firstElementChild;c?c.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),T=()=>{S(!1),N(0),Object(na.a)(i.current),requestAnimationFrame(()=>{o.current.innerHTML=""})},x=(R=T,()=>{Na&&Na(),Na=R});var R;Object(n.n)(()=>{i.current&&(P?Object(na.a)(i.current):i.current.pause())},[P]),ra(i,P),ia(i,Boolean(O)),Object(oa.a)(i,[O]);const L=Object(n.m)(()=>{if(!O)return void u(e=>!e);const e=i.current;M?e.paused?Object(na.a)(e):e.pause():(e.currentTime=0,S(!0),x())},[x,M,O]),F=Object(n.m)(e=>{const t=e.currentTarget;N(t.currentTime/t.duration)},[]),D=Object(K.a)("full-media",w);return n.a.createElement("div",{ref:r,className:"RoundVideo media-inner",onClick:L},E&&n.a.createElement("div",{className:"thumbnail-wrapper"},n.a.createElement("img",{src:g,className:"thumbnail",width:Je.d,height:Je.d,alt:""})),O&&n.a.createElement("div",{className:"video-wrapper"},n.a.createElement("video",ka({ref:i,className:D,width:Je.d,height:Je.d,autoPlay:!0,muted:!M,loop:!M,playsInline:!0,poster:g,onEnded:M?T:void 0},p,{onTimeUpdate:M?F:void 0}),n.a.createElement("source",{src:O}))),n.a.createElement("div",{className:"progress",ref:o}),y&&n.a.createElement("div",{className:"media-loading "+C},n.a.createElement(aa.a,{progress:j})),!O&&!b&&n.a.createElement("i",{className:"icon-large-play"}),n.a.createElement("div",{className:"message-media-duration"},M?Object(A.e)(i.current.currentTime):Object(A.e)(l.duration),(!M||i.current.paused)&&n.a.createElement("i",{className:"icon-muted-chat"})))};a(224);var Ta=({message:e,onClick:t})=>n.a.createElement("div",{className:"InlineButtons"},e.inlineButtons.map(e=>n.a.createElement("div",{className:"row"},e.map(e=>n.a.createElement(ce.a,{size:"tiny",ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>t({button:e})},e.text)))));a(225);var Aa=Object(n.h)(Object(s.h)((e,{message:t})=>{const{threadId:a,chatId:s}=t.threadInfo,c=Object(o.zb)(e,s,a)||t.threadInfo,{byId:n}=e.users,{byId:r}=e.chats;return{threadInfo:c,usersById:n,chatsById:r}},(e,t)=>Object(d.l)(t,["openChat"]))(({disabled:e,threadInfo:t,usersById:a,chatsById:s,openChat:c})=>{const{threadId:r,chatId:o,messagesCount:i,lastMessageId:l,lastReadInboxMessageId:d,recentReplierIds:b}=t,u=Object(n.m)(()=>{c({id:o,threadId:r})},[c,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 n.a.createElement("div",{"data-cnt":Object($e.b)(i),className:Object(K.a)("CommentButton",O&&"has-unread",e&&"disabled"),onClick:u},n.a.createElement("i",{className:"icon-comments-sticker"}),(!h||0===h.length)&&n.a.createElement("i",{className:"icon-comments"}),h&&h.length>0&&n.a.createElement("div",{className:"recent-repliers"},h.map(e=>n.a.createElement(Bt.a,{key:e.id,size:"small",user:Object(m.lb)(e.id)?e:void 0,chat:Object(m.lb)(e.id)?void 0:e}))),n.a.createElement("div",{className:"label"},function(e){if(0===e)return"Leave a Comment";if(1===e)return"1 Comment";return Object($e.a)(e)+" Comments"}(i)),n.a.createElement("i",{className:"icon-next"}))}));a(226);function xa(e){const t=La(e.currentTarget);t&&t.setAttribute("data-is-document-group-hover","")}function Ra(e){const t=La(e.currentTarget);t&&t.removeAttribute("data-is-document-group-hover")}function La(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var Fa=Object(n.h)(Object(s.h)((e,t)=>{const{focusedMessage:a,forwardMessages:s,lastSyncTime:c}=e,{message:n,album:r,withSenderName:i,withAvatar:l,threadId:d,messageListType:b}=t,{id:u,chatId:h,viaBotId:O,replyToMessageId:j,isOutgoing:g}=n,f=Object(o.f)(e,h),p=Object(o.O)(e,h),I=f&&Object(m.jb)(f),v=!p&&Object(m.eb)(n),y=i||l||v?Object(o.qb)(e,n):void 0,C=Object(o.J)(e,n),E=O?Object(o.Db)(e,O):void 0,w=d?Object(o.Bb)(e,h,d):void 0,M=n.id===w,S=j===w,k=j&&!S?Object(o.k)(e,h,j):void 0,N=k&&Object(o.qb)(e,k),P=Object(o.Cb)(e,n),T="thread"===b&&(r?r.messages.some(t=>Object(o.T)(e,t)):Object(o.T)(e,n)),{direction:A,noHighlight:x}=T&&a||{},R=s.messageIds&&s.messageIds.includes(u),{query:L}=Object(o.A)(e)||{},F=Object(m.K)(n);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:E,shouldHideReply:S,isThreadTop:M,replyMessage:k,replyMessageSender:N,...g&&{outgoingStatus:Object(o.cb)(e,n,"scheduled"===b)},..."number"==typeof P&&{uploadProgress:P},isFocused:T,...T&&{focusDirection:A,noFocusHighlight:x},isForwarding:R,isChatWithSelf:p,isChannel:I,lastSyncTime:c,highlight:L,isSingleEmoji:Boolean(F),animatedEmoji:F?Object(o.c)(e,F):void 0,isInSelectMode:Object(o.R)(e),isSelected:D,isGroupSelected:!!n.groupedId&&!n.isInAlbum&&Object(o.P)(e,h,n.groupedId),threadId:d,isPinnedList:"pinned"===b,shouldAutoLoadMedia:f?Object(o.rb)(e,n,f,y):void 0,shouldAutoPlayMedia:Object(o.sb)(e,n),shouldLoopStickers:Object(o.tb)(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:c,withAvatar:r,withSenderName:o,noComments:d,appearanceOrder:b,isFirstInGroup:u,isLastInGroup:h,isFirstInDocumentGroup:O,isLastInDocumentGroup:j,isLastInList:g,forceSenderName:f,sender:p,originSender:I,botSender:v,isThreadTop:y,shouldHideReply:C,replyMessage:E,replyMessageSender:w,outgoingStatus:M,uploadProgress:S,isFocused:k,focusDirection:N,noFocusHighlight:P,isForwarding:T,isChatWithSelf:A,isChannel:x,lastSyncTime:R,highlight:L,animatedEmoji:F,isInSelectMode:D,isSelected:B,isGroupSelected:U,threadId:H,messageListType:q,isPinnedList:G,shouldAutoLoadMedia:_,shouldAutoPlayMedia:z,shouldLoopStickers:V,focusMessage:$,openMediaViewer:W,openAudioPlayer:Q,openUserInfo:J,openChat:Z,cancelSendingMessage:X,markMessagesRead:ee,sendPollVote:ae,toggleMessageSelection:se,setReplyingToId:ne,openForwardMenu:re,clickInlineButton:oe})=>{const ie=Object(n.q)(null),le=Object(n.q)(null),de=Object(n.q)(null);Object(Ot.c)(le,t);const{width:be}=Ue(),{isContextMenuOpen:ue,contextMenuPosition:me,handleBeforeContextMenu:he,handleContextMenu:Oe,handleContextMenuClose:je,handleContextMenuHide:ge}=Object(vt.a)(ie),fe=b<=0,[pe,Ie]=Object(ct.a)(fe);Object(n.n)(()=>{fe||setTimeout(Ie,10*b)},[b,Ie,fe]);const{transitionClassNames:ve}=Object(Y.a)(pe,void 0,fe,!1),{chatId:ye,id:Ce,threadInfo:Ee}=e,we=Object(m.tb)(e),Me="scheduled"===q||e.isScheduled,Se=Object(m.ub)(e)&&!C,ke=Boolean(Ee)&&"thread"===q,{forwardInfo:Ne,viaBotId:Pe}=e,Te=Ne&&!A&&!Ne.isLinkedChannelPost,Ae=!!e.groupedId&&!e.isInAlbum,xe=Boolean(c)&&c.messages.length>1,{text:Re,photo:Le,video:Fe,audio:De,voice:Be,document:He,sticker:qe,contact:Ge,poll:ze,webPage:Ve,invoice:$e}=Object(m.v)(e),We=Object(m.x)(e),Qe=Object(yt.a)(e,L,Ct(We)),Ke=void 0!==me,Ye=Object(K.a)("Message message-list-item",u&&"first-in-group",h&&"last-in-group",O&&"first-in-document-group",j&&"last-in-document-group",g&&"last-in-list",we&&"own",Boolean(e.views)&&"has-views",e.isEdited&&"was-edited",Se&&"has-reply",Ke&&"has-menu-open",k&&!P&&"focused",T&&"is-forwarding",e.isDeleting&&"is-deleting",Ae&&"is-in-document-group",xe&&"is-album",e.hasUnreadMention&&"has-unread-mention",B&&"is-selected",D&&"is-in-selection-mode",y&&"is-thread-top",Boolean(e.inlineButtons)&&"has-inline-buttons",ve),Xe=function(e,{hasReply:t,customShape:a,isLastInGroup:s,asForwarded:c,hasThread:n,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 Ct(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")),c&&!a&&f.push("is-forwarded"),t&&f.push("is-reply"),n&&f.push("has-replies"),I&&f.push("is-via-bot"),r&&f.push("force-sender-name"),a||(f.push("has-shadow"),(t||c||!p||I||r)&&f.push("has-solid-background"),!s||!l&&p||f.push("has-appendix")),f.join(" ")}(e,{hasReply:Se,customShape:We,isLastInGroup:h,asForwarded:Te,hasThread:ke,forceSenderName:f,hasComments:e.threadInfo&&e.threadInfo.messagesCount>0}),et=!Ne||!A&&p?p:I,tt=Ne?I:p,at=x&&e.adminTitle||Ne&&!Te&&Ne.adminTitle||void 0;Object(_e.a)(ye,Se?e.replyToMessageId:void 0,E,e.id),Dt(ie,ye,k,N,P),Object(n.o)(()=>{de.current&&(de.current.innerHTML=we?'<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>')},[we]);const st=Object(n.m)(t=>{t.stopPropagation(),se({messageId:Ce,groupedId:e.groupedId})},[Ce,e.groupedId,se]),nt=Object(n.m)(e=>{const t=xe&&c&&c.messages?{messageId:Ce,childMessageIds:c.messages.map(({id:e})=>e),withShift:e&&e.shiftKey}:{messageId:Ce,withShift:e&&e.shiftKey};se(t)},[se,Ce,xe,c]),rt=Object(n.m)(()=>{ne({messageId:Ce})},[ne,Ce]),ot=Object(n.m)(e=>{e.stopPropagation()},[]),it=Object(n.m)(()=>{et&&(Object(m.lb)(et.id)?J({id:et.id}):Z({id:et.id}))},[et,J,Z]),lt=Object(n.m)(()=>{tt&&(Object(m.lb)(tt.id)?J({id:tt.id}):Z({id:tt.id}))},[tt,J,Z]),dt=Object(n.m)(()=>{v&&J({id:v.id})},[v,J]),bt=Object(n.m)(()=>{$({chatId:ye,threadId:H,messageId:e.replyToMessageId})},[$,ye,H,e.replyToMessageId]),ut=Object(n.m)(()=>{W({chatId:ye,threadId:H,messageId:Ce,origin:Me?l.h.ScheduledInline:l.h.Inline})},[ye,H,Ce,W,Me]),mt=Object(n.m)(()=>{Q({chatId:ye,messageId:Ce})},[ye,Ce,Q]),ht=Object(n.m)(e=>{W({chatId:ye,threadId:H,messageId:e,origin:Me?l.h.ScheduledAlbum:l.h.Album})},[ye,H,W,Me]),jt=Object(n.m)(()=>{ee({messageIds:[Ce]})},[Ce,ee]),gt=Object(n.m)(()=>{X({chatId:ye,messageId:Ce})},[X,ye,Ce]),ft=Object(n.m)(e=>{ae({chatId:ye,messageId:Ce,options:e})},[ye,Ce,ae]),pt=Object(n.m)(()=>{re({fromChatId:ye,groupedId:e.groupedId})},[re,ye,e.groupedId]),It=Object(n.m)(()=>{if(c&&c.messages){const e=c.messages.map(({id:e})=>e);re({fromChatId:ye,messageIds:e})}else re({fromChatId:ye,messageIds:[Ce]})},[c,re,ye,Ce]),Mt=Object(n.m)(()=>{$({chatId:ye,threadId:i.MAIN_THREAD_ID,messageId:Ce})},[$,ye,Ce]),St=Object(n.m)(()=>{$(Ae?{chatId:Ne.fromChatId,groupedId:e.groupedId,groupedChatId:ye}:{chatId:Ne.fromChatId,messageId:Ne.fromMessageId})},[$,Ne,e,ye,Ae]),kt=Object(te.a)();let Nt,Pt="";const Tt=Object(n.p)(()=>xe?Rt(we,Boolean(Te),c,be):void 0,[xe,be,we,Te,c]),At=Te?28:0;if(xe||!Le&&!Fe)Tt&&(Nt=Math.max(Et(Boolean(Re)),Tt.containerStyle.width));else{let t;Le?t=wt(e).width:Fe&&(t=Fe.isRound?Je.d:wt(e).width),t&&(Nt=Math.max(Et(Boolean(Re)),t))}Nt&&(Pt=`width: ${Nt+At}px`);const xt=Object(n.p)(()=>at?Ft(at):void 0,[at]),Lt=!(Ke||D||T)&&(!Ae||j),Ut=Lt&&x&&!Me,qt=Lt&&(Ne&&(Ne.isChannelPost||A&&!we)&&Ne.fromMessageId||G),Vt=e.threadInfo&&(!Ae||j)&&"thread"===q&&!d;return n.a.createElement("div",{ref:ie,id:"message"+Ce,className:Ye,style:xt?`--meta-safe-author-width: ${xt}px`:void 0,"data-message-id":Ce,onClick:D?nt:void 0,onDoubleClick:D?void 0:rt,onMouseDown:D?void 0:he,onContextMenu:D?void 0:Oe,onMouseEnter:Ae&&!j?xa:void 0,onMouseLeave:Ae&&!j?Ra:void 0},n.a.createElement("div",{ref:le,className:"bottom-marker","data-message-id":Ce,"data-last-message-id":c?c.messages[c.messages.length-1].id:void 0,"data-has-unread-mention":e.hasUnreadMention}),!Ae&&n.a.createElement("div",{className:"message-select-control"},B&&n.a.createElement("i",{className:"icon-select"})),j&&n.a.createElement("div",{className:Object(K.a)("message-select-control group-select",U&&"is-selected"),onClick:st},U&&n.a.createElement("i",{className:"icon-select"})),r&&function(){const e=et&&Object(m.lb)(et.id),t=et&&e?et:void 0,a=et&&!e?et:void 0,s=!et&&Ne?Ne.hiddenUserName:void 0;return n.a.createElement(Bt.a,{size:"small",user:t,chat:a,text:s,lastSyncTime:R,onClick:t||a?it:void 0})}(),n.a.createElement("div",{className:"message-content-wrapper",onClick:D&&Ae?nt:void 0},n.a.createElement("div",{className:Xe,style:Pt},Xe.includes("has-appendix")&&n.a.createElement("div",{className:"svg-appendix",ref:de}),Te&&!We&&(!Ae||O)&&n.a.createElement("div",{className:"message-title"},kt("ForwardedMessage")),function(){const t=Object(K.a)("content-inner",Te&&!We&&"forwarded-message",Se&&"reply-message"),r=h&&!Qe&&!Te&&!ke;return n.a.createElement("div",{className:t,onDoubleClick:ot},function(){if(We||!(o&&!Le&&!Fe||Te||Pe||f)||Ae&&!O)return;let t,a;tt?(t=Object(m.V)(tt),Te||(a="color-"+Object(m.X)(tt))):Ne&&Ne.hiddenUserName&&(t=Ne.hiddenUserName);return n.a.createElement("div",{className:"message-title"},t?n.a.createElement("span",{className:Object(K.a)(tt&&"interactive",a),onClick:tt?lt:void 0},Object(Ze.a)(t)):v?void 0:" ",v&&n.a.createElement(n.a.Fragment,null,n.a.createElement("span",{className:"via"},kt("ViaBot")),n.a.createElement("span",{className:"interactive",onClick:dt},Object(Ze.a)("@"+v.username))),Ne&&Ne.isLinkedChannelPost?n.a.createElement("span",{className:"admin-title"},kt("DiscussChannel")):e.adminTitle&&!x?n.a.createElement("span",{className:"admin-title"},e.adminTitle):void 0)}(),Se&&n.a.createElement(Gt,{message:E,sender:w,observeIntersection:a,onClick:bt}),qe&&n.a.createElement(Yt,{message:e,observeIntersection:a,observeIntersectionForPlaying:s,shouldLoop:V,lastSyncTime:R}),F&&n.a.createElement(Jt.a,{isInline:!0,sticker:F,observeIntersection:a,lastSyncTime:R}),xe&&n.a.createElement(Sa,{album:c,albumLayout:Tt,observeIntersection:a,shouldAutoLoad:_,shouldAutoPlay:z,isOwn:we,hasCustomAppendix:r,lastSyncTime:R,onMediaClick:ht}),!xe&&Le&&n.a.createElement(sa,{message:e,observeIntersection:a,shouldAutoLoad:_,uploadProgress:S,shouldAffectAppendix:r,onClick:ut,onCancelUpload:gt}),!xe&&Fe&&Fe.isRound&&n.a.createElement(Pa,{message:e,observeIntersection:a,shouldAutoLoad:_,shouldAutoPlay:z,lastSyncTime:R}),!xe&&Fe&&!Fe.isRound&&n.a.createElement(da,{message:e,observeIntersection:a,shouldAutoLoad:_,shouldAutoPlay:z,uploadProgress:S,lastSyncTime:R,onClick:ut,onCancelUpload:gt}),(De||Be)&&n.a.createElement(zt.a,{message:e,uploadProgress:S,lastSyncTime:R,isSelectable:Ae,isSelected:B,onPlay:mt,onReadMedia:!Be||we&&!A?void 0:jt,onCancelUpload:gt}),He&&n.a.createElement(_t.a,{message:e,observeIntersection:a,uploadProgress:S,isSelectable:Ae,isSelected:B,onCancelUpload:gt}),Ge&&n.a.createElement(ua,{contact:Ge}),ze&&n.a.createElement(pa,{message:e,poll:ze,onSendVote:ft}),!F&&Qe&&n.a.createElement("p",{className:"text-content"},Qe),Ve&&n.a.createElement(ya,{message:e,observeIntersection:a,shouldAutoLoad:_,onMediaClick:ut,onCancelMediaTransfer:gt}),$e&&n.a.createElement(Ca,{message:e}))}(),(!Ae||j)&&n.a.createElement($t,{message:e,outgoingStatus:M,signature:at,onClick:nt}),Ut?n.a.createElement(ce.a,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Forward message",onClick:j?pt:It},n.a.createElement("i",{className:"icon-share-filled"})):qt?n.a.createElement(ce.a,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:G?Mt:St},n.a.createElement("i",{className:"icon-arrow-right"})):void 0,Vt&&n.a.createElement(Aa,{message:e,disabled:d})),e.inlineButtons&&n.a.createElement(Ta,{message:e,onClick:oe})),me&&n.a.createElement(Ht,{isOpen:ue,anchor:me,message:e,album:c,messageListType:q,onClose:je,onCloseAnimationEnd:ge}))}));a(227);const Da=h.b?1e3:350,Ba=h.f?300:500,Ua=Object(g.a)(e=>e(),200,!1),Ha=Object(g.j)(e=>e());var qa=Object(n.h)(Object(s.h)((e,{chatId:t,threadId:a,type:s})=>{const c=Object(o.f)(e,t);if(!c)return{};const n=Object(o.x)(e,t,a,s),r="scheduled"===s?Object(o.nb)(e,t):Object(o.m)(e,t),l=Object(o.Bb)(e,t,a);if(a!==i.MAIN_THREAD_ID&&!(r&&l&&r[l]))return{};const{isRestricted:d,restrictionReason:b,lastMessage:u}=c,h=Object(o.H)(e,t),O=a===i.MAIN_THREAD_ID&&!n&&!c.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)(c),canPost:Object(m.e)(c,a),isChatWithSelf:Object(o.O)(e,t),messageIds:n,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:c.fullInfo&&"linkedChatId"in c.fullInfo?Boolean(c.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:E,restrictionReason:w,focusingId:M,isSelectModeActive:S,animationLevel:k,loadViewportMessages:N,markMessageListRead:P,markMessagesRead:T,setScrollOffset:x,lastMessage:R,botDescription:L,threadTopMessageId:F,hasLinkedChat:D})=>{const B=Object(n.q)(null),U=Object(n.q)("thread"===a&&Object(o.ob)(Object(s.e)(),e,t)||0),H=Object(n.q)(),q=Object(n.q)(),G=Object(n.q)(),_=Object(n.q)(v),z=Object(n.q)(),V=Object(n.q)(),$=Object(n.q)(!1),W=Object(n.q)(!p),[Y,J]=Object(n.r)(),[Z,X]=Object(n.r)(Boolean(M)),ee=Boolean(p);Object(me.a)(()=>{ee&&Object(g.d)(()=>{W.current=!1})},[ee]),Object(me.a)(()=>{z.current=v},[v]);const{observe:ae,freeze:se,unfreeze:ce}=Object(Ot.a)({rootRef:B,throttleMs:Da,margin:Ba}),{observe:ne,freeze:re,unfreeze:oe}=Object(Ot.a)({rootRef:B},e=>{if("thread"!==a)return;let t=0;const s=[];e.forEach(e=>{const{isIntersecting:a,target:c}=e;if(!a)return;const{dataset:n}=c,r=Number(n.lastMessageId||n.messageId);r>t&&(t=r),n.hasUnreadMention&&s.push(r)}),z.current&&t>=z.current&&P({maxId:t}),s.length&&T({messageIds:s})});Object(me.a)(()=>{V.current=M,M?(se(),re()):(oe(),ce())},[M]);const{observe:ie}=Object(Ot.a)({rootRef:B,throttleMs:Da});Object(n.n)(()=>{M?X(!0):setTimeout(()=>{X(!1)},200)},[M]);const le=Object(n.p)(()=>{if(!p||!I)return;const e=!F||p[0]&&C!==p[0]?p:[F,...p];if(!e.length)return;const t=e.map(e=>I[e]);return ht(Object(d.k)(t,["date","id"]),_.current)},[p,I,C,F]),[de,be,ue]=Object(n.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:he,updateStickyDates:Oe}=jt(),je=Object(n.m)(()=>{if($.current)return void($.current=!1);const s=B.current;V.current||Oe(s,r),Ua(()=>{Object(g.b)(()=>{s.parentElement&&(U.current=s.scrollHeight-s.scrollTop,"thread"===a&&x({chatId:e,threadId:t,scrollOffset:U.current}))})})},[Oe,r,a,x,e,t]);Object(n.n)(()=>{if(!("ResizeObserver"in window))return;const e=new ResizeObserver(([e])=>{e.target.offsetParent&&J(e.contentRect.height)});return e.observe(B.current),()=>{e.disconnect()}},[]),Object(n.o)(()=>{B.current.dataset.normalHeight=String(B.current.offsetHeight)},[]),Object(n.o)(()=>{h.d&&Ha(()=>{if(!B.current.querySelector(".AnimatedSticker.is-playing"))return;const e=B.current.style;e.webkitOverflowScrolling="auto"===e.webkitOverflowScrolling?"":"auto"})}),Object(n.n)(()=>{if(!ue||!b||E||M)return;const e=B.current;(!p||p.length<c.U/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&ue()},[b,p,ue,M,E]),Object(ut.a)(([e,t,a])=>{const s=B.current;if(G.current=Array.from(s.querySelectorAll(".message-list-item")),!s.offsetParent)return;const n=y&&p&&p.length<c.U/2&&!s.parentElement.classList.contains("force-messages-scroll")&&s.firstElementChild.clientHeight<=2*s.offsetHeight;n&&(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=U.current,b=G.current[G.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],f=p&&V.current===p[p.length-1];if(m&&j&&!O&&!f&&(b&&Object(g.b)(()=>{Object(ft.a)(s,b,"end",20,void 0,void 0,void 0,!0)}),h=i-l,U.current=Math.max(i-h,l),!n))return;const I=void 0!==a&&a!==Y,v=H.current&&s.querySelector("#"+H.current),C=!v&&_.current&&s.querySelector(".unread-divider");if(m&&I){if(Object(ft.b)())return;h=i-l}else if(v){h=o+(v.getBoundingClientRect().top-(q.current||0))}else h=C?C.offsetTop-(r?60:10):i-d;Object(gt.a)(s,h),V.current||($.current=!0,Object(g.b)(()=>{$.current=!1})),U.current=Math.max(i-h,l)},[p,y,Y,r]),Object(n.n)(()=>{(!k||k>0)&&Object(Q.b)(200+c.c)},[k,S]);const ge=Object(te.a)(),fe=Boolean(e&&Object(m.lb)(e)),pe=Boolean(!fe&&!u||f),Ie=Object(K.a)("MessageList custom-scroll",!pe&&"no-avatars",u&&"no-avatars",(!O||"none"!==j)&&"bottom-padding","none"!==j&&"bottom-padding-"+j,S&&"select-mode-active",Z&&"has-focusing",he&&"scrolled");return n.a.createElement("div",{ref:B,className:Ie,onScroll:je},E?n.a.createElement("div",{className:"empty"},n.a.createElement("span",null,w?w.text:"This is a private "+(u?"channel":"chat"))):L?n.a.createElement("div",{className:"empty rich"},n.a.createElement("span",null,Object(Ze.a)(ge(L),["br","emoji","links"]))):p&&!le?n.a.createElement("div",{className:"empty"},n.a.createElement("span",null,ge("NoMessages"))):p&&le||R?n.a.createElement(It,{containerRef:B,className:"messages-container",messageIds:p||[R.id],containerHeight:Y,listItemElementsRef:G,focusingId:M,anchorIdRef:H,anchorTopRef:q,loadMoreForwards:be,loadMoreBackwards:de,isViewportNewest:y,firstUnreadId:v,onFabToggle:i},function(e,t,a,s,r,o,i,l,b,u,h,O,j,g=!1,f=!1){const p=n.a.createElement("div",{className:Object(K.a)("unread-divider","local-action-message"),key:"unread-messages"},n.a.createElement("span",null,e("UnreadMessages"))),I=f?0:t.reduce((e,t)=>e+Object(d.h)(t.senderGroups).length,0);let v=0;const y=t.map((t,f,y)=>{const C=t.senderGroups.map((t,c,g)=>{if(1===t.length&&!mt(t[0])&&Object(m.db)(t[0])){const e=t[0];return Object(d.e)([e.id===l.current&&p,n.a.createElement(qt,{key:e.id,message:e,observeIntersection:a,appearanceOrder:I-++v})])}let C;return Object(d.h)(t.map((E,w)=>{const M=mt(E)?E.mainMessage:E,S=mt(E)?E:void 0,k=Object(m.tb)(M),N=mt(E),P=t[w+1];M.previousLocalId&&i.current==="message"+M.previousLocalId&&(i.current="message"+M.id);const T=!N&&M.groupedId?M.groupedId:void 0,A=P&&!mt(P)?P.groupedId:void 0,x={isFirstInGroup:0===w,isLastInGroup:w===t.length-1,isFirstInDocumentGroup:Boolean(T&&T!==C),isLastInDocumentGroup:Boolean(T&&T!==A),isLastInList:w===t.length-1&&c===g.length-1&&f===y.length-1};C=T;const R=M.id===l.current&&l.current!==O||M.id===h&&l.current===O,L=Object(m.F)(M),F="scheduled"!==u?L:`${M.date}_${L}`;return Object(d.e)([R&&p,n.a.createElement(Fa,{key:F,message:M,observeIntersectionForBottom:a,observeIntersectionForMedia:s,observeIntersectionForAnimatedStickers:r,album:S,withAvatar:x.isLastInGroup&&o&&!k&&!(M.id===h),withSenderName:x.isFirstInGroup&&o&&!k,threadId:b,messageListType:u,noComments:!1===j,appearanceOrder:I-++v,isFirstInGroup:x.isFirstInGroup,isLastInGroup:x.isLastInGroup,isFirstInDocumentGroup:x.isFirstInDocumentGroup,isLastInDocumentGroup:x.isLastInDocumentGroup,isLastInList:x.isLastInList}),M.id===h&&n.a.createElement("div",{className:"local-action-message",key:"discussion-started"},n.a.createElement("span",null,e("DiscussionStarted")))])}))});return n.a.createElement("div",{className:"message-date-group",key:t.datetime,teactFastList:!0},n.a.createElement("div",{className:"sticky-date",key:"date-header"},n.a.createElement("span",null,g&&t.originalDate===c.kb&&e("MessageScheduledUntilOnline"),g&&t.originalDate!==c.kb&&e("MessageScheduledOn",Object(A.c)(t.datetime,void 0,!0)),!g&&Object(A.c)(t.datetime))),Object(d.h)(C))});return Object(d.h)(y)}(ge,le||ht([R]),ne,ae,ie,pe,H,_,t,a,F,C,D,!!le&&"scheduled"===a,!le||!W.current)):n.a.createElement(ve.a,{color:"white"}))}));a(228);var Ga=Object(n.h)(Object(s.h)(e=>{const t=Object(o.y)(e);if(!t)return{};const{chatId:a,threadId:s,type:c}=t,n=Object(o.f)(e,a);return{messageListType:c,canPost:n&&Object(m.e)(n,s),unreadCount:n&&s===i.MAIN_THREAD_ID&&"thread"===c?n.unreadCount:void 0}},(e,t)=>Object(d.l)(t,["focusLastMessage"]))(({isShown:e,messageListType:t,canPost:a,unreadCount:s,focusLastMessage:c})=>{const r=Object(n.q)(null),o=Object(n.m)(()=>{if(e)if("thread"===t)c();else{const e=r.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),a=t[t.length-1];if(!a)return;Object(ft.a)(e,a,"end",20)}},[e,t,c]),i=Object(K.a)("ScrollDownButton",e&&"revealed",!a&&"no-composer");return n.a.createElement("div",{ref:r,className:i},n.a.createElement("div",{className:"ScrollDownButton-inner"},n.a.createElement(ce.a,{color:"secondary",round:!0,onClick:o,ariaLabel:"Scroll to bottom"},n.a.createElement("i",{className:"icon-arrow-down"})),Boolean(s)&&n.a.createElement("div",{className:"unread-count"},Object($e.b)(s))))})),_a=a(123),za=a(131),Va=a(14);async function $a(e,t,a,s){const c=URL.createObjectURL(t),{type:n,size:r}=t;let o,i;if(n.startsWith("image/"))if(a){const a=await Object(Va.g)(c),{width:r,height:i}=a;if(r>1280||i>1280||"image/jpeg"!==n){const n=await function(e){return new Promise(t=>{const a=document.createElement("canvas"),s=a.getContext("2d");let{width:c,height:n}=e;(c>1280||n>1280)&&(c>=n?(n*=1280/c,c=1280):(c*=1280/n,n=1280)),a.width=c,a.height=n,s.drawImage(e,0,0,e.width,e.height,0,0,c,n),a.toBlob(t,"image/jpeg",100)})}(a);return n?(URL.revokeObjectURL(c),$a(e,n,!0,s)):$a(e,t,!1,s)}o={width:r,height:i}}else i=c;else if(n.startsWith("video/")){if(r<10485760){const{videoWidth:e,videoHeight:t,duration:a}=await Object(Va.h)(c);o={width:e,height:t,duration:a}}i=await Object(Va.c)(c)}return{blobUrl:c,filename:e,mimeType:n,size:r,quick:o,previewBlobUrl:i,...s}}var Wa=a(174),Qa=a.p+"8ccc0b555efcec3616377aea078dda16.js";const Ka={encoderPath:Qa,reuseWorker:!0},Ya={type:"audio/ogg"};let Ja,Za,Xa;async function es(){return Ja||(Ja=a.e(9).then(a.t.bind(null,307,7)),Za=(await Ja).default,Xa=new Za(Ka)),Ja}async function ts(e){await async function(){await es(),await Xa.start()}();const t=Date.now();let a;const s=[],c=[];Xa.ondataavailable=e=>{s.push(e)};const n=function(e,t){const a=e.sourceNode,s=a.context.createAnalyser();s.fftSize=64,a.connect(s);const c=s.frequencyBinCount,n=new Uint8Array(c);let r=!1;return function e(){if(r)return;s.getByteFrequencyData(n);const a=n.reduce((e,t)=>e+t,0),o=a/c/255;t(o<.1?0:o),requestAnimationFrame(e)}(),()=>{r=!0}}(Xa,t=>{c.push(255*t),e(t)});return{stop:()=>new Promise((e,r)=>{Xa.onstop=()=>{e({blob:new Blob(s,Ya),duration:Math.round(((a||Date.now())-t)/1e3),waveform:c})},Xa.onerror=r;const o=Math.max(0,t+1e3-Date.now());setTimeout(()=>{Xa.stop(),n()},o)}),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout(()=>{Xa.pause(),a=Date.now(),n()},e)}}}const as=["image/png","image/jpeg","image/gif"];function ss(e){const{text:t,entities:a}=e||{};if(!t)return"";const s=Object(yt.b)(t,a,void 0,void 0,!0);return Array.isArray(s)?s.join(""):s}let cs,ns;var rs=a(59);var os=a(60);let is,ls,ds;const bs=/[^-:_a-z\d]+/i;function us(e,t,s,r=c.u,o){const[i,l,d]=Object(ct.a)(),[b,u]=Object(n.r)([]),[m,O]=Object(n.r)([]),j=Object(n.p)(()=>b.length&&s.length?s.map(e=>ds.emojis[e]).filter(Boolean):[],[b,s]);Object(n.n)(()=>{const e=()=>{u(Object.keys(ds.emojis))};ds?e():async function(){is||(is=a.e(1).then(a.t.bind(null,308,3)),ls=(await is).default,ds=Object(os.b)(ls));return is}().then(e)},[]),Object(n.n)(()=>{if(!t||!b.length)return void d();const e=function(e){const t=document.createElement("div");t.innerHTML=e;const a=t.innerText,s=a[a.length-1],c=a.split(bs).pop();if(!a.length||bs.test(s)||!c||!c.startsWith(":"))return;return c.toLowerCase()}(t);if(!e)return O([]),void d();const a=e.substr(1),s=""===a?j:b.filter(e=>ds.emojis[e].names.find(e=>e.includes(a))).slice(0,36).map(e=>ds.emojis[e]);s.length?(l(),O(s)):d()},[b,t,l,j,d]);const g=Object(n.m)(e=>{const a=t.lastIndexOf(":");if(-1!==a){o(`${t.substr(0,a)}${e}`);const s=document.getElementById(r);h.f||requestAnimationFrame(()=>{Object(_a.a)(s,!0)})}d()},[t,r,o,d]);return{isEmojiTooltipOpen:i,closeEmojiTooltip:d,filteredEmojis:m,insertEmoji:g}}var ms=a(182);var hs=Object(n.h)(e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"DeleteMessageModal",!t);return a?n.a.createElement(a,e):void 0});function Os(){return(Os=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 js,gs=!0;var fs=Object(n.h)(({onActivate:e,...t})=>{const a=Object(n.q)(!1),s=Object(n.m)(()=>{if(a.current=!0,gs)return gs=!1,void e();js&&(clearTimeout(js),js=void 0),js=window.setTimeout(()=>{a.current&&e()},200)},[e]),c=Object(n.m)(()=>{a.current=!1},[]);return n.a.createElement(ce.a,Os({},t,{onMouseEnter:h.k?void 0:s,onMouseLeave:h.k?void 0:c,onClick:h.k?e:void 0}))});var ps=Object(n.h)(e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"AttachMenu",!t);return a?n.a.createElement(a,e):void 0});var Is=Object(n.h)(e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"SymbolMenu",!t);return a?n.a.createElement(a,e):void 0});var vs=Object(n.h)(e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"MentionTooltip",!t);return a?n.a.createElement(a,e):void 0});var ys=Object(n.h)(e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"CustomSendMenu",!t);return a?n.a.createElement(a,e):void 0});var Cs=e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"StickerTooltip",!t);return a?n.a.createElement(a,e):void 0};var Es=Object(n.h)(e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"EmojiTooltip",!t);return a?n.a.createElement(a,e):void 0});var ws=Object(n.h)(e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"BotKeyboardMenu",!t);return a?n.a.createElement(a,e):void 0}),Ms=a(175),Ss=a(113);a(230);var ks=Object(n.h)(Object(s.h)(e=>{const{chatId:t,threadId:a,type:s}=Object(o.y)(e)||{};if(!t||!a||!s)return{};const{currentUserId:c,forwardMessages:{fromChatId:n,toChatId:r,messageIds:i}}=e,l=Object(o.jb)(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,n,i[0])),l&&h){const{forwardInfo:a}=h,s=t===c;a&&(a.isChannelPost||s)&&(O=Object(o.J)(e,h)),O||(O=Object(o.qb)(e,h))}else u&&(O=Object(m.lb)(n)?Object(o.Db)(e,n):Object(o.f)(e,n));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:c,forwardedMessagesCount:r,setReplyingToId:o,setEditingId:i,focusMessage:l,exitForwardMode:d})=>{const b=Boolean((e||t)&&a||s&&r),u=Object(Ss.a)([r],r?300:void 0),{shouldRender:m,transitionClassNames:h}=Object(Y.a)(u&&b,void 0,!c,void 0,!c),O=Object(n.m)(()=>{e?o({messageId:void 0}):t?i({messageId:void 0}):r&&d()},[e,t,r,o,i,d]);Object(n.n)(()=>b?Object(Z.a)(O):void 0,[b,O]);const j=Object(n.m)(()=>{l({chatId:a.chatId,messageId:a.id})},[l,a]),g=Object(K.a)("ComposerEmbeddedMessage",h),f=r&&r>1?r+" forwarded messages":void 0;if(m)return n.a.createElement("div",{className:g},n.a.createElement("div",null,n.a.createElement(ce.a,{round:!0,color:"translucent",ariaLabel:"Cancel replying",onClick:O},n.a.createElement("i",{className:"icon-close"})),n.a.createElement(Gt,{className:"inside-input",message:a,sender:s,customText:f,title:t?"Edit Message":void 0,onClick:j})))}));var Ns=Object(n.h)(e=>{const{attachments:t}=e,a=Object(Ie.a)(pe.a.Extra,"AttachmentModal",!t.length);return a?n.a.createElement(a,e):void 0});var Ps=Object(n.h)(e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"PollModal",!t);return a?n.a.createElement(a,e):void 0});var Ts=Object(n.h)(e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"DropArea",!t);return a?n.a.createElement(a,e):void 0});a(231);const As=new RegExp(c.fb,"i");var xs=Object(n.h)(Object(s.h)((e,{chatId:t,threadId:a})=>{const s=Object(o.bb)(e,t,a);return{webPagePreview:e.webPagePreview,noWebPage:s}},(e,t)=>Object(d.l)(t,["loadWebPagePreview","clearWebPagePreview","toggleMessageWebPage"]))(({chatId:e,threadId:t,messageText:a,disabled:s,webPagePreview:c,noWebPage:r,loadWebPagePreview:o,clearWebPagePreview:l,toggleMessageWebPage:d})=>{const b=Object(n.p)(()=>{const{text:e,entities:t}=Object(za.a)(a),s=t&&t.find(({type:e})=>e===i.ApiMessageEntityTypes.TextUrl);if(s)return s.url;const c=e.match(As);return c?c[0]:void 0},[a]);Object(n.n)(()=>{b?o({text:b}):(l(),d({chatId:e,threadId:t}))},[e,d,l,b,o,t]),Object(me.a)(()=>{l(),d({chatId:e,threadId:t})},[e]);const u=Boolean(c&&a.length&&!r&&!s),{shouldRender:m,transitionClassNames:h}=Object(Y.a)(u),O=Ve(c);if(!m||!O)return;const{photo:j,...g}=O,f={content:{webPage:g}};return n.a.createElement("div",{className:Object(K.a)("WebPagePreview",h)},n.a.createElement("div",null,n.a.createElement(ce.a,{round:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:()=>{d({chatId:e,threadId:t,noWebPage:!0})}},n.a.createElement("i",{className:"icon-close"})),n.a.createElement(ya,{message:f,inPreview:!0})))})),Rs=a(116);var Ls=Object(n.h)(e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"CalendarModal",!t);return a?n.a.createElement(a,e):void 0});var Fs=Object(n.h)(e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"PaymentModal",!t);return a?n.a.createElement(a,e):void 0});var Ds,Bs=Object(n.h)(e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"ReceiptModal",!t);return a?n.a.createElement(a,e):void 0});a(232);!function(e){e.Send="send",e.Record="record",e.Edit="edit"}(Ds||(Ds={}));var Us=Object(n.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const c=Object(o.f)(e,t),n=c&&Object(o.o)(e,c),r=c?Object(o.N)(e,c):void 0,l=Object(o.O)(e,t),d=r&&Object(o.ab)(e,t),b=Object(o.lb)(e,t);return{editingMessage:Object(o.D)(e,t,a,s),connectionState:e.connectionState,draft:Object(o.B)(e,t,a),chat:c,isChatWithBot:r,isChatWithSelf:l,canScheduleUntilOnline:!l&&!r&&c&&n&&Object(m.lb)(t)&&n.status&&Boolean(n.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:c&&Object(m.kb)(c),isPollModalOpen:e.isPollModalOpen,stickersForEmoji:e.stickers.forEmoji.stickers,groupChatMembers:c&&c.fullInfo&&c.fullInfo.members,currentUserId:e.currentUserId,usersById:e.users.byId,lastSyncTime:e.lastSyncTime,contentToBeScheduled:e.messages.contentToBeScheduled,isPaymentModalOpen:e.payment.isPaymentModalOpen,isReceiptModalOpen:Boolean(e.payment.receipt),shouldSuggestStickers:e.settings.byKey.shouldSuggestStickers,recentEmojis:e.recentEmojis}},(e,t)=>Object(d.l)(t,["sendMessage","editMessage","saveDraft","clearDraft","showError","setStickerSearchQuery","setGifSearchQuery","forwardMessages","openPollModal","closePollModal","closePaymentModal","clearReceipt","loadScheduledHistory","openChat","addRecentEmoji"]))(({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:E,isPaymentModalOpen:w,isReceiptModalOpen:M,botKeyboardMessageId:S,withScheduledButton:k,stickersForEmoji:N,groupChatMembers:P,currentUserId:T,usersById:x,lastSyncTime:R,contentToBeScheduled:L,shouldSuggestStickers:F,recentEmojis:D,sendMessage:B,editMessage:U,saveDraft:H,clearDraft:q,showError:G,setStickerSearchQuery:_,setGifSearchQuery:z,forwardMessages:V,openPollModal:$,closePollModal:W,loadScheduledHistory:Q,closePaymentModal:Y,openChat:J,clearReceipt:X,addRecentEmoji:ee})=>{const ae=Object(n.q)(null),[se,ne]=Object(n.r)(""),re=Object(n.q)(),oe=Object(ze.a)(e),[ie,le,be]=Object(ct.a)(),[ue,me]=Object(n.r)(),he=Object(n.q)(se);Object(n.n)(()=>{he.current=se},[se]),Object(n.n)(()=>{re.current=void 0},[l]),Object(n.n)(()=>{l&&R&&d===i.MAIN_THREAD_ID&&Q()},[l,Q,R,d]),Object(n.o)(()=>{ae.current&&(ae.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(n.n)(()=>{L&&(me(L),le())},[L,le]);const[Oe,je]=Object(n.r)([]),[ge,fe,pe]=Object(ct.a)(),[Ie,ve,ye]=Object(ct.a)(),[Ce,Ee,we]=Object(ct.a)(),[Me,Se,ke]=Object(ct.a)(),[Ne,Pe]=Object(ct.a)(),[Te,Ae,xe]=Object(ct.a)(),{startRecordingVoice:Re,stopRecordingVoice:Le,pauseRecordingVoice:De,activeVoiceRecording:Be,currentRecordTime:Ue,recordButtonRef:He,startRecordTimeRef:qe}=(()=>{const e=Object(n.q)(null),[t,a]=Object(n.r)(),s=Object(n.q)(),[c,r]=Object(n.r)();Object(n.n)(()=>{h.d&&es()},[]);const o=Object(n.m)(async()=>{try{const{stop:t,pause:c}=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:c})}catch(e){console.error(e)}},[]),i=Object(n.m)(()=>{if(t){e.current&&(e.current.style.boxShadow="none");try{return t.pause()}catch(e){return void console.error(e)}}},[t]),l=Object(n.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(n.n)(()=>t?Object(Z.a)(l):void 0,[t,l]),{startRecordingVoice:o,pauseRecordingVoice:i,stopRecordingVoice:l,activeVoiceRecording:t,currentRecordTime:c,recordButtonRef:e,startRecordTimeRef:s}})(),Ge=o?Ds.Edit:!h.l||Be||se&&!Oe.length||y?Ds.Send:Ds.Record,_e=!t,{isMentionTooltipOpen:Ve,mentionFilter:$e,closeMentionTooltip:We,insertMention:Qe,mentionFilteredMembers:Ke}=Object(ms.a)(C&&!Oe.length,se,ne,void 0,P,T,x),{isContextMenuOpen:Ye,handleContextMenu:Je,handleContextMenuClose:Xe,handleContextMenuHide:et}=Object(vt.a)(He,!(Ge===Ds.Send&&_e)),tt=Object(n.p)(()=>Object(m.c)(O,f),[O,f]),at=O&&Object(m.gb)(O),st=Object(m.k)(O),{isStickerTooltipOpen:nt,closeStickerTooltip:rt}=function(e,t,a){const{loadStickersForEmoji:c,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(n.n)(()=>{e&&o?c({emoji:t}):!i&&o||r()},[t,o,r,c,e]),{isStickerTooltipOpen:i,closeStickerTooltip:r}}(Boolean(F&&tt.canSendStickers&&!Oe.length),se,N),{isEmojiTooltipOpen:ot,closeEmojiTooltip:it,filteredEmojis:lt,insertEmoji:dt}=us(Boolean(F&&tt.canSendStickers&&!Oe.length),se,D,void 0,ne),bt=Object(n.m)(e=>{const t=window.getSelection(),a=document.getElementById(c.u),s=Object(Ze.a)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");if(t.rangeCount){const c=t.getRangeAt(0);if(Object(Wa.a)(c))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),c=s.lastChild;a.insertNode(s),c&&(a.setStartAfter(c),a.setEndAfter(c),t.removeAllRanges(),t.addRange(a))}}(s),a.dispatchEvent(new Event("input",{bubbles:!0}))));ne(`${he.current}${s}`),h.f||requestAnimationFrame(()=>{Object(_a.a)(a)})}else ne(`${he.current}${s}`)},[]),ut=Object(n.m)(()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if(Object(Wa.a)(t))return void document.execCommand("delete",!1)}ne(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,c=document.createRange(),n=window.getSelection();c.setStart(a,s),c.setEnd(a,s),n.removeAllRanges(),n.addRange(c),document.execCommand("delete",!1);const r=t.innerHTML;return document.body.removeChild(t),r}(he.current))},[]),mt=Object(n.m)(()=>{ne(""),je([]),rt(),be(),me(void 0),We(),it(),h.f?setTimeout(()=>we(),350):we()},[rt,be,We,it,we]),ht=Object(ze.a)(l);Object(n.n)(()=>{ht&&l!==ht&&(Le(),mt())},[l,ht,mt,Le]);const Ot=((e,t,a,s,r,o)=>{Object(n.n)(()=>{a?(t(ss(a.content.text)),requestAnimationFrame(()=>{const e=document.getElementById(c.u);Object(_a.a)(e,!0)})):t("")},[a,t]);return Object(n.m)(()=>{const{text:t,entities:c}=Object(za.a)(e.current);a&&(t||Object(m.cb)(a)?(o({messageId:a.id,text:t,entities:c}),s()):r())},[o,a,e,r,s])})(he,ne,o,mt,Se,U);((e,t,a,s,r,o,i,l,d)=>{const b=Object(n.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(n.p)(()=>Object(g.a)(e=>e(),c.t,!1),[t]),m=Object(ze.a)(t),h=Object(ze.a)(a);Object(n.n)(()=>(cs=t,ns=a,()=>{cs=void 0,ns=void 0,b(t,a)}),[t,a,b]),Object(n.n)(()=>{t===m&&a===h||e&&(o(ss(e)),requestAnimationFrame(()=>{const e=document.getElementById(c.u);Object(_a.a)(e,!0)}))},[t,a,e,o,b,m,h]);const O=Object(ze.a)(s);Object(n.n)(()=>{t&&a&&m===t&&h===a&&O!==s&&(s.length?u(()=>{cs===t&&ns===a&&b(t,a)}):b(t,a))},[t,s,m,O,h,u,a,b]),Object(n.n)(()=>{function e(){t&&a&&b(t,a)}return window.addEventListener("blur",e),()=>{window.removeEventListener("blur",e)}},[t,a,b])})(u,l,d,se,he,ne,o,H,q),((e,t,a)=>{Object(n.n)(()=>{async function s(s){if(!s.clipboardData)return;const n=document.activeElement;if(n&&"INPUT"===n.tagName&&![c.u,c.v].includes(n.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])})(bt,je,o);const jt=Object(n.m)(async(e,t)=>{je(await Promise.all(e.map(e=>$a(e.name,e,t))))},[]),gt=Object(n.m)(()=>{je([])},[]),ft=Object(n.m)(async(e=!1,t)=>{if("connectionStateReady"!==j)return;let a=Oe;if(Be){const e=await Le();if(e){const{blob:t,duration:s,waveform:c}=e;a=[await $a("wonderful-voice-message.ogg",t,!1,{voice:{duration:s,waveform:c}})]}}const{text:s,entities:n}=Object(za.a)(he.current);if(a.length||s||y)if(a.length&&s&&s.length>1024){const e=s.length-1024;G({error:{message:"CAPTION_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":e,"{PLURAL_S}":e>1?"s":""}}})}else{if(a.length||s){if(st&&!at){const e=Math.floor(Date.now()/1e3),t=re.current&&Math.floor(e-re.current),a=st.nextSendDate&&st.nextSendDate>e;if(t&&t<st.seconds||a){const s=a?st.nextSendDate-e:st.seconds-t;G({error:{message:`A wait of ${s} seconds is required before sending another message in this chat`,isSlowMode:!0}});return void document.getElementById(c.u).blur()}}B({text:s,entities:n,attachments:a,scheduledAt:t,isSilent:e})}y&&V(),re.current=Math.floor(Date.now()/1e3),q({chatId:l,localOnly:!0}),requestAnimationFrame(mt)}},[Be,Oe,j,l,st,y,at,B,Le,mt,q,G,V]),pt=Object(n.m)(e=>{e={...e,isPreloadedGlobally:!0},t?(me({sticker:e}),le()):(B({sticker:e}),requestAnimationFrame(mt))},[t,le,B,mt]),It=Object(n.m)(e=>{t?(me({gif:e}),le()):(B({gif:e}),requestAnimationFrame(mt))},[t,le,B,mt]),yt=Object(n.m)(e=>{t?(me({poll:e}),W(),le()):(B({poll:e}),W())},[W,le,B,t]),Ct=Object(n.m)(()=>{t?(me({isSilent:!0}),le()):ft(!0)},[ft,le,t]),Et=Object(n.m)(e=>{const{isSilent:t,...a}=ue||{},s=Math.round(Math.max(e.getTime(),Date.now()+6e4)/1e3);ue&&0!==Object.keys(a).length?(B({...ue,scheduledAt:s}),requestAnimationFrame(mt)):ft(!!t,s),be()},[be,ft,mt,ue,B]),wt=Object(n.m)(()=>{Et(new Date(1e3*c.kb))},[Et]),Mt=Object(n.m)(()=>{be(),me(void 0)},[be]),St=Object(n.m)(e=>{"stickers"===e?(_({query:""}),z({query:void 0})):(z({query:""}),_({query:void 0}))},[_,z]),kt=Object(n.m)(()=>{const e=document.getElementById(c.u);h.f&&e===document.activeElement?(e.blur(),setTimeout(()=>{Ee()},100)):Ee()},[Ee]),Nt=Object(n.m)(()=>{J({id:l,threadId:d,type:"scheduled"})},[J,l,d]);Object(n.n)(()=>{I&&h.f&&we()},[I,we]),Object(n.n)(()=>{v?Ae():setTimeout(()=>{xe()},200)},[v,xe,Ae]);const Pt=Object(n.m)(()=>{switch(Ge){case Ds.Send:t?(Be&&De(),le()):(ft(),requestAnimationFrame(mt));break;case Ds.Record:Re();break;case Ds.Edit:Ot()}},[Ge,mt,t,Re,Ot,Be,le,De,ft]),Tt=Object(te.a)(),At=Ge===Ds.Record&&!tt.canAttachMedia,xt=Object(ze.a)(o,!0),Rt=o||xt,Lt=new Date;Lt.setSeconds(0),Lt.setMilliseconds(0);const Ft=new Date;Ft.setFullYear(Ft.getFullYear()+1);let Dt="Send message";switch(Ge){case Ds.Edit:Dt="Save edited message";break;case Ds.Record:Dt=At?"Posting media content is not allowed in this group.":"Record a voice message"}const Bt=Object(K.a)("Composer",!v&&"shown",Te&&"hover-disabled"),Ut=Object(K.a)("mobile-symbol-menu-button",Ne?Ce&&"menu-opened":Ce&&"is-loading");return n.a.createElement("div",{className:Bt},tt.canAttachMedia&&n.a.createElement(Rs.a,{containerId:"#middle-column-portals"},n.a.createElement(Ts,{isOpen:e!==Fe.a.None,withQuick:[e,oe].includes(Fe.a.QuickFile),onHide:r,onFileSelect:jt})),n.a.createElement(Ns,{attachments:Oe,caption:Oe.length?se:"",canSuggestMembers:C,groupChatMembers:P,currentUserId:T,usersById:x,onCaptionUpdate:ne,onSend:t?le:ft,onClear:gt}),n.a.createElement(Ps,{isOpen:Boolean(E),onClear:W,onSend:yt}),n.a.createElement(Fs,{isOpen:Boolean(w),onClose:Y}),n.a.createElement(Bs,{isOpen:Boolean(M),onClose:X}),Rt&&n.a.createElement(hs,{isOpen:Me,isSchedule:"scheduled"===b,onClose:ke,message:Rt}),n.a.createElement(vs,{isOpen:Ve,filter:$e,onClose:We,onInsertUserName:Qe,filteredChatMembers:Ke,usersById:x}),n.a.createElement("div",{id:"message-compose"},n.a.createElement("div",{className:"svg-appendix",ref:ae}),n.a.createElement(ks,null),n.a.createElement(xs,{chatId:l,threadId:d,messageText:Oe.length?"":se,disabled:!tt.canAttachEmbedLinks}),n.a.createElement("div",{className:"message-input-wrapper"},h.f?n.a.createElement(ce.a,{className:Ut,round:!0,color:"translucent",onClick:Ce?we:kt,ariaLabel:"Choose emoji, sticker or GIF"},n.a.createElement("i",{className:"icon-smile"}),n.a.createElement("i",{className:"icon-keyboard"}),n.a.createElement(de.a,{color:"gray"})):n.a.createElement(fs,{className:""+(Ce?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:Ee,ariaLabel:"Choose emoji, sticker or GIF"},n.a.createElement("i",{className:"icon-smile"})),n.a.createElement(Ms.a,{id:"message-input-text",html:Oe.length?"":se,placeholder:Be&&window.innerWidth<=600?"":Tt("Message"),shouldSetFocus:Ce,shouldSupressFocus:h.f&&Ce,shouldSupressTextFormatter:ot||Ve,onUpdate:ne,onSend:Ge===Ds.Edit?Ot:t?le:ft,onSupressedFocus:we}),k&&n.a.createElement(ce.a,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:Nt,ariaLabel:"Open scheduled messages"},n.a.createElement("i",{className:"icon-schedule"})),S&&!Be&&!o&&n.a.createElement(fs,{className:""+(ge?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:fe,ariaLabel:"Open bot command keyboard"},n.a.createElement("i",{className:"icon-bot-command"})),!Be&&!o&&n.a.createElement(fs,{className:""+(Ie?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:ve,ariaLabel:"Add an attachment"},n.a.createElement("i",{className:"icon-attach"})),Be&&Ue&&n.a.createElement("span",{className:"recording-state"},Object(A.i)(Ue-qe.current)),n.a.createElement(Cs,{isOpen:nt,onStickerSelect:pt}),n.a.createElement(Es,{isOpen:ot,emojis:lt,onClose:it,onEmojiSelect:dt,addRecentEmoji:ee}),n.a.createElement(ps,{isOpen:Ie,allowedAttachmentOptions:tt,onFileSelect:jt,onPollCreate:$,onClose:ye}),S&&n.a.createElement(ws,{messageId:S,isOpen:ge,onClose:pe}),n.a.createElement(Is,{isOpen:Ce,allowedAttachmentOptions:tt,onLoad:Pe,onClose:we,onEmojiSelect:bt,onStickerSelect:pt,onGifSelect:It,onRemoveSymbol:ut,onSearchOpen:St,addRecentEmoji:ee}))),Be&&n.a.createElement(ce.a,{round:!0,color:"danger",className:"cancel",onClick:Le,ariaLabel:"Cancel voice recording"},n.a.createElement("i",{className:"icon-delete"})),n.a.createElement(ce.a,{ref:He,round:!0,color:"secondary",className:`${Ge} ${Be?"recording":""}`,disabled:At,ariaLabel:Dt,onClick:Pt,onContextMenu:Ge===Ds.Send&&_e?Je:void 0},n.a.createElement("i",{className:"icon-send"}),n.a.createElement("i",{className:"icon-microphone-alt"}),n.a.createElement("i",{className:"icon-check"})),_e&&n.a.createElement(ys,{isOpen:Ye,onSilentSend:p?void 0:Ct,onScheduleSend:t?void 0:le,onClose:Xe,onCloseAnimationEnd:et}),n.a.createElement(Ls,{isOpen:ie,withTimePicker:!0,selectedAt:Lt.getTime(),maxAt:Object(A.k)(Ft),isFutureMode:!0,secondButtonLabel:a?"Send When Online":void 0,onClose:Mt,onSubmit:Et,onSecondButtonClick:a?wt:void 0}))}));var Hs=Object(n.h)(e=>{const{isActive:t}=e,a=Object(Ie.a)(pe.a.Extra,"MobileSearch",!t,!0);return a?n.a.createElement(a,e):void 0});var qs=Object(n.h)(e=>{const{isActive:t}=e,a=Object(Ie.a)(pe.a.Extra,"MessageSelectToolbar",!t);return a?n.a.createElement(a,e):void 0});var Gs=Object(n.h)(e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"UnpinAllMessagesModal",!t);return a?n.a.createElement(a,e):void 0});a(233);const _s=h.f?450+c.c:void 0;function zs(e){return"file"===e.kind&&e.type&&c.k.includes(e.type)}var Vs=Object(n.h)(Object(s.h)(e=>{const{isBackgroundBlurred:t,customBackground:a,patternColor:s}=e.settings.byKey,c=Boolean((a||"").match(/^#[a-f\d]{6,8}$/i)),n=Object(o.y)(e),{chats:{listIds:r}}=e;if(!n||!r.active)return{customBackground:a,isBackgroundBlurred:t,isCustomBackgroundColor:c};const{chatId:i,threadId:l,type:d}=n,b=Object(o.f)(e,i),u=Object(o.gb)(e,i),{chatId:O,messageId:j}=e.audioPlayer,g=b&&Object(m.e)(b,l),f=Object(o.K)(e,i),p="pinned"===d;return{chatId:i,threadId:l,messageListType:d,isPrivate:Object(m.lb)(i),canPost:!p&&(!b||g)&&(!f||h.f),isPinnedMessageList:p,messageSendingRestrictionReason:b&&Object(m.J)(b),hasPinnedOrAudioMessage:Boolean(u&&u.length)||Boolean(O&&j),customBackground:a,patternColor:s,isCustomBackgroundColor:c,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,patternColor:u,isCustomBackgroundColor:m,isRightColumnShown:O,isBackgroundBlurred:j,isMobileSearchActive:g,isSelectModeActive:f,animationLevel:p,openChat:I,unpinAllMessages:v,loadUser:y})=>{const{width:C}=Ue(),[E,w]=Object(n.r)(Fe.a.None),[M,S]=Object(n.r)(!1),[k,N]=Object(n.r)(!1),P=Object(He.a)(e,_s),T=Object(He.a)(t,_s),A=Object(He.a)(a,_s),x=Object(He.a)(o,_s);Object(n.n)(()=>e?Object(Z.a)(()=>{I({id:void 0})}):void 0,[e,I]),Object(n.n)(()=>{w(Fe.a.None)},[e]),Object(n.n)(()=>{s&&y({userId:e})},[e,s,y]);const R=Object(n.m)(e=>{if(h.k)return;const{items:t}=e.dataTransfer||{},a=t&&Array.from(t).every(zs);w(a?Fe.a.QuickFile:Fe.a.Document)},[]),L=Object(n.m)(()=>{w(Fe.a.None)},[]),F=Object(n.m)(()=>{N(!0)},[]),D=Object(n.m)(()=>{N(!1)},[]),B=Object(n.m)(()=>{v({chatId:e}),D(),I({id:e})},[v,I,D,e]),U=(e=>{const[t,a]=Object(n.r)(e);return Object(n.n)(()=>{e&&(e.startsWith("#")?a(e):De.c(c.l,c.l,De.a.Blob).then(e=>{a("url("+URL.createObjectURL(e))}))},[e]),t})(b),H=d&&(C<c.cb||O&&C>c.Z&&C<c.jb||C>=c.Y&&C<c.ib),q=Object(K.a)(H&&"has-header-tools",b&&!m&&"custom-bg-image",b&&m&&"custom-bg-color",b&&j&&"blurred",h.m?"mask-image-disabled":"mask-image-enabled"),G=Object(K.a)("messaging-disabled",!f&&"shown"),{composerHiddenScale:_,toolbarHiddenScale:z,composerTranslateX:V,toolbarTranslateX:$,unpinHiddenScale:W,toolbarForUnpinHiddenScale:Q}=Object(n.p)(()=>qe(C,x),[x,C]),Y=Object(te.a)();return n.a.createElement("div",{id:"MiddleColumn",className:q,style:`\n --composer-hidden-scale: ${_};\n --toolbar-hidden-scale: ${z};\n --unpin-hidden-scale: ${W};\n --toolbar-unpin-hidden-scale: ${Q};\n --composer-translate-x: ${V}px;\n --toolbar-translate-x: ${$}px;\n --pattern-color: ${u};\n `},n.a.createElement("div",{id:"middle-column-bg",style:U?"--custom-background: "+U:void 0}),n.a.createElement("div",{id:"middle-column-portals"}),P&&T&&n.a.createElement(n.a.Fragment,null,n.a.createElement("div",{className:"messages-layout",onDragEnter:x?R:void 0},n.a.createElement(bt,{chatId:P,threadId:T,messageListType:A}),n.a.createElement(X.a,{name:p===c.e?"slide":"fade",activeKey:"thread"===A&&T===i.MAIN_THREAD_ID?1:2,shouldCleanup:!0},()=>n.a.createElement(n.a.Fragment,null,n.a.createElement(qa,{key:`${P}-${T}-${A}`,chatId:P,threadId:T,type:A,hasTools:H,onFabToggle:S,bottomOffset:x?"none":r?"big":"small"}),n.a.createElement("div",{className:Object(K.a)("middle-column-footer",!x&&"no-composer")},x&&n.a.createElement(Us,{chatId:P,threadId:T,messageListType:A,dropAreaState:E,onDropHide:L}),r&&n.a.createElement("div",{className:"unpin-button-container"},n.a.createElement(ce.a,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:F},n.a.createElement("i",{className:"icon-unpin"}),n.a.createElement("span",null,Y("Chat.PanelHidePinnedMessages")))),!r&&!x&&l&&n.a.createElement("div",{className:G},n.a.createElement("div",{className:"messaging-disabled-inner"},n.a.createElement("span",null,l))),n.a.createElement(qs,{messageListType:A,isActive:f,canPost:x})))),n.a.createElement(Ga,{isShown:M})),h.f&&n.a.createElement(Hs,{isActive:Boolean(g)})),e&&n.a.createElement(Gs,{isOpen:k,chatId:e,onClose:D,onUnpin:B}))}));a(234);const $s=Object(g.a)(e=>e(),200,!1);var Ws;!function(e){e[e.Profile=0]="Profile",e[e.MemberList=1]="MemberList",e[e.SharedMedia=2]="SharedMedia",e[e.Search=3]="Search",e[e.Management=4]="Management",e[e.ManageInitial=5]="ManageInitial",e[e.ManageChannelSubscribers=6]="ManageChannelSubscribers",e[e.ManageChatAdministrators=7]="ManageChatAdministrators",e[e.ManageChatPrivacyType=8]="ManageChatPrivacyType",e[e.ManageDiscussion=9]="ManageDiscussion",e[e.ManageGroupPermissions=10]="ManageGroupPermissions",e[e.ManageGroupRemovedUsers=11]="ManageGroupRemovedUsers",e[e.ManageGroupUserPermissionsCreate=12]="ManageGroupUserPermissionsCreate",e[e.ManageGroupUserPermissions=13]="ManageGroupUserPermissions",e[e.ManageGroupRecentActions=14]="ManageGroupRecentActions",e[e.ManageGroupAdminRights=15]="ManageGroupAdminRights",e[e.ManageGroupMembers=16]="ManageGroupMembers",e[e.StickerSearch=17]="StickerSearch",e[e.GifSearch=18]="GifSearch",e[e.PollResults=19]="PollResults"}(Ws||(Ws={}));var Qs=Object(n.h)(Object(s.h)((e,{chatId:t,isProfile:a,isManagement:s})=>{const{query:c}=Object(o.A)(e)||{},{query:n}=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:c,stickerSearchQuery:n,gifSearchQuery:r}},(e,t)=>Object(d.l)(t,["setLocalTextSearchQuery","setStickerSearchQuery","setGifSearchQuery","searchTextMessagesLocal","toggleManagement","searchMessagesByDate"]))(({isColumnOpen:e,isProfile:t,isSearch:a,isManagement:s,isStickerSearch:c,isGifSearch:r,isPollResults:o,profileState:i,managementScreen:d,canManage:b,isChannel:u,onClose:m,messageSearchQuery:O,stickerSearchQuery:j,gifSearchQuery:g,setLocalTextSearchQuery:f,setStickerSearchQuery:p,setGifSearchQuery:I,searchTextMessagesLocal:v,toggleManagement:y,searchMessagesByDate:C})=>{var E;const w=Object(n.q)(null),[M,S,k]=Object(ct.a)(),N=Object(n.m)(e=>{f({query:e}),e.length&&$s(v)},[v,f]),P=Object(n.m)(e=>{C({timestamp:e.valueOf()/1e3}),k()},[k,C]),T=Object(n.m)(e=>{p({query:e})},[p]),A=Object(n.m)(e=>{I({query:e})},[I]),[x,R]=Object(n.r)(!e);Object(n.n)(()=>{setTimeout(()=>{R(!e)},300)},[e]);const L=Object(te.a)(),F=t?i===l.k.Profile?Ws.Profile:i===l.k.SharedMedia?Ws.SharedMedia:i===l.k.MemberList?Ws.MemberList:-1:a?Ws.Search:o?Ws.PollResults:c?Ws.StickerSearch:r?Ws.GifSearch:s?d===l.g.Initial?Ws.ManageInitial:d===l.g.ChatPrivacyType?Ws.ManageChatPrivacyType:d===l.g.Discussion?Ws.ManageDiscussion:d===l.g.ChannelSubscribers?Ws.ManageChannelSubscribers:d===l.g.GroupPermissions?Ws.ManageGroupPermissions:d===l.g.ChatAdministrators?Ws.ManageChatAdministrators:d===l.g.GroupRemovedUsers?Ws.ManageGroupRemovedUsers:d===l.g.GroupUserPermissionsCreate?Ws.ManageGroupUserPermissionsCreate:d===l.g.GroupUserPermissions?Ws.ManageGroupUserPermissions:d===l.g.GroupRecentActions?Ws.ManageGroupRecentActions:d===l.g.ChatAdminRights?Ws.ManageGroupAdminRights:d===l.g.GroupMembers?Ws.ManageGroupMembers:void 0:void 0,D=null!==(E=Ve(F,!0))&&void 0!==E?E:-1;function B(){if(-1!==D)switch(D){case Ws.PollResults:return n.a.createElement("h3",null,L("PollResults"));case Ws.Search:return n.a.createElement(n.a.Fragment,null,n.a.createElement(ne.a,{value:O,onChange:N}),n.a.createElement(ce.a,{round:!0,size:"smaller",color:"translucent",onClick:S,ariaLabel:"Search messages by date"},n.a.createElement("i",{className:"icon-calendar"})));case Ws.ManageInitial:return n.a.createElement("h3",null,L("Edit"));case Ws.ManageChatPrivacyType:return n.a.createElement("h3",null,L(u?"ChannelTypeHeader":"GroupTypeHeader"));case Ws.ManageDiscussion:return n.a.createElement("h3",null,L("Discussion"));case Ws.ManageChatAdministrators:return n.a.createElement("h3",null,L("ChannelAdministrators"));case Ws.ManageGroupRecentActions:return n.a.createElement("h3",null,L("Group.Info.AdminLog"));case Ws.ManageGroupAdminRights:return n.a.createElement("h3",null,L("EditAdminRights"));case Ws.ManageGroupPermissions:return n.a.createElement("h3",null,L("ChannelPermissions"));case Ws.ManageGroupRemovedUsers:return n.a.createElement("h3",null,L("ChannelBlockedUsers"));case Ws.ManageGroupUserPermissionsCreate:return n.a.createElement("h3",null,L("ChannelAddException"));case Ws.ManageGroupUserPermissions:return n.a.createElement("h3",null,L("UserRestrictions"));case Ws.StickerSearch:return n.a.createElement(ne.a,{value:j,placeholder:"Search Stickers",onChange:T});case Ws.GifSearch:return n.a.createElement(ne.a,{value:g,placeholder:L("SearchGifsTitle"),onChange:A});case Ws.SharedMedia:return n.a.createElement("h3",null,L("SharedMedia"));case Ws.ManageChannelSubscribers:return n.a.createElement("h3",null,L("ChannelSubscribers"));case Ws.MemberList:case Ws.ManageGroupMembers:return n.a.createElement("h3",null,L("GroupMembers"));default:return n.a.createElement(n.a.Fragment,null,n.a.createElement("h3",null,"Profile"),n.a.createElement("section",{className:"tools"},b&&n.a.createElement(ce.a,{round:!0,color:"translucent",size:"smaller",ariaLabel:L("Edit"),onClick:y},n.a.createElement("i",{className:"icon-edit"}))))}}const U=h.f||F===Ws.SharedMedia||F===Ws.MemberList||s,H=Object(K.a)("animated-close-icon",x&&"no-transition");return Object(n.n)(()=>{w.current.classList.toggle("state-back",U)},[U]),n.a.createElement("div",{className:"RightHeader"},n.a.createElement(ce.a,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:m,ariaLabel:L(U?"Common.Back":"Common.Close")},n.a.createElement("div",{ref:w,className:H})),n.a.createElement(X.a,{name:x?"none":"slide-fade",activeKey:D},B),!h.f&&n.a.createElement(Ls,{isOpen:M,isPastMode:!0,submitButtonLabel:L("JumpToDate"),onClose:k,onSubmit:P}))})),Ks=a(121);function Ys(e,t,a,s,r,o,i,l,d,b,u){const h="members"!==s&&r?r:s,O=Object(n.p)(()=>{if(o&&i)return Object(m.Db)(o.map(({userId:e})=>e),i)},[o,i]),[j,g,f]=function(e,t,a,s){const[n,r]=Object(Ks.a)(a?t:void 0,s,void 0,c.Q),o=!n||!s||n[0]===s[0];return[n,r,!o]}(0,t,u,O),[p,I,v]=Js("media",h,a,u,l,d),[y,C,E]=Js("documents",h,a,u,l,d),[w,M,S]=Js("links",h,a,u,l,d),[k,N,P]=Js("audio",h,a,u,l,d);let T,A,x=!1;switch(h){case"members":T=j,A=g,x=f;break;case"media":T=p,A=I,x=v;break;case"documents":T=y,A=C,x=E;break;case"links":T=w,A=M,x=S;break;case"audio":T=k,A=N,x=P}return[h,T,A,x]}function Js(e,t,a,s,r,o){const i=Object(n.q)();Object(me.a)(()=>{t===e&&r&&o&&(i.current=Object(m.w)(r,o,e).reverse())},[r,o,t,e]);const[l,d]=Object(Ks.a)(s?a:void 0,i.current,void 0,"media"===e?c.mb:c.W);return[l,d,!(!l||!i.current||l[0]===i.current[0])]}var Zs=a(54);const Xs=Object(g.g)(e=>e(),250,!1);let ec=!1;var tc=a(106),ac=a(99);var sc=a(127),cc=a(176);a(235);var nc=Object(n.h)(({chat:e,user:t,photo:a,isFirstPhoto:s,isSavedMessages:c,lastSyncTime:r,onClick:o})=>{const l=t&&Object(m.pb)(t);function d(s="big",n){if(a&&!n)return`photo${a.id}?size=c`;let r;return c||l||(t?r=Object(m.f)(t,s):e&&(r=Object(m.f)(e,s))),r}const b=d(),u=Object(Xe.a)(b,!1,i.ApiMediaFormat.BlobUrl,r),h=Object(Xe.a)(!u&&s?d("normal",!0):void 0,!1,i.ApiMediaFormat.BlobUrl,r),O=Object(cc.a)(!u&&a&&a.thumbnail&&a.thumbnail.dataUri),j=u||h||O,g=Object(ze.a)(j);let f="";if(c)f=n.a.createElement("i",{className:"icon-avatar-saved-messages"});else if(l)f=n.a.createElement("i",{className:"icon-avatar-deleted-account"});else if(j)f=n.a.createElement("img",{src:j,className:"avatar-media",alt:"",decoding:"async"});else if(!j&&t){const e=Object(m.Z)(t);f=e?Object($e.c)(e,2):void 0}else if(!j&&e){const t=Object(m.l)(e);f=t&&Object($e.c)(t,Object(m.lb)(e.id)?2:1)}else f=n.a.createElement("div",{className:"spinner-wrapper"},n.a.createElement(de.a,{color:"white"}));const p=Object(K.a)("ProfilePhoto","color-bg-"+Object(m.X)(t||e),c&&"saved-messages",l&&"deleted-account",!c&&!j&&"no-photo");return n.a.createElement("div",{className:p,onClick:j?o:void 0},g&&j&&g!==j&&n.a.createElement("img",{src:g,className:"prev-avatar-media",alt:"",decoding:"async"}),"string"==typeof f?Object(Ze.a)(f,["hq_emoji"]):f)});a(236);var rc=Object(n.h)(Object(s.h)((e,{userId:t,forceShowSelf:a})=>{const{lastSyncTime:s}=e,c=Object(o.Db)(e,t),n=Object(o.f)(e,t),r=!a&&c&&c.isSelf,{animationLevel:i}=e.settings.byKey;return{lastSyncTime:s,user:c,chat:n,isSavedMessages:r,animationLevel:i}},(e,t)=>Object(d.l)(t,["loadFullUser","openMediaViewer"]))(({user:e,chat:t,isSavedMessages:a,lastSyncTime:s,animationLevel:c,loadFullUser:r,openMediaViewer:o})=>{const{id:d}=e||{},{id:b}=t||{},u=e?Object(m.Z)(e):t?t.title:"",O=(e?e.photos:t?t.photos:void 0)||[],j=c>=1?"slide":"none",[g,f]=Object(n.r)(0),p=a||O.length<=1||0===g,I=a||O.length<=1||g===O.length-1;Object(n.n)(()=>{g>O.length&&f(Math.max(0,O.length-1))},[g,O.length]);const v=Object(te.a)();Object(n.n)(()=>{s&&d&&r({userId:d})},[d,r,s]),function(e,t,a){Object(n.n)(()=>{t.slice(a,a+4).forEach(e=>{it.c(`photo${e.id}?size=c`)||it.b(`photo${e.id}?size=c`,i.ApiMediaFormat.BlobUrl)})},[a,t])}(0,O,g);const y=Object(n.m)(()=>{o({avatarOwnerId:d||b,profilePhotoIndex:g,origin:l.h.ProfileAvatar})},[o,d,b,g]),C=Object(n.m)(()=>{p||f(g-1)},[g,p]),E=Object(n.m)(()=>{I||f(g+1)},[g,I]);if(Object(n.n)(()=>{const e=document.querySelector(".profile-slide-container > .active, .profile-slide-container > .to");if(e)return Object(ue.b)(e,{excludedClosestSelector:".navigation",onSwipe:h.k?(e,t)=>{t===ue.a.Right?C():t===ue.a.Left&&E()}:void 0})},[E,C]),!e&&!t)return;function w(){const s=!a&&O&&O.length>0?O[g]:void 0;return n.a.createElement(nc,{key:g,user:e,chat:t,photo:s,isSavedMessages:a,isFirstPhoto:p,onClick:y})}const M=e&&e.isVerified||t&&t.isVerified;return n.a.createElement("div",{className:"ProfileInfo"},n.a.createElement("div",{className:"photo-wrapper"},function(){if(!(a||!O||O.length<=1))return n.a.createElement("div",{className:"photo-dashes"},O.map((e,t)=>n.a.createElement("span",{className:"photo-dash "+(t===g?"current":"")})))}(),n.a.createElement(X.a,{activeKey:g,name:j,className:"profile-slide-container"},w),!p&&n.a.createElement("button",{type:"button",className:"navigation prev","aria-label":v("AccDescrPrevious"),onClick:C}),!I&&n.a.createElement("button",{type:"button",className:"navigation next","aria-label":v("Next"),onClick:E})),n.a.createElement("div",{className:"info"},a?n.a.createElement("div",{className:"title"},n.a.createElement("h3",null,v("SavedMessages"))):n.a.createElement("div",{className:"title"},n.a.createElement("h3",null,u&&Object(Ze.a)(u)),M&&n.a.createElement(sc.a,null)),!a&&(e?n.a.createElement("div",{className:"status "+(Object(m.xb)(e)?"online":"")},n.a.createElement("span",{className:"user-status"},Object(m.ab)(e,v))):n.a.createElement("span",{className:"status"},Object(m.jb)(t)?v("Subscribers",t.membersCount,"i"):v("Members",t.membersCount,"i")))))}));var oc=Object(n.h)(Object(s.h)((e,{chatOrUserId:t})=>{const{lastSyncTime:a}=e,s=t?Object(o.f)(e,t):void 0;return{lastSyncTime:a,chat:s,user:Object(m.lb)(t)?Object(o.Db)(e,t):void 0,canInviteUsers:s&&(!Object(m.jb)(s)&&!Object(m.yb)(s,"inviteUsers")||Object(m.q)(s,"inviteUsers"))}},(e,t)=>Object(d.l)(t,["loadFullUser","updateChatMutedState","showNotification"]))(({lastSyncTime:e,user:t,chat:a,forceShowSelf:s,canInviteUsers:c,loadFullUser:r,showNotification:o,updateChatMutedState:i})=>{const{id:l,fullInfo:d,username:b,phoneNumber:u,isSelf:h}=t||{},{id:O,isMuted:j,username:g}=a||{},f=Object(te.a)();Object(n.n)(()=>{e&&l&&r({userId:l})},[r,l,e]);const p=Object(n.m)((e,t)=>{Object(E.c)(e),o({message:t+" was copied"})},[o]),I=Object(n.m)(()=>{i({chatId:O,isMuted:!j})},[O,j,i]);if(!a||a.isRestricted||h&&!s)return;const v=d&&d.bio,y=u&&Object(ba.c)(u),C=Object(m.g)(a),w=Object(m.h)(a),M=0===w.indexOf("http")?w:"http://"+w,S=b||g,k=v||C;return n.a.createElement("div",{className:"ChatExtra"},y&&!!y.length&&n.a.createElement(ac.a,{icon:"phone",multiline:!0,narrow:!0,ripple:!0,onClick:()=>p(y,f("Phone"))},n.a.createElement("span",{className:"title"},y),n.a.createElement("span",{className:"subtitle"},f("Phone"))),S&&n.a.createElement(ac.a,{icon:"mention",multiline:!0,narrow:!0,ripple:!0,onClick:()=>p("@"+S,f("Username"))},n.a.createElement("span",{className:"title"},Object(Ze.a)(S)),n.a.createElement("span",{className:"subtitle"},f("Username"))),k&&!!k.length&&n.a.createElement(ac.a,{icon:"info",multiline:!0,narrow:!0,ripple:!0,onClick:()=>p(k,f(l?"UserBio":"Info"))},n.a.createElement("span",{className:"title"},Object(Ze.a)(k,["br","links","emoji"])),n.a.createElement("span",{className:"subtitle"},f(l?"UserBio":"Info"))),c&&!S&&!!w.length&&n.a.createElement(ac.a,{icon:"mention",multiline:!0,narrow:!0,ripple:!0,onClick:()=>p(w,f("SetUrlPlaceholder"))},n.a.createElement("div",{className:"title"},n.a.createElement(va.a,{url:M,className:"title",text:w})),n.a.createElement("span",{className:"subtitle"},f("SetUrlPlaceholder"))),n.a.createElement(ac.a,{icon:"unmute",onClick:I},n.a.createElement("span",null,f("Notifications")),n.a.createElement(oe,{id:"group-notifications",label:""+(l?"Toggle User Notifications":"Toggle Chat Notifications"),checked:!j,inactive:!0})))})),ic=a(157),lc=a(177),dc=a(112);a(240);const bc=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"}];function uc(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > div.active > .${e}-list > .scroll-item`].join(", ")}var mc=Object(n.h)(Object(s.h)((e,{chatId:t,userId:a})=>{const s=Object(o.f)(e,t),c=Object(o.m)(e,a||t),{currentType:n,resultsByType:r}=Object(o.v)(e)||{},{foundIds:i}=r&&n&&r[n]||{},{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:c,foundIds:i,mediaSearchType:n,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","loadMoreMembers","searchMediaMessagesLocal","openMediaViewer","openAudioPlayer","openUserInfo","focusMessage","loadProfilePhotos"]))(({chatId:e,profileState:t,onProfileStateChange:a,isChannel:s,resolvedUserId:r,chatMessages:o,foundIds:d,mediaSearchType:b,hasMembersTab:u,areMembersHidden:m,members:O,usersById:j,isRightColumnShown:g,isRestricted:f,lastSyncTime:p,setLocalMediaSearchType:I,loadMoreMembers:v,searchMediaMessagesLocal:y,openMediaViewer:C,openAudioPlayer:E,openUserInfo:w,focusMessage:M,loadProfilePhotos:S})=>{const k=Object(n.q)(null),N=Object(n.q)(null),[P,T]=Object(n.r)(0),A=Object(n.p)(()=>[...u?[{type:"members",title:s?"ChannelSubscribers":"GroupMembers"}]:[],...bc],[u,s]),x=A[P].type,[R,L,F,D]=Ys(0,v,y,x,b,O,j,o,d,0,p),B=A.findIndex(({type:e})=>e===R),{handleScroll:U}=function(e,t,a,s){Object(Zs.a)(([a])=>{if(a&&a!==t){const a=e.current,c=a.querySelector(".TabList");a.scrollTop<c.offsetTop&&(s("members"===t?l.k.MemberList:l.k.SharedMedia),ec=!0,Object(ft.a)(a,c,"start",void 0,void 0,void 0,300),setTimeout(()=>{ec=!1},350))}},[t,s]),Object(Zs.a)(([t])=>{if(a!==l.k.Profile||a===t)return;const c=e.current;if(!c)return;const n=c.querySelector(".TabList");!n||n.offsetTop>c.scrollTop||(ec=!0,Object(ft.a)(c,c.firstElementChild,"start",void 0,2*c.offsetHeight),setTimeout(()=>{ec=!1},350),s(a))},[a]);const c=Object(n.m)(()=>{const a=e.current;if(!a)return;const c=a.querySelector(".TabList");if(!c)return;let n=l.k.Profile;a.scrollTop>=c.offsetTop&&(n="members"===t?l.k.MemberList:l.k.SharedMedia),s(n)},[e,s,t]);return Object(n.n)(()=>{ec||c()},[c,t]),{handleScroll:Object(n.m)(()=>{ec||Xs(c)},[c])}}(k,x,t,a),{applyTransitionFix:H,releaseTransitionFix:q}=function(e,t=".Transition.shared-media-transition"){return Object(n.n)(()=>{function a(){const a=e.current,s=a.querySelector(t),c=a.querySelector(".TabList");s&&c&&(s.style.minHeight=a.offsetHeight-c.offsetHeight+"px")}return a(),window.addEventListener("resize",a,!1),()=>{window.removeEventListener("resize",a,!1)}},[e,t]),{applyTransitionFix:Object(n.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(n.m)(()=>{const t=e.current;t.style.overflowY="scroll",t.style.marginRight="0"},[e])}}(k),[G,_]=(()=>{const[e,t]=Object(n.r)(!1);return[e,Object(n.m)(()=>{t(e=>!e)},[])]})(),z=Object(n.m)(()=>{q(),_()},[q,_]);Object(n.n)(()=>{I({mediaType:x})},[I,x]);const V=r||e;Object(n.n)(()=>{p&&S({profileId:V})},[S,V,p]);const $=Object(n.m)(e=>{C({chatId:V,threadId:i.MAIN_THREAD_ID,messageId:e,origin:l.h.SharedMedia})},[V,C]),W=Object(n.m)(e=>{E({chatId:V,messageId:e})},[V,E]),Q=Object(n.m)(e=>{w({id:e})},[w]),K=Object(n.m)(e=>{M({chatId:V,messageId:e})},[V,M]);let Y;Object(n.n)(()=>{if(N.current&&h.k)return Object(ue.b)(N.current,{onSwipe:(e,t)=>{t===ue.a.Left?T(Math.min(P+1,A.length-1)):t===ue.a.Right&&T(Math.max(0,P-1))}})},[P,A.length]);const J="members"===R||!u&&"media"===R;J?Y=g?0:1e3:L||(Y=c.nb);const Z=Object(Ss.a)([e,R],Y);function ee(){if(!L||!Z||!o){const e=J&&L&&!Z;return n.a.createElement("div",{className:"content empty-list"},!e&&n.a.createElement(de.a,null))}if(!L.length){let e;switch(R){case"members":e=m?"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 n.a.createElement("div",{className:"content empty-list"},n.a.createElement(dc.a,{text:e}))}return n.a.createElement("div",{className:`content ${R}-list`,teactFastList:!0},"media"===R?L.map(e=>o[e]&&n.a.createElement(ic.a,{key:e,message:o[e],onClick:$})):"documents"===R?L.map(e=>o[e]&&n.a.createElement(_t.a,{key:e,message:o[e],withDate:!0,smaller:!0,className:"scroll-item",onDateClick:K})):"links"===R?L.map(e=>o[e]&&n.a.createElement(lc.a,{key:e,message:o[e],onMessageClick:K})):"audio"===R?L.map(e=>o[e]&&n.a.createElement(zt.a,{key:e,renderingFor:"sharedMedia",message:o[e],date:o[e].date,lastSyncTime:p,className:"scroll-item",onPlay:W,onDateClick:K})):"members"===R?L.map((e,t)=>n.a.createElement(ac.a,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>Q(e)},n.a.createElement(We.a,{userId:e,forceShowSelf:!0}))):void 0)}return n.a.createElement(tc.a,{ref:k,className:"Profile custom-scroll",itemSelector:uc(R),items:Z?L:void 0,cacheBuster:G,sensitiveArea:c.eb,preloadBackwards:Z?"members"===R?c.Q:c.mb:0,noFastList:!0,onLoadMore:F,onScroll:U},!D&&function(e,t){return n.a.createElement("div",{className:"profile-info"},n.a.createElement(rc,{userId:t||e,forceShowSelf:t!==e}),n.a.createElement(oc,{chatOrUserId:t||e,forceShowSelf:t!==e}))}(e,r),!f&&n.a.createElement("div",{className:"shared-media"},n.a.createElement(X.a,{ref:N,name:"slide",activeKey:B,renderCount:A.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:H,onStop:z},ee),n.a.createElement(je.a,{big:!0,activeTab:P,tabs:A,onSwitchTab:T})))}));var hc=Object(n.h)(e=>{const t=Object(Ie.a)(pe.a.Extra,"RightSearch");return t?n.a.createElement(t,e):n.a.createElement(ve.a,null)});var Oc=Object(n.h)(e=>{const t=Object(Ie.a)(pe.a.Extra,"Management");return t?n.a.createElement(t,e):n.a.createElement(ve.a,null)});var jc=Object(n.h)(()=>{const e=Object(Ie.a)(pe.a.Extra,"StickerSearch");return e?n.a.createElement(e,null):n.a.createElement(ve.a,null)});var gc=Object(n.h)(()=>{const e=Object(Ie.a)(pe.a.Extra,"GifSearch");return e?n.a.createElement(e,null):n.a.createElement(ve.a,null)});var fc=Object(n.h)(()=>{const e=Object(Ie.a)(pe.a.Extra,"PollResults");return e?n.a.createElement(e,null):n.a.createElement(ve.a,null)});a(241);const pc=Object.keys(l.l).length/2,Ic=Object.keys(l.g).length/2;function vc(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}var yc=Object(n.h)(Object(s.h)(e=>{const{chatId:t,threadId:a}=Object(o.y)(e)||{},s=Object(o.d)(e);return{contentKey:Object(o.kb)(e),chatId:t,threadId:a,currentProfileUserId:e.users.selectedId,isChatSelected:Boolean(t&&s)}},(e,t)=>Object(d.l)(t,["openUserInfo","toggleChatInfo","toggleManagement","closeLocalTextSearch","setStickerSearchQuery","setGifSearchQuery","closePollResults"]))(({contentKey:e,chatId:t,threadId:a,currentProfileUserId:s,isChatSelected:r,toggleChatInfo:o,toggleManagement:i,openUserInfo:d,closeLocalTextSearch:b,setStickerSearchQuery:u,setGifSearchQuery:m,closePollResults:h})=>{var O;const{width:j}=Ue(),[g,f]=Object(n.r)(l.k.Profile),[p,I]=Object(n.r)(l.g.Initial),[v,y]=Object(n.r)(),[C,E]=Object(n.r)(),w=g!==l.k.Profile,M=void 0!==e,S=e===l.l.ChatInfo||e===l.l.UserInfo,k=e===l.l.Search,N=e===l.l.Management,P=e===l.l.StickerSearch,T=e===l.l.GifSearch,A=e===l.l.PollResults,x=j<=c.Z,[R,L]=Object(n.r)(!M),F=null!==(O=Ve(e,!0,!r))&&void 0!==O?O:-1,D=Object(n.m)(()=>{switch(e){case l.l.ChatInfo:if(w){f(l.k.Profile);break}o();break;case l.l.UserInfo:if(w){f(l.k.Profile);break}d({id:void 0});break;case l.l.Management:switch(p){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:I(l.g.Initial);break;case l.g.GroupUserPermissionsCreate:case l.g.GroupRemovedUsers:case l.g.GroupUserPermissions:I(l.g.GroupPermissions),y(void 0),E(void 0);break;case l.g.ChatAdminRights:case l.g.GroupRecentActions:I(l.g.ChatAdministrators)}break;case l.l.Search:vc(),b();break;case l.l.StickerSearch:case l.l.GifSearch:vc(),u({query:void 0}),m({query:void 0});break;case l.l.PollResults:h()}},[e,w,o,d,h,p,i,b,u,m]),B=Object(n.m)((e,t)=>{y(e),E(t)},[]);function U(){if(-1!==F)switch(F){case l.l.ChatInfo:case l.l.UserInfo:return n.a.createElement(mc,{key:s||t,chatId:t,userId:s,profileState:g,onProfileStateChange:f});case l.l.Search:return n.a.createElement(hc,{chatId:t,threadId:a});case l.l.Management:return n.a.createElement(Oc,{chatId:t,currentScreen:p,isPromotedByCurrentUser:C,selectedChatMemberId:v,onScreenSelect:I,onChatMemberSelect:B});case l.l.StickerSearch:return n.a.createElement(jc,null);case l.l.GifSearch:return n.a.createElement(gc,null);case l.l.PollResults:return n.a.createElement(fc,null)}}return Object(n.n)(()=>M?Object(Z.a)(D):void 0,[M,D]),Object(n.n)(()=>{setTimeout(()=>{L(!M)},300)},[M]),Object(n.n)(()=>{M&&x&&D()},[x]),Object(ut.a)(([a,s])=>{(a===l.l.ChatInfo&&e===l.l.UserInfo||a===l.l.UserInfo&&e===l.l.ChatInfo||s!==t)&&(f(l.k.Profile),I(l.g.Initial))},[e,t]),n.a.createElement("div",{id:"RightColumn-wrapper",className:r?void 0:"is-hidden"},x&&n.a.createElement("div",{className:"overlay-backdrop",onClick:D}),n.a.createElement("div",{id:"RightColumn"},n.a.createElement(Qs,{chatId:t,isColumnOpen:M,isProfile:S,isSearch:k,isManagement:N,isStickerSearch:P,isGifSearch:T,isPollResults:A,profileState:g,managementScreen:p,onClose:D}),n.a.createElement(X.a,{name:R?"none":"zoom-fade",renderCount:pc+Ic,activeKey:N?pc+p:F},U)))}));var Cc=Object(n.h)(({isOpen:e})=>{const t=Object(Ie.a)(pe.a.Extra,"MediaViewer",!e);return t?n.a.createElement(t,null):void 0});var Ec=Object(n.h)(({isOpen:e})=>{const t=Object(Ie.a)(pe.a.Extra,"Notifications",!e);return t?n.a.createElement(t,null):void 0});var wc=Object(n.h)(({isOpen:e})=>{const t=Object(Ie.a)(pe.a.Extra,"Errors",!e);return t?n.a.createElement(t,null):void 0});var Mc=Object(n.h)(e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"ForwardPicker",!t);return a?n.a.createElement(a,e):void 0});a(242);let Sc,kc,Nc=!1;function Pc(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 Tc=Object(n.h)(Object(s.h)(e=>{const{chatId:t,messageId:a}=e.audioPlayer,s=t&&a?Object(o.k)(e,t,a):void 0;return{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),audioMessage:s}},(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,audioMessage:m})=>{c.o&&!Nc&&(Nc=!0,console.log(">>> RENDER MAIN")),Object(n.n)(()=>{e&&t()},[e,t]);const{transitionClassNames:h}=Object(Y.a)(!a,void 0,!0),{transitionClassNames:O}=Object(Y.a)(r,void 0,!0),j=Object(K.a)(h.replace(/([\w-]+)/g,"middle-column-$1"),O.replace(/([\w-]+)/g,"right-column-$1"));function g(e){e.preventDefault(),e.stopPropagation()}return Object(n.n)(()=>{document.body.classList.toggle("is-middle-column-open",j.includes("middle-column-open")),document.body.classList.toggle("is-right-column-shown",j.includes("right-column-open"))},[j]),Object(n.n)(()=>{d>0&&(document.body.classList.add("animating-right-column"),Object(Q.b)(350+c.c),Sc&&(clearTimeout(Sc),Sc=void 0),Sc=window.setTimeout(()=>{document.body.classList.remove("animating-right-column"),Sc=void 0},350+c.c))},[d,r]),Object(J.a)(()=>{const e=Object(o.q)(Object(s.e)());let t=0;clearInterval(kc),kc=window.setInterval(()=>{if(document.title.includes(c.D))Pc(!1);else{if(t%2==0){const t=Object(o.q)(Object(s.e)())-e;t>0&&(document.title=`${t} notification${t>1?"s":""}`,Pc(!0))}else document.title=c.db,Pc(!1);t++}},1e3)},()=>{clearInterval(kc),kc=void 0,document.title.includes(c.D)||(document.title=c.db),Pc(!1)}),n.a.createElement("div",{id:"Main",className:j,onDrop:g,onDragOver:g},n.a.createElement(Le,null),n.a.createElement(Vs,null),n.a.createElement(yc,null),n.a.createElement(Cc,{isOpen:i}),n.a.createElement(Mc,{isOpen:l}),n.a.createElement(Ec,{isOpen:b}),n.a.createElement(wc,{isOpen:u}),m&&n.a.createElement(dt,{key:m.id,message:m,noUi:!0}))}));c.o&&console.log(">>> FINISH LOAD MAIN BUNDLE"),Object(s.e)().connectionState||Object(s.d)().initApi()}}]);
|
||
//# sourceMappingURL=4.1197b4f2953ec8558e0c.js.map
|