mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-11 16:49:44 +01:00
2 lines
305 KiB
JavaScript
2 lines
305 KiB
JavaScript
(()=>{var e,t,n={6514:(e,t,n)=>{"use strict";var s={};n.r(s),n.d(s,{Type:()=>yt,clear:()=>It,fetch:()=>bt,save:()=>wt});var a={};n.r(a),n.d(a,{addChatMembers:()=>Cn,answerCallbackButton:()=>va,blockContact:()=>na,checkChatUsername:()=>Ts,checkPassword:()=>qs,checkUsername:()=>Js,clearDraft:()=>zt,clearPassword:()=>Hs,createChannel:()=>jt,createGroupChat:()=>Yt,deleteChannel:()=>Zt,deleteChat:()=>Qt,deleteChatFolder:()=>rn,deleteChatMember:()=>Pn,deleteChatUser:()=>Jt,deleteHistory:()=>Hn,deleteMessages:()=>Ln,deleteScheduledMessages:()=>qn,deleteUser:()=>hs,destroy:()=>kt,disconnect:()=>Rt,downloadMedia:()=>Tt,editChatFolder:()=>on,editChatPhoto:()=>en,editMessage:()=>xn,faveSticker:()=>Is,fetchAnimatedEmojis:()=>Ps,fetchAuthorizations:()=>aa,fetchBlockedContacts:()=>ta,fetchChat:()=>Ht,fetchChatFolders:()=>sn,fetchChats:()=>Ot,fetchContactList:()=>gs,fetchContentSettings:()=>ba,fetchCountryList:()=>ls,fetchCurrentUser:()=>Vt,fetchEmojiKeywords:()=>Us,fetchFavoriteStickers:()=>bs,fetchFeaturedStickers:()=>ws,fetchFullChat:()=>Lt,fetchFullUser:()=>cs,fetchGroupsForDiscussion:()=>yn,fetchInlineBot:()=>Sa,fetchInlineBotResults:()=>Ma,fetchLangPack:()=>ga,fetchLangStrings:()=>pa,fetchLanguages:()=>ua,fetchMembers:()=>_n,fetchMessage:()=>En,fetchMessages:()=>Un,fetchNearestCountry:()=>ds,fetchNotificationExceptions:()=>ra,fetchNotificationSettings:()=>ca,fetchPinnedMessages:()=>ss,fetchPrivacySettings:()=>fa,fetchProfilePhotos:()=>ms,fetchRecentStickers:()=>ys,fetchRecommendedChatFolders:()=>an,fetchSavedGifs:()=>As,fetchScheduledHistory:()=>es,fetchStickerSets:()=>_s,fetchStickers:()=>Cs,fetchStickersForEmoji:()=>Rs,fetchTopInlineBots:()=>Aa,fetchTopUsers:()=>us,fetchUsers:()=>ps,fetchWallpapers:()=>Ys,fetchWebPagePreview:()=>Jn,findFirstMessageIdAfterDate:()=>Yn,forwardMessages:()=>Zn,getChatByUsername:()=>dn,getPasswordInfo:()=>Os,getPaymentForm:()=>Ba,getReceipt:()=>xa,importChatInvite:()=>Sn,installStickerSet:()=>Ss,joinChannel:()=>$t,leaveChannel:()=>Xt,loadPollOptionResults:()=>Xn,markMessageListRead:()=>Kn,markMessagesRead:()=>zn,migrateChat:()=>wn,openChatByInvite:()=>In,pinMessage:()=>Fn,provideAuthCode:()=>lt,provideAuthPassword:()=>ut,provideAuthPhoneNumber:()=>dt,provideAuthRegistration:()=>gt,provideRecoveryEmailCode:()=>zs,registerDevice:()=>ha,reportMessages:()=>Gn,requestChatUpdate:()=>Gt,requestThreadInfoUpdate:()=>Wn,rescheduleMessage:()=>Vn,restartAuth:()=>pt,restartAuthWithQr:()=>ft,saveDraft:()=>Kt,searchChats:()=>qt,searchGifs:()=>ks,searchMessagesGlobal:()=>$n,searchMessagesLocal:()=>jn,searchStickers:()=>vs,sendInlineBotResult:()=>ka,sendMessage:()=>Tn,sendPaymentForm:()=>Ta,sendPollVote:()=>Qn,sendScheduledMessages:()=>ts,setChatUsername:()=>Bs,setDiscussionGroup:()=>bn,setPrivacySettings:()=>_a,startBot:()=>Ra,terminateAllAuthorizations:()=>oa,terminateAuthorization:()=>ia,toggleChatArchived:()=>nn,toggleChatPinned:()=>tn,toggleDialogUnread:()=>cn,togglePreHistoryHidden:()=>ln,toggleSignatures:()=>mn,unblockContact:()=>sa,uninstallStickerSet:()=>Ms,unpinAllMessages:()=>On,unregisterDevice:()=>ma,updateChatAbout:()=>hn,updateChatAdmin:()=>pn,updateChatDefaultBannedRights:()=>un,updateChatMemberBannedRights:()=>gn,updateChatMutedState:()=>Wt,updateChatTitle:()=>fn,updateContact:()=>fs,updateContactSignUpNotification:()=>da,updateContentSettings:()=>wa,updateIsOnline:()=>ya,updateNotificationSettings:()=>la,updatePassword:()=>Gs,updatePrivateLink:()=>xs,updateProfile:()=>$s,updateProfilePhoto:()=>Xs,updateRecoveryEmail:()=>Ks,updateUsername:()=>Qs,uploadProfilePhoto:()=>Zs,uploadWallpaper:()=>ea,validateRequestedInfo:()=>Da});const i=("undefined"!=typeof window&&window.innerHeight,Math.round(425)),o=new Set(["newMessage","newScheduledMessage","deleteMessages","deleteScheduledMessages","deleteHistory"]),r=new Set(["image/png","image/gif","image/jpeg"]),c=new Set(["video/mp4"]);let d,l;new Set([...r,...c]);var u=n(3522);function g(e,t){return e.reduce(((e,n)=>(e[n[t]]=n,e)),{})}function p(e,t){return t.reduce(((t,n)=>(t[n]=e[n],t)),{})}function f(e){return e.hasOwnProperty("userId")}function h(e){return e.hasOwnProperty("chatId")}function m(e,t=!1,n="image/jpeg"){return`${t?"":`data:${n};base64,`}${btoa(String.fromCharCode(...e))}`}function _(e){if(!e)return;const{flags:t,CONSTRUCTOR_ID:n,SUBCLASS_OF_ID:s,className:a,classType:i,...o}=e;return o}const y=e=>Math.floor(Date.now()/1e3)+e;function b(e,t=!1){const n=Boolean("min"in e&&e.min),s="accessHash"in e&&String(e.accessHash),a="photo"in e&&e.photo&&E(e.photo),i=Boolean("signatures"in e&&e.signatures);return{isMin:n,hasPrivateLink:Boolean("hasLink"in e&&e.hasLink),isSignaturesShown:i,...s&&{accessHash:s},...a&&{avatarHash:a},...(e instanceof u.Api.Channel||e instanceof u.Api.User)&&{username:e.username},..."verified"in e&&{isVerified:e.verified},..."callActive"in e&&{isCallActive:e.callActive},..."callNotEmpty"in e&&{isCallNotEmpty:e.callNotEmpty},...(e instanceof u.Api.Chat||e instanceof u.Api.Channel)&&{...e.participantsCount&&{membersCount:e.participantsCount},joinDate:e.date},...t&&{isSupport:!0},...I(e),..."creator"in e&&{isCreator:e.creator},...C(e),...P(e)}}function w(e,t,n){const{peer:s,folderId:a,unreadMark:i,unreadCount:o,unreadMentionsCount:r,notifySettings:{silent:c,muteUntil:d},readOutboxMaxId:l,readInboxMaxId:g,draft:p}=e,f=c||"number"==typeof d&&y(n)<d;return{id:A(s),...a&&{folderId:a},type:M(t),title:R(s,t),lastReadOutboxMessageId:l,lastReadInboxMessageId:g,unreadCount:o,unreadMentionsCount:r,isMuted:f,...i&&{hasUnreadMark:!0},...p instanceof u.Api.DraftMessage&&{draftDate:p.date},...b(t)}}function I(e){return e instanceof u.Api.Chat||e instanceof u.Api.Channel?{adminRights:_(e.adminRights),currentUserBannedRights:e instanceof u.Api.Channel?_(e.bannedRights):void 0,defaultBannedRights:_(e.defaultBannedRights)}:{}}function C(e){if(e instanceof u.Api.ChatForbidden||e instanceof u.Api.ChannelForbidden)return{isRestricted:!0};const t={};if("restricted"in e){const n=e.restricted?function(e){if(!e)return;const t=e.find((({platform:e})=>"all"===e));return t?p(t,["reason","text"]):void 0}(e.restrictionReason):void 0;n&&Object.assign(t,{isRestricted:!0,restrictionReason:n})}return e instanceof u.Api.Chat&&Object.assign(t,{isNotJoined:e.left,isRestricted:e.kicked}),e instanceof u.Api.Channel&&Object.assign(t,{isNotJoined:e.left}),t}function P(e){return e instanceof u.Api.Chat&&e.migratedTo&&!(e.migratedTo instanceof u.Api.InputChannelEmpty)?{migratedTo:{chatId:A(e.migratedTo),...e.migratedTo instanceof u.Api.InputChannel&&{accessHash:e.migratedTo.accessHash.toString()}}}:{}}function v(e,t=!1,n=!1){if(e instanceof u.Api.Chat||e instanceof u.Api.Channel||e instanceof u.Api.User||n&&(e instanceof u.Api.ChatForbidden||e instanceof u.Api.ChannelForbidden))return{id:e instanceof u.Api.User?e.id:-e.id,type:M(e),title:e instanceof u.Api.User?U(e):e.title,...b(e,t)}}function A(e){return f(e)?e.userId:h(e)?-e.chatId:-e.channelId}function S(e){return function(e){return e.hasOwnProperty("userId")}(e)?e.userId:function(e){return e.hasOwnProperty("chatId")}(e)?-e.chatId:function(e){return e.hasOwnProperty("channelId")}(e)?-e.channelId:void 0}function M(e){return e instanceof u.Api.User||e instanceof u.Api.UserEmpty?"chatTypePrivate":e instanceof u.Api.Chat||e instanceof u.Api.ChatForbidden||e instanceof u.Api.ChatEmpty?"chatTypeBasicGroup":e.megagroup?"chatTypeSuperGroup":"chatTypeChannel"}function k(e){return f(e)?`user${e.userId}`:h(e)?`chat${e.chatId}`:`chat${e.channelId}`}function R(e,t){return f(e)?U(t):t.title}function U(e){return e.firstName?`${e.firstName}${e.lastName?` ${e.lastName}`:""}`:e.lastName||void 0}function E(e){if("photoId"in e)return e.photoId.toString()}function D(e){return{userId:e instanceof u.Api.ChannelParticipantBanned||e instanceof u.Api.ChannelParticipantLeft?A(e.peer):e.userId,inviterId:"inviterId"in e?e.inviterId:void 0,joinedDate:"date"in e?e.date:void 0,kickedByUserId:"kickedBy"in e?e.kickedBy:void 0,promotedByUserId:"promotedBy"in e?e.promotedBy:void 0,bannedRights:"bannedRights"in e?_(e.bannedRights):void 0,adminRights:"adminRights"in e?_(e.adminRights):void 0,customTitle:"rank"in e?e.rank:void 0,...(e instanceof u.Api.ChannelParticipantAdmin||e instanceof u.Api.ChatParticipantAdmin)&&{isAdmin:!0},...(e instanceof u.Api.ChannelParticipantCreator||e instanceof u.Api.ChatParticipantCreator)&&{isOwner:!0}}}function T(e){return e instanceof u.Api.ChatParticipants||e instanceof u.Api.channels.ChannelParticipants?e.participants.map(D).filter(Boolean):void 0}function B(e,t){let n="";if(!(e.action instanceof u.Api.SendMessageCancelAction))return e.action instanceof u.Api.SendMessageTypingAction?n="lng_user_typing":e.action instanceof u.Api.SendMessageRecordVideoAction?n="lng_send_action_record_video":e.action instanceof u.Api.SendMessageUploadVideoAction?n="lng_send_action_upload_video":e.action instanceof u.Api.SendMessageRecordAudioAction?n="lng_send_action_record_audio":e.action instanceof u.Api.SendMessageUploadAudioAction?n="lng_send_action_upload_audio":e.action instanceof u.Api.SendMessageUploadPhotoAction?n="lng_send_action_upload_photo":e.action instanceof u.Api.SendMessageUploadDocumentAction?n="lng_send_action_upload_file":e.action instanceof u.Api.SendMessageGeoLocationAction?n="selecting a location to share":e.action instanceof u.Api.SendMessageChooseContactAction?n="selecting a contact to share":e.action instanceof u.Api.SendMessageGamePlayAction?n="lng_playing_game":e.action instanceof u.Api.SendMessageRecordRoundAction?n="lng_send_action_record_round":e.action instanceof u.Api.SendMessageUploadRoundAction&&(n="lng_send_action_upload_round"),{action:n,...!(e instanceof u.Api.UpdateUserTyping)&&{userId:A(e.fromId)},timestamp:Date.now()+1e3*t}}function x(e){return{...(t=e,n=["id","title","emoticon","contacts","nonContacts","groups","bots","excludeMuted","excludeRead","excludeArchived"],n.reduce(((e,n)=>(t[n]&&(e[n]=t[n]),e)),{})),channels:e.broadcasts,pinnedChatIds:e.pinnedPeers.map(S).filter(Boolean),includedChatIds:e.includePeers.map(S).filter(Boolean),excludedChatIds:e.excludePeers.map(S).filter(Boolean)};var t,n}function V({filter:e,description:t}){return{...x(e),description:t}}function N(e){return e.reduce(((e,t)=>e.concat(t.commands.map((e=>({botId:t.userId,..._(e)}))))),[])}var F=n(8960);function O(e,t,n){return'<?xml version="1.0" encoding="utf-8"?><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 {{width}} {{height}}" xml:space="preserve"><path fill-opacity="0.1" d="{{path}}" /></svg>'.replace("{{path}}",function(e){let t="M";const n=e.length;for(let s=0;s<n;s++){const n=e[s];n>=192?t+="AACAAAAHAAALMAAAQASTAVAAAZaacaaaahaaalmaaaqastava.az0123456789-,"[n-128-64]:(n>=128?t+=",":n>=64&&(t+="-"),t+=String(63&n))}return t+="z",t}(e)).replace("{{width}}",String(t)).replace("{{height}}",String(n))}const L={w:100,h:100};function q(e,t){if(!e||!e.length)return;const n=e.find((e=>e instanceof u.Api.PhotoStrippedSize));if(!n)return;const s=e.filter((e=>e instanceof u.Api.PhotoSize)),{w:a,h:i}=s.length?s[s.length-1]:L,{bytes:o}=n;return{dataUri:m(t&&"image/jpeg"!==t?o:(0,F.strippedPhotoToJpg)(o),void 0,t),width:a,height:i}}function H(e){const t=e.sizes.filter((e=>e instanceof u.Api.PhotoSize||e instanceof u.Api.PhotoSizeProgressive)).map(G);return{id:String(e.id),thumbnail:q(e.sizes),sizes:t}}function G(e){const{w:t,h:n,type:s}=e;return{width:t,height:n,type:s}}const K={localMessages:{},chats:{},users:{},messages:{},documents:{},stickerSets:{},photos:{},webDocuments:{}},z="application/x-tgsticker";function W(e){if(e instanceof u.Api.DocumentEmpty)return;const t=e.attributes.find((e=>e instanceof u.Api.DocumentAttributeSticker)),n=e.mimeType===z&&e.attributes.find((e=>e instanceof u.Api.DocumentAttributeFilename));if(!t&&!n)return;const s=e.attributes.find((e=>e instanceof u.Api.DocumentAttributeImageSize)),a=t&&t.stickerset instanceof u.Api.InputStickerSetID?t.stickerset:void 0,i=null==t?void 0:t.alt,o=e.mimeType===z,r=e.thumbs&&e.thumbs.find((e=>e instanceof u.Api.PhotoCachedSize)),c=e.thumbs&&e.thumbs.find((e=>e instanceof u.Api.PhotoPathSize)),d=r?function(e){const{w:t,h:n,bytes:s}=e;return{dataUri:m(s,void 0,"image/webp"),width:t,height:n}}(r):c&&s?function(e,t){const{w:n,h:s}=t;return{dataUri:`data:image/svg+xml;utf8,${O(e.bytes,n,s)}`,width:n,height:s}}(c,s):void 0,{w:l,h:g}=r||s||{};return{id:String(e.id),stickerSetId:a?String(a.id):"MEMOJI_STICKER",stickerSetAccessHash:a&&String(a.accessHash),emoji:i,isAnimated:o,width:l,height:g,thumbnail:d}}function j(e){const{archived:t,animated:n,installedDate:s,id:a,accessHash:i,title:o,thumbs:r,count:c,hash:d,shortName:l}=e;return{archived:t,isAnimated:n,installedDate:s,id:String(a),accessHash:String(i),title:o,hasThumbnail:Boolean(null==r?void 0:r.length),count:c,hash:d,shortName:l}}function $(e){const t=j(e.set),n=e instanceof u.Api.StickerSetMultiCovered?e.covers:[e.cover];return t.covers=[],n.forEach((e=>{if(e instanceof u.Api.Document){const n=W(e);n&&(t.covers.push(n),K.documents[String(e.id)]=e)}})),t}function J(e,t){let n=0;const s=new Array(t),a=e.length/t,i=e[0],o=e[e.length-1];for(let l=0;l<t;l++){var r,c,d;const t=Math.floor(l*a),u=((null!==(r=e[t-1])&&void 0!==r?r:i)+(null!==(c=e[t])&&void 0!==c?c:i)+(null!==(d=e[t+1])&&void 0!==d?d:o))/3;s[l]=u,n<u&&(n=u)}return{data:s,peak:n}}var Q=n(4736),X=n.n(Q),Z=n(9618);let Y,ee;!function(e){e.Bold="MessageEntityBold",e.Blockquote="MessageEntityBlockquote",e.BotCommand="MessageEntityBotCommand",e.Cashtag="MessageEntityCashtag",e.Code="MessageEntityCode",e.Email="MessageEntityEmail",e.Hashtag="MessageEntityHashtag",e.Italic="MessageEntityItalic",e.MentionName="MessageEntityMentionName",e.Mention="MessageEntityMention",e.Phone="MessageEntityPhone",e.Pre="MessageEntityPre",e.Strike="MessageEntityStrike",e.TextUrl="MessageEntityTextUrl",e.Url="MessageEntityUrl",e.Underline="MessageEntityUnderline",e.Unknown="MessageEntityUnknown"}(Y||(Y={})),function(e){e[e.BlobUrl=0]="BlobUrl",e[e.Lottie=1]="Lottie",e[e.Progressive=2]="Progressive",e[e.Stream=3]="Stream"}(ee||(ee={}));var te=n(8764).Buffer;function ne(e){return e>0?"user":e<=-1e9?"channel":"chat"}function se(e){return e>0?new u.Api.PeerUser({userId:e}):e<=-1e9?new u.Api.PeerChannel({channelId:-e}):new u.Api.PeerChat({chatId:-e})}function ae(e,t){return e>0||e<=-1e9?e>0?new u.Api.InputPeerUser({userId:e,accessHash:X()(t)}):new u.Api.InputPeerChannel({channelId:-e,accessHash:X()(t)}):new u.Api.InputPeerChat({chatId:-e})}function ie(e){if(e>0){const{accessHash:t}=K.users[e]||{};return t?new u.Api.InputPeerUser({userId:e,accessHash:t}):void 0}if(e<=-1e9){const{accessHash:t}=K.chats[-e]||{};return t?new u.Api.InputPeerChannel({channelId:-e,accessHash:t}):void 0}return new u.Api.InputPeerChat({chatId:-e})}function oe(e,t){return e>0?new u.Api.InputUser({userId:e,accessHash:X()(t)}):e<=-1e9?new u.Api.InputChannel({channelId:-e,accessHash:X()(t)}):-e}function re(e,t){return new u.Api.InputStickerSetID({id:X()(e),accessHash:X()(t)})}function ce(e){const t=K.documents[e.id];if(t)return new u.Api.InputDocument(p(t,["id","accessHash","fileReference"]))}function de(e){const t=ce(e);if(t)return new u.Api.InputMediaDocument({id:t})}function le(){return(0,Z.readBigIntFromBuffer)((0,Z.generateRandomBytes)(8),!0,!0)}function ue(e,t,n){return new u.Api.Message({id:e,peerId:se(t),fromId:se(t),media:n.media})}function ge(e){const{type:t,offset:n,length:s,url:a,userId:i}=e,o=i?K.users[i]:void 0;switch(t){case Y.Bold:return new u.Api.MessageEntityBold({offset:n,length:s});case Y.Italic:return new u.Api.MessageEntityItalic({offset:n,length:s});case Y.Underline:return new u.Api.MessageEntityUnderline({offset:n,length:s});case Y.Strike:return new u.Api.MessageEntityStrike({offset:n,length:s});case Y.Code:return new u.Api.MessageEntityCode({offset:n,length:s});case Y.Pre:return new u.Api.MessageEntityPre({offset:n,length:s,language:""});case Y.Blockquote:return new u.Api.MessageEntityBlockquote({offset:n,length:s});case Y.TextUrl:return new u.Api.MessageEntityTextUrl({offset:n,length:s,url:a});case Y.Url:return new u.Api.MessageEntityUrl({offset:n,length:s});case Y.Hashtag:return new u.Api.MessageEntityHashtag({offset:n,length:s});case Y.MentionName:return new u.Api.InputMessageEntityMentionName({offset:n,length:s,userId:new u.Api.InputUser({userId:i,accessHash:o.accessHash})});default:return new u.Api.MessageEntityUnknown({offset:n,length:s})}}function pe(e){let t=0;return e.forEach((e=>{t=(20261*t&2147483647)+e&2147483647})),t}function fe(e){const{media:t}=e;return!!t&&(t instanceof u.Api.MessageMediaPhoto||t instanceof u.Api.MessageMediaDocument||t instanceof u.Api.MessageMediaWebPage&&t.webpage instanceof u.Api.WebPage&&(t.webpage.photo instanceof u.Api.Photo||t.webpage.document instanceof u.Api.Document&&t.webpage.document.mimeType.startsWith("video")))}function he({phone:e,firstName:t,lastName:n}){return new u.Api.InputPhoneContact({clientId:X()(1),phone:e,firstName:t,lastName:n})}function me(e,t=0){return new u.Api.ChatBannedRights({...e,untilDate:t})}function _e(e){return new u.Api.ChatAdminRights(e)}function ye(e){const{shippingAddress:t}=e;return new u.Api.PaymentRequestedInfo({...e,shippingAddress:t?new u.Api.PostAddress(t):void 0})}function be(e){switch(e){case"phoneNumber":return new u.Api.InputPrivacyKeyPhoneNumber;case"lastSeen":return new u.Api.InputPrivacyKeyStatusTimestamp;case"profilePhoto":return new u.Api.InputPrivacyKeyProfilePhoto;case"forwards":return new u.Api.InputPrivacyKeyForwards;case"chatInvite":return new u.Api.InputPrivacyKeyChatInvite}}function we(e){switch(e){case"spam":return new u.Api.InputReportReasonSpam;case"violence":return new u.Api.InputReportReasonViolence;case"childAbuse":return new u.Api.InputReportReasonChildAbuse;case"pornography":return new u.Api.InputReportReasonPornography;case"copyright":return new u.Api.InputReportReasonCopyright;case"fake":return new u.Api.InputReportReasonFake;case"geoIrrelevant":return new u.Api.InputReportReasonGeoIrrelevant;case"other":return new u.Api.InputReportReasonOther}}function Ie(e){if(e instanceof u.Api.Message||e instanceof u.Api.MessageService)return A(e.peerId)}function Ce(e){const t=`${Ie(e)}-${e.id}`;K.messages[t]=e,e instanceof u.Api.Message&&e.media instanceof u.Api.MessageMediaDocument&&e.media.document instanceof u.Api.Document&&(K.documents[String(e.media.document.id)]=e.media.document),e instanceof u.Api.Message&&e.media instanceof u.Api.MessageMediaWebPage&&e.media.webpage instanceof u.Api.WebPage&&e.media.webpage.document instanceof u.Api.Document&&(K.documents[String(e.media.webpage.document.id)]=e.media.webpage.document),e instanceof u.Api.MessageService&&"photo"in e.action&&Pe(e.action.photo)}function Pe(e){e instanceof u.Api.Photo&&(K.photos[String(e.id)]=e)}let ve,Ae,Se=1e9;function Me(e){const t=Ie(e);if(t&&(e instanceof u.Api.Message||e instanceof u.Api.MessageService))return ke(t,e)}function ke(e,t){const n=t.fromId?A(t.fromId):void 0,s=t.peerId?A(t.peerId):void 0,a=!n&&e===ve,i=t.out&&!t.post||a&&!t.fwdFrom;let o={};t.media&&(o={...Ee(t.media)}),!t.message||o.sticker||o.poll||o.contact||(o={...o,text:Re(t.message,t.entities)});const r=t.action&&function(e,t,n,s,a){if(e instanceof u.Api.MessageActionEmpty)return;let i,o,r;const c=[];let d,l="other";const g="users"in e?e.users&&e.users:"userId"in e&&[e.userId]||[];let p;if(e instanceof u.Api.MessageActionChatCreate)r="Notification.CreatedChatWithTitle",c.push("%action_origin%",e.title),l="chatCreate";else if(e instanceof u.Api.MessageActionChatEditTitle)s?(r="Channel.MessageTitleUpdated",c.push(e.title)):(r="Notification.ChangedGroupName",c.push("%action_origin%",e.title));else if(e instanceof u.Api.MessageActionChatEditPhoto)s?r="Channel.MessagePhotoUpdated":(r="Notification.ChangedGroupPhoto",c.push("%action_origin%"));else if(e instanceof u.Api.MessageActionChatDeletePhoto)r=s?"Channel.MessagePhotoRemoved":"Group.MessagePhotoRemoved";else if(e instanceof u.Api.MessageActionChatAddUser)!t||g.includes(t)?(r="Notification.JoinedChat",c.push("%target_user%")):(r="Notification.Invited",c.push("%action_origin%","%target_user%"));else if(e instanceof u.Api.MessageActionChatDeleteUser)!t||g.includes(t)?(r="Notification.LeftChat",c.push("%target_user%")):(r="Notification.Kicked",c.push("%action_origin%","%target_user%"));else if(e instanceof u.Api.MessageActionChatJoinedByLink)r="Notification.JoinedGroupByLink",c.push("%action_origin%");else if(e instanceof u.Api.MessageActionChannelCreate)r="Notification.CreatedChannel";else if(e instanceof u.Api.MessageActionChatMigrateTo)p=A(e),r="Migrated to %target_chat%",c.push("%target_chat%");else if(e instanceof u.Api.MessageActionChannelMigrateFrom)p=A(e),r="Migrated from %target_chat%",c.push("%target_chat%");else if(e instanceof u.Api.MessageActionPinMessage)r="Chat.Service.Group.UpdatedPinnedMessage1",c.push("%action_origin%","%message%");else if(e instanceof u.Api.MessageActionHistoryClear)r="HistoryCleared",l="historyClear";else if(e instanceof u.Api.MessageActionPhoneCall){const t=Boolean(e.duration);if(r=[t?"ChatList.Service":"Chat",e.video?"VideoCall":"Call",a?t?"outgoing":"Outgoing":t?"incoming":"Incoming"].join("."),t){const t=Math.max(Math.round(e.duration/60),1);c.push(`${t} min${t>1?"s":""}`)}}else if(e instanceof u.Api.MessageActionContactSignUp)r="Notification.Joined",c.push("%action_origin%"),l="contactSignUp";else if(e instanceof u.Api.MessageActionPaymentSent)i=Number(e.totalAmount),o=e.currency,r="PaymentSuccessfullyPaid",n&&g.push(n),c.push("%payment_amount%","%target_user%","%product%");else if(e instanceof u.Api.MessageActionGroupCall)if(e.duration){const t=Math.max(Math.round(e.duration/60),1);r="Notification.VoiceChatEnded",c.push(`${t} min${t>1?"s":""}`)}else r="Notification.VoiceChatStartedChannel";else e instanceof u.Api.MessageActionBotAllowed?(r="Chat.Service.BotPermissionAllowed",c.push(e.domain)):r="ChatList.UnsupportedMessage";return"photo"in e&&e.photo instanceof u.Api.Photo&&(Pe(e.photo),d=H(e.photo)),{text:r,type:l,targetUserIds:g,targetChatId:p,photo:d,amount:i,currency:o,translationValues:c}}(t.action,n,s,Boolean(t.post),i);r&&(o.action=r);const{replyToMsgId:c,replyToTopId:d,replyToPeerId:l}=t.replyTo||{},g=t.editDate&&!t.editHide,{inlineButtons:p,keyboardButtons:f,keyboardPlaceholder:h,isKeyboardSingleUse:m}=function(e){const{id:t,replyMarkup:n,media:s}=e;if(!n)return s instanceof u.Api.MessageMediaWebPage&&s.webpage instanceof u.Api.WebPage&&"telegram_message"===s.webpage.type?{inlineButtons:[[{type:"url",text:"Show Message",messageId:t,value:s.webpage.url}]]}:void 0;if(!(n instanceof u.Api.ReplyKeyboardMarkup||n instanceof u.Api.ReplyInlineMarkup))return;const a=n.rows.map((({buttons:e})=>e.map((e=>{let n,a,{text:i}=e;return e instanceof u.Api.KeyboardButton?(n="command",a=i):e instanceof u.Api.KeyboardButtonUrl?(n="url",a=e.url):e instanceof u.Api.KeyboardButtonCallback?(n="callback",a=String(e.data)):e instanceof u.Api.KeyboardButtonRequestPoll?n="requestPoll":e instanceof u.Api.KeyboardButtonBuy?(s instanceof u.Api.MessageMediaInvoice&&s.receiptMsgId&&(i="PaymentReceipt",a=s.receiptMsgId),n="buy"):n="NOT_SUPPORTED",{type:n,text:i,messageId:t,value:a}}))));return{[n instanceof u.Api.ReplyKeyboardMarkup?"keyboardButtons":"inlineButtons"]:a,...n instanceof u.Api.ReplyKeyboardMarkup&&{keyboardPlaceholder:n.placeholder,isKeyboardSingleUse:n.singleUse}}}(t)||{},_=t.fwdFrom&&function(e,t=!1){const n=e.savedFromPeer&&A(e.savedFromPeer),s=e.fromId&&A(e.fromId);return{isChannelPost:Boolean(e.channelPost),channelPostId:e.channelPost,isLinkedChannelPost:Boolean(e.channelPost&&n&&!t),fromChatId:n||s,fromMessageId:e.channelPost||e.savedFromMsgId,senderUserId:s,hiddenUserName:e.fromName,adminTitle:e.postAuthor}}(t.fwdFrom,a),{replies:y,mediaUnread:b,postAuthor:w}=t,I=t.groupedId&&t.groupedId.toString(),C=Boolean(I)&&!(o.document||o.audio),P=t.replyMarkup instanceof u.Api.ReplyKeyboardHide;return{id:t.id,chatId:e,isOutgoing:i,content:o,date:t.date,senderId:n||t.out&&t.post&&ve||e,views:t.views,isFromScheduled:t.fromScheduled,...c&&{replyToMessageId:c},...l&&{replyToChatId:A(l)},...d&&{replyToTopMessageId:d},..._&&{forwardInfo:_},...g&&{isEdited:g},...b&&{isMediaUnread:b},...t.mentioned&&b&&{hasUnreadMention:!0},...t.mentioned&&{isMentioned:!0},...I&&{groupedId:I,isInAlbum:C},inlineButtons:p,...f&&{keyboardButtons:f,keyboardPlaceholder:h,isKeyboardSingleUse:m},...P&&{shouldHideKeyboardButtons:P},...t.viaBotId&&{viaBotId:t.viaBotId},...(null==y?void 0:y.comments)&&{threadInfo:Le(y,t.id,e)},...w&&{adminTitle:w}}}function Re(e,t){return{text:e,...t&&{entities:t.map(Oe)}}}function Ue(e){if(e instanceof u.Api.DraftMessageEmpty)return;const{message:t,entities:n,replyToMsgId:s,date:a}=e;return{formattedText:t?Re(t,n):void 0,replyingToId:s,date:a}}function Ee(e){const t=function(e){if(e instanceof u.Api.MessageMediaDocument&&e.document&&e.document instanceof u.Api.Document)return W(e.document)}(e);if(t)return{sticker:t};const n=function(e){if(e instanceof u.Api.MessageMediaPhoto&&e.photo&&e.photo instanceof u.Api.Photo&&!e.ttlSeconds)return H(e.photo)}(e);if(n)return{photo:n};const s=function(e){if(e instanceof u.Api.MessageMediaDocument&&e.document instanceof u.Api.Document&&e.document.mimeType.startsWith("video"))return De(e.document)}(e);if(s)return{video:s};const a=function(e){if(!(e instanceof u.Api.MessageMediaDocument&&e.document&&e.document instanceof u.Api.Document))return;const t=e.document.attributes.find((e=>e instanceof u.Api.DocumentAttributeAudio));if(!t||t.voice)return;const n=e.document.thumbs&&e.document.thumbs.filter((e=>e instanceof u.Api.PhotoSize)).map((e=>G(e)));return{fileName:Ne(e.document,"audio"),thumbnailSizes:n,...p(e.document,["size","mimeType"]),...p(t,["duration","performer","title"])}}(e);if(a)return{audio:a};const i=function(e){if(!(e instanceof u.Api.MessageMediaDocument&&e.document&&e.document instanceof u.Api.Document))return;const t=e.document.attributes.find((e=>e instanceof u.Api.DocumentAttributeAudio));if(!t||!t.voice)return;const{duration:n,waveform:s}=t;return{duration:n,waveform:s?Array.from(s):void 0}}(e);if(i)return{voice:i};const o=function(e){if(e instanceof u.Api.MessageMediaDocument&&e.document&&!e.ttlSeconds)return Te(e.document)}(e);if(o)return{document:o};const r=function(e){if(e instanceof u.Api.MessageMediaContact)return p(e,["firstName","lastName","phoneNumber","userId"])}(e);if(r)return{contact:r};const c=function(e){if(e instanceof u.Api.MessageMediaPoll)return Be(e.poll,e.results)}(e);if(c)return{poll:c};const d=Ve(e);if(d)return{webPage:d};const l=function(e){if(e instanceof u.Api.MessageMediaInvoice)return function(e){const{description:t,title:n,photo:s,test:a,totalAmount:i,currency:o,receiptMsgId:r}=e;return{text:t,title:n,photoUrl:null==s?void 0:s.url,receiptMsgId:r,amount:Number(i),currency:o,isTest:a}}(e)}(e);return l?{invoice:l}:void 0}function De(e){if(e instanceof u.Api.DocumentEmpty)return;const{id:t,mimeType:n,thumbs:s,size:a,attributes:i}=e;if("video/quicktime"===n&&!self.isMovSupported)return;const o=i.find((e=>e instanceof u.Api.DocumentAttributeVideo));if(!o)return;const r=i.find((e=>e instanceof u.Api.DocumentAttributeAnimated)),{duration:c,w:d,h:l,supportsStreaming:g=!1,roundMessage:p=!1}=o;return{id:String(t),mimeType:n,duration:c,fileName:Ne(e,"video"),width:d,height:l,supportsStreaming:g,isRound:p,isGif:Boolean(r),thumbnail:q(s),size:a}}function Te(e){if(!(e instanceof u.Api.Document))return;const{id:t,size:n,mimeType:s,date:a,thumbs:i,attributes:o}=e,d=i&&q(i);let l,g;const p=i&&i.find((e=>e instanceof u.Api.PhotoSize));if(p)if(g={width:p.w,height:p.h},r.has(s)){l="photo";const e=o.find((e=>e instanceof u.Api.DocumentAttributeImageSize));if(e){const{w:t,h:n}=e;g={width:t,height:n}}}else c.has(s)&&(l="video");return{id:String(t),size:n,mimeType:s,timestamp:a,fileName:Ne(e),thumbnail:d,mediaType:l,mediaSize:g}}function Be(e,t){const{id:n,answers:s}=e,a=s.map((e=>({text:e.text,option:String.fromCharCode(...e.option)})));return{id:n.toString(),summary:{isPublic:e.publicVoters,...p(e,["closed","multipleChoice","quiz","question","closePeriod","closeDate"]),answers:a},results:xe(t)}}function xe(e){const{results:t,totalVoters:n,recentVoters:s,solution:a,solutionEntities:i}=e;return{totalVoters:n,recentVoterIds:s,results:t&&t.map((({option:e,chosen:t,correct:n,voters:s})=>({isChosen:t,isCorrect:n,option:String.fromCharCode(...e),votersCount:s}))),solution:a,...i&&{solutionEntities:i.map(Oe)}}}function Ve(e){if(!(e instanceof u.Api.MessageMediaWebPage&&e.webpage instanceof u.Api.WebPage))return;const{id:t,photo:n,document:s}=e.webpage;let a;return s instanceof u.Api.Document&&s.mimeType.startsWith("video/")&&(a=De(s)),{id:Number(t),...p(e.webpage,["url","displayUrl","type","siteName","title","description","duration"]),photo:n instanceof u.Api.Photo?H(n):void 0,document:!a&&s?Te(s):void 0,video:a}}function Ne(e,t="file"){const{mimeType:n,attributes:s}=e,a=s.find((e=>e instanceof u.Api.DocumentAttributeFilename));if(a)return a.fileName;const i=n.split("/")[1];return`${t}${String(e.id)}.${i}`}function Fe(e,t){return{poll:{id:t.toString(),summary:p(e.summary,["question","answers"]),results:{}}}}function Oe(e){const{className:t,offset:n,length:s}=e;return{type:t,offset:n,length:s,..."userId"in e&&"number"==typeof e.userId&&{userId:e.userId},..."url"in e&&{url:e.url}}}function Le(e,t,n){const{channelId:s,replies:a,maxId:i,readMaxId:o,recentRepliers:r}=e;if(777!==s)return{threadId:t,...n!==s?{chatId:A({channelId:s}),originChannelId:n}:{chatId:n},messagesCount:a,lastMessageId:i,lastReadInboxMessageId:o,...r&&{recentReplierIds:r.map(A)}}}function qe(e){const{about:t,commonChatsCount:n,pinnedMsgId:s,botInfo:a,blocked:i}=e;return{...He(e.user),fullInfo:{bio:t,commonChatsCount:n,pinnedMessageId:s,isBlocked:Boolean(i),...a&&{botDescription:a.description},...a&&a.commands.length&&{botCommands:Ke(e.user.id,a)}}}}function He(e){if(!(e instanceof u.Api.User))return;const{id:t,firstName:n,lastName:s}=e,a=e.photo instanceof u.Api.UserProfilePhoto?String(e.photo.photoId):void 0,i=(o=e).bot?"userTypeBot":o.deleted?"userTypeDeleted":"userTypeRegular";var o;return{id:t,isMin:Boolean(e.min),...e.self&&{isSelf:!0},...e.verified&&{isVerified:!0},...(e.contact||e.mutualContact)&&{isContact:!0},type:i,...n&&{firstName:n},..."userTypeBot"===i&&{canBeInvitedToGroup:!e.botNochats},...s&&{lastName:s},username:e.username||"",phoneNumber:e.phone||"",status:Ge(e.status),...e.accessHash&&{accessHash:String(e.accessHash)},...a&&{avatarHash:a},...e.bot&&e.botInlinePlaceholder&&{botPlaceholder:e.botInlinePlaceholder}}}function Ge(e){return!e||e instanceof u.Api.UserStatusEmpty?{type:"userStatusEmpty"}:e instanceof u.Api.UserStatusOnline?{type:"userStatusOnline",expires:e.expires}:e instanceof u.Api.UserStatusOffline?{type:"userStatusOffline",wasOnline:e.wasOnline}:e instanceof u.Api.UserStatusRecently?{type:"userStatusRecently"}:e instanceof u.Api.UserStatusLastWeek?{type:"userStatusLastWeek"}:{type:"userStatusLastMonth"}}function Ke(e,t){return t.commands.map((({command:t,description:n})=>({botId:e,command:t,description:n})))}function ze(e){if(e instanceof u.Api.WallPaperNoFile)return;const{slug:t}=e,n=Te(e.document);return n?{slug:t,document:n}:void 0}function We(e){return{isCurrent:Boolean(e.current),isOfficialApp:Boolean(e.officialApp),isPasswordPending:Boolean(e.passwordPending),hash:String(e.hash),...p(e,["deviceModel","platform","systemVersion","appName","appVersion","dateCreated","dateActive","ip","country","region"])}}function je(e){let t,n,s,a,i;return e.forEach((e=>{e instanceof u.Api.PrivacyValueAllowAll?t=t||"everybody":e instanceof u.Api.PrivacyValueAllowContacts?t=t||"contacts":e instanceof u.Api.PrivacyValueDisallowContacts?t=t||"nonContacts":e instanceof u.Api.PrivacyValueDisallowAll?t=t||"nobody":e instanceof u.Api.PrivacyValueAllowUsers?n=e.users:e instanceof u.Api.PrivacyValueDisallowUsers?a=e.users:e instanceof u.Api.PrivacyValueAllowChatParticipants?s=e.chats.map((e=>-e)):e instanceof u.Api.PrivacyValueDisallowChatParticipants&&(i=e.chats.map((e=>-e)))})),t||(t="nobody"),{visibility:t,allowUserIds:n||[],allowChatIds:s||[],blockUserIds:a||[],blockChatIds:i||[]}}function $e(e,t,n){const{silent:s,muteUntil:a,showPreviews:i,sound:o}=e;return{chatId:A(t),isMuted:s||"number"==typeof a&&y(n)<a,...""===o&&{isSilent:!0},...void 0!==i&&{shouldShowPreviews:Boolean(i)}}}function Je(e,t){const{hidden:n,iso2:s,defaultName:a,name:i}=e,{countryCode:o,prefixes:r,patterns:c}=t||{};return{isHidden:n,iso2:s,defaultName:a,name:i,countryCode:o,prefixes:r,patterns:c}}const Qe=new Set;let Xe=0;function Ze(e,t){if(e instanceof u.connection.UpdateServerTimeOffset)Xe=e.timeOffset;else if(e instanceof u.connection.UpdateConnectionState){let t;switch(e.state){case u.connection.UpdateConnectionState.disconnected:t="connectionStateConnecting";break;case u.connection.UpdateConnectionState.broken:t="connectionStateBroken";break;case u.connection.UpdateConnectionState.connected:default:t="connectionStateReady"}Ae({"@type":"updateConnectionState",connectionState:t})}else if(e instanceof u.Api.UpdateNewMessage||e instanceof u.Api.UpdateNewScheduledMessage||e instanceof u.Api.UpdateNewChannelMessage||e instanceof u.Api.UpdateShortChatMessage||e instanceof u.Api.UpdateShortMessage||e instanceof u.Api.UpdateServiceNotification){let t,a;if(e instanceof u.Api.UpdateShortChatMessage)t=ke(A({chatId:(s=e).chatId}),{...s,fromId:se(s.fromId)});else if(e instanceof u.Api.UpdateShortMessage)t=function(e){return ke(A({userId:e.userId}),{...e,fromId:se(e.out?ve:e.userId)})}(e);else if(e instanceof u.Api.UpdateServiceNotification)t=function(e,t){const n=Se++;let s={};return e.media&&(s={...Ee(e.media)}),!e.message||s.sticker||s.poll||s.contact||(s={...s,text:Re(e.message,e.entities)}),{id:n,chatId:777e3,date:e.inboxDate||t,content:s,isOutgoing:!1}}(e,Date.now()/1e3+Xe),fe(e)&&Ce(ue(t.id,t.chatId,e));else{var n;if(e.message instanceof u.Api.MessageEmpty)return;e.message instanceof u.Api.Message&&fe(e.message)&&Ce(e.message),t=Me(e.message),a="replyMarkup"in e.message&&(null===(n=e.message)||void 0===n?void 0:n.replyMarkup)instanceof u.Api.ReplyKeyboardForceReply&&(!e.message.replyMarkup.selective||t.isMentioned)}const i=e._entities;if(null!=i&&i.length&&(i.filter((e=>e instanceof u.Api.User)).map(He).forEach((e=>{e&&Ae({"@type":"updateUser",id:e.id,user:e})})),i.filter((e=>e instanceof u.Api.Chat||e instanceof u.Api.Channel)).map((e=>v(e))).forEach((e=>{e&&Ae({"@type":"updateChat",id:e.id,chat:e})}))),e instanceof u.Api.UpdateNewScheduledMessage?Ae({"@type":Qe.has(t.id)?"updateScheduledMessage":"newScheduledMessage",id:t.id,chatId:t.chatId,message:t}):Ae({"@type":Qe.has(t.id)?"updateMessage":"newMessage",id:t.id,chatId:t.chatId,message:t,shouldForceReply:a}),e.message instanceof u.Api.MessageService){const{action:n}=e.message;if(n instanceof u.Api.MessageActionChatEditTitle)Ae({"@type":"updateChat",id:t.chatId,chat:{title:n.title}});else if(n instanceof u.Api.MessageActionChatEditPhoto){const s=function(e){if(e instanceof u.Api.PhotoEmpty)return new u.Api.ChatPhotoEmpty;const{dcId:t,id:n}=e;return new u.Api.ChatPhoto({dcId:t,photoId:n})}(n.photo),a=E(s),i=Math.abs(Ie(e.message));K.chats[i]&&(K.chats[i].photo=s),Pe(n.photo),a&&Ae({"@type":"updateChat",id:t.chatId,chat:{avatarHash:a},...n.photo instanceof u.Api.Photo&&{newProfilePhoto:H(n.photo)}})}else if(n instanceof u.Api.MessageActionChatDeletePhoto){const n=Math.abs(Ie(e.message));K.chats[n]&&(K.chats[n].photo=new u.Api.ChatPhotoEmpty),Ae({"@type":"updateChat",id:t.chatId,chat:{avatarHash:void 0}})}else n instanceof u.Api.MessageActionChatDeleteUser?e._entities&&e._entities.some((e=>e instanceof u.Api.User&&!!e.self&&e.id===n.userId))&&(Ae({"@type":"updateChat",id:t.chatId,chat:{isRestricted:!0}}),Ae({"@type":"updateChatLeave",id:t.chatId})):n instanceof u.Api.MessageActionChatAddUser&&e._entities&&e._entities.some((e=>e instanceof u.Api.User&&!!e.self&&n.users.includes(e.id)))&&Ae({"@type":"updateChatJoin",id:t.chatId})}}else if(e instanceof u.Api.UpdateEditMessage||e instanceof u.Api.UpdateEditChannelMessage){if(e.message instanceof u.Api.MessageEmpty)return;e.message instanceof u.Api.Message&&fe(e.message)&&Ce(e.message);const t=Me(e.message);Ae({"@type":"updateMessage",id:t.id,chatId:t.chatId,message:t})}else if(e instanceof u.Api.UpdateDeleteMessages)Ae({"@type":"deleteMessages",ids:e.messages});else if(e instanceof u.Api.UpdateDeleteScheduledMessages)Ae({"@type":"deleteScheduledMessages",ids:e.messages,chatId:S(e.peer)});else if(e instanceof u.Api.UpdateDeleteChannelMessages){const t=A({channelId:e.channelId}),n=e.messages,s=n.filter((e=>K.messages[`${t}-${e}`])),a=n.filter((e=>!K.messages[`${t}-${e}`])),i=n.map((e=>{const n=K.messages[`${t}-${e}`];return n&&n instanceof u.Api.MessageService&&"photo"in n.action?String(n.action.photo.id):void 0})).filter(Boolean);s.length&&Ae({"@type":"deleteMessages",ids:s,chatId:t}),i.length&&Ae({"@type":"deleteProfilePhotos",ids:i,chatId:t}),a.length&&setTimeout((()=>{Ae({"@type":"deleteMessages",ids:a,chatId:t})}),1e3)}else if((t instanceof u.Api.messages.SendMessage||t instanceof u.Api.messages.SendMedia||t instanceof u.Api.messages.SendMultiMedia||t instanceof u.Api.messages.ForwardMessages)&&(e instanceof u.Api.UpdateMessageID||e instanceof u.Api.UpdateShortSentMessage)){let n;"randomId"in e?n=e.randomId:"randomId"in t&&(n=t.randomId);const s=n&&K.localMessages[n.toString()];if(!s)throw new Error("Local message not found");let a;if(e instanceof u.Api.UpdateShortSentMessage){s.content.text&&e.entities&&(a={text:Re(s.content.text.text,e.entities)}),e.media&&(a={...a,...Ee(e.media)});const t=ue(e.id,s.chatId,e);fe(t)&&Ce(t)}Qe.add(e.id);const i="date"in e&&1e3*e.date<Date.now()+1e3*Xe;Ae({"@type":s.isScheduled&&!i?"updateScheduledMessageSendSucceeded":"updateMessageSendSucceeded",chatId:s.chatId,localId:s.id,message:{...s,...a&&{content:{...s.content,...a}},id:e.id,sendingState:void 0,..."date"in e&&{date:e.date}}})}else if(e instanceof u.Api.UpdateReadMessagesContents)Ae({"@type":"updateCommonBoxMessages",ids:e.messages,messageUpdate:{hasUnreadMention:!1,isMediaUnread:!1}});else if(e instanceof u.Api.UpdateChannelReadMessagesContents)Ae({"@type":"updateChannelMessages",channelId:e.channelId,ids:e.messages,messageUpdate:{hasUnreadMention:!1,isMediaUnread:!1}});else if(e instanceof u.Api.UpdateMessagePoll){const{pollId:t,poll:n,results:s}=e;if(n){const e=Be(n,s);Ae({"@type":"updateMessagePoll",pollId:t.toString(),pollUpdate:e})}else{const e=xe(s);Ae({"@type":"updateMessagePoll",pollId:t.toString(),pollUpdate:{results:e}})}}else if(e instanceof u.Api.UpdateMessagePollVote)Ae({"@type":"updateMessagePollVote",pollId:e.pollId.toString(),userId:e.userId,options:e.options.map((e=>String.fromCharCode(...e)))});else if(e instanceof u.Api.UpdateChannelMessageViews)Ae({"@type":"updateMessage",chatId:A({channelId:e.channelId}),id:e.id,message:{views:e.views}});else if(e instanceof u.Api.UpdateReadHistoryInbox)Ae({"@type":"updateChatInbox",id:A(e.peer),chat:{lastReadInboxMessageId:e.maxId,unreadCount:e.stillUnreadCount}});else if(e instanceof u.Api.UpdateReadHistoryOutbox)Ae({"@type":"updateChat",id:A(e.peer),chat:{lastReadOutboxMessageId:e.maxId}});else if(e instanceof u.Api.UpdateReadChannelInbox)Ae({"@type":"updateChat",id:A({channelId:e.channelId}),chat:{lastReadInboxMessageId:e.maxId,unreadCount:e.stillUnreadCount}});else if(e instanceof u.Api.UpdateReadChannelOutbox)Ae({"@type":"updateChat",id:A({channelId:e.channelId}),chat:{lastReadOutboxMessageId:e.maxId}});else if(e instanceof u.Api.UpdateDialogPinned&&e.peer instanceof u.Api.DialogPeer)Ae({"@type":"updateChatPinned",id:A(e.peer.peer),isPinned:e.pinned||!1});else if(e instanceof u.Api.UpdatePinnedDialogs){const t=e.order?e.order.filter((e=>e instanceof u.Api.DialogPeer)).map((e=>A(e.peer))):[];Ae({"@type":"updatePinnedChatIds",ids:t,folderId:e.folderId||void 0})}else if(e instanceof u.Api.UpdateFolderPeers)e.folderPeers.forEach((e=>{const{folderId:t,peer:n}=e;Ae({"@type":"updateChatListType",id:A(n),folderId:t})}));else if(e instanceof u.Api.UpdateDialogFilter){const{id:t,filter:n}=e,s=n?x(n):void 0;Ae({"@type":"updateChatFolder",id:t,folder:s})}else if(e instanceof u.Api.UpdateDialogFilterOrder)Ae({"@type":"updateChatFoldersOrder",orderedIds:e.order});else if(e instanceof u.Api.UpdateChatParticipants){const t=T(e.participants);Ae({"@type":"updateChatMembers",id:A({chatId:e.participants.chatId}),replacedMembers:t})}else if(e instanceof u.Api.UpdateChatParticipantAdd){const t=D(p(e,["userId","inviterId","date"]));Ae({"@type":"updateChatMembers",id:A({chatId:e.chatId}),addedMember:t})}else if(e instanceof u.Api.UpdateChatParticipantDelete){const{userId:t}=e;Ae({"@type":"updateChatMembers",id:A({chatId:e.chatId}),deletedMemberId:t})}else if(e instanceof u.Api.UpdatePinnedMessages||e instanceof u.Api.UpdatePinnedChannelMessages){const t=A(e instanceof u.Api.UpdatePinnedMessages?e.peer:{channelId:e.channelId});Ae({"@type":"updatePinnedIds",chatId:t,messageIds:e.messages,isPinned:e.pinned})}else if(e instanceof u.Api.UpdateNotifySettings&&e.peer instanceof u.Api.NotifyPeer)Ae({"@type":"updateNotifyExceptions",...$e(e.notifySettings,e.peer.peer,Xe)});else if(e instanceof u.Api.UpdateUserTyping||e instanceof u.Api.UpdateChatUserTyping){const t=e instanceof u.Api.UpdateUserTyping?e.userId:A({chatId:e.chatId});Ae({"@type":"updateChatTypingStatus",id:t,typingStatus:B(e,Xe)})}else if(e instanceof u.Api.UpdateChannelUserTyping){const t=A({channelId:e.channelId});Ae({"@type":"updateChatTypingStatus",id:t,typingStatus:B(e,Xe)})}else if(e instanceof u.Api.UpdateChannel){const{_entities:t}=e;if(!t)return;const n=t.find((e=>e instanceof u.Api.Channel||e instanceof u.Api.ChannelForbidden));if(n instanceof u.Api.Channel){const t=v(n);t&&(Ae({"@type":"updateChat",id:t.id,chat:t}),Ae({"@type":t.isNotJoined?"updateChatLeave":"updateChatJoin",id:A({channelId:e.channelId})}))}else if(n instanceof u.Api.ChannelForbidden){const t=A({channelId:e.channelId});Ae({"@type":"updateChat",id:t,chat:{isRestricted:!0}}),Ae({"@type":"updateChatLeave",id:t})}else 0===t.length&&Ae({"@type":"resetMessages",id:A({chatId:e.channelId})})}else if(e instanceof u.Api.UpdateDialogUnreadMark&&e.peer instanceof u.Api.DialogPeer)Ae({"@type":"updateChat",id:A(e.peer.peer),chat:{hasUnreadMark:e.unread}});else if(e instanceof u.Api.UpdateChatDefaultBannedRights)Ae({"@type":"updateChat",id:A(e.peer),chat:{defaultBannedRights:_(e.defaultBannedRights)}});else if(e instanceof u.Api.UpdateUserStatus){const{userId:t,status:n}=e;Ae({"@type":"updateUserStatus",userId:t,status:Ge(n)})}else if(e instanceof u.Api.UpdateUserName){const t=K.users[e.userId],n=null!=t&&t.mutualContact&&!t.self?p(e,["username"]):p(e,["firstName","lastName","username"]);Ae({"@type":"updateUser",id:e.userId,user:n})}else if(e instanceof u.Api.UpdateUserPhoto){const{userId:t,photo:n}=e,s=E(n);K.users[t]&&(K.users[t].photo=n),Ae({"@type":"updateUser",id:t,user:{avatarHash:s}})}else if(e instanceof u.Api.UpdateUserPhone){const{userId:t,phone:n}=e;Ae({"@type":"updateUser",id:t,user:{phoneNumber:n}})}else if(e instanceof u.Api.UpdatePeerSettings){const{_entities:t}=e;if(!t)return;null!=t&&t.length&&(t.filter((e=>e instanceof u.Api.User&&!e.contact)).forEach((e=>{Ae({"@type":"deleteUser",id:e.id})})),t.filter((e=>e instanceof u.Api.User&&e.contact)).map(He).forEach((e=>{e&&Ae({"@type":"updateUser",id:e.id,user:e})})))}else if(e instanceof u.Api.UpdateNotifySettings){const{notifySettings:{showPreviews:t,silent:n,muteUntil:s},peer:{className:a}}=e,i="NotifyUsers"===a?"contact":"NotifyChats"===a?"group":"NotifyBroadcasts"===a?"broadcast":void 0;if(!i)return;Ae({"@type":"updateNotifySettings",peerType:i,isSilent:Boolean(n||"number"==typeof s&&Date.now()+1e3*Xe<1e3*s),shouldShowPreviews:Boolean(t)})}else if(e instanceof u.Api.UpdatePeerBlocked)Ae({"@type":"updatePeerBlocked",id:A(e.peerId),isBlocked:e.blocked});else if(e instanceof u.Api.UpdatePrivacy){const t=function(e){switch(e.className){case"PrivacyKeyPhoneNumber":return"phoneNumber";case"PrivacyKeyStatusTimestamp":return"lastSeen";case"PrivacyKeyProfilePhoto":return"profilePhoto";case"PrivacyKeyForwards":return"forwards";case"PrivacyKeyChatInvite":return"chatInvite"}}(e.key);t&&Ae({"@type":"updatePrivacy",key:t,rules:je(e.rules)})}else e instanceof u.Api.UpdateDraftMessage?Ae({"@type":"draftMessage",chatId:A(e.peer),...Ue(e.draft)}):e instanceof u.Api.UpdateContactsReset?Ae({"@type":"updateResetContactList"}):e instanceof u.Api.UpdateFavedStickers&&Ae({"@type":"updateFavoriteStickers"});var s}const Ye={PHONE_NUMBER_INVALID:"PHONE_NUMBER_INVALID",PHONE_CODE_INVALID:"PHONE_CODE_INVALID",PASSWORD_HASH_INVALID:"PASSWORD_HASH_INVALID",PHONE_PASSWORD_FLOOD:"You have tried logging in too many times"},et={};let tt;function nt(){return tt(ct("authorizationStateWaitPhoneNumber")),new Promise(((e,t)=>{et.resolve=e,et.reject=t}))}function st(e=!1){return tt({...ct("authorizationStateWaitCode"),isCodeViaApp:e}),new Promise(((e,t)=>{et.resolve=e,et.reject=t}))}function at(e){return tt({...ct("authorizationStateWaitPassword"),hint:e}),new Promise((e=>{et.resolve=e}))}function it(){return tt(ct("authorizationStateWaitRegistration")),new Promise((e=>{et.resolve=e}))}function ot(e){return tt({...ct("authorizationStateWaitQrCode"),qrCode:{token:btoa(String.fromCharCode(...e.token)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),expires:e.expires}}),new Promise(((e,t)=>{et.reject=t}))}function rt(e){let t;if(e instanceof u.errors.FloodWaitError){const n=Math.ceil(Number(e.seconds)/60/60);t="Too many attempts. Try again in "+(n>1?`${n} hours`:"an hour")}else t=Ye[e.message];t||(t="Unexpected Error"),tt({"@type":"updateAuthorizationError",message:t})}function ct(e){return{"@type":"updateAuthorizationState",authorizationState:e}}function dt(e){et.resolve&&et.resolve(e)}function lt(e){et.resolve&&et.resolve(e)}function ut(e){et.resolve&&et.resolve(e)}function gt(e){const{firstName:t,lastName:n}=e;et.resolve&&et.resolve([t,n])}function pt(){et.reject&&et.reject(new Error("RESTART_AUTH"))}function ft(){et.reject&&et.reject(new Error("RESTART_AUTH_WITH_QR"))}var ht=n(9832),mt=n(5802);const _t=self.caches;let yt;async function bt(e,t,n,s=!1){if(_t)try{const a=new Request(t.replace(/:/g,"_")),i=await _t.open(e),o=await i.match(a);if(!o)return;const r=o.headers.get("Content-Type");switch(n){case yt.Text:return await o.text();case yt.Blob:{if(t.startsWith("avatar")&&r&&r.startsWith("text"))return;const e=await o.blob();if(t.startsWith("sticker"))return new Blob([e],{type:"image/webp"});const n=!e.type||!s&&e.type.includes("html");let a=e.type||r;return n&&a?(s||(a=a.replace(/html/gi,"")),new Blob([e],{type:a})):e}case yt.Json:return await o.json();default:return}}catch(e){return void console.warn(e)}}async function wt(e,t,n){if(_t)try{const s="string"==typeof n||n instanceof Blob?n:JSON.stringify(n),a=new Request(t.replace(/:/g,"_")),i=new Response(s),o=await _t.open(e);return await o.put(a,i)}catch(e){return void console.warn(e)}}async function It(e){try{if(!_t)return;return await _t.delete(e)}catch(e){return void console.warn(e)}}!function(e){e[e.Text=0]="Text",e[e.Blob=1]="Blob",e[e.Json=2]="Json"}(yt||(yt={}));const Ct=new Set(["msg","sticker","gif","wallpaper","photo","webDocument"]);function Pt(e,t="image/jpeg"){if(e.length<4)return t;let n=t;switch(e.subarray(0,4).reduce(((e,t)=>e+t.toString(16)),"")){case"89504e47":n="image/png";break;case"47494638":n="image/gif";break;case"ffd8ffe0":case"ffd8ffe1":case"ffd8ffe2":case"ffd8ffe3":case"ffd8ffe8":n="image/jpeg";break;case"52494646":n="image/webp"}return n}ht.Logger.setLevel("warn");const vt={build:e=>e};let At,St,Mt=!1;async function kt(){await Dt(new u.Api.auth.LogOut),await St.destroy()}async function Rt(){await St.disconnect()}function Ut(e){At({"@type":"updateSession",sessionData:e})}function Et(e){e instanceof u.connection.UpdateConnectionState?Mt=e.state===u.connection.UpdateConnectionState.connected:e instanceof u.Api.UpdatesTooLong?async function(){try{await Dt(new u.Api.users.GetFullUser({id:new u.Api.InputUserSelf}),void 0,!0)}catch(e){"AUTH_KEY_UNREGISTERED"===e.message&&At({"@type":"updateConnectionState",connectionState:"connectionStateBroken"})}}():e instanceof u.connection.UpdateServerTimeOffset&&At({"@type":"updateServerTimeOffset",serverTimeOffset:e.timeOffset})}async function Dt(e,t=!1,n=!1){if(Mt)try{const n=await St.invoke(e);if(t){let t;n instanceof u.Api.Updates||n instanceof u.Api.UpdatesCombined?t=n:"updates"in n&&(n.updates instanceof u.Api.Updates||n.updates instanceof u.Api.UpdatesCombined)&&(t=n.updates),t?(function(e){const t=[...e.users,...e.chats];e.updates.forEach((e=>{t&&(e._entities=t)}))}(t),t.updates.forEach((t=>{Ze(t,e)}))):n instanceof u.Api.UpdatesTooLong||Ze(n,e)}return n}catch(t){if(n)throw t;return void function(e,t){const n=e.message.startsWith("A wait of")&&(t instanceof u.Api.messages.SendMessage||t instanceof u.Api.messages.SendMedia||t instanceof u.Api.messages.SendMultiMedia),{message:s}=e;At({"@type":"error",error:{message:s,isSlowMode:n,hasErrorKey:!0}})}(t,e)}}function Tt(e,t){return async function({url:e,mediaFormat:t,start:n,end:a,isHtmlAllowed:i},o,r,c){const{data:d,mimeType:l,fullSize:g}=await async function(e,t,n,s,a,i,o,r){const c=e.startsWith("webDocument")?e.match(/(webDocument):(.+)/):e.match(/(avatar|profile|photo|msg|stickerSet|sticker|wallpaper|gif|file)([-\d\w./]+)(\?size=\w+)?/);if(!c)return;if("file"===c[1]){const e=await fetch(c[2]);return{data:await e.arrayBuffer()}}if(!n)return Promise.reject(new Error("ERROR: Client is not connected"));let d,l=c[2];const g=c[3]?c[3].replace("?size=",""):void 0;let p;switch("avatar"===c[1]||"profile"===c[1]?(d=ne(Number(l)),l=Math.abs(Number(l))):d=c[1],d){case"channel":case"chat":p=K.chats[l];break;case"user":p=K.users[l];break;case"msg":p=K.messages[l];break;case"sticker":case"gif":case"wallpaper":p=K.documents[l];break;case"photo":p=K.photos[l];break;case"stickerSet":p=K.stickerSets[l];break;case"webDocument":p=K.webDocuments[l]}if(p){if(Ct.has(d)){o===ee.Stream&&(s.acceptsBuffer=!0);const e=await t.downloadMedia(p,{sizeType:g,start:a,end:i,progressCallback:s,workers:16});let n,c;return p instanceof u.Api.Message?(n=function(e,t){if(e&&e.media)return e.media instanceof u.Api.MessageMediaPhoto?"image/jpeg":e.media instanceof u.Api.MessageMediaDocument&&e.media.document instanceof u.Api.Document?t?e.media.document.attributes.some((e=>e instanceof u.Api.DocumentAttributeSticker))?"image/webp":"image/jpeg":e.media.document.mimeType:e.media instanceof u.Api.MessageMediaWebPage&&e.media.webpage instanceof u.Api.WebPage&&e.media.webpage.document instanceof u.Api.Document?e.media.webpage.document.mimeType:void 0}(p,g),p.media instanceof u.Api.MessageMediaDocument&&p.media.document instanceof u.Api.Document&&(c=p.media.document.size),p.media instanceof u.Api.MessageMediaWebPage&&p.media.webpage instanceof u.Api.WebPage&&p.media.webpage.document instanceof u.Api.Document&&(c=p.media.webpage.document.size)):p instanceof u.Api.Photo?n="image/jpeg":"sticker"===d&&g?n="image/webp":"webDocument"===d?n=p.mimeType:(n=p.mimeType,c=p.size),!r&&n&&(n=n.replace(/html/gi,"")),{mimeType:n,data:e,fullSize:c}}if("stickerSet"===d){const e=await t.downloadStickerSetThumb(p);return{mimeType:o===ee.Lottie?"application/json":Pt(e),data:e}}{const e=await t.downloadProfilePhoto(p,"profile"===c[1]);return{mimeType:Pt(e),data:e}}}}(e,o,r,c,n,a,t,i)||{};if(!d)return;const p=await async function(e,t,n){switch(t){case ee.BlobUrl:return new Blob([e],{type:n});case ee.Lottie:{const t=(0,mt.inflate)(e,{to:"string"});return JSON.parse(t)}case ee.Progressive:return e.buffer}}(d,t,l);if(!p)return;const f=t!==ee.Progressive&&(t!==ee.BlobUrl||p.size<=524288);return s&&f&&wt(e.startsWith("avatar")?"tt-media-avatars":"tt-media",e,p),{prepared:t===ee.Progressive?"":(h=p,h instanceof Blob?URL.createObjectURL(h):h),arrayBuffer:t===ee.Progressive?p:void 0,mimeType:l,fullSize:g};var h}(e,St,Mt,t)}function Bt(e,t){return St.uploadFile({file:e,onProgress:t,workers:16})}function xt(e){return St.updateTwoFaSettings(e)}async function Vt(){const e=await Dt(new u.Api.users.GetFullUser({id:new u.Api.InputUserSelf}));if(!(e&&e.user instanceof u.Api.User))return;K.users[e.user.id]=e.user;const t=qe(e);var n;n=t.id,ve=n,function(e){tt({"@type":"updateCurrentUser",currentUser:e})}(t)}const Nt=2**31-1;let Ft;async function Ot({limit:e,offsetDate:t,archived:n,withPinned:s,serverTimeOffset:a}){const i=await Dt(new u.Api.messages.GetDialogs({offsetPeer:new u.Api.InputPeerEmpty,limit:e,offsetDate:t,folderId:n?1:void 0,...s&&{excludePinned:!0}})),o=s?await Dt(new u.Api.messages.GetPinnedDialogs({folderId:n?1:void 0})):void 0;if(!i||i instanceof u.Api.messages.DialogsNotModified)return;o&&An(o),An(i);const r=g((o?o.messages:[]).concat(i.messages).map(Me).filter(Boolean),"chatId"),c={...o&&vn(o),...vn(i)},d=[],l={},p={},f=(o?o.dialogs:[]).concat(i.dialogs),h=[];f.forEach((e=>{if(!(e instanceof u.Api.Dialog)||!n&&1===e.folderId||n&&1!==e.folderId)return;const t=w(e,c[k(e.peer)],a);if(t.lastMessage=r[t.id],t.isListed=!0,d.push(t),s&&e.pinned&&h.push(t.id),e.draft){const{formattedText:n,replyingToId:s}=Ue(e.draft)||{};n&&(l[t.id]=n),s&&(p[t.id]=s)}}));const m=(o?o.users:[]).concat(i.users).map(He).filter(Boolean),_=d.map((e=>e.id));let y;return y=i instanceof u.Api.messages.DialogsSlice?i.count:_.length,{chatIds:_,chats:d,users:m,draftsById:l,replyingToById:p,orderedPinnedIds:s?h:void 0,totalChatCount:y}}function Lt(e){const{id:t,accessHash:n,adminRights:s}=e;return oe(t,n)instanceof u.Api.InputChannel?async function(e,t,n){var s;const a=await Dt(new u.Api.channels.GetFullChannel({channel:oe(e,t)}));if(!(a&&a.fullChat instanceof u.Api.ChannelFull))return;const{about:i,onlineCount:o,exportedInvite:r,slowmodeSeconds:c,slowmodeNextSendDate:d,migratedFromChatId:l,migratedFromMaxId:g,canViewParticipants:p,linkedChatId:f,hiddenPrehistory:h,call:m,botInfo:_}=a.fullChat,y=r instanceof u.Api.ChatInviteExported?r.link:void 0,{members:b,users:w}=p&&await _n(e,t)||{},{members:I,users:C}=p&&n&&await _n(e,t,"kicked")||{},{members:P,users:S}=p&&n&&await _n(e,t,"admin")||{},M=_?N(_):void 0;if((null==a||null===(s=a.chats)||void 0===s?void 0:s.length)>1){An(a);const[,e]=a.chats,t=v(e,void 0,!0);t&&Ft({"@type":"updateChat",id:t.id,chat:t})}return{fullInfo:{about:i,onlineCount:o,inviteLink:y,slowMode:c?{seconds:c,nextSendDate:d}:void 0,migratedFrom:l?{chatId:A({chatId:l}),maxMessageId:g}:void 0,canViewMembers:p,isPreHistoryHidden:h,members:b,kickedMembers:I,adminMembers:P,groupCallId:m?m.id.toString():void 0,linkedChatId:f?A({chatId:f}):void 0,botCommands:M},users:[...w||[],...C||[],...S||[]]}}(t,n,s):async function(e){const t=await Dt(new u.Api.messages.GetFullChat({chatId:oe(e)}));if(!(t&&t.fullChat instanceof u.Api.ChatFull))return;An(t);const{about:n,participants:s,exportedInvite:a,botInfo:i}=t.fullChat,o=T(s),r=o?o.filter((({isAdmin:e,isOwner:t})=>e||t)):void 0;return{fullInfo:{about:n,members:o,adminMembers:r,canViewMembers:!0,botCommands:i?N(i):void 0,...a&&{inviteLink:a.link}},users:t.users.map(He).filter(Boolean)}}(t)}async function qt({query:e}){const t=await Dt(new u.Api.contacts.Search({q:e}));if(!t)return;An(t);const n=t.myResults.map(A),s=t.chats.concat(t.users).map((e=>v(e))).filter(Boolean),a=t.users.map(He).filter((e=>!!e&&!e.isSelf));return{localChats:s.filter((e=>n.includes(e.id))),localUsers:a.filter((e=>n.includes(e.id))),globalChats:s.filter((e=>!n.includes(e.id))),globalUsers:a.filter((e=>!n.includes(e.id)))}}async function Ht({type:e,user:t}){let n;if("self"===e||"user"===e){const s=await Dt(new u.Api.users.GetUsers({id:["user"===e&&t?oe(t.id,t.accessHash):new u.Api.InputUserSelf]}));if(!s||!s.length)return;[n]=s}else if("support"===e){const e=await Dt(new u.Api.help.GetSupport);if(!e||!e.user)return;n=e.user}const s=v(n,"support"===e);if(s)return Ft({"@type":"updateChat",id:s.id,chat:s}),{chatId:s.id}}async function Gt({chat:e,serverTimeOffset:t}){const{id:n,accessHash:s}=e,a=await Dt(new u.Api.messages.GetPeerDialogs({peers:[new u.Api.InputDialogPeer({peer:ae(n,s)})]}));if(!a)return;const i=a.dialogs[0];if(!(i&&i instanceof u.Api.Dialog))return;const o=vn(a)[k(i.peer)];if(!o)return;An(a);const r=Me(a.messages[0]);Ft({"@type":"updateChat",id:n,chat:{...w(i,o,t),lastMessage:r}})}function Kt({chat:e,text:t,entities:n,replyToMsgId:s}){return Dt(new u.Api.messages.SaveDraft({peer:ae(e.id,e.accessHash),message:t,...n&&{entities:n.map(ge)},replyToMsgId:s}))}function zt(e){return Dt(new u.Api.messages.SaveDraft({peer:ae(e.id,e.accessHash),message:""}))}async function Wt({chat:e,isMuted:t,serverTimeOffset:n}){await Dt(new u.Api.account.UpdateNotifySettings({peer:new u.Api.InputNotifyPeer({peer:ae(e.id,e.accessHash)}),settings:new u.Api.InputPeerNotifySettings({muteUntil:t?Nt:0})})),Ft({"@type":"updateNotifyExceptions",chatId:e.id,isMuted:t}),Gt({chat:e,serverTimeOffset:n})}async function jt({title:e,about:t,users:n}){const s=await Dt(new u.Api.channels.CreateChannel({broadcast:!0,title:e,about:t}),!0);if(!(s instanceof u.Api.Updates))return;const a=s.chats[0];if(!(a&&a instanceof u.Api.Channel))return;const i=v(a);return await Dt(new u.Api.channels.InviteToChannel({channel:oe(i.id,i.accessHash),users:n.map((({id:e,accessHash:t})=>oe(e,t)))})),i}function $t({channelId:e,accessHash:t}){return Dt(new u.Api.channels.JoinChannel({channel:oe(e,t)}),!0)}function Jt({chat:e,user:t}){if("chatTypeBasicGroup"===e.type)return Dt(new u.Api.messages.DeleteChatUser({chatId:oe(e.id,e.accessHash),userId:oe(t.id,t.accessHash)}),!0)}function Qt({chatId:e}){return Dt(new u.Api.messages.DeleteChat({chatId:oe(e)}),!0)}function Xt({channelId:e,accessHash:t}){return Dt(new u.Api.channels.LeaveChannel({channel:oe(e,t)}),!0)}function Zt({channelId:e,accessHash:t}){return Dt(new u.Api.channels.DeleteChannel({channel:oe(e,t)}),!0)}async function Yt({title:e,users:t}){const n=await Dt(new u.Api.messages.CreateChat({title:e,users:t.map((({id:e,accessHash:t})=>oe(e,t)))}),!0);if(!(n instanceof u.Api.Updates))return;const s=n.chats[0];return s&&s instanceof u.Api.Chat?v(s):void 0}async function en({chatId:e,accessHash:t,photo:n}){const s=await Bt(n),a=oe(e,t);return Dt(a instanceof u.Api.InputChannel?new u.Api.channels.EditPhoto({channel:a,photo:new u.Api.InputChatUploadedPhoto({file:s})}):new u.Api.messages.EditChatPhoto({chatId:a,photo:new u.Api.InputChatUploadedPhoto({file:s})}),!0)}async function tn({chat:e,shouldBePinned:t}){const{id:n,accessHash:s}=e;await Dt(new u.Api.messages.ToggleDialogPin({peer:new u.Api.InputDialogPeer({peer:ae(n,s)}),pinned:t||void 0}))&&Ft({"@type":"updateChatPinned",id:e.id,isPinned:t})}function nn({chat:e,folderId:t}){const{id:n,accessHash:s}=e;return Dt(new u.Api.folders.EditPeerFolders({folderPeers:[new u.Api.InputFolderPeer({peer:ae(n,s),folderId:t})]}),!0)}async function sn(){const e=await Dt(new u.Api.messages.GetDialogFilters);if(e)return{byId:g(e.map(x),"id"),orderedIds:e.map((({id:e})=>e))}}async function an(){const e=await Dt(new u.Api.messages.GetSuggestedDialogFilters);if(e)return e.map(V)}async function on({id:e,folderUpdate:t}){const n=function(e){const{emoticon:t,contacts:n,nonContacts:s,groups:a,channels:i,bots:o,excludeArchived:r,excludeMuted:c,excludeRead:d,pinnedChatIds:l,includedChatIds:g,excludedChatIds:p}=e,f=l?l.map(ie).filter(Boolean):[],h=g?g.map(ie).filter(Boolean):[],m=p?p.map(ie).filter(Boolean):[];return new u.Api.DialogFilter({id:e.id,title:e.title,emoticon:t||void 0,contacts:n||void 0,nonContacts:s||void 0,groups:a||void 0,bots:o||void 0,excludeArchived:r||void 0,excludeMuted:c||void 0,excludeRead:d||void 0,broadcasts:i||void 0,pinnedPeers:f,includePeers:h,excludePeers:m})}(t);await Dt(new u.Api.messages.UpdateDialogFilter({id:e,filter:n}))&&Ft({"@type":"updateChatFolder",id:e,folder:t})}async function rn(e){const t=await Dt(new u.Api.messages.UpdateDialogFilter({id:e,filter:void 0})),n=await an();t&&Ft({"@type":"updateChatFolder",id:e,folder:void 0}),n&&Ft({"@type":"updateRecommendedChatFolders",folders:n})}async function cn({chat:e,hasUnreadMark:t}){const{id:n,accessHash:s}=e;await Dt(new u.Api.messages.MarkDialogUnread({peer:new u.Api.InputDialogPeer({peer:ae(n,s)}),unread:t||void 0}))&&Ft({"@type":"updateChat",id:e.id,chat:{hasUnreadMark:t}})}async function dn(e){const t=await Dt(new u.Api.contacts.ResolveUsername({username:e}));if(!t)return;const{users:n,chats:s}=t,a=s.length?v(s[0]):v(n[0]);return a?(An(t),a):void 0}function ln({chat:e,isEnabled:t}){const{id:n,accessHash:s}=e,a=oe(n,s);return Dt(new u.Api.channels.TogglePreHistoryHidden({channel:a,enabled:t}),!0)}function un({chat:e,bannedRights:t}){const{id:n,accessHash:s}=e,a=ae(n,s);return Dt(new u.Api.messages.EditChatDefaultBannedRights({peer:a,bannedRights:me(t)}),!0)}function gn({chat:e,user:t,bannedRights:n,untilDate:s}){const a=oe(e.id,e.accessHash),i=ae(t.id,t.accessHash);return Dt(new u.Api.channels.EditBanned({channel:a,participant:i,bannedRights:me(n,s)}),!0)}function pn({chat:e,user:t,adminRights:n,customTitle:s=""}){const a=oe(e.id,e.accessHash),i=oe(t.id,t.accessHash);return Dt(new u.Api.channels.EditAdmin({channel:a,userId:i,adminRights:_e(n),rank:s}),!0)}async function fn(e,t){const n=oe(e.id,e.accessHash);await Dt(n instanceof u.Api.InputChannel?new u.Api.channels.EditTitle({channel:n,title:t}):new u.Api.messages.EditChatTitle({chatId:n,title:t}),!0)}async function hn(e,t){await Dt(new u.Api.messages.EditChatAbout({peer:ae(e.id,e.accessHash),about:t}))&&Ft({"@type":"updateChatFullInfo",id:e.id,fullInfo:{about:t}})}function mn({chat:e,isEnabled:t}){const{id:n,accessHash:s}=e,a=oe(n,s);return Dt(new u.Api.channels.ToggleSignatures({channel:a,enabled:t}),!0)}async function _n(e,t,n="recent",s){let a;switch(n){case"kicked":a=new u.Api.ChannelParticipantsKicked({q:""});break;case"admin":a=new u.Api.ChannelParticipantsAdmins;break;default:a=new u.Api.ChannelParticipantsRecent}const i=await Dt(new u.Api.channels.GetParticipants({channel:oe(e,t),filter:a,offset:s,limit:200}));if(i&&!(i instanceof u.Api.channels.ChannelParticipantsNotModified))return An(i),{members:T(i),users:i.users.map(He).filter(Boolean)}}async function yn(){const e=await Dt(new u.Api.channels.GetGroupsForDiscussion);if(e)return An(e),e.chats.map((e=>v(e)))}function bn({channel:e,chat:t}){return Dt(new u.Api.channels.SetDiscussionGroup({broadcast:ae(e.id,e.accessHash),group:t?ae(t.id,t.accessHash):new u.Api.InputChannelEmpty}))}async function wn(e){const t=await Dt(new u.Api.messages.MigrateChat({chatId:oe(e.id)}),!0);if(t&&t instanceof u.Api.Updates)return An(t),v(t.chats[1])}async function In(e){const t=await Dt(new u.Api.messages.CheckChatInvite({hash:e}));if(!t)return;let n;return t instanceof u.Api.ChatInvite?Ft({"@type":"showInvite",data:{title:t.title,hash:e,participantsCount:t.participantsCount,isChannel:t.channel}}):(n=v(t.chat),n&&Ft({"@type":"updateChat",id:n.id,chat:n})),n?{chatId:n.id}:void 0}function Cn(e,t){return"chatTypeChannel"===e.type||"chatTypeSuperGroup"===e.type?Dt(new u.Api.channels.InviteToChannel({channel:oe(e.id,e.accessHash),users:t.map((e=>oe(e.id,e.accessHash)))}),!0):Promise.all(t.map((t=>Dt(new u.Api.messages.AddChatUser({chatId:oe(e.id),userId:oe(t.id,t.accessHash)}),!0))))}function Pn(e,t){return"chatTypeChannel"===e.type||"chatTypeSuperGroup"===e.type?gn({chat:e,user:t,bannedRights:{viewMessages:!0,sendMessages:!0,sendMedia:!0,sendStickers:!0,sendGifs:!0,sendGames:!0,sendInline:!0,embedLinks:!0,sendPolls:!0,changeInfo:!0,inviteUsers:!0,pinMessages:!0},untilDate:Nt}):Dt(new u.Api.messages.DeleteChatUser({chatId:oe(e.id),userId:oe(t.id,t.accessHash)}),!0)}function vn(e){const t={};return e.chats.forEach((e=>{t[`chat${e.id}`]=e})),e.users.forEach((e=>{t[`user${e.id}`]=e})),t}function An(e){"users"in e&&e.users.forEach((e=>{e instanceof u.Api.User&&(K.users[e.id]=e)})),"chats"in e&&e.chats.forEach((e=>{(e instanceof u.Api.Chat||e instanceof u.Api.Channel)&&(K.chats[e.id]=e)})),"messages"in e&&e.messages.forEach((e=>{e instanceof u.Api.Message&&fe(e)&&Ce(e)}))}async function Sn({hash:e}){const t=await Dt(new u.Api.messages.ImportChatInvite({hash:e}),!0);if(t instanceof u.Api.Updates&&t.chats.length)return v(t.chats[0])}function Mn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}"undefined"==typeof File&&(self.File=class extends Blob{constructor(e,t,n){if(n){const{type:t,...s}=n;super(e,{type:t}),Mn(this,"name",void 0),Object.assign(this,s)}else super(e),Mn(this,"name",void 0);this.name=t}});var kn=n(8764).Buffer;let Rn;async function Un({chat:e,threadId:t,...n}){const s=-1===t?u.Api.messages.GetHistory:u.Api.messages.GetReplies;let a;try{a=await Dt(new s({peer:ae(e.id,e.accessHash),...-1!==t&&{msgId:t},...n}),void 0,!0)}catch(t){"CHANNEL_PRIVATE"===t.message&&Rn({"@type":"updateChat",id:e.id,chat:{isRestricted:!0}})}if(!a||a instanceof u.Api.messages.MessagesNotModified||!a.messages)return;ns(a);const i=a.messages.map(Me).filter(Boolean),o=a.users.map(He).filter(Boolean),r=a.chats.map((e=>v(e))).filter(Boolean),c=i.map((({threadInfo:e})=>e)).filter(Boolean);return{messages:i,users:o,chats:r,threadInfos:c}}async function En({chat:e,messageId:t}){const n="channel"===ne(e.id);let s;try{s=await Dt(n?new u.Api.channels.GetMessages({channel:oe(e.id,e.accessHash),id:[new u.Api.InputMessageID({id:t})]}):new u.Api.messages.GetMessages({id:[new u.Api.InputMessageID({id:t})]}),void 0,!0)}catch(e){const{message:t}=e;"CHANNEL_PRIVATE"!==t&&Rn({"@type":"error",error:{message:t,isSlowMode:!1,hasErrorKey:!0}})}if(!s||s instanceof u.Api.messages.MessagesNotModified)return;const a=s.messages[0];if(!a)return;if(a instanceof u.Api.MessageEmpty)return"MESSAGE_DELETED";const i=a&&Me(a);return i?(a instanceof u.Api.Message&&Ce(a),{message:i,users:s.users.map(He).filter(Boolean)}):void 0}let Dn=Promise.resolve();function Tn({chat:e,text:t,entities:n,replyingTo:s,attachment:a,sticker:i,gif:o,poll:r,isSilent:c,scheduledAt:d,groupedId:l,noWebPage:g,serverTimeOffset:p},f){const h=function(e,t,n,s,a,i,o,r,c,d,l=0){const u=Se++,g=a&&function(e){const{filename:t,blobUrl:n,previewBlobUrl:s,mimeType:a,size:i}=e;if(e.quick){const{width:o,height:r,duration:c}=e.quick;return a.startsWith("image/")?{photo:{id:"temp",sizes:[],thumbnail:{width:o,height:r,dataUri:""},blobUrl:n}}:{video:{id:"temp",mimeType:a,duration:c||0,fileName:t,width:o,height:r,blobUrl:n,...s&&{thumbnail:{width:o,height:r,dataUri:s}},size:i}}}if(e.voice){const{duration:t,waveform:n}=e.voice,{data:s}=J(n,63);return{voice:{duration:t,waveform:s}}}return a.startsWith("audio/")?{audio:{mimeType:a,fileName:t,size:i,duration:200}}:{document:{mimeType:a,fileName:t,size:i,...s&&{previewBlobUrl:s}}}}(a),p="chatTypeChannel"===e.type;return{id:u,chatId:e.id,content:{...t&&{text:{text:t,entities:n}},...g,...i&&{sticker:i},...o&&{video:o},...r&&Fe(r,u)},date:d||Math.round(Date.now()/1e3)+l,isOutgoing:!p,senderId:ve,...s&&{replyToMessageId:s},...c&&{groupedId:c,...g&&(g.photo||g.video)&&{isInAlbum:!0}},...d&&{isScheduled:!0}}}(e,t,n,s,a,i,o,r,l,d,p);Rn({"@type":h.isScheduled?"newScheduledMessage":"newMessage",id:h.id,chatId:e.id,message:h}),setTimeout((()=>{Rn({"@type":h.isScheduled?"updateScheduledMessage":"updateMessage",id:h.id,chatId:e.id,message:{sendingState:"messageSendingStatePending"}})}),1e3);const m=le();if(K.localMessages[m.toString()]=h,l)return function({chat:e,text:t,entities:n,replyingTo:s,attachment:a,groupedId:i,isSilent:o,scheduledAt:r},c,d,l){let g=-1;Bn[i]||(Bn[i]={counter:0,singleMediaByIndex:{}}),g=Bn[i].counter++;const p=Dn;return Dn=(async()=>{let f;try{f=await Nn(d,a,l)}catch(e){return Bn[i].counter--,void await p}const h=await async function(e,t){const n=await Dt(new u.Api.messages.UploadMedia({peer:e,media:t}));if(n instanceof u.Api.MessageMediaPhoto&&n.photo&&n.photo instanceof u.Api.Photo){const{photo:{id:e,accessHash:t,fileReference:s}}=n;return new u.Api.InputMediaPhoto({id:new u.Api.InputPhoto({id:e,accessHash:t,fileReference:s})})}if(n instanceof u.Api.MessageMediaDocument&&n.document&&n.document instanceof u.Api.Document){const{document:{id:e,accessHash:t,fileReference:s}}=n;return new u.Api.InputMediaDocument({id:new u.Api.InputDocument({id:e,accessHash:t,fileReference:s})})}}(ae(e.id,e.accessHash),f);if(await p,!h)return void Bn[i].counter--;if(Bn[i].singleMediaByIndex[g]=new u.Api.InputSingleMedia({media:h,randomId:c,message:t||"",entities:n?n.map(ge):void 0}),Object.keys(Bn[i].singleMediaByIndex).length<Bn[i].counter)return;const{singleMediaByIndex:m}=Bn[i];delete Bn[i],await Dt(new u.Api.messages.SendMultiMedia({clearDraft:!0,peer:ae(e.id,e.accessHash),multiMedia:Object.values(m),replyToMsgId:s,...o&&{silent:o},...r&&{scheduleDate:r}}),!0)})(),Dn}({chat:e,text:t,entities:n,replyingTo:s,attachment:a,groupedId:l,isSilent:c,scheduledAt:d},m,h,f);const _=Dn;return Dn=(async()=>{let l;if(a)try{l=await Nn(h,a,f)}catch(e){return void await _}else i?l=de(i):o?l=de(o):r&&(l=function(e,t){const{summary:n,quiz:s}=e,a=new u.Api.Poll({id:t,publicVoters:n.isPublic,question:n.question,answers:n.answers.map((({text:e,option:t})=>new u.Api.PollAnswer({text:e,option:te.from(t)}))),quiz:n.quiz,multipleChoice:n.multipleChoice});if(!s)return new u.Api.InputMediaPoll({poll:a});const i=s.correctAnswers.map((e=>te.from(e))),{solution:o}=s,r=s.solutionEntities?s.solutionEntities.map(ge):[];return new u.Api.InputMediaPoll({poll:a,correctAnswers:i,...o&&{solution:o,solutionEntities:r}})}(r,m));await _;const p=l?u.Api.messages.SendMedia:u.Api.messages.SendMessage;await Dt(new p({clearDraft:!0,message:t||"",entities:n?n.map(ge):void 0,peer:ae(e.id,e.accessHash),randomId:m,...c&&{silent:c},...d&&{scheduleDate:d},...s&&{replyToMsgId:s},...l&&{media:l},...g&&{noWebpage:g}}),!0)})(),Dn}const Bn={};async function xn({chat:e,message:t,text:n,entities:s,noWebPage:a,serverTimeOffset:i}){const o=1e3*t.date>Date.now()+1e3*i,r={content:{...t.content,...n&&{text:{text:n,entities:s}}}};Rn({"@type":o?"updateScheduledMessage":"updateMessage",id:t.id,chatId:e.id,message:r}),K.localMessages[t.id]={...t,...r};const c=s&&s.map(ge);await Dt(new u.Api.messages.EditMessage({message:n||"",entities:c,peer:ae(e.id,e.accessHash),id:t.id,...o&&{scheduleDate:t.date},...a&&{noWebpage:a}}),!0)}async function Vn({chat:e,message:t,scheduledAt:n}){await Dt(new u.Api.messages.EditMessage({peer:ae(e.id,e.accessHash),id:t.id,scheduleDate:n}),!0)}async function Nn(e,t,n){const{filename:s,blobUrl:a,mimeType:i,quick:o,voice:d}=t,l=await async function(e,t){return function(e,t){return new File([e],t,{lastModified:Date.now(),type:e.type})}(await async function(e){return(await fetch(e)).blob()}(e),t)}(a,s),g=t=>{n.isCanceled?g.isCanceled=!0:n(t,e.id)},p=await Bt(l,g),f=[new u.Api.DocumentAttributeFilename({fileName:s})];if(o){if(r.has(i))return new u.Api.InputMediaUploadedPhoto({file:p});if(c.has(i)){const{width:e,height:t,duration:n}=o;void 0!==n&&f.push(new u.Api.DocumentAttributeVideo({duration:n,w:e,h:t,supportsStreaming:!0}))}}if(d){const{duration:e,waveform:t}=d,{data:n}=J(t,63);f.push(new u.Api.DocumentAttributeAudio({voice:!0,duration:e,waveform:kn.from(n)}))}return new u.Api.InputMediaUploadedDocument({file:p,mimeType:i,attributes:f})}async function Fn({chat:e,messageId:t,isUnpin:n,isOneSide:s,isSilent:a}){await Dt(new u.Api.messages.UpdatePinnedMessage({peer:ae(e.id,e.accessHash),id:t,...n&&{unpin:!0},...s&&{pmOneside:!0},...a&&{silent:!0}}),!0)}async function On({chat:e}){await Dt(new u.Api.messages.UnpinAllMessages({peer:ae(e.id,e.accessHash)}),!0)}async function Ln({chat:e,messageIds:t,shouldDeleteForAll:n}){const s="channel"===ne(e.id);await Dt(s?new u.Api.channels.DeleteMessages({channel:oe(e.id,e.accessHash),id:t}):new u.Api.messages.DeleteMessages({id:t,...n&&{revoke:!0}}))&&Rn({"@type":"deleteMessages",ids:t,...s&&{chatId:e.id}})}async function qn({chat:e,messageIds:t}){await Dt(new u.Api.messages.DeleteScheduledMessages({peer:ae(e.id,e.accessHash),id:t}))&&Rn({"@type":"deleteScheduledMessages",ids:t,chatId:e.id})}async function Hn({chat:e,shouldDeleteForAll:t,maxId:n}){const s="channel"===ne(e.id);await Dt(s?new u.Api.channels.DeleteHistory({channel:oe(e.id,e.accessHash),maxId:n}):new u.Api.messages.DeleteHistory({peer:ae(e.id,e.accessHash),...t&&{revoke:!0},...!t&&{just_clear:!0},maxId:n}))&&Rn({"@type":"deleteHistory",chatId:e.id})}async function Gn({peer:e,messageIds:t,reason:n,description:s}){return await Dt(new u.Api.messages.Report({peer:ae(e.id,e.accessHash),id:t,reason:we(n),message:s}))}async function Kn({chat:e,threadId:t,maxId:n,serverTimeOffset:s}){const a="channel"===ne(e.id);a&&-1===t?await Dt(new u.Api.channels.ReadHistory({channel:oe(e.id,e.accessHash),maxId:n})):a?await Dt(new u.Api.messages.ReadDiscussion({peer:ae(e.id,e.accessHash),msgId:t,readMaxId:n})):await Dt(new u.Api.messages.ReadHistory({peer:ae(e.id,e.accessHash),maxId:n})),-1===t?Gt({chat:e,serverTimeOffset:s}):Wn({chat:e,threadId:t})}async function zn({chat:e,messageIds:t}){const n="channel"===ne(e.id);await Dt(n?new u.Api.channels.ReadMessageContents({channel:oe(e.id,e.accessHash),id:t}):new u.Api.messages.ReadMessageContents({id:t})),Rn({...n?{"@type":"updateChannelMessages",channelId:e.id}:{"@type":"updateCommonBoxMessages"},ids:t,messageUpdate:{hasUnreadMention:!1,isMediaUnread:!1}})}async function Wn({chat:e,threadId:t}){const[n,s]=await Promise.all([Dt(new u.Api.messages.GetDiscussionMessage({peer:ae(e.id,e.accessHash),msgId:t})),Dt(new u.Api.messages.GetReplies({peer:ae(e.id,e.accessHash),msgId:t,offsetId:1,addOffset:-1,limit:1}))]);if(!n||!n.messages.length)return;const a=Ie(n.messages[0]);return a?(Rn({"@type":"updateThreadInfo",chatId:a,threadId:t,threadInfo:{threadId:t,topMessageId:n.messages[n.messages.length-1].id,lastReadInboxMessageId:n.readInboxMaxId,messagesCount:s instanceof u.Api.messages.ChannelMessages?s.count:void 0},firstMessageId:s&&"messages"in s&&s.messages.length?s.messages[0].id:void 0}),n.chats.map((e=>v(e))).filter(Boolean).forEach((e=>{Rn({"@type":"updateChat",id:e.id,chat:e,noTopChatsRequest:!0})})),{discussionChatId:a}):void 0}async function jn({chatOrUser:e,type:t,query:n,topMessageId:s,minDate:a,maxDate:i,...o}){let r;switch(t){case"media":r=new u.Api.InputMessagesFilterPhotoVideo;break;case"documents":r=new u.Api.InputMessagesFilterDocument;break;case"links":r=new u.Api.InputMessagesFilterUrl;break;case"audio":r=new u.Api.InputMessagesFilterMusic;break;case"voice":r=new u.Api.InputMessagesFilterRoundVoice;break;case"profilePhoto":r=new u.Api.InputMessagesFilterChatPhotos;break;case"text":default:r=new u.Api.InputMessagesFilterEmpty}const c=await Dt(new u.Api.messages.Search({peer:ae(e.id,e.accessHash),filter:r,q:n||"",topMsgId:s,minDate:a,maxDate:i,...o}));if(!c||c instanceof u.Api.messages.MessagesNotModified||!c.messages)return;ns(c);const d=c.messages.map(Me).filter(Boolean),l=c.users.map(He).filter(Boolean);let g,p=d.length;return(c instanceof u.Api.messages.MessagesSlice||c instanceof u.Api.messages.ChannelMessages)&&(p=c.count,d.length&&(g=d[d.length-1].id)),{messages:d,users:l,totalCount:p,nextOffsetId:g}}async function $n({query:e,offsetRate:t=0,limit:n,type:s="text",minDate:a,maxDate:i}){let o;switch(s){case"media":o=new u.Api.InputMessagesFilterPhotoVideo;break;case"documents":o=new u.Api.InputMessagesFilterDocument;break;case"links":o=new u.Api.InputMessagesFilterUrl;break;case"audio":o=new u.Api.InputMessagesFilterMusic;break;case"voice":o=new u.Api.InputMessagesFilterRoundVoice;break;case"text":default:if(!(e||i&&a))return;o=new u.Api.InputMessagesFilterEmpty}const r=await Dt(new u.Api.messages.SearchGlobal({q:e,offsetRate:t,offsetPeer:new u.Api.InputPeerEmpty,limit:n,filter:o,folderId:0,minDate:a,maxDate:i}));if(!r||r instanceof u.Api.messages.MessagesNotModified||!r.messages)return;ns({chats:r.chats,users:r.users,messages:r.messages});const c=r.chats.map((e=>v(e))).filter(Boolean),d=r.users.map(He).filter(Boolean),l=r.messages.map(Me).filter(Boolean);let g,p=l.length;return(r instanceof u.Api.messages.MessagesSlice||r instanceof u.Api.messages.ChannelMessages)&&(p=r.count,l.length&&(g=l[l.length-1].id)),{messages:l,users:d,chats:c,totalCount:p,nextRate:"nextRate"in r&&r.nextRate?r.nextRate:g}}async function Jn({message:e}){const t=await Dt(new u.Api.messages.GetWebPagePreview({message:e}));return t&&Ve(t)}async function Qn({chat:e,messageId:t,options:n}){const{id:s,accessHash:a}=e;await Dt(new u.Api.messages.SendVote({peer:ae(s,a),msgId:t,options:n.map((e=>kn.from(e)))}),!0)}async function Xn({chat:e,messageId:t,option:n,offset:s,limit:a,shouldResetVoters:i}){const{id:o,accessHash:r}=e,c=await Dt(new u.Api.messages.GetPollVotes({peer:ae(o,r),id:t,...n&&{option:kn.from(n)},...s&&{offset:s},...a&&{limit:a}}));if(!c)return;ns({chats:[],users:c.users,messages:[]});const d=c.users.map(He).filter(Boolean),l=c.votes.map((e=>({userId:e.userId,date:e.date})));return{count:c.count,votes:l,users:d,nextOffset:c.nextOffset,shouldResetVoters:i}}async function Zn({fromChat:e,toChat:t,messages:n,serverTimeOffset:s}){const a=n.map((({id:e})=>e)),i=n.map(le);n.forEach(((e,n)=>{const a=function(e,t,n){const s=Se++,{content:a,chatId:i,id:o,senderId:r,groupedId:c,isInAlbum:d}=t,l=a.audio,u=e.id===ve&&(i!==e.id||t.forwardInfo)&&!l;return{id:s,chatId:e.id,content:a,date:Math.round(Date.now()/1e3)+n,isOutgoing:!u&&"chatTypeChannel"!==e.type,senderId:ve,sendingState:"messageSendingStatePending",...r!==ve&&!l&&{forwardInfo:{isChannelPost:!1,fromChatId:i,fromMessageId:o,senderUserId:r}},groupedId:c,isInAlbum:d}}(t,e,s);K.localMessages[String(i[n])]=a,Rn({"@type":"newMessage",id:a.id,chatId:t.id,message:a})})),await Dt(new u.Api.messages.ForwardMessages({fromPeer:ae(e.id,e.accessHash),toPeer:ae(t.id,t.accessHash),randomId:i,id:a}),!0)}async function Yn({chat:e,timestamp:t}){const n=await Dt(new u.Api.messages.GetHistory({peer:ae(e.id,e.accessHash),offsetDate:t,addOffset:-1,limit:1}));if(n&&!(n instanceof u.Api.messages.MessagesNotModified)&&n.messages&&n.messages.length)return n.messages[0].id}async function es({chat:e,hash:t=0}){const{id:n,accessHash:s}=e,a=await Dt(new u.Api.messages.GetScheduledHistory({peer:ae(n,s),hash:t}));if(!a||a instanceof u.Api.messages.MessagesNotModified||!a.messages)return;ns(a);const i=a.messages.map(Me).filter(Boolean);return{messages:i,hash:pe(i.map((e=>e.id)))}}async function ts({chat:e,ids:t}){const{id:n,accessHash:s}=e;await Dt(new u.Api.messages.SendScheduledMessages({peer:ae(n,s),id:t}),!0)}function ns(e){e.users.forEach((e=>{e instanceof u.Api.User&&(K.users[e.id]=e)})),e.chats.forEach((e=>{(e instanceof u.Api.Chat||e instanceof u.Api.Channel)&&(K.chats[e.id]=e)})),e.messages.forEach((e=>{(e instanceof u.Api.Message&&fe(e)||e instanceof u.Api.MessageService&&function(e){return"photo"in e.action&&e.action.photo instanceof u.Api.Photo}(e))&&Ce(e)}))}async function ss({chat:e}){const t=await Dt(new u.Api.messages.Search({peer:ae(e.id,e.accessHash),filter:new u.Api.InputMessagesFilterPinned,q:"",limit:50}));if(t&&!(t instanceof u.Api.messages.MessagesNotModified)&&t.messages)return ns(t),{messages:t.messages.map(Me).filter(Boolean),users:t.users.map(He).filter(Boolean),chats:t.chats.map((e=>v(e))).filter(Boolean)}}let as,is,os,rs;async function cs({id:e,accessHash:t}){const n=oe(e,t);if(!(n instanceof u.Api.InputUser))return;const s=await Dt(new u.Api.users.GetFullUser({id:n}));if(!s)return;const a=qe(s);as({"@type":"updateUser",id:e,user:{fullInfo:a.fullInfo}})}async function ds(){const e=await Dt(new u.Api.help.GetNearestDc);return null==e?void 0:e.country}async function ls({langCode:e="en"}){const t=await Dt(new u.Api.help.GetCountriesList({langCode:e}));if(t instanceof u.Api.help.CountriesList)return n=t.countries,{phoneCodes:(s=n.filter((e=>!e.hidden)).map((e=>e.countryCodes.map((t=>Je(e,t))))),s.reduce(((e,t)=>Array.isArray(t)?e.concat(t):(e.push(t),e)),[])).sort(((e,t)=>e.name?e.name.localeCompare(t.name):e.defaultName.localeCompare(t.defaultName))),general:n.filter((e=>!e.hidden)).map((e=>Je(e))).sort(((e,t)=>e.name?e.name.localeCompare(t.name):e.defaultName.localeCompare(t.defaultName)))};var n,s}async function us({hash:e=0}){const t=await Dt(new u.Api.contacts.GetTopPeers({hash:e,correspondents:!0}));if(!(t instanceof u.Api.contacts.TopPeers))return;const n=t.users.map(He).filter((e=>!!e&&!e.isSelf)),s=n.map((({id:e})=>e));return{hash:pe(s),ids:s,users:n}}async function gs({hash:e=0}){const t=await Dt(new u.Api.contacts.GetContacts({hash:e}));if(t&&!(t instanceof u.Api.contacts.ContactsNotModified))return t.users.forEach((e=>{e instanceof u.Api.User&&(K.users[e.id]=e)})),{hash:pe([t.savedCount,...t.contacts.map((({userId:e})=>e))]),users:t.users.map(He).filter(Boolean),chats:t.users.map((e=>v(e))).filter(Boolean)}}async function ps({users:e}){const t=await Dt(new u.Api.users.GetUsers({id:e.map((({id:e,accessHash:t})=>ae(e,t)))}));if(t&&t.length)return t.forEach((e=>{e instanceof u.Api.User&&(K.users[e.id]=e)})),t.map(He).filter(Boolean)}function fs({phone:e,firstName:t,lastName:n}){return Dt(new u.Api.contacts.ImportContacts({contacts:[he({phone:e||"",firstName:t||"",lastName:n||""})]}))}async function hs({id:e,accessHash:t}){const n=oe(e,t);n instanceof u.Api.InputUser&&await Dt(new u.Api.contacts.DeleteContacts({id:[n]}))&&as({"@type":"deleteUser",id:e})}async function ms(e,t){if(e){const{id:t,accessHash:n}=e,s=await Dt(new u.Api.photos.GetUserPhotos({userId:oe(t,n),limit:40,offset:0,maxId:X()("0")}));if(!s)return;return function(e){e.photos.forEach(Pe)}(s),{photos:s.photos.filter((e=>e instanceof u.Api.Photo)).map(H)}}const n=await jn({chatOrUser:t,type:"profilePhoto",limit:40});if(!n)return;const{messages:s,users:a}=n;return{photos:s.map((e=>e.content.action.photo)).filter(Boolean),users:a}}async function _s({hash:e}){const t=await Dt(new u.Api.messages.GetAllStickers({hash:e}));if(t&&!(t instanceof u.Api.messages.AllStickersNotModified))return t.sets.forEach((e=>{var t;null!==(t=e.thumbs)&&void 0!==t&&t.length&&(K.stickerSets[String(e.id)]=e)})),{hash:t.hash,sets:t.sets.map(j)}}async function ys({hash:e}){const t=await Dt(new u.Api.messages.GetRecentStickers({hash:e}));if(t&&!(t instanceof u.Api.messages.RecentStickersNotModified))return{hash:t.hash,stickers:Es(t.stickers.slice(0,20))}}async function bs({hash:e}){const t=await Dt(new u.Api.messages.GetFavedStickers({hash:e}));if(t&&!(t instanceof u.Api.messages.FavedStickersNotModified))return{hash:t.hash,stickers:Es(t.stickers)}}async function ws({hash:e}){const t=await Dt(new u.Api.messages.GetFeaturedStickers({hash:e}));if(t&&!(t instanceof u.Api.messages.FeaturedStickersNotModified))return{hash:t.hash,sets:t.sets.map($)}}async function Is({sticker:e,unfave:t}){const n=new u.Api.messages.FaveSticker({id:ce(e),unfave:t});await Dt(n)&&is({"@type":"updateFavoriteStickers"})}async function Cs({stickerSetShortName:e,stickerSetId:t,accessHash:n}){const s=await Dt(new u.Api.messages.GetStickerSet({stickerset:t?re(t,n):(a=e,new u.Api.InputStickerSetShortName({shortName:a}))}));var a,i;if(s)return{set:j(s.set),stickers:Es(s.documents),packs:(i=s.packs,i.reduce(((e,{emoticon:t,documents:n})=>(e[t]=n.map((e=>W(K.documents[String(e)]))).filter(Boolean),e)),{}))}}async function Ps(){const e=await Dt(new u.Api.messages.GetStickerSet({stickerset:new u.Api.InputStickerSetAnimatedEmoji}));if(e)return{set:j(e.set),stickers:Es(e.documents)}}async function vs({query:e,hash:t}){const n=await Dt(new u.Api.messages.SearchStickerSets({q:e,hash:t}));if(n&&!(n instanceof u.Api.messages.FoundStickerSetsNotModified))return{hash:n.hash,sets:n.sets.map($)}}async function As({hash:e}){const t=await Dt(new u.Api.messages.GetSavedGifs({hash:e}));if(t&&!(t instanceof u.Api.messages.SavedGifsNotModified))return{hash:t.hash,gifs:Ds(t.gifs)}}async function Ss({stickerSetId:e,accessHash:t}){await Dt(new u.Api.messages.InstallStickerSet({stickerset:re(e,t)}))&&is({"@type":"updateStickerSet",id:e,stickerSet:{installedDate:Date.now()}})}async function Ms({stickerSetId:e,accessHash:t}){await Dt(new u.Api.messages.UninstallStickerSet({stickerset:re(e,t)}))&&is({"@type":"updateStickerSet",id:e,stickerSet:{installedDate:void 0}})}async function ks({query:e,offset:t=""}){if(!os){const e=await Dt(new u.Api.help.GetConfig);if(!e)return;const t=await Dt(new u.Api.contacts.ResolveUsername({username:e.gifSearchUsername}));if(!(t&&t.users[0]instanceof u.Api.User))return;os=new u.Api.InputUser({userId:t.peer.userId,accessHash:t.users[0].accessHash})}const n=await Dt(new u.Api.messages.GetInlineBotResults({bot:os,peer:new u.Api.InputPeerEmpty,query:e,offset:t}));if(!n)return;const s=n.results.map((e=>{if(e instanceof u.Api.BotInlineMediaResult)return e.document})).filter(Boolean);return{nextOffset:n.nextOffset,gifs:Ds(s)}}async function Rs({emoji:e,hash:t=0}){const n=await Dt(new u.Api.messages.GetStickers({emoticon:e,hash:t}));if(n&&!(n instanceof u.Api.messages.StickersNotModified))return{stickers:Es(n.stickers),hash:n.hash}}async function Us({language:e,fromVersion:t}){const n=await Dt(new u.Api.messages.GetEmojiKeywordsDifference({langCode:e,fromVersion:t}));if(n)return{language:n.langCode,version:n.version,keywords:n.keywords.reduce(((e,t)=>(e[t.keyword]=t.emoticons,e)),{})}}function Es(e){return e.map((e=>{if(e instanceof u.Api.Document){const t=W(e);if(t)return K.documents[String(e.id)]=e,t}})).filter(Boolean)}function Ds(e){return e.map((e=>{if(e instanceof u.Api.Document){const t=De(e);if(t)return K.documents[String(e.id)]=e,t}})).filter(Boolean)}async function Ts({username:e}){try{return await Dt(new u.Api.channels.CheckUsername({channel:new u.Api.InputChannelEmpty,username:e}),void 0,!0)}catch(e){return!1}}async function Bs({chat:e,username:t}){await Dt(new u.Api.channels.UpdateUsername({channel:oe(e.id,e.accessHash),username:t}))&&rs({"@type":"updateChat",id:e.id,chat:{username:t}})}async function xs({chat:e}){const t=await Dt(new u.Api.messages.ExportChatInvite({peer:ae(e.id,e.accessHash)}));t&&t instanceof u.Api.ChatInviteExported&&rs({"@type":"updateChatFullInfo",id:e.id,fullInfo:{inviteLink:t.link}})}const Vs={EMAIL_UNCONFIRMED:"Email unconfirmed",EMAIL_HASH_EXPIRED:"Email hash expired",NEW_SALT_INVALID:"The new salt is invalid",NEW_SETTINGS_INVALID:"The new password settings are invalid",CODE_INVALID:"Invalid Code",PASSWORD_HASH_INVALID:"Invalid Password"},Ns={};let Fs;async function Os(){const e=await Dt(new u.Api.account.GetPassword);if(!e)return;const{hint:t,hasPassword:n}=e;return{hint:t,hasPassword:n}}function Ls(e){return Fs({"@type":"updateTwoFaStateWaitCode",length:e}),new Promise(((e,t)=>{Ns.resolve=e,Ns.reject=t}))}async function qs(e){try{return await xt({isCheckPassword:!0,currentPassword:e}),!0}catch(e){return Ws(e),!1}}async function Hs(e){try{return await xt({currentPassword:e}),!0}catch(e){return Ws(e),!1}}async function Gs(e,t,n,s){try{return await xt({currentPassword:e,newPassword:t,hint:n,email:s,emailCodeCallback:Ls,onEmailCodeError:Ws}),!0}catch(e){return Ws(e),!1}}async function Ks(e,t){try{return await xt({currentPassword:e,newPassword:e,email:t,emailCodeCallback:Ls,onEmailCodeError:Ws}),!0}catch(e){return Ws(e),!1}}function zs(e){Ns.resolve(e)}function Ws(e){let t;if(e instanceof u.errors.FloodWaitError){const n=Math.ceil(Number(e.seconds)/60/60);t="Too many attempts. Try again in "+(n>1?`${n} hours`:"an hour")}else t=Vs[e.message];t||(t="Unexpected Error"),Fs({"@type":"updateTwoFaError",message:t})}const js=["ar","fa","id","ko","uz"];function $s({firstName:e,lastName:t,about:n}){return Dt(new u.Api.account.UpdateProfile({firstName:e||"",lastName:t||"",about:n||""}))}function Js(e){return Dt(new u.Api.account.CheckUsername({username:e}))}function Qs(e){return Dt(new u.Api.account.UpdateUsername({username:e}))}async function Xs(e){const t=await Bt(e);return Dt(new u.Api.photos.UploadProfilePhoto({file:t}))}async function Zs(e){const t=await Bt(e);await Dt(new u.Api.photos.UploadProfilePhoto({file:t}))}async function Ys(e){const t=await Dt(new u.Api.account.GetWallPapers({hash:e}));if(!t||t instanceof u.Api.account.WallPapersNotModified)return;const n=t.wallpapers.filter((e=>e instanceof u.Api.WallPaper&&e.document instanceof u.Api.Document&&!e.pattern&&"application/x-tgwallpattern"!==e.document.mimeType));return n.forEach((e=>{K.documents[String(e.document.id)]=e.document})),{hash:t.hash,wallpapers:n.map(ze).filter(Boolean)}}async function ea(e){const t=await Bt(e),n=await Dt(new u.Api.account.UploadWallPaper({file:t,mimeType:e.type,settings:new u.Api.WallPaperSettings}));if(!(n&&n instanceof u.Api.WallPaper))return;const s=ze(n);return s?(K.documents[String(n.document.id)]=n.document,{wallpaper:s}):void 0}async function ta(){const e=await Dt(new u.Api.contacts.GetBlocked({limit:100}));if(e)return Ia(e),{users:e.users.map(He).filter(Boolean),chats:e.chats.map((e=>v(e,void 0,!0))).filter(Boolean),blockedIds:e.blocked.map((e=>A(e.peerId))),totalCount:e instanceof u.Api.contacts.BlockedSlice?e.count:e.blocked.length}}function na(e,t){return Dt(new u.Api.contacts.Block({id:ae(e,t)}))}function sa(e,t){return Dt(new u.Api.contacts.Unblock({id:ae(e,t)}))}async function aa(){const e=await Dt(new u.Api.account.GetAuthorizations);if(e)return e.authorizations.map(We)}function ia(e){return Dt(new u.Api.account.ResetAuthorization({hash:X()(e)}))}function oa(){return Dt(new u.Api.auth.ResetAuthorizations)}async function ra({serverTimeOffset:e}){const t=await Dt(new u.Api.account.GetNotifyExceptions({compareSound:!0}));if(t instanceof u.Api.Updates||t instanceof u.Api.UpdatesCombined)return Ia(t),t.updates.reduce(((t,n)=>n instanceof u.Api.UpdateNotifySettings&&n.peer instanceof u.Api.NotifyPeer?(t.push($e(n.notifySettings,n.peer.peer,e)),t):t),[])}async function ca({serverTimeOffset:e}){const[t,n,s,a]=await Promise.all([Dt(new u.Api.account.GetContactSignUpNotification),Dt(new u.Api.account.GetNotifySettings({peer:new u.Api.InputNotifyUsers})),Dt(new u.Api.account.GetNotifySettings({peer:new u.Api.InputNotifyChats})),Dt(new u.Api.account.GetNotifySettings({peer:new u.Api.InputNotifyBroadcasts}))]);if(!n||!s||!a)return!1;const{silent:i,muteUntil:o,showPreviews:r}=n,{silent:c,muteUntil:d,showPreviews:l}=s,{silent:g,muteUntil:p,showPreviews:f}=a;return{hasContactJoinedNotifications:!t,hasPrivateChatsNotifications:!(i||"number"==typeof o&&y(e)<o),hasPrivateChatsMessagePreview:r,hasGroupNotifications:!(c||"number"==typeof d&&y(e)<d),hasGroupMessagePreview:l,hasBroadcastNotifications:!(g||"number"==typeof p&&y(e)<p),hasBroadcastMessagePreview:f}}function da(e){return Dt(new u.Api.account.SetContactSignUpNotification({silent:e}))}function la(e,{isSilent:t,shouldShowPreviews:n}){let s;s="contact"===e?new u.Api.InputNotifyUsers:"group"===e?new u.Api.InputNotifyChats:new u.Api.InputNotifyBroadcasts;const a={showPreviews:n,silent:t,muteUntil:t?2147483647:0};return Dt(new u.Api.account.UpdateNotifySettings({peer:s,settings:new u.Api.InputPeerNotifySettings(a)}))}async function ua(){const e=await Dt(new u.Api.langpack.GetLanguages({langPack:"android"}));if(e)return e.map(_)}async function ga({sourceLangPacks:e,langCode:t}){const n=(await Promise.all(e.map((e=>Dt(new u.Api.langpack.GetLangPack({langPack:e,langCode:js.includes(t)?`${t}-raw`:t})))))).filter(Boolean).map((e=>g(e.strings.map(_),"key")));if(n.length)return{langPack:Object.assign({},...n.reverse())}}async function pa({langPack:e,langCode:t,keys:n}){const s=await Dt(new u.Api.langpack.GetStrings({langPack:e,langCode:js.includes(t)?`${t}-raw`:t,keys:n}));if(s)return s.map(_)}async function fa(e){const t=be(e),n=await Dt(new u.Api.account.GetPrivacy({key:t}));if(n)return Ia(n),je(n.rules)}function ha(e){const t=St.session.getAuthKey().getKey();return Dt(new u.Api.account.RegisterDevice({tokenType:10,secret:t,appSandbox:!1,otherUids:[],token:e}))}function ma(e){return Dt(new u.Api.account.UnregisterDevice({tokenType:10,otherUids:[],token:e}))}async function _a(e,t){const n=be(e),s=[];switch(t.allowedUsers&&s.push(new u.Api.InputPrivacyValueAllowUsers({users:t.allowedUsers.map((({id:e,accessHash:t})=>ae(e,t)))})),t.allowedChats&&s.push(new u.Api.InputPrivacyValueAllowChatParticipants({chats:t.allowedChats.map((({id:e})=>-e))})),t.blockedUsers&&s.push(new u.Api.InputPrivacyValueDisallowUsers({users:t.blockedUsers.map((({id:e,accessHash:t})=>ae(e,t)))})),t.blockedChats&&s.push(new u.Api.InputPrivacyValueDisallowChatParticipants({chats:t.blockedChats.map((({id:e})=>-e))})),t.visibility){case"everybody":s.push(new u.Api.InputPrivacyValueAllowAll);break;case"contacts":s.push(new u.Api.InputPrivacyValueAllowContacts);break;case"nonContacts":s.push(new u.Api.InputPrivacyValueDisallowContacts);break;case"nobody":s.push(new u.Api.InputPrivacyValueDisallowAll)}const a=await Dt(new u.Api.account.SetPrivacy({key:n,rules:s}));if(a)return Ia(a),je(a.rules)}async function ya(e){await Dt(new u.Api.account.UpdateStatus({offline:!e}))}async function ba(){const e=await Dt(new u.Api.account.GetContentSettings);if(e)return{isSensitiveEnabled:Boolean(e.sensitiveEnabled),canChangeSensitive:Boolean(e.sensitiveCanChange)}}function wa(e){return Dt(new u.Api.account.SetContentSettings({sensitiveEnabled:e||void 0}))}function Ia(e){e.users.forEach((e=>{e instanceof u.Api.User&&(K.users[e.id]=e)})),e.chats.forEach((e=>{(e instanceof u.Api.Chat||e instanceof u.Api.Channel)&&(K.chats[e.id]=e)}))}function Ca(e){return e?p(e,["url","mimeType"]):void 0}var Pa=n(8764).Buffer;function va({chatId:e,accessHash:t,messageId:n,data:s}){return Dt(new u.Api.messages.GetBotCallbackAnswer({peer:ae(e,t),msgId:n,data:Pa.from(s)}))}async function Aa({hash:e=0}){const t=await Dt(new u.Api.contacts.GetTopPeers({hash:e,botsInline:!0}));if(!(t instanceof u.Api.contacts.TopPeers))return;const n=t.users.map(He).filter(Boolean),s=n.map((({id:e})=>e));return{hash:pe(s),ids:s,users:n}}async function Sa({username:e}){const t=await Dt(new u.Api.contacts.ResolveUsername({username:e}));if(t&&t.users[0]instanceof u.Api.User&&t.users[0].bot&&t.users[0].botInlinePlaceholder)return Ua(t.users[0]),{user:He(t.users[0]),chat:v(t.users[0])}}async function Ma({bot:e,chat:t,query:n,offset:s=""}){const a=await Dt(new u.Api.messages.GetInlineBotResults({bot:ae(e.id,e.accessHash),peer:ae(t.id,t.accessHash),query:n,offset:s}));var i,o,r,c,d;if(a)return a.users.map(Ua),{isGallery:Boolean(a.gallery),help:e.botPlaceholder,nextOffset:(c=e.username,d=a.nextOffset,"gif"===c&&"0"===d?"":d),switchPm:(r=a.switchPm,r?p(r,["text","startParam"]):void 0),users:a.users.map(He).filter(Boolean),results:(i=String(a.queryId),o=a.results,o.map((e=>{return e instanceof u.Api.BotInlineMediaResult?(e.document instanceof u.Api.Document&&(t=e.document,K.documents[String(t.id)]=t),e.photo instanceof u.Api.Photo&&(n=e.photo,K.photos[String(n.id)]=n),function(e,t){const{id:n,type:s,title:a,description:i,photo:o,document:r}=e;return{id:n,queryId:t,type:s,title:a,description:i,..."sticker"===s&&r instanceof u.Api.Document&&{sticker:W(r)},...o instanceof u.Api.Photo&&{photo:H(o)},..."gif"===s&&r instanceof u.Api.Document&&{gif:De(r)},..."video"===s&&r instanceof u.Api.Document&&{thumbnail:q(r.thumbs)}}}(e,i)):(e.thumb&&(s=e.thumb,K.webDocuments[s.url]=s),function(e,t){const{id:n,type:s,title:a,description:i,url:o,thumb:r}=e;return{id:n,queryId:t,type:s,title:a,description:i,url:o,webThumbnail:Ca(r)}}(e,i));var t,n,s})))}}async function ka({chat:e,resultId:t,queryId:n,replyingTo:s}){const a=le();await Dt(new u.Api.messages.SendInlineBotResult({clearDraft:!0,randomId:a,queryId:X()(n),peer:ae(e.id,e.accessHash),id:t,...s&&{replyToMsgId:s}}),!0)}async function Ra({bot:e,startParam:t}){const n=le();await Dt(new u.Api.messages.StartBot({bot:ae(e.id,e.accessHash),peer:ae(e.id,e.accessHash),randomId:n,startParam:t}),!0)}function Ua(e){K.users[e.id]=e}function Ea(e){if(e)return Object.values(e).map((e=>({id:e.id,title:e.title,amount:e.prices.reduce(((e,t)=>e+Number(t.amount.value)),0),prices:e.prices.map((({label:e,amount:t})=>({label:e,amount:Number(t.value)})))})))}async function Da({chat:e,messageId:t,requestInfo:n,shouldSave:s}){const a=await Dt(new u.Api.payments.ValidateRequestedInfo({peer:ae(e.id,e.accessHash),msgId:t,save:s||void 0,info:ye(n)}));if(!a)return;const{id:i,shippingOptions:o}=a;return i?{id:i,shippingOptions:Ea(o)}:void 0}function Ta({chat:e,messageId:t,formId:n,requestedInfoId:s,shippingOptionId:a,credentials:i}){return Dt(new u.Api.payments.SendPaymentForm({formId:X()(n),peer:ae(e.id,e.accessHash),msgId:t,requestedInfoId:s,shippingOptionId:a,credentials:new u.Api.InputPaymentCredentials({save:i.save,data:new u.Api.DataJSON({data:JSON.stringify(i.data)})})}),!0)}async function Ba({chat:e,messageId:t}){const n=await Dt(new u.Api.payments.GetPaymentForm({peer:ae(e.id,e.accessHash),msgId:t}));if(n)return function(e){const{formId:t,canSaveCredentials:n,passwordMissing:s,providerId:a,nativeProvider:i,nativeParams:o,savedInfo:r,invoice:c}=e,{test:d,nameRequested:l,phoneRequested:u,emailRequested:g,shippingAddressRequested:p,flexible:f,phoneToProvider:h,emailToProvider:m,currency:_,prices:y}=c,b=y.map((({label:e,amount:t})=>({label:e,amount:Number(t.value)}))),w=o?JSON.parse(o.data):{};return{canSaveCredentials:n,passwordMissing:s,formId:String(t),providerId:a,nativeProvider:i,savedInfo:r,invoice:{test:d,nameRequested:l,phoneRequested:u,emailRequested:g,shippingAddressRequested:p,flexible:f,phoneToProvider:h,emailToProvider:m,currency:_,prices:b},nativeParams:{needCardholderName:w.need_cardholder_name,needCountry:w.need_country,needZip:w.need_zip,publishableKey:w.publishable_key}}}(n)}async function xa(e,t){const n=await Dt(new u.Api.payments.GetPaymentReceipt({peer:ae(e.id,e.accessHash),msgId:t}));if(n)return function(e){const{invoice:t,info:n,shipping:s,currency:a,totalAmount:i,credentialsTitle:o}=e,{shippingAddress:r,phone:c,name:d}=n||{},{prices:l}=t,u=l.map((({label:e,amount:t})=>({label:e,amount:Number(t.value)})));let g,p;return s&&(g=s.prices.map((({label:e,amount:t})=>({label:e,amount:Number(t.value)}))),p=s.title),{currency:a,prices:u,info:{shippingAddress:r,phone:c,name:d},totalAmount:Number(i.value),credentialsTitle:o,shippingPrices:g,shippingMethod:p}}(n)}let Va;async function Na(e,t){Va=e,function(e){Ae=e}(Ha),function(e){tt=e}(Ha),function(e){Ft=e}(Ha),function(e){Rn=e}(Ha),function(e){as=e}(Ha),function(e){is=e}(Ha),function(e){rs=e}(Ha),function(e){Fs=e}(Ha),await async function(e,t){At=e;const{userAgent:n,platform:s,sessionData:a,isMovSupported:i}=t,o=new u.sessions.CallbackSession(a,Ut);self.isMovSupported=i,St=new u.TelegramClient(o,"2496","8da85b0d5bfe62527e5b244c209159c3",{deviceModel:navigator.userAgent||n||"Unknown UserAgent",appVersion:"1.16.5 Z",useWSS:!0,additionalDcsDisabled:!1}),St.addEventHandler(Et,vt),St.addEventHandler(Ze,vt);try{try{await St.start({phoneNumber:nt,phoneCode:st,password:at,firstAndLastNames:it,qrCode:ot,onError:rt,initialMethod:"iOS"===s||"Android"===s?"phoneNumber":"qrCode"})}catch(e){if("Disconnect"!==e.message)return void At({"@type":"updateConnectionState",connectionState:"connectionStateBroken"})}tt(ct("authorizationStateReady")),Ut(o.getSessionData()),At({"@type":"updateApiReady"}),Vt()}catch(e){throw e}}(Ha,t)}const Fa=function(e,t){let n,s=!1;return(...a)=>{n=a,s||(s=!0,e((()=>{s=!1,t(...n)})))}}((function(e,t=!1){d?t?l.push(e):d.push(e):(d=t?[]:[e],l=t?[e]:[],Promise.resolve().then((()=>{const e=d,t=l;d=void 0,l=void 0,t.forEach((e=>e())),e.forEach((e=>e()))})))}),(function(e){if(!qa||e!==La)return;const t=qa;qa=void 0,t.forEach(Va)}));let Oa,La,qa;function Ha(e){qa?qa.push(e):qa=[e],Oa&&!o.has(e["@type"])||(Oa=function(e,t,n=!0){let s,a,i;return(...o)=>{a=!0,i=o,s||(n&&(a=!1,e(...i)),s=self.setInterval((()=>{if(!a)return self.clearInterval(s),void(s=void 0);a=!1,e(...i)}),t))}}(Fa,i,!0),La=Math.random()),Oa(La)}self.onerror=e=>{console.error(e),za({type:"unhandledError",error:{message:e.error.message||"Uncaught exception in worker"}})},self.addEventListener("unhandledrejection",(e=>{console.error(e),za({type:"unhandledError",error:{message:e.reason.message||"Uncaught rejection in worker"}})}));const Ga=new Map;function Ka(e){za({type:"update",update:e})}function za(e,t){t?postMessage(e,[t]):postMessage(e)}onmessage=async e=>{const{data:t}=e;switch(t.type){case"initApi":await Na(Ka,t.args[0]);break;case"callMethod":{const{messageId:e,name:n,args:s}=t;try{if(e){const t=(...t)=>{const n=t[t.length-1];za({type:"methodCallback",messageId:e,callbackArgs:t},n instanceof ArrayBuffer?n:void 0)};Ga.set(e,t),s.push(t)}const t=await function(e,...t){return a[e](...t)}(n,...s),{arrayBuffer:i}="object"==typeof t&&"arrayBuffer"in t&&t||{};e&&za({type:"methodResponse",messageId:e,response:t},i)}catch(t){e&&za({type:"methodResponse",messageId:e,error:{message:t.message}})}e&&Ga.delete(e);break}case"cancelProgress":{const e=Ga.get(t.messageId);e&&(e.isCanceled=!0);break}case"ping":za({type:"methodResponse",messageId:t.messageId})}}},9618:(e,t,n)=>{var s=n(8764).Buffer;const a=n(4736),i=n(6842);function o(e,t=!0,n=!1){let i=s.from(e);const o=i.length;t&&(i=i.reverse());let r=a(i.toString("hex"),16);return n&&Math.floor(r.toString("2").length/8)>=o&&(r=r.subtract(a(2).pow(a(8*o)))),r}function r(e,t=8){const n=a(e),i=[];for(let e=0;e<t;e++)i[e]=n.shiftRight(8*e).and(255);return s.from(i)}function c(e,t,n=!0,i=!1){const o=(e=a(e)).bitLength();if(t<Math.ceil(o/8))throw new Error("OverflowError: int too big to convert");if(!i&&e.lesser(a(0)))throw new Error("Cannot convert to unsigned");let r=!1;e.lesser(a(0))&&(r=!0,e=e.abs());const c=e.toString("16").padStart(2*t,"0");let d=s.from(c,"hex");if(n&&(d=d.reverse()),i&&r)if(n){let e=!1;0!==d[0]&&(d[0]-=1);for(let t=0;t<d.length;t++)0!==d[t]?(e&&(d[t]-=1,e=!1),d[t]=255-d[t]):e=!0}else{d[d.length-1]=256-d[d.length-1];for(let e=0;e<d.length-1;e++)d[e]=255-d[e]}return d}function d(e){return s.from(i.randomBytes(e))}function l(e){const t=i.createHash("sha1");return t.update(e),t.digest()}let u;e.exports={readBigIntFromBuffer:o,readBufferFromBigInt:c,generateRandomLong:function(e=!0){return o(d(8),!0,e)},mod:function(e,t){return(e%t+t)%t},crc32:function(e){u||(u=function(){let e;const t=[];for(let n=0;n<256;n++){e=n;for(let t=0;t<8;t++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}()),s.isBuffer(e)||(e=s.from(e));let t=-1;for(let n=0;n<e.length;n++){const s=e[n];t=u[255&(t^s)]^t>>>8}return(-1^t)>>>0},generateRandomBytes:d,generateKeyDataFromNonce:async function(e,t){e=r(e,16),t=r(t,32);const[n,a,i]=await Promise.all([l(s.concat([t,e])),l(s.concat([e,t])),l(s.concat([t,t]))]);return{key:s.concat([n,a.slice(0,12)]),iv:s.concat([a.slice(12,20),i,t.slice(0,4)])}},sha1:l,sha256:function(e){const t=i.createHash("sha256");return t.update(e),t.digest()},bigIntMod:function(e,t){return e.remainder(t).add(t).remainder(t)},modExp:function(e,t,n){e=e.remainder(n);let s=a.one,i=e;for(;t.greater(a.zero);){const e=t.remainder(a(2));t=t.divide(a(2)),e.eq(a.one)&&(s=s.multiply(i),s=s.remainder(n)),i=i.multiply(i),i=i.remainder(n)}return s},getRandomInt:function(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e},sleep:e=>new Promise((t=>setTimeout(t,e))),getByteArray:function(e,t=!1){const n=e.toString(2).length,s=Math.floor((n+8-1)/8);return c(a(e),s,!1,t)},toSignedLittleBuffer:r,convertToLittle:function(e){const t=s.alloc(4*e.length);for(let n=0;n<e.length;n++)t.writeUInt32BE(e[n],4*n);return t},bufferXor:function(e,t){const n=[];for(let s=0;s<e.length;s++)n.push(e[s]^t[s]);return s.from(n)},createDeferred:function(){let e;return{promise:new Promise((t=>{e=t})),resolve:e}}}},9674:(e,t,n)=>{var s=n(8764).Buffer;const a=n(4736),{constructors:i}=n(7404),{readBigIntFromBuffer:o,readBufferFromBigInt:r,sha256:c,bigIntMod:d,modExp:l,generateRandomBytes:u}=n(9618),g=n(6842);function p(e,t){if(!s.from([199,28,174,185,198,177,201,4,142,108,82,47,112,241,63,115,152,13,64,35,142,62,33,193,73,52,208,55,86,61,147,15,72,25,138,10,167,193,64,88,34,148,147,210,37,48,244,219,250,51,111,110,10,201,37,19,149,67,174,212,76,206,124,55,32,253,81,246,148,88,112,90,198,140,212,254,107,107,19,171,220,151,70,81,41,105,50,132,84,241,143,175,140,89,95,100,36,119,254,150,187,42,148,29,91,205,29,74,200,204,73,136,7,8,250,155,55,142,60,79,58,144,96,190,230,124,249,164,164,166,149,129,16,81,144,126,22,39,83,181,107,15,107,65,13,186,116,216,168,75,42,20,179,20,78,14,241,40,71,84,253,23,237,149,13,89,101,180,185,221,70,88,45,177,23,141,22,156,107,196,101,176,214,255,156,163,146,143,239,91,154,228,228,24,252,21,232,62,190,160,248,127,169,255,94,237,112,5,13,237,40,73,244,123,249,89,217,86,133,12,233,41,133,31,13,129,21,246,53,177,5,238,46,78,21,208,75,36,84,191,111,79,173,240,52,177,4,3,17,156,216,227,185,47,204,91]).equals(e)||![3,4,5,7].includes(t))throw new Error("Changing passwords unsupported")}function f(e){return s.concat([s.alloc(256-e.length),e])}function h(e){return r(e,256,!1)}function m(e,t){const n=t.subtract(e);return!(n.lesser(a(0))||n.bitLength()<1984||e.bitLength()<1984||Math.floor((e.bitLength()+7)/8)>256)}function _(e,t){const n=Math.min(e.length,t.length);for(let s=0;s<n;s++)e[s]^=t[s];return e}async function y(e,t){const n=await c(s.concat([e.salt1,s.from(t,"utf-8"),e.salt1])),a=await c(s.concat([e.salt2,n,e.salt2])),i=await function(e,t,n){return g.pbkdf2(e,t,1e5,64,"sha512")}(a,e.salt1);return c(s.concat([e.salt2,i,e.salt2]))}e.exports={computeCheck:async function(e,t){const n=e.currentAlgo;if(!(n instanceof i.PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow))throw new Error(`Unsupported password algorithm ${n.className}`);const r=await y(n,t),g=o(n.p,!1),{g:b}=n,w=o(e.srp_B,!1);try{p(n.p,b)}catch(e){throw new Error("bad /g in password")}if(!function(e,t){return e.greater(a(0))&&t.subtract(e).greater(a(0))}(w,g))throw new Error("bad b in check");const I=o(r,!1),C=f(n.p),P=h(b),v=f(e.srp_B),A=l(a(b),I,g),S=o(await c(s.concat([C,P])),!1),M=d(S.multiply(A),g),[k,R,U]=await(async()=>{for(;;){const e=u(256),t=o(e,!1),n=l(a(b),t,g);if(m(n,g)){const e=h(n),i=o(await c(s.concat([e,v])),!1);if(i.greater(a(0)))return[t,e,i]}}})(),E=d(w.subtract(M),g);if(!m(E,g))throw new Error("bad gB");const D=U.multiply(I),T=k.add(D),B=l(E,T,g),[x,V,N,F,O]=await Promise.all([c(h(B)),c(C),c(P),c(n.salt1),c(n.salt2)]),L=await c(s.concat([_(V,N),F,O,R,v,x]));return new i.InputCheckPasswordSRP({srpId:e.srpId,A:s.from(R),M1:L})},computeDigest:async function(e,t){try{p(e.p,e.g)}catch(e){throw new Error("bad p/g in password")}return h(l(a(e.g),o(await y(e,t),!1),o(e.p,!1)))}}},8960:(e,t,n)=>{var s=n(8764).Buffer;const{constructors:a}=n(7404),i=s.from("ffd8ffe000104a46494600010100000100010000ffdb004300281c1e231e19282321232d2b28303c64413c37373c7b585d4964918099968f808c8aa0b4e6c3a0aadaad8a8cc8ffcbdaeef5ffffff9bc1fffffffaffe6fdfff8ffdb0043012b2d2d3c353c76414176f8a58ca5f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8ffc00011080000000003012200021101031101ffc4001f0000010501010101010100000000000000000102030405060708090a0bffc400b5100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9faffc4001f0100030101010101010101010000000000000102030405060708090a0bffc400b51100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffda000c03010002110311003f00","hex"),o=s.from("ffd9","hex");function r(e,t){throw new Error(`Cannot cast ${e.className} to any kind of ${t}`)}e.exports={getMessageId:function(e){if(void 0!==e){if("number"==typeof e)return e;if(2030045667===e.SUBCLASS_OF_ID)return e.id;throw new Error(`Invalid message type: ${e.constructor.name}`)}},getInputPeer:function e(t,n=!0,s=!0){if(void 0===t.SUBCLASS_OF_ID){if(n&&"inputEntity"in t)return t.inputEntity;if("entity"in t)return e(t.entity);r(t,"InputPeer")}if(3374092470===t.SUBCLASS_OF_ID)return t;if(t instanceof a.User){if(t.isSelf&&n)return new a.InputPeerSelf;if(void 0===t.accessHash&&s)throw new Error("User without accessHash or min info cannot be input");return new a.InputPeerUser({userId:t.id,accessHash:t.accessHash})}if(t instanceof a.Chat||t instanceof a.ChatEmpty||t instanceof a.ChatForbidden)return new a.InputPeerChat({chatId:t.id});if(t instanceof a.Channel){if(void 0===t.accessHash&&s)throw new TypeError("Channel without accessHash or min info cannot be input");return new a.InputPeerChannel({channelId:t.id,accessHash:t.accessHash})}return t instanceof a.ChannelForbidden?new a.InputPeerChannel({channelId:t.id,accessHash:t.accessHash}):t instanceof a.InputUser?new a.InputPeerUser({userId:t.userId,accessHash:t.accessHash}):t instanceof a.InputChannel?new a.InputPeerChannel({channelId:t.channelId,accessHash:t.accessHash}):t instanceof a.UserEmpty?new a.InputPeerEmpty:t instanceof a.UserFull?e(t.user):t instanceof a.ChatFull?new a.InputPeerChat({chatId:t.id}):t instanceof a.PeerChat?new a.InputPeerChat(t.chatId):void r(t,"InputPeer")},getDisplayName:function(e){return e instanceof a.User?e.lastName&&e.firstName?`${e.firstName} ${e.lastName}`:e.firstName?e.firstName:e.lastName?e.lastName:"":e instanceof a.Chat||e instanceof a.Channel?e.title:""},getAppropriatedPartSize:function(e){if(e<=104857600)return 128;if(e<=786432e3)return 256;if(e<=2097152e3)return 512;throw new Error("File size too large")},strippedPhotoToJpg:function(e){if(e.length<3||1!==e[0])return e;const t=s.from(i);return t[164]=e[1],t[166]=e[2],s.concat([t,e.slice(3),o])},getDC:function(e,t=!1){switch(e){case 1:return{id:1,ipAddress:`zws1${t?"-1":""}.web.telegram.org`,port:443};case 2:return{id:2,ipAddress:`zws2${t?"-1":""}.web.telegram.org`,port:443};case 3:return{id:3,ipAddress:`zws3${t?"-1":""}.web.telegram.org`,port:443};case 4:return{id:4,ipAddress:`zws4${t?"-1":""}.web.telegram.org`,port:443};case 5:return{id:5,ipAddress:`zws5${t?"-1":""}.web.telegram.org`,port:443};default:throw new Error(`Cannot find the DC with the ID of ${e}`)}}}},1472:e=>{e.exports="0.0.2"},243:(e,t,n)=>{"use strict";n.r(t),n.d(t,{updateTwoFaSettings:()=>l});var s=n(7150),a=n.n(s),i=n(9618),o=n(9674),r=n(7873),c=n.n(r),d=n(8764).Buffer;async function l(e,{isCheckPassword:t,currentPassword:n,newPassword:s,hint:r="",email:l,emailCodeCallback:u,onEmailCodeError:g}){if(!s&&!n)throw new Error("Neither `currentPassword` nor `newPassword` is present");if(l&&(!u||!g))throw new Error("`email` present without `emailCodeCallback` and `onEmailCodeError`");const p=await e.invoke(new(a().account.GetPassword));p.newAlgo instanceof a().PasswordKdfAlgoUnknown||(p.newAlgo.salt1=d.concat([p.newAlgo.salt1,(0,i.generateRandomBytes)(32)])),!p.hasPassword&&n&&(n=void 0);const f=n?await(0,o.computeCheck)(p,n):new(a().InputCheckPasswordEmpty);if(t)await e.invoke(new(a().auth.CheckPassword)({password:f}));else try{await e.invoke(new(a().account.UpdatePasswordSettings)({password:f,newSettings:new(a().account.PasswordInputSettings)({newAlgo:p.newAlgo,newPasswordHash:s?await(0,o.computeDigest)(p.newAlgo,s):d.alloc(0),hint:r,email:l,newSecureSettings:void 0})}))}catch(t){if(!(t instanceof c().EmailUnconfirmedError))throw t;for(;;)try{const n=await u(t.codeLength);if(!n)throw new Error("Code is empty");await e.invoke(new(a().account.ConfirmPasswordEmail)({code:n}));break}catch(e){g(e)}}}},8742:(e,t,n)=>{var s=n(8764).Buffer;const a=n(7435),i=n(6748),{sleep:o}=n(9618),r=n(7873),c=n(3995),d=n(9618),l=n(8960),u=n(9270),{LAYER:g}=n(845),{constructors:p,requests:f}=n(7404),h=n(4046),{ConnectionTCPObfuscated:m}=n(2986),{authFlow:_,checkAuthorization:y}=n(1545),{downloadFile:b}=n(2288),{uploadFile:w}=n(4766),{updateTwoFaSettings:I}=n(243),C=131072,P=["w","y","d","x","c","m","b","a","s"];class v{constructor(e,t,n,s=v.DEFAULT_OPTIONS){if(!t||!n)throw Error('Your API ID or Hash are invalid. Please read "Requirements" on README.md');const o={...v.DEFAULT_OPTIONS,...s};if(this.apiId=t,this.apiHash=n,this._useIPV6=o.useIPV6,"string"==typeof o.baseLogger?this._log=new i:this._log=o.baseLogger,"string"!=typeof e&&e){if(!(e instanceof u))throw new Error("The given session must be str or a session instance")}else try{throw new Error("not implemented")}catch(t){e=new c}this.floodSleepLimit=o.floodSleepLimit,this._eventBuilders=[],this._phoneCodeHash={},this.session=e,this.apiId=parseInt(t,10),this.apiHash=n,this._requestRetries=o.requestRetries,this._connectionRetries=o.connectionRetries,this._retryDelay=o.retryDelay||0,o.proxy&&this._log.warn("proxies are not supported"),this._proxy=o.proxy,this._timeout=o.timeout,this._autoReconnect=o.autoReconnect,this._connection=o.connection,this._floodWaitedRequests={},this._initWith=e=>new f.InvokeWithLayer({layer:g,query:new f.InitConnection({apiId:this.apiId,deviceModel:o.deviceModel||a.type().toString()||"Unknown",systemVersion:o.systemVersion||a.release().toString()||"1.0",appVersion:o.appVersion||"1.0",langCode:o.langCode,langPack:"",systemLangCode:o.systemLangCode,query:e,proxy:void 0})}),this._args=o,this._config=void 0,this.phoneCodeHashes=[],this._exportedSenderPromises={},this._exportedSenderReleaseTimeouts={},this._additionalDcsDisabled=o.additionalDcsDisabled,this._loopStarted=!1,this._reconnecting=!1,this._destroyed=!1}async connect(){await this._initSession(),void 0===this._sender&&(this._sender=new h(this.session.getAuthKey(),{logger:this._log,dcId:this.session.dcId,retries:this._connectionRetries,delay:this._retryDelay,autoReconnect:this._autoReconnect,connectTimeout:this._timeout,authKeyCallback:this._authKeyCallback.bind(this),updateCallback:this._handleUpdate.bind(this),isMainSender:!0})),this._sender.userDisconnected=!1,this._sender._user_connected=!1,this._sender._reconnecting=!1,this._sender._disconnected=!0;const e=new this._connection(this.session.serverAddress,this.session.port,this.session.dcId,this._log);await this._sender.connect(e)?(this.session.setAuthKey(this._sender.authKey),await this._sender.send(this._initWith(new f.help.GetConfig({}))),this._loopStarted||(this._updateLoop(),this._loopStarted=!0),this._reconnecting=!1):this._loopStarted||(this._updateLoop(),this._loopStarted=!0)}async _initSession(){await this.session.load(),this.session.serverAddress&&this.session.serverAddress.includes(":")===this._useIPV6||this.session.setDC(2,this._useIPV6?"[2001:67c:4e8:f002::a]":"zws2.web.telegram.org",this._args.useWSS?443:80)}async _updateLoop(){for(;!this._destroyed;)if(await d.sleep(3e3),!this._reconnecting){try{await k((()=>{return e=this._sender.send(new f.PingDelayDisconnect({pingId:d.getRandomInt(Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),disconnectDelay:6e4})),5e3,Promise.race([e,d.sleep(5e3).then((()=>Promise.reject(new Error("TIMEOUT"))))]);var e}),3,100)}catch(e){if(console.warn(e),this._reconnecting)continue;await this.disconnect(),await this.connect()}if((new Date).getTime()-this._lastRequest>18e5)try{await this.invoke(new f.updates.GetState)}catch(e){}}await this.disconnect()}async disconnect(){this._sender&&await this._sender.disconnect(),await Promise.all(Object.values(this._exportedSenderPromises).map((e=>e&&e.then((e=>{if(e)return e.disconnect()}))))),this._exportedSenderPromises={}}async destroy(){this._destroyed=!0;try{await this.disconnect()}catch(e){}this.session.delete(),this._eventBuilders=[]}async _switchDC(e){this._log.info(`Reconnecting to new data center ${e}`);const t=l.getDC(e);return this.session.setDC(e,t.ipAddress,t.port),await this._sender.authKey.setKey(void 0),this.session.setAuthKey(void 0),this._reconnecting=!0,await this.disconnect(),this.connect()}_authKeyCallback(e,t){this.session.setAuthKey(e,t)}async _cleanupExportedSender(e){this.session.dcId!==e&&this.session.setAuthKey(void 0,e);const t=await this._exportedSenderPromises[e];this._exportedSenderPromises[e]=void 0,await t.disconnect()}async _connectSender(e,t){const n=l.getDC(t,!!e.authKey.getKey());for(;;)try{if(await e.connect(new this._connection(n.ipAddress,n.port,t,this._log)),this.session.dcId!==t&&!e._authenticated){this._log.info(`Exporting authorization for data center ${n.ipAddress}`);const s=await this.invoke(new f.auth.ExportAuthorization({dcId:t})),a=this._initWith(new f.auth.ImportAuthorization({id:s.id,bytes:s.bytes}));await e.send(a),e._authenticated=!0}return e.dcId=t,e.userDisconnected=!1,e}catch(t){console.error(t),await d.sleep(1e3),await e.disconnect()}}async _borrowExportedSender(e,t,n){if(this._additionalDcsDisabled)return;let s;this._exportedSenderPromises[e]&&!t||(this._exportedSenderPromises[e]=this._connectSender(n||this._createExportedSender(e),e));try{if(s=await this._exportedSenderPromises[e],!s.isConnected())return s.isConnecting?(await d.sleep(1e3),this._borrowExportedSender(e,!1,s)):this._borrowExportedSender(e,!0,s)}catch(t){return console.error(t),this._borrowExportedSender(e,!0)}return this._exportedSenderReleaseTimeouts[e]&&(clearTimeout(this._exportedSenderReleaseTimeouts[e]),this._exportedSenderReleaseTimeouts[e]=void 0),this._exportedSenderReleaseTimeouts[e]=setTimeout((()=>{this._exportedSenderReleaseTimeouts[e]=void 0,s.disconnect()}),3e4),s}_createExportedSender(e){return new h(this.session.getAuthKey(e),{logger:this._log,dcId:e,retries:this._connectionRetries,delay:this._retryDelay,autoReconnect:this._autoReconnect,connectTimeout:this._timeout,authKeyCallback:this._authKeyCallback.bind(this),isMainSender:e===this.session.dcId,onConnectionBreak:this._cleanupExportedSender.bind(this)})}getSender(e){return e?this._borrowExportedSender(e):Promise.resolve(this._sender)}downloadFile(e,t={}){return b(this,e,t)}downloadMedia(e,t){let n;if(n=e instanceof p.Message?e.media:e,"string"==typeof n)throw new Error("not implemented");return n instanceof p.MessageMediaWebPage&&n.webpage instanceof p.WebPage&&(n=n.webpage.document||n.webpage.photo),n instanceof p.MessageMediaPhoto||n instanceof p.Photo?this._downloadPhoto(n,t):n instanceof p.MessageMediaDocument||n instanceof p.Document?this._downloadDocument(n,t):n instanceof p.MessageMediaContact?this._downloadContact(n,t):n instanceof p.WebDocument||n instanceof p.WebDocumentNoProxy?this._downloadWebDocument(n,t):void 0}downloadProfilePhoto(e,t=!1){const n=t?"x":"m";let s,a,i;if([765557111,3316604308,524706233,3566872215].includes(e.SUBCLASS_OF_ID)){if(!e.photo){if(!e.chatPhoto)return;return this._downloadPhoto(e.chatPhoto,{sizeType:n})}s=e.photo}else s=e;if(s instanceof p.UserProfilePhoto||s instanceof p.ChatPhoto)return a=s.dcId,i=new p.InputPeerPhotoFileLocation({peer:l.getInputPeer(e),photoId:s.photoId,big:t}),this.downloadFile(i,{dcId:a})}downloadStickerSetThumb(e){if(!e.thumbs||!e.thumbs.length)return;const{thumbVersion:t}=e;return this.downloadFile(new p.InputStickerSetThumb({stickerset:new p.InputStickerSetID({id:e.id,accessHash:e.accessHash}),thumbVersion:t}),{dcId:e.thumbDcId})}_pickFileSize(e,t){if(!t||!e||!e.length)return;let n;for(let s=P.indexOf(t);s<P.length;s++)if(n=e.find((e=>e.type===P[s])),n)return n}_downloadCachedPhotoSize(e){let t;return t=e instanceof p.PhotoStrippedSize?l.strippedPhotoToJpg(e.bytes):e.bytes,t}_downloadPhoto(e,t){if(e instanceof p.MessageMediaPhoto&&(e=e.photo),!(e instanceof p.Photo))return;const n=this._pickFileSize(e.sizes,t.sizeType);return!n||n instanceof p.PhotoSizeEmpty?void 0:n instanceof p.PhotoCachedSize||n instanceof p.PhotoStrippedSize?this._downloadCachedPhotoSize(n):this.downloadFile(new p.InputPhotoFileLocation({id:e.id,accessHash:e.accessHash,fileReference:e.fileReference,thumbSize:n.type}),{dcId:e.dcId,fileSize:n.size,progressCallback:t.progressCallback})}_downloadDocument(e,t){if(e instanceof p.MessageMediaDocument&&(e=e.document),!(e instanceof p.Document))return;let n;if(t.sizeType){if(n=e.thumbs?this._pickFileSize(e.thumbs,t.sizeType):void 0,!n&&e.mimeType.startsWith("video/"))return;if(n&&(n instanceof p.PhotoCachedSize||n instanceof p.PhotoStrippedSize))return this._downloadCachedPhotoSize(n)}return this.downloadFile(new p.InputDocumentFileLocation({id:e.id,accessHash:e.accessHash,fileReference:e.fileReference,thumbSize:n?n.type:""}),{fileSize:n?n.size:e.size,progressCallback:t.progressCallback,start:t.start,end:t.end,dcId:e.dcId,workers:t.workers})}_downloadContact(e,t){throw new Error("not implemented")}async _downloadWebDocument(e){try{const t=[];let n=0;for(;;){const s=new f.upload.GetWebFile({location:new p.InputWebFileLocation({url:e.url,accessHash:e.accessHash}),offset:n,limit:C}),a=await this._borrowExportedSender(4),i=await a.send(s);if(n+=131072,!i.bytes.length)break;if(t.push(i.bytes),i.bytes.length<C)break}return s.concat(t)}catch(e){if("WEBFILE_NOT_AVAILABLE"===e.message)return s.alloc(0);throw e}}async invoke(e){if("request"!==e.classType)throw new Error("You can only invoke MTProtoRequests");this._lastRequest=(new Date).getTime();let t=0;for(t=0;t<this._requestRetries;t++){const t=this._sender.sendWithInvokeSupport(e);try{return await t.promise}catch(e){if(e instanceof r.ServerError||"RPC_CALL_FAIL"===e.message||"RPC_MCGET_FAIL"===e.message)this._log.warn(`Telegram is having internal issues ${e.constructor.name}`),await o(2e3);else if(e instanceof r.FloodWaitError||e instanceof r.FloodTestPhoneWaitError){if(!(e.seconds<=this.floodSleepLimit))throw e;this._log.info(`Sleeping for ${e.seconds}s on flood wait`),await o(1e3*e.seconds)}else if(e instanceof r.PhoneMigrateError||e instanceof r.NetworkMigrateError||e instanceof r.UserMigrateError){if(this._log.info(`Phone migrated to ${e.newDc}`),(e instanceof r.PhoneMigrateError||e instanceof r.NetworkMigrateError)&&await y(this))throw e;await this._switchDC(e.newDc)}else{if(!(e instanceof r.MsgWaitError))throw e;await t.isReady()}}}throw new Error(`Request was unsuccessful ${t} time(s)`)}async getMe(){try{return(await this.invoke(new f.users.GetUsers({id:[new p.InputUserSelf]})))[0]}catch(e){this._log.warn("error while getting me"),this._log.warn(e)}}async start(e){if(this.isConnected()||await this.connect(),await y(this))return;const t={apiId:this.apiId,apiHash:this.apiHash};await _(this,t,e)}uploadFile(e){return w(this,e)}updateTwoFaSettings(e){return I(this,e)}addEventHandler(e,t){this._eventBuilders.push([t,e])}_handleUpdate(e){if(e instanceof p.Updates||e instanceof p.UpdatesCombined){const t=[];for(const n of[...e.users,...e.chats])t.push(n);for(const n of e.updates)this._processUpdate(n,e.updates,t)}else e instanceof p.UpdateShort?this._processUpdate(e.update,void 0):this._processUpdate(e,void 0)}_processUpdate(e,t,n){e._entities=n||[];const s={update:e,others:t};this._dispatchUpdate(s)}async _dispatchUpdate(e={update:void 0,others:void 0,channelId:void 0,ptsDate:void 0}){for(const[t,n]of this._eventBuilders){const s=t.build(e.update);s&&await n(s)}}isConnected(){return!(!this._sender||!this._sender.isConnected())}}var A,S,M;async function k(e,t,n){for(let s=0;s<t;s++)try{return await e()}catch(e){if(s===t-1)throw e;await d.sleep(n)}}M={connection:m,useIPV6:!1,proxy:void 0,timeout:10,requestRetries:5,connectionRetries:1/0,retryDelay:1e3,autoReconnect:!0,sequentialUpdates:!1,floodSleepLimit:60,deviceModel:void 0,systemVersion:void 0,appVersion:void 0,langCode:"en",systemLangCode:"en",baseLogger:"gramjs",useWSS:!1,additionalDcsDisabled:!1},(S="DEFAULT_OPTIONS")in(A=v)?Object.defineProperty(A,S,{value:M,enumerable:!0,configurable:!0,writable:!0}):A[S]=M,e.exports=v},1545:(e,t,n)=>{"use strict";n.r(t),n.d(t,{authFlow:()=>l,checkAuthorization:()=>u});var s=n(7150),a=n.n(s),i=n(8960),o=n.n(i),r=n(9618),c=n(9674);const d="phoneNumber";async function l(e,t,n){let s;if("botAuthToken"in n)s=await async function(e,t,n){const{apiId:s,apiHash:i}=t,{botAuthToken:o}=n,{user:r}=await e.invoke(new(a().auth.ImportBotAuthorization)({apiId:s,apiHash:i,botAuthToken:o}));return r}(e,t,n);else{const{initialMethod:a=d}=n;s="phoneNumber"===a?await g(e,t,n):await p(e,t,n)}e._log.info("Signed in successfully as",o().getDisplayName(s))}async function u(e){try{return await e.invoke(new(a().updates.GetState)),!0}catch(e){if("Disconnect"===e.message)throw e;return!1}}async function g(e,t,n){let s,i,o,r=!1;for(;;)try{if("function"==typeof n.phoneNumber)try{s=await n.phoneNumber()}catch(s){if("RESTART_AUTH_WITH_QR"===s.message)return p(e,t,n);throw s}else s=n.phoneNumber;const a=await f(e,t,s,n.forceSMS);if(i=a.phoneCodeHash,r=a.isCodeViaApp,"string"!=typeof i)throw new Error("Failed to retrieve phone code hash");break}catch(e){if("function"!=typeof n.phoneNumber)throw e;n.onError(e)}let c,d=!1;for(;;)try{try{o=await n.phoneCode(r)}catch(s){if("RESTART_AUTH"===s.message)return g(e,t,n)}if(!o)throw new Error("Code is empty");const l=await e.invoke(new(a().auth.SignIn)({phoneNumber:s,phoneCodeHash:i,phoneCode:o}));if(l instanceof a().auth.AuthorizationSignUpRequired){d=!0,c=l.termsOfService;break}return l.user}catch(t){if("SESSION_PASSWORD_NEEDED"===t.message)return h(e,0,n);n.onError(t)}if(d)for(;;)try{const[t,o]=await n.firstAndLastNames();if(!t)throw new Error("First name is required");const{user:r}=await e.invoke(new(a().auth.SignUp)({phoneNumber:s,phoneCodeHash:i,firstName:t,lastName:o}));return c&&await e.invoke(new(a().help.AcceptTermsOfService)({id:c.id})),r}catch(e){n.onError(e)}return n.onError(new Error("Auth failed")),g(e,t,n)}async function p(e,t,n){let s=!1;const i=(async()=>{for(;!s;){const t=await e.invoke(new(a().auth.ExportLoginToken)({apiId:Number("2496"),apiHash:"8da85b0d5bfe62527e5b244c209159c3",exceptIds:[]}));if(!(t instanceof a().auth.LoginToken))throw new Error("Unexpected");const{token:s,expires:i}=t;await Promise.race([n.qrCode({token:s,expires:i}),(0,r.sleep)(3e4)])}})(),o=new Promise((t=>{e.addEventHandler((e=>{e instanceof a().UpdateLoginToken&&t()}),{build:e=>e})}));try{await Promise.race([o,i])}catch(s){if("RESTART_AUTH"===s.message)return await g(e,t,n);throw s}finally{s=!0}try{const t=await e.invoke(new(a().auth.ExportLoginToken)({apiId:Number("2496"),apiHash:"8da85b0d5bfe62527e5b244c209159c3",exceptIds:[]}));if(t instanceof a().auth.LoginTokenSuccess&&t.authorization instanceof a().auth.Authorization)return t.authorization.user;if(t instanceof a().auth.LoginTokenMigrateTo){await e._switchDC(t.dcId);const n=await e.invoke(new(a().auth.ImportLoginToken)({token:t.token}));if(n instanceof a().auth.LoginTokenSuccess&&n.authorization instanceof a().auth.Authorization)return n.authorization.user}}catch(t){if("SESSION_PASSWORD_NEEDED"===t.message)return h(e,0,n);throw t}throw void 0}async function f(e,t,n,s=!1){try{const{apiId:i,apiHash:o}=t,r=await e.invoke(new(a().auth.SendCode)({phoneNumber:n,apiId:i,apiHash:o,settings:new(a().CodeSettings)}));if(!s||r.type instanceof a().auth.SentCodeTypeSms)return{phoneCodeHash:r.phoneCodeHash,isCodeViaApp:r.type instanceof a().auth.SentCodeTypeApp};const c=await e.invoke(new(a().auth.ResendCode)({phoneNumber:n,phoneCodeHash:r.phoneCodeHash}));return{phoneCodeHash:c.phoneCodeHash,isCodeViaApp:c.type instanceof a().auth.SentCodeTypeApp}}catch(a){if("AUTH_RESTART"===a.message)return f(e,t,n,s);throw a}}async function h(e,t,n){for(;;)try{const t=await e.invoke(new(a().account.GetPassword)),s=await n.password(t.hint);if(!s)throw new Error("Password is empty");const i=await(0,c.computeCheck)(t,s),{user:o}=await e.invoke(new(a().auth.CheckPassword)({password:i}));return o}catch(e){n.onError(e)}}},2288:(e,t,n)=>{"use strict";n.r(t),n.d(t,{downloadFile:()=>p});var s=n(7150),a=n.n(s),i=n(8960),o=n(9618),r=n(7873),c=n.n(r),d=n(8764).Buffer;function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const u=1048576;class g{constructor(e){this.maxWorkers=e,l(this,"deferred",void 0),l(this,"activeWorkers",0)}requestWorker(){return this.activeWorkers++,this.activeWorkers>this.maxWorkers?(this.deferred=(0,o.createDeferred)(),this.deferred.promise):Promise.resolve()}releaseWorker(){this.activeWorkers--,this.deferred&&this.activeWorkers<=this.maxWorkers&&this.deferred.resolve()}}async function p(e,t,n){let{partSizeKb:s,end:r}=n;const{fileSize:l,workers:p=1}=n,{dcId:f,progressCallback:h,start:m=0}=n;r=r&&r<l?r:l-1,s||(s=l?(0,i.getAppropriatedPartSize)(l):64);const _=1024*s,y=r?Math.ceil((r-m)/_):1;if(_%4096!=0)throw new Error("The part size must be evenly divisible by 4096");e._log.info(`Downloading file in chunks of ${_} bytes`);const b=new g(p),w=[];let I=m,C=!1,P=0;for(h&&h(P),await e.getSender(f);;){let n=_,s=!1;if(Math.floor(I/u)!==Math.floor((I+n-1)/u)&&(n=u-I%u,s=!0),await b.requestWorker(),C){b.releaseWorker();break}if(w.push((async i=>{for(;;){let d;try{d=await e.getSender(f);const o=await d.send(new(a().upload.GetFile)({location:t,offset:i,limit:n,precise:s||void 0}));if(h){if(h.isCanceled)throw new Error("USER_CANCELED");P+=1/y,h(P)}return!r&&o.bytes.length<n&&(C=!0),b.releaseWorker(),o.bytes}catch(e){if(d&&!d.isConnected()){await(0,o.sleep)(1e3);continue}if(e instanceof c().FloodWaitError){await(0,o.sleep)(1e3*e.seconds);continue}throw b.releaseWorker(),C=!0,e}}})(I)),I+=n,r&&I>r)break}const v=(await Promise.all(w)).filter(Boolean),A=r?r+1-m:void 0;return d.concat(v,A)}},4766:(e,t,n)=>{"use strict";n.r(t),n.d(t,{uploadFile:()=>l});var s=n(7150),a=n.n(s),i=n(9618),o=n(8960),r=n(7873),c=n.n(r),d=n(8764).Buffer;async function l(e,t){const{file:n,onProgress:s}=t;let{workers:r}=t;const{name:l,size:u}=n,g=(0,i.readBigIntFromBuffer)((0,i.generateRandomBytes)(8),!0,!0),p=u>10485760,f=1024*(0,o.getAppropriatedPartSize)(u),h=Math.floor((u+f-1)/f),m=d.from(await function(e){return new Response(e).arrayBuffer()}(n));await e.getSender(e.session.dcId),r&&u||(r=1),r>=h&&(r=h);let _=0;s&&s(_);for(let t=0;t<h;t+=r){const n=[];let o=t+r;o>h&&(o=h);for(let r=t;r<o;r++){const t=m.slice(r*f,(r+1)*f);n.push((async(t,n)=>{for(;;){let o;try{o=await e.getSender(e.session.dcId),await o.send(p?new(a().upload.SaveBigFilePart)({fileId:g,filePart:t,fileTotalParts:h,bytes:n}):new(a().upload.SaveFilePart)({fileId:g,filePart:t,bytes:n}))}catch(e){if(o&&!o.isConnected()){await(0,i.sleep)(1e3);continue}if(e instanceof c().FloodWaitError){await(0,i.sleep)(1e3*e.seconds);continue}throw e}if(s){if(s.isCanceled)throw new Error("USER_CANCELED");_+=1/h,s(_)}break}})(r,t))}await Promise.all(n)}return p?new(a().InputFileBig)({id:g,parts:h,name:l}):new(a().InputFile)({id:g,parts:h,name:l,md5Checksum:""})}},3302:(e,t,n)=>{var s=n(8764).Buffer;const{sha1:a,toSignedLittleBuffer:i,readBufferFromBigInt:o,readBigIntFromBuffer:r}=n(9618),c=n(5544),{sleep:d}=n(9618);class l{constructor(e,t){if(!t||!e)return;this._key=e,this._hash=t;const n=new c(t);this.auxHash=n.readLong(!1),n.read(4),this.keyId=n.readLong(!1)}async setKey(e){if(!e)return this._key=void 0,this.auxHash=void 0,this.keyId=void 0,void(this._hash=void 0);if(e instanceof l)return this._key=e._key,this.auxHash=e.auxHash,this.keyId=e.keyId,void(this._hash=e._hash);this._key=e,this._hash=await a(this._key);const t=new c(this._hash);this.auxHash=t.readLong(!1),t.read(4),this.keyId=t.readLong(!1)}async waitForKey(){for(;!this.keyId;)await d(20)}getKey(){return this._key}async calcNewNonceHash(e,t){e=i(e,32);const n=s.alloc(1);n.writeUInt8(t,0);const c=s.concat([e,s.concat([n,o(this.auxHash,8,!0)])]),d=(await a(c)).slice(4,20);return r(d,!0,!0)}equals(e){return e instanceof this.constructor&&this._key&&e.getKey()&&e.getKey().equals(this._key)}}e.exports=l},5830:(e,t,n)=>{var s=n(8764).Buffer;const a=n(6842);e.exports=class{constructor(e,t){if(!s.isBuffer(e)||!s.isBuffer(t)||16!==t.length)throw new Error("Key and iv need to be a buffer");this.cipher=a.createCipheriv("AES-256-CTR",e,t)}encrypt(e){return s.from(this.cipher.update(e))}}},9636:(e,t,n)=>{const s=n(4736),{modExp:a}=n(9618);class i{static gcd(e,t){for(;t.neq(s.zero);){const n=t;t=e.remainder(t),e=n}return e}static factorize(e){if(e.remainder(2).equals(s.zero))return{p:s(2),q:e.divide(s(2))};let t=s.randBetween(s(1),e.minus(1));const n=s.randBetween(s(1),e.minus(1)),o=s.randBetween(s(1),e.minus(1));let r,c=s.one,d=s.one,l=s.one,u=s.zero,g=s.zero;for(;c.eq(s.one);){u=t;for(let i=0;s(i).lesser(d);i++)t=a(t,s(2),e).add(n).remainder(e);for(r=s.zero;r.lesser(d)&&c.eq(s.one);){g=t;const p=s.min(o,d.minus(r));for(let i=0;s(i).lesser(p);i++)t=a(t,s(2),e).add(n).remainder(e),l=l.multiply(u.minus(t).abs()).remainder(e);c=i.gcd(l,e),r=r.add(o)}d=d.multiply(2)}if(c.eq(e))for(;g=a(g,s(2),e).add(n).remainder(e),c=i.gcd(u.minus(g).abs(),e),!c.greater(1););const p=c;return l=e.divide(c),p<l?{p,q:l}:{p:l,q:p}}}e.exports=i},2608:(e,t,n)=>{var s=n(8764).Buffer;const{IGE:a}=n(8136),i=n(9618);e.exports=class{constructor(e,t){this.ige=new a(e,t)}decryptIge(e){return i.convertToLittle(this.ige.decrypt(e))}encryptIge(e){const t=e.length%16;return t&&(e=s.concat([e,i.generateRandomBytes(16-t)])),i.convertToLittle(this.ige.encrypt(e))}}},4121:(e,t,n)=>{"use strict";function s(e){const t=new Uint8Array(4*e.length);let n=0;for(let s=0;s<e.length;s++){const a=e[s];t[n++]=a>>>24,t[n++]=a>>16&255,t[n++]=a>>8&255,t[n++]=255&a}return t.buffer}function a(e){return e.buffer}function i(e){const t=new Uint8Array(e),n=new Uint32Array(t.length/4);for(let e=0;e<t.length;e+=4)n[e/4]=t[e]<<24^t[e+1]<<16^t[e+2]<<8^t[e+3];return n}function o(e){return new Uint32Array(e)}n.r(t),n.d(t,{i2abLow:()=>s,i2abBig:()=>a,ab2iLow:()=>i,ab2iBig:()=>o,isBigEndian:()=>r,i2ab:()=>c,ab2i:()=>d});const r=1===new Uint8Array(new Uint32Array([16909060]))[0],c=r?a:s,d=r?o:i},6842:(e,t,n)=>{var s=n(8764).Buffer;const a=n(8136).default,{i2ab:i,ab2i:o}=n(4121),{getWords:r}=n(7760);class c{constructor(e){this.setBytes(e)}setBytes(e){e=s.from(e),this._counter=e}increment(){for(let e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}}}class d{constructor(e,t){t instanceof c||(t=new c(t)),this._counter=t,this._remainingCounter=void 0,this._remainingCounterIndex=16,this._aes=new a(r(e))}update(e){return this.encrypt(e)}encrypt(e){const t=s.from(e);for(let e=0;e<t.length;e++)16===this._remainingCounterIndex&&(this._remainingCounter=s.from(i(this._aes.encrypt(o(this._counter._counter)))),this._remainingCounterIndex=0,this._counter.increment()),t[e]^=this._remainingCounter[this._remainingCounterIndex++];return t}}class l{constructor(e){this.algorithm=e}update(e){this.data=new Uint8Array(e)}async digest(){return"sha1"===this.algorithm?s.from(await self.crypto.subtle.digest("SHA-1",this.data)):"sha256"===this.algorithm?s.from(await self.crypto.subtle.digest("SHA-256",this.data)):void 0}}e.exports={createCipheriv:function(e,t,n){if(e.includes("ECB"))throw new Error("Not supported");return new d(t,n)},createDecipheriv:function(e,t,n){if(e.includes("ECB"))throw new Error("Not supported");return new d(t,n)},randomBytes:function(e){const t=new Uint8Array(e);return crypto.getRandomValues(t),t},createHash:function(e){return new l(e)},pbkdf2:async function(e,t,n){const a=await crypto.subtle.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]);return s.from(await crypto.subtle.deriveBits({name:"PBKDF2",hash:"SHA-512",salt:t,iterations:n},a,512))}}},7760:(e,t,n)=>{"use strict";function s(e,t){return e.charCodeAt(t)<<24^e.charCodeAt(t+1)<<16^e.charCodeAt(t+2)<<8^e.charCodeAt(t+3)}function a(e){if(e instanceof Uint32Array)return e;if("string"==typeof e){if(e.length%4!=0)for(let t=e.length%4;t<=4;t++)e+="\0x00";const t=new Uint32Array(e.length/4);for(let n=0;n<e.length;n+=4)t[n/4]=s(e,n);return t}if(e instanceof Uint8Array){const t=new Uint32Array(e.length/4);for(let n=0;n<e.length;n+=4)t[n/4]=e[n]<<24^e[n+1]<<16^e[n+2]<<8^e[n+3];return t}throw new Error("Unable to create 32-bit words")}function i(e,t,n=e){for(let s=0;s<e.length;s++)n[s]=e[s]^t[s]}n.r(t),n.d(t,{s2i:()=>s,getWords:()=>a,xor:()=>i})},8187:e=>{class t extends Error{constructor(){super("The read operation was cancelled.")}}class n extends Error{constructor(e,t){super(`Could not find a matching Constructor ID for the TLObject that was supposed to be\n read with ID ${e}. Most likely, a TLObject was trying to be read when\n it should not be read. Remaining bytes: ${t.length}`),"undefined"!=typeof alert&&alert(`Missing MTProto Entity: Please, make sure to add TL definition for ID ${e}`),this.invalidConstructorId=e,this.remaining=t}}class s extends Error{constructor(e,t){super(`Invalid checksum (${e} when ${t} was expected). This packet should be skipped.`),this.checksum=e,this.validChecksum=t}}class a extends Error{constructor(e){let t;4===e.length?(t=-e.readInt32LE(0),super(`Invalid response buffer (HTTP code ${t})`)):super(`Invalid response buffer (too short ${e})`),this.code=t,this.payload=e}}class i extends Error{constructor(...e){e.length||(e=["A security check failed."]),super(...e)}}class o extends Error{constructor(e,t){let n=o.ErrorMessages[t]||`Unknown error code (this should not happen): ${t}.`;n+=` Caused by ${e.className}`,super(n),this.message=n,this.code=t}}var r,c,d;d={16:"msg_id too low (most likely, client time is wrong it would be worthwhile to synchronize it using msg_id notifications and re-send the original message with the “correct” msg_id or wrap it in a container with a new msg_id if the original message had waited too long on the client to be transmitted).",17:"msg_id too high (similar to the previous case, the client time has to be synchronized, and the message re-sent with the correct msg_id).",18:"Incorrect two lower order msg_id bits (the server expects client message msg_id to be divisible by 4).",19:"Container msg_id is the same as msg_id of a previously received message (this must never happen).",20:"Message too old, and it cannot be verified whether the server has received a message with this msg_id or not.",32:"msg_seqno too low (the server has already received a message with a lower msg_id but with either a higher or an equal and odd seqno).",33:"msg_seqno too high (similarly, there is a message with a higher msg_id but with either a lower or an equal and odd seqno).",34:"An even msg_seqno expected (irrelevant message), but odd received.",35:"Odd msg_seqno expected (relevant message), but even received.",48:"Incorrect server salt (in this case, the bad_server_salt response is received with the correct salt, and the message is to be re-sent with it).",64:"Invalid container."},(c="ErrorMessages")in(r=o)?Object.defineProperty(r,c,{value:d,enumerable:!0,configurable:!0,writable:!0}):r[c]=d,e.exports={ReadCancelledError:t,TypeNotFoundError:n,InvalidChecksumError:s,InvalidBufferError:a,SecurityError:i,CdnFileTamperedError:class extends i{constructor(){super("The CDN file has been altered and its download cancelled.")}},BadMessageError:o}},6952:e=>{function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class n extends Error{constructor(e,t,s){super("RPCError {0}: {1}{2}".replace("{0}",s).replace("{1}",e).replace("{2}",n._fmtRequest(t))),this.code=s,this.message=e}static _fmtRequest(e){return e?` (caused by ${e.className})`:""}}e.exports={RPCError:n,InvalidDCError:class extends n{constructor(e,t,n){super(t,e,n),this.code=n||303,this.message=t||"ERROR_SEE_OTHER"}},BadRequestError:class extends n{constructor(...e){super(...e),t(this,"code",400),t(this,"message","BAD_REQUEST")}},UnauthorizedError:class extends n{constructor(...e){super(...e),t(this,"code",401),t(this,"message","UNAUTHORIZED")}},ForbiddenError:class extends n{constructor(...e){super(...e),t(this,"code",403),t(this,"message","FORBIDDEN")}},NotFoundError:class extends n{constructor(...e){super(...e),t(this,"code",404),t(this,"message","NOT_FOUND")}},AuthKeyError:class extends n{constructor(...e){super(...e),t(this,"code",406),t(this,"message","AUTH_KEY")}},FloodError:class extends n{constructor(...e){super(...e),t(this,"code",420),t(this,"message","FLOOD")}},ServerError:class extends n{constructor(...e){super(...e),t(this,"code",500),t(this,"message","INTERNAL")}},TimedOutError:class extends n{constructor(...e){super(...e),t(this,"code",503),t(this,"message","Timeout")}}}},5651:(e,t,n)=>{const{RPCError:s,InvalidDCError:a,FloodError:i,BadRequestError:o}=n(6952);class r extends a{constructor(e){const t=Number(e.capture||0);super(`The user whose identity is being used to execute queries is associated with DC ${t}${s._fmtRequest(e.request)}`),this.message=`The user whose identity is being used to execute queries is associated with DC ${t}${s._fmtRequest(e.request)}`,this.newDc=t}}class c extends a{constructor(e){const t=Number(e.capture||0);super(`The phone number a user is trying to use for authorization is associated with DC ${t}${s._fmtRequest(e.request)}`),this.message=`The phone number a user is trying to use for authorization is associated with DC ${t}${s._fmtRequest(e.request)}`,this.newDc=t}}class d extends i{constructor(e){const t=Number(e.capture||0);super(`A wait of ${t} seconds is required before sending another message in this chat${s._fmtRequest(e.request)}`),this.message=`A wait of ${t} seconds is required before sending another message in this chat${s._fmtRequest(e.request)}`,this.seconds=t}}class l extends i{constructor(e){const t=Number(e.capture||0);super(`A wait of ${t} seconds is required${s._fmtRequest(e.request)}`),this.message=`A wait of ${t} seconds is required${s._fmtRequest(e.request)}`,this.seconds=t}}class u extends i{constructor(e){super(`Message failed to be sent.${s._fmtRequest(e.request)}`),this.message=`Message failed to be sent.${s._fmtRequest(e.request)}`}}class g extends i{constructor(e){const t=Number(e.capture||0);super(`A wait of ${t} seconds is required in the test servers${s._fmtRequest(e.request)}`),this.message=`A wait of ${t} seconds is required in the test servers${s._fmtRequest(e.request)}`,this.seconds=t}}class p extends a{constructor(e){const t=Number(e.capture||0);super(`The file to be accessed is currently stored in DC ${t}${s._fmtRequest(e.request)}`),this.message=`The file to be accessed is currently stored in DC ${t}${s._fmtRequest(e.request)}`,this.newDc=t}}class f extends a{constructor(e){const t=Number(e.capture||0);super(`The source IP address is associated with DC ${t}${s._fmtRequest(e.request)}`),this.message=`The source IP address is associated with DC ${t}${s._fmtRequest(e.request)}`,this.newDc=t}}class h extends o{constructor(e){const t=Number(e.capture||0);super(`Email unconfirmed, the length of the code must be ${t}${s._fmtRequest(e.request)}`),this.message=`Email unconfirmed, the length of the code must be ${t}${s._fmtRequest(e.request)}`,this.codeLength=t}}const m=[[/FILE_MIGRATE_(\d+)/,p],[/FLOOD_TEST_PHONE_WAIT_(\d+)/,g],[/FLOOD_WAIT_(\d+)/,l],[/MSG_WAIT_(.*)/,u],[/PHONE_MIGRATE_(\d+)/,c],[/SLOWMODE_WAIT_(\d+)/,d],[/USER_MIGRATE_(\d+)/,r],[/NETWORK_MIGRATE_(\d+)/,f],[/EMAIL_UNCONFIRMED_(\d+)/,h]];e.exports={rpcErrorRe:m,FileMigrateError:p,FloodTestPhoneWaitError:g,FloodWaitError:l,PhoneMigrateError:c,SlowModeWaitError:d,UserMigrateError:r,NetworkMigrateError:f,MsgWaitError:u,EmailUnconfirmedError:h}},7873:(e,t,n)=>{const{RPCError:s}=n(6952),{rpcErrorRe:a}=n(5651),i=n(8187),o=n(6952),r=n(5651);e.exports={RPCMessageToError:function(e,t){for(const[n,s]of a){const a=e.errorMessage.match(n);if(a)return new s({request:t,capture:2===a.length?parseInt(a[1],10):void 0})}return new s(e.errorMessage,t)},...i,...o,...r}},6316:()=>{},3903:(e,t,n)=>{const{EventBuilder:s}=n(6172);e.exports=class extends s{constructor(e={types:void 0,func:void 0}){super(),e.types?this.types=e.types:this.types=!0}build(e){return e}}},6172:e=>{e.exports={EventBuilder:class{constructor(e={chats:void 0,blacklistChats:void 0,func:void 0}){this.chats=e.chats,this.blacklistChats=Boolean(e.blacklistChats),this.resolved=!1,this.func=e.func}build(e){}}}},3182:(e,t,n)=>{const s=n(6316),a=n(3903);class i extends Error{}e.exports={NewMessage:s,StopPropagation:i,Raw:a}},6151:e=>{e.exports=class{constructor(){this._queue=[],this.canGet=new Promise((e=>{this.resolveGet=e})),this.canPush=!0}async push(e){await this.canPush,this._queue.push(e),this.resolveGet(!0),this.canPush=new Promise((e=>{this.resolvePush=e}))}async pop(){await this.canGet;const e=this._queue.pop();return this.resolvePush(!0),this.canGet=new Promise((e=>{this.resolveGet=e})),e}}},5544:(e,t,n)=>{const{TypeNotFoundError:s}=n(8187),{coreObjects:a}=n(2058),{tlobjects:i}=n(845),{readBigIntFromBuffer:o}=n(9618);e.exports=class{constructor(e){this.stream=e,this._last=void 0,this.offset=0}readByte(){return this.read(1)[0]}readInt(e=!0){let t;return t=e?this.stream.readInt32LE(this.offset):this.stream.readUInt32LE(this.offset),this.offset+=4,t}readLong(e=!0){return this.readLargeInt(64,e)}readFloat(){return this.read(4).readFloatLE(0)}readDouble(){return this.read(8).readDoubleLE(0)}readLargeInt(e,t=!0){const n=this.read(Math.floor(e/8));return o(n,!0,t)}read(e=-1){-1===e&&(e=this.stream.length-this.offset);const t=this.stream.slice(this.offset,this.offset+e);if(this.offset+=e,t.length!==e)throw Error(`No more data left to read (need ${e}, got ${t.length}: ${t}); last read ${this._last}`);return this._last=t,t}getBuffer(){return this.stream}tgReadBytes(){const e=this.readByte();let t,n;254===e?(n=this.readByte()|this.readByte()<<8|this.readByte()<<16,t=n%4):(n=e,t=(n+1)%4);const s=this.read(n);return t>0&&(t=4-t,this.read(t)),s}tgReadString(){return this.tgReadBytes().toString("utf-8")}tgReadBool(){const e=this.readInt(!1);if(2574415285===e)return!0;if(3162085175===e)return!1;throw new Error(`Invalid boolean code ${e.toString("16")}`)}tgReadDate(){const e=this.readInt();return new Date(1e3*e)}tgReadObject(){const e=this.readInt(!1);let t=i[e];if(void 0===t){if(2574415285===e)return!0;if(3162085175===e)return!1;if(481674261===e){const e=[],t=this.readInt();for(let n=0;n<t;n++)e.push(this.tgReadObject());return e}if(t=a[e],void 0===t){this.seek(-4);const t=this.tellPosition(),n=new s(e,this.read());throw this.setPosition(t),n}}return t.fromReader(this)}tgReadVector(){if(481674261!==this.readInt(!1))throw new Error("Invalid constructor code, vector was expected");const e=this.readInt(),t=[];for(let n=0;n<e;n++)t.push(this.tgReadObject());return t}close(){this.stream=void 0}tellPosition(){return this.offset}setPosition(e){this.offset=e}seek(e){this.offset+=e}}},6472:(e,t,n)=>{var s=n(8764).Buffer;e.exports=class{constructor(e){this._stream=e}write(e){this._stream=s.concat([this._stream,e])}getValue(){return this._stream}}},6748:e=>{let t;class n{constructor(e){t||(t=e||"debug"),this.isBrowser="undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs,this.isBrowser?this.colors={start:"%c",warn:"color : #ff00ff",info:"color : #ffff00",debug:"color : #00ffff",error:"color : #ff0000",end:""}:this.colors={start:"[2m",warn:"[35m",info:"[33m",debug:"[36m",error:"[31m",end:"[0m"},this.messageFormat="[%t] [%l] - [%m]"}static setLevel(e){t=e}canSend(e){return n.levels.indexOf(t)>=n.levels.indexOf(e)}warn(e){"debug"===t&&console.error((new Error).stack),this._log("warn",e,this.colors.warn)}info(e){this._log("info",e,this.colors.info)}debug(e){this._log("debug",e,this.colors.debug)}error(e){"debug"===t&&console.error((new Error).stack),this._log("error",e,this.colors.error)}format(e,t){return this.messageFormat.replace("%t",(new Date).toISOString()).replace("%l",t.toUpperCase()).replace("%m",e)}_log(e,n,s){t&&this.canSend(e)&&(this.isBrowser?console.log(this.colors.start+this.format(n,e),s):console.log(s+this.format(n,e)+this.colors.end))}}var s,a,i;i=["error","warn","info","debug"],(a="levels")in(s=n)?Object.defineProperty(s,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):s[a]=i,e.exports=n},6411:(e,t,n)=>{var s=n(8764).Buffer;const a=n(3254),i=n(355),o=n(6472),r=["messages.SendMessage","messages.SendMedia","messages.SendMultiMedia","messages.ForwardMessages","messages.SendInlineBotResult"];e.exports=class{constructor(e,t){this._state=e,this._queue=[],this._pendingStates=[],this._ready=new Promise((e=>{this.setReady=e})),this._log=t}values(){return this._queue}append(e){if(e&&r.includes(e.request.className))for(let t=this._queue.length-1;t>=0;t--)if(r.includes(this._queue[t].request.className)){e.after=this._queue[t];break}this._queue.push(e),this.setReady(!0),e&&(this._pendingStates.push(e),e.promise.catch((()=>{})).finally((()=>{this._pendingStates=this._pendingStates.filter((t=>t!==e))})))}extend(e){for(const t of e)this._queue.push(t);this.setReady(!0)}async get(){if(this._queue.length||(this._ready=new Promise((e=>{this.setReady=e})),await this._ready),!this._queue[this._queue.length-1])return void(this._queue=[]);let e,t=new o(s.alloc(0));const n=[];let r=0;for(;this._queue.length&&n.length<=a.MAXIMUM_LENGTH;){const e=this._queue.shift();if(r+=e.data.length+i.SIZE_OVERHEAD,r<=a.MAXIMUM_SIZE){let s;e.after&&(s=e.after.msgId),e.msgId=await this._state.writeDataAsMessage(t,e.data,"request"===e.request.classType,s),this._log.debug(`Assigned msgId = ${e.msgId} to ${e.request.className||e.request.constructor.name}`),n.push(e)}else{if(n.length){this._queue.unshift(e);break}this._log.warn(`Message payload for ${e.request.className||e.request.constructor.name} is too long ${e.data.length} and cannot be sent`),e.reject("Request Payload is too big"),r=0}}if(n.length){if(n.length>1){const i=s.alloc(8);i.writeUInt32LE(a.CONSTRUCTOR_ID,0),i.writeInt32LE(n.length,4),e=s.concat([i,t.getValue()]),t=new o(s.alloc(0));const r=await this._state.writeDataAsMessage(t,e,!1);for(const e of n)e.containerId=r}return e=t.getValue(),{batch:n,data:e}}}rejectAll(){this._pendingStates.forEach((e=>{e.reject(new Error("Disconnect"))}))}}},7214:(e,t,n)=>{var s=n(8764).Buffer;const{Mutex:a}=n(8125),i=new a,o=n(5840).w3cwebsocket,r=new Error("WebSocket was closed");e.exports=class{constructor(e){this.client=void 0,this.closed=!0,this.disconnectedCallback=e}async readExactly(e){let t=s.alloc(0);for(;;){const n=await this.read(e);if(t=s.concat([t,n]),!(e-=n.length))return t}}async read(e){if(this.closed)throw r;if(await this.canRead,this.closed)throw r;const t=this.stream.slice(0,e);return this.stream=this.stream.slice(e),0===this.stream.length&&(this.canRead=new Promise((e=>{this.resolveRead=e}))),t}async readAll(){if(this.closed||!await this.canRead)throw r;const e=this.stream;return this.stream=s.alloc(0),this.canRead=new Promise((e=>{this.resolveRead=e})),e}getWebSocketLink(e,t){return 443===t?`wss://${e}:${t}/apiws`:`ws://${e}:${t}/apiws`}connect(e,t){return this.stream=s.alloc(0),this.canRead=new Promise((e=>{this.resolveRead=e})),this.closed=!1,this.website=this.getWebSocketLink(t,e),this.client=new o(this.website,"binary"),new Promise(((e,n)=>{this.client.onopen=()=>{this.receive(),e(this)},this.client.onerror=e=>{console.error("WebSocket error",e),n(e)},this.client.onclose=e=>{const{code:n,reason:s,wasClean:a}=e;1e3!==n&&console.error(`Socket ${t} closed. Code: ${n}, reason: ${s}, was clean: ${a}`),this.resolveRead(!1),this.closed=!0,this.disconnectedCallback&&this.disconnectedCallback()},self.addEventListener("offline",(async()=>{await this.close(),this.resolveRead(!1)}))}))}write(e){if(this.closed)throw r;this.client.send(e)}async close(){await this.client.close(),this.closed=!0}receive(){this.client.onmessage=async e=>{const t=await i.acquire();try{const n=e.data instanceof ArrayBuffer?s.from(e.data):s.from(await new Response(e.data).arrayBuffer());this.stream=s.concat([this.stream,n]),this.resolveRead(!0)}finally{t()}}}}},9832:(e,t,n)=>{const s=n(6748),a=n(6472),i=n(5544),o=n(7214),r=n(6411),c=n(6151);e.exports={BinaryWriter:a,BinaryReader:i,MessagePacker:r,AsyncQueue:c,Logger:s,PromisedWebSockets:o}},3522:(e,t,n)=>{const s=n(7150),a=n(8742),i=n(8415),o=n(7404),r=n(1472),c=n(3182),d=n(8960),l=n(7873),u=n(5886),g=n(9832),p=n(9618);e.exports={Api:s,TelegramClient:a,sessions:u,connection:i,extensions:g,tl:o,version:r,events:c,utils:d,errors:l,helpers:p}},9870:(e,t,n)=>{"use strict";n.r(t),n.d(t,{doAuthentication:()=>_});var s=n(7150),a=n.n(s),i=n(7873),o=n(4736),r=n.n(o);n(9618),n(8764).Buffer;const c=[{fingerprint:r()("-3414540481677951611"),n:r()("29379598170669337022986177149456128565388431120058863768162556424047512191330847455146576344487764408661701890505066208632169112269581063774293102577308490531282748465986139880977280302242772832972539403531316010870401287642763009136156734339538042419388722777357134487746169093539093850251243897188928735903389451772730245253062963384108812842079887538976360465290946139638691491496062099570836476454855996319192747663615955633778034897140982517446405334423701359108810182097749467210509584293428076654573384828809574217079944388301239431309115013843331317877374435868468779972014486325557807783825502498215169806323"),e:65537}],d=new Map;c.forEach((({fingerprint:e,...t})=>{d.set(e.toString(),t)}));var l=n(8764).Buffer;const u=n(4736),g=n(2608),p=n(3302),f=n(9636),h=n(9618),m=n(5544);async function _(e,t){let n=h.generateRandomBytes(16);const s=h.readBigIntFromBuffer(n,!1,!0),o=await e.send(new(a().ReqPqMulti)({nonce:s}));if(t.debug("Starting authKey generation step 1"),!(o instanceof a().ResPQ))throw new i.SecurityError(`Step 1 answer was ${o}`);if(o.nonce.neq(s))throw new i.SecurityError("Step 1 invalid nonce from server");const r=h.readBigIntFromBuffer(o.pq,!1,!0);t.debug("Finished authKey generation step 1");const{p:c,q:_}=f.factorize(r),y=h.getByteArray(c),b=h.getByteArray(_);n=h.generateRandomBytes(32);const w=h.readBigIntFromBuffer(n,!0,!0),I=new(a().PQInnerData)({pq:h.getByteArray(r),p:y,q:b,nonce:o.nonce,serverNonce:o.serverNonce,newNonce:w}).getBytes();if(I.length>144)throw new i.SecurityError("Step 1 invalid nonce from server");let C,P;for(const e of o.serverPublicKeyFingerprints)if(P=d.get(e.toString()),void 0!==P){C=e;break}if(void 0===C||void 0===P)throw new i.SecurityError("Step 2 could not find a valid key for fingerprints");const v=h.generateRandomBytes(192-I.length),A=l.concat([I,v]),S=l.from(A).reverse();let M;for(let e=0;e<20;e++){const e=h.generateRandomBytes(32),n=await h.sha256(l.concat([e,A])),s=l.concat([S,n]),a=new g(e,l.alloc(32)).encryptIge(s),i=h.bufferXor(e,await h.sha256(a)),o=l.concat([i,a]),r=h.readBigIntFromBuffer(o,!1,!1);if(r.greaterOrEquals(P.n)){t.debug("Aes key greater than RSA. retrying");continue}const c=h.modExp(r,u(P.e),P.n);M=h.readBufferFromBigInt(c,256,!1,!1);break}if(void 0===M)throw new i.SecurityError("Step 2 could create a secure encrypted key");t.debug("Step 2 : Generated a secure aes encrypted data");const k=await e.send(new(a().ReqDHParams)({nonce:o.nonce,serverNonce:o.serverNonce,p:y,q:b,publicKeyFingerprint:C,encryptedData:M}));if(!(k instanceof a().ServerDHParamsOk||k instanceof a().ServerDHParamsFail))throw new Error(`Step 2.1 answer was ${k}`);if(k.nonce.neq(o.nonce))throw new i.SecurityError("Step 2 invalid nonce from server");if(k.serverNonce.neq(o.serverNonce))throw new i.SecurityError("Step 2 invalid server nonce from server");if(k instanceof a().ServerDHParamsFail){const e=await h.sha1(h.toSignedLittleBuffer(w,32).slice(4,20)),t=h.readBigIntFromBuffer(e,!0,!0);if(k.newNonceHash.neq(t))throw new i.SecurityError("Step 2 invalid DH fail nonce from server")}if(!(k instanceof a().ServerDHParamsOk))throw new Error(`Step 2.2 answer was ${k}`);t.debug("Finished authKey generation step 2"),t.debug("Starting authKey generation step 3");const{key:R,iv:U}=await h.generateKeyDataFromNonce(o.serverNonce,w);if(k.encryptedAnswer.length%16!=0)throw new i.SecurityError("Step 3 AES block size mismatch");const E=new g(R,U),D=E.decryptIge(k.encryptedAnswer),T=new m(D);T.read(20);const B=T.tgReadObject();if(!(B instanceof a().ServerDHInnerData))throw new Error(`Step 3 answer was ${B}`);if(B.nonce.neq(o.nonce))throw new i.SecurityError("Step 3 Invalid nonce in encrypted answer");if(B.serverNonce.neq(o.serverNonce))throw new i.SecurityError("Step 3 Invalid server nonce in encrypted answer");const x=h.readBigIntFromBuffer(B.dhPrime,!1,!1),V=h.readBigIntFromBuffer(B.gA,!1,!1),N=B.serverTime-Math.floor((new Date).getTime()/1e3),F=h.readBigIntFromBuffer(h.generateRandomBytes(256),!1,!1),O=h.modExp(u(B.g),F,x),L=h.modExp(V,F,x),q=new(a().ClientDHInnerData)({nonce:o.nonce,serverNonce:o.serverNonce,retryId:u.zero,gB:h.getByteArray(O,!1)}).getBytes(),H=l.concat([await h.sha1(q),q]),G=E.encryptIge(H),K=await e.send(new(a().SetClientDHParams)({nonce:o.nonce,serverNonce:o.serverNonce,encryptedData:G})),z=[a().DhGenOk,a().DhGenRetry,a().DhGenFail];if(!(K instanceof z[0]||K instanceof z[1]||K instanceof z[2]))throw new Error(`Step 3.1 answer was ${K}`);const{name:W}=K.constructor;if(K.nonce.neq(o.nonce))throw new i.SecurityError(`Step 3 invalid ${W} nonce from server`);if(K.serverNonce.neq(o.serverNonce))throw new i.SecurityError(`Step 3 invalid ${W} server nonce from server`);const j=new p;await j.setKey(h.getByteArray(L));const $=1+["DhGenOk","DhGenRetry","DhGenFail"].indexOf(K.className),J=await j.calcNewNonceHash(w,$);if(K[`newNonceHash${$}`].neq(J))throw new i.SecurityError("Step 3 invalid new nonce hash");if(!(K instanceof a().DhGenOk))throw new Error(`Step 3.2 answer was ${K}`);return t.debug("Finished authKey generation step 3"),{authKey:j,timeOffset:N}}},5585:(e,t,n)=>{var s=n(8764).Buffer;const a=n(4736),i=n(9109),o=n(5544),{InvalidBufferError:r}=n(8187),{toSignedLittleBuffer:c}=n(9618);e.exports=class{constructor(e,t){this._state=new i(e,t),this._connection=e}async send(e){let t=e.getBytes(),n=this._state._getNewMsgId();const i=c(n,8),d=s.alloc(4);d.writeInt32LE(t.length,0);const l=s.concat([s.concat([s.alloc(8),i,d]),t]);if(await this._connection.send(l),t=await this._connection.recv(),t.length<8)throw new r(t);const u=new o(t);if(u.readLong().neq(a(0)))throw new Error("Bad authKeyId");if(n=u.readLong(),n.eq(a(0)))throw new Error("Bad msgId");if(u.readInt()<=0)throw new Error("Bad length");return u.tgReadObject()}}},4046:(e,t,n)=>{const s=n(5585),a=n(9109),i=n(9618),o=n(3302),{doAuthentication:r}=n(9870),c=n(2301),d=n(3254),l=n(8963),u=n(4287),{MsgsAck:g,upload:p,MsgsStateInfo:f,Pong:h}=n(7404).constructors,m=n(6411),_=n(5544),{UpdateConnectionState:y,UpdateServerTimeOffset:b}=n(8415),{BadMessageError:w}=n(8187),{BadServerSalt:I,BadMsgNotification:C,MsgDetailedInfo:P,MsgNewDetailedInfo:v,NewSessionCreated:A,FutureSalts:S,MsgsStateReq:M,MsgResendReq:k,MsgsAllInfo:R}=n(7404).constructors,{SecurityError:U}=n(8187),{InvalidBufferError:E}=n(8187),{LogOut:D}=n(7404).requests.auth,{RPCMessageToError:T}=n(7873),{TypeNotFoundError:B}=n(8187);class x{constructor(e,t){const n={...x.DEFAULT_OPTIONS,...t};this._connection=void 0,this._log=n.logger,this._dcId=n.dcId,this._retries=n.retries,this._delay=n.delay,this._autoReconnect=n.autoReconnect,this._connectTimeout=n.connectTimeout,this._authKeyCallback=n.authKeyCallback,this._updateCallback=n.updateCallback,this._autoReconnectCallback=n.autoReconnectCallback,this._isMainSender=n.isMainSender,this._onConnectionBreak=n.onConnectionBreak,this.userDisconnected=!1,this._user_connected=!1,this._reconnecting=!1,this._disconnected=!0,this._send_loop_handle=void 0,this._recv_loop_handle=void 0,this.authKey=e||new o,this._state=new a(this.authKey,this._log),this._send_queue=new m(this._state,this._log),this._pending_state={},this._pending_ack=new Set,this._last_acks=[],this._handlers={[c.CONSTRUCTOR_ID]:this._handleRPCResult.bind(this),[d.CONSTRUCTOR_ID]:this._handleContainer.bind(this),[l.CONSTRUCTOR_ID]:this._handleGzipPacked.bind(this),[h.CONSTRUCTOR_ID]:this._handlePong.bind(this),[I.CONSTRUCTOR_ID]:this._handleBadServerSalt.bind(this),[C.CONSTRUCTOR_ID]:this._handleBadNotification.bind(this),[P.CONSTRUCTOR_ID]:this._handleDetailedInfo.bind(this),[v.CONSTRUCTOR_ID]:this._handleNewDetailedInfo.bind(this),[A.CONSTRUCTOR_ID]:this._handleNewSessionCreated.bind(this),[g.CONSTRUCTOR_ID]:this._handleAck.bind(this),[S.CONSTRUCTOR_ID]:this._handleFutureSalts.bind(this),[M.CONSTRUCTOR_ID]:this._handleStateForgotten.bind(this),[k.CONSTRUCTOR_ID]:this._handleStateForgotten.bind(this),[R.CONSTRUCTOR_ID]:this._handleMsgAll.bind(this)}}async connect(e,t){if(this._user_connected&&!t)return this._log.info("User is already connected!"),!1;this.isConnecting=!0,this._connection=e;for(let e=0;e<this._retries;e++)try{await this._connect(),this._updateCallback&&this._updateCallback(new y(y.connected));break}catch(t){this._updateCallback&&0===e&&this._updateCallback(new y(y.disconnected)),this._log.error(`WebSocket connection failed attempt: ${e+1}`),console.error(t),await i.sleep(this._delay)}return this.isConnecting=!1,!0}isConnected(){return this._user_connected}async disconnect(){this.userDisconnected=!0,await this._disconnect()}send(e){if(!this._user_connected)throw new Error("Cannot send requests while disconnected");const t=new u(e);return this._send_queue.append(t),t.promise}sendWithInvokeSupport(e){if(!this._user_connected)throw new Error("Cannot send requests while disconnected");const t=new u(e,void 0,this._pending_state);return this._send_queue.append(t),t}async _connect(){if(this._log.info("Connecting to {0}...".replace("{0}",this._connection)),await this._connection.connect(),this._log.debug("Connection success!"),this.authKey.getKey())this._authenticated=!0,this._log.debug("Already have an auth key ...");else{const e=new s(this._connection,this._log);this._log.debug("New auth_key attempt ...");const t=await r(e,this._log);this._log.debug("Generated new auth_key successfully"),await this.authKey.setKey(t.authKey),this._state.timeOffset=t.timeOffset,this._updateCallback&&this._updateCallback(new b(this._state.timeOffset)),this._authKeyCallback&&await this._authKeyCallback(this.authKey,this._dcId)}this._user_connected=!0,this._reconnecting=!1,this._log.debug("Starting send loop"),this._send_loop_handle=this._sendLoop(),this._log.debug("Starting receive loop"),this._recv_loop_handle=this._recvLoop(),this._log.info("Connection to %s complete!".replace("%s",this._connection.toString()))}async _disconnect(){this._send_queue.rejectAll(),void 0!==this._connection?(this._updateCallback&&this._updateCallback(new y(y.disconnected)),this._log.info("Disconnecting from %s...".replace("%s",this._connection.toString())),this._user_connected=!1,this._log.debug("Closing current connection..."),await this._connection.disconnect()):this._log.info("Not disconnecting (already have no connection)")}async _sendLoop(){for(this._send_queue=new m(this._state,this._log);this._user_connected&&!this._reconnecting;){if(this._pending_ack.size){const e=new u(new g({msgIds:Array(...this._pending_ack)}));this._send_queue.append(e),this._last_acks.push(e),this._pending_ack.clear()}this._log.debug(`Waiting for messages to send...${this._reconnecting}`);const e=await this._send_queue.get();if(this._reconnecting)return;if(!e)continue;let{data:t}=e;const{batch:n}=e;this._log.debug(`Encrypting ${n.length} message(s) in ${t.length} bytes for sending`),t=await this._state.encryptMessageData(t);try{await this._connection.send(t)}catch(e){return this._log.error(e),void this._log.info("Connection closed while sending data")}for(const e of n)if(Array.isArray(e))for(const t of e)"request"===t.request.classType&&(this._pending_state[t.msgId]=t);else"request"===e.request.classType&&(this._pending_state[e.msgId]=e);this._log.debug("Encrypted messages put in a queue to be sent")}}async _recvLoop(){let e,t;for(;this._user_connected&&!this._reconnecting;){this._log.debug("Receiving items from the network...");try{e=await this._connection.recv()}catch(e){return void(this.userDisconnected||(this._log.error(e),this._log.warn("Connection closed while receiving data"),this.reconnect()))}try{t=await this._state.decryptMessageData(e)}catch(e){if(e instanceof B){this._log.info(`Type ${e.invalidConstructorId} not found, remaining data ${e.remaining}`);continue}if(e instanceof U){this._log.warn(`Security error while unpacking a received message: ${e}`);continue}return e instanceof E?void(404===e.code?(this._log.warn(`Broken authorization key for dc ${this._dcId}; resetting`),this._updateCallback&&this._isMainSender?this._updateCallback(new y(y.broken)):this._onConnectionBreak&&!this._isMainSender&&this._onConnectionBreak(this._dcId)):(this._log.warn(`Invalid buffer ${e.code} for dc ${this._dcId}`),this.reconnect())):(this._log.error("Unhandled error while receiving data"),this._log.error(e),void this.reconnect())}try{await this._processMessage(t)}catch(e){this._log.error("Unhandled error while receiving data"),this._log.error(e)}}}async _processMessage(e){this._pending_ack.add(e.msgId),e.obj=await e.obj;let t=this._handlers[e.obj.CONSTRUCTOR_ID];t||(t=this._handleUpdate.bind(this)),await t(e)}_popStates(e){let t=this._pending_state[e];if(t)return this._pending_state[e].deferred.resolve(),delete this._pending_state[e],[t];const n=[];for(t of Object.values(this._pending_state))t.containerId&&t.containerId.equals(e)&&n.push(t.msgId);if(n.length){const e=[];for(const t of n)e.push(this._pending_state[t]),this._pending_state[t].deferred.resolve(),delete this._pending_state[t];return e}for(const t of this._last_acks)if(t.msgId===e)return[t];return[]}_handleRPCResult(e){const t=e.obj,n=this._pending_state[t.reqMsgId];if(n&&(n.deferred.resolve(),delete this._pending_state[t.reqMsgId]),this._log.debug(`Handling RPC result for message ${t.reqMsgId}`),!n)try{if(!(new _(t.body).tgReadObject()instanceof p.File))throw new B("Not an upload.File")}catch(e){if(this._log.error(e),e instanceof B)return void this._log.info(`Received response without parent request: ${t.body}`);throw e}if(t.error){const e=T(t.error,n.request);this._send_queue.append(new u(new g({msgIds:[n.msgId]}))),n.reject(e)}else{const e=new _(t.body),s=n.request.readResult(e);n.resolve(s)}}async _handleContainer(e){this._log.debug("Handling container");for(const t of e.obj.messages)await this._processMessage(t)}async _handleGzipPacked(e){this._log.debug("Handling gzipped data");const t=new _(e.obj.data);e.obj=t.tgReadObject(),await this._processMessage(e)}_handleUpdate(e){2331323052===e.obj.SUBCLASS_OF_ID?(this._log.debug(`Handling update ${e.obj.className}`),this._updateCallback&&this._updateCallback(e.obj)):this._log.warn(`Note: ${e.obj.className} is not an update, not dispatching it`)}_handlePong(e){const t=e.obj,n=this._state.updateTimeOffset(e.msgId);this._updateCallback&&this._updateCallback(new b(n)),this._log.debug(`Handling pong for message ${t.msgId}`);const s=this._pending_state[t.msgId];this._pending_state[t.msgId].deferred.resolve(),delete this._pending_state[t.msgId],s&&s.resolve(t)}_handleBadServerSalt(e){const t=e.obj;this._log.debug(`Handling bad salt for message ${t.badMsgId}`),this._state.salt=t.newServerSalt;const n=this._popStates(t.badMsgId);this._send_queue.extend(n),this._log.debug(`${n.length} message(s) will be resent`)}_handleBadNotification(e){const t=e.obj,n=this._popStates(t.badMsgId);if(this._log.debug(`Handling bad msg ${JSON.stringify(t)}`),[16,17].includes(t.errorCode)){const t=this._state.updateTimeOffset(e.msgId);this._updateCallback&&this._updateCallback(new b(t)),this._log.info(`System clock is wrong, set time offset to ${t}s`)}else if(32===t.errorCode)this._state._sequence+=64;else{if(33!==t.errorCode){for(const e of n)e.reject(new w(e.request,t.errorCode));return}this._state._sequence-=16}this._send_queue.extend(n),this._log.debug(`${n.length} messages will be resent due to bad msg`)}_handleDetailedInfo(e){const t=e.obj.answerMsgId;this._log.debug(`Handling detailed info for message ${t}`),this._pending_ack.add(t)}_handleNewDetailedInfo(e){const t=e.obj.answerMsgId;this._log.debug(`Handling new detailed info for message ${t}`),this._pending_ack.add(t)}_handleNewSessionCreated(e){this._log.debug("Handling new session created"),this._state.salt=e.obj.serverSalt}_handleAck(e){const t=e.obj;this._log.debug(`Handling acknowledge for ${t.msgIds}`);for(const e of t.msgIds){const t=this._pending_state[e];t&&t.request instanceof D&&(this._pending_state[e].deferred.resolve(),delete this._pending_state[e],t.resolve(!0))}}_handleFutureSalts(e){this._log.debug(`Handling future salts for message ${e.msgId}`);const t=this._pending_state[e.msgId];t&&(this._pending_state[e].deferred.resolve(),delete this._pending_state[e],t.resolve(e.obj))}_handleStateForgotten(e){this._send_queue.append(new u(new f(e.msgId,String.fromCharCode(1).repeat(e.obj.msgIds))))}_handleMsgAll(e){}reconnect(){this._user_connected&&!this._reconnecting&&(this._reconnecting=!0,i.sleep(1e3).then((()=>{this._log.info("Started reconnecting"),this._reconnect()})))}async _reconnect(){this._log.debug("Closing current connection...");try{await this._disconnect()}catch(e){this._log.warn(e)}this._send_queue.append(void 0),this._state.reset();const e=new this._connection.constructor(this._connection._ip,this._connection._port,this._connection._dcId,this._connection._log);await this.connect(e,!0),this._reconnecting=!1;for(const e of Object.values(this._pending_state))e.deferred.resolve();this._pending_state={},this._autoReconnectCallback&&await this._autoReconnectCallback()}}var V,N,F;F={logger:void 0,retries:1/0,delay:2e3,autoReconnect:!0,connectTimeout:void 0,authKeyCallback:void 0,updateCallback:void 0,autoReconnectCallback:void 0,isMainSender:void 0,onConnectionBreak:void 0},(N="DEFAULT_OPTIONS")in(V=x)?Object.defineProperty(V,N,{value:F,enumerable:!0,configurable:!0,writable:!0}):V[N]=F,e.exports=x},9109:(e,t,n)=>{var s=n(8764).Buffer;const a=n(4736),i=n(9618),o=n(2608),r=n(5544),c=n(8963),{TLMessage:d}=n(2058),{SecurityError:l,InvalidBufferError:u}=n(8187),{InvokeAfterMsg:g}=n(7404).requests,{toSignedLittleBuffer:p}=n(9618);e.exports=class{constructor(e,t){this.authKey=e,this._log=t,this.timeOffset=0,this.salt=0,this.id=void 0,this._sequence=void 0,this._lastMsgId=void 0,this.reset()}reset(){this.id=i.generateRandomLong(!0),this._sequence=0,this._lastMsgId=a(0)}updateMessageId(e){e.msgId=this._getNewMsgId()}async _calcKey(e,t,n){const a=!0===n?0:8,[o,r]=await Promise.all([i.sha256(s.concat([t,e.slice(a,a+36)])),i.sha256(s.concat([e.slice(a+40,a+76),t]))]);return{key:s.concat([o.slice(0,8),r.slice(8,24),o.slice(24,32)]),iv:s.concat([r.slice(0,8),o.slice(8,24),r.slice(24,32)])}}async writeDataAsMessage(e,t,n,a){const i=this._getNewMsgId(),o=this._getSeqNo(n);let r;r=a?await c.gzipIfSmaller(n,new g(a,{getBytes:()=>t}).getBytes()):await c.gzipIfSmaller(n,t);const d=s.alloc(4);d.writeInt32LE(o,0);const l=s.alloc(4);l.writeInt32LE(r.length,0);const u=p(i,8);return e.write(s.concat([u,d,l])),e.write(r),i}async encryptMessageData(e){await this.authKey.waitForKey();const t=p(this.salt,8),n=p(this.id,8);e=s.concat([s.concat([t,n]),e]);const a=i.generateRandomBytes(i.mod(-(e.length+12),16)+12),r=(await i.sha256(s.concat([this.authKey.getKey().slice(88,120),e,a]))).slice(8,24),{iv:c,key:d}=await this._calcKey(this.authKey.getKey(),r,!0),l=i.readBufferFromBigInt(this.authKey.keyId,8);return s.concat([l,r,new o(d,c).encryptIge(s.concat([e,a]))])}async decryptMessageData(e){if(e.length<8)throw new u(e);if(e.length<0)throw new l("Server replied with negative length");if(e.length%4!=0)throw new l("Server replied with length not divisible by 4");if(i.readBigIntFromBuffer(e.slice(0,8)).neq(this.authKey.keyId))throw new l("Server replied with an invalid auth key");const t=e.slice(8,24),{iv:n,key:a}=await this._calcKey(this.authKey.getKey(),t,!1);e=new o(a,n).decryptIge(e.slice(24));const c=await i.sha256(s.concat([this.authKey.getKey().slice(96,128),e]));if(!t.equals(c.slice(8,24)))throw new l("Received msg_key doesn't match with expected one");const g=new r(e);if(g.readLong(),!g.readLong().eq(this.id))throw new l("Server replied with a wrong session ID");const p=g.readLong(),f=g.readInt(),h=g.readInt(),m=e.length-h;if(m<12||m>1024)throw new l("Server replied with the wrong message padding");const _=g.tgReadObject();return new d(p,f,_)}_getNewMsgId(){const e=(new Date).getTime()/1e3+this.timeOffset,t=Math.floor(1e9*(e-Math.floor(e)));let n=a(Math.floor(e)).shiftLeft(a(32)).or(a(t).shiftLeft(a(2)));return this._lastMsgId.greaterOrEquals(n)&&(n=this._lastMsgId.add(a(4))),this._lastMsgId=n,n}updateTimeOffset(e){const t=this._getNewMsgId(),n=this.timeOffset,s=Math.floor((new Date).getTime()/1e3),i=e.shiftRight(a(32));return this.timeOffset=i-s,this.timeOffset!==n&&(this._lastMsgId=a(0),this._log.debug(`Updated time offset (old offset ${n}, bad ${t}, good ${e}, new ${this.timeOffset})`)),this.timeOffset}_getSeqNo(e){if(e){const e=2*this._sequence+1;return this._sequence+=1,e}return 2*this._sequence}}},4287:(e,t,n)=>{const{createDeferred:s}=n(9618);e.exports=class{constructor(e,t,n={}){this.containerId=void 0,this.msgId=void 0,this.request=e,this.data=e.getBytes(),this.after=t,this.result=void 0,this.pending=n,this.deferred=s(),this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}isReady(){const e=this.pending[this.after.id];return!e||e.deferred.promise}}},4353:(e,t,n)=>{function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const a=n(7214),i=n(6151);class o{constructor(e,t,n,o){s(this,"PacketCodecClass",void 0),this._ip=e,this._port=t,this._dcId=n,this._log=o,this._connected=!1,this._sendTask=void 0,this._recvTask=void 0,this._codec=void 0,this._obfuscation=void 0,this._sendArray=new i,this._recvArray=new i,this.socket=new a(this.disconnectCallback.bind(this))}async disconnectCallback(){await this.disconnect(!0)}async _connect(){this._log.debug("Connecting"),this._codec=new this.PacketCodecClass(this),await this.socket.connect(this._port,this._ip,this),this._log.debug("Finished connecting"),await this._initConn()}async connect(){await this._connect(),this._connected=!0,this._sendTask||(this._sendTask=this._sendLoop()),this._recvTask=this._recvLoop()}async disconnect(e=!1){this._connected&&(this._connected=!1,this._recvArray.push(void 0),e||await this.socket.close())}async send(e){if(!this._connected)throw new Error("Not connected");await this._sendArray.push(e)}async recv(){for(;this._connected;){const e=await this._recvArray.pop();if(e)return e}throw new Error("Not connected")}async _sendLoop(){try{for(;this._connected;){const e=await this._sendArray.pop();if(!e)return void(this._sendTask=void 0);await this._send(e)}}catch(e){this._log.info("The server closed the connection while sending")}}async _recvLoop(){let e;for(;this._connected;){try{if(e=await this._recv(),!e)throw new Error("no data received")}catch(e){return this._log.info("connection closed"),void this.disconnect()}await this._recvArray.push(e)}}async _initConn(){this._codec.tag&&await this.socket.write(this._codec.tag)}_send(e){const t=this._codec.encodePacket(e);this.socket.write(t)}_recv(){return this._codec.readPacket(this.socket)}toString(){return`${this._ip}:${this._port}/${this.constructor.name.replace("Connection","")}`}}e.exports={Connection:o,PacketCodec:class{constructor(e){this._conn=e}encodePacket(e){throw new Error("Not Implemented")}readPacket(e){throw new Error("Not Implemented")}},ObfuscatedConnection:class extends o{constructor(...e){super(...e),s(this,"ObfuscatedIO",void 0)}_initConn(){this._obfuscation=new this.ObfuscatedIO(this),this.socket.write(this._obfuscation.header)}_send(e){this._obfuscation.write(this._codec.encodePacket(e))}_recv(){return this._codec.readPacket(this._obfuscation)}}}},6302:(e,t,n)=>{var s=n(8764).Buffer;function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const i=n(4736),{readBufferFromBigInt:o}=n(9618),{Connection:r,PacketCodec:c}=n(4353);class d extends c{constructor(e){super(e),this.tag=d.tag,this.obfuscateTag=d.obfuscateTag}encodePacket(e){let t=e.length>>2;if(t<127){const e=s.alloc(1);e.writeUInt8(t,0),t=e}else t=s.concat([s.from("7f","hex"),o(i(t),3)]);return s.concat([t,e])}async readPacket(e){let t=(await e.read(1))[0];return t>=127&&(t=s.concat([await e.read(3),s.alloc(1)]).readInt32LE(0)),e.read(t<<2)}}a(d,"tag",s.from("ef","hex")),a(d,"obfuscateTag",s.from("efefefef","hex")),e.exports={ConnectionTCPAbridged:class extends r{constructor(...e){super(...e),a(this,"PacketCodecClass",d)}},AbridgedPacketCodec:d}},5484:()=>{},2986:(e,t,n)=>{var s=n(8764).Buffer;function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{generateRandomBytes:i}=n(9618),{ObfuscatedConnection:o}=n(4353),{AbridgedPacketCodec:r}=n(6302),c=n(5830);class d{constructor(e){a(this,"header",void 0),this.connection=e.socket;const t=this.initHeader(e.PacketCodecClass);this.header=t.random,this._encrypt=t.encryptor,this._decrypt=t.decryptor}initHeader(e){const t=[s.from("50567247","hex"),s.from("474554","hex"),s.from("504f5354","hex"),s.from("eeeeeeee","hex")];let n;for(;;)if(n=i(64),239!==n[0]&&!n.slice(4,8).equals(s.alloc(4))){let e=!0;for(const s of t)if(s.equals(n.slice(0,4))){e=!1;break}if(e)break}n=n.toJSON().data;const a=s.from(n.slice(8,56)).reverse(),o=s.from(n.slice(8,40)),r=s.from(n.slice(40,56)),d=s.from(a.slice(0,32)),l=s.from(a.slice(32,48)),u=new c(o,r),g=new c(d,l);return n=s.concat([s.from(n.slice(0,56)),e.obfuscateTag,s.from(n.slice(60))]),n=s.concat([s.from(n.slice(0,56)),s.from(u.encrypt(n).slice(56,64)),s.from(n.slice(64))]),{random:n,encryptor:u,decryptor:g}}async read(e){const t=await this.connection.readExactly(e);return this._decrypt.encrypt(t)}write(e){this.connection.write(this._encrypt.encrypt(e))}}e.exports={ConnectionTCPObfuscated:class extends o{constructor(...e){super(...e),a(this,"ObfuscatedIO",d),a(this,"PacketCodecClass",r)}}}},417:(e,t,n)=>{const{Connection:s}=n(4353),{ConnectionTCPFull:a}=n(5484),{ConnectionTCPAbridged:i}=n(6302),{ConnectionTCPObfuscated:o}=n(2986);e.exports={Connection:s,ConnectionTCPFull:a,ConnectionTCPAbridged:i,ConnectionTCPObfuscated:o}},8415:(e,t,n)=>{function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const a=n(5585),i=n(4046);class o{constructor(e){this.state=e}}s(o,"disconnected",-1),s(o,"connected",1),s(o,"broken",0);const{Connection:r,ConnectionTCPFull:c,ConnectionTCPAbridged:d,ConnectionTCPObfuscated:l}=n(417);e.exports={Connection:r,ConnectionTCPFull:c,ConnectionTCPAbridged:d,ConnectionTCPObfuscated:l,MTProtoPlainSender:a,MTProtoSender:i,UpdateConnectionState:o,UpdateServerTimeOffset:class{constructor(e){this.timeOffset=e}}}},9270:e=>{e.exports=class{get dcId(){throw new Error("Not Implemented")}get serverAddress(){throw new Error("Not Implemented")}get port(){throw new Error("Not Implemented")}get authKey(){throw new Error("Not Implemented")}set authKey(e){throw new Error("Not Implemented")}setDC(e,t,n){throw new Error("Not implemented")}save(){throw new Error("Not Implemented")}delete(){throw new Error("Not Implemented")}}},926:(e,t,n)=>{const s=n(8753),a="GramJs";e.exports=class extends s{async _delete(){const e=new Request(this._storageKey);return(await self.caches.open(a)).delete(e)}async _fetchFromCache(){const e=new Request(this._storageKey),t=await self.caches.open(a),n=await t.match(e);return n?n.text():void 0}async _saveToCache(e){const t=new Request(this._storageKey),n=new Response(e);return(await self.caches.open(a)).put(t,n)}}},7:(e,t,n)=>{var s=n(8764).Buffer;const a=n(3995),i=n(3302),o=n(8960);e.exports=class extends a{constructor(e,t){super(),this._sessionData=e,this._callback=t,this._authKeys={}}get authKey(){throw new Error("Not supported")}set authKey(e){throw new Error("Not supported")}async load(){if(!this._sessionData)return;const{mainDcId:e,keys:t,hashes:n}=this._sessionData,{ipAddress:a,port:r}=o.getDC(e);this.setDC(e,a,r,!0),await Promise.all(Object.keys(t).map((async e=>{const a="string"==typeof t[e]?s.from(t[e],"hex"):s.from(t[e]);if(n[e]){const t="string"==typeof n[e]?s.from(n[e],"hex"):s.from(n[e]);this._authKeys[e]=new i(a,t)}else this._authKeys[e]=new i,await this._authKeys[e].setKey(a,!0)})))}setDC(e,t,n,s=!1){this._dcId=e,this._serverAddress=t,this._port=n,delete this._authKeys[e],s||this._onUpdate()}getAuthKey(e=this._dcId){return this._authKeys[e]}setAuthKey(e,t=this._dcId){this._authKeys[t]=e,this._onUpdate()}getSessionData(){const e={mainDcId:this._dcId,keys:{},hashes:{}};return Object.keys(this._authKeys).forEach((t=>{const n=this._authKeys[t];n&&n._key&&(e.keys[t]=n._key.toString("hex"),e.hashes[t]=n._hash.toString("hex"))})),e}_onUpdate(){this._callback(this.getSessionData())}delete(){this._callback(void 0)}}},5945:(e,t,n)=>{const s=n(1875),a=n(8753);e.exports=class extends a{_delete(){return s.del(`GramJs:${this._storageKey}`)}_fetchFromCache(){return s.get(`GramJs:${this._storageKey}`)}_saveToCache(e){return s.set(`GramJs:${this._storageKey}`,e)}}},1753:(e,t,n)=>{const s=n(8753);e.exports=class extends s{_delete(){return localStorage.removeItem(this._storageKey)}_fetchFromCache(){return localStorage.getItem(this._storageKey)}_saveToCache(e){return localStorage.setItem(this._storageKey,e)}}},3995:(e,t,n)=>{const s=n(9270);e.exports=class extends s{constructor(){super(),this._serverAddress=void 0,this._dcId=0,this._port=void 0,this._takeoutId=void 0,this._entities=new Set,this._updateStates={}}get dcId(){return this._dcId}get serverAddress(){return this._serverAddress}get port(){return this._port}get authKey(){return this._authKey}set authKey(e){this._authKey=e}setDC(e,t,n){this._dcId=0|e,this._serverAddress=t,this._port=n}}},8753:(e,t,n)=>{var s=n(8764).Buffer;const a=n(3995),i=n(3302),o=n(8960);e.exports=class extends a{constructor(e){super(),this._authKeys={},e&&e.startsWith("session:")?this._sessionString=e:e&&(this._storageKey=e)}get authKey(){throw new Error("Not supported")}set authKey(e){throw new Error("Not supported")}async load(){if(this._sessionString)await this._loadFromSessionString();else if(this._storageKey)try{const e=await this._fetchFromCache(),{mainDcId:t,keys:n,hashes:a}=JSON.parse(e),{ipAddress:r,port:c}=o.getDC(t);this.setDC(t,r,c,!0),Object.keys(n).forEach((e=>{n[e]&&a[e]&&(this._authKeys[e]=new i(s.from(n[e].data),s.from(a[e].data)))}))}catch(e){console.warn("Failed to retrieve or parse session from storage"),console.warn(e)}}setDC(e,t,n,s=!1){this._dcId=e,this._serverAddress=t,this._port=n,delete this._authKeys[e],s||this._updateStorage()}async save(){return this._storageKey||(this._storageKey=`GramJs-session-${Date.now()}`),await this._updateStorage(),this._storageKey}getAuthKey(e=this._dcId){return this._authKeys[e]}setAuthKey(e,t=this._dcId){this._authKeys[t]=e,this._updateStorage()}getSessionData(e){const t={mainDcId:this._dcId,keys:{},hashes:{}};return Object.keys(this._authKeys).forEach((n=>{const s=this._authKeys[n];s._key&&(t.keys[n]=e?s._key.toString("hex"):s._key,t.hashes[n]=e?s._hash.toString("hex"):s._hash)})),t}async _loadFromSessionString(){const[,e,t]=this._sessionString.split(":"),n=Number(e),{ipAddress:a,port:r}=o.getDC(n);this.setDC(n,a,r);const c=new i;await c.setKey(s.from(t,"hex"),!0),this.setAuthKey(c,n)}async _updateStorage(){if(this._storageKey)try{await this._saveToCache(JSON.stringify(this.getSessionData()))}catch(e){console.warn("Failed to update session in storage"),console.warn(e)}}async delete(){try{return await this._delete()}catch(e){console.warn("Failed to delete session from storage"),console.warn(e)}}_delete(){throw new Error("Not Implemented")}_fetchFromCache(){throw new Error("Not Implemented")}_saveToCache(e){throw new Error("Not Implemented")}}},2433:(e,t,n)=>{var s=n(8764).Buffer;const a=n(3995),i=n(3302),o=n(5544);class r extends a{constructor(e){if(super(),e){if("1"!==e[0])throw new Error("Not a valid string");e=e.slice(1);const t=r.decode(e),n=new o(t);this._dcId=n.read(1).readUInt8(0);const s=n.read(2).readInt16BE(0);this._serverAddress=String(n.read(s)),this._port=n.read(2).readInt16BE(0),this._key=n.read(-1)}}static encode(e){return e.toString("base64")}static decode(e){return s.from(e,"base64")}async load(){this._key&&(this._authKey=new i,await this._authKey.setKey(this._key))}save(){if(!this.authKey)return"";const e=s.from([this.dcId]),t=s.from(this.serverAddress),n=s.alloc(2);n.writeInt16BE(t.length,0);const a=s.alloc(2);return a.writeInt16BE(this.port,0),"1"+r.encode(s.concat([e,n,t,a,this.authKey.getKey()]))}getAuthKey(e){if(!e||e===this.dcId)return this.authKey}setAuthKey(e,t){t&&t!==this.dcId||(this.authKey=e)}}e.exports=r},5886:(e,t,n)=>{const s=n(3995),a=n(2433),i=n(926),o=n(1753),r=n(5945),c=n(7);e.exports={Memory:s,StringSession:a,CacheApiSession:i,LocalStorageSession:o,IdbSession:r,CallbackSession:c}},845:(e,t,n)=>{const s=n(7150),a={};for(const e of Object.values(s))if(e.CONSTRUCTOR_ID)a[e.CONSTRUCTOR_ID]=e;else for(const t of Object.values(e))a[t.CONSTRUCTOR_ID]=t;e.exports={LAYER:131,tlobjects:a}},7150:(e,t,n)=>{var s=n(8764).Buffer;function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{parseTl:i,serializeBytes:o,serializeDate:r}=n(1436),{toSignedLittleBuffer:c}=n(9618),d=n(4779),l=n(8106),u="undefined"!=typeof self&&void 0!==self.localStorage,g="GramJs:apiCache";function p(e){const t=i(e,109),n=[],s=[];for(const e of t)e.isFunction?s.push(e):n.push(e);return[n,s]}function f(e,t){switch(t){case"int":{const t=s.alloc(4);return t.writeInt32LE(e,0),t}case"long":return c(e,8);case"int128":return c(e,16);case"int256":return c(e,32);case"double":{const t=s.alloc(8);return t.writeDoubleLE(e,0),t}case"string":return o(e);case"Bool":return e?s.from("b5757299","hex"):s.from("379779bc","hex");case"true":return s.alloc(0);case"bytes":return o(e);case"date":return r(e);default:return e.getBytes()}}function h(e,t){if(t.isVector){t.useVectorId&&e.readInt();const n=[],s=e.readInt();t.isVector=!1;for(let a=0;a<s;a++)n.push(h(e,t));return t.isVector=!0,n}if(t.flagIndicator)return e.readInt();switch(t.type){case"int":return e.readInt();case"long":return e.readLong();case"int128":return e.readLargeInt(128);case"int256":return e.readLargeInt(256);case"double":return e.readDouble();case"string":return e.tgReadString();case"Bool":return e.tgReadBool();case"true":return!0;case"bytes":return e.tgReadBytes();case"date":return e.tgReadDate();default:if(t.skipConstructorId)throw new Error(`Unknown type ${t}`);return e.tgReadObject()}}function m(e,t){const n={};for(const i of t){const{name:t,constructorId:o,subclassOfId:r,argsConfig:c,namespace:d,result:l}=i,u=[d,t].join(".").replace(/^\./,"");class g{constructor(t){a(this,"CONSTRUCTOR_ID",o),a(this,"SUBCLASS_OF_ID",r),a(this,"className",u),a(this,"classType",e),t=t||{},Object.keys(t).forEach((e=>{this[e]=t[e]}))}static fromReader(e){const t={};for(const n in c)if(c.hasOwnProperty(n)){const s=c[n];if(s.isFlag){if("true"===s.type){t[n]=Boolean(t.flags&1<<s.flagIndex);continue}t.flags&1<<s.flagIndex?t[n]=h(e,s):t[n]=void 0}else s.flagIndicator&&(s.name="flags"),t[n]=h(e,s)}return new g(t)}getBytes(){const e=this.CONSTRUCTOR_ID,t=s.alloc(4);t.writeUInt32LE(e,0);const n=[t];for(const e in c)if(c.hasOwnProperty(e)){if(c[e].isFlag&&(!1===this[e]&&"true"===c[e].type||void 0===this[e]))continue;if(c[e].isVector){c[e].useVectorId&&n.push(s.from("15c4b51c","hex"));const t=s.alloc(4);t.writeInt32LE(this[e].length,0),n.push(t,s.concat(this[e].map((t=>f(t,c[e].type)))))}else if(c[e].flagIndicator)if(Object.values(c).some((e=>e.isFlag))){let e=0;for(const t in c)c[t].isFlag&&(!1===this[t]&&"true"===c[t].type||void 0===this[t]?e|=0:e|=1<<c[t].flagIndex);const t=s.alloc(4);t.writeUInt32LE(e,0),n.push(t)}else n.push(s.alloc(4));else if(n.push(f(this[e],c[e].type)),this[e]&&"function"==typeof this[e].getBytes){let t=c[e].type.charAt(c[e].type.indexOf(".")+1);t=t===t.toUpperCase(),t||n.shift()}}return s.concat(n)}readResult(t){if("request"!==e)throw new Error("`readResult()` called for non-request instance");const n=l.match(/Vector<(int|long)>/);if(n){t.readInt();const e=[],s=t.readInt();if("int"===n[1])for(let n=0;n<s;n++)e.push(t.readInt());else for(let n=0;n<s;n++)e.push(t.readLong());return e}return t.tgReadObject()}}a(g,"CONSTRUCTOR_ID",o),a(g,"SUBCLASS_OF_ID",r),a(g,"className",u),a(g,"classType",e),d?(n[d]||(n[d]={}),n[d][t]=g):n[t]=g}return n}e.exports=function(){let e;const t=u&&function(){const e=localStorage.getItem(g);return e&&JSON.parse(e)}();return t?e=t:(e=function(){const[e,t]=p(d),[n,s]=p(l);return{constructors:[].concat(e,n),requests:[].concat(t,s)}}(),u&&localStorage.setItem(g,JSON.stringify(e))),function(e,t){const n={...e};return Object.keys(t).forEach((e=>{"function"!=typeof t[e]&&n[e]?Object.assign(n[e],t[e]):n[e]=t[e]})),n}(m("constructor",e.constructors),m("request",e.requests))}()},4779:e=>{e.exports="boolFalse#bc799737 = Bool;\nboolTrue#997275b5 = Bool;\ntrue#3fedd339 = True;\nvector#1cb5c415 {t:Type} # [ t ] = Vector t;\nerror#c4b9f9bb code:int text:string = Error;\nnull#56730bcc = Null;\ninputPeerEmpty#7f3b18ea = InputPeer;\ninputPeerSelf#7da07ec9 = InputPeer;\ninputPeerChat#179be863 chat_id:int = InputPeer;\ninputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer;\ninputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer;\ninputPeerUserFromMessage#17bae2e6 peer:InputPeer msg_id:int user_id:int = InputPeer;\ninputPeerChannelFromMessage#9c95f7bb peer:InputPeer msg_id:int channel_id:int = InputPeer;\ninputUserEmpty#b98886cf = InputUser;\ninputUserSelf#f7c1b13f = InputUser;\ninputUser#d8292816 user_id:int access_hash:long = InputUser;\ninputUserFromMessage#2d117597 peer:InputPeer msg_id:int user_id:int = InputUser;\ninputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact;\ninputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile;\ninputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile;\ninputMediaEmpty#9664f57f = InputMedia;\ninputMediaUploadedPhoto#1e287d04 flags:# file:InputFile stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia;\ninputMediaPhoto#b3ba0635 flags:# id:InputPhoto ttl_seconds:flags.0?int = InputMedia;\ninputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia;\ninputMediaContact#f8ab7dfb phone_number:string first_name:string last_name:string vcard:string = InputMedia;\ninputMediaUploadedDocument#5b38c6c1 flags:# nosound_video:flags.3?true force_file:flags.4?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector<DocumentAttribute> stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia;\ninputMediaDocument#33473058 flags:# id:InputDocument ttl_seconds:flags.0?int query:flags.1?string = InputMedia;\ninputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string = InputMedia;\ninputMediaPhotoExternal#e5bbfe1a flags:# url:string ttl_seconds:flags.0?int = InputMedia;\ninputMediaDocumentExternal#fb52dc99 flags:# url:string ttl_seconds:flags.0?int = InputMedia;\ninputMediaGame#d33f43f3 id:InputGame = InputMedia;\ninputMediaInvoice#d9799874 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:flags.1?string = InputMedia;\ninputMediaGeoLive#971fa843 flags:# stopped:flags.0?true geo_point:InputGeoPoint heading:flags.2?int period:flags.1?int proximity_notification_radius:flags.3?int = InputMedia;\ninputMediaPoll#f94e5f1 flags:# poll:Poll correct_answers:flags.0?Vector<bytes> solution:flags.1?string solution_entities:flags.1?Vector<MessageEntity> = InputMedia;\ninputMediaDice#e66fbf7b emoticon:string = InputMedia;\ninputChatPhotoEmpty#1ca48f57 = InputChatPhoto;\ninputChatUploadedPhoto#c642724e flags:# file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double = InputChatPhoto;\ninputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto;\ninputGeoPointEmpty#e4c123d6 = InputGeoPoint;\ninputGeoPoint#48222faf flags:# lat:double long:double accuracy_radius:flags.0?int = InputGeoPoint;\ninputPhotoEmpty#1cd7bf0d = InputPhoto;\ninputPhoto#3bb3b94a id:long access_hash:long file_reference:bytes = InputPhoto;\ninputFileLocation#dfdaabe1 volume_id:long local_id:int secret:long file_reference:bytes = InputFileLocation;\ninputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation;\ninputDocumentFileLocation#bad07584 id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation;\ninputSecureFileLocation#cbc7ee28 id:long access_hash:long = InputFileLocation;\ninputTakeoutFileLocation#29be5899 = InputFileLocation;\ninputPhotoFileLocation#40181ffe id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation;\ninputPhotoLegacyFileLocation#d83466f3 id:long access_hash:long file_reference:bytes volume_id:long local_id:int secret:long = InputFileLocation;\ninputPeerPhotoFileLocation#37257e99 flags:# big:flags.0?true peer:InputPeer photo_id:long = InputFileLocation;\ninputStickerSetThumb#9d84f3db stickerset:InputStickerSet thumb_version:int = InputFileLocation;\ninputGroupCallStream#bba51639 call:InputGroupCall time_ms:long scale:int = InputFileLocation;\npeerUser#9db1bc6d user_id:int = Peer;\npeerChat#bad0e5bb chat_id:int = Peer;\npeerChannel#bddde532 channel_id:int = Peer;\nstorage.fileUnknown#aa963b05 = storage.FileType;\nstorage.filePartial#40bc6f52 = storage.FileType;\nstorage.fileJpeg#7efe0e = storage.FileType;\nstorage.fileGif#cae1aadf = storage.FileType;\nstorage.filePng#a4f63c0 = storage.FileType;\nstorage.filePdf#ae1e508d = storage.FileType;\nstorage.fileMp3#528a0677 = storage.FileType;\nstorage.fileMov#4b09ebbc = storage.FileType;\nstorage.fileMp4#b3cea0e4 = storage.FileType;\nstorage.fileWebp#1081464c = storage.FileType;\nuserEmpty#200250ba id:int = User;\nuser#938458c1 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User;\nuserProfilePhotoEmpty#4f11bae1 = UserProfilePhoto;\nuserProfilePhoto#82d1f706 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto;\nuserStatusEmpty#9d05049 = UserStatus;\nuserStatusOnline#edb93949 expires:int = UserStatus;\nuserStatusOffline#8c703f was_online:int = UserStatus;\nuserStatusRecently#e26f42f1 = UserStatus;\nuserStatusLastWeek#7bf09fc = UserStatus;\nuserStatusLastMonth#77ebc742 = UserStatus;\nchatEmpty#9ba2d800 id:int = Chat;\nchat#3bda1bde flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true deactivated:flags.5?true call_active:flags.23?true call_not_empty:flags.24?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel admin_rights:flags.14?ChatAdminRights default_banned_rights:flags.18?ChatBannedRights = Chat;\nchatForbidden#7328bdb id:int title:string = Chat;\nchannel#d31a961e flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat;\nchannelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat;\nchatFull#8a1e2983 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:int about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer = ChatFull;\nchannelFull#548c3f93 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?int location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer = ChatFull;\nchatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant;\nchatParticipantCreator#da13538a user_id:int = ChatParticipant;\nchatParticipantAdmin#e2d6e436 user_id:int inviter_id:int date:int = ChatParticipant;\nchatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants;\nchatParticipants#3f460fed chat_id:int participants:Vector<ChatParticipant> version:int = ChatParticipants;\nchatPhotoEmpty#37c1011c = ChatPhoto;\nchatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = ChatPhoto;\nmessageEmpty#90a6ca84 flags:# id:int peer_id:flags.0?Peer = Message;\nmessage#bce383d2 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true id:int from_id:flags.8?Peer peer_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long restriction_reason:flags.22?Vector<RestrictionReason> ttl_period:flags.25?int = Message;\nmessageService#2b085862 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction ttl_period:flags.25?int = Message;\nmessageMediaEmpty#3ded6320 = MessageMedia;\nmessageMediaPhoto#695150d7 flags:# photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia;\nmessageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia;\nmessageMediaContact#cbf24940 phone_number:string first_name:string last_name:string vcard:string user_id:int = MessageMedia;\nmessageMediaUnsupported#9f84f49e = MessageMedia;\nmessageMediaDocument#9cb070d7 flags:# document:flags.0?Document ttl_seconds:flags.2?int = MessageMedia;\nmessageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia;\nmessageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia;\nmessageMediaGame#fdb19008 game:Game = MessageMedia;\nmessageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia;\nmessageMediaGeoLive#b940c666 flags:# geo:GeoPoint heading:flags.0?int period:int proximity_notification_radius:flags.1?int = MessageMedia;\nmessageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia;\nmessageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia;\nmessageActionEmpty#b6aef7b0 = MessageAction;\nmessageActionChatCreate#a6638b9a title:string users:Vector<int> = MessageAction;\nmessageActionChatEditTitle#b5a1ce5a title:string = MessageAction;\nmessageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction;\nmessageActionChatDeletePhoto#95e3fbef = MessageAction;\nmessageActionChatAddUser#488a7337 users:Vector<int> = MessageAction;\nmessageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction;\nmessageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction;\nmessageActionChannelCreate#95d2ac92 title:string = MessageAction;\nmessageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction;\nmessageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction;\nmessageActionPinMessage#94bd38ed = MessageAction;\nmessageActionHistoryClear#9fbab604 = MessageAction;\nmessageActionGameScore#92a72876 game_id:long score:int = MessageAction;\nmessageActionPaymentSentMe#8f31b327 flags:# currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction;\nmessageActionPaymentSent#40699cd0 currency:string total_amount:long = MessageAction;\nmessageActionPhoneCall#80e11a7f flags:# video:flags.2?true call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction;\nmessageActionScreenshotTaken#4792929b = MessageAction;\nmessageActionCustomAction#fae69f56 message:string = MessageAction;\nmessageActionBotAllowed#abe9affe domain:string = MessageAction;\nmessageActionSecureValuesSentMe#1b287353 values:Vector<SecureValue> credentials:SecureCredentialsEncrypted = MessageAction;\nmessageActionSecureValuesSent#d95c6154 types:Vector<SecureValueType> = MessageAction;\nmessageActionContactSignUp#f3f25f76 = MessageAction;\nmessageActionGeoProximityReached#98e0d697 from_id:Peer to_id:Peer distance:int = MessageAction;\nmessageActionGroupCall#7a0d7f42 flags:# call:InputGroupCall duration:flags.0?int = MessageAction;\nmessageActionInviteToGroupCall#76b9f11a call:InputGroupCall users:Vector<int> = MessageAction;\nmessageActionSetMessagesTTL#aa1afbfd period:int = MessageAction;\nmessageActionGroupCallScheduled#b3a07661 call:InputGroupCall schedule_date:int = MessageAction;\ndialog#2c171f72 flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int = Dialog;\ndialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog;\nphotoEmpty#2331b22d id:long = Photo;\nphoto#fb197a65 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector<PhotoSize> video_sizes:flags.1?Vector<VideoSize> dc_id:int = Photo;\nphotoSizeEmpty#e17e23c type:string = PhotoSize;\nphotoSize#75c78e60 type:string w:int h:int size:int = PhotoSize;\nphotoCachedSize#21e1ad6 type:string w:int h:int bytes:bytes = PhotoSize;\nphotoStrippedSize#e0b0bc2e type:string bytes:bytes = PhotoSize;\nphotoSizeProgressive#fa3efb95 type:string w:int h:int sizes:Vector<int> = PhotoSize;\nphotoPathSize#d8214d41 type:string bytes:bytes = PhotoSize;\ngeoPointEmpty#1117dd5f = GeoPoint;\ngeoPoint#b2a2f663 flags:# long:double lat:double access_hash:long accuracy_radius:flags.0?int = GeoPoint;\nauth.sentCode#5e002502 flags:# type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode;\nauth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization;\nauth.authorizationSignUpRequired#44747e9a flags:# terms_of_service:flags.0?help.TermsOfService = auth.Authorization;\nauth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization;\ninputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer;\ninputNotifyUsers#193b4417 = InputNotifyPeer;\ninputNotifyChats#4a95e84e = InputNotifyPeer;\ninputNotifyBroadcasts#b1db7c7e = InputNotifyPeer;\ninputPeerNotifySettings#9c3d198e flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = InputPeerNotifySettings;\npeerNotifySettings#af509d20 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = PeerNotifySettings;\npeerSettings#733f2961 flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true autoarchived:flags.7?true invite_members:flags.8?true geo_distance:flags.6?int = PeerSettings;\nwallPaper#a437c3ed id:long flags:# creator:flags.0?true default:flags.1?true pattern:flags.3?true dark:flags.4?true access_hash:long slug:string document:Document settings:flags.2?WallPaperSettings = WallPaper;\nwallPaperNoFile#e0804116 id:long flags:# default:flags.1?true dark:flags.4?true settings:flags.2?WallPaperSettings = WallPaper;\ninputReportReasonSpam#58dbcab8 = ReportReason;\ninputReportReasonViolence#1e22c78d = ReportReason;\ninputReportReasonPornography#2e59d922 = ReportReason;\ninputReportReasonChildAbuse#adf44ee3 = ReportReason;\ninputReportReasonOther#c1e4a2b1 = ReportReason;\ninputReportReasonCopyright#9b89f93a = ReportReason;\ninputReportReasonGeoIrrelevant#dbd4feed = ReportReason;\ninputReportReasonFake#f5ddd6e7 = ReportReason;\nuserFull#139a9a77 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true user:User about:flags.1?string settings:PeerSettings profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int = UserFull;\ncontact#f911c994 user_id:int mutual:Bool = Contact;\nimportedContact#d0028438 user_id:int client_id:long = ImportedContact;\ncontactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus;\ncontacts.contactsNotModified#b74ba9d2 = contacts.Contacts;\ncontacts.contacts#eae87e42 contacts:Vector<Contact> saved_count:int users:Vector<User> = contacts.Contacts;\ncontacts.importedContacts#77d01c3b imported:Vector<ImportedContact> popular_invites:Vector<PopularContact> retry_contacts:Vector<long> users:Vector<User> = contacts.ImportedContacts;\ncontacts.blocked#ade1591 blocked:Vector<PeerBlocked> chats:Vector<Chat> users:Vector<User> = contacts.Blocked;\ncontacts.blockedSlice#e1664194 count:int blocked:Vector<PeerBlocked> chats:Vector<Chat> users:Vector<User> = contacts.Blocked;\nmessages.dialogs#15ba6c40 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs;\nmessages.dialogsSlice#71e094f3 count:int dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs;\nmessages.dialogsNotModified#f0e3e596 count:int = messages.Dialogs;\nmessages.messages#8c718e87 messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;\nmessages.messagesSlice#3a54685e flags:# inexact:flags.1?true count:int next_rate:flags.0?int offset_id_offset:flags.2?int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;\nmessages.channelMessages#64479808 flags:# inexact:flags.1?true pts:int count:int offset_id_offset:flags.2?int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;\nmessages.messagesNotModified#74535f21 count:int = messages.Messages;\nmessages.chats#64ff9fd5 chats:Vector<Chat> = messages.Chats;\nmessages.chatsSlice#9cd81144 count:int chats:Vector<Chat> = messages.Chats;\nmessages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector<Chat> users:Vector<User> = messages.ChatFull;\nmessages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory;\ninputMessagesFilterEmpty#57e2f66c = MessagesFilter;\ninputMessagesFilterPhotos#9609a51c = MessagesFilter;\ninputMessagesFilterVideo#9fc00e65 = MessagesFilter;\ninputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter;\ninputMessagesFilterDocument#9eddf188 = MessagesFilter;\ninputMessagesFilterUrl#7ef0dd87 = MessagesFilter;\ninputMessagesFilterGif#ffc86587 = MessagesFilter;\ninputMessagesFilterVoice#50f5c392 = MessagesFilter;\ninputMessagesFilterMusic#3751b49e = MessagesFilter;\ninputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter;\ninputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter;\ninputMessagesFilterRoundVoice#7a7c17a4 = MessagesFilter;\ninputMessagesFilterRoundVideo#b549da53 = MessagesFilter;\ninputMessagesFilterMyMentions#c1f8e69a = MessagesFilter;\ninputMessagesFilterGeo#e7026d0d = MessagesFilter;\ninputMessagesFilterContacts#e062db83 = MessagesFilter;\ninputMessagesFilterPinned#1bb00451 = MessagesFilter;\nupdateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update;\nupdateMessageID#4e90bfd6 id:int random_id:long = Update;\nupdateDeleteMessages#a20db0e5 messages:Vector<int> pts:int pts_count:int = Update;\nupdateUserTyping#5c486927 user_id:int action:SendMessageAction = Update;\nupdateChatUserTyping#86cadb6c chat_id:int from_id:Peer action:SendMessageAction = Update;\nupdateChatParticipants#7761198 participants:ChatParticipants = Update;\nupdateUserStatus#1bfbd823 user_id:int status:UserStatus = Update;\nupdateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update;\nupdateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update;\nupdateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update;\nupdateEncryptedChatTyping#1710f156 chat_id:int = Update;\nupdateEncryption#b4a2e88d chat:EncryptedChat date:int = Update;\nupdateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update;\nupdateChatParticipantAdd#ea4b0e5c chat_id:int user_id:int inviter_id:int date:int version:int = Update;\nupdateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update;\nupdateDcOptions#8e5e9873 dc_options:Vector<DcOption> = Update;\nupdateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update;\nupdateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector<MessageEntity> = Update;\nupdatePrivacy#ee3b272a key:PrivacyKey rules:Vector<PrivacyRule> = Update;\nupdateUserPhone#12b9417b user_id:int phone:string = Update;\nupdateReadHistoryInbox#9c974fdf flags:# folder_id:flags.0?int peer:Peer max_id:int still_unread_count:int pts:int pts_count:int = Update;\nupdateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update;\nupdateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update;\nupdateReadMessagesContents#68c13933 messages:Vector<int> pts:int pts_count:int = Update;\nupdateChannelTooLong#eb0467fb flags:# channel_id:int pts:flags.0?int = Update;\nupdateChannel#b6d45656 channel_id:int = Update;\nupdateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update;\nupdateReadChannelInbox#330b5424 flags:# folder_id:flags.0?int channel_id:int max_id:int still_unread_count:int pts:int = Update;\nupdateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector<int> pts:int pts_count:int = Update;\nupdateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update;\nupdateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update;\nupdateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update;\nupdateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector<long> = Update;\nupdateStickerSets#43ae3dec = Update;\nupdateSavedGifs#9375341e = Update;\nupdateBotInlineQuery#3f2038db flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint peer_type:flags.1?InlineQueryPeerType offset:string = Update;\nupdateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update;\nupdateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update;\nupdateBotCallbackQuery#e73547e1 flags:# query_id:long user_id:int peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update;\nupdateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update;\nupdateInlineBotCallbackQuery#f9d27a5a flags:# query_id:long user_id:int msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update;\nupdateReadChannelOutbox#25d6c9c7 channel_id:int max_id:int = Update;\nupdateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update;\nupdateReadFeaturedStickers#571d2742 = Update;\nupdateRecentStickers#9a422c20 = Update;\nupdateConfig#a229dd06 = Update;\nupdatePtsChanged#3354678f = Update;\nupdateChannelWebPage#40771900 channel_id:int webpage:WebPage pts:int pts_count:int = Update;\nupdateDialogPinned#6e6fe51c flags:# pinned:flags.0?true folder_id:flags.1?int peer:DialogPeer = Update;\nupdatePinnedDialogs#fa0f3ca2 flags:# folder_id:flags.1?int order:flags.0?Vector<DialogPeer> = Update;\nupdateBotWebhookJSON#8317c0c3 data:DataJSON = Update;\nupdateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update;\nupdateBotShippingQuery#e0cdc940 query_id:long user_id:int payload:bytes shipping_address:PostAddress = Update;\nupdateBotPrecheckoutQuery#5d2f3aa9 flags:# query_id:long user_id:int payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update;\nupdatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update;\nupdateLangPackTooLong#46560264 lang_code:string = Update;\nupdateLangPack#56022f4d difference:LangPackDifference = Update;\nupdateFavedStickers#e511996d = Update;\nupdateChannelReadMessagesContents#89893b45 channel_id:int messages:Vector<int> = Update;\nupdateContactsReset#7084a7be = Update;\nupdateChannelAvailableMessages#70db6837 channel_id:int available_min_id:int = Update;\nupdateDialogUnreadMark#e16459c3 flags:# unread:flags.0?true peer:DialogPeer = Update;\nupdateMessagePoll#aca1657b flags:# poll_id:long poll:flags.0?Poll results:PollResults = Update;\nupdateChatDefaultBannedRights#54c01850 peer:Peer default_banned_rights:ChatBannedRights version:int = Update;\nupdateFolderPeers#19360dc0 folder_peers:Vector<FolderPeer> pts:int pts_count:int = Update;\nupdatePeerSettings#6a7e7366 peer:Peer settings:PeerSettings = Update;\nupdatePeerLocated#b4afcfb0 peers:Vector<PeerLocated> = Update;\nupdateNewScheduledMessage#39a51dfb message:Message = Update;\nupdateDeleteScheduledMessages#90866cee peer:Peer messages:Vector<int> = Update;\nupdateTheme#8216fba3 theme:Theme = Update;\nupdateGeoLiveViewed#871fb939 peer:Peer msg_id:int = Update;\nupdateLoginToken#564fe691 = Update;\nupdateMessagePollVote#37f69f0b poll_id:long user_id:int options:Vector<bytes> qts:int = Update;\nupdateDialogFilter#26ffde7d flags:# id:int filter:flags.0?DialogFilter = Update;\nupdateDialogFilterOrder#a5d72105 order:Vector<int> = Update;\nupdateDialogFilters#3504914f = Update;\nupdatePhoneCallSignalingData#2661bf09 phone_call_id:long data:bytes = Update;\nupdateChannelMessageForwards#6e8a84df channel_id:int id:int forwards:int = Update;\nupdateReadChannelDiscussionInbox#1cc7de54 flags:# channel_id:int top_msg_id:int read_max_id:int broadcast_id:flags.0?int broadcast_post:flags.0?int = Update;\nupdateReadChannelDiscussionOutbox#4638a26c channel_id:int top_msg_id:int read_max_id:int = Update;\nupdatePeerBlocked#246a4b22 peer_id:Peer blocked:Bool = Update;\nupdateChannelUserTyping#6b171718 flags:# channel_id:int top_msg_id:flags.0?int from_id:Peer action:SendMessageAction = Update;\nupdatePinnedMessages#ed85eab5 flags:# pinned:flags.0?true peer:Peer messages:Vector<int> pts:int pts_count:int = Update;\nupdatePinnedChannelMessages#8588878b flags:# pinned:flags.0?true channel_id:int messages:Vector<int> pts:int pts_count:int = Update;\nupdateChat#1330a196 chat_id:int = Update;\nupdateGroupCallParticipants#f2ebdb4e call:InputGroupCall participants:Vector<GroupCallParticipant> version:int = Update;\nupdateGroupCall#a45eb99b chat_id:int call:GroupCall = Update;\nupdatePeerHistoryTTL#bb9bb9a5 flags:# peer:Peer ttl_period:flags.0?int = Update;\nupdateChatParticipant#f3b3781f flags:# chat_id:int date:int actor_id:int user_id:int prev_participant:flags.0?ChatParticipant new_participant:flags.1?ChatParticipant invite:flags.2?ExportedChatInvite qts:int = Update;\nupdateChannelParticipant#7fecb1ec flags:# channel_id:int date:int actor_id:int user_id:int prev_participant:flags.0?ChannelParticipant new_participant:flags.1?ChannelParticipant invite:flags.2?ExportedChatInvite qts:int = Update;\nupdateBotStopped#7f9488a user_id:int date:int stopped:Bool qts:int = Update;\nupdateGroupCallConnection#b783982 flags:# presentation:flags.0?true params:DataJSON = Update;\nupdateBotCommands#cf7e0873 peer:Peer bot_id:int commands:Vector<BotCommand> = Update;\nupdates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;\nupdates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference;\nupdates.difference#f49ca0 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> state:updates.State = updates.Difference;\nupdates.differenceSlice#a8fb1981 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> intermediate_state:updates.State = updates.Difference;\nupdates.differenceTooLong#4afe8f6d pts:int = updates.Difference;\nupdatesTooLong#e317af7e = Updates;\nupdateShortMessage#faeff833 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;\nupdateShortChatMessage#1157b858 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;\nupdateShort#78d4dec1 update:Update date:int = Updates;\nupdatesCombined#725b04c3 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq_start:int seq:int = Updates;\nupdates#74ae4240 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq:int = Updates;\nupdateShortSentMessage#9015e101 flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;\nphotos.photos#8dca6aa5 photos:Vector<Photo> users:Vector<User> = photos.Photos;\nphotos.photosSlice#15051f54 count:int photos:Vector<Photo> users:Vector<User> = photos.Photos;\nphotos.photo#20212ca8 photo:Photo users:Vector<User> = photos.Photo;\nupload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File;\nupload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes file_hashes:Vector<FileHash> = upload.File;\ndcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption;\nconfig#330b4067 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true pfs_enabled:flags.13?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int pinned_infolder_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int = Config;\nnearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc;\nhelp.appUpdate#ccbbce30 flags:# can_not_skip:flags.0?true id:int version:string text:string entities:Vector<MessageEntity> document:flags.1?Document url:flags.2?string sticker:flags.3?Document = help.AppUpdate;\nhelp.noAppUpdate#c45a6536 = help.AppUpdate;\nhelp.inviteText#18cb9f78 message:string = help.InviteText;\nencryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat;\nencryptedChatWaiting#3bf703dc id:int access_hash:long date:int admin_id:int participant_id:int = EncryptedChat;\nencryptedChatRequested#62718a82 flags:# folder_id:flags.0?int id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat;\nencryptedChat#fa56ce36 id:int access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long = EncryptedChat;\nencryptedChatDiscarded#1e1c7c45 flags:# history_deleted:flags.0?true id:int = EncryptedChat;\ninputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat;\nencryptedFileEmpty#c21f497e = EncryptedFile;\nencryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile;\ninputEncryptedFileEmpty#1837c364 = InputEncryptedFile;\ninputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile;\ninputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile;\ninputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile;\nencryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage;\nencryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage;\nmessages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig;\nmessages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig;\nmessages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage;\nmessages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage;\ninputDocumentEmpty#72f0eaae = InputDocument;\ninputDocument#1abfb575 id:long access_hash:long file_reference:bytes = InputDocument;\ndocumentEmpty#36f8c871 id:long = Document;\ndocument#1e87342b flags:# id:long access_hash:long file_reference:bytes date:int mime_type:string size:int thumbs:flags.0?Vector<PhotoSize> video_thumbs:flags.1?Vector<VideoSize> dc_id:int attributes:Vector<DocumentAttribute> = Document;\nhelp.support#17c6b5f6 phone_number:string user:User = help.Support;\nnotifyPeer#9fd40bd8 peer:Peer = NotifyPeer;\nnotifyUsers#b4c83b4c = NotifyPeer;\nnotifyChats#c007cec3 = NotifyPeer;\nnotifyBroadcasts#d612e8ef = NotifyPeer;\nsendMessageTypingAction#16bf744e = SendMessageAction;\nsendMessageCancelAction#fd5ec8f5 = SendMessageAction;\nsendMessageRecordVideoAction#a187d66f = SendMessageAction;\nsendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction;\nsendMessageRecordAudioAction#d52f73f7 = SendMessageAction;\nsendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction;\nsendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction;\nsendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction;\nsendMessageGeoLocationAction#176f8ba1 = SendMessageAction;\nsendMessageChooseContactAction#628cbc6f = SendMessageAction;\nsendMessageGamePlayAction#dd6a8f48 = SendMessageAction;\nsendMessageRecordRoundAction#88f27fbc = SendMessageAction;\nsendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction;\nspeakingInGroupCallAction#d92c2285 = SendMessageAction;\nsendMessageHistoryImportAction#dbda9246 progress:int = SendMessageAction;\ncontacts.found#b3134d9d my_results:Vector<Peer> results:Vector<Peer> chats:Vector<Chat> users:Vector<User> = contacts.Found;\ninputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey;\ninputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey;\ninputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey;\ninputPrivacyKeyPhoneP2P#db9e70d2 = InputPrivacyKey;\ninputPrivacyKeyForwards#a4dd4c08 = InputPrivacyKey;\ninputPrivacyKeyProfilePhoto#5719bacc = InputPrivacyKey;\ninputPrivacyKeyPhoneNumber#352dafa = InputPrivacyKey;\ninputPrivacyKeyAddedByPhone#d1219bdd = InputPrivacyKey;\nprivacyKeyStatusTimestamp#bc2eab30 = PrivacyKey;\nprivacyKeyChatInvite#500e6dfa = PrivacyKey;\nprivacyKeyPhoneCall#3d662b7b = PrivacyKey;\nprivacyKeyPhoneP2P#39491cc8 = PrivacyKey;\nprivacyKeyForwards#69ec56a3 = PrivacyKey;\nprivacyKeyProfilePhoto#96151fed = PrivacyKey;\nprivacyKeyPhoneNumber#d19ae46d = PrivacyKey;\nprivacyKeyAddedByPhone#42ffd42b = PrivacyKey;\ninputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule;\ninputPrivacyValueAllowAll#184b35ce = InputPrivacyRule;\ninputPrivacyValueAllowUsers#131cc67f users:Vector<InputUser> = InputPrivacyRule;\ninputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule;\ninputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule;\ninputPrivacyValueDisallowUsers#90110467 users:Vector<InputUser> = InputPrivacyRule;\ninputPrivacyValueAllowChatParticipants#4c81c1ba chats:Vector<int> = InputPrivacyRule;\ninputPrivacyValueDisallowChatParticipants#d82363af chats:Vector<int> = InputPrivacyRule;\nprivacyValueAllowContacts#fffe1bac = PrivacyRule;\nprivacyValueAllowAll#65427b82 = PrivacyRule;\nprivacyValueAllowUsers#4d5bbe0c users:Vector<int> = PrivacyRule;\nprivacyValueDisallowContacts#f888fa1a = PrivacyRule;\nprivacyValueDisallowAll#8b73e763 = PrivacyRule;\nprivacyValueDisallowUsers#c7f49b7 users:Vector<int> = PrivacyRule;\nprivacyValueAllowChatParticipants#18be796b chats:Vector<int> = PrivacyRule;\nprivacyValueDisallowChatParticipants#acae0690 chats:Vector<int> = PrivacyRule;\naccount.privacyRules#50a04e45 rules:Vector<PrivacyRule> chats:Vector<Chat> users:Vector<User> = account.PrivacyRules;\naccountDaysTTL#b8d0afdf days:int = AccountDaysTTL;\ndocumentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute;\ndocumentAttributeAnimated#11b58939 = DocumentAttribute;\ndocumentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute;\ndocumentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true supports_streaming:flags.1?true duration:int w:int h:int = DocumentAttribute;\ndocumentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute;\ndocumentAttributeFilename#15590068 file_name:string = DocumentAttribute;\ndocumentAttributeHasStickers#9801d2f7 = DocumentAttribute;\nmessages.stickersNotModified#f1749a22 = messages.Stickers;\nmessages.stickers#e4599bbd hash:int stickers:Vector<Document> = messages.Stickers;\nstickerPack#12b299d4 emoticon:string documents:Vector<long> = StickerPack;\nmessages.allStickersNotModified#e86602c3 = messages.AllStickers;\nmessages.allStickers#edfd405f hash:int sets:Vector<StickerSet> = messages.AllStickers;\nmessages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages;\nwebPageEmpty#eb1477e8 id:long = WebPage;\nwebPagePending#c586da1c id:long date:int = WebPage;\nwebPage#e89c45b2 flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page attributes:flags.12?Vector<WebPageAttribute> = WebPage;\nwebPageNotModified#7311ca11 flags:# cached_page_views:flags.0?int = WebPage;\nauthorization#ad01d61d flags:# current:flags.0?true official_app:flags.1?true password_pending:flags.2?true hash:long device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization;\naccount.authorizations#1250abde authorizations:Vector<Authorization> = account.Authorizations;\naccount.password#185b184f flags:# has_recovery:flags.0?true has_secure_values:flags.1?true has_password:flags.2?true current_algo:flags.2?PasswordKdfAlgo srp_B:flags.2?bytes srp_id:flags.2?long hint:flags.3?string email_unconfirmed_pattern:flags.4?string new_algo:PasswordKdfAlgo new_secure_algo:SecurePasswordKdfAlgo secure_random:bytes pending_reset_date:flags.5?int = account.Password;\naccount.passwordSettings#9a5c33e5 flags:# email:flags.0?string secure_settings:flags.1?SecureSecretSettings = account.PasswordSettings;\naccount.passwordInputSettings#c23727c9 flags:# new_algo:flags.0?PasswordKdfAlgo new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string new_secure_settings:flags.2?SecureSecretSettings = account.PasswordInputSettings;\nauth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery;\nreceivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage;\nchatInviteExported#6e24fc9d flags:# revoked:flags.0?true permanent:flags.5?true link:string admin_id:int date:int start_date:flags.4?int expire_date:flags.1?int usage_limit:flags.2?int usage:flags.3?int = ExportedChatInvite;\nchatInviteAlready#5a686d7c chat:Chat = ChatInvite;\nchatInvite#dfc2f58e flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string photo:Photo participants_count:int participants:flags.4?Vector<User> = ChatInvite;\nchatInvitePeek#61695cb0 chat:Chat expires:int = ChatInvite;\ninputStickerSetEmpty#ffb62b95 = InputStickerSet;\ninputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet;\ninputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet;\ninputStickerSetAnimatedEmoji#28703c8 = InputStickerSet;\ninputStickerSetDice#e67f520e emoticon:string = InputStickerSet;\nstickerSet#d7df217a flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumbs:flags.4?Vector<PhotoSize> thumb_dc_id:flags.4?int thumb_version:flags.4?int count:int hash:int = StickerSet;\nmessages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet;\nbotCommand#c27ac8c7 command:string description:string = BotCommand;\nbotInfo#98e81d3a user_id:int description:string commands:Vector<BotCommand> = BotInfo;\nkeyboardButton#a2fa4880 text:string = KeyboardButton;\nkeyboardButtonUrl#258aff05 text:string url:string = KeyboardButton;\nkeyboardButtonCallback#35bbdb6b flags:# requires_password:flags.0?true text:string data:bytes = KeyboardButton;\nkeyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton;\nkeyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton;\nkeyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton;\nkeyboardButtonGame#50f41ccf text:string = KeyboardButton;\nkeyboardButtonBuy#afd93fbb text:string = KeyboardButton;\nkeyboardButtonUrlAuth#10b78d29 flags:# text:string fwd_text:flags.0?string url:string button_id:int = KeyboardButton;\ninputKeyboardButtonUrlAuth#d02e7fd4 flags:# request_write_access:flags.0?true text:string fwd_text:flags.1?string url:string bot:InputUser = KeyboardButton;\nkeyboardButtonRequestPoll#bbc7515d flags:# quiz:flags.0?Bool text:string = KeyboardButton;\nkeyboardButtonRow#77608b83 buttons:Vector<KeyboardButton> = KeyboardButtonRow;\nreplyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup;\nreplyKeyboardForceReply#86b40b08 flags:# single_use:flags.1?true selective:flags.2?true placeholder:flags.3?string = ReplyMarkup;\nreplyKeyboardMarkup#85dd99d1 flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector<KeyboardButtonRow> placeholder:flags.3?string = ReplyMarkup;\nreplyInlineMarkup#48a30254 rows:Vector<KeyboardButtonRow> = ReplyMarkup;\nmessageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity;\nmessageEntityMention#fa04579d offset:int length:int = MessageEntity;\nmessageEntityHashtag#6f635b0d offset:int length:int = MessageEntity;\nmessageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity;\nmessageEntityUrl#6ed02538 offset:int length:int = MessageEntity;\nmessageEntityEmail#64e475c2 offset:int length:int = MessageEntity;\nmessageEntityBold#bd610bc9 offset:int length:int = MessageEntity;\nmessageEntityItalic#826f8b60 offset:int length:int = MessageEntity;\nmessageEntityCode#28a20571 offset:int length:int = MessageEntity;\nmessageEntityPre#73924be0 offset:int length:int language:string = MessageEntity;\nmessageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity;\nmessageEntityMentionName#352dca58 offset:int length:int user_id:int = MessageEntity;\ninputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity;\nmessageEntityPhone#9b69e34b offset:int length:int = MessageEntity;\nmessageEntityCashtag#4c4e743f offset:int length:int = MessageEntity;\nmessageEntityUnderline#9c4e7e8b offset:int length:int = MessageEntity;\nmessageEntityStrike#bf0693d4 offset:int length:int = MessageEntity;\nmessageEntityBlockquote#20df5d0 offset:int length:int = MessageEntity;\nmessageEntityBankCard#761e6af4 offset:int length:int = MessageEntity;\ninputChannelEmpty#ee8c1e86 = InputChannel;\ninputChannel#afeb712e channel_id:int access_hash:long = InputChannel;\ninputChannelFromMessage#2a286531 peer:InputPeer msg_id:int channel_id:int = InputChannel;\ncontacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector<Chat> users:Vector<User> = contacts.ResolvedPeer;\nmessageRange#ae30253 min_id:int max_id:int = MessageRange;\nupdates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference;\nupdates.channelDifferenceTooLong#a4bcc6fe flags:# final:flags.0?true timeout:flags.1?int dialog:Dialog messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference;\nupdates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector<Message> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference;\nchannelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter;\nchannelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector<MessageRange> = ChannelMessagesFilter;\nchannelParticipant#15ebac1d user_id:int date:int = ChannelParticipant;\nchannelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant;\nchannelParticipantCreator#447dca4b flags:# user_id:int admin_rights:ChatAdminRights rank:flags.0?string = ChannelParticipant;\nchannelParticipantAdmin#ccbebbaf flags:# can_edit:flags.0?true self:flags.1?true user_id:int inviter_id:flags.1?int promoted_by:int date:int admin_rights:ChatAdminRights rank:flags.2?string = ChannelParticipant;\nchannelParticipantBanned#50a1dfd6 flags:# left:flags.0?true peer:Peer kicked_by:int date:int banned_rights:ChatBannedRights = ChannelParticipant;\nchannelParticipantLeft#1b03f006 peer:Peer = ChannelParticipant;\nchannelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter;\nchannelParticipantsAdmins#b4608969 = ChannelParticipantsFilter;\nchannelParticipantsKicked#a3b54985 q:string = ChannelParticipantsFilter;\nchannelParticipantsBots#b0d1865b = ChannelParticipantsFilter;\nchannelParticipantsBanned#1427a5e1 q:string = ChannelParticipantsFilter;\nchannelParticipantsSearch#656ac4b q:string = ChannelParticipantsFilter;\nchannelParticipantsContacts#bb6ae88d q:string = ChannelParticipantsFilter;\nchannelParticipantsMentions#e04b5ceb flags:# q:flags.0?string top_msg_id:flags.1?int = ChannelParticipantsFilter;\nchannels.channelParticipants#9ab0feaf count:int participants:Vector<ChannelParticipant> chats:Vector<Chat> users:Vector<User> = channels.ChannelParticipants;\nchannels.channelParticipantsNotModified#f0173fe9 = channels.ChannelParticipants;\nchannels.channelParticipant#dfb80317 participant:ChannelParticipant chats:Vector<Chat> users:Vector<User> = channels.ChannelParticipant;\nhelp.termsOfService#780a0310 flags:# popup:flags.0?true id:DataJSON text:string entities:Vector<MessageEntity> min_age_confirm:flags.1?int = help.TermsOfService;\nmessages.savedGifsNotModified#e8025ca2 = messages.SavedGifs;\nmessages.savedGifs#2e0709a5 hash:int gifs:Vector<Document> = messages.SavedGifs;\ninputBotInlineMessageMediaAuto#3380c786 flags:# message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;\ninputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;\ninputBotInlineMessageMediaGeo#96929a85 flags:# geo_point:InputGeoPoint heading:flags.0?int period:flags.1?int proximity_notification_radius:flags.3?int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;\ninputBotInlineMessageMediaVenue#417bbf11 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;\ninputBotInlineMessageMediaContact#a6edbffd flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;\ninputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;\ninputBotInlineMessageMediaInvoice#d7e78225 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;\ninputBotInlineResult#88bf9319 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?InputWebDocument content:flags.5?InputWebDocument send_message:InputBotInlineMessage = InputBotInlineResult;\ninputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult;\ninputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult;\ninputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult;\nbotInlineMessageMediaAuto#764cf810 flags:# message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage;\nbotInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage;\nbotInlineMessageMediaGeo#51846fd flags:# geo:GeoPoint heading:flags.0?int period:flags.1?int proximity_notification_radius:flags.3?int reply_markup:flags.2?ReplyMarkup = BotInlineMessage;\nbotInlineMessageMediaVenue#8a86659c flags:# geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;\nbotInlineMessageMediaContact#18d1cdc2 flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;\nbotInlineMessageMediaInvoice#354a9b09 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument currency:string total_amount:long reply_markup:flags.2?ReplyMarkup = BotInlineMessage;\nbotInlineResult#11965f3a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?WebDocument content:flags.5?WebDocument send_message:BotInlineMessage = BotInlineResult;\nbotInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult;\nmessages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector<BotInlineResult> cache_time:int users:Vector<User> = messages.BotResults;\nexportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink;\nmessageFwdHeader#5f777dce flags:# imported:flags.7?true from_id:flags.0?Peer from_name:flags.5?string date:int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int psa_type:flags.6?string = MessageFwdHeader;\nauth.codeTypeSms#72a3158c = auth.CodeType;\nauth.codeTypeCall#741cd3e3 = auth.CodeType;\nauth.codeTypeFlashCall#226ccefb = auth.CodeType;\nauth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType;\nauth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType;\nauth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType;\nauth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType;\nmessages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer;\nmessages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData;\ninputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID;\ninlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM;\nmessages.peerDialogs#3371c354 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> state:updates.State = messages.PeerDialogs;\ntopPeer#edcdc05b peer:Peer rating:double = TopPeer;\ntopPeerCategoryBotsPM#ab661b5b = TopPeerCategory;\ntopPeerCategoryBotsInline#148677e2 = TopPeerCategory;\ntopPeerCategoryCorrespondents#637b7ed = TopPeerCategory;\ntopPeerCategoryGroups#bd17a14a = TopPeerCategory;\ntopPeerCategoryChannels#161d9628 = TopPeerCategory;\ntopPeerCategoryPhoneCalls#1e76a78c = TopPeerCategory;\ntopPeerCategoryForwardUsers#a8406ca9 = TopPeerCategory;\ntopPeerCategoryForwardChats#fbeec0f0 = TopPeerCategory;\ntopPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector<TopPeer> = TopPeerCategoryPeers;\ncontacts.topPeersNotModified#de266ef5 = contacts.TopPeers;\ncontacts.topPeers#70b772a8 categories:Vector<TopPeerCategoryPeers> chats:Vector<Chat> users:Vector<User> = contacts.TopPeers;\ncontacts.topPeersDisabled#b52c939d = contacts.TopPeers;\ndraftMessageEmpty#1b0c841a flags:# date:flags.0?int = DraftMessage;\ndraftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector<MessageEntity> date:int = DraftMessage;\nmessages.featuredStickersNotModified#c6dc0c66 count:int = messages.FeaturedStickers;\nmessages.featuredStickers#b6abc341 hash:int count:int sets:Vector<StickerSetCovered> unread:Vector<long> = messages.FeaturedStickers;\nmessages.recentStickersNotModified#b17f890 = messages.RecentStickers;\nmessages.recentStickers#22f3afb3 hash:int packs:Vector<StickerPack> stickers:Vector<Document> dates:Vector<int> = messages.RecentStickers;\nmessages.archivedStickers#4fcba9c8 count:int sets:Vector<StickerSetCovered> = messages.ArchivedStickers;\nmessages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult;\nmessages.stickerSetInstallResultArchive#35e410a8 sets:Vector<StickerSetCovered> = messages.StickerSetInstallResult;\nstickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered;\nstickerSetMultiCovered#3407e51b set:StickerSet covers:Vector<Document> = StickerSetCovered;\nmaskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords;\ninputStickeredMediaPhoto#4a992157 id:InputPhoto = InputStickeredMedia;\ninputStickeredMediaDocument#438865b id:InputDocument = InputStickeredMedia;\ngame#bdf9653b flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document = Game;\ninputGameID#32c3e77 id:long access_hash:long = InputGame;\ninputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame;\nhighScore#58fffcd0 pos:int user_id:int score:int = HighScore;\nmessages.highScores#9a3bfd99 scores:Vector<HighScore> users:Vector<User> = messages.HighScores;\ntextEmpty#dc3d824f = RichText;\ntextPlain#744694e0 text:string = RichText;\ntextBold#6724abc4 text:RichText = RichText;\ntextItalic#d912a59c text:RichText = RichText;\ntextUnderline#c12622c4 text:RichText = RichText;\ntextStrike#9bf8bb95 text:RichText = RichText;\ntextFixed#6c3f19b9 text:RichText = RichText;\ntextUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText;\ntextEmail#de5a0dd6 text:RichText email:string = RichText;\ntextConcat#7e6260d7 texts:Vector<RichText> = RichText;\ntextSubscript#ed6a8504 text:RichText = RichText;\ntextSuperscript#c7fb5e01 text:RichText = RichText;\ntextMarked#34b8621 text:RichText = RichText;\ntextPhone#1ccb966a text:RichText phone:string = RichText;\ntextImage#81ccf4f document_id:long w:int h:int = RichText;\ntextAnchor#35553762 text:RichText name:string = RichText;\npageBlockUnsupported#13567e8a = PageBlock;\npageBlockTitle#70abc3fd text:RichText = PageBlock;\npageBlockSubtitle#8ffa9a1f text:RichText = PageBlock;\npageBlockAuthorDate#baafe5e0 author:RichText published_date:int = PageBlock;\npageBlockHeader#bfd064ec text:RichText = PageBlock;\npageBlockSubheader#f12bb6e1 text:RichText = PageBlock;\npageBlockParagraph#467a0766 text:RichText = PageBlock;\npageBlockPreformatted#c070d93e text:RichText language:string = PageBlock;\npageBlockFooter#48870999 text:RichText = PageBlock;\npageBlockDivider#db20b188 = PageBlock;\npageBlockAnchor#ce0d37b0 name:string = PageBlock;\npageBlockList#e4e88011 items:Vector<PageListItem> = PageBlock;\npageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock;\npageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock;\npageBlockPhoto#1759c560 flags:# photo_id:long caption:PageCaption url:flags.0?string webpage_id:flags.0?long = PageBlock;\npageBlockVideo#7c8fe7b6 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:PageCaption = PageBlock;\npageBlockCover#39f23300 cover:PageBlock = PageBlock;\npageBlockEmbed#a8718dc5 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:flags.5?int h:flags.5?int caption:PageCaption = PageBlock;\npageBlockEmbedPost#f259a80b url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector<PageBlock> caption:PageCaption = PageBlock;\npageBlockCollage#65a0fa4d items:Vector<PageBlock> caption:PageCaption = PageBlock;\npageBlockSlideshow#31f9590 items:Vector<PageBlock> caption:PageCaption = PageBlock;\npageBlockChannel#ef1751b5 channel:Chat = PageBlock;\npageBlockAudio#804361ea audio_id:long caption:PageCaption = PageBlock;\npageBlockKicker#1e148390 text:RichText = PageBlock;\npageBlockTable#bf4dea82 flags:# bordered:flags.0?true striped:flags.1?true title:RichText rows:Vector<PageTableRow> = PageBlock;\npageBlockOrderedList#9a8ae1e1 items:Vector<PageListOrderedItem> = PageBlock;\npageBlockDetails#76768bed flags:# open:flags.0?true blocks:Vector<PageBlock> title:RichText = PageBlock;\npageBlockRelatedArticles#16115a96 title:RichText articles:Vector<PageRelatedArticle> = PageBlock;\npageBlockMap#a44f3ef6 geo:GeoPoint zoom:int w:int h:int caption:PageCaption = PageBlock;\nphoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason;\nphoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason;\nphoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason;\nphoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason;\ndataJSON#7d748d04 data:string = DataJSON;\nlabeledPrice#cb296bf8 label:string amount:long = LabeledPrice;\ninvoice#cd886e0 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true currency:string prices:Vector<LabeledPrice> max_tip_amount:flags.8?long suggested_tip_amounts:flags.8?Vector<long> = Invoice;\npaymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge;\npostAddress#1e8caaeb street_line1:string street_line2:string city:string state:string country_iso2:string post_code:string = PostAddress;\npaymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string email:flags.2?string shipping_address:flags.3?PostAddress = PaymentRequestedInfo;\npaymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials;\nwebDocument#1c570ed1 url:string access_hash:long size:int mime_type:string attributes:Vector<DocumentAttribute> = WebDocument;\nwebDocumentNoProxy#f9c8bcc6 url:string size:int mime_type:string attributes:Vector<DocumentAttribute> = WebDocument;\ninputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector<DocumentAttribute> = InputWebDocument;\ninputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation;\ninputWebFileGeoPointLocation#9f2221c9 geo_point:InputGeoPoint access_hash:long w:int h:int zoom:int scale:int = InputWebFileLocation;\nupload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile;\npayments.paymentForm#8d0b2415 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true form_id:long bot_id:int invoice:Invoice provider_id:int url:string native_provider:flags.4?string native_params:flags.4?DataJSON saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?PaymentSavedCredentials users:Vector<User> = payments.PaymentForm;\npayments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = payments.ValidatedRequestedInfo;\npayments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult;\npayments.paymentVerificationNeeded#d8411139 url:string = payments.PaymentResult;\npayments.paymentReceipt#10b555d0 flags:# date:int bot_id:int provider_id:int title:string description:string photo:flags.2?WebDocument invoice:Invoice info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption tip_amount:flags.3?long currency:string total_amount:long credentials_title:string users:Vector<User> = payments.PaymentReceipt;\npayments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo;\ninputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials;\ninputPaymentCredentials#3417d728 flags:# save:flags.0?true data:DataJSON = InputPaymentCredentials;\ninputPaymentCredentialsApplePay#aa1c39f payment_data:DataJSON = InputPaymentCredentials;\ninputPaymentCredentialsGooglePay#8ac32801 payment_token:DataJSON = InputPaymentCredentials;\naccount.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword;\nshippingOption#b6213cdf id:string title:string prices:Vector<LabeledPrice> = ShippingOption;\ninputStickerSetItem#ffa0a496 flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords = InputStickerSetItem;\ninputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall;\nphoneCallEmpty#5366c915 id:long = PhoneCall;\nphoneCallWaiting#1b8f4ad1 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:int participant_id:int protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall;\nphoneCallRequested#87eabb53 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:int participant_id:int g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall;\nphoneCallAccepted#997c454a flags:# video:flags.6?true id:long access_hash:long date:int admin_id:int participant_id:int g_b:bytes protocol:PhoneCallProtocol = PhoneCall;\nphoneCall#8742ae7f flags:# p2p_allowed:flags.5?true video:flags.6?true id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connections:Vector<PhoneConnection> start_date:int = PhoneCall;\nphoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true video:flags.6?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall;\nphoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection;\nphoneConnectionWebrtc#635fe375 flags:# turn:flags.0?true stun:flags.1?true id:long ip:string ipv6:string port:int username:string password:string = PhoneConnection;\nphoneCallProtocol#fc878fc8 flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int library_versions:Vector<string> = PhoneCallProtocol;\nphone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector<User> = phone.PhoneCall;\nupload.cdnFileReuploadNeeded#eea8e46e request_token:bytes = upload.CdnFile;\nupload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile;\ncdnPublicKey#c982eaba dc_id:int public_key:string = CdnPublicKey;\ncdnConfig#5725e40a public_keys:Vector<CdnPublicKey> = CdnConfig;\nlangPackString#cad181f6 key:string value:string = LangPackString;\nlangPackStringPluralized#6c47ac9f flags:# key:string zero_value:flags.0?string one_value:flags.1?string two_value:flags.2?string few_value:flags.3?string many_value:flags.4?string other_value:string = LangPackString;\nlangPackStringDeleted#2979eeb2 key:string = LangPackString;\nlangPackDifference#f385c1f6 lang_code:string from_version:int version:int strings:Vector<LangPackString> = LangPackDifference;\nlangPackLanguage#eeca5ce3 flags:# official:flags.0?true rtl:flags.2?true beta:flags.3?true name:string native_name:string lang_code:string base_lang_code:flags.1?string plural_code:string strings_count:int translated_count:int translations_url:string = LangPackLanguage;\nchannelAdminLogEventActionChangeTitle#e6dfb825 prev_value:string new_value:string = ChannelAdminLogEventAction;\nchannelAdminLogEventActionChangeAbout#55188a2e prev_value:string new_value:string = ChannelAdminLogEventAction;\nchannelAdminLogEventActionChangeUsername#6a4afc38 prev_value:string new_value:string = ChannelAdminLogEventAction;\nchannelAdminLogEventActionChangePhoto#434bd2af prev_photo:Photo new_photo:Photo = ChannelAdminLogEventAction;\nchannelAdminLogEventActionToggleInvites#1b7907ae new_value:Bool = ChannelAdminLogEventAction;\nchannelAdminLogEventActionToggleSignatures#26ae0971 new_value:Bool = ChannelAdminLogEventAction;\nchannelAdminLogEventActionUpdatePinned#e9e82c18 message:Message = ChannelAdminLogEventAction;\nchannelAdminLogEventActionEditMessage#709b2405 prev_message:Message new_message:Message = ChannelAdminLogEventAction;\nchannelAdminLogEventActionDeleteMessage#42e047bb message:Message = ChannelAdminLogEventAction;\nchannelAdminLogEventActionParticipantJoin#183040d3 = ChannelAdminLogEventAction;\nchannelAdminLogEventActionParticipantLeave#f89777f2 = ChannelAdminLogEventAction;\nchannelAdminLogEventActionParticipantInvite#e31c34d8 participant:ChannelParticipant = ChannelAdminLogEventAction;\nchannelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction;\nchannelAdminLogEventActionParticipantToggleAdmin#d5676710 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction;\nchannelAdminLogEventActionChangeStickerSet#b1c3caa7 prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction;\nchannelAdminLogEventActionTogglePreHistoryHidden#5f5c95f1 new_value:Bool = ChannelAdminLogEventAction;\nchannelAdminLogEventActionDefaultBannedRights#2df5fc0a prev_banned_rights:ChatBannedRights new_banned_rights:ChatBannedRights = ChannelAdminLogEventAction;\nchannelAdminLogEventActionStopPoll#8f079643 message:Message = ChannelAdminLogEventAction;\nchannelAdminLogEventActionChangeLinkedChat#a26f881b prev_value:int new_value:int = ChannelAdminLogEventAction;\nchannelAdminLogEventActionChangeLocation#e6b76ae prev_value:ChannelLocation new_value:ChannelLocation = ChannelAdminLogEventAction;\nchannelAdminLogEventActionToggleSlowMode#53909779 prev_value:int new_value:int = ChannelAdminLogEventAction;\nchannelAdminLogEventActionStartGroupCall#23209745 call:InputGroupCall = ChannelAdminLogEventAction;\nchannelAdminLogEventActionDiscardGroupCall#db9f9140 call:InputGroupCall = ChannelAdminLogEventAction;\nchannelAdminLogEventActionParticipantMute#f92424d2 participant:GroupCallParticipant = ChannelAdminLogEventAction;\nchannelAdminLogEventActionParticipantUnmute#e64429c0 participant:GroupCallParticipant = ChannelAdminLogEventAction;\nchannelAdminLogEventActionToggleGroupCallSetting#56d6a247 join_muted:Bool = ChannelAdminLogEventAction;\nchannelAdminLogEventActionParticipantJoinByInvite#5cdada77 invite:ExportedChatInvite = ChannelAdminLogEventAction;\nchannelAdminLogEventActionExportedInviteDelete#5a50fca4 invite:ExportedChatInvite = ChannelAdminLogEventAction;\nchannelAdminLogEventActionExportedInviteRevoke#410a134e invite:ExportedChatInvite = ChannelAdminLogEventAction;\nchannelAdminLogEventActionExportedInviteEdit#e90ebb59 prev_invite:ExportedChatInvite new_invite:ExportedChatInvite = ChannelAdminLogEventAction;\nchannelAdminLogEventActionParticipantVolume#3e7f6847 participant:GroupCallParticipant = ChannelAdminLogEventAction;\nchannelAdminLogEventActionChangeHistoryTTL#6e941a38 prev_value:int new_value:int = ChannelAdminLogEventAction;\nchannelAdminLogEvent#3b5a3e40 id:long date:int user_id:int action:ChannelAdminLogEventAction = ChannelAdminLogEvent;\nchannels.adminLogResults#ed8af74d events:Vector<ChannelAdminLogEvent> chats:Vector<Chat> users:Vector<User> = channels.AdminLogResults;\nchannelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true group_call:flags.14?true invites:flags.15?true = ChannelAdminLogEventsFilter;\npopularContact#5ce14175 client_id:long importers:int = PopularContact;\nmessages.favedStickersNotModified#9e8fa6d3 = messages.FavedStickers;\nmessages.favedStickers#f37f2f16 hash:int packs:Vector<StickerPack> stickers:Vector<Document> = messages.FavedStickers;\nrecentMeUrlUnknown#46e1d13d url:string = RecentMeUrl;\nrecentMeUrlUser#8dbc3336 url:string user_id:int = RecentMeUrl;\nrecentMeUrlChat#a01b22f9 url:string chat_id:int = RecentMeUrl;\nrecentMeUrlChatInvite#eb49081d url:string chat_invite:ChatInvite = RecentMeUrl;\nrecentMeUrlStickerSet#bc0a57dc url:string set:StickerSetCovered = RecentMeUrl;\nhelp.recentMeUrls#e0310d7 urls:Vector<RecentMeUrl> chats:Vector<Chat> users:Vector<User> = help.RecentMeUrls;\ninputSingleMedia#1cc6e91f flags:# media:InputMedia random_id:long message:string entities:flags.0?Vector<MessageEntity> = InputSingleMedia;\nwebAuthorization#cac943f2 hash:long bot_id:int domain:string browser:string platform:string date_created:int date_active:int ip:string region:string = WebAuthorization;\naccount.webAuthorizations#ed56c9fc authorizations:Vector<WebAuthorization> users:Vector<User> = account.WebAuthorizations;\ninputMessageID#a676a322 id:int = InputMessage;\ninputMessageReplyTo#bad88395 id:int = InputMessage;\ninputMessagePinned#86872538 = InputMessage;\ninputMessageCallbackQuery#acfa1a7e id:int query_id:long = InputMessage;\ninputDialogPeer#fcaafeb7 peer:InputPeer = InputDialogPeer;\ninputDialogPeerFolder#64600527 folder_id:int = InputDialogPeer;\ndialogPeer#e56dbf05 peer:Peer = DialogPeer;\ndialogPeerFolder#514519e2 folder_id:int = DialogPeer;\nmessages.foundStickerSetsNotModified#d54b65d = messages.FoundStickerSets;\nmessages.foundStickerSets#5108d648 hash:int sets:Vector<StickerSetCovered> = messages.FoundStickerSets;\nfileHash#6242c773 offset:int limit:int hash:bytes = FileHash;\ninputClientProxy#75588b3f address:string port:int = InputClientProxy;\nhelp.termsOfServiceUpdateEmpty#e3309f7f expires:int = help.TermsOfServiceUpdate;\nhelp.termsOfServiceUpdate#28ecf961 expires:int terms_of_service:help.TermsOfService = help.TermsOfServiceUpdate;\ninputSecureFileUploaded#3334b0f0 id:long parts:int md5_checksum:string file_hash:bytes secret:bytes = InputSecureFile;\ninputSecureFile#5367e5be id:long access_hash:long = InputSecureFile;\nsecureFileEmpty#64199744 = SecureFile;\nsecureFile#e0277a62 id:long access_hash:long size:int dc_id:int date:int file_hash:bytes secret:bytes = SecureFile;\nsecureData#8aeabec3 data:bytes data_hash:bytes secret:bytes = SecureData;\nsecurePlainPhone#7d6099dd phone:string = SecurePlainData;\nsecurePlainEmail#21ec5a5f email:string = SecurePlainData;\nsecureValueTypePersonalDetails#9d2a81e3 = SecureValueType;\nsecureValueTypePassport#3dac6a00 = SecureValueType;\nsecureValueTypeDriverLicense#6e425c4 = SecureValueType;\nsecureValueTypeIdentityCard#a0d0744b = SecureValueType;\nsecureValueTypeInternalPassport#99a48f23 = SecureValueType;\nsecureValueTypeAddress#cbe31e26 = SecureValueType;\nsecureValueTypeUtilityBill#fc36954e = SecureValueType;\nsecureValueTypeBankStatement#89137c0d = SecureValueType;\nsecureValueTypeRentalAgreement#8b883488 = SecureValueType;\nsecureValueTypePassportRegistration#99e3806a = SecureValueType;\nsecureValueTypeTemporaryRegistration#ea02ec33 = SecureValueType;\nsecureValueTypePhone#b320aadb = SecureValueType;\nsecureValueTypeEmail#8e3ca7ee = SecureValueType;\nsecureValue#187fa0ca flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?SecureFile reverse_side:flags.2?SecureFile selfie:flags.3?SecureFile translation:flags.6?Vector<SecureFile> files:flags.4?Vector<SecureFile> plain_data:flags.5?SecurePlainData hash:bytes = SecureValue;\ninputSecureValue#db21d0a7 flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?InputSecureFile reverse_side:flags.2?InputSecureFile selfie:flags.3?InputSecureFile translation:flags.6?Vector<InputSecureFile> files:flags.4?Vector<InputSecureFile> plain_data:flags.5?SecurePlainData = InputSecureValue;\nsecureValueHash#ed1ecdb0 type:SecureValueType hash:bytes = SecureValueHash;\nsecureValueErrorData#e8a40bd9 type:SecureValueType data_hash:bytes field:string text:string = SecureValueError;\nsecureValueErrorFrontSide#be3dfa type:SecureValueType file_hash:bytes text:string = SecureValueError;\nsecureValueErrorReverseSide#868a2aa5 type:SecureValueType file_hash:bytes text:string = SecureValueError;\nsecureValueErrorSelfie#e537ced6 type:SecureValueType file_hash:bytes text:string = SecureValueError;\nsecureValueErrorFile#7a700873 type:SecureValueType file_hash:bytes text:string = SecureValueError;\nsecureValueErrorFiles#666220e9 type:SecureValueType file_hash:Vector<bytes> text:string = SecureValueError;\nsecureValueError#869d758f type:SecureValueType hash:bytes text:string = SecureValueError;\nsecureValueErrorTranslationFile#a1144770 type:SecureValueType file_hash:bytes text:string = SecureValueError;\nsecureValueErrorTranslationFiles#34636dd8 type:SecureValueType file_hash:Vector<bytes> text:string = SecureValueError;\nsecureCredentialsEncrypted#33f0ea47 data:bytes hash:bytes secret:bytes = SecureCredentialsEncrypted;\naccount.authorizationForm#ad2e1cd8 flags:# required_types:Vector<SecureRequiredType> values:Vector<SecureValue> errors:Vector<SecureValueError> users:Vector<User> privacy_policy_url:flags.0?string = account.AuthorizationForm;\naccount.sentEmailCode#811f854f email_pattern:string length:int = account.SentEmailCode;\nhelp.deepLinkInfoEmpty#66afa166 = help.DeepLinkInfo;\nhelp.deepLinkInfo#6a4ee832 flags:# update_app:flags.0?true message:string entities:flags.1?Vector<MessageEntity> = help.DeepLinkInfo;\nsavedPhoneContact#1142bd56 phone:string first_name:string last_name:string date:int = SavedContact;\naccount.takeout#4dba4501 id:long = account.Takeout;\npasswordKdfAlgoUnknown#d45ab096 = PasswordKdfAlgo;\npasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow#3a912d4a salt1:bytes salt2:bytes g:int p:bytes = PasswordKdfAlgo;\nsecurePasswordKdfAlgoUnknown#4a8537 = SecurePasswordKdfAlgo;\nsecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000#bbf2dda0 salt:bytes = SecurePasswordKdfAlgo;\nsecurePasswordKdfAlgoSHA512#86471d92 salt:bytes = SecurePasswordKdfAlgo;\nsecureSecretSettings#1527bcac secure_algo:SecurePasswordKdfAlgo secure_secret:bytes secure_secret_id:long = SecureSecretSettings;\ninputCheckPasswordEmpty#9880f658 = InputCheckPasswordSRP;\ninputCheckPasswordSRP#d27ff082 srp_id:long A:bytes M1:bytes = InputCheckPasswordSRP;\nsecureRequiredType#829d99da flags:# native_names:flags.0?true selfie_required:flags.1?true translation_required:flags.2?true type:SecureValueType = SecureRequiredType;\nsecureRequiredTypeOneOf#27477b4 types:Vector<SecureRequiredType> = SecureRequiredType;\nhelp.passportConfigNotModified#bfb9f457 = help.PassportConfig;\nhelp.passportConfig#a098d6af hash:int countries_langs:DataJSON = help.PassportConfig;\ninputAppEvent#1d1b1245 time:double type:string peer:long data:JSONValue = InputAppEvent;\njsonObjectValue#c0de1bd9 key:string value:JSONValue = JSONObjectValue;\njsonNull#3f6d7b68 = JSONValue;\njsonBool#c7345e6a value:Bool = JSONValue;\njsonNumber#2be0dfa4 value:double = JSONValue;\njsonString#b71e767a value:string = JSONValue;\njsonArray#f7444763 value:Vector<JSONValue> = JSONValue;\njsonObject#99c1d49d value:Vector<JSONObjectValue> = JSONValue;\npageTableCell#34566b6a flags:# header:flags.0?true align_center:flags.3?true align_right:flags.4?true valign_middle:flags.5?true valign_bottom:flags.6?true text:flags.7?RichText colspan:flags.1?int rowspan:flags.2?int = PageTableCell;\npageTableRow#e0c0c5e5 cells:Vector<PageTableCell> = PageTableRow;\npageCaption#6f747657 text:RichText credit:RichText = PageCaption;\npageListItemText#b92fb6cd text:RichText = PageListItem;\npageListItemBlocks#25e073fc blocks:Vector<PageBlock> = PageListItem;\npageListOrderedItemText#5e068047 num:string text:RichText = PageListOrderedItem;\npageListOrderedItemBlocks#98dd8936 num:string blocks:Vector<PageBlock> = PageListOrderedItem;\npageRelatedArticle#b390dc08 flags:# url:string webpage_id:long title:flags.0?string description:flags.1?string photo_id:flags.2?long author:flags.3?string published_date:flags.4?int = PageRelatedArticle;\npage#98657f0d flags:# part:flags.0?true rtl:flags.1?true v2:flags.2?true url:string blocks:Vector<PageBlock> photos:Vector<Photo> documents:Vector<Document> views:flags.3?int = Page;\nhelp.supportName#8c05f1c9 name:string = help.SupportName;\nhelp.userInfoEmpty#f3ae2eed = help.UserInfo;\nhelp.userInfo#1eb3758 message:string entities:Vector<MessageEntity> author:string date:int = help.UserInfo;\npollAnswer#6ca9c2e9 text:string option:bytes = PollAnswer;\npoll#86e18161 id:long flags:# closed:flags.0?true public_voters:flags.1?true multiple_choice:flags.2?true quiz:flags.3?true question:string answers:Vector<PollAnswer> close_period:flags.4?int close_date:flags.5?int = Poll;\npollAnswerVoters#3b6ddad2 flags:# chosen:flags.0?true correct:flags.1?true option:bytes voters:int = PollAnswerVoters;\npollResults#badcc1a3 flags:# min:flags.0?true results:flags.1?Vector<PollAnswerVoters> total_voters:flags.2?int recent_voters:flags.3?Vector<int> solution:flags.4?string solution_entities:flags.4?Vector<MessageEntity> = PollResults;\nchatOnlines#f041e250 onlines:int = ChatOnlines;\nstatsURL#47a971e0 url:string = StatsURL;\nchatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true anonymous:flags.10?true manage_call:flags.11?true other:flags.12?true = ChatAdminRights;\nchatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true send_polls:flags.8?true change_info:flags.10?true invite_users:flags.15?true pin_messages:flags.17?true until_date:int = ChatBannedRights;\ninputWallPaper#e630b979 id:long access_hash:long = InputWallPaper;\ninputWallPaperSlug#72091c80 slug:string = InputWallPaper;\ninputWallPaperNoFile#967a462e id:long = InputWallPaper;\naccount.wallPapersNotModified#1c199183 = account.WallPapers;\naccount.wallPapers#702b65a9 hash:int wallpapers:Vector<WallPaper> = account.WallPapers;\ncodeSettings#debebe83 flags:# allow_flashcall:flags.0?true current_number:flags.1?true allow_app_hash:flags.4?true = CodeSettings;\nwallPaperSettings#1dc1bca4 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int second_background_color:flags.4?int third_background_color:flags.5?int fourth_background_color:flags.6?int intensity:flags.3?int rotation:flags.4?int = WallPaperSettings;\nautoDownloadSettings#e04232f3 flags:# disabled:flags.0?true video_preload_large:flags.1?true audio_preload_next:flags.2?true phonecalls_less_data:flags.3?true photo_size_max:int video_size_max:int file_size_max:int video_upload_maxbitrate:int = AutoDownloadSettings;\naccount.autoDownloadSettings#63cacf26 low:AutoDownloadSettings medium:AutoDownloadSettings high:AutoDownloadSettings = account.AutoDownloadSettings;\nemojiKeyword#d5b3b9f9 keyword:string emoticons:Vector<string> = EmojiKeyword;\nemojiKeywordDeleted#236df622 keyword:string emoticons:Vector<string> = EmojiKeyword;\nemojiKeywordsDifference#5cc761bd lang_code:string from_version:int version:int keywords:Vector<EmojiKeyword> = EmojiKeywordsDifference;\nemojiURL#a575739d url:string = EmojiURL;\nemojiLanguage#b3fb5361 lang_code:string = EmojiLanguage;\nfolder#ff544e65 flags:# autofill_new_broadcasts:flags.0?true autofill_public_groups:flags.1?true autofill_new_correspondents:flags.2?true id:int title:string photo:flags.3?ChatPhoto = Folder;\ninputFolderPeer#fbd2c296 peer:InputPeer folder_id:int = InputFolderPeer;\nfolderPeer#e9baa668 peer:Peer folder_id:int = FolderPeer;\nmessages.searchCounter#e844ebff flags:# inexact:flags.1?true filter:MessagesFilter count:int = messages.SearchCounter;\nurlAuthResultRequest#92d33a0e flags:# request_write_access:flags.0?true bot:User domain:string = UrlAuthResult;\nurlAuthResultAccepted#8f8c0e4e url:string = UrlAuthResult;\nurlAuthResultDefault#a9d6db1f = UrlAuthResult;\nchannelLocationEmpty#bfb5ad8b = ChannelLocation;\nchannelLocation#209b82db geo_point:GeoPoint address:string = ChannelLocation;\npeerLocated#ca461b5d peer:Peer expires:int distance:int = PeerLocated;\npeerSelfLocated#f8ec284b expires:int = PeerLocated;\nrestrictionReason#d072acb4 platform:string reason:string text:string = RestrictionReason;\ninputTheme#3c5693e9 id:long access_hash:long = InputTheme;\ninputThemeSlug#f5890df1 slug:string = InputTheme;\ntheme#28f1114 flags:# creator:flags.0?true default:flags.1?true id:long access_hash:long slug:string title:string document:flags.2?Document settings:flags.3?ThemeSettings installs_count:int = Theme;\naccount.themesNotModified#f41eb622 = account.Themes;\naccount.themes#7f676421 hash:int themes:Vector<Theme> = account.Themes;\nauth.loginToken#629f1980 expires:int token:bytes = auth.LoginToken;\nauth.loginTokenMigrateTo#68e9916 dc_id:int token:bytes = auth.LoginToken;\nauth.loginTokenSuccess#390d5c5e authorization:auth.Authorization = auth.LoginToken;\naccount.contentSettings#57e28221 flags:# sensitive_enabled:flags.0?true sensitive_can_change:flags.1?true = account.ContentSettings;\nmessages.inactiveChats#a927fec5 dates:Vector<int> chats:Vector<Chat> users:Vector<User> = messages.InactiveChats;\nbaseThemeClassic#c3a12462 = BaseTheme;\nbaseThemeDay#fbd81688 = BaseTheme;\nbaseThemeNight#b7b31ea8 = BaseTheme;\nbaseThemeTinted#6d5f77ee = BaseTheme;\nbaseThemeArctic#5b11125a = BaseTheme;\ninputThemeSettings#bd507cd1 flags:# base_theme:BaseTheme accent_color:int message_top_color:flags.0?int message_bottom_color:flags.0?int wallpaper:flags.1?InputWallPaper wallpaper_settings:flags.1?WallPaperSettings = InputThemeSettings;\nthemeSettings#9c14984a flags:# base_theme:BaseTheme accent_color:int message_top_color:flags.0?int message_bottom_color:flags.0?int wallpaper:flags.1?WallPaper = ThemeSettings;\nwebPageAttributeTheme#54b56617 flags:# documents:flags.0?Vector<Document> settings:flags.1?ThemeSettings = WebPageAttribute;\nmessageUserVote#a28e5559 user_id:int option:bytes date:int = MessageUserVote;\nmessageUserVoteInputOption#36377430 user_id:int date:int = MessageUserVote;\nmessageUserVoteMultiple#e8fe0de user_id:int options:Vector<bytes> date:int = MessageUserVote;\nmessages.votesList#823f649 flags:# count:int votes:Vector<MessageUserVote> users:Vector<User> next_offset:flags.0?string = messages.VotesList;\nbankCardOpenUrl#f568028a url:string name:string = BankCardOpenUrl;\npayments.bankCardData#3e24e573 title:string open_urls:Vector<BankCardOpenUrl> = payments.BankCardData;\ndialogFilter#7438f7e8 flags:# contacts:flags.0?true non_contacts:flags.1?true groups:flags.2?true broadcasts:flags.3?true bots:flags.4?true exclude_muted:flags.11?true exclude_read:flags.12?true exclude_archived:flags.13?true id:int title:string emoticon:flags.25?string pinned_peers:Vector<InputPeer> include_peers:Vector<InputPeer> exclude_peers:Vector<InputPeer> = DialogFilter;\ndialogFilterSuggested#77744d4a filter:DialogFilter description:string = DialogFilterSuggested;\nstatsDateRangeDays#b637edaf min_date:int max_date:int = StatsDateRangeDays;\nstatsAbsValueAndPrev#cb43acde current:double previous:double = StatsAbsValueAndPrev;\nstatsPercentValue#cbce2fe0 part:double total:double = StatsPercentValue;\nstatsGraphAsync#4a27eb2d token:string = StatsGraph;\nstatsGraphError#bedc9822 error:string = StatsGraph;\nstatsGraph#8ea464b6 flags:# json:DataJSON zoom_token:flags.0?string = StatsGraph;\nmessageInteractionCounters#ad4fc9bd msg_id:int views:int forwards:int = MessageInteractionCounters;\nstats.broadcastStats#bdf78394 period:StatsDateRangeDays followers:StatsAbsValueAndPrev views_per_post:StatsAbsValueAndPrev shares_per_post:StatsAbsValueAndPrev enabled_notifications:StatsPercentValue growth_graph:StatsGraph followers_graph:StatsGraph mute_graph:StatsGraph top_hours_graph:StatsGraph interactions_graph:StatsGraph iv_interactions_graph:StatsGraph views_by_source_graph:StatsGraph new_followers_by_source_graph:StatsGraph languages_graph:StatsGraph recent_message_interactions:Vector<MessageInteractionCounters> = stats.BroadcastStats;\nhelp.promoDataEmpty#98f6ac75 expires:int = help.PromoData;\nhelp.promoData#8c39793f flags:# proxy:flags.0?true expires:int peer:Peer chats:Vector<Chat> users:Vector<User> psa_type:flags.1?string psa_message:flags.2?string = help.PromoData;\nvideoSize#de33b094 flags:# type:string w:int h:int size:int video_start_ts:flags.0?double = VideoSize;\nstatsGroupTopPoster#18f3d0f7 user_id:int messages:int avg_chars:int = StatsGroupTopPoster;\nstatsGroupTopAdmin#6014f412 user_id:int deleted:int kicked:int banned:int = StatsGroupTopAdmin;\nstatsGroupTopInviter#31962a4c user_id:int invitations:int = StatsGroupTopInviter;\nstats.megagroupStats#ef7ff916 period:StatsDateRangeDays members:StatsAbsValueAndPrev messages:StatsAbsValueAndPrev viewers:StatsAbsValueAndPrev posters:StatsAbsValueAndPrev growth_graph:StatsGraph members_graph:StatsGraph new_members_by_source_graph:StatsGraph languages_graph:StatsGraph messages_graph:StatsGraph actions_graph:StatsGraph top_hours_graph:StatsGraph weekdays_graph:StatsGraph top_posters:Vector<StatsGroupTopPoster> top_admins:Vector<StatsGroupTopAdmin> top_inviters:Vector<StatsGroupTopInviter> users:Vector<User> = stats.MegagroupStats;\nglobalPrivacySettings#bea2f424 flags:# archive_and_mute_new_noncontact_peers:flags.0?Bool = GlobalPrivacySettings;\nhelp.countryCode#4203c5ef flags:# country_code:string prefixes:flags.0?Vector<string> patterns:flags.1?Vector<string> = help.CountryCode;\nhelp.country#c3878e23 flags:# hidden:flags.0?true iso2:string default_name:string name:flags.1?string country_codes:Vector<help.CountryCode> = help.Country;\nhelp.countriesListNotModified#93cc1f32 = help.CountriesList;\nhelp.countriesList#87d0759e countries:Vector<help.Country> hash:int = help.CountriesList;\nmessageViews#455b853d flags:# views:flags.0?int forwards:flags.1?int replies:flags.2?MessageReplies = MessageViews;\nmessages.messageViews#b6c4f543 views:Vector<MessageViews> chats:Vector<Chat> users:Vector<User> = messages.MessageViews;\nmessages.discussionMessage#f5dd8f9d flags:# messages:Vector<Message> max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int chats:Vector<Chat> users:Vector<User> = messages.DiscussionMessage;\nmessageReplyHeader#a6d57763 flags:# reply_to_msg_id:int reply_to_peer_id:flags.0?Peer reply_to_top_id:flags.1?int = MessageReplyHeader;\nmessageReplies#4128faac flags:# comments:flags.0?true replies:int replies_pts:int recent_repliers:flags.1?Vector<Peer> channel_id:flags.0?int max_id:flags.2?int read_max_id:flags.3?int = MessageReplies;\npeerBlocked#e8fd8014 peer_id:Peer date:int = PeerBlocked;\nstats.messageStats#8999f295 views_graph:StatsGraph = stats.MessageStats;\ngroupCallDiscarded#7780bcb4 id:long access_hash:long duration:int = GroupCall;\ngroupCall#d597650c flags:# join_muted:flags.1?true can_change_join_muted:flags.2?true join_date_asc:flags.6?true schedule_start_subscribed:flags.8?true can_start_video:flags.9?true id:long access_hash:long participants_count:int title:flags.3?string stream_dc_id:flags.4?int record_start_date:flags.5?int schedule_date:flags.7?int unmuted_video_count:flags.10?int unmuted_video_limit:int version:int = GroupCall;\ninputGroupCall#d8aa840f id:long access_hash:long = InputGroupCall;\ngroupCallParticipant#eba636fe flags:# muted:flags.0?true left:flags.1?true can_self_unmute:flags.2?true just_joined:flags.4?true versioned:flags.5?true min:flags.8?true muted_by_you:flags.9?true volume_by_admin:flags.10?true self:flags.12?true video_joined:flags.15?true peer:Peer date:int active_date:flags.3?int source:int volume:flags.7?int about:flags.11?string raise_hand_rating:flags.13?long video:flags.6?GroupCallParticipantVideo presentation:flags.14?GroupCallParticipantVideo = GroupCallParticipant;\nphone.groupCall#9e727aad call:GroupCall participants:Vector<GroupCallParticipant> participants_next_offset:string chats:Vector<Chat> users:Vector<User> = phone.GroupCall;\nphone.groupParticipants#f47751b6 count:int participants:Vector<GroupCallParticipant> next_offset:string chats:Vector<Chat> users:Vector<User> version:int = phone.GroupParticipants;\ninlineQueryPeerTypeSameBotPM#3081ed9d = InlineQueryPeerType;\ninlineQueryPeerTypePM#833c0fac = InlineQueryPeerType;\ninlineQueryPeerTypeChat#d766c50a = InlineQueryPeerType;\ninlineQueryPeerTypeMegagroup#5ec4be43 = InlineQueryPeerType;\ninlineQueryPeerTypeBroadcast#6334ee9a = InlineQueryPeerType;\nmessages.historyImport#1662af0b id:long = messages.HistoryImport;\nmessages.historyImportParsed#5e0fb7b9 flags:# pm:flags.0?true group:flags.1?true title:flags.2?string = messages.HistoryImportParsed;\nmessages.affectedFoundMessages#ef8d3e6c pts:int pts_count:int offset:int messages:Vector<int> = messages.AffectedFoundMessages;\nchatInviteImporter#1e3e6680 user_id:int date:int = ChatInviteImporter;\nmessages.exportedChatInvites#bdc62dcc count:int invites:Vector<ExportedChatInvite> users:Vector<User> = messages.ExportedChatInvites;\nmessages.exportedChatInvite#1871be50 invite:ExportedChatInvite users:Vector<User> = messages.ExportedChatInvite;\nmessages.exportedChatInviteReplaced#222600ef invite:ExportedChatInvite new_invite:ExportedChatInvite users:Vector<User> = messages.ExportedChatInvite;\nmessages.chatInviteImporters#81b6b00a count:int importers:Vector<ChatInviteImporter> users:Vector<User> = messages.ChatInviteImporters;\nchatAdminWithInvites#dfd2330f admin_id:int invites_count:int revoked_invites_count:int = ChatAdminWithInvites;\nmessages.chatAdminsWithInvites#b69b72d7 admins:Vector<ChatAdminWithInvites> users:Vector<User> = messages.ChatAdminsWithInvites;\nmessages.checkedHistoryImportPeer#a24de717 confirm_text:string = messages.CheckedHistoryImportPeer;\nphone.joinAsPeers#afe5623f peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = phone.JoinAsPeers;\nphone.exportedGroupCallInvite#204bd158 link:string = phone.ExportedGroupCallInvite;\ngroupCallParticipantVideoSourceGroup#dcb118b7 semantics:string sources:Vector<int> = GroupCallParticipantVideoSourceGroup;\ngroupCallParticipantVideo#67753ac8 flags:# paused:flags.0?true endpoint:string source_groups:Vector<GroupCallParticipantVideoSourceGroup> audio_source:flags.1?int = GroupCallParticipantVideo;\nstickers.suggestedShortName#85fea03f short_name:string = stickers.SuggestedShortName;\nbotCommandScopeDefault#2f6cb2ab = BotCommandScope;\nbotCommandScopeUsers#3c4f04d8 = BotCommandScope;\nbotCommandScopeChats#6fe1a881 = BotCommandScope;\nbotCommandScopeChatAdmins#b9aa606a = BotCommandScope;\nbotCommandScopePeer#db9d897d peer:InputPeer = BotCommandScope;\nbotCommandScopePeerAdmins#3fd863d1 peer:InputPeer = BotCommandScope;\nbotCommandScopePeerUser#a1321f3 peer:InputPeer user_id:InputUser = BotCommandScope;\naccount.resetPasswordFailedWait#e3779861 retry_date:int = account.ResetPasswordResult;\naccount.resetPasswordRequestedWait#e9effc7d until_date:int = account.ResetPasswordResult;\naccount.resetPasswordOk#e926d63e = account.ResetPasswordResult;\n---functions---\ninitConnection#c1cd5ea9 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy params:flags.1?JSONValue query:!X = X;\ninvokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X;\nauth.sendCode#a677244f phone_number:string api_id:int api_hash:string settings:CodeSettings = auth.SentCode;\nauth.signUp#80eee427 phone_number:string phone_code_hash:string first_name:string last_name:string = auth.Authorization;\nauth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization;\nauth.logOut#5717da40 = Bool;\nauth.resetAuthorizations#9fab0d1a = Bool;\nauth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization;\nauth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization;\nauth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool;\nauth.checkPassword#d18b4d16 password:InputCheckPasswordSRP = auth.Authorization;\nauth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery;\nauth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode;\nauth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool;\nauth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector<long> = Bool;\nauth.exportLoginToken#b1b41517 api_id:int api_hash:string except_ids:Vector<int> = auth.LoginToken;\nauth.importLoginToken#95ac5ce4 token:bytes = auth.LoginToken;\naccount.registerDevice#68976c6f flags:# no_muted:flags.0?true token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector<int> = Bool;\naccount.unregisterDevice#3076c4bf token_type:int token:string other_uids:Vector<int> = Bool;\naccount.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool;\naccount.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings;\naccount.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User;\naccount.updateStatus#6628562c offline:Bool = Bool;\naccount.getWallPapers#aabb1763 hash:int = account.WallPapers;\naccount.checkUsername#2714d86c username:string = Bool;\naccount.updateUsername#3e0bdd7c username:string = User;\naccount.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules;\naccount.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector<InputPrivacyRule> = account.PrivacyRules;\naccount.getAuthorizations#e320c158 = account.Authorizations;\naccount.resetAuthorization#df77f3bc hash:long = Bool;\naccount.getPassword#548a30f5 = account.Password;\naccount.getPasswordSettings#9cd4eaf9 password:InputCheckPasswordSRP = account.PasswordSettings;\naccount.updatePasswordSettings#a59b102f password:InputCheckPasswordSRP new_settings:account.PasswordInputSettings = Bool;\naccount.sendConfirmPhoneCode#1b3faa88 hash:string settings:CodeSettings = auth.SentCode;\naccount.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool;\naccount.getTmpPassword#449e0b51 password:InputCheckPasswordSRP period:int = account.TmpPassword;\naccount.sendVerifyPhoneCode#a5a356f9 phone_number:string settings:CodeSettings = auth.SentCode;\naccount.confirmPasswordEmail#8fdf1920 code:string = Bool;\naccount.getContactSignUpNotification#9f07c728 = Bool;\naccount.setContactSignUpNotification#cff43f61 silent:Bool = Bool;\naccount.getNotifyExceptions#53577479 flags:# compare_sound:flags.1?true peer:flags.0?InputNotifyPeer = Updates;\naccount.uploadWallPaper#dd853661 file:InputFile mime_type:string settings:WallPaperSettings = WallPaper;\naccount.setContentSettings#b574b16b flags:# sensitive_enabled:flags.0?true = Bool;\naccount.getContentSettings#8b9b4dae = account.ContentSettings;\nusers.getUsers#d91a548 id:Vector<InputUser> = Vector<User>;\nusers.getFullUser#ca30a5b1 id:InputUser = UserFull;\ncontacts.getContacts#c023849f hash:int = contacts.Contacts;\ncontacts.importContacts#2c800be5 contacts:Vector<InputContact> = contacts.ImportedContacts;\ncontacts.deleteContacts#96a0e00 id:Vector<InputUser> = Updates;\ncontacts.block#68cc1411 id:InputPeer = Bool;\ncontacts.unblock#bea65d50 id:InputPeer = Bool;\ncontacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked;\ncontacts.search#11f812d8 q:string limit:int = contacts.Found;\ncontacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer;\ncontacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true forward_users:flags.4?true forward_chats:flags.5?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:int = contacts.TopPeers;\nmessages.getMessages#63c66506 id:Vector<InputMessage> = messages.Messages;\nmessages.getDialogs#a0ee3b73 flags:# exclude_pinned:flags.0?true folder_id:flags.1?int offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:int = messages.Dialogs;\nmessages.getHistory#dcbb8260 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;\nmessages.search#c352eec flags:# peer:InputPeer q:string from_id:flags.0?InputPeer top_msg_id:flags.1?int filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;\nmessages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages;\nmessages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true revoke:flags.1?true peer:InputPeer max_id:int = messages.AffectedHistory;\nmessages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector<int> = messages.AffectedMessages;\nmessages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>;\nmessages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool;\nmessages.sendMessage#520c3870 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int = Updates;\nmessages.sendMedia#3491eba9 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int = Updates;\nmessages.forwardMessages#d9fee60e flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer schedule_date:flags.10?int = Updates;\nmessages.report#8953ab4e peer:InputPeer id:Vector<int> reason:ReportReason message:string = Bool;\nmessages.getChats#3c6aa187 id:Vector<int> = messages.Chats;\nmessages.getFullChat#3b831c66 chat_id:int = messages.ChatFull;\nmessages.editChatTitle#dc452855 chat_id:int title:string = Updates;\nmessages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates;\nmessages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates;\nmessages.deleteChatUser#c534459a flags:# revoke_history:flags.0?true chat_id:int user_id:InputUser = Updates;\nmessages.createChat#9cb126e users:Vector<InputUser> title:string = Updates;\nmessages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig;\nmessages.readMessageContents#36a73f77 id:Vector<int> = messages.AffectedMessages;\nmessages.getStickers#43d4f2c emoticon:string hash:int = messages.Stickers;\nmessages.getAllStickers#1c9618b1 hash:int = messages.AllStickers;\nmessages.getWebPagePreview#8b68b0cc flags:# message:string entities:flags.3?Vector<MessageEntity> = MessageMedia;\nmessages.exportChatInvite#14b9bcd7 flags:# legacy_revoke_permanent:flags.2?true peer:InputPeer expire_date:flags.0?int usage_limit:flags.1?int = ExportedChatInvite;\nmessages.checkChatInvite#3eadb1bb hash:string = ChatInvite;\nmessages.importChatInvite#6c50051c hash:string = Updates;\nmessages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet;\nmessages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult;\nmessages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool;\nmessages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates;\nmessages.migrateChat#15a3b8e3 chat_id:int = Updates;\nmessages.searchGlobal#4bc6589a flags:# folder_id:flags.0?int q:string filter:MessagesFilter min_date:int max_date:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;\nmessages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document;\nmessages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs;\nmessages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults;\nmessages.sendInlineBotResult#220815b0 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string schedule_date:flags.10?int = Updates;\nmessages.editMessage#48f71778 flags:# no_webpage:flags.1?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.15?int = Updates;\nmessages.getBotCallbackAnswer#9342ca07 flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes password:flags.2?InputCheckPasswordSRP = messages.BotCallbackAnswer;\nmessages.getPeerDialogs#e470bcfd peers:Vector<InputDialogPeer> = messages.PeerDialogs;\nmessages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector<MessageEntity> = Bool;\nmessages.getFeaturedStickers#2dacca4f hash:int = messages.FeaturedStickers;\nmessages.readFeaturedStickers#5b118126 id:Vector<long> = Bool;\nmessages.getRecentStickers#5ea192c9 flags:# attached:flags.0?true hash:int = messages.RecentStickers;\nmessages.getWebPage#32ca8f91 url:string hash:int = WebPage;\nmessages.toggleDialogPin#a731e257 flags:# pinned:flags.0?true peer:InputDialogPeer = Bool;\nmessages.getPinnedDialogs#d6b94df2 folder_id:int = messages.PeerDialogs;\nmessages.uploadMedia#519bc2b1 peer:InputPeer media:InputMedia = MessageMedia;\nmessages.getFavedStickers#21ce0b0e hash:int = messages.FavedStickers;\nmessages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool;\nmessages.sendMultiMedia#cc0110cb flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int multi_media:Vector<InputSingleMedia> schedule_date:flags.10?int = Updates;\nmessages.searchStickerSets#c2b7d08b flags:# exclude_featured:flags.0?true q:string hash:int = messages.FoundStickerSets;\nmessages.markDialogUnread#c286d98f flags:# unread:flags.0?true peer:InputDialogPeer = Bool;\nmessages.updatePinnedMessage#d2aaf7ec flags:# silent:flags.0?true unpin:flags.1?true pm_oneside:flags.2?true peer:InputPeer id:int = Updates;\nmessages.sendVote#10ea6184 peer:InputPeer msg_id:int options:Vector<bytes> = Updates;\nmessages.getOnlines#6e2be050 peer:InputPeer = ChatOnlines;\nmessages.editChatAbout#def60797 peer:InputPeer about:string = Bool;\nmessages.editChatDefaultBannedRights#a5866b41 peer:InputPeer banned_rights:ChatBannedRights = Updates;\nmessages.getEmojiKeywordsDifference#1508b6af lang_code:string from_version:int = EmojiKeywordsDifference;\nmessages.getScheduledHistory#e2c2685b peer:InputPeer hash:int = messages.Messages;\nmessages.sendScheduledMessages#bd38850a peer:InputPeer id:Vector<int> = Updates;\nmessages.deleteScheduledMessages#59ae2b16 peer:InputPeer id:Vector<int> = Updates;\nmessages.getPollVotes#b86e380e flags:# peer:InputPeer id:int option:flags.0?bytes offset:flags.1?string limit:int = messages.VotesList;\nmessages.getDialogFilters#f19ed96d = Vector<DialogFilter>;\nmessages.getSuggestedDialogFilters#a29cd42c = Vector<DialogFilterSuggested>;\nmessages.updateDialogFilter#1ad4a04a flags:# id:int filter:flags.0?DialogFilter = Bool;\nmessages.getReplies#24b581ba peer:InputPeer msg_id:int offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;\nmessages.getDiscussionMessage#446972fd peer:InputPeer msg_id:int = messages.DiscussionMessage;\nmessages.readDiscussion#f731a9f4 peer:InputPeer msg_id:int read_max_id:int = Bool;\nmessages.unpinAllMessages#f025bc8b peer:InputPeer = messages.AffectedHistory;\nmessages.deleteChat#83247d11 chat_id:int = Bool;\nupdates.getState#edd4882a = updates.State;\nupdates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference;\nupdates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference;\nphotos.uploadProfilePhoto#89f30f69 flags:# file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double = photos.Photo;\nphotos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos;\nupload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool;\nupload.getFile#b15a9afc flags:# precise:flags.0?true cdn_supported:flags.1?true location:InputFileLocation offset:int limit:int = upload.File;\nupload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool;\nupload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile;\nhelp.getConfig#c4f9186b = Config;\nhelp.getNearestDc#1fb33026 = NearestDc;\nhelp.getSupport#9cdf08cd = help.Support;\nhelp.acceptTermsOfService#ee72f79a id:DataJSON = Bool;\nhelp.getCountriesList#735787a8 lang_code:string hash:int = help.CountriesList;\nchannels.readHistory#cc104937 channel:InputChannel max_id:int = Bool;\nchannels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages;\nchannels.getMessages#ad8c9a23 channel:InputChannel id:Vector<InputMessage> = messages.Messages;\nchannels.getParticipants#123e05e9 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int hash:int = channels.ChannelParticipants;\nchannels.getParticipant#a0ab6cc6 channel:InputChannel participant:InputPeer = channels.ChannelParticipant;\nchannels.getChannels#a7f6bbb id:Vector<InputChannel> = messages.Chats;\nchannels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull;\nchannels.createChannel#3d5fb10f flags:# broadcast:flags.0?true megagroup:flags.1?true for_import:flags.3?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string = Updates;\nchannels.editAdmin#d33c8902 channel:InputChannel user_id:InputUser admin_rights:ChatAdminRights rank:string = Updates;\nchannels.editTitle#566decd0 channel:InputChannel title:string = Updates;\nchannels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates;\nchannels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool;\nchannels.updateUsername#3514b3de channel:InputChannel username:string = Bool;\nchannels.joinChannel#24b524c5 channel:InputChannel = Updates;\nchannels.leaveChannel#f836aa95 channel:InputChannel = Updates;\nchannels.inviteToChannel#199f3a6c channel:InputChannel users:Vector<InputUser> = Updates;\nchannels.deleteChannel#c0111fe3 channel:InputChannel = Updates;\nchannels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates;\nchannels.editBanned#96e6cd81 channel:InputChannel participant:InputPeer banned_rights:ChatBannedRights = Updates;\nchannels.readMessageContents#eab5dc38 channel:InputChannel id:Vector<int> = Bool;\nchannels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates;\nchannels.getGroupsForDiscussion#f5dad378 = messages.Chats;\nchannels.setDiscussionGroup#40582bb2 broadcast:InputChannel group:InputChannel = Bool;\npayments.getPaymentForm#8a333c8d flags:# peer:InputPeer msg_id:int theme_params:flags.0?DataJSON = payments.PaymentForm;\npayments.getPaymentReceipt#2478d1cc peer:InputPeer msg_id:int = payments.PaymentReceipt;\npayments.validateRequestedInfo#db103170 flags:# save:flags.0?true peer:InputPeer msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo;\npayments.sendPaymentForm#30c3bc9d flags:# form_id:long peer:InputPeer msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials tip_amount:flags.2?long = payments.PaymentResult;\npayments.getSavedInfo#227d824b = payments.SavedInfo;\nlangpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference;\nlangpack.getStrings#efea3803 lang_pack:string lang_code:string keys:Vector<string> = Vector<LangPackString>;\nlangpack.getLanguages#42c6978f lang_pack:string = Vector<LangPackLanguage>;\nfolders.editPeerFolders#6847d0ab folder_peers:Vector<InputFolderPeer> = Updates;\n"},8963:(e,t,n)=>{var s=n(8764).Buffer;function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{inflate:i}=n(5802),{serializeBytes:o}=n(7404);class r{constructor(e){this.data=e,this.CONSTRUCTOR_ID=812830625,this.classType="constructor"}static async gzipIfSmaller(e,t){if(e&&t.length>512){const e=await new r(t).toBytes();if(e.length<t.length)return e}return t}static gzip(e){return s.from(e)}static ungzip(e){return s.from(i(e))}static read(e){if(e.readInt(!1)!==r.CONSTRUCTOR_ID)throw new Error("not equal");return r.gzip(e.tgReadBytes())}static async fromReader(e){return new r(await r.ungzip(e.tgReadBytes()))}async toBytes(){const e=s.alloc(4);return e.writeUInt32LE(r.CONSTRUCTOR_ID,0),s.concat([e,o(await r.gzip(this.data))])}}a(r,"CONSTRUCTOR_ID",812830625),a(r,"classType","constructor"),e.exports=r},3254:(e,t,n)=>{function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const a=n(355);class i{constructor(e){this.CONSTRUCTOR_ID=1945237724,this.messages=e,this.classType="constructor"}static fromReader(e){const t=[],n=e.readInt();for(let s=0;s<n;s++){const n=e.readLong(),s=e.readInt(),i=e.readInt(),o=e.tellPosition(),r=e.tgReadObject();e.setPosition(o+i);const c=new a(n,s,r);t.push(c)}return new i(t)}}s(i,"CONSTRUCTOR_ID",1945237724),s(i,"classType","constructor"),s(i,"MAXIMUM_SIZE",1044448),s(i,"MAXIMUM_LENGTH",100),e.exports=i},2301:(e,t,n)=>{function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{RpcError:a}=n(7404).constructors,i=n(8963);class o{constructor(e,t,n){this.CONSTRUCTOR_ID=4082920705,this.reqMsgId=e,this.body=t,this.error=n,this.classType="constructor"}static async fromReader(e){const t=e.readLong(),n=e.readInt(!1);return n===a.CONSTRUCTOR_ID?new o(t,void 0,a.fromReader(e)):n===i.CONSTRUCTOR_ID?new o(t,(await i.fromReader(e)).data):(e.seek(-4),new o(t,e.read(),void 0))}}s(o,"CONSTRUCTOR_ID",4082920705),s(o,"classType","constructor"),e.exports=o},355:e=>{function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class n{constructor(e,t,n){this.msgId=e,this.seqNo=t,this.obj=n,this.classType="constructor"}}t(n,"SIZE_OVERHEAD",12),t(n,"classType","constructor"),e.exports=n},2058:(e,t,n)=>{const s=n(355),a=n(2301),i=n(3254),o=n(8963),r={[a.CONSTRUCTOR_ID]:a,[o.CONSTRUCTOR_ID]:o,[i.CONSTRUCTOR_ID]:i};e.exports={TLMessage:s,RPCResult:a,MessageContainer:i,GZIPPacked:o,coreObjects:r}},1436:(e,t,n)=>{var s=n(8764).Buffer;const a=e=>e.replace(/(?:^|_)([a-z])/g,((e,t)=>t.toUpperCase())).replace(/_/g,""),i=e=>e.replace(/([-_][a-z])/g,(e=>e.toUpperCase().replace("-","").replace("_",""))),o=new Set([3162085175,2574415285,1072550713,3300522427,1450380236]),r=new Set([85337187,2211011308,2851430293,1013613780,1459478408,3504867164,3045658042,1715713620,3608339646,4110704415,812830625]);let c;function d(e){c||(c=function(){let e;const t=[];for(let n=0;n<256;n++){e=n;for(let t=0;t<8;t++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}()),s.isBuffer(e)||(e=s.from(e));let t=-1;for(let n=0;n<e.length;n++){const s=e[n];t=c[255&(t^s)]^t>>>8}return(-1^t)>>>0}const l=(e,t,n=[])=>{e.flags.includes("g")||(e=new RegExp(e.source,"g"));const s=e.exec(t);return s&&(n.push(s.slice(1)),l(e,t,n)),n},u=(e,t)=>{const n=e.match(/([\w.]+)(?:#([0-9a-fA-F]+))?(?:\s{?\w+:[\w\d<>#.?!]+}?)*\s=\s([\w\d<>#.?]+);$/);if(!n)throw new Error(`Cannot parse TLObject ${e}`);const o=l(/({)?(\w+):([\w\d<>#.?!]+)}?/,e),r={name:n[1],constructorId:parseInt(n[2],16),argsConfig:{},subclassOfId:d(n[3]),result:n[3],isFunction:t,namespace:void 0};if(!r.constructorId){const e="";let t;t=Object.values(r.argsConfig).length?` ${Object.keys(r.argsConfig).map((e=>e.toString())).join(" ")}`:"";const n=`${r.name}${e}${t} = ${r.result}`.replace(/(:|\?)bytes /g,"$1string ").replace(/</g," ").replace(/>|{|}/g,"").replace(/ \w+:flags\.\d+\?true/g,"");"inputMediaInvoice"===r.name&&r.name,r.constructorId=d(s.from(n,"utf8"))}for(const[e,t,n]of o)void 0===e&&(r.argsConfig[i(t)]=g(t,n));return r.name.includes(".")&&([r.namespace,r.name]=r.name.split(/\.(.+)/)),r.name=a(r.name),r};function g(e,t){e="self"===e?"is_self":e;const n={isVector:!1,isFlag:!1,skipConstructorId:!1,flagIndex:-1,flagIndicator:!0,type:void 0,useVectorId:void 0};if("#"!==t){n.flagIndicator=!1,n.type=t.replace(/^!+/,"");const e=n.type.match(/flags.(\d+)\?([\w<>.]+)/);e&&(n.isFlag=!0,n.flagIndex=Number(e[1]),[,,n.type]=e);const s=n.type.match(/[Vv]ector<([\w\d.]+)>/);s&&(n.isVector=!0,n.useVectorId="V"===n.type.charAt(0),[,n.type]=s),/^[a-z]$/.test(n.type.split(".").pop().charAt(0))&&(n.skipConstructorId=!0)}return n}e.exports={findAll:l,parseTl:function*(e,t,n=[],s=o){(n||[]).reduce(((e,t)=>({...e,[t.name]:t})),{});const a=[],i={},c={},d=e;let l=!1;for(let e of d.split("\n")){const t=e.indexOf("//");if(-1!==t&&(e=e.slice(0,t)),e=e.trim(),!e)continue;const n=e.match(/---(\w+)---/);if(n){const[,e]=n;l="functions"===e}else try{const t=u(e,l);if(s.has(t.constructorId))continue;a.push(t),t.isFunction||(c[t.result]||(c[t.result]=[]),i[t.name]=t,c[t.result].push(t))}catch(e){if(!e.toString().includes("vector#1cb5c415"))throw e}}for(const e of a)if(r.has(e.constructorId))for(const t in e.argsConfig)"string"===e.argsConfig[t].type&&(e.argsConfig[t].type="bytes");for(const e of a)yield e},buildArgConfig:g,fromLine:u,CORE_TYPES:o,serializeDate:function(e){if(!e)return s.alloc(4).fill(0);if(e instanceof Date&&(e=Math.floor((Date.now()-e.getTime())/1e3)),"number"==typeof e){const t=s.alloc(4);return t.writeInt32LE(e,0),t}throw Error(`Cannot interpret "${e}" as a date`)},serializeBytes:function(e){if(!(e instanceof s)){if("string"!=typeof e)throw Error(`Bytes or str expected, not ${e.constructor.name}`);e=s.from(e)}const t=[];let n;return e.length<254?(n=(e.length+1)%4,0!==n&&(n=4-n),t.push(s.from([e.length])),t.push(e)):(n=e.length%4,0!==n&&(n=4-n),t.push(s.from([254,e.length%256,(e.length>>8)%256,(e.length>>16)%256])),t.push(e)),t.push(s.alloc(n).fill(0)),s.concat(t)},snakeToCamelCase:a,variableSnakeToCamelCase:i}},7404:(e,t,n)=>{const s=n(7150),{serializeBytes:a,serializeDate:i}=n(1436);e.exports={constructors:s,requests:s,serializeBytes:a,serializeDate:i}},8106:e=>{e.exports="resPQ#05162463 nonce:int128 server_nonce:int128 pq:string server_public_key_fingerprints:Vector<long> = ResPQ;\np_q_inner_data#83c95aec pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 = P_Q_inner_data;\nserver_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params;\nserver_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params;\nserver_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:string g_a:string server_time:int = Server_DH_inner_data;\nclient_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data;\ndh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer;\ndh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer;\ndh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer;\ndestroy_auth_key_ok#f660e1d4 = DestroyAuthKeyRes;\ndestroy_auth_key_none#0a9f2259 = DestroyAuthKeyRes;\ndestroy_auth_key_fail#ea109b13 = DestroyAuthKeyRes;\n---functions---\nreq_pq#60469778 nonce:int128 = ResPQ;\nreq_pq_multi#be7e8ef1 nonce:int128 = ResPQ;\nreq_pq_multi_new#51b410fd nonce:int128 = ResPQ;\nreq_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params;\nset_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:string = Set_client_DH_params_answer;\ndestroy_auth_key#d1435160 = DestroyAuthKeyRes;\n---types---\nmsgs_ack#62d6b459 msg_ids:Vector<long> = MsgsAck;\nbad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int error_code:int = BadMsgNotification;\nbad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification;\nmsgs_state_req#da69fb52 msg_ids:Vector<long> = MsgsStateReq;\nmsgs_state_info#04deb57d req_msg_id:long info:string = MsgsStateInfo;\nmsgs_all_info#8cc0d131 msg_ids:Vector<long> info:string = MsgsAllInfo;\nmsg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long bytes:int status:int = MsgDetailedInfo;\nmsg_new_detailed_info#809db6df answer_msg_id:long bytes:int status:int = MsgDetailedInfo;\nmsg_resend_req#7d861a08 msg_ids:Vector<long> = MsgResendReq;\nrpc_error#2144ca19 error_code:int error_message:string = RpcError;\nfuture_salt#0949d9dc valid_since:int valid_until:int salt:long = FutureSalt;\nfuture_salts#ae500895 req_msg_id:long now:int salts:vector<future_salt> = FutureSalts;\npong#347773c5 msg_id:long ping_id:long = Pong;\ndestroy_session_ok#e22045fc session_id:long = DestroySessionRes;\ndestroy_session_none#62d350c9 session_id:long = DestroySessionRes;\nnew_session_created#9ec20908 first_msg_id:long unique_id:long server_salt:long = NewSession;\n---functions---\nping#7abe77ec ping_id:long = Pong;\nping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong;"}},s={};function a(e){var t=s[e];if(void 0!==t)return t.exports;var i=s[e]={id:e,loaded:!1,exports:{}};return n[e].call(i.exports,i,i.exports,a),i.loaded=!0,i.exports}a.m=n,a.x=()=>{var e=a.O(void 0,[592],(()=>a(6514)));return a.O(e)},e=[],a.O=(t,n,s,i)=>{if(!n){var o=1/0;for(l=0;l<e.length;l++){for(var[n,s,i]=e[l],r=!0,c=0;c<n.length;c++)(!1&i||o>=i)&&Object.keys(a.O).every((e=>a.O[e](n[c])))?n.splice(c--,1):(r=!1,i<o&&(o=i));if(r){e.splice(l--,1);var d=s();void 0!==d&&(t=d)}}return t}i=i||0;for(var l=e.length;l>0&&e[l-1][2]>i;l--)e[l]=e[l-1];e[l]=[n,s,i]},a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce(((t,n)=>(a.f[n](e,t),t)),[])),a.u=e=>e+".d7ca037ed9b7d1c6792a.js",a.miniCssF=e=>{},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");n.length&&(e=n[n.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{var e={514:1};a.f.i=(t,n)=>{e[t]||importScripts(a.p+a.u(t))};var t=self.webpackChunktelegram_t=self.webpackChunktelegram_t||[],n=t.push.bind(t);t.push=t=>{var[s,i,o]=t;for(var r in i)a.o(i,r)&&(a.m[r]=i[r]);for(o&&o(a);s.length;)e[s.pop()]=1;n(t)}})(),t=a.x,a.x=()=>a.e(592).then(t),a.x()})();
|
||
//# sourceMappingURL=514.f5e7f15467b991859ce2.js.map
|