2 lines
360 KiB
JavaScript
2 lines
360 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[5769],{53779:(e,t,s)=>{s.r(t),s.d(t,{LockScreen:()=>cc,Main:()=>sc});var a=s(33555),n=s(83716),i=s(97184),o=(s(65456),s(27225)),r=s(6137),c=s(91713),d=s(81396),l=s(65054),u=s(60782),m=s(59692),h=s(69118),p=s(92387),g=s(4463),f=s(41020),I=s(44271),v=s(7054),w=s(84112),y=s(28406),b=s(43858),P=s(74399);const Z=32*P.Gw,S=45.5*P.Gw,C=26.5*P.Gw,M=16*P.Gw,E=16.125*P.Gw;var R=s(53475),k=s(4907),T=s(42797);function A(e,t){return t-((0,v.jUK)(e).isLeftColumnShown&&!(0,T.W7)()?e.leftColumnWidth||((s=b.Z.get().width)>n._mX?Math.min(Math.max(.25*s,M),.33*s):s>n.ksF?Math.min(Math.max(.33*s,M),.4*s):C):0);var s}function N(e,t,s){const a=t.reactions||{results:[]},n=(0,v._5C)(e,t.chatId),i=(0,g.vt)(a.results,s);let{recentReactions:o=[]}=a;return o.length&&(o=o.filter((t=>{let{isOwn:s,peerId:a}=t;return!s&&a!==e.currentUserId}))),s.forEach((t=>{const{currentUserId:s}=e;o.unshift({peerId:n?.id||s,reaction:t,addedDate:Math.floor(Date.now()/1e3),isOwn:!0})})),(0,k.cY)(e,t.chatId,t.id,{reactions:{...a,results:i,recentReactions:o}})}function B(e,t,s){return(0,R.a4)(e,t,s,void 0,!0)}const x=350;function L(e,t,s,a,n,i,o){const r=o?.reactions;if(r&&(0,w.A)(a,r))return e;if(e=(0,f.cY)(e,t,s,{reactions:a}),!i)return e;const c=n.unreadReactions?.includes(s);if((0,g.yL)(e,a)&&!c){e=B(e,t,{unreadReactionsCount:(n?.unreadReactionsCount||0)+1,unreadReactions:[...n?.unreadReactions||[],s]});const a=(0,v.hjO)(e,t,s);if(!n||!a)return e;(0,h.R3)((()=>{(0,y.rh)({chat:n,message:a,isReaction:!0})}))}else c&&(e=B(e,t,{unreadReactionsCount:(n?.unreadReactionsCount||1)-1,unreadReactions:n?.unreadReactions?.filter((e=>e!==s))}));return e}function U(e,t,s,a){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const i=n?(0,v.TmO)(e,t,s):(0,v.hjO)(e,t,s);if(i&&a.content){const{photo:e,video:t,sticker:s,document:n}=(0,g.qp)(i);e&&a.content.photo?(a.content.photo.blobUrl=e.blobUrl,a.content.photo.thumbnail=e.thumbnail):t&&a.content.video?a.content.video.blobUrl=t.blobUrl:s&&a.content.sticker?a.content.sticker.isPreloadedGlobally=s.isPreloadedGlobally:n&&a.content.document&&(a.content.document.previewBlobUrl=n.previewBlobUrl)}const o=i?{...i,...a}:a;return n?(0,f.P4)(e,t,s,o):(0,f.cY)(e,t,s,o)}function O(e,t,s,a){const{chatId:n}=s,{threadInfo:i}=(0,v.DbP)(e,s)||{};if(!i&&s.replyToMessageId){const i=(0,v.hjO)(e,n,s.replyToMessageId);i?e=(0,f.lG)(e,i,n,s.id,a):t.loadMessage({chatId:n,messageId:s.replyToMessageId,threadUpdate:{isDeleting:a,lastMessageId:s.id}})}return e}function j(e,t,s){const{id:a,chatId:n}=s,{threadInfo:i,firstMessageId:o}=(0,v.DbP)(e,s)||{},c=(0,v.Z1J)(e,n),d=c?.unreadCount&&!(0,v.gbs)(e,n,r._f);return e=O(e,t,s),i&&(!o&&(0,g.CI)(s)||(e=(0,f.xj)(e,n,i.threadId,[a]),Object.values(e.byTabId).forEach((t=>{let{id:r}=t;(0,v.b9T)(e,n,i.threadId,r)&&(e=(0,f.$S)(e,n,i.threadId,a,r),o||(e=(0,f.pf)(e,n,i.threadId,"firstMessageId",s.id)))}))),e=(0,f.pf)(e,n,i.threadId,"threadInfo",{...i,lastMessageId:s.id}),(0,g.CI)(s)||(0,g.FT)(s)||(e=(0,f.Xg)(e,n,i.threadId,{messagesCount:(i.messagesCount||0)+1}))),d||(e=(0,f.xj)(e,n,r._f,[a]),Object.values(e.byTabId).forEach((t=>{let{id:s}=t;if((0,v.b9T)(e,n,r._f,s)){const t=(0,v.It8)(e,n,r._f),i=(0,f.$S)(e,n,r._f,a,s),o=(0,v.Cbz)(i,n,r._f,s);t&&!o.includes(t)||(e=i)}}))),e}function _(e,t,s){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{chats:n}=e,i=n.byId[t],o=i?.lastMessage,r=i?.isForum?(0,v.p$s)(e,s):void 0;return r&&(e=(0,f.Cn)(e,t,r.id,{lastMessageId:s.id})),!o||a||o.id===s.id||o.id===s.previousLocalId||s.id>o.id?(0,f.a4)(e,t,{lastMessage:s}):e}function F(e,t){const s=(0,v.Zwk)(e,t),a=(0,v.gbs)(e,t,r._f);if(!s||!a)return;let n=a.length;for(;n--;){const e=s[a[n]];if(!e.isDeleting)return e}}function D(e,t,s,n){if(t){const i=(0,v.Z1J)(e,t);if(!i)return;s.forEach((s=>{e=(0,f.cY)(e,t,s,{isDeleting:!0});const a=F(e=(0,f.CE)(e,t,s),t);a&&(e=_(e,t,a,!0)),i.topics?.[s]&&(e=(0,f.BK)(e,t,s))})),n.requestChatUpdate({chatId:t});const o=[];return s.forEach((s=>{const a=(0,v.hjO)(e,t,s);if(!a)return;e=O(e,n,a,!0);const i=(0,v.nrh)(e,a);i&&o.push(i)})),(0,a.R3)(e),void setTimeout((()=>{e=(0,a.Rd)(),e=(0,f.K4)(e,t,s),(0,a.R3)(e),(0,u.Tw)(o).forEach((e=>{n.requestThreadInfoUpdate({chatId:t,threadId:e})}))}),x)}const i=[];s.forEach((t=>{const s=(0,v.X5I)(e,t);if(s){i.push(s);const n=F(e=(0,f.cY)(e,s,t,{isDeleting:!0}),s);n&&(e=_(e,s,n,!0)),setTimeout((()=>{e=(0,a.Rd)(),e=(0,f.K4)(e,s,[t]),(0,a.R3)(e)}),x)}})),(0,a.R3)(e),(0,u.Tw)(i).forEach((e=>{n.requestChatUpdate({chatId:e})}))}(0,a.iw)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"newMessage":{const{chatId:n,id:i,message:o,shouldForceReply:c}=s;e=j(e=U(e,n,i,o),t,o),o.repliesThreadInfo&&(e=(0,f.Xg)(e,o.repliesThreadInfo.chatId,o.repliesThreadInfo.threadId,o.repliesThreadInfo));const d=(0,v.hjO)(e,n,i),l=(0,v.Z1J)(e,n);l?.isForum&&d.isTopicReply&&!(0,v.p$s)(e,d)&&d.replyToMessageId&&t.loadTopicById({chatId:n,topicId:d.replyToMessageId}),Object.values(e.byTabId).forEach((s=>{let{id:l}=s;const u=(0,g.CI)(o);if((0,v.KAC)(e,n,o,l)){if(u&&o.isOutgoing&&!o.content?.action&&!o.replyToStoryId&&!o.content?.storyData){const s=(0,v.Btg)(e,l);s&&t.focusMessage({chatId:n,threadId:s.threadId,messageId:o.id,noHighlight:!0,isResizingContainer:!0,tabId:l})}const{threadInfo:s}=(0,v.DbP)(e,o)||{};s&&!u&&t.requestThreadInfoUpdate({chatId:n,threadId:s.threadId}),u||setTimeout((()=>{e=(0,a.Rd)(),c&&(e=(0,f.pf)(e,n,r._f,"replyingToId",i)),e=_(e,n,d),(0,a.R3)(e)}),x)}else e=_(e,n,d)})),(0,a.R3)(e),(0,v.Nap)(e,n)||t.loadTopChats();break}case"updateStartEmojiInteraction":Object.values(e.byTabId).forEach((t=>{let{id:a}=t;const{chatId:n}=(0,v.Btg)(e,a)||{};if(n!==s.id)return;const i=(0,v.hjO)(e,n,s.messageId);if(!i)return;if((0,g.UD)(i)!==s.emoji)return;const o=(0,v.jUK)(e,a);e=(0,I.i)(e,{activeEmojiInteractions:[...o.activeEmojiInteractions||[],{id:Math.random(),animatedEffect:s.emoji,messageId:s.messageId}]},a)})),(0,a.R3)(e);break;case"newScheduledMessage":{const{chatId:t,id:n,message:i}=s;e=U(e,t,n,i,!0);const o=(0,v.qyA)(e,t,r._f)||[];e=(0,f.pf)(e,t,r._f,"scheduledIds",(0,u.Tw)([...o,n]));const c=(0,v.nrh)(e,i);if(c!==r._f){const s=(0,v.qyA)(e,t,c)||[];e=(0,f.pf)(e,t,c,"scheduledIds",(0,u.Tw)([...s,n]))}(0,a.R3)(e);break}case"updateMessage":{const{chatId:t,id:n,message:i}=s,o=(0,v.hjO)(e,t,n),r=(0,v.Z1J)(e,t);e=U(e,t,n,i);const c=(0,v.hjO)(e,t,n);i.repliesThreadInfo&&(e=(0,f.Xg)(e,i.repliesThreadInfo.chatId,i.repliesThreadInfo.threadId,i.repliesThreadInfo)),o&&(e=_(e,t,c)),i.reactions&&r&&(e=L(e,t,n,i.reactions,r,c.isOutgoing,o)),i.content?.text?.text!==o?.content?.text?.text&&(e=(0,f.CE)(e,t,n)),(0,a.R3)(e);break}case"updateScheduledMessage":{const{chatId:t,id:n,message:i}=s,o=(0,v.TmO)(e,t,n);if(!o)return;e=U(e,t,n,i,!0);const c=Object.keys((0,v.yBV)(e,t)||{}).map(Number).sort(((e,t)=>t-e));e=(0,f.pf)(e,t,r._f,"scheduledIds",c);const d=(0,v.nrh)(e,o);if(d!==r._f){const s=(0,v.qyA)(e,t,d)||[];e=(0,f.pf)(e,t,d,"scheduledIds",s.sort(((e,t)=>t-e)))}(0,a.R3)(e);break}case"updateMessageSendSucceeded":{const{chatId:n,localId:i,message:o}=s;e=j(e,t,o);const c=(0,v.hjO)(e,n,i);e=(0,f.K4)(e,n,[i]),o.isScheduled&&(e=(0,f.bV)(e,n,[i])),e=(0,f.cY)(e,n,o.id,{...c,...o,previousLocalId:i}),e={...e,fileUploads:{byMessageLocalId:(0,u.CE)(e.fileUploads.byMessageLocalId,[i.toString()])}};const d=(0,v.hjO)(e,n,o.id);e=_(e,n,d);const l=(0,v.DbP)(e,o);Object.values(e.byTabId).forEach((s=>{let{id:a}=s;const{chatId:i,threadId:c}=(0,v.Btg)(e,a)||{};i===n&&(l?.threadInfo?.threadId||r._f)===c&&t.markMessageListRead({maxId:o.id,tabId:a})})),l?.threadInfo&&(e=(0,f.pf)(e,n,l.threadInfo.threadId,"threadInfo",{...l.threadInfo,lastMessageId:o.id,lastReadInboxMessageId:o.id})),e=(0,f.a4)(e,n,{lastReadInboxMessageId:o.id}),(0,a.R3)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:n,message:i}=s,o=(0,v.qyA)(e,t,r._f)||[];e=(0,f.pf)(e,t,r._f,"scheduledIds",[...o,i.id]);const c=(0,v.nrh)(e,i);if(c!==r._f){const s=(0,v.qyA)(e,t,c)||[];e=(0,f.pf)(e,t,c,"scheduledIds",[...s,i.id])}const d=(0,v.TmO)(e,t,n);e=(0,f.bV)(e,t,[n]),e=(0,f.P4)(e,t,i.id,{...d,...i,previousLocalId:n}),(0,a.R3)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:n,messageIds:i}=s,o=(0,u.q0)((0,v.Zwk)(e,t),i),c={[r._f]:i};Object.values(o).forEach((s=>{const a=(0,v.nrh)(e,s);if(e=(0,f.cY)(e,t,s.id,{isPinned:n}),a===r._f)return;const i=c[a]||[];i.push(s.id),c[a]=i})),Object.entries(c).forEach((s=>{let[a,i]=s;const o=(0,v.KBA)(e,t,r._f)||[],c=n?(0,u.Tw)(o.concat(i)).sort(((e,t)=>t-e)):o.filter((e=>!i.includes(e)));e=(0,f.pf)(e,t,Number(a),"pinnedIds",c)})),(0,a.R3)(e);break}case"updateThreadInfo":{const{chatId:n,threadId:i,threadInfo:o,firstMessageId:r}=s,c=(0,v.tZg)(e,n,i),d={...c,...o};if(!d.threadId)return;e=(0,f.Xg)(e,n,i,d),r&&(e=(0,f.pf)(e,n,i,"firstMessageId",r));const l=(0,v.Z1J)(e,n);if(l?.isForum&&o.lastReadInboxMessageId!==c?.lastReadInboxMessageId&&t.loadTopicById({chatId:n,topicId:i}),o.topMessageId===i&&!l?.isForum){const t=l?.lastReadInboxMessageId,s=d.lastReadInboxMessageId||t;t&&s&&(e=(0,f.Xg)(e,n,i,{lastReadInboxMessageId:Math.max(s,t)}))}(0,a.R3)(e);break}case"resetMessages":{const{id:n}=s,i=(0,v.Zwk)(e,n);if(i&&!(0,g.YC)(n)){const s=(0,l._w)();e=(0,f.K4)(e,n,Object.keys(i).map(Number)),(0,a.R3)(e),t.loadFullChat({chatId:n,force:!0,tabId:s}),t.loadViewportMessages({chatId:n,threadId:r._f,tabId:s})}break}case"deleteMessages":{const{ids:a,chatId:n}=s;D(e,n,a,t);break}case"deleteScheduledMessages":{const{ids:t,chatId:n}=s;!function(e,t,s,n){e&&(t.forEach((t=>{n=(0,f.P4)(n,e,t,{isDeleting:!0})})),(0,a.R3)(n),setTimeout((()=>{n=(0,a.Rd)(),n=(0,f.bV)(n,e,t);const s=(0,v.yBV)(n,e);n=(0,f.pf)(n,e,r._f,"scheduledIds",Object.keys(s||{}).map(Number)),(0,a.R3)(n)}),x))}(n,t,0,e);break}case"deleteHistory":{const{chatId:i}=s,o=e.messages.byChatId[i];if(i===n.awM&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>({...e,isDeleted:!0})))},(0,a.R3)(e)),o){const s=Object.keys(o.byId).map(Number);D(e=(0,a.Rd)(),i,s,t)}else t.requestChatUpdate({chatId:i});e=(0,a.Rd)(),e=(0,f.kq)(e,i),(0,a.R3)(e);break}case"updateCommonBoxMessages":{const{ids:t,messageUpdate:n}=s;t.forEach((t=>{const s=(0,v.X5I)(e,t);s&&(e=(0,f.cY)(e,s,t,n))})),(0,a.R3)(e);break}case"updateChannelMessages":{const{channelId:t,ids:n,messageUpdate:i}=s;n.forEach((s=>{e=(0,f.cY)(e,t,s,i)})),(0,a.R3)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:n}=s,i=(0,v.ZBV)(e,t);if(i?.content.poll){const t=i.content.poll.results;let s=t;n.results?.results&&(t.results&&n.results.isMin?t.results&&(s={...n.results,results:n.results.results.map((e=>({...e,isChosen:t.results.find((t=>t.option===e.option))?.isChosen}))),isMin:void 0}):s=n.results);const o={...i.content.poll,...n,results:s};e=(0,f.cY)(e,i.chatId,i.id,{content:{...i.content,poll:o}}),(0,a.R3)(e)}break}case"updateMessagePollVote":{const{pollId:t,peerId:n,options:i}=s,o=(0,v.ZBV)(e,t);if(!o||!o.content.poll||!o.content.poll.results)break;const{poll:r}=o.content,c=(0,v._5C)(e,o.chatId),{recentVoterIds:d,totalVoters:l,results:u}=r.results,m=d?[...d]:[],h=l?l+1:1,p=u?[...u]:[];m.push(n),i.forEach((t=>{const s=p.findIndex((e=>e.option===t)),a=p[s],i=a?{...a}:{option:t,votersCount:0};i.votersCount+=1,c?.id!==n&&n!==e.currentUserId||(i.isChosen=!0),s?p[s]=i:p.push(i)})),e=(0,f.cY)(e,o.chatId,o.id,{content:{...o.content,poll:{...r,results:{...r.results,recentVoterIds:m,totalVoters:h,results:p}}}}),(0,a.R3)(e);break}case"updateServiceNotification":{const{message:a}=s;(0,v.UWV)(e)&&t.createServiceNotification({message:a});break}case"updateMessageReactions":{const{chatId:t,id:n,reactions:i}=s,o=(0,v.hjO)(e,t,n),r=(0,v.Z1J)(e,s.chatId);if(!r||!o)return;e=L(e,t,n,i,r,o.isOutgoing,o),(0,a.R3)(e);break}case"updateMessageExtendedMedia":{const{chatId:t,id:n,media:i,preview:o}=s,r=(0,v.hjO)(e,t,n);if(!(0,v.Z1J)(e,s.chatId)||!r)return;if(o){if(!r.content.invoice)return;e=(0,f.cY)(e,t,n,{content:{...r.content,invoice:{...r.content.invoice,extendedMedia:o}}}),(0,a.R3)(e)}else i&&(e=(0,f.cY)(e,t,n,{content:{...i}}),(0,a.R3)(e));break}case"updateTranscribedAudio":{const{transcriptionId:t,text:n,isPending:i}=s;e={...e,transcriptions:{...e.transcriptions,[t]:{...e.transcriptions[t]||{},transcriptionId:t,text:n,isPending:i}}},(0,a.R3)(e);break}case"updateMessageSendFailed":{const{chatId:n,localId:i,error:o}=s;o.match(/CHAT_SEND_.+?FORBIDDEN/)&&Object.values(e.byTabId).forEach((e=>{let{id:s}=e;t.showAllowedMessageTypesNotification({chatId:n,tabId:s})})),e=(0,f.cY)(e,n,i,{sendingState:"messageSendingStateFailed"}),(0,a.R3)(e);break}case"updateMessageTranslations":{const{chatId:t,messageIds:n,toLanguageCode:i,translations:o}=s;e=(0,f.TD)(e,t,n,i,o),(0,a.R3)(e);break}}}));const q=new Map,G=(0,h.Ds)((e=>e()),500,!1);async function H(e,t,s,i,o){let d=arguments.length>5&&void 0!==arguments[5]&&arguments[5],m=arguments.length>6&&void 0!==arguments[6]&&arguments[6];for(var h=arguments.length,g=new Array(h>7?h-7:0),I=7;I<h;I++)g[I-7]=arguments[I];let[w=(0,l._w)()]=g;const y=t.id;let b,P=n.hT6;switch(o){case c.Uq.Backwards:i?(b=-1,P+=1):b=void 0;break;case c.Uq.Around:b=-(Math.round(n.hT6/2)+1);break;case c.Uq.Forwards:b=-(n.hT6+1),i&&(P+=1)}e=(0,a.Rd)();const Z=await(0,p.t9)("fetchMessages",{chat:(0,v.Z1J)(e,y),offsetId:i,addOffset:b,limit:P,threadId:s});if(!Z)return;const{messages:S,users:C,chats:M,repliesThreadInfos:E}=Z;e=(0,a.Rd)();const R=y===n.awM?e.serviceNotifications.filter((e=>{let{isDeleted:t}=e;return!t})).map((e=>{let{message:t}=e;return t})):[],k=[].concat(S,R),T=(0,u.ee)(k,"id"),A=Object.keys(T).map(Number);if(s!==r._f){const t=(0,v.yZJ)(e,y,s)||{};A[0]&&t!==A[0]||t===s||A.unshift(s)}e=(0,f.c_)(e,y,T),e=d?(0,f.hv)(e,y,s,A):(0,f.xj)(e,y,s,A),e=(0,f.Sh)(e,(0,u.ee)(C,"id")),e=(0,f.fZ)(e,(0,u.ee)(M,"id")),e=(0,f.j6)(e,E);let N=(0,v.gbs)(e,y,s);const B=i?(0,v.ofg)(e,y,s,i):void 0;if(d&&N&&B&&(B.length&&!(0,u.YE)(N,B)||(e=(0,f.xj)(e,y,s,B),N=(0,v.gbs)(e,y,s),e=(0,f.IU)(e,y,s,B),d=!1)),!m){const t=d?B:N,{newViewportIds:a}=V(t,i,o);e=(0,f.y9)(e,y,s,a,w)}(0,a.R3)(e)}function V(e,t,s){const{length:a}=e,i=t?function(e,t){return t<e[0]?0:t>e[e.length-1]?e.length-1:e.findIndex(((s,a)=>s===t||s<t&&e[a+1]>t))}(e,t):-1,o=s===c.Uq.Backwards?i:i+1||a,r=s===c.Uq.Around?Math.round(n.hT6/2):n.hT6,d=o-r,l=o+r-1,u=e.slice(Math.max(0,d),l+1);let m,h;switch(s){case c.Uq.Backwards:m=o>=0,h=d>=0;break;case c.Uq.Forwards:m=o<a,h=l<=a-1;break;case c.Uq.Around:default:m=u.length>0,h=u.length===n.hT6}return{newViewportIds:u,areSomeLocal:m,areAllLocal:h}}async function $(e,t){let s;const n=t.attachment?(t,i)=>{q.has(i)||(s=i,q.set(i,n)),e=(0,a.Rd)(),e={...e,fileUploads:{byMessageLocalId:{...e.fileUploads.byMessageLocalId,[i]:{progress:t}}}},(0,a.R3)(e)}:void 0;(t.replyingTo||i.cj)&&await(0,h.Pn)(),void 0!==t.currentThreadId&&(t.currentThreadId!==r._f&&(t.replyingTo&&"replyingTo"in t.replyingTo||(t.replyingTo={replyingTo:t.currentThreadId}),t.replyingTo.replyingTo||(t.replyingTo.replyingTo=t.currentThreadId),t.replyingTo.replyingTo&&!t.replyingTo.replyingToTopId&&(t.replyingTo.replyingToTopId=t.currentThreadId)),await(0,p.t9)("sendMessage",t,n),n&&s&&q.delete(s))}(0,a.iw)("loadViewportMessages",((e,t,s)=>{const{direction:n=c.Uq.Around,isBudgetPreload:i=!1,shouldForceRender:o=!1,tabId:r=(0,l._w)()}=s||{};let{chatId:d,threadId:u}=s||{};if(!d||!u){const t=(0,v.Btg)(e,r);if(!t)return;d=t.chatId,u=t.threadId}const m=(0,v.Z1J)(e,d);if(!m||m.isRestricted)return;const p=(0,v.Cbz)(e,d,u,r),g=(0,v.gbs)(e,d,u);if(p&&p.length&&n!==c.Uq.Around){const s=n===c.Uq.Backwards?p[0]:p[p.length-1],a=Boolean(g&&!g.includes(s)),o=a?(0,v.ofg)(e,d,u,s):g,{newViewportIds:I,areSomeLocal:w,areAllLocal:y}=V(o,s,n);if(w&&(e=(0,f.y9)(e,d,u,I,r)),(0,h.R3)((()=>{!async function(e,t,s,a,n,i,o,r,c){for(var d=arguments.length,u=new Array(d>9?d-9:0),m=9;m<d;m++)u[m-9]=arguments[m];let[h=(0,l._w)()]=u;s||await H(e,i,o,c,r,a,n,h),n||t.loadViewportMessages({chatId:i.id,threadId:o,direction:r,isBudgetPreload:!0,tabId:h})}(e,t,y,a,i,m,u,n,s,r)})),i)return}else{const t=(0,v.G$N)(e,d,r)||(0,v.rdT)(e,d,u),s=Boolean(t&&g&&!g.includes(t)),a=(s?(0,v.ofg)(e,d,u,t):g)||[],{newViewportIds:n,areSomeLocal:o,areAllLocal:l}=V(a,t,c.Uq.Around);o&&(e=(0,f.y9)(e,d,u,n,r)),l||(0,h.R3)((()=>{H(e,m,u,t,c.Uq.Around,s,i,r)}))}(0,a.R3)(e,{forceOnHeavyAnimation:o})})),(0,a.iw)("loadMessage",(async(e,t,s)=>{const{chatId:n,messageId:i,replyOriginForId:o,threadUpdate:c}=s,d=(0,v.Z1J)(e,n);if(!d)return;const l=await async function(e,t,s,n){const i=await(0,p.t9)("fetchMessage",{chat:t,messageId:s});if(i){if(i!==r._Q)return e=(0,a.Rd)(),e=(0,f.cY)(e,t.id,s,i.message),e=(0,f.Sh)(e,(0,u.ee)(i.users,"id")),(0,a.R3)(e),i.message;if(n){e=(0,a.Rd)();const s=(0,v.hjO)(e,t.id,n);e=(0,f.cY)(e,t.id,n,{...s,replyToMessageId:void 0}),(0,a.R3)(e)}}}(e,d,i,o);if(l&&c){const{lastMessageId:t,isDeleting:s}=c;e=(0,a.Rd)(),e=(0,f.lG)(e,l,n,t,s),(0,a.R3)(e)}})),(0,a.iw)("sendMessage",((e,t,s)=>{const{messageList:a,tabId:i=(0,l._w)()}=s,{storyId:o,peerId:c}=(0,v.pri)(e,i),d=Boolean(o&&c);if(!a&&!d)return;let{chatId:m,threadId:h,type:p}=a||{};if(d&&(m=c,h=r._f,p="thread"),s=(0,u.CE)(s,["tabId"]),"scheduled"===p&&!s.scheduledAt)return(0,I.i)(e,{contentToBeScheduled:s},i);const g=(0,v.Z1J)(e,m),f=d?void 0:(0,v.Yyv)(e,m,h),w=f?(0,v.hjO)(e,m,f):void 0,y=g.isForum?(0,v.qSq)(e,m,h):w?.replyToTopMessageId||w?.replyToMessageId,b=f?{replyingTo:f,replyingToTopId:y}:d?{userId:c,storyId:o}:void 0,P={...s,chat:g,currentThreadId:h,replyingTo:b,noWebPage:(0,v.tVX)(e,m,h),sendAs:(0,v._5C)(e,m)};t.setReplyingToId({messageId:void 0,tabId:i}),t.clearWebPagePreview({tabId:i});const Z=!s.attachments||s.attachments.length<=1,S=!Z&&s.shouldGroupMessages;if(Z){const{attachments:t,...s}=P;$(e,{...s,attachment:t?t[0]:void 0})}else if(S){const{text:t,entities:s,attachments:a,...i}=P,o=function(e){return e.reduce(((e,t,s,a)=>0===s?(e.push([t]),e):(W(t)===W(a[s-1])?e[e.length-1].push(t):e.push([t]),e)),[])}(a);o.forEach(((a,o)=>{const r=(0,u.Vl)(a,n.DUi);for(let a=0;a<r.length;a++){const[n,...c]=r[a],d=`${Date.now()}${o}${a}`,l=0===a&&0===o;$(e,{...i,text:l?t:void 0,entities:l?s:void 0,attachment:n,groupedId:c.length>0?d:void 0}),c.forEach((t=>{$(e,{...i,attachment:t,groupedId:d})}))}}))}else{const{text:t,entities:s,attachments:a,replyingTo:n,...i}=P;t&&$(e,{...i,text:t,entities:s,replyingTo:n}),a?.forEach((t=>{$(e,{...i,attachment:t})}))}})),(0,a.iw)("editMessage",((e,t,s)=>{const{messageList:a,text:n,entities:i,tabId:o=(0,l._w)()}=s;if(!a)return;const{chatId:r,threadId:c,type:d}=a,u=(0,v.Z1J)(e,r),m=(0,v.kKD)(e,r,c,d);u&&m&&((0,p.t9)("editMessage",{chat:u,message:m,text:n,entities:i,noWebPage:(0,v.tVX)(e,r,c)}),t.setEditingId({messageId:void 0,tabId:o}))})),(0,a.iw)("cancelSendingMessage",((e,t,s)=>{const{chatId:a,messageId:n}=s,i=(0,v.hjO)(e,a,n),o=i&&q.get((0,g.KK)(i));o&&(0,p.u3)(o),t.apiUpdate({"@type":"deleteMessages",ids:[n],chatId:a})})),(0,a.iw)("saveDraft",(async(e,t,s)=>{const{chatId:n,threadId:i,draft:o}=s;if(!o)return;const{text:r,entities:c}=o,d=(0,v.Z1J)(e,n),l=(0,v.dyD)(e,n);l&&(0,g.NB)(l)||(o.isLocal=!0,e=(0,f.pf)(e,n,i,"draft",o),e=(0,f.a4)(e,n,{draftDate:Math.round(Date.now()/1e3)}),(0,a.R3)(e),await(0,p.t9)("saveDraft",{chat:d,text:r,entities:c,replyToMsgId:(0,v.Yyv)(e,n,i),threadId:(0,v.qSq)(e,n,i)})&&(o.isLocal=!1),e=(0,a.Rd)(),e=(0,f.pf)(e,n,i,"draft",o),e=(0,f.a4)(e,n,{draftDate:Math.round(Date.now()/1e3)}),(0,a.R3)(e))})),(0,a.iw)("clearDraft",((e,t,s)=>{const{chatId:a,threadId:n=r._f,localOnly:i}=s;if(!(0,v.Mst)(e,a,n))return;const o=(0,v.Z1J)(e,a);return i||(0,p.t9)("clearDraft",o,(0,v.qSq)(e,a,n)),e=(0,f.pf)(e,a,n,"draft",void 0),(0,f.a4)(e,a,{draftDate:void 0})})),(0,a.iw)("toggleMessageWebPage",((e,t,s)=>{const{chatId:a,threadId:n,noWebPage:i}=s;return(0,f.pf)(e,a,n,"noWebPage",i)})),(0,a.iw)("pinMessage",((e,t,s)=>{const{messageId:a,isUnpin:n,isOneSide:i,isSilent:o,tabId:r=(0,l._w)()}=s,c=(0,v.jrE)(e,r);c&&(0,p.t9)("pinMessage",{chat:c,messageId:a,isUnpin:n,isOneSide:i,isSilent:o})})),(0,a.iw)("unpinAllMessages",(async(e,t,s)=>{const{chatId:n,threadId:i}=s,o=(0,v.Z1J)(e,n);if(!o)return;const c=(0,v.qSq)(e,n,i);await(0,p.t9)("unpinAllMessages",{chat:o,threadId:c}),e=(0,a.Rd)();const d=(0,v.KBA)(e,n,i);d?.forEach((t=>{e=(0,f.cY)(e,n,t,{isPinned:!1})})),e=(0,f.pf)(e,o.id,r._f,"pinnedIds",[]),(0,a.R3)(e)})),(0,a.iw)("deleteMessages",((e,t,s)=>{const{messageIds:a,shouldDeleteForAll:n,tabId:i=(0,l._w)()}=s,o=(0,v.Btg)(e,i);if(!o)return;const{chatId:r,threadId:c}=o,d=(0,v.Z1J)(e,r),u=a.filter((t=>{const s=(0,v.hjO)(e,r,t);return s&&!(0,g.CI)(s)}));if(!u.length&&a.length)return void D(e,(0,g.eA)(d)?r:void 0,a,t);(0,p.t9)("deleteMessages",{chat:d,messageIds:u,shouldDeleteForAll:n});const m=(0,v._$9)(e,r,c);m&&a.includes(m)&&t.setEditingId({messageId:void 0,tabId:i})})),(0,a.iw)("deleteScheduledMessages",((e,t,s)=>{const{messageIds:a,tabId:n=(0,l._w)()}=s,i=(0,v.Btg)(e,n);if(!i)return;const{chatId:o}=i,r=(0,v.Z1J)(e,o);(0,p.t9)("deleteScheduledMessages",{chat:r,messageIds:a});const c=(0,v.nBP)(e,o);c&&a.includes(c)&&t.setEditingId({messageId:void 0,tabId:n})})),(0,a.iw)("deleteHistory",(async(e,t,s)=>{const{chatId:n,shouldDeleteForAll:i,tabId:o=(0,l._w)()}=s,r=(0,v.Z1J)(e,n);if(!r)return;await(0,p.t9)("deleteHistory",{chat:r,shouldDeleteForAll:i}),e=(0,a.Rd)();const c=(0,v.Btg)(e,o);c&&c.chatId===n&&t.openChat({id:void 0,tabId:o});const d=e.chatFolders.byId;Object.values(d).forEach((e=>{if(e.includedChatIds.includes(n)||e.pinnedChatIds?.includes(n)){const t=e.includedChatIds.filter((e=>e!==n)),s=e.pinnedChatIds?.filter((e=>e!==n)),a={...e,includedChatIds:t,pinnedChatIds:s};(0,p.t9)("editChatFolder",{id:e.id,folderUpdate:a})}}))})),(0,a.iw)("reportMessages",(async(e,t,s)=>{const{messageIds:a,reason:n,description:i,tabId:o=(0,l._w)()}=s,r=(0,v.Btg)(e,o);if(!r)return;const{chatId:c}=r,d=(0,v.Z1J)(e,c),u=await(0,p.t9)("reportMessages",{peer:d,messageIds:a,reason:n,description:i});t.showNotification({message:u?(0,m.Iu)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later.",tabId:o})})),(0,a.iw)("sendMessageAction",(async(e,t,s)=>{const{action:a,chatId:n,threadId:i}=s;if("connectionStateReady"!==e.connectionState)return;if(n===e.currentUserId)return;const o=(0,v.Z1J)(e,n);if(!o)return;const r=(0,v.dyD)(e,n);r&&((0,g.cS)(r)||(0,g.NB)(r))||await(0,p.t9)("sendMessageAction",{peer:o,threadId:i,action:a})})),(0,a.iw)("markMessageListRead",((e,t,s)=>{const{maxId:a,tabId:i=(0,l._w)()}=s,o=(0,v.Btg)(e,i);if(!o)return;const{chatId:c,threadId:d}=o,u=(0,v.Z1J)(e,c);if(!u)return;G((()=>{(0,p.t9)("markMessageListRead",{chat:u,threadId:d,maxId:a})})),c===n.awM&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>e.isUnread&&e.id<=a?{...e,isUnread:!1}:e))});const m=(0,v.Cbz)(e,c,d,i),h=(0,v.It8)(e,c,d);if(!m||!h||!u.unreadCount)return e;const g=function(e,t,s){let a=0;for(let n=0,i=e.length;n<i&&(e[n]>=t&&e[n]<=s&&a++,!(e[n]>=s));n++);return a}(m,h,a);if(!g)return e;if(u.isForum&&u.topics?.[d]){const t=u.topics[d];e=(0,f.Xg)(e,c,d,{lastReadInboxMessageId:a});const s=Math.max(0,t.unreadCount-g);return 0===s&&(e=(0,f.a4)(e,c,{unreadCount:Math.max(0,u.unreadCount-1)})),(0,f.Cn)(e,c,d,{unreadCount:s})}return d===r._f?(0,f.a4)(e,c,{lastReadInboxMessageId:a,unreadCount:Math.max(0,u.unreadCount-g)}):void 0})),(0,a.iw)("markMessagesRead",((e,t,s)=>{const{messageIds:a,tabId:n=(0,l._w)()}=s,i=(0,v.jrE)(e,n);i&&(0,p.t9)("markMessagesRead",{chat:i,messageIds:a})})),(0,a.iw)("loadWebPagePreview",(async(e,t,s)=>{const{text:n,tabId:i=(0,l._w)()}=s,o=await(0,p.t9)("fetchWebPagePreview",{text:n});e=(0,a.Rd)(),e=(0,I.i)(e,{webPagePreview:o},i),(0,a.R3)(e)})),(0,a.iw)("clearWebPagePreview",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};if((0,v.jUK)(e,a).webPagePreview)return(0,I.i)(e,{webPagePreview:void 0},a)})),(0,a.iw)("sendPollVote",((e,t,s)=>{const{chatId:a,messageId:n,options:i}=s,o=(0,v.Z1J)(e,a);o&&(0,p.t9)("sendPollVote",{chat:o,messageId:n,options:i})})),(0,a.iw)("cancelPollVote",((e,t,s)=>{const{chatId:a,messageId:n}=s,i=(0,v.Z1J)(e,a);i&&(0,p.t9)("sendPollVote",{chat:i,messageId:n,options:[]})})),(0,a.iw)("closePoll",((e,t,s)=>{const{chatId:a,messageId:n}=s,i=(0,v.Z1J)(e,a),o=(0,v.hjO)(e,a,n)?.content.poll;i&&o&&(0,p.t9)("closePoll",{chat:i,messageId:n,poll:o})})),(0,a.iw)("loadPollOptionResults",(async(e,t,s)=>{const{chat:n,messageId:i,option:o,offset:r,limit:c,shouldResetVoters:d,tabId:m=(0,l._w)()}=s,h=await(0,p.t9)("loadPollOptionResults",{chat:n,messageId:i,option:o,offset:r,limit:c});if(!h)return;e=(0,a.Rd)(),e=(0,f.Sh)(e,(0,u.ee)(h.users,"id")),e=(0,f.fZ)(e,(0,u.ee)(h.chats,"id"));const g=(0,v.jUK)(e,m),{pollResults:w}=g,{voters:y}=g.pollResults;e=(0,I.i)(e,{pollResults:{...w,voters:{...y,[o]:(0,u.Tw)([...!d&&y?.[o]?y[o]:[],...h.votes.map((e=>e.peerId))])},offsets:{...w.offsets?w.offsets:{},[o]:h.nextOffset||""}}},m),(0,a.R3)(e)})),(0,a.iw)("loadExtendedMedia",((e,t,s)=>{const{chatId:a,ids:n}=s,i=(0,v.Z1J)(e,a);i&&(0,p.t9)("fetchExtendedMedia",{chat:i,ids:n})})),(0,a.iw)("forwardMessages",((e,t,s)=>{const{isSilent:n,scheduledAt:i,tabId:o=(0,l._w)()}=s,{fromChatId:c,messageIds:d,toChatId:u,withMyScore:m,noAuthors:f,noCaptions:w,toThreadId:y}=(0,v.jUK)(e,o).forwardMessages,b=(0,v.wVz)(e),P=c?(0,v.Z1J)(e,c):void 0,Z=u?(0,v.Z1J)(e,u):void 0,S=c&&d?d.sort(((e,t)=>e-t)).map((t=>(0,v.hjO)(e,c,t))).filter(Boolean):void 0;if(!P||!Z||!S||y&&!Z.isForum)return;const C=(0,v._5C)(e,u),M=S.filter((e=>!(0,g.jM)(e)));M.length&&(async()=>{await(0,h.Pn)(),(0,p.t9)("forwardMessages",{fromChat:P,toChat:Z,toThreadId:y,messages:M,isSilent:n,scheduledAt:i,sendAs:C,withMyScore:m,noAuthors:f,noCaptions:w,isCurrentUserPremium:b})})(),S.filter((e=>(0,g.jM)(e))).forEach((t=>{const{text:s,entities:a}=t.content.text||{},{sticker:o,poll:c}=t.content;$(e,{chat:Z,replyingTo:y?{replyingTo:y,replyingToTopId:y}:void 0,currentThreadId:y||r._f,text:s,entities:a,sticker:o,poll:c,isSilent:n,scheduledAt:i,sendAs:C})})),e=(0,a.Rd)(),e=(0,I.i)(e,{forwardMessages:{}},o),(0,a.R3)(e)})),(0,a.iw)("loadScheduledHistory",(async(e,t,s)=>{const{chatId:n}=s,i=(0,v.Z1J)(e,n);if(!i)return;const o=await(0,p.t9)("fetchScheduledHistory",{chat:i});if(!o)return;const{messages:c}=o,d=(0,u.ee)(c,"id"),l=Object.keys(d).map(Number).sort(((e,t)=>t-e));if(e=(0,a.Rd)(),e=(0,f.w3)(e,i.id,d),e=(0,f.pf)(e,i.id,r._f,"scheduledIds",l),i?.isForum){const t={};c.forEach((s=>{const a=(0,v.nrh)(e,s),n=t[a]||[];n.push(s.id),t[a]=n})),Object.entries(t).forEach((t=>{let[s,a]=t;e=(0,f.pf)(e,i.id,Number(s),"scheduledIds",a)}))}(0,a.R3)(e)})),(0,a.iw)("sendScheduledMessages",((e,t,s)=>{const{chatId:a,id:n}=s,i=(0,v.Z1J)(e,a);i&&(0,p.t9)("sendScheduledMessages",{chat:i,ids:[n]})})),(0,a.iw)("rescheduleMessage",((e,t,s)=>{const{chatId:a,messageId:n,scheduledAt:i}=s,o=(0,v.Z1J)(e,a),r=o&&(0,v.TmO)(e,o.id,n);o&&r&&(0,p.t9)("rescheduleMessage",{chat:o,message:r,scheduledAt:i})})),(0,a.iw)("requestThreadInfoUpdate",(async(e,t,s)=>{const{chatId:n,threadId:i}=s,o=(0,v.Z1J)(e,n);if(!o)return;const r=(0,v.CmE)(e,n,i)?.id,c=await(0,p.t9)("requestThreadInfoUpdate",{chat:o,threadId:i,originChannelId:r});c&&(e=(0,a.Rd)(),e=(0,f.Sh)(e,(0,u.ee)(c.users,"id")),(0,a.R3)(e))})),(0,a.iw)("transcribeAudio",(async(e,t,s)=>{const{messageId:n,chatId:i}=s,o=(0,v.Z1J)(e,i);if(!o)return;e=(0,f.cY)(e,i,n,{transcriptionId:""}),(0,a.R3)(e);const r=await(0,p.t9)("transcribeAudio",{chat:o,messageId:n});e=(0,a.Rd)(),e=(0,f.cY)(e,i,n,{transcriptionId:r,isTranscriptionError:!r}),(0,a.R3)(e)})),(0,a.iw)("loadCustomEmojis",(async(e,t,s)=>{const{ids:n,ignoreCache:i}=s,o=i?n:(0,u.Tw)(n.filter((t=>!e.customEmojis.byId[t]))),r=await(0,p.t9)("fetchCustomEmoji",{documentId:o});r&&(e=(0,a.Rd)(),e={...e,customEmojis:{...e.customEmojis,byId:{...e.customEmojis.byId,...(0,u.ee)(r,"id")}}},(0,a.R3)(e))})),(0,a.iw)("loadPinnedMessages",(async(e,t,s)=>{const{chatId:n,threadId:i}=s,o=(0,v.Z1J)(e,n);if(!o)return;const r=await(0,p.t9)("fetchPinnedMessages",{chat:o,threadId:i});if(!r)return;const{messages:c,chats:d,users:l}=r,m=(0,u.ee)(c,"id"),h=Object.keys(m).map(Number).sort(((e,t)=>t-e));e=(0,a.Rd)(),e=(0,f.c_)(e,o.id,m),e=(0,f.HX)(e,o.id,i,h),e=(0,f.Sh)(e,(0,u.ee)(l,"id")),e=(0,f.fZ)(e,(0,u.ee)(d,"id")),(0,a.R3)(e)})),(0,a.iw)("loadSeenBy",(async(e,t,s)=>{const{chatId:n,messageId:i}=s,o=(0,v.Z1J)(e,n);if(!o)return;const r=await(0,p.t9)("fetchSeenBy",{chat:o,messageId:i});r&&(e=(0,a.Rd)(),e=(0,f.cY)(e,n,i,{seenByDates:r}),(0,a.R3)(e))})),(0,a.iw)("saveDefaultSendAs",((e,t,s)=>{const{chatId:a,sendAsId:n}=s,i=(0,v.Z1J)(e,a),o=(0,v.Z1J)(e,n)||(0,v.dyD)(e,n);if(i&&o)return(0,p.t9)("saveDefaultSendAs",{sendAs:o,chat:i}),(0,f.US)(e,a,{sendAsId:n})})),(0,a.iw)("loadSendAs",(async(e,t,s)=>{const{chatId:n}=s,i=(0,v.Z1J)(e,n);if(!i)return;const o=await(0,p.t9)("fetchSendAs",{chat:i});if(!o)return e=(0,a.Rd)(),e=(0,f.a4)(e,n,{sendAsPeerIds:[]}),void(0,a.R3)(e);e=(0,a.Rd)(),e=(0,f.Sh)(e,(0,u.ee)(o.users,"id")),e=(0,f.fZ)(e,(0,u.ee)(o.chats,"id")),e=(0,f.a4)(e,n,{sendAsPeerIds:o.sendAs}),(0,a.R3)(e)})),(0,a.iw)("loadSponsoredMessages",(async(e,t,s)=>{const{chatId:n}=s,i=(0,v.Z1J)(e,n);if(!i)return;const o=await(0,p.t9)("fetchSponsoredMessages",{chat:i});o&&(e=(0,a.Rd)(),e=(0,f.Fn)(e,n,o.messages[0]),e=(0,f.Sh)(e,(0,u.ee)(o.users,"id")),e=(0,f.fZ)(e,(0,u.ee)(o.chats,"id")),(0,a.R3)(e))})),(0,a.iw)("viewSponsoredMessage",((e,t,s)=>{const{chatId:a}=s,n=(0,v.Z1J)(e,a),i=(0,v.fSe)(e,a);n&&i&&(0,p.t9)("viewSponsoredMessage",{chat:n,random:i.randomId})})),(0,a.iw)("fetchUnreadMentions",(async(e,t,s)=>{const{chatId:n,offsetId:i}=s,o=(0,v.Z1J)(e,n);if(!o)return;const r=await(0,p.t9)("fetchUnreadMentions",{chat:o,offsetId:i});if(!r)return;const{messages:c,chats:d,users:l}=r,m=(0,u.ee)(c,"id"),h=Object.keys(m).map(Number);e=(0,a.Rd)(),e=(0,f.c_)(e,o.id,m),e=(0,f.Sh)(e,(0,u.ee)(l,"id")),e=(0,f.fZ)(e,(0,u.ee)(d,"id")),e=(0,f.a4)(e,n,{unreadMentions:[...o.unreadMentions||[],...h]}),(0,a.R3)(e)})),(0,a.iw)("markMentionsRead",((e,t,s)=>{const{messageIds:n,tabId:i=(0,l._w)()}=s,o=(0,v.jrE)(e,i);if(!o)return;const r=(o.unreadMentions||[]).filter((e=>!n.includes(e)));e=(0,f.a4)(e,o.id,{unreadMentions:r}),(0,a.R3)(e),t.markMessagesRead({messageIds:n,tabId:i})})),(0,a.iw)("focusNextMention",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},n=(0,v.jrE)(e,a);n?.unreadMentions&&t.focusMessage({chatId:n.id,messageId:n.unreadMentions[0],tabId:a})})),(0,a.iw)("readAllMentions",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},n=(0,v.jrE)(e,a);if(n)return(0,p.t9)("readAllMentions",{chat:n}),(0,f.a4)(e,n.id,{unreadMentionsCount:void 0,unreadMentions:void 0})})),(0,a.iw)("openUrl",((e,t,s)=>{const{url:a,shouldSkipModal:i,tabId:o=(0,l._w)()}=s,r=(0,d.X)(a),c=Boolean((0,v.jUK)(e,o).storyViewer.peerId);if(r.match(n.FSu)||r.match(n.g$l))return c&&t.closeStoryViewer({tabId:o}),void t.openTelegramLink({url:a,tabId:o});const{appConfig:u,config:m}=e;if(u){const e=new URL(r);if(m?.autologinToken&&u.autologinDomains.includes(e.hostname))return e.searchParams.set("autologin_token",m.autologinToken),void window.open(e.href,"_blank","noopener");if(u.urlAuthDomains.includes(e.hostname))return c&&t.closeStoryViewer({tabId:o}),void t.requestLinkUrlAuth({url:a,tabId:o})}r.match(n.jL5)||i?window.open(r,"_blank","noopener"):t.toggleSafeLinkModal({url:r,tabId:o})})),(0,a.iw)("setForwardChatOrTopic",(async(e,t,s)=>{const{chatId:n,topicId:i,tabId:o=(0,l._w)()}=s;let r=(0,v.dyD)(e,n);if(r&&(0,v.Nm0)(e,o)){let s=(0,v.ccz)(e,n);if(!s){const{accessHash:t}=r,i=await(0,p.t9)("fetchFullUser",{id:n,accessHash:t});e=(0,a.Rd)(),r=i?.user,s=i?.fullInfo}if(s.noVoiceMessages)return void t.showDialog({data:{message:(0,m.Iu)("VoiceMessagesRestrictedByPrivacy",(0,g.Js)(r))},tabId:o})}(0,v.GQU)(e,n,o)?(e=(0,I.i)(e,{forwardMessages:{...(0,v.jUK)(e,o).forwardMessages,toChatId:n,toThreadId:i,isModalShown:!1}},o),(0,a.R3)(e),t.openChat({id:n,threadId:i,tabId:o}),t.closeMediaViewer({tabId:o}),t.exitMessageSelectMode({tabId:o})):t.showAllowedMessageTypesNotification({chatId:n,tabId:o})})),(0,a.iw)("forwardToSavedMessages",((e,t,s)=>{const{tabId:n=(0,l._w)()}=s||{};e=(0,I.i)(e,{forwardMessages:{...(0,v.jUK)(e,n).forwardMessages,toChatId:e.currentUserId}},n),(0,a.R3)(e),t.exitMessageSelectMode({tabId:n}),t.forwardMessages({isSilent:!0,tabId:n})})),(0,a.iw)("forwardStory",((e,t,s)=>{const{toChatId:n,tabId:i=(0,l._w)()}=s||{},{fromChatId:o,storyId:c}=(0,v.jUK)(e,i).forwardMessages,d=o?(0,v.Z1J)(e,o):void 0,u=n?(0,v.Z1J)(e,n):void 0,m=o&&c?(0,v.JrV)(e,o,c):void 0;if(!d||!u||!m||"isDeleted"in m)return;const{text:h,entities:p}=m.content.text||{};$(e,{chat:u,currentThreadId:r._f,text:h,entities:p,story:m}),e=(0,a.Rd)(),e=(0,I.i)(e,{forwardMessages:{}},i),(0,a.R3)(e)})),(0,a.iw)("requestMessageTranslation",((e,t,s)=>{const{chatId:a,id:n,toLanguageCode:i=(0,v.Mc4)(e),tabId:o=(0,l._w)()}=s;return e=(0,f.ql)(e,a,n,i,o),(0,f.BI)(e,{translationLanguage:i})})),(0,a.iw)("showOriginalMessage",((e,t,s)=>{const{chatId:a,id:n,tabId:i=(0,l._w)()}=s;return(0,f.IR)(e,a,n,i)})),(0,a.iw)("markMessagesTranslationPending",((e,t,s)=>{const{chatId:a,messageIds:n,toLanguageCode:i=(0,v.rB0)(e)}=s;return n.forEach((t=>{e=(0,f.qt)(e,a,t,i,{isPending:!0})})),e})),(0,a.iw)("translateMessages",((e,t,s)=>{const{chatId:a,messageIds:n,toLanguageCode:i=(0,v.rB0)(e)}=s,o=(0,v.Z1J)(e,a);if(o)return t.markMessagesTranslationPending({chatId:a,messageIds:n,toLanguageCode:i}),(0,p.t9)("translateText",{chat:o,messageIds:n,toLanguageCode:i}),e}));let J,K={};function z(){J&&(clearTimeout(J),J=void 0);const{loadMessageViews:e}=(0,a.Sv)();Object.entries(K).forEach((t=>{let[s,a]=t;e({chatId:s,ids:Array.from(a),shouldIncrement:!0})})),K={}}function W(e){const{shouldSendAsFile:t,mimeType:s}=e;return t?"file":s===n.s11?"gif":n.oGt.has(s)||n.wGh.has(s)?"media":n.e74.has(s)?"audio":e.voice?"voice":"file"}(0,a.iw)("scheduleForViewsIncrement",((e,t,s)=>{const{ids:a,chatId:n}=s;J||setTimeout(z,1e3),K[n]||(K[n]=new Set),a.forEach((e=>{K[n].add(e)}))})),(0,a.iw)("loadMessageViews",(async(e,t,s)=>{const{chatId:n,ids:i,shouldIncrement:o}=s,r=(0,v.Z1J)(e,n);if(!r)return;const c=await(0,p.t9)("fetchMessageViews",{chat:r,ids:i,shouldIncrement:o});c&&(e=(0,a.Rd)(),c.forEach((t=>{e=(0,f.cY)(e,n,t.id,{views:t.views,forwards:t.forwards});const s=(0,v.hjO)(e,n,t.id);if(!s)return;const a=s.repliesThreadInfo?.chatId,i=s.repliesThreadInfo?.threadId;a&&i&&(e=(0,f.Xg)(e,a,i,{messagesCount:t.messagesCount,recentReplierIds:t.recentReplierIds,lastMessageId:t.maxId,lastReadInboxMessageId:t.readMaxId}))})),(0,a.R3)(e))}));var Y=s(85765),X=s(9211);const Q=(0,h.P2)((e=>e()),500,!1);async function ee(e,t){const s=await(0,p.t9)("fetchRecentStickers",{hash:t});s&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,recent:s}},(0,a.R3)(e))}async function te(e,t,s){for(var n=arguments.length,i=new Array(n>3?n-3:0),o=3;o<n;o++)i[o-3]=arguments[o];let r,[c=(0,l._w)()]=i;try{r=await(0,p.t9)("fetchStickers",{stickerSetInfo:s})}catch(n){if("STICKERSET_INVALID"===n.message)return t.showNotification({message:(0,m.Iu)("StickerPack.ErrorNotFound"),tabId:c}),void("shortName"in s&&(0,v.jUK)(e,c).openedStickerSetShortName===s.shortName&&(e=(0,I.i)(e,{openedStickerSetShortName:void 0},c),(0,a.R3)(e)))}if(e=(0,a.Rd)(),!r)return;const{set:d,stickers:u,packs:h}=r,g=(e=(0,f.Rg)(e,d.id,{...d,stickers:u,packs:h})).stickers.forEmoji.emoji;g&&h[g]&&(e=(0,f.vy)(e)),(0,a.R3)(e)}async function se(e,t,s,n){for(var i=arguments.length,o=new Array(i>4?i-4:0),r=4;r<i;r++)o[r-4]=arguments[r];let[c=(0,l._w)()]=o;const d=await(0,p.t9)("searchGifs",{query:t,offset:n,username:s});d&&(e=(0,a.Rd)(),e=(0,f.rq)(e,!n,d.gifs,d.nextOffset,c),(0,a.R3)(e))}(0,a.iw)("loadStickerSets",(async(e,t)=>{const[s,n]=await Promise.all([(0,p.t9)("fetchStickerSets",{hash:e.stickers.added.hash}),(0,p.t9)("fetchCustomEmojiSets",{hash:e.customEmojis.added.hash})]);n&&s&&(e=(0,a.Rd)(),e=(0,f.z3)(e,"added",s.hash,s.sets),e=(0,f.cU)(e,n.hash,n.sets),(0,a.R3)(e),t.loadCustomEmojis({ids:e.recentCustomEmojis}))})),(0,a.iw)("loadAddedStickers",(async(e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},{added:{setIds:n=[]},setsById:i}=e.stickers,{added:{setIds:o=[]}}=e.customEmojis,r=[...n,...o];if(r.length)for(let e=0;e<r.length;e++){const s=r[e];i[s]?.stickers||(t.loadStickers({stickerSetInfo:{id:s,accessHash:i[s].accessHash},tabId:a}),e%10==0&&e>0&&await(0,h.wO)(200))}})),(0,a.iw)("loadRecentStickers",(e=>{const{hash:t}=e.stickers.recent||{};ee(e,t)})),(0,a.iw)("loadFavoriteStickers",(async e=>{const{hash:t}=e.stickers.favorite||{},s=await(0,p.t9)("fetchFavoriteStickers",{hash:t});s&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,favorite:s}},(0,a.R3)(e))})),(0,a.iw)("loadPremiumStickers",(async e=>{const{hash:t}=e.stickers.premium||{},s=await(0,p.t9)("fetchStickersForEmoji",{emoji:"⭐️⭐️",hash:t});s&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,premium:{hash:s.hash,stickers:s.stickers}}},(0,a.R3)(e))})),(0,a.iw)("loadPremiumSetStickers",(async e=>{const{hash:t}=e.stickers.premium||{},s=await(0,p.t9)("fetchStickersForEmoji",{emoji:"📂⭐️",hash:t});s&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,premiumSet:{hash:s.hash,stickers:s.stickers}}},(0,a.R3)(e))})),(0,a.iw)("loadGreetingStickers",(async e=>{const{hash:t}=e.stickers.greeting||{},s=await(0,p.t9)("fetchStickersForEmoji",{emoji:"👋⭐️",hash:t});s&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,greeting:{hash:s.hash,stickers:s.stickers.filter((e=>"👋"===e.emoji))}}},(0,a.R3)(e))})),(0,a.iw)("loadFeaturedStickers",(async e=>{const{hash:t}=e.stickers.featured||{},s=await(0,p.t9)("fetchFeaturedStickers",{hash:t});s&&(e=(0,a.Rd)(),e=(0,f.z3)(e,"featured",s.hash,s.sets),(0,a.R3)(e))})),(0,a.iw)("loadPremiumGifts",(async e=>{const t=await(0,p.t9)("fetchPremiumGifts");if(!t)return;const{set:s,stickers:n}=t;e=(0,a.Rd)(),e={...e,premiumGifts:{...s,stickers:n}},(0,a.R3)(e)})),(0,a.iw)("loadDefaultTopicIcons",(async e=>{const t=await(0,p.t9)("fetchDefaultTopicIcons");if(!t)return;e=(0,a.Rd)();const{set:s,stickers:n}=t,i={...s,stickers:n};e=(0,f.Rg)(e,i.id,i),e={...e,defaultTopicIconsId:i.id},(0,a.R3)(e)})),(0,a.iw)("loadDefaultStatusIcons",(async e=>{const t=await(0,p.t9)("fetchDefaultStatusEmojis");if(!t)return;e=(0,a.Rd)();const{set:s,stickers:n}=t,i={...s,stickers:n};e=(0,f.Rg)(e,i.id,i),e={...e,defaultStatusIconsId:i.id},(0,a.R3)(e)})),(0,a.iw)("loadStickers",((e,t,s)=>{const{stickerSetInfo:a,tabId:n=(0,l._w)()}=s,i=(0,v.Ny0)(e,a);i&&i.count===i?.stickers?.length||te(e,t,a,n)})),(0,a.iw)("loadAnimatedEmojis",(async e=>{const[t,s]=await Promise.all([(0,p.t9)("fetchAnimatedEmojis"),(0,p.t9)("fetchAnimatedEmojiEffects")]);t&&s&&(e=(0,a.Rd)(),e=(0,f.g_)(e,{...t.set,stickers:t.stickers}),e={...e,animatedEmojiEffects:{...s.set,stickers:s.stickers}},(0,a.R3)(e))})),(0,a.iw)("loadGenericEmojiEffects",(async e=>{const t=await(0,p.t9)("fetchGenericEmojiEffects");if(!t)return;e=(0,a.Rd)();const{set:s,stickers:n}=t;e={...e,genericEmojiEffects:{...s,stickers:n}},(0,a.R3)(e)})),(0,a.iw)("loadSavedGifs",(async e=>{const{hash:t}=e.gifs.saved,s=await(0,p.t9)("fetchSavedGifs",{hash:t});s&&(e=(0,a.Rd)(),e={...e,gifs:{...e.gifs,saved:s}},(0,a.R3)(e))})),(0,a.iw)("saveGif",(async(e,t,s)=>{const{gif:n,shouldUnsave:i,tabId:o=(0,l._w)()}=s,r=e.gifs.saved.gifs?.length,c=(0,X.M)(e,"savedGifs"),d=(0,X.P)(e,"savedGifs"),u=(0,v.wVz)(e);if(!i&&r&&r>=c&&t.showNotification({title:m.Iu("LimitReachedFavoriteGifs",c.toString()),message:u?m.Iu("LimitReachedFavoriteGifsSubtitlePremium"):m.Iu("LimitReachedFavoriteGifsSubtitle",d.toString()),...!u&&{action:{action:"openPremiumModal",payload:{tabId:o}}},className:"bold-link",tabId:o}),!await(0,p.t9)("saveGif",{gif:n,shouldUnsave:i}))return;e=(0,a.Rd)();const h=e.gifs.saved.gifs?.filter((e=>{let{id:t}=e;return t!==n.id}))||[],g=i?h:[n,...h];e={...e,gifs:{...e.gifs,saved:{...e.gifs.saved,gifs:g}}},(0,a.R3)(e)})),(0,a.iw)("faveSticker",((e,t,s)=>{const{sticker:a,tabId:n=(0,l._w)()}=s,i=e.stickers.favorite.stickers.length,o=(0,X.M)(e,"stickersFaved"),r=(0,X.P)(e,"stickersFaved"),c=(0,v.wVz)(e);i>=o&&t.showNotification({title:m.Iu("LimitReachedFavoriteStickers",o.toString()),message:c?m.Iu("LimitReachedFavoriteStickersSubtitlePremium"):m.Iu("LimitReachedFavoriteStickersSubtitle",r.toString()),...!c&&{action:{action:"openPremiumModal",payload:{tabId:n}}},className:"bold-link",tabId:n}),a&&(0,p.t9)("faveSticker",{sticker:a})})),(0,a.iw)("unfaveSticker",((e,t,s)=>{const{sticker:n}=s;n&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,favorite:{...e.stickers.favorite,stickers:e.stickers.favorite.stickers.filter((e=>{let{id:t}=e;return t!==n.id}))}}},(0,a.R3)(e),(0,p.t9)("faveSticker",{sticker:n,unfave:!0}))})),(0,a.iw)("removeRecentSticker",(async(e,t,s)=>{const{sticker:n}=s;await(0,p.t9)("removeRecentSticker",{sticker:n})&&ee((0,a.Rd)())})),(0,a.iw)("clearRecentStickers",(async e=>{await(0,p.t9)("clearRecentStickers")&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,recent:{stickers:[]}}},(0,a.R3)(e))})),(0,a.iw)("toggleStickerSet",((e,t,s)=>{const{stickerSetId:a}=s,n=(0,v.Ny0)(e,a);if(!n)return;const{accessHash:i,installedDate:o,isArchived:r}=n,c=!r&&Boolean(o);(0,p.t9)(c?"uninstallStickerSet":"installStickerSet",{stickerSetId:a,accessHash:i})})),(0,a.iw)("loadEmojiKeywords",(async(e,t,s)=>{const{language:n}=s;let i=e.emojiKeywords[n];if(i?.isLoading)return;e={...e,emojiKeywords:{...e.emojiKeywords,[n]:{...i,isLoading:!0}}},(0,a.R3)(e);const o=await(0,p.t9)("fetchEmojiKeywords",{language:n,fromVersion:i?i.version:0});if(i=(e=(0,a.Rd)()).emojiKeywords[n],!o)return e={...e,emojiKeywords:{...e.emojiKeywords,[n]:{...i,isLoading:!1}}},void(0,a.R3)(e);e={...e,emojiKeywords:{...e.emojiKeywords,[n]:{isLoading:!1,version:o.version,keywords:{...i?.keywords,...o.keywords}}}},(0,a.R3)(e)})),(0,a.iw)("setStickerSearchQuery",((e,t,s)=>{const{query:n,tabId:i=(0,l._w)()}=s;n&&Q((async()=>{const t=await(0,p.t9)("searchStickers",{query:n});if(!t)return;e=(0,a.Rd)();const{setsById:s,added:o}=e.stickers,r=t.sets.map((e=>{let{id:t}=e;return t}));o.setIds&&o.setIds.forEach((e=>{if(!r.includes(e)){const{title:t}=s[e]||{};t&&(0,Y.Z)(t,n)&&r.unshift(e)}})),e=(0,f.z3)(e,"search",t.hash,t.sets),e=(0,f.fH)(e,t.hash,r,i),(0,a.R3)(e)}))})),(0,a.iw)("setGifSearchQuery",((e,t,s)=>{const{query:n,tabId:i=(0,l._w)()}=s;"string"==typeof n&&Q((()=>{se(e=(0,a.Rd)(),n,e.config?.gifSearchUsername,void 0,i)}))})),(0,a.iw)("searchMoreGifs",((e,t,s)=>{const{tabId:n=(0,l._w)()}=s||{},{query:i,offset:o}=(0,v.jUK)(e,n).gifSearch;"string"==typeof i&&Q((()=>{se(e=(0,a.Rd)(),i,e.config?.gifSearchUsername,o,n)}))})),(0,a.iw)("loadStickersForEmoji",((e,t,s)=>{const{emoji:n}=s,{hash:i}=e.stickers.forEmoji;Q((async()=>{e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,forEmoji:{...e.stickers.forEmoji,emoji:n}}},(0,a.R3)(e);const t=await(0,p.t9)("fetchStickersForEmoji",{emoji:n,hash:i});e=(0,a.Rd)(),t&&e.stickers.forEmoji.emoji===n&&(e=(0,f.IM)(e,n,t.stickers,t.hash),(0,a.R3)(e))}))})),(0,a.iw)("clearStickersForEmoji",(e=>({...e,stickers:{...e.stickers,forEmoji:{}}}))),(0,a.iw)("loadCustomEmojiForEmoji",((e,t,s)=>{const{emoji:a}=s;return(0,f.AA)(e,a)})),(0,a.iw)("clearCustomEmojiForEmoji",(e=>({...e,customEmojis:{...e.customEmojis,forEmoji:{}}}))),(0,a.iw)("loadFeaturedEmojiStickers",(async e=>{const t=await(0,p.t9)("fetchFeaturedEmojiStickers");t&&(e=(0,a.Rd)(),e={...e,customEmojis:{...e.customEmojis,featuredIds:t.sets.map((e=>{let{id:t}=e;return t})),byId:{...e.customEmojis.byId,...(0,u.ee)(t.sets.flatMap((e=>e.stickers||[])),"id")}},stickers:{...e.stickers,setsById:{...e.stickers.setsById,...(0,u.ee)(t.sets,"id")}}},(0,a.R3)(e))})),(0,a.iw)("openStickerSet",(async(e,t,s)=>{const{stickerSetInfo:n,tabId:i=(0,l._w)()}=s;(0,v.Ny0)(e,n)||await te(e,t,n,i),e=(0,a.Rd)();const o=(0,v.Ny0)(e,n);o?.shortName&&(e=(0,I.i)(e,{openedStickerSetShortName:o.shortName},i),(0,a.R3)(e))})),(0,a.iw)("loadRecentEmojiStatuses",(async e=>{const t=await(0,p.t9)("fetchRecentEmojiStatuses");t&&(e=(0,a.Rd)(),e=(0,f.et)(e,t.hash,t.emojiStatuses),(0,a.R3)(e))}));var ae=s(790);const ne=(0,h.P2)((e=>e()),500,!1);async function ie(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",s=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,c=arguments.length>6?arguments[6]:void 0;for(var d=arguments.length,m=new Array(d>7?d-7:0),h=7;h<d;h++)m[h-7]=arguments[h];let g,[I=(0,l._w)()]=m;if(o){const e=(0,p.t9)("searchMessagesLocal",{chat:o,query:t,type:s,limit:n.Hkl,offsetId:i,minDate:c,maxDate:r}),a=o.isForum?(0,p.t9)("fetchTopics",{chat:o,query:t,limit:n.XM3}):void 0,[d,l]=await Promise.all([e,a]);if(d){const{messages:e,users:t,totalCount:s,nextOffsetId:a}=d,{topics:n,count:i}=l||{};g={topics:n,totalTopicsCount:i,messages:e,users:t,chats:[],totalCount:s,nextRate:a}}}else g=await(0,p.t9)("searchMessagesGlobal",{query:t,offsetRate:i,limit:n.Hkl,type:s,maxDate:r,minDate:c});e=(0,a.Rd)();const w=(0,v.JXM)(e,I);if(!g||""!==t&&t!==w)return e=(0,f.xv)(e,{messages:!1},I),void(0,a.R3)(e);const{messages:y,users:b,chats:P,totalCount:Z,nextRate:S}=g;P.length&&(e=(0,f.fZ)(e,(0,u.ee)(P,"id"))),b.length&&(e=(0,f.Sh)(e,(0,u.ee)(b,"id"))),y.length&&(e=(0,f.m6)(e,y)),e=(0,f.px)(e,y,Z,s,S,I),g.topics&&(e=(0,f.XG)(e,o.id,g.totalTopicsCount,g.topics));const C=g.topics?.map((e=>{let{id:t}=e;return t})).sort(((e,t)=>t-e));e=(0,f.No)(e,{foundTopicIds:C},I),(0,a.R3)(e)}async function oe(e,t,s,i,o){let c=arguments.length>5&&void 0!==arguments[5]&&arguments[5];for(var d=arguments.length,m=new Array(d>6?d-6:0),h=6;h<d;h++)m[h-6]=arguments[h];let[g=(0,l._w)()]=m;const I=await(0,p.t9)("searchMessagesLocal",{chat:t,type:i,limit:2*n.ENB,topMessageId:s===r._f?void 0:s,offsetId:o});if(!I)return;const{chats:w,users:y,messages:b,totalCount:P,nextOffsetId:Z}=I,S=(0,u.ee)(b,"id"),C=Object.keys(S).map(Number);e=(0,a.Rd)(),(0,v.weG)(e,g)&&(e=(0,f.fZ)(e,(0,u.ee)(w,"id")),e=(0,f.Sh)(e,(0,u.ee)(y,"id")),e=(0,f.c_)(e,t.id,S),e=(0,f.c1)(e,t.id,s,i,C,P,Z,g),(0,a.R3)(e),c||oe(e,t,s,i,Z,!0,g))}(0,a.iw)("setGlobalSearchQuery",((e,t,s)=>{const{query:n,tabId:i=(0,l._w)()}=s,{chatId:o}=(0,v.jUK)(e,i).globalSearch;n&&!o&&ne((async()=>{const t=await(0,p.t9)("searchChats",{query:n});e=(0,a.Rd)();const s=(0,v.JXM)(e,i);if(!t||!s||n!==s)return e=(0,f.xv)(e,{chats:!1},i),void(0,a.R3)(e);const{localChats:o,localUsers:r,globalChats:c,globalUsers:d}=t;(o.length||c.length)&&(e=(0,f.fZ)(e,(0,u.ee)([...o,...c],"id"))),(r.length||d.length)&&(e=(0,f.Sh)(e,(0,u.ee)([...r,...d],"id"))),e=(0,f.xv)(e,{chats:!1},i),e=(0,f.No)(e,{localResults:{chatIds:o.map((e=>{let{id:t}=e;return t})),userIds:r.map((e=>{let{id:t}=e;return t}))},globalResults:{...(0,v.jUK)(e,i).globalSearch.globalResults,chatIds:c.map((e=>{let{id:t}=e;return t})),userIds:d.map((e=>{let{id:t}=e;return t}))}},i),(0,a.R3)(e)}))})),(0,a.iw)("setGlobalSearchDate",((e,t,s)=>{const{date:n,tabId:i=(0,l._w)()}=s,o=n?(0,ae.IS)(n):n;e=(0,f.No)(e,{date:n,query:"",resultsByType:{...(0,v.jUK)(e,i).globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}},i),(0,a.R3)(e);const{chatId:r}=(0,v.jUK)(e,i).globalSearch;ie(e,"","text",void 0,r?(0,v.Z1J)(e,r):void 0,o,n,i)})),(0,a.iw)("searchMessagesGlobal",((e,t,s)=>{const{type:a,tabId:n=(0,l._w)()}=s,{query:i,resultsByType:o,chatId:r,date:c}=(0,v.jUK)(e,n).globalSearch,d=c?(0,ae.IS)(c):c,u=o?.[a]?.nextOffsetId;ie(e,i,a,u,r?(0,v.Z1J)(e,r):void 0,d,c,n)})),(0,a.iw)("searchTextMessagesLocal",(async(e,t,s)=>{const{tabId:i=(0,l._w)()}=s||{},{chatId:o,threadId:c}=(0,v.Btg)(e,i)||{},d=o?(0,v.Z1J)(e,o):void 0;let m=(0,v.n5x)(e,i);if(!d||!m||!c)return;const{query:h,results:g}=m,I=g?.nextOffsetId;let w;if(c!==r._f){const t=(0,v.tZg)(e,o,c);w=t?.topMessageId}if(!h)return;const y=await(0,p.t9)("searchMessagesLocal",{chat:d,type:"text",query:h,topMessageId:w,limit:n.pnA,offsetId:I});if(!y)return;const{chats:b,users:P,messages:Z,totalCount:S,nextOffsetId:C}=y,M=(0,u.ee)(Z,"id"),E=Object.keys(M).map(Number);e=(0,a.Rd)(),m=(0,v.n5x)(e,i),m&&h===m.query&&(e=(0,f.fZ)(e,(0,u.ee)(b,"id")),e=(0,f.Sh)(e,(0,u.ee)(P,"id")),e=(0,f.c_)(e,d.id,M),e=(0,f.dx)(e,d.id,c,E,S,C,i),(0,a.R3)(e))})),(0,a.iw)("searchMediaMessagesLocal",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},{chatId:n,threadId:i}=(0,v.Btg)(e,a)||{};if(!n||!i)return;const o=(0,v.Z1J)(e,n),r=(0,v.weG)(e,a);if(!o||!r)return;const{currentType:c,resultsByType:d}=r,u=c&&d&&d[c],m=u?.nextOffsetId;c&&oe(e,o,i,c,m,void 0,a)})),(0,a.iw)("searchMessagesByDate",(async(e,t,s)=>{const{timestamp:a,tabId:n=(0,l._w)()}=s,{chatId:i}=(0,v.Btg)(e,n)||{};if(!i)return;const o=(0,v.Z1J)(e,i);if(!o)return;const r=await(0,p.t9)("findFirstMessageIdAfterDate",{chat:o,timestamp:a});r&&t.focusMessage({chatId:o.id,messageId:r,tabId:n})})),(0,a.iw)("checkPublicLink",(async(e,t,s)=>{const{username:n,tabId:i=(0,l._w)()}=s,{chatId:o}=(0,v.Btg)(e,i)||{};if(!o)return;if((0,v.jUK)(e,i).management.progress===c.wv.InProgress)return;e=(0,f.fw)(e,o,{isUsernameAvailable:void 0,checkedUsername:void 0},i),(0,a.R3)(e);const{result:r,error:d}=await(0,p.t9)("checkChatUsername",{username:n});e=(0,a.Rd)(),e=(0,f.H9)(e,!0===r?c.wv.Complete:c.wv.Error,i),e=(0,f.fw)(e,o,{isUsernameAvailable:!0===r,checkedUsername:n,error:d},i),(0,a.R3)(e),void 0===r&&t.openLimitReachedModal({limit:"channelsPublic",tabId:i})})),(0,a.iw)("updatePublicLink",(async(e,t,s)=>{const{username:n,shouldDisableUsernames:i,tabId:r=(0,l._w)()}=s,{chatId:d}=(0,v.Btg)(e,r)||{};if(!d)return;const u=await(0,o.X9)(e,t,d,r);if(!u)return;e=(0,a.Rd)(),e=(0,f.H9)(e,c.wv.InProgress,r),(0,a.R3)(e);const m=await(0,p.t9)("setChatUsername",{chat:u,username:n});i&&await(0,p.t9)("deactivateAllUsernames",{chat:u}),e=(0,a.Rd)(),e=(0,f.H9)(e,m?c.wv.Complete:c.wv.Error,r),e=(0,f.fw)(e,u.id,{isUsernameAvailable:void 0,checkedUsername:void 0,error:void 0},r),(0,a.R3)(e)})),(0,a.iw)("updatePrivateLink",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},{chatId:n}=(0,v.Btg)(e,a)||{},i=n&&(0,v.Z1J)(e,n);n&&i&&(0,p.t9)("updatePrivateLink",{chat:i})})),(0,a.iw)("setEditingExportedInvite",((e,t,s)=>{const{chatId:n,invite:i,tabId:o=(0,l._w)()}=s;e=(0,f.fw)(e,n,{editingInvite:i},o),(0,a.R3)(e)})),(0,a.iw)("setOpenedInviteInfo",((e,t,s)=>{const{chatId:n,invite:i,tabId:o=(0,l._w)()}=s,r=i?{inviteInfo:{invite:i}}:{inviteInfo:void 0};e=(0,f.fw)(e,n,r,o),(0,a.R3)(e)})),(0,a.iw)("loadExportedChatInvites",(async(e,t,s)=>{const{chatId:n,adminId:i,isRevoked:o,limit:r,tabId:c=(0,l._w)()}=s,d=(0,v.Z1J)(e,n),m=(0,v.dyD)(e,i||e.currentUserId);if(!d||!m)return;const h=await(0,p.t9)("fetchExportedChatInvites",{peer:d,admin:m,isRevoked:o,limit:r});if(!h)return;e=(0,a.Rd)();const{invites:g,users:I}=h;e=(0,f.Sh)(e,(0,u.ee)(I,"id"));const w=o?{revokedInvites:g}:{invites:g};e=(0,f.fw)(e,n,w,c),(0,a.R3)(e)})),(0,a.iw)("editExportedChatInvite",(async(e,t,s)=>{const{chatId:n,link:i,isRevoked:o,expireDate:r,usageLimit:c,isRequestNeeded:d,title:m,tabId:h=(0,l._w)()}=s,g=(0,v.Z1J)(e,n);if(!g)return;const I=await(0,p.t9)("editExportedChatInvite",{peer:g,link:i,isRevoked:o,expireDate:r,usageLimit:c,isRequestNeeded:d,title:m});if(!I)return;const{oldInvite:w,newInvite:y,users:b}=I;e=(0,a.Rd)();const{management:P}=(0,v.jUK)(e,h),Z=(P.byChatId[n].invites||[]).filter((e=>e.link!==w.link)),S=[...P.byChatId[n].revokedInvites||[]];y.isRevoked?S.unshift(y):Z.push(y),e=(0,f.Sh)(e,(0,u.ee)(b,"id")),e=(0,f.fw)(e,n,{invites:Z,revokedInvites:S},h),(0,a.R3)(e)})),(0,a.iw)("exportChatInvite",(async(e,t,s)=>{const{chatId:n,expireDate:i,usageLimit:o,isRequestNeeded:r,title:c,tabId:d=(0,l._w)()}=s,u=(0,v.Z1J)(e,n);if(!u)return;const m=await(0,p.t9)("exportChatInvite",{peer:u,expireDate:i,usageLimit:o,isRequestNeeded:r,title:c});if(!m)return;e=(0,a.Rd)();const h=(0,v.jUK)(e,d).management.byChatId[n].invites||[];e=(0,f.fw)(e,n,{invites:[...h,m]},d),(0,a.R3)(e)})),(0,a.iw)("deleteExportedChatInvite",(async(e,t,s)=>{const{chatId:n,link:i,tabId:o=(0,l._w)()}=s,r=(0,v.Z1J)(e,n);if(!r)return;if(!await(0,p.t9)("deleteExportedChatInvite",{peer:r,link:i}))return;e=(0,a.Rd)();const c=(0,v.jUK)(e,o).management.byChatId[n];e=(0,f.fw)(e,n,{invites:c?.invites?.filter((e=>e.link!==i)),revokedInvites:c?.revokedInvites?.filter((e=>e.link!==i))},o),(0,a.R3)(e)})),(0,a.iw)("deleteRevokedExportedChatInvites",(async(e,t,s)=>{const{chatId:n,adminId:i,tabId:o=(0,l._w)()}=s,r=(0,v.Z1J)(e,n),c=(0,v.dyD)(e,i||e.currentUserId);r&&c&&await(0,p.t9)("deleteRevokedExportedChatInvites",{peer:r,admin:c})&&(e=(0,a.Rd)(),e=(0,f.fw)(e,n,{revokedInvites:[]},o),(0,a.R3)(e))})),(0,a.iw)("loadChatInviteImporters",(async(e,t,s)=>{const{chatId:n,link:i,offsetDate:o,offsetUserId:r,limit:c,tabId:d=(0,l._w)()}=s,u=(0,v.Z1J)(e,n),m=r?(0,v.dyD)(e,r):void 0;if(!u||r&&!m)return;const h=await(0,p.t9)("fetchChatInviteImporters",{peer:u,link:i,offsetDate:o,offsetUser:m,limit:c});if(!h)return;const{importers:g,users:I}=h;e=(0,a.Rd)();const w=(0,v.jUK)(e,d).management.byChatId[n]?.inviteInfo;w?.invite&&w.invite.link===i&&(e=(0,f.fw)(e,n,{inviteInfo:{...w,importers:g}},d),e=(0,f.Sh)(e,I),(0,a.R3)(e))})),(0,a.iw)("loadChatInviteRequesters",(async(e,t,s)=>{const{chatId:n,link:i,offsetDate:o,offsetUserId:r,limit:c,tabId:d=(0,l._w)()}=s,u=(0,v.Z1J)(e,n),m=r?(0,v.dyD)(e,r):void 0;if(!u||r&&!m)return;const h=await(0,p.t9)("fetchChatInviteImporters",{peer:u,link:i,offsetDate:o,offsetUser:m,limit:c,isRequested:!0});if(!h)return;const{importers:g,users:I}=h;e=(0,a.Rd)();const w=(0,v.jUK)(e,d).management.byChatId[n]?.inviteInfo;w?.invite&&w.invite.link===i&&(e=(0,f.fw)(e,n,{inviteInfo:{...w,requesters:g}},d),e=(0,f.Sh)(e,I),(0,a.R3)(e))})),(0,a.iw)("loadChatJoinRequests",(async(e,t,s)=>{const{chatId:n,offsetDate:i=0,offsetUserId:o,limit:r=0}=s,c=(0,v.Z1J)(e,n),d=o?(0,v.dyD)(e,o):void 0;if(!c||o&&!d)return;const l=await(0,p.t9)("fetchChatInviteImporters",{peer:c,offsetDate:i,offsetUser:d,limit:r,isRequested:!0});if(!l)return;const{importers:u,users:m}=l;e=(0,a.Rd)(),e=(0,f.a4)(e,n,{joinRequests:u}),e=(0,f.Sh)(e,m),(0,a.R3)(e)})),(0,a.iw)("hideChatJoinRequest",(async(e,t,s)=>{const{chatId:n,userId:i,isApproved:o}=s,r=(0,v.Z1J)(e,n),c=(0,v.dyD)(e,i);if(!r||!c)return;if(!await(0,p.t9)("hideChatJoinRequest",{peer:r,user:c,isApproved:o}))return;e=(0,a.Rd)();const d=(0,v.Z1J)(e,n);d&&(e=(0,f.a4)(e,n,{joinRequests:d.joinRequests?.filter((e=>e.userId!==i))}),(0,a.R3)(e))})),(0,a.iw)("hideAllChatJoinRequests",(async(e,t,s)=>{const{chatId:n,isApproved:i,link:o}=s,r=(0,v.Z1J)(e,n);r&&await(0,p.t9)("hideAllChatJoinRequests",{peer:r,isApproved:i,link:o})&&(e=(0,a.Rd)(),(0,v.Z1J)(e,n)&&(e=(0,f.a4)(e,n,{joinRequests:[]}),e=(0,f.US)(e,n,{recentRequesterIds:[],requestsPending:0}),(0,a.R3)(e)))})),(0,a.iw)("hideChatReportPanel",(async(e,t,s)=>{const{chatId:n}=s,i=(0,v.Z1J)(e,n);i&&await(0,p.t9)("hideChatReportPanel",i)&&(e=(0,a.Rd)(),e=(0,f.a4)(e,n,{settings:void 0}),(0,a.R3)(e))})),(0,a.iw)("uploadContactProfilePhoto",(async(e,t,s)=>{const{userId:n,file:i,isSuggest:o,tabId:r=(0,l._w)()}=s,d=(0,v.dyD)(e,n);if(!d)return;e=(0,f.H9)(e,c.wv.InProgress,r),(0,a.R3)(e);const h=await(0,p.t9)("uploadContactProfilePhoto",{user:d,file:i,isSuggest:o});if(!h)return e=(0,a.Rd)(),e=(0,f.H9)(e,c.wv.Error,r),void(0,a.R3)(e);e=(0,a.Rd)(),e=(0,f.Sh)(e,(0,u.ee)(h.users,"id")),(0,a.R3)(e);const{id:I,accessHash:w}=d;if(!await(0,p.t9)("fetchFullUser",{id:I,accessHash:w}))return e=(0,a.Rd)(),e=(0,f.H9)(e,c.wv.Error,r),void(0,a.R3)(e);t.loadProfilePhotos({profileId:n}),e=(0,a.Rd)(),e=(0,f.H9)(e,c.wv.Complete,r),(0,a.R3)(e),i&&!o&&t.showNotification({message:m.Iu("UserInfo.SetCustomPhoto.SuccessPhotoText",(0,g.Vl)(d)),tabId:r})})),(0,a.iw)("resetManagementError",((e,t,s)=>{const{chatId:a,tabId:n=(0,l._w)()}=s||{};return(0,f.fw)(e,a,{error:void 0},n)}));var re=s(65116),ce=s(16974);let de,le;(0,a.iw)("sync",((e,t)=>{n.eMD&&console.log(">>> START SYNC"),de&&clearTimeout(de),e=(0,a.Rd)(),e={...e,isSyncing:!0},(0,a.R3)(e),de=window.setTimeout((()=>{e=(0,a.Rd)(),e={...e,isSyncing:!1},(0,a.R3)(e),de=void 0}),15e3);const{loadAllChats:s,preloadTopChatMessages:i,loadAllStories:o,loadAllHiddenStories:c}=t;s({listType:"active",shouldReplace:!0,onReplace:async()=>{await async function(e,t){let s=!1;e=(0,a.Rd)();let i=!1;const o=Object.keys(e.messages.byChatId).reduce(((t,s)=>(t[s]=Object.keys(e.messages.byChatId[s].threadsById).reduce(((t,a)=>(t[Number(a)]={draft:(0,v.Mst)(e,s,Number(a)),editingId:(0,v._$9)(e,s,Number(a)),editingDraft:(0,v.saH)(e,s,Number(a)),replyingToId:(0,v.Yyv)(e,s,Number(a))},t)),{}),t)),{});for(const{id:o}of Object.values(e.byTabId)){e=(0,a.Rd)();const{chatId:m,threadId:h}=(0,v.Btg)(e,o)||{},g=h||r._f,w=h&&m?(0,v.tZg)(e,m,h):void 0,y=m?e.chats.byId[m]:void 0;if(m&&y){const t=await(c=y,d=g,l=w?.lastReadInboxMessageId,(0,p.t9)("fetchMessages",{chat:c,threadId:d,offsetId:l||c.lastReadInboxMessageId,addOffset:-(Math.round(n.hT6/2)+1),limit:n.hT6}));e=(0,a.Rd)();const{chatId:r}=(0,v.Btg)(e,o)||{};if(t&&r===m){const a=(0,v.Zwk)(e,m),o=m===n.awM?e.serviceNotifications.filter((e=>{let{isDeleted:t}=e;return!t})).map((e=>{let{message:t}=e;return t})):[],r=y.isForum&&y.topics?Object.values(y.topics).map((e=>{let{lastMessageId:t}=e;return a[t]})).filter(Boolean):[],c=[].concat(t.messages,o),d=c.concat(r),l=(0,u.ee)(d,"id"),h=c.map((e=>{let{id:t}=e;return t}));i||(e={...e,messages:{...e.messages,byChatId:{}}},Object.values(e.byTabId).forEach((t=>{let{id:s}=t;e=(0,I.i)(e,{tabThreads:{}},s)})),i=!0),e=(0,f.c_)(e,m,l),e=(0,f.xj)(e,m,g,h),w?.originChannelId&&(e=(0,f.Xg)(e,m,g,w)),Object.values(e.byTabId).forEach((t=>{let{id:s}=t;const{chatId:a,threadId:n}=(0,v.Btg)(e,s)||{};a===m&&n===g&&(e=(0,f.y9)(e,m,g,h,s))})),e=(0,f.GL)(e,(0,u.ee)(t.chats,"id")),e=(0,f.eD)(e,(0,u.ee)(t.users,"id")),t.repliesThreadInfos.length&&(e=(0,f.j6)(e,t.repliesThreadInfos)),s=!0}}(0,a.R3)(e),y?.isForum&&(t.loadTopics({chatId:m,force:!0}),h&&h!==r._f&&t.loadTopicById({chatId:m,topicId:h,shouldCloseChatOnError:!0}))}var c,d,l;e=(0,a.Rd)(),s||(e={...e,messages:{...e.messages,byChatId:{}}},Object.values(e.byTabId).forEach((t=>{let{id:s}=t;e=(0,I.i)(e,{tabThreads:{}},s)}))),Object.keys(o).forEach((t=>{const s=o[t];Object.keys(s).forEach((s=>{e=(0,f.sN)(e,t,Number(s),o[t][Number(s)])}))})),(0,a.R3)(e),Object.values(e.byTabId).forEach((s=>{let{id:a}=s;const{chatId:n,messageId:i}=(0,v.jUK)(e,a).audioPlayer;n&&i&&!(0,v.hjO)(e,n,i)&&t.closeAudioPlayer({tabId:a})}))}(e,t),e=(0,a.Rd)(),e={...e,isSyncing:!1,isSynced:!0,isFetchingDifference:!1},(0,a.R3)(e),n.eMD&&console.log(">>> FINISH SYNC"),(0,ce.S1)(),s({listType:"archived",shouldReplace:!0}),(0,p.t9)("fetchCurrentUser"),i(),o(),c()}})})),(0,re.ll)((e=>{const{connectionState:t,authState:s,isSynced:n}=e,{isMasterTab:i}=(0,v.jUK)(e);!i||n||le?.connectionState===t&&le?.authState===s||"connectionStateReady"===t&&"authorizationStateReady"===s&&(0,a.Sv)().sync(),le=e})),(0,a.iw)("reportPeer",(async(e,t,s)=>{const{chatId:a,reason:n,description:i,tabId:o=(0,l._w)()}=s;if(!a)return;const r=(0,v.Z1J)(e,a);if(!r)return;const c=await(0,p.t9)("reportPeer",{peer:r,reason:n,description:i});t.showNotification({message:c?(0,m.Iu)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later.",tabId:o})})),(0,a.iw)("reportProfilePhoto",(async(e,t,s)=>{const{chatId:a,reason:n,description:i,photo:o,tabId:r=(0,l._w)()}=s;if(!a)return;const c=(0,v.Z1J)(e,a);if(!c||!o)return;const d=await(0,p.t9)("reportProfilePhoto",{peer:c,photo:o,reason:n,description:i});t.showNotification({message:d?(0,m.Iu)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later.",tabId:r})})),(0,a.iw)("loadAuthorizations",(async e=>{const t=await(0,p.t9)("fetchAuthorizations");t&&(e=(0,a.Rd)(),e={...e,activeSessions:{byHash:t.authorizations,orderedHashes:Object.keys(t.authorizations),ttlDays:t.ttlDays}},(0,a.R3)(e))})),(0,a.iw)("terminateAuthorization",(async(e,t,s)=>{const{hash:n}=s;if(!await(0,p.t9)("terminateAuthorization",n))return;e=(0,a.Rd)();const{[n]:i,...o}=e.activeSessions.byHash;e={...e,activeSessions:{byHash:o,orderedHashes:e.activeSessions.orderedHashes.filter((e=>e!==n))}},(0,a.R3)(e)})),(0,a.iw)("terminateAllAuthorizations",(async e=>{if(!await(0,p.t9)("terminateAllAuthorizations"))return;const t=(e=(0,a.Rd)()).activeSessions.orderedHashes.find((t=>e.activeSessions.byHash[t].isCurrent));if(!t)return;const s=e.activeSessions.byHash[t];e={...e,activeSessions:{byHash:{[t]:s},orderedHashes:[t]}},(0,a.R3)(e)})),(0,a.iw)("changeSessionSettings",(async(e,t,s)=>{const{hash:n,areCallsEnabled:i,areSecretChatsEnabled:o,isConfirmed:r}=s;await(0,p.t9)("changeSessionSettings",{hash:n,areCallsEnabled:i,areSecretChatsEnabled:o,isConfirmed:r})&&(e=(0,a.Rd)(),e={...e,activeSessions:{...e.activeSessions,byHash:{...e.activeSessions.byHash,[n]:{...e.activeSessions.byHash[n],...void 0!==i?{areCallsEnabled:i}:void 0,...void 0!==o?{areSecretChatsEnabled:o}:void 0,...r&&{isUnconfirmed:void 0}}}}},(0,a.R3)(e))})),(0,a.iw)("changeSessionTtl",(async(e,t,s)=>{const{days:n}=s;await(0,p.t9)("changeSessionTtl",{days:n})&&(e=(0,a.Rd)(),e={...e,activeSessions:{...e.activeSessions,ttlDays:n}},(0,a.R3)(e))})),(0,a.iw)("loadWebAuthorizations",(async e=>{const t=await(0,p.t9)("fetchWebAuthorizations");if(!t)return;const{users:s,webAuthorizations:n}=t;e=(0,a.Rd)(),e=(0,f.Sh)(e,(0,u.ee)(s,"id")),e={...e,activeWebSessions:{byHash:n,orderedHashes:Object.keys(n)}},(0,a.R3)(e)})),(0,a.iw)("terminateWebAuthorization",(async(e,t,s)=>{const{hash:n}=s;if(!await(0,p.t9)("terminateWebAuthorization",n))return;e=(0,a.Rd)();const{[n]:i,...o}=e.activeWebSessions.byHash;e={...e,activeWebSessions:{byHash:o,orderedHashes:e.activeWebSessions.orderedHashes.filter((e=>e!==n))}},(0,a.R3)(e)})),(0,a.iw)("terminateAllWebAuthorizations",(async e=>{await(0,p.t9)("terminateAllWebAuthorizations")&&(e=(0,a.Rd)(),e={...e,activeWebSessions:{byHash:{},orderedHashes:[]}},(0,a.R3)(e))}));var ue=s(82267);const me=(0,h.P2)((e=>e()),500,!1);(0,a.iw)("loadFullUser",(async(e,t,s)=>{const{userId:n,withPhotos:i}=s,o=(0,v.dyD)(e,n);if(!o)return;const{id:r,accessHash:c}=o,d=await(0,p.t9)("fetchFullUser",{id:r,accessHash:c});if(!d?.user)return;e=(0,a.Rd)();const l=(0,v.ccz)(e,n),{user:u,fullInfo:m}=d,h=o.avatarHash!==u.avatarHash||l?.profilePhoto?.id!==m?.profilePhoto?.id||l?.fallbackPhoto?.id!==m?.fallbackPhoto?.id||l?.personalPhoto?.id!==m?.personalPhoto?.id;e=(0,f.Nq)(e,n,d.user),e=(0,f.ap)(e,n,d.fullInfo),(0,a.R3)(e),(i||o.photos?.length&&h)&&t.loadProfilePhotos({profileId:n})})),(0,a.iw)("loadUser",(async(e,t,s)=>{const{userId:n}=s,i=(0,v.dyD)(e,n);if(!i)return;const o=await(0,p.t9)("fetchUsers",{users:[i]});if(!o)return;const{users:r,userStatusesById:c}=o;e=(0,a.Rd)(),e=(0,f.eD)(e,(0,u.ee)(r,"id")),e=(0,f.ps)(e,{...e.users.statusesById,...c}),(0,a.R3)(e)})),(0,a.iw)("loadTopUsers",(async e=>{const{topPeers:{lastRequestedAt:t}}=e;if(t&&!((0,ue.bp)()-t>60))return;const s=await(0,p.t9)("fetchTopUsers");if(!s)return;const{ids:n,users:i}=s;e=(0,a.Rd)(),e=(0,f.Sh)(e,(0,u.ee)(i,"id")),e={...e,topPeers:{...e.topPeers,userIds:n,lastRequestedAt:(0,ue.bp)()}},(0,a.R3)(e)})),(0,a.iw)("loadContactList",(async e=>{const t=await(0,p.t9)("fetchContactList");if(!t)return;e=(0,a.Rd)(),e=(0,f.Sh)(e,(0,u.ee)(t.users,"id")),e=(0,f.fZ)(e,(0,u.ee)(t.chats,"id")),e=(0,f.zn)(e,t.userStatusesById);const s=e=>e.lastName||e.firstName||"",n=new Intl.Collator("en-US"),i=t.users.sort(((e,t)=>n.compare(s(e),s(t)))).filter((e=>!e.isSelf));e={...e,contactList:{userIds:i.map((e=>e.id))}},(0,a.R3)(e)})),(0,a.iw)("loadCurrentUser",(()=>{(0,p.t9)("fetchCurrentUser")})),(0,a.iw)("loadCommonChats",(async(e,t,s)=>{const{tabId:n=(0,l._w)()}=s||{},{chatId:i}=(0,v.Btg)(e,n)||{},o=i?(0,v.dyD)(e,i):void 0;if(!o||(0,g.cS)(o)||o.commonChats?.isFullyLoaded)return;const r=o.commonChats?.maxId,c=await(0,p.t9)("fetchCommonChats",o.id,o.accessHash,r);if(!c)return;const{chats:d,chatIds:m,isFullyLoaded:h}=c;e=(0,a.Rd)(),d.length&&(e=(0,f.fZ)(e,(0,u.ee)(d,"id"))),e=(0,f.Nq)(e,o.id,{commonChats:{maxId:m.length?m[m.length-1]:"0",ids:(0,u.Tw)((o.commonChats?.ids||[]).concat(m)),isFullyLoaded:h}}),(0,a.R3)(e)})),(0,a.iw)("updateContact",(async(e,t,s)=>{const{userId:n,isMuted:i=!1,firstName:o,lastName:r,shouldSharePhoneNumber:d,tabId:u=(0,l._w)()}=s,m=(0,v.dyD)(e,n);if(!m)return;let h;if(t.updateChatMutedState({chatId:n,isMuted:i}),e=(0,a.Rd)(),e=(0,f.H9)(e,c.wv.InProgress,u),(0,a.R3)(e),!m.isContact&&m.phoneNumber)h=await(0,p.t9)("importContact",{phone:m.phoneNumber,firstName:o,lastName:r});else{const{id:e,accessHash:t}=m;h=await(0,p.t9)("updateContact",{id:e,accessHash:t,phoneNumber:"",firstName:o,lastName:r,shouldSharePhoneNumber:d})}h&&(t.loadChatSettings({chatId:n}),t.loadPeerStories({peerId:n}),e=(0,a.Rd)(),e=(0,f.Nq)(e,m.id,{firstName:o,lastName:r}),(0,a.R3)(e)),e=(0,a.Rd)(),e=(0,f.H9)(e,c.wv.Complete,u),e=(0,f.ft)(e,u),(0,a.R3)(e)})),(0,a.iw)("deleteContact",(async(e,t,s)=>{const{userId:a}=s,n=(0,v.dyD)(e,a);if(!n)return;const{id:i,accessHash:o}=n;await(0,p.t9)("deleteContact",{id:i,accessHash:o})})),(0,a.iw)("loadProfilePhotos",(async(e,t,s)=>{const{profileId:n}=s,i=(0,g.YC)(n);let o=i?(0,v.dyD)(e,n):void 0;const r=i?void 0:(0,v.Z1J)(e,n);if(!o&&!r)return;let c=(0,v.ccz)(e,n);if(o&&!c?.profilePhoto){const{id:e,accessHash:t}=o,s=await(0,p.t9)("fetchFullUser",{id:e,accessHash:t});if(!s?.user)return;o=s.user,c=s.fullInfo}const d=await(0,p.t9)("fetchProfilePhotos",o,r);if(!d||!d.photos)return;e=(0,a.Rd)();const l=o||r,{photos:m,users:h}=d,I=c?.fallbackPhoto,w=c?.personalPhoto;I&&m.push(I),w&&m.unshift(w),m.sort((e=>e.id===l?.avatarHash?-1:1)),e=(0,f.Sh)(e,(0,u.ee)(h,"id")),e=i?(0,f.Nq)(e,n,{photos:m}):(0,f.a4)(e,n,{photos:m}),(0,a.R3)(e)})),(0,a.iw)("setUserSearchQuery",((e,t,s)=>{const{query:n,tabId:i=(0,l._w)()}=s;n&&me((async()=>{const t=await(0,p.t9)("searchChats",{query:n});e=(0,a.Rd)();const s=(0,v.jUK)(e,i).userSearch.query;if(!t||!s||n!==s)return e=(0,f.Q3)(e,!1,i),void(0,a.R3)(e);const{localUsers:o,globalUsers:r}=t;let c,d;o.length&&(e=(0,f.Sh)(e,(0,u.ee)(o,"id")),c=o.map((e=>{let{id:t}=e;return t}))),r.length&&(e=(0,f.Sh)(e,(0,u.ee)(r,"id")),d=r.map((e=>{let{id:t}=e;return t}))),e=(0,f.Q3)(e,!1,i),e=(0,f.Lm)(e,{localUserIds:c,globalUserIds:d},i),(0,a.R3)(e)}))})),(0,a.iw)("importContact",(async(e,t,s)=>{const{phoneNumber:n,firstName:i,lastName:o,tabId:r=(0,l._w)()}=s,c=await(0,p.t9)("importContact",{phone:n,firstName:i,lastName:o});c?(t.openChat({id:c,tabId:r}),e=(0,a.Rd)(),e=(0,f.ft)(e,r),(0,a.R3)(e)):t.showNotification({message:m.Iu("Contacts.PhoneNumber.NotRegistred"),tabId:r})})),(0,a.iw)("reportSpam",((e,t,s)=>{const{chatId:a}=s,n=(0,v.RGZ)(e,a);n&&(0,p.t9)("reportSpam",n)})),(0,a.iw)("setEmojiStatus",((e,t,s)=>{const{emojiStatus:a,expires:n}=s;(0,p.t9)("updateEmojiStatus",a,n)})),(0,a.iw)("saveCloseFriends",(async(e,t,s)=>{const{userIds:n}=s;await(0,p.t9)("saveCloseFriends",n)&&(e=(0,a.Rd)(),e.contactList?.userIds.forEach((t=>{const{isCloseFriend:s}=e.users.byId[t]||{};s&&!n.includes(t)&&(e=(0,f.Nq)(e,t,{isCloseFriend:void 0}))})),n.forEach((t=>{e=(0,f.Nq)(e,t,{isCloseFriend:!0})})),(0,a.R3)(e))}));const he=i.cj||i.wZ;class pe{constructor(e,t){var s,a,n;this.features=e,this.onFail=t,s=this,n=void 0,(a=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var a=s.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(a="preOpened"))in s?Object.defineProperty(s,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):s[a]=n}preOpenIfNeeded(){he&&(this.preOpened=window.open("about:blank",void 0,this.features),this.preOpened?this.preOpened.blur():this.onFail?.())}open(e){if(this.preOpened)return this.preOpened.location.href=e,this.preOpened.focus(),void(this.preOpened=void 0);if(!he){const t=window.open(e,void 0,this.features);t?t.focus():this.onFail?.()}}cancelPreOpen(){this.preOpened?.close(),this.preOpened=void 0}}var ge=s(97690),fe=s(18629);function Ie(e,t,s){for(var a=arguments.length,n=new Array(a>3?a-3:0),i=3;i<a;i++)n[i-3]=arguments[i];let[o=(0,l._w)()]=n;const r=(0,v.jUK)(e,o);return(0,I.i)(e,{inlineBots:{...r.inlineBots,byUsername:{...r.inlineBots.byUsername,[t]:s}}},o)}function ve(e,t){for(var s=arguments.length,a=new Array(s>2?s-2:0),n=2;n<s;n++)a[n-2]=arguments[n];let[i=(0,l._w)()]=a;return(0,I.i)(e,{inlineBots:{...(0,v.jUK)(e,i).inlineBots,isLoading:t}},i)}const we=(0,h.Ds)((e=>e()),500,!1);function ye(e,t,s,n){for(var i=arguments.length,o=new Array(i>4?i-4:0),r=4;r<i;r++)o[r-4]=arguments[r];let[c=(0,l._w)()]=o;if("request"===n.type){e=(0,a.Rd)();const t=(0,v.jUK)(e,c);if(!t.urlAuth)return;const{domain:s,bot:i,shouldRequestWriteAccess:o}=n;return e=(0,I.i)(e,{urlAuth:{...t.urlAuth,request:{domain:s,botId:i.id,shouldRequestWriteAccess:o}}},c),void(0,a.R3)(e)}const d="accepted"===n.type?n.url:s;window.open(d,"_blank","noopener"),t.closeUrlAuthModal({tabId:c})}async function be(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r._f,s=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0;await(0,p.t9)("sendMessage",{chat:e,replyingTo:a?{replyingTo:a,replyingToTopId:t}:void 0,text:s,sendAs:n})}let Pe;async function Ze(e,t,s,a,n){let i=arguments.length>5&&void 0!==arguments[5]&&arguments[5];for(var o=arguments.length,r=new Array(o>6?o-6:0),c=6;c<o;c++)r[c-6]=arguments[c];let[d=(0,l._w)()]=r;const{showDialog:u,showNotification:m,openUrl:h,openGame:g}=t;i&&(Pe||(Pe=new pe("popup,width=800,height=600",(()=>{m({message:"Allow browser to open popup window",tabId:d})}))),Pe.preOpenIfNeeded());const f=await(0,p.t9)("answerCallbackButton",{chatId:s.id,accessHash:s.accessHash,messageId:a,data:n,isGame:i});if(!f)return;const{message:I,alert:v,url:w}=f;v?u({data:{message:I||"Error"},tabId:d}):I?m({message:I,tabId:d}):w&&(i?w.includes("https://prizes.gamee.com/")?Pe.open(w):(Pe.cancelPreOpen(),g({url:w,chatId:s.id,messageId:a,tabId:d})):h({url:w,tabId:d}))}async function Se(e,t){for(var s=arguments.length,n=new Array(s>2?s-2:0),i=2;i<s;i++)n[i-2]=arguments[i];let[o=(0,l._w)()]=n;const r=await(0,p.t9)("getPaymentForm",t);if(!r)return;const{form:d,invoice:m,users:h}=r;return e=(0,a.Rd)(),e=(0,f._7)(e,d,o),e=(0,f.Q$)(e,c.KB.Checkout,o),e=(0,f.Sh)(e,(0,u.ee)(h,"id")),(0,a.R3)(e),m}async function Ce(e,t,s,n){for(var i=arguments.length,o=new Array(i>4?i-4:0),r=4;r<i;r++)o[r-4]=arguments[r];let[d=(0,l._w)()]=o;const u=await(0,p.t9)("validateRequestedInfo",{inputInvoice:t,requestInfo:s,shouldSave:n});if(!u)return;const{id:m,shippingOptions:h}=u;e=(0,a.Rd)(),e=(0,f.vT)(e,m,d),h?(e=(0,f.TM)(e,h,d),e=(0,f.Q$)(e,c.KB.Shipping,d)):e=(0,f.Q$)(e,c.KB.Checkout,d),(0,a.R3)(e)}(0,a.iw)("clickBotInlineButton",((e,t,s)=>{const{messageId:a,button:n,tabId:i=(0,l._w)()}=s;switch(n.type){case"command":t.sendBotCommand({command:n.text,tabId:i});break;case"url":{const{url:e}=n;t.openUrl({url:e,tabId:i});break}case"callback":{const s=(0,v.jrE)(e,i);if(!s)return;Ze(e,t,s,a,n.data,void 0,i);break}case"requestPoll":t.openPollModal({isQuiz:n.isQuiz,tabId:i});break;case"requestPhone":{const s=e.currentUserId?(0,v.dyD)(e,e.currentUserId):void 0;if(!s)return;t.showDialog({data:{phoneNumber:s.phoneNumber,firstName:s.firstName||"",lastName:s.lastName||"",userId:s.id},tabId:i});break}case"receipt":{const s=(0,v.jrE)(e,i);if(!s)return;const{receiptMessageId:o}=n;t.getReceipt({receiptMessageId:o,chatId:s.id,messageId:a,tabId:i});break}case"buy":{const s=(0,v.jrE)(e,i);if(!s)return;t.openInvoice({chatId:s.id,messageId:a,tabId:i});break}case"game":{const s=(0,v.jrE)(e,i);if(!s)return;Ze(e,t,s,a,void 0,!0,i);break}case"switchBotInline":{const{query:e,isSamePeer:s}=n;t.switchBotInline({query:e,isSamePeer:s,messageId:a,tabId:i});break}case"userProfile":{const{userId:e}=n;t.openChatWithInfo({id:e,tabId:i});break}case"simpleWebView":{const{url:s}=n,{chatId:o}=(0,v.Btg)(e,i)||{};if(!o)return;const r=(0,v.hjO)(e,o,a);if(!r?.senderId)return;const c=(0,fe.BS)();t.requestSimpleWebView({url:s,botId:r?.senderId,theme:c,buttonText:n.text,tabId:i});break}case"webView":{const{url:s}=n,o=(0,v.jrE)(e,i);if(!o)return;const r=(0,v.hjO)(e,o.id,a);if(!r)return;const c=r.viaBotId||r.senderId;if(!c)return;const d=(0,fe.BS)();t.requestWebView({url:s,botId:c,peerId:o.id,theme:d,buttonText:n.text,tabId:i});break}case"urlAuth":{const{url:s}=n,o=(0,v.jrE)(e,i);if(!o)return;t.requestBotUrlAuth({chatId:o.id,messageId:a,buttonId:n.buttonId,url:s,tabId:i});break}}})),(0,a.iw)("sendBotCommand",((e,t,s)=>{const{command:a,chatId:n,tabId:i=(0,l._w)()}=s,o=n?(0,v.Z1J)(e,n):(0,v.jrE)(e,i),r=(0,v.Btg)(e,i);if(!o||!r)return;const{threadId:c}=r;t.setReplyingToId({messageId:void 0,tabId:i}),t.clearWebPagePreview({tabId:i}),be(o,c,a,(0,v.Yyv)(e,o.id,c),(0,v._5C)(e,o.id))})),(0,a.iw)("restartBot",(async(e,t,s)=>{const{chatId:n,tabId:i=(0,l._w)()}=s,{currentUserId:o}=e,c=(0,v.jrE)(e,i),d=o&&(0,v.kBx)(e,n);o&&c&&d&&await(0,p.t9)("unblockUser",{user:d})&&(e=(0,a.Rd)(),e=(0,f.kw)(e,d.id),(0,a.R3)(e),be(c,r._f,"/start",void 0,(0,v._5C)(e,n)))})),(0,a.iw)("loadTopInlineBots",(async e=>{const{lastRequestedAt:t}=e.topInlineBots;if(t&&(0,ue.bp)()-t<60)return;const s=await(0,p.t9)("fetchTopInlineBots");if(!s)return;const{ids:n,users:i}=s;e=(0,a.Rd)(),e=(0,f.Sh)(e,(0,u.ee)(i,"id")),e={...e,topInlineBots:{...e.topInlineBots,userIds:n,lastRequestedAt:(0,ue.bp)()}},(0,a.R3)(e)})),(0,a.iw)("queryInlineBot",(async(e,t,s)=>{const{chatId:n,username:i,query:o,offset:r,tabId:c=(0,l._w)()}=s;let d=(0,v.jUK)(e,c).inlineBots.byUsername[i];if(!1!==d){if(void 0===d){const{user:t,chat:s}=await(0,p.t9)("fetchInlineBot",{username:i})||{};if(e=(0,a.Rd)(),!t||!s)return e=Ie(e,i,!1,c),void(0,a.R3)(e);e=(0,f.Sh)(e,{[t.id]:t}),e=(0,f.fZ)(e,{[s.id]:s}),d={id:t.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[],cacheTime:0},e=Ie(e,i,d,c),(0,a.R3)(e)}(o!==d.query||d.canLoadMore)&&we((()=>{!async function(e,t){let{username:s,inlineBotData:n,chatId:i,query:o,offset:r}=t;for(var c=arguments.length,d=new Array(c>2?c-2:0),u=2;u<c;u++)d[u-2]=arguments[u];let[m=(0,l._w)()]=d;e=(0,a.Rd)();const h=(0,v.dyD)(e,n.id),g=(0,v.Z1J)(e,i);if(!h||!g)return;const f=n.query!==o;e=Ie(e=ve(e,!0,m),s,{...n,query:o,...f&&{offset:void 0,results:[]}},m),(0,a.R3)(e);const I=await(0,p.t9)("fetchInlineBotResults",{bot:h,chat:g,query:o,offset:f?void 0:r});e=(0,a.Rd)();const w=(0,v.jUK)(e,m).inlineBots.byUsername[s];if(e=ve(e,!1,m),!I||!w||o!==w.query)return void(0,a.R3)(e);const y=new Set((w.results||[]).map((e=>e.id))),b=I.results.filter((e=>!y.has(e.id)));e=Ie(e,s,{...w,help:I.help,cacheTime:Date.now()+1e3*I.cacheTime,...b.length&&{isGallery:I.isGallery},...I.switchPm&&{switchPm:I.switchPm},...I.switchWebview&&{switchWebview:I.switchWebview},canLoadMore:I.results.length>0&&Boolean(I.nextOffset),results:""===w.offset||w.offset===I.nextOffset?I.results:(w.results||[]).concat(b),offset:b.length?I.nextOffset:""},m),(0,a.R3)(e)}(e,{username:i,inlineBotData:d,chatId:n,query:o,offset:r},c)}))}})),(0,a.iw)("switchBotInline",((e,t,s)=>{const{query:a,isSamePeer:n,messageId:i,filter:o,tabId:r=(0,l._w)()}=s;let{botId:c}=s;const d=(0,v.jrE)(e,r);if(!d)return;if(!c&&i){const t=(0,v.hjO)(e,d.id,i);if(!t)return;c=t.viaBotId||t.senderId}if(!c)return;const u=(0,v.dyD)(e,c);u&&t.openChatWithDraft({text:`@${u.usernames[0].username} ${a}`,chatId:n?d.id:void 0,filter:o,tabId:r})})),(0,a.iw)("sendInlineBotResult",((e,t,s)=>{const{id:a,queryId:n,isSilent:i,scheduledAt:o,messageList:c,tabId:d=(0,l._w)()}=s;if(!a)return;const{chatId:u,threadId:m}=c,h=(0,v.Z1J)(e,u),g=(0,v.Yyv)(e,u,m),f=g?(0,v.hjO)(e,u,g):void 0,I=h.isForum||m!==r._f?(0,v.qSq)(e,u,m):f?.replyToTopMessageId||f?.replyToMessageId;t.setReplyingToId({messageId:void 0,tabId:d}),t.clearWebPagePreview({tabId:d}),(0,p.t9)("sendInlineBotResult",{chat:h,resultId:a,queryId:n,replyingTo:g||I,replyingToTopId:I,sendAs:(0,v._5C)(e,u),isSilent:i,scheduleDate:o})})),(0,a.iw)("resetInlineBot",((e,t,s)=>{const{username:n,force:i,tabId:o=(0,l._w)()}=s;let r=(0,v.jUK)(e,o).inlineBots.byUsername[n];r&&(!i&&Date.now()<r.cacheTime||(r={id:r.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[],cacheTime:0},e=Ie(e,n,r,o),(0,a.R3)(e)))})),(0,a.iw)("resetAllInlineBots",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},n=(0,v.jUK)(e,a).inlineBots.byUsername;Object.keys(n).forEach((e=>{t.resetInlineBot({username:e,tabId:a})}))})),(0,a.iw)("startBot",(async(e,t,s)=>{const{botId:a,param:n}=s,i=(0,v.dyD)(e,a);if(!i)return;let o=(0,v.ccz)(e,a);if(!o){const e=await(0,p.t9)("fetchFullUser",{id:i.id,accessHash:i.accessHash});o=e?.fullInfo}o?.isBlocked&&await(0,p.t9)("unblockUser",{user:i}),await(0,p.t9)("startBot",{bot:i,startParam:n})})),(0,a.iw)("sharePhoneWithBot",(async(e,t,s)=>{const{botId:n}=s,i=(0,v.dyD)(e,n);if(!i)return;let o=(0,v.ccz)(e,n);if(!o){const e=await(0,p.t9)("fetchFullUser",{id:i.id,accessHash:i.accessHash});o=e?.fullInfo}o?.isBlocked&&await(0,p.t9)("unblockUser",{user:i}),e=(0,a.Rd)();const r=(0,v.Z1J)(e,n),c=(0,v.dyD)(e,e.currentUserId);r&&await(0,p.t9)("sendMessage",{chat:r,contact:{firstName:c.firstName||"",lastName:c.lastName||"",phoneNumber:c.phoneNumber||"",userId:c.id}})})),(0,a.iw)("requestSimpleWebView",(async(e,t,s)=>{const{url:n,botId:i,theme:o,buttonText:r,isFromSideMenu:c,isFromSwitchWebView:d,startParam:u,tabId:m=(0,l._w)()}=s,h=(0,v.dyD)(e,i);if(!h)return;if(!(0,v.LM9)(e,i))return e=(0,I.i)(e,{botTrustRequest:{botId:i,type:"webApp",onConfirm:{action:"requestSimpleWebView",payload:s}}},m),void(0,a.R3)(e);const g=await(0,p.t9)("requestSimpleWebView",{url:n,bot:h,theme:o,startParam:u,isFromSideMenu:c,isFromSwitchWebView:d});g&&(e=(0,a.Rd)(),e=(0,I.i)(e,{webApp:{url:g,botId:i,buttonText:r}},m),(0,a.R3)(e))})),(0,a.iw)("requestWebView",(async(e,t,s)=>{const{url:n,botId:i,peerId:o,theme:r,isSilent:c,buttonText:d,isFromBotMenu:u,startParam:m,tabId:h=(0,l._w)()}=s,g=(0,v.dyD)(e,i);if(!g)return;const f=(0,v.Z1J)(e,o);if(!f)return;if(!(0,v.LM9)(e,i))return e=(0,I.i)(e,{botTrustRequest:{botId:i,type:"webApp",onConfirm:{action:"requestWebView",payload:s}}},h),void(0,a.R3)(e);const w=(0,v.Btg)(e,h);if(!w)return;const{chatId:y,threadId:b}=w,P=y&&(0,v.Yyv)(e,y,b),Z=(0,v._5C)(e,y),S=await(0,p.t9)("requestWebView",{url:n,bot:g,peer:f,theme:r,isSilent:c,replyToMessageId:P||void 0,threadId:b,isFromBotMenu:u,startParam:m,sendAs:Z});if(!S)return;const{url:C,queryId:M}=S;e=(0,a.Rd)(),e=(0,I.i)(e,{webApp:{url:C,botId:i,queryId:M,replyToMessageId:P||void 0,threadId:b,buttonText:d}},h),(0,a.R3)(e)})),(0,a.iw)("requestAppWebView",(async(e,t,s)=>{const{botId:n,appName:i,startApp:o,theme:r,isWriteAllowed:c,tabId:d=(0,l._w)()}=s,u=(0,v.dyD)(e,n);if(!u)return;const h=await(0,p.t9)("fetchBotApp",{bot:u,appName:i});if(e=(0,a.Rd)(),!h)return void t.showNotification({message:(0,m.Iu)("lng_username_app_not_found"),tabId:d});if(h.isInactive&&!(0,v.LM9)(e,n))return e=(0,I.i)(e,{botTrustRequest:{botId:n,shouldRequestWriteAccess:h.shouldRequestWriteAccess,type:"botApp",onConfirm:{action:"requestAppWebView",payload:s}}},d),void(0,a.R3)(e);const g=(0,v.jrE)(e,d),f=await(0,p.t9)("requestAppWebView",{peer:g||u,app:h,startParam:o,isWriteAllowed:c,theme:r});e=(0,a.Rd)(),f&&(e=(0,I.i)(e,{webApp:{url:f,botId:n,buttonText:""}},d),(0,a.R3)(e))})),(0,a.iw)("prolongWebView",(async(e,t,s)=>{const{botId:a,peerId:n,isSilent:i,replyToMessageId:o,queryId:r,threadId:c,tabId:d=(0,l._w)()}=s,u=(0,v.dyD)(e,a);if(!u)return;const m=(0,v.Z1J)(e,n);if(!m)return;const h=(0,v._5C)(e,n);await(0,p.t9)("prolongWebView",{bot:u,peer:m,isSilent:i,replyToMessageId:o,threadId:c,queryId:r,sendAs:h})||t.closeWebApp({tabId:d})})),(0,a.iw)("sendWebViewData",((e,t,s)=>{const{bot:a,data:n,buttonText:i}=s;(0,p.t9)("sendWebViewData",{bot:a,data:n,buttonText:i})})),(0,a.iw)("closeWebApp",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{webApp:void 0},a)})),(0,a.iw)("setWebAppPaymentSlug",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s,n=(0,v.jUK)(e,a);if(n.webApp?.url)return(0,I.i)(e,{webApp:{...n.webApp,slug:s.slug}},a)})),(0,a.iw)("cancelBotTrustRequest",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{botTrustRequest:void 0},a)})),(0,a.iw)("markBotTrusted",((e,t,s)=>{const{botId:n,isWriteAllowed:i,tabId:o=(0,l._w)()}=s,{trustedBotIds:r}=e,c=new Set(r);c.add(n),e={...e,trustedBotIds:Array.from(c)};const d=(0,v.jUK)(e,o);if(d.botTrustRequest?.onConfirm){const{action:e,payload:s}=d.botTrustRequest.onConfirm;t[e]({...s,isWriteAllowed:i})}e=(0,I.i)(e,{botTrustRequest:void 0},o),(0,a.R3)(e)})),(0,a.iw)("loadAttachBots",(async(e,t,s)=>{const{hash:i}=s||{},o=await async function(e,t){const s=await(0,p.t9)("loadAttachBots",{hash:t});if(s)return e=(0,a.Rd)(),e=(0,f.Sh)(e,(0,u.ee)(s.users,"id")),e={...e,attachMenu:{hash:s.hash,bots:s.bots}},(0,a.R3)(e),s}(e,i);(0,ge.Z)({action:"loadAttachBots",payload:{hash:o?.hash}},n.dse)})),(0,a.iw)("toggleAttachBot",(async(e,t,s)=>{const{botId:a,isWriteAllowed:n,isEnabled:i}=s,o=(0,v.dyD)(e,a);o&&await(0,p.t9)("toggleAttachBot",{bot:o,isWriteAllowed:n,isEnabled:i})})),(0,a.iw)("callAttachBot",((e,t,s)=>{const{bot:a,startParam:n,isFromConfirm:i,tabId:o=(0,l._w)()}=s,r="isFromSideMenu"in s&&s.isFromSideMenu,c=!a,d=!c&&!e.attachMenu.bots[a.id]||r&&(a?.isInactive||a?.isDisclaimerNeeded);if(!i&&d)return(0,I.i)(e,{requestedAttachBotInstall:{bot:a,onConfirm:{action:"callAttachBot",payload:{...s,isFromConfirm:!0}}}},o);const u=(0,fe.BS)();if(r&&t.requestSimpleWebView({botId:a.id,buttonText:"",isFromSideMenu:!0,startParam:n,theme:u,tabId:o}),"chatId"in s){const{chatId:e,threadId:i,url:r}=s;t.openChat({id:e,threadId:i,tabId:o}),t.requestWebView({url:r,peerId:e,botId:c?e:a.id,theme:u,buttonText:"",isFromBotMenu:c,startParam:n,tabId:o})}})),(0,a.iw)("confirmAttachBotInstall",(async(e,t,s)=>{const{isWriteAllowed:n,tabId:i=(0,l._w)()}=s,{requestedAttachBotInstall:o}=(0,v.jUK)(e,i),{bot:r,onConfirm:c}=o;e=(0,I.i)(e,{requestedAttachBotInstall:void 0},i),(0,a.R3)(e);const d=(0,v.dyD)(e,r.id);if(d&&(t.markBotTrusted({botId:r.id,isWriteAllowed:n,tabId:i}),await(0,p.t9)("toggleAttachBot",{bot:d,isWriteAllowed:n,isEnabled:!0}),c)){const{action:e,payload:s}=c;t[e](s)}})),(0,a.iw)("cancelAttachBotInstall",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{requestedAttachBotInstall:void 0},a)})),(0,a.iw)("requestAttachBotInChat",((e,t,s)=>{const{bot:n,filter:i,startParam:o,tabId:r=(0,l._w)()}=s,c=(0,v.Btg)(e,r)?.chatId,d=n.attachMenuPeerTypes?.filter((e=>"self"!==e&&i.includes(e)));d?.length?(e=(0,I.i)(e,{requestedAttachBotInChat:{bot:n,filter:d,startParam:o}},r),(0,a.R3)(e)):t.callAttachBot({chatId:c||n.id,bot:n,startParam:o,tabId:r})})),(0,a.iw)("cancelAttachBotInChat",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{requestedAttachBotInChat:void 0},a)})),(0,a.iw)("requestBotUrlAuth",(async(e,t,s)=>{const{chatId:n,buttonId:i,messageId:o,url:r,tabId:c=(0,l._w)()}=s,d=(0,v.Z1J)(e,n);if(!d)return;const u=await(0,p.t9)("requestBotUrlAuth",{chat:d,buttonId:i,messageId:o});u&&(e=(0,a.Rd)(),e=(0,I.i)(e,{urlAuth:{url:r,button:{buttonId:i,messageId:o,chatId:d.id}}},c),(0,a.R3)(e),ye(e,t,r,u,c))})),(0,a.iw)("acceptBotUrlAuth",(async(e,t,s)=>{const{isWriteAllowed:n,tabId:i=(0,l._w)()}=s,o=(0,v.jUK)(e,i);if(!o.urlAuth?.button)return;const{button:r,url:c}=o.urlAuth,{chatId:d,messageId:u,buttonId:m}=r,h=(0,v.Z1J)(e,d);if(!h)return;const g=await(0,p.t9)("acceptBotUrlAuth",{chat:h,messageId:u,buttonId:m,isWriteAllowed:n});g&&ye(e=(0,a.Rd)(),t,c,g,i)})),(0,a.iw)("requestLinkUrlAuth",(async(e,t,s)=>{const{url:n,tabId:i=(0,l._w)()}=s,o=await(0,p.t9)("requestLinkUrlAuth",{url:n});o&&(e=(0,a.Rd)(),e=(0,I.i)(e,{urlAuth:{url:n}},i),(0,a.R3)(e),ye(e,t,n,o,i))})),(0,a.iw)("acceptLinkUrlAuth",(async(e,t,s)=>{const{isWriteAllowed:n,tabId:i=(0,l._w)()}=s,o=(0,v.jUK)(e,i);if(!o.urlAuth?.url)return;const{url:r}=o.urlAuth,c=await(0,p.t9)("acceptLinkUrlAuth",{url:r,isWriteAllowed:n});c&&ye(e=(0,a.Rd)(),t,r,c,i)})),(0,a.iw)("closeUrlAuthModal",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{urlAuth:void 0},a)})),s(51371),(0,a.iw)("loadPasswordInfo",(async e=>{const t=await(0,p.t9)("getPasswordInfo");t&&(e=(0,a.Rd)(),e=(0,f.BI)(e,{hasPassword:t.hasPassword}),e=(0,f.IE)(e,{hint:t.hint}),(0,a.R3)(e))})),(0,a.iw)("checkPassword",(async(e,t,s)=>{const{currentPassword:n,onSuccess:i}=s;e=(0,f.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const o=await(0,p.t9)("checkPassword",n);e=(0,a.Rd)(),e=(0,f.IE)(e,{isLoading:!1}),(0,a.R3)(e),o&&i()})),(0,a.iw)("clearPassword",(async(e,t,s)=>{const{currentPassword:n,onSuccess:i}=s;e=(0,f.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const o=await(0,p.t9)("clearPassword",n);e=(0,a.Rd)(),e=(0,f.IE)(e,{isLoading:!1}),(0,a.R3)(e),o&&i()})),(0,a.iw)("updatePassword",(async(e,t,s)=>{const{currentPassword:n,password:i,hint:o,email:r,onSuccess:c}=s;e=(0,f.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const d=await(0,p.t9)("updatePassword",n,i,o,r);e=(0,a.Rd)(),e=(0,f.IE)(e,{isLoading:!1}),(0,a.R3)(e),d&&c()})),(0,a.iw)("updateRecoveryEmail",(async(e,t,s)=>{const{currentPassword:n,email:i,onSuccess:o}=s;e=(0,f.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const r=await(0,p.t9)("updateRecoveryEmail",n,i);e=(0,a.Rd)(),e=(0,f.IE)(e,{isLoading:!1,waitingEmailCodeLength:void 0}),(0,a.R3)(e),r&&o()})),(0,a.iw)("provideTwoFaEmailCode",((e,t,s)=>{const{code:a}=s;(0,p.t9)("provideRecoveryEmailCode",a)})),(0,a.iw)("clearTwoFaError",(e=>(0,f.IE)(e,{error:void 0}))),(0,a.iw)("validateRequestedInfo",((e,t,s)=>{const{requestInfo:a,saveInfo:n,tabId:i=(0,l._w)()}=s,o=(0,v.kbX)(e,i);if(o)if("slug"in o)Ce(e,o,a,n,i);else{const t=(0,v.Z1J)(e,o.chatId);if(!t)return;Ce(e,{chat:t,messageId:o.messageId},a,n,i)}})),(0,a.iw)("openInvoice",(async(e,t,s)=>{const{tabId:n=(0,l._w)()}=s;let i;if("slug"in s)i=await Se(e,{slug:s.slug},n);else{const t=(0,v.Z1J)(e,s.chatId);if(!t)return;i=await Se(e,{chat:t,messageId:s.messageId},n)}i&&(e=(0,a.Rd)(),e=(0,f.bs)(e,i,n),e=(0,I.i)(e,{payment:{...(0,v.jUK)(e,n).payment,inputInvoice:s,isPaymentModalOpen:!0,status:"cancelled",isExtendedMedia:s.isExtendedMedia}},n),(0,a.R3)(e))})),(0,a.iw)("getReceipt",(async(e,t,s)=>{const{receiptMessageId:n,chatId:i,messageId:o,tabId:r=(0,l._w)()}=s,c=i&&(0,v.Z1J)(e,i);if(!o||!n||!c)return;const d=await(0,p.t9)("getReceipt",c,n);if(!d)return;e=(0,a.Rd)();const m=(0,v.hjO)(e,c.id,o);e=(0,f.Sh)(e,(0,u.ee)(d.users,"id")),e=(0,f.Dq)(e,d.receipt,m,r),(0,a.R3)(e)})),(0,a.iw)("clearPaymentError",((e,t,s)=>{const{tabId:n=(0,l._w)()}=s||{};e=(0,I.i)(e,{payment:{...(0,v.jUK)(e,n).payment,error:void 0}},n),(0,a.R3)(e)})),(0,a.iw)("clearReceipt",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{payment:{...(0,v.jUK)(e,a).payment,receipt:void 0}},a)})),(0,a.iw)("sendCredentialsInfo",((e,t,s)=>{const{credentials:i,tabId:o=(0,l._w)()}=s,{nativeProvider:r}=(0,v.jUK)(e,o).payment,{data:d}=i;if("stripe"===r){const t=(0,v.$$M)(e,o);if(!t)return;!async function(e,t,s){for(var n=arguments.length,i=new Array(n>3?n-3:0),o=3;o<n;o++)i[o-3]=arguments[o];let[r=(0,l._w)()]=i;const d=function(e){const t=Object.keys(e).map((t=>`${t}=${e[t]}`)).join("&");return t.length>0?`?${t}`:""}({"card[number]":t.cardNumber,"card[exp_month]":t.expiryMonth,"card[exp_year]":t.expiryYear,"card[cvc]":t.cvv,"card[address_zip]":t.zip,"card[address_country]":t.country}),u=await fetch(`https://api.stripe.com/v1/tokens${d}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:`Bearer ${s}`}}),m=await u.json();if(m.error){const t=(0,g.Ow)(m.error);return e=(0,a.Rd)(),e=(0,I.i)(e,{payment:{...(0,v.jUK)(e,r).payment,status:"failed",error:{...t}}},r),void(0,a.R3)(e)}e=(0,a.Rd)(),e=(0,f.QH)(e,{type:m.type,id:m.id},r),e=(0,f.Q$)(e,c.KB.Checkout,r),(0,a.R3)(e)}(e,d,t,o)}else if("smartglocal"===r){const t=(0,v.EBU)(e,o);if(!t)return;!async function(e,t,s){for(var i=arguments.length,o=new Array(i>3?i-3:0),r=3;r<i;r++)o[r-3]=arguments[r];let[d=(0,l._w)()]=o;const u={card:{number:t.cardNumber.replace(/\D+/g,""),expiration_month:t.expiryMonth,expiration_year:t.expiryYear,security_code:t.cvv.replace(/\D+/g,"")}},m=n.eAU?"https://tgb-playground.smart-glocal.com/cds/v1/tokenize/card":"https://tgb.smart-glocal.com/cds/v1/tokenize/card",h=await fetch(m,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-PUBLIC-TOKEN":s},body:JSON.stringify(u)}),p=await h.json();if("ok"!==p.status){const t={description:"payment error"};return e=(0,a.Rd)(),e=(0,I.i)(e,{payment:{...(0,v.jUK)(e,d).payment,status:"failed",error:{...t}}},d),void(0,a.R3)(e)}e=(0,a.Rd)(),e=(0,f.QD)(e,{type:"card",token:p.data.token},d),e=(0,f.Q$)(e,c.KB.Checkout,d),(0,a.R3)(e)}(e,d,t,o)}})),(0,a.iw)("sendPaymentForm",(async(e,t,s)=>{const{shippingOptionId:n,saveCredentials:i,savedCredentialId:o,tipAmount:r,tabId:c=(0,l._w)()}=s,d=(0,v.kbX)(e,c),u=(0,v.ehD)(e,c),m=(0,v.sp9)(e,c),{nativeProvider:h,temporaryPassword:g}=(0,v.jUK)(e,c).payment,I="stripe"===h?(0,v.$$M)(e,c):(0,v.EBU)(e,c);if(!(d&&I&&u&&h))return;let w;if("slug"in d)w={slug:d.slug};else{const t=(0,v.Z1J)(e,d.chatId);if(!t)return;w={chat:t,messageId:d.messageId}}e=(0,f.cQ)(e,{status:"pending"},c),(0,a.R3)(e);const y={save:i,data:"stripe"===h?(0,v.i31)(e,c):(0,v.Jg1)(e,c)};await(0,p.t9)("sendPaymentForm",{inputInvoice:w,formId:u,credentials:y,requestedInfoId:m,shippingOptionId:n,savedCredentialId:o,temporaryPassword:g?.value,tipAmount:r})&&(e=(0,a.Rd)(),e=(0,f.cQ)(e,{status:"paid"},c),e=(0,f.WY)(e,c),(0,a.R3)(e))})),(0,a.iw)("setPaymentStep",((e,t,s)=>{const{step:a,tabId:n=(0,l._w)()}=s;return(0,f.Q$)(e,a??c.KB.Checkout,n)})),(0,a.iw)("closePremiumModal",((e,t,s)=>{const{isClosed:a,tabId:n=(0,l._w)()}=s||{},i=(0,v.jUK)(e,n);if(i.premiumModal)return(0,I.i)(e,{premiumModal:{...i.premiumModal,...a&&{isOpen:!1},isClosing:!a}},n)})),(0,a.iw)("openPremiumModal",(async(e,t,s)=>{const{initialSection:n,fromUserId:i,isSuccess:o,isGift:r,monthsAmount:c,toUserId:d,tabId:m=(0,l._w)()}=s||{};t.loadPremiumStickers();const h=await(0,p.t9)("fetchPremiumPromo");h&&(e=(0,a.Rd)(),e=(0,f.Sh)(e,(0,u.ee)(h.users,"id")),e=(0,I.i)(e,{premiumModal:{promo:h.promo,initialSection:n,isOpen:!0,fromUserId:i,toUserId:d,isGift:r,monthsAmount:c,isSuccess:o}},m),(0,a.R3)(e),t.closeReactionPicker({tabId:m}))})),(0,a.iw)("openGiftPremiumModal",(async(e,t,s)=>{const{forUserId:n,tabId:i=(0,l._w)()}=s||{},o=await(0,p.t9)("fetchPremiumPromo");if(!o)return;e=(0,a.Rd)(),e=(0,f.Sh)(e,(0,u.ee)(o.users,"id"));const r=o.promo.options.find((e=>1===e.months));e=(0,I.i)(e,{giftPremiumModal:{isOpen:!0,forUserId:n,monthlyCurrency:r.currency,monthlyAmount:r.amount}},i),(0,a.R3)(e)})),(0,a.iw)("closeGiftPremiumModal",((e,t,s)=>{const{tabId:n=(0,l._w)()}=s||{};e=(0,I.i)(e,{giftPremiumModal:{isOpen:!1}},n),(0,a.R3)(e)})),(0,a.iw)("validatePaymentPassword",(async(e,t,s)=>{const{password:n,tabId:i=(0,l._w)()}=s,o=await(0,p.t9)("fetchTemporaryPaymentPassword",n);e=(0,a.Rd)(),e=o?"error"in o?(0,f.cQ)(e,{error:{message:o.error,field:"password"}},i):(0,f.cQ)(e,{temporaryPassword:o,step:c.KB.Checkout},i):(0,f.cQ)(e,{error:{message:"Unknown Error",field:"password"}},i),(0,a.R3)(e)}));var Me=s(40647);let Ee=0;(0,a.iw)("loadAvailableReactions",(async e=>{const t=await(0,p.t9)("getAvailableReactions");t&&(t.forEach((e=>{e.aroundAnimation&&Me.he(`sticker${e.aroundAnimation.id}`,r.IU.BlobUrl),e.centerIcon&&Me.he(`sticker${e.centerIcon.id}`,r.IU.BlobUrl),e.appearAnimation&&Me.he(`sticker${e.appearAnimation.id}`,r.IU.BlobUrl),e.selectAnimation&&Me.he((0,g.ym)(e.selectAnimation),r.IU.BlobUrl)})),e=(0,a.Rd)(),e={...e,availableReactions:t},(0,a.R3)(e),(0,ge.Z)({action:"loadAvailableReactions",payload:void 0},n.dse))})),(0,a.iw)("interactWithAnimatedEmoji",((e,t,s)=>{const{emoji:a,x:n,y:i,startSize:o,isReversed:r,tabId:c=(0,l._w)()}=s,d={id:Ee++,animatedEffect:a,x:A(e,n)+40*Math.random()-20,y:i+40*Math.random()-20,startSize:o,isReversed:r};return(0,I.i)(e,{activeEmojiInteractions:[...(0,v.jUK)(e,c).activeEmojiInteractions||[],d]},c)})),(0,a.iw)("sendEmojiInteraction",((e,t,s)=>{const{messageId:a,chatId:n,emoji:i,interactions:o}=s;if("connectionStateReady"!==e.connectionState)return;const r=(0,v.Z1J)(e,n);r&&i&&n!==e.currentUserId&&(0,p.t9)("sendEmojiInteraction",{chat:r,messageId:a,emoticon:i,timestamps:o})})),(0,a.iw)("sendDefaultReaction",((e,t,s)=>{const{chatId:a,messageId:n,tabId:i=(0,l._w)()}=s,o=(0,v.q6x)(e,a),r=(0,v.hjO)(e,a,n);o&&r&&!(0,g.CI)(r)&&t.toggleReaction({chatId:a,messageId:n,reaction:o,tabId:i})})),(0,a.iw)("toggleReaction",(async(e,t,s)=>{const{chatId:n,reaction:i,shouldAddToRecent:o,tabId:r=(0,l._w)()}=s;let{messageId:c}=s;const d=(0,v.Z1J)(e,n);let u=(0,v.hjO)(e,n,c);if(!d||!u)return;const m=Boolean(u.groupedId)&&!u.isInAlbum,h=m?(0,v.xHX)(e,n,u.groupedId)[0]:void 0;u=m&&(0,v.hjO)(e,n,h)||u,c=u?.id||c;const f=(0,g.UZ)(u),I=f.some((e=>(0,g.Hl)(e,i))),w=I?f.filter((e=>!(0,g.Hl)(e,i))):[...f,i],y=(0,v.oC7)(e),b=w.slice(-y),P=(0,g.Tp)(u);(0,v.$Yd)(e,"reactionEffects")&&(I?t.stopActiveReaction({containerId:P,reaction:i,tabId:r}):t.startActiveReaction({containerId:P,reaction:i,tabId:r})),e=N(e,u,b),(0,a.R3)(e);try{await(0,p.t9)("sendReaction",{chat:d,messageId:c,reactions:b,shouldAddToRecent:o})}catch(t){e=N(e=(0,a.Rd)(),u,f),(0,a.R3)(e)}})),(0,a.iw)("startActiveReaction",((e,t,s)=>{const{containerId:a,reaction:n,tabId:i=(0,l._w)()}=s,o=(0,v.jUK)(e,i);if(!(0,v.$Yd)(e,"reactionEffects"))return;const r=o.activeReactions[a]||[];if(r.some((e=>(0,g.Hl)(e,n))))return;const c=r.concat(n);return(0,I.i)(e,{activeReactions:{...o.activeReactions,[a]:c}},i)})),(0,a.iw)("stopActiveReaction",((e,t,s)=>{const{containerId:a,reaction:n,tabId:i=(0,l._w)()}=s,o=(0,v.jUK)(e,i),r=o.activeReactions[a]||[],c=n?r.filter((e=>!(0,g.Hl)(e,n))):[],d=c.length?{...o.activeReactions,[a]:c}:(0,u.CE)(o.activeReactions,[a]);return(0,I.i)(e,{activeReactions:d},i)})),(0,a.iw)("setDefaultReaction",(async(e,t,s)=>{const{reaction:n}=s;await(0,p.t9)("setDefaultReaction",{reaction:n})&&((e=(0,a.Rd)()).config?(e={...e,config:{...e.config,defaultReaction:n}},(0,a.R3)(e)):t.loadConfig())})),(0,a.iw)("stopActiveEmojiInteraction",((e,t,s)=>{const{id:a,tabId:n=(0,l._w)()}=s;return(0,I.i)(e,{activeEmojiInteractions:(0,v.jUK)(e,n).activeEmojiInteractions?.filter((e=>e.id!==a))},n)})),(0,a.iw)("loadReactors",(async(e,t,s)=>{const{chatId:n,messageId:i,reaction:o}=s,r=(0,v.Z1J)(e,n),c=(0,v.hjO)(e,n,i);if(!r||!c)return;const d=c.reactors?.nextOffset,l=await(0,p.t9)("fetchMessageReactionsList",{reaction:o,chat:r,messageId:i,offset:d});l&&(e=(0,a.Rd)(),e=(0,f.Sh)(e,(0,u.ee)(l.users,"id")),e=(0,f.fZ)(e,(0,u.ee)(l.chats,"id")),e=(0,f.cY)(e,n,i,{reactors:l}),(0,a.R3)(e))})),(0,a.iw)("loadMessageReactions",((e,t,s)=>{const{ids:a,chatId:n}=s,i=(0,v.Z1J)(e,n);i&&"connectionStateReady"===e.connectionState&&(0,p.t9)("fetchMessageReactions",{ids:a,chat:i})})),(0,a.iw)("sendWatchingEmojiInteraction",((e,t,s)=>{const{chatId:a,emoticon:n,x:i,y:o,startSize:r,isReversed:c,id:d,tabId:u=(0,l._w)()}=s,m=(0,v.Z1J)(e,a),h=(0,v.jUK)(e,u);if(m&&h.activeEmojiInteractions?.some((e=>e.id===d))&&a!==e.currentUserId)return"connectionStateReady"===e.connectionState&&(0,p.t9)("sendWatchingEmojiInteraction",{chat:m,emoticon:n}),(0,I.i)(e,{activeEmojiInteractions:h.activeEmojiInteractions.map((t=>t.id===d?{...t,x:A(e,i),y:o,startSize:r,isReversed:c}:t))},u)})),(0,a.iw)("fetchUnreadReactions",(async(e,t,s)=>{const{chatId:n,offsetId:i}=s,o=(0,v.Z1J)(e,n);if(!o)return;const r=await(0,p.t9)("fetchUnreadReactions",{chat:o,offsetId:i,addOffset:i?-1:void 0});if(!r||!r.messages.length)return e=B(e=(0,a.Rd)(),n,{unreadReactionsCount:0}),void(0,a.R3)(e);const{messages:c,chats:d,users:l}=r,m=(0,u.ee)(c,"id"),h=Object.keys(m).map(Number);e=(0,a.Rd)(),e=(0,f.c_)(e,o.id,m),e=(0,f.Sh)(e,(0,u.ee)(l,"id")),e=B(e=(0,f.fZ)(e,(0,u.ee)(d,"id")),n,{unreadReactions:[...o.unreadReactions||[],...h]}),(0,a.R3)(e)})),(0,a.iw)("animateUnreadReaction",((e,t,s)=>{const{messageIds:n,tabId:i=(0,l._w)()}=s,o=(0,v.jrE)(e,i);if(o){if(o.unreadReactionsCount){const s=o.unreadReactionsCount-n.length,i=(o.unreadReactions||[]).filter((e=>!n.includes(e)));e=B(e,o.id,{unreadReactions:i}),(0,a.R3)(e),!i.length&&s&&t.fetchUnreadReactions({chatId:o.id,offsetId:Math.min(...n)})}if(t.markMessagesRead({messageIds:n,tabId:i}),(0,v.$Yd)(e,"reactionEffects"))return e=(0,a.Rd)(),(0,I.i)(e,{activeReactions:{...(0,v.jUK)(e,i).activeReactions,...Object.fromEntries(n.map((t=>{const s=(0,v.hjO)(e,o.id,t);if(!s)return;const a=s.reactions?.recentReactions?.filter((e=>{let{isUnread:t}=e;return t}));if(!a)return;const n=a.map((e=>e.reaction));return[t,n.map((e=>({messageId:t,reaction:e})))]})).filter(Boolean))}},i)}})),(0,a.iw)("focusNextReaction",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},n=(0,v.jrE)(e,a);n?.unreadReactions&&t.focusMessage({chatId:n.id,messageId:n.unreadReactions[0],tabId:a})})),(0,a.iw)("readAllReactions",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},n=(0,v.jrE)(e,a);if(n)return(0,p.t9)("readAllReactions",{chat:n}),B(e,n.id,{unreadReactionsCount:void 0,unreadReactions:void 0})})),(0,a.iw)("loadTopReactions",(async e=>{const t=await(0,p.t9)("fetchTopReactions",{});t&&(e=(0,a.Rd)(),e={...e,topReactions:t.reactions},(0,a.R3)(e))})),(0,a.iw)("loadRecentReactions",(async e=>{const t=await(0,p.t9)("fetchRecentReactions",{});t&&(e=(0,a.Rd)(),e={...e,recentReactions:t.reactions},(0,a.R3)(e))})),(0,a.iw)("clearRecentReactions",(async e=>{await(0,p.t9)("clearRecentReactions")&&(e=(0,a.Rd)(),e={...e,recentReactions:[]},(0,a.R3)(e))})),(0,a.iw)("loadStatistics",(async(e,t,s)=>{const{chatId:n,isGroup:i,tabId:o=(0,l._w)()}=s,r=(0,v.Z1J)(e,n),c=(0,v.x67)(e,n);if(!r||!c)return;const d=await(0,p.t9)(i?"fetchGroupStatistics":"fetchChannelStatistics",{chat:r,dcId:c.statisticsDcId});if(!d)return;e=(0,a.Rd)();const{stats:m,users:h}=d;if(e=(0,f.Sh)(e,(0,u.ee)(h,"id")),"recentTopMessages"in m&&m.recentTopMessages.length){const t=(0,v.Zwk)(e,n);m.recentTopMessages=m.recentTopMessages.map((e=>({...e,...t[e.msgId]})))}e=(0,f.ze)(e,n,m,o),(0,a.R3)(e)})),(0,a.iw)("loadMessageStatistics",(async(e,t,s)=>{const{chatId:n,messageId:i,tabId:o=(0,l._w)()}=s,r=(0,v.Z1J)(e,n),c=(0,v.x67)(e,n);if(!r||!c)return;const d=c.statisticsDcId;let u=await(0,p.t9)("fetchMessageStatistics",{chat:r,messageId:i,dcId:d});u||(u={}),e=(0,a.Rd)();const{views:m,forwards:h}=(0,v.Zwk)(e,n)[i];u.views=m,u.forwards=h;const g=await(0,p.t9)("fetchMessagePublicForwards",{chat:r,messageId:i,dcId:d});u.publicForwards=g?.length,u.publicForwardsData=g,e=(0,a.Rd)(),e=(0,f.kM)(e,u,o),(0,a.R3)(e)})),(0,a.iw)("loadStatisticsAsyncGraph",(async(e,t,s)=>{const{chatId:n,token:i,name:o,isPercentage:r,tabId:c=(0,l._w)()}=s,d=(0,v.x67)(e,n);if(!d)return;const u=d.statisticsDcId,m=await(0,p.t9)("fetchStatisticsAsyncGraph",{token:i,dcId:u,isPercentage:r});m&&(e=(0,a.Rd)(),e=(0,f.yC)(e,n,o,m,c),(0,a.R3)(e))})),(0,a.iw)("loadAllStories",(async e=>{let t=0;for(;e.stories.hasNext;){if(t++>=100)return void(n.eMD&&console.error("`actions/loadAllStories`: Infinite loop detected"));e=(0,a.Rd)();const{stateHash:s,hasNext:i}=e.stories;if(s&&!i)return;const o=await(0,p.t9)("fetchAllStories",{isFirstRequest:!s,stateHash:s});if(!o)return;(e=(0,a.Rd)()).stories.stateHash=o.state,"peerStories"in o&&(e=(0,f.Sh)(e,(0,u.ee)(o.users,"id")),e=(0,f.fZ)(e,(0,u.ee)(o.chats,"id")),e=(0,f.p1)(e,o.peerStories),e=(0,f.Fz)(e,o.peerStories),(e=(0,f.Uq)(e,o.stealthMode)).stories.hasNext=o.hasMore),(0,a.R3)(e)}})),(0,a.iw)("loadAllHiddenStories",(async e=>{let t=0;for(;e.stories.hasNextInArchive;){if(t++>=100)return void(n.eMD&&console.error("`actions/loadAllHiddenStories`: Infinite loop detected"));e=(0,a.Rd)();const{archiveStateHash:s,hasNextInArchive:i}=e.stories;if(s&&!i)return;const o=await(0,p.t9)("fetchAllStories",{isFirstRequest:!s,stateHash:s,isHidden:!0});if(!o)return;(e=(0,a.Rd)()).stories.archiveStateHash=o.state,"peerStories"in o&&(e=(0,f.Sh)(e,(0,u.ee)(o.users,"id")),e=(0,f.fZ)(e,(0,u.ee)(o.chats,"id")),e=(0,f.p1)(e,o.peerStories),e=(0,f.Fz)(e,o.peerStories),(e=(0,f.Uq)(e,o.stealthMode)).stories.hasNextInArchive=o.hasMore),(0,a.R3)(e)}})),(0,a.iw)("loadPeerSkippedStories",(async(e,t,s)=>{const{peerId:n}=s,i=(0,v.RGZ)(e,n),o=(0,v.nST)(e,n);if(!i||!o)return;const r=Object.values(o.byId).reduce(((e,t)=>("content"in t||e.push(t.id),e)),[]);if(0===r.length)return;const c=await(0,p.t9)("fetchPeerStoriesByIds",{peer:i,ids:r});c&&(e=(0,a.Rd)(),e=(0,f.Sh)(e,(0,u.ee)(c.users,"id")),e=(0,f.fZ)(e,(0,u.ee)(c.chats,"id")),e=(0,f._6)(e,n,c.stories),(0,a.R3)(e))})),(0,a.iw)("viewStory",(async(e,t,s)=>{const{peerId:n,storyId:i,tabId:o=(0,l._w)()}=s,r=(0,v.RGZ)(e,n),c=(0,v.JrV)(e,n,i);if(!r||!c||!("content"in c))return;e=(0,f.WW)(e,n,i,o),(0,a.R3)(e);const d=(0,ue.bp)();c.expireDate<d&&c.isPinned&&(0,p.t9)("viewStory",{peer:r,storyId:i}),(e.stories.byPeerId[n].lastReadId||0)<c.id&&await(0,p.t9)("markStoryRead",{peer:r,storyId:i})&&(e=(0,a.Rd)(),e=(0,f.P5)(e,n,i),(0,a.R3)(e))})),(0,a.iw)("deleteStory",(async(e,t,s)=>{const{peerId:n,storyId:i}=s,o=(0,v.RGZ)(e,n);o&&await(0,p.t9)("deleteStory",{peer:o,storyId:i})&&(e=(0,a.Rd)(),e=(0,f.se)(e,n,i),(0,a.R3)(e))})),(0,a.iw)("toggleStoryPinned",(async(e,t,s)=>{const{peerId:n,storyId:i,isPinned:o}=s,r=(0,v.RGZ)(e,n);if(!r)return;const c=(0,v.JrV)(e,n,i),d=c&&"content"in c?c.isPinned:void 0;e=(0,f.w2)(e,n,i,{isPinned:o}),e=(0,f.vI)(e,n,i,o),(0,a.R3)(e),await(0,p.t9)("toggleStoryPinned",{peer:r,storyId:i,isPinned:o})||(e=(0,a.Rd)(),e=(0,f.w2)(e,n,i,{isPinned:d}),e=(0,f.vI)(e,n,i,d),(0,a.R3)(e))})),(0,a.iw)("loadPeerStories",(async(e,t,s)=>{const{peerId:n}=s,i=(0,v.RGZ)(e,n);if(!i)return;const o=await(0,p.t9)("fetchPeerStories",{peer:i});o&&(e=(0,a.Rd)(),e=(0,f.Sh)(e,(0,u.ee)(o.users,"id")),e=(0,f.fZ)(e,(0,u.ee)(o.chats,"id")),e=(0,f._6)(e,n,o.stories),o.lastReadStoryId&&(e=(0,f.P5)(e,n,o.lastReadStoryId)),(0,a.R3)(e))})),(0,a.iw)("loadPeerPinnedStories",(async(e,t,s)=>{const{peerId:n,offsetId:i}=s,o=(0,v.RGZ)(e,n);if(!o)return;const r=await(0,p.t9)("fetchPeerPinnedStories",{peer:o,offsetId:i});r&&(e=(0,a.Rd)(),e=(0,f.Sh)(e,(0,u.ee)(r.users,"id")),e=(0,f.fZ)(e,(0,u.ee)(r.chats,"id")),e=(0,f._6)(e,n,r.stories),(0,a.R3)(e))})),(0,a.iw)("loadStoriesArchive",(async(e,t,s)=>{const{peerId:n,offsetId:i}=s,o=(0,v.RGZ)(e,n);if(!o)return;const r=await(0,p.t9)("fetchStoriesArchive",{peer:o,offsetId:i});r&&(e=(0,a.Rd)(),e=(0,f.Sh)(e,(0,u.ee)(r.users,"id")),e=(0,f.fZ)(e,(0,u.ee)(r.chats,"id")),e=(0,f._6)(e,n,r.stories,!0),(0,a.R3)(e))})),(0,a.iw)("loadPeerStoriesByIds",(async(e,t,s)=>{const{peerId:n,storyIds:i}=s,o=(0,v.RGZ)(e,n);if(!o)return;const r=await(0,p.t9)("fetchPeerStoriesByIds",{peer:o,ids:i});r&&(e=(0,a.Rd)(),e=(0,f.Sh)(e,(0,u.ee)(r.users,"id")),e=(0,f.fZ)(e,(0,u.ee)(r.chats,"id")),e=(0,f._6)(e,n,r.stories),(0,a.R3)(e))})),(0,a.iw)("loadStoryViews",(async(e,t,s)=>{const{peerId:i,storyId:o,tabId:r=(0,l._w)()}=s,c="isPreload"in s,{offset:d,areReactionsFirst:m,areJustContacts:h,query:g,limit:I}=c?{offset:void 0,areReactionsFirst:void 0,areJustContacts:void 0,query:void 0,limit:n.Ob7}:s,w=(0,v.RGZ)(e,i);if(!w)return;c||(e=(0,f.uS)(e,!0,r),(0,a.R3)(e));const y=await(0,p.t9)("fetchStoryViewList",{peer:w,storyId:o,offset:d,areReactionsFirst:m,areJustContacts:h,limit:I,query:g});if(!y)return e=(0,a.Rd)(),e=(0,f.uS)(e,!1,r),void(0,a.R3)(e);const b=(0,u.ee)(y.views,"userId");if(e=(0,a.Rd)(),e=(0,f.Sh)(e,(0,u.ee)(y.users,"id")),c||(e=(0,f.eB)(e,o,b,y.nextOffset,r)),c&&y.views?.length){const t=y.views.map((e=>e.userId));e=(0,f.w2)(e,i,o,{recentViewerIds:t,viewsCount:y.viewsCount,reactionsCount:y.reactionsCount})}(0,a.R3)(e)})),(0,a.iw)("reportStory",(async(e,t,s)=>{const{peerId:a,storyId:n,reason:i,description:o,tabId:r=(0,l._w)()}=s,c=(0,v.RGZ)(e,a);if(!c)return;const d=await(0,p.t9)("reportStory",{peer:c,storyId:n,reason:i,description:o});t.showNotification({message:d?(0,m.Iu)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later.",tabId:r})})),(0,a.iw)("editStoryPrivacy",((e,t,s)=>{const{peerId:a,storyId:n,privacy:i}=s,o=(0,v.RGZ)(e,a);if(!o)return;const r=[...i.allowUserIds,...i.allowChatIds],c=[...i.blockUserIds,...i.blockChatIds],d=(0,g.wA)(e,{visibility:i.visibility,isUnspecified:i.isUnspecified,allowedIds:r,blockedIds:c});(0,p.t9)("editStoryPrivacy",{peer:o,id:n,privacy:d})})),(0,a.iw)("toggleStoriesHidden",(async(e,t,s)=>{const{peerId:n,isHidden:i}=s,o=(0,v.RGZ)(e,n);o&&await(0,p.t9)("toggleStoriesHidden",{peer:o,isHidden:i})&&(e=(0,a.Rd)(),e=(0,f.QO)(e,n,i),(0,a.R3)(e))})),(0,a.iw)("loadStoriesMaxIds",(async(e,t,s)=>{const{peerIds:n}=s,i=n.map((t=>(0,v.RGZ)(e,t))).filter(Boolean);if(!i.length)return;const o=await(0,p.t9)("fetchStoriesMaxIds",{peers:i});if(!o)return;const r=[];e=(0,a.Rd)(),o.forEach(((t,s)=>{const a=i[s];e=(0,f.GG)(e,a.id,{maxStoryId:t,hasStories:0!==t}),0!==t&&r.push(a.id)})),(0,a.R3)(e),r?.forEach((e=>t.loadPeerStories({peerId:e})))})),(0,a.iw)("sendStoryReaction",(async(e,t,s)=>{const{peerId:n,storyId:i,containerId:o,reaction:r,shouldAddToRecent:c,tabId:d=(0,l._w)()}=s,u=(0,v.RGZ)(e,n);if(!u)return;const m=(0,v.JrV)(e,n,i);if(!m||!("content"in m))return;const h=m.sentReaction;e=(0,f.ed)(e,n,i,r),(0,a.R3)(e),r?t.startActiveReaction({containerId:o,reaction:r,tabId:d}):t.stopActiveReaction({containerId:o,tabId:d});const g=await(0,p.t9)("sendStoryReaction",{peer:u,storyId:i,reaction:r,shouldAddToRecent:c});e=(0,a.Rd)(),g||(e=(0,f.ed)(e,n,i,h)),(0,a.R3)(e)})),(0,a.iw)("activateStealthMode",((e,t,s)=>{const{isForPast:a=!0,isForFuture:n=!0}=s||{};(0,p.t9)("activateStealthMode",{isForPast:a||!0,isForFuture:n||!0})})),(0,a.iw)("openBoostModal",(async(e,t,s)=>{const{chatId:n,tabId:i=(0,l._w)()}=s,o=(0,v.Z1J)(e,n);if(!o||!(0,g.eA)(o))return;e=(0,I.i)(e,{boostModal:{chatId:n}},i),(0,a.R3)(e);const r=await(0,p.t9)("fetchBoostsStatus",{chat:o});if(!r)return void t.closeBoostModal({tabId:i});e=(0,a.Rd)(),e=(0,I.i)(e,{boostModal:{chatId:n,boostStatus:r}},i),(0,a.R3)(e);const c=await(0,p.t9)("fetchCanApplyBoost",{chat:o});if(!c?.info)return;const d=c.info;e=(0,a.Rd)();const m=(0,v.jUK)(e,i);m.boostModal&&(e=(0,f.fZ)(e,(0,u.ee)(c.chats,"id")),e=(0,I.i)(e,{boostModal:{...m.boostModal,applyInfo:d}},i),(0,a.R3)(e))})),(0,a.iw)("openBoostStatistics",(async(e,t,s)=>{const{chatId:n,tabId:i=(0,l._w)()}=s,o=(0,v.Z1J)(e,n);if(!o)return;e=(0,I.i)(e,{boostStatistics:{chatId:n}},i),(0,a.R3)(e);const[r,c]=await Promise.all([(0,p.t9)("fetchBoostersList",{chat:o}),(0,p.t9)("fetchBoostsStatus",{chat:o})]);if(e=(0,a.Rd)(),!r||!c)return e=(0,I.i)(e,{boostStatistics:void 0},i),void(0,a.R3)(e);e=(0,f.Sh)(e,(0,u.ee)(r.users,"id")),e=(0,I.i)(e,{boostStatistics:{chatId:n,boostStatus:c,boosters:r.boosters,boosterIds:r.boosterIds,count:r.count,nextOffset:r.nextOffset}},i),(0,a.R3)(e)})),(0,a.iw)("loadMoreBoosters",(async(e,t,s)=>{const{tabId:n=(0,l._w)()}=s||{};let i=(0,v.jUK)(e,n);if(!i.boostStatistics)return;const o=(0,v.Z1J)(e,i.boostStatistics.chatId);if(!o)return;e=(0,I.i)(e,{boostStatistics:{...i.boostStatistics,isLoadingBoosters:!0}},n),(0,a.R3)(e);const r=await(0,p.t9)("fetchBoostersList",{chat:o,offset:i.boostStatistics.nextOffset});r&&(e=(0,a.Rd)(),e=(0,f.Sh)(e,(0,u.ee)(r.users,"id")),i=(0,v.jUK)(e,n),i.boostStatistics&&(e=(0,I.i)(e,{boostStatistics:{...i.boostStatistics,boosters:{...i.boostStatistics.boosters,...r.boosters},boosterIds:(0,u.Tw)([...i.boostStatistics.boosterIds||[],...r.boosterIds]),count:r.count,nextOffset:r.nextOffset,isLoadingBoosters:!1}},n),(0,a.R3)(e)))})),(0,a.iw)("applyBoost",(async(e,t,s)=>{const{chatId:n,tabId:i=(0,l._w)()}=s,o=(0,v.Z1J)(e,n);if(!o)return;if(!await(0,p.t9)("applyBoost",{chat:o}))return;const r=await(0,p.t9)("fetchBoostsStatus",{chat:o});if(!r)return;e=(0,a.Rd)();const c=(0,v.jUK)(e,i);c.boostModal?.boostStatus&&(e=(0,I.i)(e,{boostModal:{...c.boostModal,boostStatus:r}},i),(0,a.R3)(e))})),s(89005);var Re=s(15780),ke=s(70735);function Te(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),a=1;a<t;a++)s[a-1]=arguments[a];let[n=(0,l._w)()]=s;const{chatId:i,threadId:o}=(0,v.Btg)(e,n)||{};return i&&o?(e=(0,f.qr)(e,i,o,!1,void 0,n),e=(0,f.Pb)(e,i,o,void 0,void 0,void 0,n)):e}(0,a.iw)("openLocalTextSearch",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},{chatId:n,threadId:i}=(0,v.Btg)(e,a)||{};if(n&&i)return(0,f.qr)(e,n,i,!0,void 0,a)})),(0,a.iw)("closeLocalTextSearch",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return Te(e,a)})),(0,a.iw)("setLocalTextSearchQuery",((e,t,s)=>{const{query:a,tabId:n=(0,l._w)()}=s,{chatId:i,threadId:o}=(0,v.Btg)(e,n)||{};if(!i||!o)return;const r=(0,g.uw)(i,o),{query:c}=(0,v.jUK)(e,n).localTextSearch.byChatThreadKey[r]||{};return a!==c&&(e=(0,f.Pb)(e,i,o,ke.D,void 0,void 0,n)),(0,f.qr)(e,i,o,!0,a,n)})),(0,a.iw)("setLocalMediaSearchType",((e,t,s)=>{const{mediaType:a,tabId:n=(0,l._w)()}=s,{chatId:i,threadId:o}=(0,v.Btg)(e,n)||{};if(i&&o)return(0,f.z5)(e,i,o,a,n)})),(0,a.iw)("openChat",((e,t,s)=>{const{id:a,threadId:n=r._f,type:i="thread",shouldReplaceHistory:o=!1,shouldReplaceLast:c=!1,noForumTopicPanel:d,tabId:u=(0,l._w)()}=s,m=(0,v.Btg)(e,u),h=(0,v.jUK)(e,u);if(h.premiumModal?.promo&&h.premiumModal?.isOpen&&(e=(0,I.i)(e,{premiumModal:{...h.premiumModal,isOpen:!1}},u)),m&&m.chatId===a&&m.threadId===n&&m.type===i||(a&&(e=(0,f.O8)(e,a,n,"replyStack",[],u),e=(0,I.i)(e,{activeReactions:{}},u)),e=Te(e=(0,f.i9)(e,u),u),e=(0,I.i)(e,{isStatisticsShown:!1,boostStatistics:void 0,contentToBeScheduled:void 0,...a!==(0,v.jUK)(e,u).forwardMessages.toChatId&&{forwardMessages:{}}},u)),a){const s=(0,v.Z1J)(e,a);s?.isForum&&!d?t.openForumPanel({chatId:a,tabId:u}):a!==(0,v.jUK)(e,u).forumPanelChatId&&t.closeForumPanel({tabId:u})}return t.updatePageTitle({tabId:u}),(0,f.Wy)(e,a,n,i,o,c,u)})),(0,a.iw)("openChatInNewTab",((e,t,s)=>{const{chatId:a,threadId:n=r._f}=s,o=(0,Re.Ex)(a,"thread",n);i.D$?window.electron.openNewWindow(o):window.open(o,"_blank")})),(0,a.iw)("openPreviousChat",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return t.updatePageTitle({tabId:a}),(0,f.Wy)(e,void 0,void 0,void 0,void 0,void 0,a)})),(0,a.iw)("openChatWithInfo",((e,t,s)=>{const{profileTab:n,tabId:i=(0,l._w)()}=s;e=(0,I.i)(e,{...(0,v.jUK)(e,i),isChatInfoShown:!0,nextProfileTab:n},i),e={...e,lastIsChatInfoShown:!0},(0,a.R3)(e),t.openChat({...s,tabId:i})})),(0,a.iw)("openChatWithDraft",((e,t,s)=>{const{chatId:a,text:n,threadId:i,files:o,filter:r,tabId:c=(0,l._w)()}=s;return a&&t.openChat({id:a,threadId:i,tabId:c}),(0,I.i)(e,{requestedDraft:{chatId:a,text:n,files:o,filter:r}},c)})),(0,a.iw)("resetChatCreation",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{chatCreation:void 0},a)})),(0,a.iw)("setNewChatMembersDialogState",((e,t,s)=>{const{newChatMembersProgress:a,tabId:n=(0,l._w)()}=s;return(0,I.i)(e,{newChatMembersProgress:a},n)})),(0,a.iw)("openNextChat",((e,t,s)=>{const{targetIndexDelta:a,orderedIds:n,tabId:i=(0,l._w)()}=s,{chatId:o}=(0,v.Btg)(e,i)||{};if(!o)return void t.openChat({id:n[0],tabId:i});const r=n.indexOf(o);if(-1===r)return;const c=n[r+a];t.openChat({id:c,shouldReplaceHistory:!0,tabId:i})})),(0,a.iw)("closeDeleteChatFolderModal",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{deleteFolderDialogModal:void 0},a)})),(0,a.iw)("closeChatlistModal",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{chatlistModal:void 0},a)})),(0,a.iw)("requestChatTranslation",((e,t,s)=>{const{chatId:a,toLanguageCode:n,tabId:i=(0,l._w)()}=s;return(0,f.LV)(e,a,n,i)}));var Ae=s(64319),Ne=s(83099),Be=s(996),xe=s(42986);const Le=n.ckE+n.fK3;let Ue;function Oe(e,t,s){const{type:a,threadId:n}=(0,v.Btg)(e)||{},i=m.Iu,o=(0,v.Z1J)(e,t),r="scheduled"===a?(0,v.yBV)(e,t):(0,v.Zwk)(e,t);if(!o||!r||!n)return;const c=s.map((e=>r[e])).filter((t=>(0,v._kf)(e,t,n).canCopy)).sort(((e,t)=>e.id-t.id)),d=[],l=[];c.forEach((t=>{const s=(0,g.eA)(o)?o:(0,v.Urc)(e,t),a=`> ${s?(0,g.OU)(i,s):t.forwardInfo?.hiddenUserName||""}:`;d.push(a),d.push(`${function(e,t){const s=(0,xe.Eb)(t),a=s?`${s} `:"",n=(0,Be.X)({message:t,shouldRenderAsHtml:!0})?.join("");return`${a}${(0,xe.Kk)(e,t,n,!0)}`}(i,t)}\n`),l.push(a),l.push(`${(0,g.MK)(i,t,!1,0,!0)}\n`)})),(0,Ae.qN)(d.join("\n"),l.join("\n"))}(0,a.iw)("setScrollOffset",((e,t,s)=>{const{chatId:a,threadId:n,scrollOffset:i,tabId:o=(0,l._w)()}=s;return e=(0,f.pf)(e,a,n,"lastScrollOffset",i),(0,f.O8)(e,a,n,"scrollOffset",i,o)})),(0,a.iw)("setReplyingToId",((e,t,s)=>{const{messageId:a,tabId:n=(0,l._w)()}=s,i=(0,v.Btg)(e,n);if(!i)return;const{chatId:o,threadId:r}=i;return(0,f.pf)(e,o,r,"replyingToId",a)})),(0,a.iw)("setEditingId",((e,t,s)=>{const{messageId:a,tabId:n=(0,l._w)()}=s,i=(0,v.Btg)(e,n);if(!i)return;const{chatId:o,threadId:r,type:c}=i,d="scheduled"===c?"editingScheduledId":"editingId";return(0,f.pf)(e,o,r,d,a)})),(0,a.iw)("setEditingDraft",((e,t,s)=>{const{text:a,chatId:n,threadId:i,type:o}=s,r="scheduled"===o?"editingScheduledDraft":"editingDraft";return(0,f.pf)(e,n,i,r,a)})),(0,a.iw)("editLastMessage",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},{chatId:n,threadId:i}=(0,v.Btg)(e,a)||{};if(!n||!i)return;const o=(0,v.Zwk)(e,n),r=(0,v.Cbz)(e,n,i,a);if(!o||!r)return;const c=(0,u.dF)(r,(t=>Boolean(o[t]&&(0,v._kf)(e,o[t],i).canEdit)));return c?(0,f.pf)(e,n,i,"editingId",c):void 0})),(0,a.iw)("replyToNextMessage",((e,t,s)=>{const{targetIndexDelta:a,tabId:n=(0,l._w)()}=s,{chatId:i,threadId:o}=(0,v.Btg)(e,n)||{};if(!i||!o)return;const c=(0,v.Zwk)(e,i),d=(0,v.Cbz)(e,i,o,n);if(!c||!d)return;const u=(0,v.Yyv)(e,i,o);let m;if((0,v.b9T)(e,i,o,n)&&u){const e=Object.keys(c),t=e.indexOf(u.toString())+a;m=t<=e.length+1&&t>=0?Number(e[t]):void 0}else if(o===r._f){const t=(0,v.Z1J)(e,i);m=t?.lastMessage?.id}else{const t=(0,v.tZg)(e,i,o);m=t?.lastMessageId}t.setReplyingToId({messageId:m,tabId:n}),t.focusMessage({chatId:i,threadId:o,messageId:m,tabId:n})})),(0,a.iw)("openAudioPlayer",((e,t,s)=>{const{chatId:a,threadId:n,messageId:i,origin:o,volume:r,playbackRate:c,isMuted:d,tabId:u=(0,l._w)()}=s,m=(0,v.jUK)(e,u);return(0,I.i)(e,{audioPlayer:{chatId:a,threadId:n,messageId:i,origin:o??m.audioPlayer.origin,volume:r??m.audioPlayer.volume,playbackRate:c||m.audioPlayer.playbackRate||e.audioPlayer.lastPlaybackRate,isPlaybackRateActive:void 0===m.audioPlayer.isPlaybackRateActive?e.audioPlayer.isLastPlaybackRateActive:m.audioPlayer.isPlaybackRateActive,isMuted:d||m.audioPlayer.isMuted}},u)})),(0,a.iw)("setAudioPlayerVolume",((e,t,s)=>{const{volume:a,tabId:n=(0,l._w)()}=s;return(0,I.i)(e,{audioPlayer:{...(0,v.jUK)(e,n).audioPlayer,volume:a,isMuted:!1}},n)})),(0,a.iw)("setAudioPlayerPlaybackRate",((e,t,s)=>{const{playbackRate:a,isPlaybackRateActive:n,tabId:i=(0,l._w)()}=s;return e={...e,audioPlayer:{...e.audioPlayer,lastPlaybackRate:a,isLastPlaybackRateActive:n}},(0,I.i)(e,{audioPlayer:{...(0,v.jUK)(e,i).audioPlayer,playbackRate:a,isPlaybackRateActive:n}},i)})),(0,a.iw)("setAudioPlayerMuted",((e,t,s)=>{const{isMuted:a,tabId:n=(0,l._w)()}=s;return(0,I.i)(e,{audioPlayer:{...(0,v.jUK)(e,n).audioPlayer,isMuted:a}},n)})),(0,a.iw)("setAudioPlayerOrigin",((e,t,s)=>{const{origin:a,tabId:n=(0,l._w)()}=s;return(0,I.i)(e,{audioPlayer:{...(0,v.jUK)(e,n).audioPlayer,origin:a}},n)})),(0,a.iw)("closeAudioPlayer",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},n=(0,v.jUK)(e,a);return(0,I.i)(e,{audioPlayer:{volume:n.audioPlayer.volume,playbackRate:n.audioPlayer.playbackRate,isPlaybackRateActive:n.audioPlayer.isPlaybackRateActive,isMuted:n.audioPlayer.isMuted}},a)})),(0,a.iw)("openPollResults",((e,t,s)=>{const{chatId:n,messageId:i,tabId:o=(0,l._w)()}=s,r=(0,v.Jf5)(e,(0,T.W7)(),o),c=(0,v.jUK)(e,o);if(r){if(n!==c.pollResults.chatId||i!==c.pollResults.messageId)return(0,I.i)(e,{pollResults:{chatId:n,messageId:i,voters:{}}},o)}else window.setTimeout((()=>{e=(0,a.Rd)(),e=(0,I.i)(e,{pollResults:{chatId:n,messageId:i,voters:{}}},o),(0,a.R3)(e)}),450)})),(0,a.iw)("closePollResults",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{pollResults:{}},a)})),(0,a.iw)("focusLastMessage",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},n=(0,v.Btg)(e,a);if(!n)return;const{chatId:i,threadId:o,type:c}=n;let d;if(o===r._f)if("pinned"===c){const t=(0,v.KBA)(e,i,r._f);if(!t?.length)return;d=t[t.length-1]}else{const t=(0,v.Z1J)(e,i);d=t?.lastMessage?.id}else{const t=(0,v.tZg)(e,i,o);d=t?.lastMessageId}d&&t.focusMessage({chatId:i,threadId:o,messageListType:c,messageId:d,noHighlight:!0,noForumTopicPanel:!0,tabId:a})})),(0,a.iw)("focusNextReply",((e,t,s)=>{const{tabId:n=(0,l._w)()}=s||{},i=(0,v.Btg)(e,n);if(!i)return;const{chatId:o,threadId:r}=i,c=(0,v.p9o)(e,o,r,n);if(c&&0!==c.length){const s=c.pop();e=(0,f.O8)(e,o,r,"replyStack",[...c],n),(0,a.R3)(e),t.focusMessage({chatId:o,threadId:r,messageId:s,tabId:n,noForumTopicPanel:!0})}else t.focusLastMessage({tabId:n})})),(0,a.iw)("focusMessage",((e,t,s)=>{const{chatId:n,threadId:i=r._f,messageListType:o="thread",noHighlight:d,groupedId:m,groupedChatId:h,replyMessageId:p,isResizingContainer:g,shouldReplaceHistory:I,noForumTopicPanel:w,tabId:y=(0,l._w)()}=s;let{messageId:b}=s;if(void 0!==m){const t=(0,v.y84)(e,h,m);t?.length&&([b]=(0,u.oA)(t))}const P=(0,v.Btg)(e,y),Z=!P||n!==P.chatId||i!==P.threadId||o!==P.type;if(Ue&&(clearTimeout(Ue),Ue=void 0),Ue=window.setTimeout((()=>{e=(0,a.Rd)(),e=(0,f.cq)(e,void 0,void 0,void 0,void 0,void 0,y),e=(0,f.wV)(e,void 0,y),(0,a.R3)(e)}),d?Le:1500),e=(0,f.cq)(e,n,b,i,d,g,y),e=(0,f.wV)(e,void 0,y),p){const t=(0,v.p9o)(e,n,i,y)||[];e=(0,f.O8)(e,n,i,"replyStack",[...t,p],y)}Z&&(e=(0,f.wV)(e,c.fo.Static,y));const S=(0,v.Cbz)(e,n,i,y);if(S&&S.includes(b))return(0,a.R3)(e,{forceOnHeavyAnimation:!0}),void t.openChat({id:n,threadId:i,type:o,shouldReplaceHistory:I,noForumTopicPanel:w,tabId:y});if(Z&&(e=(0,f.O8)(e,n,i,"viewportIds",void 0,y)),S&&!Z){const t=b>S[0]?c.fo.Down:c.fo.Up;e=(0,f.wV)(e,t,y)}(0,a.R3)(e,{forceOnHeavyAnimation:!0}),t.openChat({id:n,threadId:i,type:o,shouldReplaceHistory:I,noForumTopicPanel:w,tabId:y}),t.loadViewportMessages({tabId:y,shouldForceRender:!0})})),(0,a.iw)("openForwardMenu",((e,t,s)=>{const{fromChatId:a,messageIds:n,storyId:i,groupedId:o,withMyScore:r,tabId:c=(0,l._w)()}=s;let d;return o&&(d=(0,v.xHX)(e,a,o)),(0,I.i)(e,{forwardMessages:{fromChatId:a,messageIds:d||n,storyId:i,isModalShown:!0,withMyScore:r}},c)})),(0,a.iw)("changeForwardRecipient",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{forwardMessages:{...(0,v.jUK)(e,a).forwardMessages,toChatId:void 0,isModalShown:!0,noAuthors:!1,noCaptions:!1}},a)})),(0,a.iw)("setForwardNoAuthors",((e,t,s)=>{const{noAuthors:a,tabId:n=(0,l._w)()}=s,i=(0,v.jUK)(e,n);return(0,I.i)(e,{forwardMessages:{...i.forwardMessages,noAuthors:a,noCaptions:a&&i.forwardMessages.noCaptions}},n)})),(0,a.iw)("setForwardNoCaptions",((e,t,s)=>{const{noCaptions:a,tabId:n=(0,l._w)()}=s;return(0,I.i)(e,{forwardMessages:{...(0,v.jUK)(e,n).forwardMessages,noCaptions:a,noAuthors:a}},n)})),(0,a.iw)("exitForwardMode",((e,t,s)=>{const{tabId:n=(0,l._w)()}=s||{};e=(0,I.i)(e,{forwardMessages:{}},n),(0,a.R3)(e)})),(0,a.iw)("openForwardMenuForSelectedMessages",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},n=(0,v.jUK)(e,a);if(!n.selectedMessages)return;const{chatId:i,messageIds:o}=n.selectedMessages;t.openForwardMenu({fromChatId:i,messageIds:o,tabId:a})})),(0,a.iw)("cancelMessageMediaDownload",((e,t,s)=>{const{message:a,tabId:n=(0,l._w)()}=s;return(0,f.wI)(e,a,n)})),(0,a.iw)("cancelMessagesMediaDownload",((e,t,s)=>{const{messages:a,tabId:n=(0,l._w)()}=s;for(const t of a)e=(0,f.wI)(e,t,n);return e})),(0,a.iw)("downloadMessageMedia",((e,t,s)=>{const{message:a,tabId:n=(0,l._w)()}=s;return(0,f.fC)(e,a,n)})),(0,a.iw)("downloadSelectedMessages",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},n=(0,v.jUK)(e,a);if(!n.selectedMessages)return;const{chatId:i,messageIds:o}=n.selectedMessages,{threadId:r}=(0,v.Btg)(e,a)||{},c=(0,v.Zwk)(e,i);c&&r&&o.map((e=>c[e])).filter((t=>(0,v._kf)(e,t,r).canDownload)).forEach((e=>t.downloadMessageMedia({message:e,tabId:a})))})),(0,a.iw)("enterMessageSelectMode",((e,t,s)=>{const{messageId:a,tabId:n=(0,l._w)()}=s||{},i=(0,v.jrE)(e,n);return i?(0,f.M6)(e,i.id,a,n):e})),(0,a.iw)("toggleMessageSelection",((e,t,s)=>{const{messageId:n,groupedId:o,childMessageIds:r,withShift:c,tabId:d=(0,l._w)()}=s,u=(0,v.Btg)(e,d);if(!u)return;const{chatId:m,threadId:h,type:p}=u;e=(0,f.Ob)(e,m,h,p,n,o,r,c,d),(0,a.R3)(e),e.shouldShowContextMenuHint&&(t.disableContextMenuHint(),t.showNotification({message:`To **edit** or **reply**, close this menu. Then ${i.$b?"long tap":"right click"} on a message.`,tabId:d}))})),(0,a.iw)("disableContextMenuHint",(e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}})),(0,a.iw)("exitMessageSelectMode",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,f.i9)(e,a)})),(0,a.iw)("openPollModal",((e,t,s)=>{const{isQuiz:a,tabId:n=(0,l._w)()}=s||{};return(0,I.i)(e,{pollModal:{isOpen:!0,isQuiz:a}},n)})),(0,a.iw)("closePollModal",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{pollModal:{isOpen:!1}},a)})),(0,a.iw)("checkVersionNotification",((e,t)=>{if(n.V61&&Date.now()>Number(n.V61)+2592e5)return;const s="10.0.14".split(".").slice(0,2).join("."),{serviceNotifications:a}=e;if(a.find((e=>{let{version:t}=e;return t===s})))return;const i={chatId:n.awM,date:(0,ue.bp)(),content:{text:(0,Ne.ZP)("**Introducing Telegram Web A v10.0!**\n\nToday marks a special occasion. Telegram is celebrating its 10th anniversary! In honor of this milestone, and to highlight our web version's long-awaited parity with the native apps, we've leaped from version 1.x straight to 10.0. Big day!\n\n🌟 **Stories on Telegram**\nIntroducing [Telegram Stories](https://t.me/durov/216) - share moments of your life, beyond just text.\n\n💻 **Desktop Version**\nAn experimental standalone version is now available for enthusiasts and early adopters on all desktop platforms: **[web.telegram.org/a/get](https://web.telegram.org/a/get)**.\n\n🚀 **Massive Connection Improvements**\nWeb A is now more optimized – ensuring speedy and seamless conversations. Less loading, more chatting.\n\n🎙️ **Redesigned Group Calls**\nGroup calls have been overhauled to bring exceptional clarity, connectivity, and functionality.\n\n🌍 **Real-Time Translation**\nPremium users can tap to translate entire chats, dynamically updating as they scroll.\n\n⏱️ **Custom Mute Durations**\nNotifications from any chat can be temporarily muted for a specific period – like hours, days, or weeks.\n\n🔖 **Read Time in Groups**\nYou can see at what time other members read your message in the 'Seen By' section.\n\n😄 **Emoji v15 Support**\nWeb A now supports the latest from Emoji v15, so you can express yourself fully.\n\n🎨 **Dynamic Sticker Packs**\nDynamic order for your sticker packs can be toggled on or off – whichever you prefer.\n\n🚀 **Performance Upgrades**\nWe've implemented multiple memory and performance optimizations for a smoother, faster, more efficient Telegram experience.\n\n🔧 **Fixes & Improvements**\nWe've patched several problems, including issues with sending messages while uploading files, freezes while scrolling, and messages incorrectly marking as read with Web A in the background. See if you can spot the host of UI refinements we added as well.😉\n\n📱 **More for iPad Users**\niPad users, we heard you! Web A now has improved iPad support.\n\nThank you for being with us. Here's to the next decade together! 🎉🥳\n\n🦄 **We also welcome** you to join our official channels in **[English](https://t.me/webachannel)** and **[Russian](https://t.me/webachannelru)** — where we post app updates and share our experiences building one of the world’s most feature-rich web applications.\n",!0)},isOutgoing:!1};t.createServiceNotification({message:i,version:s})})),(0,a.iw)("createServiceNotification",((e,t,s)=>{const{message:i,version:o}=s,{serviceNotifications:r}=e,c=(0,v.Z1J)(e,n.awM),d=Math.max(c.lastMessage?.id||0,...r.map((e=>{let{id:t}=e;return t}))),l=(r.length+1)/1e3,u=Math.floor(d)+l;i.previousLocalId=i.id,i.id=u;const m={id:u,message:i,version:o,isUnread:!0};e={...e,serviceNotifications:[...r.slice(-1e3),m]},(0,a.R3)(e),t.apiUpdate({"@type":"newMessage",id:i.id,chatId:i.chatId,message:i})})),(0,a.iw)("openReactorListModal",((e,t,s)=>{const{chatId:a,messageId:n,tabId:i=(0,l._w)()}=s;return(0,I.i)(e,{reactorModal:{chatId:a,messageId:n}},i)})),(0,a.iw)("closeReactorListModal",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{reactorModal:void 0},a)})),(0,a.iw)("openSeenByModal",((e,t,s)=>{const{chatId:a,messageId:n,tabId:i=(0,l._w)()}=s;return(0,I.i)(e,{seenByModal:{chatId:a,messageId:n}},i)})),(0,a.iw)("closeSeenByModal",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{seenByModal:void 0},a)})),(0,a.iw)("openChatLanguageModal",((e,t,s)=>{const{chatId:a,messageId:n,tabId:i=(0,l._w)()}=s,o=n?(0,v.Bdn)(e,a,n,i):(0,v.lpX)(e,a,i);return(0,I.i)(e,{chatLanguageModal:{chatId:a,messageId:n,activeLanguage:o}},i)})),(0,a.iw)("closeChatLanguageModal",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{chatLanguageModal:void 0},a)})),(0,a.iw)("copySelectedMessages",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},n=(0,v.jUK)(e,a);if(!n.selectedMessages)return;const{chatId:i,messageIds:o}=n.selectedMessages;Oe(e,i,o)})),(0,a.iw)("copyMessagesByIds",((e,t,s)=>{const{messageIds:a,tabId:n=(0,l._w)()}=s,i=(0,v.jrE)(e,n);a&&0!==a.length&&i&&Oe(e,i.id,a)})),(0,a.iw)("setGlobalSearchQuery",((e,t,s)=>{const{query:a,tabId:n=(0,l._w)()}=s,{chatId:i}=(0,v.jUK)(e,n).globalSearch;return(0,f.No)(e,{globalResults:{},localResults:{},resultsByType:void 0,...a?{fetchingStatus:{chats:!i,messages:!0}}:{fetchingStatus:void 0},query:a},n)})),(0,a.iw)("setGlobalSearchClosing",((e,t,s)=>{const{tabId:a=(0,l._w)(),isClosing:n}=s||{};return(0,f.No)(e,{isClosing:n},a)})),(0,a.iw)("addRecentlyFoundChatId",((e,t,s)=>{const{id:a}=s,{recentlyFoundChatIds:n}=e;if(!n)return{...e,recentlyFoundChatIds:[a]};const i=n.filter((e=>e!==a));return i.unshift(a),i.length>10&&i.pop(),{...e,recentlyFoundChatIds:i}})),(0,a.iw)("clearRecentlyFoundChats",(e=>({...e,recentlyFoundChatIds:void 0}))),(0,a.iw)("setGlobalSearchContent",((e,t,s)=>{const{content:a,tabId:n=(0,l._w)()}=s;return(0,f.Og)(e,a,n)})),(0,a.iw)("setGlobalSearchChatId",((e,t,s)=>{const{id:a,tabId:n=(0,l._w)()}=s;return(0,f.No)(e,{chatId:a,query:void 0,resultsByType:void 0},n)})),(0,a.iw)("setStickerSearchQuery",((e,t,s)=>{const{query:a,tabId:n=(0,l._w)()}=s;return(0,I.i)(e,{stickerSearch:{query:a,resultIds:void 0}},n)})),(0,a.iw)("setGifSearchQuery",((e,t,s)=>{const{query:a,tabId:n=(0,l._w)()}=s;return(0,I.i)(e,{gifSearch:{query:a,offset:void 0,results:void 0}},n)})),(0,a.iw)("setUserSearchQuery",((e,t,s)=>{const{query:a,tabId:n=(0,l._w)()}=s;return(0,f.Lm)(e,{globalUserIds:void 0,localUserIds:void 0,fetchingStatus:Boolean(a),query:a},n)})),(0,a.iw)("openAddContactDialog",((e,t,s)=>{const{userId:a,tabId:n=(0,l._w)()}=s;return(0,I.i)(e,{newContact:{userId:a}},n)})),(0,a.iw)("openNewContactDialog",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{newContact:{isByPhoneNumber:!0}},a)})),(0,a.iw)("closeNewContactDialog",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,f.ft)(e,a)})),s(73456);var je=s(69995);const _e=/^\d+\.\d+(\.\d+)?$/;var Fe=s(91947);function De(e){document.querySelectorAll('link[rel="icon"], link[rel="alternate 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")}))}function qe(e){i.D$?window.electron.setWindowTitle(e):document.title!==e&&(document.title=e)}const Ge=(0,h.Ds)(qe,200,!1);let He,Ve;(0,a.iw)("toggleChatInfo",((e,t,s)=>{const{force:a,tabId:n=(0,l._w)()}=s||{},i=void 0!==a?a:!(0,v.jUK)(e,n).isChatInfoShown;return e=(0,I.i)(e,{isChatInfoShown:i},n),{...e,lastIsChatInfoShown:i}})),(0,a.iw)("setLeftColumnWidth",((e,t,s)=>{const{leftColumnWidth:a}=s;return{...e,leftColumnWidth:a}})),(0,a.iw)("resetLeftColumnWidth",(e=>({...e,leftColumnWidth:void 0}))),(0,a.iw)("toggleManagement",((e,t,s)=>{const{force:a,tabId:n=(0,l._w)()}=s||{},{chatId:i}=(0,v.Btg)(e,n)||{};if(!i)return;const o=(0,v.jUK)(e,n);return(0,I.i)(e,{management:{byChatId:{...o.management.byChatId,[i]:{...o.management.byChatId[i],isActive:void 0!==a?a:!(o.management.byChatId[i]||{}).isActive}}}},n)})),(0,a.iw)("requestNextManagementScreen",((e,t,s)=>{const{screen:a,tabId:n=(0,l._w)()}=s||{},{chatId:i}=(0,v.Btg)(e,n)||{};if(!i)return;const o=(0,v.jUK)(e,n);return(0,I.i)(e,{management:{byChatId:{...o.management.byChatId,[i]:{...o.management.byChatId[i],isActive:!0,nextScreen:a}}}},n)})),(0,a.iw)("closeManagement",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},{chatId:n}=(0,v.Btg)(e,a)||{};if(!n)return;const i=(0,v.jUK)(e,a);return(0,I.i)(e,{management:{byChatId:{...i.management.byChatId,[n]:{...i.management.byChatId[n],isActive:!1}}}},a)})),(0,a.iw)("openChat",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s;if((0,T.W7)()||(0,T.c9)())return(0,I.i)(e,{isLeftColumnShown:0===(0,v.jUK)(e,a).messageLists.length},a)})),(0,a.iw)("resetNextProfileTab",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},{chatId:n}=(0,v.Btg)(e,a)||{};if(n)return(0,I.i)(e,{nextProfileTab:void 0},a)})),(0,a.iw)("toggleStatistics",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},n=(0,v.jUK)(e,a);return(0,I.i)(e,{isStatisticsShown:!n.isStatisticsShown,statistics:{...n.statistics,currentMessageId:void 0}},a)})),(0,a.iw)("toggleMessageStatistics",((e,t,s)=>{const{tabId:a=(0,l._w)(),messageId:n}=s||{};return(0,I.i)(e,{statistics:{...(0,v.jUK)(e,a).statistics,currentMessageId:n}},a)})),(0,a.iw)("toggleLeftColumn",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{isLeftColumnShown:!(0,v.jUK)(e,a).isLeftColumnShown},a)})),(0,a.iw)("addRecentEmoji",((e,t,s)=>{const{emoji:a}=s,{recentEmojis:n}=e;if(!n)return{...e,recentEmojis:[a]};const i=n.filter((e=>e!==a));return i.unshift(a),i.length>32&&i.pop(),{...e,recentEmojis:i}})),(0,a.iw)("addRecentSticker",((e,t,s)=>{const{sticker:a}=s,{recent:n}=e.stickers;if(!n)return{...e,stickers:{...e.stickers,recent:{hash:"0",stickers:[a]}}};const i=n.stickers.filter((e=>e.id!==a.id));return i.unshift(a),{...e,stickers:{...e.stickers,recent:{...n,stickers:i}}}})),(0,a.iw)("addRecentCustomEmoji",((e,t,s)=>{const{documentId:a}=s,{recentCustomEmojis:n}=e;if(!n)return{...e,recentCustomEmojis:[a]};const i=n.filter((e=>e!==a));return i.unshift(a),i.length>32&&i.pop(),{...e,recentCustomEmojis:i}})),(0,a.iw)("clearRecentCustomEmoji",(e=>({...e,recentCustomEmojis:[]}))),(0,a.iw)("reorderStickerSets",((e,t,s)=>{const{order:a,isCustomEmoji:n}=s;return{...e,stickers:{...e.stickers,added:{setIds:n?e.stickers.added.setIds:a}},customEmojis:{...e.customEmojis,added:{setIds:n?a:e.customEmojis.added.setIds}}}})),(0,a.iw)("showNotification",((e,t,s)=>{const{tabId:a=(0,l._w)(),...n}=s;n.localId=(0,je.Z)();const i=[...(0,v.jUK)(e,a).notifications],o=i.findIndex((e=>e.message===n.message));return-1!==o&&i.splice(o,1),i.push(n),(0,I.i)(e,{notifications:i},a)})),(0,a.iw)("showAllowedMessageTypesNotification",((e,t,s)=>{const{chatId:a,tabId:n=(0,l._w)()}=s,i=(0,v.Z1J)(e,a);if(!i)return;const{canSendPlainText:o,canSendPhotos:r,canSendVideos:c,canSendDocuments:d,canSendAudios:h,canSendStickers:p,canSendRoundVideos:f,canSendVoices:I}=(0,g.H5)(i),w=(0,u.oA)([o?"Chat.SendAllowedContentTypeText":void 0,r?"Chat.SendAllowedContentTypePhoto":void 0,c?"Chat.SendAllowedContentTypeVideo":void 0,I?"Chat.SendAllowedContentTypeVoiceMessage":void 0,f?"Chat.SendAllowedContentTypeVideoMessage":void 0,d?"Chat.SendAllowedContentTypeFile":void 0,h?"Chat.SendAllowedContentTypeMusic":void 0,p?"Chat.SendAllowedContentTypeSticker":void 0]).map((e=>m.Iu(e)));if(!w.length)return void t.showNotification({message:m.Iu("Chat.SendNotAllowedText"),tabId:n});const y=m.Iu("AutoDownloadSettings.LastDelimeter"),b=w.join(", ").replace(/,([^,]*)$/,`${y}$1`);t.showNotification({message:m.Iu("Chat.SendAllowedContentText",b),tabId:n})})),(0,a.iw)("dismissNotification",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s,n=(0,v.jUK)(e,a).notifications.filter((e=>{let{localId:t}=e;return t!==s.localId}));return(0,I.i)(e,{notifications:n},a)})),(0,a.iw)("showDialog",((e,t,s)=>{const{data:a,tabId:n=(0,l._w)()}=s;if("message"in a&&a.hasErrorKey&&!(0,Fe.ZP)(a))return e;const i=[...(0,v.jUK)(e,n).dialogs];if("message"in a){const e=i.findIndex((e=>e.message===a.message));-1!==e&&i.splice(e,1)}return i.push(a),(0,I.i)(e,{dialogs:i},n)})),(0,a.iw)("dismissDialog",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},n=[...(0,v.jUK)(e,a).dialogs];return n.pop(),(0,I.i)(e,{dialogs:n},a)})),(0,a.iw)("toggleSafeLinkModal",((e,t,s)=>{const{url:a,tabId:n=(0,l._w)()}=s;return(0,I.i)(e,{safeLinkModalUrl:a},n)})),(0,a.iw)("openHistoryCalendar",((e,t,s)=>{const{selectedAt:a,tabId:n=(0,l._w)()}=s;return(0,I.i)(e,{historyCalendarSelectedAt:a},n)})),(0,a.iw)("closeHistoryCalendar",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{historyCalendarSelectedAt:void 0},a)})),(0,a.iw)("openGame",((e,t,s)=>{const{url:n,chatId:i,messageId:o,tabId:r=(0,l._w)()}=s,c=(0,v.hjO)(e,i,o);if(!c)return;const d=c.viaBotId||c.senderId;if(d){if(!(0,v.LM9)(e,d))return e=(0,I.i)(e,{botTrustRequest:{botId:d,type:"game",onConfirm:{action:"openGame",payload:s}}},r),void(0,a.R3)(e);e=(0,I.i)(e,{openedGame:{url:n,chatId:i,messageId:o}},r),(0,a.R3)(e)}})),(0,a.iw)("closeGame",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{openedGame:void 0},a)})),(0,a.iw)("requestConfetti",((e,t,s)=>{const{top:a,left:n,width:i,height:o,tabId:r=(0,l._w)()}=s||{};if((0,v.FOo)(e))return(0,I.i)(e,{confetti:{lastConfettiTime:Date.now(),top:a,left:n,width:i,height:o}},r)})),(0,a.iw)("updateAttachmentSettings",((e,t,s)=>{const{shouldCompress:a,shouldSendGrouped:n}=s;return{...e,attachmentSettings:{shouldCompress:a??e.attachmentSettings.shouldCompress,shouldSendGrouped:n??e.attachmentSettings.shouldSendGrouped}}})),(0,a.iw)("openLimitReachedModal",((e,t,s)=>{const{limit:a,tabId:n=(0,l._w)()}=s;return(0,I.i)(e,{limitReachedModal:{limit:a}},n)})),(0,a.iw)("closeLimitReachedModal",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{limitReachedModal:void 0},a)})),(0,a.iw)("closeStickerSetModal",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{openedStickerSetShortName:void 0},a)})),(0,a.iw)("openCustomEmojiSets",((e,t,s)=>{const{setIds:a,tabId:n=(0,l._w)()}=s;return(0,I.i)(e,{openedCustomEmojiSetIds:a},n)})),(0,a.iw)("closeCustomEmojiSets",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{openedCustomEmojiSetIds:void 0},a)})),(0,a.iw)("updateLastRenderedCustomEmojis",((e,t,s)=>{const{ids:a}=s,{lastRendered:i}=e.customEmojis;return{...e,customEmojis:{...e.customEmojis,lastRendered:(0,u.Tw)([...i,...a]).slice(0,n.j7i)}}})),(0,a.iw)("openCreateTopicPanel",((e,t,s)=>{const{chatId:a,tabId:n=(0,l._w)()}=s;return(0,v.jrE)(e,n)||t.openChat({id:a,threadId:r._f,tabId:n}),(0,I.i)(e,{createTopicPanel:{chatId:a}},n)})),(0,a.iw)("closeCreateTopicPanel",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{createTopicPanel:void 0},a)})),(0,a.iw)("openEditTopicPanel",((e,t,s)=>{const{chatId:a,topicId:n,tabId:i=(0,l._w)()}=s;return(0,v.jrE)(e,i)||t.openChat({id:a,tabId:i}),(0,I.i)(e,{editTopicPanel:{chatId:a,topicId:n}},i)})),(0,a.iw)("closeEditTopicPanel",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{editTopicPanel:void 0},a)})),(0,a.iw)("updateArchiveSettings",((e,t,s)=>{const{archiveSettings:a}=e,{isHidden:n=a.isHidden,isMinimized:i=a.isMinimized}=s;return{...e,archiveSettings:{isHidden:n,isMinimized:i}}})),(0,a.iw)("openMapModal",((e,t,s)=>{const{geoPoint:a,zoom:n,tabId:i=(0,l._w)()}=s;return(0,I.i)(e,{mapModal:{point:a,zoom:n}},i)})),(0,a.iw)("closeMapModal",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{mapModal:void 0},a)})),(0,a.iw)("checkAppVersion",(e=>{fetch(`version.txt?${Date.now()}`).then((e=>e.text())).then((t=>{var s;s=t=t.trim(),_e.test(s)&&"10.0.14"!==s&&(e=(0,a.Rd)(),e={...e,isAppUpdateAvailable:!0},(0,a.R3)(e))})).catch((e=>{n.eMD&&console.error("[checkAppVersion failed] ",e)}))})),(0,a.iw)("setIsElectronUpdateAvailable",((e,t,s)=>{e=(0,a.Rd)(),e={...e,isElectronUpdateAvailable:Boolean(s)},(0,a.R3)(e)})),(0,a.iw)("afterHangUp",(e=>{(0,v.jUK)(e,(0,l._w)()).multitabNextAction&&(0,l.g)()})),(0,a.iw)("onTabFocusChange",((e,t,s)=>{const{isBlurred:a,tabId:n=(0,l._w)()}=s;return a?(He&&clearInterval(He),He=window.setInterval((()=>{t.updatePageTitle({tabId:n})}),500)):(clearInterval(He),He=void 0),e=(0,I.i)(e,{isBlurred:a},n),{...e,initialUnreadNotifications:a?(0,ce.xW)():void 0}})),(0,a.iw)("updatePageTitle",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},{canDisplayChatInTitle:o}=e.settings.byKey,r=e.currentUserId;if(document.title.includes(n.ouc))return De(!1),void qe(`${n.Tih} ${n.ouc}`);if(e.initialUnreadNotifications&&Math.round(Date.now()/1e3)%2==0){const t=(0,ce.xW)()-e.initialUnreadNotifications;if(t>0)return qe(`${t} notification${t>1?"s":""}`),void De(!0)}De(!1);const c=(0,v.Btg)(e,a);if(c&&o&&!e.passcode.isScreenLocked){const{chatId:t,threadId:s}=c,a=(0,v.Z1J)(e,t);if(a){const e=(0,g.U)(m.Iu,a,t===r);return a.isForum&&a.topics?.[s]?void Ge(`${e} › ${a.topics[s].title}`):void Ge(e)}}qe(i.D$?"":n.Tih)}));let $e,Je=0;(0,re.ll)((e=>{const{updatePageTitle:t,updateIsOnline:s}=(0,a.Sv)(),n=e.passcode.isScreenLocked!==Ve,i=Object.values(e.byTabId).filter((e=>e.isBlurred)).length,o=(0,v.jUK)(e,(0,l._w)()).isMasterTab;n&&t(),i!==Je&&o&&($e&&clearTimeout($e),$e=window.setTimeout((()=>{e=(0,a.Rd)();const t=Object.values(e.byTabId).filter((e=>e.isBlurred)).length;s(t!==(0,l.s1)().length)}),100)),Ve=e.passcode.isScreenLocked,Je=i})),(0,a.iw)("closePaymentModal",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},n=(0,v.jUK)(e,a).payment.status;return e=(0,f.bp)(e,a),e=(0,f.WY)(e,a),(0,I.i)(e,{payment:{...(0,v.jUK)(e,a).payment,status:n}},a)})),(0,a.iw)("addPaymentError",((e,t,s)=>{const{error:a,tabId:n=(0,l._w)()}=s;return(0,I.i)(e,{payment:{...(0,v.jUK)(e,n).payment,status:"failed",error:a}},n)}));var Ke=s(88422);(0,a.iw)("openMediaViewer",((e,t,s)=>{const{chatId:a,threadId:i,mediaId:o,avatarOwnerId:r,profilePhotoIndex:c,origin:d,volume:u,playbackRate:m,isMuted:h,tabId:p=(0,l._w)()}=s,g=(0,v.jUK)(e,p);return(0,I.i)(e,{mediaViewer:{...g.mediaViewer,chatId:a,threadId:i,mediaId:o,avatarOwnerId:r,profilePhotoIndex:c,origin:d,isHidden:!1,volume:u??g.mediaViewer.volume,playbackRate:m||g.mediaViewer.playbackRate||e.mediaViewer.lastPlaybackRate||n.mwi,isMuted:h||g.mediaViewer.isMuted},forwardMessages:{}},p)})),(0,a.iw)("closeMediaViewer",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},{volume:n,isMuted:i,playbackRate:o,isHidden:r}=(0,v.jUK)(e,a).mediaViewer;return(0,I.i)(e,{mediaViewer:{volume:n,isMuted:i,isHidden:r,playbackRate:o}},a)})),(0,a.iw)("setMediaViewerVolume",((e,t,s)=>{const{volume:a,tabId:n=(0,l._w)()}=s;return(0,I.i)(e,{mediaViewer:{...(0,v.jUK)(e,n).mediaViewer,volume:a,isMuted:!1}},n)})),(0,a.iw)("setMediaViewerPlaybackRate",((e,t,s)=>{const{playbackRate:a,tabId:n=(0,l._w)()}=s;return e={...e,mediaViewer:{...e.mediaViewer,lastPlaybackRate:a}},(0,I.i)(e,{mediaViewer:{...(0,v.jUK)(e,n).mediaViewer,playbackRate:a}},n)})),(0,a.iw)("setMediaViewerMuted",((e,t,s)=>{const{isMuted:a,tabId:n=(0,l._w)()}=s;return(0,I.i)(e,{mediaViewer:{...(0,v.jUK)(e,n).mediaViewer,isMuted:a}},n)})),(0,a.iw)("setMediaViewerHidden",((e,t,s)=>{const{isHidden:a,tabId:n=(0,l._w)()}=s;return(0,I.i)(e,{mediaViewer:{...(0,v.jUK)(e,n).mediaViewer,isHidden:a}},n)}));var ze=s(95281),We=s(50214),Ye=s(5872),Xe=s(35369);let Qe=!1;(0,h.Gq)((()=>{(0,a.Rd)().passcode.hasPasscode&&!Qe&&1===Object.keys((0,a.Rd)().byTabId).length&&(0,We.jv)()})),(0,a.iw)("setPasscode",(async(e,t,s)=>{const{passcode:n,tabId:i=(0,l._w)()}=s;e=(0,f.vu)(e,{isLoading:!0}),(0,a.R3)(e),await(0,ze.AU)(n);const o=JSON.stringify({...(0,We.K8)(),userId:e.currentUserId});e=(0,a.Rd)();const r=(0,Ye.Uf)((0,f.vu)(e,{hasPasscode:!0,error:void 0,isLoading:!1}));try{await(0,ze.H4)(o,r),(0,l.Z6)(),e=(0,a.Rd)(),e=(0,f.vu)(e,{hasPasscode:!0,error:void 0,isLoading:!1}),(0,a.R3)(e),(0,Ye.jA)(!0)}catch(s){(0,ze.J9)(),e=(0,a.Rd)(),e=(0,f.vu)(e,{isLoading:!1}),(0,a.R3)(e),t.showNotification({message:"Failed to set passcode",tabId:i}),t.requestNextSettingsScreen({screen:c.MT.PasscodeDisabled,tabId:i})}})),(0,a.iw)("clearPasscode",(e=>((0,ze.C8)(),(0,f.Kn)(e)))),(0,a.iw)("unlockScreen",((e,t,s)=>{const n=Object.values(e.byTabId),{sessionJson:i,globalJson:o}=s,r=JSON.parse(i);(0,We.wX)(r,r.userId);const c=e;(e=JSON.parse(o)).byTabId=c.byTabId,(0,Ye.nE)(e,(0,u.Xh)(Xe.g9)),e=(0,f.vu)(e,{isScreenLocked:!1,error:void 0,invalidAttemptsCount:0}),(0,a.R3)(e),(0,l.Z6)(),n.forEach((e=>{let{id:s,isMasterTab:a}=e;return t.init({tabId:s,isMasterTab:a})})),t.initApi()})),(0,a.iw)("decryptSession",((e,t,s)=>{const{passcode:a}=s;(0,ze.so)(a).then(t.unlockScreen,(()=>{t.logInvalidUnlockAttempt()}))})),(0,a.iw)("logInvalidUnlockAttempt",(e=>{const t=(e.passcode?.invalidAttemptsCount??0)+1;return(0,f.vu)(e,{invalidAttemptsCount:t,timeoutUntil:t>=5?Date.now()+15e3:void 0})})),(0,a.iw)("resetInvalidUnlockAttempts",(e=>(0,f.vu)(e,{invalidAttemptsCount:0,timeoutUntil:void 0}))),(0,a.iw)("setPasscodeError",((e,t,s)=>{const{error:a}=s;return(0,f.vu)(e,{error:a})})),(0,a.iw)("clearPasscodeError",(e=>(0,f.vu)(e,{error:void 0}))),(0,a.iw)("skipLockOnUnload",(()=>{Qe=!0})),(0,a.iw)("openChat",((e,t,s)=>{const{id:a,tabId:n=(0,l._w)()}=s;return a?(0,I.i)(e,{reactionPicker:{chatId:a,messageId:void 0,position:void 0}},n):(0,I.i)(e,{reactionPicker:void 0},n)})),(0,a.iw)("openMessageReactionPicker",((e,t,s)=>{const{chatId:a,messageId:n,position:i,tabId:o=(0,l._w)()}=s;return(0,I.i)(e,{reactionPicker:{chatId:a,messageId:n,position:i}},o)})),(0,a.iw)("openStoryReactionPicker",((e,t,s)=>{const{peerId:a,storyId:n,position:i,sendAsMessage:o,tabId:r=(0,l._w)()}=s;return(0,I.i)(e,{reactionPicker:{storyPeerId:a,storyId:n,sendAsMessage:o,position:i}},r)})),(0,a.iw)("closeReactionPicker",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},n=(0,v.jUK)(e,a);return(0,I.i)(e,{reactionPicker:{...n.reactionPicker,messageId:void 0,position:void 0,storyId:void 0,storyPeerId:void 0}},a)})),(0,a.iw)("openStoryViewer",(async(e,t,s)=>{const{peerId:n,storyId:i,isSinglePeer:o,isSingleStory:r,isPrivate:c,isArchive:d,origin:m,tabId:h=(0,l._w)()}=s,g=(0,v.RGZ)(e,n);if(!g)return;const w=(0,v.jUK)(e,h),y=(0,v.nST)(e,n);if(i&&(!y||!y.byId[i])){const t=await(0,p.t9)("fetchPeerStoriesByIds",{peer:g,ids:[i]});if(!t)return;e=(0,a.Rd)(),e=(0,f.Sh)(e,(0,u.ee)(t.users,"id")),e=(0,f.fZ)(e,(0,u.ee)(t.chats,"id")),e=(0,f._6)(e,n,t.stories)}e=(0,I.i)(e,{storyViewer:{...w.storyViewer,peerId:n,storyId:i||(0,v.ZEE)(e,n)||(0,v.wUq)(e,n),isSinglePeer:o,isPrivate:c,isArchive:d,isSingleStory:r,viewModal:void 0,origin:m}},h),(0,a.R3)(e)})),(0,a.iw)("openStoryViewerByUsername",(async(e,t,s)=>{const{username:a,storyId:n,origin:i,tabId:r=(0,l._w)()}=s,c=await(0,o.Co)(e,a);c&&t.openStoryViewer({peerId:c.id,storyId:n,isSinglePeer:!0,isSingleStory:!0,origin:i,tabId:r})})),(0,a.iw)("closeStoryViewer",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},{isMuted:n,isRibbonShown:i,isArchivedRibbonShown:o,storyId:r}=(0,v.jUK)(e,a).storyViewer;return r?e=(0,I.i)(e,{storyViewer:{isMuted:n,isRibbonShown:i,isArchivedRibbonShown:o,lastViewedByPeerIds:void 0}},a):e})),(0,a.iw)("setStoryViewerMuted",((e,t,s)=>{const{isMuted:a,tabId:n=(0,l._w)()}=s;return(0,I.i)(e,{storyViewer:{...(0,v.jUK)(e,n).storyViewer,isMuted:a}},n)})),(0,a.iw)("toggleStoryRibbon",((e,t,s)=>{const{isShown:a,isArchived:n,tabId:i=(0,l._w)()}=s,o=e.stories.orderedPeerIds[n?"archived":"active"];return o?.length?(0,I.i)(e,{storyViewer:{...(0,v.jUK)(e,i).storyViewer,[n?"isArchivedRibbonShown":"isRibbonShown"]:a}},i):e})),(0,a.iw)("openPreviousStory",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},n=(0,v.jUK)(e,a),{peerId:i,storyId:o,isSinglePeer:r,isSingleStory:c,isPrivate:d,isArchive:u}=n.storyViewer;if(c)return void t.closeStoryViewer({tabId:a});const{orderedPeerIds:{active:m,archived:h}}=e.stories;if(!i||!o)return;const p=(0,v.RGZ)(e,i),g=(0,v.nST)(e,i);if(!g||!p)return;const f=(p.areStoriesHidden?h:m)??[],w=u?"archiveIds":d?"pinnedIds":"orderedIds",y=(g[w]??[]).indexOf(o);let b,P;if(y>0)b=y-1,P=i;else{const t=f.indexOf(i)-1;if(r||t<0)return;P=f[t],b=((0,v.nST)(e,P)?.orderedIds.length||1)-1}const Z=(0,v.nST)(e,P)?.[w]?.[b];return Z?(0,I.i)(e,{storyViewer:{...n.storyViewer,peerId:P,storyId:Z}},a):void 0})),(0,a.iw)("openNextStory",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},n=(0,v.jUK)(e,a),{peerId:i,storyId:o,isSinglePeer:r,isSingleStory:c,isPrivate:d,isArchive:u}=n.storyViewer;if(c)return void t.closeStoryViewer({tabId:a});const{orderedPeerIds:{active:m,archived:h}}=e.stories;if(!i||!o)return;const p=(0,v.RGZ)(e,i),g=(0,v.nST)(e,i);if(!g||!p)return;const f=(p.areStoriesHidden?h:m)??[],w=u?"archiveIds":d?"pinnedIds":"orderedIds",y=g[w]??[],b=y.indexOf(o);let P,Z;if(b<y.length-1)P=b+1,Z=i;else{const e=f.indexOf(i)+1;if(r||e>f.length-1)return void t.closeStoryViewer({tabId:a});Z=f[e],P=0}const S=(0,v.nST)(e,Z)?.[w]?.[P];return S?(0,I.i)(e,{storyViewer:{...n.storyViewer,peerId:Z,storyId:S}},a):void 0})),(0,a.iw)("openStoryViewModal",((e,t,s)=>{const{storyId:a,tabId:n=(0,l._w)()}=s,i=(0,v.jUK)(e,n);return(0,I.i)(e,{storyViewer:{...i.storyViewer,viewModal:{storyId:a,nextOffset:"",isLoading:!0}}},n)})),(0,a.iw)("closeStoryViewModal",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},n=(0,v.jUK)(e,a);return(0,I.i)(e,{storyViewer:(0,u.CE)(n.storyViewer,["viewModal"])},a)})),(0,a.iw)("copyStoryLink",(async(e,t,s)=>{const{peerId:a,storyId:n,tabId:i=(0,l._w)()}=s,o=(0,v.RGZ)(e,a);if(!o)return;const r=await(0,p.t9)("fetchStoryLink",{peer:o,storyId:n});r&&((0,Ae.TE)(r),t.showNotification({message:m.Iu("LinkCopied"),tabId:i}))})),(0,a.iw)("sendMessage",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s,{storyId:n,peerId:i}=(0,v.pri)(e,a);if(!Boolean(n&&i))return;const{gif:o,sticker:r,isReaction:c}=s;let d;d=o?"Story.Tooltip.GifSent":r?"Story.Tooltip.StickerSent":c?"Story.Tooltip.ReactionSent":"Story.Tooltip.MessageSent",t.showNotification({message:m.Iu(d),actionText:m.Iu("Story.ToastViewInChat"),action:[{action:"closeStoryViewer",payload:void 0},{action:"openChat",payload:{id:i}}],tabId:a})})),(0,a.iw)("openStoryPrivacyEditor",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},n=(0,v.jUK)(e,a);return(0,I.i)(e,{storyViewer:{...n.storyViewer,isPrivacyModalOpen:!0}},a)})),(0,a.iw)("closeStoryPrivacyEditor",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{},n=(0,v.jUK)(e,a);return(0,I.i)(e,{storyViewer:{...n.storyViewer,isPrivacyModalOpen:!1}},a)})),(0,a.iw)("toggleStealthModal",((e,t,s)=>{const{isOpen:a,tabId:n=(0,l._w)()}=s||{},i=(0,v.jUK)(e,n);return(0,I.i)(e,{storyViewer:{...i.storyViewer,isStealthModalOpen:a}},n)})),(0,a.iw)("clearStoryViews",((e,t,s)=>{const{isLoading:a,tabId:n=(0,l._w)()}=s||{},i=(0,v.jUK)(e,n);return i.storyViewer.viewModal?(0,I.i)(e,{storyViewer:{...i.storyViewer,viewModal:{...i.storyViewer.viewModal,viewsById:{},isLoading:a,nextOffset:""}}},n):e})),(0,a.iw)("updateStoryView",((e,t,s)=>{const{userId:a,isUserBlocked:n,areStoriesBlocked:i,tabId:o=(0,l._w)()}=s,r=(0,v.jUK)(e,o),{viewModal:c}=r.storyViewer;if(!c?.viewsById?.[a])return e;const d={...c.viewsById,[a]:{...c.viewsById[a],isUserBlocked:n||void 0,areStoriesBlocked:i||void 0}};return(0,I.i)(e,{storyViewer:{...r.storyViewer,viewModal:{...c,viewsById:d}}},o)})),(0,a.iw)("closeBoostModal",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{boostModal:void 0},a)})),(0,a.iw)("closeBoostStatistics",((e,t,s)=>{const{tabId:a=(0,l._w)()}=s||{};return(0,I.i)(e,{boostStatistics:void 0},a)})),s(28304),(0,a.iw)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"updateChat":{const{isForum:n,lastReadOutboxMessageId:i}=(0,v.Z1J)(e,s.id)||{};s.chat.lastReadOutboxMessageId&&i&&s.chat.lastReadOutboxMessageId<i&&(s={...s,chat:(0,u.CE)(s.chat,["lastReadInboxMessageId"])});const o=(0,v.Z1J)(e,s.id);return e=(0,f.a4)(e,s.id,s.chat,s.newProfilePhoto),o?.areStoriesHidden!==s.chat.areStoriesHidden&&(e=(0,f.QO)(e,s.id,s.chat.areStoriesHidden||!1)),(0,a.R3)(e),s.noTopChatsRequest||(0,v.Nap)(e,s.id)||t.loadTopChats(),s.chat.id&&(0,y.Vr)({chatId:s.chat.id,lastReadInboxMessageId:s.chat.lastReadInboxMessageId}),void Object.values(e.byTabId).forEach((a=>{let{id:i}=a;const{chatId:o}=(0,v.Btg)(e,i)||{},r=s;o===r.id&&"isForum"in r.chat&&n!==r.chat.isForum&&(n&&t.closeForumPanel({tabId:i}),t.openChat({id:o,tabId:i}))}))}case"updateChatJoin":{const n=(0,v.EkO)(e,s.id);if(!n)return;e=(0,f.B1)(e,n,[s.id]),e=(0,f.a4)(e,s.id,{isNotJoined:!1}),(0,a.R3)(e);const i=(0,v.Z1J)(e,s.id);return void(i&&t.requestChatUpdate({chatId:i.id}))}case"updateChatLeave":return(0,f.Dd)(e,s.id);case"updateChatInbox":return(0,f.a4)(e,s.id,s.chat);case"updateChatTypingStatus":{const{id:t,threadId:n=r._f,typingStatus:i}=s;return e=(0,f.pf)(e,t,n,"typingStatus",i),(0,a.R3)(e),void setTimeout((()=>{e=(0,a.Rd)();const s=(0,v.WPz)(e,t,n,"typingStatus");i&&s&&i.timestamp===s.timestamp&&(e=(0,f.pf)(e,t,n,"typingStatus",void 0),(0,a.R3)(e))}),6e3)}case"newMessage":{const{message:t}=s;if(t.senderId===e.currentUserId&&!t.isFromScheduled)return;const n=(0,v.Z1J)(e,s.chatId);if(!n)return;const i=Boolean(s.message.id&&s.message.hasUnreadMention);e=(0,f.a4)(e,s.chatId,{unreadCount:n.unreadCount?n.unreadCount+1:1,...i&&{unreadMentionsCount:(n.unreadMentionsCount||0)+1}}),i&&(e=(0,f.a4)(e,s.chatId,{unreadMentions:[...n.unreadMentions||[],s.message.id]}));const o=n.isForum?(0,v.p$s)(e,t):void 0;return o&&(e=(0,f.Cn)(e,s.chatId,o.id,{unreadCount:o.unreadCount?o.unreadCount+1:1})),(0,a.R3)(e),void(0,y.rh)({chat:n,message:t})}case"updateCommonBoxMessages":case"updateChannelMessages":{const{ids:t,messageUpdate:a}=s;if(!1!==a.hasUnreadMention)return;return t.forEach((t=>{const a="channelId"in s?s.channelId:(0,v.X5I)(e,t),n=(0,v.Z1J)(e,a);n?.unreadReactionsCount&&(e=B(e,a,{unreadReactionsCount:n.unreadReactionsCount-1||void 0,unreadReactions:n.unreadReactions?.filter((e=>e!==t))})),n?.unreadMentionsCount&&(e=(0,f.a4)(e,a,{unreadMentionsCount:n.unreadMentionsCount-1||void 0,unreadMentions:n.unreadMentions?.filter((e=>e!==t))}))})),e}case"updateChatFullInfo":return(0,f.US)(e,s.id,s.fullInfo);case"updatePinnedChatIds":{const{ids:t,folderId:a}=s,i=a===n.WSp?"archived":"active";return{...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[i]:t.length?t:void 0}}}}case"updateChatPinned":{const{id:t,isPinned:a}=s,i=(0,v.EkO)(e,t);if(!i)return;const{[i]:o}=e.chats.orderedPinnedIds;let r=o||[];if(a){if(!r.includes(t)){if("active"===i&&r.length>=n.EGK){const t=e.chats.listIds.active;r=r.filter((e=>t&&t.includes(e)))}r=[t,...r]}}else r=r.filter((e=>e!==t));return{...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[i]:r.length?r:void 0}}}}case"updateChatListType":{const{id:t,folderId:a}=s;return(0,f.Pi)(e,t,a)}case"updateChatFolder":{const{id:t,folder:a}=s,{byId:n,orderedIds:i}=e.chatFolders,o=void 0===a;Object.values(e.byTabId).forEach((s=>{let{id:a}=s;const i=(0,v.jUK)(e,a);Object.values(n)[i.activeChatFolder-1]?.id===t&&(e=(0,I.i)(e,{activeChatFolder:0},a))}));const r=o?(0,u.CE)(n,[t]):{...n,[t]:a},c=o?i?.filter((e=>e!==t)):i?.includes(t)?i:[...i||[],t];return{...e,chatFolders:{...e.chatFolders,byId:r,orderedIds:c,invites:(0,u.CE)(e.chatFolders.invites,[t])}}}case"updateChatFoldersOrder":{const{orderedIds:t}=s;return{...e,chatFolders:{...e.chatFolders,orderedIds:t}}}case"updateRecommendedChatFolders":{const{folders:t}=s;return{...e,chatFolders:{...e.chatFolders,recommended:t}}}case"updateChatMembers":{const t=(0,v.x67)(e,s.id),{replacedMembers:a,addedMember:n,deletedMemberId:i}=s;if(!t)return;let o=!1,r=t?.members?[...t.members]:[];if(a)r=a,o=!0;else if(n)r.length&&r.some((e=>e.userId===n.userId))||(r.push(n),o=!0);else if(r.length&&i){const e=r.findIndex((e=>e.userId===i));e>-1&&(r.slice(e,1),o=!0)}if(o){const t=r.filter((e=>{let{isOwner:t,isAdmin:s}=e;return t||s}));return e=(0,f.a4)(e,s.id,{membersCount:r.length}),e=(0,f.US)(e,s.id,{members:r,adminMembersById:(0,u.ee)(t,"userId")})}return}case"deleteProfilePhotos":{const{chatId:t,ids:a}=s,n=e.chats.byId[t];return n?.photos?(0,f.a4)(e,t,{photos:n.photos.filter((e=>!a.includes(e.id)))}):void 0}case"draftMessage":{const{chatId:t,formattedText:a,date:n,replyingToId:i,threadId:o}=s;if(!e.chats.byId[t])return;return e=(0,f.pf)(e,t,o||r._f,"draft",a),e=(0,f.pf)(e,t,o||r._f,"replyingToId",i),e=(0,f.a4)(e,t,{draftDate:n})}case"showInvite":{const{data:a}=s;return void Object.values(e.byTabId).forEach((e=>{let{id:s}=e;t.showDialog({data:a,tabId:s})}))}case"updatePendingJoinRequests":{const{chatId:n,requestsPending:i,recentRequesterIds:o}=s;if(!e.chats.byId[n])return;return e=(0,f.US)(e,n,{requestsPending:i,recentRequesterIds:o}),(0,a.R3)(e),void t.loadChatJoinRequests({chatId:n})}case"updatePinnedTopic":{const{chatId:t,topicId:n,isPinned:i}=s;if(!e.chats.byId[t])return;return e=(0,f.Cn)(e,t,n,{isPinned:i}),void(0,a.R3)(e)}case"updatePinnedTopicsOrder":{const{chatId:t,order:n}=s;if(!e.chats.byId[t])return;return e=(0,f.a4)(e,t,{orderedPinnedTopicIds:n}),void(0,a.R3)(e)}case"updateTopic":{const{chatId:a,topicId:n}=s,i=(0,v.Z1J)(e,a);if(!i?.isForum)return;return void t.loadTopicById({chatId:a,topicId:n})}case"updateTopics":{const{chatId:a}=s,n=(0,v.Z1J)(e,a);if(!n?.isForum)return;return void t.loadTopics({chatId:a,force:!0})}}}));const et=(0,h.P2)((function(){let e=(0,a.Rd)();e=(0,f.ps)(e,{...e.users.statusesById,...tt}),(0,a.R3)(e),tt={}}),3e3,!0);let tt={};(0,a.iw)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"deleteContact":return(0,f.GK)(e,s.id);case"updateUser":{Object.values(e.byTabId).forEach((a=>{let{id:n}=a;s.id===e.currentUserId&&s.user.isPremium!==(0,v.wVz)(e)&&(s.user.isPremium&&e.byTabId[n].premiumModal&&t.openPremiumModal({isSuccess:!0,tabId:n}),e={...e,translations:{byChatId:{}}})}));const a=(0,v.dyD)(e,s.id);return e=(0,f.Nq)(e,s.id,s.user),s.fullInfo&&(e=(0,f.ap)(e,s.id,s.fullInfo)),a?.areStoriesHidden!==s.user.areStoriesHidden&&(e=(0,f.QO)(e,s.id,s.user.areStoriesHidden||!1)),e}case"updateRequestUserUpdate":t.loadFullUser({userId:s.id});break;case"updateUserEmojiStatus":return(0,f.Nq)(e,s.userId,{emojiStatus:s.emojiStatus});case"updateUserStatus":return a=s.userId,n=s.status,tt[a]=n,void et();case"updateUserFullInfo":{const{id:t,fullInfo:a}=s;return(0,f.ap)(e,t,a)}case"updateBotMenuButton":{const{botId:t,button:a}=s,n=(0,v.ccz)(e,t);if(!n?.botInfo)return;return(0,f.ap)(e,t,{botInfo:{...n.botInfo,menuButton:a}})}}var a,n})),(0,a.iw)("apiUpdate",((e,t,s)=>{if("updateStickerSet"===s["@type"])return(0,f.Rg)(e,s.id,s.stickerSet)})),(0,a.iw)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"updatePeerBlocked":return s.isBlocked?(0,f.h7)(e,s.id):s.isBlockedFromStories?e:(0,f.kw)(e,s.id);case"updateResetContactList":e={...e,contactList:{userIds:[]}},(0,a.R3)(e);break;case"updateConfig":t.loadConfig();break;case"updateNewAuthorization":t.loadAuthorizations();break;case"updateFavoriteStickers":t.loadFavoriteStickers();break;case"updateRecentStickers":t.loadRecentStickers();break;case"updateRecentReactions":t.loadRecentReactions();break;case"updateRecentEmojiStatuses":t.loadRecentEmojiStatuses();break;case"updateMoveStickerSetToTop":{const a=s.isCustomEmoji?e.customEmojis.added.setIds:e.stickers.added.setIds;if(!a)return e;const n=[s.id,...a.filter((e=>e!==s.id))];t.reorderStickerSets({order:n,isCustomEmoji:s.isCustomEmoji});break}case"updateStickerSets":t.loadStickerSets();break;case"updateStickerSetsOrder":{const a=s.order.filter((t=>Boolean(e.stickers.setsById[t])));t.reorderStickerSets({order:a,isCustomEmoji:s.isCustomEmoji});break}case"updateSavedGifs":t.loadSavedGifs();break;case"updatePrivacy":e={...e,settings:{...e.settings,privacy:{...e.settings.privacy,[s.key]:s.rules}}},(0,a.R3)(e);break;case"updatePaymentVerificationNeeded":Object.values(e.byTabId).forEach((t=>{let{id:a}=t;e=(0,f.fS)(e,s.url,a),e=(0,f.Q$)(e,c.KB.ConfirmPayment,a)})),(0,a.R3)(e);break;case"updateWebViewResultSent":Object.values(e.byTabId).forEach((e=>{e.webApp?.queryId===s.queryId&&(t.setReplyingToId({messageId:void 0,tabId:e.id}),t.closeWebApp({tabId:e.id}))}));break;case"updateStory":e=(0,f._6)(e,s.peerId,{[s.story.id]:s.story}),e=(0,f.Fz)(e,{[s.peerId]:(0,v.nST)(e,s.peerId)}),(0,a.R3)(e);break;case"deleteStory":e=(0,f.se)(e,s.peerId,s.storyId),(0,a.R3)(e);break;case"updateReadStories":e=(0,f.P5)(e,s.peerId,s.lastReadId),(0,a.R3)(e);break;case"updateSentStoryReaction":{const{peerId:t,storyId:n,reaction:i}=s;if(!(0,v.JrV)(e,t,n))return e;e=(0,f.w2)(e,t,n,{sentReaction:i}),(0,a.R3)(e);break}case"updateStealthMode":e=(0,f.Uq)(e,s.stealthMode),(0,a.R3)(e);break;case"updateAttachMenuBots":t.loadAttachBots({hash:e.attachMenu.hash})}})),(0,a.iw)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"updateNotifySettings":return(0,f.HN)(e,s.peerType,s.isSilent,s.shouldShowPreviews);case"updateNotifyExceptions":{const{chatId:t,isMuted:n,isSilent:i,shouldShowPreviews:o}=s;e.chats.byId[t]&&(e=(0,f.a4)(e,t,{isMuted:n})),e=(0,f.aK)(e,t,{isMuted:n,isSilent:i,shouldShowPreviews:o}),(0,a.R3)(e);break}case"updateTopicNotifyExceptions":{const{chatId:t,topicId:n,isMuted:i}=s;e=(0,f.Cn)(e,t,n,{isMuted:i}),(0,a.R3)(e);break}}})),(0,a.iw)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"updateTwoFaStateWaitCode":return{...e,twoFaSettings:{...e.twoFaSettings,isLoading:!1,waitingEmailCodeLength:s.length}};case"updateTwoFaError":return{...e,twoFaSettings:{...e.twoFaSettings,error:s.message}}}}));var st=s(78958),at=s(42431);(0,a.iw)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"updateGroupCall":{if("discarded"===s.call.connectionState)return e.groupCalls.activeGroupCallId?void("leaveGroupCall"in t&&t.leaveGroupCall({shouldRemove:!0,tabId:(0,l._w)()})):(0,st.dc)(e,s.call.id);const a=(0,at.$5)(e,s.call.id),n=a?.chatId;return n&&(e=(0,f.a4)(e,n,{isCallNotEmpty:a.participantsCount>0||Boolean(a.participants?.length)})),(0,st.AH)(e,s.call.id,(0,u.CE)(s.call,["connectionState"]),void 0,s.call.participantsCount)}case"updateGroupCallChatId":return(0,v.Z1J)(e,s.chatId)&&(e=(0,f.US)(e,s.chatId,{groupCallId:s.call.id})),e;case"updateGroupCallParticipants":{const{groupCallId:t,participants:n,nextOffset:i}=s,{currentUserId:o}=e;e=(0,a.Rd)(),n.forEach((s=>{s.id&&(e=(0,st.B6)(e,t,s.id,s,Boolean(i)||o===s.id))})),i&&(e=(0,st.AH)(e,t,{nextOffset:i}));const r=(0,at.$5)(e,t),c=r?.chatId;return c&&(e=(0,f.a4)(e,c,{isCallNotEmpty:r.participantsCount>0||Boolean(r.participants?.length)})),e}case"updatePhoneCall":{if(!i.Bi)return;const{phoneCall:n,currentUserId:o}=e,{call:r}=s;if(n)return"discarded"===r.state?(t.playGroupCallSound({sound:"end"}),"hangUp"in t&&t.hangUp({tabId:(0,l._w)()}),{...e,...r.needRating&&{ratingPhoneCall:r}}):void 0;if(r?.adminId!==o&&"requested"===r.state)return(0,h.R3)((()=>{e=(0,a.Rd)(),(0,y.TO)({call:r,user:(0,at.fu)(e)})})),(0,Ke.EP)(),(0,Ke.CW)(e,t,r.isVideo,(0,l._w)()),e={...e,phoneCall:r},(0,I.i)(e,{isCallPanelVisible:!1},(0,l._w)())}}}));var nt=s(9937);(0,a.iw)("apiUpdate",((e,t,s)=>{"updatePaymentStateCompleted"===s["@type"]&&Object.values(e.byTabId).forEach((a=>{let{id:n}=a;const{inputInvoice:o}=(0,v.jUK)(e,n).payment;if(o&&"chatId"in o&&"messageId"in o){const s=(0,v.hjO)(e,o.chatId,o.messageId);if(s&&s.content.invoice){const{amount:e,currency:a,title:i}=s.content.invoice;t.showNotification({tabId:n,message:m.Iu("PaymentInfoHint",[(0,nt.x)(e,a,m.QO().code),i])})}}i.Xp||(e=(0,f.WY)(e,n)),s.slug&&o&&"slug"in o&&o.slug!==s.slug||(e=(0,I.i)(e,{payment:{...(0,v.jUK)(e,n).payment,status:"paid"}},n))}))}));var it=s(60748),ot=s(31664),rt=s(73760),ct=s(57710),dt=s(46752),lt=s(1279),ut=s(53551),mt=s(99203),ht=s(45332),pt=s(58637),gt=s(65326),ft=s(36413),It=s(18674),vt=s(62357),wt=s(25190);const yt=document.querySelector('meta[name="viewport"]'),bt=yt?.getAttribute("content")||"";function Pt(e){e.preventDefault()}var Zt=s(31212),St=s(34446),Ct=s(28183),Mt=s(48778);const Et=e=>{const{isActive:t}=e,s=(0,Mt.Z)(mt.gl.Calls,"ActiveCallHeader",!t);return s?it.ZP.createElement(s,null):void 0},Rt=e=>{const{groupCallId:t}=e,s=(0,Mt.Z)(mt.gl.Calls,"GroupCall",!t);return s?it.ZP.createElement(s,e):void 0},kt=e=>{const{isActive:t}=e,s=(0,Mt.Z)(mt.gl.Calls,"PhoneCall",!t);return s?it.ZP.createElement(s,null):void 0},Tt=e=>{const{isOpen:t}=e,s=(0,Mt.Z)(mt.gl.Calls,"RatePhoneCallModal",!t);return s?it.ZP.createElement(s,e):void 0},At=e=>{const{customEmojiSetIds:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"CustomEmojiSetsModal",!t);return s?it.ZP.createElement(s,e):void 0},Nt=e=>{const{isOpen:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"StickerSetModal",!t);return s?it.ZP.createElement(s,e):void 0};var Bt=s(17358),xt=s(2155),Lt=s(95616);const Ut=(0,it.X$)((e=>{let{isForAppBadge:t}=e;(0,Lt.yi)();const s=(0,ce.xW)();if((0,it.d4)((()=>{t&&(0,Bt.w)(s)}),[t,s]),!t&&s)return it.ZP.createElement("div",{className:"unread-count active"},(0,xt.bi)(s))}));var Ot=s(23989),jt=s(29371),_t=s(53455),Ft=s(73541),Dt=s(70971),qt=s(2255),Gt=s(34288);const Ht=e=>{const t=(0,Mt.Z)(mt.gl.Extra,"ArchivedChats");return t?it.ZP.createElement(t,e):it.ZP.createElement(Gt.Z,null)};var Vt=s(54416),$t=s(59107),Jt=s(231),Kt=s(52328),zt=s(58964);const Wt=e=>{let{isShown:t,onNewPrivateChat:s,onNewChannel:a,onNewGroup:n}=e;const[i,o]=(0,it.eJ)(!1);(0,it.d4)((()=>{t||o(!1)}),[t]);const r=(0,$t.Z)(),c=(0,dt.Z)("NewChatButton",t&&"revealed",i&&"menu-is-open"),d=(0,it.I4)((()=>{o(!i)}),[i]),l=(0,it.I4)((()=>{o(!1)}),[]),u=(0,it.Ye)((()=>it.ZP.createElement(it.ZP.Fragment,null,it.ZP.createElement(zt.Z,{icon:"channel",onClick:a},r("NewChannel")),it.ZP.createElement(zt.Z,{icon:"group",onClick:n},r("NewGroup")),it.ZP.createElement(zt.Z,{icon:"user",onClick:s},r("NewMessageTitle")))),[r,a,n,s]);return it.ZP.createElement("div",{className:c,dir:r.isRtl?"rtl":void 0},it.ZP.createElement(Jt.Z,{round:!0,color:"primary",className:i?"active":"",onClick:d,ariaLabel:r(i?"Close":"NewMessageTitle"),tabIndex:-1},it.ZP.createElement("i",{className:"icon icon-new-chat-filled"}),it.ZP.createElement("i",{className:"icon icon-close"})),it.ZP.createElement(Kt.Z,{isOpen:i,positionX:r.isRtl?"left":"right",positionY:"bottom",autoClose:!0,onClose:l},u))},Yt=e=>{const t=(0,Mt.Z)(mt.gl.Extra,"LeftSearch");return t?it.ZP.createElement(t,e):it.ZP.createElement(Gt.Z,null)};var Xt=s(64963),Qt=s(46590),es=s(47505),ts=s(31711),ss=s(40340);const as=(0,it.X$)((0,a.c$)((e=>{const{chatFolders:{byId:t,orderedIds:s,invites:a},chats:{listIds:{archived:n}},stories:{orderedPeerIds:{archived:i}},activeSessions:{byHash:o},currentUserId:r,archiveSettings:c}=e,{shouldSkipHistoryAnimations:d,activeChatFolder:l}=(0,v.jUK)(e),{storyViewer:{isRibbonShown:u}}=(0,v.jUK)(e);return{chatFoldersById:t,folderInvitesById:a,orderedFolderIds:s,activeChatFolder:l,currentUserId:r,shouldSkipHistoryAnimations:d,hasArchivedChats:Boolean(n?.length),hasArchivedStories:Boolean(i?.length),maxFolders:(0,X.M)(e,"dialogFilters"),maxFolderInvites:(0,X.M)(e,"chatlistInvites"),maxChatLists:(0,X.M)(e,"chatlistJoined"),archiveSettings:c,isStoryRibbonShown:u,sessions:o}}))((e=>{let{foldersDispatch:t,onSettingsScreenSelect:s,onLeftColumnContentChange:o,chatFoldersById:r,orderedFolderIds:c,activeChatFolder:d,currentUserId:l,isForumPanelOpen:u,shouldSkipHistoryAnimations:m,maxFolders:h,maxChatLists:p,shouldHideFolderTabs:g,folderInvitesById:f,maxFolderInvites:I,hasArchivedChats:w,hasArchivedStories:y,archiveSettings:b,isStoryRibbonShown:P,sessions:Z}=e;const{loadChatFolders:S,setActiveChatFolder:C,openChat:M,openShareChatFolderModal:E,openDeleteChatFolderModal:R,openEditChatFolder:k,openLimitReachedModal:T}=(0,a.Sv)(),A=(0,it.sO)(null),N=(0,$t.Z)();(0,it.d4)((()=>{S()}),[]);const{shouldRender:B,transitionClassNames:x,isClosing:L}=(0,Zt.Z)(P,void 0,void 0,""),U=(0,it.Ye)((()=>({id:n.NfV,title:c?.[0]===n.NfV?N("FilterAllChatsShort"):N("FilterAllChats"),includedChatIds:ke.D,excludedChatIds:ke.D})),[c,N]),O=(0,it.Ye)((()=>c?c.map((e=>e===n.NfV?U:r[e]||{})).filter(Boolean):void 0),[r,U,c]),j=O?.findIndex((e=>e.id===n.NfV)),_=j===d,F=0===d,D=(0,Lt.yi)(),q=(0,it.Ye)((()=>{if(O&&O.length)return O.map(((e,t)=>{const{id:s,title:i}=e,o=s!==n.NfV&&t>h-1,c=[];return(0,v.yEv)((0,a.Rd)(),s)&&c.push({title:N("ChatList.ContextMenuShare"),icon:"link",handler:()=>{Object.values(r).reduce(((e,t)=>e+(t.isChatList?1:0)),0)>=p&&!e.isChatList?T({limit:"chatlistJoined"}):f[s]?.length>=I?T({limit:"chatlistInvites"}):E({folderId:s})}}),s!==n.NfV&&(c.push({title:N("FilterEdit"),icon:"edit",handler:()=>{k({folderId:s})}}),c.push({title:N("FilterDeleteItem"),icon:"delete",destructive:!0,handler:()=>{R({folderId:s})}})),{id:s,title:i,badgeCount:D[s]?.chatsCount,isBadgeActive:Boolean(D[s]?.notificationsCount),isBlocked:o,contextActions:c?.length?c:void 0}}))}),[O,h,D,N,r,p,f,I]),G=(0,wt.Z)((e=>{C({activeChatFolder:e},{forceOnHeavyAnimation:!0})}));(0,it.d4)((()=>{q?.length&&d>=q.length&&C({activeChatFolder:0})}),[d,q,C]),(0,it.d4)((()=>{if(i.$b&&q?.length&&!u)return(0,Xt.sf)(A.current,{selectorToPreventScroll:".chat-list",onSwipe:(e,t)=>t===Xt.eM.Left?(C({activeChatFolder:Math.min(d+1,q.length-1)},{forceOnHeavyAnimation:!0}),!0):t===Xt.eM.Right&&(C({activeChatFolder:Math.max(0,d-1)},{forceOnHeavyAnimation:!0}),!0)})}),[d,q,u,C]);const H=(0,it.sO)();H.current=!F,(0,it.d4)((()=>H.current?(0,Ot.Z)((()=>{H.current&&C({activeChatFolder:0})})):void 0),[d,C]),(0,Qt.Z)({isActive:!F,onBack:()=>C({activeChatFolder:0},{forceOnHeavyAnimation:!0})}),(0,it.d4)((()=>{const e=e=>{if(e.ctrlKey&&e.shiftKey&&e.code.startsWith("Digit")&&q){const[,t]=e.code.match(/Digit(\d)/)||[];if(!t)return;if("0"===t)return void M({id:l,shouldReplaceHistory:!0});const s=Number(t)-1;if(s>q.length-1)return;C({activeChatFolder:s},{forceOnHeavyAnimation:!0}),e.preventDefault()}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}}),[l,q,M,C]);const{shouldRender:V,transitionClassNames:$}=(0,Zt.Z)(!c,void 0,!0);function J(e){const a=Object.values(r).find((e=>{let{id:t}=e;return t===q[d].id})),n=a&&!_;return it.ZP.createElement(ss.Z,{folderType:n?"folder":"all",folderId:n?a.id:void 0,isActive:e,isForumPanelOpen:u,foldersDispatch:t,onSettingsScreenSelect:s,onLeftColumnContentChange:o,canDisplayArchive:(w||y)&&!b.isHidden,archiveSettings:b,sessions:Z})}const K=q&&q.length>1;return it.ZP.createElement("div",{className:(0,dt.Z)("ChatFolders",K&&g&&"ChatFolders--tabs-hidden",B&&"with-story-ribbon",x)},B&&it.ZP.createElement(es.Z,{isClosing:L}),K?it.ZP.createElement(ts.Z,{contextRootElementSelector:"#LeftColumn",tabs:q,activeTab:d,onSwitchTab:G,areFolders:!0}):V?it.ZP.createElement("div",{className:(0,dt.Z)("tabs-placeholder",$)}):void 0,it.ZP.createElement(qt.ZP,{ref:A,name:m?"none":N.isRtl?"slideOptimizedRtl":"slideOptimized",activeKey:d,renderCount:K?q.length:void 0},J))}))),ns=e=>{const t=(0,Mt.Z)(mt.gl.Extra,"ContactList");return t?it.ZP.createElement(t,e):it.ZP.createElement(Gt.Z,null)};var is=s(59690);let os=function(e){return e[e.waitingForNetwork=0]="waitingForNetwork",e[e.syncing=1]="syncing",e[e.online=2]="online",e}({});function rs(e,t,s,a,n,i){let o,r,c;return o=function(){const[e,t]=(0,it.eJ)(window.navigator.onLine);return(0,it.d4)((()=>{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"!==t?s?os.syncing:os.online:os.waitingForNetwork,r=o===os.online||i?"none":a?"middleHeader":n?"minimized":"overlay",o===os.waitingForNetwork?c=e("WaitingForNetwork"):o===os.syncing&&(c=e("Updating")),"middleHeader"===r&&(c=c.toLowerCase().replace(/\.+$/,"")),{connectionStatus:o,connectionStatusPosition:r,connectionStatusText:c}}var cs=s(97458),ds=s(60706),ls=s(73217),us=s(49187),ms=s(85194),hs=s(53106),ps=s(69589),gs=s(40126),fs=s(49204);const Is=(0,it.X$)((e=>{let{connectionStatus:t,connectionStatusText:s,onClick:a}=e;const n=(0,$t.Z)();return it.ZP.createElement("div",{id:"ConnectionStatusOverlay",dir:n.isRtl?"rtl":void 0,onClick:a},it.ZP.createElement(fs.Z,{color:"black"}),it.ZP.createElement("div",{className:"state-text"},it.ZP.createElement(qt.ZP,{activeKey:t,name:"slideFade"},s)),it.ZP.createElement(Jt.Z,{round:!0,size:"tiny",color:"translucent-black"},it.ZP.createElement("span",{className:"icon icon-close"})))}));var vs=s(36046),ws=s(17926),ys=s(43159),bs=s(83321),Ps=s(79994);const Zs=(0,it.X$)((0,a.c$)((e=>{const t=(0,v.jUK)(e),{currentUserId:s,archiveSettings:a}=e,{animationLevel:n}=e.settings.byKey,i=e.attachMenu.bots;return{currentUserId:s,theme:(0,v.Puy)(e),animationLevel:n,canInstall:Boolean(t.canInstall),archiveSettings:a,attachBots:i}}))((e=>{let{currentUserId:t,archiveSettings:s,animationLevel:o,theme:r,canInstall:c,attachBots:d,onSelectArchived:l,onSelectContacts:u,onSelectSettings:m,onBotMenuOpened:h,onBotMenuClosed:p}=e;const{openChat:g,setSettingOption:f,updatePerformanceSettings:I,openChatByUsername:v,openUrl:w,openChatWithInfo:y}=(0,a.Sv)(),b=(0,$t.Z)(),P=o!==n.oBh?o===n.zy8?"max":"mid":"min",Z=!i.D$&&(window.location.hostname===n.xHY||n.Cgt),S=(0,Lt.yi)()[n.WSp]?.chatsCount||0,C=(0,it.Ye)((()=>Object.values(d).filter((e=>e.isForSideMenu))),[d]),M=(0,wt.Z)((()=>{g({id:t,shouldReplaceHistory:!0})})),E=(0,wt.Z)((e=>{e.stopPropagation(),f({theme:"light"===r?"dark":"light"}),f({shouldUseSystemTheme:!1})})),R=(0,wt.Z)((e=>{e.stopPropagation();let t=o+1;t>n.zy8&&(t=n.oBh);const s=t===n.oBh?Xe.ww:t===n.zy8?Xe.WD:Xe.LN;f({animationLevel:t}),I(s)})),k=(0,wt.Z)((()=>{window.open(n.ulW,"_blank","noopener")})),T=(0,wt.Z)((()=>{(0,ws.El)("K")})),A=(0,wt.Z)((()=>{v({username:b("Settings.TipsUsername")})})),N=(0,wt.Z)((()=>{w({url:n.mUA})})),B=(0,wt.Z)((()=>{y({id:t,shouldReplaceHistory:!0,profileTab:"stories"})}));return it.ZP.createElement(it.ZP.Fragment,null,it.ZP.createElement(zt.Z,{icon:"saved-messages",onClick:M},b("SavedMessages")),s.isHidden&&it.ZP.createElement(zt.Z,{icon:"archive",onClick:l},it.ZP.createElement("span",{className:"menu-item-name"},b("ArchivedChats")),S>0&&it.ZP.createElement("div",{className:"right-badge"},S)),it.ZP.createElement(zt.Z,{icon:"user",onClick:u},b("Contacts")),C.map((e=>it.ZP.createElement(ys.Z,{bot:e,theme:r,isInSideMenu:!0,onMenuOpened:h,onMenuClosed:p}))),it.ZP.createElement(zt.Z,{icon:"play-story",onClick:B},b("Settings.MyStories")),it.ZP.createElement(zt.Z,{icon:"settings",onClick:m},b("Settings")),it.ZP.createElement(zt.Z,{icon:"darkmode",onClick:E},it.ZP.createElement("span",{className:"menu-item-name"},b("lng_menu_night_mode")),it.ZP.createElement(bs.Z,{id:"darkmode",label:b("dark"===r?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===r,noAnimation:!0})),it.ZP.createElement(zt.Z,{icon:"animations",onClick:R},it.ZP.createElement("span",{className:"menu-item-name capitalize"},b("Appearance.Animations").toLowerCase()),it.ZP.createElement(Ps.Z,{value:P})),it.ZP.createElement(zt.Z,{icon:"help",onClick:A},b("TelegramFeatures")),it.ZP.createElement(zt.Z,{icon:"bug",onClick:N},"Report Bug"),n.Tjg&&it.ZP.createElement(zt.Z,{icon:"permissions",onClick:k},"Beta Changelog"),Z&&it.ZP.createElement(zt.Z,{icon:"K",isCharIcon:!0,href:`${n.OfM}k`,onClick:T},"Switch to K Version"),c&&it.ZP.createElement(zt.Z,{icon:"install",onClick:(0,vs.G)()},"Install App"))})));var Ss=s(274),Cs=s(96459),Ms=s(4863),Es=s(67427);const Rs=e=>{const{isOpen:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"StatusPickerMenu",!t);return s?it.ZP.createElement(s,e):void 0},ks=(0,it.X$)((0,a.c$)((e=>{const{currentUserId:t}=e,s=t?(0,v.dyD)(e,t):void 0;return{emojiStatus:s?.emojiStatus}}))((e=>{let{emojiStatus:t}=e;const{setEmojiStatus:s,loadCurrentUser:i}=(0,a.Sv)(),o=(0,it.sO)(null),[r,c,d]=(0,ds.Z)(!1),[l,u,m]=(0,ds.Z)(!1),[h,p,g]=(0,ds.Z)(!1),{isMobile:f}=(0,T.ZP)(),I=t?.until?1e3*t.until-Date.now()+1e3*(0,ue.Qj)():void 0;(0,Ct.Z)(i,I),(0,Ss.Z)((e=>{let[s]=e;r&&t&&s&&t.documentId!==s.documentId&&(u(),d())}),[t,r,u,d]);const v=(0,it.I4)((e=>{c(),s({emojiStatus:e})}),[c,s]);(0,Ct.Z)(m,l?1500:void 0);const w=(0,it.I4)((()=>{p()}),[p]);return it.ZP.createElement("div",{className:"extra-spacing"},Boolean(l&&t)&&it.ZP.createElement(Es.Z,{reaction:t,isLottie:!0,className:"emoji-status-effect"}),it.ZP.createElement(Jt.Z,{round:!0,ref:o,ripple:!f,size:"smaller",color:"translucent",className:"emoji-status",onClick:w},t?it.ZP.createElement(Cs.Z,{key:t.documentId,documentId:t.documentId,size:24,loopLimit:n.y3O}):it.ZP.createElement(Ms.Z,null)),it.ZP.createElement(Rs,{statusButtonRef:o,isOpen:h,onEmojiStatusSelect:v,onClose:g}))}))),Ts={date:void 0},As={id:void 0},Ns=(0,it.X$)((0,a.c$)((e=>{const t=(0,v.jUK)(e),{query:s,fetchingStatus:a,chatId:n,date:i}=t.globalSearch,{connectionState:o,isSyncing:r,isFetchingDifference:c}=e,{isConnectionStatusMinimized:d}=e.settings.byKey;return{searchQuery:s,isLoading:!!a&&Boolean(a.chats||a.messages),globalSearchChatId:n,searchDate:i,theme:(0,v.Puy)(e),connectionState:o,isSyncing:r,isFetchingDifference:c,isMessageListOpen:Boolean((0,v.Btg)(e)),isConnectionStatusMinimized:d,isCurrentUserPremium:(0,v.wVz)(e),areChatsLoaded:Boolean(e.chats.listIds.active),hasPasscode:Boolean(e.passcode.hasPasscode),canSetPasscode:(0,v.eB8)(e)}}))((e=>{let{shouldHideSearch:t,content:s,contactsFilter:o,isClosingSearch:r,searchQuery:d,isLoading:l,isCurrentUserPremium:u,shouldSkipTransition:m,globalSearchChatId:h,searchDate:p,theme:g,connectionState:f,isSyncing:I,isFetchingDifference:v,isMessageListOpen:w,isConnectionStatusMinimized:y,areChatsLoaded:b,hasPasscode:P,canSetPasscode:Z,onSearchQuery:S,onSelectSettings:C,onSelectContacts:M,onSelectArchived:E,onReset:R}=e;const{setGlobalSearchDate:k,setSettingOption:A,setGlobalSearchChatId:N,lockScreen:B,requestNextSettingsScreen:x}=(0,a.Sv)(),L=(0,$t.Z)(),{isMobile:U}=(0,T.ZP)(),[O,j,_]=(0,ds.Z)(),F=s===c.du.ChatList,D=(0,it.Ye)((()=>p?(0,ae.xH)(new Date(1e3*p)):void 0),[p]),{connectionStatus:q,connectionStatusText:G,connectionStatusPosition:H}=rs(L,f,I||v,w,y,!b),V=(0,wt.Z)((e=>{e.preventDefault(),e.stopPropagation(),P?B():x({screen:c.MT.PasscodeDisabled})}));(0,Ft.y)(Z?{"Ctrl+Shift+L":V,"Alt+Shift+L":V,"Meta+Shift+L":V,...i.RM&&{"Mod+L":V}}:void 0);const $=(0,it.Ye)((()=>e=>{let{onTrigger:t,isOpen:s}=e;return it.ZP.createElement(Jt.Z,{round:!0,ripple:F&&!U,size:"smaller",color:"translucent",className:s?"active":"",onClick:F?t:()=>R(),ariaLabel:F?L("AccDescrOpenMenu2"):"Return to chat list"},it.ZP.createElement("div",{className:(0,dt.Z)("animated-menu-icon",!F&&"state-back",m&&"no-animation")}))}),[F,U,L,R,m]),J=(0,wt.Z)((()=>{d||S("")})),K=(0,wt.Z)((()=>{A({isConnectionStatusMinimized:!y})})),z=(0,wt.Z)((()=>{B()})),W=Boolean(h)||s===c.du.GlobalSearch||s===c.du.Contacts;(0,it.d4)((()=>W?(0,Ot.Z)((()=>R())):void 0),[W,R]);const Y=s===c.du.Contacts?L("SearchFriends"):L("Search"),X=n.Tjg?"10.0.14 Beta (master)":n.eMD?"master":"10.0.14",Q=(0,ft.Ar)(),{shouldDisableDropdownMenuTransitionRef:ee,handleDropdownMenuTransitionEnd:te}=(0,ls.Z)(t),se=(0,it.sO)(null);(0,cs.Z)(se);const ne=(0,it.Ye)((()=>it.ZP.createElement(it.ZP.Fragment,null,D&&it.ZP.createElement(us.Z,{icon:"calendar",title:D,canClose:!0,isMinimized:Boolean(h),className:"search-date",onClick:k,clickArg:Ts}),h&&it.ZP.createElement(us.Z,{peerId:h,onClick:N,canClose:!0,clickArg:As}))),[h,D]);return it.ZP.createElement("div",{className:"LeftMainHeader"},it.ZP.createElement("div",{id:"LeftMainHeader",className:"left-header",ref:se},L.isRtl&&it.ZP.createElement("div",{className:"DropdownMenuFiller"}),it.ZP.createElement(hs.Z,{trigger:$,footer:`${n.iCi} ${X}`,className:(0,dt.Z)("main-menu",L.isRtl&&"rtl",t&&L.isRtl&&"right-aligned",ee.current&&L.isRtl&&"disable-transition"),forceOpen:O,positionX:t&&L.isRtl?"right":"left",transformOriginX:i.D$&&i.jm&&!Q?90:void 0,onTransitionEnd:L.isRtl?te:void 0},it.ZP.createElement(Zs,{onSelectArchived:E,onSelectContacts:M,onSelectSettings:C,onBotMenuOpened:j,onBotMenuClosed:_})),it.ZP.createElement(ps.Z,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:(0,dt.Z)(h||p?"with-picker-item":void 0,t&&"SearchInput--hidden"),value:r?void 0:o||d,focused:W,isLoading:l||"minimized"===H,spinnerColor:"minimized"===H?"yellow":void 0,spinnerBackgroundColor:"minimized"===H&&"light"===g?"light":void 0,placeholder:Y,autoComplete:"off",canClose:Boolean(h||p),onChange:S,onReset:R,onFocus:J,onSpinnerClick:"minimized"===H?K:void 0},ne,it.ZP.createElement(ms.Z,{canShow:!W&&!D&&!h})),u&&it.ZP.createElement(ks,null),P&&it.ZP.createElement(Jt.Z,{round:!0,ripple:!U,size:"smaller",color:"translucent",ariaLabel:`${L("ShortcutsController.Others.LockByPasscode")} (Ctrl+Shift+L)`,onClick:z,className:(0,dt.Z)(!u&&"extra-spacing")},it.ZP.createElement("i",{className:"icon icon-lock"})),it.ZP.createElement(gs.Z,{isOpen:"overlay"===H,isCustom:!0,className:"connection-state-wrapper"},it.ZP.createElement(Is,{connectionStatus:q,connectionStatusText:G,onClick:K}))))}))),Bs=Object.keys(c.du).length/2;let xs;const Ls=(0,it.X$)((e=>{let{content:t,searchQuery:s,searchDate:o,isClosingSearch:r,contactsFilter:d,shouldSkipTransition:l,foldersDispatch:u,isAppUpdateAvailable:m,isElectronUpdateAvailable:h,isForumPanelOpen:p,onSearchQuery:g,onContentChange:f,onSettingsScreenSelect:I,onReset:v,onTopicSearch:w}=e;const{closeForumPanel:y}=(0,a.Sv)(),[b,P]=(0,it.eJ)(i.$b),[Z,S]=(0,it.eJ)(!1);(0,it.d4)((()=>{window.electron?.getIsAutoUpdateEnabled().then(S)}),[]);const{shouldRenderForumPanel:C,handleForumPanelAnimationEnd:M,handleForumPanelAnimationStart:E,isAnimationStarted:R}=(0,Vt.Z)(p),k=p&&t===c.du.ChatList,T=k&&R,{shouldRender:A,transitionClassNames:N}=(0,Zt.Z)(m||h),B=(0,it.sO)(!1),x=(0,wt.Z)((()=>{t===c.du.ChatList&&(B.current=!0,P(!0))})),L=(0,wt.Z)((()=>{B.current=!1,xs&&(clearTimeout(xs),xs=void 0),xs=window.setTimeout((()=>{B.current||P(!1)}),250)})),U=(0,wt.Z)((()=>{f(c.du.Settings)})),O=(0,wt.Z)((()=>{f(c.du.Contacts)})),j=(0,wt.Z)((()=>{f(c.du.Archived),y()})),_=(0,wt.Z)((()=>{i.D$&&!Z?window.open(`${n.bl0}/get`,"_blank","noopener"):h?window.electron?.installUpdate():window.location.reload()})),F=(0,wt.Z)((()=>{f(c.du.NewChannelStep1)})),D=(0,wt.Z)((()=>{f(c.du.NewGroupStep1)}));(0,it.d4)((()=>{let e;return t!==c.du.ChatList?e=window.setTimeout((()=>{P(!1)}),250):(B.current||i.$b)&&P(!0),()=>{e&&(clearTimeout(e),e=void 0)}}),[t]);const q=(0,$t.Z)();return it.ZP.createElement("div",{id:"LeftColumn-main",onMouseEnter:i.$b?void 0:x,onMouseLeave:i.$b?void 0:L},it.ZP.createElement(Ns,{shouldHideSearch:T,content:t,contactsFilter:d,onSearchQuery:g,onSelectSettings:U,onSelectContacts:O,onSelectArchived:j,onReset:v,shouldSkipTransition:l,isClosingSearch:r}),it.ZP.createElement(qt.ZP,{name:l?"none":"zoomFade",renderCount:Bs,activeKey:t,shouldCleanup:!0,cleanupExceptionKey:c.du.ChatList,shouldWrap:!0,wrapExceptionKey:c.du.ChatList},(e=>{switch(t){case c.du.ChatList:return it.ZP.createElement(as,{shouldHideFolderTabs:T,onSettingsScreenSelect:I,onLeftColumnContentChange:f,foldersDispatch:u,isForumPanelOpen:T});case c.du.GlobalSearch:return it.ZP.createElement(Yt,{searchQuery:s,searchDate:o,isActive:e,onReset:v});case c.du.Contacts:return it.ZP.createElement(ns,{filter:d,isActive:e,onReset:v});default:return}})),A&&it.ZP.createElement(Jt.Z,{fluid:!0,pill:!0,className:(0,dt.Z)("btn-update",N),onClick:_},q("lng_update_telegram")),C&&it.ZP.createElement(is.Z,{isOpen:p,isHidden:!k,onTopicSearch:w,onOpenAnimationStart:E,onCloseAnimationEnd:M}),it.ZP.createElement(Wt,{isShown:b,onNewPrivateChat:O,onNewChannel:F,onNewGroup:D}))})),Us=e=>{const t=(0,Mt.Z)(mt.gl.Extra,"NewChat");return t?it.ZP.createElement(t,e):it.ZP.createElement(Gt.Z,null)},Os=e=>{const t=(0,Mt.Z)(mt.gl.Extra,"Settings");return t?it.ZP.createElement(t,e):it.ZP.createElement(Gt.Z,null)};var js=function(e){return 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",e}(js||{});const _s=Object.keys(js).length/2,Fs=(0,it.X$)((0,a.c$)((e=>{const t=(0,v.jUK)(e),{globalSearch:{query:s,date:a},shouldSkipHistoryAnimations:n,activeChatFolder:i,nextSettingsScreen:o,nextFoldersAction:r,storyViewer:{isArchivedRibbonShown:c}}=t,{currentUserId:d,passcode:{hasPasscode:l},isAppUpdateAvailable:u,isElectronUpdateAvailable:m,archiveSettings:h}=e,p=(0,v.jrE)(e);return{searchQuery:s,searchDate:a,isFirstChatFolderActive:0===i,shouldSkipHistoryAnimations:n,currentUserId:d,hasPasscode:l,nextSettingsScreen:o,nextFoldersAction:r,isChatOpen:Boolean(p?.id),isAppUpdateAvailable:u,isElectronUpdateAvailable:m,isForumPanelOpen:(0,v.nd)(e),forumPanelChatId:t.forumPanelChatId,isClosingSearch:t.globalSearch.isClosing,archiveSettings:h,isArchivedStoryRibbonShown:c}}))((function(e){let{ref:t,searchQuery:s,searchDate:n,isFirstChatFolderActive:o,shouldSkipHistoryAnimations:r,currentUserId:d,hasPasscode:l,nextSettingsScreen:u,nextFoldersAction:m,isChatOpen:h,isAppUpdateAvailable:p,isElectronUpdateAvailable:g,isForumPanelOpen:f,forumPanelChatId:I,isClosingSearch:v,archiveSettings:w,isArchivedStoryRibbonShown:y}=e;const{setGlobalSearchQuery:b,setGlobalSearchClosing:P,setGlobalSearchChatId:Z,resetChatCreation:S,setGlobalSearchDate:C,loadPasswordInfo:M,clearTwoFaError:E,openChat:R,requestNextSettingsScreen:k}=(0,a.Sv)(),[T,A]=(0,it.eJ)(c.du.ChatList),[N,B]=(0,it.eJ)(c.MT.Main),[x,L]=(0,it.eJ)(""),[U,O]=(0,_t.ZP)(),[j,_]=(0,it.eJ)(0);let F=js.Main;switch(T){case c.du.Archived:F=js.Archived;break;case c.du.Settings:F=js.Settings;break;case c.du.NewChannelStep1:case c.du.NewChannelStep2:F=js.NewChannel;break;case c.du.NewGroupStep1:case c.du.NewGroupStep2:F=js.NewGroup}const D=(0,wt.Z)((e=>{function t(){A(c.du.ChatList),B(c.MT.Main),L(""),P({isClosing:!0}),S(),setTimeout((()=>{b({query:""}),C({date:void 0}),Z({id:void 0}),P({isClosing:!1}),_(Date.now())}),250)}if(!0!==e)if(T!==c.du.NewGroupStep2)if(T!==c.du.NewChannelStep2){if(T===c.du.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(T===c.du.Settings)switch(N){case c.MT.EditProfile:case c.MT.Folders:case c.MT.General:case c.MT.Notifications:case c.MT.DataStorage:case c.MT.Privacy:case c.MT.Performance:case c.MT.ActiveSessions:case c.MT.Language:case c.MT.Stickers:case c.MT.Experimental:return void B(c.MT.Main);case c.MT.GeneralChatBackground:return void B(c.MT.General);case c.MT.GeneralChatBackgroundColor:return void B(c.MT.GeneralChatBackground);case c.MT.PrivacyPhoneNumber:case c.MT.PrivacyAddByPhone:case c.MT.PrivacyLastSeen:case c.MT.PrivacyProfilePhoto:case c.MT.PrivacyBio:case c.MT.PrivacyPhoneCall:case c.MT.PrivacyPhoneP2P:case c.MT.PrivacyForwarding:case c.MT.PrivacyGroupChats:case c.MT.PrivacyVoiceMessages:case c.MT.PrivacyBlockedUsers:case c.MT.ActiveWebsites:case c.MT.TwoFaDisabled:case c.MT.TwoFaEnabled:case c.MT.TwoFaCongratulations:case c.MT.PasscodeDisabled:case c.MT.PasscodeEnabled:case c.MT.PasscodeCongratulations:return void B(c.MT.Privacy);case c.MT.PasscodeNewPasscode:return void B(l?c.MT.PasscodeEnabled:c.MT.PasscodeDisabled);case c.MT.PasscodeChangePasscodeCurrent:case c.MT.PasscodeTurnOff:return void B(c.MT.PasscodeEnabled);case c.MT.PasscodeNewPasscodeConfirm:return void B(c.MT.PasscodeNewPasscode);case c.MT.PasscodeChangePasscodeNew:return void B(c.MT.PasscodeChangePasscodeCurrent);case c.MT.PasscodeChangePasscodeConfirm:return void B(c.MT.PasscodeChangePasscodeNew);case c.MT.PrivacyPhoneNumberAllowedContacts:case c.MT.PrivacyPhoneNumberDeniedContacts:return void B(c.MT.PrivacyPhoneNumber);case c.MT.PrivacyLastSeenAllowedContacts:case c.MT.PrivacyLastSeenDeniedContacts:return void B(c.MT.PrivacyLastSeen);case c.MT.PrivacyProfilePhotoAllowedContacts:case c.MT.PrivacyProfilePhotoDeniedContacts:return void B(c.MT.PrivacyProfilePhoto);case c.MT.PrivacyBioAllowedContacts:case c.MT.PrivacyBioDeniedContacts:return void B(c.MT.PrivacyBio);case c.MT.PrivacyPhoneCallAllowedContacts:case c.MT.PrivacyPhoneCallDeniedContacts:return void B(c.MT.PrivacyPhoneCall);case c.MT.PrivacyPhoneP2PAllowedContacts:case c.MT.PrivacyPhoneP2PDeniedContacts:return void B(c.MT.PrivacyPhoneP2P);case c.MT.PrivacyForwardingAllowedContacts:case c.MT.PrivacyForwardingDeniedContacts:return void B(c.MT.PrivacyForwarding);case c.MT.PrivacyVoiceMessagesAllowedContacts:case c.MT.PrivacyVoiceMessagesDeniedContacts:return void B(c.MT.PrivacyVoiceMessages);case c.MT.PrivacyGroupChatsAllowedContacts:case c.MT.PrivacyGroupChatsDeniedContacts:return void B(c.MT.PrivacyGroupChats);case c.MT.TwoFaNewPassword:return void B(c.MT.TwoFaDisabled);case c.MT.TwoFaNewPasswordConfirm:return void B(c.MT.TwoFaNewPassword);case c.MT.TwoFaNewPasswordHint:return void B(c.MT.TwoFaNewPasswordConfirm);case c.MT.TwoFaNewPasswordEmail:return void B(c.MT.TwoFaNewPasswordHint);case c.MT.TwoFaNewPasswordEmailCode:return void B(c.MT.TwoFaNewPasswordEmail);case c.MT.TwoFaChangePasswordCurrent:case c.MT.TwoFaTurnOff:case c.MT.TwoFaRecoveryEmailCurrentPassword:return void B(c.MT.TwoFaEnabled);case c.MT.TwoFaChangePasswordNew:return void B(c.MT.TwoFaChangePasswordCurrent);case c.MT.TwoFaChangePasswordConfirm:return void B(c.MT.TwoFaChangePasswordNew);case c.MT.TwoFaChangePasswordHint:return void B(c.MT.TwoFaChangePasswordConfirm);case c.MT.TwoFaRecoveryEmail:return void B(c.MT.TwoFaRecoveryEmailCurrentPassword);case c.MT.TwoFaRecoveryEmailCode:return void B(c.MT.TwoFaRecoveryEmail);case c.MT.FoldersCreateFolder:case c.MT.FoldersEditFolder:return void B(c.MT.Folders);case c.MT.FoldersShare:return void B(c.MT.FoldersEditFolder);case c.MT.FoldersIncludedChatsFromChatList:case c.MT.FoldersExcludedChatsFromChatList:return void B(c.MT.FoldersEditFolderFromChatList);case c.MT.FoldersEditFolderFromChatList:case c.MT.FoldersEditFolderInvites:return A(c.du.ChatList),void B(c.MT.Main);case c.MT.QuickReaction:case c.MT.CustomEmoji:return void B(c.MT.Stickers);case c.MT.DoNotTranslate:return void B(c.MT.Language)}T===c.du.ChatList&&o?A(c.du.GlobalSearch):t()}else A(c.du.NewChannelStep1);else A(c.du.NewGroupStep1);else t()})),q=(0,wt.Z)((e=>{T!==c.du.Contacts?(A(c.du.GlobalSearch),e!==s&&b({query:e})):L(e)})),G=(0,wt.Z)((()=>{A(c.du.GlobalSearch),b({query:""}),Z({id:I})}));(0,it.d4)((()=>{const e=T===c.du.Archived,t=T===c.du.ChatList,s=!h&&!f;return e&&s||!t&&!e||o&&s?(0,Ot.Z)((()=>{D()})):void 0}),[o,T,D,h,f]);const H=(0,wt.Z)((e=>{T!==c.du.GlobalSearch&&(e.preventDefault(),A(c.du.GlobalSearch))})),V=(0,wt.Z)((e=>{e.preventDefault(),R({id:d,shouldReplaceHistory:!0})})),$=(0,wt.Z)((e=>{e.preventDefault(),A(c.du.Archived)})),J=(0,wt.Z)((e=>{e.preventDefault(),A(c.du.Settings)}));(0,Ft.y)({"Mod+Shift+F":H,"Mod+Shift+S":V,...i.RM&&{"Mod+0":V,"Mod+9":$},...i.jm&&i.RM&&{"Mod+,":J}}),(0,it.d4)((()=>{E(),N===c.MT.Privacy&&M()}),[E,M,N]),(0,St.Z)((()=>{void 0!==u&&(A(c.du.Settings),B(u),k({screen:void 0})),m&&O(m)}),[O,m,u,k]);const K=(0,wt.Z)((e=>{A(c.du.Settings),B(e)})),z=(0,Dt.Y)(function(e){const t=(0,it.sO)(),s=(0,it.sO)();return s.current!==e&&(t.current=s.current),s.current=e,t.current}(F===js.Settings?N:-1));function W(e){switch(F){case js.Archived:return it.ZP.createElement(Ht,{isActive:e,onReset:D,onTopicSearch:G,foldersDispatch:O,onSettingsScreenSelect:K,onLeftColumnContentChange:A,isForumPanelOpen:f,archiveSettings:w,isStoryRibbonShown:y});case js.Settings:return it.ZP.createElement(Os,{isActive:e,currentScreen:N,foldersState:U,foldersDispatch:O,shouldSkipTransition:r,onScreenSelect:K,onReset:D});case js.NewChannel:return it.ZP.createElement(Us,{key:j,isActive:e,isChannel:!0,content:T,onContentChange:A,onReset:D});case js.NewGroup:return it.ZP.createElement(Us,{key:j,isActive:e,content:T,onContentChange:A,onReset:D});default:return it.ZP.createElement(Ls,{content:T,isClosingSearch:v,searchQuery:s,searchDate:n,contactsFilter:x,foldersDispatch:O,onContentChange:A,onSearchQuery:q,onSettingsScreenSelect:K,onReset:D,shouldSkipTransition:r,isAppUpdateAvailable:p,isElectronUpdateAvailable:g,isForumPanelOpen:f,onTopicSearch:G})}}return(0,it.d4)((()=>{if(i.$b)return(0,jt.U)(t.current,{excludedClosestSelector:".ProfileInfo, .color-picker, .hue-picker",onSwipeRightStart:D,onCancel:()=>{A(c.du.Settings),K(z.current)}})}),[z,t]),it.ZP.createElement(qt.ZP,{ref:t,name:r?"none":i.s0,renderCount:_s,activeKey:F,shouldCleanup:!0,cleanupExceptionKey:js.Main,shouldWrap:!0,wrapExceptionKey:js.Main,id:"LeftColumn",withSwipeControl:!0},W)}))),Ds=e=>{let{isOpen:t}=e;const s=(0,Mt.Z)(mt.gl.Extra,"MediaViewer",!t);return s?it.ZP.createElement(s,null):void 0};var qs=s(10396),Gs=s(64532),Hs=s(32340),Vs=s(23186),$s=s(17240),Js=s(93447),Ks=s(77510),zs=s(6202);const Ws=s.p+"telegram-logo-filled.67469f6dc5e301e8e0bd.svg",Ys={width:200,height:200},Xs=115;var Qs=s(18051),ea=s(68512);const ta={.5:.66,.75:.8,1:1,1.5:1.4,2:1.8},sa=Object.keys(ta).sort().map(Number),aa=(0,a.c$)(((e,t)=>{let{message:s}=t;const a=(0,v.Urc)(e,s),n=(0,v.Z1J)(e,s.chatId),{volume:i,playbackRate:o,isMuted:r,isPlaybackRateActive:c}=(0,v.jUK)(e).audioPlayer;return{sender:a,chat:n,volume:i,playbackRate:o,isPlaybackRateActive:c,isMuted:r}}))((e=>{let{message:t,className:s,noUi:o,sender:r,chat:c,volume:d,playbackRate:l,isPlaybackRateActive:u,isMuted:m}=e;const{setAudioPlayerVolume:h,setAudioPlayerPlaybackRate:p,setAudioPlayerMuted:f,focusMessage:I,closeAudioPlayer:v}=(0,a.Sv)(),w=(0,it.sO)(null),y=(0,$t.Z)(),{isMobile:b}=(0,T.ZP)(),{audio:Z,voice:S,video:C}=(0,g.qp)(t),M=Boolean(S||C),E=M||(Z?.duration||0)>n.J0S,R=r?(0,g.OU)(y,r):void 0,k=Me.UV((0,g.Ti)(t,"inline")),A=((e,t,s)=>{const a=(0,$t.Z)(),{audio:n,voice:i}=(0,g.qp)(e),o=n?n.title||n.fileName:i?"Voice message":"",r=n?.performer||t&&(0,g.OU)(a,t),c=s&&(0,g.U)(a,s)||"Telegram",d=n&&(0,g.MR)(n)&&(0,g.Ti)(e,"pictogram"),l=t&&(0,g.RT)(t,"big"),u=n&&d||i&&l,m=(0,zs.Z)(u),h=(0,it.Ye)((()=>function(e,t,s){if(!s)return Ys;if(e){if(!e.thumbnailSizes?.length)return;const t=e.thumbnailSizes.find((e=>"m"===e.type));return t||e.thumbnailSizes[0]}return t?P.vY:void 0}(n,i,m)),[n,m,i]),{result:p}=(0,Ks.Z)((()=>function(e,t){if(!e)return Promise.resolve(Ws);if(!t)return(0,Js.t)(e,Xs,Xs);const s=Math.min(t.width,t.height);if(s<Xs){const t=Xs/s;return(0,Js.j)(e,t)}return Promise.resolve(e)}(m,h)),[m,h],Ws);return(0,it.Ye)((()=>(0,Gs.Of)({title:o,artist:r,album:c,artwork:[{src:p}]})),[c,r,o,p])})(t,r,c),{playPause:N,stop:B,isPlaying:x,requestNextTrack:L,requestPreviousTrack:U,isFirst:O,isLast:j,setVolume:_,toggleMuted:F,setPlaybackRate:D}=(0,Vs.Z)((0,qs.An)(t),(0,g.XV)(t),M?"voice":"audio",k,void 0,A,void 0,!0,void 0,void 0,(0,g.CI)(t),!0),{isContextMenuOpen:q,handleBeforeContextMenu:G,handleContextMenu:H,handleContextMenuClose:V,handleContextMenuHide:$}=(0,$s.Z)(w),J=(0,wt.Z)((()=>{I({chatId:t.chatId,messageId:t.id})})),K=(0,wt.Z)((()=>{x&&N(),v(),(0,Gs.Ay)(),B()})),z=(0,wt.Z)((e=>{h({volume:e/100}),_(e/100)})),W=(0,wt.Z)((()=>{i.$b&&!i.cj||(F(),f({isMuted:!m}))})),Y=(0,wt.Z)((function(e){const t=ta[e],s=1!==e&&(!(arguments.length>1&&void 0!==arguments[1])||arguments[1]);p({playbackRate:t,isPlaybackRateActive:s}),D(s?t:1)})),X=(0,wt.Z)((()=>{V();const e=Number(Object.entries(ta).find((e=>{let[,t]=e;return t===l}))?.[0])||1,t=!u;Y(t&&1===e?2:e,t)})),Q=(0,wt.Z)((()=>{const e=Object.entries(ta).find((e=>{let[,t]=e;return t===l}))?.[0]||1,t=`${1===l?2:e}Х`;return it.ZP.createElement("div",{className:"playback-wrapper"},q&&it.ZP.createElement("div",{className:"playback-backdrop",onClick:V}),it.ZP.createElement(Jt.Z,{round:!0,className:(0,dt.Z)("playback-button",u&&"applied",q&&"on-top"),color:"translucent",size:"smaller",ariaLabel:"Playback Rate",ripple:!b,onMouseEnter:H,onClick:X,onMouseDown:G,onContextMenu:H},it.ZP.createElement("span",{className:(0,dt.Z)("playback-button-inner",4===t.length&&"small",5===t.length&&"tiny")},t)))})),ee=(0,it.Ye)((()=>0===d||m?"icon-muted":d<.3?"icon-volume-1":d<.6?"icon-volume-2":"icon-volume-3"),[d,m]);if(!o)return it.ZP.createElement("div",{className:(0,dt.Z)("AudioPlayer",s),dir:y.isRtl?"rtl":void 0,ref:w},it.ZP.createElement("div",{className:"AudioPlayer-content",onClick:J},Z?function(e){const{title:t,performer:s,fileName:a}=e;return it.ZP.createElement(it.ZP.Fragment,null,it.ZP.createElement("div",{className:"title",dir:"auto"},(0,Hs.Z)(t||a)),s&&it.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,Hs.Z)(s)))}(Z):function(e,t){return it.ZP.createElement(it.ZP.Fragment,null,it.ZP.createElement("div",{className:"title",dir:"auto"},t&&(0,Hs.Z)(t)),it.ZP.createElement("div",{className:"subtitle",dir:"auto"},e))}(y("AttachAudio"),R),it.ZP.createElement(ea.Z,null)),it.ZP.createElement(Jt.Z,{round:!0,ripple:!b,color:"translucent",size:"smaller",className:"player-button",disabled:O(),onClick:U,ariaLabel:"Previous track"},it.ZP.createElement("i",{className:"icon icon-skip-previous"})),it.ZP.createElement(Jt.Z,{round:!0,ripple:!b,color:"translucent",size:"smaller",className:(0,dt.Z)("toggle-play","player-button",x?"pause":"play"),onClick:N,ariaLabel:x?"Pause audio":"Play audio"},it.ZP.createElement("i",{className:"icon icon-play"}),it.ZP.createElement("i",{className:"icon icon-pause"})),it.ZP.createElement(Jt.Z,{round:!0,ripple:!b,color:"translucent",size:"smaller",className:"player-button",disabled:j(),onClick:L,ariaLabel:"Next track"},it.ZP.createElement("i",{className:"icon icon-skip-next"})),it.ZP.createElement("div",{className:"volume-button-wrapper"},it.ZP.createElement(Jt.Z,{round:!0,className:"player-button volume-button",color:"translucent",size:"smaller",ariaLabel:"Volume",onClick:W,ripple:!b},it.ZP.createElement("i",{className:(0,dt.Z)("icon",ee)})),!i.cj&&it.ZP.createElement("div",{className:"volume-slider-wrapper"},it.ZP.createElement("div",{className:"volume-slider-spacer"}),it.ZP.createElement("div",{className:"volume-slider"},it.ZP.createElement(Qs.Z,{bold:!0,value:m?0:100*d,onChange:z})))),E&&it.ZP.createElement(hs.Z,{forceOpen:q,positionX:"right",positionY:"top",className:"playback-rate-menu",trigger:Q,onClose:V,onHide:$,onMouseEnterBackdrop:V},sa.map((e=>function(e,t,s,a){const n=t===ta[e]&&a||1===e&&!a;return it.ZP.createElement(zt.Z,{key:e,onClick:()=>s(e),icon:n?"check":void 0,customIcon:n?void 0:it.ZP.createElement("i",{className:"icon icon-placeholder"})},e,"X")}(e,l,Y,u)))),it.ZP.createElement(Jt.Z,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:K,ariaLabel:"Close player"},it.ZP.createElement("i",{className:"icon icon-close"})))})),na=e=>{const{isOpen:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"ReactionPicker",!t);return s?it.ZP.createElement(s,e):void 0};function ia(){return ia=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},ia.apply(this,arguments)}const oa=(0,it.X$)((0,a.c$)((e=>({messageLists:(0,v.jUK)(e).messageLists})))((e=>{let{messageLists:t}=e;const{openChat:s}=(0,a.Sv)(),n=()=>{s({id:void 0},{forceSyncOnIOs:!0})},i=e=>{let{chatId:t,type:s,threadId:a}=e;(0,Qt.Z)({isActive:!0,hash:(0,Re.tB)(t,s,a),onBack:n})};return it.ZP.createElement("div",null,t?.map(((e,t)=>it.ZP.createElement(i,ia({key:`${e.chatId}_${e.threadId}_${e.type}_${t}`},e)))))})));var ra=s(80036),ca=s(49524),da=s(71394);var la=s(52678),ua=s(87204),ma=s(12255),ha=s(3570),pa=s(28712),ga=s(33799),fa=s(36103);const Ia=e=>{const{isOpen:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"SeenByModal",!t);return s?it.ZP.createElement(s,e):void 0},va=e=>{const{isOpen:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"UnpinAllMessagesModal",!t);return s?it.ZP.createElement(s,e):void 0},wa=e=>{const{isOpen:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"GiftPremiumModal",!t);return s?it.ZP.createElement(s,e):void 0},ya=e=>{const{isOpen:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"ChatLanguageModal",!t);return s?it.ZP.createElement(s,e):void 0};var ba=s(12420);const Pa=e=>{const{activeEmojiInteraction:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"EmojiInteractionAnimation",!t);return s?it.ZP.createElement(s,e):void 0};var Za=s(81740);const Sa=(0,it.X$)((e=>{let{icon:t,ariaLabelLang:s,unreadCount:a,onClick:n,onReadAll:i,className:o}=e;const r=(0,$t.Z)(),c=(0,it.sO)(null),{isContextMenuOpen:d,handleContextMenu:l,handleContextMenuClose:u,handleContextMenuHide:m}=(0,$s.Z)(c,!i);return it.ZP.createElement("div",{className:(0,dt.Z)("KboxtoWkfx23zfklH_Zg",o),ref:c},it.ZP.createElement(Jt.Z,{color:"secondary",round:!0,className:"sgkkv3bmIMAZS9G9BHUz",onClick:n,onContextMenu:l,ariaLabel:r(s)},it.ZP.createElement("i",{className:(0,dt.Z)("AafG9_xBi_2eJ_bFNnNg","icon",`icon-${t}`)})),Boolean(a)&&it.ZP.createElement("div",{className:"yKN1kQ3YXf4SHHIBcotS"},(0,xt.bi)(a)),i&&it.ZP.createElement(Kt.Z,{isOpen:d,onClose:u,onCloseAnimationEnd:m,autoClose:!0,positionX:"right",positionY:"bottom"},it.ZP.createElement(zt.Z,{icon:"readchats",onClick:i},r("MarkAllAsRead"))))})),Ca="EcdaljLbQ7DJN9gbQpSC",Ma=(0,it.X$)((0,a.c$)((e=>{const t=(0,v.Btg)(e);if(!t)return{};const{chatId:s,threadId:a,type:n}=t,i=(0,v.Z1J)(e,s),o=i&&a===r._f&&"thread"===n;return{messageListType:n,chatId:s,reactionsCount:o?i.unreadReactionsCount:void 0,mentionsCount:o?i.unreadMentionsCount:void 0,unreadCount:o?i.unreadCount:void 0}}))((e=>{let{isShown:t,canPost:s,messageListType:n,chatId:i,unreadCount:o,reactionsCount:r,mentionsCount:c,withExtraShift:d}=e;const{focusNextReply:l,focusNextReaction:u,focusNextMention:m,fetchUnreadReactions:h,readAllMentions:p,readAllReactions:g,fetchUnreadMentions:f}=(0,a.Sv)(),I=(0,it.sO)(null),v=Boolean(r),w=Boolean(c);(0,it.d4)((()=>{v&&i&&h({chatId:i})}),[i,h,v]),(0,it.d4)((()=>{w&&i&&f({chatId:i})}),[i,f,w]);const y=(0,wt.Z)((()=>{if(t)if("thread"===n)l();else{const e=I.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),s=t[t.length-1];if(!s)return;(0,Za.ZP)(e,s,"end",20)}})),b=(0,dt.Z)("quM3aP53TOfurCEOYgOE",(t||Boolean(r)||Boolean(c))&&"Gutr8PrNAFFTnrIdgK_l",(Boolean(r)||Boolean(c))&&!t&&"bHOz3QboabL0RvHuj3ku",!s&&"r7RXnwv5TF4Cf2V0d5Mf",!d&&"S98OqutuQVCNVHgTrKv4");return it.ZP.createElement("div",{ref:I,className:b},it.ZP.createElement(Sa,{icon:"heart-outline",ariaLabelLang:"AccDescrReactionMentionDown",onClick:u,onReadAll:g,unreadCount:r,className:(0,dt.Z)("wHTB_MNtk9J6I3F_4eVE",!v&&Ca,!w&&"uHEtFnXb6pb14Jf0EsDr")}),it.ZP.createElement(Sa,{icon:"mention",ariaLabelLang:"AccDescrMentionDown",onClick:m,onReadAll:p,unreadCount:c,className:!w&&Ca}),it.ZP.createElement(Sa,{icon:"arrow-down",ariaLabelLang:"AccDescrPageDown",onClick:y,unreadCount:o,className:"Hoi4yrJrfBHTmvB8TPce"}))})));var Ea=s(87675);function Ra(e){return"albumId"in e}function ka(e,t){let s,a=[],n={originalDate:e[0].date,datetime:(0,ae._F)(1e3*e[0].date),senderGroups:[a]};const i=[n];return e.forEach(((o,r)=>{o.isInAlbum?s?(s.messages.push(o),o.content.text&&(s.mainMessage=o)):s={albumId:o.groupedId,messages:[o],mainMessage:o}:a.push(o);const c=e[r+1];if(!s||c&&c.groupedId&&c.groupedId===s.albumId||(a.push(s),s=void 0),c){const e=(0,ae._F)(1e3*c.date);n.datetime!==e?(n={originalDate:c.date,datetime:e,senderGroups:[]},i.push(n),a=[],n.senderGroups.push(a)):(c.id===t||o.senderId!==c.senderId||o.isOutgoing!==c.isOutgoing||(0,g.FT)(o)&&!o.content.action?.phoneCall||(0,g.FT)(c)&&!c.content.action?.phoneCall||o.inlineButtons||c.inlineButtons||c.date-o.date>600)&&(a=[],n.senderGroups.push(a))}})),i}var Ta=s(30386),Aa=s(72645),Na=s(60998);var Ba=s(78722),xa=s(88957);var La=s(36765);const Ua=(0,it.X$)((0,a.c$)(((e,t)=>{let{userId:s}=t;const{stickers:a}=e.stickers.greeting,n=(0,g.R0)(s)+(0,g.R0)(e.currentUserId),i=a?.length?a[n%a.length]:void 0,o=(0,v.Z1J)(e,s);return o?{sticker:i,lastUnreadMessageId:o.lastMessage&&o.lastMessage.id!==o.lastReadInboxMessageId?o.lastMessage.id:void 0,connectionState:e.connectionState,currentMessageList:(0,v.Btg)(e)}:{}}))((e=>{let{sticker:t,connectionState:s,lastUnreadMessageId:n,currentMessageList:i}=e;const{loadGreetingStickers:o,sendMessage:r,markMessageListRead:c}=(0,a.Sv)(),d=(0,$t.Z)(),l=(0,it.sO)(null);(0,it.d4)((()=>{t||"connectionStateReady"!==s||o()}),[s,o,t]),(0,it.d4)((()=>{"connectionStateReady"===s&&n&&c({maxId:n})}),[s,c,n]);const u=(0,wt.Z)((()=>{i&&r({sticker:{...t,isPreloadedGlobally:!0},messageList:i})}));return it.ZP.createElement("div",{className:"ContactGreeting"},it.ZP.createElement("div",{className:"wrapper"},it.ZP.createElement("p",{className:"title",dir:"auto"},d("Conversation.EmptyPlaceholder")),it.ZP.createElement("p",{className:"description",dir:"auto"},d("Conversation.GreetingText")),it.ZP.createElement("div",{ref:l,className:"sticker",onClick:u},t&&it.ZP.createElement(La.Z,{containerRef:l,sticker:t,size:160}))))})));var Oa=s(57080),ja=s(74607);const _a=(0,it.X$)((0,a.c$)(((e,t)=>{let{chatId:s}=t;const a=(0,v.kBx)(e,s);let n,i=!1;if(a){const t=(0,v.ccz)(e,a.id);t?n=t.botInfo:i=!0}return{botInfo:n,isLoadingBotInfo:i}}))((e=>{let{botInfo:t,isLoadingBotInfo:s,isInMessageList:a}=e;const n=(0,$t.Z)(),o=(0,zs.Z)(t?.photo?(0,g.NF)(t.photo):void 0),r=(0,zs.Z)(t?.gif?(0,g.ym)(t.gif):void 0),c=t?.photo?(0,g.bV)(t.photo):t?.gif?(0,g.jC)(t.gif):void 0,d=c&&{width:c.width/i.cL,height:c.height/i.cL},l=t&&!t.description&&!t.gif&&!t.photo,{width:u,height:m}=d||{};if(!l&&!s||!a)return it.ZP.createElement("div",{className:(0,dt.Z)("Lsq8MNpDNQOesVld_hE2","empty")},s&&it.ZP.createElement("span",null,n("Loading")),l&&!s&&it.ZP.createElement("span",null,n("NoMessages")),t&&it.ZP.createElement("div",{className:"QDlMH9oNVNDnHBMnbvhw",style:d&&`width: ${d.width}px`},o&&it.ZP.createElement("img",{className:"ZAL3vluMFRM8wd30wuzL",src:o,width:d?.width,height:d?.height,alt:"Bot info"}),r&&it.ZP.createElement(Oa.Z,{canPlay:!0,src:r,loop:!0,disablePictureInPicture:!0,muted:!0,playsInline:!0,style:(0,ra.Z)(Boolean(u)&&`width: ${u}px`,Boolean(m)&&`height: ${m}px`)}),c&&!o&&!r&&it.ZP.createElement(ja.Z,{width:d?.width,height:d?.height}),t.description&&it.ZP.createElement("div",{className:"qhxnNXJM8_CyuUQ0pxo7"},it.ZP.createElement("p",{className:"mdOWgfW0GwJTT3vqO5_M"},n("BotInfoTitle")),(0,Hs.Z)(t.description,["br","emoji","links"]))))})));var Fa=s(71790),Da=s(3657);const qa=i.wZ?1e3:350;var Ga=s(11309),Ha=s(93862),Va=s(78323),$a=s(55254),Ja=s(44139),Ka=s(83967);const za={None:0,Top:1,Right:2,Bottom:4,Left:8};function Wa(e,t){return e.reduce(((e,t)=>e+t),t)}function Ya(e){const t={width:0,height:0};return e.forEach((e=>{let{dimensions:s,sides:a}=e;a&za.Right&&(t.width=s.width+s.x),a&za.Bottom&&(t.height=s.height+s.y)})),t}function Xa(e,t,s,a,n){const i=function(e,t){return e.map((e=>{const s=(0,Ka.GH)(e,void 0,void 0,t);return s.width/s.height}))}(a.messages,n),o=function(e){return e.map((e=>e>1.2?"w":e<.8?"n":"q")).join("")}(i),r=function(e){return e.reduce(((e,t)=>t+e),1)/e.length}(i),c=i.length,d=i.some((e=>e>2)),l=(0,P.kc)(e,t,!1,s,n)-(t?2.5:0)*P.Gw;let u;const m={ratios:i,proportions:o,averageRatio:r,maxWidth:l,minWidth:100,maxHeight:l,spacing:2};return u=c>=5||d?function(e){let{ratios:t,averageRatio:s,maxWidth:a,minWidth:n,spacing:i,maxHeight:o=4*a/3}=e;const r=function(e,t){return e.map((e=>t>1.1?(0,pa.uZ)(e,1,2.75):(0,pa.uZ)(e,.6667,1)))}(t,s),c=t.length,d=new Array(c),l=[],u=e=>{const t=[];let s=0;e.forEach((e=>{t.push(((e,t)=>{const s=Wa(r.slice(e,e+t),0);return(a-(t-1)*i)/s})(s,e)),s+=e})),l.push({lineCounts:e,heights:t})};for(let e=1;e!==c;++e){const t=c-e;e<=3&&t<=3&&u([e,t])}for(let e=1;e!==c-1;++e)for(let t=1;t!==c-e;++t){const a=c-e-t;e<=3&&t<=(s<.85?4:3)&&a<=3&&u([e,t,a])}for(let e=1;e!==c-1;++e)for(let t=1;t!==c-e;++t)for(let s=1;s!==c-e-t;++s){const a=c-e-t-s;e<=3&&t<=3&&s<=3&&a<=4&&u([e,t,s,a])}let m,h=0;for(let e=0;e<l.length;e++){const{heights:t,lineCounts:s}=l[e],a=s.length,r=Wa(t,0)+i*(a-1),c=Math.min(...t)<n?1.5:1,d=(()=>{for(let e=1;e!==a;++e)if(s[e-1]>s[e])return 1.5;return 1})(),u=Math.abs(r-o)*c*d;(!m||u<h)&&(m=l[e],h=u)}const p=m.lineCounts,g=m.heights,f=p.length;let I=0,v=0;for(let e=0;e!==f;++e){const t=p[e],s=g[e],n=Math.round(s);let o=0;for(let c=0;c!==t;++c){const l=za.None|(0===e?za.Top:za.None)|(e===f-1?za.Bottom:za.None)|(0===c?za.Left:za.None)|(c===t-1?za.Right:za.None),u=r[I],m=c===t-1?a-o:Math.round(u*s);d[I]={dimensions:{x:o,y:v,width:m,height:n},sides:l},o+=m+i,++I}v+=n+i}return d}(m):2===c?function(e){const{ratios:t,proportions:s,averageRatio:a}=e;return"ww"===s&&a>1.4&&t[1]-t[0]<.2?function(e){const{ratios:t,maxWidth:s,spacing:a,maxHeight:n}=e,i=Math.round(Math.min(s/t[0],Math.min(s/t[1],(n-a)/2)));return[{dimensions:{x:0,y:0,width:s,height:i},sides:za.Left|za.Top|za.Right},{dimensions:{x:0,y:i+a,width:s,height:i},sides:za.Left|za.Bottom|za.Right}]}(e):"ww"===s||"qq"===s?function(e){const{ratios:t,maxWidth:s,spacing:a,maxHeight:n}=e,i=(s-a)/2,o=Math.round(Math.min(i/t[0],Math.min(i/t[1],n)));return[{dimensions:{x:0,y:0,width:i,height:o},sides:za.Top|za.Left|za.Bottom},{dimensions:{x:i+a,y:0,width:i,height:o},sides:za.Top|za.Right|za.Bottom}]}(e):function(e){const{ratios:t,minWidth:s,maxWidth:a,spacing:n,maxHeight:i}=e,o=Math.round(1.5*s),r=Math.min(Math.round(Math.max(.4*(a-n),(a-n)/t[0]/(1/t[0]+1/t[1]))),a-n-o),c=a-r-n,d=Math.min(i,Math.round(Math.min(c/t[0],r/t[1])));return[{dimensions:{x:0,y:0,width:c,height:d},sides:za.Top|za.Left|za.Bottom},{dimensions:{x:c+n,y:0,width:r,height:d},sides:za.Top|za.Right|za.Bottom}]}(e)}(m):3===c?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:s,ratios:a,maxWidth:n,minWidth:i}=e,o=t,r=Math.round(Math.min((t-s)/2,a[1]*(n-s)/(a[2]+a[1]))),c=o-r-s,d=Math.max(i,Math.round(Math.min((n-s)/2,Math.min(r*a[2],c*a[1])))),l=Math.min(Math.round(o*a[0]),n-s-d);return[{dimensions:{x:0,y:0,width:l,height:o},sides:za.Top|za.Left|za.Bottom},{dimensions:{x:l+s,y:0,width:d,height:c},sides:za.Top|za.Right},{dimensions:{x:l+s,y:c+s,width:d,height:r},sides:za.Bottom|za.Right}]}(e):function(e){const{maxWidth:t,ratios:s,maxHeight:a,spacing:n}=e,i=t,o=Math.round(Math.min(i/s[0],.66*(a-n))),r=(t-n)/2,c=Math.min(a-o-n,Math.round(Math.min(r/s[1],r/s[2]))),d=i-r-n;return[{dimensions:{x:0,y:0,width:i,height:o},sides:za.Left|za.Top|za.Right},{dimensions:{x:0,y:o+n,width:r,height:c},sides:za.Bottom|za.Left},{dimensions:{x:r+n,y:o+n,width:d,height:c},sides:za.Bottom|za.Right}]}(e)}(m):function(e){const{proportions:t}=e;return"w"===t[0]?function(e){let{maxWidth:t,ratios:s,spacing:a,maxHeight:n,minWidth:i}=e;const o=t,r=Math.round(Math.min(o/s[0],.66*(n-a))),c=Math.round((t-2*a)/(s[1]+s[2]+s[3])),d=Math.max(i,Math.round(Math.min(.4*(t-2*a),c*s[1]))),l=Math.round(Math.max(Math.max(i,.33*(t-2*a)),c*s[3])),u=o-d-l-2*a,m=Math.min(n-r-a,c);return[{dimensions:{x:0,y:0,width:o,height:r},sides:za.Left|za.Top|za.Right},{dimensions:{x:0,y:r+a,width:d,height:m},sides:za.Bottom|za.Left},{dimensions:{x:d+a,y:r+a,width:u,height:m},sides:za.Bottom},{dimensions:{x:d+a+u+a,y:r+a,width:l,height:m},sides:za.Right|za.Bottom}]}(e):function(e){let{maxHeight:t,ratios:s,maxWidth:a,spacing:n,minWidth:i}=e;const o=t,r=Math.round(Math.min(o*s[0],.6*(a-n))),c=Math.round((t-2*n)/(1/s[1]+1/s[2]+1/s[3])),d=Math.round(c/s[1]),l=Math.round(c/s[2]),u=o-d-l-2*n,m=Math.max(i,Math.min(a-r-n,c));return[{dimensions:{x:0,y:0,width:r,height:o},sides:za.Top|za.Left|za.Bottom},{dimensions:{x:r+n,y:0,width:m,height:d},sides:za.Top|za.Right},{dimensions:{x:r+n,y:d+n,width:m,height:l},sides:za.Right},{dimensions:{x:r+n,y:d+l+2*n,width:m,height:u},sides:za.Bottom|za.Right}]}(e)}(m),{layout:u,containerStyle:Ya(u)}}var Qa=s(75790),en=s(31526),tn=s(46586),sn=s(74095);let an;const nn=new tn.Z;i.SX&&setTimeout((function(){an||(an=(0,sn.K)(new Worker(new URL(s.p+s.u(4923),s.b))),nn.resolve())}),4e3);var on=s(3927);let rn,cn;function dn(e,t,s){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var a=s.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}rn=Symbol.toStringTag,cn=Symbol.iterator;class ln{constructor(e){this.limit=e,dn(this,"map",void 0),dn(this,"insertionQueue",void 0),this.map=new Map,this.insertionQueue=new Set}get(e){return this.map.get(e)}set(e,t){if(this.map.size===this.limit){const e=Array.from(this.insertionQueue).shift();e&&(this.map.delete(e),this.insertionQueue.delete(e))}return this.map.set(e,t),this.insertionQueue.add(e),this}delete(e){const t=this.map.delete(e);return t&&this.insertionQueue.delete(e),t}clear(){this.map.clear(),this.insertionQueue.clear()}forEach(e,t){this.map.forEach(e,t)}get size(){return this.map.size}get[rn](){return this.map[Symbol.toStringTag]}[cn](){return this.map[Symbol.iterator]()}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}}const un=new Map;const mn=(0,h.P2)((function(e){const{updateChatDetectedLanguage:t}=(0,a.Sv)(),s=un.get(e);if(!s)return;const n=s.size;if(n<8)return;let i=0,o=0;const r=new Map;for(const e of s.values()){e.isTranslatable&&i++,e.detectedLanguage&&o++;const t=e.detectedLanguage;if(t){const e=r.get(t)||0;r.set(t,e+1)}}if(i/n<.3||o/n<.6)return;t({chatId:e,detectedLanguage:Array.from(r.entries()).sort(((e,t)=>{let[,s]=e,[,a]=t;return a-s}))[0][0]})}),1e3);var hn=s(45277),pn=s(75368),gn=s(3858);const fn=3*P.Gw,In=Number(P.Gw),vn="data-is-document-group-hover";function wn(e,t,s,n,o,r,c,d,l,u,m,h,p){const{setReplyingToId:g,sendDefaultReaction:f}=(0,a.Sv)(),[I,v,w]=(0,ds.Z)(),[y,P,Z]=(0,ds.Z)(),S=(0,it.sO)(),C=(0,on.Z)((e=>{const t=m.current;if(!t)return;const{clientX:s,clientY:a}=e,{x:n,width:i,y:o,height:r}=t.getBoundingClientRect(),c=n+i/2,d=o+r/2,l=Math.abs(c-s)<fn,u=Math.abs(d-a)<In;l&&u?v():w()}),[m],ct.i$);return(0,it.d4)((()=>{if(!i.$b||n||!o||u||!p())return;let e;return(0,Xt.sf)(t.current,{selectorToPreventScroll:".MessageList",excludedClosestSelector:".no-word-wrap",onSwipe:(t,s)=>s===Xt.eM.Left&&(e||(e=Date.now()),P(),!0),onRelease:()=>{e&&o&&(g({messageId:s}),setTimeout(Z,Math.max(0,150-(Date.now()-e))),e=void 0)}})}),[t,n,s,g,P,Z,o,u,p]),{handleMouseDown:n?void 0:function(e){(0,Ta.q)(e),d(e)},handleClick:function(t){if(n)e(t);else if(i.$b)return S.current?(clearInterval(S.current),S.current=void 0,void f({chatId:l,messageId:s})):void(S.current=setTimeout((()=>{S.current=void 0,function(e){if(i.wZ){const t=e.target;if(!t.classList.contains("text-content")&&!t.classList.contains("Message"))return;b.Z.getIsKeyboardVisible()?setTimeout((()=>{c(e)}),350):c(e)}}(t)}),200))},handleContextMenu:n?r?gn.Z:void 0:function(t){if(i.wZ){if(t.target.matches("a[href]")||u)return;t.preventDefault(),e()}else c(t)},handleDoubleClick:n?void 0:function(){!i.$b&&o&&g({messageId:s})},handleContentDoubleClick:i.$b?void 0:function(e){e.stopPropagation()},handleMouseMove:C,handleSendQuickReaction:function(e){e.stopPropagation(),f({chatId:l,messageId:s})},handleMouseLeave:function(e){(0,ct.i$)(w),h&&function(e){const t=bn(e.currentTarget);t&&t.removeAttribute(vn)}(e)},isSwiped:y,isQuickReactionVisible:I,handleDocumentGroupMouseEnter:yn}}function yn(e){const t=bn(e.currentTarget);t&&t.setAttribute(vn,"")}function bn(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var Pn=s(54752),Zn=s(70172),Sn=s(82535),Cn=s(78780),Mn=s(84441),En=s(39415);const Rn=e=>{let{story:t,sender:s,noUserColors:n,isProtected:i,observeIntersectionForLoading:o,onClick:r}=e;const{showNotification:c}=(0,a.Sv)(),d=(0,$t.Z)(),l=(0,it.sO)(null),u=(0,Da.Op)(l,o),m=t&&"content"in t,h=t&&"isDeleted"in t,p=m&&Boolean(t.content.video),f=m?"Story":h?"ExpiredStory":"Loading",I=(0,zs.Z)(m&&(0,g.Cc)(t,"pictogram"),!u),v=p?t.content.video.thumbnail?.dataUri:void 0,w=I||v,y=s?(0,g.OU)(d,s):void 0,b=(0,wt.Z)((()=>{t&&!h?r():c({message:d("StoryNotFound")})})),{handleClick:Z,handleMouseDown:S}=(0,En.m)(b);return it.ZP.createElement("div",{ref:l,className:(0,dt.Z)("EmbeddedMessage",s&&!n&&`color-${(0,g.kj)(s)}`),onClick:Z,onMouseDown:S},w&&function(e,t){const{width:s,height:a}=(0,P.W7)();return it.ZP.createElement("div",{className:"embedded-thumb"},it.ZP.createElement("img",{src:e,width:s,height:a,alt:"",className:"pictogram",draggable:!1}),t&&it.ZP.createElement("span",{className:"protector"}))}(w,i),it.ZP.createElement("div",{className:"message-text with-message-color"},it.ZP.createElement("p",{dir:"auto"},h&&it.ZP.createElement("i",{className:"icon icon-story-expired","aria-hidden":!0}),m&&it.ZP.createElement("i",{className:"icon icon-story-reply","aria-hidden":!0}),d(f)),it.ZP.createElement("div",{className:"message-title",dir:"auto"},(0,Hs.Z)(y||" "))))};var kn=s(50685),Tn=s(14612),An=s(48198),Nn=s(98138),Bn=s(2995);var xn=s(69123);const Ln=1.125*P.Gw,Un=(0,it.X$)((e=>{let{topic:t,className:s,onClick:a}=e;const n=(0,$t.Z)();return it.ZP.createElement("div",{className:(0,dt.Z)("wUl1jHjVuMxmGhsdl358",s),style:`--topic-button-accent-color: var(${(0,Nn.gZ)(t?.iconColor)})`,onClick:a},t?it.ZP.createElement(Bn.Z,{topic:t,size:Ln}):it.ZP.createElement("img",{src:xn,alt:"",draggable:!1}),t?.title?(0,Hs.Z)(t.title):n("Loading"),t?.isClosed&&it.ZP.createElement("i",{className:"icon icon-lock"}),it.ZP.createElement("i",{className:"icon icon-next"}))}));function On(e){return(0,it.X$)((0,a.c$)(((e,t)=>{const{message:s}=t;return{isInSelectMode:(0,v.CAb)(e),isSelected:(0,v.vkB)(e,s.id)}}))((t=>{const{isInSelectMode:s,isSelected:n,message:i,dimensions:o}=t,{toggleMessageSelection:r}=(0,a.Sv)(),c=(0,wt.Z)((e=>{e.stopPropagation(),r({messageId:i.id,withShift:e?.shiftKey})})),d=(0,it.Ye)((()=>{const{dimensions:e,onClick:a}=t;return{...t,isInSelectMode:s,isSelected:n,dimensions:{...e,x:0,y:0},onClick:s?void 0:a}}),[t,s,n]);return it.ZP.createElement("div",{className:(0,dt.Z)("album-item-select-wrapper",n&&"is-selected"),style:o?`left: ${o.x}px; top: ${o.y}px;`:"",onClick:s?c:void 0},s&&it.ZP.createElement("div",{className:"message-select-control"},n&&it.ZP.createElement("i",{className:"icon icon-select"})),it.ZP.createElement(e,d))})))}var jn=s(95822),_n=s(35269);const Fn=On(jn.Z),Dn=On(_n.Z),qn=(0,a.c$)(((e,t)=>{let{album:s}=t;const{chatId:a}=s.mainMessage,n=(0,v.Puy)(e),i=(0,v.f21)(e,a),o=s.mainMessage.isScheduled;return{theme:n,uploadsById:e.fileUploads.byMessageLocalId,activeDownloadIds:o?i?.scheduledIds:i?.ids}}))((e=>{let{album:t,observeIntersection:s,hasCustomAppendix:n,isOwn:i,isProtected:o,albumLayout:r,onMediaClick:c,uploadsById:d,activeDownloadIds:l,theme:u}=e;const{cancelSendingMessage:m}=(0,a.Sv)(),h=t.messages.length,p=(0,wt.Z)((e=>{m({chatId:e.chatId,messageId:e.id})})),{width:f,height:I}=r.containerStyle;return it.ZP.createElement("div",{className:"Album",style:`width: ${f}px; height: ${I}px;`},t.messages.map((function(e,t){const{photo:m,video:f}=(0,g.qp)(e),I=d[(0,g.KK)(e)],w=I?.progress,{dimensions:y,sides:b}=r.layout[t],P=(0,v.bHC)((0,a.Rd)(),e),Z=(0,v.__o)((0,a.Rd)(),e);if(m){const a=n&&(i?t===h-1:Boolean(b&za.Left&&b&za.Bottom));return it.ZP.createElement(Fn,{id:`album-media-${(0,g.d0)(e.id)}`,message:e,observeIntersectionForLoading:s,canAutoLoad:P,shouldAffectAppendix:a,uploadProgress:w,dimensions:y,isProtected:o,onClick:c,onCancelUpload:p,isDownloading:l?.includes(e.id),theme:u})}if(f)return it.ZP.createElement(Dn,{id:`album-media-${(0,g.d0)(e.id)}`,message:e,observeIntersectionForLoading:s,canAutoLoad:P,canAutoPlay:Z,uploadProgress:w,dimensions:y,isProtected:o,onClick:c,onCancelUpload:p,isDownloading:l?.includes(e.id),theme:u})})))}));var Gn=s(74753);const Hn=7*P.Gw;function Vn(e,t,s,n,o,r,c){const{interactWithAnimatedEmoji:d,sendEmojiInteraction:l,sendWatchingEmojiInteraction:u}=(0,a.Sv)(),m=(0,it.sO)(null),h=(0,it.sO)(null),p=(0,zs.Z)(s?`document${s}`:void 0,!s),g=c||Hn,f=(0,ra.Z)(`width: ${g}px`,`height: ${g}px`,r&&!i.D$&&"cursor: pointer"),I=(0,it.sO)(void 0),v=(0,it.sO)(void 0),w=(0,wt.Z)((()=>{m.current&&(l({chatId:e,messageId:t,emoji:r,interactions:I.current}),v.current=void 0,I.current=void 0)})),y=(0,wt.Z)((()=>{const e=h.current;p&&(e&&(e.pause(),e.remove()),h.current=new Audio,h.current.src=p,(0,Gn.Z)(h.current),h.current.addEventListener("ended",(()=>{h.current=void 0}),{once:!0}))})),b=(0,wt.Z)((()=>{y();const s=m.current;if(!(r&&s&&t&&e))return;const{x:a,y:n}=s.getBoundingClientRect();d({emoji:r,x:a,y:n,startSize:g,isReversed:!o}),I.current||(I.current=[],v.current=performance.now(),setTimeout(w,1e3)),I.current.push(v.current?(performance.now()-v.current)/1e3:0)}));return(0,it.d4)((()=>{const s=m.current;s&&n&&n.forEach((a=>{let{id:n,startSize:i,messageId:c}=a;if(i||t!==c)return;const{x:d,y:l}=s.getBoundingClientRect();u({id:n,chatId:e,emoticon:r,startSize:g,x:d,y:l,isReversed:!o}),y()}))}),[n,e,r,o,t,y,u,g]),{ref:m,size:g,style:f,handleClick:b}}const $n=(0,it.X$)((0,a.c$)(((e,t)=>{let{customEmojiId:s,withEffects:a}=t;const n=e.customEmojis.byId[s];return{sticker:n,effect:n?.emoji&&a?(0,v.tHA)(e,n.emoji):void 0,soundId:n?.emoji&&(0,v.Ohz)(e,n.emoji),noPlay:!(0,v.W9H)(e)}}))((e=>{let{isOwn:t,customEmojiId:s,messageId:a,chatId:n,activeEmojiInteractions:i,sticker:o,effect:r,soundId:c,noPlay:d,observeIntersection:l}=e;const{ref:u,size:m,style:h,handleClick:p}=Vn(n,a,c,i,t,r?.emoji,(0,Ja.qo)(1));return it.ZP.createElement(Cs.Z,{ref:u,documentId:s,className:(0,dt.Z)("AnimatedEmoji media-inner",o?.id===P.wB&&"like-sticker-thumb"),style:h,size:m,isBig:!0,noPlay:d,withSharedAnimation:!0,forceOnHeavyAnimation:Boolean(r&&i?.length),observeIntersectionForLoading:l,onClick:p})})));var Jn=s(45601);const Kn=(0,it.X$)((0,a.c$)(((e,t)=>{let{emoji:s,withEffects:a}=t;return{sticker:(0,v.zB_)(e,s),effect:a?(0,v.tHA)(e,s):void 0,soundId:(0,v.Ohz)(e,s)}}))((e=>{let{isOwn:t,observeIntersection:s,forceLoadPreview:a,messageId:n,chatId:i,activeEmojiInteractions:o,sticker:r,effect:c,soundId:d}=e;const{ref:l,size:u,style:m,handleClick:h}=Vn(i,n,d,o,t,c?.emoji),p=(0,Da.Op)(l,s);return it.ZP.createElement(Jn.Z,{sticker:r,size:u,quality:1,noLoad:!p,forcePreview:a,play:p,forceAlways:!0,ref:l,className:(0,dt.Z)("AnimatedEmoji media-inner",r?.id===P.wB&&"like-sticker-thumb"),style:m,onClick:h})})));var zn=s(34076);const Wn=(0,it.X$)((e=>{let{threadInfo:t,disabled:s}=e;const{openComments:n}=(0,a.Sv)(),i=(0,$t.Z)(),{threadId:o,chatId:r,messagesCount:c,lastMessageId:d,lastReadInboxMessageId:l,recentReplierIds:u,originChannelId:m}=t,h=(0,wt.Z)((()=>{n({id:r,threadId:o,originChannelId:m})})),p=(0,it.Ye)((()=>{if(!u?.length)return;const e=(0,a.Rd)();return u.map((t=>(0,v.RGZ)(e,t))).filter(Boolean)}),[u]);if(void 0===c)return;const g=Boolean(l&&d&&l<d),f=c?i("Comments","%COMMENTS_COUNT%",void 0,c).split("%").map((e=>"COMMENTS_COUNT"===e?it.ZP.createElement(zn.Z,{text:(0,xt.bi)(c)}):e)):void 0;return it.ZP.createElement("div",{"data-cnt":(0,xt.bi)(c),className:(0,dt.Z)("CommentButton",g&&"has-unread",s&&"disabled"),dir:i.isRtl?"rtl":"ltr",onClick:h},it.ZP.createElement("i",{className:"icon icon-comments-sticker"}),(!p||0===p.length)&&it.ZP.createElement("i",{className:"icon icon-comments"}),Boolean(p?.length)&&it.ZP.createElement("div",{className:"recent-repliers",dir:i.isRtl?"rtl":"ltr"},p.map((e=>it.ZP.createElement(Zn.Z,{key:e.id,size:"small",peer:e})))),it.ZP.createElement("div",{className:"label",dir:"auto"},c?f:i("LeaveAComment")),it.ZP.createElement("i",{className:"icon icon-next"}))}));var Yn=s(6272);const Xn=(0,a.c$)(((e,t)=>{let{contact:s}=t;const{countryList:{phoneCodes:a}}=e;return{user:(0,v.dyD)(e,s.userId),phoneCodeList:a}}))((e=>{let{contact:t,user:s,phoneCodeList:n}=e;const{openChat:i}=(0,a.Sv)(),{firstName:o,lastName:r,phoneNumber:c,userId:d}=t,l="0"!==d,u=(0,wt.Z)((()=>{i({id:d})}));return it.ZP.createElement("div",{className:(0,dt.Z)("Contact",l&&"interactive"),onClick:l?u:void 0},it.ZP.createElement(Zn.Z,{size:"large",peer:s,text:o||r}),it.ZP.createElement("div",{className:"contact-info"},it.ZP.createElement("div",{className:"contact-name"},o," ",r),it.ZP.createElement("div",{className:"contact-phone"},(0,Yn.WZ)(n,c))))}));var Qn=s(97182);const ei=(0,it.X$)((e=>{let{message:t,canAutoLoadMedia:s}=e;const{clickBotInlineButton:n}=(0,a.Sv)(),i=t.content.game,{title:o,description:r}=i,c=(0,g.N)(i),d=(0,g.Wc)(i),l=(0,zs.Z)(c,!s),u=(0,zs.Z)(d,!s);return it.ZP.createElement("div",{className:"Game"},it.ZP.createElement("div",{className:"preview",style:"width: 480px; height: 270px",onClick:()=>{n({messageId:t.id,button:t.inlineButtons[0][0]})}},!l&&!u&&it.ZP.createElement(ja.Z,{className:"skeleton preview-content"}),l&&it.ZP.createElement("img",{className:"preview-content",src:l,alt:o,draggable:!1}),u&&it.ZP.createElement("video",{className:"preview-content",playsInline:!0,muted:!0,disablePictureInPicture:!0,autoPlay:!0,loop:!0,src:u})),it.ZP.createElement("div",{className:"title"},o),!(0,g.UD)(t)&&it.ZP.createElement("div",{className:"description"},r))})),ti=e=>{let{message:t,onClick:s}=e;const a=(0,$t.Z)();return it.ZP.createElement("div",{className:"InlineButtons"},t.inlineButtons.map((e=>it.ZP.createElement("div",{className:"row"},e.map((e=>it.ZP.createElement(Jt.Z,{size:"tiny",ripple:!0,disabled:"unsupported"===e.type,onClick:()=>s({messageId:t.id,button:e})},it.ZP.createElement("span",{className:"inline-button-text"},(0,Hs.Z)(a(e.text))),(e=>{const{type:t}=e;switch(t){case"url":if(!n.FSu.test(e.url))return it.ZP.createElement("i",{className:"icon icon-arrow-right"});break;case"urlAuth":return it.ZP.createElement("i",{className:"icon icon-arrow-right"});case"buy":case"receipt":return it.ZP.createElement("i",{className:"icon icon-cart"});case"switchBotInline":return it.ZP.createElement("i",{className:"icon icon-share-filled"});case"webView":case"simpleWebView":return it.ZP.createElement("i",{className:"icon icon-webapp"})}})(e))))))))};var si=s(26593),ai=s(41280);const ni=(0,it.X$)((e=>{let{message:t,shouldAffectAppendix:s,isInSelectMode:a,isSelected:i,theme:o,forcedWidth:r}=e;const c=(0,it.sO)(null),d=(0,$t.Z)(),l=(0,g.eO)(t),{title:u,text:m,amount:h,currency:p,isTest:f,photo:I}=l,v=(0,zs.Z)((0,g.O9)(I)),w=Boolean(r),y=(0,ai.Z)(t,!w,v);(0,Aa.Z)((e=>{let[t]=e;if(s){if(v){const e=c.current.closest(n.be_);(0,si.Z)(v,!1,i,o).then((t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute(n.s22,"")}))}}else t&&c.current.closest(n.be_).removeAttribute(n.s22)}),[s,v,a,i,o]);const b=r||I?.dimensions?.width,P=(0,ra.Z)(I?.dimensions&&`width: ${b}px`,I?.dimensions&&`aspect-ratio: ${I.dimensions.width} / ${I.dimensions.height}`,Boolean(!I?.dimensions&&r)&&`width: ${r}px`);return it.ZP.createElement("div",{ref:c,className:"Invoice"},u&&it.ZP.createElement("p",{className:"title"},(0,Hs.Z)(u)),m&&it.ZP.createElement("div",null,(0,Hs.Z)(m,["emoji","br"])),it.ZP.createElement("div",{className:"description "+(I?"has-image":"")},Boolean(I)&&it.ZP.createElement("div",{className:"invoice-image-container"},w&&it.ZP.createElement("canvas",{ref:y,className:"thumbnail blurred-bg"}),v&&it.ZP.createElement("img",{className:"invoice-image",src:v,alt:"",style:P,crossOrigin:"anonymous",draggable:!1}),!v&&I&&it.ZP.createElement(ja.Z,{width:b,height:I.dimensions?.height,forceAspectRatio:!0})),it.ZP.createElement("p",{className:"description-text"},(0,nt.x)(h,p,d.code),f&&it.ZP.createElement("span",null,d("PaymentTestInvoice")))))}));var ii=s(62230);const oi={root:"rwnm0xOh31c2MY4kK2No",duration:"lKSp02aI8WDGX3393nkh",buy:"gxQfWp0jp0_2Z4qWiXKN",spoiler:"z2tB5Vd_jKJ9IYX4Nijd"},ri=(0,it.X$)((e=>{let{message:t,isConnected:s}=e;const{openInvoice:n,loadExtendedMedia:i}=(0,a.Sv)(),o=(0,$t.Z)(),r=(0,g.eO)(t),{chatId:c,id:d}=t,l=(0,wt.Z)((()=>{i({chatId:c,ids:[d]})}));(0,vt.Z)(l,s?3e4:void 0);const{amount:u,currency:m,extendedMedia:h}=r,{width:p,height:f,thumbnail:I,duration:v}=h,w=(0,wt.Z)((()=>{n({chatId:c,messageId:d,isExtendedMedia:!0})}));return it.ZP.createElement("div",{className:(0,dt.Z)(oi.root,"media-inner"),onClick:w},it.ZP.createElement(ii.Z,{thumbDataUri:I?.dataUri,width:p,height:f,isVisible:!0,className:oi.spoiler}),Boolean(v)&&it.ZP.createElement("div",{className:oi.duration},(0,ae.k9)(v)),it.ZP.createElement("div",{className:oi.buy},it.ZP.createElement("i",{className:(0,dt.Z)("icon","icon-lock",oi.lock)}),o("Checkout.PayPrice",(0,nt.x)(u,m))))}));var ci=s(91489);const di=s.p+"map-pin.899635f6fe777c28998a.svg",li=24*Math.PI,ui=1e-4,mi={width:400,height:300,zoom:16,scale:2};function hi(){return it.ZP.createElement("svg",{className:"round-pin",style:"enable-background:new 0 0 64 64",viewBox:"0 0 64 64"},it.ZP.createElement("circle",{cx:"32",cy:"32",r:"24.5"}),it.ZP.createElement("path",{d:"M32 8c13.23 0 24 10.77 24 24S45.23 56 32 56 8 45.23 8 32 18.77 8 32 8m0-1C18.19 7 7 18.19 7 32s11.19 25 25 25 25-11.19 25-25S45.81 7 32 7z"}),it.ZP.createElement("path",{d:"m29.38 57.67-1.98-1.59 3.02-1.66L32 51.54l1.58 2.88 3.02 1.66-1.91 1.53L32 60.73z"}),it.ZP.createElement("path",{d:"m32 52.58 1.07 1.95.14.26.26.14 2.24 1.22-1.33 1.06-.07.06-.06.07L32 59.96l-2.24-2.61-.06-.07-.07-.06-1.33-1.06 2.24-1.22.26-.14.14-.26L32 52.58m0-2.08-1.94 3.56L26.5 56l2.5 2 3 3.5 3-3.5 2.5-2-3.56-1.94L32 50.5z"}))}const pi=(0,it.X$)((e=>{let{message:t,peer:s}=e;const{openMapModal:n}=(0,a.Sv)(),i=(0,it.sO)(null),o=(0,it.sO)(null),r=(0,$t.Z)(),c=(0,gt.Z)(),d=(0,g.nf)(t),{type:l,geo:u}=d,m=(0,ue.bp)(),h=(0,g.$R)(t),p="geoLive"!==l||h?void 0:t.date+d.period-m,[f,I]=(0,it.eJ)(u),v="venue"===l||"geoLive"===l&&!h,{width:w,height:y,zoom:b,scale:P}=mi,Z=(0,g.k6)(f,w,y,b,P),S=(0,zs.Z)(Z),C=(0,ua.Z)(S,!0),M=S||C,E=(0,it.Ye)((()=>{if("geoLive"!==l||!f.accuracyRadius)return 0;const{lat:e,accuracyRadius:t}=f;return t/(0,ci.Qw)(e,b)}),[l,f,b]),R=(0,wt.Z)((e=>{if("geoLive"!==l)return;const s=e.lastElementChild,a=e.firstElementChild,n=t.date+d.period-(0,ue.bp)(),i=(1-n/d.period)*li,o=(0,ae.mB)(r,1e3*n);a.textContent=o,s.firstElementChild.setAttribute("stroke-dashoffset",`-${i}`)}));return(0,it.bt)((()=>{o.current&&R(o.current)}),[R]),(0,it.d4)((()=>{Math.abs(u.lat-f.lat)<ui&&Math.abs(u.long-f.long)<ui?f.accuracyRadius!==u.accuracyRadius&&I({...f,accuracyRadius:u.accuracyRadius}):I(u)}),[u,f]),(0,Ct.Z)((()=>{c()}),h?void 0:1e3*(p||0)),(0,vt.Z)((()=>{(0,ct.WM)((()=>{const e=o.current;e&&R(e)}))}),p?1e3:void 0),it.ZP.createElement("div",{ref:i,className:"Location media-inner interactive",onClick:()=>{n({geoPoint:f,zoom:b})}},it.ZP.createElement("div",{className:"map-wrapper"},M?it.ZP.createElement("img",{className:"full-media map",src:M,alt:"Location on a map",draggable:!1,style:`width: ${mi.width}px; height: ${mi.height}px;`}):it.ZP.createElement(ja.Z,{width:w,height:y}),function(){if(M)return it.ZP.createElement(it.ZP.Fragment,null,Boolean(E)&&!h&&it.ZP.createElement("div",{className:"location-accuracy",style:`width: ${2*E}px; height: ${2*E}px`}),function(){const e=(0,dt.Z)("pin",l,h&&"expired");if("geoLive"===l)return it.ZP.createElement("div",{className:e},it.ZP.createElement(hi,null),it.ZP.createElement(Zn.Z,{peer:s,className:"location-avatar"}),void 0!==d.heading&&it.ZP.createElement("div",{className:"direction",style:`--direction: ${d.heading}deg`}));if("venue"===l){const t=(0,ci.k4)(d.venueType),s=(0,ci.lZ)(d.venueType);if(s)return it.ZP.createElement("div",{className:e,style:`--pin-color: ${t}`},it.ZP.createElement(hi,null),it.ZP.createElement("img",{src:s,draggable:!1,className:"venue-icon",alt:""}))}return it.ZP.createElement("img",{className:e,draggable:!1,src:di,alt:""})}())}()),function(){if(v)return"venue"===l?it.ZP.createElement("div",{className:"location-info"},it.ZP.createElement("div",{className:"location-info-title"},d.title),it.ZP.createElement("div",{className:"location-info-subtitle"},d.address)):"geoLive"===l?it.ZP.createElement("div",{className:"location-info"},it.ZP.createElement("div",{className:"location-info-title"},r("AttachLiveLocation")),it.ZP.createElement("div",{className:"location-info-subtitle"},(0,ae.dJ)(r,m,t.editDate)),!h&&it.ZP.createElement("div",{className:"geo-countdown",ref:o},it.ZP.createElement("span",{className:"geo-countdown-text"}),it.ZP.createElement("svg",{width:"32px",height:"32px"},it.ZP.createElement("circle",{cx:"16",cy:"16",r:12,className:"geo-countdown-progress",transform:"rotate(-90, 16, 16)","stroke-dasharray":li,"stroke-dashoffset":"0"})))):void 0}())}));var gi=s(8018);const fi=(0,it.X$)((e=>{let{message:t,outgoingStatus:s,signature:n,withReactionOffset:i,repliesThreadInfo:o,renderQuickReactionButton:r,noReplies:c,isTranslated:d,isPinned:l,onClick:u,onTranslationClick:m,onOpenThread:h}=e;const{showNotification:p}=(0,a.Sv)(),g=(0,$t.Z)(),[f,I]=(0,ds.Z)();function v(e){e.stopPropagation(),p({message:g("ImportedInfo")})}const w=(0,it.Ye)((()=>{if(!f)return;const e=(0,ae.SA)(1e3*t.date,g.code,void 0,g.timeFormat),s=t.isEdited&&(0,ae.SA)(1e3*t.editDate,g.code,void 0,g.timeFormat),a=t.forwardInfo&&(0,ae.SA)(1e3*t.forwardInfo.date,g.code,void 0,g.timeFormat);let n=e;return s&&(n+="\n",n+=g("lng_edited_date").replace("{date}",s)),a&&(n+="\n",n+=g("lng_forwarded_date").replace("{date}",a)),n}),[f,g,t,g.timeFormat]),y=(0,dt.Z)("MessageMeta",i&&"reactions-offset",t.forwardInfo?.isImported&&"is-imported");return it.ZP.createElement("span",{className:y,dir:g.isRtl?"rtl":"ltr",onClick:u,"data-ignore-on-paste":!0},d&&it.ZP.createElement("i",{className:"icon icon-language message-translated",onClick:m}),Boolean(t.views)&&it.ZP.createElement(it.ZP.Fragment,null,it.ZP.createElement("span",{className:"message-views"},(0,xt.bi)(t.views)),it.ZP.createElement("i",{className:"icon icon-channelviews"})),!c&&Boolean(o?.messagesCount)&&it.ZP.createElement("span",{onClick:function(e){e.stopPropagation(),h()},className:"message-replies-wrapper"},it.ZP.createElement("span",{className:"message-replies"},it.ZP.createElement(zn.Z,{text:(0,xt.bi)(o.messagesCount)})),it.ZP.createElement("i",{className:"icon icon-reply-filled"})),l&&it.ZP.createElement("i",{className:"icon icon-pinned-message message-pinned"}),n&&it.ZP.createElement("span",{className:"message-signature"},(0,Hs.Z)(n)),it.ZP.createElement("span",{className:"message-time",title:w,onMouseEnter:I},t.forwardInfo?.isImported&&it.ZP.createElement(it.ZP.Fragment,null,it.ZP.createElement("span",{className:"message-imported",onClick:v},(0,ae.SA)(1e3*t.forwardInfo.date,g.code,!0)),it.ZP.createElement("span",{className:"message-imported",onClick:v},g("ImportedMessage"))),t.isEdited&&`${g("EditedMessage")} `,(0,ae.mr)(g,1e3*t.date)),s&&it.ZP.createElement(gi.Z,{status:s}),r&&r())})),Ii=(0,it.X$)((e=>{let{phoneCall:t,message:s,chatId:n}=e;const{requestMasterAndRequestCall:o}=(0,a.Sv)(),r=(0,$t.Z)(),{isOutgoing:c,isVideo:d,reason:l,duration:u}=t,m="missed"===l,h="busy"===l||void 0===u,p=(0,wt.Z)((()=>{o({isVideo:d,userId:n})})),g=(0,it.Ye)((()=>d?m?c?"CallMessageVideoOutgoingMissed":"CallMessageVideoIncomingMissed":h?"CallMessageVideoIncomingDeclined":c?"CallMessageVideoOutgoing":"CallMessageVideoIncoming":m?c?"CallMessageOutgoingMissed":"CallMessageIncomingMissed":h?"CallMessageIncomingDeclined":c?"CallMessageOutgoing":"CallMessageIncoming"),[h,m,c,d]),f=(0,it.Ye)((()=>t.duration?(0,ae.J_)(r,t.duration):void 0),[r,t.duration]),I=(0,ae.mr)(r,1e3*s.date);return it.ZP.createElement("div",{className:"vDeypQzM845_JE14qGId"},it.ZP.createElement(Jt.Z,{size:"smaller",color:"translucent",round:!0,ripple:!0,onClick:p,className:"OtJi45yywgt1n_y6VPkE",disabled:!i.Bi,ariaLabel:r(c?"CallAgain":"CallBack")},it.ZP.createElement("i",{className:(0,dt.Z)("icon",d?"icon-video-outlined":"icon-phone")})),it.ZP.createElement("div",{className:"_0BG8sziTJQ_NYrsspMg"},it.ZP.createElement("div",{className:"LWVSvxVjeEyHPBrCb2sD"},r(g)),it.ZP.createElement("div",{className:"nuIsoCP15iD4ETadJ44R"},it.ZP.createElement("i",{className:(0,dt.Z)("icon","icon-arrow-right","wrUkWet7enyh9L1iPKvA",m&&"V5tKkKZpcY5yq_f5nO8l",h&&"Q7dh9ssyXXCzatPRmIDv",!c&&"e0Vhbj8gfzQn1zJQoFLK")}),it.ZP.createElement("span",{className:"TJ2lYkLxYUie3A0JqtMR"},f?r("CallMessageWithDuration",[I,f]):I))))}));var vi=s(20230),wi=s(51218),yi=s(96937),bi=s(14434);function Pi(e,t){return t>0?(e/t*100).toFixed():0}const Zi=e=>{let{answer:t,voteResults:s,totalVoters:a,maxVotersCount:n,correctResults:i,shouldAnimate:o}=e;const r=s&&s.find((e=>e.option===t.option)),c=0===i.length||-1!==i.indexOf(t.option),d=i.length>0&&c||r?.isChosen,l=r?Pi(r.votersCount,a||0):0,[u,m]=(0,it.eJ)(o?0:l),h=r?Pi(r.votersCount,n||0):0,p=u!==l;if((0,it.d4)((()=>{o&&m(l)}),[o,l]),!s||!r)return;const g=`width: ${h}%; transform:scaleX(${p?0:1})`;return it.ZP.createElement("div",{className:"PollOption",dir:"ltr"},it.ZP.createElement("div",{className:"poll-option-share "+("100"===l?"limit-width":"")},l,"%",d&&it.ZP.createElement("span",{className:(0,dt.Z)("poll-option-chosen",!c&&"wrong",o&&"animate")},it.ZP.createElement("i",{className:(0,dt.Z)("icon",c?"icon-check":"icon-close")}))),it.ZP.createElement("div",{className:"poll-option-right"},it.ZP.createElement("div",{className:"poll-option-text",dir:"auto"},(0,Hs.Z)(t.text)),it.ZP.createElement("div",{className:(0,dt.Z)("poll-option-answer",d&&!c&&"wrong")},o&&it.ZP.createElement("svg",{className:"poll-line",style:p?"":"stroke-dasharray: 100% 200%; stroke-dashoffset: -44"},it.ZP.createElement("path",{d:"M4.47 5.33v13.6a9 9 0 009 9h13"})),it.ZP.createElement("div",{className:"poll-option-line",style:g}))))},Si=12*Math.PI;function Ci(e){e.stopPropagation()}const Mi=(0,it.X$)((0,a.c$)(((e,t)=>{let{poll:s}=t;const{recentVoterIds:a}=s.results,{users:{byId:n}}=e;return a&&0!==a.length?{recentVoterIds:a,usersById:n}:{}}))((e=>{let{message:t,poll:s,recentVoterIds:n,onSendVote:i}=e;const{loadMessage:o,openPollResults:r,requestConfetti:c}=(0,a.Sv)(),{id:d,chatId:l}=t,{summary:u,results:m}=s,[h,p]=(0,it.eJ)(!1),[g,f]=(0,it.eJ)([]),[I,v]=(0,it.eJ)(!1),[w,y]=(0,it.eJ)(!1),[b,P]=(0,it.eJ)(!u.closed&&u.closeDate&&u.closeDate>0?Math.min(u.closeDate-(0,ue.bp)(),u.closePeriod):0),Z=(0,it.sO)(null),S=(0,it.sO)(null),{results:C,totalVoters:M}=m,E=C&&C.some((e=>e.isChosen)),R=!u.closed&&!E,k=!R&&u.isPublic&&Number(m.totalVoters)>0,T=R&&u.multipleChoice,A=C?Math.max(...C.map((e=>e.votersCount))):M,N=(0,it.Ye)((()=>C?.filter((e=>e.isCorrect)).map((e=>e.option))||[]),[C]),B=(0,it.Ye)((()=>u.answers.map((e=>({label:e.text,value:e.option,hidden:Boolean(u.quiz&&u.closePeriod&&b<=0)})))),[b,u]);(0,it.d4)((()=>{const e=s.results.results?.find((e=>e.isChosen));h&&e&&(e.isCorrect&&c(),p(!1))}),[h,s.results.results,c]),(0,it.bt)((()=>{if(b>0&&setTimeout((()=>P(b-1)),1e3),!S.current)return;b<=5&&Z.current.classList.add("hurry-up");const e=(u.closePeriod-b)/u.closePeriod*Si;S.current.setAttribute("stroke-dashoffset",`-${e}`)}),[b,u.closePeriod]),(0,it.d4)((()=>{u.quiz&&(b<=0||E&&!u.closed)&&o({chatId:l,messageId:d})}),[l,b,E,o,d,u.closed,u.quiz]),(0,it.d4)((()=>{let e;return u.quiz&&!u.closed&&u.closePeriod&&u.closePeriod>0&&(e=window.setTimeout((()=>{o({chatId:l,messageId:d})}),1e3*u.closePeriod)),()=>{e&&window.clearTimeout(e)}}),[R,l,o,d,u.closePeriod,u.closed,u.quiz]);const x=(0,it.Ye)((()=>{const e=(0,a.Rd)().chats.byId,t=(0,a.Rd)().users.byId;return n?n.reduce(((s,a)=>{const n=e[a],i=t[a];return i?s.push(i):n&&s.push(n),s}),[]):[]}),[n]),L=(0,wt.Z)((e=>{f([e]),p(!0),y(!0),i([e])})),U=(0,wt.Z)((e=>{f(e)})),O=(0,wt.Z)((()=>{p(!0),y(!0),i(g)})),j=(0,wt.Z)((()=>{r({chatId:l,messageId:d})})),_=(0,wt.Z)((()=>{v(!0)})),F=(0,wt.Z)((()=>{v(!1),y(!1)}));(0,it.d4)((()=>{w&&E&&u.quiz&&m.results&&s.results.solution&&(m.results.find((e=>e.isChosen&&e.isCorrect))||v(!0))}),[E,w,m.results,u.quiz,s.results.solution]);const D=(0,$t.Z)();return it.ZP.createElement("div",{className:"Poll",dir:D.isRtl?"auto":"ltr"},I&&s.results.solution&&it.ZP.createElement(yi.Z,{message:(0,vi.H)({text:s.results.solution,entities:s.results.solutionEntities}),duration:5e3,onDismiss:F,containerId:"#middle-column-portals"}),it.ZP.createElement("div",{className:"poll-question"},(0,Hs.Z)(u.question,["emoji","br"])),it.ZP.createElement("div",{className:"poll-type"},D(function(e){return void 0===e.isPublic?" ":e.closed?"FinalResults":e.quiz?e.isPublic?"QuizPoll":"AnonymousQuizPoll":e.isPublic?"PublicPoll":"AnonymousPoll"}(u)),x.length>0&&it.ZP.createElement("div",{className:"poll-recent-voters"},x.map((e=>it.ZP.createElement(Zn.Z,{key:e.id,size:"micro",peer:e})))),b>0&&R&&it.ZP.createElement("div",{ref:Z,className:"poll-countdown"},it.ZP.createElement("span",null,(0,ae.k9)(b)),it.ZP.createElement("svg",{width:"16px",height:"16px"},it.ZP.createElement("circle",{ref:S,cx:"8",cy:"8",r:6,className:"poll-countdown-progress",transform:"rotate(-90, 8, 8)","stroke-dasharray":Si,"stroke-dashoffset":"0"}))),u.quiz&&s.results.solution&&!R&&it.ZP.createElement(Jt.Z,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:I,onClick:_,ariaLabel:"Show Solution"},it.ZP.createElement("i",{className:"icon icon-lamp"}))),R&&it.ZP.createElement("div",{className:"poll-answers",onClick:Ci},T?it.ZP.createElement(wi.Z,{options:B,onChange:U,disabled:t.isScheduled||h,loadingOptions:h?g:void 0,round:!0}):it.ZP.createElement(bi.Z,{name:`poll-${d}`,options:B,onChange:L,disabled:t.isScheduled||h,loadingOption:h?g[0]:void 0})),!R&&it.ZP.createElement("div",{className:"poll-results"},u.answers.map((function(e){return it.ZP.createElement(Zi,{key:e.option,shouldAnimate:w||!R,answer:e,voteResults:C,totalVoters:M,maxVotersCount:A,correctResults:N})}))),!k&&!T&&it.ZP.createElement("div",{className:"poll-voters-count"},function(e,t,s){return s?e(t?"Answer":"Vote",s,"i"):e(t?"Chat.Quiz.TotalVotesEmpty":"Chat.Poll.TotalVotesResultEmpty")}(D,u.quiz,m.totalVoters)),T&&it.ZP.createElement(Jt.Z,{isText:!0,disabled:0===g.length,size:"tiny",onClick:O},D("PollSubmitVotes")),k&&it.ZP.createElement(Jt.Z,{isText:!0,size:"tiny",onClick:j},D("PollViewResults")))})));var Ei=s(65351),Ri=s(36368);const ki=1.25*P.Gw,Ti=(0,it.X$)((e=>{let{reaction:t,message:s,withRecentReactors:n,observeIntersection:i}=e;const{toggleReaction:o}=(0,a.Sv)(),{recentReactions:r}=s.reactions,c=(0,it.Ye)((()=>{if(!n||!r)return;const e=(0,a.Rd)().chats.byId,s=(0,a.Rd)().users.byId;return r.filter((e=>(0,g.Hl)(e.reaction,t.reaction))).map((t=>s[t.peerId]||e[t.peerId])).filter(Boolean)}),[t.reaction,r,n]),d=(0,wt.Z)((()=>{o({reaction:t.reaction,chatId:s.chatId,messageId:s.id})}));return it.ZP.createElement(Jt.Z,{className:(0,dt.Z)((0,g.Bt)(t)&&"chosen","message-reaction"),size:"tiny",onClick:d},it.ZP.createElement(Ri.Z,{className:"reaction-animated-emoji",containerId:(0,g.Tp)(s),reaction:t.reaction,size:ki,observeIntersection:i}),c?.length?it.ZP.createElement(Ei.Z,{size:"mini",peers:c}):it.ZP.createElement(zn.Z,{text:(0,xt.bi)(t.count),className:"counter"}))})),Ai=(0,it.X$)((e=>{let{message:t,isOutside:s,maxWidth:a,metaChildren:n,observeIntersection:i,noRecentReactors:o}=e;const r=(0,$t.Z)(),c=(0,it.Ye)((()=>t.reactions.results.reduce(((e,t)=>e+t.count),0)),[t]);return it.ZP.createElement("div",{className:(0,dt.Z)("Reactions",s&&"is-outside"),style:a?`max-width: ${a}px`:void 0,dir:r.isRtl?"rtl":"ltr"},t.reactions.results.map((e=>it.ZP.createElement(Ti,{key:(0,g.$d)(e.reaction),reaction:e,message:t,withRecentReactors:c<=3&&!o,observeIntersection:i}))),n)}));var Ni=s(70692),Bi=s(6701),xi=s(39196);const Li=P.Rj/2,Ui=2*(Li-6)*Math.PI;let Oi;const ji=e=>{let{message:t,observeIntersection:s,canAutoLoad:n,isDownloading:i}=e;const o=(0,it.sO)(null),c=(0,it.sO)(null),d=(0,it.sO)(null),l=t.content.video,u=(0,Da.Op)(o,s),[m,h]=(0,it.eJ)(n),p=Boolean(m&&u),{mediaData:f,loadProgress:I}=(0,Bi.Z)((0,g.Ti)(t,"inline"),!p,(0,g.kG)(t,"inline")),{loadProgress:v}=(0,Bi.Z)((0,g.Ti)(t,"download"),!i,r.IU.BlobUrl),[w,y]=(0,ds.Z)(),b=!Boolean((0,g.DH)(t))||w,Z=(0,ai.Z)(t,b),S=(0,Ni.Z)(!b),C=m&&!w||i,M=!1===(0,ua.Z)(m),{shouldRender:E,transitionClassNames:R}=(0,Zt.Z)(C,void 0,M),[k,T]=(0,it.eJ)(!1),[A,N]=(0,ga.Z)(0),B=(0,Ga.WR)(A,16);(0,it.d4)((()=>{if(!k)return;const e=c.current;N(e.currentTime/e.duration)}),[N,k,B]),(0,it.bt)((()=>{if(!k||!d.current)return;const e=Ui-B()*Ui;d.current.setAttribute("stroke-dashoffset",e.toString())}),[k,B]);const x=Boolean(f&&u),L=(0,wt.Z)((()=>{c.current&&(T(!1),N(0),(0,Gn.Z)(c.current))})),U=(0,wt.Z)((()=>{Oi?.(),Oi=L})),O=(0,wt.Z)((()=>{if(!f)return void h((e=>!e));if(i)return void(0,a.Sv)().cancelMessageMediaDownload({message:t});const e=c.current;k?e.paused?((0,Gn.Z)(e),(0,qs.Es)()):e.pause():(U(),e.pause(),e.currentTime=0,(0,Gn.Z)(e),(0,qs.Es)(),T(!0))})),j=(0,wt.Z)((e=>{const t=e.currentTarget;N(t.currentTime/t.duration)}));return it.ZP.createElement("div",{ref:o,className:"RoundVideo media-inner",onClick:O},f&&it.ZP.createElement("div",{className:"video-wrapper"},it.ZP.createElement(Oa.Z,{canPlay:x,ref:c,src:f,className:"full-media",width:P.Rj,height:P.Rj,autoPlay:!0,disablePictureInPicture:!0,muted:!k,loop:!k,playsInline:!0,onEnded:k?L:void 0,onTimeUpdate:k?j:void 0,onReady:y})),it.ZP.createElement("canvas",{ref:Z,className:(0,dt.Z)("thumbnail",S),style:`width: ${P.Rj}px; height: ${P.Rj}px`}),it.ZP.createElement("div",{className:"progress"},k&&it.ZP.createElement("svg",{width:P.Rj,height:P.Rj},it.ZP.createElement("circle",{ref:d,cx:Li,cy:Li,r:Li-6,className:"progress-circle",transform:`rotate(-90, ${Li}, ${Li})`,"stroke-dasharray":Ui,"stroke-dashoffset":Ui}))),E&&it.ZP.createElement("div",{className:`media-loading ${R}`},it.ZP.createElement(xi.Z,{progress:i?v:I})),!f&&!m&&it.ZP.createElement("i",{className:"icon icon-download"}),it.ZP.createElement("div",{className:"message-media-duration"},k?(0,ae.k9)(c.current.currentTime):(0,ae.k9)(l.duration),(!k||c.current.paused)&&it.ZP.createElement("i",{className:"icon icon-muted"})))};var _i=s(97799);const Fi=e=>{let{message:t,observeIntersection:s,observeIntersectionForPlaying:n,shouldLoop:o,shouldPlayEffect:c,withEffect:d,onPlayEffect:l,onStopEffect:u}=e;const{showNotification:m,openStickerSet:h}=(0,a.Sv)(),p=(0,$t.Z)(),{isMobile:f}=(0,T.ZP)(),I=(0,it.sO)(null),v=t.content.sticker,{stickerSetInfo:w,isVideo:y,hasEffect:b}=v,Z=v.isPreloadedGlobally?void 0:(0,g.Ti)(t,y&&!i.Hh?"pictogram":"inline"),S=(0,Da.Op)(I,s),C=(0,Da.Op)(I,n),M=`sticker${v.id}?size=f`,E=(0,zs.Z)(M,!S||!b,r.IU.BlobUrl),[R,k,A]=(0,ds.Z)(),N=(0,wt.Z)((()=>{A(),u?.()})),B=(0,ua.Z)(c);(0,it.d4)((()=>{b&&d&&C&&(c||B)&&(k(),l?.())}),[b,C,l,c,B,k,d]);const x=(0,wt.Z)((()=>{h({stickerSetInfo:v.stickerSetInfo})})),L=(0,wt.Z)((()=>{if(b){if(R||!d)return void m({message:p("PremiumStickerTooltip"),action:{action:"openStickerSet",payload:{stickerSetInfo:v.stickerSetInfo}},actionText:p("ViewAction")});if(d)return k(),void l?.()}x()})),U="isMissing"in w,{width:O,height:j}=(0,P.Wr)(v,f),_=(0,dt.Z)("Sticker media-inner",U&&"inactive",b&&!t.isOutgoing&&"reversed");return it.ZP.createElement("div",{ref:I,className:_,style:`width: ${O}px; height: ${j}px;`,onClick:U?void 0:L},it.ZP.createElement(La.Z,{containerRef:I,sticker:v,fullMediaHash:Z,fullMediaClassName:"full-media",size:O,shouldLoop:o,noLoad:!S,noPlay:!C,withSharedAnimation:!0}),b&&d&&S&&R&&it.ZP.createElement(_i.Z,{key:M,className:"effect-sticker",tgsUrl:E,size:1.49*O,play:!0,isLowPriority:!0,noLoop:!0,onEnded:N}))};var Di=s(93609);const qi=(0,it.X$)((0,a.c$)(((e,t)=>{let{message:s}=t;const{id:a,peerId:n}=s.content.storyData;return{story:(0,v.JrV)(e,n,a),isConnected:"connectionStateReady"===e.connectionState}}))((function(e){let{message:t,story:s,isProtected:a,isConnected:n}=e;const{storyData:i}=t.content;return it.ZP.createElement(Di.Z,{story:s||i,isProtected:a,isConnected:n})}))),Gi=(0,it.X$)((0,a.c$)(((e,t)=>{let{message:s}=t;const{id:a,peerId:n}=s.content.storyData,i=(0,v.nST)(e,n)?.lastReadId;return{story:(0,v.JrV)(e,n,a),peer:(0,v.RGZ)(e,n),targetUser:(0,v.dyD)(e,s.chatId),isUnread:Boolean(i&&i<a)}}))((function(e){let{message:t,story:s,peer:n,isUnread:i,targetUser:o}=e;const{openStoryViewer:r}=(0,a.Sv)(),c=(0,$t.Z)(),{storyData:d}=t.content,l=(0,wt.Z)((()=>{r({peerId:s.peerId,storyId:s.id,isSinglePeer:!0,isSingleStory:!0})})),u=s&&"isDeleted"in s,m=s&&"content"in s,h=m?s.content.video:void 0,p=m?(0,g.Cc)(s,"pictogram"):void 0,f=(0,zs.Z)(p)||h?.thumbnail?.dataUri;return(0,en.Z)(d.peerId,d.id,s),it.ZP.createElement("div",{className:(0,dt.Z)("action-message-story-mention",i&&"is-unread",m&&"with-preview"),tabIndex:0,role:"button",onClick:m?l:void 0},m&&it.ZP.createElement("span",{className:"story-media-wrapper"},f&&it.ZP.createElement("img",{src:f,alt:"",className:"story-media"})),it.ZP.createElement("span",{className:"story-title"},(0,Hs.Z)(n&&"isSelf"in n&&n.isSelf?c(u?"ExpiredStoryMentioned":"StoryYouMentionedTitle",(0,g.Vl)(o)):u?c("ExpiredStoryMention"):c("StoryMentionedTitle",(0,g.OU)(c,n)),["emoji","simple_markdown"])))})));var Hi=s(54659);const Vi=1.75*P.Gw,$i=2.25*P.Gw;function Ji(e){let{isOwn:t}=e;const s=t?"M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z":"M3 17h6V0c-.193 2.84-.876 5.767-2.05 8.782-.904 2.325-2.446 4.485-4.625 6.48A1 1 0 003 17z";return it.ZP.createElement("svg",{width:"9",height:"20",className:"svg-appendix"},it.ZP.createElement("defs",null,it.ZP.createElement("filter",{x:"-50%",y:"-14.7%",width:"200%",height:"141.2%",filterUnits:"objectBoundingBox",id:"messageAppendix"},it.ZP.createElement("feOffset",{dy:"1",in:"SourceAlpha",result:"shadowOffsetOuter1"}),it.ZP.createElement("feGaussianBlur",{stdDeviation:"1",in:"shadowOffsetOuter1",result:"shadowBlurOuter1"}),it.ZP.createElement("feColorMatrix",{values:"0 0 0 0 0.0621962482 0 0 0 0 0.138574144 0 0 0 0 0.185037364 0 0 0 0.15 0",in:"shadowBlurOuter1"}))),it.ZP.createElement("g",{fill:"none","fill-rule":"evenodd"},it.ZP.createElement("path",{d:s,fill:"#000",filter:"url(#messageAppendix)"}),it.ZP.createElement("path",{d:s,fill:t?"#EEFFDE":"FFF",className:"corner"})))}const Ki=(0,it.X$)((0,a.c$)(((e,t)=>{const{focusedMessage:s,forwardMessages:a,activeEmojiInteractions:o,activeReactions:c}=(0,v.jUK)(e),{message:d,album:l,withSenderName:u,withAvatar:m,threadId:h,messageListType:p,isLastInDocumentGroup:f,isFirstInGroup:I}=t,{id:w,chatId:y,viaBotId:b,replyToChatId:P,replyToMessageId:Z,isOutgoing:S,forwardInfo:C,transcriptionId:M,isPinned:E,replyToStoryUserId:R,replyToStoryId:k,repliesThreadInfo:T}=d,A=(0,v.Z1J)(e,y),N=(0,v.FM1)(e,y),B=(0,g.pK)(y),x=A&&(0,g.eA)(A),L=A&&(0,g.Bf)(A),U=(0,g.YC)(y)?void 0:(0,v.x67)(e,y),O=d.content.webPage?.story,j=O?(0,v.JrV)(e,O.peerId,O.id):void 0,_=a.messageIds&&a.messageIds.includes(w),F=!N&&(0,g.Ul)(d),D=u||m||F,q=(0,v.Urc)(e,d),G=(0,v.cve)(e,d),H=b?(0,v.dyD)(e,b):void 0,V=q?.id&&L?U?.adminMembersById?.[q?.id]:void 0,$=h?(0,v.qSq)(e,y,h):void 0,J=d.id===$,K=Z===$,z=Z&&!K?(0,v.hjO)(e,B&&P?P:y,Z):void 0,W=z&&(0,v.BzW)(e,z,Boolean(C)),Y=z&&(0,v.cve)(e,z),X="topicCreate"===z?.content.action?.type,Q=k&&R?(0,v.JrV)(e,R,k):void 0,ee=R?(0,v.dyD)(e,R):void 0,te=(0,v.uZE)(e,d),se="thread"===p&&(l?l.messages.some((t=>(0,v._XY)(e,t,h))):(0,v._XY)(e,d,h)),{direction:ae,noHighlight:ne,isResizingContainer:ie}=se&&s||{},{query:oe}=(0,v.n5x)(e)||{},re=(0,g.h_)(d),ce=re&&(0,v.zB_)(e,re)?re:void 0,de=(0,g.HW)(d);let le;le=l?.messages?l.messages.every((t=>{let{id:s}=t;return(0,v.vkB)(e,s)})):(0,v.vkB)(e,w);const{canReply:ue}="thread"===p&&(0,v._kf)(e,d,h)||{},me=(0,v.teg)(e,d),he=T?(0,v.tZg)(e,T.chatId,T.threadId)||T:void 0,pe=Boolean(d.groupedId)&&!d.isInAlbum,ge=pe?(0,v.xHX)(e,y,d.groupedId)[0]:void 0,fe=pe?f?(0,v.hjO)(e,y,ge):void 0:d,Ie=A?.unreadReactions?.includes(d.id),ve=h===r._f&&A?.isForum&&I,we=ve?(0,v.p$s)(e,d)||A?.topics?.[n.OxA]:void 0,ye=Boolean((0,g.nf)(d)),be=(0,v.xfm)(e,y),Pe=(0,v.Bdn)(e,y,d.id),Ze=(0,v.lpX)(e,y),Se=i.SX&&e.settings.byKey.canTranslate&&!Ze,Ce="connectionStateReady"===e.connectionState,Me=Boolean(fe&&c[(0,g.Tp)(fe)]?.length);return{theme:(0,v.Puy)(e),forceSenderName:F,canShowSender:D,originSender:G,botSender:H,shouldHideReply:K||X,isThreadTop:J,replyMessage:z,replyMessageSender:W,replyMessageForwardSender:Y,replyStory:Q,storySender:ee,isInDocumentGroup:pe,isProtected:(0,v.EVS)(e,d),isChatProtected:(0,v.AmN)(e,y),isFocused:se,isForwarding:_,reactionMessage:fe,isChatWithSelf:N,isRepliesChat:B,isChannel:x,isGroup:L,canReply:ue,highlight:oe,animatedEmoji:ce,animatedCustomEmoji:de,isInSelectMode:(0,v.CAb)(e),isSelected:le,isGroupSelected:Boolean(d.groupedId)&&!d.isInAlbum&&(0,v.a65)(e,y,d.groupedId),threadId:h,isDownloading:me,isPinnedList:"pinned"===p,isPinned:E,canAutoLoadMedia:(0,v.bHC)(e,d),canAutoPlayMedia:(0,v.__o)(e,d),autoLoadFileMaxSizeMb:e.settings.byKey.autoLoadFileMaxSizeMb,shouldLoopStickers:(0,v.yBd)(e),repliesThreadInfo:he,availableReactions:e.availableReactions,defaultReaction:(0,g.CI)(d)||"scheduled"===p?void 0:(0,v.q6x)(e,y),hasActiveReactions:Me,activeEmojiInteractions:o,hasUnreadReaction:Ie,isTranscribing:void 0!==M&&e.transcriptions[M]?.isPending,transcribedText:void 0!==M?e.transcriptions[M]?.text:void 0,isPremium:(0,v.wVz)(e),senderAdminMember:V,messageTopic:we,hasTopicChip:ve,chatTranslations:be,areTranslationsEnabled:Se,shouldDetectChatLanguage:(0,v.J1l)(e,y),requestedTranslationLanguage:Pe,requestedChatTranslationLanguage:Ze,hasLinkedChat:Boolean(U?.linkedChatId),withStickerEffects:(0,v.$Yd)(e,"stickerEffects"),webPageStory:j,isConnected:Ce,shouldWarnAboutSvg:e.settings.byKey.shouldWarnAboutSvg,...(D||ye)&&{sender:q},...S&&{outgoingStatus:(0,v.dTW)(e,d,"scheduled"===p)},..."number"==typeof te&&{uploadProgress:te},...se&&{focusDirection:ae,noFocusHighlight:ne,isResizingContainer:ie}}}))((e=>{let{message:t,observeIntersectionForBottom:s,observeIntersectionForLoading:o,observeIntersectionForPlaying:d,album:l,noAvatars:u,withAvatar:m,withSenderName:h,noComments:p,noReplies:f,appearanceOrder:I,isJustAdded:v,isFirstInGroup:w,isPremium:y,isLastInGroup:b,isFirstInDocumentGroup:Z,isLastInDocumentGroup:S,isTranscribing:C,transcribedText:M,isLastInList:E,theme:R,forceSenderName:k,sender:A,canShowSender:N,originSender:B,botSender:x,isThreadTop:L,shouldHideReply:U,replyMessage:O,replyMessageSender:j,replyMessageForwardSender:_,replyStory:F,storySender:D,outgoingStatus:q,uploadProgress:G,isInDocumentGroup:H,isProtected:V,isChatProtected:$,isFocused:J,focusDirection:K,noFocusHighlight:z,isResizingContainer:W,isForwarding:Y,isChatWithSelf:X,isRepliesChat:Q,isChannel:ee,isGroup:te,canReply:se,highlight:ae,animatedEmoji:ne,animatedCustomEmoji:ie,hasActiveReactions:oe,hasLinkedChat:re,isInSelectMode:ce,isSelected:de,isGroupSelected:le,threadId:ue,reactionMessage:me,availableReactions:he,defaultReaction:pe,activeEmojiInteractions:ge,messageListType:fe,isPinnedList:Ie,isPinned:ve,isDownloading:we,canAutoLoadMedia:ye,canAutoPlayMedia:be,shouldLoopStickers:Pe,autoLoadFileMaxSizeMb:Ze,repliesThreadInfo:Se,hasUnreadReaction:Ce,memoFirstUnreadIdRef:Me,senderAdminMember:Ee,messageTopic:Re,hasTopicChip:ke,chatTranslations:Te,areTranslationsEnabled:Ae,shouldDetectChatLanguage:Ne,requestedTranslationLanguage:Be,requestedChatTranslationLanguage:xe,withStickerEffects:Le,webPageStory:Ue,isConnected:Oe,getIsMessageListReady:je,shouldWarnAboutSvg:_e,onPinnedIntersectionChange:Fe}=e;const{toggleMessageSelection:De,clickBotInlineButton:qe,disableContextMenuHint:Ge,animateUnreadReaction:He,focusLastMessage:Ve}=(0,a.Sv)(),$e=(0,it.sO)(null),Je=(0,it.sO)(null),Ke=(0,it.sO)(null),ze=(0,it.sO)(0),We=(0,$t.Z)(),[Ye,Xe]=(0,it.eJ)(!1),[Qe,et,tt]=(0,ds.Z)(),{isMobile:st,isTouchScreen:at}=(0,T.ZP)();(0,Da._N)(Je,s);const{isContextMenuOpen:nt,contextMenuPosition:ot,contextMenuTarget:rt,handleBeforeContextMenu:lt,handleContextMenu:ut,handleContextMenuClose:mt,handleContextMenuHide:ht}=(0,$s.Z)($e,at&&ce,!i.D$,i.wZ,je);(0,it.d4)((()=>{nt&&Ge()}),[nt,Ge]);const pt=I<=0,[gt,ft]=(0,ds.Z)(pt);(0,it.d4)((()=>{pt||setTimeout(ft,10*I)}),[I,ft,pt]);const{transitionClassNames:vt}=(0,Zt.Z)(gt||v,void 0,pt&&!v,!1),{id:yt,chatId:bt,forwardInfo:Pt,viaBotId:St,isTranscriptionError:Ct}=t;(0,it.d4)((()=>{if(!ve)return;const e=l?l.mainMessage.id:yt;return()=>{Fe({viewportPinnedIdsToRemove:[e],isUnmount:!0})}}),[l,ve,yt,Fe]);const Mt=(0,g.CI)(t),Et=(0,g.B4)(t),Rt="scheduled"===fe||t.isScheduled,kt=(0,g.ss)(t)&&!U,Tt=Boolean(t.replyToStoryId),At=Boolean(Se)&&"thread"===fe,Nt=(0,g.$D)(t),Bt=Nt&&(ne||ie),xt=me?.reactions&&!(0,g.JE)(me.reactions),Lt=Pt&&(!X||Rt)&&!Q&&!Pt.isLinkedChannelPost&&!Nt||Boolean(t.content.storyData&&!t.content.storyData.isMention),Ut=t.content.storyData?.isMention,Ot=Boolean(l)&&l.messages.length>1&&!l?.messages.some((e=>0===Object.keys(e.content).length)),jt=H&&!Z,_t=H&&!S,Ft=void 0!==ot,Dt=!(Ft||ce||Y||_t||Ut),qt=ee&&!Rt&&t.isForwardingAllowed&&!$,Gt=Boolean(Ie||Pt&&(Pt.isChannelPost||X&&!Et||Q)&&Pt.fromMessageId),Ht=ke||kt||Tt,Vt=(0,wt.Z)(((e,t)=>{De({messageId:yt,groupedId:t,...e?.shiftKey&&{withShift:!0},...Ot&&{childMessageIds:l.messages.map((e=>{let{id:t}=e;return t}))}})})),Kt=N?A:void 0,zt=Boolean(!Ye&&(Ct||M)),Wt=Pt&&(X||Q||!Kt)?B:Kt,Yt=Pt||t.content.storyData?B:Kt,{handleMouseDown:Xt,handleClick:Qt,handleContextMenu:es,handleDoubleClick:ts,handleContentDoubleClick:ss,handleMouseMove:as,handleSendQuickReaction:ns,handleMouseLeave:is,isSwiped:os,isQuickReactionVisible:rs,handleDocumentGroupMouseEnter:cs}=wn(Vt,$e,yt,Boolean(ce),Boolean(se),Boolean(V),ut,lt,bt,Ft,Ke,_t,je),{handleAvatarClick:ls,handleSenderClick:us,handleViaBotClick:ms,handleReplyClick:hs,handleMediaClick:ps,handleAudioPlay:gs,handleAlbumMediaClick:fs,handleMetaClick:Is,handleTranslationClick:vs,handleOpenThread:ws,handleReadMedia:ys,handleCancelUpload:bs,handleVoteSend:Ps,handleGroupForward:Zs,handleForward:Ss,handleFocus:Es,handleFocusForwarded:Rs,handleDocumentGroupSelectAll:ks,handleTopicChipClick:Ts,handleStoryClick:As}=function(e,t,s,n,i,o,d,l,u,m,h,p,g,f,I,v){const{openChat:w,showNotification:y,focusMessage:b,openMediaViewer:P,openAudioPlayer:Z,markMessagesRead:S,cancelSendingMessage:C,sendPollVote:M,openForwardMenu:E,openChatLanguageModal:R,openStoryViewer:k,focusMessageInComments:T}=(0,a.Sv)(),{id:A,forwardInfo:N,replyToMessageId:B,replyToChatId:x,replyToTopMessageId:L,groupedId:U}=s,O=(0,wt.Z)((()=>{h&&w({id:h.id})})),j=(0,wt.Z)((()=>{p?d&&N?.channelPostId?b({chatId:p.id,messageId:N.channelPostId}):w({id:p.id}):y({message:e("HidAccount")})})),_=(0,wt.Z)((()=>{g&&w({id:g.id})})),F=(0,wt.Z)((()=>{b({chatId:u&&x?x:n,threadId:i,messageId:B,replyMessageId:u&&x?void 0:A,noForumTopicPanel:!0})})),D=(0,wt.Z)((()=>{P({chatId:n,threadId:i,mediaId:A,origin:l?c.bZ.ScheduledInline:c.bZ.Inline})})),q=(0,wt.Z)((()=>{Z({chatId:n,messageId:A})})),G=(0,wt.Z)((e=>{P({chatId:n,threadId:i,mediaId:e,origin:l?c.bZ.ScheduledAlbum:c.bZ.Album})})),H=(0,wt.Z)((()=>{S({messageIds:[A]})})),V=(0,wt.Z)((()=>{C({chatId:n,messageId:A})})),$=(0,wt.Z)((e=>{M({chatId:n,messageId:A,options:e})})),J=(0,wt.Z)((()=>{E({fromChatId:n,groupedId:U})})),K=(0,wt.Z)((()=>{if(m&&m.messages){const e=m.messages.map((e=>{let{id:t}=e;return t}));E({fromChatId:n,messageIds:e})}else E({fromChatId:n,messageIds:[A]})})),z=(0,wt.Z)((()=>{b({chatId:n,threadId:r._f,messageId:A})})),W=(0,wt.Z)((()=>{o?b({chatId:N.fromChatId,groupedId:U,groupedChatId:n,messageId:N.fromMessageId}):u&&x?T({chatId:x,threadId:L,messageId:N.fromMessageId}):b({chatId:N.fromChatId,messageId:N.fromMessageId})})),Y=(0,wt.Z)((e=>{e.stopPropagation(),t(e,U)}));return{handleAvatarClick:O,handleSenderClick:j,handleViaBotClick:_,handleReplyClick:F,handleMediaClick:D,handleAudioPlay:q,handleAlbumMediaClick:G,handleMetaClick:Y,handleTranslationClick:(0,wt.Z)((e=>{e.stopPropagation(),R({chatId:n,messageId:I?void 0:A})})),handleOpenThread:(0,wt.Z)((()=>{w({id:s.chatId,threadId:s.id})})),handleReadMedia:H,handleCancelUpload:V,handleVoteSend:$,handleGroupForward:J,handleForward:K,handleFocus:z,handleFocusForwarded:W,handleDocumentGroupSelectAll:Y,handleTopicChipClick:(0,wt.Z)((()=>{f&&b({chatId:u&&x?x:n,threadId:f.id,messageId:A})})),handleStoryClick:(0,wt.Z)((()=>{v&&k({peerId:v.peerId,storyId:v.id,isSingleStory:!0})}))}}(We,Vt,t,bt,ue,H,Lt,Rt,Q,l,Wt,Yt,x,Re,Boolean(xe),F&&"content"in F?F:void 0);(0,it.d4)((()=>{E&&zt&&M&&Ve()}),[Ve,E,M,zt]);const Ns=(0,dt.Z)("Message message-list-item",w&&"first-in-group",V?"is-protected":"allow-selection",b&&"last-in-group",Z&&"first-in-document-group",S&&"last-in-document-group",E&&"last-in-list",Et&&"own",Boolean(t.views)&&"has-views",t.isEdited&&"was-edited",kt&&"has-reply",nt&&"has-menu-open",J&&!z&&"focused",Y&&"is-forwarding",t.isDeleting&&"is-deleting",H&&"is-in-document-group",Ot&&"is-album",t.hasUnreadMention&&"has-unread-mention",de&&"is-selected",ce&&"is-in-selection-mode",L&&!m&&"is-thread-top",Boolean(t.inlineButtons)&&"has-inline-buttons",os&&"is-swiped",vt,v&&"is-just-added",(oe||Qe)&&"has-active-reaction",Ut&&"is-story-mention"),{text:Bs,photo:xs,video:Ls,audio:Us,voice:Os,document:js,sticker:_s,contact:Fs,poll:Ds,webPage:qs,invoice:Gs,location:Vs,action:Js,game:Ks,storyData:zs}=(0,g.qp)(t),Ws=function(e,t,s){const[a,n]=(0,it.eJ)();return(0,it.d4)((()=>{t||s&&!s()||(e?async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2;return an||await nn.promise,await an.request({name:"detectLanguage",args:[e,t]})}(e).then(n):n(void 0))}),[t,e,s]),a}(Bs?.text,!(Ae||Ne),je);!function(e,t,s,a){(0,it.d4)((()=>{if(s||a&&!a())return;const n=Boolean(e.content.text?.text.length);!function(e,t,s,a){const n=un.get(e)||new ln(150),i=n.get(t);i&&i.detectedLanguage===a&&i.isTranslatable===s||(n.set(t,{id:t,isTranslatable:s,detectedLanguage:a}),un.set(e,n),mn(e))}(e.chatId,e.id,n,t)}),[e,t,s,a])}(t,Ws,!Ne,je);const Ys=(0,g.cT)(t,!xe),{isPending:Xs,translatedText:Qs}=(0,pn.Z)(Te,bt,Ys?yt:void 0,Be),ea=(0,ua.Z)(Qs,Boolean(Ys)),ta=Qs||ea,{phoneCall:sa}=Js||{},aa=(Se||re&&ee&&Mt)&&!_t&&"thread"===fe&&!p,na=Se&&!_t&&"thread"===fe&&!p,ia=!at&&!sa&&!ce&&pe&&!_t&&!Ut,oa=function(e){let{hasSubheader:t,isCustomShape:s,isLastInGroup:a,asForwarded:i,hasThread:o,forceSenderName:r,hasComments:c,hasActionButton:d,hasReactions:l,isGeoLiveActive:u,withVoiceTranscription:m}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{text:h,photo:p,video:f,audio:I,voice:v,document:w,poll:y,webPage:b,contact:P,location:Z,invoice:S,storyData:C}=(0,g.qp)(e),M=[n.gnl],E=C||p||f||Z||S?.extendedMedia,R=h||"venue"===Z?.type||u,k=E&&!R,T=Boolean(e.viaBotId);return!E&&e.emojiOnlyCount?(M.push("emoji-only"),e.emojiOnlyCount<=n.L5X&&M.push(`emoji-only-${e.emojiOnlyCount}`)):R?M.push("text"):M.push("no-text"),d&&M.push("has-action-button"),s&&(M.push("custom-shape"),f?.isRound&&M.push("round"),c&&M.push("has-comments")),E?M.push("media"):I?M.push("audio"):v?(M.push("voice"),m&&M.push("with-voice-transcription")):w?M.push("document"):P?M.push("contact"):y?M.push("poll"):b&&(M.push("web-page"),(b.photo||b.video)&&M.push("media")),S&&!S.extendedMedia&&M.push("invoice"),C&&M.push("story"),i&&M.push("is-forwarded"),t&&M.push("has-subheader"),o&&M.push("has-replies"),l&&M.push("has-reactions"),T&&M.push("is-via-bot"),r&&M.push("force-sender-name"),s||(M.push("has-shadow"),E&&c&&M.push("has-background"),(t||i||T||!k||r)&&M.push("has-solid-background"),a&&(p||!k||Z&&i)&&M.push("has-appendix")),M.join(" ")}(t,{hasSubheader:Ht,isCustomShape:Nt,isLastInGroup:b,asForwarded:Lt,hasThread:At&&!p,forceSenderName:k,hasComments:Se&&Se.messagesCount>0,hasActionButton:qt||Gt,hasReactions:xt,isGeoLiveActive:"geoLive"===Vs?.type&&!(0,g.$R)(t),withVoiceTranscription:zt}),ra=oa.includes("has-appendix"),ca=(0,g.fY)(t),da=(0,Ja.qo)(t.emojiOnlyCount);let la,ma;la=sa||_t?"none":!ca||qs||da?"standalone":"in-text",xt?Nt||(xs||Ls||zs||Vs&&"geo"===Vs.type)&&!ca?ma="outside":Lt?(la="standalone",ma="inside"):ma="inside":ma="none";const ha=Nt?"in-meta":"in-content";(0,Qa.Z)(Q&&t.replyToChatId?t.replyToChatId:bt,kt?t.replyToMessageId:void 0,O,t.id),(0,en.Z)(t.replyToStoryUserId?t.replyToStoryUserId:bt,t.replyToStoryId,F),(0,hn.Z)($e,bt,J,K,z,W,v);const pa=ee&&t.postAuthorTitle||!Lt&&Pt?.postAuthorTitle||void 0;!function(e,t){(0,it.bt)((()=>{t&&(0,ct.lT)((()=>{const t=e.current.querySelector(".message-signature")?.offsetWidth;if(t)return()=>{e.current.style.setProperty("--meta-safe-author-width",`${t}px`)}}))}),[e,t])}($e,pa);const ga=E,fa=(0,wt.Z)((e=>{const t=ze.current,s=e.contentRect.height;if(ze.current=s,(0,Za.Ni)()||!t||s<=t)return;const a=e.target.closest(".MessageList");if(!a)return;(0,It.YW)(400);const n=s-t,{offsetHeight:i,scrollHeight:o,scrollTop:r}=a;Math.round(o-r-i)-n<=5&&Ve()})),Ia=(0,on.Z)(fa,[fa],300,!1);(0,Ba.Z)($e,Ia,!ga),(0,it.d4)((()=>{const e=Je.current;Ce&&e&&(0,$a.P)(e)&&He({messageIds:[yt]})}),[Ce,yt,He]);const va=(0,it.Ye)((()=>Ot?Xa(Et,Boolean(Lt),Boolean(u),l,st):void 0),[Ot,Et,Lt,u,l,st]),wa=Lt?28:0,ya=(0,it.Ye)((()=>{let e,s,a,n=!1,i="";if(!Ot&&(xs||Ls||Gs?.extendedMedia)){let a;if(xs)a=(0,Ka.GH)(t,Lt,u,st).width;else if(Ls)a=Ls.isRound?P.Rj:(0,Ka.GH)(t,Lt,u,st).width;else if(Gs?.extendedMedia&&Gs.extendedMedia.width&&Gs.extendedMedia.height){const{width:e,height:t}=Gs.extendedMedia;a=(0,P.Kf)({width:e,height:t,fromOwnMessage:Et,asForwarded:Lt,noAvatars:u,isMobile:st}).width}a&&(a<Ka.Vx&&(s=a),e=Math.max((0,Ka.Pw)(Bs?.text,aa),a),Gs?.extendedMedia&&e-a>18&&(n=!0))}else va&&(e=Math.max((0,Ka.Pw)(Bs?.text,aa),va.containerStyle.width),e-va.containerStyle.width>18&&(n=!0));if(e)i=`width: ${e+wa}px`,a=e+$i;else if(_s&&!Ht){const{width:e}=(0,P.Wr)(_s,st);i=`width: ${e+wa}px`,a=e+$i}return{contentWidth:s,noMediaCorners:n,style:i,reactionsMaxWidth:a}}),[va,Lt,wa,Ht,Gs?.extendedMedia,Ot,aa,st,Et,t,u,xs,_s,Bs?.text,Ls]),{contentWidth:ba,noMediaCorners:Pa,style:Sa,reactionsMaxWidth:Ca}=ya;function Ma(e){return it.ZP.createElement(Tn.Z,{messageOrStory:t,translatedText:Be?ta:void 0,isForAnimation:e,emojiSize:da,highlight:ae,isProtected:V,observeIntersectionForLoading:o,observeIntersectionForPlaying:d,withTranslucentThumbs:Nt})}const Ea=(0,it.I4)((()=>{if(pe)return it.ZP.createElement("div",{className:(0,dt.Z)("quick-reaction",rs&&!oe&&"visible"),onClick:ns,ref:Ke},it.ZP.createElement(An.Z,{reaction:pe,size:Vi,availableReactions:he,observeIntersection:d}))}),[oe,he,pe,ns,rs,d]);function Ra(){const e=it.ZP.createElement(fi,{message:t,isPinned:ve,noReplies:f,repliesThreadInfo:Se,outgoingStatus:q,signature:pa,withReactionOffset:"inside"===ma,renderQuickReactionButton:ia&&"in-meta"===ha?Ea:void 0,availableReactions:he,isTranslated:Boolean(Be?ta:void 0),onClick:Is,onTranslationClick:vs,onOpenThread:ws});return"inside"!==ma?e:it.ZP.createElement(Ai,{message:me,metaChildren:e,observeIntersection:d,noRecentReactors:ee})}function ka(){if(Nt&&!St||!(h&&(!(xs||Ls||Vs)||ke)||Lt||St||k)||jt||kt&&Nt)return;let e,s;!Yt||Nt&&St?Pt?.hiddenUserName?e=Pt.hiddenUserName:zs&&B&&(e=(0,g.OU)(We,B)):(e=(0,g.OU)(We,Yt),Lt||Et||(s=`color-${(0,g.kj)(Yt)}`));const a=Yt&&"emojiStatus"in Yt&&Yt.emojiStatus,i=Yt&&"isPremium"in Yt&&Yt.isPremium;return it.ZP.createElement("div",{className:"message-title",dir:"ltr"},e||Lt?it.ZP.createElement("span",{className:(0,dt.Z)("message-title-name",Pt?.hiddenUserName?"sender-hidden":"interactive",s),onClick:us,dir:"ltr"},Lt&&it.ZP.createElement("i",{className:"icon "+(Pt?.hiddenUserName?"icon-forward":"icon-share-filled")}),e?(0,Hs.Z)(e):Lt?" ":void 0,!Lt&&a&&it.ZP.createElement(Cs.Z,{documentId:a.documentId,loopLimit:n.y3O,observeIntersectionForLoading:o,observeIntersectionForPlaying:d}),!Lt&&!a&&i&&it.ZP.createElement(Ms.Z,null),Yt?.fakeType&&it.ZP.createElement(kn.Z,{fakeType:Yt.fakeType})):x?void 0:" ",x&&it.ZP.createElement(it.ZP.Fragment,null,it.ZP.createElement("span",{className:"via"},We("ViaBot")),it.ZP.createElement("span",{className:"interactive",onClick:ms},(0,Hs.Z)(`@${x.usernames[0].username}`))),Pt?.isLinkedChannelPost?it.ZP.createElement("span",{className:"admin-title",dir:"auto"},We("DiscussChannel")):t.forwardInfo?.postAuthorTitle&&te&&Lt?it.ZP.createElement("span",{className:"admin-title",dir:"auto"},t.forwardInfo?.postAuthorTitle):t.postAuthorTitle&&te&&!Lt?it.ZP.createElement("span",{className:"admin-title",dir:"auto"},t.postAuthorTitle):!Ee||Lt||St?void 0:it.ZP.createElement("span",{className:"admin-title",dir:"auto"},Ee.customTitle||We(Ee.isOwner?"GroupInfo.LabelOwner":"GroupInfo.LabelAdmin")))}const Ta=te&&Lt?t.postAuthorTitle:void 0;return it.ZP.createElement("div",{ref:$e,id:(0,g.d0)(t.id),className:Ns,"data-message-id":yt,onMouseDown:Xt,onClick:Qt,onContextMenu:es,onDoubleClick:ts,onMouseEnter:_t?cs:void 0,onMouseMove:ia?as:void 0,onMouseLeave:ia||_t?is:void 0},it.ZP.createElement("div",{ref:Je,className:"bottom-marker","data-message-id":yt,"data-last-message-id":l?l.messages[l.messages.length-1].id:void 0,"data-album-main-id":l?l.mainMessage.id:void 0,"data-has-unread-mention":t.hasUnreadMention||void 0,"data-has-unread-reaction":Ce||void 0,"data-is-pinned":ve||void 0,"data-should-update-views":void 0!==t.views}),!H&&it.ZP.createElement("div",{className:"message-select-control"},de&&it.ZP.createElement("i",{className:"icon icon-select"})),S&&it.ZP.createElement("div",{className:(0,dt.Z)("message-select-control group-select",le&&"is-selected"),onClick:ks},le&&it.ZP.createElement("i",{className:"icon icon-select"})),m&&function(){const e=!Wt&&Pt?Pt.hiddenUserName:void 0;return it.ZP.createElement(Zn.Z,{size:st?"small-mobile":"small",peer:Wt,text:e,onClick:Wt?ls:void 0})}(),it.ZP.createElement("div",{className:(0,dt.Z)("message-content-wrapper",oa.includes("text")&&"can-select-text")},it.ZP.createElement("div",{className:oa,style:Sa,dir:"auto"},Lt&&!jt&&it.ZP.createElement(it.ZP.Fragment,null,ka(),Ta&&it.ZP.createElement("span",{className:"admin-title",dir:"auto"},Ta)),function(){const e=(0,dt.Z)("content-inner",Lt&&"forwarded-message",Ht&&"with-subheader",Pa&&"no-media-corners"),s=b&&!ca&&!Lt&&!na,a=(0,dt.Z)("text-content","clearfix","in-text"===la&&"with-meta",q&&"with-outgoing-icon");return it.ZP.createElement("div",{className:e,onDoubleClick:ss,dir:"auto"},!Lt&&ka(),Ht&&it.ZP.createElement("div",{className:"message-subheader"},ke&&it.ZP.createElement(Un,{topic:Re,onClick:Ts,className:"message-topic"}),kt&&it.ZP.createElement(Mn.Z,{message:O,noUserColors:Et||ee,isProtected:V,sender:j,forwardSender:_,chatTranslations:Te,requestedChatTranslationLanguage:xe,observeIntersectionForLoading:o,observeIntersectionForPlaying:d,onClick:hs}),Tt&&it.ZP.createElement(Rn,{story:F,sender:D,noUserColors:Et||ee,isProtected:V,observeIntersectionForLoading:o,onClick:As})),_s&&it.ZP.createElement(Fi,{message:t,observeIntersection:o,observeIntersectionForPlaying:d,shouldLoop:Pe,shouldPlayEffect:_s.hasEffect&&(Me.current&&yt>=Me.current||Mt)||void 0,withEffect:Le,onPlayEffect:et,onStopEffect:tt}),Bt&&ie&&it.ZP.createElement($n,{customEmojiId:ie,withEffects:Le&&(0,g.YC)(bt),isOwn:Et,observeIntersection:o,forceLoadPreview:Mt,messageId:yt,chatId:bt,activeEmojiInteractions:ge}),Bt&&ne&&it.ZP.createElement(Kn,{emoji:ne,withEffects:Le&&(0,g.YC)(bt),isOwn:Et,observeIntersection:o,forceLoadPreview:Mt,messageId:yt,chatId:bt,activeEmojiInteractions:ge}),Ot&&it.ZP.createElement(qn,{album:l,albumLayout:va,observeIntersection:o,isOwn:Et,isProtected:V,hasCustomAppendix:s,onMediaClick:fs}),sa&&it.ZP.createElement(Ii,{message:t,phoneCall:sa,chatId:bt}),!Ot&&xs&&it.ZP.createElement(jn.Z,{message:t,observeIntersection:o,noAvatars:u,canAutoLoad:ye,uploadProgress:G,shouldAffectAppendix:s,isDownloading:we,isProtected:V,asForwarded:Lt,theme:R,forcedWidth:ba,onClick:ps,onCancelUpload:bs}),!Ot&&Ls&&Ls.isRound&&it.ZP.createElement(ji,{message:t,observeIntersection:o,canAutoLoad:ye,isDownloading:we}),!Ot&&Ls&&!Ls.isRound&&it.ZP.createElement(_n.Z,{message:t,observeIntersectionForLoading:o,observeIntersectionForPlaying:d,forcedWidth:ba,noAvatars:u,canAutoLoad:ye,canAutoPlay:be,uploadProgress:G,isDownloading:we,isProtected:V,asForwarded:Lt,onClick:ps,onCancelUpload:bs}),(Us||Os)&&it.ZP.createElement(Pn.ZP,{theme:R,message:t,origin:c.Cr.Inline,uploadProgress:G,isSelectable:H,isSelected:de,noAvatars:u,onPlay:gs,onReadMedia:!Os||Et&&!X?void 0:ys,onCancelUpload:bs,isDownloading:we,isTranscribing:C,isTranscriptionHidden:Ye,isTranscribed:Boolean(M),isTranscriptionError:Ct,canDownload:!V,onHideTranscription:Xe,canTranscribe:y}),js&&it.ZP.createElement(Sn.Z,{message:t,observeIntersection:o,canAutoLoad:ye,autoLoadFileMaxSizeMb:Ze,uploadProgress:G,isSelectable:H,isSelected:de,onMediaClick:ps,onCancelUpload:bs,isDownloading:we,shouldWarnAboutSvg:_e}),zs&&!Ut&&it.ZP.createElement(qi,{message:t,isProtected:V}),Ut&&it.ZP.createElement(Gi,{message:t}),Fs&&it.ZP.createElement(Xn,{contact:Fs}),Ds&&it.ZP.createElement(Mi,{message:t,poll:Ds,onSendVote:Ps}),Ks&&it.ZP.createElement(ei,{message:t,canAutoLoadMedia:ye}),Gs?.extendedMedia&&it.ZP.createElement(ri,{message:t,isConnected:Oe}),zt&&it.ZP.createElement("p",{className:(0,dt.Z)("transcription",!Ye&&Ct&&"transcription-error"),dir:"auto"},Ct?We("NoWordsRecognized"):C&&M?it.ZP.createElement(Cn.Z,{content:M}):M),!Bt&&ca&&it.ZP.createElement("div",{className:a,dir:"auto"},Ma(),Xs&&it.ZP.createElement("div",{className:"translation-animation"},it.ZP.createElement("div",{className:"text-loading"},Ma(!0))),"in-text"===la&&Ra()),qs&&it.ZP.createElement(Hi.Z,{message:t,observeIntersection:o,noAvatars:u,canAutoLoad:ye,canAutoPlay:be,asForwarded:Lt,isDownloading:we,isProtected:V,theme:R,story:Ue,isConnected:Oe,onMediaClick:ps,onCancelMediaTransfer:bs}),Gs&&!Gs.extendedMedia&&it.ZP.createElement(ni,{message:t,shouldAffectAppendix:s&&!xt,isInSelectMode:ce,isSelected:de,theme:R,forcedWidth:ba}),Vs&&it.ZP.createElement(pi,{message:t,isInSelectMode:ce,isSelected:de,theme:R,peer:A}))}(),!_t&&"standalone"===la&&!Ut&&Ra(),Dt&&qt?it.ZP.createElement(Jt.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:We("lng_context_forward_msg"),onClick:S?Zs:Ss},it.ZP.createElement("i",{className:"icon icon-share-filled"})):Dt&&Gt?it.ZP.createElement(Jt.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:Ie?Es:Rs},it.ZP.createElement("i",{className:"icon icon-arrow-right"})):void 0,na&&it.ZP.createElement(Wn,{threadInfo:Se,disabled:p}),ra&&it.ZP.createElement(Ji,{isOwn:Et}),ia&&"in-content"===ha&&Ea()),t.inlineButtons&&it.ZP.createElement(ti,{message:t,onClick:qe}),"outside"===ma&&!Ut&&it.ZP.createElement(Ai,{message:me,isOutside:!0,maxWidth:Ca,observeIntersection:d,noRecentReactors:ee})),ot&&it.ZP.createElement(Qn.Z,{isOpen:nt,anchor:ot,targetHref:rt?.matches("a[href]")?rt.href:void 0,message:t,album:l,messageListType:fe,onClose:mt,onCloseAnimationEnd:ht,repliesThreadInfo:Se,noReplies:f,detectedLanguage:Ws}))}))),zi=e=>{const{isOpen:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"AboutAdsModal",!t);return s?it.ZP.createElement(s,e):void 0},Wi=e=>{const{isOpen:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"SponsoredMessageContextMenuContainer",!t);return s?it.ZP.createElement(s,e):void 0},Yi=(0,it.X$)((0,a.c$)(((e,t)=>{let{chatId:s}=t;const a=(0,v.fSe)(e,s),{chatId:n,isBot:i}=a||{};return{message:a,bot:n&&i?(0,v.dyD)(e,n):void 0,channel:!i&&n?(0,v.Z1J)(e,n):void 0}}))((e=>{let{chatId:t,message:s,containerRef:n,bot:o,channel:r}=e;const{viewSponsoredMessage:c,openChat:d,openChatByInvite:l,startBot:u,focusMessage:m}=(0,a.Sv)(),h=(0,$t.Z)(),p=(0,it.sO)(null),f=(0,it.sO)(null),I=Boolean(s),{observe:v}=(0,Da.S1)({rootRef:n,debounceMs:200,threshold:1}),{isContextMenuOpen:w,contextMenuPosition:y,handleBeforeContextMenu:b,handleContextMenu:P,handleContextMenuClose:Z,handleContextMenuHide:S}=(0,$s.Z)(p,i.$b,!0,i.wZ),[C,M,E]=(0,ds.Z)(!1);(0,it.d4)((()=>I?v(f.current,(e=>{e.isIntersecting&&c({chatId:t})})):void 0),[t,I,v,c]);const R=(0,wt.Z)((()=>{s&&(s.chatInviteHash?l({hash:s.chatInviteHash}):s.channelPostId?m({chatId:s.chatId,messageId:s.channelPostId}):(d({id:s.chatId}),s.startParam&&u({botId:s.chatId,param:s.startParam})))}));if(s)return it.ZP.createElement("div",{ref:p,key:"sponsored-message",className:"SponsoredMessage Message open",onMouseDown:e=>{(0,Ta.q)(e),b(e)},onContextMenu:P},it.ZP.createElement("div",{className:"message-content has-shadow has-solid-background",dir:"auto"},it.ZP.createElement("div",{className:"content-inner",dir:"auto"},it.ZP.createElement("div",{className:"message-title",dir:"ltr"},o&&(0,Hs.Z)((0,g.Js)(o)||""),r&&(0,Hs.Z)(s.chatInviteTitle||(0,g.U)(h,r)||"")),it.ZP.createElement("div",{className:"text-content with-meta",dir:"auto",ref:f},it.ZP.createElement("span",{className:"text-content-inner",dir:"auto"},(0,vi.H)({text:s.text.text,entities:s.text.entities})),it.ZP.createElement("span",{className:"MessageMeta",dir:"ltr"},it.ZP.createElement("span",{className:"message-signature"},s.isRecommended?h("Message.RecommendedLabel"):h("SponsoredMessage")))),it.ZP.createElement(Jt.Z,{color:"secondary",size:"tiny",ripple:!0,onClick:R,className:"SponsoredMessage__button"},h(s.isBot?"Conversation.ViewBot":s.channelPostId?"Conversation.ViewPost":"Conversation.ViewChannel")))),y&&it.ZP.createElement(Wi,{isOpen:w,anchor:y,message:s,onAboutAds:M,onClose:Z,onCloseAnimationEnd:S}),it.ZP.createElement(zi,{isOpen:C,onClose:E}))}))),Xi=(0,it.X$)((e=>{let{isCurrentUserPremium:t,chatId:s,threadId:o,messageIds:d,messageGroups:l,getContainerHeight:m,isViewportNewest:p,isUnread:f,isComments:I,withUsers:v,isChannelChat:w,noAvatars:y,containerRef:b,anchorIdRef:P,memoUnreadDividerBeforeIdRef:Z,memoFirstUnreadIdRef:S,type:C,isReady:M,threadTopMessageId:E,hasLinkedChat:R,isSchedule:k,shouldRenderBotInfo:A,noAppearanceAnimation:N,onFabToggle:B,onNotchToggle:x,onPinnedIntersectionChange:L}=e;const{openHistoryCalendar:U}=(0,a.Sv)(),O=(0,Fa.Z)(M),{observeIntersectionForReading:j,observeIntersectionForLoading:_,observeIntersectionForPlaying:F}=function(e,t,s,n,i){const{markMessageListRead:o,markMentionsRead:r,animateUnreadReaction:c,scheduleForViewsIncrement:d}=(0,a.Sv)(),{isMobile:l}=(0,T.ZP)(),u=l?300:500,{observe:m,freeze:h,unfreeze:p}=(0,Da.S1)({rootRef:t,throttleMs:150},(t=>{if("thread"!==e||(0,ht.q)())return;let a=0;const l=[],u=[],m=[],h=[],p=[];let g=!1;t.forEach((e=>{const{isIntersecting:t,target:s,boundingClientRect:n,rootBounds:i}=e,{dataset:o}=s,r=Number(o.lastMessageId||o.messageId),c="true"===o.shouldUpdateViews,d=o.albumMainId?Number(o.albumMainId):void 0;t?(r>a&&(a=r),o.hasUnreadMention&&l.push(r),o.hasUnreadReaction&&u.push(r),o.isPinned&&m.push(d||r),c&&p.push(d||r)):o.isPinned&&(i&&n.bottom<i.top&&(g=!0),h.push(d||r))})),s.current&&a>=s.current&&o({maxId:a}),l.length&&r({messageIds:l}),u.length&&c({messageIds:u}),(m.length||h.length)&&n({viewportPinnedIdsToAdd:m,viewportPinnedIdsToRemove:h,isReversed:g}),p.length&&d({chatId:i,ids:p})}));(0,ht.Z)(h,p);const{observe:g}=(0,Da.S1)({rootRef:t,throttleMs:qa,margin:u}),{observe:f}=(0,Da.S1)({rootRef:t,throttleMs:qa});return{observeIntersectionForReading:m,observeIntersectionForLoading:g,observeIntersectionForPlaying:f}}(C,b,S,L,s),{withHistoryTriggers:D,backwardsTriggerRef:q,forwardsTriggerRef:G,fabTriggerRef:H}=function(e,t,s,n,o,r,d,l,u){const{loadViewportMessages:m}=(0,a.Sv)(),[p,f]=(0,it.Ye)((()=>"thread"===e?[(0,h.Ds)((()=>m({direction:c.Uq.Backwards})),1e3,!0,!1),(0,h.Ds)((()=>m({direction:c.Uq.Forwards})),1e3,!0,!1)]:[]),[m,s]),I=(0,it.sO)(null),v=(0,it.sO)(null),w=(0,it.sO)(null),y=(0,wt.Z)((()=>{if(!u)return;if(!s?.length)return d(!1),void l(!1);if(!o)return d(!0),void l(!0);const e=t.current;if(!e)return;const{offsetHeight:a,scrollHeight:n,scrollTop:i}=e,c=Math.round(n-i-a),m=c<=1;0!==n&&(d(r?!m:!(c<=50)),l(!m))})),{observe:b}=(0,Da.S1)({rootRef:t,margin:i.gZ},(e=>{f&&p&&((0,g.AJ)(s[0])||e.forEach((e=>{let{isIntersecting:t,target:s}=e;t&&("backwards-trigger"===s.className&&p(),"forwards-trigger"===s.className&&f())})))})),P=s&&s.length>1;(0,Da._N)(I,P?b:void 0),(0,Da._N)(v,P?b:void 0);const{observe:Z,freeze:S,unfreeze:C}=(0,Da.S1)({rootRef:t,margin:100,throttleScheduler:ct.i$},y);(0,Da._N)(w,Z);const{observe:M,freeze:E,unfreeze:R}=(0,Da.S1)({rootRef:t,margin:1,throttleScheduler:ct.i$},y);(0,Da._N)(w,M),(0,it.d4)((()=>{u&&y()}),[u,y]);const k=(0,wt.Z)((()=>{S(),E(),setTimeout((()=>{R(),C()}),350)}));(0,St.Z)(k,[k,s]);const T=(0,Ga.Vr)(n,200);return(0,Ha.b)(k,[k,T]),{withHistoryTriggers:P,backwardsTriggerRef:I,forwardsTriggerRef:v,fabTriggerRef:w}}(C,b,d,m,p,f,B,x,M),V=(0,$t.Z)(),$=it.ZP.createElement("div",{className:(0,dt.Z)("unread-divider","local-action-message"),key:"unread-messages"},it.ZP.createElement("span",null,V("UnreadMessages"))),J=N?0:l.reduce(((e,t)=>e+t.senderGroups.flat().length),0);let K=0;const z=(0,ua.Z)(d),W=Boolean(d&&z&&d[d.length-2]===z[z.length-1]),Y=l.map(((e,t,s)=>{const a=e.senderGroups.map(((e,a,n)=>{if(1===e.length&&!Ra(e[0])&&(0,g.FT)(e[0])&&!e[0].content.action?.phoneCall){const i=e[0],c=a===n.length-1&&t===s.length-1;return(0,u.oA)([i.id===Z.current&&$,it.ZP.createElement(Va.Z,{key:i.id,message:i,threadId:o,messageListType:C,isInsideTopic:Boolean(o&&o!==r._f),observeIntersectionForReading:j,observeIntersectionForLoading:_,observeIntersectionForPlaying:F,memoFirstUnreadIdRef:S,appearanceOrder:J-++K,isJustAdded:c&&W,isLastInList:c,onPinnedIntersectionChange:L})])}let i;return e.map(((c,d)=>{const l=Ra(c)?c.mainMessage:c,m=Ra(c)?c:void 0,h=(0,g.B4)(l),p=Ra(c),f=e[d+1];l.previousLocalId&&P.current===(0,g.d0)(l.previousLocalId)&&(P.current=(0,g.d0)(l.id));const b=!p&&l.groupedId?l.groupedId:void 0,M=f&&!Ra(f)?f.groupedId:void 0,k={isFirstInGroup:0===d,isLastInGroup:d===e.length-1,isFirstInDocumentGroup:Boolean(b&&b!==i),isLastInDocumentGroup:Boolean(b&&b!==M),isLastInList:d===e.length-1&&a===n.length-1&&t===s.length-1};i=b;const T=(0,g.KK)(l),A=(0,g.jM)(l)?`${l.date}_${T}`:T,N=!1===R||!w,B=l.id===E;return(0,u.oA)([l.id===Z.current&&$,it.ZP.createElement(Ki,{key:A,message:l,observeIntersectionForBottom:j,observeIntersectionForLoading:_,observeIntersectionForPlaying:F,album:m,noAvatars:y,withAvatar:k.isLastInGroup&&v&&!h&&(!B||!I),withSenderName:k.isFirstInGroup&&v&&!h,threadId:o,messageListType:C,noComments:N,noReplies:!N||o!==r._f||"scheduled"===C,appearanceOrder:J-++K,isJustAdded:k.isLastInList&&W,isFirstInGroup:k.isFirstInGroup,isLastInGroup:k.isLastInGroup,isFirstInDocumentGroup:k.isFirstInDocumentGroup,isLastInDocumentGroup:k.isLastInDocumentGroup,isLastInList:k.isLastInList,memoFirstUnreadIdRef:S,onPinnedIntersectionChange:L,getIsMessageListReady:O}),l.id===E&&it.ZP.createElement("div",{className:"local-action-message",key:"discussion-started"},it.ZP.createElement("span",null,V("DiscussionStarted")))])})).flat()}));return it.ZP.createElement("div",{className:"message-date-group",key:e.datetime,onMouseDown:Ta.q,teactFastList:!0},it.ZP.createElement("div",{className:(0,dt.Z)("sticky-date",!k&&"interactive"),key:"date-header",onMouseDown:Ta.q,onClick:k?void 0:()=>U({selectedAt:e.datetime})},it.ZP.createElement("span",{dir:"auto"},k&&e.originalDate===n.t4X&&V("MessageScheduledUntilOnline"),k&&e.originalDate!==n.t4X&&V("MessageScheduledOn",(0,ae.j1)(V,e.datetime,void 0,!0)),!k&&(0,ae.j1)(V,e.datetime))),a.flat())}));return it.ZP.createElement("div",{className:"messages-container",teactFastList:!0},D&&it.ZP.createElement("div",{ref:q,key:"backwards-trigger",className:"backwards-trigger"}),A&&it.ZP.createElement(_a,{isInMessageList:!0,key:`bot_info_${s}`,chatId:s}),Y.flat(),!t&&p&&it.ZP.createElement(Yi,{key:s,chatId:s,containerRef:b}),D&&it.ZP.createElement("div",{ref:G,key:"forwards-trigger",className:"forwards-trigger"}),it.ZP.createElement("div",{ref:H,key:"fab-trigger",className:"fab-trigger"}))})),Qi=3*P.Gw,eo=(0,it.X$)((e=>{let{isChatWithSelf:t,type:s,isGroupChatJustCreated:a,topic:n}=e;const i=(0,$t.Z)();return"scheduled"===s?function(e){return it.ZP.createElement("div",{className:"empty"},it.ZP.createElement("span",null,e("ScheduledMessages.EmptyPlaceholder")))}(i):t?function(e){return it.ZP.createElement("div",{className:"NoMessages"},it.ZP.createElement("div",{className:"wrapper"},it.ZP.createElement("i",{className:"icon no-messages-icon icon-cloud-download"}),it.ZP.createElement("h3",{className:"title"},e("Conversation.CloudStorageInfo.Title")),it.ZP.createElement("ul",{className:"description"},it.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description1")),it.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description2")),it.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description3")),it.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description4")))))}(i):a?function(e){return it.ZP.createElement("div",{className:"NoMessages"},it.ZP.createElement("div",{className:"wrapper",dir:e.isRtl?"rtl":void 0},it.ZP.createElement("h3",{className:"title"},e("EmptyGroupInfo.Title")),it.ZP.createElement("p",{className:"description"},e("EmptyGroupInfo.Subtitle")),it.ZP.createElement("ul",{className:"list-checkmarks"},it.ZP.createElement("li",null,e("EmptyGroupInfo.Line1")),it.ZP.createElement("li",null,e("EmptyGroupInfo.Line2")),it.ZP.createElement("li",null,e("EmptyGroupInfo.Line3")),it.ZP.createElement("li",null,e("EmptyGroupInfo.Line4")))))}(i):n?function(e,t){return it.ZP.createElement("div",{className:"NoMessages"},it.ZP.createElement("div",{className:"wrapper"},it.ZP.createElement(Bn.Z,{topic:t,size:Qi,className:"no-messages-icon topic-icon"}),it.ZP.createElement("h3",{className:"title"},e("Chat.EmptyTopicPlaceholder.Title")),it.ZP.createElement("p",{className:"description topic-description"},(0,Hs.Z)(e("Chat.EmptyTopicPlaceholder.Text"),["br"]))))}(i,n):it.ZP.createElement("div",{className:"empty"},it.ZP.createElement("span",null,i("NoMessages")))})),to=(0,h.Ds)((e=>e()),200,!1),so=(0,it.X$)((0,a.c$)(((e,t)=>{let{chatId:s,threadId:a,type:i}=t;const o=(0,v.Z1J)(e,s);if(!o)return{};const c=(0,v.$Wy)(e,s,a,i),d="scheduled"===i?(0,v.yBV)(e,s):(0,v.Zwk)(e,s),l=(0,v.qSq)(e,s,a),u=(0,v.tZg)(e,s,a);if(!(a===r._f||o?.isForum||d&&l&&d[l]))return{};const{isRestricted:m,restrictionReason:h,lastMessage:p}=o,f=(0,v.G$N)(e,s),I=a===r._f&&!c&&!o.unreadCount&&!f&&p&&!p.groupedId,w=(0,v.kBx)(e,s),y=o.topics?.[a],b=(0,g.YC)(s)?void 0:(0,v.x67)(e,s);return{isCurrentUserPremium:(0,v.wVz)(e),isChatLoaded:!0,isRestricted:m,restrictionReason:h,isChannelChat:(0,g.eA)(o),isGroupChat:(0,g.Bf)(o),isCreator:o.isCreator,isChatWithSelf:(0,v.FM1)(e,s),isRepliesChat:(0,g.pK)(s),isBot:Boolean(w),messageIds:c,messagesById:d,isComments:Boolean(u?.originChannelId),firstUnreadId:(0,v.It8)(e,s,a),isViewportNewest:"thread"!==i||(0,v.b9T)(e,s,a),focusingId:f,isSelectModeActive:(0,v.CAb)(e),threadTopMessageId:l,hasLinkedChat:b?Boolean(b.linkedChatId):void 0,topic:y,noMessageSendingAnimation:!(0,v.$Yd)(e,"messageSendingAnimations"),isServiceNotificationsChat:s===n.awM,...I&&{lastMessage:p}}}))((e=>{let{chatId:t,threadId:s,type:i,hasTools:o,onFabToggle:d,onNotchToggle:l,isCurrentUserPremium:m,isChatLoaded:p,isChannelChat:f,isGroupChat:I,canPost:w,isReady:y,isChatWithSelf:b,isRepliesChat:P,isCreator:Z,isBot:S,messageIds:C,messagesById:M,firstUnreadId:E,isComments:R,isViewportNewest:k,isRestricted:T,restrictionReason:A,focusingId:N,isSelectModeActive:B,lastMessage:x,threadTopMessageId:L,hasLinkedChat:U,withBottomShift:O,withDefaultBg:j,topic:_,noMessageSendingAnimation:F,isServiceNotificationsChat:D,onPinnedIntersectionChange:q,getForceNextPinnedInHeader:G}=e;const{loadViewportMessages:H,setScrollOffset:V,loadSponsoredMessages:$,loadMessageReactions:J,copyMessagesByIds:K,loadMessageViews:z,loadPeerStoriesByIds:W}=(0,a.Sv)(),Y=(0,it.sO)(null),X=(0,it.sO)("thread"===i&&(0,v.Vtl)((0,a.Rd)(),t,s)||(0,v.T6o)((0,a.Rd)(),t,s)||0),Q=(0,it.sO)(),ee=(0,it.sO)(),te=(0,it.sO)(),se=(0,it.sO)(),ae=(0,it.sO)(),ne=(0,it.sO)(),ie=(0,it.sO)(!1),oe=(0,it.sO)(Boolean(x)),re=Boolean(C);(0,St.Z)((()=>{re&&(0,h.R3)((()=>{oe.current=!1}))}),[re]),(0,St.Z)((()=>{se.current=E}),[E]),(0,it.d4)((()=>{!m&&f&&y&&$({chatId:t})}),[m,t,y,f]),(0,St.Z)((()=>{re&&(ae.current=se.current)}),[re]),(0,St.Z)((()=>{ne.current=N}),[N]),(e=>{(0,Ft.y)({"Mod+C":function(t){const s=(0,Na.Z)();s&&s.length>1&&(t.preventDefault(),e({messageIds:s}))}})})(K);const ce=(0,it.Ye)((()=>{if(!C?.length||!M)return;const e=C.map((e=>M[e])).filter(Boolean),t="scheduled"===i||D?["date","id"]:["id"];return e.length?ka((0,u.Xo)(e,t),ae.current):void 0}),[C,M,i,D]);(0,vt.Z)((()=>{if(!C||!M||"scheduled"===i)return;const e=C.filter((e=>M[e]?.reactions));e.length&&J({chatId:t,ids:e})}),15e3),(0,vt.Z)((()=>{if(!C||!M||"scheduled"===i)return;const e=C.map((e=>M[e]?.content.storyData)).filter(Boolean);if(!e.length)return;const t=e.reduce(((e,t)=>{const{peerId:s,id:a}=t;return e[s]||(e[s]=[]),e[s].push(a),e}),{});Object.entries(t).forEach((e=>{let[t,s]=e;W({peerId:t,storyIds:s})}))}),3e5),(0,vt.Z)((()=>{if(!C||!M||s!==r._f||"scheduled"===i)return;const e=C.filter((e=>M[e]?.repliesThreadInfo?.isComments||void 0!==M[e]?.views));e.length&&z({chatId:t,ids:e})}),15e3);const de=(0,it.Ye)((()=>{if("thread"===i)return(0,h.Ds)((()=>H({direction:c.Uq.Around})),1e3,!0,!1)}),[H,C]),{isScrolled:le,updateStickyDates:ue}=function(){const[e,t]=(0,ds.Z)(!1),s=(0,xa.Z)(1e3,!0);return{isScrolled:e,updateStickyDates:(0,wt.Z)(((e,a)=>{t(),document.body.classList.contains("is-scrolling-messages")||(0,ct.WM)((()=>{document.body.classList.add("is-scrolling-messages")})),s((()=>{const t=function(e,t){const s=e.querySelectorAll(".sticky-date"),a=e.scrollTop;return Array.from(s).find((e=>{const{offsetTop:s,offsetHeight:n}=e,i=s-a;return-n<=i&&i<=(t?60:10)}))}(e,a);t&&(0,ct.WM)((()=>{t.classList.add("stuck")})),(0,ct.WM)((()=>{const e=document.querySelector(".stuck");e&&e.classList.remove("stuck"),document.body.classList.remove("is-scrolling-messages")}))}))}))}}(),me=(0,wt.Z)((()=>{if(ie.current)return void(ie.current=!1);const e=Y.current;e&&(ne.current||ue(e,o),to((()=>{const n=(0,a.Rd)();G()&&!(0,v.jUK)(n).focusedMessage?.chatId&&q({hasScrolled:!0}),e.parentElement&&(X.current=e.scrollHeight-e.scrollTop,"thread"===i&&V({chatId:t,threadId:s,scrollOffset:X.current}))})))})),[he,pe]=function(e,t){const[s,a]=(0,ga.Z)(),n=(0,wt.Z)((e=>{a(e.contentRect.height)}));(0,Ba.Z)(e,n),(0,it.d4)((()=>{const a=Number(e.current.dataset.normalHeight)||0,n=s();n&&n>a&&t&&(e.current.dataset.normalHeight=String(n))}),[t,e,s]);const i=(0,it.sO)();return[s,i]}(Y,w&&!B);(0,it.d4)((()=>{if(!de||!p||T||N)return;if(C&&(0,g.AJ)(C[C.length-1]))return;const e=Y.current;(!C||C.length<n.hT6/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&de()}),[p,C,de,N,T]);const ge=(0,Dt.Y)((()=>{if(!C||!te.current)return;const e=te.current.filter((e=>C.includes(Number(e.dataset.messageId)))),t=e[1]||e[0];t&&(Q.current=t.id,ee.current=t.getBoundingClientRect().top)}));(0,St.Z)((()=>(0,ct.yn)((()=>ge.current()))),[C,k,o,ge]),(0,it.d4)((()=>ge.current()),[he,ge]),(0,Aa.Z)((e=>{let[t,s]=e;const a=he(),i=pe.current;if(pe.current=a,C===t&&k===s&&a!==i&&void 0===i)return;const r=Y.current;te.current=Array.from(r.querySelectorAll(".message-list-item"));const c=te.current[te.current.length-1],d=se.current?r.querySelector(`#${(0,g.d0)(se.current)}`):void 0,l=C&&t&&C[C.length-1]!==t[t.length-1],u=C?.[0]!==t?.[0]&&C?.length===n.hT6/2+1,m=l&&!u;k&&m&&C&&C.length<n.hT6/2&&!r.parentElement.classList.contains("force-messages-scroll")&&(0,ct.yn)((()=>r.firstElementChild.clientHeight<=2*r.offsetHeight))&&((0,ot.D_)(r.parentElement,"force-messages-scroll"),r.parentElement.classList.add("force-messages-scroll"),setTimeout((()=>{r.parentElement&&(0,ot.mC)(r.parentElement,"force-messages-scroll")}),500)),(0,ct.lT)((()=>{const{scrollTop:e,scrollHeight:t,offsetHeight:n}=r,l=X.current;let u=l-(i||n);m&&(u-=c?c.offsetHeight:0);const h=k&&s&&u<=50,p=C&&ne.current===C[C.length-1];m&&h&&!p&&(0,ct.i$)((()=>{const e=!(0,ht.q)()||!d;(0,Za.ZP)(r,e?c:d,e?"end":"start",20,void 0,void 0,F?0:void 0)}));const g=void 0!==i&&i!==a;if(g&&(0,Za.Ni)())return;const f=Q.current&&r.querySelector(`#${Q.current}`),I=!f&&ae.current&&r.querySelector(".unread-divider");let v;if(h&&g)v=t-n;else if(f){const t=f.getBoundingClientRect().top;v=e+(t-(ee.current||0))}else v=I?Math.min(I.offsetTop-(o?60:10),t-l):t-l;return()=>{(0,Ea.Z)(r,Math.ceil(v)),(0,Za.wA)(),X.current=Math.max(Math.ceil(t-v),n),ne.current||(ie.current=!0,(0,ct.i$)((()=>{ie.current=!1})))}}))}),[C,k,o,he,pe,F]),(0,Ss.Z)((e=>{let[t]=e;void 0!==t&&(0,It.YW)(200+n.fK3)}),[B]);const fe=Boolean(t&&(0,g.YC)(t)),Ie=Boolean(!fe&&!f||b||P),ve=Boolean(!Ie||f),we=(0,g.YC)(t)&&!b&&!S&&(!ce&&!x&&C&&(!te.current||0===te.current.length)||1===C?.length&&"contactSignUp"===M?.[C[0]]?.content.action?.type||"contactSignUp"===x?.content?.action?.type),ye=I&&Z&&1===C?.length&&"chatCreate"===M?.[C[0]]?.content.action?.type,be=1===C?.length&&"topicCreate"===M?.[C[0]]?.content.action?.type,Pe=(0,dt.Z)("MessageList custom-scroll",ve&&"no-avatars",!w&&"no-composer","pinned"===i&&"type-pinned",O&&"with-bottom-shift",j&&"with-default-bg",B&&"select-mode-active",le&&"scrolled",!y&&"is-animating"),Ze=C&&ce||x;return it.ZP.createElement("div",{ref:Y,className:Pe,onScroll:me,onMouseDown:Ta.q},T?it.ZP.createElement("div",{className:"empty"},it.ZP.createElement("span",null,A?A.text:"This is a private "+(f?"channel":"chat"))):S&&!Ze?it.ZP.createElement(_a,{chatId:t}):we?it.ZP.createElement(Ua,{userId:t}):C&&(!ce||ye||be)?it.ZP.createElement(eo,{chatId:t,topic:_,type:i,isChatWithSelf:b,isGroupChatJustCreated:ye}):Ze?it.ZP.createElement(Xi,{isCurrentUserPremium:m,chatId:t,isComments:R,isChannelChat:f,messageIds:C||[x.id],messageGroups:ce||ka([x]),getContainerHeight:he,isViewportNewest:Boolean(k),isUnread:Boolean(E),withUsers:Ie,noAvatars:ve,containerRef:Y,anchorIdRef:Q,memoUnreadDividerBeforeIdRef:ae,memoFirstUnreadIdRef:se,threadId:s,type:i,isReady:y,threadTopMessageId:L,hasLinkedChat:U,isSchedule:!!ce&&"scheduled"===i,shouldRenderBotInfo:S,noAppearanceAnimation:!ce||!oe.current,onFabToggle:d,onNotchToggle:l,onPinnedIntersectionChange:q}):it.ZP.createElement(Gt.Z,{color:"white",backgroundColor:"dark"}))}))),ao=e=>{const{isActive:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"MessageSelectToolbar",!t);return s?it.ZP.createElement(s,e):void 0};var no=s(18360),io=s(86203),oo=s(4794),ro=s(98799),co=s(6058),lo=s(14605),uo=s(17551);const mo=(0,it.X$)((0,a.c$)(((e,t)=>{let{chatId:s}=t;return{currentUserId:e.currentUserId,chat:(0,v.Z1J)(e,s),user:(0,v.dyD)(e,s)}}))((e=>{let{chatId:t,className:s,chat:n,user:i,settings:o,currentUserId:r}=e;const{openAddContactDialog:c,blockUser:d,reportSpam:l,deleteChat:u,leaveChannel:m,deleteChatUser:h,deleteHistory:p,toggleChatArchived:f,hideChatReportPanel:I}=(0,a.Sv)(),v=(0,$t.Z)(),[w,y,b]=(0,ds.Z)(),[P,Z]=(0,it.eJ)(!0),[S,C]=(0,it.eJ)(!0),{isAutoArchived:M,canReportSpam:E,canAddContact:R,canBlockContact:k}=o||{},T=n&&(0,g.G9)(n),A=(0,wt.Z)((()=>{c({userId:t}),M&&f({id:t})})),N=(0,wt.Z)((()=>{b(),d({userId:t}),E&&P&&l({chatId:t}),S&&u({chatId:t})})),B=(0,wt.Z)((()=>{I({chatId:t})})),x=(0,wt.Z)((()=>{b(),l({chatId:t}),T?(h({chatId:t,userId:r}),p({chatId:t,shouldDeleteForAll:!1})):m({chatId:t})}));if(o&&(n||i))return it.ZP.createElement("div",{className:(0,dt.Z)("ChatReportPanel",s),dir:v.isRtl?"rtl":void 0},R&&it.ZP.createElement(Jt.Z,{isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:A},v("lng_new_contact_add")),k&&it.ZP.createElement(Jt.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:y},v("lng_new_contact_block")),E&&!k&&it.ZP.createElement(Jt.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:y},v("lng_report_spam_and_leave")),it.ZP.createElement(Jt.Z,{round:!0,ripple:!0,size:"tiny",color:"translucent",onClick:B,ariaLabel:v("Close")},it.ZP.createElement("i",{className:"icon icon-close"})),it.ZP.createElement(uo.Z,{isOpen:w,onClose:b,title:v("BlockUserTitle",i?(0,g.Vl)(i):(0,g.U)(v,n)),text:i?v("UserInfo.BlockConfirmationTitle",(0,g.Js)(i)):v("Chat.Confirm.ReportSpam.Channel"),confirmIsDestructive:!0,confirmLabel:v("Block"),confirmHandler:i?N:x},i&&it.ZP.createElement(lo.Z,{label:v("DeleteThisChat"),checked:S,onCheck:C}),i&&E&&it.ZP.createElement(lo.Z,{label:v("ReportChat"),checked:P,onCheck:Z})))})));var ho=s(59188),po=s(2903),go=s(17891),fo=s(45370);const Io={"pinned-message-border":"II9Qj_b_XQlgwGAOoy7u",pinnedMessageBorder:"II9Qj_b_XQlgwGAOoy7u","pinned-message-border-wrapper-1":"QpNjYZM0KJrGrocs69__",pinnedMessageBorderWrapper1:"QpNjYZM0KJrGrocs69__","pinned-message-border-wrapper":"sNpxwL0ihB0aXnfphNmp",pinnedMessageBorderWrapper:"sNpxwL0ihB0aXnfphNmp","pinned-message-border-mark":"YX_iyQuDtga6uKXRQqR0",pinnedMessageBorderMark:"YX_iyQuDtga6uKXRQqR0"};function vo(e,t,s,a,n){return`M${e},${t+n}a${n},${n},0,0,1,\n ${s},0v${a-2*n}a${n},${n},0,0,1,${-s},0Z`}const wo=(0,it.X$)((e=>{let{count:t,index:s}=e;const a=(0,it.sO)(null),n=(0,it.Ye)((()=>function(e,t){const s=e-t-1,a=function(e){let t=8;return 1===e?t=36:2===e?t=17:3===e?t=11:(4===e||e>3)&&(t=7.5),t}(e),n=function(e,t){let s=36;return 1===e?s=36:2===e?s=17:3===e?s=1===t?12:11:(4===e||e>3)&&(s=7.5),s}(e,s),i=function(e,t){return e<=3?36:t*e+2*(e-1)}(e,a),o=`clipPath${e}`,r=function(e,t,s){let a="";if(3===s)a=vo(0,0,2,t,1)+vo(0,12,2,t+1,1)+vo(0,25,2,t,1);else for(let e=0;e<s;e++)a+=vo(0,(t+2)*e,2,t,1);return`<clipPath id="${e}">\n <path d="${a}" />\n </clipPath>`}(o,a,e),c=function(e,t,s){return 1===s?0:2===s?0===e?0:t+2:3===s?0===e?0:1===e?12:25:(t+2)*e}(s,a,e),d=function(e,t,s,a){return t<=4||e<=1?0:e>=t-2?a-36:(s+4)/2+(e-2)*(s+2)}(s,e,a,i);return{markHeight:n,clipPath:r,markTranslateY:c,trackTranslateY:d,trackHeight:i,clipPathId:o}}(t,s)),[t,s]);if((0,it.bt)((()=>{if(!a.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:s,markTranslateY:i,clipPathId:o,clipPath:r}=n,c=a.current.firstElementChild;if(a?.current){const n=a.current,{style:d}=n;d.height=`${e}px`,d.transform=`translateY(-${t}px)`,d.clipPath=`url("#${o}")`;const l=n.querySelector("svg"),u=n.querySelector("div"),m=n.querySelector("defs");l||c&&(c.innerHTML=`<svg height="0" width="0"><defs> ${r} </defs></svg>`),m&&(m.innerHTML=r),u&&(u.style.height=`${s}px`,u.style.transform=`translateY(${i}px)`)}}),[n]),1===t)return it.ZP.createElement("div",{className:Io.pinnedMessageBorder},it.ZP.createElement("div",{className:Io.pinnedMessageBorderWrapper1,ref:a}));const{trackHeight:i,trackTranslateY:o,markHeight:r,markTranslateY:c,clipPathId:d}=n;return it.ZP.createElement("div",{className:(0,dt.Z)(Io.pinnedMessageBorder,t>4&&Io.pinnedMessageBorderMask)},it.ZP.createElement("div",{className:Io.pinnedMessageBorderWrapper,ref:a,style:`clip-path: url("#${d}"); width: 2px;\n height: ${i}px; transform: translateY(-${o}px);`},it.ZP.createElement("span",null),it.ZP.createElement("div",{className:Io.pinnedMessageBorderMark,style:`--height: ${r}px; --translate-y: ${c}px; --translate-track: ${o}px;`})))})),yo="DusHAy2Lx0SlaPpVAb_o",bo="jSVbc8Hb7PjitJujB_dQ",Po=1.125*P.Gw,Zo=(0,it.X$)((e=>{let{message:t,count:s,index:n,customTitle:o,className:r,onUnpinMessage:c,onClick:d,onAllPinnedClick:l,isLoading:u,isFullWidth:m}=e;const{clickBotInlineButton:h}=(0,a.Sv)(),p=(0,$t.Z)(),f=(0,po.Z)(t),I=(0,zs.Z)((0,g.Ti)(t,"pictogram")),v=(0,g.NE)(t),w=(0,go.Z)([u],450)&&u,[y,b,Z]=(0,ds.Z)(),S=(0,wt.Z)((()=>{Z(),c&&c(t.id)})),C=(0,g.eH)(t),M=(0,wt.Z)((()=>{C&&h({messageId:t.id,button:C})})),[E,R,k]=(0,ds.Z)(),{handleClick:T,handleMouseDown:A}=(0,En.m)(d);return it.ZP.createElement("div",{className:(0,dt.Z)("HeaderPinnedMessageWrapper","TMOjo7XfD1ZiiuRtfpkm",m&&"full-width",r)},(s>1||w)&&it.ZP.createElement(Jt.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:p("EventLogFilterPinnedMessages"),onClick:w?void 0:l},u&&it.ZP.createElement(fs.Z,{color:"blue",className:(0,dt.Z)("d7XDT4Keip1KHh7mcCv9",yo,!w&&bo)}),it.ZP.createElement("i",{className:(0,dt.Z)("icon","icon-pin-list",yo,w&&bo)})),c&&it.ZP.createElement(Jt.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:p("UnpinMessageAlertTitle"),onClick:b},it.ZP.createElement("i",{className:"icon icon-close"})),it.ZP.createElement(uo.Z,{isOpen:y,onClose:Z,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:S}),it.ZP.createElement("div",{className:(0,dt.Z)("uhn_g6FmUELuGJrCm45w",E&&"jeTsUEkDCkzGUVwy6lrL"),onClick:T,onMouseDown:A,dir:p.isRtl?"rtl":void 0},it.ZP.createElement(wo,{count:s,index:n}),it.ZP.createElement(qt.ZP,{activeKey:t.id,name:"slideVertical",className:"EK6juGhJwhsLLm4Aag2F"},function(e,t,s){const{width:a,height:n}=(0,P.W7)(),i=t||e;return it.ZP.createElement("div",{className:"RFnmHP92f6CwfuR2Upaw"},e&&!s&&it.ZP.createElement("img",{className:"JfPOYkOcaMjS7Y5rsHZ4",src:i,width:a,height:n,alt:"",draggable:!1}),e&&it.ZP.createElement(ii.Z,{thumbDataUri:i,isVisible:Boolean(s),width:a,height:n}))}(f,I,v)),it.ZP.createElement("div",{className:(0,dt.Z)("bSvmca5kaTIUh3yJBxnF",f&&"FBCNFm307_rxATSHPSiN")},it.ZP.createElement("div",{className:"q9_FnsHlndM1hZqZjxjM",dir:"auto"},!o&&it.ZP.createElement(zn.Z,{text:`${p("PinnedMessage")} ${n>0?"#"+(s-n):""}`}),o&&(0,Hs.Z)(o)),it.ZP.createElement(qt.ZP,{activeKey:t.id,name:"slideVerticalFade",className:"ugsKEK4Xb166oFMP8hHy"},it.ZP.createElement("p",{dir:"auto",className:"WRuyhyQK6mv28Mz8iK28"},it.ZP.createElement(fo.Z,{lang:p,message:t,noEmoji:Boolean(f),emojiSize:Po})))),it.ZP.createElement(ea.Z,null),C&&it.ZP.createElement(Jt.Z,{size:"tiny",className:"kXRuktM2s7UN91zOl0Tx",onClick:M,shouldStopPropagation:!0,onMouseEnter:i.$b?void 0:R,onMouseLeave:i.$b?void 0:k},C.text)))})),So=(0,it.X$)((0,a.c$)(((e,t)=>{let{chatId:s,threadId:a,messageListType:n,isMobile:i}=t;const{isLeftColumnShown:o,shouldSkipHistoryAnimations:c,audioPlayer:d,messageLists:l}=(0,v.jUK)(e),u=(0,v.Z1J)(e,s),{chatId:m,messageId:h}=d,p=m&&h?(0,v.hjO)(e,m,h):void 0;let f;if("pinned"===n){const t=(0,v.KBA)(e,s,a);f=t?.length}else if("scheduled"===n){const t=(0,v.qyA)(e,s,a);f=t?.length}else if("thread"===n&&a!==r._f){const t=(0,v.tZg)(e,s,a);f=t?.messagesCount||0}const I="thread"===n&&a===r._f,w=u&&(0,v.xoo)(e,u),y=Boolean(w&&(0,v.s4q)(e,s)),b=w&&!y&&Boolean((0,v.pkN)(e,s)),P=Boolean(u&&(I||u.isForum)&&((0,g.eA)(u)||(0,g.ZV)(u))&&u.isNotJoined),Z=Boolean(u?.isNotJoined&&u.isJoinRequest),S={typingStatus:(0,v.WPz)(e,s,a,"typingStatus"),isLeftColumnShown:o,isRightColumnShown:(0,v.Jf5)(e,i),isSelectModeActive:(0,v.CAb)(e),audioMessage:p,chat:u,messagesCount:f,isChatWithSelf:(0,v.FM1)(e,s),shouldSkipHistoryAnimations:c,currentTransitionKey:Math.max(0,l.length-1),connectionState:e.connectionState,isSyncing:e.isSyncing,isSynced:e.isSynced,isFetchingDifference:e.isFetchingDifference,hasButtonInHeader:b||y||P||Z},C=(0,v.Zwk)(e,s);if("thread"!==n||!C)return S;if(a!==r._f&&!u?.isForum){const t=(0,v.qSq)(e,s,a),n=t?(0,v.hjO)(e,s,t):void 0,i=n?(0,v.cve)(e,n):void 0,o=(0,v.tZg)(e,s,a);return{...S,pinnedMessageIds:t,messagesById:C,canUnpin:!1,topMessageSender:i,isComments:Boolean(o?.originChannelId)}}const M=(0,v.KBA)(e,s,a);if(M?.length){const t=C[M[0]],{canUnpin:s}=t&&(0,v._kf)(e,t,a)||{};return{...S,pinnedMessageIds:M,messagesById:C,canUnpin:s}}return S}))((e=>{let{chatId:t,threadId:s,messageListType:i,isReady:o,isMobile:d,pinnedMessageIds:l,messagesById:u,canUnpin:m,topMessageSender:h,typingStatus:p,isSelectModeActive:f,isLeftColumnShown:I,isRightColumnShown:v,audioMessage:w,chat:y,messagesCount:b,isComments:P,isChatWithSelf:Z,hasButtonInHeader:S,shouldSkipHistoryAnimations:C,currentTransitionKey:M,connectionState:E,isSyncing:R,isSynced:k,isFetchingDifference:A,getCurrentPinnedIndexes:N,getLoadingPinnedId:B,onFocusPinnedMessage:x}=e;const{openChatWithInfo:L,pinMessage:U,focusMessage:O,openChat:j,openPreviousChat:_,loadPinnedMessages:F,toggleLeftColumn:D,exitMessageSelectMode:q,openPremiumModal:G}=(0,a.Sv)(),H=(0,$t.Z)(),V=(0,it.sO)(!0),{isTablet:$}=(0,T.ZP)(),J=(0,io.Z)(N)[`${t}_${s}`]||0,K=(0,io.Z)(B),z=Array.isArray(l)?l[J]:l,W=u&&z?u[z]:void 0,Y=Array.isArray(l)?l.length:l?1:void 0,X=y&&(0,g.U)(H,y).length,Q=h?(0,g.OU)(H,h):void 0,{settings:ee}=y||{},te=y?.isForum;(0,it.d4)((()=>{k&&o&&(s===r._f||te)&&F({chatId:t,threadId:s})}),[t,s,k,o,te]),(0,Qa.Z)(t,z,W);const{width:se}=(0,ma.Z)(),ae=se<=n.ksF,ne=$&&I,ie=(0,it.sO)(null),oe=(0,it.sO)(!0),{handleClick:re,handleMouseDown:ce}=(0,En.m)((e=>{"mousedown"===e.type&&e.target.closest(".title > .custom-emoji")||L({id:t,threadId:s})})),de=(0,wt.Z)((e=>{U({messageId:e,isUnpin:!0})})),le=(0,wt.Z)((e=>{const a=e.shiftKey&&Array.isArray(l)?l[(0,ha.Z)(l.length,l.indexOf(z)-2)]:z;x(a)&&O({chatId:t,threadId:s,messageId:a,noForumTopicPanel:!0})})),ue=(0,wt.Z)((()=>{j({id:t,threadId:s,type:"pinned"})})),me=(0,wt.Z)((()=>{setTimeout((()=>{V.current=!0}),450)})),he=(0,wt.Z)((()=>{G({fromUserId:t})})),pe=(0,wt.Z)((e=>{if(V.current){if(V.current=!1,d){const e=document.querySelector(n.Edp);e?.blur()}if(f)return q(),void me();if("thread"===i&&0===M)return!$||ne?(e.stopPropagation(),j({id:void 0},{forceOnHeavyAnimation:!0})):D(),void me();_(),me()}})),ge=se>=n.ksF&&se<n.jT7||se>n.l35&&se<n.ksF&&(!X||X>30),fe=ge||se>n._mX&&se<n.QU1,Ie=Boolean(ee?.canAddContact||ee?.canBlockContact||ee?.canReportSpam),{shouldRender:ve,transitionClassNames:we}=(0,Zt.Z)(Ie),ye=(0,no.Z)(Ie?ee:void 0,!0),{shouldRender:be,transitionClassNames:Pe}=(0,Zt.Z)(Boolean(w)),Ze=(0,no.Z)(w,!0),{shouldRender:Se,transitionClassNames:Ce}=(0,Zt.Z)(Boolean(W),void 0,!0),Me=(0,no.Z)(W,!0),Ee=(0,no.Z)(Y,!0),Re=(0,no.Z)(m,!0),ke=(0,no.Z)(Q),Te=(0,ua.Z)(M),Ae=void 0!==Te&&Te<M?Te:void 0,Ne=Se&&Me||be&&Ze;(0,it.bt)((()=>{const e=ie.current;if(e)return fe&&Ne?void(v||ge?(oe.current&&(e.classList.add("tools-stacked","animated"),oe.current=!1),setTimeout((()=>{(0,ct.WM)((()=>{e.classList.remove("animated")}))}),350)):(e.classList.remove("tools-stacked"),oe.current=!0)):(e.classList.remove("tools-stacked","animated"),void(oe.current=!0))}),[fe,Ne,ge,v]);const{connectionStatusText:Be}=rs(H,E,R||A,!0);function xe(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return it.ZP.createElement("div",{className:"back-button"},it.ZP.createElement(Jt.Z,{round:!0,size:"smaller",color:"translucent",onClick:pe,ariaLabel:H(e?"Close":"Back")},it.ZP.createElement("div",{className:(0,dt.Z)("animated-close-icon",!e&&"state-back")})),t&&it.ZP.createElement(Ut,null))}const Le=Boolean(be&&Ze),Ue=Le||!d&&S&&se<n.sgm;return(0,cs.Z)(ie),it.ZP.createElement("div",{className:"MiddleHeader",ref:ie},it.ZP.createElement(qt.ZP,{name:C?"none":"slideFade",activeKey:M,shouldCleanup:!0,cleanupExceptionKey:Ae},"thread"!==i||s!==r._f&&!y?.isForum?it.ZP.createElement(it.ZP.Fragment,null,xe(),it.ZP.createElement("h3",null,void 0!==b?"thread"===i?H(P?"CommentsCount":"Replies",b,"i"):"pinned"===i?H("PinnedMessagesCount",b,"i"):"scheduled"===i?Z?H("Reminders"):H("messages",b,"i"):void 0:H("Loading"))):it.ZP.createElement(it.ZP.Fragment,null,(ae||M>0)&&xe(ne,!0),it.ZP.createElement("div",{className:"chat-info-wrapper",onClick:re,onMouseDown:ce},(0,g.YC)(t)?it.ZP.createElement(co.Z,{key:t,userId:t,typingStatus:p,status:Be,withDots:Boolean(Be),withFullInfo:!0,withMediaViewer:!0,withStory:!Z,withUpdatingStatus:!0,storyViewerOrigin:c.ze.MiddleHeaderAvatar,emojiStatusSize:22,noRtl:!0,onEmojiStatusClick:he}):it.ZP.createElement(ro.Z,{key:t,chatId:t,threadId:s,typingStatus:p,status:Be,withDots:Boolean(Be),withMediaViewer:s===r._f,withFullInfo:s===r._f,withUpdatingStatus:!0,withStory:!0,storyViewerOrigin:c.ze.MiddleHeaderAvatar,noRtl:!0})))),s===r._f&&!y?.isForum&&it.ZP.createElement(oo.Z,{hasPinnedOffset:Se&&Boolean(Me)||be&&Boolean(Ze),chatId:t}),Se&&Me&&it.ZP.createElement(Zo,{key:t,message:Me,count:Ee||0,index:J,customTitle:ke,className:Ce,onUnpinMessage:Re?de:void 0,onClick:le,onAllPinnedClick:ue,isLoading:void 0!==K,isFullWidth:Ue}),ve&&it.ZP.createElement(mo,{key:t,chatId:t,settings:ye,className:we}),it.ZP.createElement("div",{className:"header-tools"},Le&&it.ZP.createElement(aa,{key:(0,g.Tp)(Ze),message:Ze,className:Pe}),it.ZP.createElement(ho.Z,{chatId:t,threadId:s,messageListType:i,isMobile:d,canExpandActions:!Le})))}))),Co=e=>{const{isActive:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"MobileSearch",!t,!0);return s?it.ZP.createElement(s,e):void 0},Mo=e=>{const{isOpen:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"ReactorListModal",!t);return s?it.ZP.createElement(s,e):void 0};function Eo(e){return"file"===e.kind&&e.type&&n.oGt.has(e.type)}const Ro=450+n.fK3,ko=(0,it.X$)((0,a.c$)(((e,t)=>{let{isMobile:s}=t;const a=(0,v.Puy)(e),{isBlurred:i,background:o,backgroundColor:c,patternColor:d}=e.settings.themes[a]||{},{messageLists:l,isLeftColumnShown:u,activeEmojiInteractions:m,seenByModal:h,giftPremiumModal:p,reactorModal:f,audioPlayer:I,shouldSkipHistoryAnimations:w,chatLanguageModal:y}=(0,v.jUK)(e),b=(0,v.Btg)(e),{leftColumnWidth:P}=e,Z={theme:a,customBackground:o,backgroundColor:c,patternColor:d,isLeftColumnShown:u,isRightColumnShown:(0,v.Jf5)(e,s),isBackgroundBlurred:i,hasCurrentTextSearch:Boolean((0,v.n5x)(e)),isSelectModeActive:(0,v.CAb)(e),isSeenByModalOpen:Boolean(h),isReactorListModalOpen:Boolean(f),isGiftPremiumModalOpen:p?.isOpen,isChatLanguageModalOpen:Boolean(y),withInterfaceAnimations:(0,v.FOo)(e),currentTransitionKey:Math.max(0,l.length-1),activeEmojiInteractions:m,leftColumnWidth:P};if(!b)return Z;const{chatId:S,threadId:C,type:M}=b,E=(0,g.YC)(S),R=(0,v.Z1J)(e,S),k=(0,v.kBx)(e,S),T=(0,v.KBA)(e,S,C),{chatId:A,messageId:N}=I,B=(0,v.tZg)(e,S,C),x=Boolean(B?.originChannelId),L=R&&(0,g.Qm)(R,C,x),U=(0,v.pkN)(e,S),O="pinned"===M,j="thread"===M&&C===r._f,_=Boolean(R&&(0,g.eA)(R)),F=Boolean(R&&j&&(_||(0,g.ZV)(R))&&R.isNotJoined&&!R.joinRequests),D=Boolean(R?.isNotJoined&&R.isJoinToSend),q=Boolean(R?.isNotJoined&&R.isJoinRequest),G=!!E&&(0,v.s4q)(e,S),H=Boolean(k&&G),V=!H&&U,$=G&&!k,J=Boolean(R&&(0,g.Bf)(R)&&!(0,v.x67)(e,R.id)),K=(0,v.Yyv)(e,S,C),z=!!R?.isForum&&C===r._f&&!K&&R.topics?.[n.OxA]?.isClosed,W=A&&N?(0,v.hjO)(e,A,N):void 0,Y=C!==r._f&&!R?.isForum,X=Y?(0,v.qSq)(e,S,C):void 0,Q=R&&(E||R?.isCreator||!_&&!(0,g.Mg)(R,"pinMessages")||(0,g.VE)(R,"pinMessages"));return{...Z,chatId:S,threadId:C,messageListType:M,chat:R,replyingToId:K,isPrivate:E,areChatSettingsLoaded:Boolean(R?.settings),canPost:!O&&(!R||L)&&!U&&!(D&&R?.isNotJoined)&&!z,isPinnedMessageList:O,currentUserBannedRights:R?.currentUserBannedRights,defaultBannedRights:R?.defaultBannedRights,hasPinned:Y||Boolean(!O&&T?.length),hasAudioPlayer:Boolean(W),hasButtonInHeader:V||H||F||q,pinnedMessagesCount:T?T.length:0,shouldSkipHistoryAnimations:w,isChannel:_,canSubscribe:F,canStartBot:V,canRestartBot:H,shouldJoinToSend:D,shouldSendJoinRequest:q,shouldLoadFullChat:J,pinnedIds:T,topMessageId:X,canUnpin:Q,canUnblock:$}}))((function(e){let{leftColumnRef:t,chatId:s,threadId:o,messageListType:r,isMobile:c,chat:d,replyingToId:l,isPrivate:m,isPinnedMessageList:h,canPost:p,currentUserBannedRights:f,defaultBannedRights:I,hasPinned:w,hasAudioPlayer:y,hasButtonInHeader:b,pinnedMessagesCount:R,customBackground:k,theme:A,backgroundColor:N,patternColor:B,isLeftColumnShown:x,isRightColumnShown:L,isBackgroundBlurred:U,leftColumnWidth:O,hasCurrentTextSearch:j,isSelectModeActive:_,isSeenByModalOpen:F,isReactorListModalOpen:D,isGiftPremiumModalOpen:q,isChatLanguageModalOpen:G,withInterfaceAnimations:H,shouldSkipHistoryAnimations:V,currentTransitionKey:$,isChannel:J,areChatSettingsLoaded:K,canSubscribe:z,canStartBot:W,canRestartBot:Y,activeEmojiInteractions:X,shouldJoinToSend:Q,shouldSendJoinRequest:ee,shouldLoadFullChat:te,pinnedIds:se,topMessageId:ae,canUnpin:ne,canUnblock:ie}=e;const{openChat:oe,openPreviousChat:re,unpinAllMessages:ce,loadUser:de,loadChatSettings:le,closeLocalTextSearch:ue,exitMessageSelectMode:me,joinChannel:he,sendBotCommand:pe,restartBot:ge,showNotification:fe,loadFullChat:Ie,setLeftColumnWidth:ve,resetLeftColumnWidth:we,unblockUser:ye}=(0,a.Sv)(),{width:be}=(0,ma.Z)(),{isTablet:Pe,isDesktop:Ze}=(0,T.ZP)(),Se=(0,$t.Z)(),[Ce,Me]=(0,it.eJ)(ba.t.None),[Ee,Re]=(0,it.eJ)(),[ke,Te]=(0,it.eJ)(),[Ae,Ne]=(0,it.eJ)(!1),{onIntersectionChanged:Be,onFocusPinnedMessage:xe,getCurrentPinnedIndexes:Le,getLoadingPinnedId:Ue,getForceNextPinnedInHeader:Oe}=function(e,t,s,n){const[i,o]=(0,ga.Z)({}),[r,c]=(0,ga.Z)(),d=(0,it.sO)(),[l,m]=(0,ga.Z)(),h=e?`${e}_${t}`:void 0;return(0,it.d4)((()=>{c(void 0),d.current=void 0,m(void 0)}),[e,o,c,m,t]),(0,it.d4)((()=>{if(!h)return;const e=i()[h],t=s?.length||0;e>=t&&o({...i(),[h]:Math.max(0,t-1)})}),[i,h,s?.length,o]),{onIntersectionChanged:(0,wt.Z)((n=>{let{viewportPinnedIdsToAdd:p=[],viewportPinnedIdsToRemove:g=[],isReversed:f,hasScrolled:I,isUnmount:w}=n;if(!e||!t||!h)return;const y=(0,a.Rd)();if(!s?.length||!s)return;const b=l();if(b&&!I){const e=s.indexOf(b);o({...i(),[h]:e}),m(void 0)}I&&(c(void 0),m(void 0));const P=r(),Z=d.current;if(w&&0===p.length&&1===g.length&&!Z?.includes(g[0]))return;const S=(0,u.Tw)((Z?.filter((e=>!g.includes(e)))||[]).concat(p));d.current=S;const C=(0,v.G$N)(y,e);if(!S.length&&w&&C&&!s.includes(C)){const e=s.find((e=>e<C));if(e){const t=s.indexOf(e);o({...i(),[h]:t})}}if(P||w)return;const M=Math.max(...S),E=s.findIndex((e=>e===M)),R=f?0:1,k=S.length?E:Z?.length?(0,pa.uZ)(s.indexOf(Z[0])+R,0,s.length-1):0;o({...i(),[h]:k})})),onFocusPinnedMessage:(0,wt.Z)((r=>{if(!e||!t||!h||l())return!1;const d=(0,a.Rd)();if(!s?.length)return n===r;const u=s.indexOf(r),p=(0,ha.Z)(s.length,u+1);c(!0);const g=(0,v.gbs)(d,e,t);return g?.includes(r)||(0,v.ofg)(d,e,t,r)?(o({...i(),[h]:p}),!0):(m(s[p]),!0)})),getCurrentPinnedIndexes:i,getLoadingPinnedId:l,getForceNextPinnedInHeader:r}}(s,o,se,ae),je=c&&j,_e=c?Ro:void 0,Fe=w&&(be<n.l35||y||L&&be>n._mX&&be<n.QU1||!c&&b&&be<n.sgm),De=(0,la.Z)(s,_e),qe=(0,la.Z)(o,_e),Ge=(0,la.Z)(r,_e),He=(0,la.Z)(z,_e),Ve=(0,la.Z)(W,_e),$e=(0,la.Z)(Y,_e),Je=(0,la.Z)(ie,_e),Ke=(0,la.Z)(p,_e)&&!$e&&!Ve&&!He&&!Je&&s!==n.mzl,ze=(0,la.Z)(Fe,_e),We=(0,la.Z)(Ee,_e)&&s!==n.mzl,Ye=(0,la.Z)(J,_e),Xe=(0,la.Z)(Q,_e),Qe=(0,la.Z)(ee,_e),et=(0,la.Z)(s?Be:void 0,_e),tt=(0,ua.Z)($),st=void 0!==tt&&tt<$?tt:void 0,{isReady:at,handleCssTransitionEnd:nt,handleSlideTransitionStop:ot}=function(e,t,s,a,n){const[i,o]=(0,it.eJ)(!n),r=(0,gt.Z)(),c=void 0!==s&&s!==t;return c&&(e?(o(!1),setTimeout((()=>{o(!0)}),Ro)):r()),(0,St.Z)((()=>{e||o(!0)}),[e]),{isReady:i&&!c,handleCssTransitionEnd:e?function(e){"transform"===e.propertyName&&e.target===e.currentTarget&&o(Boolean(a))}:void 0,handleSlideTransitionStop:e?function(){o(!0)}:void 0}}(!V&&H,$,tt,s,c);(0,it.d4)((()=>s?(0,Ot.Z)((()=>{oe({id:void 0})})):void 0),[s,oe]),(0,St.Z)((()=>{Me(ba.t.None),Te(void 0)}),[s]),(0,it.d4)((()=>{if(!i.cj&&!i.wZ)return;const{visualViewport:e}=window;if(!e)return;const t=()=>{const t=e.height!==document.documentElement.clientHeight;(0,ct.WM)((()=>{document.body.classList.toggle("keyboard-visible",t),(0,ct.i$)((()=>{!t&&e.offsetTop&&(0,ct.WM)((()=>{window.scrollTo({top:0})}))}))}))};return e.addEventListener("resize",t),()=>{e.removeEventListener("resize",t)}})),(0,it.d4)((()=>{m&&de({userId:s})}),[s,m,de]),(0,it.d4)((()=>{K||le({chatId:s})}),[s,m,K]),(0,it.d4)((()=>{s&&te&&at&&Ie({chatId:s})}),[te,s,at,Ie]);const{initResize:rt,resetResize:lt,handleMouseUp:ut}=function(e,t,s,a,n){const[i,o,r]=(0,ds.Z)(),[c,d]=(0,it.eJ)(0),[l,u]=(0,it.eJ)(0),m=(0,wt.Z)((t=>{(0,ct.WM)((()=>{if(!e.current)return;const s=t?`${t}px`:"";e.current.style.width=s,n&&e.current.style.setProperty(n,s)}))}));function h(){(0,ct.WM)((()=>{document.body.classList.remove("cursor-ew-resize")}))}return(0,it.bt)((()=>{e.current&&a&&m(a)}),[n,e,a,m]),(0,it.d4)((()=>{if(!i)return;const s=e=>{const t=Math.ceil(l+e.clientX-c);m(t)};function a(){n(),t(e.current.offsetWidth)}function n(){h(),document.removeEventListener("mousemove",s,!1),document.removeEventListener("mouseup",a,!1),document.removeEventListener("blur",a,!1),r()}return document.addEventListener("mousemove",s,!1),document.addEventListener("mouseup",a,!1),document.addEventListener("blur",a,!1),n}),[l,c,e,t,i,r,m]),{initResize:function(t){t.preventDefault(),(0,ct.WM)((()=>{document.body.classList.add("cursor-ew-resize")})),d(t.clientX),u(e.current.offsetWidth),o()},resetResize:function(e){e.preventDefault(),m(void 0),s()},handleMouseUp:h}}(t,(e=>ve({leftColumnWidth:e})),we,O,"--left-column-width"),mt=(0,wt.Z)((e=>{const{items:t}=e.dataTransfer||{},s=t&&t.length>0&&Array.from(t).filter((e=>"text/uri-list"!==e.type)).every(Eo);Me(s?ba.t.QuickFile:ba.t.Document)})),ht=(0,wt.Z)((()=>{Me(ba.t.None)})),pt=(0,wt.Z)((()=>{Ne(!0)})),ft=(0,wt.Z)((()=>{Ne(!1)})),It=(0,wt.Z)((()=>{ce({chatId:s,threadId:o}),ft(),re()})),vt=(0,wt.Z)((()=>{oe({id:s})})),yt=(0,wt.Z)((()=>{he({chatId:s}),Qe&&fe({message:Se(J?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")})})),bt=(0,wt.Z)((()=>{pe({command:"/start"})})),Pt=(0,wt.Z)((()=>{ge({chatId:s})})),Zt=(0,wt.Z)((()=>{ye({userId:s})})),Ct=((e,t)=>{const{setThemeSettings:s}=(0,a.Sv)(),[i,o]=(0,it.eJ)(t);return(0,it.d4)((()=>{t&&(t.startsWith("#")?o(t):ca.fetch(n.foQ,e,ca.Type.Blob).then((e=>{const t=URL.createObjectURL(e);(0,da.pt)(t).then((()=>{o(`url(${t})`)}))})).catch((()=>{s({theme:e,background:void 0,backgroundColor:void 0,isBlurred:!0,patternColor:"dark"===e?n.Vvx:n.ga_})})))}),[t,e]),t?i:void 0})(A,k),Mt=(0,dt.Z)(ze&&"has-header-tools",i.aZ?"mask-image-disabled":"mask-image-enabled"),Et=(0,dt.Z)("ON5E8MkEVA1mAlkuIxhG","OWFg9Wf1uioPWDz_IgS8",k&&"Ik9ZZlj3eKtKXRrUZKVk",N&&"avVozLQe3SaWcSkIt6pG",k&&U&&"Tipa66fYcSvl6w0587Xz",L&&"vhOr8s3T_LCKSt2BF7fs",i.D$&&!(De&&qe)&&"kIdhoMn_mbGnJc1YZpIK"),Rt=(0,dt.Z)("messaging-disabled",!_&&"shown"),kt=(0,g.q8)(Se,f,I),Tt=(0,g.mt)(Se,d,o,Boolean(l)),At=kt||Tt,{composerHiddenScale:Nt,toolbarHiddenScale:Bt,composerTranslateX:xt,toolbarTranslateX:Lt,unpinHiddenScale:Ut,toolbarForUnpinHiddenScale:jt}=(0,it.Ye)((()=>function(e,t){const s=e<=n.l35?P.Gw:2*P.Gw,a=function(e){if(e>n._mX){const t=Math.min(Math.max(.25*e,M),C),s=Math.min(.25*e,C);return Math.min(e-t-s,S)}if(e>n.ksF){const t=Math.min(Math.max(.4*e,M),C);return Math.min(e-t,S)}return e>S?S:e}(e),i=e<=n.l35?3.375*P.Gw:4*P.Gw,o=t?a-s-i:a-s,r=e>n.l35?Math.min(a-s,Z):a-s,c=r/o,d=o/r;return{composerHiddenScale:c,toolbarHiddenScale:d,composerTranslateX:t?i/2*d:0,toolbarTranslateX:t?i/2*-1*c:0,unpinHiddenScale:r/E,toolbarForUnpinHiddenScale:E/r}}(be,Ke)),[Ke,be]),_t=(0,dt.Z)("middle-column-footer",!Ke&&"no-composer",Ke&&ke&&!_&&"with-notch");(0,Qt.Z)({isActive:_,onBack:me}),(0,Qt.Z)({isActive:je,onBack:ue});const Ft=Boolean(!h&&!Ke&&!$e&&!Ve&&!He&&At),Dt=Boolean($e||He||Qe||Ve||h||Je),Gt=Boolean(Ft||_||h);return it.ZP.createElement("div",{id:"MiddleColumn",className:Mt,onTransitionEnd:nt,style:(0,ra.Z)(`--composer-hidden-scale: ${Nt}`,`--toolbar-hidden-scale: ${Bt}`,`--unpin-hidden-scale: ${Ut}`,`--toolbar-unpin-hidden-scale: ${jt},`,`--composer-translate-x: ${xt}px`,`--toolbar-translate-x: ${Lt}px`,`--pattern-color: ${B}`,N&&`--theme-background-color: ${N}`),onClick:Pe&&x?vt:void 0},Ze&&it.ZP.createElement("div",{className:"resize-handle",onMouseDown:rt,onMouseUp:ut,onDoubleClick:lt}),it.ZP.createElement("div",{className:Et,style:Ct?`--custom-background: ${Ct}`:void 0}),it.ZP.createElement("div",{id:"middle-column-portals"}),Boolean(De&&qe)&&it.ZP.createElement(it.ZP.Fragment,null,it.ZP.createElement("div",{className:"messages-layout",onDragEnter:Ke?mt:void 0},it.ZP.createElement(So,{chatId:De,threadId:qe,messageListType:Ge,isReady:at,isMobile:c,getCurrentPinnedIndexes:Le,getLoadingPinnedId:Ue,onFocusPinnedMessage:xe}),it.ZP.createElement(qt.ZP,{name:V?"none":H?"slide":"fade",activeKey:$,shouldCleanup:!0,cleanupExceptionKey:st,onStop:ot},it.ZP.createElement(so,{key:`${De}-${qe}-${Ge}`,chatId:De,threadId:qe,type:Ge,canPost:Ke,hasTools:ze,onFabToggle:Re,onNotchToggle:Te,isReady:at,withBottomShift:Dt,withDefaultBg:Boolean(!k&&!N),onPinnedIntersectionChange:et,getForceNextPinnedInHeader:Oe}),it.ZP.createElement("div",{className:_t},Ke&&it.ZP.createElement(fa.Z,{type:"messageList",chatId:De,threadId:qe,messageListType:Ge,dropAreaState:Ce,onDropHide:ht,isReady:at,isMobile:c,editableInputId:n.R2F,editableInputCssSelector:n.Edp,inputId:"message-input-text"}),h&&ne&&it.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Se.isRtl?"rtl":void 0},it.ZP.createElement(Jt.Z,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:pt},it.ZP.createElement("i",{className:"icon icon-unpin"}),it.ZP.createElement("span",null,Se("Chat.Pinned.UnpinAll",R,"i")))),Ft&&it.ZP.createElement("div",{className:Rt},it.ZP.createElement("div",{className:"messaging-disabled-inner"},it.ZP.createElement("span",null,At))),c&&(He||Xe&&!Qe)&&it.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Se.isRtl?"rtl":void 0},it.ZP.createElement(Jt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:yt},Se(Ye?"ProfileJoinChannel":"ProfileJoinGroup"))),c&&Qe&&it.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Se.isRtl?"rtl":void 0},it.ZP.createElement(Jt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:yt},Se("ChannelJoinRequest"))),c&&Ve&&it.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Se.isRtl?"rtl":void 0},it.ZP.createElement(Jt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:bt},Se("BotStart"))),c&&$e&&it.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Se.isRtl?"rtl":void 0},it.ZP.createElement(Jt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Pt},Se("BotRestart"))),c&&Je&&it.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Se.isRtl?"rtl":void 0},it.ZP.createElement(Jt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Zt},Se("Unblock"))),it.ZP.createElement(ao,{messageListType:Ge,isActive:_,canPost:Ke}),it.ZP.createElement(Ia,{isOpen:F}),it.ZP.createElement(Mo,{isOpen:D}),i.SX&&it.ZP.createElement(ya,{isOpen:G}))),it.ZP.createElement(Ma,{isShown:We,canPost:Ke,withExtraShift:Gt})),c&&it.ZP.createElement(Co,{isActive:Boolean(je)})),s&&it.ZP.createElement(va,{isOpen:Ae,chatId:s,pinnedMessagesCount:R,onClose:ft,onUnpin:It}),it.ZP.createElement("div",{teactFastList:!0},X?.map(((e,t)=>it.ZP.createElement(Pa,{teactOrderKey:t,key:e.id,activeEmojiInteraction:e})))),it.ZP.createElement(wa,{isOpen:q}))}))),To=e=>{const{bot:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"AttachBotInstallModal",!t);return s?it.ZP.createElement(s,e):void 0},Ao=e=>{const{info:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"BoostModal",!t);return s?it.ZP.createElement(s,e):void 0},No=e=>{const{info:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"ChatlistModal",!t);return s?it.ZP.createElement(s,e):void 0},Bo=e=>{const{geoPoint:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"MapModal",!t);return s?it.ZP.createElement(s,e):void 0},xo=e=>{const{urlAuth:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"UrlAuthModal",!t);return s?it.ZP.createElement(s,e):void 0},Lo=e=>{const{webApp:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"WebAppModal",!t);return s?it.ZP.createElement(s,e):void 0},Uo=e=>{const{isOpen:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"PaymentModal",!t);return s?it.ZP.createElement(s,e):void 0},Oo=e=>{const{isOpen:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"ReceiptModal",!t);return s?it.ZP.createElement(s,e):void 0};var jo=s(11820),_o=s(41151);const Fo=(0,it.X$)((0,a.c$)(((e,t)=>{let{chatId:s}=t;const a=(0,v.Z1J)(e,s),{userIds:n}=e.contactList||{},{byId:i}=e.chats,{newChatMembersProgress:o}=(0,v.jUK)(e),{currentUserId:r}=e,d=a&&(0,g.eA)(a),{query:l,fetchingStatus:u,globalUserIds:m,localUserIds:h}=(0,v.jUK)(e).userSearch;return{isChannel:d,members:(0,v.x67)(e,s)?.members,currentUserId:r,chatsById:i,localContactIds:n,searchQuery:l,isSearching:u,isLoading:o===c.WB.Loading,globalUserIds:m,localUserIds:h}}))((e=>{let{isChannel:t,members:s,onNextStep:n,currentUserId:i,chatsById:o,localContactIds:r,isLoading:c,searchQuery:d,isSearching:l,localUserIds:m,globalUserIds:h,onClose:p,isActive:f}=e;const{setUserSearchQuery:I}=(0,a.Sv)(),v=(0,$t.Z)(),[w,y]=(0,it.eJ)([]),b=(0,ua.Z)(w)===w;(0,Qt.Z)({isActive:f,onBack:p});const P=(0,it.Ye)((()=>s?s.map((e=>e.userId)):[]),[s]),Z=(0,it.I4)((e=>{I({query:e})}),[I]),S=(0,it.Ye)((()=>{const e=(0,a.Rd)().users.byId,s=r?(0,g.kK)(r,e,d):[];return(0,g.ih)((0,u.Tw)([...s,...m||[],...h||[]]).filter((s=>{const a=e[s];return!P.includes(s)&&s!==i&&(!a||!(0,g.cS)(a)||!t&&a.canBeInvitedToGroup)})),o)}),[r,o,d,m,h,i,P,t]),C=(0,it.I4)((()=>{w.length&&(I({query:""}),n(w))}),[w,I,n]);return it.ZP.createElement("div",{className:"AddChatMembers"},it.ZP.createElement("div",{className:"AddChatMembers-inner"},it.ZP.createElement(jo.Z,{itemIds:S,selectedIds:w,filterValue:d,filterPlaceholder:v("lng_channel_add_users"),searchInputId:"new-members-picker-search",isLoading:l,onSelectedIdsChange:y,onFilterChange:Z,isSearchable:!0,noScrollRestore:b}),it.ZP.createElement(_o.Z,{isShown:Boolean(w.length),disabled:c,ariaLabel:v("lng_channel_add_users"),onClick:C},c?it.ZP.createElement(fs.Z,{color:"white"}):it.ZP.createElement("i",{className:"icon icon-arrow-right"}))))}))),Do=e=>{const t=(0,Mt.Z)(mt.gl.Extra,"CreateTopic");return t?it.ZP.createElement(t,e):it.ZP.createElement(Gt.Z,null)},qo=e=>{const t=(0,Mt.Z)(mt.gl.Extra,"EditTopic");return t?it.ZP.createElement(t,e):it.ZP.createElement(Gt.Z,null)},Go=()=>{const e=(0,Mt.Z)(mt.gl.Extra,"GifSearch");return e?it.ZP.createElement(e,null):it.ZP.createElement(Gt.Z,null)},Ho=e=>{const t=(0,Mt.Z)(mt.gl.Extra,"Management");return t?it.ZP.createElement(t,e):it.ZP.createElement(Gt.Z,null)},Vo=()=>{const e=(0,Mt.Z)(mt.gl.Extra,"PollResults");return e?it.ZP.createElement(e,null):it.ZP.createElement(Gt.Z,null)};var $o=s(91),Jo=s(13995);const Ko=(0,h.P2)((e=>e()),250,!1);let zo=!1;var Wo=s(27407);function Yo(e,t){const[s,a]=(0,Wo.Z)(e,t,void 0,n.Vk);return[s,a,!(!s||!t||s[0]===t[0])]}function Xo(e,t,s,a,i,o){const r=(0,it.sO)();(0,St.Z)((()=>{r.current=void 0}),[o]),(0,St.Z)((()=>{t===e&&a&&i&&(r.current=(0,g.R5)(a,i,e))}),[a,i,t,e]);const[c,d]=(0,Wo.Z)(s,r.current,void 0,"media"===e?n.ENB:n.pnA);return[c,d,!(!c||!r.current||c[0]===r.current[0])]}var Qo=s(70180),er=s(13709),tr=s(47262),sr=s(16568),ar=s(45418),nr=s(12644),ir=s(42175);const or=(0,it.X$)((function(e){let{story:t,isProtected:s,isArchive:n}=e;const{openStoryViewer:i,loadPeerSkippedStories:o,toggleStoryPinned:r,showNotification:c}=(0,a.Sv)(),d=(0,$t.Z)(),l=(0,it.sO)(null),u=(0,wt.Z)((()=>l.current)),m=(0,wt.Z)((()=>document.body)),h=(0,wt.Z)((()=>document.querySelector("#portals .story-context-menu .bubble"))),p=(0,wt.Z)((()=>({withPortal:!0,isDense:!0}))),f=t&&t.peerId,I=t&&"content"in t,v=I&&t.isOut,w=t&&"isDeleted"in t,y=I?t.content.video:void 0,b=I?(0,g.Cc)(t):void 0,P=(0,zs.Z)(b)||y?.thumbnail?.dataUri;(0,it.d4)((()=>{!t||I||w||o({peerId:t.peerId})}),[w,I,t]);const{isContextMenuOpen:Z,contextMenuPosition:S,handleBeforeContextMenu:C,handleContextMenu:M,handleContextMenuClose:E,handleContextMenuHide:R}=(0,$s.Z)(l,!v),{positionX:k,positionY:T,transformOriginX:A,transformOriginY:N,style:B}=(0,nr.Z)(S,u,m,h,p),x=(0,it.I4)((()=>{i({peerId:t.peerId,storyId:t.id,isSinglePeer:!0,isPrivate:!0,isArchive:n})}),[n,t.id,t.peerId]),L=(0,wt.Z)((e=>{(0,Ta.b)(e),C(e)})),U=(0,wt.Z)((e=>{(0,gn.Z)(e),r({peerId:f,storyId:t.id,isPinned:!0}),c({message:d("Story.ToastSavedToProfileText")}),E()})),O=(0,wt.Z)((e=>{(0,gn.Z)(e),r({peerId:f,storyId:t.id,isPinned:!1}),c({message:d("Story.ToastRemovedFromProfileText")}),E()}));return it.ZP.createElement("div",{ref:l,className:(0,dt.Z)("ox1yTGx4NBVANs7q4Ste","scroll-item"),onMouseDown:L,onClick:x,onContextMenu:M},w&&it.ZP.createElement("span",null,it.ZP.createElement("i",{className:(0,dt.Z)("eg5740UDe7iAc7dGlyex","icon icon-story-expired"),"aria-hidden":!0}),d("ExpiredStory")),it.ZP.createElement("div",{className:"g34egFNlUSZiOR5Y9K9A"},P&&it.ZP.createElement("img",{src:P,alt:"",className:"gyVqf8gGVz_cu2HCjifT",draggable:!1}),I&&it.ZP.createElement(ir.Z,{story:t}),s&&it.ZP.createElement("span",{className:"protector"})),void 0!==S&&it.ZP.createElement(Kt.Z,{isOpen:Z,transformOriginX:A,transformOriginY:N,positionX:k,positionY:T,style:B,className:(0,dt.Z)("rhvyma7da0HVZh3rYFnr","story-context-menu"),autoClose:!0,onClose:E,onCloseAnimationEnd:R,withPortal:!0},n&&it.ZP.createElement(zt.Z,{icon:"pin",onClick:U},d("StoryList.SaveToProfile")),!n&&it.ZP.createElement(zt.Z,{icon:"unpin",onClick:O},d("Story.Context.RemoveFromProfile"))))}));var rr=s(21273),cr=s(31876),dr=s(22275);const lr=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"}],ur=(0,it.X$)((0,a.c$)(((e,t)=>{let{chatId:s,topicId:a,isMobile:n}=t;const i=(0,v.Z1J)(e,s),o=(0,v.x67)(e,s),r=(0,v.Zwk)(e,s),{currentType:c,resultsByType:d}=(0,v.weG)(e)||{},{foundIds:l}=d&&c&&d[c]||{},{byId:u,statusesById:m}=e.users,{byId:h}=e.chats,p=i&&(0,g.Bf)(i),f=i&&(0,g.eA)(i),I=!a&&(p||f&&(0,g.Nl)(i)),w=o?.members,y=o?.adminMembersById,b=I&&i&&(i.isForbidden||o&&!o.canViewMembers),P=I&&i&&((0,g.VE)(i,"inviteUsers")||!(0,g.Mg)(i,"inviteUsers")||i.isCreator),Z=I&&i&&((0,g.VE)(i,"banUsers")||i.isCreator),S=(0,v.f21)(e,s);let C,M,E;(0,g.YC)(s)&&(M=s,E=(0,v.dyD)(e,M),C=E&&!E.isSelf&&!(0,g.cS)(E));const R=E||i,k=(0,v.mZI)(e,s),T=R&&(E?.isSelf||!R.areStoriesHidden&&k?.hasPinnedStories),A=T?(0,v.nST)(e,R.id):void 0,N=A?.pinnedIds,B=A?.byId,x=A?.archiveIds;return{theme:(0,v.Puy)(e),isChannel:f,resolvedUserId:M,messagesById:r,foundIds:l,mediaSearchType:c,hasCommonChatsTab:C,hasStoriesTab:T,hasMembersTab:I,areMembersHidden:b,canAddMembers:P,canDeleteMembers:Z,currentUserId:e.currentUserId,isRightColumnShown:(0,v.Jf5)(e,n),isRestricted:i?.isRestricted,activeDownloadIds:S?.ids,usersById:u,userStatusesById:m,chatsById:h,storyIds:N,archiveStoryIds:x,storyByIds:B,isChatProtected:i?.isProtected,nextProfileTab:(0,v.jUK)(e).nextProfileTab,shouldWarnAboutSvg:e.settings.byKey.shouldWarnAboutSvg,...I&&w&&{members:w,adminMembersById:y},...C&&E&&{commonChatIds:E.commonChats?.ids}}}))((e=>{let{chatId:t,topicId:s,profileState:o,onProfileStateChange:d,theme:l,isChannel:u,resolvedUserId:m,currentUserId:h,messagesById:p,foundIds:f,storyIds:I,archiveStoryIds:v,storyByIds:w,mediaSearchType:y,hasCommonChatsTab:b,hasStoriesTab:P,hasMembersTab:Z,areMembersHidden:S,canAddMembers:C,canDeleteMembers:M,commonChatIds:E,members:R,adminMembersById:k,usersById:T,userStatusesById:A,chatsById:N,isRightColumnShown:B,isRestricted:x,activeDownloadIds:L,isChatProtected:U,nextProfileTab:O,shouldWarnAboutSvg:j}=e;const{setLocalMediaSearchType:_,loadMoreMembers:F,loadCommonChats:D,openChat:q,searchMediaMessagesLocal:G,openMediaViewer:H,openAudioPlayer:V,focusMessage:$,loadProfilePhotos:J,setNewChatMembersDialogState:K,loadPeerPinnedStories:z,loadStoriesArchive:W}=(0,a.Sv)(),Y=(0,it.sO)(null),X=(0,it.sO)(null),Q=(0,$t.Z)(),[ee,te]=(0,it.eJ)(),se=(0,it.Ye)((()=>[...P?[{type:"stories",title:"ProfileStories"}]:[],...P&&h===t?[{type:"storiesArchive",title:"ProfileStoriesArchive"}]:[],...Z?[{type:"members",title:u?"ChannelSubscribers":"GroupMembers"}]:[],...lr,...s?[]:[{type:"voice",title:"SharedVoiceTab2"}],...b?[{type:"commonChats",title:"SharedGroupsTab2"}]:[]]),[t,h,b,Z,P,u,s]),ae=(0,it.Ye)((()=>{if(!O)return 0;const e=se.findIndex((e=>{let{type:t}=e;return t===O}));return-1===e?0:e}),[O,se]),[ne,ie]=(0,it.eJ)(ae);(0,it.d4)((()=>{if(!O)return;const e=se.findIndex((e=>{let{type:t}=e;return t===O}));-1!==e&&ie(e)}),[O,se]);const oe=ne>se.length-1?se.length-1:ne,re=se[oe].type,ce=(0,it.I4)((e=>{let{offsetId:s}=e;z({peerId:t,offsetId:s})}),[t]),de=(0,it.I4)((e=>{let{offsetId:t}=e;W({peerId:h,offsetId:t})}),[h]),[le,ue,me,he]=function(e,t,s,a,n,i,o,r,c,d,l,u,m,h,p,f,I){const v="members"!==i&&o?o:i,w=(0,it.Ye)((()=>{if(r&&d&&l)return(0,g.Z0)(r.map((e=>{let{userId:t}=e;return t})),d,l)}),[r,d,l]),y=(0,it.Ye)((()=>{if(c&&u)return(0,g.ih)(c,u,!0)}),[u,c]),[b,P,Z]=Yo(e,w),[S,C,M]=Xo("media",v,s,m,h,p),[E,R,k]=Xo("documents",v,s,m,h,p),[T,A,N]=Xo("links",v,s,m,h,p),[B,x,L]=Xo("audio",v,s,m,h,p),[U,O,j]=Xo("voice",v,s,m,h,p),[_,F,D]=Yo(t,y),[q,G,H]=Yo(a,f),[V,$,J]=Yo(n,I);let K,z,W=!1;switch(v){case"members":K=b,z=P,W=Z;break;case"commonChats":K=_,z=F,W=D;break;case"media":K=S,z=C,W=M;break;case"documents":K=E,z=R,W=k;break;case"links":K=T,z=A,W=N;break;case"audio":K=B,z=x,W=L;break;case"voice":K=U,z=O,W=j;break;case"stories":K=q,z=G,W=H;break;case"storiesArchive":K=V,z=$,W=J}return[v,K,z,W]}(F,D,G,ce,de,re,y,R,E,T,A,N,p,f,s,I,v),pe=P&&"stories"===le||"members"===le||!Z&&"media"===le,ge=se.findIndex((e=>{let{type:t}=e;return t===le}));(0,Jo.Z)("members"===le?ue:void 0);const{handleScroll:fe}=function(e,t,s,a){(0,Ss.Z)((s=>{let[n]=s;if(n&&n!==t){const s=e.current,n=s.querySelector(".TabList");s.scrollTop<n.offsetTop&&(a("members"===t?c.vi.MemberList:"stories"===t?c.vi.StoryList:c.vi.SharedMedia),zo=!0,(0,Za.ZP)(s,n,"start",void 0,void 0,void 0,300),setTimeout((()=>{zo=!1}),350))}}),[t,a,e]),(0,Ss.Z)((t=>{let[n]=t;if(s!==c.vi.Profile||s===n)return;const i=e.current;if(!i)return;const o=i.querySelector(".TabList");!o||o.offsetTop>i.scrollTop||(zo=!0,(0,Za.ZP)(i,i.firstElementChild,"start",void 0,2*i.offsetHeight),setTimeout((()=>{zo=!1}),350),a(s))}),[s,e,a]);const n=(0,wt.Z)((()=>{const s=e.current;if(!s)return;const n=s.querySelector(".TabList");if(!n)return;let i=c.vi.Profile;s.scrollTop>=n.offsetTop&&(i="members"===t?c.vi.MemberList:"stories"===t?c.vi.StoryList:c.vi.SharedMedia),a(i)}));return(0,it.d4)((()=>{zo||n()}),[n,t]),{handleScroll:(0,wt.Z)((()=>{zo||Ko(n)}))}}(Y,le,o,d),{applyTransitionFix:Ie,releaseTransitionFix:ve}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".Transition.shared-media-transition";return(0,it.d4)((()=>{function s(){const s=e.current,a=s.querySelector(t),n=s.querySelector(".TabList");if(a&&n){const e=s.offsetHeight-n.offsetHeight;(0,ct.WM)((()=>{a.style.minHeight=`${e}px`}))}}return s(),window.addEventListener("resize",s,!1),()=>{window.removeEventListener("resize",s,!1)}}),[e,t]),{applyTransitionFix:(0,wt.Z)((()=>{(0,ct.i$)((()=>{const t=e.current;if("hidden"===t.style.overflowY)return;const s=t.offsetWidth-t.clientWidth;(0,ct.WM)((()=>{t.style.overflowY="hidden",t.style.paddingRight=`${s}px`}))}))})),releaseTransitionFix:(0,wt.Z)((()=>{const t=e.current;t.style.overflowY="scroll",t.style.paddingRight="0"}))}}(Y),[we,ye]=(()=>{const[e,t]=(0,it.eJ)(0);return[e,(0,it.I4)((()=>{t((e=>e+1))}),[])]})(),{observe:be}=(0,Da.S1)({rootRef:Y,throttleMs:500}),Pe=(0,wt.Z)((()=>{ve(),ye()})),Ze=(0,wt.Z)((()=>{K({newChatMembersProgress:c.WB.InProgress})}));(0,it.d4)((()=>{_({mediaType:re})}),[_,re,s]);const Se=m||t;(0,it.d4)((()=>{J({profileId:Se})}),[Se]);const Ce=(0,wt.Z)((e=>{H({chatId:Se,threadId:r._f,mediaId:e,origin:c.bZ.SharedMedia})})),Me=(0,wt.Z)((e=>{V({chatId:Se,messageId:e})})),Ee=(0,wt.Z)((e=>{q({id:e})})),Re=(0,wt.Z)((e=>{$({chatId:Se,messageId:e})})),ke=(0,wt.Z)((()=>{te(void 0)}));let Te;(0,Ss.Z)((e=>{let[t]=e;if(void 0===t||0===ne||t===Z)return;const s=ne+(Z?1:-1);ie(Math.min(s,se.length-1))}),[Z,ne,se]),(0,it.d4)((()=>{if(X.current&&i.$b)return(0,Xt.sf)(X.current,{selectorToPreventScroll:".Profile",onSwipe:(e,t)=>t===Xt.eM.Left?(ie(Math.min(oe+1,se.length-1)),!0):t===Xt.eM.Right&&(ie(Math.max(0,oe-1)),!0)})}),[oe,se.length]),pe?Te=B?0:1e3:ue||(Te=n.Yan);const Ae=(0,go.Z)([t,s,le,oe],Te);return it.ZP.createElement(rr.Z,{ref:Y,className:"Profile custom-scroll",itemSelector:`.shared-media-transition > .Transition_slide-active.${le}-list > .scroll-item`,items:Ae?ue:void 0,cacheBuster:we,sensitiveArea:n.qUX,preloadBackwards:Ae?"members"===le?n.Vk:n.ENB:0,noScrollRestoreOnTop:!0,noFastList:!0,onLoadMore:me,onScroll:fe},!he&&function(e,t,s){return it.ZP.createElement("div",{className:"profile-info"},it.ZP.createElement(sr.Z,{userId:t||e,canPlayVideo:s}),it.ZP.createElement(Qo.Z,{chatOrUserId:t||e}))}(t,m,B&&Ae),!x&&it.ZP.createElement("div",{className:"shared-media"},it.ZP.createElement(qt.ZP,{ref:X,name:Q.isRtl?"slideOptimizedRtl":"slideOptimized",activeKey:ge,renderCount:se.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:Ie,onStop:Pe},function(){if(!ue||!Ae||!p){const e=pe&&!Ae,t=Boolean("members"===le&&S);return it.ZP.createElement("div",{className:"content empty-list"},!e&&!t&&it.ZP.createElement(fs.Z,null),t&&it.ZP.createElement(tr.Z,{text:"You have no access to group members list."}))}if(!ue.length){let e;switch(le){case"members":e=S?"You have no access to group members list.":"No members found";break;case"commonChats":e=Q("NoGroupsInCommon");break;case"documents":e=Q("lng_media_file_empty");break;case"links":e=Q("lng_media_link_empty");break;case"audio":e=Q("lng_media_song_empty");break;case"voice":e=Q("lng_media_audio_empty");break;case"stories":e=Q("StoryList.SavedEmptyState.Title");break;case"storiesArchive":e=Q("StoryList.ArchivedEmptyState.Title");break;default:e=Q("SharedMedia.EmptyTitle")}return it.ZP.createElement("div",{className:"content empty-list"},it.ZP.createElement(tr.Z,{text:e}))}return it.ZP.createElement("div",{className:`content ${le}-list`,dir:Q.isRtl&&"media"===le?"rtl":void 0,teactFastList:!0},"media"===le?ue.map((e=>p[e]&&it.ZP.createElement(er.Z,{key:e,message:p[e],isProtected:U||p[e].isProtected,observeIntersection:be,onClick:Ce}))):"stories"===le||"storiesArchive"===le?ue.map((e=>w?.[e]&&it.ZP.createElement(or,{key:`${le}_${e}`,story:w[e],isProtected:U,isArchive:"storiesArchive"===le}))):"documents"===le?ue.map((e=>p[e]&&it.ZP.createElement(Sn.Z,{key:e,message:p[e],withDate:!0,smaller:!0,className:"scroll-item",isDownloading:L?.includes(e),observeIntersection:be,onDateClick:Re,shouldWarnAboutSvg:j}))):"links"===le?ue.map((e=>p[e]&&it.ZP.createElement(ar.Z,{key:e,message:p[e],isProtected:U||p[e].isProtected,observeIntersection:be,onMessageClick:Re}))):"audio"===le?ue.map((e=>p[e]&&it.ZP.createElement(Pn.ZP,{key:e,theme:l,message:p[e],origin:c.Cr.SharedMedia,date:p[e].date,className:"scroll-item",onPlay:Me,onDateClick:Re,canDownload:!U&&!p[e].isProtected,isDownloading:L?.includes(e)}))):"voice"===le?ue.map((e=>p[e]&&it.ZP.createElement(Pn.ZP,{key:e,theme:l,message:p[e],senderTitle:(0,$o.F)(Q,p[e],N,T),origin:c.Cr.SharedMedia,date:p[e].date,className:"scroll-item",onPlay:Me,onDateClick:Re,canDownload:!U&&!p[e].isProtected,isDownloading:L?.includes(e)}))):"members"===le?ue.map(((e,t)=>{return it.ZP.createElement(cr.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable contact-list-item scroll-item small-icon",onClick:()=>Ee(e),contextActions:(s=e,s!==h&&M?[{title:Q("lng_context_remove_from_group"),icon:"stop",handler:()=>{te(s)}}]:void 0)},it.ZP.createElement(co.Z,{userId:e,adminMember:k?.[e],forceShowSelf:!0,withStory:!0}));var s})):"commonChats"===le?ue.map(((e,t)=>it.ZP.createElement(cr.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>q({id:e})},it.ZP.createElement(ro.Z,{chatId:e})))):void 0)}()),it.ZP.createElement(ts.Z,{big:!0,activeTab:oe,tabs:se,onSwitchTab:ie})),C&&it.ZP.createElement(_o.Z,{isShown:"members"===le,onClick:Ze,ariaLabel:Q("lng_channel_add_users")},it.ZP.createElement("i",{className:"icon icon-add-user-filled"})),M&&it.ZP.createElement(dr.Z,{isOpen:Boolean(ee),userId:ee,onClose:ke}))}))),mr=450+n.fK3,hr=(0,h.Ds)((e=>e()),200,!1);var pr=function(e){return e[e.Profile=0]="Profile",e[e.MemberList=1]="MemberList",e[e.SharedMedia=2]="SharedMedia",e[e.StoryList=3]="StoryList",e[e.Search=4]="Search",e[e.Statistics=5]="Statistics",e[e.MessageStatistics=6]="MessageStatistics",e[e.BoostStatistics=7]="BoostStatistics",e[e.Management=8]="Management",e[e.ManageInitial=9]="ManageInitial",e[e.ManageChannelSubscribers=10]="ManageChannelSubscribers",e[e.ManageChatAdministrators=11]="ManageChatAdministrators",e[e.ManageChatPrivacyType=12]="ManageChatPrivacyType",e[e.ManageDiscussion=13]="ManageDiscussion",e[e.ManageGroupPermissions=14]="ManageGroupPermissions",e[e.ManageGroupRemovedUsers=15]="ManageGroupRemovedUsers",e[e.ManageChannelRemovedUsers=16]="ManageChannelRemovedUsers",e[e.ManageGroupUserPermissionsCreate=17]="ManageGroupUserPermissionsCreate",e[e.ManageGroupUserPermissions=18]="ManageGroupUserPermissions",e[e.ManageGroupRecentActions=19]="ManageGroupRecentActions",e[e.ManageGroupAdminRights=20]="ManageGroupAdminRights",e[e.ManageGroupNewAdminRights=21]="ManageGroupNewAdminRights",e[e.ManageGroupMembers=22]="ManageGroupMembers",e[e.ManageGroupAddAdmins=23]="ManageGroupAddAdmins",e[e.StickerSearch=24]="StickerSearch",e[e.GifSearch=25]="GifSearch",e[e.PollResults=26]="PollResults",e[e.AddingMembers=27]="AddingMembers",e[e.ManageInvites=28]="ManageInvites",e[e.ManageEditInvite=29]="ManageEditInvite",e[e.ManageReactions=30]="ManageReactions",e[e.ManageInviteInfo=31]="ManageInviteInfo",e[e.ManageJoinRequests=32]="ManageJoinRequests",e[e.CreateTopic=33]="CreateTopic",e[e.EditTopic=34]="EditTopic",e}(pr||{});const gr=(0,a.c$)(((e,t)=>{let{chatId:s,isProfile:a,isManagement:n,threadId:i}=t;const o=(0,v.jUK)(e),{query:c}=(0,v.n5x)(e)||{},{query:d}=(0,v.y5E)(e)||{},{query:l}=(0,v.yNS)(e)||{},u=s?(0,v.Z1J)(e,s):void 0,m=a&&s&&(0,g.YC)(s)?(0,v.dyD)(e,s):void 0,h=u&&(0,g.eA)(u),p=u?.isForum&&Boolean(i&&i!==r._f),f=p?u.topics?.[i]:void 0,I=p&&f&&(0,g.GU)(u,f),w=m&&(0,g.cS)(m),y=m&&(0,g.kw)(m),b=Boolean(!n&&a&&s&&(0,v.Yo)(e,s)),P=Boolean(s&&o.management.byChatId[s]?.editingInvite),Z=!p&&s?(0,v.x67)(e,s)?.canViewStatistics:void 0,S=s?o.management.byChatId[s]?.inviteInfo?.invite:void 0;return{canManage:b,canAddContact:y,canViewStatistics:Z,isChannel:h,isBot:w,isInsideTopic:p,canEditTopic:I,userId:m?.id,isSelf:m?.isSelf,messageSearchQuery:c,stickerSearchQuery:d,gifSearchQuery:l,isEditingInvite:P,currentInviteInfo:S,shouldSkipHistoryAnimations:o.shouldSkipHistoryAnimations}}))((e=>{let{chatId:t,threadId:s,isColumnOpen:n,isProfile:i,isSearch:o,isManagement:r,isStatistics:d,isMessageStatistics:l,isBoostStatistics:u,isStickerSearch:m,isGifSearch:h,isPollResults:p,isCreatingTopic:g,isEditingTopic:f,isAddingChatMembers:I,profileState:v,managementScreen:w,canAddContact:y,userId:b,isSelf:P,canManage:Z,isChannel:S,messageSearchQuery:C,stickerSearchQuery:M,gifSearchQuery:E,isEditingInvite:R,canViewStatistics:k,currentInviteInfo:A,shouldSkipHistoryAnimations:N,isBot:B,isInsideTopic:x,canEditTopic:L,onClose:U,onScreenSelect:O}=e;const{setLocalTextSearchQuery:j,setStickerSearchQuery:_,setGifSearchQuery:F,searchTextMessagesLocal:D,toggleManagement:q,openHistoryCalendar:G,openAddContactDialog:H,toggleStatistics:V,setEditingExportedInvite:$,deleteExportedChatInvite:J,openEditTopicPanel:K}=(0,a.Sv)(),[z,W,Y]=(0,ds.Z)(),{isMobile:X}=(0,T.ZP)(),Q=(0,wt.Z)((()=>{$({chatId:t,invite:A}),O(c.u1.EditInvite)})),ee=(0,wt.Z)((()=>{J({chatId:t,link:A.link}),O(c.u1.Invites),Y()})),te=(0,wt.Z)((e=>{j({query:e}),e.length&&hr(D)})),se=(0,wt.Z)((e=>{_({query:e})})),ne=(0,wt.Z)((e=>{F({query:e})})),ie=(0,wt.Z)((()=>{H({userId:b})})),oe=(0,wt.Z)((()=>{t&&s&&K({chatId:t,topicId:s})})),re=(0,wt.Z)((()=>{q()})),ce=(0,wt.Z)((()=>{V()})),[de,le]=(0,it.eJ)(!n);(0,it.d4)((()=>{setTimeout((()=>{le(!n)}),mr)}),[n]);const ue=(0,$t.Z)(),me=i?v===c.vi.Profile?pr.Profile:v===c.vi.SharedMedia?pr.SharedMedia:v===c.vi.MemberList?pr.MemberList:v===c.vi.StoryList?pr.StoryList:-1:o?pr.Search:p?pr.PollResults:m?pr.StickerSearch:h?pr.GifSearch:I?pr.AddingMembers:r?w===c.u1.Initial?pr.ManageInitial:w===c.u1.ChatPrivacyType?pr.ManageChatPrivacyType:w===c.u1.Discussion?pr.ManageDiscussion:w===c.u1.ChannelSubscribers?pr.ManageChannelSubscribers:w===c.u1.GroupPermissions?pr.ManageGroupPermissions:w===c.u1.ChatAdministrators?pr.ManageChatAdministrators:w===c.u1.GroupRemovedUsers?pr.ManageGroupRemovedUsers:w===c.u1.ChannelRemovedUsers?pr.ManageChannelRemovedUsers:w===c.u1.GroupUserPermissionsCreate?pr.ManageGroupUserPermissionsCreate:w===c.u1.GroupUserPermissions?pr.ManageGroupUserPermissions:w===c.u1.GroupRecentActions?pr.ManageGroupRecentActions:w===c.u1.ChatAdminRights?pr.ManageGroupAdminRights:w===c.u1.ChatNewAdminRights?pr.ManageGroupNewAdminRights:w===c.u1.GroupMembers?pr.ManageGroupMembers:w===c.u1.Invites?pr.ManageInvites:w===c.u1.EditInvite?pr.ManageEditInvite:w===c.u1.GroupAddAdmins?pr.ManageGroupAddAdmins:w===c.u1.Reactions?pr.ManageReactions:w===c.u1.InviteInfo?pr.ManageInviteInfo:w===c.u1.JoinRequests?pr.ManageJoinRequests:void 0:d?pr.Statistics:l?pr.MessageStatistics:u?pr.BoostStatistics:g?pr.CreateTopic:f?pr.EditTopic:void 0,he=(0,no.Z)(me,!0)??-1,pe=X||me===pr.SharedMedia||me===pr.MemberList||me===pr.StoryList||me===pr.AddingMembers||me===pr.MessageStatistics||r,ge=(0,dt.Z)("animated-close-icon",pe&&"state-back",(de||N)&&"no-transition"),fe=(0,it.sO)(null);return(0,cs.Z)(fe),it.ZP.createElement("div",{className:"RightHeader",ref:fe},it.ZP.createElement(Jt.Z,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:U,ariaLabel:ue(pe?"Common.Back":"Common.Close")},it.ZP.createElement("div",{className:ge})),it.ZP.createElement(qt.ZP,{name:de||N?"none":"slideFade",activeKey:he},function(){if(-1!==he)switch(he){case pr.PollResults:return it.ZP.createElement("h3",null,ue("PollResults"));case pr.Search:return it.ZP.createElement(it.ZP.Fragment,null,it.ZP.createElement(ps.Z,{parentContainerClassName:"RightSearch",value:C,onChange:te}),it.ZP.createElement(Jt.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>G({selectedAt:(0,ae._F)(Date.now())}),ariaLabel:"Search messages by date"},it.ZP.createElement("i",{className:"icon icon-calendar"})));case pr.AddingMembers:return it.ZP.createElement("h3",null,ue(S?"ChannelAddSubscribers":"GroupAddMembers"));case pr.ManageInitial:return it.ZP.createElement("h3",null,ue("Edit"));case pr.ManageChatPrivacyType:return it.ZP.createElement("h3",null,ue(S?"ChannelTypeHeader":"GroupTypeHeader"));case pr.ManageDiscussion:return it.ZP.createElement("h3",null,ue("Discussion"));case pr.ManageChatAdministrators:return it.ZP.createElement("h3",null,ue("ChannelAdministrators"));case pr.ManageGroupRecentActions:return it.ZP.createElement("h3",null,ue("Group.Info.AdminLog"));case pr.ManageGroupAdminRights:return it.ZP.createElement("h3",null,ue("EditAdminRights"));case pr.ManageGroupNewAdminRights:return it.ZP.createElement("h3",null,ue("SetAsAdmin"));case pr.ManageGroupPermissions:return it.ZP.createElement("h3",null,ue("ChannelPermissions"));case pr.ManageGroupRemovedUsers:return it.ZP.createElement("h3",null,ue("BlockedUsers"));case pr.ManageChannelRemovedUsers:return it.ZP.createElement("h3",null,ue("ChannelBlockedUsers"));case pr.ManageGroupUserPermissionsCreate:return it.ZP.createElement("h3",null,ue("ChannelAddException"));case pr.ManageGroupUserPermissions:return it.ZP.createElement("h3",null,ue("UserRestrictions"));case pr.ManageInvites:return it.ZP.createElement("h3",null,ue("lng_group_invite_title"));case pr.ManageEditInvite:return it.ZP.createElement("h3",null,ue(R?"EditLink":"NewLink"));case pr.ManageInviteInfo:return it.ZP.createElement(it.ZP.Fragment,null,it.ZP.createElement("h3",null,ue("InviteLink")),it.ZP.createElement("section",{className:"tools"},A&&!A.isRevoked&&it.ZP.createElement(Jt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("Edit"),onClick:Q},it.ZP.createElement("i",{className:"icon icon-edit"})),A&&A.isRevoked&&it.ZP.createElement(it.ZP.Fragment,null,it.ZP.createElement(Jt.Z,{round:!0,color:"danger",size:"smaller",ariaLabel:ue("Delete"),onClick:W},it.ZP.createElement("i",{className:"icon icon-delete"})),it.ZP.createElement(uo.Z,{isOpen:z,onClose:Y,title:ue("DeleteLink"),text:ue("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:ue("Delete"),confirmHandler:ee}))));case pr.ManageJoinRequests:return it.ZP.createElement("h3",null,ue(S?"SubscribeRequests":"MemberRequests"));case pr.ManageGroupAddAdmins:return it.ZP.createElement("h3",null,ue("Channel.Management.AddModerator"));case pr.StickerSearch:return it.ZP.createElement(ps.Z,{value:M,placeholder:ue("SearchStickersHint"),autoFocusSearch:!0,onChange:se});case pr.GifSearch:return it.ZP.createElement(ps.Z,{value:E,placeholder:ue("SearchGifsTitle"),autoFocusSearch:!0,onChange:ne});case pr.Statistics:return it.ZP.createElement("h3",null,ue(S?"ChannelStats.Title":"GroupStats.Title"));case pr.MessageStatistics:return it.ZP.createElement("h3",null,ue("Stats.MessageTitle"));case pr.BoostStatistics:return it.ZP.createElement("h3",null,ue("Boosts"));case pr.SharedMedia:return it.ZP.createElement("h3",null,ue("SharedMedia"));case pr.ManageChannelSubscribers:return it.ZP.createElement("h3",null,ue("ChannelSubscribers"));case pr.MemberList:case pr.ManageGroupMembers:return it.ZP.createElement("h3",null,ue("GroupMembers"));case pr.StoryList:return it.ZP.createElement("h3",null,ue(P?"Settings.MyStories":"PeerInfo.PaneStories"));case pr.ManageReactions:return it.ZP.createElement("h3",null,ue("Reactions"));case pr.CreateTopic:return it.ZP.createElement("h3",null,ue("NewTopic"));case pr.EditTopic:return it.ZP.createElement("h3",null,ue("EditTopic"));default:return it.ZP.createElement(it.ZP.Fragment,null,it.ZP.createElement("h3",null,ue(x?"AccDescrTopic":S?"Channel.TitleInfo":b?B?"lng_info_bot_title":"lng_info_user_title":"GroupInfo.Title")),it.ZP.createElement("section",{className:"tools"},y&&it.ZP.createElement(Jt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("AddContact"),onClick:ie},it.ZP.createElement("i",{className:"icon icon-add-user","aria-hidden":!0})),Z&&!x&&it.ZP.createElement(Jt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("Edit"),onClick:re},it.ZP.createElement("i",{className:"icon icon-edit"})),L&&it.ZP.createElement(Jt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("EditTopic"),onClick:oe},it.ZP.createElement("i",{className:"icon icon-edit"})),k&&it.ZP.createElement(Jt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("Statistics"),onClick:ce},it.ZP.createElement("i",{className:"icon icon-stats"}))))}}()))})),fr=e=>{const t=(0,Mt.Z)(mt.gl.Extra,"RightSearch");return t?it.ZP.createElement(t,e):it.ZP.createElement(Gt.Z,null)};var Ir=s(4830),vr=s(65979),wr=s(57019),yr=s(66),br=s(63028);const Pr={root:"ZtWHQyTLrCmeNE53Hvd9",noResults:"cuYFx3gorhlWaUcBJ0Aj","section-header":"IPPwOeRGhyQDYbJsBsdb",sectionHeader:"IPPwOeRGhyQDYbJsBsdb",section:"HMySq6RoeqoKdRuUAW7z",user:"hben8jCvRhcyebFweulH",stats:"dBHHnaU4CZ9TELAykZyA",down:"nlFBjRF9YGIjCHGrt2cp",loadMoreSpinner:"QBMARpR7dewZog5QmOkh"},Zr=(0,it.X$)((0,a.c$)((e=>({boostStatistics:(0,v.jUK)(e).boostStatistics})))((e=>{let{boostStatistics:t}=e;const{openChat:s,loadMoreBoosters:n,closeBoostStatistics:i}=(0,a.Sv)(),o=(0,$t.Z)(),r=t?.boostStatus,c=r?t.boostStatus:void 0,{currentLevel:d,hasNextLevel:l,boosts:u,levelProgress:m,remainingBoosts:h}=(0,it.Ye)((()=>c?(0,Ir.k)(c):{currentLevel:0,hasNextLevel:!1,boosts:0,levelProgress:0,remainingBoosts:0}),[c]),p=(0,it.Ye)((()=>{if(c)return{level:d,boosts:u,premiumSubscribers:c.premiumSubscribers,remainingBoosts:h}}),[c,u,d,h]),g=(0,it.Ye)((()=>{if(!t?.count)return;const e=t.boosterIds?.length||0;return t.count-e}),[t]),f=(0,wt.Z)((e=>{s({id:e}),i()})),I=(0,wt.Z)((()=>{n()}));return it.ZP.createElement("div",{className:(0,dt.Z)(Pr.root,"custom-scroll")},!r&&it.ZP.createElement(Gt.Z,null),r&&p&&it.ZP.createElement(it.ZP.Fragment,null,it.ZP.createElement("div",{className:Pr.section},it.ZP.createElement(yr.Z,{leftText:o("BoostsLevel",d),rightText:l?o("BoostsLevel",d+1):void 0,progress:m,floatingBadgeText:u.toString(),floatingBadgeIcon:"boost"}),it.ZP.createElement(br.Z,{className:Pr.stats,statistics:p,type:"boost"})),it.ZP.createElement("div",{className:Pr.section},it.ZP.createElement("h4",{className:Pr.sectionHeader,dir:o.isRtl?"rtl":void 0},o("Boosters")),!t.boosterIds?.length&&it.ZP.createElement("div",{className:Pr.noResults},o("NoBoostersHint")),t.boosterIds?.map((e=>it.ZP.createElement(cr.Z,{key:e,className:"chat-item-clickable",onClick:()=>f(e)},it.ZP.createElement(co.Z,{className:Pr.user,forceShowSelf:!0,userId:e,status:o("BoostExpireOn",(0,ae.$M)(o,1e3*t.boosters[e]))})))),Boolean(g)&&it.ZP.createElement(cr.Z,{key:"load-more",className:Pr.showMore,disabled:t?.isLoadingBoosters,onClick:I},t?.isLoadingBoosters?it.ZP.createElement(fs.Z,{className:Pr.loadMoreSpinner}):it.ZP.createElement(vr.Z,{name:"down",className:Pr.down}),o("ShowVotes",g))),it.ZP.createElement(wr.Z,{className:Pr.section,inviteLink:c.boostUrl,title:o("LinkForBoosting")})))}))),Sr=e=>{const t=(0,Mt.Z)(mt.gl.Extra,"MessageStatistics");return t?it.ZP.createElement(t,e):it.ZP.createElement(Gt.Z,null)},Cr=e=>{const t=(0,Mt.Z)(mt.gl.Extra,"Statistics");return t?it.ZP.createElement(t,e):it.ZP.createElement(Gt.Z,null)},Mr=()=>{const e=(0,Mt.Z)(mt.gl.Extra,"StickerSearch");return e?it.ZP.createElement(e,null):it.ZP.createElement(Gt.Z,null)},Er=450+n.fK3,Rr=Object.keys(c.qt).length/2,kr=Object.keys(c.u1).length/2;function Tr(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}const Ar=(0,it.X$)((0,a.c$)(((e,t)=>{let{isMobile:s}=t;const{chatId:a,threadId:n}=(0,v.Btg)(e)||{},i=(0,v.g4C)(e),{management:o,shouldSkipHistoryAnimations:c,nextProfileTab:d}=(0,v.jUK)(e),l=a?o.byChatId[a]?.nextScreen:void 0,u=(a?(0,v.Z1J)(e,a)?.isForum:void 0)&&Boolean(n&&n!==r._f);return{contentKey:(0,v.WqZ)(e,s),chatId:a,threadId:n,isInsideTopic:u,isChatSelected:Boolean(a&&i),shouldSkipHistoryAnimations:c,nextManagementScreen:l,nextProfileTab:d}}))((e=>{let{contentKey:t,chatId:s,threadId:i,isMobile:o,isInsideTopic:r,isChatSelected:d,shouldSkipHistoryAnimations:l,nextManagementScreen:u,nextProfileTab:m}=e;const{toggleChatInfo:h,toggleManagement:p,closeLocalTextSearch:g,setStickerSearchQuery:f,setGifSearchQuery:I,closePollResults:v,addChatMembers:w,setNewChatMembersDialogState:y,setEditingExportedInvite:b,toggleStatistics:P,toggleMessageStatistics:Z,setOpenedInviteInfo:S,requestNextManagementScreen:C,resetNextProfileTab:M,closeCreateTopicPanel:E,closeEditTopicPanel:R,closeBoostStatistics:k}=(0,a.Sv)(),{width:T}=(0,ma.Z)(),[A,N]=(0,it.eJ)(c.vi.Profile),[B,x]=(0,it.eJ)(c.u1.Initial),[L,U]=(0,it.eJ)(),[O,j]=(0,it.eJ)(),_=A!==c.vi.Profile,F=void 0!==t,D=t===c.qt.ChatInfo,q=t===c.qt.Search,G=t===c.qt.Management,H=t===c.qt.Statistics,V=t===c.qt.MessageStatistics,$=t===c.qt.BoostStatistics,J=t===c.qt.StickerSearch,K=t===c.qt.GifSearch,z=t===c.qt.PollResults,W=t===c.qt.AddingMembers,Y=t===c.qt.CreateTopic,X=t===c.qt.EditTopic,Q=T<=n._mX,[ee,te]=(0,it.eJ)(!F),se=(0,no.Z)(t,!0,!d)??-1,ae=(0,wt.Z)((function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];switch(t){case c.qt.AddingMembers:y({newChatMembersProgress:c.WB.Closed});break;case c.qt.ChatInfo:if(_&&e){N(c.vi.Profile);break}h({force:!1},{forceSyncOnIOs:!0});break;case c.qt.Management:switch(B){case c.u1.Initial:p();break;case c.u1.ChatPrivacyType:case c.u1.Discussion:case c.u1.GroupPermissions:case c.u1.GroupType:case c.u1.ChatAdministrators:case c.u1.ChannelSubscribers:case c.u1.GroupMembers:case c.u1.Invites:case c.u1.Reactions:case c.u1.JoinRequests:case c.u1.ChannelRemovedUsers:x(c.u1.Initial);break;case c.u1.GroupUserPermissionsCreate:case c.u1.GroupRemovedUsers:case c.u1.GroupUserPermissions:x(c.u1.GroupPermissions),U(void 0),j(void 0);break;case c.u1.ChatAdminRights:case c.u1.ChatNewAdminRights:case c.u1.GroupAddAdmins:case c.u1.GroupRecentActions:x(c.u1.ChatAdministrators);break;case c.u1.EditInvite:case c.u1.InviteInfo:x(c.u1.Invites),S({chatId:s,invite:void 0}),b({chatId:s,invite:void 0})}break;case c.qt.MessageStatistics:Z();break;case c.qt.Statistics:P();break;case c.qt.BoostStatistics:k();break;case c.qt.Search:Tr(),g();break;case c.qt.StickerSearch:Tr(),f({query:void 0});break;case c.qt.GifSearch:Tr(),I({query:void 0});break;case c.qt.PollResults:v();break;case c.qt.CreateTopic:E();break;case c.qt.EditTopic:R()}})),ne=(0,wt.Z)(((e,t)=>{U(e),j(t)})),ie=(0,wt.Z)((e=>{w({chatId:s,memberIds:e})}));function oe(e){if(-1!==se)switch(se){case c.qt.AddingMembers:return it.ZP.createElement(Fo,{key:`add_chat_members_${s}`,chatId:s,isActive:F&&e,onNextStep:ie,onClose:ae});case c.qt.ChatInfo:return it.ZP.createElement(ur,{key:`profile_${s}`,chatId:s,topicId:r?i:void 0,profileState:A,isMobile:o,onProfileStateChange:N});case c.qt.Search:return it.ZP.createElement(fr,{key:`right_search_${s}`,chatId:s,threadId:i,onClose:ae,isActive:F&&e});case c.qt.Management:return it.ZP.createElement(Ho,{key:`management_${s}_${B}`,chatId:s,currentScreen:B,isPromotedByCurrentUser:O,selectedChatMemberId:L,isActive:F&&e,onScreenSelect:x,onChatMemberSelect:ne,onClose:ae});case c.qt.Statistics:return it.ZP.createElement(Cr,{chatId:s});case c.qt.BoostStatistics:return it.ZP.createElement(Zr,null);case c.qt.MessageStatistics:return it.ZP.createElement(Sr,{chatId:s,isActive:F&&e});case c.qt.StickerSearch:return it.ZP.createElement(Mr,{onClose:ae,isActive:F&&e});case c.qt.GifSearch:return it.ZP.createElement(Go,{onClose:ae,isActive:F&&e});case c.qt.PollResults:return it.ZP.createElement(Vo,{onClose:ae,isActive:F&&e});case c.qt.CreateTopic:return it.ZP.createElement(Do,{onClose:ae,isActive:F&&e});case c.qt.EditTopic:return it.ZP.createElement(qo,{onClose:ae,isActive:F&&e})}}return(0,it.d4)((()=>F?(0,Ot.Z)(ae):void 0),[F,ae]),(0,it.d4)((()=>{setTimeout((()=>{te(!F)}),Er)}),[F]),(0,it.d4)((()=>{u&&(x(u),C(void 0))}),[u]),(0,it.d4)((()=>{m&&M()}),[m]),(0,it.d4)((()=>{F&&Q&&ae()}),[Q]),(0,Aa.Z)((e=>{let[t]=e;t!==s&&(N(c.vi.Profile),x(c.u1.Initial))}),[s]),(0,Qt.Z)({isActive:d&&(t===c.qt.ChatInfo||t===c.qt.Management||t===c.qt.AddingMembers||t===c.qt.CreateTopic||t===c.qt.EditTopic),onBack:()=>ae(!1)}),it.ZP.createElement("div",{id:"RightColumn-wrapper",className:d?void 0:"is-hidden"},Q&&it.ZP.createElement("div",{className:"overlay-backdrop",onClick:ae}),it.ZP.createElement("div",{id:"RightColumn"},it.ZP.createElement(gr,{chatId:s,threadId:i,isColumnOpen:F,isProfile:D,isSearch:q,isManagement:G,isStatistics:H,isBoostStatistics:$,isMessageStatistics:V,isStickerSearch:J,isGifSearch:K,isPollResults:z,isCreatingTopic:Y,isEditingTopic:X,isAddingChatMembers:W,profileState:A,managementScreen:B,onClose:ae,onScreenSelect:x}),it.ZP.createElement(qt.ZP,{name:ee||l?"none":"zoomFade",renderCount:Rr+kr,activeKey:G?Rr+B:se,shouldCleanup:!0,cleanupExceptionKey:se===c.qt.MessageStatistics?c.qt.Statistics:void 0},oe)))}))),Nr=(0,it.X$)((e=>{let{isOpen:t}=e;const s=(0,Mt.Z)(mt.gl.Extra,"StoryViewer",!t);return s?it.ZP.createElement(s,null):void 0})),Br=e=>{const{requestedAttachBotInChat:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"AttachBotRecipientPicker",!t);return s?it.ZP.createElement(s,e):void 0},xr=e=>{const{bot:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"BotTrustModal",!t);return s?it.ZP.createElement(s,e):void 0},Lr={root:"vfd0Bo1X6k19aaxQ577t"},Ur=["#E8BC2C","#D0049E","#02CBFE","#5723FD","#FE8C27","#6CB859"],Or=(0,it.X$)((0,a.c$)((e=>(0,u.ei)((0,v.jUK)(e),["confetti"])))((e=>{let{confetti:t}=e;const s=(0,it.sO)(null),a=(0,it.sO)([]),n=(0,it.sO)(!1),i=(0,ma.Z)(),o=(0,gt.Z)(),{isMobile:r}=(0,T.ZP)(),c=r?50:100,{lastConfettiTime:d,top:l,width:u,left:m,height:h}=t||{},p=(0,it.I4)((function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c;for(let n=0;n<s;n++){const s=n%2,i={x:e*(s?-.1:1.1),y:.75*t},o=Math.random()*e*1.5,r={x:s?o:-1*o,y:-t/2-Math.random()*t},c=Ur[Math.floor(Math.random()*Ur.length)],d=10;a.current.push({pos:i,size:d,color:c,velocity:r,flicker:d,flickerFrequency:.2*Math.random(),rotation:0,lastDrawnAt:Date.now(),frameCount:0})}}),[c]),g=(0,it.I4)((()=>{if(!s.current||!n.current)return;const e=s.current,t=e.getContext("2d");if(!t)return;const{width:i,height:o}=e;t.clearRect(0,0,i,o);const r=[];a.current.forEach(((e,s)=>{const{pos:n,velocity:i,size:c,color:d,flicker:l,flickerFrequency:u,rotation:m,lastDrawnAt:h,frameCount:p}=e,g=(Date.now()-h)/1e3,f={x:n.x+i.x*g,y:n.y+i.y*g},I={x:.98*i.x,y:i.y+=1e3*g},v=c*Math.abs(Math.sin(p*u)),w=5*p*u*(Math.PI/180),y=p+1,b=Date.now();if(f.y>o+e.size)return void r.push(e);const P={...e,pos:f,velocity:I,flicker:v,rotation:w,lastDrawnAt:b,frameCount:y};a.current[s]=P,t.fillStyle=d,t.beginPath(),t.ellipse(n.x,n.y,c,l,m,0,2*Math.PI),t.fill()})),a.current=a.current.filter((e=>!r.includes(e))),a.current.length?(0,ct.i$)(g):n.current=!1}),[]);if((0,St.Z)((e=>{let t,[s]=e;return s!==d&&(p(u||i.width,h||i.height),t=setTimeout(o,1e4),n.current||(n.current=!0,(0,ct.i$)(g))),()=>{clearTimeout(t)}}),[d,o,g]),!d||Date.now()-d>1e4)return;const f=(0,ra.Z)(Boolean(l)&&`top: ${l}px`,Boolean(m)&&`left: ${m}px`,Boolean(u)&&`width: ${u}px`,Boolean(h)&&`height: ${h}px`);return it.ZP.createElement("div",{id:"Confetti",className:Lr.root,style:f},it.ZP.createElement("canvas",{ref:s,className:Lr.canvas,width:i.width,height:i.height}))}))),jr=e=>{const{folder:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"DeleteFolderDialog",!t);return s?it.ZP.createElement(s,e):void 0},_r=e=>{let{isOpen:t}=e;const s=(0,Mt.Z)(mt.gl.Extra,"Dialogs",!t);return s?it.ZP.createElement(s,null):void 0};var Fr=s(6562);const Dr=new Set,qr=new Set,Gr=(0,it.X$)((0,a.c$)((e=>({activeDownloads:(0,v.jUK)(e).activeDownloads.byChatId})))((e=>{let{activeDownloads:t}=e;const{cancelMessagesMediaDownload:s,showNotification:n}=(0,a.Sv)(),o=(0,xa.Z)(1e3,!0),c=(0,wt.Z)((e=>{qr.add(e),o((()=>{qr.size&&(s({messages:Array.from(qr)}),qr.clear())}))}));(0,it.d4)((()=>{const e=(0,a.Rd)().messages.byChatId,s=(0,a.Rd)().scheduledMessages.byChatId,o=Object.entries(t).map((t=>{let[a,n]=t;const i=n.ids?.map((t=>e[a]?.byId[t])),o=n.scheduledIds?.map((e=>s[a]?.byId[e]));return(0,u.oA)([...i||[],...o||[]])})).flat();o.length?o.forEach((e=>{if(Dr.has(e))return;Dr.add(e);const t=(0,g.Ti)(e,"download");if(!t)return void c(e);const s=Me.UV(t);if(s)return(0,Fr.Z)(s,(0,g.w6)(e)),void c(e);const{document:a,video:o,audio:d}=e.content;if(((a||o||d)?.size||0)>i.l0&&!i.rT&&!i.Mc)return n({message:"Downloading files bigger than 2GB is not supported in your browser."}),void c(e);const l=(0,g.kG)(e,"download");Me.he(t,l,!0).then((t=>{if(l===r.IU.DownloadUrl){const s=new URL(t,window.document.baseURI),a=(0,g.w6)(e);s.searchParams.set("filename",encodeURIComponent(a));const i=window.open(s.toString());i?.addEventListener("beforeunload",(()=>{n({message:"Download started. Please, do not close the app before it is finished."})}))}else t&&(0,Fr.Z)(t,(0,g.w6)(e));c(e)}))})):Dr.clear()}),[t,s,c,n])}))),Hr=e=>{const{requestedDraft:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"DraftRecipientPicker",!t);return s?it.ZP.createElement(s,e):void 0},Vr=e=>{const{isOpen:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"ForwardRecipientPicker",!t);return s?it.ZP.createElement(s,e):void 0};var $r=s(56389),Jr=s(34563);const Kr=(0,it.X$)((0,a.c$)(((e,t)=>{let{openedGame:s}=t;const{chatId:a}=s||{},n=a&&(0,v.Z1J)(e,a);return{canPost:Boolean(n)&&(0,g.Qm)(n,r._f)}}))((e=>{let{openedGame:t,gameTitle:s,canPost:a}=e;const{closeGame:n,openForwardMenu:i}=(0,re.Sv)(),o=(0,$t.Z)(),{url:r,chatId:c,messageId:d}=t||{},l=Boolean(r),u=(0,$r.Z)(c);(0,vt.Z)((()=>{u({type:"playingGame"})}),l&&a?5e3:void 0);const m=(0,it.I4)((e=>{try{const t=JSON.parse(e.data);"share_score"===t.eventType&&(i({fromChatId:c,messageIds:[d],withMyScore:!0}),n()),"share_game"===t.eventType&&(i({fromChatId:c,messageIds:[d]}),n())}catch(e){}}),[c,n,d,i]),h=(0,it.I4)((e=>{e.currentTarget.focus()}),[]);return(0,it.d4)((()=>(window.addEventListener("message",m),()=>window.removeEventListener("message",m))),[m]),it.ZP.createElement(Jr.Z,{className:"GameModal",isOpen:l,onClose:n,title:s,hasCloseButton:!0},l&&it.ZP.createElement("iframe",{className:"game-frame",onLoad:h,src:r,title:o("AttachGame"),sandbox:"allow-scripts allow-same-origin allow-orientation-lock",allow:"fullscreen"}))}))),zr=e=>{const{isOpen:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"HistoryCalendar",!t);return s?it.ZP.createElement(s,e):void 0},Wr=e=>{const{isOpen:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"NewContactModal",!t);return s?it.ZP.createElement(s,e):void 0},Yr=e=>{let{isOpen:t}=e;const s=(0,Mt.Z)(mt.gl.Extra,"Notifications",!t);return s?it.ZP.createElement(s,null):void 0},Xr=e=>{const{limit:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"PremiumLimitReachedModal",!t);return s?it.ZP.createElement(s,e):void 0},Qr=e=>{const{isOpen:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"PremiumMainModal",!t);return s?it.ZP.createElement(s,e):void 0},ec=e=>{const{url:t}=e,s=(0,Mt.Z)(mt.gl.Extra,"SafeLinkModal",!t);return s?it.ZP.createElement(s,e):void 0};let tc=!1;const sc=(0,it.X$)((0,a.c$)(((e,t)=>{let{isMobile:s}=t;const{settings:{byKey:{language:a,wasTimeFormatSetManually:n}}}=e,{botTrustRequest:i,requestedAttachBotInstall:o,requestedAttachBotInChat:r,requestedDraft:c,urlAuth:d,webApp:l,safeLinkModalUrl:u,mapModal:m,openedStickerSetShortName:h,openedCustomEmojiSetIds:p,shouldSkipHistoryAnimations:f,openedGame:I,audioPlayer:w,isLeftColumnShown:y,historyCalendarSelectedAt:b,notifications:P,dialogs:Z,newContact:S,ratingPhoneCall:C,premiumModal:M,isMasterTab:E,payment:R,limitReachedModal:k,deleteFolderDialogModal:T,chatlistModal:A,boostModal:N}=(0,v.jUK)(e),{chatId:B,messageId:x}=w,L=B&&x?(0,v.hjO)(e,B,x):void 0,U=I&&(0,v.hjO)(e,I.chatId,I.messageId),O=U?.content.game?.title,j=e.currentUserId?(0,v.dyD)(e,e.currentUserId):void 0,{chatId:_}=(0,v.Btg)(e)||{},F=!(0,v.$Yd)(e,"rightColumnAnimations")||!(0,v.FOo)(e),D=T?(0,v.MwT)(e,T):void 0;return{isLeftColumnOpen:y,isMiddleColumnOpen:Boolean(_),isRightColumnOpen:(0,v.Jf5)(e,s),isMediaViewerOpen:(0,v.zQd)(e),isStoryViewerOpen:(0,v.TuN)(e),isForwardModalOpen:(0,v.Evo)(e),isReactionPickerOpen:(0,v.Io8)(e),hasNotifications:Boolean(P.length),hasDialogs:Boolean(Z.length),audioMessage:L,safeLinkModalUrl:u,mapModalGeoPoint:m?.point,mapModalZoom:m?.zoom,isHistoryCalendarOpen:Boolean(b),shouldSkipHistoryAnimations:f,openedStickerSetShortName:h,openedCustomEmojiSetIds:p,isServiceChatReady:(0,v.UWV)(e),activeGroupCallId:E?e.groupCalls.activeGroupCallId:void 0,withInterfaceAnimations:(0,v.FOo)(e),language:a,wasTimeFormatSetManually:n,isPhoneCallActive:E?Boolean(e.phoneCall):void 0,addedSetIds:e.stickers.added.setIds,addedCustomEmojiIds:e.customEmojis.added.setIds,newContactUserId:S?.userId,newContactByPhoneNumber:S?.isByPhoneNumber,openedGame:I,gameTitle:O,isRatePhoneCallModalOpen:Boolean(C),botTrustRequest:i,botTrustRequestBot:i&&(0,v.dyD)(e,i.botId),attachBotToInstall:o?.bot,requestedAttachBotInChat:r,webApp:l,currentUserName:(0,g.Js)(j),urlAuth:d,isCurrentUserPremium:(0,v.wVz)(e),isPremiumModalOpen:M?.isOpen,limitReached:k?.limit,isPaymentModalOpen:R.isPaymentModalOpen,isReceiptModalOpen:Boolean(R.receipt),deleteFolderDialog:D,isMasterTab:E,requestedDraft:c,chatlistModal:A,boostModal:N,noRightColumnAnimation:F,isSynced:e.isSynced}}))((e=>{let{isMobile:t,isLeftColumnOpen:s,isMiddleColumnOpen:o,isRightColumnOpen:r,isMediaViewerOpen:c,isStoryViewerOpen:d,isForwardModalOpen:l,hasNotifications:u,hasDialogs:m,audioMessage:h,activeGroupCallId:p,safeLinkModalUrl:g,mapModalGeoPoint:f,mapModalZoom:I,isHistoryCalendarOpen:v,shouldSkipHistoryAnimations:w,limitReached:y,openedStickerSetShortName:b,openedCustomEmojiSetIds:P,isServiceChatReady:Z,withInterfaceAnimations:S,language:C,wasTimeFormatSetManually:M,addedSetIds:E,addedCustomEmojiIds:R,isPhoneCallActive:k,newContactUserId:A,newContactByPhoneNumber:N,openedGame:B,gameTitle:x,isRatePhoneCallModalOpen:L,botTrustRequest:U,botTrustRequestBot:O,attachBotToInstall:j,requestedAttachBotInChat:_,requestedDraft:F,webApp:D,currentUserName:q,urlAuth:G,isPremiumModalOpen:H,isPaymentModalOpen:V,isReceiptModalOpen:$,isReactionPickerOpen:J,isCurrentUserPremium:K,deleteFolderDialog:z,isMasterTab:W,chatlistModal:Y,boostModal:X,noRightColumnAnimation:Q,isSynced:ee}=e;const{initMain:te,loadAnimatedEmojis:se,loadNotificationSettings:ae,loadNotificationExceptions:ne,updateIsOnline:ie,onTabFocusChange:oe,loadTopInlineBots:re,loadEmojiKeywords:ce,loadCountryList:de,loadAvailableReactions:le,loadStickerSets:ue,loadPremiumGifts:me,loadDefaultTopicIcons:he,loadAddedStickers:pe,loadFavoriteStickers:ge,loadDefaultStatusIcons:fe,ensureTimeFormat:Ie,closeStickerSetModal:ve,closeCustomEmojiSets:we,checkVersionNotification:ye,loadConfig:be,loadAppConfig:Pe,loadAttachBots:Ze,loadContactList:Se,loadCustomEmojis:Ce,loadGenericEmojiEffects:Me,closePaymentModal:Ee,clearReceipt:ke,checkAppVersion:Te,openChat:Ae,toggleLeftColumn:Ne,loadRecentEmojiStatuses:Be,updatePageTitle:xe,loadTopReactions:Le,loadRecentReactions:Ue,loadFeaturedEmojiStickers:Oe,setIsElectronUpdateAvailable:je,loadPremiumSetStickers:_e,loadAuthorizations:Fe}=(0,a.Sv)();n.eMD&&!tc&&(tc=!0,console.log(">>> RENDER MAIN")),(0,Ct.Z)((()=>{(0,mt.Pb)(mt.gl.Calls)}),5e3);const qe=(0,it.sO)(null),Ge=(0,it.sO)(null),{isDesktop:He}=(0,T.ZP)();(0,it.d4)((()=>{s||o||He?s&&o&&t&&Ne():Ne()}),[He,s,o,t,Ne]),(0,vt.Z)(Te,W?3e5:void 0,!0),(0,it.d4)((()=>{if(!i.D$)return;const e=window.electron.on(rt.I.UPDATE_AVAILABLE,(()=>{je(!0)})),t=window.electron.on(rt.I.UPDATE_ERROR,(()=>{je(!1),e?.()}));return()=>{t?.(),e?.()}}),[]),(0,it.d4)((()=>{W&&ee&&(ie(!0),be(),Pe(),te(),le(),se(),Me(),ae(),ne(),re(),ce({language:n.pRL}),Ze(),Se(),me(),he(),Te(),Le(),Ue(),Oe(),Fe())}),[W,ee]),(0,it.d4)((()=>{W&&K&&(fe(),Be(),_e())}),[K,W]),(0,it.d4)((()=>{W&&(C!==n.pRL&&ce({language:C}),de({langCode:C}))}),[C,W]),(0,it.d4)((()=>{W&&Ce({ids:Object.keys((0,a.Rd)().customEmojis.byId),ignoreCache:!0})}),[W]),(0,it.d4)((()=>{W&&ee&&(E&&R||(ue(),ge()),E&&R&&pe())}),[E,R,W,ee]),(0,it.d4)((()=>{Z&&W&&ye()}),[Z,W]),(0,it.d4)((()=>{M||Ie()}),[M]),(0,it.d4)((()=>{const e=(0,Re.dx)();e?.tgaddr&&(0,ut.ou)(decodeURIComponent(e.tgaddr))}),[]),(0,it.d4)((()=>window.electron?.on(rt.I.DEEPLINK,(e=>{(0,ut.ou)(decodeURIComponent(e))}))),[]),(0,it.d4)((()=>{const e=(0,Re.VX)();e&&Ae({id:e.chatId,threadId:e.threadId,type:e.type})}),[]),(0,it.bt)((()=>{const e=qe.current;1===e.parentNode.childElementCount&&(0,ot.D_)(e,"Transition_slide-active")}),[]);const Ve=(0,Zt.Z)(s,void 0,!0,void 0,w,void 0,!0),$e=(0,it.sO)(!1),Je=(0,gt.Z)();(0,St.Z)((e=>{let[t]=e;if(void 0===t||s===t||!S)return;$e.current=!0,i.wZ&&(0,ct.Yq)((()=>{document.body.classList.toggle("android-left-blackout-open",!s)}));const a=(0,It.YW)();(0,lt.L)(document.getElementById("MiddleColumn"),(()=>{a(),$e.current=!1,Je()}))}),[s,S,Je]);const Ke=(0,Zt.Z)(r,void 0,!0,void 0,w,void 0,!0),ze=(0,it.sO)(!1),[We,Ye]=(0,it.eJ)(r),Xe=(0,ft.Ar)();(0,St.Z)((e=>{let[t,s]=e;if(void 0===s||r===s)return;if(!t||Q)return void Ye(r);ze.current=!0;const a=(0,It.YW)();(0,lt.L)(document.getElementById("RightColumn"),(()=>{a(),ze.current=!1,Je(),Ye(r)}))}),[o,r,Q,Je]);const Qe=(0,dt.Z)(Ve.hasShownClass&&"left-column-shown",Ve.hasOpenClass&&"left-column-open",$e.current&&"left-column-animating",Ke.hasShownClass&&"right-column-shown",Ke.hasOpenClass&&"right-column-open",ze.current&&"right-column-animating",We&&"narrow-message-list",w&&"history-animation-disabled",Xe&&"is-fullscreen"),et=(0,wt.Z)((()=>{oe({isBlurred:!0})})),tt=(0,wt.Z)((()=>{oe({isBlurred:!1}),document.title.includes(n.ouc)||xe(),De(!1)})),st=(0,wt.Z)((()=>{ve()})),at=(0,wt.Z)((()=>{we()}));return(0,ht.Z)(et,tt,!!i.D$),(0,pt.Z)(et),function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,it.d4)((()=>{if(i.$b){if(!e)return yt?.setAttribute("content",bt),i.cj&&!i.fl&&document.addEventListener("gesturestart",Pt),()=>{yt?.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no"),i.cj&&!i.fl&&document.removeEventListener("gesturestart",Pt)};yt?.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover")}}),[e])}(c||d),it.ZP.createElement("div",{ref:qe,id:"Main",className:Qe},it.ZP.createElement(Fs,{ref:Ge}),it.ZP.createElement(ko,{leftColumnRef:Ge,isMobile:t}),it.ZP.createElement(Ar,{isMobile:t}),it.ZP.createElement(Ds,{isOpen:c}),it.ZP.createElement(Nr,{isOpen:d}),it.ZP.createElement(Vr,{isOpen:l}),it.ZP.createElement(Hr,{requestedDraft:F}),it.ZP.createElement(Yr,{isOpen:u}),it.ZP.createElement(_r,{isOpen:m}),h&&it.ZP.createElement(aa,{key:h.id,message:h,noUi:!0}),it.ZP.createElement(ec,{url:g}),it.ZP.createElement(Bo,{geoPoint:f,zoom:I}),it.ZP.createElement(xo,{urlAuth:G,currentUserName:q}),it.ZP.createElement(zr,{isOpen:v}),it.ZP.createElement(Nt,{isOpen:Boolean(b),onClose:st,stickerSetShortName:b}),it.ZP.createElement(At,{customEmojiSetIds:P,onClose:at}),p&&it.ZP.createElement(Rt,{groupCallId:p}),it.ZP.createElement(Et,{isActive:Boolean(p||k)}),it.ZP.createElement(Wr,{isOpen:Boolean(A||N),userId:A,isByPhoneNumber:N}),it.ZP.createElement(Ao,{info:X}),it.ZP.createElement(No,{info:Y}),it.ZP.createElement(Kr,{openedGame:B,gameTitle:x}),it.ZP.createElement(Lo,{webApp:D}),it.ZP.createElement(Gr,null),it.ZP.createElement(Or,null),it.ZP.createElement(kt,{isActive:k}),it.ZP.createElement(Ut,{isForAppBadge:!0}),it.ZP.createElement(Tt,{isOpen:L}),it.ZP.createElement(xr,{bot:O,type:U?.type,shouldRequestWriteAccess:U?.shouldRequestWriteAccess}),it.ZP.createElement(To,{bot:j}),it.ZP.createElement(Br,{requestedAttachBotInChat:_}),it.ZP.createElement(oa,null),H&&it.ZP.createElement(Qr,{isOpen:H}),it.ZP.createElement(Xr,{limit:y}),it.ZP.createElement(Uo,{isOpen:V,onClose:Ee}),it.ZP.createElement(Oo,{isOpen:$,onClose:ke}),it.ZP.createElement(jr,{folder:z}),it.ZP.createElement(na,{isOpen:J}))})));var ac=s(57773),nc=s(21179),ic=s(99364),oc=s(8337);var rc=s(2092);const cc=(0,it.X$)((0,a.c$)((e=>({passcodeSettings:e.passcode})))((e=>{let{isLocked:t,passcodeSettings:s}=e;const{unlockScreen:n,signOut:i,logInvalidUnlockAttempt:o,resetInvalidUnlockAttempts:r}=(0,a.Sv)(),{invalidAttemptsCount:c,timeoutUntil:d,isLoading:l}=s,u=(0,$t.Z)(),[m,h]=(0,it.eJ)(""),[p,g]=(0,it.eJ)(!1),[f,I,v]=(0,ds.Z)(!1),{shouldRender:w}=(0,Zt.Z)(t);(0,Ct.Z)(r,d?d-Date.now():void 0);const y=(0,it.I4)((()=>{h("")}),[]),b=(0,it.I4)((e=>{void 0===d?(h(""),(0,ze.so)(e).then(n,(()=>{o(),h(u("lng_passcode_wrong"))}))):h(u("FloodWait"))}),[u,d]);(0,it.d4)((()=>{void 0!==d?h(u("FloodWait")):0===c&&h("")}),[d,u,c]);const P=(0,it.I4)((()=>{v(),i({forceInitApi:!0})}),[v,i]);if(w)return it.ZP.createElement("div",{className:"sY59IPNwkaRsrfYPhEJc"},it.ZP.createElement("div",{className:"DlErQEIDwmZ0duQgO_2b",dir:u.isRtl?"rtl":void 0},it.ZP.createElement(nc.Z,{tgsUrl:ac.l.Lock,previewUrl:rc,size:160,className:"ar9YdQbWJreREHmnZa9m"}),it.ZP.createElement(ic.Z,{key:"password-form",shouldShowSubmit:!0,shouldDisablePasswordManager:!0,isLoading:l,error:m,placeholder:u("Passcode.EnterPasscodePlaceholder"),submitLabel:u("Next"),clearError:y,isPasswordVisible:p,noRipple:!0,onChangePasswordVisibility:g,onSubmit:b}),it.ZP.createElement("div",{className:"uOmdTQr_cJEvuTkQipx7"},it.ZP.createElement("p",null,it.ZP.createElement(oc.Z,{onClick:I},"Log out")," ","if you don't remember your passcode."),it.ZP.createElement("p",null,it.ZP.createElement(Jt.Z,{color:"translucent",size:"tiny",isText:!0,onClick:I},u("AccountSettings.Logout"))))),it.ZP.createElement(uo.Z,{isOpen:f,onClose:v,text:u("lng_sure_logout"),confirmLabel:u("AccountSettings.Logout"),confirmHandler:P,confirmIsDestructive:!0}))})));n.eMD&&console.log(">>> FINISH LOAD MAIN BUNDLE");const{passcode:{isScreenLocked:dc},connectionState:lc}=(0,a.Rd)();lc||dc||i.Eo||(0,a.Sv)().initApi()}}]);
|
||
//# sourceMappingURL=5769.43e49e3461845248be35.js.map
|