TelegramPWA/dist/8422.dbc32fb5a56c599828a2.js
Alexander Zinchuk f8cb0f526a [Build]
2024-04-19 13:52:38 +04:00

2 lines
47 KiB
JavaScript

"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[8422],{27225:(t,e,a)=>{a.d(e,{Co:()=>B,X9:()=>Z,ft:()=>S});var s=a(59187),i=a(91713),d=a(83716),o=a(53551),n=a(51190),r=a(65054),c=a(16974),l=a(60782),h=a(59692),u=a(490),I=a(69118),p=a(18629),g=a(92387),f=a(41765),V=a(33555),b=a(11302),w=a(78958),C=a(44271),m=a(7054),R=a(42431),y=a(9211);const v={id:d.awM,accessHash:"0",type:"userTypeRegular",isMin:!0,phoneNumber:""},A=new Set(["FILTERS_TOO_MUCH","CHATLISTS_TOO_MUCH","INVITES_TOO_MUCH"]),M=(0,I.P2)((t=>t()),3e3,!0),P=(0,I.Ds)((t=>t()),500,!1,!0);function F(t,e){(0,g.t9)("abortChatRequests",{chatId:t,threadId:e})}function T(t,e,a,...[s=(0,r._w)()]){const i=(0,m.Btg)(t,s),d=i?.chatId,o=i?.threadId;if(d&&(d!==e||o!==a)){const[a,i]=Object.values(t.byTabId).reduce((([e,a],{id:i})=>{if(i===s||e&&a)return[e,a];const n=(0,m.Btg)(t,i),r=n?.chatId===d;return[e||r,a||r&&n?.threadId===o]}),[d===e,!1]);(!a||!i)&&F(d,a?o:void 0)}}async function _(t,e,a,i=!1,o){let n=(0,V.Rd)(),r=(0,m.VFo)(n)?.id;const h="saved"===t?await(0,g.t9)("fetchSavedChats",{limit:d.Ov0,offsetDate:a,withPinned:i}):await(0,g.t9)("fetchChats",{limit:d.Ov0,offsetDate:a,archived:"archived"===t,withPinned:i,lastLocalServiceMessageId:r});if(!h)return;const{chatIds:u}=h;if(u.length>0&&u[0]===e&&u.shift(),n=(0,V.Rd)(),r=(0,m.VFo)(n)?.id,i)if("active"===t){if(!u.includes(d.awM)){const t=await(0,g.t9)("fetchChat",{type:"user",user:v});n=(0,V.Rd)();const e=t&&(0,m.Z1J)(n,t.chatId);e&&(u.unshift(e.id),h.chats.unshift(e),r&&(h.lastMessageByChatId[e.id]=r))}const e=Object.values(n.byTabId),a=(0,c.gO)(d.WSp)?.slice(0,d.Y2k).map((t=>(0,m.Z1J)(n,t))).filter(Boolean),s=e.flatMap((({id:t})=>{const e=(0,m.jrE)(n,t);return e?[e]:[]})).concat(a||[]),i=e.flatMap((({id:t})=>(0,m.P2Q)(n,t)||[]));n.currentUserId&&n.users.byId[n.currentUserId]&&i.push(n.users.byId[n.currentUserId]),n=(0,b.s5)(n,(0,l.ee)(i.concat(h.users),"id")),n=(0,b.ps)(n,h.userStatusesById),n=(0,b.SL)(n,(0,l.ee)(s.concat(h.chats),"id")),n=(0,b.Mg)(n,t,u)}else n=(0,b.Sh)(n,(0,l.ee)(h.users,"id")),n=(0,b.zn)(n,h.userStatusesById),n=(0,b.GL)(n,(0,l.ee)(h.chats,"id")),n=(0,b.Mg)(n,t,u);else{const e=(0,l.ee)(h.chats,"id");n=(0,b.Sh)(n,(0,l.ee)(h.users,"id")),n=(0,b.zn)(n,h.userStatusesById),n=(0,b.GL)(n,e),n=(0,b.B1)(n,t,u)}n=(0,b.vv)(n,t,h),n=(0,b.m6)(n,h.messages),n=(0,b.fr)(n,h.lastMessageByChatId,t),(o?h.chatIds:Object.keys(h.draftsById)).forEach((t=>{const e=h.draftsById[t],a=(0,m.cii)(n,t,s._f);(e||a)&&((0,m.Mst)(n,t,s._f)?.isLocal||(n=(0,b.pf)(n,t,s._f,"draft",e)))})),0!==u.length&&u.length!==h.totalChatCount||n.chats.isFullyLoaded[t]||(n={...n,chats:{...n.chats,isFullyLoaded:{...n.chats.isFullyLoaded,[t]:!0}}}),(0,V.R3)(n)}async function S(t,e,a,...[s=(0,r._w)()]){const i=await(0,g.t9)("fetchFullChat",a);if(!i)return;const{chats:d,users:o,userStatusesById:n,fullInfo:c,groupCall:h,membersCount:u,isForumAsMessages:I}=i;if(t=(0,V.Rd)(),t=(0,b.Sh)(t,(0,l.ee)(o,"id")),t=(0,b.GL)(t,(0,l.ee)(d,"id")),n&&(t=(0,b.zn)(t,n)),h){const e=(0,R.$5)(t,h.id);t=(0,w.AH)(t,h.id,(0,l.CE)(h,["connectionState","isLoaded"]),void 0,e?void 0:h.participantsCount)}void 0!==u&&(t=(0,b.a4)(t,a.id,{membersCount:u})),a.isForum&&(t=(0,b.a4)(t,a.id,{isForumAsMessages:I})),t=(0,b.FK)(t,a.id,c),(0,V.R3)(t);const p=c.stickerSet,f=p&&(0,m.Ny0)(t,p);p&&!f&&e.loadStickers({stickerSetInfo:{id:p.id,accessHash:p.accessHash},tabId:s});const C=c.emojiSet,y=C&&(0,m.Ny0)(t,C);return C&&!y&&e.loadStickers({stickerSetInfo:{id:C.id,accessHash:C.accessHash},tabId:s}),i}async function B(t,e){t=(0,V.Rd)();const a=(0,m.DIA)(t,e);if(a&&!a.isMin)return a;const{chat:s,user:i}=await(0,g.t9)("getChatByUsername",e)||{};return s?(t=(0,V.Rd)(),t=(0,b.a4)(t,s.id,s),i&&(t=(0,b.Nq)(t,i.id,i)),(0,V.R3)(t),s):void 0}async function H(t,e,a,...[s=(0,r._w)()]){const i=await B(t,a);if(!i)return;t=(0,V.Rd)();const d=(0,m.dyD)(t,i.id);if(!d)return;if(!(0,f.cS)(d))return;const o=await(0,g.t9)("loadAttachBot",{bot:d});if(t=(0,V.Rd)(),o)return t=(0,b.Sh)(t,(0,l.ee)(o.users,"id")),(0,V.R3)(t),o.bot;e.showNotification({message:h.Iu("WebApp.AddToAttachmentUnavailableError"),tabId:s})}async function U(t,e,a,s,i,...[d=(0,r._w)()]){t=(0,V.Rd)();const o=await H(t,e,s,d);o&&e.callAttachBot({bot:o,chatId:a,..."string"==typeof i&&{startParam:i},tabId:d})}async function Z(t,e,a,...[s=(0,r._w)()]){const i=(0,m.Z1J)(t,a);if(!i||!(0,f.G9)(i))return i;const d=await async function(t,e,a,...[s=(0,r._w)()]){try{return await(0,g.t9)("migrateChat",a)}catch(t){return void("CHANNELS_TOO_MUCH"===t.message?e.openLimitReachedModal({limit:"channels",tabId:s}):e.showDialog({data:{...t,hasErrorKey:!0},tabId:s}))}}(0,e,i,s);return d?(e.loadFullChat({chatId:d.id,tabId:s}),e.openChat({id:d.id,tabId:s}),d):void 0}(0,V.iw)("preloadTopChatMessages",(async(t,e)=>{const a=new Set;for(let i=0;i<d.ulj;i++){await(0,I.wO)(100),t=(0,V.Rd)();const i=Object.values(t.byTabId).map((({id:e})=>(0,m.Btg)(t,e)?.chatId)).filter(Boolean),o=(0,c.gO)(d.NfV),n=o?.find((t=>!i.includes(t)&&!a.has(t)));if(!n)return;a.add(n),e.loadViewportMessages({chatId:n,threadId:s._f,tabId:(0,r._w)()})}})),(0,V.iw)("openChat",((t,e,a)=>{const{id:i,type:o,noForumTopicPanel:n,shouldReplaceHistory:c,shouldReplaceLast:l,tabId:h=(0,r._w)()}=a;if(e.processOpenChatOrThread({chatId:i,type:o,threadId:s._f,noForumTopicPanel:n,shouldReplaceHistory:c,shouldReplaceLast:l,tabId:h}),T(t,i,s._f,h),!i||i===d.mzl)return;const u=(0,m.Z1J)(t,i);u?.hasUnreadMark&&e.toggleChatUnread({id:i});const I=!(0,m.xMv)(t,i);if(u)I&&!u.isMin&&e.requestChatUpdate({chatId:i});else if((0,m.FM1)(t,i))(0,g.t9)("fetchChat",{type:"self"});else{const e=(0,m.dyD)(t,i);e&&(0,g.t9)("fetchChat",{type:"user",user:e})}e.closeStoryViewer({tabId:h})})),(0,V.iw)("openSavedDialog",((t,e,a)=>{const{chatId:s,tabId:i=(0,r._w)(),...d}=a;e.openThread({chatId:t.currentUserId,threadId:s,tabId:i,...d})})),(0,V.iw)("openThread",(async(t,e,a)=>{const{type:i,isComments:d,noForumTopicPanel:o,shouldReplaceHistory:n,shouldReplaceLast:c,focusMessageId:u,tabId:I=(0,r._w)()}=a;let p,w,R,{chatId:y}=a;if(d){const{originChannelId:t,originMessageId:e}=a;w=t,R=e}else{w=a.chatId,p=a.threadId,R=p;const r=(0,m.Z1J)(t,w);if(p===s._f)return void e.openChat({id:y,type:i,noForumTopicPanel:o,shouldReplaceHistory:n,shouldReplaceLast:c,tabId:I});if(r?.isForum||y&&(0,f._o)(y,p,t.currentUserId))return void e.processOpenChatOrThread({chatId:y,type:i,threadId:p,isComments:d,noForumTopicPanel:o,shouldReplaceHistory:n,shouldReplaceLast:c,tabId:I})}const v=(0,m.Z1J)(t,w),A=(0,m.tZg)(t,w,R),M=(0,m.cii)(t,w,R);if(!v)return;if(T(t,w,R,I),y&&A?.threadId&&(d||M?.listedIds?.length&&M.listedIds.includes(Number(A.threadId))))return t=(0,C.i)(t,{loadingThread:void 0},I),(0,V.R3)(t),void e.processOpenChatOrThread({chatId:y,type:i,threadId:A.threadId,isComments:d,noForumTopicPanel:o,shouldReplaceHistory:n,shouldReplaceLast:c,tabId:I});let{loadingThread:P}=(0,m.jUK)(t,I);P&&F(P.loadingChatId,P.loadingMessageId),t=(0,C.i)(t,{loadingThread:{loadingChatId:w,loadingMessageId:Number(R)}},I),(0,V.R3)(t);const _=()=>{const t=(0,V.Rd)();d||(0,m.Btg)(t,I)?.chatId!==w||(0,m.Btg)(t,I)?.threadId!==R||e.openPreviousChat({tabId:I})};d||e.processOpenChatOrThread({chatId:y,type:i,threadId:p,tabId:I,isComments:d,noForumTopicPanel:o,shouldReplaceHistory:n,shouldReplaceLast:c});const S=await(0,g.t9)("fetchDiscussionMessage",{chat:(0,m.Z1J)(t,w),messageId:Number(R)});if(t=(0,V.Rd)(),P=(0,m.jUK)(t,I).loadingThread,P?.loadingChatId===w&&P?.loadingMessageId===R){if(!S)return t=(0,C.i)(t,{loadingThread:void 0},I),(0,V.R3)(t),e.showNotification({message:h.Iu(d?"ChannelPostDeleted":"lng_message_not_found"),tabId:I}),void _();p??(p=S.threadId),y??(y=S.chatId),y?(t=(0,V.Rd)(),t=(0,b.Sh)(t,(0,l.ee)(S.users,"id")),t=(0,b.fZ)(t,(0,l.ee)(S.chats,"id")),t=(0,b.m6)(t,S.messages),d&&(t=(0,b.Xg)(t,w,R,{threadId:p}),t=(0,b.Xg)(t,y,p,{isCommentsInfo:!1,threadId:p,chatId:y,fromChannelId:w,fromMessageId:R,...A&&(0,l.ei)(A,["messagesCount","lastMessageId","lastReadInboxMessageId","recentReplierIds"])})),t=(0,b.sN)(t,y,p,{firstMessageId:S.firstMessageId}),(0,V.R3)(t),u&&e.focusMessage({chatId:y,threadId:p,messageId:u,tabId:I}),e.loadViewportMessages({chatId:y,threadId:p,tabId:I,onError:()=>{t=(0,V.Rd)(),t=(0,C.i)(t,{loadingThread:void 0},I),(0,V.R3)(t),e.showNotification({message:h.Iu("Group.ErrorAccessDenied"),tabId:I})},onLoaded:()=>{t=(0,V.Rd)(),P=(0,m.jUK)(t,I).loadingThread,P?.loadingChatId===w&&P?.loadingMessageId===R&&(t=(0,C.i)(t,{loadingThread:void 0},I),(0,V.R3)(t),e.processOpenChatOrThread({chatId:y,type:i,threadId:p,tabId:I,isComments:d,noForumTopicPanel:o,shouldReplaceHistory:n,shouldReplaceLast:c}))}})):_()}else _()})),(0,V.iw)("openLinkedChat",(async(t,e,a)=>{const{id:s,tabId:i=(0,r._w)()}=a,d=(0,m.Z1J)(t,s);if(!d)return;const o=await(0,g.t9)("fetchFullChat",d);o?.fullInfo?.linkedChatId&&e.openChat({id:o.fullInfo.linkedChatId,tabId:i})})),(0,V.iw)("openSupportChat",(async(t,e,a)=>{const{tabId:s=(0,r._w)()}=a||{},i=(0,m.P_p)(t);if(i)return void e.openChat({id:i.id,shouldReplaceHistory:!0,tabId:s});e.openChat({id:d.mzl,shouldReplaceHistory:!0,tabId:s});const o=await(0,g.t9)("fetchChat",{type:"support"});o&&e.openChat({id:o.chatId,shouldReplaceHistory:!0,tabId:s})})),(0,V.iw)("loadAllChats",(async(t,e,a)=>{const s=a.listType,{onReplace:i}=a;let{shouldReplace:o}=a,n=0;const r=e=>(0,m._If)(t,e.id,"saved"===s?"saved":"all")?.date||e.creationDate;for(;o||!t.chats.isFullyLoaded[s];){if(n++>=100)return void(d.eMD&&console.error("`actions/loadAllChats`: Infinite loop detected"));if("connectionStateReady"!==(t=(0,V.Rd)()).connectionState||"authorizationStateReady"!==t.authState)return;const e=!o&&t.chats.listIds[s],a=e?e.map((e=>t.chats.byId[e])).filter((e=>Boolean(e&&r(e))&&e.id!==d.awM&&!(0,m.epB)(t,e.id))).sort(((t,e)=>r(t)-r(e)))[0]:void 0;await _(s,a?.id,a?r(a):void 0,o,!0),o&&(i?.(),o=!1),t=(0,V.Rd)()}})),(0,V.iw)("loadFullChat",((t,e,a)=>{const{chatId:s,force:i,tabId:d=(0,r._w)(),withPhotos:o}=a,n=(0,m.Z1J)(t,s);if(!n)return;const c=async()=>{await S(t,e,n,d),o&&e.loadProfilePhotos({profileId:s})};i?c():P(c)})),(0,V.iw)("loadTopChats",(()=>{M((()=>{_("active"),_("archived")}))})),(0,V.iw)("requestChatUpdate",((t,e,a)=>{const{chatId:s}=a,i=(0,m.Z1J)(t,s);i&&(0,g.t9)("requestChatUpdate",{chat:i,...s===d.awM&&{lastLocalMessage:(0,m.VFo)(t)?.message}})})),(0,V.iw)("requestSavedDialogUpdate",(async(t,e,a)=>{const{chatId:s}=a,i=(0,m.Z1J)(t,s);if(!i)return;const d=await(0,g.t9)("fetchMessages",{chat:i,isSavedDialog:!0,limit:1});d&&(t=(0,V.Rd)(),t=(0,b.m6)(t,d.messages),t=(0,b.Sh)(t,(0,l.ee)(d.users,"id")),t=(0,b.fZ)(t,(0,l.ee)(d.chats,"id")),d.messages.length?(t=(0,b._l)(t,s,d.messages[0].id,"saved"),t=(0,b.B1)(t,"saved",[s]),(0,V.R3)(t)):(t=(0,b.kq)(t,s,"saved"),(0,V.R3)(t),Object.values(t.byTabId).forEach((({id:a})=>{const i=(0,m.Btg)(t,a);if(!i)return;const{chatId:d,threadId:o}=i;(0,m.FM1)(t,d)&&o===s&&e.openChat({id:void 0,tabId:a})}))))})),(0,V.iw)("updateChatMutedState",((t,e,a)=>{const{chatId:s,muteUntil:i=0}=a,d=(0,m.Z1J)(t,s);if(!d)return;const o=a.isMuted??i>0;t=(0,b.a4)(t,s,{isMuted:o}),(0,V.R3)(t),(0,g.t9)("updateChatMutedState",{chat:d,isMuted:o,muteUntil:i})})),(0,V.iw)("updateTopicMutedState",((t,e,a)=>{const{chatId:s,topicId:i,muteUntil:d=0}=a,o=(0,m.Z1J)(t,s);if(!o)return;const n=a.isMuted??d>0;t=(0,b.Cn)(t,s,i,{isMuted:n}),(0,V.R3)(t),(0,g.t9)("updateTopicMutedState",{chat:o,topicId:i,isMuted:n,muteUntil:d})})),(0,V.iw)("createChannel",(async(t,e,a)=>{const{title:s,about:d,photo:o,memberIds:n,tabId:c=(0,r._w)()}=a,l=n.map((e=>(0,m.dyD)(t,e))).filter(Boolean);let h,u;t=(0,C.i)(t,{chatCreation:{progress:i.Nh.InProgress}},c),(0,V.R3)(t);try{const t=await(0,g.t9)("createChannel",{title:s,about:d,users:l});h=t?.channel,u=t?.missingUsers}catch(a){t=(0,V.Rd)(),t=(0,C.i)(t,{chatCreation:{progress:i.Nh.Error}},c),(0,V.R3)(t),"CHANNELS_TOO_MUCH"===a.message?e.openLimitReachedModal({limit:"channels",tabId:c}):e.showDialog({data:{...a,hasErrorKey:!0},tabId:c})}if(!h)return;const{id:I,accessHash:p}=h;t=(0,V.Rd)(),t=(0,b.a4)(t,I,h),t=(0,C.i)(t,{chatCreation:{...(0,m.jUK)(t,c).chatCreation,progress:h?i.Nh.Complete:i.Nh.Error}},c),(0,V.R3)(t),e.openChat({id:I,shouldReplaceHistory:!0,tabId:c}),u&&(t=(0,V.Rd)(),t=(0,b.zo)(t,I,u,c),(0,V.R3)(t)),I&&p&&o&&await(0,g.t9)("editChatPhoto",{chatId:I,accessHash:p,photo:o})})),(0,V.iw)("joinChannel",(async(t,e,a)=>{const{chatId:s,tabId:i=(0,r._w)()}=a,d=(0,m.Z1J)(t,s);if(!d)return;const{id:o,accessHash:n}=d;if(o&&n)try{await(0,g.t9)("joinChannel",{channelId:o,accessHash:n})}catch(t){"CHANNELS_TOO_MUCH"===t.message?e.openLimitReachedModal({limit:"channels",tabId:i}):e.showDialog({data:{...t,hasErrorKey:!0},tabId:i})}})),(0,V.iw)("deleteChatUser",((t,e,a)=>{const{chatId:s,userId:i,tabId:d=(0,r._w)()}=a,o=(0,m.Z1J)(t,s),n=(0,m.dyD)(t,i);o&&n&&(t=(0,b.Dd)(t,s),(0,V.R3)(t),(0,m.Btg)(t,d)?.chatId===s&&e.openChat({id:void 0,tabId:d}),(0,g.t9)("deleteChatUser",{chat:o,user:n}))})),(0,V.iw)("deleteChat",((t,e,a)=>{const{chatId:s,tabId:i=(0,r._w)()}=a,d=(0,m.Z1J)(t,s);d&&(t=(0,b.Dd)(t,s),(0,V.R3)(t),(0,m.Btg)(t,i)?.chatId===s&&e.openChat({id:void 0,tabId:i}),(0,g.t9)("deleteChat",{chatId:d.id}))})),(0,V.iw)("leaveChannel",(async(t,e,a)=>{const{chatId:s,tabId:i=(0,r._w)()}=a,d=(0,m.Z1J)(t,s);if(!d)return;t=(0,b.Dd)(t,s),(0,V.R3)(t),(0,m.Btg)(t,i)?.chatId===s&&e.openChat({id:void 0,tabId:i});const{id:o,accessHash:n}=d;if(o&&n){await(0,g.t9)("leaveChannel",{channelId:o,accessHash:n}),t=(0,V.Rd)();const e=(0,m.Zwk)(t,s),a=Object.keys(e).map(Number).filter(u.AJ);t=(0,b.K4)(t,s,a),(0,V.R3)(t)}})),(0,V.iw)("deleteChannel",((t,e,a)=>{const{chatId:s,tabId:i=(0,r._w)()}=a,d=(0,m.Z1J)(t,s);if(!d)return;t=(0,b.Dd)(t,s),(0,V.R3)(t),(0,m.Btg)(t,i)?.chatId===s&&e.openChat({id:void 0,tabId:i});const{id:o,accessHash:n}=d;o&&n&&(0,g.t9)("deleteChannel",{channelId:o,accessHash:n})})),(0,V.iw)("createGroupChat",(async(t,e,a)=>{const{title:s,memberIds:d,photo:o,tabId:n=(0,r._w)()}=a,c=d.map((e=>(0,m.dyD)(t,e))).filter(Boolean);t=(0,C.i)(t,{chatCreation:{progress:i.Nh.InProgress}},n),(0,V.R3)(t);try{const{chat:a,missingUsers:d}=await(0,g.t9)("createGroupChat",{title:s,users:c})??{};if(!a)return;const{id:r}=a;t=(0,V.Rd)(),t=(0,b.a4)(t,r,a),t=(0,C.i)(t,{chatCreation:{...(0,m.jUK)(t,n).chatCreation,progress:a?i.Nh.Complete:i.Nh.Error}},n),(0,V.R3)(t),e.openChat({id:r,shouldReplaceHistory:!0,tabId:n}),d&&(t=(0,V.Rd)(),t=(0,b.zo)(t,r,d,n),(0,V.R3)(t)),r&&o&&await(0,g.t9)("editChatPhoto",{chatId:r,photo:o})}catch(e){"USERS_TOO_FEW"===e.message&&(t=(0,V.Rd)(),t=(0,C.i)(t,{chatCreation:{...(0,m.jUK)(t,n).chatCreation,progress:i.Nh.Error,error:"CreateGroupError"}},n),(0,V.R3)(t))}})),(0,V.iw)("toggleChatPinned",((t,e,a)=>{const{id:s,folderId:i,tabId:o=(0,r._w)()}=a,n=(0,m.Z1J)(t,s);if(!n)return;const c=(0,y.M)(t,"dialogFolderPinned");if(i){const e=(0,m.MwT)(t,i);if(e){const a=!(0,m.epB)(t,s,i),{pinnedChatIds:d,includedChatIds:o}=e,n=a?[s,...d||[]]:(d||[]).filter((t=>t!==s)),r=[s,...o];(0,g.t9)("editChatFolder",{id:i,folderUpdate:{...e,pinnedChatIds:n,includedChatIds:r}})}}else{const a=(0,m.EkO)(t,s),i=(0,m.epB)(t,s,"archived"===a?d.WSp:void 0),r=t.chats.orderedPinnedIds["archived"===a?"archived":"active"];if((r?.length||0)>=c&&!i)return void e.openLimitReachedModal({limit:"dialogFolderPinned",tabId:o});(0,g.t9)("toggleChatPinned",{chat:n,shouldBePinned:!i})}})),(0,V.iw)("toggleChatArchived",((t,e,a)=>{const{id:s}=a,i=(0,m.Z1J)(t,s);i&&(0,g.t9)("toggleChatArchived",{chat:i,folderId:(0,f.pE)(i)?0:d.WSp})})),(0,V.iw)("toggleSavedDialogPinned",((t,e,a)=>{const{id:s,tabId:i=(0,r._w)()}=a,o=(0,m.Z1J)(t,s);if(!o)return;const n=(0,y.M)(t,"savedDialogsPinned"),c=(0,m.epB)(t,s,d.aV7),l=t.chats.orderedPinnedIds.saved;(l?.length||0)>=n&&!c?e.openLimitReachedModal({limit:"savedDialogsPinned",tabId:i}):(0,g.t9)("toggleSavedDialogPinned",{chat:o,shouldBePinned:!c})})),(0,V.iw)("loadChatFolders",(async t=>{const e=await(0,g.t9)("fetchChatFolders");e&&(t=(0,V.Rd)(),t={...t,chatFolders:{...t.chatFolders,...e}},(0,V.R3)(t))})),(0,V.iw)("loadRecommendedChatFolders",(async t=>{const e=await(0,g.t9)("fetchRecommendedChatFolders");e&&(t=(0,V.Rd)(),t={...t,chatFolders:{...t.chatFolders,recommended:e}},(0,V.R3)(t))})),(0,V.iw)("editChatFolders",((t,e,a)=>{const{chatId:s,idsToRemove:i,idsToAdd:d,tabId:o=(0,r._w)()}=a,n=(0,y.M)(t,"dialogFiltersChats");d.some((e=>(0,m.MwT)(t,e).includedChatIds.length>=n))?e.openLimitReachedModal({limit:"dialogFiltersChats",tabId:o}):(i.forEach((async e=>{const a=(0,m.MwT)(t,e);a&&await(0,g.t9)("editChatFolder",{id:e,folderUpdate:{...a,pinnedChatIds:a.pinnedChatIds?.filter((t=>t!==s)),includedChatIds:a.includedChatIds.filter((t=>t!==s))}})})),d.forEach((async e=>{const a=(0,m.MwT)(t,e);a&&await(0,g.t9)("editChatFolder",{id:e,folderUpdate:{...a,includedChatIds:a.includedChatIds.concat(s)}})})))})),(0,V.iw)("editChatFolder",((t,e,a)=>{const{id:s,folderUpdate:i}=a,d=(0,m.MwT)(t,s);d&&(0,g.t9)("editChatFolder",{id:s,folderUpdate:{id:s,emoticon:d.emoticon,pinnedChatIds:d.pinnedChatIds,...i}})})),(0,V.iw)("addChatFolder",(async(t,e,a)=>{const{folder:s,tabId:i=(0,r._w)()}=a,{orderedIds:o,byId:n}=t.chatFolders,c=(0,y.M)(t,"dialogFilters");if(Object.keys(n).length>=c)return void e.openLimitReachedModal({limit:"dialogFilters",tabId:i});const l=Math.max(...o||[],d.WSp),{id:h,description:u,...I}=s,p=l+1,f={id:p,...I};if(await(0,g.t9)("editChatFolder",{id:p,folderUpdate:f}),e.apiUpdate({"@type":"updateChatFolder",id:p,folder:f}),e.requestNextSettingsScreen({foldersAction:{type:"setFolderId",payload:l+1},tabId:i}),!u)return;t=(0,V.Rd)();const{recommended:b}=t.chatFolders;b&&(t={...t,chatFolders:{...t.chatFolders,recommended:b.filter((({id:t})=>t!==h))}},(0,V.R3)(t))})),(0,V.iw)("sortChatFolders",(async(t,e,a)=>{const{folderIds:s}=a;await(0,g.t9)("sortChatFolders",s)&&(t=(0,V.Rd)(),t={...t,chatFolders:{...t.chatFolders,orderedIds:s}},(0,V.R3)(t))})),(0,V.iw)("deleteChatFolder",(async(t,e,a)=>{const{id:s}=a;(0,m.MwT)(t,s)&&await(0,g.t9)("deleteChatFolder",s)})),(0,V.iw)("toggleChatUnread",((t,e,a)=>{const{id:i}=a,d=(0,m.Z1J)(t,i);d&&(d.unreadCount?(0,g.t9)("markMessageListRead",{chat:d,threadId:s._f}):(0,g.t9)("toggleDialogUnread",{chat:d,hasUnreadMark:!d.hasUnreadMark}))})),(0,V.iw)("markTopicRead",((t,e,a)=>{const{chatId:s,topicId:i}=a,d=(0,m.Z1J)(t,s);if(!d)return;const o=d.topics?.[i]?.lastMessageId;o&&((0,g.t9)("markMessageListRead",{chat:d,threadId:i,maxId:o}),t=(0,V.Rd)(),t=(0,b.Cn)(t,s,i,{unreadCount:0}),t=(0,b.Xg)(t,s,i,{lastReadInboxMessageId:o}),(0,V.R3)(t))})),(0,V.iw)("openChatByInvite",(async(t,e,a)=>{const{hash:s,tabId:i=(0,r._w)()}=a,d=await(0,g.t9)("openChatByInvite",s);d&&e.openChat({id:d.chatId,tabId:i})})),(0,V.iw)("openChatByPhoneNumber",(async(t,e,a)=>{const{phoneNumber:s,startAttach:i,attach:o,text:n,tabId:c=(0,r._w)()}=a;e.openChat({id:d.mzl,tabId:c});const l=await async function(t,e){t=(0,V.Rd)();const a=(0,m.Bki)(t,e);if(a&&!a.isMin)return(0,m.Z1J)(t,a.id);const{chat:s,user:i}=await(0,g.t9)("getChatByPhoneNumber",e)||{};return s?(t=(0,V.Rd)(),t=(0,b.a4)(t,s.id,s),i&&(t=(0,b.Nq)(t,i.id,i)),(0,V.R3)(t),s):void 0}(t,s);if(!l)return e.openPreviousChat({tabId:c}),void e.showNotification({message:h.Iu("lng_username_by_phone_not_found").replace("{phone}",s),tabId:c});n?e.openChatWithDraft({chatId:l.id,text:{text:n},tabId:c}):e.openChat({id:l.id,tabId:c}),o&&U(t=(0,V.Rd)(),e,l.id,o,i,c)})),(0,V.iw)("openTelegramLink",((t,e,a)=>{const{url:s,tabId:i=(0,r._w)()}=a,{openChatByPhoneNumber:c,openChatByInvite:l,openStickerSet:h,openChatWithDraft:u,joinVoiceChatByLink:I,focusMessage:p,openInvoice:g,processAttachBotParameters:V,checkChatlistInvite:b,openChatByUsername:w,openStoryViewerByUsername:C,processBoostParameters:m,checkGiftCode:R}=e;if((0,n.I)(s)&&((0,o.ou)(s)||s.match(d.g$l)))return;const y=new URL(s.toLowerCase().startsWith("http")?s:`https://${s}`);if(d.LBg.has(y.hostname)&&"/"===y.pathname)return void window.open(y.toString(),"_blank","noopener");const v=(d.LBg.has(y.hostname)?"t.me":y.hostname).split(".");if(v.length>3)return;const A=3===v.length?`${v[0]}/${y.pathname}`:y.pathname,[M,P,F]=A.split("/").filter(Boolean).map((t=>decodeURI(t))),T=Object.fromEntries(y.searchParams);let _;"joinchat"===M&&(_=P);const S=T.hasOwnProperty("startattach"),B=T.hasOwnProperty("startapp"),H=(0,o.GX)(T.choose),U="s"===P&&(Number(F)||void 0),Z=T.hasOwnProperty("boost");if(M.match(/^\+([0-9]+)(\?|$)/))return void c({phoneNumber:M.substr(1,M.length-1),startAttach:T.startattach,attach:T.attach,text:T.text,tabId:i});if(U)return void C({username:M,storyId:U,tabId:i});if((M.startsWith(" ")||M.startsWith("+"))&&(_=M.substr(1,M.length-1)),_)return void l({hash:_,tabId:i});if("addstickers"===M||"addemoji"===M)return void h({stickerSetInfo:{shortName:P},tabId:i});if("share"===M)return void u({text:(0,o.QH)(T.url,T.text),tabId:i});if("addlist"===M)return void b({slug:P,tabId:i});if("giftcode"===M)return void R({slug:P,tabId:i});const L=P||void 0,D=F?Number(F):void 0,E=T.comment?Number(T.comment):void 0;if(T.hasOwnProperty("voicechat")||T.hasOwnProperty("livestream"))I({username:M,inviteHash:T.voicechat||T.livestream,tabId:i});else if("boost"===M){const t=P,e=T.c;m({usernameOrId:t||e,isPrivate:!t&&Boolean(e),tabId:i})}else Z?m({usernameOrId:L||M,isPrivate:"c"===M&&Boolean(L),tabId:i}):"c"===M&&L&&D?p({chatId:(0,f.Yg)(L),messageId:D,tabId:i}):M.startsWith("$")?g({type:"slug",slug:M.substring(1),tabId:i}):"invoice"===M?g({type:"slug",slug:P,tabId:i}):S&&H||!P&&B?V({username:M,filter:H,startParam:T.startattach||T.startapp,tabId:i}):w({username:M,messageId:D||Number(L),threadId:D?Number(L):void 0,commentId:E,startParam:T.start,startAttach:T.startattach,attach:T.attach,startApp:T.startapp,originalParts:[M,P,F],tabId:i})})),(0,V.iw)("processBoostParameters",(async(t,e,a)=>{const{usernameOrId:s,isPrivate:i,tabId:d=(0,r._w)()}=a;let o;if(i){const a=(0,f.Yg)(s);if(o=(0,m.Z1J)(t,a),!o)return void e.showNotification({message:"Chat does not exist",tabId:d})}else if(o=await B(t,s),!o)return void e.showNotification({message:"User does not exist",tabId:d});(0,f.eA)(o)||(0,f.ZV)(o)?e.openBoostModal({chatId:o.id,tabId:d}):e.openChat({id:o.id,tabId:d})})),(0,V.iw)("acceptInviteConfirmation",(async(t,e,a)=>{const{hash:s,tabId:i=(0,r._w)()}=a,d=await(0,g.t9)("importChatInvite",{hash:s});d&&e.openChat({id:d.id,tabId:i})})),(0,V.iw)("openChatByUsername",(async(t,e,a)=>{const{username:i,messageId:o,commentId:n,startParam:c,startAttach:l,attach:h,threadId:u,originalParts:I,startApp:g,text:f,tabId:b=(0,r._w)()}=a,w=(0,m.jrE)(t,b),C=I?.[1],R=C&&!Number(C)&&!I?.[2];if(!n){if(void 0===l&&o&&!c&&w?.usernames?.some((t=>t.username===i)))return void e.focusMessage({chatId:w.id,threadId:u,messageId:o,tabId:b});if(!R)return void await async function(t,e,a,...[i=(0,r._w)()]){const{username:o,threadId:n,channelPostId:c,startParam:l,startAttach:h,attach:u,text:I}=a;t=(0,V.Rd)();const p=(0,m.jrE)(t,i);if(void 0!==h&&!u){const a=await H(t,e,o,i);if(!p||!a)return;return void e.callAttachBot({bot:a,chatId:p.id,startParam:h,tabId:i})}const g=p?.usernames?.some((t=>t.username===o));g||e.openChat({id:d.mzl,tabId:i});const f=await B(t,o);f?(c?e.focusMessage({chatId:f.id,threadId:n,messageId:c,tabId:i}):g||e.openThread({chatId:f.id,threadId:n??s._f,tabId:i}),l&&e.startBot({botId:f.id,param:l}),u&&U(t=(0,V.Rd)(),e,f.id,u,h,i),I&&e.openChatWithDraft({chatId:f.id,text:{text:I},tabId:i})):g||(e.openPreviousChat({tabId:i}),e.showNotification({message:"User does not exist",tabId:i}))}(t,e,{username:i,threadId:u,channelPostId:o,startParam:c,startAttach:l,attach:h,text:f},b)}const y=(0,m.DIA)(t,i);if(n&&o&&y)return void e.openThread({isComments:!0,originChannelId:y.id,originMessageId:o,tabId:b,focusMessageId:n});R||e.openChat({id:d.mzl,tabId:b});const v=await B(t,i);if(v)if(R&&v){const t=(0,p.BS)();e.requestAppWebView({appName:C,botId:v.id,tabId:b,startApp:g,theme:t})}else o&&e.openThread({isComments:!0,originChannelId:v.id,originMessageId:o,tabId:b,focusMessageId:n})})),(0,V.iw)("togglePreHistoryHidden",(async(t,e,a)=>{const{chatId:s,isEnabled:i,tabId:d=(0,r._w)()}=a,o=await Z(t,e,s,d);o&&(t=(0,V.Rd)(),t=(0,b.US)(t,o.id,{isPreHistoryHidden:i}),(0,V.R3)(t),(0,g.t9)("togglePreHistoryHidden",{chat:o,isEnabled:i}))})),(0,V.iw)("updateChatDefaultBannedRights",((t,e,a)=>{const{chatId:s,bannedRights:i}=a,d=(0,m.Z1J)(t,s);d&&(0,g.t9)("updateChatDefaultBannedRights",{chat:d,bannedRights:i})})),(0,V.iw)("updateChatMemberBannedRights",(async(t,e,a)=>{const{chatId:s,userId:i,bannedRights:d,tabId:o=(0,r._w)()}=a,n=(0,m.dyD)(t,i);if(!n)return;const c=await Z(t,e,s,o);if(!c)return;await(0,g.t9)("updateChatMemberBannedRights",{chat:c,user:n,bannedRights:d}),t=(0,V.Rd)();const l=(0,m.x67)(t,c.id);if(!l)return;const{members:h,kickedMembers:u}=l,I=Boolean(d.viewMessages),p=!Object.keys(d).length;t=(0,b.US)(t,c.id,{...h&&I&&{members:h.filter((t=>t.userId!==i))},...h&&!I&&{members:h.map((t=>t.userId===i?{...t,bannedRights:d}:t))},...p&&u&&{kickedMembers:u.filter((t=>t.userId!==i))}}),(0,V.R3)(t)})),(0,V.iw)("updateChatAdmin",(async(t,e,a)=>{const{chatId:s,userId:i,adminRights:d,customTitle:o,tabId:n=(0,r._w)()}=a,c=(0,m.dyD)(t,i);if(!c)return;const l=await Z(t,e,s,n);if(!l)return;await(0,g.t9)("updateChatAdmin",{chat:l,user:c,adminRights:d,customTitle:o});const h=await(0,g.t9)("fetchFullChat",l);if(!h?.fullInfo)return;const{adminMembersById:u}=h.fullInfo,I=!Object.keys(d).length;let p;if(u)if(I){const{[i]:t,...e}=u;p=e}else p={...u,[i]:{...u[i],adminRights:d,customTitle:o}};p&&(t=(0,V.Rd)(),t=(0,b.US)(t,l.id,{adminMembersById:p}),(0,V.R3)(t))})),(0,V.iw)("updateChat",(async(t,e,a)=>{const{chatId:s,title:d,about:o,photo:n,tabId:c=(0,r._w)()}=a,l=(0,m.Z1J)(t,s),h=(0,m.x67)(t,s);l&&(t=(0,V.Rd)(),t=(0,b.H9)(t,i.wv.InProgress,c),(0,V.R3)(t),await Promise.all([l.title!==d?(0,g.t9)("updateChatTitle",l,d):void 0,h?.about!==o?(0,g.t9)("updateChatAbout",l,o):void 0,n?(0,g.t9)("editChatPhoto",{chatId:s,accessHash:l.accessHash,photo:n}):void 0]),t=(0,V.Rd)(),t=(0,b.H9)(t,i.wv.Complete,c),(0,V.R3)(t),n&&e.loadFullChat({chatId:s,tabId:c,withPhotos:!0}))})),(0,V.iw)("updateChatPhoto",(async(t,e,a)=>{const{photo:s,chatId:i,tabId:d=(0,r._w)()}=a,o=(0,m.Z1J)(t,i);o&&(t=(0,b.a4)(t,i,{avatarHash:void 0}),t=(0,b.US)(t,i,{profilePhoto:void 0}),(0,V.R3)(t),await(0,g.t9)("editChatPhoto",{chatId:i,accessHash:o.accessHash,photo:s}),await(0,g.t9)("deleteProfilePhotos",[s]),e.loadFullChat({chatId:i,tabId:d,withPhotos:!0}))})),(0,V.iw)("deleteChatPhoto",(async(t,e,a)=>{const{photo:s,chatId:i,tabId:d=(0,r._w)()}=a,o=(0,m.Z1J)(t,i);if(!o)return;const n=[s];if(o.avatarHash===s.id){const e=o.photos?.[1];e&&n.push(e),t=(0,b.a4)(t,i,{avatarHash:void 0}),t=(0,b.US)(t,i,{profilePhoto:void 0}),(0,V.R3)(t),await(0,g.t9)("editChatPhoto",{chatId:i,accessHash:o.accessHash,photo:e})}const{photos:c=[]}=o,l=c.filter((t=>n.some((e=>e.id!==t.id))));t=(0,V.Rd)(),t=(0,b.a4)(t,i,{photos:l}),(0,V.R3)(t),await(0,g.t9)("deleteProfilePhotos",n)&&e.loadFullChat({chatId:i,tabId:d,withPhotos:!0})})),(0,V.iw)("toggleSignatures",((t,e,a)=>{const{chatId:s,isEnabled:i}=a,d=(0,m.Z1J)(t,s);d&&(0,g.t9)("toggleSignatures",{chat:d,isEnabled:i})})),(0,V.iw)("loadGroupsForDiscussion",(async t=>{const e=await(0,g.t9)("fetchGroupsForDiscussion");if(!e)return;const a=e.reduce(((t,e)=>(e&&!e.isForum&&(t[e.id]=e),t)),{});t=(0,V.Rd)(),t=(0,b.fZ)(t,a),t={...t,chats:{...t.chats,forDiscussionIds:Object.keys(a)}},(0,V.R3)(t)})),(0,V.iw)("linkDiscussionGroup",(async(t,e,a)=>{const{channelId:s,chatId:i,tabId:d=(0,r._w)()}=a||{},o=(0,m.Z1J)(t,s);if(!o)return;const n=await Z(t,e,i,d);if(!n)return;let c=(0,m.x67)(t,n.id);if(!c){const t=await(0,g.t9)("fetchFullChat",n);if(!t)return;c=t.fullInfo}c.isPreHistoryHidden&&(t=(0,V.Rd)(),t=(0,b.US)(t,n.id,{isPreHistoryHidden:!1}),(0,V.R3)(t),await(0,g.t9)("togglePreHistoryHidden",{chat:n,isEnabled:!1})),(0,g.t9)("setDiscussionGroup",{channel:o,chat:n})})),(0,V.iw)("unlinkDiscussionGroup",(async(t,e,a)=>{const{channelId:s,tabId:i=(0,r._w)()}=a,d=(0,m.Z1J)(t,s);if(!d)return;const o=(0,m.x67)(t,s);let n;o?.linkedChatId&&(n=(0,m.Z1J)(t,o.linkedChatId)),await(0,g.t9)("setDiscussionGroup",{channel:d}),n&&S(t=(0,V.Rd)(),e,n,i)})),(0,V.iw)("setActiveChatFolder",((t,e,a)=>{const{activeChatFolder:s,tabId:i=(0,r._w)()}=a;if(!(s+1>(0,y.M)(t,"dialogFilters")))return(0,C.i)(t,{activeChatFolder:s},i);e.openLimitReachedModal({limit:"dialogFilters",tabId:i})})),(0,V.iw)("resetOpenChatWithDraft",((t,e,a)=>{const{tabId:s=(0,r._w)()}=a||{};return(0,C.i)(t,{requestedDraft:void 0},s)})),(0,V.iw)("loadMoreMembers",(async(t,e,a)=>{const{tabId:s=(0,r._w)()}=a||{},{chatId:i}=(0,m.Btg)(t,s)||{},d=i?(0,m.Z1J)(t,i):void 0;if(!d||(0,f.G9)(d))return;const o=(0,m.x67)(t,d.id)?.members?.length;if(void 0!==o&&void 0!==d.membersCount&&o>=d.membersCount)return;const n=await(0,g.t9)("fetchMembers",d.id,d.accessHash,"recent",o);if(!n)return;const{members:c,users:h,userStatusesById:u}=n;c&&c.length&&(t=(0,V.Rd)(),t=(0,b.Sh)(t,(0,l.ee)(h,"id")),t=(0,b.zn)(t,u),t=(0,b.iX)(t,d,c),(0,V.R3)(t))})),(0,V.iw)("addChatMembers",(async(t,e,a)=>{const{chatId:s,memberIds:d,tabId:o=(0,r._w)()}=a,n=(0,m.Z1J)(t,s),c=d.map((e=>(0,m.dyD)(t,e))).filter(Boolean);if(!n||!c.length)return;e.setNewChatMembersDialogState({newChatMembersProgress:i.WB.Loading,tabId:o});const l=await(0,g.t9)("addChatMembers",n,c);l&&(t=(0,V.Rd)(),t=(0,b.zo)(t,s,l,o),(0,V.R3)(t)),e.setNewChatMembersDialogState({newChatMembersProgress:i.WB.Closed,tabId:o}),S(t=(0,V.Rd)(),e,n,o)})),(0,V.iw)("deleteChatMember",(async(t,e,a)=>{const{chatId:s,userId:i,tabId:d=(0,r._w)()}=a,o=(0,m.Z1J)(t,s),n=(0,m.dyD)(t,i);o&&n&&(await(0,g.t9)("deleteChatMember",o,n),S(t=(0,V.Rd)(),e,o,d))})),(0,V.iw)("toggleIsProtected",((t,e,a)=>{const{chatId:s,isProtected:i}=a,d=(0,m.Z1J)(t,s);d&&(0,g.t9)("toggleIsProtected",{chat:d,isProtected:i})})),(0,V.iw)("setChatEnabledReactions",(async(t,e,a)=>{const{chatId:s,enabledReactions:i,tabId:d=(0,r._w)()}=a,o=(0,m.Z1J)(t,s);o&&(await(0,g.t9)("setChatEnabledReactions",{chat:o,enabledReactions:i}),S(t=(0,V.Rd)(),e,o,d))})),(0,V.iw)("fetchChat",((t,e,a)=>{const{chatId:s}=a;if(!(0,m.Z1J)(t,s))if((0,m.FM1)(t,s))(0,g.t9)("fetchChat",{type:"self"});else{const e=(0,m.dyD)(t,s);e&&(0,g.t9)("fetchChat",{type:"user",user:e})}})),(0,V.iw)("loadChatSettings",(async(t,e,a)=>{const{chatId:s}=a,i=(0,m.Z1J)(t,s);if(!i)return;const d=await(0,g.t9)("fetchChatSettings",i);if(!d)return;const{settings:o,users:n}=d;t=(0,V.Rd)(),t=(0,b.Sh)(t,(0,l.ee)(n,"id")),t=(0,b.a4)(t,i.id,{settings:o}),(0,V.R3)(t)})),(0,V.iw)("toggleJoinToSend",(async(t,e,a)=>{const{chatId:s,isEnabled:i}=a,d=(0,m.Z1J)(t,s);d&&((0,f.ZV)(d)||(0,f.eA)(d))&&await(0,g.t9)("toggleJoinToSend",d,i)})),(0,V.iw)("toggleJoinRequest",(async(t,e,a)=>{const{chatId:s,isEnabled:i}=a,d=(0,m.Z1J)(t,s);d&&((0,f.ZV)(d)||(0,f.eA)(d))&&await(0,g.t9)("toggleJoinRequest",d,i)})),(0,V.iw)("openForumPanel",((t,e,a)=>{const{chatId:s,tabId:i=(0,r._w)()}=a;return e.toggleStoryRibbon({isShown:!1,tabId:i}),e.toggleStoryRibbon({isShown:!1,isArchived:!0,tabId:i}),(0,C.i)(t,{forumPanelChatId:s},i)})),(0,V.iw)("closeForumPanel",((t,e,a)=>{const{tabId:s=(0,r._w)()}=a||{};return(0,C.i)(t,{forumPanelChatId:void 0},s)})),(0,V.iw)("processAttachBotParameters",(async(t,e,a)=>{const{username:s,filter:i,startParam:d,tabId:o=(0,r._w)()}=a,n=await H(t,e,s,o);if(!n)return;if(!Boolean(i))return void e.callAttachBot({isFromSideMenu:!0,bot:n,startParam:d,tabId:o});t=(0,V.Rd)();const{attachMenu:{bots:c}}=t;if(!c[n.id])return t=(0,C.i)(t,{requestedAttachBotInstall:{bot:n,onConfirm:{action:"requestAttachBotInChat",payload:{bot:n,filter:i,startParam:d}}}},o),void(0,V.R3)(t);e.requestAttachBotInChat({bot:n,filter:i,startParam:d,tabId:o})})),(0,V.iw)("loadTopics",(async(t,e,a)=>{const{chatId:s,force:i}=a,o=(0,m.Z1J)(t,s);if(!o)return;if(!i&&o.listedTopicIds&&o.listedTopicIds.length===o.topicsCount)return;const n=!i&&o.listedTopicIds?o.listedTopicIds.reduce(((t,e)=>{const a=o.topics?.[e],s=o.topics?.[t];return a&&(!s||a.lastMessageId<s.lastMessageId)?e:t})):void 0,{id:r,date:c,lastMessageId:h}=n&&o.topics?.[n]||{},u=await(0,g.t9)("fetchTopics",{chat:o,offsetTopicId:r,offsetId:h,offsetDate:c,limit:r?d.C1M:d.SC4});u&&(t=(0,V.Rd)(),t=(0,b.Sh)(t,(0,l.ee)(u.users,"id")),t=(0,b.fZ)(t,(0,l.ee)(u.chats,"id")),t=(0,b.m6)(t,u.messages),t=(0,b.XG)(t,s,u.count,u.topics),t=(0,b.Jr)(t,s,u.topics.map((t=>t.id))),Object.entries(u.draftsById||{}).forEach((([e,a])=>{t=(0,b.pf)(t,s,Number(e),"draft",a)})),Object.entries(u.readInboxMessageIdByTopicId||{}).forEach((([e,a])=>{t=(0,b.Xg)(t,s,Number(e),{lastReadInboxMessageId:a})})),(0,V.R3)(t))})),(0,V.iw)("loadTopicById",(async(t,e,a)=>{const{chatId:s,topicId:i}=a,d=(0,m.Z1J)(t,s);if(!d)return;const o=await(0,g.t9)("fetchTopicById",{chat:d,topicId:i});if(o)t=(0,V.Rd)(),t=(0,b.Sh)(t,(0,l.ee)(o.users,"id")),t=(0,b.fZ)(t,(0,l.ee)(o.chats,"id")),t=(0,b.m6)(t,o.messages),t=(0,b.Cn)(t,s,i,o.topic),(0,V.R3)(t);else if("tabId"in a&&a.shouldCloseChatOnError){const{tabId:t=(0,r._w)()}=a;e.openChat({id:void 0,tabId:t})}})),(0,V.iw)("toggleForum",(async(t,e,a)=>{const{chatId:s,isEnabled:i,tabId:d=(0,r._w)()}=a,o=await Z(t,e,s,d);if(!o)return;let n;try{n=await(0,g.t9)("toggleForum",{chat:o,isEnabled:i})}catch(t){t.message.startsWith("A wait of")?e.showNotification({message:h.Iu("FloodWait"),tabId:d}):e.showDialog({data:{...t,hasErrorKey:!0},tabId:d})}n&&(t=(0,V.Rd)(),t=(0,b.a4)(t,o.id,{isForum:i}),(0,V.R3)(t),i?e.openForumPanel({chatId:o.id,tabId:d}):e.closeForumPanel({tabId:d}))})),(0,V.iw)("toggleParticipantsHidden",(async(t,e,a)=>{const{chatId:s,isEnabled:i}=a,d=(0,m.Z1J)(t,s);if(!d)return;const o=(0,m.x67)(t,d.id)?.areParticipantsHidden;t=(0,b.US)(t,s,{areParticipantsHidden:i}),(0,V.R3)(t),await(0,g.t9)("toggleParticipantsHidden",{chat:d,isEnabled:i})||void 0===o||(t=(0,V.Rd)(),t=(0,b.US)(t,s,{areParticipantsHidden:o}),(0,V.R3)(t))})),(0,V.iw)("createTopic",(async(t,e,a)=>{const{chatId:s,title:i,iconColor:d,iconEmojiId:o,tabId:n=(0,r._w)()}=a,c=(0,m.Z1J)(t,s);if(!c)return;(0,m.jUK)(t,n).createTopicPanel&&(t=(0,C.i)(t,{createTopicPanel:{chatId:s,isLoading:!0}},n),(0,V.R3)(t));const l=await(0,g.t9)("createTopic",{chat:c,title:i,iconColor:d,iconEmojiId:o});l&&e.openThread({chatId:s,threadId:l,shouldReplaceHistory:!0,tabId:n}),e.closeCreateTopicPanel({tabId:n})})),(0,V.iw)("deleteTopic",(async(t,e,a)=>{const{chatId:s,topicId:i}=a,d=(0,m.Z1J)(t,s);d&&(await(0,g.t9)("deleteTopic",{chat:d,topicId:i}),t=(0,V.Rd)(),t=(0,b.BK)(t,s,i),(0,V.R3)(t))})),(0,V.iw)("editTopic",(async(t,e,a)=>{const{chatId:s,topicId:i,tabId:d=(0,r._w)(),...o}=a,n=(0,m.Z1J)(t,s),c=n?.topics?.[i];n&&c&&((0,m.jUK)(t,d).editTopicPanel&&(t=(0,C.i)(t,{editTopicPanel:{chatId:s,topicId:i,isLoading:!0}},d),(0,V.R3)(t)),await(0,g.t9)("editTopic",{chat:n,topicId:i,...o})&&(t=(0,V.Rd)(),t=(0,b.Cn)(t,s,i,o),(0,V.R3)(t),e.closeEditTopicPanel({tabId:d})))})),(0,V.iw)("toggleTopicPinned",((t,e,a)=>{const{chatId:s,topicId:i,isPinned:d,tabId:o=(0,r._w)()}=a,{topicsPinnedLimit:n}=t.appConfig||{},c=(0,m.Z1J)(t,s);c&&c.topics&&n&&(d&&Object.values(c.topics).filter((t=>t.isPinned)).length>=n?e.showNotification({message:h.Iu("LimitReachedPinnedTopics",n,"i"),tabId:o}):(0,g.t9)("togglePinnedTopic",{chat:c,topicId:i,isPinned:d}))})),(0,V.iw)("checkChatlistInvite",(async(t,e,a)=>{const{slug:s,tabId:i=(0,r._w)()}=a,d=await(0,g.t9)("checkChatlistInvite",{slug:s});d?(t=(0,V.Rd)(),t=(0,b.Sh)(t,(0,l.ee)(d.users,"id")),t=(0,b.fZ)(t,(0,l.ee)(d.chats,"id")),t=(0,C.i)(t,{chatlistModal:{invite:d.invite}},i),(0,V.R3)(t)):e.showNotification({message:h.Iu("lng_group_invite_bad_link"),tabId:i})})),(0,V.iw)("joinChatlistInvite",(async(t,e,a)=>{const{invite:s,peerIds:i,tabId:d=(0,r._w)()}=a,o=i.map((e=>(0,m.Z1J)(t,e))).filter(Boolean),n=o.filter((t=>t.isNotJoined)).length,c="folderId"in s?(0,m.MwT)(t,s.folderId):void 0,l="title"in s?s.title:c?.title;try{if(!await(0,g.t9)("joinChatlistInvite",{slug:s.slug,peers:o}))return;e.showNotification({title:h.Iu(c?"FolderLinkUpdatedTitle":"FolderLinkAddedTitle",l),message:h.Iu("FolderLinkAddedSubtitle",n,"i"),tabId:d})}catch(t){"CHATLISTS_TOO_MUCH"===t.message?e.openLimitReachedModal({limit:"chatlistJoined",tabId:d}):e.showDialog({data:{...t,hasErrorKey:!0},tabId:d})}})),(0,V.iw)("leaveChatlist",(async(t,e,a)=>{const{folderId:s,peerIds:i,tabId:d=(0,r._w)()}=a,o=(0,m.MwT)(t,s),n=i?.map((e=>(0,m.Z1J)(t,e))).filter(Boolean)||[];await(0,g.t9)("leaveChatlist",{folderId:s,peers:n})&&e.showNotification({title:h.Iu("FolderLinkDeletedTitle",o.title),message:h.Iu("FolderLinkDeletedSubtitle",n.length,"i"),tabId:d})})),(0,V.iw)("loadChatlistInvites",(async(t,e,a)=>{const{folderId:s}=a,i=await(0,g.t9)("fetchChatlistInvites",{folderId:s});i&&(t=(0,V.Rd)(),t=(0,b.Sh)(t,(0,l.ee)(i.users,"id")),t=(0,b.fZ)(t,(0,l.ee)(i.chats,"id")),t={...t,chatFolders:{...t.chatFolders,invites:{...t.chatFolders.invites,[s]:i.invites}}},(0,V.R3)(t))})),(0,V.iw)("createChatlistInvite",(async(t,e,a)=>{const{folderId:s,tabId:d=(0,r._w)()}=a,o=(0,m.MwT)(t,s);if(!o)return;let n;t=(0,C.i)(t,{shareFolderScreen:{...(0,m.jUK)(t,d).shareFolderScreen,isLoading:!0}},d),(0,V.R3)(t);try{n=await(0,g.t9)("createChalistInvite",{folderId:s,peers:o.includedChatIds.concat(o.pinnedChatIds||[]).map((e=>(0,m.Z1J)(t,e)||(0,m.dyD)(t,e))).filter(Boolean)})}catch(t){A.has(t.message)?(e.openLimitReachedModal({limit:"chatlistInvites",tabId:d}),e.requestNextSettingsScreen({screen:i.MT.Folders,tabId:d})):e.showDialog({data:{...t,hasErrorKey:!0},tabId:d})}if(!n||!n.invite)return;const{shareFolderScreen:c}=(0,m.jUK)(t,d);c&&(t=(0,V.Rd)(),t={...t,chatFolders:{...t.chatFolders,byId:{...t.chatFolders.byId,[s]:{...t.chatFolders.byId[s],...n.filter}},invites:{...t.chatFolders.invites,[s]:[...t.chatFolders.invites[s]||[],n.invite]}}},t=(0,C.i)(t,{shareFolderScreen:{...c,url:n.invite.url,isLoading:!1}},d),(0,V.R3)(t))})),(0,V.iw)("editChatlistInvite",(async(t,e,a)=>{const{folderId:s,peerIds:i,url:d,tabId:o=(0,r._w)()}=a,n=d.split("/").pop();if(!n)return;const c=i.map((e=>(0,m.Z1J)(t,e)||(0,m.dyD)(t,e))).filter(Boolean);t=(0,C.i)(t,{shareFolderScreen:{...(0,m.jUK)(t,o).shareFolderScreen,isLoading:!0}},o),(0,V.R3)(t);try{const e=await(0,g.t9)("editChatlistInvite",{folderId:s,slug:n,peers:c});if(!e)return;t=(0,V.Rd)(),t={...t,chatFolders:{...t.chatFolders,invites:{...t.chatFolders.invites,[s]:t.chatFolders.invites[s]?.map((t=>t.url===d?e:t))}}},(0,V.R3)(t)}catch(t){e.showDialog({data:{...t,hasErrorKey:!0},tabId:o})}finally{t=(0,V.Rd)(),t=(0,C.i)(t,{shareFolderScreen:{...(0,m.jUK)(t,o).shareFolderScreen,isLoading:!1}},o),(0,V.R3)(t)}})),(0,V.iw)("deleteChatlistInvite",(async(t,e,a)=>{const{folderId:s,url:i}=a,d=i.split("/").pop();d&&await(0,g.t9)("deleteChatlistInvite",{folderId:s,slug:d})&&(t=(0,V.Rd)(),t={...t,chatFolders:{...t.chatFolders,invites:{...t.chatFolders.invites,[s]:t.chatFolders.invites[s]?.filter((t=>t.url!==i))}}},(0,V.R3)(t))})),(0,V.iw)("openDeleteChatFolderModal",(async(t,e,a)=>{const{folderId:s,isConfirmedForChatlist:i,tabId:d=(0,r._w)()}=a,o=(0,m.MwT)(t,s);if(o){if(o.isChatList&&(!o.hasMyInvites||i)){const e=await(0,g.t9)("fetchLeaveChatlistSuggestions",{folderId:s});return t=(0,V.Rd)(),t=(0,C.i)(t,{chatlistModal:{removal:{folderId:s,suggestedPeerIds:e}}},d),void(0,V.R3)(t)}t=(0,C.i)(t,{deleteFolderDialogModal:s},d),(0,V.R3)(t)}})),(0,V.iw)("updateChatDetectedLanguage",((t,e,a)=>{const{chatId:s,detectedLanguage:i}=a;return t=(0,V.Rd)(),(0,b.a4)(t,s,{detectedLanguage:i})})),(0,V.iw)("togglePeerTranslations",(async(t,e,a)=>{const{chatId:s,isEnabled:i}=a,d=(0,m.Z1J)(t,s);d&&void 0!==await(0,g.t9)("togglePeerTranslations",{chat:d,isEnabled:i})&&(t=(0,V.Rd)(),t=(0,b.CJ)(t,s,{isTranslationDisabled:!i||void 0}),(0,V.R3)(t))})),(0,V.iw)("setViewForumAsMessages",((t,e,a)=>{const{chatId:s,isEnabled:i}=a,d=(0,m.Z1J)(t,s);d?.isForum&&d.isForumAsMessages!==i&&(t=(0,b.a4)(t,s,{isForumAsMessages:i||void 0}),(0,V.R3)(t),(0,g.t9)("setViewForumAsMessages",{chat:d,isEnabled:i}))})),(0,V.iw)("fetchChannelRecommendations",(async(t,e,a)=>{const{chatId:s}=a,i=(0,m.Z1J)(t,s);if(!i)return;const{similarChannels:d,count:o}=await(0,g.t9)("fetchChannelRecommendations",{chat:i})||{};d&&(t=(0,V.Rd)(),t=(0,b.fZ)(t,(0,l.ee)(d,"id")),t=(0,b.BY)(t,s,d.map((t=>t.id)),o),(0,V.R3)(t))})),(0,V.iw)("toggleChannelRecommendations",((t,e,a)=>{const{chatId:s}=a;(0,m.Z1J)(t,s)&&(t=(0,b.VO)(t,s),(0,V.R3)(t))})),(0,V.iw)("resolveBusinessChatLink",(async(t,e,a)=>{const{slug:s,tabId:i=(0,r._w)()}=a,d=await(0,g.t9)("resolveBusinessChatLink",{slug:s});if(!d)return void e.showNotification({message:h.Iu("BusinessLink.ErrorExpired"),tabId:i});const{users:o,chats:n,chatLink:c}=d;t=(0,V.Rd)(),t=(0,b.Sh)(t,(0,l.ee)(o,"id")),t=(0,b.fZ)(t,(0,l.ee)(n,"id")),(0,V.R3)(t),e.openChatWithDraft({chatId:c.chatId,text:c.text,tabId:i})}))},88422:(t,e,a)=>{a.d(e,{CW:()=>S,EP:()=>v,FF:()=>F,Mt:()=>_,NH:()=>T,o5:()=>y});var s=a(57710),i=a(64319),d=a(65054),o=a(60782),n=a(59692),r=a(74753),c=a(97184),l=a(92387),h=a(41765),u=a(33555),I=a(11302),p=a(78958),g=a(44271),f=a(7054),V=a(42431),b=a(27225);const w="data:audio/mpeg;base64,SUQzBAAAAAABEVRYWFgAAAAtAAADY29tbWVudABCaWdTb3VuZEJhbmsuY29tIC8gTGFTb25vdGhlcXVlLm9yZwBURU5DAAAAHQAAA1N3aXRjaCBQbHVzIMKpIE5DSCBTb2Z0d2FyZQBUSVQyAAAABgAAAzIyMzUAVFNTRQAAAA8AAANMYXZmNTcuODMuMTAwAAAAAAAAAAAAAAD/80DEAAAAA0gAAAAATEFNRTMuMTAwVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/zQsRbAAADSAAAAABVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/zQMSkAAADSAAAAABVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV";let C,m,R;function y(){return v(),Promise.all(Object.values(R).map((t=>{const e=t.src;return t.src=w,t.muted=!0,t.volume=1e-4,t.play().then((()=>{t.pause(),t.volume=1,t.currentTime=0,t.muted=!1,(0,s.Yq)((()=>{t.src=e}))}))})))}function v(){if(R)return;const t=new Audio("./voicechat_join.mp3"),e=new Audio("./voicechat_connecting.mp3");e.loop=!0;const a=new Audio("./voicechat_leave.mp3"),s=new Audio("./voicechat_onallowtalk.mp3"),i=new Audio("./call_busy.mp3"),d=new Audio("./call_connect.mp3"),o=new Audio("./call_end.mp3"),n=new Audio("./call_incoming.mp3");n.loop=!0;const r=new Audio("./call_ringing.mp3");r.loop=!0,R={join:t,allowTalk:s,leave:a,connecting:e,incoming:n,end:o,connect:d,busy:i,ringing:r}}async function A(t,e){const a=await(0,l.t9)("getGroupCall",{call:e});if(!a)return;t=(0,u.Rd)();const s=(0,V.$5)(t,e.id);return t=(0,p.AH)(t,e.id,(0,o.CE)(a.groupCall,["connectionState"]),void 0,s?.isLoaded?void 0:a.groupCall.participantsCount),t=(0,I.Sh)(t,(0,o.ee)(a.users,"id")),t=(0,I.fZ)(t,(0,o.ee)(a.chats,"id")),(0,u.R3)(t),a.groupCall}async function M(t,e,a){const s=await(0,l.t9)("fetchGroupCallParticipants",{call:e,offset:a});s&&(t=(0,u.Rd)(),t=(0,I.Sh)(t,(0,o.ee)(s.users,"id")),t=(0,I.fZ)(t,(0,o.ee)(s.chats,"id")),(0,u.R3)(t))}(0,u.iw)("toggleGroupCallPanel",((t,e,a)=>{const{force:s,tabId:i=(0,d._w)()}=a||{};return(0,g.i)(t,{isCallPanelVisible:"force"in(a||{})?s:!(0,f.jUK)(t,i).isCallPanelVisible},i)})),(0,u.iw)("subscribeToGroupCallUpdates",(async(t,e,a)=>{const{subscribed:s,id:i}=a,d=(0,V.$5)(t,i);d&&(s&&(await A(t,d),t=(0,u.Rd)(),await M(t,d)),await(0,l.t9)("toggleGroupCallStartSubscription",{subscribed:s,call:d}))})),(0,u.iw)("createGroupCall",(async(t,e,a)=>{const{chatId:s,tabId:i=(0,d._w)()}=a,o=(0,f.Z1J)(t,s);if(!o)return;const n=await(0,l.t9)("createGroupCall",{peer:o});n&&(t=(0,u.Rd)(),t=(0,p.AH)(t,n.id,{...n,chatId:s}),(0,u.R3)(t),e.requestMasterAndJoinGroupCall({id:n.id,accessHash:n.accessHash,tabId:i}))})),(0,u.iw)("createGroupCallInviteLink",(async(t,e,a)=>{const{tabId:s=(0,d._w)()}=a||{},o=(0,V.mU)(t);if(!o||!o.chatId)return;const n=(0,f.Z1J)(t,o.chatId);if(!n)return;const r=Boolean((0,h.WS)(n));let c=(0,f.x67)(t,n.id)?.inviteLink;r&&(c=await(0,l.t9)("exportGroupCallInvite",{call:o,canSelfUnmute:!1})),c&&((0,i.TE)(c),e.showNotification({message:"Link copied to clipboard",tabId:s}))})),(0,u.iw)("joinVoiceChatByLink",(async(t,e,a)=>{const{username:s,inviteHash:i,tabId:o=(0,d._w)()}=a,r=await(0,b.Co)(t,s);if(!r)return void e.showNotification({message:n.Iu("NoUsernameFound"),tabId:o});t=(0,u.Rd)();const c=await(0,b.ft)(t,e,r,o);c?.groupCall&&e.requestMasterAndJoinGroupCall({id:c.groupCall.id,accessHash:c.groupCall.accessHash,inviteHash:i,tabId:o})})),(0,u.iw)("requestMasterAndJoinGroupCall",((t,e,a)=>{e.requestMasterAndCallAction({action:"joinGroupCall",payload:a,tabId:a.tabId||(0,d._w)()})})),(0,u.iw)("requestMasterAndAcceptCall",((t,e,a)=>{e.requestMasterAndCallAction({action:"acceptCall",payload:void 0,tabId:a?.tabId||(0,d._w)()})})),(0,u.iw)("joinGroupCall",(async(t,e,a)=>{const{chatId:s,id:i,accessHash:o,inviteHash:n,tabId:l=(0,d._w)()}=a;if(!c.Bi)return void e.showNotification({message:"Sorry, your browser doesn't support group calls",tabId:l});if(t.phoneCall)return void e.toggleGroupCallPanel({tabId:l});!function(){const t=new(window.AudioContext||window.webkitAudioContext);C=new Audio,m=t,C.srcObject=P(t),(0,r.Z)(C)}(),v(),S(t=(0,u.Rd)(),e,!0,l);const{groupCalls:{activeGroupCallId:h}}=t;let I=i?(0,V.$5)(t,i):(0,V.Bj)(t,s);if(I&&I.id===h)e.toggleGroupCallPanel({tabId:l});else if(h)"leaveGroupCall"in e&&e.leaveGroupCall({rejoin:a,tabId:l});else if(I&&h===I.id)e.toggleGroupCallPanel({tabId:l});else{if(I||i&&o||!s)!I&&i&&o&&(I=await A(t,{id:i,accessHash:o}));else{const a=(0,f.Z1J)(t,s);if(!a)return;await(0,b.ft)(t,e,a,l),t=(0,u.Rd)(),I=(0,V.Bj)(t,s)}I&&(t=(0,u.Rd)(),t=(0,p.AH)(t,I.id,{...I,inviteHash:n},void 0,I.participantsCount+1),t={...t,groupCalls:{...t.groupCalls,activeGroupCallId:I.id}},(0,u.R3)(t),e.toggleGroupCallPanel({force:!1,tabId:l}))}})),(0,u.iw)("playGroupCallSound",((t,e,a)=>{const{sound:s}=a;R[s]&&("connecting"!==s&&R.connecting.pause(),"incoming"!==s&&R.incoming.pause(),"ringing"!==s&&R.ringing.pause(),(0,r.Z)(R[s]))})),(0,u.iw)("loadMoreGroupCallParticipants",(t=>{const e=(0,V.mU)(t);e&&M(t,e,e.nextOffset)})),(0,u.iw)("requestMasterAndRequestCall",((t,e,a)=>{e.requestMasterAndCallAction({action:"requestCall",payload:a,tabId:a.tabId||(0,d._w)()})})),(0,u.iw)("requestCall",((t,e,a)=>{const{userId:s,isVideo:i,tabId:o=(0,d._w)()}=a;t.phoneCall?e.toggleGroupCallPanel({tabId:o}):(0,f.dyD)(t,s)&&(v(),S(t=(0,u.Rd)(),e,i,o),t=(0,u.Rd)(),t={...t,phoneCall:{id:"",state:"requesting",participantId:s,isVideo:i,adminId:t.currentUserId}},(0,u.R3)(t),e.toggleGroupCallPanel({force:!1,tabId:o}))}));const P=t=>{const e=t.createOscillator(),a=e.connect(t.createMediaStreamDestination());return e.start(),new MediaStream([Object.assign(a.stream.getAudioTracks()[0],{enabled:!1})])};function F(){return C}function T(){return m}function _(){C?.pause(),m=void 0,C=void 0}function S(t,e,a,...[s=(0,d._w)()]){a?navigator.mediaDevices.getUserMedia({video:!0}).then((t=>{0===t.getVideoTracks().length?e.showNotification({message:n.Iu("Call.Camera.Error"),tabId:s}):(t.getTracks().forEach((t=>t.stop())),B(0,e,s))})).catch((()=>{e.showNotification({message:n.Iu("Call.Camera.Error"),tabId:s})})):B(0,e,s)}function B(t,e,...[a=(0,d._w)()]){navigator.mediaDevices.getUserMedia({audio:!0}).then((t=>{0===t.getAudioTracks().length?e.showNotification({message:n.Iu("RequestAcces.Error.HaveNotAccess.Call"),tabId:a}):t.getTracks().forEach((t=>t.stop()))})).catch((()=>{e.showNotification({message:n.Iu("RequestAcces.Error.HaveNotAccess.Call"),tabId:a})}))}},78958:(t,e,a)=>{a.d(e,{AH:()=>n,B6:()=>l,Ic:()=>c,dc:()=>r});var s=a(60782),i=a(7054),d=a(42431),o=a(53475);function n(t,e,a,i,d){const o=Object.values({...t.groupCalls.byId[e]?.participants,...a.participants}).filter((({isLeft:t})=>!t)).reduce(((t,e)=>(t[e.id]=e,t)),{});return{...t,groupCalls:{...t.groupCalls,byId:{...t.groupCalls.byId,[e]:{...t.groupCalls.byId[e],...(0,s.CE)(a,["participantsCount"]),...i&&{participantsCount:t.groupCalls.byId[e].participantsCount+i},...void 0!==d&&{participantsCount:d},participants:o}}}}}function r(t,e){const a=(0,d.$5)(t,e);return a&&a.chatId&&(0,i.Z1J)(t,a.chatId)&&(t=(0,o.US)(t,a.chatId,{groupCallId:void 0})),{...t,groupCalls:{...t.groupCalls,byId:{...(0,s.CE)(t.groupCalls.byId,[e.toString()])}}}}function c(t,e,a){return t.groupCalls.activeGroupCallId?n(t,t.groupCalls.activeGroupCallId,e,void 0,a):t}function l(t,e,a,s,i=!1){const o=(0,d.$5)(t,e);return o?n(t,e,{participants:{...o.participants,[a]:{...o.participants[a],...s}}},s.isLeft?i?0:-1:o.participants[a]||i?0:1):t}}}]);
//# sourceMappingURL=8422.dbc32fb5a56c599828a2.js.map