2 lines
48 KiB
JavaScript
2 lines
48 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[8422],{27225:(t,e,a)=>{a.d(e,{Co:()=>H,X9:()=>D,ft:()=>B});var s=a(59187),i=a(91713),d=a(83716),o=a(64319),n=a(53551),r=a(51190),c=a(65054),l=a(16974),h=a(60782),u=a(59692),I=a(490),p=a(69118),g=a(18629),f=a(92387),b=a(41765),V=a(33555),w=a(11302),C=a(78958),m=a(44271),R=a(7054),y=a(42431),v=a(9211);const A={id:d.awM,accessHash:"0",type:"userTypeRegular",isMin:!0,phoneNumber:""},M=new Set(["FILTERS_TOO_MUCH","CHATLISTS_TOO_MUCH","INVITES_TOO_MUCH"]),P=(0,p.P2)((t=>t()),3e3,!0),F=(0,p.Ds)((t=>t()),500,!1,!0);function T(t,e){(0,f.t9)("abortChatRequests",{chatId:t,threadId:e})}function S(t,e,a,...[s=(0,c._w)()]){const i=(0,R.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,R.Btg)(t,i),r=n?.chatId===d;return[e||r,a||r&&n?.threadId===o]}),[d===e,!1]);(!a||!i)&&T(d,a?o:void 0)}}async function _(t,e,a,i=!1,o){let n=(0,V.Rd)(),r=(0,R.VFo)(n)?.id;const c="saved"===t?await(0,f.t9)("fetchSavedChats",{limit:d.Ov0,offsetDate:a,withPinned:i}):await(0,f.t9)("fetchChats",{limit:d.Ov0,offsetDate:a,archived:"archived"===t,withPinned:i,lastLocalServiceMessageId:r});if(!c)return;const{chatIds:u}=c;if(u.length>0&&u[0]===e&&u.shift(),n=(0,V.Rd)(),r=(0,R.VFo)(n)?.id,i)if("active"===t){if(!u.includes(d.awM)){const t=await(0,f.t9)("fetchChat",{type:"user",user:A});n=(0,V.Rd)();const e=t&&(0,R.Z1J)(n,t.chatId);e&&(u.unshift(e.id),c.chats.unshift(e),r&&(c.lastMessageByChatId[e.id]=r))}const e=Object.values(n.byTabId),a=(0,l.gO)(d.WSp)?.slice(0,d.Y2k).map((t=>(0,R.Z1J)(n,t))).filter(Boolean),s=e.flatMap((({id:t})=>{const e=(0,R.jrE)(n,t);return e?[e]:[]})).concat(a||[]),i=e.flatMap((({id:t})=>(0,R.P2Q)(n,t)||[]));n.currentUserId&&n.users.byId[n.currentUserId]&&i.push(n.users.byId[n.currentUserId]),n=(0,w.s5)(n,(0,h.ee)(i.concat(c.users),"id")),n=(0,w.ps)(n,c.userStatusesById),n=(0,w.SL)(n,(0,h.ee)(s.concat(c.chats),"id")),n=(0,w.Mg)(n,t,u)}else n=(0,w.Sh)(n,(0,h.ee)(c.users,"id")),n=(0,w.zn)(n,c.userStatusesById),n=(0,w.GL)(n,(0,h.ee)(c.chats,"id")),n=(0,w.Mg)(n,t,u);else{const e=(0,h.ee)(c.chats,"id");n=(0,w.Sh)(n,(0,h.ee)(c.users,"id")),n=(0,w.zn)(n,c.userStatusesById),n=(0,w.GL)(n,e),n=(0,w.B1)(n,t,u)}n=(0,w.vv)(n,t,c),n=(0,w.m6)(n,c.messages),n=(0,w.fr)(n,c.lastMessageByChatId,t),(o?c.chatIds:Object.keys(c.draftsById)).forEach((t=>{const e=c.draftsById[t],a=(0,R.cii)(n,t,s._f);(e||a)&&((0,R.Mst)(n,t,s._f)?.isLocal||(n=(0,w.pf)(n,t,s._f,"draft",e)))})),0!==u.length&&u.length!==c.totalChatCount||n.chats.isFullyLoaded[t]||(n={...n,chats:{...n.chats,isFullyLoaded:{...n.chats.isFullyLoaded,[t]:!0}}}),(0,V.R3)(n)}async function B(t,e,a,...[s=(0,c._w)()]){const i=await(0,f.t9)("fetchFullChat",a);if(!i)return;const{chats:d,users:o,userStatusesById:n,fullInfo:r,groupCall:l,membersCount:u,isForumAsMessages:I}=i;if(t=(0,V.Rd)(),t=(0,w.Sh)(t,(0,h.ee)(o,"id")),t=(0,w.GL)(t,(0,h.ee)(d,"id")),n&&(t=(0,w.zn)(t,n)),l){const e=(0,y.$5)(t,l.id);t=(0,C.AH)(t,l.id,(0,h.CE)(l,["connectionState","isLoaded"]),void 0,e?void 0:l.participantsCount)}void 0!==u&&(t=(0,w.a4)(t,a.id,{membersCount:u})),a.isForum&&(t=(0,w.a4)(t,a.id,{isForumAsMessages:I})),t=(0,w.FK)(t,a.id,r),(0,V.R3)(t);const p=r.stickerSet,g=p&&(0,R.Ny0)(t,p);p&&!g&&e.loadStickers({stickerSetInfo:{id:p.id,accessHash:p.accessHash},tabId:s});const b=r.emojiSet,m=b&&(0,R.Ny0)(t,b);return b&&!m&&e.loadStickers({stickerSetInfo:{id:b.id,accessHash:b.accessHash},tabId:s}),i}async function H(t,e){t=(0,V.Rd)();const a=(0,R.DIA)(t,e);if(a&&!a.isMin)return a;const{chat:s,user:i}=await(0,f.t9)("getChatByUsername",e)||{};return s?(t=(0,V.Rd)(),t=(0,w.a4)(t,s.id,s),i&&(t=(0,w.Nq)(t,i.id,i)),(0,V.R3)(t),s):void 0}async function U(t,e,a,...[s=(0,c._w)()]){const i=await H(t,a);if(!i)return;t=(0,V.Rd)();const d=(0,R.dyD)(t,i.id);if(!d)return;if(!(0,b.cS)(d))return;const o=await(0,f.t9)("loadAttachBot",{bot:d});if(t=(0,V.Rd)(),o)return t=(0,w.Sh)(t,(0,h.ee)(o.users,"id")),(0,V.R3)(t),o.bot;e.showNotification({message:u.Iu("WebApp.AddToAttachmentUnavailableError"),tabId:s})}async function Z(t,e,a,s,i,...[d=(0,c._w)()]){t=(0,V.Rd)();const o=await U(t,e,s,d);o&&e.callAttachBot({bot:o,chatId:a,..."string"==typeof i&&{startParam:i},tabId:d})}async function D(t,e,a,...[s=(0,c._w)()]){const i=(0,R.Z1J)(t,a);if(!i||!(0,b.G9)(i))return i;const d=await async function(t,e,a,...[s=(0,c._w)()]){try{return await(0,f.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,p.wO)(100),t=(0,V.Rd)();const i=Object.values(t.byTabId).map((({id:e})=>(0,R.Btg)(t,e)?.chatId)).filter(Boolean),o=(0,l.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,c._w)()})}})),(0,V.iw)("openChat",((t,e,a)=>{const{id:i,type:o,noForumTopicPanel:n,shouldReplaceHistory:r,shouldReplaceLast:l,tabId:h=(0,c._w)()}=a;if(e.processOpenChatOrThread({chatId:i,type:o,threadId:s._f,noForumTopicPanel:n,shouldReplaceHistory:r,shouldReplaceLast:l,tabId:h}),S(t,i,s._f,h),!i||i===d.mzl)return;const u=(0,R.Z1J)(t,i);u?.hasUnreadMark&&e.toggleChatUnread({id:i});const I=!(0,R.xMv)(t,i);if(u)I&&!u.isMin&&e.requestChatUpdate({chatId:i});else if((0,R.FM1)(t,i))(0,f.t9)("fetchChat",{type:"self"});else{const e=(0,R.dyD)(t,i);e&&(0,f.t9)("fetchChat",{type:"user",user:e})}e.closeStoryViewer({tabId:h})})),(0,V.iw)("openSavedDialog",((t,e,a)=>{const{chatId:s,tabId:i=(0,c._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:r,focusMessageId:l,tabId:I=(0,c._w)()}=a;let p,g,C,{chatId:y}=a;if(d){const{originChannelId:t,originMessageId:e}=a;g=t,C=e}else{g=a.chatId,p=a.threadId,C=p;const c=(0,R.Z1J)(t,g);if(p===s._f)return void e.openChat({id:y,type:i,noForumTopicPanel:o,shouldReplaceHistory:n,shouldReplaceLast:r,tabId:I});if(c?.isForum||y&&(0,b._o)(y,p,t.currentUserId))return void e.processOpenChatOrThread({chatId:y,type:i,threadId:p,isComments:d,noForumTopicPanel:o,shouldReplaceHistory:n,shouldReplaceLast:r,tabId:I})}const v=(0,R.Z1J)(t,g),A=(0,R.tZg)(t,g,C),M=(0,R.cii)(t,g,C);if(!v)return;if(S(t,g,C,I),y&&A?.threadId&&(d||M?.listedIds?.length&&M.listedIds.includes(Number(A.threadId))))return t=(0,m.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:r,tabId:I});let{loadingThread:P}=(0,R.jUK)(t,I);P&&T(P.loadingChatId,P.loadingMessageId),t=(0,m.i)(t,{loadingThread:{loadingChatId:g,loadingMessageId:Number(C)}},I),(0,V.R3)(t);const F=()=>{const t=(0,V.Rd)();d||(0,R.Btg)(t,I)?.chatId!==g||(0,R.Btg)(t,I)?.threadId!==C||e.openPreviousChat({tabId:I})};d||e.processOpenChatOrThread({chatId:y,type:i,threadId:p,tabId:I,isComments:d,noForumTopicPanel:o,shouldReplaceHistory:n,shouldReplaceLast:r});const _=await(0,f.t9)("fetchDiscussionMessage",{chat:(0,R.Z1J)(t,g),messageId:Number(C)});if(t=(0,V.Rd)(),P=(0,R.jUK)(t,I).loadingThread,P?.loadingChatId===g&&P?.loadingMessageId===C){if(!_)return t=(0,m.i)(t,{loadingThread:void 0},I),(0,V.R3)(t),e.showNotification({message:u.Iu(d?"ChannelPostDeleted":"lng_message_not_found"),tabId:I}),void F();p??(p=_.threadId),y??(y=_.chatId),y?(t=(0,V.Rd)(),t=(0,w.Sh)(t,(0,h.ee)(_.users,"id")),t=(0,w.fZ)(t,(0,h.ee)(_.chats,"id")),t=(0,w.m6)(t,_.messages),d&&(t=(0,w.Xg)(t,g,C,{threadId:p}),t=(0,w.Xg)(t,y,p,{isCommentsInfo:!1,threadId:p,chatId:y,fromChannelId:g,fromMessageId:C,...A&&(0,h.ei)(A,["messagesCount","lastMessageId","lastReadInboxMessageId","recentReplierIds"])})),t=(0,w.sN)(t,y,p,{firstMessageId:_.firstMessageId}),(0,V.R3)(t),l&&e.focusMessage({chatId:y,threadId:p,messageId:l,tabId:I}),e.loadViewportMessages({chatId:y,threadId:p,tabId:I,onError:()=>{t=(0,V.Rd)(),t=(0,m.i)(t,{loadingThread:void 0},I),(0,V.R3)(t),e.showNotification({message:u.Iu("Group.ErrorAccessDenied"),tabId:I})},onLoaded:()=>{t=(0,V.Rd)(),P=(0,R.jUK)(t,I).loadingThread,P?.loadingChatId===g&&P?.loadingMessageId===C&&(t=(0,m.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:r}))}})):F()}else F()})),(0,V.iw)("openLinkedChat",(async(t,e,a)=>{const{id:s,tabId:i=(0,c._w)()}=a,d=(0,R.Z1J)(t,s);if(!d)return;const o=await(0,f.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,c._w)()}=a||{},i=(0,R.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,f.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,R._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,R.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,c._w)(),withPhotos:o}=a,n=(0,R.Z1J)(t,s);if(!n)return;const r=async()=>{await B(t,e,n,d),o&&e.loadProfilePhotos({profileId:s})};i?r():F(r)})),(0,V.iw)("loadTopChats",(()=>{P((()=>{_("active"),_("archived")}))})),(0,V.iw)("requestChatUpdate",((t,e,a)=>{const{chatId:s}=a,i=(0,R.Z1J)(t,s);i&&(0,f.t9)("requestChatUpdate",{chat:i,...s===d.awM&&{lastLocalMessage:(0,R.VFo)(t)?.message}})})),(0,V.iw)("requestSavedDialogUpdate",(async(t,e,a)=>{const{chatId:s}=a,i=(0,R.Z1J)(t,s);if(!i)return;const d=await(0,f.t9)("fetchMessages",{chat:i,isSavedDialog:!0,limit:1});d&&(t=(0,V.Rd)(),t=(0,w.m6)(t,d.messages),t=(0,w.Sh)(t,(0,h.ee)(d.users,"id")),t=(0,w.fZ)(t,(0,h.ee)(d.chats,"id")),d.messages.length?(t=(0,w._l)(t,s,d.messages[0].id,"saved"),t=(0,w.B1)(t,"saved",[s]),(0,V.R3)(t)):(t=(0,w.kq)(t,s,"saved"),(0,V.R3)(t),Object.values(t.byTabId).forEach((({id:a})=>{const i=(0,R.Btg)(t,a);if(!i)return;const{chatId:d,threadId:o}=i;(0,R.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,R.Z1J)(t,s);if(!d)return;const o=a.isMuted??i>0;t=(0,w.a4)(t,s,{isMuted:o}),(0,V.R3)(t),(0,f.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,R.Z1J)(t,s);if(!o)return;const n=a.isMuted??d>0;t=(0,w.Cn)(t,s,i,{isMuted:n}),(0,V.R3)(t),(0,f.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:r=(0,c._w)()}=a,l=n.map((e=>(0,R.dyD)(t,e))).filter(Boolean);let h,u;t=(0,m.i)(t,{chatCreation:{progress:i.Nh.InProgress}},r),(0,V.R3)(t);try{const t=await(0,f.t9)("createChannel",{title:s,about:d,users:l});h=t?.channel,u=t?.missingUsers}catch(a){t=(0,V.Rd)(),t=(0,m.i)(t,{chatCreation:{progress:i.Nh.Error}},r),(0,V.R3)(t),"CHANNELS_TOO_MUCH"===a.message?e.openLimitReachedModal({limit:"channels",tabId:r}):e.showDialog({data:{...a,hasErrorKey:!0},tabId:r})}if(!h)return;const{id:I,accessHash:p}=h;t=(0,V.Rd)(),t=(0,w.a4)(t,I,h),t=(0,m.i)(t,{chatCreation:{...(0,R.jUK)(t,r).chatCreation,progress:h?i.Nh.Complete:i.Nh.Error}},r),(0,V.R3)(t),e.openChat({id:I,shouldReplaceHistory:!0,tabId:r}),u&&(t=(0,V.Rd)(),t=(0,w.zo)(t,I,u,r),(0,V.R3)(t)),I&&p&&o&&await(0,f.t9)("editChatPhoto",{chatId:I,accessHash:p,photo:o})})),(0,V.iw)("joinChannel",(async(t,e,a)=>{const{chatId:s,tabId:i=(0,c._w)()}=a,d=(0,R.Z1J)(t,s);if(!d)return;const{id:o,accessHash:n}=d;if(o&&n)try{await(0,f.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,c._w)()}=a,o=(0,R.Z1J)(t,s),n=(0,R.dyD)(t,i);o&&n&&(t=(0,w.Dd)(t,s),(0,V.R3)(t),(0,R.Btg)(t,d)?.chatId===s&&e.openChat({id:void 0,tabId:d}),(0,f.t9)("deleteChatUser",{chat:o,user:n}))})),(0,V.iw)("deleteChat",((t,e,a)=>{const{chatId:s,tabId:i=(0,c._w)()}=a,d=(0,R.Z1J)(t,s);d&&(t=(0,w.Dd)(t,s),(0,V.R3)(t),(0,R.Btg)(t,i)?.chatId===s&&e.openChat({id:void 0,tabId:i}),(0,f.t9)("deleteChat",{chatId:d.id}))})),(0,V.iw)("leaveChannel",(async(t,e,a)=>{const{chatId:s,tabId:i=(0,c._w)()}=a,d=(0,R.Z1J)(t,s);if(!d)return;t=(0,w.Dd)(t,s),(0,V.R3)(t),(0,R.Btg)(t,i)?.chatId===s&&e.openChat({id:void 0,tabId:i});const{id:o,accessHash:n}=d;if(o&&n){await(0,f.t9)("leaveChannel",{channelId:o,accessHash:n}),t=(0,V.Rd)();const e=(0,R.Zwk)(t,s),a=Object.keys(e).map(Number).filter(I.AJ);t=(0,w.K4)(t,s,a),(0,V.R3)(t)}})),(0,V.iw)("deleteChannel",((t,e,a)=>{const{chatId:s,tabId:i=(0,c._w)()}=a,d=(0,R.Z1J)(t,s);if(!d)return;t=(0,w.Dd)(t,s),(0,V.R3)(t),(0,R.Btg)(t,i)?.chatId===s&&e.openChat({id:void 0,tabId:i});const{id:o,accessHash:n}=d;o&&n&&(0,f.t9)("deleteChannel",{channelId:o,accessHash:n})})),(0,V.iw)("createGroupChat",(async(t,e,a)=>{const{title:s,memberIds:d,photo:o,tabId:n=(0,c._w)()}=a,r=d.map((e=>(0,R.dyD)(t,e))).filter(Boolean);t=(0,m.i)(t,{chatCreation:{progress:i.Nh.InProgress}},n),(0,V.R3)(t);try{const{chat:a,missingUsers:d}=await(0,f.t9)("createGroupChat",{title:s,users:r})??{};if(!a)return;const{id:c}=a;t=(0,V.Rd)(),t=(0,w.a4)(t,c,a),t=(0,m.i)(t,{chatCreation:{...(0,R.jUK)(t,n).chatCreation,progress:a?i.Nh.Complete:i.Nh.Error}},n),(0,V.R3)(t),e.openChat({id:c,shouldReplaceHistory:!0,tabId:n}),d&&(t=(0,V.Rd)(),t=(0,w.zo)(t,c,d,n),(0,V.R3)(t)),c&&o&&await(0,f.t9)("editChatPhoto",{chatId:c,photo:o})}catch(e){"USERS_TOO_FEW"===e.message&&(t=(0,V.Rd)(),t=(0,m.i)(t,{chatCreation:{...(0,R.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,c._w)()}=a,n=(0,R.Z1J)(t,s);if(!n)return;const r=(0,v.M)(t,"dialogFolderPinned");if(i){const e=(0,R.MwT)(t,i);if(e){const a=!(0,R.epB)(t,s,i),{pinnedChatIds:d,includedChatIds:o}=e,n=a?[s,...d||[]]:(d||[]).filter((t=>t!==s)),r=[s,...o];(0,f.t9)("editChatFolder",{id:i,folderUpdate:{...e,pinnedChatIds:n,includedChatIds:r}})}}else{const a=(0,R.EkO)(t,s),i=(0,R.epB)(t,s,"archived"===a?d.WSp:void 0),c=t.chats.orderedPinnedIds["archived"===a?"archived":"active"];if((c?.length||0)>=r&&!i)return void e.openLimitReachedModal({limit:"dialogFolderPinned",tabId:o});(0,f.t9)("toggleChatPinned",{chat:n,shouldBePinned:!i})}})),(0,V.iw)("toggleChatArchived",((t,e,a)=>{const{id:s}=a,i=(0,R.Z1J)(t,s);i&&(0,f.t9)("toggleChatArchived",{chat:i,folderId:(0,b.pE)(i)?0:d.WSp})})),(0,V.iw)("toggleSavedDialogPinned",((t,e,a)=>{const{id:s,tabId:i=(0,c._w)()}=a,o=(0,R.Z1J)(t,s);if(!o)return;const n=(0,v.M)(t,"savedDialogsPinned"),r=(0,R.epB)(t,s,d.aV7),l=t.chats.orderedPinnedIds.saved;(l?.length||0)>=n&&!r?e.openLimitReachedModal({limit:"savedDialogsPinned",tabId:i}):(0,f.t9)("toggleSavedDialogPinned",{chat:o,shouldBePinned:!r})})),(0,V.iw)("loadChatFolders",(async t=>{const e=await(0,f.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,f.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,c._w)()}=a,n=(0,v.M)(t,"dialogFiltersChats");d.some((e=>(0,R.MwT)(t,e).includedChatIds.length>=n))?e.openLimitReachedModal({limit:"dialogFiltersChats",tabId:o}):(i.forEach((async e=>{const a=(0,R.MwT)(t,e);a&&await(0,f.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,R.MwT)(t,e);a&&await(0,f.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,R.MwT)(t,s);d&&(0,f.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,c._w)()}=a,{orderedIds:o,byId:n}=t.chatFolders,r=(0,v.M)(t,"dialogFilters");if(Object.keys(n).length>=r)return void e.openLimitReachedModal({limit:"dialogFilters",tabId:i});const l=Math.max(...o||[],d.WSp),{id:h,description:u,...I}=s,p=l+1,g={id:p,...I};if(await(0,f.t9)("editChatFolder",{id:p,folderUpdate:g}),e.apiUpdate({"@type":"updateChatFolder",id:p,folder:g}),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,f.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,R.MwT)(t,s)&&await(0,f.t9)("deleteChatFolder",s)})),(0,V.iw)("toggleChatUnread",((t,e,a)=>{const{id:i}=a,d=(0,R.Z1J)(t,i);d&&(d.unreadCount?(0,f.t9)("markMessageListRead",{chat:d,threadId:s._f}):(0,f.t9)("toggleDialogUnread",{chat:d,hasUnreadMark:!d.hasUnreadMark}))})),(0,V.iw)("markTopicRead",((t,e,a)=>{const{chatId:s,topicId:i}=a,d=(0,R.Z1J)(t,s);if(!d)return;const o=d.topics?.[i]?.lastMessageId;o&&((0,f.t9)("markMessageListRead",{chat:d,threadId:i,maxId:o}),t=(0,V.Rd)(),t=(0,w.Cn)(t,s,i,{unreadCount:0}),t=(0,w.Xg)(t,s,i,{lastReadInboxMessageId:o}),(0,V.R3)(t))})),(0,V.iw)("openChatByInvite",(async(t,e,a)=>{const{hash:s,tabId:i=(0,c._w)()}=a,d=await(0,f.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:r=(0,c._w)()}=a;e.openChat({id:d.mzl,tabId:r});const l=await async function(t,e){t=(0,V.Rd)();const a=(0,R.Bki)(t,e);if(a&&!a.isMin)return(0,R.Z1J)(t,a.id);const{chat:s,user:i}=await(0,f.t9)("getChatByPhoneNumber",e)||{};return s?(t=(0,V.Rd)(),t=(0,w.a4)(t,s.id,s),i&&(t=(0,w.Nq)(t,i.id,i)),(0,V.R3)(t),s):void 0}(t,s);if(!l)return e.openPreviousChat({tabId:r}),void e.showNotification({message:u.Iu("lng_username_by_phone_not_found").replace("{phone}",s),tabId:r});n?e.openChatWithDraft({chatId:l.id,text:{text:n},tabId:r}):e.openChat({id:l.id,tabId:r}),o&&Z(t=(0,V.Rd)(),e,l.id,o,i,r)})),(0,V.iw)("openTelegramLink",((t,e,a)=>{const{url:s,tabId:i=(0,c._w)()}=a,{openChatByPhoneNumber:o,openChatByInvite:l,openStickerSet:h,openChatWithDraft:u,joinVoiceChatByLink:I,focusMessage:p,openInvoice:g,processAttachBotParameters:f,checkChatlistInvite:V,openChatByUsername:w,openStoryViewerByUsername:C,processBoostParameters:m,checkGiftCode:R}=e;if((0,r.I)(s)&&((0,n.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 S;"joinchat"===M&&(S=P);const _=T.hasOwnProperty("startattach"),B=T.hasOwnProperty("startapp"),H=(0,n.GX)(T.choose),U="s"===P&&(Number(F)||void 0),Z=T.hasOwnProperty("boost");if(M.match(/^\+([0-9]+)(\?|$)/))return void o({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("+"))&&(S=M.substr(1,M.length-1)),S)return void l({hash:S,tabId:i});if("addstickers"===M||"addemoji"===M)return void h({stickerSetInfo:{shortName:P},tabId:i});if("share"===M)return void u({text:(0,n.QH)(T.url,T.text),tabId:i});if("addlist"===M)return void V({slug:P,tabId:i});if("giftcode"===M)return void R({slug:P,tabId:i});const D=P||void 0,L=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:D||M,isPrivate:"c"===M&&Boolean(D),tabId:i}):"c"===M&&D&&L?p({chatId:(0,b.Yg)(D),messageId:L,tabId:i}):M.startsWith("$")?g({type:"slug",slug:M.substring(1),tabId:i}):"invoice"===M?g({type:"slug",slug:P,tabId:i}):_&&H||!P&&B?f({username:M,filter:H,startParam:T.startattach||T.startapp,tabId:i}):w({username:M,messageId:L||Number(D),threadId:L?Number(D):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,c._w)()}=a;let o;if(i){const a=(0,b.Yg)(s);if(o=(0,R.Z1J)(t,a),!o)return void e.showNotification({message:"Chat does not exist",tabId:d})}else if(o=await H(t,s),!o)return void e.showNotification({message:"User does not exist",tabId:d});(0,b.eA)(o)||(0,b.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,c._w)()}=a,d=await(0,f.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:r,startAttach:l,attach:h,threadId:u,originalParts:I,startApp:p,text:f,tabId:b=(0,c._w)()}=a,w=(0,R.jrE)(t,b),C=I?.[1],m=C&&!Number(C)&&!I?.[2];if(!n){if(void 0===l&&o&&!r&&w?.usernames?.some((t=>t.username===i)))return void e.focusMessage({chatId:w.id,threadId:u,messageId:o,tabId:b});if(!m)return void await async function(t,e,a,...[i=(0,c._w)()]){const{username:o,threadId:n,channelPostId:r,startParam:l,startAttach:h,attach:u,text:I}=a;t=(0,V.Rd)();const p=(0,R.jrE)(t,i);if(void 0!==h&&!u){const a=await U(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 H(t,o);f?(r?e.focusMessage({chatId:f.id,threadId:n,messageId:r,tabId:i}):g||e.openThread({chatId:f.id,threadId:n??s._f,tabId:i}),l&&e.startBot({botId:f.id,param:l}),u&&Z(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:r,startAttach:l,attach:h,text:f},b)}const y=(0,R.DIA)(t,i);if(n&&o&&y)return void e.openThread({isComments:!0,originChannelId:y.id,originMessageId:o,tabId:b,focusMessageId:n});m||e.openChat({id:d.mzl,tabId:b});const v=await H(t,i);if(v)if(m&&v){const t=(0,g.BS)();e.requestAppWebView({appName:C,botId:v.id,tabId:b,startApp:p,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,c._w)()}=a,o=await D(t,e,s,d);o&&(t=(0,V.Rd)(),t=(0,w.US)(t,o.id,{isPreHistoryHidden:i}),(0,V.R3)(t),(0,f.t9)("togglePreHistoryHidden",{chat:o,isEnabled:i}))})),(0,V.iw)("updateChatDefaultBannedRights",((t,e,a)=>{const{chatId:s,bannedRights:i}=a,d=(0,R.Z1J)(t,s);d&&(0,f.t9)("updateChatDefaultBannedRights",{chat:d,bannedRights:i})})),(0,V.iw)("updateChatMemberBannedRights",(async(t,e,a)=>{const{chatId:s,userId:i,bannedRights:d,tabId:o=(0,c._w)()}=a,n=(0,R.dyD)(t,i);if(!n)return;const r=await D(t,e,s,o);if(!r)return;await(0,f.t9)("updateChatMemberBannedRights",{chat:r,user:n,bannedRights:d}),t=(0,V.Rd)();const l=(0,R.x67)(t,r.id);if(!l)return;const{members:h,kickedMembers:u}=l,I=Boolean(d.viewMessages),p=!Object.keys(d).length;t=(0,w.US)(t,r.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,c._w)()}=a,r=(0,R.dyD)(t,i);if(!r)return;const l=await D(t,e,s,n);if(!l)return;await(0,f.t9)("updateChatAdmin",{chat:l,user:r,adminRights:d,customTitle:o});const h=await(0,f.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,w.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:r=(0,c._w)()}=a,l=(0,R.Z1J)(t,s),h=(0,R.x67)(t,s);l&&(t=(0,V.Rd)(),t=(0,w.H9)(t,i.wv.InProgress,r),(0,V.R3)(t),await Promise.all([l.title!==d?(0,f.t9)("updateChatTitle",l,d):void 0,h?.about!==o?(0,f.t9)("updateChatAbout",l,o):void 0,n?(0,f.t9)("editChatPhoto",{chatId:s,accessHash:l.accessHash,photo:n}):void 0]),t=(0,V.Rd)(),t=(0,w.H9)(t,i.wv.Complete,r),(0,V.R3)(t),n&&e.loadFullChat({chatId:s,tabId:r,withPhotos:!0}))})),(0,V.iw)("updateChatPhoto",(async(t,e,a)=>{const{photo:s,chatId:i,tabId:d=(0,c._w)()}=a,o=(0,R.Z1J)(t,i);o&&(t=(0,w.a4)(t,i,{avatarHash:void 0}),t=(0,w.US)(t,i,{profilePhoto:void 0}),(0,V.R3)(t),await(0,f.t9)("editChatPhoto",{chatId:i,accessHash:o.accessHash,photo:s}),await(0,f.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,c._w)()}=a,o=(0,R.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,w.a4)(t,i,{avatarHash:void 0}),t=(0,w.US)(t,i,{profilePhoto:void 0}),(0,V.R3)(t),await(0,f.t9)("editChatPhoto",{chatId:i,accessHash:o.accessHash,photo:e})}const{photos:r=[]}=o,l=r.filter((t=>n.some((e=>e.id!==t.id))));t=(0,V.Rd)(),t=(0,w.a4)(t,i,{photos:l}),(0,V.R3)(t),await(0,f.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,R.Z1J)(t,s);d&&(0,f.t9)("toggleSignatures",{chat:d,isEnabled:i})})),(0,V.iw)("loadGroupsForDiscussion",(async t=>{const e=await(0,f.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,w.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,c._w)()}=a||{},o=(0,R.Z1J)(t,s);if(!o)return;const n=await D(t,e,i,d);if(!n)return;let r=(0,R.x67)(t,n.id);if(!r){const t=await(0,f.t9)("fetchFullChat",n);if(!t)return;r=t.fullInfo}r.isPreHistoryHidden&&(t=(0,V.Rd)(),t=(0,w.US)(t,n.id,{isPreHistoryHidden:!1}),(0,V.R3)(t),await(0,f.t9)("togglePreHistoryHidden",{chat:n,isEnabled:!1})),(0,f.t9)("setDiscussionGroup",{channel:o,chat:n})})),(0,V.iw)("unlinkDiscussionGroup",(async(t,e,a)=>{const{channelId:s,tabId:i=(0,c._w)()}=a,d=(0,R.Z1J)(t,s);if(!d)return;const o=(0,R.x67)(t,s);let n;o?.linkedChatId&&(n=(0,R.Z1J)(t,o.linkedChatId)),await(0,f.t9)("setDiscussionGroup",{channel:d}),n&&B(t=(0,V.Rd)(),e,n,i)})),(0,V.iw)("setActiveChatFolder",((t,e,a)=>{const{activeChatFolder:s,tabId:i=(0,c._w)()}=a;if(!(s+1>(0,v.M)(t,"dialogFilters")))return(0,m.i)(t,{activeChatFolder:s},i);e.openLimitReachedModal({limit:"dialogFilters",tabId:i})})),(0,V.iw)("resetOpenChatWithDraft",((t,e,a)=>{const{tabId:s=(0,c._w)()}=a||{};return(0,m.i)(t,{requestedDraft:void 0},s)})),(0,V.iw)("loadMoreMembers",(async(t,e,a)=>{const{tabId:s=(0,c._w)()}=a||{},{chatId:i}=(0,R.Btg)(t,s)||{},d=i?(0,R.Z1J)(t,i):void 0;if(!d||(0,b.G9)(d))return;const o=(0,R.x67)(t,d.id)?.members?.length;if(void 0!==o&&void 0!==d.membersCount&&o>=d.membersCount)return;const n=await(0,f.t9)("fetchMembers",d.id,d.accessHash,"recent",o);if(!n)return;const{members:r,users:l,userStatusesById:u}=n;r&&r.length&&(t=(0,V.Rd)(),t=(0,w.Sh)(t,(0,h.ee)(l,"id")),t=(0,w.zn)(t,u),t=(0,w.iX)(t,d,r),(0,V.R3)(t))})),(0,V.iw)("addChatMembers",(async(t,e,a)=>{const{chatId:s,memberIds:d,tabId:o=(0,c._w)()}=a,n=(0,R.Z1J)(t,s),r=d.map((e=>(0,R.dyD)(t,e))).filter(Boolean);if(!n||!r.length)return;e.setNewChatMembersDialogState({newChatMembersProgress:i.WB.Loading,tabId:o});const l=await(0,f.t9)("addChatMembers",n,r);l&&(t=(0,V.Rd)(),t=(0,w.zo)(t,s,l,o),(0,V.R3)(t)),e.setNewChatMembersDialogState({newChatMembersProgress:i.WB.Closed,tabId:o}),B(t=(0,V.Rd)(),e,n,o)})),(0,V.iw)("deleteChatMember",(async(t,e,a)=>{const{chatId:s,userId:i,tabId:d=(0,c._w)()}=a,o=(0,R.Z1J)(t,s),n=(0,R.dyD)(t,i);o&&n&&(await(0,f.t9)("deleteChatMember",o,n),B(t=(0,V.Rd)(),e,o,d))})),(0,V.iw)("toggleIsProtected",((t,e,a)=>{const{chatId:s,isProtected:i}=a,d=(0,R.Z1J)(t,s);d&&(0,f.t9)("toggleIsProtected",{chat:d,isProtected:i})})),(0,V.iw)("setChatEnabledReactions",(async(t,e,a)=>{const{chatId:s,enabledReactions:i,tabId:d=(0,c._w)()}=a,o=(0,R.Z1J)(t,s);o&&(await(0,f.t9)("setChatEnabledReactions",{chat:o,enabledReactions:i}),B(t=(0,V.Rd)(),e,o,d))})),(0,V.iw)("fetchChat",((t,e,a)=>{const{chatId:s}=a;if(!(0,R.Z1J)(t,s))if((0,R.FM1)(t,s))(0,f.t9)("fetchChat",{type:"self"});else{const e=(0,R.dyD)(t,s);e&&(0,f.t9)("fetchChat",{type:"user",user:e})}})),(0,V.iw)("loadChatSettings",(async(t,e,a)=>{const{chatId:s}=a,i=(0,R.Z1J)(t,s);if(!i)return;const d=await(0,f.t9)("fetchChatSettings",i);if(!d)return;const{settings:o,users:n}=d;t=(0,V.Rd)(),t=(0,w.Sh)(t,(0,h.ee)(n,"id")),t=(0,w.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,R.Z1J)(t,s);d&&((0,b.ZV)(d)||(0,b.eA)(d))&&await(0,f.t9)("toggleJoinToSend",d,i)})),(0,V.iw)("toggleJoinRequest",(async(t,e,a)=>{const{chatId:s,isEnabled:i}=a,d=(0,R.Z1J)(t,s);d&&((0,b.ZV)(d)||(0,b.eA)(d))&&await(0,f.t9)("toggleJoinRequest",d,i)})),(0,V.iw)("openForumPanel",((t,e,a)=>{const{chatId:s,tabId:i=(0,c._w)()}=a;return e.toggleStoryRibbon({isShown:!1,tabId:i}),e.toggleStoryRibbon({isShown:!1,isArchived:!0,tabId:i}),(0,m.i)(t,{forumPanelChatId:s},i)})),(0,V.iw)("closeForumPanel",((t,e,a)=>{const{tabId:s=(0,c._w)()}=a||{};return(0,m.i)(t,{forumPanelChatId:void 0},s)})),(0,V.iw)("processAttachBotParameters",(async(t,e,a)=>{const{username:s,filter:i,startParam:d,tabId:o=(0,c._w)()}=a,n=await U(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:r}}=t;if(!r[n.id])return t=(0,m.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,R.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:l}=n&&o.topics?.[n]||{},u=await(0,f.t9)("fetchTopics",{chat:o,offsetTopicId:r,offsetId:l,offsetDate:c,limit:r?d.C1M:d.SC4});u&&(t=(0,V.Rd)(),t=(0,w.Sh)(t,(0,h.ee)(u.users,"id")),t=(0,w.fZ)(t,(0,h.ee)(u.chats,"id")),t=(0,w.m6)(t,u.messages),t=(0,w.XG)(t,s,u.count,u.topics),t=(0,w.Jr)(t,s,u.topics.map((t=>t.id))),Object.entries(u.draftsById||{}).forEach((([e,a])=>{t=(0,w.pf)(t,s,Number(e),"draft",a)})),Object.entries(u.readInboxMessageIdByTopicId||{}).forEach((([e,a])=>{t=(0,w.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,R.Z1J)(t,s);if(!d)return;const o=await(0,f.t9)("fetchTopicById",{chat:d,topicId:i});if(o)t=(0,V.Rd)(),t=(0,w.Sh)(t,(0,h.ee)(o.users,"id")),t=(0,w.fZ)(t,(0,h.ee)(o.chats,"id")),t=(0,w.m6)(t,o.messages),t=(0,w.Cn)(t,s,i,o.topic),(0,V.R3)(t);else if("tabId"in a&&a.shouldCloseChatOnError){const{tabId:t=(0,c._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,c._w)()}=a,o=await D(t,e,s,d);if(!o)return;let n;try{n=await(0,f.t9)("toggleForum",{chat:o,isEnabled:i})}catch(t){t.message.startsWith("A wait of")?e.showNotification({message:u.Iu("FloodWait"),tabId:d}):e.showDialog({data:{...t,hasErrorKey:!0},tabId:d})}n&&(t=(0,V.Rd)(),t=(0,w.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,R.Z1J)(t,s);if(!d)return;const o=(0,R.x67)(t,d.id)?.areParticipantsHidden;t=(0,w.US)(t,s,{areParticipantsHidden:i}),(0,V.R3)(t),await(0,f.t9)("toggleParticipantsHidden",{chat:d,isEnabled:i})||void 0===o||(t=(0,V.Rd)(),t=(0,w.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,c._w)()}=a,r=(0,R.Z1J)(t,s);if(!r)return;(0,R.jUK)(t,n).createTopicPanel&&(t=(0,m.i)(t,{createTopicPanel:{chatId:s,isLoading:!0}},n),(0,V.R3)(t));const l=await(0,f.t9)("createTopic",{chat:r,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,R.Z1J)(t,s);d&&(await(0,f.t9)("deleteTopic",{chat:d,topicId:i}),t=(0,V.Rd)(),t=(0,w.BK)(t,s,i),(0,V.R3)(t))})),(0,V.iw)("editTopic",(async(t,e,a)=>{const{chatId:s,topicId:i,tabId:d=(0,c._w)(),...o}=a,n=(0,R.Z1J)(t,s),r=n?.topics?.[i];n&&r&&((0,R.jUK)(t,d).editTopicPanel&&(t=(0,m.i)(t,{editTopicPanel:{chatId:s,topicId:i,isLoading:!0}},d),(0,V.R3)(t)),await(0,f.t9)("editTopic",{chat:n,topicId:i,...o})&&(t=(0,V.Rd)(),t=(0,w.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,c._w)()}=a,{topicsPinnedLimit:n}=t.appConfig||{},r=(0,R.Z1J)(t,s);r&&r.topics&&n&&(d&&Object.values(r.topics).filter((t=>t.isPinned)).length>=n?e.showNotification({message:u.Iu("LimitReachedPinnedTopics",n,"i"),tabId:o}):(0,f.t9)("togglePinnedTopic",{chat:r,topicId:i,isPinned:d}))})),(0,V.iw)("checkChatlistInvite",(async(t,e,a)=>{const{slug:s,tabId:i=(0,c._w)()}=a,d=await(0,f.t9)("checkChatlistInvite",{slug:s});d?(t=(0,V.Rd)(),t=(0,w.Sh)(t,(0,h.ee)(d.users,"id")),t=(0,w.fZ)(t,(0,h.ee)(d.chats,"id")),t=(0,m.i)(t,{chatlistModal:{invite:d.invite}},i),(0,V.R3)(t)):e.showNotification({message:u.Iu("lng_group_invite_bad_link"),tabId:i})})),(0,V.iw)("joinChatlistInvite",(async(t,e,a)=>{const{invite:s,peerIds:i,tabId:d=(0,c._w)()}=a,o=i.map((e=>(0,R.Z1J)(t,e))).filter(Boolean),n=o.filter((t=>t.isNotJoined)).length,r="folderId"in s?(0,R.MwT)(t,s.folderId):void 0,l="title"in s?s.title:r?.title;try{if(!await(0,f.t9)("joinChatlistInvite",{slug:s.slug,peers:o}))return;e.showNotification({title:u.Iu(r?"FolderLinkUpdatedTitle":"FolderLinkAddedTitle",l),message:u.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,c._w)()}=a,o=(0,R.MwT)(t,s),n=i?.map((e=>(0,R.Z1J)(t,e))).filter(Boolean)||[];await(0,f.t9)("leaveChatlist",{folderId:s,peers:n})&&e.showNotification({title:u.Iu("FolderLinkDeletedTitle",o.title),message:u.Iu("FolderLinkDeletedSubtitle",n.length,"i"),tabId:d})})),(0,V.iw)("loadChatlistInvites",(async(t,e,a)=>{const{folderId:s}=a,i=await(0,f.t9)("fetchChatlistInvites",{folderId:s});i&&(t=(0,V.Rd)(),t=(0,w.Sh)(t,(0,h.ee)(i.users,"id")),t=(0,w.fZ)(t,(0,h.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,c._w)()}=a,o=(0,R.MwT)(t,s);if(!o)return;let n;t=(0,m.i)(t,{shareFolderScreen:{...(0,R.jUK)(t,d).shareFolderScreen,isLoading:!0}},d),(0,V.R3)(t);try{n=await(0,f.t9)("createChalistInvite",{folderId:s,peers:o.includedChatIds.concat(o.pinnedChatIds||[]).map((e=>(0,R.Z1J)(t,e)||(0,R.dyD)(t,e))).filter(Boolean)})}catch(t){M.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:r}=(0,R.jUK)(t,d);r&&(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,m.i)(t,{shareFolderScreen:{...r,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,c._w)()}=a,n=d.split("/").pop();if(!n)return;const r=i.map((e=>(0,R.Z1J)(t,e)||(0,R.dyD)(t,e))).filter(Boolean);t=(0,m.i)(t,{shareFolderScreen:{...(0,R.jUK)(t,o).shareFolderScreen,isLoading:!0}},o),(0,V.R3)(t);try{const e=await(0,f.t9)("editChatlistInvite",{folderId:s,slug:n,peers:r});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,m.i)(t,{shareFolderScreen:{...(0,R.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,f.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,c._w)()}=a,o=(0,R.MwT)(t,s);if(o){if(o.isChatList&&(!o.hasMyInvites||i)){const e=await(0,f.t9)("fetchLeaveChatlistSuggestions",{folderId:s});return t=(0,V.Rd)(),t=(0,m.i)(t,{chatlistModal:{removal:{folderId:s,suggestedPeerIds:e}}},d),void(0,V.R3)(t)}t=(0,m.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,w.a4)(t,s,{detectedLanguage:i})})),(0,V.iw)("togglePeerTranslations",(async(t,e,a)=>{const{chatId:s,isEnabled:i}=a,d=(0,R.Z1J)(t,s);d&&void 0!==await(0,f.t9)("togglePeerTranslations",{chat:d,isEnabled:i})&&(t=(0,V.Rd)(),t=(0,w.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,R.Z1J)(t,s);d?.isForum&&d.isForumAsMessages!==i&&(t=(0,w.a4)(t,s,{isForumAsMessages:i||void 0}),(0,V.R3)(t),(0,f.t9)("setViewForumAsMessages",{chat:d,isEnabled:i}))})),(0,V.iw)("loadChannelRecommendations",(async(t,e,a)=>{const{chatId:s}=a,i=s?(0,R.Z1J)(t,s):void 0;if(s&&!i)return;if(!s&&(0,R.D2x)(t,d.ST4))return;const o=await(0,f.t9)("fetchChannelRecommendations",{chat:i});if(!o)return;const{similarChannels:n,count:r}=o,c=(0,h.ee)(n,"id");t=(0,V.Rd)(),t=(0,w.fZ)(t,c),t=(0,w.BY)(t,s||d.ST4,Object.keys(c),r),(0,V.R3)(t)})),(0,V.iw)("toggleChannelRecommendations",((t,e,a)=>{const{chatId:s}=a;(0,R.Z1J)(t,s)&&(t=(0,w.VO)(t,s),(0,V.R3)(t))})),(0,V.iw)("resolveBusinessChatLink",(async(t,e,a)=>{const{slug:s,tabId:i=(0,c._w)()}=a,d=await(0,f.t9)("resolveBusinessChatLink",{slug:s});if(!d)return void e.showNotification({message:u.Iu("BusinessLink.ErrorExpired"),tabId:i});const{users:o,chats:n,chatLink:r}=d;t=(0,V.Rd)(),t=(0,w.Sh)(t,(0,h.ee)(o,"id")),t=(0,w.fZ)(t,(0,h.ee)(n,"id")),(0,V.R3)(t),e.openChatWithDraft({chatId:r.chatId,text:r.text,tabId:i})})),(0,V.iw)("requestCollectibleInfo",(async(t,e,a)=>{const{type:s,collectible:i,userId:d,tabId:n=(0,c._w)()}=a;let r;if("phone"===s&&(r={phone:i}),"username"===s&&(r={username:i}),!r)return;const l=await(0,f.t9)("fetchCollectionInfo",r);l?(t=(0,V.Rd)(),t=(0,m.i)(t,{collectibleInfoModal:{...l,type:s,collectible:i,userId:d}},n),(0,V.R3)(t)):(0,o.TE)(i)}))},88422:(t,e,a)=>{a.d(e,{CW:()=>_,EP:()=>v,FF:()=>F,Mt:()=>S,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),b=a(42431),V=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,b.$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,b.$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,b.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,V.Co)(t,s);if(!r)return void e.showNotification({message:n.Iu("NoUsernameFound"),tabId:o});t=(0,u.Rd)();const c=await(0,V.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(),_(t=(0,u.Rd)(),e,!0,l);const{groupCalls:{activeGroupCallId:h}}=t;let I=i?(0,b.$5)(t,i):(0,b.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,V.ft)(t,e,a,l),t=(0,u.Rd)(),I=(0,b.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,b.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(),_(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 S(){C?.pause(),m=void 0,C=void 0}function _(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.f95920289e7b822055fc.js.map
|