mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-11 08:39:59 +01:00
2 lines
213 KiB
JavaScript
2 lines
213 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{103:function(e,t,a){"use strict";a.r(t),a.d(t,"Main",(function(){return An}));var s=a(2),n=a(1),c=a(0),r=(a(84),a(37)),o=a(5);window.addEventListener("popstate",e=>{if(!e.state)return;const{chatId:t,threadId:a,messageListType:n}=e.state;Object(s.d)().openChat({id:t,threadId:a,type:n,noPushState:!0})}),Object(s.b)("openChat",(e,t,a)=>{const{id:n,threadId:c=-1,type:i="thread",noPushState:l}=a,d=Object(o.y)(e);return d&&d.chatId===n&&d.threadId===c&&d.type===i||(e=Object(r.n)(e),e={...e,messages:{...e.messages,contentToBeScheduled:void 0},...n!==e.forwardMessages.toChatId&&{forwardMessages:{}}},Object(s.g)(e),l||window.history.pushState({chatId:n,threadId:c,messageListType:i},"")),Object(r.N)(e,n,c,i)}),Object(s.b)("openChatWithInfo",(e,t,a)=>{Object(s.g)({...e,isChatInfoShown:!0}),t.openChat(a)}),Object(s.b)("resetChatCreation",e=>({...e,chatCreation:void 0}));var i=a(6),l=a(19),d=a(3),b=a(7);let u;Object(s.b)("setScrollOffset",(e,t,a)=>{const{chatId:s,threadId:n,scrollOffset:c}=a;return Object(r.x)(e,s,n,"scrollOffset",c)}),Object(s.b)("setReplyingToId",(e,t,a)=>{const{messageId:s}=a,n=Object(o.y)(e);if(!n)return;const{chatId:c,threadId:i}=n;return Object(r.x)(e,c,i,"replyingToId",s)}),Object(s.b)("setEditingId",(e,t,a)=>{const{messageId:s}=a,n=Object(o.y)(e);if(!n)return;const{chatId:c,threadId:i,type:l}=n,d="scheduled"===l?"editingScheduledId":"editingId";return Object(r.x)(e,c,i,d,s)}),Object(s.b)("editLastMessage",e=>{const{chatId:t,threadId:a}=Object(o.y)(e)||{};if(!t||!a)return;const s=Object(o.m)(e,t),n=Object(o.Ib)(e,t,a);if(!s||!n)return;const c=Object(d.g)(n,t=>Boolean(s[t]&&Object(o.b)(e,s[t],a).canEdit));return c?Object(r.x)(e,t,a,"editingId",c):void 0}),Object(s.b)("replyToNextMessage",(e,t,a)=>{const{targetIndexDelta:s}=a,{chatId:n,threadId:c}=Object(o.y)(e)||{};if(!n||!c)return;const r=Object(o.m)(e,n),l=Object(o.Ib)(e,n,c);if(!r||!l)return;const d=Object(o.mb)(e,n,c);let b;if(Object(o.X)(e,n,c)&&d){const e=Object.keys(r),t=e.indexOf(d.toString())+s;b=t<=e.length+1&&t>=0?Number(e[t]):void 0}else if(c===i.MAIN_THREAD_ID){const t=Object(o.f)(e,n);b=t&&t.lastMessage?t.lastMessage.id:void 0}else{const t=Object(o.Db)(e,n,c);b=t?t.lastMessageId:void 0}t.setReplyingToId({messageId:b}),t.focusMessage({chatId:n,threadId:c,messageId:b})}),Object(s.b)("openMediaViewer",(e,t,a)=>{const{chatId:s,threadId:n,messageId:c,avatarOwnerId:r,profilePhotoIndex:o,origin:i}=a;return{...e,mediaViewer:{chatId:s,threadId:n,messageId:c,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:n,messageId:c}=a;return{...e,audioPlayer:{chatId:s,threadId:n,messageId:c}}}),Object(s.b)("closeAudioPlayer",e=>({...e,audioPlayer:{}})),Object(s.b)("openPollResults",(e,t,a)=>{const{chatId:n,messageId:c}=a;Object(o.W)(e)?n===e.pollResults.chatId&&c===e.pollResults.messageId||Object(s.g)({...e,pollResults:{chatId:n,messageId:c,voters:{}}}):window.setTimeout(()=>{const e=Object(s.e)();Object(s.g)({...e,pollResults:{chatId:n,messageId:c,voters:{}}})},450)}),Object(s.b)("closePollResults",e=>{Object(s.g)({...e,pollResults:{}})}),Object(s.b)("focusLastMessage",(e,t)=>{const a=Object(o.y)(e);if(!a)return;const{chatId:s,threadId:n}=a;let c;if(n===i.MAIN_THREAD_ID){const t=Object(o.f)(e,s);c=t&&t.lastMessage?t.lastMessage.id:void 0}else{const t=Object(o.Db)(e,s,n);c=t?t.lastMessageId:void 0}c&&t.focusMessage({chatId:s,threadId:n,messageId:c,noHighlight:!0})}),Object(s.b)("focusMessage",(e,t,a)=>{const{chatId:n,threadId:c=i.MAIN_THREAD_ID,messageListType:d="thread",noHighlight:b,groupedId:m,groupedChatId:h}=a;let{messageId:O}=a;if(void 0!==m){const t=Object(o.J)(e,h,m);t&&t.length&&([O]=t)}const j=Object(o.y)(e),g=!j||n!==j.chatId||c!==j.threadId||d!==j.type;u&&(clearTimeout(u),u=void 0),u=window.setTimeout(()=>{let e=Object(s.e)();e=Object(r.P)(e),e=Object(r.O)(e),Object(s.g)(e)},2e3),e=Object(r.P)(e,n,O,b),e=Object(r.O)(e,void 0),g&&(e=Object(r.O)(e,l.b.Static));const f=Object(o.Ib)(e,n,c);if(f&&f.includes(O))return Object(s.g)(e),void t.openChat({id:n,threadId:c});if(g&&(e=Object(r.x)(e,n,c,"viewportIds",void 0)),e=Object(r.x)(e,n,c,"outlyingIds",void 0),f&&!g){const t=O>f[0]?l.b.Down:l.b.Up;e=Object(r.O)(e,t)}Object(s.g)(e),t.openChat({id:n,threadId:c}),t.loadViewportMessages()}),Object(s.b)("openForwardMenu",(e,t,a)=>{const{fromChatId:s,messageIds:n,groupedId:c}=a;let r;return c&&(r=Object(o.ab)(e,s,c)),{...e,forwardMessages:{fromChatId:s,messageIds:r||n,isModalShown:!0}}}),Object(s.b)("exitForwardMode",e=>{Object(s.g)({...e,forwardMessages:{}})}),Object(s.b)("setForwardChatId",(e,t,a)=>{const{id:n}=a;Object(s.g)({...e,forwardMessages:{...e.forwardMessages,toChatId:n,isModalShown:!1}}),t.openChat({id:n}),t.closeMediaViewer(),t.exitMessageSelectMode()}),Object(s.b)("openForwardMenuForSelectedMessages",(e,t)=>{if(!e.selectedMessages)return;const{chatId:a,messageIds:s}=e.selectedMessages;t.openForwardMenu({fromChatId:a,messageIds:s})}),Object(s.b)("enterMessageSelectMode",(e,t,a)=>{const{messageId:s}=a||{},n=Object(o.r)(e);return n?Object(r.m)(e,n.id,s):e}),Object(s.b)("toggleMessageSelection",(e,t,a)=>{const{messageId:n,groupedId:c,childMessageIds:i,withShift:l}=a,d=Object(o.y)(e);if(!d)return;const{chatId:u,threadId:m,type:h}=d;e=Object(r.G)(e,u,m,h,n,c,i,l),Object(s.g)(e),e.shouldShowContextMenuHint&&(t.disableContextMenuHint(),t.showNotification({message:`To **edit** or **reply**, close this menu. Then ${b.m?"long tap":"right click"} on a message.`}))}),Object(s.b)("disableContextMenuHint",e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}}),Object(s.b)("exitMessageSelectMode",r.n),Object(s.b)("openPollModal",e=>({...e,isPollModalOpen:!0})),Object(s.b)("closePollModal",e=>({...e,isPollModalOpen:!1}));Object(s.b)("setGlobalSearchQuery",(e,t,a)=>{const{query:s}=a,{chatId:n}=e.globalSearch;return Object(r.R)(e,{globalResults:{},localResults:{},resultsByType:void 0,...s?{fetchingStatus:{chats:!n,messages:!0}}:{fetchingStatus:void 0},query:s})}),Object(s.b)("addRecentlyFoundChatId",(e,t,a)=>{const{id:s}=a,{recentlyFoundChatIds:n}=e.globalSearch;if(!n)return Object(r.R)(e,{recentlyFoundChatIds:[s]});const c=n.filter(e=>e!==s);return c.unshift(s),c.length>10&&c.pop(),Object(r.R)(e,{recentlyFoundChatIds:c})}),Object(s.b)("clearRecentlyFoundChats",e=>Object(r.R)(e,{recentlyFoundChatIds:void 0})),Object(s.b)("setGlobalSearchContent",(e,t,a)=>{const{content:s}=a;return Object(r.S)(e,s)}),Object(s.b)("setGlobalSearchChatId",(e,t,a)=>{const{id:s}=a;return Object(r.R)(e,{chatId:s,query:void 0,resultsByType:void 0})});var m=a(50),h=a(4);Object(s.b)("openLocalTextSearch",e=>{const{chatId:t,threadId:a}=Object(o.y)(e)||{};if(t&&a)return Object(r.Y)(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.Y)(e,t,a,!1),e=Object(r.t)(e,t,a,void 0)}),Object(s.b)("setLocalTextSearchQuery",(e,t,a)=>{const{chatId:s,threadId:n}=Object(o.y)(e)||{};if(!s||!n)return;const{query:c}=a,i=Object(h.a)(s,n),{query:l}=e.localTextSearch.byChatThreadKey[i]||{};return c!==l&&(e=Object(r.t)(e,s,n,m.a)),e=Object(r.Y)(e,s,n,!0,c)}),Object(s.b)("setLocalMediaSearchType",(e,t,a)=>{const{chatId:s}=Object(o.y)(e)||{};if(!s)return;const{mediaType:n}=a;return Object(r.X)(e,s,n)}),Object(s.b)("setStickerSearchQuery",(e,t,a)=>{const{query:s}=a;return{...e,stickers:{...e.stickers,search:{query:s,resultIds:void 0}}}}),Object(s.b)("setGifSearchQuery",(e,t,a)=>{const{query:s}=a;return{...e,gifs:{...e.gifs,search:{query:s,offsetId:void 0,results:void 0}}}}),Object(s.b)("openUserInfo",(e,t,a)=>{const{id:s}=a;t.openChat({id:s})});Object(s.b)("openChat",e=>Object(r.fb)(e,void 0)),Object(s.b)("setSettingOption",(e,t,a)=>Object(r.v)(e,a)),Object(s.b)("setThemeSettings",(e,t,a)=>{const{theme:s,...n}=a;return Object(r.w)(e,s,n)});var O=a(169);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(!b.k&&!b.l)return;const{id:s}=a;return{...e,isLeftColumnShown:void 0===s}}),Object(s.b)("toggleLeftColumn",e=>({...e,isLeftColumnShown:!e.isLeftColumnShown})),Object(s.b)("addRecentEmoji",(e,t,a)=>{const{emoji:s}=a,{recentEmojis:n}=e;if(!n)return{...e,recentEmojis:[s]};const c=n.filter(e=>e!==s);return c.unshift(s),c.length>18&&c.pop(),{...e,recentEmojis:c}}),Object(s.b)("addRecentSticker",(e,t,a)=>{const{sticker:s}=a,{recent:n}=e.stickers;if(!n)return{...e,stickers:{...e.stickers,recent:{hash:0,stickers:[s]}}};const c=n.stickers.filter(e=>e.id!==s.id);return c.unshift(s),{...e,stickers:{...e.stickers,recent:{...n,stickers:c}}}}),Object(s.b)("showNotification",(e,t,a)=>{const s=a,n=[...e.notifications],c=n.findIndex(e=>e.message===s.message);return-1!==c&&n.splice(c,1),n.push(s),{...e,notifications:n}}),Object(s.b)("dismissNotification",e=>{const t=[...e.notifications];return t.pop(),{...e,notifications:t}}),Object(s.b)("showError",(e,t,a)=>{const{error:s}=a;if(!Object(O.a)(s))return e;const n=[...e.errors],c=n.findIndex(e=>e.message===s.message);return-1!==c&&n.splice(c,1),n.push(s),{...e,errors:n}}),Object(s.b)("dismissError",e=>{const t=[...e.errors];return t.pop(),{...e,errors:t}}),Object(s.b)("toggleSafeLinkModal",(e,t,a)=>{const{url:s}=a;return{...e,safeLinkModalUrl:s}}),Object(s.b)("openHistoryCalendar",(e,t,a)=>{const{selectedAt:s}=a;return{...e,historyCalendarSelectedAt:s}}),Object(s.b)("closeHistoryCalendar",e=>({...e,historyCalendarSelectedAt:void 0})),Object(s.b)("openPaymentModal",(e,t,a)=>{const{messageId:s}=a;return{...e,payment:{...e.payment,messageId:s,isPaymentModalOpen:!0}}}),Object(s.b)("closePaymentModal",e=>{const t=Object(r.h)(e);return Object(r.i)(t)});a(85);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 c=await Object(j.a)("fetchChats",{limit:n.j,offsetDate:a,archived:"archived"===e,withPinned:void 0===Object(s.e)().chats.orderedPinnedIds[e],serverTimeOffset:Object(s.e)().serverTimeOffset});if(!c)return;const{chatIds:o}=c;o.length>0&&o[0]===t&&o.shift();let l=Object(s.e)();l=Object(r.f)(l,Object(d.c)(c.users,"id")),l=Object(r.M)(l,Object(d.c)(c.chats,"id")),l=Object(r.I)(l,e,o),l=Object(r.J)(l,e,c),Object.keys(c.draftsById).map(Number).forEach(e=>{l=Object(r.x)(l,e,i.MAIN_THREAD_ID,"draft",c.draftsById[e])}),Object.keys(c.replyingToById).map(Number).forEach(e=>{l=Object(r.x)(l,e,i.MAIN_THREAD_ID,"replyingToId",c.replyingToById[e])}),0!==o.length||l.chats.isFullyLoaded[e]||(l={...l,chats:{...l.chats,isFullyLoaded:{...l.chats.isFullyLoaded,[e]:!0}}}),Object(s.g)(l)}async function y(e){const t=await Object(j.a)("fetchFullChat",e);if(!t)return;const{users:a,fullInfo:n}=t;let c=Object(s.e)();a&&(c=Object(r.f)(c,Object(d.c)(a,"id"))),c=Object(r.H)(c,e.id,{fullInfo:n}),Object(s.g)(c)}async function C(e,t,a){const n=Object(s.e)(),c=Object(o.h)(n,t);if(c&&!c.isMin)return void(a?e.focusMessage({chatId:c.id,messageId:a}):e.openChat({id:c.id}));const i=Object(o.r)(n);e.openChat({id:-1});const l=await Object(j.a)("getChatByUsername",t);if(!l)return i&&e.openChat({id:i.id}),void e.showNotification({message:"User does not exist"});Object(s.g)(Object(r.H)(Object(s.e)(),l.id,l)),a?e.focusMessage({chatId:l.id,messageId:a}):e.openChat({id:l.id})}Object(s.b)("preloadTopChatMessages",(e,t)=>{(async()=>{const a=[];for(let c=0;c<n.Eb;c++){await Object(g.e)(100);const{byId:n,listIds:{active:c},orderedPinnedIds:{active:r}}=Object(s.e)().chats;if(!c)return;const{chatId:l}=Object(o.y)(e)||{},{pinnedChats:d,otherChats:b}=Object(h.Bb)(n,c,r),u=[...d,...b].find(({id:e})=>e!==l&&!a.includes(e));if(!u)return;a.push(u.id),t.loadViewportMessages({chatId:u.id,threadId:i.MAIN_THREAD_ID})}})()}),Object(s.b)("openChat",(e,t,a)=>{const{id:s,threadId:n}=a,{currentUserId:c}=e,r=Object(o.f)(e,s);if(r&&r.hasUnreadMark&&t.toggleChatUnread({id:s}),r)Object(h.nb)(r)&&!r.isMin&&t.requestChatUpdate({chatId:s});else if(s===c)Object(j.a)("fetchChat",{type:"self"});else{const t=Object(o.Hb)(e,s);t&&Object(j.a)("fetchChat",{type:"user",user:t})}if(n!==i.MAIN_THREAD_ID){Object(o.Fb)(e,s,n)||t.requestThreadInfoUpdate({chatId:s,threadId:n})}}),Object(s.b)("openSupportChat",(e,t)=>{const a=Object(o.Ab)(e);t.openChat({id:a?a.id:-1}),a||(async()=>{const e=await Object(j.a)("fetchChat",{type:"support"});e&&t.openChat({id:e.chatId})})()}),Object(s.b)("openTipsChat",(e,t)=>{t.openChatByUsername({username:n.Db})}),Object(s.b)("loadMoreChats",(e,t,a)=>{const{listType:s="active"}=a,n=e.chats.listIds[s];if(e.chats.isFullyLoaded[s])return;const c=n?n.map(t=>e.chats.byId[t]).filter(t=>Boolean(t&&t.lastMessage)&&!Object(o.N)(e,t.id)).sort((e,t)=>e.lastMessage.date-t.lastMessage.date)[0]:void 0;f(c?()=>v(s,c.id,c.lastMessage.date):()=>v(s))}),Object(s.b)("loadFullChat",(e,t,a)=>{const{chatId:s,force:n}=a,c=Object(o.f)(e,s);c&&(n?y(c):I(()=>y(c)))}),Object(s.b)("loadTopChats",()=>{p(()=>v("active"))}),Object(s.b)("requestChatUpdate",(e,t,a)=>{const{serverTimeOffset:s}=e,{chatId:n}=a,c=Object(o.f)(e,n);c&&Object(j.a)("requestChatUpdate",{chat:c,serverTimeOffset:s})}),Object(s.b)("updateChatMutedState",(e,t,a)=>{const{serverTimeOffset:n}=e,{chatId:c,isMuted:i}=a,l=Object(o.f)(e,c);l&&(Object(s.g)(Object(r.H)(e,c,{isMuted:i})),Object(j.a)("updateChatMutedState",{chat:l,isMuted:i,serverTimeOffset:n}))}),Object(s.b)("createChannel",(e,t,a)=>{const{title:n,about:c,photo:i,memberIds:d}=a;!async function(e,t,a,n){Object(s.g)({...Object(s.e)(),chatCreation:{progress:l.a.InProgress}});const c=await Object(j.a)("createChannel",{title:e,about:a,users:t});if(!c)return;const{id:o,accessHash:i}=c;let d=Object(s.e)();d=Object(r.H)(d,o,c),d={...d,chatCreation:{...d.chatCreation,progress:c?l.a.Complete:l.a.Error}},Object(s.g)(d),Object(s.d)().openChat({id:o}),o&&i&&n&&await Object(j.a)("editChatPhoto",{chatId:o,accessHash:i,photo:n})}(n,d.map(t=>Object(o.Hb)(e,t)).filter(Boolean),c,i)}),Object(s.b)("joinChannel",(e,t,a)=>{const{chatId:s}=a,n=Object(o.f)(e,s);if(!n)return;const{id:c,accessHash:r}=n;c&&r&&Object(j.a)("joinChannel",{channelId:c,accessHash:r})}),Object(s.b)("leaveChannel",(e,t,a)=>{(async()=>{const{chatId:s}=a,n=Object(o.f)(e,s);if(!n)return;const{id:c,accessHash:r}=n;c&&r&&await Object(j.a)("leaveChannel",{channelId:c,accessHash:r}),t.openChat({id:void 0})})()}),Object(s.b)("deleteChannel",(e,t,a)=>{(async()=>{const{chatId:s}=a,n=Object(o.f)(e,s);if(!n)return;const{id:c,accessHash:r}=n;c&&r&&await Object(j.a)("deleteChannel",{channelId:c,accessHash:r}),t.openChat({id:void 0})})()}),Object(s.b)("createGroupChat",(e,t,a)=>{const{title:n,memberIds:c,photo:i}=a;!async function(e,t,a){Object(s.g)({...Object(s.e)(),chatCreation:{progress:l.a.InProgress}});const n=await Object(j.a)("createGroupChat",{title:e,users:t});if(!n)return;const{id:c}=n;let o=Object(s.e)();o=Object(r.H)(o,c,n),o={...o,chatCreation:{...o.chatCreation,progress:n?l.a.Complete:l.a.Error}},Object(s.g)(o),Object(s.d)().openChat({id:c}),c&&a&&await Object(j.a)("editChatPhoto",{chatId:c,photo:a})}(n,c.map(t=>Object(o.Hb)(e,t)).filter(Boolean),i)}),Object(s.b)("toggleChatPinned",(e,t,a)=>{const{id:s,folderId:c}=a,r=Object(o.f)(e,s);if(r)if(c){const t=Object(o.i)(e,c);if(t){const a=!Object(o.N)(e,s,c),{pinnedChatIds:n,includedChatIds:r}=t,i=a?[s,...n||[]]:(n||[]).filter(e=>e!==s),l=[s,...r];Object(j.a)("editChatFolder",{id:c,folderUpdate:{...t,pinnedChatIds:i,includedChatIds:l}})}}else{const t=Object(o.j)(e,s),a=Object(o.N)(e,s,"archived"===t?n.h:void 0);Object(j.a)("toggleChatPinned",{chat:r,shouldBePinned:!a})}}),Object(s.b)("toggleChatArchived",(e,t,a)=>{const{id:s}=a,c=Object(o.f)(e,s);c&&Object(j.a)("toggleChatArchived",{chat:c,folderId:Object(h.ib)(c)?0:n.h})}),Object(s.b)("loadChatFolders",()=>{!async function(){const e=await Object(j.a)("fetchChatFolders");if(e){const t=Object(s.e)();Object(s.g)({...t,chatFolders:{...t.chatFolders,...e}})}}()}),Object(s.b)("loadRecommendedChatFolders",()=>{!async function(){const e=await Object(j.a)("fetchRecommendedChatFolders");if(e){const t=Object(s.e)();Object(s.g)({...t,chatFolders:{...t.chatFolders,recommended:e}})}}()}),Object(s.b)("editChatFolder",(e,t,a)=>{const{id:s,folderUpdate:n}=a,c=Object(o.i)(e,s);c&&Object(j.a)("editChatFolder",{id:s,folderUpdate:{id:s,emoticon:c.emoticon,pinnedChatIds:c.pinnedChatIds,...n}})}),Object(s.b)("addChatFolder",(e,t,a)=>{const{folder:c}=a,{orderedIds:r}=e.chatFolders;!async function(e,t){const{id:a,description:n,...c}=e;if(await Object(j.a)("editChatFolder",{id:t+1,folderUpdate:{id:t+1,...c}}),!n)return;const r=Object(s.e)(),{recommended:o}=r.chatFolders;o&&Object(s.g)({...r,chatFolders:{...r.chatFolders,recommended:o.filter(({id:e})=>e!==a)}})}(c,r&&r.length?Math.max.apply(Math.max,r):n.h)}),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,{serverTimeOffset:n}=e,c=Object(o.f)(e,s);c&&(c.unreadCount?Object(j.a)("markMessageListRead",{serverTimeOffset:n,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 c=n.ib.exec(s);if(c){const e=c[1];(async()=>{const a=await Object(j.a)("openChatByInvite",e);a&&t.openChat({id:a.chatId})})()}else{c=n.jb.exec(s);const e=c[1],a=c[2]?Number(c[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:n}=a;let c=Object(o.f)(e,s);c&&(async()=>{if(Object(h.jb)(c)){if(c=await Object(j.a)("migrateChat",c),!c)return;t.openChat({id:c.id})}Object(j.a)("togglePreHistoryHidden",{chat:c,isEnabled:n})})()}),Object(s.b)("updateChatDefaultBannedRights",(e,t,a)=>{const{chatId:s,bannedRights:n}=a,c=Object(o.f)(e,s);c&&Object(j.a)("updateChatDefaultBannedRights",{chat:c,bannedRights:n})}),Object(s.b)("updateChatMemberBannedRights",(e,t,a)=>{const{chatId:n,userId:c,bannedRights:i}=a;let l=Object(o.f)(e,n);const d=Object(o.Hb)(e,c);l&&d&&(async()=>{if(Object(h.jb)(l)){if(l=await Object(j.a)("migrateChat",l),!l)return;t.openChat({id:l.id})}await Object(j.a)("updateChatMemberBannedRights",{chat:l,user:d,bannedRights:i});const e=Object(s.e)(),a=Object(o.f)(e,n);if(!a||!a.fullInfo)return;const{members:b,kickedMembers:u}=a.fullInfo,m=!!i.viewMessages,O=!Object.keys(i).length;Object(s.g)(Object(r.H)(e,n,{fullInfo:{...a.fullInfo,...b&&m&&{members:b.filter(e=>e.userId!==c)},...b&&!m&&{members:b.map(e=>e.userId===c?{...e,bannedRights:i}:e)},...O&&u&&{kickedMembers:u.filter(e=>e.userId!==c)}}}))})()}),Object(s.b)("updateChatAdmin",(e,t,a)=>{const{chatId:n,userId:c,adminRights:i,customTitle:l}=a;let d=Object(o.f)(e,n);const b=Object(o.Hb)(e,c);d&&b&&(async()=>{if(Object(h.jb)(d)){if(d=await Object(j.a)("migrateChat",d),!d)return;t.openChat({id:d.id})}await Object(j.a)("updateChatAdmin",{chat:d,user:b,adminRights:i,customTitle:l});const e=Object(s.e)(),a=Object(o.f)(e,n);if(!a||!a.fullInfo)return;const{adminMembers:u}=a.fullInfo,m=!Object.keys(i).length;Object(s.g)(Object(r.H)(e,n,{fullInfo:{...a.fullInfo,...u&&m&&{adminMembers:u.filter(e=>e.userId!==c)},...u&&!m&&{adminMembers:u.map(e=>e.userId===c?{...e,adminRights:i,customTitle:l}:e)}}}))})()}),Object(s.b)("updateChat",(e,t,a)=>{const{chatId:n,title:c,about:i,photo:d}=a,b=Object(o.f)(e,n);b&&(async()=>{Object(s.g)(Object(r.bb)(Object(s.e)(),l.f.InProgress)),await Promise.all([b.title!==c?Object(j.a)("updateChatTitle",b,c):void 0,b.fullInfo&&b.fullInfo.about!==i?Object(j.a)("updateChatAbout",b,i):void 0,d?Object(j.a)("editChatPhoto",{chatId:n,accessHash:b.accessHash,photo:d}):void 0]),Object(s.g)(Object(r.bb)(Object(s.e)(),l.f.Complete))})()}),Object(s.b)("toggleSignatures",(e,t,a)=>{const{chatId:s,isEnabled:n}=a,c=Object(o.f)(e,s);c&&Object(j.a)("toggleSignatures",{chat:c,isEnabled:n})}),Object(s.b)("loadGroupsForDiscussion",()=>{(async()=>{const e=await Object(j.a)("fetchGroupsForDiscussion");if(!e)return;const t=e.reduce((e,t)=>(t&&(e[t.id]=t),e),{}),a=Object(r.c)(Object(s.e)(),t);Object(s.g)({...a,chats:{...a.chats,forDiscussionIds:Object.keys(t).map(Number)}})})()}),Object(s.b)("linkDiscussionGroup",(e,t,a)=>{const{channelId:s,chatId:n}=a,c=Object(o.f)(e,s);let r=Object(o.f)(e,n);c&&r&&(async()=>{if(Object(h.jb)(r)){if(r=await Object(j.a)("migrateChat",r),!r)return;t.openChat({id:r.id})}let{fullInfo:e}=r;if(!e){const t=await Object(j.a)("fetchFullChat",r);if(!t)return;e=t.fullInfo}e.isPreHistoryHidden&&await Object(j.a)("togglePreHistoryHidden",{chat:r,isEnabled:!1}),Object(j.a)("setDiscussionGroup",{channel:c,chat:r})})()}),Object(s.b)("unlinkDiscussionGroup",(e,t,a)=>{const{channelId:s}=a,n=Object(o.f)(e,s);if(!n)return;let c;n.fullInfo&&n.fullInfo.linkedChatId&&(c=Object(o.f)(e,n.fullInfo.linkedChatId)),(async()=>{await Object(j.a)("setDiscussionGroup",{channel:n}),c&&y(c)})()}),Object(s.b)("setActiveChatFolder",(e,t,a)=>({...e,chatFolders:{...e.chatFolders,activeChatFolder:a}})),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(h.jb)(a))return;const n=a.fullInfo&&a.fullInfo.members&&a.fullInfo.members.length||void 0,c=await Object(j.a)("fetchMembers",a.id,a.accessHash,"recent",n);if(!c)return;const{members:i,users:l}=c;i&&i.length&&(e=Object(s.e)(),e=Object(r.f)(e,Object(d.c)(l,"id")),e=Object(r.H)(e,a.id,{fullInfo:{...a.fullInfo,members:[...(a.fullInfo||{}).members||[],...i||[]]}}),Object(s.g)(e))})()});var w=a(152);const E=new Map,M=Object(g.g)(e=>e(),1e3,!0);async function S(e,t,a,c,i=!1,b=!1){const u=e.id;let m;switch(c){case l.e.Backwards:m=void 0;break;case l.e.Around:m=-(Math.round(n.V/2)+1);break;case l.e.Forwards:m=-(n.V+1)}const h=await Object(j.a)("fetchMessages",{chat:Object(o.Eb)(Object(s.e)(),u,t),offsetId:a,addOffset:m,limit:n.V,threadId:t});if(!h)return;const{messages:O,users:g,chats:f,threadInfos:p}=h,I=Object(d.c)(O,"id"),v=Object.keys(I).map(Number);let y=Object(s.e)();y=Object(r.b)(y,u,I),y=i?Object(r.db)(y,u,t,v):Object(r.V)(y,u,t,v),y=Object(r.f)(y,Object(d.c)(g,"id")),y=Object(r.c)(y,Object(d.c)(f,"id")),y=Object(r.lb)(y,u,p);let C=Object(o.Y)(y,u,t);const w=Object(o.gb)(y,u,t);if(i&&C&&w&&Object(d.b)(C,w)&&(y=Object(r.V)(y,u,t,w),C=Object(o.Y)(y,u,t),y=Object(r.x)(y,u,t,"outlyingIds",void 0),i=!1),!b){const e=i?w:C,{newViewportIds:s}=k(e,a,c);y=Object(r.z)(y,u,t,s)}Object(s.g)(y)}function k(e,t,a){const{length:s}=e,c=t?function(e,t){return t<e[0]?0:t>e[e.length-1]?e.length-1:e.findIndex((a,s)=>a===t||a<t&&e[s+1]>t)}(e,t):-1,r=a===l.e.Backwards?c:c+1||s,o=r-n.V,i=r+n.V-1,d=e.slice(Math.max(0,o),i+1);let b,u;switch(a){case l.e.Backwards:b=r>0,u=o>=0;break;case l.e.Forwards:b=r<s,u=i<=s-1;break;case l.e.Around:default:b=d.length>0,u=d.length===n.V}return{newViewportIds:d,areSomeLocal:b,areAllLocal:u}}async function N(e){let t;const a=e.attachment?(e,n)=>{E.has(n)||(t=n,E.set(n,a));const c=Object(s.e)();Object(s.g)({...c,fileUploads:{byMessageLocalId:{...c.fileUploads.byMessageLocalId,[n]:{progress:e}}}})}:void 0;e.replyingTo&&await Object(g.f)();const n=Object(s.e)();e.serverTimeOffset=n.serverTimeOffset;const c=Object(o.y)(n);if(!c)return;const{threadId:r}=c;e.replyingTo||r===i.MAIN_THREAD_ID||(e.replyingTo=Object(o.Fb)(n,e.chat.id,r)),await Object(j.a)("sendMessage",e,a),a&&t&&E.delete(t)}Object(s.b)("loadViewportMessages",(e,t,a)=>{const{direction:s=l.e.Around,isBudgetPreload:c=!1}=a||{};let{chatId:i,threadId:d}=a||{};if(!i){const t=Object(o.y)(e);if(!t)return;i=t.chatId,d=t.threadId}const b=Object(o.f)(e,i);if(!b||b.isRestricted)return;const u=Object(o.Ib)(e,i,d),m=Object(o.Y)(e,i,d),h=Object(o.gb)(e,i,d);if(u&&u.length&&s!==l.e.Around){const a=s===l.e.Backwards?u[0]:u[u.length-1],n=Boolean(h),o=n?h:m,{newViewportIds:O,areSomeLocal:j,areAllLocal:g}=k(o,a,s);if(j&&(e=Object(r.z)(e,i,d,O)),async function(e,t,a,s,n,c,r,o){t||await S(n,c,o,r,a,s);s||(await Promise.resolve(),e.loadViewportMessages({chatId:n.id,threadId:c,direction:r,isBudgetPreload:!0}))}(t,g,n,c,b,d,s,a),c)return}else{const t=Object(o.I)(e,i)||Object(o.lb)(e,i,d),a=Boolean(t&&m&&!m.includes(t)),s=(a?h:m)||[],{newViewportIds:u,areSomeLocal:O,areAllLocal:j}=k(s,t,l.e.Around);O&&u.length>=n.V&&(e=Object(r.z)(e,i,d,u)),j||S(b,d,t,l.e.Around,a,c)}return e}),Object(s.b)("loadMessage",(e,t,a)=>{const{chatId:n,messageId:c,replyOriginForId:l}=a,b=Object(o.f)(e,n);b&&async function(e,t,a){const n=await Object(j.a)("fetchMessage",{chat:e,messageId:t});if(!n)return;if(n===i.MESSAGE_DELETED){if(a){let t=Object(s.e)();const n=Object(o.k)(t,e.id,a);t=Object(r.L)(t,e.id,a,{...n,replyToMessageId:void 0}),Object(s.g)(t)}return}let c=Object(s.e)();c=Object(r.L)(c,e.id,t,n.message),c=Object(r.f)(c,Object(d.c)(n.users,"id")),Object(s.g)(c)}(b,c,l)}),Object(s.b)("sendMessage",(e,t,a)=>{const s=Object(o.y)(e);if(!s)return;const{chatId:c,threadId:r,type:i}=s;if("scheduled"===i&&!a.scheduledAt)return{...e,messages:{...e.messages,contentToBeScheduled:a}};const l=Object(o.f)(e,c);t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:c,threadId:r,value:!1});const b={...a,chat:l,replyingTo:Object(o.mb)(e,c,r),noWebPage:Object(o.cb)(e,c,r)},u=!a.attachments||a.attachments.length<=1,m=!u&&a.attachments&&a.attachments.length>1;if(u){const{attachments:e,...t}=b;N({...t,attachment:e?e[0]:void 0})}else if(m){const{text:e,entities:t,attachments:a,...s}=b,c=Object(d.n)(a,n.L);for(let a=0;a<c.length;a++){const[n,...r]=c[a],o=`${Date.now()}${a}`;N({...s,text:0===a?e:void 0,entities:0===a?t:void 0,attachment:n,groupedId:r.length>0?o:void 0}),r.forEach(e=>{N({...s,attachment:e,groupedId:o})})}}else{const{text:e,entities:t,attachments:a,replyingTo:s,...n}=b;e&&N({...n,text:e,entities:t,replyingTo:s}),a.forEach(e=>{N({...n,attachment:e})})}}),Object(s.b)("editMessage",(e,t,a)=>{const{serverTimeOffset:s}=e,{text:n,entities:c}=a,r=Object(o.y)(e);if(!r)return;const{chatId:i,threadId:l,type:d}=r,b=Object(o.f)(e,i),u=Object(o.D)(e,i,l,d);b&&u&&(Object(j.a)("editMessage",{chat:b,message:u,text:n,entities:c,noWebPage:Object(o.cb)(e,i,l),serverTimeOffset:s}),t.setEditingId({messageId:void 0}))}),Object(s.b)("cancelSendingMessage",(e,t,a)=>{const{chatId:s,messageId:n}=a,c=Object(o.k)(e,s,n),r=c&&E.get(c.previousLocalId||c.id);r&&Object(j.b)(r),t.apiUpdate({"@type":"deleteMessages",ids:[n],chatId:s})}),Object(s.b)("saveDraft",(e,t,a)=>{const{chatId:s,threadId:n,draft:c}=a;if(!c)return;const{text:l,entities:d}=c,b=Object(o.f)(e,s);return n===i.MAIN_THREAD_ID&&Object(j.a)("saveDraft",{chat:b,text:l,entities:d,replyToMsgId:Object(o.mb)(e,s,n)}),e=Object(r.x)(e,s,n,"draft",c),e=Object(r.H)(e,s,{hasDraft:!0})}),Object(s.b)("clearDraft",(e,t,a)=>{const{chatId:s,threadId:n,localOnly:c}=a;if(!Object(o.B)(e,s,n))return;const l=Object(o.f)(e,s);return c||n!==i.MAIN_THREAD_ID||Object(j.a)("clearDraft",l),e=Object(r.x)(e,s,n,"draft",void 0),e=Object(r.H)(e,s,{hasDraft:!1})}),Object(s.b)("toggleMessageWebPage",(e,t,a)=>{const{chatId:s,threadId:n,noWebPage:c}=a;return Object(r.x)(e,s,n,"noWebPage",c)}),Object(s.b)("pinMessage",(e,t,a)=>{const s=Object(o.r)(e);if(!s)return;const{messageId:n,isUnpin:c,isOneSide:r,isSilent:i}=a;Object(j.a)("pinMessage",{chat:s,messageId:n,isUnpin:c,isOneSide:r,isSilent:i})}),Object(s.b)("unpinAllMessages",(e,t,a)=>{const n=Object(o.f)(e,a.chatId);n&&async function(e){await Object(j.a)("unpinAllMessages",{chat:e});let t=Object(s.e)();t=Object(r.x)(t,e.id,i.MAIN_THREAD_ID,"pinnedIds",[]),Object(s.g)(t)}(n)}),Object(s.b)("deleteMessages",(e,t,a)=>{const{messageIds:s,shouldDeleteForAll:n}=a,c=Object(o.y)(e);if(!c)return;const{chatId:r,threadId:i}=c,l=Object(o.f)(e,r);Object(j.a)("deleteMessages",{chat:l,messageIds:s,shouldDeleteForAll:n});const d=Object(o.C)(e,r,i);s.includes(d)&&t.setEditingId({messageId:void 0})}),Object(s.b)("deleteScheduledMessages",(e,t,a)=>{const{messageIds:s}=a,n=Object(o.y)(e);if(!n)return;const{chatId:c}=n,r=Object(o.f)(e,c);Object(j.a)("deleteScheduledMessages",{chat:r,messageIds:s});const i=Object(o.E)(e,c);s.includes(i)&&t.setEditingId({messageId:void 0})}),Object(s.b)("deleteHistory",(e,t,a)=>{(async()=>{const{chatId:s,shouldDeleteForAll:n}=a,c=Object(o.f)(e,s);if(!c)return;const r=c.lastMessage&&c.lastMessage.id;await Object(j.a)("deleteHistory",{chat:c,shouldDeleteForAll:n,maxId:r}),t.openChat({id:void 0})})()}),Object(s.b)("markMessageListRead",(e,t,a)=>{const{serverTimeOffset:s}=e,n=Object(o.y)(e);if(!n)return;const{chatId:c,threadId:r}=n,i=Object(o.Eb)(e,c,r);if(!i)return;const{maxId:l}=a;M(()=>{Object(j.a)("markMessageListRead",{serverTimeOffset:s,chat:i,threadId:r,maxId:l})})}),Object(s.b)("markMessagesRead",(e,t,a)=>{const s=Object(o.r)(e);if(!s)return;const{messageIds:n}=a;Object(j.a)("markMessagesRead",{chat:s,messageIds:n})}),Object(s.b)("loadWebPagePreview",(e,t,a)=>{const{text:n}=a;!async function(e){const t=await Object(j.a)("fetchWebPagePreview",{message:e});Object(s.g)({...Object(s.e)(),webPagePreview:t})}(n)}),Object(s.b)("clearWebPagePreview",e=>{if(e.webPagePreview)return{...e,webPagePreview:void 0}}),Object(s.b)("sendPollVote",(e,t,a)=>{const{chatId:s,messageId:n,options:c}=a,r=Object(o.f)(e,s);r&&Object(j.a)("sendPollVote",{chat:r,messageId:n,options:c})}),Object(s.b)("loadPollOptionResults",(e,t,a)=>{const{chat:n,messageId:c,option:o,offset:i,limit:l,shouldResetVoters:b}=a;!async function(e,t,a,n,c,o){const i=await Object(j.a)("loadPollOptionResults",{chat:e,messageId:t,option:a,offset:n,limit:c});if(!i)return;let l=Object(s.e)();l=Object(r.f)(l,Object(d.c)(i.users,"id"));const{voters:b}=l.pollResults;Object(s.g)({...l,pollResults:{...l.pollResults,voters:{...b,[a]:[...!o&&b&&b[a]?b[a]:[],...i&&i.users.map(e=>e.id)].filter((e,t,a)=>a.indexOf(e)===t)},offsets:{...l.pollResults.offsets?l.pollResults.offsets:{},[a]:i.nextOffset||""}}})}(n,c,o,i,l,b)}),Object(s.b)("forwardMessages",e=>{const{fromChatId:t,messageIds:a,toChatId:n}=e.forwardMessages,c=t?Object(o.f)(e,t):void 0,r=n?Object(o.f)(e,n):void 0,i=t&&a?a.sort((e,t)=>e-t).map(a=>Object(o.k)(e,t,a)).filter(Boolean):void 0;c&&r&&i&&i.length&&function(e,t,a){Object(j.a)("forwardMessages",{fromChat:e,toChat:t,messages:a,serverTimeOffset:Object(s.e)().serverTimeOffset}),Object(s.g)({...Object(s.e)(),forwardMessages:{}})}(c,r,i)}),Object(s.b)("loadScheduledHistory",e=>{const t=Object(o.r)(e);if(!t)return;const{hash:a}=e.scheduledMessages.byChatId[t.id]||{};!async function(e,t){const a=await Object(j.a)("fetchScheduledHistory",{chat:e,hash:t});if(!a)return;const{hash:n,messages:c}=a,o=Object(d.c)(c,"id"),l=Object.keys(o).map(Number).sort((e,t)=>t-e);let b=Object(s.e)();b=Object(r.u)(b,e.id,o,n),b=Object(r.x)(b,e.id,i.MAIN_THREAD_ID,"scheduledIds",l),Object(s.g)(b)}(t,a)}),Object(s.b)("sendScheduledMessages",(e,t,a)=>{const{chatId:s,id:n}=a,c=Object(o.f)(e,s);c&&Object(j.a)("sendScheduledMessages",{chat:c,ids:[n]})}),Object(s.b)("rescheduleMessage",(e,t,a)=>{const{chatId:s,messageId:n,scheduledAt:c}=a,r=Object(o.f)(e,s),i=r&&Object(o.pb)(e,r.id,n);r&&i&&Object(j.a)("rescheduleMessage",{chat:r,message:i,scheduledAt:c})}),Object(s.b)("requestThreadInfoUpdate",(e,t,a)=>{const{chatId:s,threadId:n}=a,c=Object(o.Eb)(e,s,n);c&&Object(j.a)("requestThreadInfoUpdate",{chat:c,threadId:n})}),Object(s.b)("loadPinnedMessages",(e,t,a)=>{const{chatId:n}=a,c=Object(o.f)(e,n);c&&async function(e){const t=await Object(j.a)("fetchPinnedMessages",{chat:e});if(!t)return;const{messages:a,chats:n,users:c}=t,o=Object(d.c)(a,"id"),l=Object.keys(o).map(Number).sort((e,t)=>t-e);let b=Object(s.e)();b=Object(r.b)(b,e.id,o),b=Object(r.x)(b,e.id,i.MAIN_THREAD_ID,"pinnedIds",l),b=Object(r.f)(b,Object(d.c)(c,"id")),b=Object(r.c)(b,Object(d.c)(n,"id")),Object(s.g)(b)}(c)}),Object(s.b)("loadMessageLink",(e,t,a)=>{const{messageId:s,chatId:n}=a,c=Object(o.f)(e,n),r=Object(o.k)(e,n,s);c&&r&&(async()=>{const e=await Object(j.a)("fetchMessageLink",{chat:c,message:r});e&&Object(w.c)(e.link)})()});var T=a(52);const P=Object(g.g)(e=>e(),500,!1);async function A(e,t){const a=await Object(j.a)("searchGifs",{query:e,offset:t});a&&Object(s.g)(Object(r.Q)(Object(s.e)(),!t,a.gifs,a.nextOffset))}Object(s.b)("loadStickerSets",e=>{const{hash:t}=e.stickers.added||{};!async function(e=0){const t=await Object(j.a)("fetchStickerSets",{hash:e});if(!t)return;Object(s.g)(Object(r.ib)(Object(s.e)(),"added",t.hash,t.sets))}(t)}),Object(s.b)("loadAddedStickers",(e,t)=>{const{setIds:a}=e.stickers.added;a&&a.length&&(async()=>{for(let e=0;e<a.length;e++)t.loadStickers({stickerSetId:a[e]}),e%50==0&&e>0&&await Object(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.ib)(Object(s.e)(),"featured",t.hash,t.sets))}(t)}),Object(s.b)("loadStickers",(e,t,a)=>{const{stickerSetId:n}=a;let{stickerSetAccessHash:c}=a;if(!c){const t=Object(o.xb)(e,n);if(!t)return;c=t.accessHash}!async function(e,t){const a=await Object(j.a)("fetchStickers",{stickerSetId:e,accessHash:t});if(!a)return;const{set:n,stickers:c,packs:o}=a;let i=Object(s.e)();i=Object(r.hb)(i,n.id,{...n,stickers:c,packs:o});const l=i.stickers.forEmoji.emoji;l&&o[l]&&(i=Object(r.o)(i));Object(s.g)(i)}(n,c)}),Object(s.b)("loadAnimatedEmojis",()=>{!async function(){const e=await Object(j.a)("fetchAnimatedEmojis");if(!e)return;const{set:t,stickers:a}=e;Object(s.g)(Object(r.q)(Object(s.e)(),{...t,stickers:a}))}()}),Object(s.b)("loadSavedGifs",e=>{const{hash:t}=e.gifs.saved;!async function(e=0){const t=await Object(j.a)("fetchSavedGifs",{hash:e});if(!t)return;const a=Object(s.e)();Object(s.g)({...a,gifs:{...a.gifs,saved:t}})}(t)}),Object(s.b)("faveSticker",(e,t,a)=>{const{sticker:s}=a;s&&Object(j.a)("faveSticker",{sticker:s})}),Object(s.b)("unfaveSticker",(e,t,a)=>{const{sticker:n}=a;n&&function(e){const t=Object(s.e)();Object(s.g)({...t,stickers:{...t.stickers,favorite:{...t.stickers.favorite,stickers:t.stickers.favorite.stickers.filter(({id:t})=>t!==e.id)}}}),Object(j.a)("faveSticker",{sticker:e,unfave:!0})}(n)}),Object(s.b)("toggleStickerSet",(e,t,a)=>{const{stickerSetId:s}=a,n=Object(o.xb)(e,s);if(!n)return;const{accessHash:c,installedDate:r}=n;Object(j.a)(r?"uninstallStickerSet":"installStickerSet",{stickerSetId:s,accessHash:c})}),Object(s.b)("loadEmojiKeywords",(e,t,a)=>{const{language:n}=a;let c=Object(o.F)(e,n);c&&c.isLoading||(Object(s.g)({...e,emojiKeywords:{...e.emojiKeywords,[n]:{...c,isLoading:!0}}}),(async()=>{const t=await Object(j.a)("fetchEmojiKeywords",{language:n,fromVersion:c?c.version:0});e=Object(s.e)(),c=Object(o.F)(e,n),t?Object(s.g)({...e,emojiKeywords:{...e.emojiKeywords,[n]:{isLoading:!1,version:t.version,keywords:{...c&&c.keywords,...t.keywords}}}}):Object(s.g)({...e,emojiKeywords:{...e.emojiKeywords,[n]:{...c,isLoading:!1}}})})())}),Object(s.b)("setStickerSearchQuery",(e,t,a)=>{const{query:n}=a;n&&P(()=>{!async function(e,t=0){const a=await Object(j.a)("searchStickers",{query:e,hash:t});if(!a)return;const n=Object(s.e)(),{setsById:c,added:o}=n.stickers,i=a.sets.map(({id:e})=>e);o.setIds&&o.setIds.forEach(t=>{if(!i.includes(t)){const{title:a}=c[t]||{};a&&Object(T.a)(a,e)&&i.unshift(t)}});Object(s.g)(Object(r.ib)(n,"search",a.hash,a.sets,i))}(n)})}),Object(s.b)("setGifSearchQuery",(e,t,a)=>{const{query:s}=a;"string"==typeof s&&P(()=>{A(s)})}),Object(s.b)("searchMoreGifs",e=>{const{query:t,offset:a}=e.gifs.search;"string"==typeof t&&P(()=>{A(t,a)})}),Object(s.b)("loadStickersForEmoji",(e,t,a)=>{const{emoji:n}=a,{hash:c}=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 n=await Object(j.a)("fetchStickersForEmoji",{emoji:e,hash:t});if(a=Object(s.e)(),!n||a.stickers.forEmoji.emoji!==e)return;a=Object(r.jb)(a,e,n.stickers,n.hash),Object(s.g)(a)}(n,c)})}),Object(s.b)("clearStickersForEmoji",e=>({...e,stickers:{...e.stickers,forEmoji:{}}}));var x=a(36);const L=Object(g.g)(e=>e(),500,!1);async function R(e="",t,a,c,i,l){let b;if(c){const s=await Object(j.a)("searchMessagesLocal",{chatOrUser:c,query:e,type:t,limit:n.y,offsetId:a,minDate:l,maxDate:i});if(s){const{messages:e,users:t,totalCount:a,nextOffsetId:n}=s;b={messages:e,users:t,chats:[],totalCount:a,nextRate:n}}}else b=await Object(j.a)("searchMessagesGlobal",{query:e,offsetRate:a,limit:n.y,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.T)(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.f)(u,Object(d.c)(O,"id"))),h.length&&(u=Object(r.d)(u,h)),u=Object(r.U)(u,h,f,t,p),Object(s.g)(u)}async function F(){const e=await Object(j.a)("fetchChats",{limit:n.j,archived:!0,withPinned:!0,serverTimeOffset:Object(s.e)().serverTimeOffset});if(!e)return;let t=Object(s.e)();t=Object(r.ob)(t,Object(d.c)(e.users,"id")),t=Object(r.M)(t,Object(d.c)(e.chats,"id")),t=Object(r.r)(t,"archived",e.chatIds),t=Object(r.J)(t,"archived",e),Object(s.g)(t)}async function D(){let e=Object(s.e)();const{recentlyFoundChatIds:t}=e.globalSearch,{userIds:a}=e.contactList||{};if(!(a&&a.length||t&&t.length))return;const n=[...t||[],...a||[]].map(t=>Object(o.Hb)(e,t)).filter(Boolean),c=await Object(j.a)("fetchUsers",{users:n});c&&(e=Object(s.e)(),e=Object(r.ob)(e,Object(d.c)(c,"id")),Object(s.g)(e))}function B(e){return Object(j.a)("fetchMessages",{chat:e,threadId:i.MAIN_THREAD_ID,offsetId:e.lastReadInboxMessageId,addOffset:-(Math.round(n.V/2)+1),limit:n.V})}Object(s.b)("setGlobalSearchQuery",(e,t,a)=>{const{chatId:n}=e.globalSearch,{query:c}=a;c&&!n&&L(()=>{!async function(e){const t=await Object(j.a)("searchChats",{query:e});let a=Object(s.e)();const n=Object(o.t)(a);if(!t||!n||e!==n)return void Object(s.g)(Object(r.T)(a,{chats:!1}));const{localChats:c,localUsers:i,globalChats:l,globalUsers:b}=t;(c.length||l.length)&&(a=Object(r.c)(a,Object(d.c)([...c,...l],"id")));(i.length||b.length)&&(a=Object(r.f)(a,Object(d.c)([...i,...b],"id")));a=Object(r.T)(a,{chats:!1}),a=Object(r.R)(a,{localResults:{chatIds:c.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)}(c)})}),Object(s.b)("setGlobalSearchDate",(e,t,a)=>{const{date:n}=a,c=n?Object(x.m)(n):n,i=Object(r.R)(e,{date:n,query:"",resultsByType:{...e.globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}});Object(s.g)(i);const{chatId:l}=e.globalSearch;R("","text",void 0,l?Object(o.f)(e,l):void 0,c,n)}),Object(s.b)("searchMessagesGlobal",(e,t,a)=>{const{query:s,resultsByType:n,chatId:c,date:r}=e.globalSearch,i=r?Object(x.m)(r):r,{type:l}=a,{nextOffsetId:d}=n&&n[l]||{};R(s,l,d,c?Object(o.f)(e,c):void 0,i,r)}),Object(s.b)("searchTextMessagesLocal",e=>{const{chatId:t,threadId:a}=Object(o.y)(e)||{},c=t?Object(o.f)(e,t):void 0,l=Object(o.A)(e);if(!c||!l||!a)return;const{query:b,results:u}=l,m=u?u.nextOffsetId:void 0;let h;if(a!==i.MAIN_THREAD_ID){const s=Object(o.Db)(e,t,a);h=s?s.topMessageId:void 0}!async function(e,t,a,c,i){const l=await Object(j.a)("searchMessagesLocal",{chatOrUser:e,type:"text",query:c,topMessageId:a,limit:n.X,offsetId:i});if(!l)return;const{messages:b,users:u,totalCount:m,nextOffsetId:h}=l,O=Object(d.c)(b,"id"),g=Object.keys(O).map(Number);let f=Object(s.e)();const p=Object(o.A)(f);if(!p||c&&c!==p.query)return;f=Object(r.b)(f,e.id,O),f=Object(r.f)(f,Object(d.c)(u,"id")),f=Object(r.Z)(f,e.id,t,g,m,h),Object(s.g)(f)}(c,a,h,b,m)}),Object(s.b)("searchMediaMessagesLocal",e=>{const t=Object(o.w)(e),a=t?e.users.byId[t]||e.chats.byId[t]:void 0,c=Object(o.v)(e);if(!a||!c)return;const{currentType:i,resultsByType:l}=c,b=i&&l&&l[i],u=b?b.nextOffsetId:void 0;i&&async function(e,t,a){const c=await Object(j.a)("searchMessagesLocal",{chatOrUser:e,type:t,limit:n.pb,offsetId:a});if(!c)return;const{messages:i,users:l,totalCount:b,nextOffsetId:u}=c,m=Object(d.c)(i,"id"),h=Object.keys(m).map(Number);let O=Object(s.e)();if(!Object(o.v)(O))return;O=Object(r.b)(O,e.id,m),O=Object(r.f)(O,Object(d.c)(l,"id")),O=Object(r.W)(O,e.id,t,h,b,u),Object(s.g)(O)}(a,i,u)}),Object(s.b)("searchMessagesByDate",(e,t,a)=>{const{timestamp:n}=a,{chatId:c}=Object(o.y)(e)||{};if(!c)return;const r=Object(o.f)(e,c);r&&async function(e,t){const a=await Object(j.a)("findFirstMessageIdAfterDate",{chat:e,timestamp:t});if(!a)return;Object(s.d)().focusMessage({chatId:e.id,messageId:a})}(r,n)}),Object(s.b)("checkPublicLink",(e,t,a)=>{const{chatId:n}=Object(o.y)(e)||{};if(!n)return;if(e.management.progress===l.f.InProgress)return;const{username:c}=a;(async()=>{e=Object(r.bb)(e,l.f.InProgress),e=Object(r.ab)(e,n,{isUsernameAvailable:void 0}),Object(s.g)(e);const t=await Object(j.a)("checkChatUsername",{username:c});e=Object(s.e)(),e=Object(r.bb)(e,t?l.f.Complete:l.f.Error),e=Object(r.ab)(e,n,{isUsernameAvailable:t}),Object(s.g)(e)})()}),Object(s.b)("updatePublicLink",(e,t,a)=>{const{chatId:n}=Object(o.y)(e)||{};let c=n&&Object(o.f)(e,n);if(!n||!c)return;const{username:i}=a;(async()=>{if(e=Object(r.bb)(e,l.f.InProgress),Object(s.g)(e),Object(h.jb)(c)){if(c=await Object(j.a)("migrateChat",c),!c)return;t.openChat({id:c.id})}const a=await Object(j.a)("setChatUsername",{chat:c,username:i});e=Object(s.e)(),e=Object(r.bb)(e,a?l.f.Complete:l.f.Error),e=Object(r.ab)(e,n,{isUsernameAvailable:void 0}),Object(s.g)(e)})()}),Object(s.b)("updatePrivateLink",e=>{const{chatId:t}=Object(o.y)(e)||{},a=t&&Object(o.f)(e,t);t&&a&&Object(j.a)("updatePrivateLink",{chat:a})}),Object(s.b)("sync",(e,t)=>{!async function(e){n.p&&console.log(">>> START SYNC");await Object(j.a)("fetchCurrentUser");const t=await async function(){const e=await Object(j.a)("fetchChats",{limit:n.j,withPinned:!0,serverTimeOffset:Object(s.e)().serverTimeOffset});if(!e)return;let t=Object(s.e)();const{recentlyFoundChatIds:a}=t.globalSearch,{userIds:c}=t.contactList||{},{currentUserId:l}=t,b=[...a||[],...c||[],...l?[l]:[]],u=b.map(e=>Object(o.Hb)(t,e)).filter(Boolean),m=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)&&m.push(e),Object(h.mb)(O)){const e=Object(o.Hb)(t,O);e&&!b.includes(O)&&u.push(e)}}u.push(...e.users),m.push(...e.chats),t=Object(r.s)(t,Object(d.c)(m,"id")),t=Object(r.r)(t,"active",e.chatIds),t={...t,chats:{...t.chats}},t=Object(r.J)(t,"active",e),Object.keys(e.draftsById).map(Number).forEach(a=>{t=Object(r.x)(t,a,i.MAIN_THREAD_ID,"draft",e.draftsById[a]),t=Object(r.H)(t,a,{hasDraft:Boolean(e.draftsById[a])})}),Object.keys(e.replyingToById).map(Number).forEach(a=>{t=Object(r.x)(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:c,threadId: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(c){const e=await B(n.chats.byId[c]);n=Object(s.e)();const{chatId:b}=Object(o.y)(n)||{},u=l&&Object(o.Db)(n,c,l);if(e&&b===c){const s=n.messages.byChatId[c],o=Object(d.c)(e.messages,"id"),b=Object.keys(o).map(Number);if(n={...n,messages:{...n.messages,byChatId:{[c]:{byId:o,threadsById:{[i.MAIN_THREAD_ID]:{...s&&s.threadsById[i.MAIN_THREAD_ID],listedIds:b,viewportIds:b,outlyingIds:void 0}}}}}},l&&u&&u.originChannelId){const{originChannelId:e}=u,t=n.messages.byChatId[e],a=await B(n.chats.byId[e]);if(a){const e=Object(d.c)(a.messages,"id"),r=Object.keys(e).map(Number);n={...n,messages:{...n.messages,byChatId:{...n.messages.byChatId,[u.originChannelId]:{byId:e,threadsById:{[i.MAIN_THREAD_ID]:{...t&&t.threadsById[i.MAIN_THREAD_ID],listedIds:r,viewportIds:r,outlyingIds:void 0}}},[c]:{...n.messages.byChatId[c],threadsById:{...n.messages.byChatId[c].threadsById,[l]:{...s&&s.threadsById[l],outlyingIds:void 0}}}}}}}}n=Object(r.M)(n,Object(d.c)(e.chats,"id")),n=Object(r.lb)(n,c,e.threadInfos),t=!0,a=Array.prototype.concat(a,e.users)}}t||(n={...n,messages:{...n.messages,byChatId:{}}});Object.keys(b).map(Number).forEach(e=>{n=Object(r.x)(n,e,i.MAIN_THREAD_ID,"draft",b[e])}),e?n=Object(r.y)(n,Object(d.c)(a,"id")):a&&(n=Object(r.ob)(n,Object(d.c)(a,"id")));Object(s.g)(n);const{chatId:u,messageId:m}=n.audioPlayer;u&&m&&!Object(o.k)(n,u,m)&&Object(s.d)().closeAudioPlayer()}(t),Object(s.g)({...Object(s.e)(),lastSyncTime:Date.now()}),n.p&&console.log(">>> FINISH SYNC");e()}(t.afterSync)}),Object(s.b)("afterSync",(e,t)=>{!async function(e){n.p&&console.log(">>> START AFTER-SYNC");e.loadFavoriteStickers(),await Promise.all([D(),F()]),await Object(j.a)("fetchCurrentUser"),n.p&&console.log(">>> FINISH AFTER-SYNC")}(t)});const H=Object(g.a)(e=>e(),500,!1,!0);function U(e,{visibility:t,allowedIds:a,deniedIds:s}){const{users:{byId:n},chats:{byId:c}}=e,r={visibility:t};let o,i;const l=e=>{if(!Object(h.mb)(e))return;const{id:t,accessHash:a}=n[e]||{};return t?{id:t,accessHash:a}:void 0},d=e=>{if(Object(h.mb)(e))return;const t=c[e];return t?{id:t.id}:void 0};return"contacts"!==t&&"nobody"!==t||(o=a.map(l).filter(Boolean),i=a.map(d).filter(Boolean),o.length>0&&(r.allowedUsers=o),i.length>0&&(r.allowedChats=i)),"everybody"!==t&&"contacts"!==t||(o=s.map(l).filter(Boolean),i=s.map(d).filter(Boolean),o.length>0&&(r.blockedUsers=o),i.length>0&&(r.blockedChats=i)),r}Object(s.b)("loadFullUser",(e,t,a)=>{const{userId:s}=a,n=Object(o.Hb)(e,s);if(!n)return;const{id:c,accessHash:r}=n;H(()=>Object(j.a)("fetchFullUser",{id:c,accessHash:r}))}),Object(s.b)("loadUser",(e,t,a)=>{const{userId:n}=a,c=Object(o.Hb)(e,n);c&&(async()=>{const t=await Object(j.a)("fetchUsers",{users:[c]});t&&(e=Object(s.e)(),e=Object(r.ob)(e,Object(d.c)(t,"id")),Object(s.g)(e))})()}),Object(s.b)("loadTopUsers",e=>{const{serverTimeOffset:t,topPeers:{hash:a,lastRequestedAt:n}}=e;(!n||Date.now()/1e3+t-n>60)&&async function(e){const t=await Object(j.a)("fetchTopUsers",{hash:e});if(!t)return;const{hash:a,ids:n,users:c}=t;let o=Object(s.e)();o=Object(r.f)(o,Object(d.c)(c,"id")),o={...o,topPeers:{...o.topPeers,hash:a,userIds:n,lastRequestedAt:Date.now()/1e3+o.serverTimeOffset}},Object(s.g)(o)}(a)}),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.f)(Object(s.e)(),Object(d.c)(t.users,"id"));a=Object(r.c)(a,Object(d.c)(t.chats,"id"));const n=e=>e.lastName||e.firstName||"",c=new Intl.Collator("en-US"),o=t.users.sort((e,t)=>c.compare(n(e),n(t))).filter(e=>!e.isSelf);Object(s.g)({...a,contactList:{hash:t.hash,userIds:o.map(e=>e.id)}})}(t)}),Object(s.b)("loadCurrentUser",()=>{Object(j.a)("fetchCurrentUser")}),Object(s.b)("updateContact",(e,t,a)=>{const{userId:n,isMuted:c,firstName:i,lastName:d}=a;!async function(e,t,a,n){const c=Object(s.e)(),i=Object(o.Hb)(c,e);if(!i)return;Object(s.d)().updateChatMutedState({chatId:e,isMuted:t}),Object(s.g)(Object(r.bb)(Object(s.e)(),l.f.InProgress));await Object(j.a)("updateContact",{phone:i.phoneNumber,firstName:a,lastName:n})&&Object(s.g)(Object(r.nb)(Object(s.e)(),i.id,{firstName:a,lastName:n}));Object(s.g)(Object(r.bb)(Object(s.e)(),l.f.Complete))}(n,c,i,d)}),Object(s.b)("deleteUser",(e,t,a)=>{const{userId:n}=a;!async function(e){const t=Object(s.e)(),a=Object(o.Hb)(t,e);if(!a)return;const{id:n,accessHash:c}=a;await Object(j.a)("deleteUser",{id:n,accessHash:c})}(n)}),Object(s.b)("loadProfilePhotos",(e,t,a)=>{const{profileId:n}=a,c=Object(h.mb)(n),i=c?Object(o.Hb)(e,n):void 0,l=c?void 0:Object(o.f)(e,n);(async()=>{const e=await Object(j.a)("fetchProfilePhotos",i,l);if(!e||!e.photos)return;let t=Object(s.e)();c?t=Object(r.nb)(t,n,{photos:e.photos}):(t=Object(r.f)(t,Object(d.c)(e.users,"id")),t=Object(r.H)(t,n,{photos:e.photos})),Object(s.g)(t)})()}),Object(s.b)("clickInlineButton",(e,t,a)=>{const{button:c}=a;switch(c.type){case"command":t.sendBotCommand({command:c.value});break;case"url":c.value.match(n.ib)||c.value.match(n.jb)?t.openTelegramLink({url:c.value}):t.toggleSafeLinkModal({url:c.value});break;case"callback":{const t=Object(o.r)(e);if(!t)return;!async function(e,t,a){const n=await Object(j.a)("answerCallbackButton",{chatId:e.id,accessHash:e.accessHash,messageId:t,data:a});if(!n||!n.message)return;const{message:c,alert:r}=n;r?Object(s.d)().showError({error:{message:c}}):Object(s.d)().showNotification({message:c})}(t,c.messageId,c.value);break}case"requestPoll":t.openPollModal();break;case"buy":{const a=Object(o.r)(e),{messageId:s,value:n}=c;if(!a)return;n?t.getReceipt({receiptMessageId:n,chatId:a.id,messageId:s}):(t.getPaymentForm({messageId:s}),t.setInvoiceMessageInfo(Object(o.k)(e,a.id,s)),t.openPaymentModal({messageId:s}));break}}}),Object(s.b)("sendBotCommand",(e,t,a)=>{const{command:s}=a,{currentUserId:n}=e,c=Object(o.r)(e);n&&c&&async function(e,t,a){await Object(j.a)("sendMessage",{chat:e,text:a})}(c,0,s)}),Object(s.b)("updateProfile",(e,t,a)=>{const{photo:n,firstName:c,lastName:i,bio:d,username:b}=a;(async()=>{const{currentUserId:t}=e;if(t){if(Object(s.g)({...Object(s.e)(),profileEdit:{progress:l.j.InProgress}}),n&&await Object(j.a)("updateProfilePhoto",n),c||i||d){if(await Object(j.a)("updateProfile",{firstName:c,lastName:i,about:d})){e=Object(s.e)();const a=t&&Object(o.Hb)(e,t);a&&Object(s.g)(Object(r.nb)(e,a.id,{firstName:c,lastName:i,fullInfo:{...a.fullInfo,bio:d}}))}}if(b){await Object(j.a)("updateUsername",b)&&t&&Object(s.g)(Object(r.nb)(Object(s.e)(),t,{username:b}))}Object(s.g)({...Object(s.e)(),profileEdit:{progress:l.j.Complete}})}})()}),Object(s.b)("checkUsername",(e,t,a)=>{const{username:n}=a;(async()=>{if(e.profileEdit&&e.profileEdit.progress===l.j.InProgress)return;Object(s.g)({...e,profileEdit:{progress:e.profileEdit?e.profileEdit.progress:l.j.Idle,isUsernameAvailable:void 0}});const t=await Object(j.a)("checkUsername",n);e=Object(s.e)(),Object(s.g)({...e,profileEdit:{...e.profileEdit,isUsernameAvailable:t}})})()}),Object(s.b)("loadWallpapers",()=>{(async()=>{const e=await Object(j.a)("fetchWallpapers",0);if(!e)return;const t=Object(s.e)();Object(s.g)({...t,settings:{...t.settings,loadedWallpapers:e.wallpapers}})})()}),Object(s.b)("uploadWallpaper",(e,t,a)=>{const n=a,c=URL.createObjectURL(n);Object(s.g)({...e,settings:{...e.settings,loadedWallpapers:[{slug:l.n,document:{fileName:"",size:n.size,mimeType:n.type,previewBlobUrl:c}},...e.settings.loadedWallpapers||[]]}}),(async()=>{const t=await Object(j.a)("uploadWallpaper",n);if(!t)return;const{wallpaper:a}=t;if(!(e=Object(s.e)()).settings.loadedWallpapers)return;const r=e.settings.loadedWallpapers[0];if(!r||r.slug!==l.n)return;const o={...a,document:{...a.document,previewBlobUrl:c}};Object(s.g)({...e,settings:{...e.settings,loadedWallpapers:[o,...e.settings.loadedWallpapers.slice(1)]}})})()}),Object(s.b)("loadBlockedContacts",()=>{(async()=>{const e=await Object(j.a)("fetchBlockedContacts");if(!e)return;let t=Object(s.e)();e.users&&e.users.length&&(t=Object(r.f)(t,Object(d.c)(e.users,"id"))),e.chats&&e.chats.length&&(t=Object(r.M)(t,Object(d.c)(e.chats,"id"))),t={...t,blocked:{...t.blocked,ids:[...t.blocked.ids||[],...e.blockedIds],totalCount:e.totalCount}},Object(s.g)(t)})()}),Object(s.b)("blockContact",(e,t,a)=>{const{contactId:n}=a;(async()=>{if(!await Object(j.a)("blockContact",n))return;const e=Object(s.e)();Object(s.g)(Object(r.a)(e,n))})()}),Object(s.b)("unblockContact",(e,t,a)=>{const{contactId:n}=a;let c;if(Object(h.mb)(n)){const t=Object(o.Hb)(e,n);if(!t)return;c=t.accessHash}(async()=>{if(!await Object(j.a)("unblockContact",n,c))return;const e=Object(s.e)();Object(s.g)(Object(r.p)(e,n))})()}),Object(s.b)("loadAuthorizations",()=>{(async()=>{const e=await Object(j.a)("fetchAuthorizations");e&&Object(s.g)({...Object(s.e)(),activeSessions:e})})()}),Object(s.b)("terminateAuthorization",(e,t,a)=>{const{hash:n}=a;(async()=>{if(!await Object(j.a)("terminateAuthorization",n))return;const e=Object(s.e)();Object(s.g)({...e,activeSessions:e.activeSessions.filter(e=>e.hash!==n)})})()}),Object(s.b)("terminateAllAuthorizations",()=>{(async()=>{if(!await Object(j.a)("terminateAllAuthorizations"))return;const e=Object(s.e)();Object(s.g)({...e,activeSessions:e.activeSessions.filter(e=>e.isCurrent)})})()}),Object(s.b)("loadNotificationExceptions",()=>{Object(j.a)("fetchNotificationExceptions")}),Object(s.b)("loadNotificationSettings",e=>{const{serverTimeOffset:t}=e;(async()=>{const e=await Object(j.a)("fetchNotificationSettings",{serverTimeOffset:t});e&&Object(s.g)(Object(r.v)(Object(s.e)(),e))})()}),Object(s.b)("updateNotificationSettings",(e,t,a)=>{const{peerType:n,isSilent:c,shouldShowPreviews:o}=a;(async()=>{await Object(j.a)("updateNotificationSettings",n,{isSilent:c,shouldShowPreviews:o})&&Object(s.g)(Object(r.cb)(Object(s.e)(),n,c,o))})()}),Object(s.b)("updateContactSignUpNotification",(e,t,a)=>{const{isSilent:n}=a;(async()=>{await Object(j.a)("updateContactSignUpNotification",n)&&Object(s.g)(Object(r.v)(Object(s.e)(),{hasContactJoinedNotifications:!n}))})()}),Object(s.b)("loadLanguages",()=>{(async()=>{const e=await Object(j.a)("fetchLanguages");e&&Object(s.g)(Object(r.v)(Object(s.e)(),{languages:e}))})()}),Object(s.b)("loadPrivacySettings",()=>{(async()=>{const[e,t,a,n,c]=await Promise.all([Object(j.a)("fetchPrivacySettings","phoneNumber"),Object(j.a)("fetchPrivacySettings","lastSeen"),Object(j.a)("fetchPrivacySettings","profilePhoto"),Object(j.a)("fetchPrivacySettings","forwards"),Object(j.a)("fetchPrivacySettings","chatInvite")]);if(!(e&&t&&a&&n&&c))return;const r=Object(s.e)();r.settings.privacy.phoneNumber=e,r.settings.privacy.lastSeen=t,r.settings.privacy.profilePhoto=a,r.settings.privacy.forwards=n,r.settings.privacy.chatInvite=c,Object(s.g)(r)})()}),Object(s.b)("setPrivacyVisibility",(e,t,a)=>{const{privacyKey:n,visibility:c}=a,{privacy:{[n]:r}}=e.settings;if(!r)return;const o=U(e,{visibility:c,allowedIds:[...r.allowUserIds,...r.allowChatIds],deniedIds:[...r.blockUserIds,...r.blockChatIds]});(async()=>{const e=await Object(j.a)("setPrivacySettings",n,o);if(e){const t=Object(s.e)();t.settings.privacy[n]=e,Object(s.g)(t)}})()}),Object(s.b)("setPrivacySettings",(e,t,a)=>{const{privacyKey:n,isAllowList:c,contactsIds:r}=a,{privacy:{[n]:o}}=e.settings;if(!o)return;const i=U(e,{visibility:o.visibility,allowedIds:c?r:[...o.allowUserIds,...o.allowChatIds],deniedIds:c?[...o.blockUserIds,...o.blockChatIds]:r});(async()=>{const e=await Object(j.a)("setPrivacySettings",n,i);if(e){const t=Object(s.e)();t.settings.privacy[n]=e,Object(s.g)(t)}})()}),Object(s.b)("updateIsOnline",(e,t,a)=>{Object(j.a)("updateIsOnline",a)}),Object(s.b)("loadContentSettings",()=>{(async()=>{const e=await Object(j.a)("fetchContentSettings");e&&Object(s.g)(Object(r.v)(Object(s.e)(),e))})()}),Object(s.b)("updateContentSettings",(e,t,a)=>{(async()=>{Object(s.g)(Object(r.v)(Object(s.e)(),{isSensitiveEnabled:a}));await Object(j.a)("updateContentSettings",a)||Object(s.g)(Object(r.v)(Object(s.e)(),{isSensitiveEnabled:!a}))})()}),Object(s.b)("loadPasswordInfo",()=>{(async()=>{const e=await Object(j.a)("getPasswordInfo");if(!e)return;let t=Object(s.e)();t=Object(r.v)(t,{hasPassword:e.hasPassword}),t=Object(r.mb)(t,{hint:e.hint}),Object(s.g)(t)})()}),Object(s.b)("checkPassword",(e,t,a)=>{const{currentPassword:n,onSuccess:c}=a;Object(s.g)(Object(r.mb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("checkPassword",n);Object(s.g)(Object(r.mb)(Object(s.e)(),{isLoading:!1})),e&&c()})()}),Object(s.b)("clearPassword",(e,t,a)=>{const{currentPassword:n,onSuccess:c}=a;Object(s.g)(Object(r.mb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("clearPassword",n);Object(s.g)(Object(r.mb)(Object(s.e)(),{isLoading:!1})),e&&c()})()}),Object(s.b)("updatePassword",(e,t,a)=>{const{currentPassword:n,password:c,hint:o,email:i,onSuccess:l}=a;Object(s.g)(Object(r.mb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("updatePassword",n,c,o,i);Object(s.g)(Object(r.mb)(Object(s.e)(),{isLoading:!1})),e&&l()})()}),Object(s.b)("updateRecoveryEmail",(e,t,a)=>{const{currentPassword:n,email:c,onSuccess:o}=a;Object(s.g)(Object(r.mb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("updateRecoveryEmail",n,c);Object(s.g)(Object(r.mb)(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.mb)(e,{error:void 0}));var q=a(60);Object(s.b)("validateRequestedInfo",(e,t,a)=>{const{requestInfo:n,saveInfo:c}=a,i=Object(o.hb)(e);i&&async function(e,t,a){const n=await Object(j.a)("validateRequestedInfo",{messageId:e,requestInfo:t,shouldSave:a});if(!n)return;const{id:c,shippingOptions:o}=n;if(!c)return;let i=Object(r.E)(Object(s.e)(),c);o?(i=Object(r.gb)(i,o),i=Object(r.C)(i,l.i.Shipping)):i=Object(r.C)(i,l.i.PaymentInfo);Object(s.g)(i)}(i,n,c)}),Object(s.b)("getPaymentForm",(e,t,a)=>{const{messageId:n}=a;n&&async function(e){const t=await Object(j.a)("getPaymentForm",{messageId:e});if(!t)return;let a=Object(r.B)(Object(s.e)(),t),n=l.i.PaymentInfo;a.payment.invoice&&(a.payment.invoice.shippingAddressRequested||a.payment.invoice.nameRequested||a.payment.invoice.phoneRequested||a.payment.invoice.emailRequested)&&(n=l.i.ShippingInfo);a=Object(r.C)(a,n),Object(s.g)(a)}(n)}),Object(s.b)("getReceipt",(e,t,a)=>{const{receiptMessageId:n,chatId:c,messageId:i}=a;i&&n&&c&&async function(e,t,a){const n=await Object(j.a)("getReceipt",t);if(!n)return;let c=Object(s.e)();const i=Object(o.k)(c,a,e);c=Object(r.D)(c,n,i),Object(s.g)(c)}(i,n,c)}),Object(s.b)("clearPaymentError",e=>{Object(s.g)({...e,payment:{...e.payment,error:void 0}})}),Object(s.b)("clearReceipt",e=>{Object(s.g)({...e,payment:{...e.payment,receipt:void 0}})}),Object(s.b)("sendCredentialsInfo",(e,t,a)=>{const n=Object(o.kb)(e);if(!n)return;const{credentials:c}=a,{data:i}=c;!async function(e,t){const a=function(e){const t=Object.keys(e).map(t=>`${t}=${e[t]}`).join("&");return t.length>0?"?"+t:""}({"card[number]":e.cardNumber,"card[exp_month]":e.expiryMonth,"card[exp_year]":e.expiryYear,"card[cvc]":e.cvv,"card[address_zip]":e.zip,"card[address_country]":e.country}),n=await fetch("https://api.stripe.com/v1/tokens"+a,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:"Bearer "+t}}),c=await n.json();if(c.error){const e=Object(q.b)(c.error),t=Object(s.e)();return void Object(s.g)({...t,payment:{...t.payment,error:{...e}}})}let o=Object(r.F)(Object(s.e)(),{type:c.type,id:c.id});o=Object(r.C)(o,l.i.Checkout),Object(s.g)(o)}(i,n)}),Object(s.b)("sendPaymentForm",(e,t,a)=>{const{shippingOptionId:n,saveCredentials:c}=a,i=Object(o.hb)(e),l=Object(o.ib)(e),d=Object(o.kb)(e),b=Object(o.zb)(e);i&&d&&async function(e,t,a,n){if(await Object(j.a)("sendPaymentForm",{messageId:e,credentials:t,requestedInfoId:a,shippingOptionId:n})){const e=Object(r.h)(Object(s.e)());Object(s.g)(Object(r.i)(e))}}(i,{save:c,data:b},l,n)}),Object(s.b)("setPaymentStep",(e,t,a={})=>Object(r.C)(e,a.step||l.i.ShippingInfo)),Object(s.b)("setInvoiceMessageInfo",(e,t,a)=>Object(r.A)(e,a));a(86);var G=a(30),_=a(77);const V=Object(g.g)(e=>e(),1e3,!0);Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateChat":{a.noTopChatsRequest||Object(o.M)(e,a.id)||t.loadTopChats();const n=Object(r.H)(e,a.id,a.chat,a.newProfilePhoto);Object(s.g)(n);const c=Object(o.q)(n);V(()=>Object(_.a)(c));break}case"updateChatJoin":{const n=Object(o.j)(e,a.id);if(!n)break;e=Object(r.I)(e,n,[a.id]),e=Object(r.H)(e,a.id,{isNotJoined:!1}),Object(s.g)(e);const c=Object(o.f)(e,a.id);c&&t.requestChatUpdate({chatId:c.id});break}case"updateChatLeave":{const t=Object(o.j)(e,a.id);if(!t)break;const{[t]:n}=e.chats.listIds;n&&(e=Object(r.r)(e,t,n.filter(e=>e!==a.id))),e=Object(r.H)(e,a.id,{isNotJoined:!0}),Object(s.g)(e);break}case"updateChatInbox":Object(s.g)(Object(r.H)(e,a.id,a.chat));break;case"updateChatTypingStatus":{const{id:t,typingStatus:n}=a;Object(s.g)(Object(r.H)(e,t,{typingStatus:n})),setTimeout(()=>{const e=Object(s.e)(),a=Object(o.f)(e,t);a&&n&&a.typingStatus&&a.typingStatus.timestamp===n.timestamp&&Object(s.g)(Object(r.H)(e,t,{typingStatus:void 0}))},6e3);break}case"newMessage":{const{message:n}=a,{chatId:c,threadId:l,type:d}=Object(o.y)(e)||{};if(n.senderId===e.currentUserId&&!n.isFromScheduled)return;const b=Object(o.f)(e,a.chatId);if(!b)return;const u="thread"===d&&l===i.MAIN_THREAD_ID&&a.chatId===c;u?setTimeout(()=>{t.requestChatUpdate({chatId:a.chatId})},1e3):Object(s.g)(Object(r.H)(e,a.chatId,{unreadCount:b.unreadCount?b.unreadCount+1:1,...a.message.hasUnreadMention&&{unreadMentionsCount:b.unreadMentionsCount?b.unreadMentionsCount+1:1}}));const m=Object(o.q)(Object(s.e)());Object(_.a)(m),Object(G.b)({chat:b,message:n,isActiveChat:u});break}case"updateCommonBoxMessages":case"updateChannelMessages":{const{ids:t,messageUpdate:n}=a;if(!1!==n.hasUnreadMention)return;t.forEach(t=>{const s="channelId"in a?a.channelId:Object(o.p)(e,t),n=Object(o.f)(e,s);n&&n.unreadMentionsCount&&(e=Object(r.H)(e,s,{unreadMentionsCount:n.unreadMentionsCount-1}))}),Object(s.g)(e);break}case"updateChatFullInfo":{const{fullInfo:t}=a,n=e.chats.byId[a.id];if(!n)return;Object(s.g)(Object(r.H)(e,a.id,{fullInfo:{...n.fullInfo,...t}}));break}case"updatePinnedChatIds":{const{ids:t,folderId:c}=a,r=c===n.h?"archived":"active";e={...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[r]:t.length?t:void 0}}},Object(s.g)(e);break}case"updateChatPinned":{const{id:t,isPinned:c}=a,r=Object(o.j)(e,t);if(r){const{[r]:a}=e.chats.orderedPinnedIds;let s=a||[];if(c){if(!s.includes(t)){if("active"===r&&s.length>=n.K){const t=e.chats.listIds.active;s=s.filter(e=>t&&t.includes(e))}s=[t,...s]}}else s=s.filter(e=>e!==t);e={...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[r]:s.length?s:void 0}}}}Object(s.g)(e);break}case"updateChatListType":{const{id:t,folderId:n}=a;Object(s.g)(Object(r.K)(e,t,n));break}case"updateChatFolder":{const{id:t,folder:n}=a,{byId:c,orderedIds:r}=e.chatFolders,o=n?{...c,[t]:n}:Object(d.l)(c,Object.keys(c).map(Number).filter(e=>e!==t)),i=n?r&&r.includes(t)?r:[...r||[],t]:r?r.filter(e=>e!==t):void 0;Object(s.g)({...e,chatFolders:{...e.chatFolders,byId:o,orderedIds:i}});break}case"updateChatFoldersOrder":{const{orderedIds:t}=a;Object(s.g)({...e,chatFolders:{...e.chatFolders,orderedIds:t}});break}case"updateRecommendedChatFolders":{const{folders:t}=a;Object(s.g)({...e,chatFolders:{...e.chatFolders,recommended:t}});break}case"updateChatMembers":{const t=e.chats.byId[a.id],{replacedMembers:n,addedMember:c,deletedMemberId:o}=a;if(!t)return;let i=!1,l=t.fullInfo&&t.fullInfo.members?[...t.fullInfo.members]:[];if(n)l=n,i=!0;else if(c)l.length&&l.some(e=>e.userId===c.userId)||(l.push(c),i=!0);else if(l.length&&o){const e=l.findIndex(e=>e.userId===o);e>-1&&(l.slice(e,1),i=!0)}if(i){const n=l.filter(({isOwner:e,isAdmin:t})=>e||t);Object(s.g)(Object(r.H)(e,a.id,{membersCount:l.length,fullInfo:{...t.fullInfo,members:l,adminMembers:n}}))}break}case"deleteProfilePhotos":{const{chatId:t,ids:n}=a,c=e.chats.byId[t];c&&c.photos&&Object(s.g)(Object(r.H)(e,t,{photos:c.photos.filter(e=>!n.includes(e.id))}));break}case"draftMessage":{const{chatId:t,formattedText:n,replyingToId:c}=a;e.chats.byId[t]&&(e=Object(r.x)(e,t,i.MAIN_THREAD_ID,"draft",n),e=Object(r.x)(e,t,i.MAIN_THREAD_ID,"replyingToId",c),e=Object(r.H)(e,t,{hasDraft:Boolean(n)}),Object(s.g)(e))}}});function $(e,t,a,s,n=!1){const c=n?Object(o.pb)(e,t,a):Object(o.k)(e,t,a);if(c&&s.content){const{photo:e,video:t,sticker:a,document:n}=Object(h.w)(c);e&&s.content.photo?(s.content.photo.blobUrl=e.blobUrl,s.content.photo.thumbnail=e.thumbnail):t&&s.content.video?s.content.video.blobUrl=t.blobUrl:a&&s.content.sticker?s.content.sticker.isPreloadedGlobally=a.isPreloadedGlobally:n&&s.content.document&&(s.content.document.previewBlobUrl=n.previewBlobUrl)}return n?Object(r.eb)(e,t,a,s):Object(r.L)(e,t,a,s)}function W(e,t){const{id:a,chatId:s}=t,n=Object(o.f)(e,s);if(n&&n.unreadCount&&!Object(o.Y)(e,s,i.MAIN_THREAD_ID))return e;if(e=Object(r.V)(e,s,i.MAIN_THREAD_ID,[a]),Object(o.X)(e,s,i.MAIN_THREAD_ID)){const t=Object(o.H)(e,s,i.MAIN_THREAD_ID),n=Object(r.g)(e,s,i.MAIN_THREAD_ID,a),c=Object(o.Ib)(n,s,i.MAIN_THREAD_ID);t&&!c.includes(t)||(e=n)}const{threadInfo:c,firstMessageId:l}=Object(o.Cb)(e,s,t)||{};return!l&&Object(h.tb)(t)||c&&(e=Object(r.V)(e,s,c.threadId,[a]),Object(o.X)(e,s,c.threadId)&&(e=Object(r.g)(e,s,c.threadId,a),l||(e=Object(r.x)(e,s,c.threadId,"firstMessageId",t.id)),c.lastMessageId||(e=Object(r.x)(e,s,c.threadId,"threadInfo",{...c,lastMessageId:t.id})))),e}function z(e,t,a,s=!1){const{chats:n}=e,c=n.byId[t]&&n.byId[t].lastMessage;if(c&&!s){if(!(c.id===a.id||c.id===a.previousLocalId||a.id>c.id))return e}return Object(r.H)(e,t,{lastMessage:a})}function K(e,t){const a=Object(o.m)(e,t),s=Object(o.Y)(e,t,i.MAIN_THREAD_ID);if(!a||!s)return;let n=s.length;for(;n--;){const e=a[s[n]];if(!e.isDeleting)return e}}function Q(e,t,a,n){if(e){t.forEach(t=>{const a=K(n=Object(r.L)(n,e,t,{isDeleting:!0}),e);a&&(n=z(n,e,a,!0))}),Object(s.g)(n),a.requestChatUpdate({chatId:e});const c=[];return t.forEach(t=>{const a=Object(o.k)(n,e,t);if(!a)return;const{threadInfo:s}=Object(o.Cb)(n,e,a)||{};s&&c.push(s.threadId)}),Object(d.o)(c).forEach(t=>{a.requestThreadInfoUpdate({chatId:e,threadId:t})}),void setTimeout(()=>{Object(s.g)(Object(r.j)(Object(s.e)(),e,t))},350)}const c=[];t.forEach(e=>{const t=Object(o.p)(n,e);if(t){c.push(t);const a=K(n=Object(r.L)(n,t,e,{isDeleting:!0}),t);a&&(n=z(n,t,a,!0)),setTimeout(()=>{Object(s.g)(Object(r.j)(Object(s.e)(),t,[e]))},350)}}),Object(s.g)(n),Object(d.o)(c).forEach(e=>{a.requestChatUpdate({chatId:e})})}Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"newMessage":{const{chatId:n,id:c,message:i}=a;e=W(e=$(e,n,c,i),i),i.threadInfo&&(e=Object(r.kb)(e,i.threadInfo.chatId,i.threadInfo.threadId,i.threadInfo)),Object(s.g)(e);const l=Object(o.k)(e,n,c);if(Object(o.a)(e,n,i)){if(i.isOutgoing&&(!i.content||!i.content.action)){const a=Object(o.y)(e);a&&t.focusMessage({chatId:n,threadId:a.threadId,messageId:i.id,noHighlight:!0})}const{threadInfo:a}=Object(o.Cb)(e,n,i)||{};a&&t.requestThreadInfoUpdate({chatId:n,threadId:a.threadId}),Object(h.tb)(i)||setTimeout(()=>{Object(s.g)(z(Object(s.e)(),n,l))},350)}else Object(s.g)(z(Object(s.e)(),n,l));Object(o.M)(e,n)||t.loadTopChats();break}case"newScheduledMessage":{const{chatId:t,id:n,message:c}=a;e=$(e,t,n,c,!0);const l=Object(o.ob)(e,t)||[];e=Object(r.x)(e,t,i.MAIN_THREAD_ID,"scheduledIds",Object(d.o)([...l,n])),Object(s.g)(e);break}case"updateMessage":{const{chatId:t,id:n,message:c}=a;if(!Object(o.k)(e,t,n))return;e=$(e,t,n,c);const i=Object(o.k)(e,t,n);c.threadInfo&&(e=Object(r.kb)(e,c.threadInfo.chatId,c.threadInfo.threadId,c.threadInfo)),e=z(e,t,i),Object(s.g)(e);break}case"updateScheduledMessage":{const{chatId:t,id:n,message:c}=a;if(!Object(o.pb)(e,t,n))return;e=$(e,t,n,c,!0);const l=Object.keys(Object(o.qb)(e,t)||{}).map(Number).sort((e,t)=>t-e);e=Object(r.x)(e,t,i.MAIN_THREAD_ID,"scheduledIds",l),Object(s.g)(e);break}case"updateMessageSendSucceeded":{const{chatId:t,localId:n,message:c}=a;e=W(e,c);const i=Object(o.k)(e,t,n);e=Object(r.j)(e,t,[n]),c.isScheduled&&(e=Object(r.k)(e,t,[n])),e=Object(r.L)(e,t,c.id,{...i,...c,previousLocalId:n});const l=Object(o.k)(e,t,c.id);e=z(e,t,l),Object(s.g)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:n,message:c}=a,l=Object(o.ob)(e,t)||[];e=Object(r.x)(e,t,i.MAIN_THREAD_ID,"scheduledIds",[...l,c.id]);const d=Object(o.pb)(e,t,n);e=Object(r.k)(e,t,[n]),e=Object(r.eb)(e,t,c.id,{...d,...c,previousLocalId:n}),Object(s.g)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:n,messageIds:c}=a,l=Object(o.jb)(e,t)||[],d=n?[...l,...c].sort((e,t)=>t-e):l.filter(e=>!c.includes(e));Object(s.g)(Object(r.x)(e,t,i.MAIN_THREAD_ID,"pinnedIds",d));break}case"updateThreadInfo":{const{chatId:t,threadId:n,threadInfo:c,firstMessageId:i}=a,l={...Object(o.Db)(e,t,n),...c};if(!l.threadId)return;e=Object(r.kb)(e,t,n,l),i&&(e=Object(r.x)(e,t,n,"firstMessageId",i)),Object(s.g)(e);break}case"resetMessages":{const{id:n}=a,c=Object(o.m)(e,n);c&&!Object(h.mb)(n)&&(e=Object(r.j)(e,n,Object.keys(c).map(Number)),Object(s.g)(e),t.loadFullChat({chatId:n,force:!0}));break}case"deleteMessages":{const{ids:s,chatId:n}=a;Q(n,s,t,e);break}case"deleteScheduledMessages":{const{ids:t,chatId:n}=a;!function(e,t,a,n){if(!e)return;t.forEach(t=>{n=Object(r.eb)(n,e,t,{isDeleting:!0})}),Object(s.g)(n),setTimeout(()=>{n=Object(r.k)(Object(s.e)(),e,t);const a=Object(o.qb)(n,e);n=Object(r.x)(n,e,i.MAIN_THREAD_ID,"scheduledIds",Object.keys(a||{}).map(Number)),Object(s.g)(n)},350)}(n,t,0,e);break}case"deleteHistory":{const{chatId:s}=a;Q(s,Object.keys(e.messages.byChatId[s].byId).map(Number),t,e);break}case"updateCommonBoxMessages":{const{ids:t,messageUpdate:n}=a;t.forEach(t=>{const a=Object(o.p)(e,t);a&&(e=Object(r.L)(e,a,t,n))}),Object(s.g)(e);break}case"updateChannelMessages":{const{channelId:t,ids:n,messageUpdate:c}=a;n.forEach(a=>{e=Object(r.L)(e,t,a,c)}),Object(s.g)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:n}=a,c=Object(o.l)(e,t);if(c&&c.content.poll){const t={...c.content.poll,...n},{results:a}=t.results||{};if(a&&!a.some(e=>e.isChosen)){const{results:e}=c.content.poll.results,s=e&&e.filter(e=>e.isChosen);s&&s.forEach(e=>{const s=a.findIndex(t=>t.option===e.option);s>=0&&(t.results.results[s].isChosen=!0)})}Object(s.g)(Object(r.L)(e,c.chatId,c.id,{content:{...c.content,poll:t}}))}break}case"updateMessagePollVote":{const{pollId:t,userId:n,options:c}=a,i=Object(o.l)(e,t);if(!i||!i.content.poll||!i.content.poll.results)break;const{poll:l}=i.content,{recentVoterIds:d,totalVoters:b,results:u}=l.results,m=d?[...d]:[],h=b?b+1:1,O=u?[...u]:[];m.push(n),c.forEach(t=>{const a=O.find(e=>e.option===t),s=O.findIndex(e=>e.option===t),c=a?{...a}:{option:t,votersCount:0};c.votersCount+=1,n===e.currentUserId&&(c.isChosen=!0),s?O[s]=c:O.push(c)}),Object(s.g)(Object(r.L)(e,i.chatId,i.id,{content:{...i.content,poll:{...l,results:{...l.results,recentVoterIds:m,totalVoters:h,results:O}}}}));break}}});const Y=Object(g.g)((function(){let e=Object(s.e)();J.forEach(([t,a])=>{e=Object(r.nb)(e,t,{status:a})}),Object(s.g)(e),J=[]}),3e3,!0);let J=[];Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"deleteUser":return Object(r.l)(e,a.id);case"updateUser":return Object(r.nb)(e,a.id,a.user);case"updateUserStatus":return s=a.userId,n=a.status,J.push([s,n]),void Y();case"updateUserFullInfo":{const{id:t,fullInfo:s}=a,n=e.users.byId[t];if(!n)return;return Object(r.nb)(e,t,{fullInfo:{...n.fullInfo,...s}})}}var s,n}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateStickerSet":return Object(r.hb)(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.p)(Object(s.e)(),a.id);case"updateResetContactList":Object(s.g)({...Object(s.e)(),contactList:{hash:0,userIds:[]}});break;case"updateFavoriteStickers":t.loadFavoriteStickers();break;case"updatePrivacy":e.settings.privacy[a.key]=a.rules}}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateNotifySettings":return Object(r.cb)(e,a.peerType,a.isSilent,a.shouldShowPreviews);case"updateNotifyExceptions":{const{id:t,isMuted:n,isSilent:c,shouldShowPreviews:o}=a;e.chats.byId[t]&&(e=Object(r.H)(e,t,{isMuted:n})),Object(s.g)(Object(r.e)(e,t,{isMuted:n,isSilent:c,shouldShowPreviews:o}));break}}}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateTwoFaStateWaitCode":return{...e,twoFaSettings:{...e.twoFaSettings,isLoading:!1,waitingEmailCodeLength:a.length}};case"updateTwoFaError":return{...e,twoFaSettings:{...e.twoFaSettings,error:a.message}}}});var X=a(48),Z=a(8),ee=a(35),te=a(126),ae=a(47),se=a(110);var ne=a(43),ce=a(26),re=a(62),oe=a(41),ie=a(23),le=a(153),de=a(140);a(197);var be=Object(c.h)(({id:e,name:t,value:a,label:s,checked:n=!1,disabled:r,inactive:o,noAnimation:i,onChange:l,onCheck:d})=>{const b=Object(c.m)(e=>{l&&l(e),d&&d(e.currentTarget.checked)},[l,d]),u=Object(Z.a)("Switcher",r&&"disabled",o&&"inactive",i&&"no-animation");return c.a.createElement("label",{className:u,title:s},c.a.createElement("input",{type:"checkbox",id:e,name:t,value:a,checked:n,disabled:r,onChange:b}),c.a.createElement("span",{className:"widget"}))});a(198);const ue=[0,1,2];var me=Object(c.h)(Object(s.h)(e=>{const{query:t,fetchingStatus:a,chatId:s,date:n}=e.globalSearch,{currentUserId:c}=e,{byId:r}=e.chats,{animationLevel:i}=e.settings.byKey;return{searchQuery:t,isLoading:!!a&&Boolean(a.chats||a.messages),currentUserId:c,chatsById:r,globalSearchChatId:s,searchDate:n,theme:Object(o.Bb)(e),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:u,isLoading:m,currentUserId:O,globalSearchChatId:j,searchDate:g,theme:f,animationLevel:p,chatsById:I,openChat:v,openTipsChat:y,setGlobalSearchDate:C,setSettingOption:w})=>{const E=Object(ce.a)(),M=e===l.d.ChatList,S={date:void 0},k={id:void 0},N=Object(c.p)(()=>g?Object(x.a)(new Date(1e3*g)):void 0,[g]),T=Object(c.p)(()=>M&&I?Object.values(I).reduce((e,t)=>Object(h.ib)(t)&&t.unreadCount?e+1:e,0):0,[M,I]),P="web.telegram.org"===window.location.hostname,A=Object(c.p)(()=>({onTrigger:e,isOpen:t})=>c.a.createElement(ie.a,{round:!0,ripple:M&&!b.k,size:"smaller",color:"translucent",className:t?"active":"",onClick:M?e:()=>d(),ariaLabel:M?E("AccDescrOpenMenu2"):"Return to chat list"},c.a.createElement("div",{className:Object(Z.a)("animated-menu-icon",!M&&"state-back")})),[M,E,d]),L=Object(c.m)(()=>{u||a("")},[u,a]),R=Object(c.m)(()=>{v({id:O})},[O,v]),F=Object(c.m)(e=>{e.stopPropagation();const t="light"===f?"dark":"light";w({theme:t}),w({shouldUseSystemTheme:!1}),Object(ne.a)(t,p===n.e)},[p,w,f]),D=Object(c.m)(e=>{e.stopPropagation();const t=0===p?2:0;ue.forEach((e,a)=>{document.body.classList.toggle("animation-level-"+a,t===a)}),w({animationLevel:t})},[p,w]),B=Boolean(j)||e===l.d.GlobalSearch||e===l.d.Contacts,H=e===l.d.Contacts?E("SearchFriends"):E("Search");return c.a.createElement("div",{className:"LeftMainHeader"},c.a.createElement("div",{id:"LeftMainHeader",className:"left-header"},c.a.createElement(re.a,{trigger:A,footer:`${n.f} alpha ${n.g}`},c.a.createElement(oe.a,{icon:"saved-messages",onClick:R},E("SavedMessages")),c.a.createElement(oe.a,{icon:"archive",onClick:o},c.a.createElement("span",{className:"menu-item-name"},E("ArchivedChats")),T>0&&c.a.createElement("div",{className:"archived-badge"},T)),c.a.createElement(oe.a,{icon:"user",onClick:r},E("Contacts")),c.a.createElement(oe.a,{icon:"settings",onClick:s},E("Settings")),c.a.createElement(oe.a,{icon:"darkmode",onClick:F},c.a.createElement("span",{className:"menu-item-name"},E("lng_menu_night_mode")),c.a.createElement(be,{id:"darkmode",label:E("dark"===f?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===f,noAnimation:!0})),c.a.createElement(oe.a,{icon:"animations",onClick:D},c.a.createElement("span",{className:"menu-item-name capitalize"},E("Appearance.Animations").toLowerCase()),c.a.createElement(be,{id:"animations",label:"Toggle Animations",checked:p>0})),c.a.createElement(oe.a,{icon:"help",onClick:y},E("TelegramFeatures")),c.a.createElement(oe.a,{icon:"bug",href:n.x},"Report Bug"),P&&c.a.createElement(c.a.Fragment,null,c.a.createElement(oe.a,{icon:"char-K",href:"https://web.telegram.org/k/",onClick:()=>{localStorage.setItem("kz_version",JSON.stringify("K"))}},"Switch to K Version"),c.a.createElement(oe.a,{icon:"char-W",href:"https://web.telegram.org/?legacy=1"},"Switch to Old Version"))),c.a.createElement(le.a,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:j||g?"with-picker-item":"",value:t||u,focused:B,isLoading:m,placeholder:H,autoComplete:"off",canClose:Boolean(j||g),onChange:a,onReset:d,onFocus:L},N&&c.a.createElement(de.a,{icon:"calendar",title:N,canClose:!0,isMinimized:Boolean(j),className:"search-date",onClick:C,clickArg:S}),j&&c.a.createElement(de.a,{chatOrUserId:j,onClick:i,canClose:!0,clickArg:k}))))})),he=a(21);a(199);var Oe=Object(c.h)(()=>{const e=Object(ce.a)();return c.a.createElement("div",{id:"ConnectionState",dir:e.isRtl?"rtl":void 0},c.a.createElement(he.a,{color:"black"}),c.a.createElement("div",{className:"state-text"},e("WaitingForNetwork")))}),je=a(131),ge=a(51),fe=a(27),pe=(e,t,a)=>{const s=Object(c.q)(),n=(e=>Object(c.p)(()=>Object(g.g)(e=>e(),e),[e]))(t),r=Object(fe.a)();return Object(ge.a)(()=>{let t=!0;n(()=>{s.current=e(),t||r()}),t=!1},a),s.current},Ie=a(168),ve=a(189);var ye=Object(c.h)(Object(s.h)(e=>{const{chats:{byId:t},users:{byId:a},chatFolders:{byId:s,orderedIds:n,activeChatFolder:c},currentUserId:r,lastSyncTime:i}=e;return{chatsById:t,usersById:a,chatFoldersById:s,orderedFolderIds:n,lastSyncTime:i,notifySettings:Object(o.eb)(e),notifyExceptions:Object(o.db)(e),activeChatFolder:c,currentUserId:r}},(e,t)=>Object(d.l)(t,["loadChatFolders","setActiveChatFolder","openChat"]))(({chatsById:e,usersById:t,chatFoldersById:a,notifySettings:s,notifyExceptions:n,orderedFolderIds:r,activeChatFolder:o,currentUserId:i,lastSyncTime:l,loadChatFolders:u,setActiveChatFolder:m,openChat:O})=>{const j=Object(c.q)(null),g=Object(ce.a)();Object(c.n)(()=>{l&&u()},[l,u]);const f=Object(c.p)(()=>r?r.map(e=>a[e]||{}).filter(Boolean):void 0,[a,r]),p=pe(()=>{if(!f||!f.length)return;const a=Object.keys(e).map(Number),c=f.map(c=>{const{unreadDialogsCount:r,hasActiveDialogs:o}=Object(h.p)(e,t,c,a,s,n)||{};return{id:c.id,badgeCount:r,isBadgeActive:o}});return Object(d.c)(c,"id")},3e3,[f,e,t,s,n]),I=Object(c.p)(()=>{if(f&&f.length)return[{title:g("FilterAllChats")},...f.map(e=>({title:e.title,...p&&p[e.id]}))]},[f,p,g]),v=Object(c.m)(e=>{m(e)},[m]);Object(c.n)(()=>{I&&I.length&&o>=I.length&&m(0)},[o,I,m]),Object(c.n)(()=>{if(j.current&&b.m&&I&&I.length)return Object(je.b)(j.current,{onSwipe:(e,t)=>{t===je.a.Left?m(Math.min(o+1,I.length-1)):t===je.a.Right&&m(Math.max(0,o-1))}})},[o,I,m]);const y=Object(c.q)();y.current=0!==o,Object(c.n)(()=>y.current?Object(ae.a)(()=>{y.current&&m(0)}):void 0,[o,m]),Object(c.n)(()=>{const e=e=>{if(e.metaKey&&e.code.startsWith("Digit")&&I){const[,t]=e.code.match(/Digit(\d)/)||[];if(!t)return;if("0"===t)return void O({id:i});const a=Number(t)-1;if(a>I.length-1)return;m(a),e.preventDefault()}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}});const{shouldRender:C,transitionClassNames:w}=Object(ee.a)(!r,void 0,!0);function E(e){const t=Object.values(a).find(({title:e})=>e===I[o].title);return t&&0!==o?c.a.createElement(ve.a,{folderType:"folder",folderId:t.id,noChatsText:g("FilterNoChatsToDisplay"),isActive:e}):c.a.createElement(ve.a,{folderType:"all",isActive:e})}return c.a.createElement("div",{className:"ChatFolders"},I&&I.length?c.a.createElement(Ie.a,{tabs:I,activeTab:o,onSwitchTab:v}):C?c.a.createElement("div",{className:Object(Z.a)("tabs-placeholder",w)}):void 0,c.a.createElement(se.a,{ref:j,name:g.isRtl?"slide-reversed":"slide",activeKey:o,renderCount:I?I.length:void 0},E))})),Ce=a(12),we=a(20),Ee=a(17);var Me=Object(c.h)(e=>{const t=Object(we.a)(Ce.a.Extra,"LeftSearch");return t?c.a.createElement(t,e):c.a.createElement(Ee.a,null)});var Se=Object(c.h)(e=>{const t=Object(we.a)(Ce.a.Extra,"ContactList");return t?c.a.createElement(t,e):c.a.createElement(Ee.a,null)}),ke=a(53);a(210);let Ne;var Te=Object(c.h)(({isShown:e,onNewPrivateChat:t,onNewChannel:a,onNewGroup:s})=>{const[n,r]=Object(c.r)(!1);Object(c.n)(()=>{e||r(!1)},[e]);const o=Object(ce.a)(),i=Object(Z.a)("NewChatButton",e&&"revealed",n&&"menu-is-open"),l=Object(c.m)(()=>{Ne&&(clearTimeout(Ne),Ne=void 0)},[]),d=Object(c.m)(()=>{Ne&&(clearTimeout(Ne),Ne=void 0),Ne=window.setTimeout(()=>{r(!1)},750)},[]);return c.a.createElement("div",{className:i,onMouseEnter:l,onMouseLeave:d},c.a.createElement(ie.a,{round:!0,color:"primary",className:n?"active":"",onClick:()=>{r(!n)},ariaLabel:o(n?"Close":"NewMessageTitle"),tabIndex:-1},c.a.createElement("i",{className:"icon-new-chat-filled"}),c.a.createElement("i",{className:"icon-close"})),c.a.createElement(ke.a,{isOpen:n,positionX:"right",positionY:"bottom",autoClose:!0,onClose:()=>{r(!1)}},c.a.createElement(oe.a,{icon:"channel",onClick:a},o("NewChannel")),c.a.createElement(oe.a,{icon:"group",onClick:s},o("NewGroup")),c.a.createElement(oe.a,{icon:"user",onClick:t},o("NewMessageTitle"))))}),Pe=a(157);a(211);const Ae=Object.keys(l.d).length/2;let xe;var Le=Object(s.h)(e=>Object(d.l)(e,["connectionState"]))(({content:e,searchQuery:t,searchDate:a,contactsFilter:s,onSearchQuery:n,onContentChange:r,onReset:o,connectionState:i})=>{const[d,u]=Object(c.r)(b.m),m=!function(){const[e,t]=Object(c.r)(window.navigator.onLine);return Object(c.n)(()=>{function e(){t(window.navigator.onLine)}return window.addEventListener("online",e),window.addEventListener("offline",e),()=>{window.removeEventListener("offline",e),window.removeEventListener("online",e)}},[]),e}()||"connectionStateConnecting"===i,h=Object(c.q)(!1),O=Object(c.m)(()=>{r(l.d.Settings)},[r]),j=Object(c.m)(()=>{r(l.d.Contacts)},[r]),g=Object(c.m)(()=>{r(l.d.NewChannelStep1)},[r]),f=Object(c.m)(()=>{r(l.d.NewGroupStep1)},[r]),p=Object(c.m)(()=>{r(l.d.Archived)},[r]),I=Object(c.m)(()=>{e===l.d.ChatList&&(h.current=!0,u(!0))},[e]),v=Object(c.m)(()=>{h.current=!1,xe&&(clearTimeout(xe),xe=void 0),xe=window.setTimeout(()=>{h.current||u(!1)},250)},[]);return Object(c.n)(()=>{let t;return e!==l.d.ChatList?t=window.setTimeout(()=>{u(!1)},250):(h.current||b.m)&&u(!0),()=>{t&&(clearTimeout(t),t=void 0)}},[e]),c.a.createElement("div",{id:"LeftColumn-main",onMouseEnter:b.m?void 0:I,onMouseLeave:b.m?void 0:v},c.a.createElement(me,{content:e,contactsFilter:s,onSearchQuery:n,onSelectSettings:O,onSelectContacts:j,onSelectArchived:p,onReset:o}),c.a.createElement(Pe.a,{isOpen:m,isCustom:!0,className:"connection-state-wrapper opacity-transition slow"},()=>c.a.createElement(Oe,null)),c.a.createElement(se.a,{name:"zoom-fade",renderCount:Ae,activeKey:e,shouldCleanup:!0,cleanupExceptionKey:l.d.ChatList,className:m?"pull-down":void 0},n=>{switch(e){case l.d.ChatList:return c.a.createElement(ye,null);case l.d.GlobalSearch:return c.a.createElement(Me,{searchQuery:t,searchDate:a,isActive:n,onReset:o});case l.d.Contacts:return c.a.createElement(Se,{filter:s});default:return}}),c.a.createElement(Te,{isShown:d,onNewPrivateChat:j,onNewChannel:g,onNewGroup:f}))});var Re=Object(c.h)(e=>{const t=Object(we.a)(Ce.a.Extra,"Settings");return t?c.a.createElement(t,e):c.a.createElement(Ee.a,null)});var Fe=Object(c.h)(e=>{const t=Object(we.a)(Ce.a.Extra,"NewChat");return t?c.a.createElement(t,e):c.a.createElement(Ee.a,null)});var De,Be=Object(c.h)(e=>{const t=Object(we.a)(Ce.a.Extra,"ArchivedChats");return t?c.a.createElement(t,e):c.a.createElement(Ee.a,null)});a(212);!function(e){e[e.Main=0]="Main",e[e.Settings=1]="Settings",e[e.Archived=2]="Archived",e[e.NewGroup=3]="NewGroup",e[e.NewChannel=4]="NewChannel"}(De||(De={}));const He=Object.keys(De).length/2;var Ue=Object(c.h)(Object(s.h)(e=>{const{globalSearch:{query:t,date:a},chatFolders:{activeChatFolder:s}}=e;return{searchQuery:t,searchDate:a,activeChatFolder:s}},(e,t)=>Object(d.l)(t,["setGlobalSearchQuery","setGlobalSearchChatId","resetChatCreation","setGlobalSearchDate","loadPasswordInfo","clearTwoFaError"]))(({searchQuery:e,searchDate:t,activeChatFolder:a,setGlobalSearchQuery:s,setGlobalSearchChatId:n,resetChatCreation:r,setGlobalSearchDate:o,loadPasswordInfo:i,clearTwoFaError:d})=>{const[u,m]=Object(c.r)(l.d.ChatList),[h,O]=Object(c.r)(l.m.Main),[j,g]=Object(c.r)(""),[f,p]=Object(c.r)(0);let I=De.Main;switch(u){case l.d.Archived:I=De.Archived;break;case l.d.Settings:I=De.Settings;break;case l.d.NewChannelStep1:case l.d.NewChannelStep2:I=De.NewChannel;break;case l.d.NewGroupStep1:case l.d.NewGroupStep2:I=De.NewGroup}const v=Object(c.m)(e=>{if(u!==l.d.NewGroupStep2||e){if(u===l.d.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(u===l.d.Settings)switch(h){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 O(l.m.Main);case l.m.GeneralChatBackground:return void O(l.m.General);case l.m.GeneralChatBackgroundColor:return void O(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 O(l.m.Privacy);case l.m.PrivacyPhoneNumberAllowedContacts:case l.m.PrivacyPhoneNumberDeniedContacts:return void O(l.m.PrivacyPhoneNumber);case l.m.PrivacyLastSeenAllowedContacts:case l.m.PrivacyLastSeenDeniedContacts:return void O(l.m.PrivacyLastSeen);case l.m.PrivacyProfilePhotoAllowedContacts:case l.m.PrivacyProfilePhotoDeniedContacts:return void O(l.m.PrivacyProfilePhoto);case l.m.PrivacyForwardingAllowedContacts:case l.m.PrivacyForwardingDeniedContacts:return void O(l.m.PrivacyForwarding);case l.m.PrivacyGroupChatsAllowedContacts:case l.m.PrivacyGroupChatsDeniedContacts:return void O(l.m.PrivacyGroupChats);case l.m.TwoFaNewPassword:return void O(l.m.TwoFaDisabled);case l.m.TwoFaNewPasswordConfirm:return void O(l.m.TwoFaNewPassword);case l.m.TwoFaNewPasswordHint:return void O(l.m.TwoFaNewPasswordConfirm);case l.m.TwoFaNewPasswordEmail:return void O(l.m.TwoFaNewPasswordHint);case l.m.TwoFaNewPasswordEmailCode:return void O(l.m.TwoFaNewPasswordEmail);case l.m.TwoFaChangePasswordCurrent:case l.m.TwoFaTurnOff:case l.m.TwoFaRecoveryEmailCurrentPassword:return void O(l.m.TwoFaEnabled);case l.m.TwoFaChangePasswordNew:return void O(l.m.TwoFaChangePasswordCurrent);case l.m.TwoFaChangePasswordConfirm:return void O(l.m.TwoFaChangePasswordNew);case l.m.TwoFaChangePasswordHint:return void O(l.m.TwoFaChangePasswordConfirm);case l.m.TwoFaRecoveryEmail:return void O(l.m.TwoFaRecoveryEmailCurrentPassword);case l.m.TwoFaRecoveryEmailCode:return void O(l.m.TwoFaRecoveryEmail);case l.m.FoldersCreateFolder:case l.m.FoldersEditFolder:return void O(l.m.Folders)}u!==l.d.ChatList||0!==a?(m(l.d.ChatList),g(""),s({query:""}),o({date:void 0}),n({id:void 0}),r(),setTimeout(()=>{p(Date.now())},250)):m(l.d.GlobalSearch)}else m(l.d.NewGroupStep1)},[u,a,s,o,n,r,h]),y=Object(c.m)(t=>{u!==l.d.Contacts?(m(l.d.GlobalSearch),t!==e&&s({query:t})):g(t)},[u,s,e]);return Object(c.n)(()=>u!==l.d.ChatList||0===a?Object(ae.a)(()=>v()):void 0,[a,u,v]),Object(c.n)(()=>{d(),h===l.m.Privacy&&i()},[d,i,h]),c.a.createElement(se.a,{id:"LeftColumn",name:b.k?"slide-layers":"push-slide",renderCount:He,activeKey:I,shouldCleanup:!0,cleanupExceptionKey:De.Main},a=>{switch(I){case De.Archived:return c.a.createElement(Be,{isActive:a,onReset:v});case De.Settings:return c.a.createElement(Re,{currentScreen:h,onScreenSelect:O,onReset:v});case De.NewChannel:return c.a.createElement(Fe,{key:f,isChannel:!0,content:u,onContentChange:m,onReset:v});case De.NewGroup:return c.a.createElement(Fe,{key:f,content:u,onContentChange:m,onReset:v});default:return c.a.createElement(Le,{content:u,searchQuery:e,searchDate:t,contactsFilter:j,onContentChange:m,onSearchQuery:y,onReset:v})}})})),qe=a(138),Ge=a(11),_e=a(13),Ve=a(56);var $e=()=>{const[e,t]=Object(c.r)(Ve.a.get());return Object(c.n)(()=>{const e=Object(g.g)(()=>{t(Ve.a.get())},250,!1);return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),e},We=a(174);function ze(e,t){const a=e<=n.db?16:32,s=function(e){if(e>n.ab){const t=Math.min(Math.max(.25*e,288),424),a=Math.min(.25*e,424);return Math.min(e-t-a,728)}if(e>n.Z){const t=Math.min(Math.max(.4*e,288),424);return Math.min(e-t,728)}if(e>728)return 728;return e}(e),c=e<=n.db?54:64,r=t?s-a-c:s-a,o=e>n.db?Math.min(s-a,512):s-a,i=o/r,l=r/o;return{composerHiddenScale:i,toolbarHiddenScale:l,composerTranslateX:t?c/2*l:0,toolbarTranslateX:t?c/2*-1*i:0,unpinHiddenScale:o/258,toolbarForUnpinHiddenScale:258/o}}var Ke=a(133),Qe=a(143),Ye=a(134),Je=a(49),Xe=a(108),Ze=a(122);var et=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(we.a)(Ce.a.Extra,"HeaderMenuContainer",!t);return a?c.a.createElement(a,e):void 0});var tt=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const n=Object(o.f)(e,t),c=Boolean(n&&Object(h.kb)(n));if(n&&n.isRestricted)return{noMenu:!0};const r=Object(o.P)(e,t),l="thread"===s&&a===i.MAIN_THREAD_ID,d="thread"===s&&a!==i.MAIN_THREAD_ID,u=Object(o.W)(e),m=Boolean(Object(o.L)(e,t)),O=Boolean(l&&n&&(c||Object(h.ob)(n))&&n.isNotJoined),j=l||d,g=l&&!r&&!O,f=!Object(o.S)(e),p=l&&!O;return{noMenu:!(b.k&&O||b.k&&j||g||f||p),isChannel:c,isRightColumnShown:u,canStartBot:m,canSubscribe:O,canSearch:j,canMute:g,canSelect:f,canLeave:p}},(e,t)=>Object(d.l)(t,["joinChannel","sendBotCommand","openLocalTextSearch"]))(({chatId:e,threadId:t,noMenu:a,isChannel:s,canStartBot:n,canSubscribe:r,canSearch:o,canMute:i,canSelect:l,canLeave:d,isRightColumnShown:u,joinChannel:m,sendBotCommand:h,openLocalTextSearch:O})=>{const j=Object(c.q)(null),[g,f]=Object(c.r)(!1),[p,I]=Object(c.r)(void 0),v=Object(c.m)(()=>{f(!0);const e=j.current.getBoundingClientRect();I({x:e.right,y:e.bottom})},[]),y=Object(c.m)(()=>{f(!1)},[]),C=Object(c.m)(()=>{I(void 0)},[]),w=Object(c.m)(()=>{m({chatId:e})},[m,e]),E=Object(c.m)(()=>{h({command:"/start"})},[h]),M=Object(c.m)(()=>{if(O(),b.k){document.querySelector("#MobileSearch input").focus()}else setTimeout(()=>{const e=document.querySelector(".RightHeader .SearchInput input");e&&e.focus()},400)},[O]),S=Object(ce.a)();return c.a.createElement("div",{className:"HeaderActions"},!b.k&&r&&c.a.createElement(ie.a,{size:"tiny",ripple:!0,fluid:!0,onClick:w},S(s?"Subscribe":"Join Group")),!b.k&&n&&c.a.createElement(ie.a,{size:"tiny",ripple:!0,fluid:!0,onClick:E},S("BotStart")),!b.k&&o&&c.a.createElement(ie.a,{round:!0,ripple:u,color:"translucent",size:"smaller",onClick:M,ariaLabel:"Search in this chat"},c.a.createElement("i",{className:"icon-search"})),(b.k||!r)&&c.a.createElement(ie.a,{ref:j,className:g?"active":"",round:!0,ripple:!b.k,size:"smaller",color:"translucent",disabled:a,ariaLabel:"More actions",onClick:v},c.a.createElement("i",{className:"icon-more"})),p&&c.a.createElement(et,{chatId:e,threadId:t,isOpen:g,anchor:p,isChannel:s,canSubscribe:r,canSearch:o,canMute:i,canSelect:l,canLeave:d,onSubscribeChannel:w,onSearchClick:M,onClose:y,onCloseAnimationEnd:C}))})),at=a(114),st=a(24),nt=a(107),ct=a(44);function rt(e){const t=e&&Object(h.F)(e),{sticker:a}=e&&e.content||{},s=t&&a&&!Object(b.r)()&&t.includes("image/webp"),[r,o]=Object(c.r)(ct.a),i=e&&e.id;return Object(c.o)(()=>{s&&Object(ct.c)("b64-"+i,t).then(o).catch(e=>{n.p&&console.error(e)})},[i,s,t]),s?r:t}var ot=a(116),it=a(42),lt=a(34);function dt(e,t,a,s,n){return`M${e},${t+n}a${n},${n},0,0,1,\n ${a},0v${s-2*n}a${n},${n},0,0,1,${-a},0Z`}var bt=Object(c.h)(({count:e,index:t})=>{const a=Object(c.q)(null),s=Object(c.p)(()=>function(e,t){const a=e-t-1,s=function(e){let t=8;1===e?t=36:2===e?t=17:3===e?t=11:(4===e||e>3)&&(t=7.5);return t}(e),n=function(e,t){let a=36;1===e?a=36:2===e?a=17:3===e?a=1===t?12:11:(4===e||e>3)&&(a=7.5);return a}(e,a),c=function(e,t){return e<=3?36:t*e+2*(e-1)}(e,s),r="clipPath"+e,o=function(e,t,a){let s="";if(3===a)s=dt(0,0,2,t,1)+dt(0,12,2,t+1,1)+dt(0,25,2,t,1);else for(let e=0;e<a;e++)s+=dt(0,(t+2)*e,2,t,1);return`<clipPath id="${e}">\n <path d="${s}" />\n </clipPath>`}(r,s,e),i=function(e,t,a){if(1===a)return 0;if(2===a)return 0===e?0:t+2;return 3===a?0===e?0:1===e?12:25:(t+2)*e}(a,s,e),l=function(e,t,a,s){if(t<=4)return 0;if(e<=1)return 0;if(e>=t-2)return s-36;return(a+4)/2+(e-2)*(a+2)}(a,e,s,c);return{markHeight:n,clipPath:o,markTranslateY:i,trackTranslateY:l,trackHeight:c,clipPathId:r}}(e,t),[e,t]);if(Object(c.n)(()=>{if(!a.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:n,markTranslateY:c,clipPathId:r,clipPath:o}=s,i=a.current.firstElementChild;if(a&&a.current){const s=a.current,{style:l}=s;l.height=e+"px",l.transform=`translateY(-${t}px)`,l.clipPath=`url("#${r}")`;const d=s.querySelector("svg"),b=s.querySelector("div"),u=s.querySelector("defs");d||i&&(i.innerHTML=`<svg height="0" width="0"><defs> ${o} </defs></svg>`),u&&(u.innerHTML=o),b&&(b.style.height=n+"px",b.style.transform=`translateY(${c}px)`)}},[s]),1===e)return c.a.createElement("div",{className:"pinned-message-border"},c.a.createElement("div",{className:"pinned-message-border-wrapper-1",ref:a}));const{trackHeight:n,trackTranslateY:r,markHeight:o,markTranslateY:i,clipPathId:l}=s;return c.a.createElement("div",{className:Object(Z.a)("pinned-message-border",e>4&&"pinned-message-border-mask")},c.a.createElement("div",{className:"pinned-message-border-wrapper",ref:a,style:`clip-path: url("#${l}"); width: 2px;\n height: ${n}px; transform: translateY(-${r}px);`},c.a.createElement("span",null),c.a.createElement("div",{className:"pinned-message-border-mark",style:`height: ${o}px; transform: translateY(${i}px);`})))});var ut=Object(c.h)(({message:e,count:t,index:a,customTitle:s,className:n,onUnpinMessage:r,onClick:o,onAllPinnedClick:i})=>{const l=Object(ce.a)(),d=rt(e),b=Object(nt.a)(Object(h.E)(e,"pictogram")),u=Object(h.O)(l,e,Boolean(d)),[m,O,j]=Object(lt.a)(),g=Object(c.m)(()=>{j(),r&&r(e.id)},[j,r,e.id]);return c.a.createElement("div",{className:Object(Z.a)("HeaderPinnedMessage-wrapper",n)},t>1&&c.a.createElement(ie.a,{round:!0,size:"smaller",color:"translucent",className:"pin-list-button",ariaLabel:l("EventLogFilterPinnedMessages"),onClick:i},c.a.createElement("i",{className:"icon-pin-list"})),r&&c.a.createElement(ie.a,{round:!0,size:"smaller",color:"translucent",ariaLabel:l("UnpinMessageAlertTitle"),className:"unpin-button",onClick:O},c.a.createElement("i",{className:"icon-close"})),c.a.createElement(ot.a,{isOpen:m,onClose:j,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:g}),c.a.createElement("div",{className:"HeaderPinnedMessage",onClick:o,dir:l.isRtl?"rtl":void 0},c.a.createElement(bt,{count:t,index:a}),d&&function(e,t){const{width:a,height:s}=Object(at.l)();return c.a.createElement("img",{src:t||e,width:a,height:s,alt:""})}(d,b),c.a.createElement("div",{className:"message-text"},c.a.createElement("div",{className:"title",dir:"auto"},s||`${l("PinnedMessage")} ${a>0?"#"+(t-a):""}`),c.a.createElement("p",{dir:"auto"},Object(st.a)(u))),c.a.createElement(it.a,null)))}),mt=a(54),ht=a(175);a(215);var Ot=Object(s.h)((e,{message:t})=>({sender:Object(o.tb)(e,t)}),(e,t)=>Object(d.l)(t,["focusMessage","closeAudioPlayer"]))(({message:e,className:t,noUi:a,sender:s,focusMessage:n,closeAudioPlayer:r})=>{const o=Object(ce.a)(),i=s?Object(h.W)(o,s):void 0,l=mt.c(Object(h.E)(e,"inline")),{playPause:d,isPlaying:u}=Object(ht.a)(Object(h.B)(e),Object(h.r)(e),l,void 0,void 0,!0),m=Object(c.m)(()=>{n({chatId:e.chatId,messageId:e.id})},[n,e.chatId,e.id]),O=Object(c.m)(()=>{u&&d(),r()},[r,u,d]);if(a)return;const j=Object(h.u)(e);return c.a.createElement("div",{className:Object(Z.a)("AudioPlayer",t),dir:o.isRtl?"rtl":void 0},c.a.createElement(ie.a,{round:!0,ripple:!b.k,color:"translucent",size:"smaller",className:Object(Z.a)("toggle-play",u?"pause":"play"),onClick:d,ariaLabel:u?"Pause audio":"Play audio"},c.a.createElement("i",{className:"icon-play"}),c.a.createElement("i",{className:"icon-pause"})),c.a.createElement("div",{className:"AudioPlayer-content",onClick:m},j?function(e){const{title:t,performer:a,fileName:s}=e;return c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"title",dir:"auto"},Object(st.a)(t||s)),a&&c.a.createElement("div",{className:"subtitle",dir:"auto"},Object(st.a)(a)))}(j):function(e,t){return c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"title",dir:"auto"},t&&Object(st.a)(t)),c.a.createElement("div",{className:"subtitle",dir:"auto"},e))}(o("AttachAudio"),i),c.a.createElement(it.a,null)),c.a.createElement(ie.a,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:O,ariaLabel:"Close player"},c.a.createElement("i",{className:"icon-close"})))});a(216);var jt=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const{isLeftColumnShown:n,lastSyncTime:c}=e,{byId:r}=e.chats,l=Object(o.f)(e,t),{typingStatus:d}=l||{},{chatId:b,messageId:u}=e.audioPlayer,m=b&&u?Object(o.k)(e,b,u):void 0,h=Object(o.Eb)(e,t,a);let O;if("pinned"===s){const a=Object(o.jb)(e,t);O=a&&a.length}else if("scheduled"===s){const a=Object(o.ob)(e,t);O=a&&a.length}else if("thread"===s&&a!==i.MAIN_THREAD_ID){const s=Object(o.Db)(e,t,a);s&&(O=s.messagesCount)}const j={typingStatus:d,isLeftColumnShown:n,isRightColumnShown:Object(o.W)(e),isSelectModeActive:Object(o.S)(e),audioMessage:m,chat:l,chatsById:r,originChatId:h?h.id:t,messagesCount:O,isChatWithSelf:Object(o.P)(e,t),isChatWithBot:l&&Object(o.O)(e,l),lastSyncTime:c,notifySettings:Object(o.eb)(e),notifyExceptions:Object(o.db)(e)},g=Object(o.m)(e,t);if("thread"!==s||!g)return j;if(Object.assign(j,{messagesById:g}),a!==i.MAIN_THREAD_ID){const s=Object(o.Fb)(e,t,a),n=s?Object(o.k)(e,t,s):void 0,c=n?Object(o.K)(e,n):void 0;return{...j,pinnedMessageIds:s,canUnpin:!1,topMessageSender:c}}const f=Object(o.jb)(e,t);if(f&&f.length){const t=g[f[0]],{canUnpin:s}=t&&Object(o.b)(e,t,a)||{};return{...j,pinnedMessageIds:f,canUnpin:s}}return j},(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,topMessageSender:l,typingStatus:d,isSelectModeActive:u,isLeftColumnShown:m,isRightColumnShown:O,audioMessage:j,chat:g,chatsById:f,originChatId:p,messagesCount:I,isChatWithSelf:v,isChatWithBot:y,lastSyncTime:C,notifySettings:w,notifyExceptions:E,openChatWithInfo:M,pinMessage:S,focusMessage:k,openChat:N,loadPinnedMessages:T,toggleLeftColumn:P,exitMessageSelectMode:A})=>{const x=Object(ce.a)(),[L,R]=Object(c.r)(0),F=Array.isArray(s)?s[L]:s,D=r&&F?r[F]:void 0,B=Array.isArray(s)?s.length:s?1:0,H=g&&Object(h.l)(x,g).length,U=l?Object(h.W)(x,l):void 0;Object(c.n)(()=>{t===i.MAIN_THREAD_ID&&C&&T({chatId:e})},[e,T,C,t]),Object(c.n)(()=>{R(0)},[s]),Object(Qe.a)(e,F,D);const{width:q}=$e(),G=q<=n.Z,_=b.l&&m,V=Object(c.q)(null),$=Object(c.q)(!0),W=Object(c.m)(()=>{M({id:e})},[M,e]),z=Object(c.m)(t=>{S({chatId:e,messageId:t,isUnpin:!0})},[S,e]),K=Object(c.m)(()=>{if(D){k({chatId:D.chatId,threadId:t,messageId:D.id});const e=Object(Ke.a)(B,L+1);R(e)}},[D,k,t,B,L]),Q=Object(c.m)(()=>{N({id:e,threadId:i.MAIN_THREAD_ID,type:"pinned"})},[N,e]),Y=Object(c.m)(e=>{if(b.k){const e=document.getElementById(n.v);e&&e.blur()}t!==i.MAIN_THREAD_ID||"thread"!==a?("scheduled"===a&&u&&A(),N({id:p,threadId:i.MAIN_THREAD_ID})):b.k||_?(e.stopPropagation(),N({id:void 0})):P()},[N,p,t,a,P,u,A,_]),J=Object(c.p)(()=>{if(!G||!f)return;let e=!1;const t=Object.values(f).reduce((t,a)=>{if(Object(h.ib)(a))return t;const s=a.unreadCount||0;return!s||Object(h.Db)(a,w,E)&&!a.unreadMentionsCount||(e=!0),t+s},0);return t?{isActive:e,totalCount:t}:void 0},[G,f,w,E]),X=q>=n.Z&&q<n.kb||q>n.db&&q<n.Z&&(!H||H>30),te=X||q>n.ab&&q<n.lb,{shouldRender:ae,transitionClassNames:ne}=Object(ee.a)(Boolean(j)),re=Object(Ye.a)(j),{shouldRender:oe,transitionClassNames:le}=Object(ee.a)(D&&!ae),de=Object(Ye.a)(D),be=Object(Ye.a)(U),ue=oe&&de||ae&&re;function me(){return"thread"===a&&t===i.MAIN_THREAD_ID?c.a.createElement(c.a.Fragment,null,G&&he(_,J),c.a.createElement("div",{className:"chat-info-wrapper",onClick:W},Object(h.mb)(e)?c.a.createElement(Xe.a,{userId:e,typingStatus:d,withFullInfo:y,withMediaViewer:!0,withUpdatingStatus:!0,noRtl:!0}):c.a.createElement(Ze.a,{chatId:e,typingStatus:d,noRtl:!0,withMediaViewer:!0,withFullInfo:!0,withUpdatingStatus:!0}))):"thread"===a?c.a.createElement(c.a.Fragment,null,he(),c.a.createElement("h3",null,x("CommentsCount",I))):"pinned"===a?c.a.createElement(c.a.Fragment,null,he(),c.a.createElement("h3",null,x("PinnedMessagesCount",I))):"scheduled"===a?c.a.createElement(c.a.Fragment,null,he(),c.a.createElement("h3",null,v?x("Reminders"):x("messages",I))):void 0}function he(e=!1,t){return c.a.createElement("div",{className:"back-button"},c.a.createElement(ie.a,{round:!0,size:"smaller",color:"translucent",onClick:Y,ariaLabel:e?"Close":"Back"},c.a.createElement("div",{className:Object(Z.a)("animated-close-icon",!e&&"state-back")})),t&&c.a.createElement("div",{className:"unread-count "+(t.isActive?"active":"")},Object(Je.b)(t.totalCount)))}return Object(c.n)(()=>{const e=V.current;if(e)return te&&ue?void(O||X?($.current&&(e.classList.add("tools-stacked","animated"),$.current=!1),setTimeout(()=>{e.classList.remove("animated")},350)):(e.classList.remove("tools-stacked"),$.current=!0)):(e.classList.remove("tools-stacked","animated"),void($.current=!0))},[te,ue,X,O]),c.a.createElement("div",{className:"MiddleHeader",ref:V},c.a.createElement(se.a,{name:"slide-fade",activeKey:"thread"===a?t:1},me),c.a.createElement("div",{className:"header-tools"},oe&&de&&!ae&&c.a.createElement(ut,{key:e,message:de,count:B,index:L,customTitle:be,className:le,onUnpinMessage:o?z:void 0,onClick:K,onAllPinnedClick:Q}),ae&&re&&c.a.createElement(Ot,{key:Object(h.B)(re),message:re,className:ne}),c.a.createElement(tt,{chatId:e,threadId:t,messageListType:a})))})),gt=a(159);function ft(e){return"albumId"in e}function pt(e,t){let a,s=[],n={originalDate:e[0].date,datetime:Number(Object(x.j)(1e3*e[0].date)),senderGroups:[s]};const c=[n];return e.forEach((r,o)=>{r.isInAlbum?a?(a.messages.push(r),r.content.text&&(a.mainMessage=r)):a={albumId:r.groupedId,messages:[r],mainMessage:r}:s.push(r);const i=e[o+1];if(!a||i&&i.groupedId&&i.groupedId===a.albumId||(s.push(a),a=void 0),i){const e=Number(Object(x.j)(1e3*i.date));n.datetime!==e?(n={originalDate:i.date,datetime:e,senderGroups:[]},c.push(n),s=[],n.senderGroups.push(s)):(i.id===t||r.senderId!==i.senderId||r.isOutgoing!==i.isOutgoing||Object(h.eb)(r)||Object(h.eb)(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||i.date-r.date>600)&&(s=[],n.senderGroups.push(s))}}),c}var It=a(106);function vt(){const[e,t]=Object(lt.a)(!1),a=(s=1e3,n=!1,Object(c.p)(()=>Object(g.a)(e=>e(),s,n,r),[s,n,r]));var s,n,r;return{isScrolled:e,updateStickyDates:Object(c.m)((e,s)=>{t(),document.body.classList.contains("is-scrolling-messages")||Object(g.b)(()=>{document.body.classList.add("is-scrolling-messages")}),a(()=>{Object(g.b)(()=>{const t=document.querySelector(".stuck");t&&t.classList.remove("stuck");const a=function(e,t){const a=e.querySelectorAll(".sticky-date"),s=e.scrollTop;return Array.from(a).find(e=>{const{offsetTop:a,offsetHeight:n}=e,c=a-s;return-n<=c&&c<=(t?60:10)})}(e,s);a&&a.classList.add("stuck"),document.body.classList.remove("is-scrolling-messages")})})},[t,a])}}var yt=a(154),Ct=a(123);var wt=({containerRef:e,className:t,messageIds:a,loadMoreForwards:s,loadMoreBackwards:r,isViewportNewest:o,firstUnreadId:i,onFabToggle:l,onNotchToggle:d,children:b})=>{const u=Object(c.q)(null),m=Object(c.q)(null),h=Object(c.q)(null),O=Object(c.m)(()=>{if(!a||!a.length)return l(!1),void d(!1);if(!o)return l(!0),void d(!0);const{offsetHeight:t,scrollHeight:s,scrollTop:n}=e.current,c=s-n-t,r=c<=0;l(i?!r:!(c<=50)),d(!r)},[a,o,e,l,i,d]),{observe:j}=Object(It.a)({rootRef:e,margin:n.U},t=>{if(!s||!r)return;const a=t.find(({isIntersecting:e})=>e);if(!a)return;const{target:n}=a;"backwards-trigger"===n.className?(Object(yt.a)(e.current),r()):"forwards-trigger"===n.className&&(Object(yt.a)(e.current),s())});Object(It.c)(u,j),Object(It.c)(m,j);const{observe:g,freeze:f,unfreeze:p}=Object(It.a)({rootRef:e,margin:50},O);Object(It.c)(h,g);const{observe:I,freeze:v,unfreeze:y}=Object(It.a)({rootRef:e},O);return Object(It.c)(h,I),Object(ge.a)(()=>{f(),v(),setTimeout(()=>{y(),p()},100)},[a]),c.a.createElement("div",{className:t,teactFastList:!0},c.a.createElement("div",{ref:u,key:"backwards-trigger",className:"backwards-trigger"}),b,c.a.createElement("div",{ref:m,key:"forwards-trigger",className:"forwards-trigger"}),c.a.createElement("div",{ref:h,key:"fab-trigger",className:"fab-trigger"}))},Et=a(144),Mt=a(145);function St(e){return"number"==typeof e}function kt(e,t){return e?t?238:175:100}function Nt(e){const t=Object(h.ub)(e),a=Object(h.rb)(e),s=Object(h.H)(e)||Object(h.S)(e),n=Object(h.Q)(e),c=Boolean(Object(h.S)(e)),{width:r,height:o}=s?Object(at.g)(s,t,a,c):Object(at.i)(n,t,a),i=kt(Boolean(Object(h.P)(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 Tt=0,Pt=1,At=2,xt=4,Lt=8;function Rt(e,t){return e.reduce((e,t)=>e+t,t)}function Ft(e,t,a){return e<t?t:e>a?a:e}function Dt(e){const t={width:0,height:0};return e.forEach(({dimensions:e,sides:a})=>{a&At&&(t.width=e.width+e.x),a&xt&&(t.height=e.height+e.y)}),t}function Bt(e,t,a,s){const c=a.messages.map(e=>{const t=Nt(e);return t.width/t.height});const r=function(e){return e.map(e=>e>1.2?"w":e<.8?"n":"q").join("")}(c),o=function(e){return e.reduce((e,t)=>t+e,1)/e.length}(c),i=c.length,l=c.some(e=>e>2),d=function(e,t,a){return a<=n.db?a/100*69-(t?1.625:0)*at.d:((e?30:29)-(t?1.625:0))*at.d}(e,t,s);let b;const u={ratios:c,proportions:r,averageRatio:o,maxWidth:d,minWidth:100,maxHeight:d,spacing:2};return b=i>=5||l?function({ratios:e,averageRatio:t,maxWidth:a,minWidth:s,spacing:n,maxHeight:c=4*a/3}){const r=function(e,t){return e.map(e=>t>1.1?Ft(e,1,2.75):Ft(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=Rt(r.slice(e,e+t),0);return(a-(t-1)*n)/s})(s,e)),s+=e}),l.push({lineCounts:e,heights:t})};for(let e=1;e!==o;++e){const t=o-e;e<=3&&t<=3&&d([e,t])}for(let e=1;e!==o-1;++e)for(let a=1;a!==o-e;++a){const s=o-e-a;e<=3&&a<=(t<.85?4:3)&&s<=3&&d([e,a,s])}for(let e=1;e!==o-1;++e)for(let t=1;t!==o-e;++t)for(let a=1;a!==o-e-t;++a){const s=o-e-t-a;e<=3&&t<=3&&a<=3&&s<=4&&d([e,t,a,s])}let b,u=0;for(let e=0;e<l.length;e++){const{heights:t,lineCounts:a}=l[e],r=a.length,o=Rt(t,0)+n*(r-1),i=Math.min(...t)<s?1.5:1,d=(()=>{for(let e=1;e!==r;++e)if(a[e-1]>a[e])return 1.5;return 1})(),m=Math.abs(o-c)*i*d;(!b||m<u)&&(b=l[e],u=m)}const m=b.lineCounts,h=b.heights,O=m.length;let j=0,g=0;for(let e=0;e!==O;++e){const t=m[e],s=h[e],c=Math.round(s);let o=0;for(let l=0;l!==t;++l){const d=Tt|(0===e?Pt:Tt)|(e===O-1?xt:Tt)|(0===l?Lt:Tt)|(l===t-1?At:Tt),b=r[j],u=l===t-1?a-o:Math.round(b*s);i[j]={dimensions:{x:o,y:g,width:u,height:c},sides:d},o+=u+n,++j}g+=c+n}return i}(u):2===i?function(e){const{ratios:t,proportions:a,averageRatio:s}=e;return"ww"===a&&s>1.4&&t[1]-t[0]<.2?function(e){const{ratios:t,maxWidth:a,spacing:s,maxHeight:n}=e,c=Math.round(Math.min(a/t[0],Math.min(a/t[1],(n-s)/2)));return[{dimensions:{x:0,y:0,width:a,height:c},sides:Lt|Pt|At},{dimensions:{x:0,y:c+s,width:a,height:c},sides:Lt|xt|At}]}(e):"ww"===a||"qq"===a?function(e){const{ratios:t,maxWidth:a,spacing:s,maxHeight:n}=e,c=(a-s)/2,r=Math.round(Math.min(c/t[0],Math.min(c/t[1],n)));return[{dimensions:{x:0,y:0,width:c,height:r},sides:Pt|Lt|xt},{dimensions:{x:c+s,y:0,width:c,height:r},sides:Pt|At|xt}]}(e):function(e){const{ratios:t,minWidth:a,maxWidth:s,spacing:n,maxHeight:c}=e,r=Math.round(1.5*a),o=Math.min(Math.round(Math.max(.4*(s-n),(s-n)/t[0]/(1/t[0]+1/t[1]))),s-n-r),i=s-o-n,l=Math.min(c,Math.round(Math.min(i/t[0],o/t[1])));return[{dimensions:{x:0,y:0,width:i,height:l},sides:Pt|Lt|xt},{dimensions:{x:i+n,y:0,width:o,height:l},sides:Pt|At|xt}]}(e)}(u):3===i?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:a,ratios:s,maxWidth:n,minWidth:c}=e,r=t,o=Math.round(Math.min((t-a)/2,s[1]*(n-a)/(s[2]+s[1]))),i=r-o-a,l=Math.max(c,Math.round(Math.min((n-a)/2,Math.min(o*s[2],i*s[1])))),d=Math.min(Math.round(r*s[0]),n-a-l);return[{dimensions:{x:0,y:0,width:d,height:r},sides:Pt|Lt|xt},{dimensions:{x:d+a,y:0,width:l,height:i},sides:Pt|At},{dimensions:{x:d+a,y:i+a,width:l,height:o},sides:xt|At}]}(e):function(e){const{maxWidth:t,ratios:a,maxHeight:s,spacing:n}=e,c=t,r=Math.round(Math.min(c/a[0],.66*(s-n))),o=(t-n)/2,i=Math.min(s-r-n,Math.round(Math.min(o/a[1],o/a[2])));return[{dimensions:{x:0,y:0,width:c,height:r},sides:Lt|Pt|At},{dimensions:{x:0,y:r+n,width:o,height:i},sides:xt|Lt},{dimensions:{x:o+n,y:r+n,width:c-o-n,height:i},sides:xt|At}]}(e)}(u):function(e){const{proportions:t}=e;return"w"===t[0]?function({maxWidth:e,ratios:t,spacing:a,maxHeight:s,minWidth:n}){const c=e,r=Math.round(Math.min(c/t[0],.66*(s-a))),o=Math.round((e-2*a)/(t[1]+t[2]+t[3])),i=Math.max(n,Math.round(Math.min(.4*(e-2*a),o*t[1]))),l=Math.round(Math.max(Math.max(n,.33*(e-2*a)),o*t[3])),d=c-i-l-2*a,b=Math.min(s-r-a,o);return[{dimensions:{x:0,y:0,width:c,height:r},sides:Lt|Pt|At},{dimensions:{x:0,y:r+a,width:i,height:b},sides:xt|Lt},{dimensions:{x:i+a,y:r+a,width:d,height:b},sides:xt},{dimensions:{x:i+a+d+a,y:r+a,width:l,height:b},sides:At|xt}]}(e):function({maxHeight:e,ratios:t,maxWidth:a,spacing:s,minWidth:n}){const c=e,r=Math.round(Math.min(c*t[0],.6*(a-s))),o=Math.round((e-2*s)/(1/t[1]+1/t[2]+1/t[3])),i=Math.round(o/t[1]),l=Math.round(o/t[2]),d=c-i-l-2*s,b=Math.max(n,Math.min(a-r-s,o));return[{dimensions:{x:0,y:0,width:r,height:c},sides:Pt|Lt|xt},{dimensions:{x:r+s,y:0,width:b,height:i},sides:Pt|At},{dimensions:{x:r+s,y:i+s,width:b,height:l},sides:At},{dimensions:{x:r+s,y:i+l+2*s,width:b,height:d},sides:xt|At}]}(e)}(u),{layout:b,containerStyle:Dt(b)}}let Ht;function Ut(e){return Ht||(Ht=document.createElement("span"),Ht.style.font='400 12px "Roboto", -apple-system, "Apple Color Emoji", BlinkMacSystemFont, "Helvetica Neue", sans-serif',Ht.style.whiteSpace="nowrap",Ht.style.position="absolute",Ht.style.left="-999px",Ht.style.opacity=".01",document.body.appendChild(Ht)),Ht.innerHTML=e,Ht.offsetWidth}function qt(e,t,a,s,n){Object(c.o)(()=>{if(a&&e.current){const t=e.current.closest(".MessageList");Object(Ct.a)(t,e.current,n?"end":"centerOrTop",20,void 0===s?1500:1e3,s)}},[e,t,a,s,n])}var Gt=a(111),_t=a(67);var Vt=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(we.a)(Ce.a.Extra,"ContextMenuContainer",!t);return a?c.a.createElement(a,e):void 0});var $t=Object(c.h)(Object(s.h)((e,{message:t})=>{const a=t.senderId,{targetUserId:s,targetChatId:n}=t.content.action||{},c=t.replyToMessageId,r=c?Object(o.k)(e,t.chatId,c):void 0,i=Object(o.U)(e,t),{direction:l,noHighlight:d}=i&&e.focusedMessage||{},b=Object(o.f)(e,t.chatId);return{sender:b&&(Object(h.kb)(b)||a===t.chatId)?b:a?Object(o.Hb)(e,a):void 0,...s&&{targetUser:Object(o.Hb)(e,s)},targetChatId:n,targetMessage:r,isFocused:i,...i&&{focusDirection:l,noFocusHighlight:d}}})(({message:e,observeIntersection:t,isEmbedded:a,appearanceOrder:s=0,isLastInList:n,sender:r,targetUser:o,targetMessage:i,targetChatId:l,isFocused:d,focusDirection:b,noFocusHighlight:u})=>{const m=Object(c.q)(null);Object(It.c)(m,t),Object(Qe.a)(e.chatId,e.replyToMessageId,i),qt(m,e.chatId,d,b,u);const h=Object(ce.a)(),O=s<=0,[j,g]=Object(lt.a)(O);Object(c.n)(()=>{O||setTimeout(g,10*s)},[s,g,O]);const{transitionClassNames:f}=Object(ee.a)(j,void 0,O,!1),p=Object(_t.a)(h,e,r,o,i,l,a?{isEmbedded:!0,asPlain:!0}:void 0),{isContextMenuOpen:I,contextMenuPosition:v,handleBeforeContextMenu:y,handleContextMenu:C,handleContextMenuClose:w,handleContextMenuHide:E}=Object(Et.a)(m),M=void 0!==v;if(a)return c.a.createElement("span",{className:"embedded-action-message"},Object(st.a)(p));const S=Object(Z.a)("ActionMessage message-list-item",d&&!u&&"focused",M&&"has-menu-open",n&&"last-in-list",f);return c.a.createElement("div",{ref:m,id:"message"+e.id,className:S,"data-message-id":e.id,onMouseDown:y,onContextMenu:C},c.a.createElement("span",null,p),v&&c.a.createElement(Vt,{isOpen:I,anchor:v,message:e,messageListType:"thread",onClose:w,onCloseAnimationEnd:E}))}));a(217);var Wt=({className:e,message:t,sender:a,title:s,customText:n,observeIntersection:r,onClick:o})=>{const i=Object(c.q)(null),l=Object(It.b)(i,r),d=Object(nt.a)(t&&Object(h.E)(t,"pictogram"),!l),b=t&&"sticker-reply-thumb"+t.id,u=rt(t),m=Boolean(t&&Object(h.J)(t)),O=Object(ce.a)(),j=a&&Object(h.W)(O,a);return c.a.createElement("div",{ref:i,className:Object(Z.a)("EmbeddedMessage",e),onClick:t?o:void 0},u&&function(e,t,a,s){const{width:n,height:r}=Object(at.l)();return c.a.createElement("img",{id:e,src:a||t,width:n,height:r,alt:"",className:s?"round":""})}(b,u,d,m),c.a.createElement("div",{className:"message-text"},c.a.createElement("p",{dir:"auto"},t?Object(h.eb)(t)?c.a.createElement($t,{message:t,isEmbedded:!0}):Object(st.a)(Object(h.O)(O,t,Boolean(u))):n||" "),c.a.createElement("div",{className:"message-title",dir:"auto"},Object(st.a)(j||s||" "))))},zt=a(160),Kt=a(167),Qt=a(172);a(221);var Yt=Object(c.h)(({message:e,outgoingStatus:t,signature:a,onClick:s})=>{const n=Object(ce.a)();return c.a.createElement("span",{className:"MessageMeta",dir:n.isRtl?"rtl":"ltr",onClick:s},Boolean(e.views)&&c.a.createElement(c.a.Fragment,null,c.a.createElement("span",{className:"message-views"},Object(Je.b)(e.views)),c.a.createElement("i",{className:"icon-channelviews"})),a&&c.a.createElement("span",{className:"message-signature"},Object(st.a)(a)),c.a.createElement("span",{className:"message-time"},e.isEdited&&n("EditedMessage")+" ",Object(x.h)(1e3*e.date)),t&&c.a.createElement(Qt.a,{status:t}))}),Jt=a(113),Xt=a(115),Zt=a(161);a(222);var ea=({message:e,observeIntersection:t,observeIntersectionForPlaying:a,shouldLoop:s,lastSyncTime:r})=>{const o=Object(c.q)(null),[i,l,d]=Object(lt.a)(),b=e.content.sticker,{isAnimated:u,stickerSetId:m}=b,O=m===n.S,j=Object(It.b)(o,t),g=Object(It.b)(o,a),f=b.isPreloadedGlobally?"sticker"+b.id:Object(h.E)(e,"inline"),p=rt(e),I=Object(nt.a)(f,!j,Object(h.D)(e,"inline",!0),r),v=Boolean(I),[y,C]=Object(lt.a)(v),w=u?y:v,{shouldRenderFullMedia:E,transitionClassNames:M}=Object(Jt.a)(w,"slow"),{width:S,height:k}=Object(at.m)(b),N=Object(Z.a)("thumbnail",!p&&"empty"),T=Object(Z.a)("Sticker media-inner",O&&"inactive");return c.a.createElement("div",{ref:o,className:T,onClick:O?void 0:l},!w&&c.a.createElement("img",{id:"sticker-thumb-"+e.id,src:p,width:S,height:k,alt:"",className:N}),!u&&E&&c.a.createElement("img",{id:"sticker-"+e.id,src:I,width:S,height:k,alt:"",className:Object(Z.a)("full-media",M)}),u&&v&&c.a.createElement(Xt.a,{key:f,className:Object(Z.a)("full-media",M),id:f,animationData:I,size:S,play:g,noLoop:!s,onLoad:C}),c.a.createElement(Zt.a,{isOpen:i,fromSticker:b,onClose:d}))},ta=a(128),aa=a(119),sa=a(162);function na(e,t){return Object(sa.a)(Object(h.F)(e),Boolean(t),b.k&&!b.c)}var ca=a(38);var ra=async(e,t,a,s)=>s?"rgba(255,255,255,1)":async function(e,t){const a=new Image;a.src=e,a.width||await new Promise(e=>{a.onload=e});const s=document.createElement("canvas"),n=s.getContext("2d");s.width=a.width,s.height=a.height,n.drawImage(a,0,0,a.width,a.height);const c=t?a.width-1:0,r=a.height-1;return`rgba(${Array.from(n.getImageData(c,r,1,1).data).join(",")})`}(e,t);var oa=a(120);var ia=({id:e,message:t,observeIntersection:a,shouldAutoLoad:s,isInSelectMode:n,isSelected:r,uploadProgress:o,size:i="inline",dimensions:l,nonInteractive:d,shouldAffectAppendix:b,onClick:u,onCancelUpload:m})=>{const O=Object(c.q)(null),j=(Object(h.H)(t)||Object(h.S)(t)).blobUrl,g=Object(It.b)(O,a),[f,p]=Object(c.r)(s),I=f&&g,{mediaData:v,downloadProgress:y}=Object(aa.a)(Object(h.E)(t,i),!I),C=j||v,w=na(t,C),{isUploading:E,isTransferring:M,transferProgress:S}=Object(h.s)(t,o||y,I&&!C),k=!1===Object(ca.a)(f),{shouldRender:N,transitionClassNames:T}=Object(ee.a)(M,void 0,k,"slow"),{shouldRenderThumb:P,shouldRenderFullMedia:A,transitionClassNames:x}=Object(Jt.a)(C,"slow"),L=Object(c.m)(()=>{E?m&&m(t):C?u&&u(t.id):p(e=>!e)},[C,E,t,m,u]),R=Object(h.ub)(t);Object(c.o)(()=>{if(!b)return;const e=O.current.closest(".message-content");C?ra(C,R,0,r).then(t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute("data-has-custom-appendix","")}):e.classList.add("has-appendix-thumb")},[C,R,b,n,r]);const{width:F,height:D,isSmall:B}=l||Nt(t),H=Object(Z.a)("media-inner",!E&&!d&&"interactive",B&&"small-image",F===D&&"square-image"),U=l?`width: ${F}px; height: ${D}px; left: ${l.x}px; top: ${l.y}px;`:"";return c.a.createElement("div",{id:e,ref:O,className:H,style:U,onClick:E?void 0:L},P&&c.a.createElement("canvas",{ref:w,className:"thumbnail",style:`width: ${F}px; height: ${D}px`}),A&&c.a.createElement("img",{src:C,className:"full-media "+x,width:F,height:D,alt:""}),N&&c.a.createElement("div",{className:"media-loading "+T},c.a.createElement(oa.a,{progress:S,onClick:E?L:void 0})),!C&&!f&&c.a.createElement("i",{className:"icon-download"}),M&&c.a.createElement("span",{className:"message-upload-progress"},Math.round(100*S),"%"))},la=a(136),da=a(135);function ba(e,t){const a=Object(c.q)();a.current=t;const s=Object(c.m)(()=>{e.current&&e.current.pause()},[e]),n=Object(c.m)(()=>{e.current&&a.current&&Object(da.a)(e.current)},[e]);Object(X.a)(s,n)}var ua=a(146),ma=(e,t=!1)=>{const a=Object(c.q)(!1),s=Object(c.q)(!1),n=Object(c.m)(()=>{s.current=!0,t&&e.current&&(a.current||(a.current=!e.current.paused),e.current.pause())},[t,e]),r=Object(c.m)(()=>{t&&e.current&&a.current&&document.body.contains(e.current)&&Object(da.a)(e.current),a.current=!1,s.current=!1},[t,e]),o=Object(c.m)(()=>{Object(g.b)(r)},[r]);document.hasFocus()||n(),Object(te.a)(n,o)};function ha(){return(ha=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 Oa=({id:e,message:t,observeIntersection:a,shouldAutoLoad:s,shouldAutoPlay:n,uploadProgress:r,lastSyncTime:o,dimensions:i,onClick:l,onCancelUpload:d})=>{const b=Object(c.q)(null),u=Object(c.q)(null),m=t.content.video,O=m.blobUrl,j=Boolean(O)||Object(h.b)(m),g=Object(It.b)(b,a),[f,p]=Object(c.r)(s),I=Boolean(f&&g&&o),[v,y]=Object(c.r)(n),C=Object(nt.a)(Object(h.E)(t,"pictogram"),!(g&&o),Object(h.D)(t,"pictogram"),o),w=na(t),{mediaData:E,downloadProgress:M}=Object(aa.a)(Object(h.E)(t,"inline"),!I,Object(h.D)(t,"inline"),o),S=O||E,k=Boolean(j&&g&&S),{isBuffered:N,bufferingHandlers:T}=Object(la.a)(!s),{isUploading:P,isTransferring:A,transferProgress:L}=Object(h.s)(t,r||M,I&&j&&!N),R=!1===Object(ca.a)(f),{shouldRender:F,transitionClassNames:D}=Object(ee.a)(A,void 0,R),{shouldRenderThumb:B,transitionClassNames:H}=Object(Jt.a)(S,"slow"),[U,q]=Object(c.r)(0),G=Object(c.m)(e=>{q(Math.max(0,e.currentTarget.currentTime-1))},[]),_=Object(h.ub)(t),V=Object(h.rb)(t),{width:$,height:W}=i||Object(at.i)(m,_,V);ba(u,Boolean(k&&n)),ma(u,v),Object(ua.a)(u,[k]);const z=Object(c.m)(()=>{P?d&&d(t):j&&!S?p(e=>!e):j&&S&&!v?(y(!0),u.current.play()):l&&l(t.id)},[P,j,S,v,l,d,t]),K=Object(Z.a)("media-inner dark",!P&&"interactive"),Q=Object(Z.a)("full-media",H),Y=i?`width: ${$}px; height: ${W}px; left: ${i.x}px; top: ${i.y}px;`:"",J=k,X=!j&&E,te=!j||f&&!v&&!F,ae=j&&!f;return c.a.createElement("div",{ref:b,id:e,className:K,style:Y,onClick:P?void 0:z},(!k||B)&&c.a.createElement("canvas",{ref:w,className:"thumbnail",style:`width: ${$}px; height: ${W}px;`}),C&&c.a.createElement("img",{src:C,className:"thumbnail",style:`width: ${$}px; height: ${W}px;`,alt:""}),J&&c.a.createElement("video",ha({ref:u,className:Q,width:$,height:W,autoPlay:v,muted:!0,loop:!0,playsInline:!0},T,{onTimeUpdate:G}),c.a.createElement("source",{src:S})),X&&c.a.createElement("img",{src:E,className:"full-media "+H,width:$,height:W,alt:""}),te&&c.a.createElement("i",{className:"icon-large-play"}),F&&c.a.createElement("div",{className:"media-loading "+D},c.a.createElement(oa.a,{progress:L,onClick:P?z:void 0})),ae&&c.a.createElement("i",{className:"icon-download"}),A&&!j?c.a.createElement("span",{className:"message-upload-progress"},Math.round(100*L),"%"):A&&j?c.a.createElement("span",{className:"message-upload-progress"},"..."):c.a.createElement("div",{className:"message-media-duration"},m.isGif?"GIF":Object(x.e)(m.duration-U)))},ja=a(18);a(224);var ga=Object(s.h)((e,{contact:t})=>({user:Object(o.Hb)(e,t.userId)}),(e,t)=>Object(d.l)(t,["openUserInfo"]))(({contact:e,user:t,openUserInfo:a})=>{const{firstName:s,lastName:n,phoneNumber:r,userId:o}=e,i=Object(c.m)(()=>{a({id:o})},[a,o]);return c.a.createElement("div",{className:Object(Z.a)("Contact",Boolean(o)&&"interactive"),onClick:o?i:void 0},c.a.createElement(Gt.a,{size:"large",user:t,text:s||n}),c.a.createElement("div",{className:"contact-info"},c.a.createElement("div",{className:"contact-name"},s," ",n),c.a.createElement("div",{className:"contact-phone"},Object(ja.c)(r))))}),fa=a(46);var pa=Object(c.h)(({id:e,options:t,selected:a=[],disabled:s,round:n,loadingOptions:r,onChange:o})=>{const[i,l]=Object(c.r)([]),d=Object(c.m)(e=>{const{value:t,checked:a}=e.currentTarget;let s;s=a?[...i,t]:i.filter(e=>e!==t),l(s),o(s)},[o,i]);return c.a.createElement("div",{id:e,className:"radio-group"},t.map(e=>c.a.createElement(fa.a,{label:e.label,subLabel:e.subLabel,value:e.value,checked:-1!==a.indexOf(e.value),disabled:s,round:n,isLoading:r?-1!==r.indexOf(e.value):void 0,onChange:d})))}),Ia=a(125),va=a(180);a(227);function ya(e,t){return t>0?(e/t*100).toFixed():0}var Ca=({answer:e,voteResults:t,totalVoters:a,maxVotersCount:s,correctResults:n,shouldAnimate:r})=>{const o=t&&t.find(t=>t.option===e.option),i=0===n.length||-1!==n.indexOf(e.option),l=n.length>0&&i||o&&o.isChosen,d=o?ya(o.votersCount,a||0):0,[b,u]=Object(c.r)(r?0:d),m=Object(c.q)(null),h=o?ya(o.votersCount,s||0):0,O=b<d;if(Object(c.n)(()=>{r&&u(d)},[r,d]),Object(c.n)(()=>{const e=m.current;if(e&&r){const t=e.firstElementChild,a=O?"":"stroke-dasharray: 100% 200%; stroke-dashoffset: -44";t?t.setAttribute("style",a):e.innerHTML=`\n <svg class="poll-line" xmlns="http://www.w3.org/2000/svg" style="${a}">\n <path d="M4.47 5.33v13.6a9 9 0 009 9h13"/>\n </svg>`}},[O,r]),!t||!o)return;const j=`width: ${h}%; transform:scaleX(${O?0:1})`;return c.a.createElement("div",{className:"PollOption",dir:"ltr"},c.a.createElement("div",{className:"poll-option-share "+("100"===d?"limit-width":"")},d,"%",l&&c.a.createElement("span",{className:Object(Z.a)("poll-option-chosen",!i&&"wrong",r&&"animate")},c.a.createElement("i",{className:i?"icon-check":"icon-close"}))),c.a.createElement("div",{className:"poll-option-right"},c.a.createElement("div",{className:"poll-option-text",dir:"auto"},Object(st.a)(e.text)),c.a.createElement("div",{className:Object(Z.a)("poll-option-answer",l&&!i&&"wrong")},c.a.createElement("div",{className:"poll-option-corner",ref:m}),c.a.createElement("div",{className:"poll-option-line",style:j}))))};a(228);var wa=Object(c.h)(Object(s.h)((e,{poll:t})=>{const{recentVoterIds:a}=t.results,{serverTimeOffset:s,users:{byId:n}}=e;return a&&0!==a.length?{recentVoterIds:a,usersById:n,serverTimeOffset:s}:{}},(e,t)=>Object(d.l)(t,["loadMessage","openPollResults"]))(({message:e,poll:t,recentVoterIds:a,usersById:s,loadMessage:n,onSendVote:r,openPollResults:o,serverTimeOffset:i})=>{const{id:l,chatId:d}=e,{summary:b,results:u}=t,[m,h]=Object(c.r)(!1),[O,j]=Object(c.r)([]),[g,f]=Object(c.r)(!1),[p,I]=Object(c.r)(!1),[v,y]=Object(c.r)(!b.closed&&b.closeDate&&b.closeDate>0?Math.min(b.closeDate-Math.floor(Date.now()/1e3)+i,b.closePeriod):0),C=Object(c.q)(null),{results:w,totalVoters:E}=u,M=w&&w.some(e=>e.isChosen),S=!b.closed&&!M,k=!S&&b.isPublic&&Number(u.totalVoters)>0,N=S&&b.multipleChoice,T=w?Math.max(...w.map(e=>e.votersCount)):E,P=w?w.reduce((e,t)=>(t.isCorrect&&e.push(t.option),e),[]):[],A=b.answers.map(e=>({label:e.text,value:e.option,hidden:Boolean(b.quiz&&b.closePeriod&&v<=0)}));Object(c.n)(()=>{m&&t.results.results&&t.results.results.some(e=>e.isChosen)&&h(!1)},[m,t.results.results]),Object(c.n)(()=>{v>0&&setTimeout(()=>y(v-1),1e3);const e=C.current;if(e){const t=12*Math.PI,a=e.lastElementChild,s=e.firstElementChild;if(v<=5&&e.classList.add("hurry-up"),a&&s){const e=(b.closePeriod-v)/b.closePeriod*t;s.textContent=Object(x.e)(v),a.firstElementChild.setAttribute("stroke-dashoffset","-"+e)}else e.innerHTML=`\n <span>${Object(x.e)(v)}</span>\n <svg width="16px" height="16px">\n <circle cx="8" cy="8" r="6" class="poll-countdown-progress" transform="rotate(-90, 8, 8)"\n stroke-dasharray="${t} ${t}"\n stroke-dashoffset="0"\n />\n </svg>`}},[v,b.closePeriod]),Object(c.n)(()=>{b.quiz&&(v<=0||M&&!b.closed)&&n({chatId:d,messageId:l})},[d,v,M,n,l,b.closed,b.quiz]),Object(c.n)(()=>{let e;return b.quiz&&!b.closed&&b.closePeriod&&b.closePeriod>0&&(e=window.setTimeout(()=>{n({chatId:d,messageId:l})},1e3*b.closePeriod)),()=>{e&&window.clearTimeout(e)}},[S,d,n,l,b.closePeriod,b.closed,b.quiz]);const L=Object(c.p)(()=>a?a.reduce((e,t)=>{const a=s[t];return a&&e.push(a),e},[]):[],[s,a]),R=Object(c.m)(e=>{j([e]),h(!0),I(!0),r([e])},[r]),F=Object(c.m)(e=>{j(e)},[]),D=Object(c.m)(()=>{h(!0),I(!0),r(O)},[r,O]),B=Object(c.m)(()=>{o({chatId:d,messageId:l})},[d,l,o]),H=Object(c.m)(()=>{f(!0)},[]),U=Object(c.m)(()=>{f(!1),I(!1)},[]);Object(c.n)(()=>{if(p&&M&&b.quiz&&u.results&&t.results.solution){u.results.find(e=>e.isChosen&&e.isCorrect)||f(!0)}},[M,p,u.results,b.quiz,t.results.solution]);const q=Object(ce.a)();return c.a.createElement("div",{className:"Poll",dir:q.isRtl?"auto":"ltr"},g&&t.results.solution&&c.a.createElement(va.a,{message:Object(Mt.b)(t.results.solution,t.results.solutionEntities),duration:5e3,onDismiss:U,containerId:"#middle-column-portals"}),c.a.createElement("div",{className:"poll-question"},Object(st.a)(b.question)),c.a.createElement("div",{className:"poll-type"},q(function(e){if(void 0===e.isPublic)return" ";if(e.quiz)return e.isPublic?"QuizPoll":"AnonymousQuizPoll";if(e.closed)return"FinalResults";return e.isPublic?"PublicPoll":"AnonymousPoll"}(b)),L.length>0&&c.a.createElement("div",{className:"poll-recent-voters"},L.map(e=>c.a.createElement(Gt.a,{size:"micro",user:e}))),v>0&&S&&c.a.createElement("div",{ref:C,className:"poll-countdown"}),b.quiz&&t.results.solution&&!S&&c.a.createElement(ie.a,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:g,onClick:H,ariaLabel:"Show Solution"},c.a.createElement("i",{className:"icon-lamp"}))),S&&c.a.createElement("div",{className:"poll-answers"},N?c.a.createElement(pa,{options:A,onChange:F,disabled:e.isScheduled||m,loadingOptions:m?O:void 0,round:!0}):c.a.createElement(Ia.a,{name:"poll-"+l,options:A,onChange:R,disabled:e.isScheduled||m,loadingOption:m?O[0]:void 0})),!S&&c.a.createElement("div",{className:"poll-results"},b.answers.map((function(e){return c.a.createElement(Ca,{key:e.option,shouldAnimate:p,answer:e,voteResults:w,totalVoters:E,maxVotersCount:T,correctResults:P})}))),!k&&!N&&c.a.createElement("div",{className:"poll-voters-count"},function(e,t,a){if(!a)return e(t?"Chat.Quiz.TotalVotesEmpty":"Chat.Poll.TotalVotesResultEmpty");return e(t?"Answer":"Vote",a,"i")}(q,b.quiz,u.totalVoters)),N&&c.a.createElement(ie.a,{isText:!0,disabled:0===O.length,size:"tiny",onClick:D},q("PollSubmitVotes")),k&&c.a.createElement(ie.a,{isText:!0,size:"tiny",onClick:B},q("PollViewResults")))})),Ea=a(39),Ma=a(57);a(229);var Sa=Object(c.h)(({message:e,observeIntersection:t,shouldAutoLoad:a,inPreview:s,onMediaClick:n,onCancelMediaTransfer:r})=>{const o=Object(h.R)(e);let i=!1;if(o&&o.photo){const{width:t,height:a}=Nt(e);i=t===a}const l=Object(c.m)(()=>{n()},[n]);if(!o)return;const{siteName:d,url:b,displayUrl:u,title:m,description:O,photo:j}=o,g=j&&n&&!i&&!o.hasDocument,f=Object(Ea.a)(O,170),p=Object(Z.a)("WebPage",j?i&&"with-square-photo":!s&&"without-photo");return c.a.createElement("div",{className:p,"data-initial":(d||u)[0],dir:"auto"},j&&c.a.createElement(ia,{message:e,observeIntersection:t,shouldAutoLoad:a,size:i?"pictogram":"inline",nonInteractive:!g,onClick:g?l:void 0,onCancelUpload:r}),c.a.createElement("div",{className:"WebPage-text"},c.a.createElement(Ma.a,{className:"site-name",url:b,text:d||u}),!s&&m&&c.a.createElement("p",{className:"site-title"},Object(st.a)(m)),f&&c.a.createElement("p",{className:"site-description"},Object(st.a)(f,["emoji","br"]))))});a(230);var ka=Object(c.h)(({message:e})=>{const t=Object(h.A)(e),{title:a,text:s,description:n,photoUrl:r}=t;return c.a.createElement("div",{className:"Invoice"},a&&c.a.createElement("p",{className:"title"},Object(st.a)(a)),s&&c.a.createElement("p",null,Object(st.a)(s,["emoji","br"])),c.a.createElement("div",{className:"description "+(r?"has-image":"")},r&&c.a.createElement("img",{className:"invoice-image",src:r,alt:""}),n&&c.a.createElement("p",{className:"description-text"},Object(st.a)(n,["emoji","br"]))))});function Na(e){return Object(c.h)(Object(s.h)((e,t)=>{const{message:a}=t;return{isInSelectMode:Object(o.S)(e),isSelected:Object(o.V)(e,a.id)}},(e,t)=>Object(d.l)(t,["toggleMessageSelection"]))(t=>{const{isInSelectMode:a,isSelected:s,message:n,toggleMessageSelection:r,dimensions:o}=t,i=Object(c.m)(e=>{e.stopPropagation(),r({messageId:n.id,withShift:e&&e.shiftKey})},[r,n]),l=Object(c.p)(()=>({...t,isInSelectMode:a,isSelected:s,dimensions:{...t.dimensions,x:0,y:0},onClick:a?void 0:t.onClick}),[t,a,s]);return c.a.createElement("div",{className:Object(Z.a)("album-item-select-wrapper",s&&"is-selected"),style:o?`left: ${o.x}px; top: ${o.y}px;`:"",onClick:a?i:void 0},a&&c.a.createElement("div",{className:"message-select-control"},s&&c.a.createElement("i",{className:"icon-select"})),c.a.createElement(e,l))}))}a(231);const Ta=Na(ia),Pa=Na(Oa);var Aa=Object(s.h)(e=>({uploadsById:e.fileUploads.byMessageLocalId}),(e,t)=>Object(d.l)(t,["cancelSendingMessage"]))(({album:e,observeIntersection:t,shouldAutoLoad:a,shouldAutoPlay:s,hasCustomAppendix:n,lastSyncTime:r,isOwn:o,albumLayout:i,onMediaClick:l,uploadsById:d,cancelSendingMessage:b})=>{const u=e.messages.length,m=Object(c.m)(e=>{b({chatId:e.chatId,messageId:e.id})},[b]);const{width:O,height:j}=i.containerStyle;return c.a.createElement("div",{className:"Album",style:`width: ${O}px; height: ${j}px;`},e.messages.map((function(e,b){const{photo:O,video:j}=Object(h.w)(e),g=d[e.previousLocalId||e.id],f=g?g.progress:void 0,{dimensions:p,sides:I}=i.layout[b];if(O){const s=n&&(o?b===u-1:Boolean(I&Lt&&I&xt));return c.a.createElement(Ta,{id:"album-media-"+e.id,message:e,observeIntersection:t,shouldAutoLoad:a,shouldAffectAppendix:s,uploadProgress:f,dimensions:p,onClick:l,onCancelUpload:m})}if(j)return c.a.createElement(Pa,{id:"album-media-"+e.id,message:e,observeIntersection:t,shouldAutoLoad:a,shouldAutoPlay:s,uploadProgress:f,lastSyncTime:r,dimensions:p,onClick:l,onCancelUpload:m})})))});a(232);function xa(){return(xa=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 La;var Ra=({message:e,observeIntersection:t,shouldAutoLoad:a,shouldAutoPlay:s,lastSyncTime:n})=>{const r=Object(c.q)(null),o=Object(c.q)(null),i=Object(c.q)(null),l=e.content.video,d=Object(It.b)(r,t),[b,u]=Object(c.r)(a&&s),m=Boolean(b&&d&&n),{mediaData:O,downloadProgress:j}=Object(aa.a)(Object(h.E)(e,"inline"),!m,Object(h.D)(e,"inline"),n),g=na(e,O),{isBuffered:f,bufferingHandlers:p}=Object(la.a)(),I=b&&!f,v=!1===Object(ca.a)(b),{shouldRender:y,transitionClassNames:C}=Object(ee.a)(I||!f,void 0,v),{shouldRenderThumb:w,transitionClassNames:E}=Object(Jt.a)(O,"slow"),[M,S]=Object(c.r)(!1),[k,N]=Object(c.r)(0);Object(c.n)(()=>{if(!M)return;const e=188*Math.PI,t=e-k*e,a=i.current,s=o.current,n=s.firstElementChild;n?n.firstElementChild.setAttribute("stroke-dashoffset",t.toString()):s.innerHTML=`<svg width="200px" height="200px">\n <circle cx="100" cy="100" r="94" class="progress-circle" transform="rotate(-90, 100, 100)"\n stroke-dasharray="${e} ${e}"\n stroke-dashoffset="${e}"\n />\n </svg>`,N(a.currentTime/a.duration)},[M,k]);const T=Boolean(O&&d),P=()=>{S(!1),N(0),Object(da.a)(i.current),requestAnimationFrame(()=>{o.current.innerHTML=""})},A=(L=P,()=>{La&&La(),La=L});var L;Object(c.n)(()=>{i.current&&(T?Object(da.a)(i.current):i.current.pause())},[T]),ba(i,T),ma(i,Boolean(O)),Object(ua.a)(i,[O]);const R=Object(c.m)(()=>{if(!O)return void u(e=>!e);const e=i.current;M?e.paused?Object(da.a)(e):e.pause():(A(),e.currentTime=0,S(!0))},[A,M,O]),F=Object(c.m)(e=>{const t=e.currentTarget;N(t.currentTime/t.duration)},[]),D=Object(Z.a)("full-media",E);return c.a.createElement("div",{ref:r,className:"RoundVideo media-inner",onClick:R},w&&c.a.createElement("div",{className:"thumbnail-wrapper"},c.a.createElement("canvas",{ref:g,className:"thumbnail",style:`width: ${at.e}px; height: ${at.e}px`})),O&&c.a.createElement("div",{className:"video-wrapper"},c.a.createElement("video",xa({ref:i,className:D,width:at.e,height:at.e,autoPlay:!0,muted:!M,loop:!M,playsInline:!0,onEnded:M?P:void 0},p,{onTimeUpdate:M?F:void 0}),c.a.createElement("source",{src:O}))),c.a.createElement("div",{className:"progress",ref:o}),y&&c.a.createElement("div",{className:"media-loading "+C},c.a.createElement(oa.a,{progress:j})),!O&&!b&&c.a.createElement("i",{className:"icon-large-play"}),c.a.createElement("div",{className:"message-media-duration"},M?Object(x.e)(i.current.currentTime):Object(x.e)(l.duration),(!M||i.current.paused)&&c.a.createElement("i",{className:"icon-muted-chat"})))};a(233);var Fa=({message:e,onClick:t})=>c.a.createElement("div",{className:"InlineButtons"},e.inlineButtons.map(e=>c.a.createElement("div",{className:"row"},e.map(e=>c.a.createElement(ie.a,{size:"tiny",ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>t({button:e})},e.text,"url"===e.type&&!e.value.match(n.jb)&&c.a.createElement("i",{className:"icon-arrow-right"}))))));a(234);var Da=Object(c.h)(Object(s.h)((e,{message:t})=>{const{threadId:a,chatId:s}=t.threadInfo,n=Object(o.Db)(e,s,a)||t.threadInfo,{byId:c}=e.users,{byId:r}=e.chats;return{threadInfo:n,usersById:c,chatsById:r}},(e,t)=>Object(d.l)(t,["openChat"]))(({disabled:e,threadInfo:t,usersById:a,chatsById:s,openChat:n})=>{const r=Object(ce.a)(),{threadId:o,chatId:i,messagesCount:l,lastMessageId:d,lastReadInboxMessageId:b,recentReplierIds:u}=t,m=Object(c.m)(()=>{n({id:i,threadId:o})},[n,i,o]);if(void 0===l)return;const O=u&&u.map(e=>Object(h.mb)(e)?a[e]:s[e]).filter(Boolean);const j=Boolean(b&&d&&b<d);return c.a.createElement("div",{"data-cnt":Object(Je.b)(l),className:Object(Z.a)("CommentButton",j&&"has-unread",e&&"disabled"),dir:r.isRtl?"rtl":"ltr",onClick:m},c.a.createElement("i",{className:"icon-comments-sticker"}),(!O||0===O.length)&&c.a.createElement("i",{className:"icon-comments"}),O&&O.length>0&&c.a.createElement("div",{className:"recent-repliers",dir:r.isRtl?"rtl":"ltr"},O.map(e=>c.a.createElement(Gt.a,{key:e.id,size:"small",user:Object(h.mb)(e.id)?e:void 0,chat:Object(h.mb)(e.id)?void 0:e}))),c.a.createElement("div",{className:"label",dir:"auto"},l?r("Comments",l,"i"):r("LeaveAComment")),c.a.createElement("i",{className:"icon-next"}))}));a(235);function Ba(e){const t=Ua(e.currentTarget);t&&t.setAttribute("data-is-document-group-hover","")}function Ha(e){const t=Ua(e.currentTarget);t&&t.removeAttribute("data-is-document-group-hover")}function Ua(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var qa=Object(c.h)(Object(s.h)((e,t)=>{const{focusedMessage:a,forwardMessages:s,lastSyncTime:n}=e,{message:c,album:r,withSenderName:i,withAvatar:l,threadId:d,messageListType:b}=t,{id:u,chatId:m,viaBotId:O,replyToMessageId:j,isOutgoing:g}=c,f=Object(o.f)(e,m),p=Object(o.P)(e,m),I=f&&Object(h.kb)(f),v=!p&&Object(h.fb)(c),y=i||l||v?Object(o.tb)(e,c):void 0,C=Object(o.K)(e,c),w=O?Object(o.Hb)(e,O):void 0,E=d?Object(o.Fb)(e,m,d):void 0,M=c.id===E,S=j===E,k=j&&!S?Object(o.k)(e,m,j):void 0,N=k&&Object(o.tb)(e,k),T=Object(o.Gb)(e,c),P="thread"===b&&(r?r.messages.some(t=>Object(o.U)(e,t)):Object(o.U)(e,c)),{direction:A,noHighlight:x}=P&&a||{},L=s.messageIds&&s.messageIds.includes(u),{query:R}=Object(o.A)(e)||{},F=Object(h.M)(c);let D;return D=r&&r.messages?r.messages.every(({id:t})=>Object(o.V)(e,t)):Object(o.V)(e,u),{theme:Object(o.Bb)(e),forceSenderName:v,sender:y,originSender:C,botSender:w,shouldHideReply:S,isThreadTop:M,replyMessage:k,replyMessageSender:N,...g&&{outgoingStatus:Object(o.fb)(e,c,"scheduled"===b)},..."number"==typeof T&&{uploadProgress:T},isFocused:P,...P&&{focusDirection:A,noFocusHighlight:x},isForwarding:L,isChatWithSelf:p,isChannel:I,lastSyncTime:n,highlight:R,isSingleEmoji:Boolean(F),animatedEmoji:F?Object(o.c)(e,F):void 0,isInSelectMode:Object(o.S)(e),isSelected:D,isGroupSelected:!!c.groupedId&&!c.isInAlbum&&Object(o.Q)(e,m,c.groupedId),threadId:d,isPinnedList:"pinned"===b,shouldAutoLoadMedia:f?Object(o.ub)(e,c,f,y):void 0,shouldAutoPlayMedia:Object(o.vb)(e,c),shouldLoopStickers:Object(o.wb)(e)}},(e,t)=>Object(d.l)(t,["focusMessage","openMediaViewer","openAudioPlayer","cancelSendingMessage","openUserInfo","openChat","markMessagesRead","sendPollVote","toggleMessageSelection","setReplyingToId","openForwardMenu","clickInlineButton","disableContextMenuHint"]))(({message:e,observeIntersectionForBottom:t,observeIntersectionForMedia:a,observeIntersectionForAnimatedStickers:s,album:n,withAvatar:r,withSenderName:o,noComments:d,appearanceOrder:u,isFirstInGroup:m,isLastInGroup:O,isFirstInDocumentGroup:j,isLastInDocumentGroup:g,isLastInList:f,theme:p,forceSenderName:I,sender:v,originSender:y,botSender:C,isThreadTop:w,shouldHideReply:E,replyMessage:M,replyMessageSender:S,outgoingStatus:k,uploadProgress:N,isFocused:T,focusDirection:P,noFocusHighlight:A,isForwarding:x,isChatWithSelf:L,isChannel:R,lastSyncTime:F,highlight:D,animatedEmoji:B,isInSelectMode:H,isSelected:U,isGroupSelected:q,threadId:G,messageListType:_,isPinnedList:V,shouldAutoLoadMedia:$,shouldAutoPlayMedia:W,shouldLoopStickers:z,focusMessage:K,openMediaViewer:Q,openAudioPlayer:Y,openUserInfo:J,openChat:X,cancelSendingMessage:te,markMessagesRead:ae,sendPollVote:se,toggleMessageSelection:ne,setReplyingToId:re,openForwardMenu:oe,clickInlineButton:le,disableContextMenuHint:de})=>{const be=Object(c.q)(null),ue=Object(c.q)(null),me=Object(c.q)(null);Object(It.c)(ue,t);const{width:he}=$e(),{isContextMenuOpen:Oe,contextMenuPosition:je,handleBeforeContextMenu:ge,handleContextMenu:fe,handleContextMenuClose:pe,handleContextMenuHide:Ie}=Object(Et.a)(be,!1,!0);Object(c.n)(()=>{Oe&&de()},[Oe,de]);const ve=u<=0,[ye,Ce]=Object(lt.a)(ve);Object(c.n)(()=>{ve||setTimeout(Ce,10*u)},[u,Ce,ve]);const{transitionClassNames:we}=Object(ee.a)(ye,void 0,ve,!1),{chatId:Ee,id:Me,threadInfo:Se}=e,ke=Object(h.ub)(e),Ne="scheduled"===_||e.isScheduled,Te=Object(h.vb)(e)&&!E,Pe=Boolean(Se)&&"thread"===_,{forwardInfo:Ae,viaBotId:xe}=e,Le=Ae&&!L&&!Ae.isLinkedChannelPost,Re=!!e.groupedId&&!e.isInAlbum,Fe=Boolean(n)&&n.messages.length>1,{text:De,photo:Be,video:He,audio:Ue,voice:qe,document:Ge,sticker:_e,contact:Ve,poll:We,webPage:ze,invoice:Ke}=Object(h.w)(e),Ye=Object(h.y)(e),Je=Object(Mt.a)(e,D,St(Ye)),Xe=void 0!==je,Ze=Object(Z.a)("Message message-list-item",m&&"first-in-group",O&&"last-in-group",j&&"first-in-document-group",g&&"last-in-document-group",f&&"last-in-list",ke&&"own",Boolean(e.views)&&"has-views",e.isEdited&&"was-edited",Te&&"has-reply",Xe&&"has-menu-open",T&&!A&&"focused",x&&"is-forwarding",e.isDeleting&&"is-deleting",Re&&"is-in-document-group",Fe&&"is-album",e.hasUnreadMention&&"has-unread-mention",U&&"is-selected",H&&"is-in-selection-mode",w&&"is-thread-top",Boolean(e.inlineButtons)&&"has-inline-buttons",we),et=function(e,{hasReply:t,customShape:a,isLastInGroup:s,asForwarded:n,hasThread:c,forceSenderName:r,hasComments:o}={}){const{text:i,photo:l,video:d,audio:b,voice:u,document:m,poll:O,webPage:j,contact:g}=Object(h.w)(e),f=["message-content"],p=(l||d)&&!i,I=Boolean(e.viaBotId);return St(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"):m?f.push("document"):g?f.push("contact"):O?f.push("poll"):j&&(f.push("web-page"),j.photo&&f.push("media")),n&&!a&&f.push("is-forwarded"),t&&f.push("is-reply"),c&&f.push("has-replies"),I&&f.push("is-via-bot"),r&&f.push("force-sender-name"),a||(f.push("has-shadow"),(t||n||!p||I||r)&&f.push("has-solid-background"),!s||!l&&p||f.push("has-appendix")),f.join(" ")}(e,{hasReply:Te,customShape:Ye,isLastInGroup:O,asForwarded:Le,hasThread:Pe,forceSenderName:I,hasComments:e.threadInfo&&e.threadInfo.messagesCount>0}),tt=!Ae||!L&&v?v:y,nt=Ae?y:v,ct=R&&e.adminTitle||Ae&&!Le&&Ae.adminTitle||void 0,rt=e.threadInfo&&(!Re||g)&&"thread"===_&&!d,ot=et.includes("has-appendix");Object(Qe.a)(Ee,Te?e.replyToMessageId:void 0,M,e.id),qt(be,Ee,T,P,A),Object(c.o)(()=>{me.current&&(me.current.innerHTML=ke?'<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>')},[ke,ot]);const it=Object(c.m)(t=>{t.stopPropagation(),ne({messageId:Me,groupedId:e.groupedId})},[Me,e.groupedId,ne]),dt=Object(c.m)(e=>{const t=Fe&&n&&n.messages?{messageId:Me,childMessageIds:n.messages.map(({id:e})=>e),withShift:e&&e.shiftKey}:{messageId:Me,withShift:e&&e.shiftKey};ne(t)},[ne,Me,Fe,n]),bt=Object(c.m)(()=>{re({messageId:Me})},[re,Me]),ut=Object(c.m)(e=>{e.stopPropagation()},[]),mt=Object(c.m)(()=>{tt&&(Object(h.mb)(tt.id)?J({id:tt.id}):X({id:tt.id}))},[tt,J,X]),ht=Object(c.m)(()=>{nt&&(Object(h.mb)(nt.id)?J({id:nt.id}):X({id:nt.id}))},[nt,J,X]),Ot=Object(c.m)(()=>{C&&J({id:C.id})},[C,J]),jt=Object(c.m)(()=>{K({chatId:Ee,threadId:G,messageId:e.replyToMessageId})},[K,Ee,G,e.replyToMessageId]),gt=Object(c.m)(()=>{Q({chatId:Ee,threadId:G,messageId:Me,origin:Ne?l.h.ScheduledInline:l.h.Inline})},[Ee,G,Me,Q,Ne]),ft=Object(c.m)(()=>{Y({chatId:Ee,messageId:Me})},[Ee,Me,Y]),pt=Object(c.m)(e=>{Q({chatId:Ee,threadId:G,messageId:e,origin:Ne?l.h.ScheduledAlbum:l.h.Album})},[Ee,G,Q,Ne]),vt=Object(c.m)(e=>{const t=e.target;(t.classList.contains("text-content")||t.classList.contains("Message"))&&fe(e)},[fe]),yt=Object(c.m)(()=>{ae({messageIds:[Me]})},[Me,ae]),Ct=Object(c.m)(()=>{te({chatId:Ee,messageId:Me})},[te,Ee,Me]),wt=Object(c.m)(e=>{se({chatId:Ee,messageId:Me,options:e})},[Ee,Me,se]),Tt=Object(c.m)(()=>{oe({fromChatId:Ee,groupedId:e.groupedId})},[oe,Ee,e.groupedId]),Pt=Object(c.m)(()=>{if(n&&n.messages){const e=n.messages.map(({id:e})=>e);oe({fromChatId:Ee,messageIds:e})}else oe({fromChatId:Ee,messageIds:[Me]})},[n,oe,Ee,Me]),At=Object(c.m)(()=>{K({chatId:Ee,threadId:i.MAIN_THREAD_ID,messageId:Me})},[K,Ee,Me]),xt=Object(c.m)(()=>{K(Re?{chatId:Ae.fromChatId,groupedId:e.groupedId,groupedChatId:Ee}:{chatId:Ae.fromChatId,messageId:Ae.fromMessageId})},[K,Ae,e,Ee,Re]),Lt=Object(ce.a)();let Rt,Ft="",Dt=!1;const Ht=Object(c.p)(()=>Fe?Bt(ke,Boolean(Le),n,he):void 0,[Fe,he,ke,Le,n]),_t=Le?28:0;if(Fe||!Be&&!He)Ht&&(Rt=Math.max(kt(Boolean(De),rt),Ht.containerStyle.width),Rt-Ht.containerStyle.width>18&&(Dt=!0));else{let t;Be?t=Nt(e).width:He&&(t=He.isRound?at.e:Nt(e).width),t&&(Rt=Math.max(kt(Boolean(De),rt),t),Rt-t>18&&(Dt=!0))}Rt&&(Ft=`width: ${Rt+_t}px`);const $t=Object(c.p)(()=>ct?Ut(ct):void 0,[ct]),Qt=!(Xe||H||x)&&(!Re||g),Jt=Qt&&R&&!Ne,Xt=Qt&&(Ae&&(Ae.isChannelPost||L&&!ke)&&Ae.fromMessageId||V);return c.a.createElement("div",{ref:be,id:"message"+Me,className:Ze,style:$t?`--meta-safe-author-width: ${$t}px`:void 0,"data-message-id":Me,onClick:H?dt:b.b?vt:void 0,onDoubleClick:H?void 0:bt,onMouseDown:H?void 0:ge,onContextMenu:H?void 0:fe,onMouseEnter:Re&&!g?Ba:void 0,onMouseLeave:Re&&!g?Ha:void 0},c.a.createElement("div",{ref:ue,className:"bottom-marker","data-message-id":Me,"data-last-message-id":n?n.messages[n.messages.length-1].id:void 0,"data-has-unread-mention":e.hasUnreadMention}),!Re&&c.a.createElement("div",{className:"message-select-control"},U&&c.a.createElement("i",{className:"icon-select"})),g&&c.a.createElement("div",{className:Object(Z.a)("message-select-control group-select",q&&"is-selected"),onClick:it},q&&c.a.createElement("i",{className:"icon-select"})),r&&function(){const e=tt&&Object(h.mb)(tt.id),t=tt&&e?tt:void 0,a=tt&&!e?tt:void 0,s=!tt&&Ae?Ae.hiddenUserName:void 0;return c.a.createElement(Gt.a,{size:"small",user:t,chat:a,text:s,lastSyncTime:F,onClick:t||a?mt:void 0})}(),c.a.createElement("div",{className:"message-content-wrapper",onClick:H&&Re?dt:void 0},c.a.createElement("div",{className:et,style:Ft,dir:"auto"},Le&&!Ye&&(!Re||j)&&c.a.createElement("div",{className:"message-title"},Lt("ForwardedMessage")),function(){const t=Object(Z.a)("content-inner",Le&&!Ye&&"forwarded-message",Te&&"reply-message",Dt&&"no-media-corners"),r=O&&!Je&&!Le&&!Pe,i=!ze&&!B&&Je;return c.a.createElement("div",{className:t,onDoubleClick:ut,dir:"auto"},function(){if(Ye||!(o&&!Be&&!He||Le||xe||I)||Re&&!j)return;let t,a;nt?(t=Object(h.W)(Lt,nt),Le||(a="color-"+Object(h.Y)(nt))):Ae&&Ae.hiddenUserName&&(t=Ae.hiddenUserName);return c.a.createElement("div",{className:"message-title",dir:"ltr"},t?c.a.createElement("span",{className:Object(Z.a)(nt&&"interactive",a),onClick:nt?ht:void 0,dir:"auto"},Object(st.a)(t)):C?void 0:" ",C&&c.a.createElement(c.a.Fragment,null,c.a.createElement("span",{className:"via"},Lt("ViaBot")),c.a.createElement("span",{className:"interactive",onClick:Ot},Object(st.a)("@"+C.username))),Ae&&Ae.isLinkedChannelPost?c.a.createElement("span",{className:"admin-title",dir:"auto"},Lt("DiscussChannel")):e.adminTitle&&!R?c.a.createElement("span",{className:"admin-title",dir:"auto"},e.adminTitle):void 0)}(),Te&&c.a.createElement(Wt,{message:M,sender:S,observeIntersection:a,onClick:jt}),_e&&c.a.createElement(ea,{message:e,observeIntersection:a,observeIntersectionForPlaying:s,shouldLoop:z,lastSyncTime:F}),B&&c.a.createElement(ta.a,{isInline:!0,sticker:B,observeIntersection:a,lastSyncTime:F,forceLoadPreview:Object(h.tb)(e)}),Fe&&c.a.createElement(Aa,{album:n,albumLayout:Ht,observeIntersection:a,shouldAutoLoad:$,shouldAutoPlay:W,isOwn:ke,hasCustomAppendix:r,lastSyncTime:F,onMediaClick:pt}),!Fe&&Be&&c.a.createElement(ia,{message:e,observeIntersection:a,shouldAutoLoad:$,uploadProgress:N,shouldAffectAppendix:r,onClick:gt,onCancelUpload:Ct}),!Fe&&He&&He.isRound&&c.a.createElement(Ra,{message:e,observeIntersection:a,shouldAutoLoad:$,shouldAutoPlay:W,lastSyncTime:F}),!Fe&&He&&!He.isRound&&c.a.createElement(Oa,{message:e,observeIntersection:a,shouldAutoLoad:$,shouldAutoPlay:W,uploadProgress:N,lastSyncTime:F,onClick:gt,onCancelUpload:Ct}),(Ue||qe)&&c.a.createElement(Kt.a,{theme:p,message:e,uploadProgress:N,lastSyncTime:F,isSelectable:Re,isSelected:U,onPlay:ft,onReadMedia:!qe||ke&&!L?void 0:yt,onCancelUpload:Ct}),Ge&&c.a.createElement(zt.a,{message:e,observeIntersection:a,uploadProgress:N,isSelectable:Re,isSelected:U,onCancelUpload:Ct}),Ve&&c.a.createElement(ga,{contact:Ve}),We&&c.a.createElement(wa,{message:e,poll:We,onSendVote:wt}),!B&&Je&&c.a.createElement("p",{className:"text-content "+(i?"with-meta":""),dir:"auto"},Je,i&&c.a.createElement(Yt,{message:e,outgoingStatus:k,signature:ct,onClick:dt})),ze&&c.a.createElement(Sa,{message:e,observeIntersection:a,shouldAutoLoad:$,onMediaClick:gt,onCancelMediaTransfer:Ct}),Ke&&c.a.createElement(ka,{message:e}))}(),(!Re||g)&&!(!ze&&!B&&Je)&&c.a.createElement(Yt,{message:e,outgoingStatus:k,signature:ct,onClick:dt}),Jt?c.a.createElement(ie.a,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:Lt("lng_context_forward_msg"),onClick:g?Tt:Pt},c.a.createElement("i",{className:"icon-share-filled"})):Xt?c.a.createElement(ie.a,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:V?At:xt},c.a.createElement("i",{className:"icon-arrow-right"})):void 0,rt&&c.a.createElement(Da,{message:e,disabled:d}),ot&&c.a.createElement("div",{className:"svg-appendix",ref:me})),e.inlineButtons&&c.a.createElement(Fa,{message:e,onClick:le})),je&&c.a.createElement(Vt,{isOpen:Oe,anchor:je,message:e,album:n,messageListType:_,onClose:pe,onCloseAnimationEnd:Ie}))}));a(236);const Ga=b.b?1e3:350,_a=b.k?300:500,Va=Object(g.a)(e=>e(),200,!1);var $a=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,type:s})=>{const n=Object(o.f)(e,t);if(!n)return{};const c=Object(o.x)(e,t,a,s),r="scheduled"===s?Object(o.qb)(e,t):Object(o.m)(e,t),l=Object(o.Fb)(e,t,a);if(a!==i.MAIN_THREAD_ID&&!(r&&l&&r[l]))return{};const{isRestricted:d,restrictionReason:b,lastMessage:u}=n,m=Object(o.I)(e,t),O=a===i.MAIN_THREAD_ID&&!c&&!n.unreadCount&&!m&&u&&!u.groupedId;let j;if(Object(o.L)(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(h.kb)(n),isChatWithSelf:Object(o.P)(e,t),messageIds:c,messagesById:r,firstUnreadId:Object(o.H)(e,t,a),isViewportNewest:"thread"!==s||Object(o.X)(e,t,a),threadFirstMessageId:Object(o.G)(e,t,a),focusingId:m,isSelectModeActive:Object(o.S)(e),animationLevel:e.settings.byKey.animationLevel,...O&&{lastMessage:u},botDescription:j,threadTopMessageId:l,hasLinkedChat:n.fullInfo&&"linkedChatId"in n.fullInfo?Boolean(n.fullInfo.linkedChatId):void 0}},(e,t)=>Object(d.l)(t,["loadViewportMessages","markMessageListRead","markMessagesRead","setScrollOffset","openHistoryCalendar"]))(({chatId:e,threadId:t,type:a,hasTools:r,onFabToggle:i,onNotchToggle:b,isChatLoaded:u,isChannelChat:m,canPost:O,isChatWithSelf:j,messageIds:f,messagesById:p,firstUnreadId:I,isViewportNewest:v,threadFirstMessageId:y,isRestricted:C,restrictionReason:w,focusingId:E,isSelectModeActive:M,animationLevel:S,loadViewportMessages:k,markMessageListRead:N,markMessagesRead:T,setScrollOffset:P,lastMessage:A,botDescription:L,threadTopMessageId:R,hasLinkedChat:F,openHistoryCalendar:D})=>{const B=Object(c.q)(null),H=Object(c.q)("thread"===a&&Object(o.rb)(Object(s.e)(),e,t)||0),U=Object(c.q)(),q=Object(c.q)(),G=Object(c.q)(),_=Object(c.q)(),V=Object(c.q)(),$=Object(c.q)(),W=Object(c.q)(!1),z=Object(c.q)(Boolean(A)),[K,Q]=Object(c.r)(),[Y,J]=Object(c.r)(Boolean(E)),ee=Boolean(f);Object(ge.a)(()=>{ee&&Object(g.d)(()=>{z.current=!1})},[ee]),Object(ge.a)(()=>{V.current=I,_.current||(_.current=I)},[I]);const{observe:ae}=Object(It.a)({rootRef:B,throttleMs:Ga,margin:_a}),{observe:se,freeze:ne,unfreeze:re}=Object(It.a)({rootRef:B},e=>{if("thread"!==a)return;let t=0;const s=[];e.forEach(e=>{const{isIntersecting:a,target:n}=e;if(!a)return;const{dataset:c}=n,r=Number(c.lastMessageId||c.messageId);r>t&&(t=r),c.hasUnreadMention&&s.push(r)}),V.current&&t>=V.current&&N({maxId:t}),s.length&&T({messageIds:s})});Object(te.a)(ne,re),Object(ge.a)(()=>{$.current=E},[E]);const{observe:oe}=Object(It.a)({rootRef:B,throttleMs:Ga});Object(c.n)(()=>{E?J(!0):setTimeout(()=>{J(!1)},200)},[E]);const ie=Object(c.p)(()=>{if(!f||!p)return;const e=!R||f[0]&&y!==f[0]?f:[R,...f];if(!e.length)return;const t=e.map(e=>p[e]).filter(Boolean);return pt(Object(d.k)(t,["date","id"]),_.current)},[f,p,y,R]),[le,de,be]=Object(c.p)(()=>"thread"===a?[Object(g.a)(()=>k({direction:l.e.Backwards}),1e3,!0,!1),Object(g.a)(()=>k({direction:l.e.Forwards}),1e3,!0,!1),Object(g.a)(()=>k({direction:l.e.Around}),1e3,!0,!1)]:[],[k,f]),{isScrolled:ue,updateStickyDates:me}=vt(),he=Object(c.m)(()=>{if(W.current)return void(W.current=!1);const s=B.current;$.current||me(s,r),Va(()=>{Object(g.b)(()=>{s.parentElement&&(H.current=s.scrollHeight-s.scrollTop,"thread"===a&&P({chatId:e,threadId:t,scrollOffset:H.current}))})})},[me,r,a,P,e,t]);Object(c.n)(()=>{if(!("ResizeObserver"in window))return;const e=new ResizeObserver(([e])=>{e.target.offsetParent&&Q(e.contentRect.height)});return e.observe(B.current),()=>{e.disconnect()}},[]);const{height:Oe}=$e();Object(c.n)(()=>{B.current.dataset.normalHeight=String(B.current.offsetHeight)},[Oe]),Object(c.n)(()=>{if(!be||!u||C||E)return;const e=B.current;(!f||f.length<n.V/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&be()},[u,f,be,E,C]),Object(ge.a)(()=>{if(!f||!G.current)return;const e=G.current.filter(e=>f.includes(Number(e.dataset.messageId))),t=e[1]||e[0];t&&(U.current=t.id,q.current=t.getBoundingClientRect().top)},[f,v,K,r]),Object(gt.a)(([e,t,a])=>{const s=B.current;if(G.current=Array.from(s.querySelectorAll(".message-list-item")),!s.offsetParent)return;const c=v&&f&&f.length<n.V/2&&!s.parentElement.classList.contains("force-messages-scroll")&&s.firstElementChild.clientHeight<=2*s.offsetHeight;c&&(s.parentElement.classList.add("force-messages-scroll"),setTimeout(()=>{s.parentElement&&s.parentElement.classList.remove("force-messages-scroll")},1e3));const{scrollTop:o,scrollHeight:i,offsetHeight:l}=s,d=H.current,b=G.current[G.current.length-1],u=b?b.offsetHeight:0,m=v&&t&&d-(a||l)-u<=100;let h;const O=f&&e&&f[0]!==e[0],j=f&&e&&f[f.length-1]!==e[e.length-1],p=f&&$.current===f[f.length-1];if(m&&j&&!O&&!p&&(b&&Object(g.b)(()=>{Object(Ct.a)(s,b,"end",20,void 0,void 0,void 0,!0)}),h=i-l,H.current=Math.max(i-h,l),!c))return;const I=void 0!==a&&a!==K,y=U.current&&s.querySelector("#"+U.current),C=!y&&_.current&&s.querySelector(".unread-divider");if(m&&I){if(Object(Ct.b)())return;h=i-l}else if(y){h=o+(y.getBoundingClientRect().top-(q.current||0))}else h=C?Math.min(C.offsetTop-(r?60:10),i-d):i-d;Object(yt.a)(s,h),$.current||(W.current=!0,Object(g.b)(()=>{W.current=!1})),H.current=Math.max(i-h,l)},[f,v,K,r]),Object(c.n)(()=>{(!S||S>0)&&Object(X.b)(200+n.c)},[S,M]);const je=Object(ce.a)(),fe=Boolean(e&&Object(h.mb)(e)),pe=Boolean(!fe&&!m||j),Ie=Object(Z.a)("MessageList custom-scroll",!pe&&"no-avatars",m&&"no-avatars",!O&&"no-composer","pinned"===a&&"type-pinned",M&&"select-mode-active",Y&&"has-focusing",ue&&"scrolled");return c.a.createElement("div",{ref:B,className:Ie,onScroll:he},C?c.a.createElement("div",{className:"empty"},c.a.createElement("span",null,w?w.text:"This is a private "+(m?"channel":"chat"))):L?c.a.createElement("div",{className:"empty rich"},c.a.createElement("span",null,Object(st.a)(je(L),["br","emoji","links"]))):f&&!ie?c.a.createElement("div",{className:"empty"},c.a.createElement("span",null,je("NoMessages"))):f&&ie||A?c.a.createElement(wt,{containerRef:B,className:"messages-container",messageIds:f||[A.id],loadMoreForwards:de,loadMoreBackwards:le,isViewportNewest:v,firstUnreadId:I,onFabToggle:i,onNotchToggle:b},function(e,t,a,s,r,o,i,l,b,u,m,O,j,g,f,p){const I=c.a.createElement("div",{className:Object(Z.a)("unread-divider","local-action-message"),key:"unread-messages"},c.a.createElement("span",null,e("UnreadMessages"))),v=f?0:t.reduce((e,t)=>e+Object(d.h)(t.senderGroups).length,0);let y=0;const C=t.map((t,O,f)=>{const C=t.senderGroups.map((t,n,g)=>{if(1===t.length&&!ft(t[0])&&Object(h.eb)(t[0])){const e=t[0],s=n===g.length-1&&O===f.length-1;return Object(d.e)([e.id===l.current&&I,c.a.createElement($t,{key:e.id,message:e,observeIntersection:a,appearanceOrder:v-++y,isLastInList:s})])}let p;return Object(d.h)(t.map((C,w)=>{const E=ft(C)?C.mainMessage:C,M=ft(C)?C:void 0,S=Object(h.ub)(E),k=ft(C),N=t[w+1];E.previousLocalId&&i.current==="message"+E.previousLocalId&&(i.current="message"+E.id);const T=!k&&E.groupedId?E.groupedId:void 0,P=N&&!ft(N)?N.groupedId:void 0,A={isFirstInGroup:0===w,isLastInGroup:w===t.length-1,isFirstInDocumentGroup:Boolean(T&&T!==p),isLastInDocumentGroup:Boolean(T&&T!==P),isLastInList:w===t.length-1&&n===g.length-1&&O===f.length-1};p=T;const x=Object(h.G)(E),L="scheduled"!==u?x:`${E.date}_${x}`;return Object(d.e)([E.id===l.current?I:void 0,c.a.createElement(qa,{key:L,message:E,observeIntersectionForBottom:a,observeIntersectionForMedia:s,observeIntersectionForAnimatedStickers:r,album:M,withAvatar:A.isLastInGroup&&o&&!S&&!(E.id===m),withSenderName:A.isFirstInGroup&&o&&!S,threadId:b,messageListType:u,noComments:!1===j,appearanceOrder:v-++y,isFirstInGroup:A.isFirstInGroup,isLastInGroup:A.isLastInGroup,isFirstInDocumentGroup:A.isFirstInDocumentGroup,isLastInDocumentGroup:A.isLastInDocumentGroup,isLastInList:A.isLastInList}),E.id===m&&c.a.createElement("div",{className:"local-action-message",key:"discussion-started"},c.a.createElement("span",null,e("DiscussionStarted")))])}))});return c.a.createElement("div",{className:"message-date-group",key:t.datetime,teactFastList:!0},c.a.createElement("div",{className:Object(Z.a)("sticky-date",!g&&"interactive"),key:"date-header",onClick:g?void 0:()=>p({selectedAt:t.datetime})},c.a.createElement("span",{dir:"auto"},g&&t.originalDate===n.mb&&e("MessageScheduledUntilOnline"),g&&t.originalDate!==n.mb&&e("MessageScheduledOn",Object(x.c)(e,t.datetime,void 0,!0)),!g&&Object(x.c)(e,t.datetime))),Object(d.h)(C))});return Object(d.h)(C)}(je,ie||pt([A]),se,ae,oe,pe,U,_,t,a,R,0,F,!!ie&&"scheduled"===a,!ie||!z.current,D)):c.a.createElement(Ee.a,{color:"white"}))}));a(237);var Wa=Object(c.h)(Object(s.h)(e=>{const t=Object(o.y)(e);if(!t)return{};const{chatId:a,threadId:s,type:n}=t,c=Object(o.f)(e,a);return{messageListType:n,unreadCount:c&&s===i.MAIN_THREAD_ID&&"thread"===n?c.unreadCount:void 0}},(e,t)=>Object(d.l)(t,["focusLastMessage"]))(({isShown:e,canPost:t,messageListType:a,unreadCount:s,focusLastMessage:n})=>{const r=Object(ce.a)(),o=Object(c.q)(null),i=Object(c.m)(()=>{if(e)if("thread"===a)n();else{const e=o.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),a=t[t.length-1];if(!a)return;Object(Ct.a)(e,a,"end",20)}},[e,a,n]),l=Object(Z.a)("ScrollDownButton",e&&"revealed",!t&&"no-composer");return c.a.createElement("div",{ref:o,className:l},c.a.createElement("div",{className:"ScrollDownButton-inner"},c.a.createElement(ie.a,{color:"secondary",round:!0,onClick:i,ariaLabel:r("AccDescrPageDown")},c.a.createElement("i",{className:"icon-arrow-down"})),Boolean(s)&&c.a.createElement("div",{className:"unread-count"},Object(Je.b)(s))))})),za=a(129),Ka=a(137);async function Qa(e,t,a,s){const n=URL.createObjectURL(t),{type:c,size:r}=t;let o,i;if(c.startsWith("image/"))if(a){const a=await Object(_e.g)(n),{width:r,height:i}=a;if(r>1280||i>1280||"image/jpeg"!==c){const c=await function(e){return new Promise(t=>{const a=document.createElement("canvas"),s=a.getContext("2d");let{width:n,height:c}=e;(n>1280||c>1280)&&(n>=c?(c*=1280/n,n=1280):(n*=1280/c,c=1280)),a.width=n,a.height=c,s.drawImage(e,0,0,e.width,e.height,0,0,n,c),a.toBlob(t,"image/jpeg",100)})}(a);return c?(URL.revokeObjectURL(n),Qa(e,c,!0,s)):Qa(e,t,!1,s)}o={width:r,height:i}}else i=n;else if(c.startsWith("video/")){if(r<10485760){const{videoWidth:e,videoHeight:t,duration:a}=await Object(_e.h)(n);o={width:e,height:t,duration:a}}i=await Object(_e.c)(n)}return{blobUrl:n,filename:e,mimeType:c,size:r,quick:o,previewBlobUrl:i,...s}}var Ya=a(181),Ja=a.p+"c0155344d336103c2b6a0b28cc510750.js";const Xa={encoderPath:Ja,reuseWorker:!0},Za={type:"audio/ogg"};let es,ts,as;async function ss(){return es||(es=a.e(10).then(a.t.bind(null,318,7)),ts=(await es).default,as=new ts(Xa)),es}async function ns(e){await async function(){await ss(),await as.start()}();const t=Date.now();let a;const s=[],n=[];as.ondataavailable=e=>{s.push(e)};const c=function(e,t){const a=e.sourceNode,s=a.context.createAnalyser();s.fftSize=64,a.connect(s);const n=s.frequencyBinCount,c=new Uint8Array(n);let r=!1;return function e(){if(r)return;s.getByteFrequencyData(c);const a=c.reduce((e,t)=>e+t,0),o=a/n/255;t(o<.1?0:o),requestAnimationFrame(e)}(),()=>{r=!0}}(as,t=>{n.push(255*t),e(t)});return{stop:()=>new Promise((e,r)=>{as.onstop=()=>{e({blob:new Blob(s,Za),duration:Math.round(((a||Date.now())-t)/1e3),waveform:n})},as.onerror=r;const o=Math.max(0,t+1e3-Date.now());setTimeout(()=>{as.stop(),c()},o)}),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout(()=>{as.pause(),a=Date.now(),c()},e)}}}const cs=["image/png","image/jpeg","image/gif"];function rs(e){const{text:t,entities:a}=e||{};if(!t)return"";const s=Object(Mt.b)(t,a,void 0,void 0,!0);return Array.isArray(s)?s.join(""):s}let os,is;var ls=a(64);var ds=a(182),bs=a(190);var us=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(we.a)(Ce.a.Extra,"DeleteMessageModal",!t);return a?c.a.createElement(a,e):void 0});function ms(){return(ms=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 hs,Os=!0;var js=Object(c.h)(({onActivate:e,...t})=>{const a=Object(c.q)(!1),s=Object(c.m)(()=>{if(a.current=!0,Os)return Os=!1,void e();hs&&(clearTimeout(hs),hs=void 0),hs=window.setTimeout(()=>{a.current&&e()},200)},[e]),n=Object(c.m)(()=>{a.current=!1},[]);return c.a.createElement(ie.a,ms({},t,{onMouseEnter:b.m?void 0:s,onMouseLeave:b.m?void 0:n,onClick:b.m?e:void 0}))});var gs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(we.a)(Ce.a.Extra,"AttachMenu",!t);return a?c.a.createElement(a,e):void 0});var fs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(we.a)(Ce.a.Extra,"SymbolMenu",!t);return a?c.a.createElement(a,e):void 0});var ps=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(we.a)(Ce.a.Extra,"MentionTooltip",!t);return a?c.a.createElement(a,e):void 0});var Is=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(we.a)(Ce.a.Extra,"CustomSendMenu",!t);return a?c.a.createElement(a,e):void 0});var vs=e=>{const{isOpen:t}=e,a=Object(we.a)(Ce.a.Extra,"StickerTooltip",!t);return a?c.a.createElement(a,e):void 0},ys=a(183);var Cs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(we.a)(Ce.a.Extra,"BotKeyboardMenu",!t);return a?c.a.createElement(a,e):void 0}),ws=a(184),Es=a(118);a(239);var Ms=Object(c.h)(Object(s.h)(e=>{const{chatId:t,threadId:a,type:s}=Object(o.y)(e)||{};if(!t||!a||!s)return{};const{currentUserId:n,forwardMessages:{fromChatId:c,toChatId:r,messageIds:i}}=e,l=Object(o.mb)(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 m,O;if(l?m=Object(o.k)(e,t,l):d?m=Object(o.D)(e,t,a,s):u&&1===i.length&&(m=Object(o.k)(e,c,i[0])),l&&m){const{forwardInfo:a}=m,s=t===n;a&&(a.isChannelPost||s)&&(O=Object(o.K)(e,m)),O||(O=Object(o.tb)(e,m))}else u&&(O=Object(h.mb)(c)?Object(o.Hb)(e,c):Object(o.f)(e,c));return{replyingToId:l,editingId:d,message:m,sender:O,shouldAnimate:b,forwardedMessagesCount:u?i.length:void 0}},(e,t)=>Object(d.l)(t,["setReplyingToId","setEditingId","focusMessage","exitForwardMode"]))(({replyingToId:e,editingId:t,message:a,sender:s,shouldAnimate:n,forwardedMessagesCount:r,setReplyingToId:o,setEditingId:i,focusMessage:l,exitForwardMode:d})=>{const b=Boolean((e||t)&&a||s&&r),u=Object(Es.a)([r],r?300:void 0),{shouldRender:m,transitionClassNames:h}=Object(ee.a)(u&&b,void 0,!n,void 0,!n),O=Object(c.m)(()=>{e?o({messageId:void 0}):t?i({messageId:void 0}):r&&d()},[e,t,r,o,i,d]);Object(c.n)(()=>b?Object(ae.a)(O):void 0,[b,O]);const j=Object(c.m)(()=>{l({chatId:a.chatId,messageId:a.id})},[l,a]),g=Object(Z.a)("ComposerEmbeddedMessage",h),f=r&&r>1?r+" forwarded messages":void 0;if(m)return c.a.createElement("div",{className:g},c.a.createElement("div",null,c.a.createElement(ie.a,{round:!0,color:"translucent",ariaLabel:"Cancel replying",onClick:O},c.a.createElement("i",{className:"icon-close"})),c.a.createElement(Wt,{className:"inside-input",message:a,sender:s,customText:f,title:t?"Edit Message":void 0,onClick:j})))}));var Ss=Object(c.h)(e=>{const{attachments:t}=e,a=Object(we.a)(Ce.a.Extra,"AttachmentModal",!t.length);return a?c.a.createElement(a,e):void 0});var ks=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(we.a)(Ce.a.Extra,"PollModal",!t);return a?c.a.createElement(a,e):void 0});var Ns=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(we.a)(Ce.a.Extra,"DropArea",!t);return a?c.a.createElement(a,e):void 0});a(240);const Ts=new RegExp(n.gb,"i");var Ps=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a})=>{const s=Object(o.cb)(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:n,noWebPage:r,loadWebPagePreview:o,clearWebPagePreview:l,toggleMessageWebPage:d})=>{const b=Object(c.p)(()=>{const{text:e,entities:t}=Object(Ka.a)(a),s=t&&t.find(({type:e})=>e===i.ApiMessageEntityTypes.TextUrl);if(s)return s.url;const n=e.match(Ts);return n?n[0]:void 0},[a]);Object(c.n)(()=>{b?o({text:b}):(l(),d({chatId:e,threadId:t}))},[e,d,l,b,o,t]),Object(ge.a)(()=>{l(),d({chatId:e,threadId:t})},[e]);const u=Boolean(n&&a.length&&!r&&!s),{shouldRender:m,transitionClassNames:h}=Object(ee.a)(u),O=Object(Ye.a)(n);if(!m||!O)return;const{photo:j,...g}=O,f={content:{webPage:g}};return c.a.createElement("div",{className:Object(Z.a)("WebPagePreview",h)},c.a.createElement("div",null,c.a.createElement(ie.a,{round:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:()=>{d({chatId:e,threadId:t,noWebPage:!0})}},c.a.createElement("i",{className:"icon-close"})),c.a.createElement(Sa,{message:f,inPreview:!0})))})),As=a(121);var xs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(we.a)(Ce.a.Extra,"CalendarModal",!t);return a?c.a.createElement(a,e):void 0});var Ls=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(we.a)(Ce.a.Extra,"PaymentModal",!t);return a?c.a.createElement(a,e):void 0});var Rs,Fs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(we.a)(Ce.a.Extra,"ReceiptModal",!t);return a?c.a.createElement(a,e):void 0});a(241);!function(e){e.Send="send",e.Record="record",e.Edit="edit"}(Rs||(Rs={}));var Ds=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const n=Object(o.f)(e,t),c=n&&Object(o.o)(e,n),r=n?Object(o.O)(e,n):void 0,l=Object(o.P)(e,t),d=r&&Object(o.bb)(e,t),b=Object(o.ob)(e,t),{language:u}=e.settings.byKey,m=Object(o.F)(e,"en"),O="en"!==u?Object(o.F)(e,u):void 0;return{editingMessage:Object(o.D)(e,t,a,s),connectionState:e.connectionState,draft:Object(o.B)(e,t,a),chat:n,isChatWithBot:r,isChatWithSelf:l,canScheduleUntilOnline:!l&&!r&&n&&c&&Object(h.mb)(t)&&c.status&&Boolean(c.status.wasOnline),isRightColumnShown:Object(o.W)(e),isSelectModeActive:Object(o.S)(e),withScheduledButton:a===i.MAIN_THREAD_ID&&"thread"===s&&Boolean(b&&b.length),shouldSchedule:"scheduled"===s,botKeyboardMessageId:d?d.id:void 0,isForwarding:t===e.forwardMessages.toChatId,canSuggestMembers:n&&Object(h.lb)(n),isPollModalOpen:e.isPollModalOpen,stickersForEmoji:e.stickers.forEmoji.stickers,groupChatMembers:n&&n.fullInfo&&n.fullInfo.members,currentUserId:e.currentUserId,usersById:e.users.byId,lastSyncTime:e.lastSyncTime,contentToBeScheduled:e.messages.contentToBeScheduled,isPaymentModalOpen:e.payment.isPaymentModalOpen,isReceiptModalOpen:Boolean(e.payment.receipt),shouldSuggestStickers:e.settings.byKey.shouldSuggestStickers,recentEmojis:e.recentEmojis,language:u,baseEmojiKeywords:m?m.keywords:void 0,emojiKeywords:O?O.keywords:void 0,serverTimeOffset:e.serverTimeOffset}},(e,t)=>Object(d.l)(t,["sendMessage","editMessage","saveDraft","clearDraft","showError","setStickerSearchQuery","setGifSearchQuery","forwardMessages","openPollModal","closePollModal","closePaymentModal","clearReceipt","loadScheduledHistory","openChat","addRecentEmoji","loadEmojiKeywords"]))(({dropAreaState:e,shouldSchedule:t,canScheduleUntilOnline:a,onDropHide:r,editingMessage:o,chatId:l,threadId:d,messageListType:u,draft:m,chat:O,connectionState:j,isChatWithBot:f,isChatWithSelf:p,isRightColumnShown:I,isSelectModeActive:v,isForwarding:y,canSuggestMembers:C,isPollModalOpen:w,isPaymentModalOpen:E,isReceiptModalOpen:M,botKeyboardMessageId:S,withScheduledButton:k,stickersForEmoji:N,groupChatMembers:T,currentUserId:P,usersById:A,lastSyncTime:L,contentToBeScheduled:R,shouldSuggestStickers:F,language:D,baseEmojiKeywords:B,emojiKeywords:H,serverTimeOffset:U,recentEmojis:q,sendMessage:G,editMessage:_,saveDraft:V,clearDraft:$,showError:W,setStickerSearchQuery:z,setGifSearchQuery:K,forwardMessages:Q,openPollModal:Y,closePollModal:J,loadScheduledHistory:X,closePaymentModal:ee,openChat:te,clearReceipt:se,addRecentEmoji:ne,loadEmojiKeywords:re})=>{const oe=Object(c.q)(null),[le,de]=Object(c.r)(""),be=Object(c.q)(),ue=Object(ca.a)(e),[me,Oe,je]=Object(lt.a)(),[ge,fe]=Object(c.r)(),pe=Object(c.q)(le);Object(c.n)(()=>{pe.current=le},[le]),Object(c.n)(()=>{be.current=void 0},[l]),Object(c.n)(()=>{l&&L&&d===i.MAIN_THREAD_ID&&X()},[l,X,L,d]),Object(c.o)(()=>{oe.current&&(oe.current.innerHTML='<svg width="9" height="20" xmlns="http://www.w3.org/2000/svg"><defs><filter x="-50%" y="-14.7%" width="200%" height="141.2%" filterUnits="objectBoundingBox" id="a"><feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0.0621962482 0 0 0 0 0.138574144 0 0 0 0 0.185037364 0 0 0 0.15 0" in="shadowBlurOuter1"/></filter></defs><g fill="none" fill-rule="evenodd"><path d="M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z" fill="#000" filter="url(#a)"/><path d="M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z" fill="#FFF" class="corner"/></g></svg>')},[]),Object(c.n)(()=>{R&&(fe(R),Oe())},[R,Oe]);const[Ie,ve]=Object(c.r)([]),[ye,Ce,we]=Object(lt.a)(),[Ee,Me,Se]=Object(lt.a)(),[ke,Ne,Te]=Object(lt.a)(),[Pe,Ae,xe]=Object(lt.a)(),[Le,Re]=Object(lt.a)(),[Fe,De,Be]=Object(lt.a)(),{startRecordingVoice:He,stopRecordingVoice:Ue,pauseRecordingVoice:Ge,activeVoiceRecording:_e,currentRecordTime:Ve,recordButtonRef:$e,startRecordTimeRef:We}=(()=>{const e=Object(c.q)(null),[t,a]=Object(c.r)(),s=Object(c.q)(),[n,r]=Object(c.r)();Object(c.n)(()=>{b.e&&ss()},[]);const o=Object(c.m)(async()=>{try{const{stop:t,pause:n}=await ns(t=>{e.current&&(s.current&&Date.now()%4==0&&(e.current.style.boxShadow=`0 0 0 ${50*(t||0)}px rgba(0,0,0,.15)`),r(Date.now()))});s.current=Date.now(),r(Date.now()),a({stop:t,pause:n})}catch(e){console.error(e)}},[]),i=Object(c.m)(()=>{if(t){e.current&&(e.current.style.boxShadow="none");try{return t.pause()}catch(e){return void console.error(e)}}},[t]),l=Object(c.m)(()=>{if(t){a(void 0),s.current=void 0,r(void 0),e.current&&(e.current.style.boxShadow="none");try{return t.stop()}catch(e){return void console.error(e)}}},[t]);return Object(c.n)(()=>t?Object(ae.a)(l):void 0,[t,l]),{startRecordingVoice:o,pauseRecordingVoice:i,stopRecordingVoice:l,activeVoiceRecording:t,currentRecordTime:n,recordButtonRef:e,startRecordTimeRef:s}})(),ze=o?Rs.Edit:!b.n||_e||le&&!Ie.length||y?Rs.Send:Rs.Record,Ke=!t,{isMentionTooltipOpen:Qe,mentionFilter:Ye,closeMentionTooltip:Je,insertMention:Xe,mentionFilteredMembers:Ze}=Object(bs.a)(C&&!Ie.length,le,de,void 0,T,P,A),{isContextMenuOpen:et,handleContextMenu:tt,handleContextMenuClose:at,handleContextMenuHide:nt}=Object(Et.a)($e,!(ze===Rs.Send&&Ke)),ct=Object(c.p)(()=>Object(h.c)(O,f),[O,f]),rt=O&&Object(h.hb)(O),ot=Object(h.k)(O),{isStickerTooltipOpen:it,closeStickerTooltip:dt}=function(e,t,a){const{loadStickersForEmoji:n,clearStickersForEmoji:r}=Object(s.d)(),o=b.d&&1===Object(ls.a)(t)||!b.d&&Boolean(t.match(/^<img.[^>]*?>$/g)),i=Boolean(a)&&o;return Object(c.n)(()=>{e&&o?n({emoji:t}):!i&&o||r()},[t,o,r,n,e]),{isStickerTooltipOpen:i,closeStickerTooltip:r}}(Boolean(F&&ct.canSendStickers&&!Ie.length),le,N),{isEmojiTooltipOpen:bt,closeEmojiTooltip:ut,filteredEmojis:mt,insertEmoji:ht}=Object(ds.a)(Boolean(F&&ct.canSendStickers&&!Ie.length),le,q,void 0,de,B,H),Ot=Object(c.m)((e,t=n.v)=>{const a=window.getSelection(),s=document.getElementById(t),c=Object(st.a)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");if(a.rangeCount){const e=a.getRangeAt(0);if(Object(Ya.a)(e,t))return function(e){const t=window.getSelection();if(t&&t.getRangeAt&&t.rangeCount){const a=t.getRangeAt(0);a.deleteContents();const s=a.createContextualFragment(e),n=s.lastChild;a.insertNode(s),n&&(a.setStartAfter(n),a.setEndAfter(n),t.removeAllRanges(),t.addRange(a))}}(c),void s.dispatchEvent(new Event("input",{bubbles:!0}))}de(`${pe.current}${c}`),b.k||requestAnimationFrame(()=>{Object(za.a)(s)})},[]),jt=Object(c.m)(()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if(Object(Ya.a)(t,n.v))return void document.execCommand("delete",!1)}de(function(e){const t=document.createElement("div");t.contentEditable="true",t.style.position="absolute",t.style.left="-10000px",t.style.top="-10000px",t.innerHTML=e,document.body.appendChild(t);let a=t.lastChild;if(a.lastChild)for(;a.lastChild;)a=a.lastChild;const s=a.textContent.length,n=document.createRange(),c=window.getSelection();n.setStart(a,s),n.setEnd(a,s),c.removeAllRanges(),c.addRange(n),document.execCommand("delete",!1);const r=t.innerHTML;return document.body.removeChild(t),r}(pe.current))},[]),gt=Object(c.m)(()=>{de(""),ve([]),dt(),je(),fe(void 0),Je(),ut(),b.k?setTimeout(()=>Te(),350):Te()},[dt,je,Je,ut,Te]),ft=Object(ca.a)(l);Object(c.n)(()=>{ft&&l!==ft&&(Ue(),gt())},[l,ft,gt,Ue]);const pt=((e,t,a,s,r,o)=>{Object(c.n)(()=>{a?(t(rs(a.content.text)),requestAnimationFrame(()=>{const e=document.getElementById(n.v);Object(za.a)(e,!0)})):t("")},[a,t]);return Object(c.m)(()=>{const{text:t,entities:n}=Object(Ka.a)(e.current);a&&(t||Object(h.db)(a)?(o({messageId:a.id,text:t,entities:n}),s()):r())},[o,a,e,r,s])})(pe,de,o,gt,Ae,_);((e,t,a,s,r,o,i,l,d)=>{const b=Object(c.m)((e,t)=>{r.current.length&&!i?l({chatId:e,threadId:t,draft:Object(Ka.a)(r.current)}):d({chatId:e,threadId:t})},[d,i,r,l]),u=Object(c.p)(()=>Object(g.a)(e=>e(),n.u,!1),[t]),m=Object(ca.a)(t),h=Object(ca.a)(a);Object(c.n)(()=>(os=t,is=a,()=>{os=void 0,is=void 0,b(t,a)}),[t,a,b]),Object(c.n)(()=>{t===m&&a===h||e&&(o(rs(e)),requestAnimationFrame(()=>{const e=document.getElementById(n.v);Object(za.a)(e,!0)}))},[t,a,e,o,b,m,h]);const O=Object(ca.a)(s);Object(c.n)(()=>{t&&a&&m===t&&h===a&&O!==s&&(s.length?u(()=>{os===t&&is===a&&b(t,a)}):b(t,a))},[t,s,m,O,h,u,a,b]),Object(c.n)(()=>{function e(){t&&a&&b(t,a)}return window.addEventListener("blur",e),()=>{window.removeEventListener("blur",e)}},[t,a,b])})(m,l,d,le,pe,de,o,V,$),((e,t,a)=>{Object(c.n)(()=>{async function s(s){if(!s.clipboardData)return;const c=document.activeElement;if(c&&![n.v,n.w].includes(c.id))return;const{items:r}=s.clipboardData,o=Array.from(r).find(e=>cs.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 Qa(i.name,i,!0);t(t=>[...t,e])}l&&e(l,c?c.id:void 0)}}return document.addEventListener("paste",s,!1),()=>{document.removeEventListener("paste",s,!1)}},[e,a,t])})(Ot,ve,o);const It=Object(c.m)(async(e,t)=>{ve(await Promise.all(e.map(e=>Qa(e.name,e,t))))},[]),vt=Object(c.m)(async(e,t)=>{ve([...Ie,...await Promise.all(e.map(e=>Qa(e.name,e,t)))])},[Ie]),yt=Object(c.m)(()=>{ve([])},[]),Ct=Object(c.m)(async(e=!1,t)=>{if("connectionStateReady"!==j)return;let a=Ie;if(_e){const e=await Ue();if(e){const{blob:t,duration:s,waveform:n}=e;a=[await Qa("wonderful-voice-message.ogg",t,!1,{voice:{duration:s,waveform:n}})]}}const{text:s,entities:c}=Object(Ka.a)(pe.current);if(a.length||s||y)if(a.length&&s&&s.length>1024){const e=s.length-1024;W({error:{message:"CAPTION_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":e,"{PLURAL_S}":e>1?"s":""}}})}else{if(a.length||s){if(ot&&!rt){const e=Math.floor(Date.now()/1e3)+U,t=be.current&&Math.floor(e-be.current),a=ot.nextSendDate&&ot.nextSendDate>e;if(t&&t<ot.seconds||a){const s=a?ot.nextSendDate-e:ot.seconds-t;W({error:{message:`A wait of ${s} seconds is required before sending another message in this chat`,isSlowMode:!0}});return void document.getElementById(n.v).blur()}}G({text:s,entities:c,attachments:a,scheduledAt:t,isSilent:e})}y&&Q(),be.current=Math.floor(Date.now()/1e3)+U,$({chatId:l,localOnly:!0}),requestAnimationFrame(gt)}},[j,Ie,_e,y,U,$,l,gt,Ue,W,ot,rt,G,Q]),wt=Object(c.m)(e=>{e={...e,isPreloadedGlobally:!0},t?(fe({sticker:e}),Oe()):(G({sticker:e}),requestAnimationFrame(gt))},[t,Oe,G,gt]),Mt=Object(c.m)(e=>{t?(fe({gif:e}),Oe()):(G({gif:e}),requestAnimationFrame(gt))},[t,Oe,G,gt]),St=Object(c.m)(e=>{t?(fe({poll:e}),J(),Oe()):(G({poll:e}),J())},[J,Oe,G,t]),kt=Object(c.m)(()=>{t?(fe({isSilent:!0}),Oe()):Ct(!0)},[Ct,Oe,t]),Nt=Object(c.m)((e,t=!1)=>{const{isSilent:a,...s}=ge||{},n=Math.round(Math.max(e.getTime(),Date.now()+6e4)/1e3)+(t?0:U);ge&&0!==Object.keys(s).length?(G({...ge,scheduledAt:n}),requestAnimationFrame(gt)):Ct(!!a,n),je()},[je,Ct,gt,ge,G,U]),Tt=Object(c.m)(()=>{Nt(new Date(1e3*n.mb),!0)},[Nt]),Pt=Object(c.m)(()=>{je(),fe(void 0)},[je]),At=Object(c.m)(e=>{"stickers"===e?(z({query:""}),K({query:void 0})):(K({query:""}),z({query:void 0}))},[z,K]),xt=Object(c.m)(()=>{const e=document.getElementById(n.v);b.k&&e===document.activeElement?(e.blur(),setTimeout(()=>{Ne()},100)):Ne()},[Ne]),Lt=Object(c.m)(()=>{te({id:l,threadId:d,type:"scheduled"})},[te,l,d]);Object(c.n)(()=>{I&&b.k&&Te()},[I,Te]),Object(c.n)(()=>{v?De():setTimeout(()=>{Be()},200)},[v,Be,De]);const Rt=Object(c.m)(()=>{switch(ze){case Rs.Send:t?(_e&&Ge(),Oe()):(Ct(),requestAnimationFrame(gt));break;case Rs.Record:He();break;case Rs.Edit:pt()}},[ze,gt,t,He,pt,_e,Oe,Ge,Ct]),Ft=Object(ce.a)(),Dt=ze===Rs.Record&&!ct.canAttachMedia,Bt=Object(ca.a)(o,!0),Ht=o||Bt,Ut=new Date;Ut.setSeconds(0),Ut.setMilliseconds(0);const qt=new Date;qt.setFullYear(qt.getFullYear()+1);let Gt="SendMessage";switch(ze){case Rs.Edit:Gt="Save edited message";break;case Rs.Record:Gt=Dt?"Conversation.DefaultRestrictedMedia":"AccDescrVoiceMessage"}const _t=Object(Z.a)("Composer",!v&&"shown",Fe&&"hover-disabled"),Vt=Object(Z.a)("mobile-symbol-menu-button",Le?ke&&"menu-opened":ke&&"is-loading"),$t=ze===Rs.Edit?pt:t?Oe:Ct;return c.a.createElement("div",{className:_t},ct.canAttachMedia&&c.a.createElement(As.a,{containerId:"#middle-column-portals"},c.a.createElement(Ns,{isOpen:e!==qe.a.None,withQuick:[e,ue].includes(qe.a.QuickFile),onHide:r,onFileSelect:It})),c.a.createElement(Ss,{attachments:Ie,caption:Ie.length?le:"",canSuggestMembers:C,groupChatMembers:T,currentUserId:P,usersById:A,recentEmojis:q,onCaptionUpdate:de,language:D,emojiKeywords:H,addRecentEmoji:ne,loadEmojiKeywords:re,onSend:t?Oe:Ct,onFileAppend:vt,onClear:yt}),c.a.createElement(ks,{isOpen:Boolean(w),onClear:J,onSend:St}),c.a.createElement(Ls,{isOpen:Boolean(E),onClose:ee}),c.a.createElement(Fs,{isOpen:Boolean(M),onClose:se}),Ht&&c.a.createElement(us,{isOpen:Pe,isSchedule:"scheduled"===u,onClose:xe,message:Ht}),c.a.createElement(ps,{isOpen:Qe,filter:Ye,onClose:Je,onInsertUserName:Xe,filteredChatMembers:Ze,usersById:A}),c.a.createElement("div",{id:"message-compose"},c.a.createElement("div",{className:"svg-appendix",ref:oe}),c.a.createElement(Ms,null),c.a.createElement(Ps,{chatId:l,threadId:d,messageText:Ie.length?"":le,disabled:!ct.canAttachEmbedLinks}),c.a.createElement("div",{className:"message-input-wrapper"},b.k?c.a.createElement(ie.a,{className:Vt,round:!0,color:"translucent",onClick:ke?Te:xt,ariaLabel:"Choose emoji, sticker or GIF"},c.a.createElement("i",{className:"icon-smile"}),c.a.createElement("i",{className:"icon-keyboard"}),c.a.createElement(he.a,{color:"gray"})):c.a.createElement(js,{className:""+(ke?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:Ne,ariaLabel:"Choose emoji, sticker or GIF"},c.a.createElement("i",{className:"icon-smile"})),c.a.createElement(ws.a,{id:"message-input-text",html:Ie.length?"":le,placeholder:_e&&window.innerWidth<=600?"":Ft("Message"),shouldSetFocus:ke,shouldSupressFocus:b.k&&ke,shouldSupressTextFormatter:bt||Qe,onUpdate:de,onSend:$t,onSupressedFocus:Te}),k&&c.a.createElement(ie.a,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:Lt,ariaLabel:"Open scheduled messages"},c.a.createElement("i",{className:"icon-schedule"})),S&&!_e&&!o&&c.a.createElement(js,{className:""+(ye?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:Ce,ariaLabel:"Open bot command keyboard"},c.a.createElement("i",{className:"icon-bot-command"})),!_e&&!o&&c.a.createElement(js,{className:""+(Ee?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:Me,ariaLabel:"Add an attachment"},c.a.createElement("i",{className:"icon-attach"})),_e&&Ve&&c.a.createElement("span",{className:"recording-state"},Object(x.i)(Ve-We.current)),c.a.createElement(vs,{isOpen:it,onStickerSelect:wt}),c.a.createElement(ys.a,{isOpen:bt,emojis:mt,onClose:ut,onEmojiSelect:ht,addRecentEmoji:ne,loadEmojiKeywords:re,language:D}),c.a.createElement(gs,{isOpen:Ee,allowedAttachmentOptions:ct,onFileSelect:It,onPollCreate:Y,onClose:Se}),S&&c.a.createElement(Cs,{messageId:S,isOpen:ye,onClose:we}),c.a.createElement(fs,{isOpen:ke,allowedAttachmentOptions:ct,onLoad:Re,onClose:Te,onEmojiSelect:Ot,onStickerSelect:wt,onGifSelect:Mt,onRemoveSymbol:jt,onSearchOpen:At,addRecentEmoji:ne}))),_e&&c.a.createElement(ie.a,{round:!0,color:"danger",className:"cancel",onClick:Ue,ariaLabel:"Cancel voice recording"},c.a.createElement("i",{className:"icon-delete"})),c.a.createElement(ie.a,{ref:$e,round:!0,color:"secondary",className:`${ze} ${_e?"recording":""}`,disabled:Dt,ariaLabel:Ft(Gt),onClick:Rt,onContextMenu:ze===Rs.Send&&Ke?tt:void 0},c.a.createElement("i",{className:"icon-send"}),c.a.createElement("i",{className:"icon-microphone-alt"}),c.a.createElement("i",{className:"icon-check"})),Ke&&c.a.createElement(Is,{isOpen:et,onSilentSend:p?void 0:kt,onScheduleSend:t?void 0:Oe,onClose:at,onCloseAnimationEnd:nt}),c.a.createElement(xs,{isOpen:me,withTimePicker:!0,selectedAt:Ut.getTime(),maxAt:Object(x.k)(qt),isFutureMode:!0,secondButtonLabel:a?"Send When Online":void 0,onClose:Pt,onSubmit:Nt,onSecondButtonClick:a?Tt:void 0}))}));var Bs=Object(c.h)(e=>{const{isActive:t}=e,a=Object(we.a)(Ce.a.Extra,"MobileSearch",!t,!0);return a?c.a.createElement(a,e):void 0});var Hs=Object(c.h)(e=>{const{isActive:t}=e,a=Object(we.a)(Ce.a.Extra,"MessageSelectToolbar",!t);return a?c.a.createElement(a,e):void 0});var Us=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(we.a)(Ce.a.Extra,"UnpinAllMessagesModal",!t);return a?c.a.createElement(a,e):void 0});a(242);const qs=b.k?450+n.c:void 0;function Gs(e){return"file"===e.kind&&e.type&&n.l.includes(e.type)}var _s=Object(c.h)(Object(s.h)(e=>{const t=Object(o.Bb)(e),{isBlurred:a,background:s,backgroundColor:n,patternColor:c}=e.settings.themes[t]||{},r=Object(o.y)(e),{isLeftColumnShown:l,chats:{listIds:d}}=e,u={theme:t,customBackground:s,backgroundColor:n,patternColor:c,isLeftColumnShown:l,isRightColumnShown:Object(o.W)(e),isBackgroundBlurred:a,isMobileSearchActive:Boolean(b.k&&Object(o.A)(e)),isSelectModeActive:Object(o.S)(e),animationLevel:e.settings.byKey.animationLevel};if(!r||!d.active)return u;const{chatId:m,threadId:O,type:j}=r,g=Object(o.f)(e,m),f=Object(o.jb)(e,m),{chatId:p,messageId:I}=e.audioPlayer,v=g&&Object(h.e)(g,O),y=Object(o.L)(e,m),C="pinned"===j;return{...u,chatId:m,threadId:O,messageListType:j,isPrivate:Object(h.mb)(m),canPost:!C&&(!g||v)&&(!y||b.k),isPinnedMessageList:C,messageSendingRestrictionReason:g&&Object(h.L)(g),hasPinnedOrAudioMessage:O!==i.MAIN_THREAD_ID||Boolean(f&&f.length)||Boolean(p&&I),pinnedMessagesCount:f?f.length:0}},(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,pinnedMessagesCount:u,customBackground:m,theme:h,backgroundColor:O,patternColor:j,isLeftColumnShown:g,isRightColumnShown:f,isBackgroundBlurred:p,isMobileSearchActive:I,isSelectModeActive:v,animationLevel:y,openChat:C,unpinAllMessages:w,loadUser:E})=>{const{width:M}=$e(),[S,k]=Object(c.r)(qe.a.None),[N,T]=Object(c.r)(),[P,A]=Object(c.r)(),[x,L]=Object(c.r)(!1),R=d&&(M<n.db||f&&M>n.ab&&M<n.lb||M>=n.Z&&M<n.kb),F=Object(We.a)(e,qs),D=Object(We.a)(t,qs),B=Object(We.a)(a,qs),H=Object(We.a)(o,qs),U=Object(We.a)(R,qs),q=Object(We.a)(N,qs);Object(c.n)(()=>e?Object(ae.a)(()=>{C({id:void 0})}):void 0,[e,C]),Object(c.n)(()=>{k(qe.a.None),T(void 0),A(void 0)},[e]),Object(c.n)(()=>{s&&E({userId:e})},[e,s,E]);const G=Object(c.m)(e=>{if(b.m)return;const{items:t}=e.dataTransfer||{},a=t&&Array.from(t).every(Gs);k(a?qe.a.QuickFile:qe.a.Document)},[]),_=Object(c.m)(()=>{k(qe.a.None)},[]),V=Object(c.m)(()=>{L(!0)},[]),$=Object(c.m)(()=>{L(!1)},[]),W=Object(c.m)(()=>{w({chatId:e}),$(),C({id:e})},[w,C,$,e]),z=Object(c.m)(()=>{C({id:e})},[C,e]),K=((e,t)=>{const[a,s]=Object(c.r)(t);return Object(c.n)(()=>{t&&(t.startsWith("#")?s(t):Ge.c(n.m,e,Ge.a.Blob).then(e=>{const t=URL.createObjectURL(e);Object(_e.g)(t).then(()=>{s(`url(${t})`)})}))},[t,e]),t?a:void 0})(h,m),Q=Object(Z.a)(U&&"has-header-tools",m&&"custom-bg-image",O&&"custom-bg-color",m&&p&&"blurred",b.o?"mask-image-disabled":"mask-image-enabled"),Y=Object(Z.a)("messaging-disabled",!v&&"shown"),{composerHiddenScale:J,toolbarHiddenScale:X,composerTranslateX:ee,toolbarTranslateX:te,unpinHiddenScale:ne,toolbarForUnpinHiddenScale:re}=Object(c.p)(()=>ze(M,H),[H,M]),oe=Object(ce.a)(),le=Object(Z.a)("middle-column-footer",!H&&"no-composer",H&&P&&!v&&"with-notch");return c.a.createElement("div",{id:"MiddleColumn",className:Q,style:`\n --composer-hidden-scale: ${J};\n --toolbar-hidden-scale: ${X};\n --unpin-hidden-scale: ${ne};\n --toolbar-unpin-hidden-scale: ${re};\n --composer-translate-x: ${ee}px;\n --toolbar-translate-x: ${te}px;\n --pattern-color: ${j};\n --theme-background-color:\n ${O||("dark"===h?n.n:n.I)};\n `,onClick:b.l&&g?z:void 0},c.a.createElement("div",{id:"middle-column-bg",style:K?"--custom-background: "+K:void 0}),c.a.createElement("div",{id:"middle-column-portals"}),F&&D&&c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"messages-layout",onDragEnter:H?G:void 0},c.a.createElement(jt,{chatId:F,threadId:D,messageListType:B}),c.a.createElement(se.a,{name:y===n.e?"slide":"fade",activeKey:"thread"===B&&D===i.MAIN_THREAD_ID?1:2,shouldCleanup:!0},()=>c.a.createElement(c.a.Fragment,null,c.a.createElement($a,{key:`${F}-${D}-${B}`,chatId:F,threadId:D,type:B,canPost:H,hasTools:U,onFabToggle:T,onNotchToggle:A}),c.a.createElement("div",{className:le},H&&c.a.createElement(Ds,{chatId:F,threadId:D,messageListType:B,dropAreaState:S,onDropHide:_}),r&&c.a.createElement("div",{className:"unpin-button-container",dir:oe.isRtl?"rtl":void 0},c.a.createElement(ie.a,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:V},c.a.createElement("i",{className:"icon-unpin"}),c.a.createElement("span",null,oe("Chat.Pinned.UnpinAll",u,"i")))),!r&&!H&&l&&c.a.createElement("div",{className:Y},c.a.createElement("div",{className:"messaging-disabled-inner"},c.a.createElement("span",null,l))),c.a.createElement(Hs,{messageListType:B,isActive:v,canPost:H})))),c.a.createElement(Wa,{isShown:q,canPost:H})),b.k&&c.a.createElement(Bs,{isActive:Boolean(I)})),e&&c.a.createElement(Us,{isOpen:x,chatId:e,pinnedMessagesCount:u,onClose:$,onUnpin:W}))}));a(243);const Vs=Object(g.a)(e=>e(),200,!1);var $s;!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"}($s||($s={}));var Ws=Object(c.h)(Object(s.h)((e,{chatId:t,isProfile:a,isManagement:s})=>{const{query:n}=Object(o.A)(e)||{},{query:c}=Object(o.z)(e)||{},{query:r}=Object(o.s)(e)||{},i=t?Object(o.f)(e,t):void 0,l=i&&Object(h.kb)(i);return{canManage:Boolean(!s&&a&&i&&!Object(o.P)(e,i.id)&&(Object(h.mb)(i.id)||(Object(h.hb)(i)||i.isCreator)&&!i.isNotJoined)),isChannel:l,messageSearchQuery:n,stickerSearchQuery:c,gifSearchQuery:r}},(e,t)=>Object(d.l)(t,["setLocalTextSearchQuery","setStickerSearchQuery","setGifSearchQuery","searchTextMessagesLocal","toggleManagement","openHistoryCalendar"]))(({isColumnOpen:e,isProfile:t,isSearch:a,isManagement:s,isStickerSearch:n,isGifSearch:r,isPollResults:o,profileState:i,managementScreen:d,canManage:u,isChannel:m,onClose:h,messageSearchQuery:O,stickerSearchQuery:j,gifSearchQuery:g,setLocalTextSearchQuery:f,setStickerSearchQuery:p,setGifSearchQuery:I,searchTextMessagesLocal:v,toggleManagement:y,openHistoryCalendar:C})=>{var w;const E=Object(c.q)(null),M=Object(c.m)(e=>{f({query:e}),e.length&&Vs(v)},[v,f]),S=Object(c.m)(e=>{p({query:e})},[p]),k=Object(c.m)(e=>{I({query:e})},[I]),[N,T]=Object(c.r)(!e);Object(c.n)(()=>{setTimeout(()=>{T(!e)},300)},[e]);const P=Object(ce.a)(),A=t?i===l.k.Profile?$s.Profile:i===l.k.SharedMedia?$s.SharedMedia:i===l.k.MemberList?$s.MemberList:-1:a?$s.Search:o?$s.PollResults:n?$s.StickerSearch:r?$s.GifSearch:s?d===l.g.Initial?$s.ManageInitial:d===l.g.ChatPrivacyType?$s.ManageChatPrivacyType:d===l.g.Discussion?$s.ManageDiscussion:d===l.g.ChannelSubscribers?$s.ManageChannelSubscribers:d===l.g.GroupPermissions?$s.ManageGroupPermissions:d===l.g.ChatAdministrators?$s.ManageChatAdministrators:d===l.g.GroupRemovedUsers?$s.ManageGroupRemovedUsers:d===l.g.GroupUserPermissionsCreate?$s.ManageGroupUserPermissionsCreate:d===l.g.GroupUserPermissions?$s.ManageGroupUserPermissions:d===l.g.GroupRecentActions?$s.ManageGroupRecentActions:d===l.g.ChatAdminRights?$s.ManageGroupAdminRights:d===l.g.GroupMembers?$s.ManageGroupMembers:void 0:void 0,L=null!==(w=Object(Ye.a)(A,!0))&&void 0!==w?w:-1;function R(){if(-1!==L)switch(L){case $s.PollResults:return c.a.createElement("h3",null,P("PollResults"));case $s.Search:return c.a.createElement(c.a.Fragment,null,c.a.createElement(le.a,{parentContainerClassName:"RightSearch",value:O,onChange:M}),c.a.createElement(ie.a,{round:!0,size:"smaller",color:"translucent",onClick:()=>C({selectedAt:Object(x.k)(Date.now())}),ariaLabel:"Search messages by date"},c.a.createElement("i",{className:"icon-calendar"})));case $s.ManageInitial:return c.a.createElement("h3",null,P("Edit"));case $s.ManageChatPrivacyType:return c.a.createElement("h3",null,P(m?"ChannelTypeHeader":"GroupTypeHeader"));case $s.ManageDiscussion:return c.a.createElement("h3",null,P("Discussion"));case $s.ManageChatAdministrators:return c.a.createElement("h3",null,P("ChannelAdministrators"));case $s.ManageGroupRecentActions:return c.a.createElement("h3",null,P("Group.Info.AdminLog"));case $s.ManageGroupAdminRights:return c.a.createElement("h3",null,P("EditAdminRights"));case $s.ManageGroupPermissions:return c.a.createElement("h3",null,P("ChannelPermissions"));case $s.ManageGroupRemovedUsers:return c.a.createElement("h3",null,P("ChannelBlockedUsers"));case $s.ManageGroupUserPermissionsCreate:return c.a.createElement("h3",null,P("ChannelAddException"));case $s.ManageGroupUserPermissions:return c.a.createElement("h3",null,P("UserRestrictions"));case $s.StickerSearch:return c.a.createElement(le.a,{value:j,placeholder:P("SearchStickersHint"),onChange:S});case $s.GifSearch:return c.a.createElement(le.a,{value:g,placeholder:P("SearchGifsTitle"),onChange:k});case $s.SharedMedia:return c.a.createElement("h3",null,P("SharedMedia"));case $s.ManageChannelSubscribers:return c.a.createElement("h3",null,P("ChannelSubscribers"));case $s.MemberList:case $s.ManageGroupMembers:return c.a.createElement("h3",null,P("GroupMembers"));default:return c.a.createElement(c.a.Fragment,null,c.a.createElement("h3",null,"Profile"),c.a.createElement("section",{className:"tools"},u&&c.a.createElement(ie.a,{round:!0,color:"translucent",size:"smaller",ariaLabel:P("Edit"),onClick:y},c.a.createElement("i",{className:"icon-edit"}))))}}const F=b.k||A===$s.SharedMedia||A===$s.MemberList||s,D=Object(Z.a)("animated-close-icon",N&&"no-transition");return Object(c.n)(()=>{E.current.classList.toggle("state-back",F)},[F]),c.a.createElement("div",{className:"RightHeader"},c.a.createElement(ie.a,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:h,ariaLabel:P(F?"Common.Back":"Common.Close")},c.a.createElement("div",{ref:E,className:D})),c.a.createElement(se.a,{name:N?"none":"slide-fade",activeKey:L},R))})),zs=a(127);function Ks(e,t,a,s,r,o,i,l,d,b,u,m=0){const O="members"!==s&&r?r:s,j=Object(c.p)(()=>{if(o&&i)return Object(h.Fb)(o.map(({userId:e})=>e),i,void 0,m)},[o,m,i]),[g,f,p]=function(e,t,a,s){const[c,r]=Object(zs.a)(a?t:void 0,s,void 0,n.R),o=!c||!s||c[0]===s[0];return[c,r,!o]}(0,t,u,j),[I,v,y]=Qs("media",O,a,u,l,d),[C,w,E]=Qs("documents",O,a,u,l,d),[M,S,k]=Qs("links",O,a,u,l,d),[N,T,P]=Qs("audio",O,a,u,l,d);let A,x,L=!1;switch(O){case"members":A=g,x=f,L=p;break;case"media":A=I,x=v,L=y;break;case"documents":A=C,x=w,L=E;break;case"links":A=M,x=S,L=k;break;case"audio":A=N,x=T,L=P}return[O,A,x,L]}function Qs(e,t,a,s,r,o){const i=Object(c.q)();Object(ge.a)(()=>{t===e&&r&&o&&(i.current=Object(h.x)(r,o,e).reverse())},[r,o,t,e]);const[l,d]=Object(zs.a)(s?a:void 0,i.current,void 0,"media"===e?n.pb:n.X);return[l,d,!(!l||!i.current||l[0]===i.current[0])]}var Ys=a(58);const Js=Object(g.g)(e=>e(),250,!1);let Xs=!1;var Zs=a(112),en=a(105);var tn=a(132),an=a(191);a(244);var sn=Object(c.h)(({chat:e,user:t,photo:a,isFirstPhoto:s,isSavedMessages:n,lastSyncTime:r,onClick:o})=>{const l=Object(ce.a)(),d=t&&Object(h.qb)(t);function b(s="big",c){if(a&&!c)return`photo${a.id}?size=c`;let r;return n||d||(t?r=Object(h.f)(t,s):e&&(r=Object(h.f)(e,s))),r}const u=b(),m=Object(nt.a)(u,!1,i.ApiMediaFormat.BlobUrl,r),O=Object(nt.a)(!m&&s?b("normal",!0):void 0,!1,i.ApiMediaFormat.BlobUrl,r),j=Object(an.a)(!m&&a&&a.thumbnail&&a.thumbnail.dataUri),g=m||O||j,f=Object(ca.a)(g);let p="";if(n)p=c.a.createElement("i",{className:"icon-avatar-saved-messages"});else if(d)p=c.a.createElement("i",{className:"icon-avatar-deleted-account"});else if(g)p=c.a.createElement("img",{src:g,className:"avatar-media",alt:"",decoding:"async"});else if(!g&&t){const e=Object(h.ab)(t);p=e?Object(Je.c)(e,2):void 0}else if(!g&&e){const t=Object(h.l)(l,e);p=t&&Object(Je.c)(t,Object(h.mb)(e.id)?2:1)}else p=c.a.createElement("div",{className:"spinner-wrapper"},c.a.createElement(he.a,{color:"white"}));const I=Object(Z.a)("ProfilePhoto","color-bg-"+Object(h.Y)(t||e),n&&"saved-messages",d&&"deleted-account",!n&&!g&&"no-photo");return c.a.createElement("div",{className:I,onClick:g?o:void 0},f&&g&&f!==g&&c.a.createElement("img",{src:f,className:"prev-avatar-media",alt:"",decoding:"async"}),"string"==typeof p?Object(st.a)(p,["hq_emoji"]):p)});a(245);var nn=Object(c.h)(Object(s.h)((e,{userId:t,forceShowSelf:a})=>{const{lastSyncTime:s,serverTimeOffset:n}=e,c=Object(o.Hb)(e,t),r=Object(o.f)(e,t),i=!a&&c&&c.isSelf,{animationLevel:l}=e.settings.byKey;return{lastSyncTime:s,user:c,chat:r,isSavedMessages:i,animationLevel:l,serverTimeOffset:n}},(e,t)=>Object(d.l)(t,["loadFullUser","openMediaViewer"]))(({user:e,chat:t,isSavedMessages:a,lastSyncTime:s,animationLevel:n,loadFullUser:r,openMediaViewer:o,serverTimeOffset:d})=>{const{id:u}=e||{},{id:m}=t||{},O=e?Object(h.ab)(e):t?t.title:"",j=(e?e.photos:t?t.photos:void 0)||[],g=n>=1?"slide":"none",[f,p]=Object(c.r)(0),I=a||j.length<=1||0===f,v=a||j.length<=1||f===j.length-1;Object(c.n)(()=>{f>j.length&&p(Math.max(0,j.length-1))},[f,j.length]);const y=Object(ce.a)();Object(c.n)(()=>{s&&u&&r({userId:u})},[u,r,s]),function(e,t,a){Object(c.n)(()=>{t.slice(a,a+4).forEach(e=>{mt.c(`photo${e.id}?size=c`)||mt.b(`photo${e.id}?size=c`,i.ApiMediaFormat.BlobUrl)})},[a,t])}(0,j,f);const C=Object(c.m)(()=>{o({avatarOwnerId:u||m,profilePhotoIndex:f,origin:l.h.ProfileAvatar})},[o,u,m,f]),w=Object(c.m)(()=>{I||p(f-1)},[f,I]),E=Object(c.m)(()=>{v||p(f+1)},[f,v]);if(Object(c.n)(()=>{const e=document.querySelector(".profile-slide-container > .active, .profile-slide-container > .to");if(e)return Object(je.b)(e,{excludedClosestSelector:".navigation",onSwipe:b.m?(e,t)=>{t===je.a.Right?w():t===je.a.Left&&E()}:void 0})},[E,w]),!e&&!t)return;function M(){const s=!a&&j&&j.length>0?j[f]:void 0;return c.a.createElement(sn,{key:f,user:e,chat:t,photo:s,isSavedMessages:a,isFirstPhoto:I,onClick:C})}const S=e&&e.isVerified||t&&t.isVerified;return c.a.createElement("div",{className:"ProfileInfo",dir:y.isRtl?"rtl":void 0},c.a.createElement("div",{className:"photo-wrapper"},function(){if(!(a||!j||j.length<=1))return c.a.createElement("div",{className:"photo-dashes"},j.map((e,t)=>c.a.createElement("span",{className:"photo-dash "+(t===f?"current":"")})))}(),c.a.createElement(se.a,{activeKey:f,name:g,className:"profile-slide-container"},M),!I&&c.a.createElement("button",{type:"button",className:"navigation prev","aria-label":y("AccDescrPrevious"),onClick:w}),!v&&c.a.createElement("button",{type:"button",className:"navigation next","aria-label":y("Next"),onClick:E})),c.a.createElement("div",{className:"info",dir:y.isRtl?"rtl":"auto"},a?c.a.createElement("div",{className:"title"},c.a.createElement("h3",{dir:"auto"},y("SavedMessages"))):c.a.createElement("div",{className:"title"},c.a.createElement("h3",{dir:"auto"},O&&Object(st.a)(O)),S&&c.a.createElement(tn.a,null)),!a&&(e?c.a.createElement("div",{className:"status "+(Object(h.yb)(e)?"online":"")},c.a.createElement("span",{className:"user-status",dir:"auto"},Object(h.bb)(y,e,d))):c.a.createElement("span",{className:"status",dir:"auto"},Object(h.kb)(t)?y("Subscribers",t.membersCount,"i"):y("Members",t.membersCount,"i")))))}));var cn=Object(c.h)(Object(s.h)((e,{chatOrUserId:t})=>{const{lastSyncTime:a}=e,s=t?Object(o.f)(e,t):void 0,n=Object(h.mb)(t)?Object(o.Hb)(e,t):void 0,c=s&&Object(h.Db)(s,Object(o.eb)(e),Object(o.db)(e));return{lastSyncTime:a,chat:s,user:n,canInviteUsers:s&&(!Object(h.kb)(s)&&!Object(h.zb)(s,"inviteUsers")||Object(h.q)(s,"inviteUsers")),isMuted:c}},(e,t)=>Object(d.l)(t,["loadFullUser","updateChatMutedState","showNotification"]))(({lastSyncTime:e,user:t,chat:a,forceShowSelf:s,canInviteUsers:n,isMuted:r,loadFullUser:o,showNotification:i,updateChatMutedState:l})=>{const{id:d,fullInfo:b,username:u,phoneNumber:m,isSelf:O}=t||{},{id:j,username:g}=a||{},f=Object(ce.a)();Object(c.n)(()=>{e&&d&&o({userId:d})},[o,d,e]);const p=Object(c.m)(()=>{l({chatId:j,isMuted:!r})},[j,r,l]);if(!a||a.isRestricted||O&&!s)return;function I(e,t){Object(w.c)(e),i({message:t+" was copied"})}const v=m&&Object(ja.c)(m),y=Object(h.h)(a),C=0===y.indexOf("http")?y:"http://"+y,E=u||g,M=b&&b.bio||Object(h.g)(a);return c.a.createElement("div",{className:"ChatExtra"},v&&!!v.length&&c.a.createElement(en.a,{icon:"phone",multiline:!0,narrow:!0,ripple:!0,onClick:()=>I(v,f("Phone"))},c.a.createElement("span",{className:"title",dir:"auto"},v),c.a.createElement("span",{className:"subtitle"},f("Phone"))),E&&c.a.createElement(en.a,{icon:"mention",multiline:!0,narrow:!0,ripple:!0,onClick:()=>I("@"+E,f("Username"))},c.a.createElement("span",{className:"title",dir:"auto"},Object(st.a)(E)),c.a.createElement("span",{className:"subtitle"},f("Username"))),M&&!!M.length&&c.a.createElement(en.a,{icon:"info",multiline:!0,narrow:!0,isStatic:!0},c.a.createElement("span",{className:"title",dir:"auto"},Object(st.a)(M,["br","links","emoji"])),c.a.createElement("span",{className:"subtitle"},f(d?"UserBio":"Info"))),n&&!E&&!!y.length&&c.a.createElement(en.a,{icon:"mention",multiline:!0,narrow:!0,ripple:!0,onClick:()=>I(y,f("SetUrlPlaceholder"))},c.a.createElement("div",{className:"title"},c.a.createElement(Ma.a,{url:C,className:"title",text:y})),c.a.createElement("span",{className:"subtitle"},f("SetUrlPlaceholder"))),c.a.createElement(en.a,{icon:"unmute",ripple:!0,onClick:p},c.a.createElement("span",null,f("Notifications")),c.a.createElement(be,{id:"group-notifications",label:d?"Toggle User Notifications":"Toggle Chat Notifications",checked:!r,inactive:!0})))})),rn=a(165),on=a(185),ln=a(117);a(249);const dn=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"}];function bn(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > div.active > .${e}-list > .scroll-item`].join(", ")}var un=Object(c.h)(Object(s.h)((e,{chatId:t,userId:a})=>{const s=Object(o.f)(e,t),n=Object(o.m)(e,a||t),{currentType:c,resultsByType:r}=Object(o.v)(e)||{},{foundIds:i}=r&&c&&r[c]||{},{byId:l}=e.users,d=s&&Object(h.lb)(s),b=s&&Object(h.kb)(s),u=d||b&&Object(h.hb)(s),m=s&&s.fullInfo&&s.fullInfo.members,O=u&&s&&s.fullInfo&&!s.fullInfo.canViewMembers;let j;return a?j=a:Object(h.mb)(t)&&(j=t),{theme:Object(o.Bb)(e),isChannel:b,resolvedUserId:j,chatMessages:n,foundIds:i,mediaSearchType:c,hasMembersTab:u,areMembersHidden:O,...u&&m&&{members:m,usersById:l},isRightColumnShown:Object(o.W)(e),isRestricted:s&&s.isRestricted,lastSyncTime:e.lastSyncTime,serverTimeOffset:e.serverTimeOffset}},(e,t)=>Object(d.l)(t,["setLocalMediaSearchType","loadMoreMembers","searchMediaMessagesLocal","openMediaViewer","openAudioPlayer","openUserInfo","focusMessage","loadProfilePhotos"]))(({chatId:e,profileState:t,onProfileStateChange:a,theme:s,isChannel:r,resolvedUserId:o,chatMessages:d,foundIds:u,mediaSearchType:m,hasMembersTab:h,areMembersHidden:O,members:j,usersById:g,isRightColumnShown:f,isRestricted:p,lastSyncTime:I,setLocalMediaSearchType:v,loadMoreMembers:y,searchMediaMessagesLocal:C,openMediaViewer:w,openAudioPlayer:E,openUserInfo:M,focusMessage:S,loadProfilePhotos:k,serverTimeOffset:N})=>{const T=Object(c.q)(null),P=Object(c.q)(null),A=Object(ce.a)(),[x,L]=Object(c.r)(0),R=Object(c.p)(()=>[...h?[{type:"members",title:r?"ChannelSubscribers":"GroupMembers"}]:[],...dn],[h,r]),F=R[x].type,[D,B,H,U]=Ks(0,y,C,F,m,j,g,d,u,0,I,N),q=R.findIndex(({type:e})=>e===D),{handleScroll:G}=function(e,t,a,s){Object(Ys.a)(([a])=>{if(a&&a!==t){const a=e.current,n=a.querySelector(".TabList");a.scrollTop<n.offsetTop&&(s("members"===t?l.k.MemberList:l.k.SharedMedia),Xs=!0,Object(Ct.a)(a,n,"start",void 0,void 0,void 0,300),setTimeout(()=>{Xs=!1},350))}},[t,s]),Object(Ys.a)(([t])=>{if(a!==l.k.Profile||a===t)return;const n=e.current;if(!n)return;const c=n.querySelector(".TabList");!c||c.offsetTop>n.scrollTop||(Xs=!0,Object(Ct.a)(n,n.firstElementChild,"start",void 0,2*n.offsetHeight),setTimeout(()=>{Xs=!1},350),s(a))},[a]);const n=Object(c.m)(()=>{const a=e.current;if(!a)return;const n=a.querySelector(".TabList");if(!n)return;let c=l.k.Profile;a.scrollTop>=n.offsetTop&&(c="members"===t?l.k.MemberList:l.k.SharedMedia),s(c)},[e,s,t]);return Object(c.n)(()=>{Xs||n()},[n,t]),{handleScroll:Object(c.m)(()=>{Xs||Js(n)},[n])}}(T,F,t,a),{applyTransitionFix:_,releaseTransitionFix:V}=function(e,t=".Transition.shared-media-transition"){return Object(c.n)(()=>{function a(){const a=e.current,s=a.querySelector(t),n=a.querySelector(".TabList");s&&n&&(s.style.minHeight=a.offsetHeight-n.offsetHeight+"px")}return a(),window.addEventListener("resize",a,!1),()=>{window.removeEventListener("resize",a,!1)}},[e,t]),{applyTransitionFix:Object(c.m)(()=>{const t=e.current;if("hidden"!==t.style.overflowY){const e=t.offsetWidth-t.clientWidth;t.style.overflowY="hidden",t.style.marginRight=e+"px"}},[e]),releaseTransitionFix:Object(c.m)(()=>{const t=e.current;t.style.overflowY="scroll",t.style.marginRight="0"},[e])}}(T),[$,W]=(()=>{const[e,t]=Object(c.r)(!1);return[e,Object(c.m)(()=>{t(e=>!e)},[])]})(),z=Object(c.m)(()=>{V(),W()},[V,W]);Object(c.n)(()=>{v({mediaType:F})},[v,F]);const K=o||e;Object(c.n)(()=>{I&&k({profileId:K})},[k,K,I]);const Q=Object(c.m)(e=>{w({chatId:K,threadId:i.MAIN_THREAD_ID,messageId:e,origin:l.h.SharedMedia})},[K,w]),Y=Object(c.m)(e=>{E({chatId:K,messageId:e})},[K,E]),J=Object(c.m)(e=>{M({id:e})},[M]),X=Object(c.m)(e=>{S({chatId:K,messageId:e})},[K,S]);let Z;Object(c.n)(()=>{if(P.current&&b.m)return Object(je.b)(P.current,{onSwipe:(e,t)=>{t===je.a.Left?L(Math.min(x+1,R.length-1)):t===je.a.Right&&L(Math.max(0,x-1))}})},[x,R.length]);const ee="members"===D||!h&&"media"===D;ee?Z=f?0:1e3:B||(Z=n.qb);const te=Object(Es.a)([e,D],Z);function ae(){if(!B||!te||!d){const e=ee&&B&&!te;return c.a.createElement("div",{className:"content empty-list"},!e&&c.a.createElement(he.a,null))}if(!B.length){let e;switch(D){case"members":e=O?"You have no access to group members list.":"No members found";break;case"documents":e=A("lng_media_file_empty_search");break;case"links":e=A("lng_media_link_empty_search");break;case"audio":e=A("lng_media_song_empty_search");break;default:e=A("SharedMedia.EmptyTitle")}return c.a.createElement("div",{className:"content empty-list"},c.a.createElement(ln.a,{text:e}))}return c.a.createElement("div",{className:`content ${D}-list`,dir:A.isRtl&&"media"===D?"rtl":void 0,teactFastList:!0},"media"===D?B.map(e=>d[e]&&c.a.createElement(rn.a,{key:e,message:d[e],onClick:Q})):"documents"===D?B.map(e=>d[e]&&c.a.createElement(zt.a,{key:e,message:d[e],withDate:!0,smaller:!0,className:"scroll-item",onDateClick:X})):"links"===D?B.map(e=>d[e]&&c.a.createElement(on.a,{key:e,message:d[e],onMessageClick:X})):"audio"===D?B.map(e=>d[e]&&c.a.createElement(Kt.a,{key:e,theme:s,message:d[e],target:"sharedMedia",date:d[e].date,lastSyncTime:I,className:"scroll-item",onPlay:Y,onDateClick:X})):"members"===D?B.map((e,t)=>c.a.createElement(en.a,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>J(e)},c.a.createElement(Xe.a,{userId:e,forceShowSelf:!0}))):void 0)}return c.a.createElement(Zs.a,{ref:T,className:"Profile custom-scroll",itemSelector:bn(D),items:te?B:void 0,cacheBuster:$,sensitiveArea:n.fb,preloadBackwards:te?"members"===D?n.R:n.pb:0,noScrollRestoreOnTop:!0,noFastList:!0,onLoadMore:H,onScroll:G},!U&&function(e,t){return c.a.createElement("div",{className:"profile-info"},c.a.createElement(nn,{userId:t||e,forceShowSelf:t!==e}),c.a.createElement(cn,{chatOrUserId:t||e,forceShowSelf:t!==e}))}(e,o),!p&&c.a.createElement("div",{className:"shared-media"},c.a.createElement(se.a,{ref:P,name:A.isRtl?"slide-reversed":"slide",activeKey:q,renderCount:R.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:_,onStop:z},ae),c.a.createElement(Ie.a,{big:!0,activeTab:x,tabs:R,onSwitchTab:L})))}));var mn=Object(c.h)(e=>{const t=Object(we.a)(Ce.a.Extra,"RightSearch");return t?c.a.createElement(t,e):c.a.createElement(Ee.a,null)});var hn=Object(c.h)(e=>{const t=Object(we.a)(Ce.a.Extra,"Management");return t?c.a.createElement(t,e):c.a.createElement(Ee.a,null)});var On=Object(c.h)(()=>{const e=Object(we.a)(Ce.a.Extra,"StickerSearch");return e?c.a.createElement(e,null):c.a.createElement(Ee.a,null)});var jn=Object(c.h)(()=>{const e=Object(we.a)(Ce.a.Extra,"GifSearch");return e?c.a.createElement(e,null):c.a.createElement(Ee.a,null)});var gn=Object(c.h)(()=>{const e=Object(we.a)(Ce.a.Extra,"PollResults");return e?c.a.createElement(e,null):c.a.createElement(Ee.a,null)});a(250);const fn=Object.keys(l.l).length/2,pn=Object.keys(l.g).length/2;function In(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}var vn=Object(c.h)(Object(s.h)(e=>{const{chatId:t,threadId:a}=Object(o.y)(e)||{},s=Object(o.d)(e);return{contentKey:Object(o.nb)(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}=$e(),[g,f]=Object(c.r)(l.k.Profile),[p,I]=Object(c.r)(l.g.Initial),[v,y]=Object(c.r)(),[C,w]=Object(c.r)(),E=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,T=e===l.l.StickerSearch,P=e===l.l.GifSearch,A=e===l.l.PollResults,x=j<=n.ab,[L,R]=Object(c.r)(!M),F=null!==(O=Object(Ye.a)(e,!0,!r))&&void 0!==O?O:-1,D=Object(c.m)(()=>{switch(e){case l.l.ChatInfo:if(E){f(l.k.Profile);break}o();break;case l.l.UserInfo:if(E){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),w(void 0);break;case l.g.ChatAdminRights:case l.g.GroupRecentActions:I(l.g.ChatAdministrators)}break;case l.l.Search:In(),b();break;case l.l.StickerSearch:case l.l.GifSearch:In(),u({query:void 0}),m({query:void 0});break;case l.l.PollResults:h()}},[e,E,o,d,h,p,i,b,u,m]),B=Object(c.m)((e,t)=>{y(e),w(t)},[]);function H(){if(-1!==F)switch(F){case l.l.ChatInfo:case l.l.UserInfo:return c.a.createElement(un,{key:s||t,chatId:t,userId:s,profileState:g,onProfileStateChange:f});case l.l.Search:return c.a.createElement(mn,{chatId:t,threadId:a});case l.l.Management:return c.a.createElement(hn,{chatId:t,currentScreen:p,isPromotedByCurrentUser:C,selectedChatMemberId:v,onScreenSelect:I,onChatMemberSelect:B});case l.l.StickerSearch:return c.a.createElement(On,null);case l.l.GifSearch:return c.a.createElement(jn,null);case l.l.PollResults:return c.a.createElement(gn,null)}}return Object(c.n)(()=>M?Object(ae.a)(D):void 0,[M,D]),Object(c.n)(()=>{setTimeout(()=>{R(!M)},300)},[M]),Object(c.n)(()=>{M&&x&&D()},[x]),Object(gt.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]),c.a.createElement("div",{id:"RightColumn-wrapper",className:r?void 0:"is-hidden"},x&&c.a.createElement("div",{className:"overlay-backdrop",onClick:D}),c.a.createElement("div",{id:"RightColumn"},c.a.createElement(Ws,{chatId:t,isColumnOpen:M,isProfile:S,isSearch:k,isManagement:N,isStickerSearch:T,isGifSearch:P,isPollResults:A,profileState:g,managementScreen:p,onClose:D}),c.a.createElement(se.a,{name:L?"none":"zoom-fade",renderCount:fn+pn,activeKey:N?fn+p:F,shouldCleanup:!0,cleanupExceptionKey:l.l.ChatInfo},H)))}));var yn=Object(c.h)(({isOpen:e})=>{const t=Object(we.a)(Ce.a.Extra,"MediaViewer",!e);return t?c.a.createElement(t,null):void 0});var Cn=Object(c.h)(({isOpen:e})=>{const t=Object(we.a)(Ce.a.Extra,"Notifications",!e);return t?c.a.createElement(t,null):void 0});var wn=Object(c.h)(({isOpen:e})=>{const t=Object(we.a)(Ce.a.Extra,"Errors",!e);return t?c.a.createElement(t,null):void 0});var En=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(we.a)(Ce.a.Extra,"ForwardPicker",!t);return a?c.a.createElement(a,e):void 0});var Mn=Object(c.h)(e=>{const{url:t}=e,a=Object(we.a)(Ce.a.Extra,"SafeLinkModal",!t);return a?c.a.createElement(a,e):void 0});var Sn=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(we.a)(Ce.a.Extra,"HistoryCalendar",!t);return a?c.a.createElement(a,e):void 0});a(251);let kn,Nn,Tn=!1;function Pn(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 An=Object(c.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.W)(e),isMediaViewerOpen:Object(o.T)(e),isForwardModalOpen:Object(o.R)(e),hasNotifications:Boolean(e.notifications.length),hasErrors:Boolean(e.errors.length),audioMessage:s,safeLinkModalUrl:e.safeLinkModalUrl,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt)}},(e,t)=>Object(d.l)(t,["loadAnimatedEmojis","loadNotificationSettings","loadNotificationExceptions","updateIsOnline"]))(({lastSyncTime:e,isLeftColumnShown:t,isRightColumnShown:a,isMediaViewerOpen:r,isForwardModalOpen:i,animationLevel:l,hasNotifications:d,hasErrors:b,audioMessage:u,safeLinkModalUrl:m,isHistoryCalendarOpen:h,loadAnimatedEmojis:O,loadNotificationSettings:j,loadNotificationExceptions:g,updateIsOnline:f})=>{n.p&&!Tn&&(Tn=!0,console.log(">>> RENDER MAIN")),Object(c.n)(()=>{e&&(f(!0),O(),j(),g())},[e,O,g,j,f]);const{transitionClassNames:p}=Object(ee.a)(!t,void 0,!0),{transitionClassNames:I}=Object(ee.a)(a,void 0,!0),v=Object(Z.a)(p.replace(/([\w-]+)/g,"middle-column-$1"),I.replace(/([\w-]+)/g,"right-column-$1"));function y(e){e.preventDefault(),e.stopPropagation()}return Object(c.n)(()=>{document.body.classList.toggle("is-middle-column-open",v.includes("middle-column-open")),document.body.classList.toggle("is-right-column-shown",v.includes("right-column-open"))},[v]),Object(c.n)(()=>{l>0&&(document.body.classList.add("animating-right-column"),Object(X.b)(350+n.c),kn&&(clearTimeout(kn),kn=void 0),kn=window.setTimeout(()=>{document.body.classList.remove("animating-right-column"),kn=void 0},350+n.c))},[l,a]),Object(te.a)(()=>{f(!1)},()=>{f(!0)}),Object(c.n)(()=>{function e(){f(!1)}return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}},[f]),Object(te.a)(()=>{const e=Object(o.q)(Object(s.e)());let t=0;clearInterval(Nn),Nn=window.setInterval(()=>{if(document.title.includes(n.D))Pn(!1);else{if(t%2==0){const t=Object(o.q)(Object(s.e)())-e;t>0&&(document.title=`${t} notification${t>1?"s":""}`,Pn(!0))}else document.title=n.eb,Pn(!1);t++}},1e3)},()=>{clearInterval(Nn),Nn=void 0,document.title.includes(n.D)||(document.title=n.eb),Pn(!1)}),c.a.createElement("div",{id:"Main",className:v,onDrop:y,onDragOver:y},c.a.createElement(Ue,null),c.a.createElement(_s,null),c.a.createElement(vn,null),c.a.createElement(yn,{isOpen:r}),c.a.createElement(En,{isOpen:i}),c.a.createElement(Cn,{isOpen:d}),c.a.createElement(wn,{isOpen:b}),u&&c.a.createElement(Ot,{key:u.id,message:u,noUi:!0}),c.a.createElement(Mn,{url:m}),c.a.createElement(Sn,{isOpen:h}))}));n.p&&console.log(">>> FINISH LOAD MAIN BUNDLE"),Object(s.e)().connectionState||Object(s.d)().initApi()},197:function(e,t,a){},198:function(e,t,a){},199:function(e,t,a){},210:function(e,t,a){},211:function(e,t,a){},212:function(e,t,a){},215:function(e,t,a){},216:function(e,t,a){},217:function(e,t,a){},221:function(e,t,a){},222:function(e,t,a){},224:function(e,t,a){},227:function(e,t,a){},228:function(e,t,a){},229:function(e,t,a){},230:function(e,t,a){},231:function(e,t,a){},232:function(e,t,a){},233:function(e,t,a){},234:function(e,t,a){},235:function(e,t,a){},236:function(e,t,a){},237:function(e,t,a){},239:function(e,t,a){},240:function(e,t,a){},241:function(e,t,a){},242:function(e,t,a){},243:function(e,t,a){},244:function(e,t,a){},245:function(e,t,a){},249:function(e,t,a){},250:function(e,t,a){},251:function(e,t,a){}}]);
|
||
//# sourceMappingURL=4.8ca91ae430fe16b85e8a.js.map
|