(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{103:function(e,t,a){"use strict";a.r(t),a.d(t,"Main",(function(){return ec}));var s=a(2),n=a(1),c=a(0),o=(a(85),a(35)),r=a(7),i=a(50),l=a(4);function d(e){const{chatId:t,threadId:a}=Object(r.z)(e)||{};return t&&a?(e=Object(o.Z)(e,t,a,!1),e=Object(o.u)(e,t,a,void 0)):e}Object(s.b)("openLocalTextSearch",e=>{const{chatId:t,threadId:a}=Object(r.z)(e)||{};if(t&&a)return Object(o.Z)(e,t,a,!0)}),Object(s.b)("closeLocalTextSearch",d),Object(s.b)("setLocalTextSearchQuery",(e,t,a)=>{const{chatId:s,threadId:n}=Object(r.z)(e)||{};if(!s||!n)return;const{query:c}=a,d=Object(l.a)(s,n),{query:b}=e.localTextSearch.byChatThreadKey[d]||{};return c!==b&&(e=Object(o.u)(e,s,n,i.a)),e=Object(o.Z)(e,s,n,!0,c)}),Object(s.b)("setLocalMediaSearchType",(e,t,a)=>{const{chatId:s}=Object(r.z)(e)||{};if(!s)return;const{mediaType:n}=a;return Object(o.Y)(e,s,n)}),Object(s.b)("openChat",(e,t,a)=>{const{id:n,threadId:c=-1,type:i="thread"}=a,l=Object(r.z)(e);return l&&l.chatId===n&&l.threadId===c&&l.type===i||(e=Object(o.y)(e,n,c,"replyStack",[]),e=d(e=Object(o.o)(e)),e={...e,messages:{...e.messages,contentToBeScheduled:void 0},...n!==e.forwardMessages.toChatId&&{forwardMessages:{}}},Object(s.g)(e)),Object(o.O)(e,n,c,i)}),Object(s.b)("openChatWithInfo",(e,t,a)=>{Object(s.g)({...e,isChatInfoShown:!0}),t.openChat(a)}),Object(s.b)("resetChatCreation",e=>({...e,chatCreation:void 0})),Object(s.b)("setNewChatMembersDialogState",(e,t,a)=>({...e,newChatMembersProgress:a})),Object(s.b)("openNextChat",(e,t,a)=>{const{targetIndexDelta:s,orderedIds:n}=a,{chatId:c}=Object(r.z)(e)||{};if(!c)return void t.openChat({id:n[0]});const o=n.indexOf(c);if(-1===o)return;const i=n[o+s];t.openChat({id:i})});var b=a(6),u=a(13),m=a(5),h=a(3);const O=n.A+n.c;let j;Object(s.b)("setScrollOffset",(e,t,a)=>{const{chatId:s,threadId:n,scrollOffset:c}=a;return Object(o.y)(e,s,n,"scrollOffset",c)}),Object(s.b)("setReplyingToId",(e,t,a)=>{const{messageId:s}=a,n=Object(r.z)(e);if(!n)return;const{chatId:c,threadId:i}=n;return Object(o.y)(e,c,i,"replyingToId",s)}),Object(s.b)("setEditingId",(e,t,a)=>{const{messageId:s}=a,n=Object(r.z)(e);if(!n)return;const{chatId:c,threadId:i,type:l}=n,d="scheduled"===l?"editingScheduledId":"editingId";return Object(o.y)(e,c,i,d,s)}),Object(s.b)("editLastMessage",e=>{const{chatId:t,threadId:a}=Object(r.z)(e)||{};if(!t||!a)return;const s=Object(r.n)(e,t),n=Object(r.Jb)(e,t,a);if(!s||!n)return;const c=Object(h.g)(n,t=>Boolean(s[t]&&Object(r.b)(e,s[t],a).canEdit));return c?Object(o.y)(e,t,a,"editingId",c):void 0}),Object(s.b)("replyToNextMessage",(e,t,a)=>{const{targetIndexDelta:s}=a,{chatId:n,threadId:c}=Object(r.z)(e)||{};if(!n||!c)return;const o=Object(r.n)(e,n),i=Object(r.Jb)(e,n,c);if(!o||!i)return;const l=Object(r.nb)(e,n,c);let d;if(Object(r.X)(e,n,c)&&l){const e=Object.keys(o),t=e.indexOf(l.toString())+s;d=t<=e.length+1&&t>=0?Number(e[t]):void 0}else if(c===b.MAIN_THREAD_ID){const t=Object(r.g)(e,n);d=t&&t.lastMessage?t.lastMessage.id:void 0}else{const t=Object(r.Eb)(e,n,c);d=t?t.lastMessageId:void 0}t.setReplyingToId({messageId:d}),t.focusMessage({chatId:n,threadId:c,messageId:d})}),Object(s.b)("openMediaViewer",(e,t,a)=>{const{chatId:s,threadId:n,messageId:c,avatarOwnerId:o,profilePhotoIndex:r,origin:i}=a;return{...e,mediaViewer:{chatId:s,threadId:n,messageId:c,avatarOwnerId:o,profilePhotoIndex:r,origin:i},forwardMessages:{}}}),Object(s.b)("closeMediaViewer",e=>({...e,mediaViewer:{}})),Object(s.b)("openAudioPlayer",(e,t,a)=>{const{chatId:s,threadId:n,messageId:c}=a;return{...e,audioPlayer:{chatId:s,threadId:n,messageId:c}}}),Object(s.b)("closeAudioPlayer",e=>({...e,audioPlayer:{}})),Object(s.b)("openPollResults",(e,t,a)=>{const{chatId:n,messageId:c}=a;Object(r.W)(e)?n===e.pollResults.chatId&&c===e.pollResults.messageId||Object(s.g)({...e,pollResults:{chatId:n,messageId:c,voters:{}}}):window.setTimeout(()=>{const e=Object(s.e)();Object(s.g)({...e,pollResults:{chatId:n,messageId:c,voters:{}}})},450)}),Object(s.b)("closePollResults",e=>{Object(s.g)({...e,pollResults:{}})}),Object(s.b)("focusLastMessage",(e,t)=>{const a=Object(r.z)(e);if(!a)return;const{chatId:s,threadId:n}=a;let c;if(n===b.MAIN_THREAD_ID){const t=Object(r.g)(e,s);c=t&&t.lastMessage?t.lastMessage.id:void 0}else{const t=Object(r.Eb)(e,s,n);c=t?t.lastMessageId:void 0}c&&t.focusMessage({chatId:s,threadId:n,messageId:c,noHighlight:!0})}),Object(s.b)("focusNextReply",(e,t)=>{const a=Object(r.z)(e);if(!a)return;const{chatId:n,threadId:c}=a,i=Object(r.mb)(e,n,c);if(i&&0!==i.length){const a=i.pop();e=Object(o.y)(e,n,c,"replyStack",[...i]),Object(s.g)(e),t.focusMessage({chatId:n,threadId:c,messageId:a})}else t.focusLastMessage()}),Object(s.b)("focusMessage",(e,t,a)=>{const{chatId:n,threadId:c=b.MAIN_THREAD_ID,messageListType:i="thread",noHighlight:l,groupedId:d,groupedChatId:m,replyMessageId:h}=a;let{messageId:g}=a;if(void 0!==d){const t=Object(r.J)(e,m,d);t&&t.length&&([g]=t)}const f=Object(r.z)(e),p=!f||n!==f.chatId||c!==f.threadId||i!==f.type;if(j&&(clearTimeout(j),j=void 0),j=window.setTimeout(()=>{let e=Object(s.e)();e=Object(o.Q)(e),e=Object(o.P)(e),Object(s.g)(e)},l?O:1500),e=Object(o.Q)(e,n,g,l),e=Object(o.P)(e,void 0),h){const t=Object(r.mb)(e,n,c)||[];e=Object(o.y)(e,n,c,"replyStack",[...t,h])}p&&(e=Object(o.P)(e,u.b.Static));const I=Object(r.Jb)(e,n,c);if(I&&I.includes(g))return Object(s.g)(e),void t.openChat({id:n,threadId:c});if(p&&(e=Object(o.y)(e,n,c,"viewportIds",void 0)),e=Object(o.y)(e,n,c,"outlyingIds",void 0),I&&!p){const t=g>I[0]?u.b.Down:u.b.Up;e=Object(o.P)(e,t)}Object(s.g)(e),t.openChat({id:n,threadId:c}),t.loadViewportMessages()}),Object(s.b)("openForwardMenu",(e,t,a)=>{const{fromChatId:s,messageIds:n,groupedId:c}=a;let o;return c&&(o=Object(r.ab)(e,s,c)),{...e,forwardMessages:{fromChatId:s,messageIds:o||n,isModalShown:!0}}}),Object(s.b)("exitForwardMode",e=>{Object(s.g)({...e,forwardMessages:{}})}),Object(s.b)("setForwardChatId",(e,t,a)=>{const{id:n}=a;Object(s.g)({...e,forwardMessages:{...e.forwardMessages,toChatId:n,isModalShown:!1}}),t.openChat({id:n}),t.closeMediaViewer(),t.exitMessageSelectMode()}),Object(s.b)("openForwardMenuForSelectedMessages",(e,t)=>{if(!e.selectedMessages)return;const{chatId:a,messageIds:s}=e.selectedMessages;t.openForwardMenu({fromChatId:a,messageIds:s})}),Object(s.b)("enterMessageSelectMode",(e,t,a)=>{const{messageId:s}=a||{},n=Object(r.s)(e);return n?Object(o.n)(e,n.id,s):e}),Object(s.b)("toggleMessageSelection",(e,t,a)=>{const{messageId:n,groupedId:c,childMessageIds:i,withShift:l}=a,d=Object(r.z)(e);if(!d)return;const{chatId:b,threadId:u,type:h}=d;e=Object(o.H)(e,b,u,h,n,c,i,l),Object(s.g)(e),e.shouldShowContextMenuHint&&(t.disableContextMenuHint(),t.showNotification({message:`To **edit** or **reply**, close this menu. Then ${m.n?"long tap":"right click"} on a message.`}))}),Object(s.b)("disableContextMenuHint",e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}}),Object(s.b)("exitMessageSelectMode",o.o),Object(s.b)("openPollModal",e=>({...e,isPollModalOpen:!0})),Object(s.b)("closePollModal",e=>({...e,isPollModalOpen:!1}));Object(s.b)("setGlobalSearchQuery",(e,t,a)=>{const{query:s}=a,{chatId:n}=e.globalSearch;return Object(o.S)(e,{globalResults:{},localResults:{},resultsByType:void 0,...s?{fetchingStatus:{chats:!n,messages:!0}}:{fetchingStatus:void 0},query:s})}),Object(s.b)("addRecentlyFoundChatId",(e,t,a)=>{const{id:s}=a,{recentlyFoundChatIds:n}=e.globalSearch;if(!n)return Object(o.S)(e,{recentlyFoundChatIds:[s]});const c=n.filter(e=>e!==s);return c.unshift(s),c.length>10&&c.pop(),Object(o.S)(e,{recentlyFoundChatIds:c})}),Object(s.b)("clearRecentlyFoundChats",e=>Object(o.S)(e,{recentlyFoundChatIds:void 0})),Object(s.b)("setGlobalSearchContent",(e,t,a)=>{const{content:s}=a;return Object(o.T)(e,s)}),Object(s.b)("setGlobalSearchChatId",(e,t,a)=>{const{id:s}=a;return Object(o.S)(e,{chatId:s,query:void 0,resultsByType:void 0})}),Object(s.b)("setStickerSearchQuery",(e,t,a)=>{const{query:s}=a;return{...e,stickers:{...e.stickers,search:{query:s,resultIds:void 0}}}}),Object(s.b)("setGifSearchQuery",(e,t,a)=>{const{query:s}=a;return{...e,gifs:{...e.gifs,search:{query:s,offsetId:void 0,results:void 0}}}}),Object(s.b)("openUserInfo",(e,t,a)=>{const{id:s}=a;t.openChat({id:s})});Object(s.b)("openChat",e=>Object(o.gb)(e,void 0)),Object(s.b)("setUserSearchQuery",(e,t,a)=>{const{query:s}=a;return Object(o.pb)(e,{globalUserIds:void 0,localUserIds:void 0,fetchingStatus:Boolean(s),query:s})}),Object(s.b)("setSettingOption",(e,t,a)=>Object(o.w)(e,a)),Object(s.b)("setThemeSettings",(e,t,a)=>{const{theme:s,...n}=a;return Object(o.x)(e,s,n)});var g=a(172);Object(s.b)("toggleChatInfo",e=>({...e,isChatInfoShown:!e.isChatInfoShown})),Object(s.b)("toggleManagement",e=>{const{chatId:t}=Object(r.z)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!(e.management.byChatId[t]||{}).isActive}}}}}),Object(s.b)("closeManagement",e=>{const{chatId:t}=Object(r.z)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!1}}}}}),Object(s.b)("openChat",(e,t,a)=>{if(!m.l&&!m.m)return;const{id:s}=a;return{...e,isLeftColumnShown:void 0===s}}),Object(s.b)("toggleLeftColumn",e=>({...e,isLeftColumnShown:!e.isLeftColumnShown})),Object(s.b)("addRecentEmoji",(e,t,a)=>{const{emoji:s}=a,{recentEmojis:n}=e;if(!n)return{...e,recentEmojis:[s]};const c=n.filter(e=>e!==s);return c.unshift(s),c.length>18&&c.pop(),{...e,recentEmojis:c}}),Object(s.b)("addRecentSticker",(e,t,a)=>{const{sticker:s}=a,{recent:n}=e.stickers;if(!n)return{...e,stickers:{...e.stickers,recent:{hash:0,stickers:[s]}}};const c=n.stickers.filter(e=>e.id!==s.id);return c.unshift(s),{...e,stickers:{...e.stickers,recent:{...n,stickers:c}}}}),Object(s.b)("showNotification",(e,t,a)=>{const s=a,n=[...e.notifications],c=n.findIndex(e=>e.message===s.message);return-1!==c&&n.splice(c,1),n.push(s),{...e,notifications:n}}),Object(s.b)("dismissNotification",e=>{const t=[...e.notifications];return t.pop(),{...e,notifications:t}}),Object(s.b)("showDialog",(e,t,a)=>{const{data:s}=a;if("message"in s&&s.hasErrorKey&&!Object(g.a)(s))return e;const n=[...e.dialogs];if("message"in s){const e=n.findIndex(e=>e.message===s.message);-1!==e&&n.splice(e,1)}return n.push(s),{...e,dialogs:n}}),Object(s.b)("dismissDialog",e=>{const t=[...e.dialogs];return t.pop(),{...e,dialogs:t}}),Object(s.b)("toggleSafeLinkModal",(e,t,a)=>{const{url:s}=a;return{...e,safeLinkModalUrl:s}}),Object(s.b)("openHistoryCalendar",(e,t,a)=>{const{selectedAt:s}=a;return{...e,historyCalendarSelectedAt:s}}),Object(s.b)("closeHistoryCalendar",e=>({...e,historyCalendarSelectedAt:void 0})),Object(s.b)("openPaymentModal",(e,t,a)=>{const{messageId:s}=a;return{...e,payment:{...e.payment,messageId:s,isPaymentModalOpen:!0}}}),Object(s.b)("closePaymentModal",e=>{const t=Object(o.i)(e);return Object(o.j)(t)});a(86);var f=a(10),p=a(9);const I=Object(p.h)(e=>e(),1e3,!0),v=Object(p.h)(e=>e(),3e3,!0),y=Object(p.a)(e=>e(),500,!1,!0);async function C(e,t,a){const c=await Object(f.a)("fetchChats",{limit:n.l,offsetDate:a,archived:"archived"===e,withPinned:void 0===Object(s.e)().chats.orderedPinnedIds[e],serverTimeOffset:Object(s.e)().serverTimeOffset});if(!c)return;const{chatIds:r}=c;r.length>0&&r[0]===t&&r.shift();let i=Object(s.e)();i=Object(o.g)(i,Object(h.c)(c.users,"id")),i=Object(o.N)(i,Object(h.c)(c.chats,"id")),i=Object(o.J)(i,e,r),i=Object(o.K)(i,e,c),Object.keys(c.draftsById).map(Number).forEach(e=>{i=Object(o.y)(i,e,b.MAIN_THREAD_ID,"draft",c.draftsById[e])}),Object.keys(c.replyingToById).map(Number).forEach(e=>{i=Object(o.y)(i,e,b.MAIN_THREAD_ID,"replyingToId",c.replyingToById[e])}),0!==r.length||i.chats.isFullyLoaded[e]||(i={...i,chats:{...i.chats,isFullyLoaded:{...i.chats.isFullyLoaded,[e]:!0}}}),Object(s.g)(i)}async function w(e){const t=await Object(f.a)("fetchFullChat",e);if(!t)return;const{users:a,fullInfo:n}=t;let c=Object(s.e)();a&&(c=Object(o.g)(c,Object(h.c)(a,"id"))),c=Object(o.I)(c,e.id,{fullInfo:n}),Object(s.g)(c)}async function E(e,t,a){const n=Object(s.e)(),c=Object(r.i)(n,t);if(c&&!c.isMin)return void(a?e.focusMessage({chatId:c.id,messageId:a}):e.openChat({id:c.id}));const i=Object(r.s)(n);e.openChat({id:-1});const l=await Object(f.a)("getChatByUsername",t);if(!l)return i&&e.openChat({id:i.id}),void e.showNotification({message:"User does not exist"});Object(s.g)(Object(o.I)(Object(s.e)(),l.id,l)),a?e.focusMessage({chatId:l.id,messageId:a}):e.openChat({id:l.id})}Object(s.b)("preloadTopChatMessages",(e,t)=>{(async()=>{const a=[];for(let c=0;ce!==i&&!a.includes(e));if(!m)return;a.push(m.id),t.loadViewportMessages({chatId:m.id,threadId:b.MAIN_THREAD_ID})}})()}),Object(s.b)("openChat",(e,t,a)=>{const{id:s,threadId:n}=a,{currentUserId:c}=e,o=Object(r.g)(e,s);if(o&&o.hasUnreadMark&&t.toggleChatUnread({id:s}),o)Object(l.pb)(o)&&!o.isMin&&t.requestChatUpdate({chatId:s});else if(s===c)Object(f.a)("fetchChat",{type:"self"});else{const t=Object(r.Ib)(e,s);t&&Object(f.a)("fetchChat",{type:"user",user:t})}if(n!==b.MAIN_THREAD_ID){Object(r.Gb)(e,s,n)||t.requestThreadInfoUpdate({chatId:s,threadId:n})}}),Object(s.b)("openSupportChat",(e,t)=>{const a=Object(r.Bb)(e);t.openChat({id:a?a.id:-1}),a||(async()=>{const e=await Object(f.a)("fetchChat",{type:"support"});e&&t.openChat({id:e.chatId})})()}),Object(s.b)("openTipsChat",(e,t)=>{t.openChatByUsername({username:n.Kb})}),Object(s.b)("loadMoreChats",(e,t,a)=>{const{listType:s="active"}=a,n=e.chats.listIds[s];if(e.chats.isFullyLoaded[s])return;const c=n?n.map(t=>e.chats.byId[t]).filter(t=>Boolean(t&&t.lastMessage)&&!Object(r.N)(e,t.id)).sort((e,t)=>e.lastMessage.date-t.lastMessage.date)[0]:void 0;I(c?()=>C(s,c.id,c.lastMessage.date):()=>C(s))}),Object(s.b)("loadFullChat",(e,t,a)=>{const{chatId:s,force:n}=a,c=Object(r.g)(e,s);c&&(n?w(c):y(()=>w(c)))}),Object(s.b)("loadTopChats",()=>{v(()=>C("active"))}),Object(s.b)("requestChatUpdate",(e,t,a)=>{const{serverTimeOffset:s}=e,{chatId:n}=a,c=Object(r.g)(e,n);c&&Object(f.a)("requestChatUpdate",{chat:c,serverTimeOffset:s})}),Object(s.b)("updateChatMutedState",(e,t,a)=>{const{serverTimeOffset:n}=e,{chatId:c,isMuted:i}=a,l=Object(r.g)(e,c);l&&(Object(s.g)(Object(o.I)(e,c,{isMuted:i})),Object(f.a)("updateChatMutedState",{chat:l,isMuted:i,serverTimeOffset:n}))}),Object(s.b)("createChannel",(e,t,a)=>{const{title:n,about:c,photo:i,memberIds:l}=a;!async function(e,t,a,n){Object(s.g)({...Object(s.e)(),chatCreation:{progress:u.a.InProgress}});const c=await Object(f.a)("createChannel",{title:e,about:a,users:t});if(!c)return;const{id:r,accessHash:i}=c;let l=Object(s.e)();l=Object(o.I)(l,r,c),l={...l,chatCreation:{...l.chatCreation,progress:c?u.a.Complete:u.a.Error}},Object(s.g)(l),Object(s.d)().openChat({id:r}),r&&i&&n&&await Object(f.a)("editChatPhoto",{chatId:r,accessHash:i,photo:n})}(n,l.map(t=>Object(r.Ib)(e,t)).filter(Boolean),c,i)}),Object(s.b)("joinChannel",(e,t,a)=>{const{chatId:s}=a,n=Object(r.g)(e,s);if(!n)return;const{id:c,accessHash:o}=n;c&&o&&Object(f.a)("joinChannel",{channelId:c,accessHash:o})}),Object(s.b)("deleteChatUser",(e,t,a)=>{(async()=>{const{chatId:s,userId:n}=a,c=Object(r.g)(e,s),o=Object(r.Ib)(e,n);if(!c||!o)return;await Object(f.a)("deleteChatUser",{chat:c,user:o});const i=Object(r.z)(e);i&&i.chatId===s&&e.currentUserId===n&&t.openChat({id:void 0})})()}),Object(s.b)("deleteChat",(e,t,a)=>{(async()=>{const{chatId:s}=a,n=Object(r.g)(e,s);if(!n)return;await Object(f.a)("deleteChat",{chatId:n.id});const c=Object(r.z)(e);c&&c.chatId===s&&t.openChat({id:void 0})})()}),Object(s.b)("leaveChannel",(e,t,a)=>{(async()=>{const{chatId:s}=a,n=Object(r.g)(e,s);if(!n)return;const{id:c,accessHash:o}=n;c&&o&&await Object(f.a)("leaveChannel",{channelId:c,accessHash:o});const i=Object(r.z)(e);i&&i.chatId===s&&t.openChat({id:void 0})})()}),Object(s.b)("deleteChannel",(e,t,a)=>{(async()=>{const{chatId:s}=a,n=Object(r.g)(e,s);if(!n)return;const{id:c,accessHash:o}=n;c&&o&&await Object(f.a)("deleteChannel",{channelId:c,accessHash:o});const i=Object(r.z)(e);i&&i.chatId===s&&t.openChat({id:void 0})})()}),Object(s.b)("createGroupChat",(e,t,a)=>{const{title:n,memberIds:c,photo:i}=a;!async function(e,t,a){Object(s.g)({...Object(s.e)(),chatCreation:{progress:u.a.InProgress}});const n=await Object(f.a)("createGroupChat",{title:e,users:t});if(!n)return;const{id:c}=n;let r=Object(s.e)();r=Object(o.I)(r,c,n),r={...r,chatCreation:{...r.chatCreation,progress:n?u.a.Complete:u.a.Error}},Object(s.g)(r),Object(s.d)().openChat({id:c}),c&&a&&await Object(f.a)("editChatPhoto",{chatId:c,photo:a})}(n,c.map(t=>Object(r.Ib)(e,t)).filter(Boolean),i)}),Object(s.b)("toggleChatPinned",(e,t,a)=>{const{id:s,folderId:c}=a,o=Object(r.g)(e,s);if(o)if(c){const t=Object(r.j)(e,c);if(t){const a=!Object(r.N)(e,s,c),{pinnedChatIds:n,includedChatIds:o}=t,i=a?[s,...n||[]]:(n||[]).filter(e=>e!==s),l=[s,...o];Object(f.a)("editChatFolder",{id:c,folderUpdate:{...t,pinnedChatIds:i,includedChatIds:l}})}}else{const t=Object(r.k)(e,s),a=Object(r.N)(e,s,"archived"===t?n.i:void 0);Object(f.a)("toggleChatPinned",{chat:o,shouldBePinned:!a})}}),Object(s.b)("toggleChatArchived",(e,t,a)=>{const{id:s}=a,c=Object(r.g)(e,s);c&&Object(f.a)("toggleChatArchived",{chat:c,folderId:Object(l.kb)(c)?0:n.i})}),Object(s.b)("loadChatFolders",()=>{!async function(){const e=await Object(f.a)("fetchChatFolders");if(e){const t=Object(s.e)();Object(s.g)({...t,chatFolders:{...t.chatFolders,...e}})}}()}),Object(s.b)("loadRecommendedChatFolders",()=>{!async function(){const e=await Object(f.a)("fetchRecommendedChatFolders");if(e){const t=Object(s.e)();Object(s.g)({...t,chatFolders:{...t.chatFolders,recommended:e}})}}()}),Object(s.b)("editChatFolder",(e,t,a)=>{const{id:s,folderUpdate:n}=a,c=Object(r.j)(e,s);c&&Object(f.a)("editChatFolder",{id:s,folderUpdate:{id:s,emoticon:c.emoticon,pinnedChatIds:c.pinnedChatIds,...n}})}),Object(s.b)("addChatFolder",(e,t,a)=>{const{folder:c}=a,{orderedIds:o}=e.chatFolders;!async function(e,t){const{id:a,description:n,...c}=e;if(await Object(f.a)("editChatFolder",{id:t+1,folderUpdate:{id:t+1,...c}}),!n)return;const o=Object(s.e)(),{recommended:r}=o.chatFolders;r&&Object(s.g)({...o,chatFolders:{...o.chatFolders,recommended:r.filter(({id:e})=>e!==a)}})}(c,o&&o.length?Math.max.apply(Math.max,o):n.i)}),Object(s.b)("deleteChatFolder",(e,t,a)=>{const{id:s}=a;Object(r.j)(e,s)&&async function(e){await Object(f.a)("deleteChatFolder",e)}(s)}),Object(s.b)("toggleChatUnread",(e,t,a)=>{const{id:s}=a,{serverTimeOffset:n}=e,c=Object(r.g)(e,s);c&&(c.unreadCount?Object(f.a)("markMessageListRead",{serverTimeOffset:n,chat:c,threadId:b.MAIN_THREAD_ID}):Object(f.a)("toggleDialogUnread",{chat:c,hasUnreadMark:!c.hasUnreadMark}))}),Object(s.b)("openTelegramLink",(e,t,a)=>{const{url:s}=a;let c=n.ob.exec(s);if(c){const e=c[1];(async()=>{const a=await Object(f.a)("openChatByInvite",e);a&&t.openChat({id:a.chatId})})()}else{c=n.pb.exec(s);const e=c[1],a=c[2]?Number(c[2]):void 0;E(t,e,a)}}),Object(s.b)("acceptInviteConfirmation",(e,t,a)=>{const{hash:s}=a;(async()=>{const e=await Object(f.a)("importChatInvite",{hash:s});e&&t.openChat({id:e.id})})()}),Object(s.b)("openChatByUsername",(e,t,a)=>{const{username:s}=a;E(t,s)}),Object(s.b)("togglePreHistoryHidden",(e,t,a)=>{const{chatId:s,isEnabled:n}=a;let c=Object(r.g)(e,s);c&&(async()=>{if(Object(l.lb)(c)){if(c=await Object(f.a)("migrateChat",c),!c)return;t.openChat({id:c.id})}Object(f.a)("togglePreHistoryHidden",{chat:c,isEnabled:n})})()}),Object(s.b)("updateChatDefaultBannedRights",(e,t,a)=>{const{chatId:s,bannedRights:n}=a,c=Object(r.g)(e,s);c&&Object(f.a)("updateChatDefaultBannedRights",{chat:c,bannedRights:n})}),Object(s.b)("updateChatMemberBannedRights",(e,t,a)=>{const{chatId:n,userId:c,bannedRights:i}=a;let d=Object(r.g)(e,n);const b=Object(r.Ib)(e,c);d&&b&&(async()=>{if(Object(l.lb)(d)){if(d=await Object(f.a)("migrateChat",d),!d)return;t.openChat({id:d.id})}await Object(f.a)("updateChatMemberBannedRights",{chat:d,user:b,bannedRights:i});const e=Object(s.e)(),a=Object(r.g)(e,n);if(!a||!a.fullInfo)return;const{members:u,kickedMembers:m}=a.fullInfo,h=!!i.viewMessages,O=!Object.keys(i).length;Object(s.g)(Object(o.I)(e,n,{fullInfo:{...a.fullInfo,...u&&h&&{members:u.filter(e=>e.userId!==c)},...u&&!h&&{members:u.map(e=>e.userId===c?{...e,bannedRights:i}:e)},...O&&m&&{kickedMembers:m.filter(e=>e.userId!==c)}}}))})()}),Object(s.b)("updateChatAdmin",(e,t,a)=>{const{chatId:n,userId:c,adminRights:i,customTitle:d}=a;let b=Object(r.g)(e,n);const u=Object(r.Ib)(e,c);b&&u&&(async()=>{if(Object(l.lb)(b)){if(b=await Object(f.a)("migrateChat",b),!b)return;t.openChat({id:b.id})}await Object(f.a)("updateChatAdmin",{chat:b,user:u,adminRights:i,customTitle:d});const e=Object(s.e)(),a=Object(r.g)(e,n);if(!a||!a.fullInfo)return;const{adminMembers:m}=a.fullInfo,h=!Object.keys(i).length;Object(s.g)(Object(o.I)(e,n,{fullInfo:{...a.fullInfo,...m&&h&&{adminMembers:m.filter(e=>e.userId!==c)},...m&&!h&&{adminMembers:m.map(e=>e.userId===c?{...e,adminRights:i,customTitle:d}:e)}}}))})()}),Object(s.b)("updateChat",(e,t,a)=>{const{chatId:n,title:c,about:i,photo:l}=a,d=Object(r.g)(e,n);d&&(async()=>{Object(s.g)(Object(o.cb)(Object(s.e)(),u.f.InProgress)),await Promise.all([d.title!==c?Object(f.a)("updateChatTitle",d,c):void 0,d.fullInfo&&d.fullInfo.about!==i?Object(f.a)("updateChatAbout",d,i):void 0,l?Object(f.a)("editChatPhoto",{chatId:n,accessHash:d.accessHash,photo:l}):void 0]),Object(s.g)(Object(o.cb)(Object(s.e)(),u.f.Complete))})()}),Object(s.b)("toggleSignatures",(e,t,a)=>{const{chatId:s,isEnabled:n}=a,c=Object(r.g)(e,s);c&&Object(f.a)("toggleSignatures",{chat:c,isEnabled:n})}),Object(s.b)("loadGroupsForDiscussion",()=>{(async()=>{const e=await Object(f.a)("fetchGroupsForDiscussion");if(!e)return;const t=e.reduce((e,t)=>(t&&(e[t.id]=t),e),{}),a=Object(o.c)(Object(s.e)(),t);Object(s.g)({...a,chats:{...a.chats,forDiscussionIds:Object.keys(t).map(Number)}})})()}),Object(s.b)("linkDiscussionGroup",(e,t,a)=>{const{channelId:s,chatId:n}=a,c=Object(r.g)(e,s);let o=Object(r.g)(e,n);c&&o&&(async()=>{if(Object(l.lb)(o)){if(o=await Object(f.a)("migrateChat",o),!o)return;t.openChat({id:o.id})}let{fullInfo:e}=o;if(!e){const t=await Object(f.a)("fetchFullChat",o);if(!t)return;e=t.fullInfo}e.isPreHistoryHidden&&await Object(f.a)("togglePreHistoryHidden",{chat:o,isEnabled:!1}),Object(f.a)("setDiscussionGroup",{channel:c,chat:o})})()}),Object(s.b)("unlinkDiscussionGroup",(e,t,a)=>{const{channelId:s}=a,n=Object(r.g)(e,s);if(!n)return;let c;n.fullInfo&&n.fullInfo.linkedChatId&&(c=Object(r.g)(e,n.fullInfo.linkedChatId)),(async()=>{await Object(f.a)("setDiscussionGroup",{channel:n}),c&&w(c)})()}),Object(s.b)("setActiveChatFolder",(e,t,a)=>({...e,chatFolders:{...e.chatFolders,activeChatFolder:a}})),Object(s.b)("loadMoreMembers",e=>{(async()=>{const{chatId:t}=Object(r.z)(e)||{},a=t?Object(r.g)(e,t):void 0;if(!a||Object(l.lb)(a))return;const n=a.fullInfo&&a.fullInfo.members&&a.fullInfo.members.length||void 0,c=await Object(f.a)("fetchMembers",a.id,a.accessHash,"recent",n);if(!c)return;const{members:i,users:d}=c;i&&i.length&&(e=Object(s.e)(),e=Object(o.g)(e,Object(h.c)(d,"id")),e=Object(o.I)(e,a.id,{fullInfo:{...a.fullInfo,members:[...(a.fullInfo||{}).members||[],...i||[]]}}),Object(s.g)(e))})()}),Object(s.b)("addChatMembers",(e,t,a)=>{const{chatId:s,memberIds:n}=a,c=Object(r.g)(e,s),o=n.map(t=>Object(r.Ib)(e,t)).filter(Boolean);c&&o.length&&(t.setNewChatMembersDialogState(u.i.Loading),(async()=>{await Object(f.a)("addChatMembers",c,o),t.setNewChatMembersDialogState(u.i.Closed),w(c)})())}),Object(s.b)("deleteChatMember",(e,t,a)=>{const{chatId:s,userId:n}=a,c=Object(r.g)(e,s),o=Object(r.Ib)(e,n);c&&o&&(async()=>{await Object(f.a)("deleteChatMember",c,o),w(c)})()});var M=a(154);const S=new Map,k=Object(p.h)(e=>e(),1e3,!0);async function N(e,t,a,c,i=!1,l=!1){const d=e.id;let b;switch(c){case u.e.Backwards:b=void 0;break;case u.e.Around:b=-(Math.round(n.bb/2)+1);break;case u.e.Forwards:b=-(n.bb+1)}const m=await Object(f.a)("fetchMessages",{chat:Object(r.Fb)(Object(s.e)(),d,t),offsetId:a,addOffset:b,limit:n.bb,threadId:t});if(!m)return;const{messages:O,users:j,chats:g,threadInfos:p}=m,I=Object(h.c)(O,"id"),v=Object.keys(I).map(Number);let y=Object(s.e)();y=Object(o.b)(y,d,I),y=i?Object(o.eb)(y,d,t,v):Object(o.W)(y,d,t,v),y=Object(o.g)(y,Object(h.c)(j,"id")),y=Object(o.c)(y,Object(h.c)(g,"id")),y=Object(o.mb)(y,d,p);let C=Object(r.Y)(y,d,t);const w=Object(r.gb)(y,d,t);if(i&&C&&w&&Object(h.b)(C,w)&&(y=Object(o.W)(y,d,t,w),C=Object(r.Y)(y,d,t),y=Object(o.y)(y,d,t,"outlyingIds",void 0),i=!1),!l){const e=i?w:C,{newViewportIds:s}=T(e,a,c);y=Object(o.A)(y,d,t,s)}Object(s.g)(y)}function T(e,t,a){const{length:s}=e,c=t?function(e,t){return te[e.length-1]?e.length-1:e.findIndex((a,s)=>a===t||at)}(e,t):-1,o=a===u.e.Backwards?c:c+1||s,r=o-n.bb,i=o+n.bb-1,l=e.slice(Math.max(0,r),i+1);let d,b;switch(a){case u.e.Backwards:d=o>0,b=r>=0;break;case u.e.Forwards:d=o0,b=l.length===n.bb}return{newViewportIds:l,areSomeLocal:d,areAllLocal:b}}async function P(e){let t;const a=e.attachment?(e,n)=>{S.has(n)||(t=n,S.set(n,a));const c=Object(s.e)();Object(s.g)({...c,fileUploads:{byMessageLocalId:{...c.fileUploads.byMessageLocalId,[n]:{progress:e}}}})}:void 0;(e.replyingTo||m.e)&&await Object(p.g)();const n=Object(s.e)();e.serverTimeOffset=n.serverTimeOffset;const c=Object(r.z)(n);if(!c)return;const{threadId:o}=c;e.replyingTo||o===b.MAIN_THREAD_ID||(e.replyingTo=Object(r.Gb)(n,e.chat.id,o)),await Object(f.a)("sendMessage",e,a),a&&t&&S.delete(t)}Object(s.b)("loadViewportMessages",(e,t,a)=>{const{direction:s=u.e.Around,isBudgetPreload:c=!1}=a||{};let{chatId:i,threadId:l}=a||{};if(!i){const t=Object(r.z)(e);if(!t)return;i=t.chatId,l=t.threadId}const d=Object(r.g)(e,i);if(!d||d.isRestricted)return;const b=Object(r.Jb)(e,i,l),m=Object(r.Y)(e,i,l),h=Object(r.gb)(e,i,l);if(b&&b.length&&s!==u.e.Around){const a=s===u.e.Backwards?b[0]:b[b.length-1],n=Boolean(h),r=n?h:m,{newViewportIds:O,areSomeLocal:j,areAllLocal:g}=T(r,a,s);if(j&&(e=Object(o.A)(e,i,l,O)),async function(e,t,a,s,n,c,o,r){t||await N(n,c,r,o,a,s);s||(await Promise.resolve(),e.loadViewportMessages({chatId:n.id,threadId:c,direction:o,isBudgetPreload:!0}))}(t,g,n,c,d,l,s,a),c)return}else{const t=Object(r.I)(e,i)||Object(r.lb)(e,i,l),a=Boolean(t&&m&&!m.includes(t)),s=(a?h:m)||[],{newViewportIds:b,areSomeLocal:O,areAllLocal:j}=T(s,t,u.e.Around);O&&b.length>=n.bb&&(e=Object(o.A)(e,i,l,b)),j||N(d,l,t,u.e.Around,a,c)}return e}),Object(s.b)("loadMessage",(e,t,a)=>{const{chatId:n,messageId:c,replyOriginForId:i}=a,l=Object(r.g)(e,n);l&&async function(e,t,a){const n=await Object(f.a)("fetchMessage",{chat:e,messageId:t});if(!n)return;if(n===b.MESSAGE_DELETED){if(a){let t=Object(s.e)();const n=Object(r.l)(t,e.id,a);t=Object(o.M)(t,e.id,a,{...n,replyToMessageId:void 0}),Object(s.g)(t)}return}let c=Object(s.e)();c=Object(o.M)(c,e.id,t,n.message),c=Object(o.g)(c,Object(h.c)(n.users,"id")),Object(s.g)(c)}(l,c,i)}),Object(s.b)("sendMessage",(e,t,a)=>{const s=Object(r.z)(e);if(!s)return;const{chatId:c,threadId:o,type:i}=s;if("scheduled"===i&&!a.scheduledAt)return{...e,messages:{...e.messages,contentToBeScheduled:a}};const l=Object(r.g)(e,c);t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:c,threadId:o,value:!1});const d={...a,chat:l,replyingTo:Object(r.nb)(e,c,o),noWebPage:Object(r.cb)(e,c,o)},b=!a.attachments||a.attachments.length<=1,u=!b&&a.attachments&&a.attachments.length>1;if(b){const{attachments:e,...t}=d;P({...t,attachment:e?e[0]:void 0})}else if(u){const{text:e,entities:t,attachments:a,...s}=d,c=Object(h.n)(a,n.R);for(let a=0;a0?r:void 0}),o.forEach(e=>{P({...s,attachment:e,groupedId:r})})}}else{const{text:e,entities:t,attachments:a,replyingTo:s,...n}=d;e&&P({...n,text:e,entities:t,replyingTo:s}),a.forEach(e=>{P({...n,attachment:e})})}}),Object(s.b)("editMessage",(e,t,a)=>{const{serverTimeOffset:s}=e,{text:n,entities:c}=a,o=Object(r.z)(e);if(!o)return;const{chatId:i,threadId:l,type:d}=o,b=Object(r.g)(e,i),u=Object(r.E)(e,i,l,d);b&&u&&(Object(f.a)("editMessage",{chat:b,message:u,text:n,entities:c,noWebPage:Object(r.cb)(e,i,l),serverTimeOffset:s}),t.setEditingId({messageId:void 0}))}),Object(s.b)("cancelSendingMessage",(e,t,a)=>{const{chatId:s,messageId:n}=a,c=Object(r.l)(e,s,n),o=c&&S.get(c.previousLocalId||c.id);o&&Object(f.b)(o),t.apiUpdate({"@type":"deleteMessages",ids:[n],chatId:s})}),Object(s.b)("saveDraft",(e,t,a)=>{const{chatId:s,threadId:n,draft:c}=a;if(!c)return;const{text:i,entities:l}=c,d=Object(r.g)(e,s);return n===b.MAIN_THREAD_ID&&Object(f.a)("saveDraft",{chat:d,text:i,entities:l,replyToMsgId:Object(r.nb)(e,s,n)}),e=Object(o.y)(e,s,n,"draft",c),e=Object(o.I)(e,s,{draftDate:Math.round(Date.now()/1e3)})}),Object(s.b)("clearDraft",(e,t,a)=>{const{chatId:s,threadId:n,localOnly:c}=a;if(!Object(r.C)(e,s,n))return;const i=Object(r.g)(e,s);return c||n!==b.MAIN_THREAD_ID||Object(f.a)("clearDraft",i),e=Object(o.y)(e,s,n,"draft",void 0),e=Object(o.I)(e,s,{draftDate:void 0})}),Object(s.b)("toggleMessageWebPage",(e,t,a)=>{const{chatId:s,threadId:n,noWebPage:c}=a;return Object(o.y)(e,s,n,"noWebPage",c)}),Object(s.b)("pinMessage",(e,t,a)=>{const s=Object(r.s)(e);if(!s)return;const{messageId:n,isUnpin:c,isOneSide:o,isSilent:i}=a;Object(f.a)("pinMessage",{chat:s,messageId:n,isUnpin:c,isOneSide:o,isSilent:i})}),Object(s.b)("unpinAllMessages",(e,t,a)=>{const n=Object(r.g)(e,a.chatId);n&&async function(e){await Object(f.a)("unpinAllMessages",{chat:e});let t=Object(s.e)();t=Object(o.y)(t,e.id,b.MAIN_THREAD_ID,"pinnedIds",[]),Object(s.g)(t)}(n)}),Object(s.b)("deleteMessages",(e,t,a)=>{const{messageIds:s,shouldDeleteForAll:n}=a,c=Object(r.z)(e);if(!c)return;const{chatId:o,threadId:i}=c,l=Object(r.g)(e,o);Object(f.a)("deleteMessages",{chat:l,messageIds:s,shouldDeleteForAll:n});const d=Object(r.D)(e,o,i);s.includes(d)&&t.setEditingId({messageId:void 0})}),Object(s.b)("deleteScheduledMessages",(e,t,a)=>{const{messageIds:s}=a,n=Object(r.z)(e);if(!n)return;const{chatId:c}=n,o=Object(r.g)(e,c);Object(f.a)("deleteScheduledMessages",{chat:o,messageIds:s});const i=Object(r.F)(e,c);s.includes(i)&&t.setEditingId({messageId:void 0})}),Object(s.b)("deleteHistory",(e,t,a)=>{(async()=>{const{chatId:s,shouldDeleteForAll:n}=a,c=Object(r.g)(e,s);if(!c)return;const o=c.lastMessage&&c.lastMessage.id;await Object(f.a)("deleteHistory",{chat:c,shouldDeleteForAll:n,maxId:o});const i=Object(r.z)(e);i&&i.chatId===s&&t.openChat({id:void 0})})()}),Object(s.b)("reportMessages",(e,t,a)=>{(async()=>{const{messageIds:s,reason:n,description:c}=a,o=Object(r.z)(e);if(!o)return;const{chatId:i}=o,l=Object(r.g)(e,i),d=await Object(f.a)("reportMessages",{peer:l,messageIds:s,reason:n,description:c});t.showNotification({message:d?"Thank you! Your report will be reviewed by our team.":"Error occured while submiting report. Please, try again later."})})()}),Object(s.b)("markMessageListRead",(e,t,a)=>{const{serverTimeOffset:s}=e,n=Object(r.z)(e);if(!n)return;const{chatId:c,threadId:o}=n,i=Object(r.Fb)(e,c,o);if(!i)return;const{maxId:l}=a;k(()=>{Object(f.a)("markMessageListRead",{serverTimeOffset:s,chat:i,threadId:o,maxId:l})})}),Object(s.b)("markMessagesRead",(e,t,a)=>{const s=Object(r.s)(e);if(!s)return;const{messageIds:n}=a;Object(f.a)("markMessagesRead",{chat:s,messageIds:n})}),Object(s.b)("loadWebPagePreview",(e,t,a)=>{const{text:n}=a;!async function(e){const t=await Object(f.a)("fetchWebPagePreview",{message:e});Object(s.g)({...Object(s.e)(),webPagePreview:t})}(n)}),Object(s.b)("clearWebPagePreview",e=>{if(e.webPagePreview)return{...e,webPagePreview:void 0}}),Object(s.b)("sendPollVote",(e,t,a)=>{const{chatId:s,messageId:n,options:c}=a,o=Object(r.g)(e,s);o&&Object(f.a)("sendPollVote",{chat:o,messageId:n,options:c})}),Object(s.b)("loadPollOptionResults",(e,t,a)=>{const{chat:n,messageId:c,option:r,offset:i,limit:l,shouldResetVoters:d}=a;!async function(e,t,a,n,c,r){const i=await Object(f.a)("loadPollOptionResults",{chat:e,messageId:t,option:a,offset:n,limit:c});if(!i)return;let l=Object(s.e)();l=Object(o.g)(l,Object(h.c)(i.users,"id"));const{voters:d}=l.pollResults;Object(s.g)({...l,pollResults:{...l.pollResults,voters:{...d,[a]:[...!r&&d&&d[a]?d[a]:[],...i&&i.users.map(e=>e.id)].filter((e,t,a)=>a.indexOf(e)===t)},offsets:{...l.pollResults.offsets?l.pollResults.offsets:{},[a]:i.nextOffset||""}}})}(n,c,r,i,l,d)}),Object(s.b)("forwardMessages",e=>{const{fromChatId:t,messageIds:a,toChatId:n}=e.forwardMessages,c=t?Object(r.g)(e,t):void 0,o=n?Object(r.g)(e,n):void 0,i=t&&a?a.sort((e,t)=>e-t).map(a=>Object(r.l)(e,t,a)).filter(Boolean):void 0;c&&o&&i&&i.length&&function(e,t,a){Object(f.a)("forwardMessages",{fromChat:e,toChat:t,messages:a,serverTimeOffset:Object(s.e)().serverTimeOffset}),Object(s.g)({...Object(s.e)(),forwardMessages:{}})}(c,o,i)}),Object(s.b)("loadScheduledHistory",e=>{const t=Object(r.s)(e);if(!t)return;const{hash:a}=e.scheduledMessages.byChatId[t.id]||{};!async function(e,t){const a=await Object(f.a)("fetchScheduledHistory",{chat:e,hash:t});if(!a)return;const{hash:n,messages:c}=a,r=Object(h.c)(c,"id"),i=Object.keys(r).map(Number).sort((e,t)=>t-e);let l=Object(s.e)();l=Object(o.v)(l,e.id,r,n),l=Object(o.y)(l,e.id,b.MAIN_THREAD_ID,"scheduledIds",i),Object(s.g)(l)}(t,a)}),Object(s.b)("sendScheduledMessages",(e,t,a)=>{const{chatId:s,id:n}=a,c=Object(r.g)(e,s);c&&Object(f.a)("sendScheduledMessages",{chat:c,ids:[n]})}),Object(s.b)("rescheduleMessage",(e,t,a)=>{const{chatId:s,messageId:n,scheduledAt:c}=a,o=Object(r.g)(e,s),i=o&&Object(r.qb)(e,o.id,n);o&&i&&Object(f.a)("rescheduleMessage",{chat:o,message:i,scheduledAt:c})}),Object(s.b)("requestThreadInfoUpdate",(e,t,a)=>{const{chatId:s,threadId:n}=a,c=Object(r.Fb)(e,s,n);c&&Object(f.a)("requestThreadInfoUpdate",{chat:c,threadId:n})}),Object(s.b)("loadPinnedMessages",(e,t,a)=>{const{chatId:n}=a,c=Object(r.g)(e,n);c&&async function(e){const t=await Object(f.a)("fetchPinnedMessages",{chat:e});if(!t)return;const{messages:a,chats:n,users:c}=t,r=Object(h.c)(a,"id"),i=Object.keys(r).map(Number).sort((e,t)=>t-e);let l=Object(s.e)();l=Object(o.b)(l,e.id,r),l=Object(o.y)(l,e.id,b.MAIN_THREAD_ID,"pinnedIds",i),l=Object(o.g)(l,Object(h.c)(c,"id")),l=Object(o.c)(l,Object(h.c)(n,"id")),Object(s.g)(l)}(c)}),Object(s.b)("loadMessageLink",(e,t,a)=>{const{messageId:s,chatId:n}=a,c=Object(r.g)(e,n),o=Object(r.l)(e,n,s);c&&o&&(async()=>{const e=await Object(f.a)("fetchMessageLink",{chat:c,message:o});e&&Object(M.c)(e.link)})()});var A=a(53);const x=Object(p.h)(e=>e(),500,!1);async function R(e,t){const a=await Object(f.a)("searchGifs",{query:e,offset:t});a&&Object(s.g)(Object(o.R)(Object(s.e)(),!t,a.gifs,a.nextOffset))}Object(s.b)("loadStickerSets",e=>{const{hash:t}=e.stickers.added||{};!async function(e=0){const t=await Object(f.a)("fetchStickerSets",{hash:e});if(!t)return;Object(s.g)(Object(o.jb)(Object(s.e)(),"added",t.hash,t.sets))}(t)}),Object(s.b)("loadAddedStickers",(e,t)=>{const{setIds:a}=e.stickers.added;a&&a.length&&(async()=>{for(let e=0;e0&&await Object(p.f)(500)})()}),Object(s.b)("loadRecentStickers",e=>{const{hash:t}=e.stickers.recent||{};!async function(e=0){const t=await Object(f.a)("fetchRecentStickers",{hash:e});if(!t)return;const a=Object(s.e)();Object(s.g)({...a,stickers:{...a.stickers,recent:t}})}(t)}),Object(s.b)("loadFavoriteStickers",e=>{const{hash:t}=e.stickers.favorite||{};!async function(e=0){const t=await Object(f.a)("fetchFavoriteStickers",{hash:e});if(!t)return;const a=Object(s.e)();Object(s.g)({...a,stickers:{...a.stickers,favorite:t}})}(t)}),Object(s.b)("loadFeaturedStickers",e=>{const{hash:t}=e.stickers.featured||{};!async function(e=0){const t=await Object(f.a)("fetchFeaturedStickers",{hash:e});if(!t)return;Object(s.g)(Object(o.jb)(Object(s.e)(),"featured",t.hash,t.sets))}(t)}),Object(s.b)("loadStickers",(e,t,a)=>{const{stickerSetId:n}=a;let{stickerSetAccessHash:c}=a;if(!c){const t=Object(r.yb)(e,n);if(!t)return;c=t.accessHash}!async function(e,t){const a=await Object(f.a)("fetchStickers",{stickerSetId:e,accessHash:t});if(!a)return;const{set:n,stickers:c,packs:r}=a;let i=Object(s.e)();i=Object(o.ib)(i,n.id,{...n,stickers:c,packs:r});const l=i.stickers.forEmoji.emoji;l&&r[l]&&(i=Object(o.p)(i));Object(s.g)(i)}(n,c)}),Object(s.b)("loadAnimatedEmojis",()=>{!async function(){const e=await Object(f.a)("fetchAnimatedEmojis");if(!e)return;const{set:t,stickers:a}=e;Object(s.g)(Object(o.r)(Object(s.e)(),{...t,stickers:a}))}()}),Object(s.b)("loadSavedGifs",e=>{const{hash:t}=e.gifs.saved;!async function(e=0){const t=await Object(f.a)("fetchSavedGifs",{hash:e});if(!t)return;const a=Object(s.e)();Object(s.g)({...a,gifs:{...a.gifs,saved:t}})}(t)}),Object(s.b)("faveSticker",(e,t,a)=>{const{sticker:s}=a;s&&Object(f.a)("faveSticker",{sticker:s})}),Object(s.b)("unfaveSticker",(e,t,a)=>{const{sticker:n}=a;n&&function(e){const t=Object(s.e)();Object(s.g)({...t,stickers:{...t.stickers,favorite:{...t.stickers.favorite,stickers:t.stickers.favorite.stickers.filter(({id:t})=>t!==e.id)}}}),Object(f.a)("faveSticker",{sticker:e,unfave:!0})}(n)}),Object(s.b)("toggleStickerSet",(e,t,a)=>{const{stickerSetId:s}=a,n=Object(r.yb)(e,s);if(!n)return;const{accessHash:c,installedDate:o}=n;Object(f.a)(o?"uninstallStickerSet":"installStickerSet",{stickerSetId:s,accessHash:c})}),Object(s.b)("loadEmojiKeywords",(e,t,a)=>{const{language:n}=a;let c=e.emojiKeywords[n];c&&c.isLoading||(Object(s.g)({...e,emojiKeywords:{...e.emojiKeywords,[n]:{...c,isLoading:!0}}}),(async()=>{const t=await Object(f.a)("fetchEmojiKeywords",{language:n,fromVersion:c?c.version:0});e=Object(s.e)(),c=e.emojiKeywords[n],t?Object(s.g)({...e,emojiKeywords:{...e.emojiKeywords,[n]:{isLoading:!1,version:t.version,keywords:{...c&&c.keywords,...t.keywords}}}}):Object(s.g)({...e,emojiKeywords:{...e.emojiKeywords,[n]:{...c,isLoading:!1}}})})())}),Object(s.b)("setStickerSearchQuery",(e,t,a)=>{const{query:n}=a;n&&x(()=>{!async function(e,t=0){const a=await Object(f.a)("searchStickers",{query:e,hash:t});if(!a)return;const n=Object(s.e)(),{setsById:c,added:r}=n.stickers,i=a.sets.map(({id:e})=>e);r.setIds&&r.setIds.forEach(t=>{if(!i.includes(t)){const{title:a}=c[t]||{};a&&Object(A.a)(a,e)&&i.unshift(t)}});Object(s.g)(Object(o.jb)(n,"search",a.hash,a.sets,i))}(n)})}),Object(s.b)("setGifSearchQuery",(e,t,a)=>{const{query:s}=a;"string"==typeof s&&x(()=>{R(s)})}),Object(s.b)("searchMoreGifs",e=>{const{query:t,offset:a}=e.gifs.search;"string"==typeof t&&x(()=>{R(t,a)})}),Object(s.b)("loadStickersForEmoji",(e,t,a)=>{const{emoji:n}=a,{hash:c}=e.stickers.forEmoji;x(()=>{!async function(e,t=0){let a=Object(s.e)();Object(s.g)({...a,stickers:{...a.stickers,forEmoji:{...a.stickers.forEmoji,emoji:e}}});const n=await Object(f.a)("fetchStickersForEmoji",{emoji:e,hash:t});if(a=Object(s.e)(),!n||a.stickers.forEmoji.emoji!==e)return;a=Object(o.kb)(a,e,n.stickers,n.hash),Object(s.g)(a)}(n,c)})}),Object(s.b)("clearStickersForEmoji",e=>({...e,stickers:{...e.stickers,forEmoji:{}}}));var L=a(26);const B=Object(p.h)(e=>e(),500,!1);async function D(e="",t,a,c,i,l){let d;if(c){const s=await Object(f.a)("searchMessagesLocal",{chatOrUser:c,query:e,type:t,limit:n.E,offsetId:a,minDate:l,maxDate:i});if(s){const{messages:e,users:t,totalCount:a,nextOffsetId:n}=s;d={messages:e,users:t,chats:[],totalCount:a,nextRate:n}}}else d=await Object(f.a)("searchMessagesGlobal",{query:e,offsetRate:a,limit:n.E,type:t,maxDate:i,minDate:l});let b=Object(s.e)();const u=Object(r.u)(b);if(!d||""!==e&&e!==u)return void Object(s.g)(Object(o.U)(b,{messages:!1}));const{messages:m,users:O,chats:j,totalCount:g,nextRate:p}=d;j.length&&(b=Object(o.c)(b,Object(h.c)(j,"id"))),O.length&&(b=Object(o.g)(b,Object(h.c)(O,"id"))),m.length&&(b=Object(o.d)(b,m)),b=Object(o.V)(b,m,g,t,p),Object(s.g)(b)}async function F(){const e=await Object(f.a)("fetchChats",{limit:n.l,archived:!0,withPinned:!0,serverTimeOffset:Object(s.e)().serverTimeOffset});if(!e)return;let t=Object(s.e)();t=Object(o.rb)(t,Object(h.c)(e.users,"id")),t=Object(o.N)(t,Object(h.c)(e.chats,"id")),t=Object(o.s)(t,"archived",e.chatIds),t=Object(o.K)(t,"archived",e),Object(s.g)(t)}async function U(){let e=Object(s.e)();const{recentlyFoundChatIds:t}=e.globalSearch,{userIds:a}=e.contactList||{};if(!(a&&a.length||t&&t.length))return;const n=[...t||[],...a||[]].map(t=>Object(r.Ib)(e,t)).filter(Boolean),c=await Object(f.a)("fetchUsers",{users:n});c&&(e=Object(s.e)(),e=Object(o.rb)(e,Object(h.c)(c,"id")),Object(s.g)(e))}function H(e){return Object(f.a)("fetchMessages",{chat:e,threadId:b.MAIN_THREAD_ID,offsetId:e.lastReadInboxMessageId,addOffset:-(Math.round(n.bb/2)+1),limit:n.bb})}Object(s.b)("setGlobalSearchQuery",(e,t,a)=>{const{chatId:n}=e.globalSearch,{query:c}=a;c&&!n&&B(()=>{!async function(e){const t=await Object(f.a)("searchChats",{query:e});let a=Object(s.e)();const n=Object(r.u)(a);if(!t||!n||e!==n)return void Object(s.g)(Object(o.U)(a,{chats:!1}));const{localChats:c,localUsers:i,globalChats:l,globalUsers:d}=t;(c.length||l.length)&&(a=Object(o.c)(a,Object(h.c)([...c,...l],"id")));(i.length||d.length)&&(a=Object(o.g)(a,Object(h.c)([...i,...d],"id")));a=Object(o.U)(a,{chats:!1}),a=Object(o.S)(a,{localResults:{chatIds:c.map(({id:e})=>e),userIds:i.map(({id:e})=>e)},globalResults:{...a.globalSearch.globalResults,chatIds:d.map(({id:e})=>e),userIds:l.map(({id:e})=>e)}}),Object(s.g)(a)}(c)})}),Object(s.b)("setGlobalSearchDate",(e,t,a)=>{const{date:n}=a,c=n?Object(L.m)(n):n,i=Object(o.S)(e,{date:n,query:"",resultsByType:{...e.globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}});Object(s.g)(i);const{chatId:l}=e.globalSearch;D("","text",void 0,l?Object(r.g)(e,l):void 0,c,n)}),Object(s.b)("searchMessagesGlobal",(e,t,a)=>{const{query:s,resultsByType:n,chatId:c,date:o}=e.globalSearch,i=o?Object(L.m)(o):o,{type:l}=a,{nextOffsetId:d}=n&&n[l]||{};D(s,l,d,c?Object(r.g)(e,c):void 0,i,o)}),Object(s.b)("searchTextMessagesLocal",e=>{const{chatId:t,threadId:a}=Object(r.z)(e)||{},c=t?Object(r.g)(e,t):void 0,i=Object(r.B)(e);if(!c||!i||!a)return;const{query:l,results:d}=i,u=d?d.nextOffsetId:void 0;let m;if(a!==b.MAIN_THREAD_ID){const s=Object(r.Eb)(e,t,a);m=s?s.topMessageId:void 0}!async function(e,t,a,c,i){const l=await Object(f.a)("searchMessagesLocal",{chatOrUser:e,type:"text",query:c,topMessageId:a,limit:n.db,offsetId:i});if(!l)return;const{messages:d,users:b,totalCount:u,nextOffsetId:m}=l,O=Object(h.c)(d,"id"),j=Object.keys(O).map(Number);let g=Object(s.e)();const p=Object(r.B)(g);if(!p||c&&c!==p.query)return;g=Object(o.b)(g,e.id,O),g=Object(o.g)(g,Object(h.c)(b,"id")),g=Object(o.ab)(g,e.id,t,j,u,m),Object(s.g)(g)}(c,a,m,l,u)}),Object(s.b)("searchMediaMessagesLocal",e=>{const t=Object(r.x)(e),a=t?e.users.byId[t]||e.chats.byId[t]:void 0,c=Object(r.w)(e);if(!a||!c)return;const{currentType:i,resultsByType:l}=c,d=i&&l&&l[i],b=d?d.nextOffsetId:void 0;i&&async function(e,t,a){const c=await Object(f.a)("searchMessagesLocal",{chatOrUser:e,type:t,limit:n.vb,offsetId:a});if(!c)return;const{messages:i,users:l,totalCount:d,nextOffsetId:b}=c,u=Object(h.c)(i,"id"),m=Object.keys(u).map(Number);let O=Object(s.e)();if(!Object(r.w)(O))return;O=Object(o.b)(O,e.id,u),O=Object(o.g)(O,Object(h.c)(l,"id")),O=Object(o.X)(O,e.id,t,m,d,b),Object(s.g)(O)}(a,i,b)}),Object(s.b)("searchMessagesByDate",(e,t,a)=>{const{timestamp:n}=a,{chatId:c}=Object(r.z)(e)||{};if(!c)return;const o=Object(r.g)(e,c);o&&async function(e,t){const a=await Object(f.a)("findFirstMessageIdAfterDate",{chat:e,timestamp:t});if(!a)return;Object(s.d)().focusMessage({chatId:e.id,messageId:a})}(o,n)}),Object(s.b)("checkPublicLink",(e,t,a)=>{const{chatId:n}=Object(r.z)(e)||{};if(!n)return;if(e.management.progress===u.f.InProgress)return;const{username:c}=a;(async()=>{e=Object(o.cb)(e,u.f.InProgress),e=Object(o.bb)(e,n,{isUsernameAvailable:void 0}),Object(s.g)(e);const t=await Object(f.a)("checkChatUsername",{username:c});e=Object(s.e)(),e=Object(o.cb)(e,t?u.f.Complete:u.f.Error),e=Object(o.bb)(e,n,{isUsernameAvailable:t}),Object(s.g)(e)})()}),Object(s.b)("updatePublicLink",(e,t,a)=>{const{chatId:n}=Object(r.z)(e)||{};let c=n&&Object(r.g)(e,n);if(!n||!c)return;const{username:i}=a;(async()=>{if(e=Object(o.cb)(e,u.f.InProgress),Object(s.g)(e),Object(l.lb)(c)){if(c=await Object(f.a)("migrateChat",c),!c)return;t.openChat({id:c.id})}const a=await Object(f.a)("setChatUsername",{chat:c,username:i});e=Object(s.e)(),e=Object(o.cb)(e,a?u.f.Complete:u.f.Error),e=Object(o.bb)(e,n,{isUsernameAvailable:void 0}),Object(s.g)(e)})()}),Object(s.b)("updatePrivateLink",e=>{const{chatId:t}=Object(r.z)(e)||{},a=t&&Object(r.g)(e,t);t&&a&&Object(f.a)("updatePrivateLink",{chat:a})}),Object(s.b)("sync",(e,t)=>{!async function(e){n.r&&console.log(">>> START SYNC");await Object(f.a)("fetchCurrentUser");const t=await async function(){const e=await Object(f.a)("fetchChats",{limit:n.l,withPinned:!0,serverTimeOffset:Object(s.e)().serverTimeOffset});if(!e)return;let t=Object(s.e)();const{recentlyFoundChatIds:a}=t.globalSearch,{userIds:c}=t.contactList||{},{currentUserId:i}=t,d=[...a||[],...c||[],...i?[i]:[]],u=d.map(e=>Object(r.Ib)(t,e)).filter(Boolean),m=d.map(e=>Object(r.g)(t,e)).filter(Boolean),{chatId:O}=Object(r.z)(t)||{};if(O){const e=Object(r.g)(t,O);if(e&&!d.includes(O)&&m.push(e),Object(l.ob)(O)){const e=Object(r.Ib)(t,O);e&&!d.includes(O)&&u.push(e)}}u.push(...e.users),m.push(...e.chats),t=Object(o.t)(t,Object(h.c)(m,"id")),t=Object(o.s)(t,"active",e.chatIds),t={...t,chats:{...t.chats}},t=Object(o.K)(t,"active",e),Object.keys(e.draftsById).map(Number).forEach(a=>{t=Object(o.y)(t,a,b.MAIN_THREAD_ID,"draft",e.draftsById[a])}),Object.keys(e.replyingToById).map(Number).forEach(a=>{t=Object(o.y)(t,a,b.MAIN_THREAD_ID,"replyingToId",e.replyingToById[a])}),Object(s.g)(t),O&&!t.chats.byId[O]&&Object(s.d)().openChat({id:void 0});return u}();await async function(e){let t=!1,a=e||[],n=Object(s.e)();const{chatId:c,threadId:i}=Object(r.z)(n)||{},l=Object.keys(n.messages.byChatId).map(Number).reduce((e,t)=>{const a=Object(r.C)(n,t,b.MAIN_THREAD_ID);return a?{...e,[t]:a}:e},{});if(c){const e=await H(n.chats.byId[c]);n=Object(s.e)();const{chatId:l}=Object(r.z)(n)||{},d=i&&Object(r.Eb)(n,c,i);if(e&&l===c){const s=n.messages.byChatId[c],r=Object(h.c)(e.messages,"id"),l=Object.keys(r).map(Number);if(n={...n,messages:{...n.messages,byChatId:{[c]:{byId:r,threadsById:{[b.MAIN_THREAD_ID]:{...s&&s.threadsById[b.MAIN_THREAD_ID],listedIds:l,viewportIds:l,outlyingIds:void 0}}}}}},i&&d&&d.originChannelId){const{originChannelId:e}=d,t=n.messages.byChatId[e],a=await H(n.chats.byId[e]);if(a){const e=Object(h.c)(a.messages,"id"),o=Object.keys(e).map(Number);n={...n,messages:{...n.messages,byChatId:{...n.messages.byChatId,[d.originChannelId]:{byId:e,threadsById:{[b.MAIN_THREAD_ID]:{...t&&t.threadsById[b.MAIN_THREAD_ID],listedIds:o,viewportIds:o,outlyingIds:void 0}}},[c]:{...n.messages.byChatId[c],threadsById:{...n.messages.byChatId[c].threadsById,[i]:{...s&&s.threadsById[i],outlyingIds:void 0}}}}}}}}n=Object(o.N)(n,Object(h.c)(e.chats,"id")),n=Object(o.mb)(n,c,e.threadInfos),t=!0,a=Array.prototype.concat(a,e.users)}}t||(n={...n,messages:{...n.messages,byChatId:{}}});Object.keys(l).map(Number).forEach(e=>{n=Object(o.y)(n,e,b.MAIN_THREAD_ID,"draft",l[e])}),e?n=Object(o.z)(n,Object(h.c)(a,"id")):a&&(n=Object(o.rb)(n,Object(h.c)(a,"id")));Object(s.g)(n);const{chatId:d,messageId:u}=n.audioPlayer;d&&u&&!Object(r.l)(n,d,u)&&Object(s.d)().closeAudioPlayer()}(t),Object(s.g)({...Object(s.e)(),lastSyncTime:Date.now()}),n.r&&console.log(">>> FINISH SYNC");e()}(t.afterSync)}),Object(s.b)("afterSync",(e,t)=>{!async function(e){n.r&&console.log(">>> START AFTER-SYNC");e.loadFavoriteStickers(),await Promise.all([U(),F()]),await Object(f.a)("fetchCurrentUser"),n.r&&console.log(">>> FINISH AFTER-SYNC")}(t)});const q=Object(p.a)(e=>e(),500,!1,!0),_=Object(p.h)(e=>e(),500,!1);function G(e,t,a){return{...e,inlineBots:{...e.inlineBots,byUsername:{...e.inlineBots.byUsername,[t]:a}}}}function z(e,t){return{...e,inlineBots:{...e.inlineBots,isLoading:t}}}Object(s.b)("loadFullUser",(e,t,a)=>{const{userId:s}=a,n=Object(r.Ib)(e,s);if(!n)return;const{id:c,accessHash:o}=n;q(()=>Object(f.a)("fetchFullUser",{id:c,accessHash:o}))}),Object(s.b)("loadUser",(e,t,a)=>{const{userId:n}=a,c=Object(r.Ib)(e,n);c&&(async()=>{const t=await Object(f.a)("fetchUsers",{users:[c]});t&&(e=Object(s.e)(),e=Object(o.rb)(e,Object(h.c)(t,"id")),Object(s.g)(e))})()}),Object(s.b)("loadTopUsers",e=>{const{serverTimeOffset:t,topPeers:{hash:a,lastRequestedAt:n}}=e;(!n||Date.now()/1e3+t-n>60)&&async function(e){const t=await Object(f.a)("fetchTopUsers",{hash:e});if(!t)return;const{hash:a,ids:n,users:c}=t;let r=Object(s.e)();r=Object(o.g)(r,Object(h.c)(c,"id")),r={...r,topPeers:{...r.topPeers,hash:a,userIds:n,lastRequestedAt:Date.now()/1e3+r.serverTimeOffset}},Object(s.g)(r)}(a)}),Object(s.b)("loadContactList",e=>{const{hash:t}=e.contactList||{};!async function(e){const t=await Object(f.a)("fetchContactList",{hash:e});if(!t)return;let a=Object(o.g)(Object(s.e)(),Object(h.c)(t.users,"id"));a=Object(o.c)(a,Object(h.c)(t.chats,"id"));const n=e=>e.lastName||e.firstName||"",c=new Intl.Collator("en-US"),r=t.users.sort((e,t)=>c.compare(n(e),n(t))).filter(e=>!e.isSelf);Object(s.g)({...a,contactList:{hash:t.hash,userIds:r.map(e=>e.id)}})}(t)}),Object(s.b)("loadCurrentUser",()=>{Object(f.a)("fetchCurrentUser")}),Object(s.b)("updateContact",(e,t,a)=>{const{userId:n,isMuted:c,firstName:i,lastName:l}=a;!async function(e,t,a,n){const c=Object(s.e)(),i=Object(r.Ib)(c,e);if(!i)return;Object(s.d)().updateChatMutedState({chatId:e,isMuted:t}),Object(s.g)(Object(o.cb)(Object(s.e)(),u.f.InProgress));await Object(f.a)("updateContact",{phone:i.phoneNumber,firstName:a,lastName:n})&&Object(s.g)(Object(o.ob)(Object(s.e)(),i.id,{firstName:a,lastName:n}));Object(s.g)(Object(o.cb)(Object(s.e)(),u.f.Complete))}(n,c,i,l)}),Object(s.b)("deleteUser",(e,t,a)=>{const{userId:n}=a;!async function(e){const t=Object(s.e)(),a=Object(r.Ib)(t,e);if(!a)return;const{id:n,accessHash:c}=a;await Object(f.a)("deleteUser",{id:n,accessHash:c})}(n)}),Object(s.b)("loadProfilePhotos",(e,t,a)=>{const{profileId:n}=a,c=Object(l.ob)(n),i=c?Object(r.Ib)(e,n):void 0,d=c?void 0:Object(r.g)(e,n);(async()=>{const e=await Object(f.a)("fetchProfilePhotos",i,d);if(!e||!e.photos)return;let t=Object(s.e)();c?t=Object(o.ob)(t,n,{photos:e.photos}):(t=Object(o.g)(t,Object(h.c)(e.users,"id")),t=Object(o.I)(t,n,{photos:e.photos})),Object(s.g)(t)})()}),Object(s.b)("setUserSearchQuery",(e,t,a)=>{const{query:n}=a;n&&_(()=>{!async function(e){const t=await Object(f.a)("searchChats",{query:e});let a=Object(s.e)();const n=a.userSearch.query;if(!t||!n||e!==n)return void Object(s.g)(Object(o.qb)(a,!1));const{localUsers:c,globalUsers:r}=t;let i,l;c.length&&(a=Object(o.g)(a,Object(h.c)(c,"id")),i=c.map(({id:e})=>e));r.length&&(a=Object(o.g)(a,Object(h.c)(r,"id")),l=r.map(({id:e})=>e));a=Object(o.qb)(a,!1),a=Object(o.pb)(a,{localUserIds:i,globalUserIds:l}),Object(s.g)(a)}(n)})});const $=Object(p.a)(e=>e(),500,!1);function W(e,{visibility:t,allowedIds:a,deniedIds:s}){const{users:{byId:n},chats:{byId:c}}=e,o={visibility:t};let r,i;const d=e=>{if(!Object(l.ob)(e))return;const{id:t,accessHash:a}=n[e]||{};return t?{id:t,accessHash:a}:void 0},b=e=>{if(Object(l.ob)(e))return;const t=c[e];return t?{id:t.id}:void 0};return"contacts"!==t&&"nobody"!==t||(r=a.map(d).filter(Boolean),i=a.map(b).filter(Boolean),r.length>0&&(o.allowedUsers=r),i.length>0&&(o.allowedChats=i)),"everybody"!==t&&"contacts"!==t||(r=s.map(d).filter(Boolean),i=s.map(b).filter(Boolean),r.length>0&&(o.blockedUsers=r),i.length>0&&(o.blockedChats=i)),o}Object(s.b)("clickInlineButton",(e,t,a)=>{const{button:c}=a;switch(c.type){case"command":t.sendBotCommand({command:c.value});break;case"url":c.value.match(n.ob)||c.value.match(n.pb)?t.openTelegramLink({url:c.value}):t.toggleSafeLinkModal({url:c.value});break;case"callback":{const t=Object(r.s)(e);if(!t)return;!async function(e,t,a){const n=await Object(f.a)("answerCallbackButton",{chatId:e.id,accessHash:e.accessHash,messageId:t,data:a});if(!n||!n.message)return;const{message:c,alert:o}=n;o?Object(s.d)().showDialog({data:{message:c}}):Object(s.d)().showNotification({message:c})}(t,c.messageId,c.value);break}case"requestPoll":t.openPollModal();break;case"buy":{const a=Object(r.s)(e),{messageId:s,value:n}=c;if(!a)return;n?t.getReceipt({receiptMessageId:n,chatId:a.id,messageId:s}):(t.getPaymentForm({messageId:s}),t.setInvoiceMessageInfo(Object(r.l)(e,a.id,s)),t.openPaymentModal({messageId:s}));break}}}),Object(s.b)("sendBotCommand",(e,t,a)=>{const{command:s,chatId:n}=a,{currentUserId:c}=e,o=n?Object(r.g)(e,n):Object(r.s)(e);c&&o&&async function(e,t,a){await Object(f.a)("sendMessage",{chat:e,text:a})}(o,0,s)}),Object(s.b)("loadTopInlineBots",e=>{const{serverTimeOffset:t}=e,{hash:a,lastRequestedAt:n}=e.topInlineBots;n&&Date.now()+t-n<6e4||(async()=>{const e=await Object(f.a)("fetchTopInlineBots",{hash:a});if(!e)return;const{hash:t,ids:n,users:c}=e;let r=Object(s.e)();r=Object(o.g)(r,Object(h.c)(c,"id")),r={...r,topInlineBots:{...r.topInlineBots,hash:t,userIds:n,lastRequestedAt:Date.now()}},Object(s.g)(r)})()}),Object(s.b)("queryInlineBot",(e,t,a)=>{const{chatId:n,username:c,query:i,offset:l}=a;(async()=>{let t=e.inlineBots.byUsername[c];if(!1!==t){if(void 0===t){const{user:a,chat:n}=await Object(f.a)("fetchInlineBot",{username:c})||{};if(e=Object(s.e)(),!a||!n)return void Object(s.g)(G(e,c,!1));e=Object(o.g)(e,{[a.id]:a}),e=Object(o.c)(e,{[n.id]:n}),t={id:a.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[]},e=G(e,c,t),Object(s.g)(e)}(i!==t.query||t.canLoadMore)&&$(()=>{!async function({username:e,inlineBotData:t,chatId:a,query:n,offset:c}){let o=Object(s.e)();const i=Object(r.Ib)(o,t.id),l=Object(r.g)(o,a);if(!i||!l)return;const d=t.query!==n;o=z(o,!0),o=G(o,e,{...t,query:n,...d&&{offset:void 0,results:[]}}),Object(s.g)(o);const b=await Object(f.a)("fetchInlineBotResults",{bot:i,chat:l,query:n,offset:d?void 0:c}),u=o.inlineBots.byUsername[e];if(o=z(Object(s.e)(),!1),!b||!u||n!==u.query)return void Object(s.g)(o);const m=new Set((u.results||[]).map(e=>e.id)),h=b.results.filter(e=>!m.has(e.id));o=G(o,e,{...u,help:b.help,isGallery:b.isGallery,...b.switchPm&&{switchPm:b.switchPm},canLoadMore:b.results.length>0&&Boolean(b.nextOffset),results:""===u.offset||u.offset===b.nextOffset?b.results:(u.results||[]).concat(h),offset:h.length?b.nextOffset:""}),Object(s.g)(o)}({username:c,inlineBotData:t,chatId:n,query:i,offset:l})})}})()}),Object(s.b)("sendInlineBotResult",(e,t,a)=>{const{id:s,queryId:n}=a,c=Object(r.z)(e);if(!c||!s)return;const{chatId:o,threadId:i}=c,l=Object(r.g)(e,o);t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:o,threadId:i,value:!1}),Object(f.a)("sendInlineBotResult",{chat:l,resultId:s,queryId:n,replyingTo:Object(r.nb)(e,o,i)})}),Object(s.b)("resetInlineBot",(e,t,a)=>{const{username:n}=a;let c=e.inlineBots.byUsername[n];c&&(c={id:c.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[]},Object(s.g)(G(e,n,c)))}),Object(s.b)("updateProfile",(e,t,a)=>{const{photo:n,firstName:c,lastName:i,bio:l,username:d}=a;(async()=>{const{currentUserId:t}=e;if(t){if(Object(s.g)({...Object(s.e)(),profileEdit:{progress:u.k.InProgress}}),n&&await Object(f.a)("updateProfilePhoto",n),c||i||l){if(await Object(f.a)("updateProfile",{firstName:c,lastName:i,about:l})){e=Object(s.e)();const a=t&&Object(r.Ib)(e,t);a&&Object(s.g)(Object(o.ob)(e,a.id,{firstName:c,lastName:i,fullInfo:{...a.fullInfo,bio:l}}))}}if(d){await Object(f.a)("updateUsername",d)&&t&&Object(s.g)(Object(o.ob)(Object(s.e)(),t,{username:d}))}Object(s.g)({...Object(s.e)(),profileEdit:{progress:u.k.Complete}})}})()}),Object(s.b)("checkUsername",(e,t,a)=>{const{username:n}=a;(async()=>{if(e.profileEdit&&e.profileEdit.progress===u.k.InProgress)return;Object(s.g)({...e,profileEdit:{progress:e.profileEdit?e.profileEdit.progress:u.k.Idle,isUsernameAvailable:void 0}});const t=await Object(f.a)("checkUsername",n);e=Object(s.e)(),Object(s.g)({...e,profileEdit:{...e.profileEdit,isUsernameAvailable:t}})})()}),Object(s.b)("loadWallpapers",()=>{(async()=>{const e=await Object(f.a)("fetchWallpapers",0);if(!e)return;const t=Object(s.e)();Object(s.g)({...t,settings:{...t.settings,loadedWallpapers:e.wallpapers}})})()}),Object(s.b)("uploadWallpaper",(e,t,a)=>{const n=a,c=URL.createObjectURL(n);Object(s.g)({...e,settings:{...e.settings,loadedWallpapers:[{slug:u.o,document:{fileName:"",size:n.size,mimeType:n.type,previewBlobUrl:c}},...e.settings.loadedWallpapers||[]]}}),(async()=>{const t=await Object(f.a)("uploadWallpaper",n);if(!t)return;const{wallpaper:a}=t;if(!(e=Object(s.e)()).settings.loadedWallpapers)return;const o=e.settings.loadedWallpapers[0];if(!o||o.slug!==u.o)return;const r={...a,document:{...a.document,previewBlobUrl:c}};Object(s.g)({...e,settings:{...e.settings,loadedWallpapers:[r,...e.settings.loadedWallpapers.slice(1)]}})})()}),Object(s.b)("loadBlockedContacts",()=>{(async()=>{const e=await Object(f.a)("fetchBlockedContacts");if(!e)return;let t=Object(s.e)();e.users&&e.users.length&&(t=Object(o.g)(t,Object(h.c)(e.users,"id"))),e.chats&&e.chats.length&&(t=Object(o.N)(t,Object(h.c)(e.chats,"id"))),t={...t,blocked:{...t.blocked,ids:[...t.blocked.ids||[],...e.blockedIds],totalCount:e.totalCount}},Object(s.g)(t)})()}),Object(s.b)("blockContact",(e,t,a)=>{const{contactId:n}=a;(async()=>{if(!await Object(f.a)("blockContact",n))return;const e=Object(s.e)();Object(s.g)(Object(o.a)(e,n))})()}),Object(s.b)("unblockContact",(e,t,a)=>{const{contactId:n}=a;let c;if(Object(l.ob)(n)){const t=Object(r.Ib)(e,n);if(!t)return;c=t.accessHash}(async()=>{if(!await Object(f.a)("unblockContact",n,c))return;const e=Object(s.e)();Object(s.g)(Object(o.q)(e,n))})()}),Object(s.b)("loadAuthorizations",()=>{(async()=>{const e=await Object(f.a)("fetchAuthorizations");e&&Object(s.g)({...Object(s.e)(),activeSessions:e})})()}),Object(s.b)("terminateAuthorization",(e,t,a)=>{const{hash:n}=a;(async()=>{if(!await Object(f.a)("terminateAuthorization",n))return;const e=Object(s.e)();Object(s.g)({...e,activeSessions:e.activeSessions.filter(e=>e.hash!==n)})})()}),Object(s.b)("terminateAllAuthorizations",()=>{(async()=>{if(!await Object(f.a)("terminateAllAuthorizations"))return;const e=Object(s.e)();Object(s.g)({...e,activeSessions:e.activeSessions.filter(e=>e.isCurrent)})})()}),Object(s.b)("loadNotificationExceptions",e=>{const{serverTimeOffset:t}=e;(async()=>{const e=await Object(f.a)("fetchNotificationExceptions",{serverTimeOffset:t});e&&Object(s.g)(Object(o.f)(Object(s.e)(),e))})()}),Object(s.b)("loadNotificationSettings",e=>{const{serverTimeOffset:t}=e;(async()=>{const e=await Object(f.a)("fetchNotificationSettings",{serverTimeOffset:t});e&&Object(s.g)(Object(o.w)(Object(s.e)(),e))})()}),Object(s.b)("updateNotificationSettings",(e,t,a)=>{const{peerType:n,isSilent:c,shouldShowPreviews:r}=a;(async()=>{await Object(f.a)("updateNotificationSettings",n,{isSilent:c,shouldShowPreviews:r})&&Object(s.g)(Object(o.db)(Object(s.e)(),n,c,r))})()}),Object(s.b)("updateContactSignUpNotification",(e,t,a)=>{const{isSilent:n}=a;(async()=>{await Object(f.a)("updateContactSignUpNotification",n)&&Object(s.g)(Object(o.w)(Object(s.e)(),{hasContactJoinedNotifications:!n}))})()}),Object(s.b)("loadLanguages",()=>{(async()=>{const e=await Object(f.a)("fetchLanguages");e&&Object(s.g)(Object(o.w)(Object(s.e)(),{languages:e}))})()}),Object(s.b)("loadPrivacySettings",()=>{(async()=>{const[e,t,a,n,c]=await Promise.all([Object(f.a)("fetchPrivacySettings","phoneNumber"),Object(f.a)("fetchPrivacySettings","lastSeen"),Object(f.a)("fetchPrivacySettings","profilePhoto"),Object(f.a)("fetchPrivacySettings","forwards"),Object(f.a)("fetchPrivacySettings","chatInvite")]);if(!(e&&t&&a&&n&&c))return;const o=Object(s.e)();o.settings.privacy.phoneNumber=e,o.settings.privacy.lastSeen=t,o.settings.privacy.profilePhoto=a,o.settings.privacy.forwards=n,o.settings.privacy.chatInvite=c,Object(s.g)(o)})()}),Object(s.b)("setPrivacyVisibility",(e,t,a)=>{const{privacyKey:n,visibility:c}=a,{privacy:{[n]:o}}=e.settings;if(!o)return;const r=W(e,{visibility:c,allowedIds:[...o.allowUserIds,...o.allowChatIds],deniedIds:[...o.blockUserIds,...o.blockChatIds]});(async()=>{const e=await Object(f.a)("setPrivacySettings",n,r);if(e){const t=Object(s.e)();t.settings.privacy[n]=e,Object(s.g)(t)}})()}),Object(s.b)("setPrivacySettings",(e,t,a)=>{const{privacyKey:n,isAllowList:c,contactsIds:o}=a,{privacy:{[n]:r}}=e.settings;if(!r)return;const i=W(e,{visibility:r.visibility,allowedIds:c?o:[...r.allowUserIds,...r.allowChatIds],deniedIds:c?[...r.blockUserIds,...r.blockChatIds]:o});(async()=>{const e=await Object(f.a)("setPrivacySettings",n,i);if(e){const t=Object(s.e)();t.settings.privacy[n]=e,Object(s.g)(t)}})()}),Object(s.b)("updateIsOnline",(e,t,a)=>{Object(f.a)("updateIsOnline",a)}),Object(s.b)("loadContentSettings",()=>{(async()=>{const e=await Object(f.a)("fetchContentSettings");e&&Object(s.g)(Object(o.w)(Object(s.e)(),e))})()}),Object(s.b)("updateContentSettings",(e,t,a)=>{(async()=>{Object(s.g)(Object(o.w)(Object(s.e)(),{isSensitiveEnabled:a}));await Object(f.a)("updateContentSettings",a)||Object(s.g)(Object(o.w)(Object(s.e)(),{isSensitiveEnabled:!a}))})()}),Object(s.b)("loadPasswordInfo",()=>{(async()=>{const e=await Object(f.a)("getPasswordInfo");if(!e)return;let t=Object(s.e)();t=Object(o.w)(t,{hasPassword:e.hasPassword}),t=Object(o.nb)(t,{hint:e.hint}),Object(s.g)(t)})()}),Object(s.b)("checkPassword",(e,t,a)=>{const{currentPassword:n,onSuccess:c}=a;Object(s.g)(Object(o.nb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(f.a)("checkPassword",n);Object(s.g)(Object(o.nb)(Object(s.e)(),{isLoading:!1})),e&&c()})()}),Object(s.b)("clearPassword",(e,t,a)=>{const{currentPassword:n,onSuccess:c}=a;Object(s.g)(Object(o.nb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(f.a)("clearPassword",n);Object(s.g)(Object(o.nb)(Object(s.e)(),{isLoading:!1})),e&&c()})()}),Object(s.b)("updatePassword",(e,t,a)=>{const{currentPassword:n,password:c,hint:r,email:i,onSuccess:l}=a;Object(s.g)(Object(o.nb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(f.a)("updatePassword",n,c,r,i);Object(s.g)(Object(o.nb)(Object(s.e)(),{isLoading:!1})),e&&l()})()}),Object(s.b)("updateRecoveryEmail",(e,t,a)=>{const{currentPassword:n,email:c,onSuccess:r}=a;Object(s.g)(Object(o.nb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(f.a)("updateRecoveryEmail",n,c);Object(s.g)(Object(o.nb)(Object(s.e)(),{isLoading:!1,waitingEmailCodeLength:void 0})),e&&r()})()}),Object(s.b)("provideTwoFaEmailCode",(e,t,a)=>{const{code:s}=a;Object(f.a)("provideRecoveryEmailCode",s)}),Object(s.b)("clearTwoFaError",e=>Object(o.nb)(e,{error:void 0}));var V=a(61);Object(s.b)("validateRequestedInfo",(e,t,a)=>{const{requestInfo:n,saveInfo:c}=a,i=Object(r.hb)(e);i&&async function(e,t,a){const n=await Object(f.a)("validateRequestedInfo",{messageId:e,requestInfo:t,shouldSave:a});if(!n)return;const{id:c,shippingOptions:r}=n;if(!c)return;let i=Object(o.F)(Object(s.e)(),c);r?(i=Object(o.hb)(i,r),i=Object(o.D)(i,u.j.Shipping)):i=Object(o.D)(i,u.j.PaymentInfo);Object(s.g)(i)}(i,n,c)}),Object(s.b)("getPaymentForm",(e,t,a)=>{const{messageId:n}=a;n&&async function(e){const t=await Object(f.a)("getPaymentForm",{messageId:e});if(!t)return;let a=Object(o.C)(Object(s.e)(),t),n=u.j.PaymentInfo;a.payment.invoice&&(a.payment.invoice.shippingAddressRequested||a.payment.invoice.nameRequested||a.payment.invoice.phoneRequested||a.payment.invoice.emailRequested)&&(n=u.j.ShippingInfo);a=Object(o.D)(a,n),Object(s.g)(a)}(n)}),Object(s.b)("getReceipt",(e,t,a)=>{const{receiptMessageId:n,chatId:c,messageId:i}=a;i&&n&&c&&async function(e,t,a){const n=await Object(f.a)("getReceipt",t);if(!n)return;let c=Object(s.e)();const i=Object(r.l)(c,a,e);c=Object(o.E)(c,n,i),Object(s.g)(c)}(i,n,c)}),Object(s.b)("clearPaymentError",e=>{Object(s.g)({...e,payment:{...e.payment,error:void 0}})}),Object(s.b)("clearReceipt",e=>{Object(s.g)({...e,payment:{...e.payment,receipt:void 0}})}),Object(s.b)("sendCredentialsInfo",(e,t,a)=>{const n=Object(r.kb)(e);if(!n)return;const{credentials:c}=a,{data:i}=c;!async function(e,t){const a=function(e){const t=Object.keys(e).map(t=>`${t}=${e[t]}`).join("&");return t.length>0?"?"+t:""}({"card[number]":e.cardNumber,"card[exp_month]":e.expiryMonth,"card[exp_year]":e.expiryYear,"card[cvc]":e.cvv,"card[address_zip]":e.zip,"card[address_country]":e.country}),n=await fetch("https://api.stripe.com/v1/tokens"+a,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:"Bearer "+t}}),c=await n.json();if(c.error){const e=Object(V.b)(c.error),t=Object(s.e)();return void Object(s.g)({...t,payment:{...t.payment,error:{...e}}})}let r=Object(o.G)(Object(s.e)(),{type:c.type,id:c.id});r=Object(o.D)(r,u.j.Checkout),Object(s.g)(r)}(i,n)}),Object(s.b)("sendPaymentForm",(e,t,a)=>{const{shippingOptionId:n,saveCredentials:c}=a,i=Object(r.hb)(e),l=Object(r.ib)(e),d=Object(r.kb)(e),b=Object(r.Ab)(e);i&&d&&async function(e,t,a,n){if(await Object(f.a)("sendPaymentForm",{messageId:e,credentials:t,requestedInfoId:a,shippingOptionId:n})){const e=Object(o.i)(Object(s.e)());Object(s.g)(Object(o.j)(e))}}(i,{save:c,data:b},l,n)}),Object(s.b)("setPaymentStep",(e,t,a={})=>Object(o.D)(e,a.step||u.j.ShippingInfo)),Object(s.b)("setInvoiceMessageInfo",(e,t,a)=>Object(o.B)(e,a));a(87);var K=a(32),Q=a(79);const Y=Object(p.h)(e=>e(),1e3,!0);Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateChat":{a.noTopChatsRequest||Object(r.M)(e,a.id)||t.loadTopChats();const n=Object(o.I)(e,a.id,a.chat,a.newProfilePhoto);Object(s.g)(n);const c=Object(r.r)(n);Y(()=>Object(Q.a)(c));break}case"updateChatJoin":{const n=Object(r.k)(e,a.id);if(!n)break;e=Object(o.J)(e,n,[a.id]),e=Object(o.I)(e,a.id,{isNotJoined:!1}),Object(s.g)(e);const c=Object(r.g)(e,a.id);c&&t.requestChatUpdate({chatId:c.id});break}case"updateChatLeave":{const t=Object(r.k)(e,a.id);if(!t)break;const{[t]:n}=e.chats.listIds;n&&(e=Object(o.s)(e,t,n.filter(e=>e!==a.id))),e=Object(o.I)(e,a.id,{isNotJoined:!0}),Object(s.g)(e);break}case"updateChatInbox":Object(s.g)(Object(o.I)(e,a.id,a.chat));break;case"updateChatTypingStatus":{const{id:t,typingStatus:n}=a;Object(s.g)(Object(o.I)(e,t,{typingStatus:n})),setTimeout(()=>{const e=Object(s.e)(),a=Object(r.g)(e,t);a&&n&&a.typingStatus&&a.typingStatus.timestamp===n.timestamp&&Object(s.g)(Object(o.I)(e,t,{typingStatus:void 0}))},6e3);break}case"newMessage":{const{message:n}=a,{chatId:c,threadId:i,type:l}=Object(r.z)(e)||{};if(n.senderId===e.currentUserId&&!n.isFromScheduled)return;const d=Object(r.g)(e,a.chatId);if(!d)return;const u="thread"===l&&i===b.MAIN_THREAD_ID&&a.chatId===c;u?setTimeout(()=>{t.requestChatUpdate({chatId:a.chatId})},1e3):Object(s.g)(Object(o.I)(e,a.chatId,{unreadCount:d.unreadCount?d.unreadCount+1:1,...a.message.hasUnreadMention&&{unreadMentionsCount:d.unreadMentionsCount?d.unreadMentionsCount+1:1}}));const m=Object(r.r)(Object(s.e)());Object(Q.a)(m),Object(K.b)({chat:d,message:n,isActiveChat:u});break}case"updateCommonBoxMessages":case"updateChannelMessages":{const{ids:t,messageUpdate:n}=a;if(!1!==n.hasUnreadMention)return;t.forEach(t=>{const s="channelId"in a?a.channelId:Object(r.q)(e,t),n=Object(r.g)(e,s);n&&n.unreadMentionsCount&&(e=Object(o.I)(e,s,{unreadMentionsCount:n.unreadMentionsCount-1}))}),Object(s.g)(e);break}case"updateChatFullInfo":{const{fullInfo:t}=a,n=e.chats.byId[a.id];if(!n)return;Object(s.g)(Object(o.I)(e,a.id,{fullInfo:{...n.fullInfo,...t}}));break}case"updatePinnedChatIds":{const{ids:t,folderId:c}=a,o=c===n.i?"archived":"active";e={...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[o]:t.length?t:void 0}}},Object(s.g)(e);break}case"updateChatPinned":{const{id:t,isPinned:c}=a,o=Object(r.k)(e,t);if(o){const{[o]:a}=e.chats.orderedPinnedIds;let s=a||[];if(c){if(!s.includes(t)){if("active"===o&&s.length>=n.Q){const t=e.chats.listIds.active;s=s.filter(e=>t&&t.includes(e))}s=[t,...s]}}else s=s.filter(e=>e!==t);e={...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[o]:s.length?s:void 0}}}}Object(s.g)(e);break}case"updateChatListType":{const{id:t,folderId:n}=a;Object(s.g)(Object(o.L)(e,t,n));break}case"updateChatFolder":{const{id:t,folder:n}=a,{byId:c,orderedIds:o}=e.chatFolders,r=n?{...c,[t]:n}:Object(h.l)(c,Object.keys(c).map(Number).filter(e=>e!==t)),i=n?o&&o.includes(t)?o:[...o||[],t]:o?o.filter(e=>e!==t):void 0;Object(s.g)({...e,chatFolders:{...e.chatFolders,byId:r,orderedIds:i}});break}case"updateChatFoldersOrder":{const{orderedIds:t}=a;Object(s.g)({...e,chatFolders:{...e.chatFolders,orderedIds:t}});break}case"updateRecommendedChatFolders":{const{folders:t}=a;Object(s.g)({...e,chatFolders:{...e.chatFolders,recommended:t}});break}case"updateChatMembers":{const t=e.chats.byId[a.id],{replacedMembers:n,addedMember:c,deletedMemberId:r}=a;if(!t)return;let i=!1,l=t.fullInfo&&t.fullInfo.members?[...t.fullInfo.members]:[];if(n)l=n,i=!0;else if(c)l.length&&l.some(e=>e.userId===c.userId)||(l.push(c),i=!0);else if(l.length&&r){const e=l.findIndex(e=>e.userId===r);e>-1&&(l.slice(e,1),i=!0)}if(i){const n=l.filter(({isOwner:e,isAdmin:t})=>e||t);Object(s.g)(Object(o.I)(e,a.id,{membersCount:l.length,fullInfo:{...t.fullInfo,members:l,adminMembers:n}}))}break}case"deleteProfilePhotos":{const{chatId:t,ids:n}=a,c=e.chats.byId[t];c&&c.photos&&Object(s.g)(Object(o.I)(e,t,{photos:c.photos.filter(e=>!n.includes(e.id))}));break}case"draftMessage":{const{chatId:t,formattedText:n,date:c,replyingToId:r}=a;e.chats.byId[t]&&(e=Object(o.y)(e,t,b.MAIN_THREAD_ID,"draft",n),e=Object(o.y)(e,t,b.MAIN_THREAD_ID,"replyingToId",r),e=Object(o.I)(e,t,{draftDate:c}),Object(s.g)(e));break}case"showInvite":{const{data:e}=a;t.showDialog({data:e});break}}});function J(e,t,a,s,n=!1){const c=n?Object(r.qb)(e,t,a):Object(r.l)(e,t,a);if(c&&s.content){const{photo:e,video:t,sticker:a,document:n}=Object(l.v)(c);e&&s.content.photo?(s.content.photo.blobUrl=e.blobUrl,s.content.photo.thumbnail=e.thumbnail):t&&s.content.video?s.content.video.blobUrl=t.blobUrl:a&&s.content.sticker?s.content.sticker.isPreloadedGlobally=a.isPreloadedGlobally:n&&s.content.document&&(s.content.document.previewBlobUrl=n.previewBlobUrl)}return n?Object(o.fb)(e,t,a,s):Object(o.M)(e,t,a,s)}function X(e,t){const{id:a,chatId:s}=t,n=Object(r.g)(e,s);if(n&&n.unreadCount&&!Object(r.Y)(e,s,b.MAIN_THREAD_ID))return e;if(e=Object(o.W)(e,s,b.MAIN_THREAD_ID,[a]),Object(r.X)(e,s,b.MAIN_THREAD_ID)){const t=Object(r.H)(e,s,b.MAIN_THREAD_ID),n=Object(o.h)(e,s,b.MAIN_THREAD_ID,a),c=Object(r.Jb)(n,s,b.MAIN_THREAD_ID);t&&!c.includes(t)||(e=n)}const{threadInfo:c,firstMessageId:i}=Object(r.Db)(e,s,t)||{};return!i&&Object(l.xb)(t)||c&&(e=Object(o.W)(e,s,c.threadId,[a]),Object(r.X)(e,s,c.threadId)&&(e=Object(o.h)(e,s,c.threadId,a),i||(e=Object(o.y)(e,s,c.threadId,"firstMessageId",t.id)),c.lastMessageId||(e=Object(o.y)(e,s,c.threadId,"threadInfo",{...c,lastMessageId:t.id})))),e}function 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(o.I)(e,t,{lastMessage:a})}function ee(e,t){const a=Object(r.n)(e,t),s=Object(r.Y)(e,t,b.MAIN_THREAD_ID);if(!a||!s)return;let n=s.length;for(;n--;){const e=a[s[n]];if(!e.isDeleting)return e}}function te(e,t,a,n){if(e){t.forEach(t=>{const a=ee(n=Object(o.M)(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(r.l)(n,e,t);if(!a)return;const{threadInfo:s}=Object(r.Db)(n,e,a)||{};s&&c.push(s.threadId)}),Object(h.o)(c).forEach(t=>{a.requestThreadInfoUpdate({chatId:e,threadId:t})}),void setTimeout(()=>{Object(s.g)(Object(o.k)(Object(s.e)(),e,t))},350)}const c=[];t.forEach(e=>{const t=Object(r.q)(n,e);if(t){c.push(t);const a=ee(n=Object(o.M)(n,t,e,{isDeleting:!0}),t);a&&(n=Z(n,t,a,!0)),setTimeout(()=>{Object(s.g)(Object(o.k)(Object(s.e)(),t,[e]))},350)}}),Object(s.g)(n),Object(h.o)(c).forEach(e=>{a.requestChatUpdate({chatId:e})})}Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"newMessage":{const{chatId:n,id:c,message:i}=a;e=X(e=J(e,n,c,i),i),i.threadInfo&&(e=Object(o.lb)(e,i.threadInfo.chatId,i.threadInfo.threadId,i.threadInfo)),Object(s.g)(e);const d=Object(r.l)(e,n,c);if(Object(r.a)(e,n,i)){if(i.isOutgoing&&(!i.content||!i.content.action)){const a=Object(r.z)(e);a&&t.focusMessage({chatId:n,threadId:a.threadId,messageId:i.id,noHighlight:!0})}const{threadInfo:a}=Object(r.Db)(e,n,i)||{};a&&t.requestThreadInfoUpdate({chatId:n,threadId:a.threadId}),Object(l.xb)(i)||setTimeout(()=>{Object(s.g)(Z(Object(s.e)(),n,d))},350)}else Object(s.g)(Z(Object(s.e)(),n,d));Object(r.M)(e,n)||t.loadTopChats();break}case"newScheduledMessage":{const{chatId:t,id:n,message:c}=a;e=J(e,t,n,c,!0);const i=Object(r.pb)(e,t)||[];e=Object(o.y)(e,t,b.MAIN_THREAD_ID,"scheduledIds",Object(h.o)([...i,n])),Object(s.g)(e);break}case"updateMessage":{const{chatId:t,id:n,message:c}=a;if(!Object(r.l)(e,t,n))return;e=J(e,t,n,c);const i=Object(r.l)(e,t,n);c.threadInfo&&(e=Object(o.lb)(e,c.threadInfo.chatId,c.threadInfo.threadId,c.threadInfo)),e=Z(e,t,i),Object(s.g)(e);break}case"updateScheduledMessage":{const{chatId:t,id:n,message:c}=a;if(!Object(r.qb)(e,t,n))return;e=J(e,t,n,c,!0);const i=Object.keys(Object(r.rb)(e,t)||{}).map(Number).sort((e,t)=>t-e);e=Object(o.y)(e,t,b.MAIN_THREAD_ID,"scheduledIds",i),Object(s.g)(e);break}case"updateMessageSendSucceeded":{const{chatId:t,localId:n,message:c}=a;e=X(e,c);const i=Object(r.l)(e,t,n);e=Object(o.k)(e,t,[n]),c.isScheduled&&(e=Object(o.l)(e,t,[n])),e=Object(o.M)(e,t,c.id,{...i,...c,previousLocalId:n});const l=Object(r.l)(e,t,c.id);e=Z(e,t,l),Object(s.g)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:n,message:c}=a,i=Object(r.pb)(e,t)||[];e=Object(o.y)(e,t,b.MAIN_THREAD_ID,"scheduledIds",[...i,c.id]);const l=Object(r.qb)(e,t,n);e=Object(o.l)(e,t,[n]),e=Object(o.fb)(e,t,c.id,{...l,...c,previousLocalId:n}),Object(s.g)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:n,messageIds:c}=a,i=Object(r.jb)(e,t)||[],l=n?[...i,...c].sort((e,t)=>t-e):i.filter(e=>!c.includes(e));Object(s.g)(Object(o.y)(e,t,b.MAIN_THREAD_ID,"pinnedIds",l));break}case"updateThreadInfo":{const{chatId:t,threadId:n,threadInfo:c,firstMessageId:i}=a,l={...Object(r.Eb)(e,t,n),...c};if(!l.threadId)return;e=Object(o.lb)(e,t,n,l),i&&(e=Object(o.y)(e,t,n,"firstMessageId",i)),Object(s.g)(e);break}case"resetMessages":{const{id:n}=a,c=Object(r.n)(e,n);c&&!Object(l.ob)(n)&&(e=Object(o.k)(e,n,Object.keys(c).map(Number)),Object(s.g)(e),t.loadFullChat({chatId:n,force:!0}));break}case"deleteMessages":{const{ids:s,chatId:n}=a;te(n,s,t,e);break}case"deleteScheduledMessages":{const{ids:t,chatId:n}=a;!function(e,t,a,n){if(!e)return;t.forEach(t=>{n=Object(o.fb)(n,e,t,{isDeleting:!0})}),Object(s.g)(n),setTimeout(()=>{n=Object(o.l)(Object(s.e)(),e,t);const a=Object(r.rb)(n,e);n=Object(o.y)(n,e,b.MAIN_THREAD_ID,"scheduledIds",Object.keys(a||{}).map(Number)),Object(s.g)(n)},350)}(n,t,0,e);break}case"deleteHistory":{const{chatId:s}=a,n=e.messages.byChatId[s];if(n){te(s,Object.keys(n.byId).map(Number),t,e)}else t.requestChatUpdate({chatId:s});break}case"updateCommonBoxMessages":{const{ids:t,messageUpdate:n}=a;t.forEach(t=>{const a=Object(r.q)(e,t);a&&(e=Object(o.M)(e,a,t,n))}),Object(s.g)(e);break}case"updateChannelMessages":{const{channelId:t,ids:n,messageUpdate:c}=a;n.forEach(a=>{e=Object(o.M)(e,t,a,c)}),Object(s.g)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:n}=a,c=Object(r.m)(e,t);if(c&&c.content.poll){const t={...c.content.poll,...n},{results:a}=t.results||{};if(a&&!a.some(e=>e.isChosen)){const{results:e}=c.content.poll.results,s=e&&e.filter(e=>e.isChosen);s&&s.forEach(e=>{const s=a.findIndex(t=>t.option===e.option);s>=0&&(t.results.results[s].isChosen=!0)})}Object(s.g)(Object(o.M)(e,c.chatId,c.id,{content:{...c.content,poll:t}}))}break}case"updateMessagePollVote":{const{pollId:t,userId:n,options:c}=a,i=Object(r.m)(e,t);if(!i||!i.content.poll||!i.content.poll.results)break;const{poll:l}=i.content,{recentVoterIds:d,totalVoters:b,results:u}=l.results,m=d?[...d]:[],h=b?b+1:1,O=u?[...u]:[];m.push(n),c.forEach(t=>{const a=O.find(e=>e.option===t),s=O.findIndex(e=>e.option===t),c=a?{...a}:{option:t,votersCount:0};c.votersCount+=1,n===e.currentUserId&&(c.isChosen=!0),s?O[s]=c:O.push(c)}),Object(s.g)(Object(o.M)(e,i.chatId,i.id,{content:{...i.content,poll:{...l,results:{...l.results,recentVoterIds:m,totalVoters:h,results:O}}}}));break}}});const ae=Object(p.h)((function(){let e=Object(s.e)();se.forEach(([t,a])=>{e=Object(o.ob)(e,t,{status:a})}),Object(s.g)(e),se=[]}),3e3,!0);let se=[];Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"deleteUser":return Object(o.m)(e,a.id);case"updateUser":return Object(o.ob)(e,a.id,a.user);case"updateUserStatus":return s=a.userId,n=a.status,se.push([s,n]),void ae();case"updateUserFullInfo":{const{id:t,fullInfo:s}=a,n=e.users.byId[t];if(!n)return;return Object(o.ob)(e,t,{fullInfo:{...n.fullInfo,...s}})}}var s,n}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateStickerSet":return Object(o.ib)(e,a.id,a.stickerSet)}}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updatePeerBlocked":return a.isBlocked?Object(o.a)(Object(s.e)(),a.id):Object(o.q)(Object(s.e)(),a.id);case"updateResetContactList":Object(s.g)({...Object(s.e)(),contactList:{hash:0,userIds:[]}});break;case"updateFavoriteStickers":t.loadFavoriteStickers();break;case"updatePrivacy":e.settings.privacy[a.key]=a.rules}}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateNotifySettings":return Object(o.db)(e,a.peerType,a.isSilent,a.shouldShowPreviews);case"updateNotifyExceptions":{const{chatId:t,isMuted:n,isSilent:c,shouldShowPreviews:r}=a;e.chats.byId[t]&&(e=Object(o.I)(e,t,{isMuted:n})),Object(s.g)(Object(o.e)(e,t,{isMuted:n,isSilent:c,shouldShowPreviews:r}));break}}}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateTwoFaStateWaitCode":return{...e,twoFaSettings:{...e.twoFaSettings,isLoading:!1,waitingEmailCodeLength:a.length}};case"updateTwoFaError":return{...e,twoFaSettings:{...e.twoFaSettings,error:a.message}}}});var ne=a(51),ce=a(8),oe=a(39),re=a(124);function ie(e){Object(c.n)(()=>Object(p.c)(e),[e])}var le=a(48),de=a(111);var be=a(38),ue=a(27),me=a(44),he=a(37),Oe=a(63),je=a(42),ge=a(24),fe=a(155),pe=a(142);a(200);var Ie=Object(c.h)(({id:e,name:t,value:a,label:s,checked:n=!1,disabled:o,inactive:r,noAnimation:i,onChange:l,onCheck:d})=>{const b=Object(c.m)(e=>{l&&l(e),d&&d(e.currentTarget.checked)},[l,d]),u=Object(ce.a)("Switcher",o&&"disabled",r&&"inactive",i&&"no-animation");return c.a.createElement("label",{className:u,title:s},c.a.createElement("input",{type:"checkbox",id:e,name:t,value:a,checked:n,disabled:o,onChange:b}),c.a.createElement("span",{className:"widget"}))});a(201);const ve=[0,1,2];var ye=Object(c.h)(Object(s.h)(e=>{const{query:t,fetchingStatus:a,chatId:s,date:n}=e.globalSearch,{currentUserId:c}=e,{byId:o}=e.chats,{animationLevel:i}=e.settings.byKey;return{searchQuery:t,isLoading:!!a&&Boolean(a.chats||a.messages),currentUserId:c,chatsById:o,globalSearchChatId:s,searchDate:n,theme:Object(r.Cb)(e),animationLevel:i}},(e,t)=>Object(h.l)(t,["openChat","openTipsChat","setGlobalSearchDate","setGlobalSearchChatId","setSettingOption"]))(({content:e,contactsFilter:t,onSearchQuery:a,onSelectSettings:s,onSelectContacts:o,onSelectArchived:r,setGlobalSearchChatId:i,onReset:d,searchQuery:b,isLoading:h,shouldSkipTransition:O,currentUserId:j,globalSearchChatId:g,searchDate:f,theme:p,animationLevel:I,chatsById:v,openChat:y,openTipsChat:C,setGlobalSearchDate:w,setSettingOption:E})=>{const M=Object(ue.a)(),S=e===u.d.ChatList,k={date:void 0},N={id:void 0},T=Object(c.p)(()=>f?Object(L.a)(new Date(1e3*f)):void 0,[f]),P=Object(c.p)(()=>S&&v?Object.values(v).reduce((e,t)=>Object(l.kb)(t)&&t.unreadCount?e+1:e,0):0,[S,v]),A="web.telegram.org"===window.location.hostname,x=Object(c.p)(()=>({onTrigger:e,isOpen:t})=>c.a.createElement(ge.a,{round:!0,ripple:S&&!m.l,size:"smaller",color:"translucent",className:t?"active":"",onClick:S?e:()=>d(),ariaLabel:S?M("AccDescrOpenMenu2"):"Return to chat list"},c.a.createElement("div",{className:Object(ce.a)("animated-menu-icon",!S&&"state-back",O&&"no-animation")})),[S,M,d,O]),R=Object(c.m)(()=>{b||a("")},[b,a]),B=Object(c.m)(()=>{y({id:j})},[j,y]),D=Object(c.m)(e=>{e.stopPropagation();const t="light"===p?"dark":"light";E({theme:t}),E({shouldUseSystemTheme:!1}),Object(me.a)(t,I===n.e)},[I,E,p]),F=Object(c.m)(e=>{e.stopPropagation();const t=0===I?2:0;ve.forEach((e,a)=>{document.body.classList.toggle("animation-level-"+a,t===a)}),E({animationLevel:t})},[I,E]),U=Boolean(g)||e===u.d.GlobalSearch||e===u.d.Contacts,H=e===u.d.Contacts?M("SearchFriends"):M("Search");return c.a.createElement("div",{className:"LeftMainHeader"},c.a.createElement("div",{id:"LeftMainHeader",className:"left-header"},c.a.createElement(Oe.a,{trigger:x,footer:`${n.g} alpha ${n.h}`},c.a.createElement(je.a,{icon:"saved-messages",onClick:B},M("SavedMessages")),c.a.createElement(je.a,{icon:"archive",onClick:r},c.a.createElement("span",{className:"menu-item-name"},M("ArchivedChats")),P>0&&c.a.createElement("div",{className:"archived-badge"},P)),c.a.createElement(je.a,{icon:"user",onClick:o},M("Contacts")),c.a.createElement(je.a,{icon:"settings",onClick:s},M("Settings")),c.a.createElement(je.a,{icon:"darkmode",onClick:D},c.a.createElement("span",{className:"menu-item-name"},M("lng_menu_night_mode")),c.a.createElement(Ie,{id:"darkmode",label:M("dark"===p?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===p,noAnimation:!0})),c.a.createElement(je.a,{icon:"animations",onClick:F},c.a.createElement("span",{className:"menu-item-name capitalize"},M("Appearance.Animations").toLowerCase()),c.a.createElement(Ie,{id:"animations",label:"Toggle Animations",checked:I>0})),c.a.createElement(je.a,{icon:"help",onClick:C},M("TelegramFeatures")),c.a.createElement(je.a,{icon:"bug",href:n.D},"Report Bug"),A&&c.a.createElement(c.a.Fragment,null,c.a.createElement(je.a,{icon:"char-K",href:"https://web.telegram.org/k/",onClick:()=>{localStorage.setItem("kz_version",JSON.stringify("K")),Object(he.b)()}},"Switch to K Version"),c.a.createElement(je.a,{icon:"char-W",href:"https://web.telegram.org/?legacy=1",onClick:he.b},"Switch to Old Version"))),c.a.createElement(fe.a,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:g||f?"with-picker-item":"",value:t||b,focused:U,isLoading:h,placeholder:H,autoComplete:"off",canClose:Boolean(g||f),onChange:a,onReset:d,onFocus:R},T&&c.a.createElement(pe.a,{icon:"calendar",title:T,canClose:!0,isMinimized:Boolean(g),className:"search-date",onClick:w,clickArg:k}),g&&c.a.createElement(pe.a,{chatOrUserId:g,onClick:i,canClose:!0,clickArg:N}))))})),Ce=a(21);a(202);var we=Object(c.h)(()=>{const e=Object(ue.a)();return c.a.createElement("div",{id:"ConnectionState",dir:e.isRtl?"rtl":void 0},c.a.createElement(Ce.a,{color:"black"}),c.a.createElement("div",{className:"state-text"},e("WaitingForNetwork")))}),Ee=a(134),Me=a(52),Se=a(29),ke=(e,t,a)=>{const s=Object(c.q)(),n=(e=>Object(c.p)(()=>Object(p.h)(e=>e(),e),[e]))(t),o=Object(Se.a)();return Object(Me.a)(()=>{let t=!0;n(()=>{s.current=e(),t||o()}),t=!1},a),s.current},Ne=a(171),Te=a(192);var Pe=Object(c.h)(Object(s.h)(e=>{const{chats:{byId:t},users:{byId:a},chatFolders:{byId:s,orderedIds:n,activeChatFolder:c},currentUserId:o,lastSyncTime:i}=e;return{chatsById:t,usersById:a,chatFoldersById:s,orderedFolderIds:n,lastSyncTime:i,notifySettings:Object(r.eb)(e),notifyExceptions:Object(r.db)(e),activeChatFolder:c,currentUserId:o}},(e,t)=>Object(h.l)(t,["loadChatFolders","setActiveChatFolder","openChat"]))(({chatsById:e,usersById:t,chatFoldersById:a,notifySettings:s,notifyExceptions:n,orderedFolderIds:o,activeChatFolder:r,currentUserId:i,lastSyncTime:d,loadChatFolders:b,setActiveChatFolder:u,openChat:O})=>{const j=Object(c.q)(null),g=Object(ue.a)();Object(c.n)(()=>{d&&b()},[d,b]);const f=Object(c.p)(()=>o?o.map(e=>a[e]||{}).filter(Boolean):void 0,[a,o]),p=ke(()=>{if(!f||!f.length)return;const a=Object.keys(e).map(Number),c=f.map(c=>{const{unreadDialogsCount:o,hasActiveDialogs:r}=Object(l.o)(e,t,c,a,s,n)||{};return{id:c.id,badgeCount:o,isBadgeActive:r}});return Object(h.c)(c,"id")},3e3,[f,e,t,s,n]),I=Object(c.p)(()=>{if(f&&f.length)return[{title:g("FilterAllChats")},...f.map(e=>({title:e.title,...p&&p[e.id]}))]},[f,p,g]),v=Object(c.m)(e=>{u(e)},[u]);Object(c.n)(()=>{I&&I.length&&r>=I.length&&u(0)},[r,I,u]),Object(c.n)(()=>{if(j.current&&m.n&&I&&I.length)return Object(Ee.b)(j.current,{onSwipe:(e,t)=>{t===Ee.a.Left?u(Math.min(r+1,I.length-1)):t===Ee.a.Right&&u(Math.max(0,r-1))}})},[r,I,u]);const y=Object(c.q)();y.current=0!==r,Object(c.n)(()=>y.current?Object(le.a)(()=>{y.current&&u(0)}):void 0,[r,u]),Object(he.a)(0!==r,()=>u(0)),Object(c.n)(()=>{const e=e=>{if(e.ctrlKey&&e.shiftKey&&e.code.startsWith("Digit")&&I){const[,t]=e.code.match(/Digit(\d)/)||[];if(!t)return;if("0"===t)return void O({id:i});const a=Number(t)-1;if(a>I.length-1)return;u(a),e.preventDefault()}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}});const{shouldRender:C,transitionClassNames:w}=Object(oe.a)(!o,void 0,!0);function E(e){const t=Object.values(a).find(({title:e})=>e===I[r].title);return t&&0!==r?c.a.createElement(Te.a,{folderType:"folder",folderId:t.id,noChatsText:g("FilterNoChatsToDisplay"),isActive:e}):c.a.createElement(Te.a,{folderType:"all",isActive:e})}return c.a.createElement("div",{className:"ChatFolders"},I&&I.length?c.a.createElement(Ne.a,{tabs:I,activeTab:r,onSwitchTab:v}):C?c.a.createElement("div",{className:Object(ce.a)("tabs-placeholder",w)}):void 0,c.a.createElement(de.a,{ref:j,name:g.isRtl?"slide-reversed":"slide",activeKey:r,renderCount:I?I.length:void 0},E))})),Ae=a(12),xe=a(20),Re=a(18);var Le=Object(c.h)(e=>{const t=Object(xe.a)(Ae.a.Extra,"LeftSearch");return t?c.a.createElement(t,e):c.a.createElement(Re.a,null)});var Be=Object(c.h)(e=>{const t=Object(xe.a)(Ae.a.Extra,"ContactList");return t?c.a.createElement(t,e):c.a.createElement(Re.a,null)}),De=a(54);a(213);let Fe;var Ue=Object(c.h)(({isShown:e,onNewPrivateChat:t,onNewChannel:a,onNewGroup:s})=>{const[n,o]=Object(c.r)(!1);Object(c.n)(()=>{e||o(!1)},[e]);const r=Object(ue.a)(),i=Object(ce.a)("NewChatButton",e&&"revealed",n&&"menu-is-open"),l=Object(c.m)(()=>{Fe&&(clearTimeout(Fe),Fe=void 0)},[]),d=Object(c.m)(()=>{Fe&&(clearTimeout(Fe),Fe=void 0),Fe=window.setTimeout(()=>{o(!1)},750)},[]);return c.a.createElement("div",{className:i,onMouseEnter:l,onMouseLeave:d},c.a.createElement(ge.a,{round:!0,color:"primary",className:n?"active":"",onClick:()=>{o(!n)},ariaLabel:r(n?"Close":"NewMessageTitle"),tabIndex:-1},c.a.createElement("i",{className:"icon-new-chat-filled"}),c.a.createElement("i",{className:"icon-close"})),c.a.createElement(De.a,{isOpen:n,positionX:"right",positionY:"bottom",autoClose:!0,onClose:()=>{o(!1)}},c.a.createElement(je.a,{icon:"channel",onClick:a},r("NewChannel")),c.a.createElement(je.a,{icon:"group",onClick:s},r("NewGroup")),c.a.createElement(je.a,{icon:"user",onClick:t},r("NewMessageTitle"))))}),He=a(159);a(214);const qe=Object.keys(u.d).length/2;let _e;var Ge=Object(s.h)(e=>Object(h.l)(e,["connectionState"]))(({content:e,searchQuery:t,searchDate:a,contactsFilter:s,shouldSkipTransition:n,onSearchQuery:o,onContentChange:r,onReset:i,connectionState:l})=>{const[d,b]=Object(c.r)(m.n),h=!function(){const[e,t]=Object(c.r)(window.navigator.onLine);return Object(c.n)(()=>{function e(){t(window.navigator.onLine)}return window.addEventListener("online",e),window.addEventListener("offline",e),()=>{window.removeEventListener("offline",e),window.removeEventListener("online",e)}},[]),e}()||"connectionStateConnecting"===l,O=Object(c.q)(!1),j=Object(c.m)(()=>{r(u.d.Settings)},[r]),g=Object(c.m)(()=>{r(u.d.Contacts)},[r]),f=Object(c.m)(()=>{r(u.d.NewChannelStep1)},[r]),p=Object(c.m)(()=>{r(u.d.NewGroupStep1)},[r]),I=Object(c.m)(()=>{r(u.d.Archived)},[r]),v=Object(c.m)(()=>{e===u.d.ChatList&&(O.current=!0,b(!0))},[e]),y=Object(c.m)(()=>{O.current=!1,_e&&(clearTimeout(_e),_e=void 0),_e=window.setTimeout(()=>{O.current||b(!1)},250)},[]);Object(c.n)(()=>{let t;return e!==u.d.ChatList?t=window.setTimeout(()=>{b(!1)},250):(O.current||m.n)&&b(!0),()=>{t&&(clearTimeout(t),t=void 0)}},[e]);const[C,w,E]=function(){const[e,t]=Object(be.a)(!1);Object(c.n)(()=>{const e=window.setTimeout(t,2592e5);return()=>{clearTimeout(e)}},[t]);const{shouldRender:a,transitionClassNames:s}=Object(oe.a)(e);return[a,s,()=>{window.location.reload()}]}(),M=Object(ue.a)();return c.a.createElement("div",{id:"LeftColumn-main",onMouseEnter:m.n?void 0:v,onMouseLeave:m.n?void 0:y},c.a.createElement(ye,{content:e,contactsFilter:s,onSearchQuery:o,onSelectSettings:j,onSelectContacts:g,onSelectArchived:I,onReset:i,shouldSkipTransition:n}),c.a.createElement(He.a,{isOpen:h,isCustom:!0,className:"connection-state-wrapper opacity-transition slow"},()=>c.a.createElement(we,null)),c.a.createElement(de.a,{name:n?"none":"zoom-fade",renderCount:qe,activeKey:e,shouldCleanup:!0,cleanupExceptionKey:u.d.ChatList,className:h?"pull-down":void 0},n=>{switch(e){case u.d.ChatList:return c.a.createElement(Pe,null);case u.d.GlobalSearch:return c.a.createElement(Le,{searchQuery:t,searchDate:a,isActive:n,onReset:i});case u.d.Contacts:return c.a.createElement(Be,{filter:s,isActive:n,onReset:i});default:return}}),C&&c.a.createElement(ge.a,{fluid:!0,pill:!0,className:Object(ce.a)("btn-update",w),onClick:E},M("lng_update_telegram")),c.a.createElement(Ue,{isShown:d,onNewPrivateChat:g,onNewChannel:f,onNewGroup:p}))});var ze=Object(c.h)(e=>{const t=Object(xe.a)(Ae.a.Extra,"Settings");return t?c.a.createElement(t,e):c.a.createElement(Re.a,null)});var $e=Object(c.h)(e=>{const t=Object(xe.a)(Ae.a.Extra,"NewChat");return t?c.a.createElement(t,e):c.a.createElement(Re.a,null)});var We,Ve=Object(c.h)(e=>{const t=Object(xe.a)(Ae.a.Extra,"ArchivedChats");return t?c.a.createElement(t,e):c.a.createElement(Re.a,null)});a(215);!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"}(We||(We={}));const Ke=Object.keys(We).length/2;var Qe=Object(c.h)(Object(s.h)(e=>{const{globalSearch:{query:t,date:a},chatFolders:{activeChatFolder:s},shouldSkipHistoryAnimations:n}=e;return{searchQuery:t,searchDate:a,activeChatFolder:s,shouldSkipHistoryAnimations:n}},(e,t)=>Object(h.l)(t,["setGlobalSearchQuery","setGlobalSearchChatId","resetChatCreation","setGlobalSearchDate","loadPasswordInfo","clearTwoFaError"]))(({searchQuery:e,searchDate:t,activeChatFolder:a,shouldSkipHistoryAnimations:s,setGlobalSearchQuery:n,setGlobalSearchChatId:o,resetChatCreation:r,setGlobalSearchDate:i,loadPasswordInfo:l,clearTwoFaError:d})=>{const[b,h]=Object(c.r)(u.d.ChatList),[O,j]=Object(c.r)(u.n.Main),[g,f]=Object(c.r)(""),[p,I]=Object(c.r)(0);let v=We.Main;switch(b){case u.d.Archived:v=We.Archived;break;case u.d.Settings:v=We.Settings;break;case u.d.NewChannelStep1:case u.d.NewChannelStep2:v=We.NewChannel;break;case u.d.NewGroupStep1:case u.d.NewGroupStep2:v=We.NewGroup}const y=Object(c.m)(e=>{if(b!==u.d.NewGroupStep2||e)if(b!==u.d.NewChannelStep2||e){if(b===u.d.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(b===u.d.Settings)switch(O){case u.n.EditProfile:case u.n.Folders:case u.n.General:case u.n.Notifications:case u.n.Privacy:case u.n.Language:return void j(u.n.Main);case u.n.GeneralChatBackground:return void j(u.n.General);case u.n.GeneralChatBackgroundColor:return void j(u.n.GeneralChatBackground);case u.n.PrivacyPhoneNumber:case u.n.PrivacyLastSeen:case u.n.PrivacyProfilePhoto:case u.n.PrivacyForwarding:case u.n.PrivacyGroupChats:case u.n.PrivacyActiveSessions:case u.n.PrivacyBlockedUsers:case u.n.TwoFaDisabled:case u.n.TwoFaEnabled:case u.n.TwoFaCongratulations:return void j(u.n.Privacy);case u.n.PrivacyPhoneNumberAllowedContacts:case u.n.PrivacyPhoneNumberDeniedContacts:return void j(u.n.PrivacyPhoneNumber);case u.n.PrivacyLastSeenAllowedContacts:case u.n.PrivacyLastSeenDeniedContacts:return void j(u.n.PrivacyLastSeen);case u.n.PrivacyProfilePhotoAllowedContacts:case u.n.PrivacyProfilePhotoDeniedContacts:return void j(u.n.PrivacyProfilePhoto);case u.n.PrivacyForwardingAllowedContacts:case u.n.PrivacyForwardingDeniedContacts:return void j(u.n.PrivacyForwarding);case u.n.PrivacyGroupChatsAllowedContacts:case u.n.PrivacyGroupChatsDeniedContacts:return void j(u.n.PrivacyGroupChats);case u.n.TwoFaNewPassword:return void j(u.n.TwoFaDisabled);case u.n.TwoFaNewPasswordConfirm:return void j(u.n.TwoFaNewPassword);case u.n.TwoFaNewPasswordHint:return void j(u.n.TwoFaNewPasswordConfirm);case u.n.TwoFaNewPasswordEmail:return void j(u.n.TwoFaNewPasswordHint);case u.n.TwoFaNewPasswordEmailCode:return void j(u.n.TwoFaNewPasswordEmail);case u.n.TwoFaChangePasswordCurrent:case u.n.TwoFaTurnOff:case u.n.TwoFaRecoveryEmailCurrentPassword:return void j(u.n.TwoFaEnabled);case u.n.TwoFaChangePasswordNew:return void j(u.n.TwoFaChangePasswordCurrent);case u.n.TwoFaChangePasswordConfirm:return void j(u.n.TwoFaChangePasswordNew);case u.n.TwoFaChangePasswordHint:return void j(u.n.TwoFaChangePasswordConfirm);case u.n.TwoFaRecoveryEmail:return void j(u.n.TwoFaRecoveryEmailCurrentPassword);case u.n.TwoFaRecoveryEmailCode:return void j(u.n.TwoFaRecoveryEmail);case u.n.FoldersCreateFolder:case u.n.FoldersEditFolder:return void j(u.n.Folders)}b!==u.d.ChatList||0!==a?(h(u.d.ChatList),f(""),n({query:""}),i({date:void 0}),o({id:void 0}),r(),setTimeout(()=>{I(Date.now())},250)):h(u.d.GlobalSearch)}else h(u.d.NewChannelStep1);else h(u.d.NewGroupStep1)},[b,a,O,n,i,o,r]),C=Object(c.m)(t=>{b!==u.d.Contacts?(h(u.d.GlobalSearch),t!==e&&n({query:t})):f(t)},[b,e,n]);Object(c.n)(()=>b!==u.d.ChatList||0===a?Object(le.a)(()=>y()):void 0,[a,b,y]),Object(c.n)(()=>{d(),O===u.n.Privacy&&l()},[d,l,O]);const w=e=>{h(u.d.Settings),j(e)};return c.a.createElement(de.a,{id:"LeftColumn",name:s?"none":m.p,renderCount:Ke,activeKey:v,shouldCleanup:!0,cleanupExceptionKey:We.Main},a=>{switch(v){case We.Archived:return c.a.createElement(Ve,{isActive:a,onReset:y,onContentChange:h});case We.Settings:return c.a.createElement(ze,{isActive:a,currentScreen:O,onScreenSelect:w,onReset:y,shouldSkipTransition:s});case We.NewChannel:return c.a.createElement($e,{key:p,isActive:a,isChannel:!0,content:b,onContentChange:h,onReset:y});case We.NewGroup:return c.a.createElement($e,{key:p,isActive:a,content:b,onContentChange:h,onReset:y});default:return c.a.createElement(Ge,{content:b,searchQuery:e,searchDate:t,contactsFilter:g,onContentChange:h,onSearchQuery:C,onReset:y,shouldSkipTransition:s})}})})),Ye=a(140),Je=a(11),Xe=a(14),Ze=a(55);var et=()=>{const[e,t]=Object(c.r)(Ze.a.get());return Object(c.n)(()=>{const e=Object(p.h)(()=>{t(Ze.a.get())},250,!1);return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),e},tt=a(177);function at(e,t){const a=e<=n.jb?16:32,s=function(e){if(e>n.gb){const t=Math.min(Math.max(.25*e,288),424),a=Math.min(.25*e,424);return Math.min(e-t-a,728)}if(e>n.fb){const t=Math.min(Math.max(.4*e,288),424);return Math.min(e-t,728)}if(e>728)return 728;return e}(e),c=e<=n.jb?54:64,o=t?s-a-c:s-a,r=e>n.jb?Math.min(s-a,512):s-a,i=r/o,l=o/r;return{composerHiddenScale:i,toolbarHiddenScale:l,composerTranslateX:t?c/2*l:0,toolbarTranslateX:t?c/2*-1*i:0,unpinHiddenScale:r/258,toolbarForUnpinHiddenScale:258/r}}var st=a(130),nt=a(145),ct=a(136),ot=a(49),rt=a(109),it=a(126);var lt=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(xe.a)(Ae.a.Extra,"HeaderMenuContainer",!t);return a?c.a.createElement(a,e):void 0});var dt=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const n=Object(r.g)(e,t),c=Boolean(n&&Object(l.mb)(n));if(n&&n.isRestricted)return{noMenu:!0};const o=Object(r.P)(e,t),i="thread"===s&&a===b.MAIN_THREAD_ID,d="thread"===s&&a!==b.MAIN_THREAD_ID,u=Object(r.W)(e),h=Boolean(Object(r.L)(e,t)),O=Boolean(i&&n&&(c||Object(l.qb)(n))&&n.isNotJoined),j=i||d,g=i&&!o&&!O,f=!Object(r.S)(e),p=i&&!O;return{noMenu:!(m.l&&O||m.l&&j||g||f||p),isChannel:c,isRightColumnShown:u,canStartBot:h,canSubscribe:O,canSearch:j,canMute:g,canSelect:f,canLeave:p}},(e,t)=>Object(h.l)(t,["joinChannel","sendBotCommand","openLocalTextSearch"]))(({chatId:e,threadId:t,noMenu:a,isChannel:s,canStartBot:n,canSubscribe:o,canSearch:r,canMute:i,canSelect:l,canLeave:d,isRightColumnShown:b,joinChannel:u,sendBotCommand:h,openLocalTextSearch:O})=>{const j=Object(c.q)(null),[g,f]=Object(c.r)(!1),[p,I]=Object(c.r)(void 0),v=Object(c.m)(()=>{f(!0);const e=j.current.getBoundingClientRect();I({x:e.right,y:e.bottom})},[]),y=Object(c.m)(()=>{f(!1)},[]),C=Object(c.m)(()=>{I(void 0)},[]),w=Object(c.m)(()=>{u({chatId:e})},[u,e]),E=Object(c.m)(()=>{h({command:"/start"})},[h]),M=Object(c.m)(()=>{if(O(),m.l){document.querySelector("#MobileSearch input").focus()}else setTimeout(()=>{const e=document.querySelector(".RightHeader .SearchInput input");e&&e.focus()},400)},[O]),S=Object(ue.a)();return c.a.createElement("div",{className:"HeaderActions"},!m.l&&o&&c.a.createElement(ge.a,{size:"tiny",ripple:!0,fluid:!0,onClick:w},S(s?"Subscribe":"Join Group")),!m.l&&n&&c.a.createElement(ge.a,{size:"tiny",ripple:!0,fluid:!0,onClick:E},S("BotStart")),!m.l&&r&&c.a.createElement(ge.a,{round:!0,ripple:b,color:"translucent",size:"smaller",onClick:M,ariaLabel:"Search in this chat"},c.a.createElement("i",{className:"icon-search"})),(m.l||!o)&&c.a.createElement(ge.a,{ref:j,className:g?"active":"",round:!0,ripple:!m.l,size:"smaller",color:"translucent",disabled:a,ariaLabel:"More actions",onClick:v},c.a.createElement("i",{className:"icon-more"})),p&&c.a.createElement(lt,{chatId:e,threadId:t,isOpen:g,anchor:p,isChannel:s,canSubscribe:o,canSearch:r,canMute:i,canSelect:l,canLeave:d,onSubscribeChannel:w,onSearchClick:M,onClose:y,onCloseAnimationEnd:C}))})),bt=a(116),ut=a(25),mt=a(108),ht=a(45);function Ot(e){const t=e&&Object(l.F)(e),{sticker:a}=e&&e.content||{},s=t&&a&&!Object(m.t)()&&t.includes("image/webp"),[o,r]=Object(c.r)(ht.a),i=e&&e.id;return Object(c.o)(()=>{s&&Object(ht.c)("b64-"+i,t).then(r).catch(e=>{n.r&&console.error(e)})},[i,s,t]),s?o:t}var jt=a(118),gt=a(43);function ft(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 pt=Object(c.h)(({count:e,index:t})=>{const a=Object(c.q)(null),s=Object(c.p)(()=>function(e,t){const a=e-t-1,s=function(e){let t=8;1===e?t=36:2===e?t=17:3===e?t=11:(4===e||e>3)&&(t=7.5);return t}(e),n=function(e,t){let a=36;1===e?a=36:2===e?a=17:3===e?a=1===t?12:11:(4===e||e>3)&&(a=7.5);return a}(e,a),c=function(e,t){return e<=3?36:t*e+2*(e-1)}(e,s),o="clipPath"+e,r=function(e,t,a){let s="";if(3===a)s=ft(0,0,2,t,1)+ft(0,12,2,t+1,1)+ft(0,25,2,t,1);else for(let e=0;e\n \n `}(o,s,e),i=function(e,t,a){if(1===a)return 0;if(2===a)return 0===e?0:t+2;return 3===a?0===e?0:1===e?12:25:(t+2)*e}(a,s,e),l=function(e,t,a,s){if(t<=4)return 0;if(e<=1)return 0;if(e>=t-2)return s-36;return(a+4)/2+(e-2)*(a+2)}(a,e,s,c);return{markHeight:n,clipPath:r,markTranslateY:i,trackTranslateY:l,trackHeight:c,clipPathId:o}}(e,t),[e,t]);if(Object(c.n)(()=>{if(!a.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:n,markTranslateY:c,clipPathId:o,clipPath:r}=s,i=a.current.firstElementChild;if(a&&a.current){const s=a.current,{style:l}=s;l.height=e+"px",l.transform=`translateY(-${t}px)`,l.clipPath=`url("#${o}")`;const d=s.querySelector("svg"),b=s.querySelector("div"),u=s.querySelector("defs");d||i&&(i.innerHTML=` ${r} `),u&&(u.innerHTML=r),b&&(b.style.height=n+"px",b.style.transform=`translateY(${c}px)`)}},[s]),1===e)return c.a.createElement("div",{className:"pinned-message-border"},c.a.createElement("div",{className:"pinned-message-border-wrapper-1",ref:a}));const{trackHeight:n,trackTranslateY:o,markHeight:r,markTranslateY:i,clipPathId:l}=s;return c.a.createElement("div",{className:Object(ce.a)("pinned-message-border",e>4&&"pinned-message-border-mask")},c.a.createElement("div",{className:"pinned-message-border-wrapper",ref:a,style:`clip-path: url("#${l}"); width: 2px;\n height: ${n}px; transform: translateY(-${o}px);`},c.a.createElement("span",null),c.a.createElement("div",{className:"pinned-message-border-mark",style:`height: ${r}px; transform: translateY(${i}px);`})))});var It=Object(c.h)(({message:e,count:t,index:a,customTitle:s,className:n,onUnpinMessage:o,onClick:r,onAllPinnedClick:i})=>{const d=Object(ue.a)(),b=Ot(e),u=Object(mt.a)(Object(l.E)(e,"pictogram")),m=Object(l.O)(d,e,Boolean(b)),[h,O,j]=Object(be.a)(),g=Object(c.m)(()=>{j(),o&&o(e.id)},[j,o,e.id]);return c.a.createElement("div",{className:Object(ce.a)("HeaderPinnedMessage-wrapper",n)},t>1&&c.a.createElement(ge.a,{round:!0,size:"smaller",color:"translucent",className:"pin-list-button",ariaLabel:d("EventLogFilterPinnedMessages"),onClick:i},c.a.createElement("i",{className:"icon-pin-list"})),o&&c.a.createElement(ge.a,{round:!0,size:"smaller",color:"translucent",ariaLabel:d("UnpinMessageAlertTitle"),className:"unpin-button",onClick:O},c.a.createElement("i",{className:"icon-close"})),c.a.createElement(jt.a,{isOpen:h,onClose:j,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:g}),c.a.createElement("div",{className:"HeaderPinnedMessage",onClick:r,dir:d.isRtl?"rtl":void 0},c.a.createElement(pt,{count:t,index:a}),b&&function(e,t){const{width:a,height:s}=Object(bt.m)();return c.a.createElement("img",{src:t||e,width:a,height:s,alt:""})}(b,u),c.a.createElement("div",{className:"message-text"},c.a.createElement("div",{className:"title",dir:"auto"},s||`${d("PinnedMessage")} ${a>0?"#"+(t-a):""}`),c.a.createElement("p",{dir:"auto"},Object(ut.a)(m))),c.a.createElement(gt.a,null)))}),vt=a(57),yt=a(178);a(218);var Ct=Object(s.h)((e,{message:t})=>({sender:Object(r.ub)(e,t)}),(e,t)=>Object(h.l)(t,["focusMessage","closeAudioPlayer"]))(({message:e,className:t,noUi:a,sender:s,focusMessage:n,closeAudioPlayer:o})=>{const r=Object(ue.a)(),i=s?Object(l.X)(r,s):void 0,d=vt.c(Object(l.E)(e,"inline")),{playPause:b,isPlaying:u}=Object(yt.a)(Object(l.C)(e),Object(l.q)(e),d,void 0,void 0,!0),h=Object(c.m)(()=>{n({chatId:e.chatId,messageId:e.id})},[n,e.chatId,e.id]),O=Object(c.m)(()=>{u&&b(),o()},[o,u,b]);if(a)return;const j=Object(l.t)(e);return c.a.createElement("div",{className:Object(ce.a)("AudioPlayer",t),dir:r.isRtl?"rtl":void 0},c.a.createElement(ge.a,{round:!0,ripple:!m.l,color:"translucent",size:"smaller",className:Object(ce.a)("toggle-play",u?"pause":"play"),onClick:b,ariaLabel:u?"Pause audio":"Play audio"},c.a.createElement("i",{className:"icon-play"}),c.a.createElement("i",{className:"icon-pause"})),c.a.createElement("div",{className:"AudioPlayer-content",onClick:h},j?function(e){const{title:t,performer:a,fileName:s}=e;return c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"title",dir:"auto"},Object(ut.a)(t||s)),a&&c.a.createElement("div",{className:"subtitle",dir:"auto"},Object(ut.a)(a)))}(j):function(e,t){return c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"title",dir:"auto"},t&&Object(ut.a)(t)),c.a.createElement("div",{className:"subtitle",dir:"auto"},e))}(r("AttachAudio"),i),c.a.createElement(gt.a,null)),c.a.createElement(ge.a,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:O,ariaLabel:"Close player"},c.a.createElement("i",{className:"icon-close"})))});a(219);var wt=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const{isLeftColumnShown:n,lastSyncTime:c,shouldSkipHistoryAnimations:o}=e,{byId:i}=e.chats,l=Object(r.g)(e,t),{typingStatus:d}=l||{},{chatId:u,messageId:m}=e.audioPlayer,h=u&&m?Object(r.l)(e,u,m):void 0,O=Object(r.Fb)(e,t,a);let j;if("pinned"===s){const a=Object(r.jb)(e,t);j=a&&a.length}else if("scheduled"===s){const a=Object(r.pb)(e,t);j=a&&a.length}else if("thread"===s&&a!==b.MAIN_THREAD_ID){const s=Object(r.Eb)(e,t,a);s&&(j=s.messagesCount)}const g={typingStatus:d,isLeftColumnShown:n,isRightColumnShown:Object(r.W)(e),isSelectModeActive:Object(r.S)(e),audioMessage:h,chat:l,chatsById:i,originChatId:O?O.id:t,messagesCount:j,isChatWithSelf:Object(r.P)(e,t),isChatWithBot:l&&Object(r.O)(e,l),lastSyncTime:c,notifySettings:Object(r.eb)(e),notifyExceptions:Object(r.db)(e),shouldSkipHistoryAnimations:o},f=Object(r.n)(e,t);if("thread"!==s||!f)return g;if(Object.assign(g,{messagesById:f}),a!==b.MAIN_THREAD_ID){const s=Object(r.Gb)(e,t,a),n=s?Object(r.l)(e,t,s):void 0,c=n?Object(r.K)(e,n):void 0;return{...g,pinnedMessageIds:s,canUnpin:!1,topMessageSender:c}}const p=Object(r.jb)(e,t);if(p&&p.length){const t=f[p[0]],{canUnpin:s}=t&&Object(r.b)(e,t,a)||{};return{...g,pinnedMessageIds:p,canUnpin:s}}return g},(e,t)=>Object(h.l)(t,["openChatWithInfo","pinMessage","focusMessage","openChat","loadPinnedMessages","toggleLeftColumn","exitMessageSelectMode"]))(({chatId:e,threadId:t,messageListType:a,isReady:s,pinnedMessageIds:o,messagesById:r,canUnpin:i,topMessageSender:d,typingStatus:u,isSelectModeActive:h,isLeftColumnShown:O,isRightColumnShown:j,audioMessage:g,chat:f,chatsById:p,originChatId:I,messagesCount:v,isChatWithSelf:y,isChatWithBot:C,lastSyncTime:w,notifySettings:E,notifyExceptions:M,shouldSkipHistoryAnimations:S,openChatWithInfo:k,pinMessage:N,focusMessage:T,openChat:P,loadPinnedMessages:A,toggleLeftColumn:x,exitMessageSelectMode:R})=>{const L=Object(ue.a)(),[B,D]=Object(c.r)(0),F=Array.isArray(o)?o[B]:o,U=r&&F?r[F]:void 0,H=Array.isArray(o)?o.length:o?1:0,q=f&&Object(l.k)(L,f).length,_=d?Object(l.X)(L,d):void 0;Object(c.n)(()=>{t===b.MAIN_THREAD_ID&&w&&s&&A({chatId:e})},[e,A,w,t,s]),Object(c.n)(()=>{D(0)},[o]),Object(nt.a)(e,F,U);const{width:G}=et(),z=G<=n.fb,$=m.m&&O,W=Object(c.q)(null),V=Object(c.q)(!0),K=Object(c.m)(()=>{k({id:e})},[k,e]),Q=Object(c.m)(t=>{N({chatId:e,messageId:t,isUnpin:!0})},[N,e]),Y=Object(c.m)(()=>{if(U){T({chatId:U.chatId,threadId:t,messageId:U.id});const e=Object(st.a)(H,B+1);D(e)}},[U,T,t,H,B]),J=Object(c.m)(()=>{P({id:e,threadId:b.MAIN_THREAD_ID,type:"pinned"})},[P,e]),X=Object(c.m)(e=>{if(m.l){const e=document.getElementById(n.x);e&&e.blur()}t!==b.MAIN_THREAD_ID||"thread"!==a?("scheduled"===a&&h&&R(),P({id:I,threadId:b.MAIN_THREAD_ID})):m.l||$?(e.stopPropagation(),P({id:void 0})):x()},[P,I,t,a,x,h,R,$]),Z=Object(c.p)(()=>{if(!z||!p)return;let e=!1;const t=Object.values(p).reduce((t,a)=>{if(Object(l.kb)(a))return t;const s=a.unreadCount||0;return!s||Object(l.Hb)(a,E,M)&&!a.unreadMentionsCount||(e=!0),t+s},0);return t?{isActive:e,totalCount:t}:void 0},[z,p,E,M]),ee=G>=n.fb&&Gn.jb&&G30),te=ee||G>n.gb&&G{const e=W.current;if(e)return te&&me?void(j||ee?(V.current&&(e.classList.add("tools-stacked","animated"),V.current=!1),setTimeout(()=>{e.classList.remove("animated")},350)):(e.classList.remove("tools-stacked"),V.current=!0)):(e.classList.remove("tools-stacked","animated"),void(V.current=!0))},[te,me,ee,j]),c.a.createElement("div",{className:"MiddleHeader",ref:W},c.a.createElement(de.a,{name:S?"none":"slide-fade",activeKey:"thread"===a?t:1},he),c.a.createElement("div",{className:"header-tools"},re&&le&&!ae&&c.a.createElement(It,{key:e,message:le,count:H,index:B,customTitle:be,className:ie,onUnpinMessage:i?Q:void 0,onClick:Y,onAllPinnedClick:J}),ae&&ne&&c.a.createElement(Ct,{key:Object(l.C)(ne),message:ne,className:se}),c.a.createElement(dt,{chatId:e,threadId:t,messageListType:a})))})),Et=a(161);function Mt(e){return"albumId"in e}function St(e,t){let a,s=[],n={originalDate:e[0].date,datetime:Number(Object(L.j)(1e3*e[0].date)),senderGroups:[s]};const c=[n];return e.forEach((o,r)=>{o.isInAlbum?a?(a.messages.push(o),o.content.text&&(a.mainMessage=o)):a={albumId:o.groupedId,messages:[o],mainMessage:o}:s.push(o);const i=e[r+1];if(!a||i&&i.groupedId&&i.groupedId===a.albumId||(s.push(a),a=void 0),i){const e=Number(Object(L.j)(1e3*i.date));n.datetime!==e?(n={originalDate:i.date,datetime:e,senderGroups:[]},c.push(n),s=[],n.senderGroups.push(s)):(i.id===t||o.senderId!==i.senderId||o.isOutgoing!==i.isOutgoing||Object(l.gb)(o)||Object(l.gb)(i)||o.forwardInfo&&i.forwardInfo&&(o.forwardInfo.senderUserId!==i.forwardInfo.senderUserId||o.forwardInfo.fromChatId!==i.forwardInfo.fromChatId||o.forwardInfo.hiddenUserName!==i.forwardInfo.hiddenUserName)||o.inlineButtons||i.inlineButtons||i.date-o.date>600)&&(s=[],n.senderGroups.push(s))}}),c}function kt(e){!m.l&&document.activeElement&&document.activeElement.id===n.x&&e.target===e.currentTarget&&e.preventDefault()}var Nt=a(107);function Tt(){const[e,t]=Object(be.a)(!1),a=(s=1e3,n=!1,Object(c.p)(()=>Object(p.a)(e=>e(),s,n,o),[s,n,o]));var s,n,o;return{isScrolled:e,updateStickyDates:Object(c.m)((e,s)=>{t(),document.body.classList.contains("is-scrolling-messages")||Object(p.b)(()=>{document.body.classList.add("is-scrolling-messages")}),a(()=>{Object(p.b)(()=>{const t=document.querySelector(".stuck");t&&t.classList.remove("stuck");const a=function(e,t){const a=e.querySelectorAll(".sticky-date"),s=e.scrollTop;return Array.from(a).find(e=>{const{offsetTop:a,offsetHeight:n}=e,c=a-s;return-n<=c&&c<=(t?60:10)})}(e,s);a&&a.classList.add("stuck"),document.body.classList.remove("is-scrolling-messages")})})},[t,a])}}var Pt=a(156),At=a(127);var xt=({containerRef:e,className:t,messageIds:a,loadMoreForwards:s,loadMoreBackwards:o,isViewportNewest:r,firstUnreadId:i,onFabToggle:l,onNotchToggle:d,children:b})=>{const u=Object(c.q)(null),m=Object(c.q)(null),h=Object(c.q)(null),O=Object(c.m)(()=>{if(!a||!a.length)return l(!1),void d(!1);if(!r)return l(!0),void d(!0);const{offsetHeight:t,scrollHeight:s,scrollTop:n}=e.current,c=s-n-t,o=c<=0;l(i?!o:!(c<=50)),d(!o)},[a,r,e,l,i,d]),{observe:j}=Object(Nt.a)({rootRef:e,margin:n.ab},t=>{if(!s||!o)return;const a=t.find(({isIntersecting:e})=>e);if(!a)return;const{target:n}=a;"backwards-trigger"===n.className?(Object(Pt.a)(e.current),o()):"forwards-trigger"===n.className&&(Object(Pt.a)(e.current),s())});Object(Nt.c)(u,j),Object(Nt.c)(m,j);const{observe:g,freeze:f,unfreeze:p}=Object(Nt.a)({rootRef:e,margin:50},O);Object(Nt.c)(h,g);const{observe:I,freeze:v,unfreeze:y}=Object(Nt.a)({rootRef:e},O);return Object(Nt.c)(h,I),Object(Me.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"}))},Rt=a(146),Lt=a(147);function Bt(e){return"number"==typeof e}function Dt(e,t){return e?t?238:175:100}function Ft(e,t){const a=Object(l.yb)(e),s=Object(l.tb)(e),n=Object(l.H)(e)||Object(l.S)(e),c=Object(l.Q)(e),o=Boolean(Object(l.S)(e)),{width:r,height:i}=n?Object(bt.g)(n,a,s,o,t):Object(bt.i)(c,a,s,t),d=Dt(Boolean(Object(l.P)(e)));let b=1;re+t,t)}function $t(e,t,a){return ea?a:e}function Wt(e){const t={width:0,height:0};return e.forEach(({dimensions:e,sides:a})=>{a&qt&&(t.width=e.width+e.x),a&_t&&(t.height=e.height+e.y)}),t}function Vt(e,t,a,s){const n=s.messages.map(e=>{const t=Ft(e);return t.width/t.height});const c=function(e){return e.map(e=>e>1.2?"w":e<.8?"n":"q").join("")}(n),o=function(e){return e.reduce((e,t)=>t+e,1)/e.length}(n),r=n.length,i=n.some(e=>e>2),l=Object(bt.j)(e,t,!1,a)-(t?2.5:0)*bt.d;let d;const b={ratios:n,proportions:c,averageRatio:o,maxWidth:l,minWidth:100,maxHeight:l,spacing:2};return d=r>=5||i?function({ratios:e,averageRatio:t,maxWidth:a,minWidth:s,spacing:n,maxHeight:c=4*a/3}){const o=function(e,t){return e.map(e=>t>1.1?$t(e,1,2.75):$t(e,.6667,1))}(e,t),r=e.length,i=new Array(r),l=[],d=e=>{const t=[];let s=0;e.forEach(e=>{t.push(((e,t)=>{const s=zt(o.slice(e,e+t),0);return(a-(t-1)*n)/s})(s,e)),s+=e}),l.push({lineCounts:e,heights:t})};for(let e=1;e!==r;++e){const t=r-e;e<=3&&t<=3&&d([e,t])}for(let e=1;e!==r-1;++e)for(let a=1;a!==r-e;++a){const s=r-e-a;e<=3&&a<=(t<.85?4:3)&&s<=3&&d([e,a,s])}for(let e=1;e!==r-1;++e)for(let t=1;t!==r-e;++t)for(let a=1;a!==r-e-t;++a){const s=r-e-t-a;e<=3&&t<=3&&a<=3&&s<=4&&d([e,t,a,s])}let b,u=0;for(let e=0;e{for(let e=1;e!==o;++e)if(a[e-1]>a[e])return 1.5;return 1})(),m=Math.abs(r-c)*i*d;(!b||m1.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:Gt|Ht|qt},{dimensions:{x:0,y:c+s,width:a,height:c},sides:Gt|_t|qt}]}(e):"ww"===a||"qq"===a?function(e){const{ratios:t,maxWidth:a,spacing:s,maxHeight:n}=e,c=(a-s)/2,o=Math.round(Math.min(c/t[0],Math.min(c/t[1],n)));return[{dimensions:{x:0,y:0,width:c,height:o},sides:Ht|Gt|_t},{dimensions:{x:c+s,y:0,width:c,height:o},sides:Ht|qt|_t}]}(e):function(e){const{ratios:t,minWidth:a,maxWidth:s,spacing:n,maxHeight:c}=e,o=Math.round(1.5*a),r=Math.min(Math.round(Math.max(.4*(s-n),(s-n)/t[0]/(1/t[0]+1/t[1]))),s-n-o),i=s-r-n,l=Math.min(c,Math.round(Math.min(i/t[0],r/t[1])));return[{dimensions:{x:0,y:0,width:i,height:l},sides:Ht|Gt|_t},{dimensions:{x:i+n,y:0,width:r,height:l},sides:Ht|qt|_t}]}(e)}(b):3===r?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:a,ratios:s,maxWidth:n,minWidth:c}=e,o=t,r=Math.round(Math.min((t-a)/2,s[1]*(n-a)/(s[2]+s[1]))),i=o-r-a,l=Math.max(c,Math.round(Math.min((n-a)/2,Math.min(r*s[2],i*s[1])))),d=Math.min(Math.round(o*s[0]),n-a-l);return[{dimensions:{x:0,y:0,width:d,height:o},sides:Ht|Gt|_t},{dimensions:{x:d+a,y:0,width:l,height:i},sides:Ht|qt},{dimensions:{x:d+a,y:i+a,width:l,height:r},sides:_t|qt}]}(e):function(e){const{maxWidth:t,ratios:a,maxHeight:s,spacing:n}=e,c=t,o=Math.round(Math.min(c/a[0],.66*(s-n))),r=(t-n)/2,i=Math.min(s-o-n,Math.round(Math.min(r/a[1],r/a[2])));return[{dimensions:{x:0,y:0,width:c,height:o},sides:Gt|Ht|qt},{dimensions:{x:0,y:o+n,width:r,height:i},sides:_t|Gt},{dimensions:{x:r+n,y:o+n,width:c-r-n,height:i},sides:_t|qt}]}(e)}(b):function(e){const{proportions:t}=e;return"w"===t[0]?function({maxWidth:e,ratios:t,spacing:a,maxHeight:s,minWidth:n}){const c=e,o=Math.round(Math.min(c/t[0],.66*(s-a))),r=Math.round((e-2*a)/(t[1]+t[2]+t[3])),i=Math.max(n,Math.round(Math.min(.4*(e-2*a),r*t[1]))),l=Math.round(Math.max(Math.max(n,.33*(e-2*a)),r*t[3])),d=c-i-l-2*a,b=Math.min(s-o-a,r);return[{dimensions:{x:0,y:0,width:c,height:o},sides:Gt|Ht|qt},{dimensions:{x:0,y:o+a,width:i,height:b},sides:_t|Gt},{dimensions:{x:i+a,y:o+a,width:d,height:b},sides:_t},{dimensions:{x:i+a+d+a,y:o+a,width:l,height:b},sides:qt|_t}]}(e):function({maxHeight:e,ratios:t,maxWidth:a,spacing:s,minWidth:n}){const c=e,o=Math.round(Math.min(c*t[0],.6*(a-s))),r=Math.round((e-2*s)/(1/t[1]+1/t[2]+1/t[3])),i=Math.round(r/t[1]),l=Math.round(r/t[2]),d=c-i-l-2*s,b=Math.max(n,Math.min(a-o-s,r));return[{dimensions:{x:0,y:0,width:o,height:c},sides:Ht|Gt|_t},{dimensions:{x:o+s,y:0,width:b,height:i},sides:Ht|qt},{dimensions:{x:o+s,y:i+s,width:b,height:l},sides:qt},{dimensions:{x:o+s,y:i+l+2*s,width:b,height:d},sides:_t|qt}]}(e)}(b),{layout:d,containerStyle:Wt(d)}}let Kt;function Qt(e){return Kt||(Kt=document.createElement("span"),Kt.style.font='400 12px "Roboto", -apple-system, "Apple Color Emoji", BlinkMacSystemFont, "Helvetica Neue", sans-serif',Kt.style.whiteSpace="nowrap",Kt.style.position="absolute",Kt.style.left="-999px",Kt.style.opacity=".01",document.body.appendChild(Kt)),Kt.innerHTML=e,Kt.offsetWidth}function Yt(e,t,a,s,n){Object(c.o)(()=>{if(a&&e.current){const t=e.current.closest(".MessageList");Object(At.a)(t,e.current,n?"end":"centerOrTop",20,void 0!==s?1e3:void 0,s)}},[e,t,a,s,n])}var Jt=a(112),Xt=a(68);var Zt=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(xe.a)(Ae.a.Extra,"ContextMenuContainer",!t);return a?c.a.createElement(a,e):void 0});var ea=Object(c.h)(Object(s.h)((e,{message:t})=>{const{byId:a}=e.users,s=t.senderId,{targetUserIds:n,targetChatId:c}=t.content.action||{},o=t.replyToMessageId,i=o?Object(r.l)(e,t.chatId,o):void 0,d=Object(r.U)(e,t),{direction:b,noHighlight:u}=d&&e.focusedMessage||{},m=Object(r.g)(e,t.chatId);return{usersById:a,sender:m&&(Object(l.mb)(m)||s===t.chatId)?m:s?Object(r.Ib)(e,s):void 0,targetChatId:c,targetUserIds:n,targetMessage:i,isFocused:d,...d&&{focusDirection:b,noFocusHighlight:u}}})(({message:e,observeIntersection:t,isEmbedded:a,appearanceOrder:s=0,isLastInList:n,usersById:o,sender:r,targetUserIds:i,targetMessage:l,targetChatId:d,isFocused:b,focusDirection:u,noFocusHighlight:m})=>{const h=Object(c.q)(null);Object(Nt.c)(h,t),Object(nt.a)(e.chatId,e.replyToMessageId,l),Yt(h,e.chatId,b,u,m);const O=Object(ue.a)(),j=s<=0,[g,f]=Object(be.a)(j);Object(c.n)(()=>{j||setTimeout(f,10*s)},[s,f,j]);const{transitionClassNames:p}=Object(oe.a)(g,void 0,j,!1),I=Object(c.p)(()=>i?i.map(e=>o&&o[e]).filter(Boolean):void 0,[i,o]),v=Object(Xt.a)(O,e,r,I,l,d,a?{isEmbedded:!0,asPlain:!0}:void 0),{isContextMenuOpen:y,contextMenuPosition:C,handleBeforeContextMenu:w,handleContextMenu:E,handleContextMenuClose:M,handleContextMenuHide:S}=Object(Rt.a)(h),k=void 0!==C;if(a)return c.a.createElement("span",{className:"embedded-action-message"},Object(ut.a)(v));const N=Object(ce.a)("ActionMessage message-list-item",b&&!m&&"focused",k&&"has-menu-open",n&&"last-in-list",p);return c.a.createElement("div",{ref:h,id:"message"+e.id,className:N,"data-message-id":e.id,onMouseDown:e=>{kt(e),w(e)},onContextMenu:E},c.a.createElement("span",null,v),C&&c.a.createElement(Zt,{isOpen:y,anchor:C,message:e,messageListType:"thread",onClose:M,onCloseAnimationEnd:S}))}));a(220);var ta=({className:e,message:t,sender:a,title:s,customText:n,observeIntersection:o,onClick:r})=>{const i=Object(c.q)(null),d=Object(Nt.b)(i,o),b=Object(mt.a)(t&&Object(l.E)(t,"pictogram"),!d),u=t&&"sticker-reply-thumb"+t.id,m=Ot(t),h=Boolean(t&&Object(l.J)(t)),O=Object(ue.a)(),j=a&&Object(l.X)(O,a);return c.a.createElement("div",{ref:i,className:Object(ce.a)("EmbeddedMessage",e),onClick:t?r:void 0},m&&function(e,t,a,s){const{width:n,height:o}=Object(bt.m)();return c.a.createElement("img",{id:e,src:a||t,width:n,height:o,alt:"",className:s?"round":""})}(u,m,b,h),c.a.createElement("div",{className:"message-text"},c.a.createElement("p",{dir:"auto"},t?Object(l.gb)(t)?c.a.createElement(ea,{message:t,isEmbedded:!0}):Object(ut.a)(Object(l.O)(O,t,Boolean(m))):n||" "),c.a.createElement("div",{className:"message-title",dir:"auto"},Object(ut.a)(j||s||" "))))},aa=a(162),sa=a(170),na=a(175);a(224);var ca=Object(c.h)(({message:e,outgoingStatus:t,signature:a,onClick:s})=>{const n=Object(ue.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(ot.b)(e.views)),c.a.createElement("i",{className:"icon-channelviews"})),a&&c.a.createElement("span",{className:"message-signature"},Object(ut.a)(a)),c.a.createElement("span",{className:"message-time"},e.isEdited&&n("EditedMessage")+" ",Object(L.h)(1e3*e.date)),t&&c.a.createElement(na.a,{status:t}))}),oa=a(115),ra=a(117),ia=a(163);a(225);var la=({message:e,observeIntersection:t,observeIntersectionForPlaying:a,shouldLoop:s,lastSyncTime:o})=>{const r=Object(c.q)(null),[i,d,b]=Object(be.a)(),u=e.content.sticker,{isAnimated:m,stickerSetId:h}=u,O=h===n.Y,j=Object(Nt.b)(r,t),g=Object(Nt.b)(r,a),f=u.isPreloadedGlobally?"sticker"+u.id:Object(l.E)(e,"inline"),p=Ot(e),I=Object(mt.a)(f,!j,Object(l.D)(e,"inline",!0),o),v=Boolean(I),[y,C]=Object(be.a)(v),w=m?y:v,{shouldRenderFullMedia:E,transitionClassNames:M}=Object(oa.a)(w,"slow"),{width:S,height:k}=Object(bt.n)(u),N=Object(ce.a)("thumbnail",!p&&"empty"),T=Object(ce.a)("Sticker media-inner",O&&"inactive");return c.a.createElement("div",{ref:r,className:T,onClick:O?void 0:d},!w&&c.a.createElement("img",{id:"sticker-thumb-"+e.id,src:p,width:S,height:k,alt:"",className:N}),!m&&E&&c.a.createElement("img",{id:"sticker-"+e.id,src:I,width:S,height:k,alt:"",className:Object(ce.a)("full-media",M)}),m&&v&&c.a.createElement(ra.a,{key:f,className:Object(ce.a)("full-media",M),id:f,animationData:I,size:S,play:g,noLoop:!s,onLoad:C}),c.a.createElement(ia.a,{isOpen:i,fromSticker:u,onClose:b}))},da=a(131),ba=a(121),ua=a(164);function ma(e,t){return Object(ua.a)(Object(l.F)(e),Boolean(t),m.l&&!m.c)}var ha=a(28);const Oa=Promise.resolve("rgba(255,255,255,1)");function ja(e,t,a,s){return s?Oa:async function(e,t){const a=new Image;a.src=e,a.width||await new Promise(e=>{a.onload=e});const s=document.createElement("canvas"),n=s.getContext("2d");s.width=a.width,s.height=a.height,n.drawImage(a,0,0,a.width,a.height);const c=t?a.width-1:0,o=a.height-1;return`rgba(${Array.from(n.getImageData(c,o,1,1).data).join(",")})`}(e,t)}var ga=a(122);var fa=({id:e,message:t,observeIntersection:a,noAvatars:s,shouldAutoLoad:n,isInSelectMode:o,isSelected:r,uploadProgress:i,size:d="inline",dimensions:b,nonInteractive:u,shouldAffectAppendix:m,onClick:h,onCancelUpload:O})=>{const j=Object(c.q)(null),g=(Object(l.H)(t)||Object(l.S)(t)).blobUrl,f=Object(Nt.b)(j,a),[p,I]=Object(c.r)(n),v=p&&f,{mediaData:y,downloadProgress:C}=Object(ba.a)(Object(l.E)(t,d),!v),w=g||y,E=ma(t,w),{isUploading:M,isTransferring:S,transferProgress:k}=Object(l.r)(t,i||C,v&&!w),N=!1===Object(ha.a)(p),{shouldRender:T,transitionClassNames:P}=Object(oe.a)(S,void 0,N,"slow"),{shouldRenderThumb:A,shouldRenderFullMedia:x,transitionClassNames:R}=Object(oa.a)(w,"slow"),L=Object(c.m)(()=>{M?O&&O(t):w?h&&h(t.id):I(e=>!e)},[w,M,t,O,h]),B=Object(l.yb)(t);Object(c.o)(()=>{if(!m)return;const e=j.current.closest(".message-content");w?ja(w,B,0,r).then(t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute("data-has-custom-appendix","")}):e.classList.add("has-appendix-thumb")},[w,B,m,o,r]);const{width:D,height:F,isSmall:U}=b||Ft(t,s),H=Object(ce.a)("media-inner",!M&&!u&&"interactive",U&&"small-image",D===F&&"square-image"),q=b?`width: ${D}px; height: ${F}px; left: ${b.x}px; top: ${b.y}px;`:"";return c.a.createElement("div",{id:e,ref:j,className:H,style:q,onClick:M?void 0:L},A&&c.a.createElement("canvas",{ref:E,className:"thumbnail",style:`width: ${D}px; height: ${F}px`}),x&&c.a.createElement("img",{src:w,className:"full-media "+R,width:D,height:F,alt:""}),T&&c.a.createElement("div",{className:"media-loading "+P},c.a.createElement(ga.a,{progress:k,onClick:M?L:void 0})),!w&&!p&&c.a.createElement("i",{className:"icon-download"}),S&&c.a.createElement("span",{className:"message-upload-progress"},Math.round(100*k),"%"))},pa=a(138),Ia=a(137);function va(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(Ia.a)(e.current)},[e]);Object(ne.a)(s,n)}var ya=a(148),Ca=(e,t=!1)=>{const a=Object(c.q)(!1),s=Object(c.q)(!1),n=Object(c.m)(()=>{s.current=!0,t&&e.current&&(a.current||(a.current=!e.current.paused),e.current.pause())},[t,e]),o=Object(c.m)(()=>{t&&e.current&&a.current&&document.body.contains(e.current)&&Object(Ia.a)(e.current),a.current=!1,s.current=!1},[t,e]),r=Object(c.m)(()=>{Object(p.b)(o)},[o]);document.hasFocus()||n(),Object(re.a)(n,r)};function wa(){return(wa=Object.assign||function(e){for(var t=1;t{const m=Object(c.q)(null),h=Object(c.q)(null),O=Object(l.Q)(t)||Object(l.T)(t),j=O.blobUrl,g=Object(Nt.b)(m,a),[f,p]=Object(c.r)(n),I=Boolean(f&&g&&i),[v,y]=Object(c.r)(o),C=Object(mt.a)(Object(l.E)(t,"pictogram"),!(g&&i),Object(l.D)(t,"pictogram"),i),{mediaData:w,downloadProgress:E}=Object(ba.a)(Object(l.E)(t,"inline"),!I,Object(l.D)(t,"inline"),i),M=j||w,S=Boolean(g&&M),k=ma(t,C),{isBuffered:N,bufferingHandlers:T}=Object(pa.a)(!n),{isUploading:P,isTransferring:A,transferProgress:x}=Object(l.r)(t,r||E,I&&!N),R=!1===Object(ha.a)(f),{shouldRender:B,transitionClassNames:D}=Object(oe.a)(A,void 0,R),{transitionClassNames:F}=Object(oa.a)(M,"slow"),[U,H]=Object(c.r)(0),q=Object(c.m)(e=>{H(Math.max(0,e.currentTarget.currentTime-1))},[]),_=h.current&&h.current.duration||O.duration||0,G=Object(l.yb)(t),z=Object(l.tb)(t),{width:$,height:W}=d||Object(bt.i)(O,G,z,s);va(h,Boolean(S&&o)),Ca(h,v),Object(ya.a)(h,[S]);const V=Object(c.m)(()=>{P?u&&u(t):M?M&&!v?(y(!0),h.current.play()):b&&b(t.id):p(e=>!e)},[P,M,v,b,u,t]),K=Object(ce.a)("media-inner dark",!P&&"interactive"),Q=Object(ce.a)("full-media",F),Y=d?`width: ${$}px; height: ${W}px; left: ${d.x}px; top: ${d.y}px;`:"";return c.a.createElement("div",{ref:m,id:e,className:K,style:Y,onClick:P?void 0:V},!C&&c.a.createElement("canvas",{ref:k,className:"thumbnail",style:`width: ${$}px; height: ${W}px;`}),C&&c.a.createElement("img",{src:C,className:"thumbnail",style:`width: ${$}px; height: ${W}px;`,alt:""}),S&&c.a.createElement("video",wa({ref:h,className:Q,width:$,height:W,autoPlay:v,muted:!0,loop:!0,playsInline:!0},T,{onTimeUpdate:q}),c.a.createElement("source",{src:M})),f&&!v&&!B&&c.a.createElement("i",{className:"icon-large-play"}),B&&c.a.createElement("div",{className:"media-loading "+D},c.a.createElement(ga.a,{progress:x,onClick:P?V:void 0})),!f&&c.a.createElement("i",{className:"icon-download"}),A?c.a.createElement("span",{className:"message-upload-progress"},"..."):c.a.createElement("div",{className:"message-media-duration"},O.isGif?"GIF":Object(L.e)(Math.max(_-U,0))))},Ma=a(19);a(227);var Sa=Object(s.h)((e,{contact:t})=>({user:Object(r.Ib)(e,t.userId)}),(e,t)=>Object(h.l)(t,["openUserInfo"]))(({contact:e,user:t,openUserInfo:a})=>{const{firstName:s,lastName:n,phoneNumber:o,userId:r}=e,i=Object(c.m)(()=>{a({id:r})},[a,r]);return c.a.createElement("div",{className:Object(ce.a)("Contact",Boolean(r)&&"interactive"),onClick:r?i:void 0},c.a.createElement(Jt.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(Ma.c)(o))))}),ka=a(47);var Na=Object(c.h)(({id:e,options:t,selected:a=[],disabled:s,round:n,loadingOptions:o,onChange:r})=>{const[i,l]=Object(c.r)([]),d=Object(c.m)(e=>{const{value:t,checked:a}=e.currentTarget;let s;s=a?[...i,t]:i.filter(e=>e!==t),l(s),r(s)},[r,i]);return c.a.createElement("div",{id:e,className:"radio-group"},t.map(e=>c.a.createElement(ka.a,{label:e.label,subLabel:e.subLabel,value:e.value,checked:-1!==a.indexOf(e.value),disabled:s,round:n,isLoading:o?-1!==o.indexOf(e.value):void 0,onChange:d})))}),Ta=a(123),Pa=a(183);a(230);function Aa(e,t){return t>0?(e/t*100).toFixed():0}var xa=({answer:e,voteResults:t,totalVoters:a,maxVotersCount:s,correctResults:n,shouldAnimate:o})=>{const r=t&&t.find(t=>t.option===e.option),i=0===n.length||-1!==n.indexOf(e.option),l=n.length>0&&i||r&&r.isChosen,d=r?Aa(r.votersCount,a||0):0,[b,u]=Object(c.r)(o?0:d),m=Object(c.q)(null),h=r?Aa(r.votersCount,s||0):0,O=b{o&&u(d)},[o,d]),Object(c.n)(()=>{const e=m.current;if(e&&o){const t=e.firstElementChild,a=O?"":"stroke-dasharray: 100% 200%; stroke-dashoffset: -44";t?t.setAttribute("style",a):e.innerHTML=`\n \n \n `}},[O,o]),!t||!r)return;const j=`width: ${h}%; transform:scaleX(${O?0:1})`;return c.a.createElement("div",{className:"PollOption",dir:"ltr"},c.a.createElement("div",{className:"poll-option-share "+("100"===d?"limit-width":"")},d,"%",l&&c.a.createElement("span",{className:Object(ce.a)("poll-option-chosen",!i&&"wrong",o&&"animate")},c.a.createElement("i",{className:i?"icon-check":"icon-close"}))),c.a.createElement("div",{className:"poll-option-right"},c.a.createElement("div",{className:"poll-option-text",dir:"auto"},Object(ut.a)(e.text)),c.a.createElement("div",{className:Object(ce.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(231);var Ra=Object(c.h)(Object(s.h)((e,{poll:t})=>{const{recentVoterIds:a}=t.results,{serverTimeOffset:s,users:{byId:n}}=e;return a&&0!==a.length?{recentVoterIds:a,usersById:n,serverTimeOffset:s}:{}},(e,t)=>Object(h.l)(t,["loadMessage","openPollResults"]))(({message:e,poll:t,recentVoterIds:a,usersById:s,loadMessage:n,onSendVote:o,openPollResults:r,serverTimeOffset:i})=>{const{id:l,chatId:d}=e,{summary:b,results:u}=t,[m,h]=Object(c.r)(!1),[O,j]=Object(c.r)([]),[g,f]=Object(c.r)(!1),[p,I]=Object(c.r)(!1),[v,y]=Object(c.r)(!b.closed&&b.closeDate&&b.closeDate>0?Math.min(b.closeDate-Math.floor(Date.now()/1e3)+i,b.closePeriod):0),C=Object(c.q)(null),{results:w,totalVoters:E}=u,M=w&&w.some(e=>e.isChosen),S=!b.closed&&!M,k=!S&&b.isPublic&&Number(u.totalVoters)>0,N=S&&b.multipleChoice,T=w?Math.max(...w.map(e=>e.votersCount)):E,P=w?w.reduce((e,t)=>(t.isCorrect&&e.push(t.option),e),[]):[],A=b.answers.map(e=>({label:e.text,value:e.option,hidden:Boolean(b.quiz&&b.closePeriod&&v<=0)}));Object(c.n)(()=>{m&&t.results.results&&t.results.results.some(e=>e.isChosen)&&h(!1)},[m,t.results.results]),Object(c.n)(()=>{v>0&&setTimeout(()=>y(v-1),1e3);const e=C.current;if(e){const t=12*Math.PI,a=e.lastElementChild,s=e.firstElementChild;if(v<=5&&e.classList.add("hurry-up"),a&&s){const e=(b.closePeriod-v)/b.closePeriod*t;s.textContent=Object(L.e)(v),a.firstElementChild.setAttribute("stroke-dashoffset","-"+e)}else e.innerHTML=`\n ${Object(L.e)(v)}\n \n \n `}},[v,b.closePeriod]),Object(c.n)(()=>{b.quiz&&(v<=0||M&&!b.closed)&&n({chatId:d,messageId:l})},[d,v,M,n,l,b.closed,b.quiz]),Object(c.n)(()=>{let e;return b.quiz&&!b.closed&&b.closePeriod&&b.closePeriod>0&&(e=window.setTimeout(()=>{n({chatId:d,messageId:l})},1e3*b.closePeriod)),()=>{e&&window.clearTimeout(e)}},[S,d,n,l,b.closePeriod,b.closed,b.quiz]);const x=Object(c.p)(()=>a?a.reduce((e,t)=>{const a=s[t];return a&&e.push(a),e},[]):[],[s,a]),R=Object(c.m)(e=>{j([e]),h(!0),I(!0),o([e])},[o]),B=Object(c.m)(e=>{j(e)},[]),D=Object(c.m)(()=>{h(!0),I(!0),o(O)},[o,O]),F=Object(c.m)(()=>{r({chatId:d,messageId:l})},[d,l,r]),U=Object(c.m)(()=>{f(!0)},[]),H=Object(c.m)(()=>{f(!1),I(!1)},[]);Object(c.n)(()=>{if(p&&M&&b.quiz&&u.results&&t.results.solution){u.results.find(e=>e.isChosen&&e.isCorrect)||f(!0)}},[M,p,u.results,b.quiz,t.results.solution]);const q=Object(ue.a)();return c.a.createElement("div",{className:"Poll",dir:q.isRtl?"auto":"ltr"},g&&t.results.solution&&c.a.createElement(Pa.a,{message:Object(Lt.b)(t.results.solution,t.results.solutionEntities),duration:5e3,onDismiss:H,containerId:"#middle-column-portals"}),c.a.createElement("div",{className:"poll-question"},Object(ut.a)(b.question)),c.a.createElement("div",{className:"poll-type"},q(function(e){if(void 0===e.isPublic)return" ";if(e.quiz)return e.isPublic?"QuizPoll":"AnonymousQuizPoll";if(e.closed)return"FinalResults";return e.isPublic?"PublicPoll":"AnonymousPoll"}(b)),x.length>0&&c.a.createElement("div",{className:"poll-recent-voters"},x.map(e=>c.a.createElement(Jt.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(ge.a,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:g,onClick:U,ariaLabel:"Show Solution"},c.a.createElement("i",{className:"icon-lamp"}))),S&&c.a.createElement("div",{className:"poll-answers"},N?c.a.createElement(Na,{options:A,onChange:B,disabled:e.isScheduled||m,loadingOptions:m?O:void 0,round:!0}):c.a.createElement(Ta.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(xa,{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(ge.a,{isText:!0,disabled:0===O.length,size:"tiny",onClick:D},q("PollSubmitVotes")),k&&c.a.createElement(ge.a,{isText:!0,size:"tiny",onClick:F},q("PollViewResults")))})),La=a(40),Ba=a(59);a(232);var Da=Object(c.h)(({message:e,observeIntersection:t,noAvatars:a,shouldAutoLoad:s,shouldAutoPlay:n,inPreview:o,lastSyncTime:r,onMediaClick:i,onCancelMediaTransfer:d})=>{const b=Object(l.R)(e);let u=!1;if(b&&b.photo&&!b.video){const{width:t,height:a}=Ft(e);u=t===a}const m=Object(c.m)(()=>{i()},[i]);if(!b)return;const{siteName:h,url:O,displayUrl:j,title:g,description:f,photo:p,video:I}=b,v=(p||I)&&i&&!u,y=Object(La.a)(f,170),C=Object(ce.a)("WebPage",u&&"with-square-photo",!p&&!I&&!o&&"without-media",I&&"with-video");return c.a.createElement("div",{className:C,"data-initial":(h||j)[0],dir:"auto"},p&&!I&&c.a.createElement(fa,{message:e,observeIntersection:t,noAvatars:a,shouldAutoLoad:s,size:u?"pictogram":"inline",nonInteractive:!v,onClick:v?m:void 0,onCancelUpload:d}),c.a.createElement("div",{className:"WebPage-text"},c.a.createElement(Ba.a,{className:"site-name",url:O,text:h||j}),!o&&g&&c.a.createElement("p",{className:"site-title"},Object(ut.a)(g)),y&&c.a.createElement("p",{className:"site-description"},Object(ut.a)(y,["emoji","br"]))),!o&&I&&c.a.createElement(Ea,{message:e,observeIntersection:t,noAvatars:a,shouldAutoLoad:s,shouldAutoPlay:n,lastSyncTime:r,onClick:v?m:void 0,onCancelUpload:d}))});a(233);var Fa=Object(c.h)(({message:e})=>{const t=Object(l.B)(e),{title:a,text:s,description:n,photoUrl:o}=t;return c.a.createElement("div",{className:"Invoice"},a&&c.a.createElement("p",{className:"title"},Object(ut.a)(a)),s&&c.a.createElement("p",null,Object(ut.a)(s,["emoji","br"])),c.a.createElement("div",{className:"description "+(o?"has-image":"")},o&&c.a.createElement("img",{className:"invoice-image",src:o,alt:""}),n&&c.a.createElement("p",{className:"description-text"},Object(ut.a)(n,["emoji","br"]))))});function Ua(e){return Object(c.h)(Object(s.h)((e,t)=>{const{message:a}=t;return{isInSelectMode:Object(r.S)(e),isSelected:Object(r.V)(e,a.id)}},(e,t)=>Object(h.l)(t,["toggleMessageSelection"]))(t=>{const{isInSelectMode:a,isSelected:s,message:n,toggleMessageSelection:o,dimensions:r}=t,i=Object(c.m)(e=>{e.stopPropagation(),o({messageId:n.id,withShift:e&&e.shiftKey})},[o,n]),l=Object(c.p)(()=>({...t,isInSelectMode:a,isSelected:s,dimensions:{...t.dimensions,x:0,y:0},onClick:a?void 0:t.onClick}),[t,a,s]);return c.a.createElement("div",{className:Object(ce.a)("album-item-select-wrapper",s&&"is-selected"),style:r?`left: ${r.x}px; top: ${r.y}px;`:"",onClick:a?i:void 0},a&&c.a.createElement("div",{className:"message-select-control"},s&&c.a.createElement("i",{className:"icon-select"})),c.a.createElement(e,l))}))}a(234);const Ha=Ua(fa),qa=Ua(Ea);var _a=Object(s.h)(e=>({uploadsById:e.fileUploads.byMessageLocalId}),(e,t)=>Object(h.l)(t,["cancelSendingMessage"]))(({album:e,observeIntersection:t,shouldAutoLoad:a,shouldAutoPlay:s,hasCustomAppendix:n,lastSyncTime:o,isOwn:r,albumLayout:i,onMediaClick:d,uploadsById:b,cancelSendingMessage:u})=>{const m=e.messages.length,h=Object(c.m)(e=>{u({chatId:e.chatId,messageId:e.id})},[u]);const{width:O,height:j}=i.containerStyle;return c.a.createElement("div",{className:"Album",style:`width: ${O}px; height: ${j}px;`},e.messages.map((function(e,u){const{photo:O,video:j}=Object(l.v)(e),g=b[e.previousLocalId||e.id],f=g?g.progress:void 0,{dimensions:p,sides:I}=i.layout[u];if(O){const s=n&&(r?u===m-1:Boolean(I&Gt&&I&_t));return c.a.createElement(Ha,{id:"album-media-"+e.id,message:e,observeIntersection:t,shouldAutoLoad:a,shouldAffectAppendix:s,uploadProgress:f,dimensions:p,onClick:d,onCancelUpload:h})}if(j)return c.a.createElement(qa,{id:"album-media-"+e.id,message:e,observeIntersection:t,shouldAutoLoad:a,shouldAutoPlay:s,uploadProgress:f,lastSyncTime:o,dimensions:p,onClick:d,onCancelUpload:h})})))});a(235);function Ga(){return(Ga=Object.assign||function(e){for(var t=1;t{const o=Object(c.q)(null),r=Object(c.q)(null),i=Object(c.q)(null),d=e.content.video,b=Object(Nt.b)(o,t),[u,m]=Object(c.r)(a&&s),h=Boolean(u&&b&&n),{mediaData:O,downloadProgress:j}=Object(ba.a)(Object(l.E)(e,"inline"),!h,Object(l.D)(e,"inline"),n),g=ma(e,O),{isBuffered:f,bufferingHandlers:I}=Object(pa.a)(),v=u&&!f,y=!1===Object(ha.a)(u),{shouldRender:C,transitionClassNames:w}=Object(oe.a)(v||!f,void 0,y),{shouldRenderThumb:E,transitionClassNames:M}=Object(oa.a)(O,"slow"),[S,k]=Object(c.r)(!1),[N,T]=Object(c.r)(0);Object(c.n)(()=>{if(!S)return;const e=188*Math.PI,t=e-N*e,a=i.current,s=r.current,n=s.firstElementChild;n?n.firstElementChild.setAttribute("stroke-dashoffset",t.toString()):s.innerHTML=`\n \n `,T(a.currentTime/a.duration)},[S,N]);const P=Boolean(O&&b),A=()=>{k(!1),T(0),Object(Ia.a)(i.current),Object(p.b)(()=>{r.current.innerHTML=""})},x=(R=A,()=>{za&&za(),za=R});var R;Object(c.n)(()=>{i.current&&(P?Object(Ia.a)(i.current):i.current.pause())},[P]),va(i,P),Ca(i,Boolean(O)),Object(ya.a)(i,[O]);const B=Object(c.m)(()=>{if(!O)return void m(e=>!e);const e=i.current;S?e.paused?Object(Ia.a)(e):e.pause():(x(),e.pause(),e.currentTime=0,Object(Ia.a)(e),k(!0))},[x,S,O]),D=Object(c.m)(e=>{const t=e.currentTarget;T(t.currentTime/t.duration)},[]),F=Object(ce.a)("full-media",M);return c.a.createElement("div",{ref:o,className:"RoundVideo media-inner",onClick:B},(E||O)&&c.a.createElement("div",{className:"thumbnail-wrapper"},c.a.createElement("canvas",{ref:g,className:"thumbnail",style:`width: ${bt.e}px; height: ${bt.e}px`})),O&&c.a.createElement("div",{className:"video-wrapper"},c.a.createElement("video",Ga({ref:i,className:F,width:bt.e,height:bt.e,autoPlay:!0,muted:!S,loop:!S,playsInline:!0,onEnded:S?A:void 0},I,{onTimeUpdate:S?D:void 0}),c.a.createElement("source",{src:O}))),c.a.createElement("div",{className:"progress",ref:r}),C&&c.a.createElement("div",{className:"media-loading "+w},c.a.createElement(ga.a,{progress:j})),!O&&!u&&c.a.createElement("i",{className:"icon-large-play"}),c.a.createElement("div",{className:"message-media-duration"},S?Object(L.e)(i.current.currentTime):Object(L.e)(d.duration),(!S||i.current.paused)&&c.a.createElement("i",{className:"icon-muted-chat"})))};a(236);var Wa=({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(ge.a,{size:"tiny",ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>t({button:e})},Object(ut.a)(e.text),"url"===e.type&&!e.value.match(n.pb)&&c.a.createElement("i",{className:"icon-arrow-right"}))))));a(237);var Va=Object(c.h)(Object(s.h)((e,{message:t})=>{const{threadId:a,chatId:s}=t.threadInfo,n=Object(r.Eb)(e,s,a)||t.threadInfo,{byId:c}=e.users,{byId:o}=e.chats;return{threadInfo:n,usersById:c,chatsById:o}},(e,t)=>Object(h.l)(t,["openChat"]))(({disabled:e,threadInfo:t,usersById:a,chatsById:s,openChat:n})=>{const o=Object(ue.a)(),{threadId:r,chatId:i,messagesCount:d,lastMessageId:b,lastReadInboxMessageId:u,recentReplierIds:m}=t,h=Object(c.m)(()=>{n({id:i,threadId:r})},[n,i,r]);if(void 0===d)return;const O=m&&m.map(e=>Object(l.ob)(e)?a[e]:s[e]).filter(Boolean);const j=Boolean(u&&b&&u0&&c.a.createElement("div",{className:"recent-repliers",dir:o.isRtl?"rtl":"ltr"},O.map(e=>c.a.createElement(Jt.a,{key:e.id,size:"small",user:Object(l.ob)(e.id)?e:void 0,chat:Object(l.ob)(e.id)?void 0:e}))),c.a.createElement("div",{className:"label",dir:"auto"},d?o("Comments",d,"i"):o("LeaveAComment")),c.a.createElement("i",{className:"icon-next"}))}));a(238);function Ka(e){const t=Ya(e.currentTarget);t&&t.setAttribute("data-is-document-group-hover","")}function Qa(e){const t=Ya(e.currentTarget);t&&t.removeAttribute("data-is-document-group-hover")}function Ya(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var Ja=Object(c.h)(Object(s.h)((e,t)=>{const{focusedMessage:a,forwardMessages:s,lastSyncTime:n}=e,{message:c,album:o,withSenderName:i,withAvatar:d,threadId:b,messageListType:u}=t,{id:m,chatId:h,viaBotId:O,replyToMessageId:j,isOutgoing:g}=c,f=Object(r.g)(e,h),p=Object(r.P)(e,h),I=f&&Object(l.mb)(f),v=!p&&Object(l.hb)(c),y=i||d||v?Object(r.ub)(e,c):void 0,C=Object(r.K)(e,c),w=O?Object(r.Ib)(e,O):void 0,E=b?Object(r.Gb)(e,h,b):void 0,M=c.id===E,S=j===E,k=j&&!S?Object(r.l)(e,h,j):void 0,N=k&&Object(r.ub)(e,k),T=Object(r.Hb)(e,c),P="thread"===u&&(o?o.messages.some(t=>Object(r.U)(e,t)):Object(r.U)(e,c)),{direction:A,noHighlight:x}=P&&a||{},R=s.messageIds&&s.messageIds.includes(m),{query:L}=Object(r.B)(e)||{},B=Object(l.M)(c);let D;return D=o&&o.messages?o.messages.every(({id:t})=>Object(r.V)(e,t)):Object(r.V)(e,m),{theme:Object(r.Cb)(e),forceSenderName:v,sender:y,originSender:C,botSender:w,shouldHideReply:S,isThreadTop:M,replyMessage:k,replyMessageSender:N,...g&&{outgoingStatus:Object(r.fb)(e,c,"scheduled"===u)},..."number"==typeof T&&{uploadProgress:T},isFocused:P,...P&&{focusDirection:A,noFocusHighlight:x},isForwarding:R,isChatWithSelf:p,isChannel:I,lastSyncTime:n,highlight:L,isSingleEmoji:Boolean(B),animatedEmoji:B?Object(r.c)(e,B):void 0,isInSelectMode:Object(r.S)(e),isSelected:D,isGroupSelected:!!c.groupedId&&!c.isInAlbum&&Object(r.Q)(e,h,c.groupedId),threadId:b,isPinnedList:"pinned"===u,shouldAutoLoadMedia:f?Object(r.vb)(e,c,f,y):void 0,shouldAutoPlayMedia:Object(r.wb)(e,c),shouldLoopStickers:Object(r.xb)(e)}},(e,t)=>Object(h.l)(t,["focusMessage","openMediaViewer","openAudioPlayer","cancelSendingMessage","openUserInfo","openChat","markMessagesRead","sendPollVote","toggleMessageSelection","setReplyingToId","openForwardMenu","clickInlineButton","disableContextMenuHint","showNotification"]))(({message:e,observeIntersectionForBottom:t,observeIntersectionForMedia:a,observeIntersectionForAnimatedStickers:s,album:n,noAvatars:o,withAvatar:r,withSenderName:i,noComments:d,appearanceOrder:h,isFirstInGroup:O,isLastInGroup:j,isFirstInDocumentGroup:g,isLastInDocumentGroup:f,isLastInList:p,theme:I,forceSenderName:v,sender:y,originSender:C,botSender:w,isThreadTop:E,shouldHideReply:M,replyMessage:S,replyMessageSender:k,outgoingStatus:N,uploadProgress:T,isFocused:P,focusDirection:A,noFocusHighlight:x,isForwarding:R,isChatWithSelf:L,isChannel:B,lastSyncTime:D,highlight:F,animatedEmoji:U,isInSelectMode:H,isSelected:q,isGroupSelected:_,threadId:G,messageListType:z,isPinnedList:$,shouldAutoLoadMedia:W,shouldAutoPlayMedia:V,shouldLoopStickers:K,focusMessage:Q,openMediaViewer:Y,openAudioPlayer:J,openUserInfo:X,openChat:Z,cancelSendingMessage:ee,markMessagesRead:te,sendPollVote:ae,toggleMessageSelection:se,setReplyingToId:ne,openForwardMenu:re,clickInlineButton:ie,disableContextMenuHint:le,showNotification:de})=>{const me=Object(c.q)(null),he=Object(c.q)(null),Oe=Object(c.q)(null),je=Object(ue.a)();Object(Nt.c)(he,t);const{isContextMenuOpen:fe,contextMenuPosition:pe,handleBeforeContextMenu:Ie,handleContextMenu:ve,handleContextMenuClose:ye,handleContextMenuHide:Ce}=Object(Rt.a)(me,!1,!0);Object(c.n)(()=>{fe&&le()},[fe,le]);const we=h<=0,[Ee,Me]=Object(be.a)(we);Object(c.n)(()=>{we||setTimeout(Me,10*h)},[h,Me,we]);const{transitionClassNames:Se}=Object(oe.a)(Ee,void 0,we,!1),{chatId:ke,id:Ne,threadInfo:Te}=e,Pe=Object(l.xb)(e),Ae=Object(l.yb)(e),xe="scheduled"===z||e.isScheduled,Re=Object(l.zb)(e)&&!M,Le=Boolean(Te)&&"thread"===z,{forwardInfo:Be,viaBotId:De}=e,Fe=Be&&!L&&!Be.isLinkedChannelPost,Ue=!!e.groupedId&&!e.isInAlbum,He=Boolean(n)&&n.messages.length>1,{text:qe,photo:_e,video:Ge,audio:ze,voice:$e,document:We,sticker:Ve,contact:Ke,poll:Qe,webPage:Ye,invoice:Je}=Object(l.v)(e),Xe=Object(l.x)(e),Ze=Object(Lt.a)(e,F,Bt(Xe)),et=void 0!==pe,tt=B&&e.adminTitle||Be&&!Fe&&Be.adminTitle||void 0,at=Object(c.p)(()=>tt?Qt(tt):void 0,[tt]),st=!(et||H||R)&&(!Ue||f),ct=st&&B&&!xe,ot=Boolean(st&&(Be&&(Be.isChannelPost||L&&!Ae)&&Be.fromMessageId||$)),rt=!Be||!L&&y?y:C,it=Be?C:y,lt=Object(ce.a)("Message message-list-item",O&&"first-in-group",j&&"last-in-group",g&&"first-in-document-group",f&&"last-in-document-group",p&&"last-in-list",Ae&&"own",Boolean(e.views)&&"has-views",e.isEdited&&"was-edited",Re&&"has-reply",et&&"has-menu-open",P&&!x&&"focused",R&&"is-forwarding",e.isDeleting&&"is-deleting",Ue&&"is-in-document-group",He&&"is-album",e.hasUnreadMention&&"has-unread-mention",q&&"is-selected",H&&"is-in-selection-mode",E&&"is-thread-top",Boolean(e.inlineButtons)&&"has-inline-buttons",Se),dt=function(e,{hasReply:t,customShape:a,isLastInGroup:s,asForwarded:n,hasThread:c,forceSenderName:o,hasComments:r}={}){const{text:i,photo:d,video:b,audio:u,voice:m,document:h,poll:O,webPage:j,contact:g}=Object(l.v)(e),f=["message-content"],p=(d||b)&&!i,I=Boolean(e.viaBotId);return Bt(a)?f.push("emoji-only emoji-only-"+a):i&&f.push("text"),a&&(f.push("custom-shape"),b&&b.isRound&&f.push("round"),r&&f.push("has-comments")),d||b?f.push("media"):u?f.push("audio"):m?f.push("voice"):h?f.push("document"):g?f.push("contact"):O?f.push("poll"):j&&(f.push("web-page"),(j.photo||j.video)&&f.push("media")),n&&!a&&f.push("is-forwarded"),t&&f.push("is-reply"),c&&f.push("has-replies"),I&&f.push("is-via-bot"),o&&f.push("force-sender-name"),a||(f.push("has-shadow"),(t||n||!p||I||o)&&f.push("has-solid-background"),!s||!d&&p||f.push("has-appendix")),f.join(" ")}(e,{hasReply:Re,customShape:Xe,isLastInGroup:j,asForwarded:Fe,hasThread:Le,forceSenderName:v,hasComments:e.threadInfo&&e.threadInfo.messagesCount>0}),mt=e.threadInfo&&(!Ue||f)&&"thread"===z&&!d,ht=dt.includes("has-appendix");Object(nt.a)(ke,Re?e.replyToMessageId:void 0,S,e.id),Yt(me,ke,P,A,x),Object(c.o)(()=>{Oe.current&&(Oe.current.innerHTML=Ae?'':'')},[Ae,ht]);const Ot=Object(c.m)(t=>{t.stopPropagation(),se({messageId:Ne,groupedId:e.groupedId})},[Ne,e.groupedId,se]),jt=Object(c.m)(e=>{if(Pe)return;const t=He&&n&&n.messages?{messageId:Ne,childMessageIds:n.messages.map(({id:e})=>e),withShift:e&&e.shiftKey}:{messageId:Ne,withShift:e&&e.shiftKey};se(t)},[Pe,He,n,Ne,se]),gt=Object(c.m)(()=>{ne({messageId:Ne})},[ne,Ne]),ft=Object(c.m)(e=>{e.stopPropagation()},[]),pt=Object(c.m)(()=>{rt&&(Object(l.ob)(rt.id)?X({id:rt.id}):Z({id:rt.id}))},[rt,X,Z]),It=Object(c.m)(()=>{it?Object(l.ob)(it.id)?X({id:it.id}):Z({id:it.id}):de({message:je("HidAccount")})},[it,de,je,X,Z]),vt=Object(c.m)(()=>{w&&X({id:w.id})},[w,X]),yt=Object(c.m)(()=>{Q({chatId:ke,threadId:G,messageId:e.replyToMessageId,replyMessageId:Ne})},[Q,ke,G,e.replyToMessageId,Ne]),Ct=Object(c.m)(()=>{Y({chatId:ke,threadId:G,messageId:Ne,origin:xe?u.h.ScheduledInline:u.h.Inline})},[ke,G,Ne,Y,xe]),wt=Object(c.m)(()=>{J({chatId:ke,messageId:Ne})},[ke,Ne,J]),Et=Object(c.m)(e=>{Y({chatId:ke,threadId:G,messageId:e,origin:xe?u.h.ScheduledAlbum:u.h.Album})},[ke,G,Y,xe]),Mt=Object(c.m)(e=>{const t=e.target;(t.classList.contains("text-content")||t.classList.contains("Message"))&&(m.b?setTimeout(()=>{ve(e)},150):ve(e))},[ve]),St=Object(c.m)(()=>{te({messageIds:[Ne]})},[Ne,te]),Tt=Object(c.m)(()=>{ee({chatId:ke,messageId:Ne})},[ee,ke,Ne]),Pt=Object(c.m)(e=>{ae({chatId:ke,messageId:Ne,options:e})},[ke,Ne,ae]),At=Object(c.m)(()=>{re({fromChatId:ke,groupedId:e.groupedId})},[re,ke,e.groupedId]),xt=Object(c.m)(()=>{if(n&&n.messages){const e=n.messages.map(({id:e})=>e);re({fromChatId:ke,messageIds:e})}else re({fromChatId:ke,messageIds:[Ne]})},[n,re,ke,Ne]),Ut=Object(c.m)(()=>{Q({chatId:ke,threadId:b.MAIN_THREAD_ID,messageId:Ne})},[Q,ke,Ne]),Ht=Object(c.m)(()=>{Q(Ue?{chatId:Be.fromChatId,groupedId:e.groupedId,groupedChatId:ke}:{chatId:Be.fromChatId,messageId:Be.fromMessageId})},[Q,Be,e,ke,Ue]);let qt,_t="",Gt=!1;const zt=Object(c.p)(()=>He?Vt(Ae,Boolean(Fe),Boolean(o),n):void 0,[He,Ae,Fe,o,n]),$t=Fe?28:0;if(He||!_e&&!Ge)zt&&(qt=Math.max(Dt(Boolean(qe),mt),zt.containerStyle.width),qt-zt.containerStyle.width>18&&(Gt=!0));else{let t;_e?t=Ft(e,o).width:Ge&&(t=Ge.isRound?bt.e:Ft(e,o).width),t&&(qt=Math.max(Dt(Boolean(qe),mt),t),qt-t>18&&(Gt=!0))}return qt&&(_t=`width: ${qt+$t}px`),c.a.createElement("div",{ref:me,id:"message"+Ne,className:lt,style:at?`--meta-safe-author-width: ${at}px`:void 0,"data-message-id":Ne,onClick:H?jt:m.b?Mt:void 0,onDoubleClick:H?void 0:gt,onMouseDown:H?void 0:e=>{kt(e),Pe||Ie(e)},onContextMenu:H||Pe?void 0:ve,onMouseEnter:Ue&&!f?Ka:void 0,onMouseLeave:Ue&&!f?Qa:void 0},c.a.createElement("div",{ref:he,className:"bottom-marker","data-message-id":Ne,"data-last-message-id":n?n.messages[n.messages.length-1].id:void 0,"data-has-unread-mention":e.hasUnreadMention}),!Pe&&!Ue&&c.a.createElement("div",{className:"message-select-control"},q&&c.a.createElement("i",{className:"icon-select"})),!Pe&&f&&c.a.createElement("div",{className:Object(ce.a)("message-select-control group-select",_&&"is-selected"),onClick:Ot},_&&c.a.createElement("i",{className:"icon-select"})),r&&function(){const e=rt&&Object(l.ob)(rt.id),t=rt&&e?rt:void 0,a=rt&&!e?rt:void 0,s=!rt&&Be?Be.hiddenUserName:void 0;return c.a.createElement(Jt.a,{size:"small",user:t,chat:a,text:s,lastSyncTime:D,onClick:t||a?pt:void 0})}(),c.a.createElement("div",{className:"message-content-wrapper",onClick:H&&Ue?jt:void 0},c.a.createElement("div",{className:dt,style:_t,dir:"auto"},Fe&&!Xe&&(!Ue||g)&&c.a.createElement("div",{className:"message-title"},je("ForwardedMessage")),function(){const t=Object(ce.a)("content-inner",Fe&&!Xe&&"forwarded-message",Re&&"reply-message",Gt&&"no-media-corners"),r=j&&!Ze&&!Fe&&!Le,d=!Ye&&!U&&Ze;return c.a.createElement("div",{className:t,onDoubleClick:ft,dir:"auto"},function(){if(Xe&&!De||!(i&&!_e&&!Ge||Fe||De||v)||Ue&&!g)return;let t,a;!it||Xe&&De?Be&&Be.hiddenUserName&&(t=Be.hiddenUserName):(t=Object(l.X)(je,it),Fe||(a="color-"+Object(l.Z)(it)));return c.a.createElement("div",{className:"message-title",dir:"ltr"},t?c.a.createElement("span",{className:Object(ce.a)("interactive",a),onClick:It,dir:"auto"},Object(ut.a)(t)):w?void 0:" ",w&&c.a.createElement(c.a.Fragment,null,c.a.createElement("span",{className:"via"},je("ViaBot")),c.a.createElement("span",{className:"interactive",onClick:vt},Object(ut.a)("@"+w.username))),Be&&Be.isLinkedChannelPost?c.a.createElement("span",{className:"admin-title",dir:"auto"},je("DiscussChannel")):e.adminTitle&&!B?c.a.createElement("span",{className:"admin-title",dir:"auto"},e.adminTitle):void 0)}(),Re&&c.a.createElement(ta,{message:S,sender:k,observeIntersection:a,onClick:yt}),Ve&&c.a.createElement(la,{message:e,observeIntersection:a,observeIntersectionForPlaying:s,shouldLoop:K,lastSyncTime:D}),U&&c.a.createElement(da.a,{isInline:!0,sticker:U,observeIntersection:a,lastSyncTime:D,forceLoadPreview:Pe}),He&&c.a.createElement(_a,{album:n,albumLayout:zt,observeIntersection:a,shouldAutoLoad:W,shouldAutoPlay:V,isOwn:Ae,hasCustomAppendix:r,lastSyncTime:D,onMediaClick:Et}),!He&&_e&&c.a.createElement(fa,{message:e,observeIntersection:a,noAvatars:o,shouldAutoLoad:W,uploadProgress:T,shouldAffectAppendix:r,onClick:Ct,onCancelUpload:Tt}),!He&&Ge&&Ge.isRound&&c.a.createElement($a,{message:e,observeIntersection:a,shouldAutoLoad:W,shouldAutoPlay:V,lastSyncTime:D}),!He&&Ge&&!Ge.isRound&&c.a.createElement(Ea,{message:e,observeIntersection:a,noAvatars:o,shouldAutoLoad:W,shouldAutoPlay:V,uploadProgress:T,lastSyncTime:D,onClick:Ct,onCancelUpload:Tt}),(ze||$e)&&c.a.createElement(sa.a,{theme:I,message:e,uploadProgress:T,lastSyncTime:D,isSelectable:Ue,isSelected:q,onPlay:wt,onReadMedia:!$e||Ae&&!L?void 0:St,onCancelUpload:Tt}),We&&c.a.createElement(aa.a,{message:e,observeIntersection:a,uploadProgress:T,isSelectable:Ue,isSelected:q,onMediaClick:Ct,onCancelUpload:Tt}),Ke&&c.a.createElement(Sa,{contact:Ke}),Qe&&c.a.createElement(Ra,{message:e,poll:Qe,onSendVote:Pt}),!U&&Ze&&c.a.createElement("p",{className:"text-content "+(d?"with-meta":""),dir:"auto"},Ze,d&&c.a.createElement(ca,{message:e,outgoingStatus:N,signature:tt,onClick:jt})),Ye&&c.a.createElement(Da,{message:e,observeIntersection:a,noAvatars:o,shouldAutoLoad:W,shouldAutoPlay:V,lastSyncTime:D,onMediaClick:Ct,onCancelMediaTransfer:Tt}),Je&&c.a.createElement(Fa,{message:e}))}(),(!Ue||f)&&!(!Ye&&!U&&Ze)&&c.a.createElement(ca,{message:e,outgoingStatus:N,signature:tt,onClick:jt}),ct?c.a.createElement(ge.a,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:je("lng_context_forward_msg"),onClick:f?At:xt},c.a.createElement("i",{className:"icon-share-filled"})):ot?c.a.createElement(ge.a,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:$?Ut:Ht},c.a.createElement("i",{className:"icon-arrow-right"})):void 0,mt&&c.a.createElement(Va,{message:e,disabled:d}),ht&&c.a.createElement("div",{className:"svg-appendix",ref:Oe})),e.inlineButtons&&c.a.createElement(Wa,{message:e,onClick:ie})),pe&&c.a.createElement(Zt,{isOpen:fe,anchor:pe,message:e,album:n,messageListType:z,onClose:ye,onCloseAnimationEnd:Ce}))}));a(239);const Xa=m.b?1e3:350,Za=m.l?300:500,es=Object(p.a)(e=>e(),200,!1);var ts=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,type:s})=>{const n=Object(r.g)(e,t);if(!n)return{};const c=Object(r.y)(e,t,a,s),o="scheduled"===s?Object(r.rb)(e,t):Object(r.n)(e,t),i=Object(r.Gb)(e,t,a);if(a!==b.MAIN_THREAD_ID&&!(o&&i&&o[i]))return{};const{isRestricted:d,restrictionReason:u,lastMessage:m}=n,h=Object(r.I)(e,t),O=a===b.MAIN_THREAD_ID&&!c&&!n.unreadCount&&!h&&m&&!m.groupedId;let j;if(Object(r.L)(e,t)){const a=Object(r.h)(e,t);j=a.fullInfo?a.fullInfo.botDescription||"NoMessages":"Updating bot info..."}return{isChatLoaded:!0,isRestricted:d,restrictionReason:u,isChannelChat:Object(l.mb)(n),isChatWithSelf:Object(r.P)(e,t),messageIds:c,messagesById:o,firstUnreadId:Object(r.H)(e,t,a),isViewportNewest:"thread"!==s||Object(r.X)(e,t,a),threadFirstMessageId:Object(r.G)(e,t,a),focusingId:h,isSelectModeActive:Object(r.S)(e),animationLevel:e.settings.byKey.animationLevel,...O&&{lastMessage:m},botDescription:j,threadTopMessageId:i,hasLinkedChat:n.fullInfo&&"linkedChatId"in n.fullInfo?Boolean(n.fullInfo.linkedChatId):void 0}},(e,t)=>Object(h.l)(t,["loadViewportMessages","markMessageListRead","markMessagesRead","setScrollOffset","openHistoryCalendar"]))(({chatId:e,threadId:t,type:a,hasTools:o,onFabToggle:i,onNotchToggle:d,isChatLoaded:b,isChannelChat:m,canPost:O,isReady:j,isChatWithSelf:g,messageIds:f,messagesById:I,firstUnreadId:v,isViewportNewest:y,threadFirstMessageId:C,isRestricted:w,restrictionReason:E,focusingId:M,isSelectModeActive:S,animationLevel:k,loadViewportMessages:N,markMessageListRead:T,markMessagesRead:P,setScrollOffset:A,lastMessage:x,botDescription:R,threadTopMessageId:B,hasLinkedChat:D,openHistoryCalendar:F})=>{const U=Object(c.q)(null),H=Object(c.q)("thread"===a&&Object(r.sb)(Object(s.e)(),e,t)||0),q=Object(c.q)(),_=Object(c.q)(),G=Object(c.q)(),z=Object(c.q)(),$=Object(c.q)(),W=Object(c.q)(),V=Object(c.q)(!1),K=Object(c.q)(Boolean(x)),[Q,Y]=Object(c.r)(),[J,X]=Object(c.r)(Boolean(M)),Z=Boolean(f);Object(Me.a)(()=>{Z&&Object(p.e)(()=>{K.current=!1})},[Z]),Object(Me.a)(()=>{$.current=v,z.current||(z.current=v)},[v]);const{observe:ee}=Object(Nt.a)({rootRef:U,throttleMs:Xa,margin:Za}),{observe:te,freeze:ae,unfreeze:se}=Object(Nt.a)({rootRef:U},e=>{if("thread"!==a)return;let t=0;const s=[];e.forEach(e=>{const{isIntersecting:a,target:n}=e;if(!a)return;const{dataset:c}=n,o=Number(c.lastMessageId||c.messageId);o>t&&(t=o),c.hasUnreadMention&&s.push(o)}),$.current&&t>=$.current&&T({maxId:t}),s.length&&P({messageIds:s})});Object(re.a)(ae,se),Object(Me.a)(()=>{W.current=M},[M]);const{observe:oe}=Object(Nt.a)({rootRef:U,throttleMs:Xa});Object(c.n)(()=>{M?X(!0):setTimeout(()=>{X(!1)},200)},[M]);const ie=Object(c.p)(()=>{if(!f||!I)return;const e=!B||f[0]&&C!==f[0]?f:[B,...f];if(!e.length)return;const t=e.map(e=>I[e]).filter(Boolean);return St(Object(h.k)(t,["date","id"]),z.current)},[f,I,C,B]),[le,de,be]=Object(c.p)(()=>"thread"===a?[Object(p.a)(()=>N({direction:u.e.Backwards}),1e3,!0,!1),Object(p.a)(()=>N({direction:u.e.Forwards}),1e3,!0,!1),Object(p.a)(()=>N({direction:u.e.Around}),1e3,!0,!1)]:[],[N,f]),{isScrolled:me,updateStickyDates:he}=Tt(),Oe=Object(c.m)(()=>{if(V.current)return void(V.current=!1);const s=U.current;W.current||he(s,o),es(()=>{Object(p.b)(()=>{s.parentElement&&(H.current=s.scrollHeight-s.scrollTop,"thread"===a&&A({chatId:e,threadId:t,scrollOffset:H.current}))})})},[he,o,a,A,e,t]);Object(c.n)(()=>{if(!("ResizeObserver"in window))return;const e=new ResizeObserver(([e])=>{e.target.offsetParent&&Y(e.contentRect.height)});return e.observe(U.current),()=>{e.disconnect()}},[]);const{height:je}=et();Object(c.n)(()=>{j&&(U.current.dataset.normalHeight=String(U.current.offsetHeight))},[je,j]),Object(c.n)(()=>{if(!be||!b||w||M)return;const e=U.current;(!f||f.length{if(!f||!G.current||!j)return;const e=G.current.filter(e=>f.includes(Number(e.dataset.messageId))),t=e[1]||e[0];t&&(q.current=t.id,_.current=t.getBoundingClientRect().top)},[f,y,Q,o,j]),Object(Et.a)(([e,t,a])=>{const s=U.current;if(G.current=Array.from(s.querySelectorAll(".message-list-item")),!s.offsetParent)return;const c=y&&f&&f.length{s.parentElement&&s.parentElement.classList.remove("force-messages-scroll")},1e3));const{scrollTop:r,scrollHeight:i,offsetHeight:l}=s,d=H.current,b=G.current[G.current.length-1],u=b?b.offsetHeight:0,m=y&&t&&d-(a||l)-u<=100;let h;const O=f&&e&&f[0]!==e[0],j=f&&e&&f[f.length-1]!==e[e.length-1],g=f&&W.current===f[f.length-1];if(m&&j&&!O&&!g&&(b&&Object(p.b)(()=>{Object(At.a)(s,b,"end",20,void 0,void 0,void 0,!0)}),h=i-l,H.current=Math.max(i-h,l),!c))return;const I=void 0!==a&&a!==Q,v=q.current&&s.querySelector("#"+q.current),C=!v&&z.current&&s.querySelector(".unread-divider");if(m&&I){if(Object(At.b)())return;h=i-l}else if(v){h=r+(v.getBoundingClientRect().top-(_.current||0))}else h=C?Math.min(C.offsetTop-(o?60:10),i-d):i-d;Object(Pt.a)(s,h),W.current||(V.current=!0,Object(p.b)(()=>{V.current=!1})),H.current=Math.max(i-h,l)},[f,y,Q,o]),Object(c.n)(()=>{(!k||k>0)&&Object(ne.b)(200+n.c)},[k,S]);const ge=Object(ue.a)(),fe=Boolean(e&&Object(l.ob)(e)),pe=Boolean(!fe&&!m||g),Ie=Boolean(!pe||m),ve=Object(ce.a)("MessageList custom-scroll",Ie&&"no-avatars",!O&&"no-composer","pinned"===a&&"type-pinned",S&&"select-mode-active",J&&"has-focusing",me&&"scrolled",!j&&"is-animating");return c.a.createElement("div",{ref:U,className:ve,onScroll:Oe,onMouseDown:kt},w?c.a.createElement("div",{className:"empty"},c.a.createElement("span",null,E?E.text:"This is a private "+(m?"channel":"chat"))):R?c.a.createElement("div",{className:"empty rich"},c.a.createElement("span",null,Object(ut.a)(ge(R),["br","emoji","links"]))):f&&!ie?c.a.createElement("div",{className:"empty"},c.a.createElement("span",null,ge("NoMessages"))):f&&ie||x?c.a.createElement(xt,{containerRef:U,className:"messages-container",messageIds:f||[x.id],loadMoreForwards:de,loadMoreBackwards:le,isViewportNewest:y,firstUnreadId:v,onFabToggle:i,onNotchToggle:d},function(e,t,a,s,o,r,i,d,b,u,m,O,j,g,f,p,I){const v=c.a.createElement("div",{className:Object(ce.a)("unread-divider","local-action-message"),key:"unread-messages"},c.a.createElement("span",null,e("UnreadMessages"))),y=p?0:t.reduce((e,t)=>e+Object(h.h)(t.senderGroups).length,0);let C=0;const w=t.map((t,j,p)=>{const w=t.senderGroups.map((t,n,f)=>{if(1===t.length&&!Mt(t[0])&&Object(l.gb)(t[0])){const e=t[0],s=n===f.length-1&&j===p.length-1;return Object(h.e)([e.id===b.current&&v,c.a.createElement(ea,{key:e.id,message:e,observeIntersection:a,appearanceOrder:y-++C,isLastInList:s})])}let I;return Object(h.h)(t.map((w,E)=>{const M=Mt(w)?w.mainMessage:w,S=Mt(w)?w:void 0,k=Object(l.yb)(M),N=Mt(w),T=t[E+1];M.previousLocalId&&d.current==="message"+M.previousLocalId&&(d.current="message"+M.id);const P=!N&&M.groupedId?M.groupedId:void 0,A=T&&!Mt(T)?T.groupedId:void 0,x={isFirstInGroup:0===E,isLastInGroup:E===t.length-1,isFirstInDocumentGroup:Boolean(P&&P!==I),isLastInDocumentGroup:Boolean(P&&P!==A),isLastInList:E===t.length-1&&n===f.length-1&&j===p.length-1};I=P;const R=Object(l.G)(M),L="scheduled"!==m?R:`${M.date}_${R}`;return Object(h.e)([M.id===b.current?v:void 0,c.a.createElement(Ja,{key:L,message:M,observeIntersectionForBottom:a,observeIntersectionForMedia:s,observeIntersectionForAnimatedStickers:o,album:S,noAvatars:i,withAvatar:x.isLastInGroup&&r&&!k&&!(M.id===O),withSenderName:x.isFirstInGroup&&r&&!k,threadId:u,messageListType:m,noComments:!1===g,appearanceOrder:y-++C,isFirstInGroup:x.isFirstInGroup,isLastInGroup:x.isLastInGroup,isFirstInDocumentGroup:x.isFirstInDocumentGroup,isLastInDocumentGroup:x.isLastInDocumentGroup,isLastInList:x.isLastInList}),M.id===O&&c.a.createElement("div",{className:"local-action-message",key:"discussion-started"},c.a.createElement("span",null,e("DiscussionStarted")))])}))});return c.a.createElement("div",{className:"message-date-group",key:t.datetime,onMouseDown:kt,teactFastList:!0},c.a.createElement("div",{className:Object(ce.a)("sticky-date",!f&&"interactive"),key:"date-header",onMouseDown:kt,onClick:f?void 0:()=>I({selectedAt:t.datetime})},c.a.createElement("span",{dir:"auto"},f&&t.originalDate===n.sb&&e("MessageScheduledUntilOnline"),f&&t.originalDate!==n.sb&&e("MessageScheduledOn",Object(L.c)(e,t.datetime,void 0,!0)),!f&&Object(L.c)(e,t.datetime))),Object(h.h)(w))});return Object(h.h)(w)}(ge,ie||St([x]),te,ee,oe,pe,Ie,q,z,t,a,B,0,D,!!ie&&"scheduled"===a,!ie||!K.current,F)):c.a.createElement(Re.a,{color:"white"}))}));a(240);var as=Object(c.h)(Object(s.h)(e=>{const t=Object(r.z)(e);if(!t)return{};const{chatId:a,threadId:s,type:n}=t,c=Object(r.g)(e,a);return{messageListType:n,unreadCount:c&&s===b.MAIN_THREAD_ID&&"thread"===n?c.unreadCount:void 0}},(e,t)=>Object(h.l)(t,["focusNextReply"]))(({isShown:e,canPost:t,messageListType:a,unreadCount:s,focusNextReply:n})=>{const o=Object(ue.a)(),r=Object(c.q)(null),i=Object(c.m)(()=>{if(e)if("thread"===a)n();else{const e=r.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),a=t[t.length-1];if(!a)return;Object(At.a)(e,a,"end",20)}},[e,a,n]),l=Object(ce.a)("ScrollDownButton",e&&"revealed",!t&&"no-composer");return c.a.createElement("div",{ref:r,className:l},c.a.createElement("div",{className:"ScrollDownButton-inner"},c.a.createElement(ge.a,{color:"secondary",round:!0,onClick:i,ariaLabel:o("AccDescrPageDown")},c.a.createElement("i",{className:"icon-arrow-down"})),Boolean(s)&&c.a.createElement("div",{className:"unread-count"},Object(ot.b)(s))))})),ss=a(132),ns=a(139);async function cs(e,t,a,s){const n=URL.createObjectURL(t),{type:c,size:o}=t;let r,i;if(c.startsWith("image/"))if(a){const a=await Object(Xe.g)(n),{width:o,height:i}=a;if(o>1280||i>1280||"image/jpeg"!==c){const c=await function(e){return new Promise(t=>{const a=document.createElement("canvas"),s=a.getContext("2d");let{width:n,height:c}=e;(n>1280||c>1280)&&(n>=c?(c*=1280/n,n=1280):(n*=1280/c,c=1280)),a.width=n,a.height=c,s.drawImage(e,0,0,e.width,e.height,0,0,n,c),a.toBlob(t,"image/jpeg",100)})}(a);return c?(URL.revokeObjectURL(n),cs(e,c,!0,s)):cs(e,t,!1,s)}r={width:o,height:i}}else i=n;else if(c.startsWith("video/")){if(o<10485760){const{videoWidth:e,videoHeight:t,duration:a}=await Object(Xe.h)(n);r={width:e,height:t,duration:a}}i=await Object(Xe.c)(n)}return{blobUrl:n,filename:e,mimeType:c,size:o,quick:r,previewBlobUrl:i,...s}}var os=a(184);let rs;function is(e){rs.focus(),e.focus()}m.e&&(rs=document.createElement("input"),rs.classList.add("for-ios-autocapitalization-fix"),document.body.appendChild(rs));var ls=a.p+"c0155344d336103c2b6a0b28cc510750.js";const ds={encoderPath:ls,reuseWorker:!0},bs={type:"audio/ogg"};let us,ms,hs;async function Os(){return us||(us=a.e(10).then(a.t.bind(null,325,7)),ms=(await us).default,hs=new ms(ds)),us}async function js(e){await async function(){await Os(),await hs.start()}();const t=Date.now();let a;const s=[],n=[];hs.ondataavailable=e=>{s.push(e)};const c=function(e,t){const a=e.sourceNode,s=a.context.createAnalyser();s.fftSize=64,a.connect(s);const n=s.frequencyBinCount,c=new Uint8Array(n);let o=!1;return function e(){if(o)return;s.getByteFrequencyData(c);const a=c.reduce((e,t)=>e+t,0),r=a/n/255;t(r<.1?0:r),requestAnimationFrame(e)}(),()=>{o=!0}}(hs,t=>{n.push(255*t),e(t)});return{stop:()=>new Promise((e,o)=>{hs.onstop=()=>{e({blob:new Blob(s,bs),duration:Math.round(((a||Date.now())-t)/1e3),waveform:n})},hs.onerror=o;const r=Math.max(0,t+1e3-Date.now());setTimeout(()=>{hs.stop(),c()},r)}),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout(()=>{hs.pause(),a=Date.now(),c()},e)}}}const gs=["image/png","image/jpeg","image/gif"];function fs(e){const{text:t,entities:a}=e||{};if(!t)return"";const s=Object(Lt.b)(t,a,void 0,void 0,!0);return Array.isArray(s)?s.join(""):s}let ps,Is;var vs=a(65);var ys=a(185),Cs=a(193);const ws=document.createElement("div"),Es=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+(.*)/i,Ms=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+\n{2,}/i;function Ss(e,t,a,n){const[o,r,i]=Object(be.a)(),l=function(e){return ws.innerHTML=e.replace(/
/g,"\n"),ws.innerText}(a),{queryInlineBot:d,resetInlineBot:b}=Object(s.d)(),{username:u,query:m,canShowHelp:h}=function(e){const t=e.match(Es);if(!t)return{username:"",query:"",canShowHelp:!1};return{username:t[1],query:t[2],canShowHelp:""===t[2]&&!e.match(Ms)}}(l),O=u.toLowerCase(),j=Object(ha.a)(u),g=n&&n[O],{id:f,switchPm:p,offset:I,results:v,isGallery:y,help:C}=g||{};Object(c.n)(()=>{e&&O&&t&&d({chatId:t,username:O,query:m})},[m,e,d,t,O]);const w=Object(c.m)(()=>{d({chatId:t,username:O,query:m,offset:I})},[I,t,m,d,O]);return Object(c.n)(()=>{e&&f&&(p||v&&v.length)?r():i()},[f,e,r,v,p,i]),j!==u&&b({username:j}),{isOpen:o,closeTooltip:i,loadMore:w,username:u,id:f,isGallery:y,switchPm:p,results:v,help:h&&C?`@${u} ${C}`:void 0}}var ks=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(xe.a)(Ae.a.Extra,"DeleteMessageModal",!t);return a?c.a.createElement(a,e):void 0});function Ns(){return(Ns=Object.assign||function(e){for(var t=1;t{const a=Object(c.q)(!1),s=Object(c.m)(()=>{if(a.current=!0,Ps)return Ps=!1,void e();Ts&&(clearTimeout(Ts),Ts=void 0),Ts=window.setTimeout(()=>{a.current&&e()},200)},[e]),n=Object(c.m)(()=>{a.current=!1},[]);return c.a.createElement(ge.a,Ns({},t,{onMouseEnter:m.n?void 0:s,onMouseLeave:m.n?void 0:n,onClick:m.n?e:void 0}))});var xs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(xe.a)(Ae.a.Extra,"AttachMenu",!t);return a?c.a.createElement(a,e):void 0});var Rs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(xe.a)(Ae.a.Extra,"SymbolMenu",!t);return a?c.a.createElement(a,e):void 0});var Ls=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(xe.a)(Ae.a.Extra,"InlineBotTooltip",!t);return a?c.a.createElement(a,e):void 0});var Bs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(xe.a)(Ae.a.Extra,"MentionTooltip",!t);return a?c.a.createElement(a,e):void 0});var Ds=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(xe.a)(Ae.a.Extra,"CustomSendMenu",!t);return a?c.a.createElement(a,e):void 0});var Fs=e=>{const{isOpen:t}=e,a=Object(xe.a)(Ae.a.Extra,"StickerTooltip",!t);return a?c.a.createElement(a,e):void 0},Us=a(186);var Hs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(xe.a)(Ae.a.Extra,"BotKeyboardMenu",!t);return a?c.a.createElement(a,e):void 0}),qs=a(187),_s=a(120);a(242);var Gs=Object(c.h)(Object(s.h)(e=>{const{chatId:t,threadId:a,type:s}=Object(r.z)(e)||{};if(!t||!a||!s)return{};const{currentUserId:n,forwardMessages:{fromChatId:c,toChatId:o,messageIds:i}}=e,d=Object(r.nb)(e,t,a),b="scheduled"===s?Object(r.F)(e,t):Object(r.D)(e,t,a),u=e.settings.byKey.animationLevel>=1,m=o===t;let h,O;if(d?h=Object(r.l)(e,t,d):b?h=Object(r.E)(e,t,a,s):m&&1===i.length&&(h=Object(r.l)(e,c,i[0])),d&&h){const{forwardInfo:a}=h,s=t===n;a&&(a.isChannelPost||s)&&(O=Object(r.K)(e,h)),O||(O=Object(r.ub)(e,h))}else m&&(O=Object(l.ob)(c)?Object(r.Ib)(e,c):Object(r.g)(e,c));return{replyingToId:d,editingId:b,message:h,sender:O,shouldAnimate:u,forwardedMessagesCount:m?i.length:void 0}},(e,t)=>Object(h.l)(t,["setReplyingToId","setEditingId","focusMessage","exitForwardMode"]))(({replyingToId:e,editingId:t,message:a,sender:s,shouldAnimate:n,forwardedMessagesCount:o,setReplyingToId:r,setEditingId:i,focusMessage:l,exitForwardMode:d})=>{const b=Boolean((e||t)&&a||s&&o),u=Object(_s.a)([o],o?300:void 0),{shouldRender:m,transitionClassNames:h}=Object(oe.a)(u&&b,void 0,!n,void 0,!n),O=Object(c.m)(()=>{e?r({messageId:void 0}):t?i({messageId:void 0}):o&&d()},[e,t,o,r,i,d]);Object(c.n)(()=>b?Object(le.a)(O):void 0,[b,O]);const j=Object(c.m)(()=>{l({chatId:a.chatId,messageId:a.id})},[l,a]),g=Object(ce.a)("ComposerEmbeddedMessage",h),f=o&&o>1?o+" forwarded messages":void 0;if(m)return c.a.createElement("div",{className:g},c.a.createElement("div",null,c.a.createElement(ge.a,{round:!0,color:"translucent",ariaLabel:"Cancel replying",onClick:O},c.a.createElement("i",{className:"icon-close"})),c.a.createElement(ta,{className:"inside-input",message:a,sender:s,customText:f,title:t?"Edit Message":void 0,onClick:j})))}));var zs=Object(c.h)(e=>{const{attachments:t}=e,a=Object(xe.a)(Ae.a.Extra,"AttachmentModal",!t.length);return a?c.a.createElement(a,e):void 0});var $s=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(xe.a)(Ae.a.Extra,"PollModal",!t);return a?c.a.createElement(a,e):void 0});var Ws=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(xe.a)(Ae.a.Extra,"DropArea",!t);return a?c.a.createElement(a,e):void 0});a(243);const Vs=new RegExp(n.mb,"i");var Ks=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a})=>{const s=Object(r.cb)(e,t,a);return{webPagePreview:e.webPagePreview,noWebPage:s}},(e,t)=>Object(h.l)(t,["loadWebPagePreview","clearWebPagePreview","toggleMessageWebPage"]))(({chatId:e,threadId:t,messageText:a,disabled:s,webPagePreview:n,noWebPage:o,loadWebPagePreview:r,clearWebPagePreview:i,toggleMessageWebPage:l})=>{const d=Object(c.p)(()=>{const{text:e,entities:t}=Object(ns.a)(a),s=t&&t.find(({type:e})=>e===b.ApiMessageEntityTypes.TextUrl);if(s)return s.url;const n=e.match(Vs);return n?n[0]:void 0},[a]);Object(c.n)(()=>{d?r({text:d}):(i(),l({chatId:e,threadId:t}))},[e,l,i,d,r,t]),Object(Me.a)(()=>{i(),l({chatId:e,threadId:t})},[e]);const u=Boolean(n&&a.length&&!o&&!s),{shouldRender:m,transitionClassNames:h}=Object(oe.a)(u),O=Object(ct.a)(n);if(!m||!O)return;const{photo:j,...g}=O,f={content:{webPage:g}};return c.a.createElement("div",{className:Object(ce.a)("WebPagePreview",h)},c.a.createElement("div",null,c.a.createElement(ge.a,{round:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:()=>{l({chatId:e,threadId:t,noWebPage:!0})}},c.a.createElement("i",{className:"icon-close"})),c.a.createElement(Da,{message:f,inPreview:!0})))})),Qs=a(125);var Ys=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(xe.a)(Ae.a.Extra,"CalendarModal",!t);return a?c.a.createElement(a,e):void 0});var Js=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(xe.a)(Ae.a.Extra,"PaymentModal",!t);return a?c.a.createElement(a,e):void 0});var Xs,Zs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(xe.a)(Ae.a.Extra,"ReceiptModal",!t);return a?c.a.createElement(a,e):void 0});a(244);!function(e){e.Send="send",e.Record="record",e.Edit="edit"}(Xs||(Xs={}));var en=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const c=Object(r.g)(e,t),o=c&&Object(r.p)(e,c),i=c?Object(r.O)(e,c):void 0,d=Object(r.P)(e,t),u=i&&Object(r.bb)(e,t),m=Object(r.pb)(e,t),{language:h}=e.settings.byKey,O=e.emojiKeywords[n.j],j=h!==n.j?e.emojiKeywords[h]:void 0;return{editingMessage:Object(r.E)(e,t,a,s),connectionState:e.connectionState,draft:Object(r.C)(e,t,a),chat:c,isChatWithBot:i,isChatWithSelf:d,canScheduleUntilOnline:!d&&!i&&c&&o&&Object(l.ob)(t)&&o.status&&Boolean(o.status.wasOnline),isRightColumnShown:Object(r.W)(e),isSelectModeActive:Object(r.S)(e),withScheduledButton:a===b.MAIN_THREAD_ID&&"thread"===s&&Boolean(m&&m.length),shouldSchedule:"scheduled"===s,botKeyboardMessageId:u?u.id:void 0,isForwarding:t===e.forwardMessages.toChatId,isPollModalOpen:e.isPollModalOpen,stickersForEmoji:e.stickers.forEmoji.stickers,groupChatMembers:c&&c.fullInfo&&c.fullInfo.members,topInlineBotIds:e.topInlineBots&&e.topInlineBots.userIds,currentUserId:e.currentUserId,usersById:e.users.byId,lastSyncTime:e.lastSyncTime,contentToBeScheduled:e.messages.contentToBeScheduled,isPaymentModalOpen:e.payment.isPaymentModalOpen,isReceiptModalOpen:Boolean(e.payment.receipt),shouldSuggestStickers:e.settings.byKey.shouldSuggestStickers,recentEmojis:e.recentEmojis,language:h,baseEmojiKeywords:O?O.keywords:void 0,emojiKeywords:j?j.keywords:void 0,serverTimeOffset:e.serverTimeOffset,inlineBots:e.inlineBots.byUsername,isInlineBotLoading:e.inlineBots.isLoading}},(e,t)=>Object(h.l)(t,["sendMessage","editMessage","saveDraft","clearDraft","showDialog","setStickerSearchQuery","setGifSearchQuery","forwardMessages","openPollModal","closePollModal","closePaymentModal","clearReceipt","loadScheduledHistory","openChat","addRecentEmoji","loadEmojiKeywords","sendInlineBotResult"]))(({dropAreaState:e,shouldSchedule:t,canScheduleUntilOnline:a,onDropHide:o,isReady:r,editingMessage:i,chatId:d,threadId:u,messageListType:h,draft:O,chat:j,connectionState:g,isChatWithBot:f,isChatWithSelf:I,isRightColumnShown:v,isSelectModeActive:y,isForwarding:C,isPollModalOpen:w,isPaymentModalOpen:E,isReceiptModalOpen:M,botKeyboardMessageId:S,withScheduledButton:k,stickersForEmoji:N,groupChatMembers:T,topInlineBotIds:P,currentUserId:A,usersById:x,lastSyncTime:R,contentToBeScheduled:B,shouldSuggestStickers:D,language:F,baseEmojiKeywords:U,emojiKeywords:H,serverTimeOffset:q,recentEmojis:_,inlineBots:G,isInlineBotLoading:z,sendMessage:$,editMessage:W,saveDraft:V,clearDraft:K,showDialog:Q,setStickerSearchQuery:Y,setGifSearchQuery:J,forwardMessages:X,openPollModal:Z,closePollModal:ee,loadScheduledHistory:te,closePaymentModal:ae,openChat:se,clearReceipt:ne,addRecentEmoji:oe,loadEmojiKeywords:de,sendInlineBotResult:me})=>{const he=Object(ue.a)(),Oe=Object(c.q)(null),[je,fe]=Object(c.r)(""),pe=Object(c.q)(),Ie=Object(ha.a)(e),[ve,ye,we]=Object(be.a)(),[Ee,Me]=Object(c.r)(),{width:Se}=Ze.a.get(),ke=Object(c.q)(je);Object(c.n)(()=>{ke.current=je},[je]),Object(c.n)(()=>{pe.current=void 0},[d]),Object(c.n)(()=>{d&&R&&u===b.MAIN_THREAD_ID&&r&&te()},[r,d,te,R,u]),Object(c.n)(()=>{R&&r&&(de({language:n.j}),F!==n.j&&de({language:F}))},[de,F,R,r]),Object(c.o)(()=>{Oe.current&&(Oe.current.innerHTML='')},[]),Object(c.n)(()=>{B&&(Me(B),ye())},[B,ye]);const[Ne,Te]=Object(c.r)([]),[Pe,Ae,xe]=Object(be.a)(),[Re,Le,Be]=Object(be.a)(),[De,Fe,Ue]=Object(be.a)(),[He,qe,_e]=Object(be.a)(),[Ge,ze]=Object(be.a)(),[$e,We,Ve]=Object(be.a)(),{startRecordingVoice:Ke,stopRecordingVoice:Qe,pauseRecordingVoice:Je,activeVoiceRecording:Xe,currentRecordTime:et,recordButtonRef:tt,startRecordTimeRef:at}=(()=>{const e=Object(c.q)(null),[t,a]=Object(c.r)(),s=Object(c.q)(),[n,o]=Object(c.r)();Object(c.n)(()=>{m.e&&Os()},[]);const r=Object(c.m)(async()=>{try{const{stop:t,pause:n}=await js(t=>{e.current&&(s.current&&Date.now()%4==0&&(e.current.style.boxShadow=`0 0 0 ${50*(t||0)}px rgba(0,0,0,.15)`),o(Date.now()))});s.current=Date.now(),o(Date.now()),a({stop:t,pause:n})}catch(e){console.error(e)}},[]),i=Object(c.m)(()=>{if(t){e.current&&(e.current.style.boxShadow="none");try{return t.pause()}catch(e){return void console.error(e)}}},[t]),l=Object(c.m)(()=>{if(t){a(void 0),s.current=void 0,o(void 0),e.current&&(e.current.style.boxShadow="none");try{return t.stop()}catch(e){return void console.error(e)}}},[t]);return Object(c.n)(()=>t?Object(le.a)(l):void 0,[t,l]),{startRecordingVoice:r,pauseRecordingVoice:i,stopRecordingVoice:l,activeVoiceRecording:t,currentRecordTime:n,recordButtonRef:e,startRecordTimeRef:s}})(),st=i?Xs.Edit:!m.o||Xe||je&&!Ne.length||C?Xs.Send:Xs.Record,nt=!t,{isMentionTooltipOpen:ct,mentionFilter:ot,closeMentionTooltip:rt,insertMention:it,mentionFilteredUsers:lt}=Object(Cs.a)(!Ne.length,je,fe,void 0,T,P,A,x),{isOpen:dt,id:bt,isGallery:mt,switchPm:ht,results:Ot,closeTooltip:jt,help:gt,loadMore:ft}=Ss(Boolean(!Ne.length&&R),d,je,G),{isContextMenuOpen:pt,handleContextMenu:It,handleContextMenuClose:vt,handleContextMenuHide:yt}=Object(Rt.a)(tt,!(st===Xs.Send&&nt)),Ct=Object(c.p)(()=>Object(l.b)(j,f),[j,f]),wt=j&&Object(l.jb)(j),Et=Object(l.j)(j),{isStickerTooltipOpen:Mt,closeStickerTooltip:St}=function(e,t,a,n=!1){const{loadStickersForEmoji:o,clearStickersForEmoji:r}=Object(s.d)(),i=m.d&&1===Object(vs.a)(t)||!m.d&&Boolean(t.match(/^]*?>$/g)),l=Boolean(a)&&i;return Object(c.n)(()=>{n||(e&&i?o({emoji:t}):!l&&i||r())},[t,i,r,o,e,n]),{isStickerTooltipOpen:l,closeStickerTooltip:r}}(Boolean(D&&Ct.canSendStickers&&!Ne.length),je,N,!r),{isEmojiTooltipOpen:kt,closeEmojiTooltip:Nt,filteredEmojis:Tt,insertEmoji:Pt}=Object(ys.a)(Boolean(D&&Ct.canSendStickers&&!Ne.length),je,_,void 0,fe,U,H,!r),At=Object(c.m)((e,t=n.x)=>{const a=window.getSelection(),s=document.getElementById(t),c=Object(ut.a)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"​");if(a.rangeCount){const e=a.getRangeAt(0);if(Object(os.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)):a.collapse(!1),t.removeAllRanges(),t.addRange(a)}}(c),void s.dispatchEvent(new Event("input",{bubbles:!0}))}fe(`${ke.current}${c}`),requestAnimationFrame(()=>{Object(ss.a)(s)})},[]),xt=Object(c.m)(()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if(Object(os.a)(t,n.x))return void document.execCommand("delete",!1)}fe(function(e){const t=document.createElement("div");t.contentEditable="true",t.style.position="absolute",t.style.left="-10000px",t.style.top="-10000px",t.innerHTML=e,document.body.appendChild(t);let a=t.lastChild;if(a.lastChild)for(;a.lastChild;)a=a.lastChild;const s=a.textContent.length,n=document.createRange(),c=window.getSelection();n.setStart(a,s),n.setEnd(a,s),c.removeAllRanges(),c.addRange(n),document.execCommand("delete",!1);const o=t.innerHTML;return document.body.removeChild(t),o}(ke.current))},[]),Lt=Object(c.m)((e=!1)=>{e||fe(""),Te([]),St(),we(),Me(void 0),rt(),Nt(),m.l?setTimeout(()=>Ue(),350):Ue()},[St,we,rt,Nt,Ue]),Bt=Object(ha.a)(d);Object(c.n)(()=>{Bt&&d!==Bt&&(Qe(),Lt())},[d,Bt,Lt,Qe]);const Dt=((e,t,a,s,o,r)=>{Object(c.n)(()=>{a?(t(fs(a.content.text)),requestAnimationFrame(()=>{const e=document.getElementById(n.x);Object(ss.a)(e,!0)})):t("")},[a,t]);return Object(c.m)(()=>{const{text:t,entities:n}=Object(ns.a)(e.current);a&&(t||Object(l.fb)(a)?(r({messageId:a.id,text:t,entities:n}),s()):o())},[r,a,e,o,s])})(ke,fe,i,Lt,qe,W);((e,t,a,s,o,r,i,l,d)=>{const b=Object(c.m)((e,t)=>{o.current.length&&!i?l({chatId:e,threadId:t,draft:Object(ns.a)(o.current)}):d({chatId:e,threadId:t})},[d,i,o,l]),u=Object(c.p)(()=>Object(p.a)(e=>e(),n.w,!1),[t]),h=Object(ha.a)(t),O=Object(ha.a)(a);Object(c.n)(()=>(ps=t,Is=a,()=>{ps=void 0,Is=void 0,b(t,a)}),[t,a,b]),Object(c.n)(()=>{t===h&&a===O||e&&(r(fs(e)),m.n||requestAnimationFrame(()=>{const e=document.getElementById(n.x);Object(ss.a)(e,!0)}))},[t,a,e,r,b,h,O]);const j=Object(ha.a)(s);Object(c.n)(()=>{t&&a&&h===t&&O===a&&j!==s&&(s.length?u(()=>{ps===t&&Is===a&&b(t,a)}):b(t,a))},[t,s,h,j,O,u,a,b]);const g=Object(c.m)(()=>{t&&a&&b(t,a)},[t,a,b]);Object(re.a)(g),ie(g)})(O,d,u,je,ke,fe,i,V,K),((e,t,a)=>{Object(c.n)(()=>{async function s(s){if(!s.clipboardData)return;const c=document.activeElement;if(c&&![n.x,n.y].includes(c.id))return;const{items:o}=s.clipboardData,r=Array.from(o).find(e=>gs.includes(e.type)),i=r&&r.getAsFile(),l=s.clipboardData.getData("text").substring(0,4096);if(i||l){if(s.preventDefault(),i&&!a){const e=await cs(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])})(At,Te,i);const Ft=Object(c.m)(async(e,t)=>{Te(await Promise.all(e.map(e=>cs(e.name,e,t))))},[]),Ut=Object(c.m)(async(e,t)=>{Te([...Ne,...await Promise.all(e.map(e=>cs(e.name,e,t)))])},[Ne]),Ht=Object(c.m)(()=>{Te([])},[]),qt=Object(c.m)(async(e=!1,t)=>{if("connectionStateReady"!==g)return;let a=Ne;if(Xe){const e=await Qe();if(e){const{blob:t,duration:s,waveform:n}=e;a=[await cs("wonderful-voice-message.ogg",t,!1,{voice:{duration:s,waveform:n}})]}}const{text:s,entities:c}=Object(ns.a)(ke.current);if(!a.length&&!s&&!C)return;if(a.length&&s&&s.length>1024){const e=s.length-1024;return void Q({data:{message:"CAPTION_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":e,"{PLURAL_S}":e>1?"s":""},hasErrorKey:!0}})}const o=document.getElementById(n.x);if(a.length||s){if(Et&&!wt){const e=Math.floor(Date.now()/1e3)+q,t=pe.current&&Math.floor(e-pe.current),a=Et.nextSendDate&&Et.nextSendDate>e;if(t&&t{Lt()})},[g,Ne,Xe,C,q,K,d,Lt,Qe,Q,Et,wt,$,X,he]),_t=Object(c.m)((e,a=!1)=>{e={...e,isPreloadedGlobally:!0},t?(Me({sticker:e}),ye()):($({sticker:e}),requestAnimationFrame(()=>{Lt(a)}))},[t,ye,$,Lt]),Gt=Object(c.m)(e=>{t?(Me({gif:e}),ye()):($({gif:e}),requestAnimationFrame(()=>{Lt(!0)}))},[t,ye,$,Lt]),zt=Object(c.m)(e=>{if("connectionStateReady"!==g)return;me({id:e.id,queryId:e.queryId});const t=document.getElementById(n.x);m.e&&t===document.activeElement&&is(t),K({chatId:d,localOnly:!0}),requestAnimationFrame(()=>{Lt()})},[d,K,g,Lt,me]),$t=Object(c.m)(e=>{t?(Me({poll:e}),ee(),ye()):($({poll:e}),ee())},[ee,ye,$,t]),Wt=Object(c.m)(()=>{t?(Me({isSilent:!0}),ye()):qt(!0)},[qt,ye,t]),Vt=Object(c.m)((e,t=!1)=>{const{isSilent:a,...s}=Ee||{},n=Math.round(Math.max(e.getTime(),Date.now()+6e4)/1e3)+(t?0:q);Ee&&0!==Object.keys(s).length?($({...Ee,scheduledAt:n}),requestAnimationFrame(()=>{Lt()})):qt(!!a,n),we()},[we,qt,Lt,Ee,$,q]),Kt=Object(c.m)(()=>{Vt(new Date(1e3*n.sb),!0)},[Vt]),Qt=Object(c.m)(()=>{we(),Me(void 0)},[we]),Yt=Object(c.m)(e=>{"stickers"===e?(Y({query:""}),J({query:void 0})):(J({query:""}),Y({query:void 0}))},[Y,J]),Jt=Object(c.m)(()=>{const e=document.getElementById(n.x);m.l&&e===document.activeElement?(e.blur(),setTimeout(()=>{Fe()},100)):Fe()},[Fe]),Xt=Object(c.m)(()=>{se({id:d,threadId:u,type:"scheduled"})},[se,d,u]);Object(c.n)(()=>{v&&m.l&&Ue()},[v,Ue]),Object(c.n)(()=>{r&&(y?We():setTimeout(()=>{Ve()},200))},[y,Ve,We,r]);const Zt=Object(c.m)(()=>{switch(st){case Xs.Send:t?(Xe&&Je(),ye()):(qt(),requestAnimationFrame(()=>{Lt()}));break;case Xs.Record:Ke();break;case Xs.Edit:Dt()}},[st,Lt,t,Ke,Dt,Xe,ye,Je,qt]),ea=st===Xs.Record&&!Ct.canAttachMedia,ta=Object(ha.a)(i,!0),aa=i||ta,sa=new Date;sa.setSeconds(0),sa.setMilliseconds(0);const na=new Date;na.setFullYear(na.getFullYear()+1);let ca="SendMessage";switch(st){case Xs.Edit:ca="Save edited message";break;case Xs.Record:ca=ea?"Conversation.DefaultRestrictedMedia":"AccDescrVoiceMessage"}const oa=Object(ce.a)("Composer",!y&&"shown",$e&&"hover-disabled"),ra=Object(ce.a)("mobile-symbol-menu-button",Ge?De&&"menu-opened":De&&"is-loading"),ia=st===Xs.Edit?Dt:t?ye:qt;return c.a.createElement("div",{className:oa},Ct.canAttachMedia&&r&&c.a.createElement(Qs.a,{containerId:"#middle-column-portals"},c.a.createElement(Ws,{isOpen:e!==Ye.a.None,withQuick:[e,Ie].includes(Ye.a.QuickFile),onHide:o,onFileSelect:Ft})),c.a.createElement(zs,{attachments:Ne,caption:Ne.length?je:"",groupChatMembers:T,currentUserId:A,usersById:x,recentEmojis:_,onCaptionUpdate:fe,baseEmojiKeywords:U,emojiKeywords:H,addRecentEmoji:oe,onSend:t?ye:qt,onFileAppend:Ut,onClear:Ht}),c.a.createElement($s,{isOpen:Boolean(w),onClear:ee,onSend:$t}),c.a.createElement(Js,{isOpen:Boolean(E),onClose:ae}),c.a.createElement(Zs,{isOpen:Boolean(M),onClose:ne}),aa&&c.a.createElement(ks,{isOpen:He,isSchedule:"scheduled"===h,onClose:_e,message:aa}),c.a.createElement(Bs,{isOpen:ct,filter:ot,onClose:rt,onInsertUserName:it,filteredUsers:lt,usersById:x}),c.a.createElement("div",{id:"message-compose"},c.a.createElement("div",{className:"svg-appendix",ref:Oe}),c.a.createElement(Gs,null),c.a.createElement(Ks,{chatId:d,threadId:u,messageText:Ne.length?"":je,disabled:!Ct.canAttachEmbedLinks}),c.a.createElement("div",{className:"message-input-wrapper"},m.l?c.a.createElement(ge.a,{className:ra,round:!0,color:"translucent",onClick:De?Ue:Jt,ariaLabel:"Choose emoji, sticker or GIF"},c.a.createElement("i",{className:"icon-smile"}),c.a.createElement("i",{className:"icon-keyboard"}),!Ge&&c.a.createElement(Ce.a,{color:"gray"})):c.a.createElement(As,{className:""+(De?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:Fe,ariaLabel:"Choose emoji, sticker or GIF"},c.a.createElement("i",{className:"icon-smile"})),c.a.createElement(qs.a,{id:"message-input-text",html:Ne.length?"":je,placeholder:Xe&&Se<=600?"":he("Message"),forcedPlaceholder:gt,shouldSetFocus:De,shouldSuppressFocus:m.l&&De,shouldSuppressTextFormatter:kt||ct||dt,onUpdate:fe,onSend:ia,onSuppressedFocus:Ue}),z&&Boolean(bt)&&c.a.createElement(Ce.a,{color:"gray"}),k&&c.a.createElement(ge.a,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:Xt,ariaLabel:"Open scheduled messages"},c.a.createElement("i",{className:"icon-schedule"})),S&&!Xe&&!i&&c.a.createElement(As,{className:""+(Pe?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:Ae,ariaLabel:"Open bot command keyboard"},c.a.createElement("i",{className:"icon-bot-command"})),!Xe&&!i&&c.a.createElement(As,{className:""+(Re?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:Le,ariaLabel:"Add an attachment"},c.a.createElement("i",{className:"icon-attach"})),Xe&&et&&c.a.createElement("span",{className:"recording-state"},Object(L.i)(et-at.current)),c.a.createElement(Fs,{isOpen:Mt,onStickerSelect:_t}),c.a.createElement(Us.a,{isOpen:kt,emojis:Tt,onClose:Nt,onEmojiSelect:Pt,addRecentEmoji:oe}),c.a.createElement(xs,{isOpen:Re,allowedAttachmentOptions:Ct,onFileSelect:Ft,onPollCreate:Z,onClose:Be}),S&&c.a.createElement(Hs,{messageId:S,isOpen:Pe,onClose:xe}),c.a.createElement(Ls,{isOpen:dt,botId:bt,allowedAttachmentOptions:Ct,isGallery:mt,inlineBotResults:Ot,switchPm:ht,onSelectResult:zt,loadMore:ft,onClose:jt}),c.a.createElement(Rs,{isOpen:De,allowedAttachmentOptions:Ct,onLoad:ze,onClose:Ue,onEmojiSelect:At,onStickerSelect:_t,onGifSelect:Gt,onRemoveSymbol:xt,onSearchOpen:Yt,addRecentEmoji:oe}))),Xe&&c.a.createElement(ge.a,{round:!0,color:"danger",className:"cancel",onClick:Qe,ariaLabel:"Cancel voice recording"},c.a.createElement("i",{className:"icon-delete"})),c.a.createElement(ge.a,{ref:tt,round:!0,color:"secondary",className:`${st} ${Xe?"recording":""}`,disabled:ea,ariaLabel:he(ca),onClick:Zt,onContextMenu:st===Xs.Send&&nt?It:void 0},c.a.createElement("i",{className:"icon-send"}),c.a.createElement("i",{className:"icon-microphone-alt"}),c.a.createElement("i",{className:"icon-check"})),nt&&c.a.createElement(Ds,{isOpen:pt,onSilentSend:I?void 0:Wt,onScheduleSend:t?void 0:ye,onClose:vt,onCloseAnimationEnd:yt}),c.a.createElement(Ys,{isOpen:ve,withTimePicker:!0,selectedAt:sa.getTime(),maxAt:Object(L.k)(na),isFutureMode:!0,secondButtonLabel:a?"Send When Online":void 0,onClose:Qt,onSubmit:Vt,onSecondButtonClick:a?Kt:void 0}))}));var tn=Object(c.h)(e=>{const{isActive:t}=e,a=Object(xe.a)(Ae.a.Extra,"MobileSearch",!t,!0);return a?c.a.createElement(a,e):void 0});var an=Object(c.h)(e=>{const{isActive:t}=e,a=Object(xe.a)(Ae.a.Extra,"MessageSelectToolbar",!t);return a?c.a.createElement(a,e):void 0});var sn=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(xe.a)(Ae.a.Extra,"UnpinAllMessagesModal",!t);return a?c.a.createElement(a,e):void 0});a(245);const nn=m.l?450+n.c:void 0;function cn(e){return"file"===e.kind&&e.type&&n.n.has(e.type)}var on=Object(c.h)(Object(s.h)(e=>{const t=Object(r.Cb)(e),{isBlurred:a,background:s,backgroundColor:n,patternColor:c}=e.settings.themes[t]||{},o=Object(r.z)(e),{isLeftColumnShown:i,chats:{listIds:d}}=e,u={theme:t,customBackground:s,backgroundColor:n,patternColor:c,isLeftColumnShown:i,isRightColumnShown:Object(r.W)(e),isBackgroundBlurred:a,isMobileSearchActive:Boolean(m.l&&Object(r.B)(e)),isSelectModeActive:Object(r.S)(e),animationLevel:e.settings.byKey.animationLevel};if(!o||!d.active)return u;const{chatId:h,threadId:O,type:j}=o,g=Object(r.g)(e,h),f=Object(r.jb)(e,h),{chatId:p,messageId:I}=e.audioPlayer,v=g&&Object(l.d)(g,O),y=Object(r.L)(e,h),C="pinned"===j,w="scheduled"===j,E=Object(r.Fb)(e,h,O);return{...u,chatId:h,threadId:O,messageListType:j,originChatId:E?E.id:h,isPrivate:Object(l.ob)(h),canPost:!C&&(!g||v)&&(!y||m.l),isPinnedMessageList:C,isScheduledMessageList:w,currentUserBannedRights:g&&g.currentUserBannedRights,defaultBannedRights:g&&g.defaultBannedRights,hasPinnedOrAudioMessage:O!==b.MAIN_THREAD_ID||Boolean(f&&f.length)||Boolean(p&&I),pinnedMessagesCount:f?f.length:0,shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations}},(e,t)=>Object(h.l)(t,["openChat","unpinAllMessages","loadUser","closeLocalTextSearch","exitMessageSelectMode"]))(({chatId:e,threadId:t,messageListType:a,isPrivate:s,isPinnedMessageList:o,isScheduledMessageList:r,canPost:i,currentUserBannedRights:d,defaultBannedRights:u,hasPinnedOrAudioMessage:h,pinnedMessagesCount:O,customBackground:j,theme:g,backgroundColor:f,patternColor:p,isLeftColumnShown:I,isRightColumnShown:v,isBackgroundBlurred:y,isMobileSearchActive:C,isSelectModeActive:w,animationLevel:E,originChatId:M,shouldSkipHistoryAnimations:S,openChat:k,unpinAllMessages:N,loadUser:T,closeLocalTextSearch:P,exitMessageSelectMode:A})=>{const{width:x}=et(),R=Object(ue.a)(),[L,B]=Object(c.r)(Ye.a.None),[D,F]=Object(c.r)(),[U,H]=Object(c.r)(),[q,_]=Object(c.r)(!1),[G,z]=Object(c.r)(!m.l||E===n.f),$=h&&(xn.gb&&x=n.fb&&xe?Object(le.a)(()=>{k({id:void 0})}):void 0,[e,k]),Object(c.n)(()=>{B(Ye.a.None),F(void 0),H(void 0)},[e]),Object(c.n)(()=>{E===n.f&&z(!0)},[E]);Object(c.n)(()=>{s&&T({userId:e})},[e,s,T]);const X=Object(c.m)(e=>{if(m.n)return;const{items:t}=e.dataTransfer||{},a=t&&Array.from(t).filter(e=>"text/uri-list"!==e.type).every(cn);B(a?Ye.a.QuickFile:Ye.a.Document)},[]),Z=Object(c.m)(()=>{B(Ye.a.None)},[]),ee=Object(c.m)(()=>{_(!0)},[]),te=Object(c.m)(()=>{_(!1)},[]),ae=Object(c.m)(()=>{N({chatId:e}),te(),k({id:e})},[N,k,te,e]),se=Object(c.m)(()=>{k({id:e})},[k,e]),ne=((e,t)=>{const[a,s]=Object(c.r)(t);return Object(c.n)(()=>{t&&(t.startsWith("#")?s(t):Je.c(n.o,e,Je.a.Blob).then(e=>{const t=URL.createObjectURL(e);Object(Xe.g)(t).then(()=>{s(`url(${t})`)})}))},[t,e]),t?a:void 0})(g,j),oe=Object(ce.a)(Y&&"has-header-tools",j&&"custom-bg-image",f&&"custom-bg-color",j&&y&&"blurred",m.q?"mask-image-disabled":"mask-image-enabled"),re=Object(ce.a)("messaging-disabled",!w&&"shown"),ie=Object(l.L)(R,d,u),{composerHiddenScale:be,toolbarHiddenScale:me,composerTranslateX:Oe,toolbarTranslateX:je,unpinHiddenScale:fe,toolbarForUnpinHiddenScale:pe}=Object(c.p)(()=>at(x,Q),[Q,x]),Ie=Object(ce.a)("middle-column-footer",!Q&&"no-composer",Q&&U&&!w&&"with-notch"),ve=()=>{V!==b.MAIN_THREAD_ID?k({id:M,threadId:b.MAIN_THREAD_ID},!0):o||r?k({id:e,type:"thread"}):k({id:void 0},!0)};Object(he.a)(W&&V,ve,k,{id:e,threadId:b.MAIN_THREAD_ID});const ye=W&&V!==b.MAIN_THREAD_ID;return Object(he.a)(ye||o||r,ve,k,{id:e,threadId:V}),Object(he.a)(C,P),Object(he.a)(w,A),c.a.createElement("div",{id:"MiddleColumn",className:oe,onTransitionEnd:t=>{"transform"===t.propertyName&&t.target===t.currentTarget&&z(Boolean(e))},style:`\n --composer-hidden-scale: ${be};\n --toolbar-hidden-scale: ${me};\n --unpin-hidden-scale: ${fe};\n --toolbar-unpin-hidden-scale: ${pe};\n --composer-translate-x: ${Oe}px;\n --toolbar-translate-x: ${je}px;\n --pattern-color: ${p};\n --theme-background-color:\n ${f||("dark"===g?n.p:n.O)};\n `,onClick:m.m&&I?se:void 0},c.a.createElement("div",{id:"middle-column-bg",style:ne?"--custom-background: "+ne:void 0}),c.a.createElement("div",{id:"middle-column-portals"}),W&&V&&c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"messages-layout",onDragEnter:Q?X:void 0},c.a.createElement(wt,{chatId:W,threadId:V,messageListType:K,isReady:G}),c.a.createElement(de.a,{name:S?"none":E===n.e?"slide":"fade",activeKey:"thread"===K&&V===b.MAIN_THREAD_ID?1:2,shouldCleanup:!0},()=>c.a.createElement(c.a.Fragment,null,c.a.createElement(ts,{key:`${W}-${V}-${K}`,chatId:W,threadId:V,type:K,canPost:Q,hasTools:Y,onFabToggle:F,onNotchToggle:H,isReady:G}),c.a.createElement("div",{className:Ie},Q&&c.a.createElement(en,{chatId:W,threadId:V,messageListType:K,dropAreaState:L,onDropHide:Z,isReady:G}),o&&c.a.createElement("div",{className:"unpin-button-container",dir:R.isRtl?"rtl":void 0},c.a.createElement(ge.a,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:ee},c.a.createElement("i",{className:"icon-unpin"}),c.a.createElement("span",null,R("Chat.Pinned.UnpinAll",O,"i")))),!o&&!Q&&ie&&c.a.createElement("div",{className:re},c.a.createElement("div",{className:"messaging-disabled-inner"},c.a.createElement("span",null,ie))),c.a.createElement(an,{messageListType:K,isActive:w,canPost:Q})))),c.a.createElement(as,{isShown:J,canPost:Q})),m.l&&c.a.createElement(tn,{isActive:Boolean(C)})),e&&c.a.createElement(sn,{isOpen:q,chatId:e,pinnedMessagesCount:O,onClose:te,onUnpin:ae}))}));a(246);const rn=Object(p.a)(e=>e(),200,!1);var ln;!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",e[e.AddingMembers=20]="AddingMembers"}(ln||(ln={}));var dn=Object(c.h)(Object(s.h)((e,{chatId:t,isProfile:a,isManagement:s})=>{const{query:n}=Object(r.B)(e)||{},{query:c}=Object(r.A)(e)||{},{query:o}=Object(r.t)(e)||{},i=t?Object(r.g)(e,t):void 0,d=i&&Object(l.mb)(i);return{canManage:Boolean(!s&&a&&i&&!Object(r.P)(e,i.id)&&(Object(l.ob)(i.id)||(Object(l.jb)(i)||i.isCreator)&&!i.isNotJoined)),isChannel:d,messageSearchQuery:n,stickerSearchQuery:c,gifSearchQuery:o}},(e,t)=>Object(h.l)(t,["setLocalTextSearchQuery","setStickerSearchQuery","setGifSearchQuery","searchTextMessagesLocal","toggleManagement","openHistoryCalendar"]))(({isColumnOpen:e,isProfile:t,isSearch:a,isManagement:s,isStickerSearch:n,isGifSearch:o,isPollResults:r,isAddingChatMembers:i,profileState:l,managementScreen:d,canManage:b,isChannel:h,onClose:O,messageSearchQuery:j,stickerSearchQuery:g,gifSearchQuery:f,setLocalTextSearchQuery:p,setStickerSearchQuery:I,setGifSearchQuery:v,searchTextMessagesLocal:y,toggleManagement:C,openHistoryCalendar:w,shouldSkipAnimation:E})=>{var M;const S=Object(c.q)(null),k=Object(c.m)(e=>{p({query:e}),e.length&&rn(y)},[y,p]),N=Object(c.m)(e=>{I({query:e})},[I]),T=Object(c.m)(e=>{v({query:e})},[v]),[P,A]=Object(c.r)(!e);Object(c.n)(()=>{setTimeout(()=>{A(!e)},300)},[e]);const x=Object(ue.a)(),R=t?l===u.l.Profile?ln.Profile:l===u.l.SharedMedia?ln.SharedMedia:l===u.l.MemberList?ln.MemberList:-1:a?ln.Search:r?ln.PollResults:n?ln.StickerSearch:o?ln.GifSearch:i?ln.AddingMembers:s?d===u.g.Initial?ln.ManageInitial:d===u.g.ChatPrivacyType?ln.ManageChatPrivacyType:d===u.g.Discussion?ln.ManageDiscussion:d===u.g.ChannelSubscribers?ln.ManageChannelSubscribers:d===u.g.GroupPermissions?ln.ManageGroupPermissions:d===u.g.ChatAdministrators?ln.ManageChatAdministrators:d===u.g.GroupRemovedUsers?ln.ManageGroupRemovedUsers:d===u.g.GroupUserPermissionsCreate?ln.ManageGroupUserPermissionsCreate:d===u.g.GroupUserPermissions?ln.ManageGroupUserPermissions:d===u.g.GroupRecentActions?ln.ManageGroupRecentActions:d===u.g.ChatAdminRights?ln.ManageGroupAdminRights:d===u.g.GroupMembers?ln.ManageGroupMembers:void 0:void 0,B=null!==(M=Object(ct.a)(R,!0))&&void 0!==M?M:-1;function D(){if(-1!==B)switch(B){case ln.PollResults:return c.a.createElement("h3",null,x("PollResults"));case ln.Search:return c.a.createElement(c.a.Fragment,null,c.a.createElement(fe.a,{parentContainerClassName:"RightSearch",value:j,onChange:k}),c.a.createElement(ge.a,{round:!0,size:"smaller",color:"translucent",onClick:()=>w({selectedAt:Object(L.k)(Date.now())}),ariaLabel:"Search messages by date"},c.a.createElement("i",{className:"icon-calendar"})));case ln.AddingMembers:return c.a.createElement("h3",null,x("GroupAddMembers"));case ln.ManageInitial:return c.a.createElement("h3",null,x("Edit"));case ln.ManageChatPrivacyType:return c.a.createElement("h3",null,x(h?"ChannelTypeHeader":"GroupTypeHeader"));case ln.ManageDiscussion:return c.a.createElement("h3",null,x("Discussion"));case ln.ManageChatAdministrators:return c.a.createElement("h3",null,x("ChannelAdministrators"));case ln.ManageGroupRecentActions:return c.a.createElement("h3",null,x("Group.Info.AdminLog"));case ln.ManageGroupAdminRights:return c.a.createElement("h3",null,x("EditAdminRights"));case ln.ManageGroupPermissions:return c.a.createElement("h3",null,x("ChannelPermissions"));case ln.ManageGroupRemovedUsers:return c.a.createElement("h3",null,x("ChannelBlockedUsers"));case ln.ManageGroupUserPermissionsCreate:return c.a.createElement("h3",null,x("ChannelAddException"));case ln.ManageGroupUserPermissions:return c.a.createElement("h3",null,x("UserRestrictions"));case ln.StickerSearch:return c.a.createElement(fe.a,{value:g,placeholder:x("SearchStickersHint"),onChange:N});case ln.GifSearch:return c.a.createElement(fe.a,{value:f,placeholder:x("SearchGifsTitle"),onChange:T});case ln.SharedMedia:return c.a.createElement("h3",null,x("SharedMedia"));case ln.ManageChannelSubscribers:return c.a.createElement("h3",null,x("ChannelSubscribers"));case ln.MemberList:case ln.ManageGroupMembers:return c.a.createElement("h3",null,x("GroupMembers"));default:return c.a.createElement(c.a.Fragment,null,c.a.createElement("h3",null,"Profile"),c.a.createElement("section",{className:"tools"},b&&c.a.createElement(ge.a,{round:!0,color:"translucent",size:"smaller",ariaLabel:x("Edit"),onClick:C},c.a.createElement("i",{className:"icon-edit"}))))}}const F=m.l||R===ln.SharedMedia||R===ln.MemberList||R===ln.AddingMembers||s,U=Object(ce.a)("animated-close-icon",(P||E)&&"no-transition");return Object(c.n)(()=>{S.current.classList.toggle("state-back",F)},[F]),c.a.createElement("div",{className:"RightHeader"},c.a.createElement(ge.a,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:O,ariaLabel:x(F?"Common.Back":"Common.Close")},c.a.createElement("div",{ref:S,className:U})),c.a.createElement(de.a,{name:P||E?"none":"slide-fade",activeKey:B},D))})),bn=a(129);function un(e,t,a,s,o,r,i,d,b,u,m,h=0){const O="members"!==s&&o?o:s,j=Object(c.p)(()=>{if(r&&i)return Object(l.Jb)(r.map(({userId:e})=>e),i,void 0,h)},[r,h,i]),[g,f,p]=function(e,t,a,s){const[c,o]=Object(bn.a)(a?t:void 0,s,void 0,n.X),r=!c||!s||c[0]===s[0];return[c,o,!r]}(0,t,m,j),[I,v,y]=mn("media",O,a,m,d,b),[C,w,E]=mn("documents",O,a,m,d,b),[M,S,k]=mn("links",O,a,m,d,b),[N,T,P]=mn("audio",O,a,m,d,b);let A,x,R=!1;switch(O){case"members":A=g,x=f,R=p;break;case"media":A=I,x=v,R=y;break;case"documents":A=C,x=w,R=E;break;case"links":A=M,x=S,R=k;break;case"audio":A=N,x=T,R=P}return[O,A,x,R]}function mn(e,t,a,s,o,r){const i=Object(c.q)();Object(Me.a)(()=>{t===e&&o&&r&&(i.current=Object(l.w)(o,r,e).reverse())},[o,r,t,e]);const[d,b]=Object(bn.a)(s?a:void 0,i.current,void 0,"media"===e?n.vb:n.db);return[d,b,!(!d||!i.current||d[0]===i.current[0])]}var hn=a(58);const On=Object(p.h)(e=>e(),250,!1);let jn=!1;var gn=a(113),fn=a(106);var pn=a(135),In=a(194);a(247);var vn=Object(c.h)(({chat:e,user:t,photo:a,isFirstPhoto:s,isSavedMessages:n,lastSyncTime:o,onClick:r})=>{const i=Object(ue.a)(),d=t&&Object(l.sb)(t);function u(s="big",c){if(a&&!c)return`photo${a.id}?size=c`;let o;return n||d||(t?o=Object(l.e)(t,s):e&&(o=Object(l.e)(e,s))),o}const m=u(),h=Object(mt.a)(m,!1,b.ApiMediaFormat.BlobUrl,o),O=Object(mt.a)(!h&&s?u("normal",!0):void 0,!1,b.ApiMediaFormat.BlobUrl,o),j=Object(In.a)(!h&&a&&a.thumbnail&&a.thumbnail.dataUri),g=h||O||j,f=Object(ha.a)(g);let p="";if(n)p=c.a.createElement("i",{className:"icon-avatar-saved-messages"});else if(d)p=c.a.createElement("i",{className:"icon-avatar-deleted-account"});else if(g)p=c.a.createElement("img",{src:g,className:"avatar-media",alt:"",decoding:"async"});else if(!g&&t){const e=Object(l.bb)(t);p=e?Object(ot.c)(e,2):void 0}else if(!g&&e){const t=Object(l.k)(i,e);p=t&&Object(ot.c)(t,Object(l.ob)(e.id)?2:1)}else p=c.a.createElement("div",{className:"spinner-wrapper"},c.a.createElement(Ce.a,{color:"white"}));const I=Object(ce.a)("ProfilePhoto","color-bg-"+Object(l.Z)(t||e),n&&"saved-messages",d&&"deleted-account",!n&&!g&&"no-photo");return c.a.createElement("div",{className:I,onClick:g?r:void 0},f&&g&&f!==g&&c.a.createElement("img",{src:f,className:"prev-avatar-media",alt:"",decoding:"async"}),"string"==typeof p?Object(ut.a)(p,["hq_emoji"]):p)});a(248);var yn=Object(c.h)(Object(s.h)((e,{userId:t,forceShowSelf:a})=>{const{lastSyncTime:s,serverTimeOffset:n}=e,c=Object(r.Ib)(e,t),o=Object(r.g)(e,t),i=!a&&c&&c.isSelf,{animationLevel:l}=e.settings.byKey;return{lastSyncTime:s,user:c,chat:o,isSavedMessages:i,animationLevel:l,serverTimeOffset:n}},(e,t)=>Object(h.l)(t,["loadFullUser","openMediaViewer"]))(({user:e,chat:t,isSavedMessages:a,lastSyncTime:s,animationLevel:n,loadFullUser:o,openMediaViewer:r,serverTimeOffset:i})=>{const{id:d}=e||{},{id:h}=t||{},O=e?Object(l.bb)(e):t?t.title:"",j=(e?e.photos:t?t.photos:void 0)||[],g=n>=1?"slide":"none",[f,p]=Object(c.r)(0),I=a||j.length<=1||0===f,v=a||j.length<=1||f===j.length-1;Object(c.n)(()=>{f>j.length&&p(Math.max(0,j.length-1))},[f,j.length]);const y=Object(ue.a)();Object(c.n)(()=>{s&&d&&o({userId:d})},[d,o,s]),function(e,t,a){Object(c.n)(()=>{t.slice(a,a+4).forEach(e=>{vt.c(`photo${e.id}?size=c`)||vt.b(`photo${e.id}?size=c`,b.ApiMediaFormat.BlobUrl)})},[a,t])}(0,j,f);const C=Object(c.m)(()=>{r({avatarOwnerId:d||h,profilePhotoIndex:f,origin:u.h.ProfileAvatar})},[r,d,h,f]),w=Object(c.m)(()=>{I||p(f-1)},[f,I]),E=Object(c.m)(()=>{v||p(f+1)},[f,v]);if(Object(c.n)(()=>{const e=document.querySelector(".profile-slide-container > .active, .profile-slide-container > .to");if(e)return Object(Ee.b)(e,{excludedClosestSelector:".navigation",onSwipe:m.n?(e,t)=>{t===Ee.a.Right?w():t===Ee.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(vn,{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(de.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(ut.a)(O)),S&&c.a.createElement(pn.a,null)),!a&&(e?c.a.createElement("div",{className:"status "+(Object(l.Cb)(e)?"online":"")},c.a.createElement("span",{className:"user-status",dir:"auto"},Object(l.cb)(y,e,i))):c.a.createElement("span",{className:"status",dir:"auto"},Object(l.mb)(t)?y("Subscribers",t.membersCount,"i"):y("Members",t.membersCount,"i")))))}));var Cn=Object(c.h)(Object(s.h)((e,{chatOrUserId:t})=>{const{lastSyncTime:a}=e,s=t?Object(r.g)(e,t):void 0,n=Object(l.ob)(t)?Object(r.Ib)(e,t):void 0,c=s&&Object(l.Hb)(s,Object(r.eb)(e),Object(r.db)(e));return{lastSyncTime:a,chat:s,user:n,canInviteUsers:s&&!n&&(!Object(l.mb)(s)&&!Object(l.Db)(s,"inviteUsers")||Object(l.p)(s,"inviteUsers")),isMuted:c}},(e,t)=>Object(h.l)(t,["loadFullUser","updateChatMutedState","showNotification"]))(({lastSyncTime:e,user:t,chat:a,forceShowSelf:s,canInviteUsers:n,isMuted:o,loadFullUser:r,showNotification:i,updateChatMutedState:d})=>{const{id:b,fullInfo:u,username:m,phoneNumber:h,isSelf:O}=t||{},{id:j}=a||{},g=Object(ue.a)();Object(c.n)(()=>{e&&b&&r({userId:b})},[r,b,e]);const f=Object(c.m)(()=>{d({chatId:j,isMuted:!o})},[j,o,d]);if(!a||a.isRestricted||O&&!s)return;function p(e,t){Object(M.c)(e),i({message:t+" was copied"})}const I=h&&Object(Ma.c)(h),v=Object(l.g)(a),y=u&&u.bio||Object(l.f)(a);return c.a.createElement("div",{className:"ChatExtra"},I&&!!I.length&&c.a.createElement(fn.a,{icon:"phone",multiline:!0,narrow:!0,ripple:!0,onClick:()=>p(I,g("Phone"))},c.a.createElement("span",{className:"title",dir:"auto"},I),c.a.createElement("span",{className:"subtitle"},g("Phone"))),m&&c.a.createElement(fn.a,{icon:"mention",multiline:!0,narrow:!0,ripple:!0,onClick:()=>p("@"+m,g("Username"))},c.a.createElement("span",{className:"title",dir:"auto"},Object(ut.a)(m)),c.a.createElement("span",{className:"subtitle"},g("Username"))),y&&!!y.length&&c.a.createElement(fn.a,{icon:"info",multiline:!0,narrow:!0,isStatic:!0},c.a.createElement("span",{className:"title",dir:"auto"},Object(ut.a)(y,["br","links","emoji"])),c.a.createElement("span",{className:"subtitle"},g(b?"UserBio":"Info"))),(n||!m)&&v&&c.a.createElement(fn.a,{icon:"mention",multiline:!0,narrow:!0,ripple:!0,onClick:()=>p(v,g("SetUrlPlaceholder"))},c.a.createElement("div",{className:"title"},v),c.a.createElement("span",{className:"subtitle"},g("SetUrlPlaceholder"))),c.a.createElement(fn.a,{icon:"unmute",ripple:!0,onClick:f},c.a.createElement("span",null,g("Notifications")),c.a.createElement(Ie,{id:"group-notifications",label:b?"Toggle User Notifications":"Toggle Chat Notifications",checked:!o,inactive:!0})))})),wn=a(167),En=a(188),Mn=a(119),Sn=a(114),kn=a(110);var Nn=Object(c.h)(Object(s.h)((e,{userId:t})=>{const a=Object(r.s)(e),s=t&&Object(r.Ib)(e,t);return{chat:a,contactName:s?Object(l.ab)(s):void 0}},(e,t)=>Object(h.l)(t,["deleteChatMember"]))(({isOpen:e,chat:t,userId:a,contactName:s,onClose:n,deleteChatMember:o})=>{const r=Object(ue.a)(),i=Object(c.m)(()=>{o({chatId:t.id,userId:a}),n()},[t,o,n,a]);if(t&&a)return c.a.createElement(kn.a,{isOpen:e,onClose:n,onEnter:i,className:"delete",title:r("GroupRemoved.Remove")},c.a.createElement("p",null,Object(ut.a)(r("PeerInfo.Confirm.RemovePeer",s))),c.a.createElement(ge.a,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:i},r("lng_box_remove")),c.a.createElement(ge.a,{className:"confirm-dialog-button",isText:!0,onClick:n},r("Cancel")))}));a(253);const Tn=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"}];function Pn(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > div.active > .${e}-list > .scroll-item`].join(", ")}var An=Object(c.h)(Object(s.h)((e,{chatId:t,userId:a})=>{const s=Object(r.g)(e,t),n=Object(r.n)(e,a||t),{currentType:c,resultsByType:o}=Object(r.w)(e)||{},{foundIds:i}=o&&c&&o[c]||{},{byId:d}=e.users,b=s&&Object(l.nb)(s),u=s&&Object(l.mb)(s),m=b||u&&Object(l.jb)(s),h=s&&s.fullInfo&&s.fullInfo.members,O=m&&s&&s.fullInfo&&!s.fullInfo.canViewMembers,j=m&&s&&(Object(l.p)(s,"inviteUsers")||s.isCreator),g=m&&s&&(Object(l.p)(s,"banUsers")||s.isCreator);let f;return a?f=a:Object(l.ob)(t)&&(f=t),{theme:Object(r.Cb)(e),isChannel:u,resolvedUserId:f,chatMessages:n,foundIds:i,mediaSearchType:c,hasMembersTab:m,areMembersHidden:O,canAddMembers:j,canDeleteMembers:g,...m&&h&&{members:h,usersById:d},currentUserId:e.currentUserId,isRightColumnShown:Object(r.W)(e),isRestricted:s&&s.isRestricted,lastSyncTime:e.lastSyncTime,serverTimeOffset:e.serverTimeOffset}},(e,t)=>Object(h.l)(t,["setLocalMediaSearchType","loadMoreMembers","searchMediaMessagesLocal","openMediaViewer","openAudioPlayer","openUserInfo","focusMessage","loadProfilePhotos","setNewChatMembersDialogState"]))(({chatId:e,profileState:t,onProfileStateChange:a,theme:s,isChannel:o,resolvedUserId:r,currentUserId:i,chatMessages:l,foundIds:d,mediaSearchType:h,hasMembersTab:O,areMembersHidden:j,canAddMembers:g,canDeleteMembers:f,members:p,usersById:I,isRightColumnShown:v,isRestricted:y,lastSyncTime:C,setLocalMediaSearchType:w,loadMoreMembers:E,searchMediaMessagesLocal:M,openMediaViewer:S,openAudioPlayer:k,openUserInfo:N,focusMessage:T,loadProfilePhotos:P,setNewChatMembersDialogState:A,serverTimeOffset:x})=>{const R=Object(c.q)(null),L=Object(c.q)(null),B=Object(ue.a)(),[D,F]=Object(c.r)(0),[U,H]=Object(c.r)(),q=Object(c.p)(()=>[...O?[{type:"members",title:o?"ChannelSubscribers":"GroupMembers"}]:[],...Tn],[O,o]),_=q[D].type,[G,z,$,W]=un(0,E,M,_,h,p,I,l,d,0,C,x),V=q.findIndex(({type:e})=>e===G),{handleScroll:K}=function(e,t,a,s){Object(hn.a)(([a])=>{if(a&&a!==t){const a=e.current,n=a.querySelector(".TabList");a.scrollTop{jn=!1},350))}},[t,s]),Object(hn.a)(([t])=>{if(a!==u.l.Profile||a===t)return;const n=e.current;if(!n)return;const c=n.querySelector(".TabList");!c||c.offsetTop>n.scrollTop||(jn=!0,Object(At.a)(n,n.firstElementChild,"start",void 0,2*n.offsetHeight),setTimeout(()=>{jn=!1},350),s(a))},[a]);const n=Object(c.m)(()=>{const a=e.current;if(!a)return;const n=a.querySelector(".TabList");if(!n)return;let c=u.l.Profile;a.scrollTop>=n.offsetTop&&(c="members"===t?u.l.MemberList:u.l.SharedMedia),s(c)},[e,s,t]);return Object(c.n)(()=>{jn||n()},[n,t]),{handleScroll:Object(c.m)(()=>{jn||On(n)},[n])}}(R,_,t,a),{applyTransitionFix:Q,releaseTransitionFix:Y}=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])}}(R),[J,X]=(()=>{const[e,t]=Object(c.r)(!1);return[e,Object(c.m)(()=>{t(e=>!e)},[])]})(),Z=Object(c.m)(()=>{Y(),X()},[Y,X]),ee=Object(c.m)(()=>{A(u.i.InProgress)},[A]);Object(c.n)(()=>{w({mediaType:_})},[w,_]);const te=r||e;Object(c.n)(()=>{C&&P({profileId:te})},[P,te,C]);const ae=Object(c.m)(e=>{S({chatId:te,threadId:b.MAIN_THREAD_ID,messageId:e,origin:u.h.SharedMedia})},[te,S]),se=Object(c.m)(e=>{k({chatId:te,messageId:e})},[te,k]),ne=Object(c.m)(e=>{N({id:e})},[N]),ce=Object(c.m)(e=>{T({chatId:te,messageId:e})},[te,T]),oe=Object(c.m)(()=>{H(void 0)},[]);let re;Object(c.n)(()=>{if(L.current&&m.n)return Object(Ee.b)(L.current,{onSwipe:(e,t)=>{t===Ee.a.Left?F(Math.min(D+1,q.length-1)):t===Ee.a.Right&&F(Math.max(0,D-1))}})},[D,q.length]);const ie="members"===G||!O&&"media"===G;ie?re=v?0:1e3:z||(re=n.wb);const le=Object(_s.a)([e,G],re);function be(e){return e!==i&&f?[{title:B("lng_context_remove_from_group"),icon:"stop",handler:()=>{H(e)}}]:void 0}function me(){if(!z||!le||!l){const e=ie&&z&&!le;return c.a.createElement("div",{className:"content empty-list"},!e&&c.a.createElement(Ce.a,null))}if(!z.length){let e;switch(G){case"members":e=j?"You have no access to group members list.":"No members found";break;case"documents":e=B("lng_media_file_empty_search");break;case"links":e=B("lng_media_link_empty_search");break;case"audio":e=B("lng_media_song_empty_search");break;default:e=B("SharedMedia.EmptyTitle")}return c.a.createElement("div",{className:"content empty-list"},c.a.createElement(Mn.a,{text:e}))}return c.a.createElement("div",{className:`content ${G}-list`,dir:B.isRtl&&"media"===G?"rtl":void 0,teactFastList:!0},"media"===G?z.map(e=>l[e]&&c.a.createElement(wn.a,{key:e,message:l[e],onClick:ae})):"documents"===G?z.map(e=>l[e]&&c.a.createElement(aa.a,{key:e,message:l[e],withDate:!0,smaller:!0,className:"scroll-item",onDateClick:ce})):"links"===G?z.map(e=>l[e]&&c.a.createElement(En.a,{key:e,message:l[e],onMessageClick:ce})):"audio"===G?z.map(e=>l[e]&&c.a.createElement(sa.a,{key:e,theme:s,message:l[e],target:"sharedMedia",date:l[e].date,lastSyncTime:C,className:"scroll-item",onPlay:se,onDateClick:ce})):"members"===G?z.map((e,t)=>c.a.createElement(fn.a,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>ne(e),contextActions:be(e)},c.a.createElement(rt.a,{userId:e,forceShowSelf:!0}))):void 0)}return c.a.createElement(gn.a,{ref:R,className:"Profile custom-scroll",itemSelector:Pn(G),items:le?z:void 0,cacheBuster:J,sensitiveArea:n.lb,preloadBackwards:le?"members"===G?n.X:n.vb:0,noScrollRestoreOnTop:!0,noFastList:!0,onLoadMore:$,onScroll:K},!W&&function(e,t){return c.a.createElement("div",{className:"profile-info"},c.a.createElement(yn,{userId:t||e,forceShowSelf:t!==e}),c.a.createElement(Cn,{chatOrUserId:t||e,forceShowSelf:t!==e}))}(e,r),!y&&c.a.createElement("div",{className:"shared-media"},c.a.createElement(de.a,{ref:L,name:B.isRtl?"slide-reversed":"slide",activeKey:V,renderCount:q.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:Q,onStop:Z},me),c.a.createElement(Ne.a,{big:!0,activeTab:D,tabs:q,onSwitchTab:F})),g&&c.a.createElement(Sn.a,{isShown:"members"===G,onClick:ee,ariaLabel:B("lng_channel_add_users")},c.a.createElement("i",{className:"icon-add-user-filled"})),f&&c.a.createElement(Nn,{isOpen:Boolean(U),userId:U,onClose:oe}))}));var xn=Object(c.h)(e=>{const t=Object(xe.a)(Ae.a.Extra,"RightSearch");return t?c.a.createElement(t,e):c.a.createElement(Re.a,null)});var Rn=Object(c.h)(e=>{const t=Object(xe.a)(Ae.a.Extra,"Management");return t?c.a.createElement(t,e):c.a.createElement(Re.a,null)});var Ln=Object(c.h)(()=>{const e=Object(xe.a)(Ae.a.Extra,"StickerSearch");return e?c.a.createElement(e,null):c.a.createElement(Re.a,null)});var Bn=Object(c.h)(()=>{const e=Object(xe.a)(Ae.a.Extra,"GifSearch");return e?c.a.createElement(e,null):c.a.createElement(Re.a,null)});var Dn=Object(c.h)(()=>{const e=Object(xe.a)(Ae.a.Extra,"PollResults");return e?c.a.createElement(e,null):c.a.createElement(Re.a,null)}),Fn=a(168);a(254);var Un=Object(c.h)(Object(s.h)((e,{chatId:t})=>{const a=Object(r.g)(e,t),{userIds:s}=e.contactList||{},{byId:n}=e.users,{byId:c}=e.chats,{currentUserId:o,newChatMembersProgress:i,connectionState:d}=e,b=a&&Object(l.mb)(a),{query:m,fetchingStatus:h,globalUserIds:O,localUserIds:j}=e.userSearch;return{isChannel:b,members:a&&a.fullInfo?a.fullInfo.members:void 0,currentUserId:o,usersById:n,chatsById:c,localContactIds:s,searchQuery:m,isSearching:h,isLoading:i===u.i.Loading,globalUserIds:O,localUserIds:j,connectionState:d}},(e,t)=>Object(h.l)(t,["loadContactList","setUserSearchQuery"]))(({isChannel:e,connectionState:t,members:a,onNextStep:s,currentUserId:n,usersById:o,chatsById:r,localContactIds:i,isLoading:d,searchQuery:b,isSearching:u,localUserIds:m,globalUserIds:O,setUserSearchQuery:j,onClose:g,isActive:f,loadContactList:p})=>{const I=Object(ue.a)(),[v,y]=Object(c.r)([]),C=Object(ha.a)(v)===v;Object(c.n)(()=>{f&&"connectionStateReady"===t&&p()},[t,f,p]),Object(he.a)(f,g);const w=Object(c.p)(()=>a?a.map(e=>e.userId):[],[a]),E=Object(c.m)(e=>{j({query:e})},[j]),M=Object(c.p)(()=>{const t=i?Object(l.Ib)(i.filter(e=>e!==n),r):[];if(!b)return t.filter(e=>!w.includes(e));const a=t.filter(e=>{const t=o[e];if(!t)return!1;const a=Object(l.bb)(t);return a&&Object(A.a)(a,b)});return Object(l.Ib)(Object(h.o)([...a,...m||[],...O||[]]).filter(t=>{const a=o[t];return!w.includes(t)&&(!a||!Object(l.Bb)(a)||!e&&a.canBeInvitedToGroup)}),r)},[i,r,b,m,O,n,o,w,e]),S=Object(c.m)(()=>{v.length&&(j({query:""}),s(v))},[v,j,s]);return c.a.createElement("div",{className:"AddChatMembers"},c.a.createElement("div",{className:"AddChatMembers-inner"},c.a.createElement(Fn.a,{itemIds:M,selectedIds:v,filterValue:b,filterPlaceholder:I("lng_channel_add_users"),searchInputId:"new-members-picker-search",isLoading:u,onSelectedIdsChange:y,onFilterChange:E,noScrollRestore:C}),c.a.createElement(Sn.a,{isShown:Boolean(v.length),disabled:d,ariaLabel:I("lng_channel_add_users"),onClick:S},d?c.a.createElement(Ce.a,{color:"white"}):c.a.createElement("i",{className:"icon-arrow-right"}))))}));a(255);const Hn=Object.keys(u.m).length/2,qn=Object.keys(u.g).length/2;function _n(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}var Gn=Object(c.h)(Object(s.h)(e=>{const{chatId:t,threadId:a}=Object(r.z)(e)||{},s=Object(r.d)(e);return{contentKey:Object(r.ob)(e),chatId:t,threadId:a,currentProfileUserId:e.users.selectedId,isChatSelected:Boolean(t&&s),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations}},(e,t)=>Object(h.l)(t,["openUserInfo","toggleChatInfo","toggleManagement","closeLocalTextSearch","setStickerSearchQuery","setGifSearchQuery","closePollResults","addChatMembers","setNewChatMembersDialogState"]))(({contentKey:e,chatId:t,threadId:a,currentProfileUserId:s,isChatSelected:o,toggleChatInfo:r,toggleManagement:i,openUserInfo:l,closeLocalTextSearch:d,setStickerSearchQuery:b,setGifSearchQuery:m,closePollResults:h,addChatMembers:O,setNewChatMembersDialogState:j,shouldSkipHistoryAnimations:g})=>{var f;const{width:p}=et(),[I,v]=Object(c.r)(u.l.Profile),[y,C]=Object(c.r)(u.g.Initial),[w,E]=Object(c.r)(),[M,S]=Object(c.r)(),k=I!==u.l.Profile,N=void 0!==e,T=e===u.m.ChatInfo||e===u.m.UserInfo,P=e===u.m.Search,A=e===u.m.Management,x=e===u.m.StickerSearch,R=e===u.m.GifSearch,L=e===u.m.PollResults,B=e===u.m.AddingMembers,D=p<=n.gb,[F,U]=Object(c.r)(!N),H=null!==(f=Object(ct.a)(e,!0,!o))&&void 0!==f?f:-1,q=Object(c.m)((t=!0)=>{switch(e){case u.m.AddingMembers:j(u.i.Closed);break;case u.m.ChatInfo:if(k&&t){v(u.l.Profile);break}r(void 0,!0);break;case u.m.UserInfo:if(k&&t){v(u.l.Profile);break}l({id:void 0},!0);break;case u.m.Management:switch(y){case u.g.Initial:i();break;case u.g.ChatPrivacyType:case u.g.Discussion:case u.g.GroupPermissions:case u.g.GroupType:case u.g.ChatAdministrators:case u.g.ChannelSubscribers:case u.g.GroupMembers:C(u.g.Initial);break;case u.g.GroupUserPermissionsCreate:case u.g.GroupRemovedUsers:case u.g.GroupUserPermissions:C(u.g.GroupPermissions),E(void 0),S(void 0);break;case u.g.ChatAdminRights:case u.g.GroupRecentActions:C(u.g.ChatAdministrators)}break;case u.m.Search:_n(),d();break;case u.m.StickerSearch:_n(),b({query:void 0});break;case u.m.GifSearch:_n(),m({query:void 0});break;case u.m.PollResults:h()}},[e,k,r,l,h,j,y,i,d,b,m]),_=Object(c.m)((e,t)=>{E(e),S(t)},[]),G=Object(c.m)(e=>{O({chatId:t,memberIds:e})},[O,t]);function z(e){if(-1!==H)switch(H){case u.m.AddingMembers:return c.a.createElement(Un,{chatId:t,onNextStep:G,isActive:N&&e,onClose:q});case u.m.ChatInfo:case u.m.UserInfo:return c.a.createElement(An,{key:s||t,chatId:t,userId:s,profileState:I,onProfileStateChange:v});case u.m.Search:return c.a.createElement(xn,{chatId:t,threadId:a,onClose:q,isActive:N&&e});case u.m.Management:return c.a.createElement(Rn,{chatId:t,currentScreen:y,isPromotedByCurrentUser:M,selectedChatMemberId:w,onScreenSelect:C,onChatMemberSelect:_,isActive:N&&e,onClose:q});case u.m.StickerSearch:return c.a.createElement(Ln,{onClose:q,isActive:N&&e});case u.m.GifSearch:return c.a.createElement(Bn,{onClose:q,isActive:N&&e});case u.m.PollResults:return c.a.createElement(Dn,{onClose:q,isActive:N&&e})}}return Object(c.n)(()=>N?Object(le.a)(q):void 0,[N,q]),Object(c.n)(()=>{setTimeout(()=>{U(!N)},300)},[N]),Object(c.n)(()=>{N&&D&&q()},[D]),Object(Et.a)(([a,s])=>{(a===u.m.ChatInfo&&e===u.m.UserInfo||a===u.m.UserInfo&&e===u.m.ChatInfo||s!==t)&&(v(u.l.Profile),C(u.g.Initial))},[e,t]),Object(he.a)(o&&(e===u.m.ChatInfo||e===u.m.UserInfo||e===u.m.Management||e===u.m.AddingMembers),()=>q(!1),r),c.a.createElement("div",{id:"RightColumn-wrapper",className:o?void 0:"is-hidden"},D&&c.a.createElement("div",{className:"overlay-backdrop",onClick:q}),c.a.createElement("div",{id:"RightColumn"},c.a.createElement(dn,{chatId:t,isColumnOpen:N,isProfile:T,isSearch:P,isManagement:A,isStickerSearch:x,isGifSearch:R,isPollResults:L,isAddingChatMembers:B,profileState:I,managementScreen:y,onClose:q,shouldSkipAnimation:F||g}),c.a.createElement(de.a,{name:F||g?"none":"zoom-fade",renderCount:Hn+qn,activeKey:A?Hn+y:H,shouldCleanup:!0,cleanupExceptionKey:u.m.ChatInfo},z)))}));var zn=Object(c.h)(({isOpen:e})=>{const t=Object(xe.a)(Ae.a.Extra,"MediaViewer",!e);return t?c.a.createElement(t,null):void 0});var $n=Object(c.h)(({isOpen:e})=>{const t=Object(xe.a)(Ae.a.Extra,"Notifications",!e);return t?c.a.createElement(t,null):void 0});var Wn=Object(c.h)(({isOpen:e})=>{const t=Object(xe.a)(Ae.a.Extra,"Dialogs",!e);return t?c.a.createElement(t,null):void 0});var Vn=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(xe.a)(Ae.a.Extra,"ForwardPicker",!t);return a?c.a.createElement(a,e):void 0});var Kn=Object(c.h)(e=>{const{url:t}=e,a=Object(xe.a)(Ae.a.Extra,"SafeLinkModal",!t);return a?c.a.createElement(a,e):void 0});var Qn=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(xe.a)(Ae.a.Extra,"HistoryCalendar",!t);return a?c.a.createElement(a,e):void 0});a(256);let Yn,Jn,Xn=!1;function Zn(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 ec=Object(c.h)(Object(s.h)(e=>{const{chatId:t,messageId:a}=e.audioPlayer,s=t&&a?Object(r.l)(e,t,a):void 0;return{animationLevel:e.settings.byKey.animationLevel,lastSyncTime:e.lastSyncTime,isLeftColumnShown:e.isLeftColumnShown,isRightColumnShown:Object(r.W)(e),isMediaViewerOpen:Object(r.T)(e),isForwardModalOpen:Object(r.R)(e),hasNotifications:Boolean(e.notifications.length),hasDialogs:Boolean(e.dialogs.length),audioMessage:s,safeLinkModalUrl:e.safeLinkModalUrl,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations}},(e,t)=>Object(h.l)(t,["loadAnimatedEmojis","loadNotificationSettings","loadNotificationExceptions","updateIsOnline","loadTopInlineBots"]))(({lastSyncTime:e,isLeftColumnShown:t,isRightColumnShown:a,isMediaViewerOpen:o,isForwardModalOpen:i,animationLevel:l,hasNotifications:d,hasDialogs:b,audioMessage:u,safeLinkModalUrl:m,isHistoryCalendarOpen:h,shouldSkipHistoryAnimations:O,loadAnimatedEmojis:j,loadNotificationSettings:g,loadNotificationExceptions:f,updateIsOnline:p,loadTopInlineBots:I})=>{n.r&&!Xn&&(Xn=!0,console.log(">>> RENDER MAIN")),Object(c.n)(()=>{e&&(p(!0),j(),g(),f(),I())},[e,j,f,g,p,I]);const{transitionClassNames:v}=Object(oe.a)(!t,void 0,!0,void 0,O),{transitionClassNames:y}=Object(oe.a)(a,void 0,!0,void 0,O),C=Object(ce.a)(v.replace(/([\w-]+)/g,"middle-column-$1"),y.replace(/([\w-]+)/g,"right-column-$1"),O&&"history-animation-disabled");Object(c.n)(()=>{l>0&&(document.body.classList.add("animating-right-column"),Object(ne.b)(350+n.c),Yn&&(clearTimeout(Yn),Yn=void 0),Yn=window.setTimeout(()=>{document.body.classList.remove("animating-right-column"),Yn=void 0},350+n.c))},[l,a]);const w=Object(c.m)(()=>{p(!1);const e=Object(r.r)(Object(s.e)());let t=0;clearInterval(Jn),Jn=window.setInterval(()=>{if(document.title.includes(n.J))Zn(!1);else{if(t%2==0){const t=Object(r.r)(Object(s.e)())-e;t>0&&(document.title=`${t} notification${t>1?"s":""}`,Zn(!0))}else document.title=n.kb,Zn(!1);t++}},1e3)},[p]),E=Object(c.m)(()=>{p(!0),clearInterval(Jn),Jn=void 0,document.title.includes(n.J)||(document.title=n.kb),Zn(!1)},[p]);function M(e){e.preventDefault(),e.stopPropagation()}return Object(re.a)(w,E),ie(w),c.a.createElement("div",{id:"Main",className:C,onDrop:M,onDragOver:M},c.a.createElement(Qe,null),c.a.createElement(on,null),c.a.createElement(Gn,null),c.a.createElement(zn,{isOpen:o}),c.a.createElement(Vn,{isOpen:i}),c.a.createElement($n,{isOpen:d}),c.a.createElement(Wn,{isOpen:b}),u&&c.a.createElement(Ct,{key:u.id,message:u,noUi:!0}),c.a.createElement(Kn,{url:m}),c.a.createElement(Qn,{isOpen:h}))}));n.r&&console.log(">>> FINISH LOAD MAIN BUNDLE"),Object(s.e)().connectionState||Object(s.d)().initApi()},200:function(e,t,a){},201:function(e,t,a){},202:function(e,t,a){},213:function(e,t,a){},214:function(e,t,a){},215:function(e,t,a){},218:function(e,t,a){},219:function(e,t,a){},220:function(e,t,a){},224:function(e,t,a){},225:function(e,t,a){},227: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){},238:function(e,t,a){},239:function(e,t,a){},240:function(e,t,a){},242:function(e,t,a){},243:function(e,t,a){},244:function(e,t,a){},245:function(e,t,a){},246:function(e,t,a){},247:function(e,t,a){},248:function(e,t,a){},253:function(e,t,a){},254:function(e,t,a){},255:function(e,t,a){},256:function(e,t,a){}}]); //# sourceMappingURL=4.fc61103f855ebaf3b6cf.js.map