telegram-tt/dist/f52f8cb8dd6763aaca42.worker.js
Alexander Zinchuk f8852fdf45 [Build]
2021-05-09 03:57:53 +03:00

3 lines
370 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*! For license information please see f52f8cb8dd6763aaca42.worker.js.LICENSE.txt */
!function(e){var t={};function n(s){if(t[s])return t[s].exports;var i=t[s]={i:s,l:!1,exports:{}};return e[s].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,s){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(s,i,function(t){return e[t]}.bind(null,i));return s},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=109)}([function(e,t,n){const s=n(6),i=n(81),a=n(40),r=n(20),o=n(98),c=n(99),u=n(21),l=n(27),d=n(103),f=n(33),g=n(8);e.exports={Api:s,TelegramClient:i,sessions:d,connection:a,extensions:f,tl:r,version:o,events:c,utils:u,errors:l,helpers:g}},function(e,t,n){"use strict";n.d(t,"f",(function(){return C})),n.d(t,"a",(function(){return M})),n.d(t,"b",(function(){return k})),n.d(t,"e",(function(){return E})),n.d(t,"g",(function(){return O})),n.d(t,"c",(function(){return U})),n.d(t,"i",(function(){return T})),n.d(t,"h",(function(){return B})),n.d(t,"d",(function(){return D}));var s={};n.r(s),n.d(s,"Type",(function(){return m})),n.d(s,"fetch",(function(){return y})),n.d(s,"save",(function(){return b})),n.d(s,"clear",(function(){return _}));var i=n(0),a=n(33),r=n(4),o=n(17),c=n(26),u=n(9),l=n(43),d=n(11),f=n(5),g=n(2),p=n(35);const h=self.caches;let m;async function y(e,t,n){if(h)try{const s=new Request(t),i=await h.open(e),a=await i.match(s);if(!a)return;switch(n){case m.Text:return await a.text();case m.Blob:{const e=await a.blob();if("sticker"===t.substr(0,7))return new Blob([e],{type:"image/webp"});if(!e.type){const t=a.headers.get("Content-Type");if(t)return new Blob([e],{type:t})}return e}case m.Json:return await a.json();default:return}}catch(e){return void console.warn(e)}}async function b(e,t,n){if(h)try{const s="string"==typeof n||n instanceof Blob?n:JSON.stringify(n),i=new Request(t),a=new Response(s),r=await h.open(e);return await r.put(i,a)}catch(e){return void console.warn(e)}}async function _(e){try{if(!h)return;return await h.delete(e)}catch(e){return void console.warn(e)}}async function w({url:e,mediaFormat:t,start:n,end:a},o,c,u){const{data:h,mimeType:m,fullSize:y}=await async function(e,t,n,s,a,o,c){const u=e.match(/(avatar|profile|photo|msg|stickerSet|sticker|wallpaper|gif|file)([-\d\w./]+)(\?size=\w+)?/);if(!u)return;if("file"===u[1]){const e=await fetch(u[2]);return{data:await e.arrayBuffer()}}if(!n)return Promise.reject(new Error("ERROR: Client is not connected"));let l,p=u[2];const h=u[3]?u[3].replace("?size=",""):void 0;let m;"avatar"===u[1]||"profile"===u[1]?(l=Object(g.s)(Number(p)),p=Math.abs(Number(p))):l=u[1];switch(l){case"channel":case"chat":m=f.a.chats[p];break;case"user":m=f.a.users[p];break;case"msg":m=f.a.messages[p];break;case"sticker":case"gif":case"wallpaper":m=f.a.documents[p];break;case"photo":m=f.a.photos[p];break;case"stickerSet":m=f.a.stickerSets[p]}if(!m)return;if(["msg","sticker","gif","wallpaper","photo"].includes(l)){c===d.ApiMediaFormat.Stream&&(s.acceptsBuffer=!0);const e=await t.downloadMedia(m,{sizeType:h,start:a,end:o,progressCallback:s,workers:r.j});let n,u;return m instanceof i.Api.Message?(n=function(e,t){if(!e||!e.media)return;if(e.media instanceof i.Api.MessageMediaPhoto)return"image/jpeg";if(e.media instanceof i.Api.MessageMediaDocument&&e.media.document instanceof i.Api.Document)return t?e.media.document.attributes.some(e=>e instanceof i.Api.DocumentAttributeSticker)?"image/webp":"image/jpeg":e.media.document.mimeType;return}(m,h),m.media instanceof i.Api.MessageMediaDocument&&m.media.document instanceof i.Api.Document&&(u=m.media.document.size)):m instanceof i.Api.Photo?n="image/jpeg":"sticker"===l&&h?n="image/webp":(n=m.mimeType,u=m.size),{mimeType:n,data:e,fullSize:u}}if("stickerSet"===l){const e=await t.downloadStickerSetThumb(m);return{mimeType:c===d.ApiMediaFormat.Lottie?"application/json":"image/jpeg",data:e}}{const e=await t.downloadProfilePhoto(m,"profile"===u[1]);return{mimeType:"image/jpeg",data:e}}}(e,o,c,u,n,a,t)||{};if(!h)return;const _=await async function(e,t,n){switch(t){case d.ApiMediaFormat.DataUri:return Object(p.a)(new Blob([e],{type:n}));case d.ApiMediaFormat.BlobUrl:return new Blob([e],{type:n});case d.ApiMediaFormat.Lottie:{const t=Object(l.inflate)(e,{to:"string"});return JSON.parse(t)}case d.ApiMediaFormat.Progressive:return e.buffer}return}(h,t,m);if(!_)return;const w=t!==d.ApiMediaFormat.Progressive&&(t!==d.ApiMediaFormat.BlobUrl||_.size<=r.n);if(!r.m&&s&&w){b(e.startsWith("avatar")?r.p:r.o,e,_)}return{prepared:t===d.ApiMediaFormat.Progressive?"":function(e){if(e instanceof Blob)return URL.createObjectURL(e);return e}(_),arrayBuffer:t===d.ApiMediaFormat.Progressive?_:void 0,mimeType:m,fullSize:y}}!function(e){e[e.Text=0]="Text",e[e.Blob=1]="Blob",e[e.Json=2]="Json"}(m||(m={}));var v=n(13);a.Logger.setLevel(r.g?"debug":"warn");const A={build:e=>e};let I,P,S=!1;async function C(e,t){I=t,r.f&&console.log(">>> START INIT API");const n=r.k?new i.sessions.LocalStorageSession(e):new i.sessions.IdbSession(e);P=new i.TelegramClient(n,"739222","60d1e1063c72d4bc4cfdda99e8906f94",{useWSS:!0,additionalDcsDisabled:r.k}),P.addEventHandler(R,A),P.addEventHandler(c.b,A);try{r.f&&console.log("[GramJs/client] CONNECTING"),await P.start({phoneNumber:o.g,phoneCode:o.e,password:o.f,firstAndLastNames:o.i,qrCode:o.h,onError:o.b});const e=await n.save();r.f&&(console.log(">>> FINISH INIT API"),console.log("[GramJs/client] CONNECTED as ",e)),Object(o.c)(e),I({"@type":"updateApiReady"}),D()}catch(e){throw r.f&&console.log("[GramJs/client] CONNECTING ERROR",e),e}}async function M(){await O(new i.Api.auth.LogOut),await P.destroy()}async function k(){await P.disconnect()}function E(){return P}function R(e){e instanceof i.connection.UpdateConnectionState?S=e.state===i.connection.UpdateConnectionState.connected:e instanceof i.Api.UpdatesTooLong&&async function(){try{await O(new i.Api.users.GetFullUser({id:new i.Api.InputUserSelf}),void 0,!0)}catch(e){"AUTH_KEY_UNREGISTERED"===e.message&&I({"@type":"updateConnectionState",connectionState:"connectionStateBroken"})}}()}async function O(e,t=!1,n=!1){if(S)try{r.f&&console.log("[GramJs/client] INVOKE "+e.className);const n=await P.invoke(e);if(r.f&&console.log("[GramJs/client] INVOKE RESPONSE "+e.className,n),t){let t;n instanceof i.Api.Updates||n instanceof i.Api.UpdatesCombined?t=n:"updates"in n&&(n.updates instanceof i.Api.Updates||n.updates instanceof i.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=>{Object(c.b)(t,e)})):n instanceof i.Api.UpdatesTooLong||Object(c.b)(n,e)}return n}catch(t){if(r.f&&(console.log("[GramJs/client] INVOKE ERROR "+e.className),console.error(t)),function(e,t){const n=e.message.startsWith("A wait of")&&(t instanceof i.Api.messages.SendMessage||t instanceof i.Api.messages.SendMedia||t instanceof i.Api.messages.SendMultiMedia),{message:s}=e;I({"@type":"error",error:{message:s,isSlowMode:n}})}(t,e),n)throw t;return}else r.f&&console.warn(`[GramJs/client] INVOKE ${e.className} ERROR: Client is not connected`)}function U(e,t){return w(e,P,S,t)}function T(e,t){return P.uploadFile({file:e,onProgress:t,workers:r.v})}function B(e){return P.updateTwoFaSettings(e)}async function D(){const e=await O(new i.Api.users.GetFullUser({id:new i.Api.InputUserSelf}));if(!(e&&e.user instanceof i.Api.User))return;f.a.users[e.user.id]=e.user;const t=Object(v.b)(e);Object(u.o)(t.id),Object(o.d)(t)}},function(e,t,n){"use strict";(function(e){n.d(t,"s",(function(){return l})),n.d(t,"o",(function(){return d})),n.d(t,"i",(function(){return f})),n.d(t,"g",(function(){return p})),n.d(t,"l",(function(){return h})),n.d(t,"f",(function(){return m})),n.d(t,"h",(function(){return y})),n.d(t,"j",(function(){return b})),n.d(t,"d",(function(){return _})),n.d(t,"r",(function(){return w})),n.d(t,"m",(function(){return v})),n.d(t,"n",(function(){return A})),n.d(t,"q",(function(){return I})),n.d(t,"t",(function(){return P})),n.d(t,"u",(function(){return S})),n.d(t,"c",(function(){return C})),n.d(t,"e",(function(){return M})),n.d(t,"b",(function(){return k})),n.d(t,"a",(function(){return E})),n.d(t,"p",(function(){return R})),n.d(t,"k",(function(){return O}));var s=n(15),i=n.n(s),a=n(0),r=n(8),o=n(11),c=n(5),u=n(14);function l(e){return e>0?"user":e<=-1e9?"channel":"chat"}function d(e){return e>0?new a.Api.PeerUser({userId:e}):e<=-1e9?new a.Api.PeerChannel({channelId:-e}):new a.Api.PeerChat({chatId:-e})}function f(e,t){return e>0||e<=-1e9?e>0?new a.Api.InputPeerUser({userId:e,accessHash:i()(t)}):new a.Api.InputPeerChannel({channelId:-e,accessHash:i()(t)}):new a.Api.InputPeerChat({chatId:-e})}function g(e){if(e>0){const{accessHash:t}=c.a.users[e]||{};return t?new a.Api.InputPeerUser({userId:e,accessHash:t}):void 0}if(e<=-1e9){const{accessHash:t}=c.a.chats[-e]||{};return t?new a.Api.InputPeerChannel({channelId:-e,accessHash:t}):void 0}return new a.Api.InputPeerChat({chatId:-e})}function p(e,t){return e>0?new a.Api.InputUser({userId:e,accessHash:i()(t)}):e<=-1e9?new a.Api.InputChannel({channelId:-e,accessHash:i()(t)}):-e}function h(e,t){return new a.Api.InputStickerSetID({id:i()(e),accessHash:i()(t)})}function m(e){const t=c.a.documents[e.id];if(t)return new a.Api.InputDocument(Object(u.b)(t,["id","accessHash","fileReference"]))}function y(e){const t=m(e);if(t)return new a.Api.InputMediaDocument({id:t})}function b(t,n){const{summary:s,quiz:i}=t,r=new a.Api.Poll({id:n,publicVoters:s.isPublic,question:s.question,answers:s.answers.map(({text:t,option:n})=>new a.Api.PollAnswer({text:t,option:e.from(n)})),quiz:s.quiz,multipleChoice:s.multipleChoice});if(!i)return new a.Api.InputMediaPoll({poll:r});const o=i.correctAnswers.map(t=>e.from(t)),{solution:c}=i,u=i.solutionEntities?i.solutionEntities.map(A):[];return new a.Api.InputMediaPoll({poll:r,correctAnswers:o,...c&&{solution:c,solutionEntities:u}})}function _(e){const{emoticon:t,contacts:n,nonContacts:s,groups:i,channels:r,bots:o,excludeArchived:c,excludeMuted:u,excludeRead:l,pinnedChatIds:d,includedChatIds:f,excludedChatIds:p}=e,h=d?d.map(g).filter(Boolean):[],m=f?f.map(g).filter(Boolean):[],y=p?p.map(g).filter(Boolean):[];return new a.Api.DialogFilter({id:e.id,title:e.title,emoticon:t||void 0,contacts:n||void 0,nonContacts:s||void 0,groups:i||void 0,bots:o||void 0,excludeArchived:c||void 0,excludeMuted:u||void 0,excludeRead:l||void 0,broadcasts:r||void 0,pinnedPeers:h,includePeers:m,excludePeers:y})}function w(){return Object(r.readBigIntFromBuffer)(Object(r.generateRandomBytes)(8),!0,!0)}function v(e,t,n){return new a.Api.Message({id:e,peerId:d(t),fromId:d(t),media:n.media})}function A(e){const{type:t,offset:n,length:s,url:i,userId:r}=e,u=r?c.a.users[r]:void 0;switch(t){case o.ApiMessageEntityTypes.Bold:return new a.Api.MessageEntityBold({offset:n,length:s});case o.ApiMessageEntityTypes.Italic:return new a.Api.MessageEntityItalic({offset:n,length:s});case o.ApiMessageEntityTypes.Underline:return new a.Api.MessageEntityUnderline({offset:n,length:s});case o.ApiMessageEntityTypes.Strike:return new a.Api.MessageEntityStrike({offset:n,length:s});case o.ApiMessageEntityTypes.Code:return new a.Api.MessageEntityCode({offset:n,length:s});case o.ApiMessageEntityTypes.Pre:return new a.Api.MessageEntityPre({offset:n,length:s,language:""});case o.ApiMessageEntityTypes.Blockquote:return new a.Api.MessageEntityBlockquote({offset:n,length:s});case o.ApiMessageEntityTypes.TextUrl:return new a.Api.MessageEntityTextUrl({offset:n,length:s,url:i});case o.ApiMessageEntityTypes.Url:return new a.Api.MessageEntityUrl({offset:n,length:s});case o.ApiMessageEntityTypes.Hashtag:return new a.Api.MessageEntityHashtag({offset:n,length:s});case o.ApiMessageEntityTypes.MentionName:return new a.Api.InputMessageEntityMentionName({offset:n,length:s,userId:new a.Api.InputUser({userId:r,accessHash:u.accessHash})});default:return new a.Api.MessageEntityUnknown({offset:n,length:s})}}function I(e){let t=0;return e.forEach(e=>{t=(20261*t&2147483647)+e&2147483647}),t}function P(e){const{media:t}=e;return!!t&&(t instanceof a.Api.MessageMediaPhoto||t instanceof a.Api.MessageMediaDocument||t instanceof a.Api.MessageMediaWebPage&&t.webpage instanceof a.Api.WebPage&&t.webpage.photo instanceof a.Api.Photo)}function S(e){return"photo"in e.action&&e.action.photo instanceof a.Api.Photo}function C(e){if(e instanceof a.Api.PhotoEmpty)return new a.Api.ChatPhotoEmpty;const{dcId:t}=e,n=e.sizes.filter(e=>e instanceof a.Api.PhotoSize||e instanceof a.Api.PhotoCachedSize);if(!n.length)return new a.Api.ChatPhotoEmpty;const s=n.find(e=>"a"===e.type),i=n.find(e=>"c"===e.type)||n.find(e=>"b"===e.type);return s&&i?new a.Api.ChatPhoto({dcId:t,photoSmall:s&&s.location,photoBig:i&&i.location}):new a.Api.ChatPhotoEmpty}function M({phone:e,firstName:t,lastName:n}){return new a.Api.InputPhoneContact({clientId:i()(1),phone:e,firstName:t,lastName:n})}function k(e,t=0){return new a.Api.ChatBannedRights({...e,untilDate:t})}function E(e){return new a.Api.ChatAdminRights(e)}function R(e){const{shippingAddress:t}=e;return new a.Api.PaymentRequestedInfo({...e,shippingAddress:t?new a.Api.PostAddress(t):void 0})}function O(e){switch(e){case"phoneNumber":return new a.Api.InputPrivacyKeyPhoneNumber;case"lastSeen":return new a.Api.InputPrivacyKeyStatusTimestamp;case"profilePhoto":return new a.Api.InputPrivacyKeyProfilePhoto;case"forwards":return new a.Api.InputPrivacyKeyForwards;case"chatInvite":return new a.Api.InputPrivacyKeyChatInvite}}}).call(this,n(12).Buffer)},function(e,t,n){"use strict";n.d(t,"c",(function(){return u})),n.d(t,"d",(function(){return p})),n.d(t,"k",(function(){return h})),n.d(t,"j",(function(){return m})),n.d(t,"l",(function(){return b})),n.d(t,"e",(function(){return v})),n.d(t,"g",(function(){return A})),n.d(t,"h",(function(){return I})),n.d(t,"f",(function(){return P})),n.d(t,"i",(function(){return S})),n.d(t,"a",(function(){return C})),n.d(t,"b",(function(){return M}));var s=n(0),i=n(14);function a(e){return e.hasOwnProperty("userId")}function r(e){return e.hasOwnProperty("chatId")}var o=n(18);function c(e,t=!1){const n=Boolean("min"in e&&e.min),i="accessHash"in e&&String(e.accessHash),a="photo"in e&&v(e.photo),r=Boolean("signatures"in e&&e.signatures);return{isMin:n,hasPrivateLink:Boolean("hasLink"in e&&e.hasLink),isSignaturesShown:r,...i&&{accessHash:i},...a&&{avatarHash:a},...(e instanceof s.Api.Channel||e instanceof s.Api.User)&&{username:e.username},..."verified"in e&&{isVerified:e.verified},...(e instanceof s.Api.Chat||e instanceof s.Api.Channel)&&{...e.participantsCount&&{membersCount:e.participantsCount},joinDate:e.date},...t&&{isSupport:!0},...l(e),..."creator"in e&&{isCreator:e.creator},...d(e),...f(e)}}function u(e,t){const{peer:n,folderId:s,unreadMark:i,unreadCount:a,unreadMentionsCount:r,notifySettings:{silent:o,muteUntil:u},readOutboxMaxId:l,readInboxMaxId:d}=e,f=o||"number"==typeof u&&Date.now()<1e3*u;return{id:h(n),...s&&{folderId:s},type:y(t),title:_(n,t),lastReadOutboxMessageId:l,lastReadInboxMessageId:d,unreadCount:a,unreadMentionsCount:r,isMuted:f,...i&&{hasUnreadMark:!0},...c(t)}}function l(e){return e instanceof s.Api.Chat||e instanceof s.Api.Channel?{adminRights:Object(o.b)(e.adminRights),currentUserBannedRights:e instanceof s.Api.Channel?Object(o.b)(e.bannedRights):void 0,defaultBannedRights:Object(o.b)(e.defaultBannedRights)}:{}}function d(e){if(e instanceof s.Api.ChatForbidden||e instanceof s.Api.ChannelForbidden)return{isRestricted:!0};if(e instanceof s.Api.User)return{isRestricted:e.restricted,restrictionReason:g(e.restrictionReason)};if(e instanceof s.Api.Chat)return{isNotJoined:e.left,isRestricted:e.kicked};if(e instanceof s.Api.Channel){const t=e.restricted&&e.restrictionReason&&e.restrictionReason.some(e=>"all"===e.platform);return{isNotJoined:e.left,isRestricted:t,restrictionReason:g(e.restrictionReason)}}return{}}function f(e){return e instanceof s.Api.Chat&&e.migratedTo&&!(e.migratedTo instanceof s.Api.InputChannelEmpty)?{migratedTo:{chatId:h(e.migratedTo),...e.migratedTo instanceof s.Api.InputChannel&&{accessHash:e.migratedTo.accessHash.toString()}}}:{}}function g(e){if(!e)return;const t=e.find(({platform:e})=>"all"===e);return t?Object(i.b)(t,["reason","text"]):void 0}function p(e,t=!1,n=!1){if(e instanceof s.Api.Chat||e instanceof s.Api.Channel||e instanceof s.Api.User||n&&(e instanceof s.Api.ChatForbidden||e instanceof s.Api.ChannelForbidden))return{id:e instanceof s.Api.User?e.id:-e.id,type:y(e),title:e instanceof s.Api.User?w(e):e.title,...c(e,t)}}function h(e){return a(e)?e.userId:r(e)?-e.chatId:-e.channelId}function m(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 y(e){return e instanceof s.Api.User||e instanceof s.Api.UserEmpty?"chatTypePrivate":e instanceof s.Api.Chat||e instanceof s.Api.ChatForbidden||e instanceof s.Api.ChatEmpty?"chatTypeBasicGroup":e.megagroup?"chatTypeSuperGroup":"chatTypeChannel"}function b(e){return a(e)?"user"+e.userId:r(e)?"chat"+e.chatId:"chat"+e.channelId}function _(e,t){return a(e)?w(t):t.title}function w(e){return e.firstName?`${e.firstName}${e.lastName?" "+e.lastName:""}`:e.lastName||void 0}function v(e){if(e instanceof s.Api.UserProfilePhoto)return e.photoId.toString();if(e instanceof s.Api.ChatPhoto){const{dcId:t,photoSmall:{volumeId:n,localId:s}}=e;return`${t}-${n}-${s}`}}function A(e){return{userId: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?Object(o.b)(e.bannedRights):void 0,adminRights:"adminRights"in e?Object(o.b)(e.adminRights):void 0,customTitle:"rank"in e?e.rank:void 0,...(e instanceof s.Api.ChannelParticipantAdmin||e instanceof s.Api.ChatParticipantAdmin)&&{isAdmin:!0},...(e instanceof s.Api.ChannelParticipantCreator||e instanceof s.Api.ChatParticipantCreator)&&{isOwner:!0}}}function I(e){return e instanceof s.Api.ChatParticipants||e instanceof s.Api.channels.ChannelParticipants?e.participants.map(A):void 0}function P(e){return e instanceof s.Api.ChatInviteExported?e.link:void 0}function S(e){let t="";if(!(e.action instanceof s.Api.SendMessageCancelAction))return e.action instanceof s.Api.SendMessageTypingAction?t="typing":e.action instanceof s.Api.SendMessageRecordVideoAction?t="recording a video":e.action instanceof s.Api.SendMessageUploadVideoAction?t="uploading a video":e.action instanceof s.Api.SendMessageRecordAudioAction?t="recording a voice message":e.action instanceof s.Api.SendMessageUploadAudioAction?t="uploading a voice message":e.action instanceof s.Api.SendMessageUploadPhotoAction?t="uploading a photo":e.action instanceof s.Api.SendMessageUploadDocumentAction?t="uploading a file":e.action instanceof s.Api.SendMessageGeoLocationAction?t="selecting a location to share":e.action instanceof s.Api.SendMessageChooseContactAction?t="selecting a contact to share":e.action instanceof s.Api.SendMessageGamePlayAction?t="playing a game":e.action instanceof s.Api.SendMessageRecordRoundAction?t="recording a round video":e.action instanceof s.Api.SendMessageUploadRoundAction&&(t="uploading a round video"),{action:t,...e instanceof s.Api.UpdateChatUserTyping&&{userId:e.userId},...e instanceof s.Api.UpdateChannelUserTyping&&{userId:e.userId},timestamp:Date.now()}}function C(e){return{...Object(i.c)(e,["id","title","emoticon","contacts","nonContacts","groups","bots","excludeMuted","excludeRead","excludeArchived"]),channels:e.broadcasts,pinnedChatIds:e.pinnedPeers.map(m).filter(Boolean),includedChatIds:e.includePeers.map(m).filter(Boolean),excludedChatIds:e.excludePeers.map(m).filter(Boolean)}}function M({filter:e,description:t}){return{...C(e),description:t}}},function(e,t,n){"use strict";n.d(t,"f",(function(){return s})),n.d(t,"k",(function(){return i})),n.d(t,"g",(function(){return a})),n.d(t,"m",(function(){return r})),n.d(t,"o",(function(){return o})),n.d(t,"p",(function(){return c})),n.d(t,"n",(function(){return u})),n.d(t,"c",(function(){return l})),n.d(t,"b",(function(){return d})),n.d(t,"j",(function(){return f})),n.d(t,"v",(function(){return g})),n.d(t,"q",(function(){return p})),n.d(t,"s",(function(){return h})),n.d(t,"e",(function(){return m})),n.d(t,"t",(function(){return y})),n.d(t,"l",(function(){return b})),n.d(t,"r",(function(){return _})),n.d(t,"u",(function(){return w})),n.d(t,"a",(function(){return v})),n.d(t,"d",(function(){return A})),n.d(t,"i",(function(){return I})),n.d(t,"h",(function(){return P}));const s=!1,i=!1,a=!1,r=!1,o="tt-media",c="tt-media-avatars",u=524288,l=300,d=new Set(["newMessage","newScheduledMessage","deleteMessages","deleteScheduledMessages","deleteHistory"]),f=16,g=16,p=("undefined"!=typeof window&&window.innerHeight,200),h=50,m=100,y=40,b=1e9,_="MEMOJI_STICKER",w=777e3,v=0,A=1,I=777,P="android"},function(e,t,n){"use strict";t.a={localMessages:{},chats:{},users:{},messages:{},documents:{},stickerSets:{},photos:{}}},function(e,t,n){(function(t){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{parseTl:i,serializeBytes:a,serializeDate:r}=n(45),{readBufferFromBigInt:o,toSignedLittleBuffer:c}=n(8),u=n(79),l=n(80),d="undefined"!=typeof self&&void 0!==self.localStorage;function f(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 g(e,n){switch(n){case"int":const n=t.alloc(4);return n.writeInt32LE(e,0),n;case"long":return c(e,8);case"int128":return c(e,16);case"int256":return c(e,32);case"double":const s=t.alloc(8);return s.writeDoubleLE(e,0),s;case"string":return a(e);case"Bool":return e?t.from("b5757299","hex"):t.from("379779bc","hex");case"true":return t.alloc(0);case"bytes":return a(e);case"date":return r(e);default:return e.getBytes()}}function p(e,t){if(t.isVector){t.useVectorId&&e.readInt();const n=[],s=e.readInt();t.isVector=!1;for(let i=0;i<s;i++)n.push(p(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:return t.skipConstructorId?api.constructors[t.type].fromReader(e):e.tgReadObject()}}function h(e,n){const i={};for(const a of n){const{name:n,constructorId:r,subclassOfId:o,argsConfig:c,namespace:u,result:l}=a,d=[u,n].join(".").replace(/^\./,"");class f{constructor(t){s(this,"CONSTRUCTOR_ID",r),s(this,"SUBCLASS_OF_ID",o),s(this,"className",d),s(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]=p(e,s):t[n]=null}else s.flagIndicator&&(s.name="flags"),t[n]=p(e,s)}return new f(t)}getBytes(){const e=this.CONSTRUCTOR_ID,n=t.alloc(4);n.writeUInt32LE(e,0);const s=[n];for(const e in c)if(c.hasOwnProperty(e)){if(c[e].isFlag&&(!1===this[e]&&"true"===c[e].type||null===this[e]||void 0===this[e]))continue;if(c[e].isVector){c[e].useVectorId&&s.push(t.from("15c4b51c","hex"));const n=t.alloc(4);n.writeInt32LE(this[e].length,0),s.push(n,t.concat(this[e].map(t=>g(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]||null===this[t]?e|=0:e|=1<<c[t].flagIndex);const n=t.alloc(4);n.writeUInt32LE(e,0),s.push(n)}else s.push(t.alloc(4));else if(s.push(g(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||s.shift()}}return t.concat(s)}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()}}s(f,"CONSTRUCTOR_ID",r),s(f,"SUBCLASS_OF_ID",o),s(f,"className",d),s(f,"classType",e),u?(i[u]||(i[u]={}),i[u][n]=f):i[n]=f}return i}e.exports=function(){let e;const t=d&&function(){const e=localStorage.getItem("GramJs:apiCache");return e&&JSON.parse(e)}();return t?e=t:(e=function(){const[e,t]=f(u),[n,s]=f(l),i=[].concat(e,n),a=[].concat(t,s);return{constructors:i,requests:a}}(),d&&localStorage.setItem("GramJs:apiCache",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}(h("constructor",e.constructors),h("request",e.requests))}()}).call(this,n(12).Buffer)},function(e,t,n){"use strict";n.d(t,"p",(function(){return p})),n.d(t,"j",(function(){return h})),n.d(t,"k",(function(){return m})),n.d(t,"w",(function(){return y})),n.d(t,"h",(function(){return b})),n.d(t,"u",(function(){return _})),n.d(t,"v",(function(){return w})),n.d(t,"a",(function(){return v})),n.d(t,"H",(function(){return A})),n.d(t,"b",(function(){return I})),n.d(t,"q",(function(){return P})),n.d(t,"r",(function(){return S})),n.d(t,"d",(function(){return C})),n.d(t,"c",(function(){return M})),n.d(t,"g",(function(){return k})),n.d(t,"z",(function(){return E})),n.d(t,"y",(function(){return R})),n.d(t,"i",(function(){return O})),n.d(t,"n",(function(){return U})),n.d(t,"f",(function(){return T})),n.d(t,"e",(function(){return B})),n.d(t,"A",(function(){return D})),n.d(t,"o",(function(){return x})),n.d(t,"B",(function(){return j})),n.d(t,"F",(function(){return N})),n.d(t,"G",(function(){return F})),n.d(t,"E",(function(){return V})),n.d(t,"I",(function(){return L})),n.d(t,"D",(function(){return q})),n.d(t,"C",(function(){return H})),n.d(t,"m",(function(){return z})),n.d(t,"l",(function(){return K})),n.d(t,"x",(function(){return G})),n.d(t,"s",(function(){return W})),n.d(t,"t",(function(){return $}));var s=n(0),i=n(4),a=n(1),r=n(3),o=n(9),c=n(13),u=n(14),l=n(5),d=n(2),f=n(16);let g;function p(e){g=e}async function h({limit:e,offsetDate:t,archived:n,withPinned:l}){const d=await Object(a.g)(new s.Api.messages.GetDialogs({offsetPeer:new s.Api.InputPeerEmpty,limit:e,offsetDate:t,folderId:n?i.d:void 0,...l&&{excludePinned:!0}})),f=l?await Object(a.g)(new s.Api.messages.GetPinnedDialogs({folderId:n?i.d:void 0})):void 0;if(!d||d instanceof s.Api.messages.DialogsNotModified)return;Z(d),f&&Z(f);const g=Object(u.a)([...d.messages,...f?f.messages:[]].map(o.b).filter(Boolean),"chatId"),p={...J(d),...f&&J(f)},h=[],m={},y={},b=[...f?f.dialogs:[],...d.dialogs],_=[];b.forEach(e=>{if(!(e instanceof s.Api.Dialog)||!n&&e.folderId===i.d||n&&e.folderId!==i.d)return;const t=p[Object(r.l)(e.peer)],a=Object(r.c)(e,t);if(a.lastMessage=g[a.id],h.push(a),l&&e.pinned&&_.push(a.id),e.draft){const{formattedText:t,replyingToId:n}=Object(o.h)(e.draft)||{};t&&(m[a.id]=t),n&&(y[a.id]=n)}});const w=[...d.users,...f?f.users:[]].map(c.a).filter(Boolean),v=h.map(e=>e.id);let A;return A=d instanceof s.Api.messages.DialogsSlice?d.count:v.length,{chatIds:v,chats:h,users:w,draftsById:m,replyingToById:y,orderedPinnedIds:l?_:void 0,totalChatCount:A}}function m(e){const{id:t,accessHash:n,adminRights:i}=e;return Object(d.g)(t,n)instanceof s.Api.InputChannel?async function(e,t,n){const i=await Object(a.g)(new s.Api.channels.GetFullChannel({channel:Object(d.g)(e,t)}));if(!(i&&i.fullChat instanceof s.Api.ChannelFull))return;const{about:o,onlineCount:c,exportedInvite:u,slowmodeSeconds:l,slowmodeNextSendDate:f,migratedFromChatId:g,migratedFromMaxId:p,canViewParticipants:h,linkedChatId:m,hiddenPrehistory:y}=i.fullChat,b=u instanceof s.Api.ChatInviteExported?u.link:void 0,{members:_,users:w}=h&&await z(e,t)||{},{members:v,users:A}=h&&n&&await z(e,t,"kicked")||{},{members:I,users:P}=h&&n&&await z(e,t,"admin")||{};return{fullInfo:{about:o,onlineCount:c,inviteLink:b,slowMode:l?{seconds:l,nextSendDate:f}:void 0,migratedFrom:g?{chatId:Object(r.k)({chatId:g}),maxMessageId:p}:void 0,canViewMembers:h,isPreHistoryHidden:y,members:_,kickedMembers:v,adminMembers:I,linkedChatId:m?Object(r.k)({chatId:m}):void 0},users:[...w||[],...A||[],...P||[]]}}(t,n,i):async function(e){const t=await Object(a.g)(new s.Api.messages.GetFullChat({chatId:Object(d.g)(e)}));if(!(t&&t.fullChat instanceof s.Api.ChatFull))return;Z(t);const{about:n,participants:i,exportedInvite:o}=t.fullChat,u=Object(r.h)(i),l=u?u.filter(({isAdmin:e,isOwner:t})=>e||t):void 0;return{fullInfo:{about:n,members:u,adminMembers:l,inviteLink:Object(r.f)(o),canViewMembers:!0},users:t.users.map(c.a).filter(Boolean)}}(t)}async function y({query:e}){const t=await Object(a.g)(new s.Api.contacts.Search({q:e}));if(!t)return;Z(t);const n=t.myResults.map(r.k),i=[...t.chats,...t.users].map(e=>Object(r.d)(e)).filter(Boolean),o=t.users.map(c.a).filter(e=>!!e&&!e.isSelf);return{localChats:i.filter(e=>n.includes(e.id)),localUsers:o.filter(e=>n.includes(e.id)),globalChats:i.filter(e=>!n.includes(e.id)),globalUsers:o.filter(e=>!n.includes(e.id))}}async function b({type:e,user:t}){let n;if("self"===e||"user"===e){const i=await Object(a.g)(new s.Api.users.GetUsers({id:["user"===e&&t?Object(d.g)(t.id,t.accessHash):new s.Api.InputUserSelf]}));if(!i||!i.length)return;[n]=i}else if("support"===e){const e=await Object(a.g)(new s.Api.help.GetSupport);if(!e||!e.user)return;n=e.user}const i=Object(r.d)(n,"support"===e);if(i)return g({"@type":"updateChat",id:i.id,chat:i}),{chatId:i.id}}async function _(e){const{id:t,accessHash:n}=e,i=await Object(a.g)(new s.Api.messages.GetPeerDialogs({peers:[new s.Api.InputDialogPeer({peer:Object(d.i)(t,n)})]}));if(!i)return;const c=i.dialogs[0];if(!(c&&c instanceof s.Api.Dialog))return;const u=J(i)[Object(r.l)(c.peer)];if(!u)return;Z(i);const l=Object(o.b)(i.messages[0]);g({"@type":"updateChat",id:t,chat:{...Object(r.c)(c,u),lastMessage:l}})}function w({chat:e,text:t,entities:n,replyToMsgId:i}){return Object(a.g)(new s.Api.messages.SaveDraft({peer:Object(d.i)(e.id,e.accessHash),message:t,...n&&{entities:n.map(d.n)},replyToMsgId:i}))}function v(e){return Object(a.g)(new s.Api.messages.SaveDraft({peer:Object(d.i)(e.id,e.accessHash),message:""}))}async function A({chat:e,isMuted:t}){await Object(a.g)(new s.Api.account.UpdateNotifySettings({peer:new s.Api.InputNotifyPeer({peer:Object(d.i)(e.id,e.accessHash)}),settings:new s.Api.InputPeerNotifySettings({muteUntil:t?2**31-1:void 0})})),_(e)}async function I({title:e,about:t,users:n}){const o=await Object(a.g)(new s.Api.channels.CreateChannel({broadcast:!0,title:e,about:t}),!0);if(!(o instanceof s.Api.Updates))return void(i.f&&console.error("Unexpected channel creation update",o));const c=o.chats[0];if(!(c&&c instanceof s.Api.Channel))return void(i.f&&console.error("Created channel not found",o));const u=Object(r.d)(c);return await Object(a.g)(new s.Api.channels.InviteToChannel({channel:Object(d.g)(u.id,u.accessHash),users:n.map(({id:e,accessHash:t})=>Object(d.g)(e,t))})),u}function P({channelId:e,accessHash:t}){return Object(a.g)(new s.Api.channels.JoinChannel({channel:Object(d.g)(e,t)}),!0)}function S({channelId:e,accessHash:t}){return Object(a.g)(new s.Api.channels.LeaveChannel({channel:Object(d.g)(e,t)}),!0)}function C({channelId:e,accessHash:t}){return Object(a.g)(new s.Api.channels.DeleteChannel({channel:Object(d.g)(e,t)}),!0)}async function M({title:e,users:t}){const n=await Object(a.g)(new s.Api.messages.CreateChat({title:e,users:t.map(({id:e,accessHash:t})=>Object(d.g)(e,t))}),!0);if(!(n instanceof s.Api.Updates))return void(i.f&&console.error("Unexpected chat creation update",n));const o=n.chats[0];if(o&&o instanceof s.Api.Chat)return Object(r.d)(o);i.f&&console.error("Created chat not found",n)}async function k({chatId:e,accessHash:t,photo:n}){const i=await Object(a.i)(n),r=Object(d.g)(e,t);return Object(a.g)(r instanceof s.Api.InputChannel?new s.Api.channels.EditPhoto({channel:r,photo:new s.Api.InputChatUploadedPhoto({file:i})}):new s.Api.messages.EditChatPhoto({chatId:r,photo:new s.Api.InputChatUploadedPhoto({file:i})}),!0)}async function E({chat:e,shouldBePinned:t}){const{id:n,accessHash:i}=e;await Object(a.g)(new s.Api.messages.ToggleDialogPin({peer:new s.Api.InputDialogPeer({peer:Object(d.i)(n,i)}),pinned:t||void 0}))&&g({"@type":"updateChatPinned",id:e.id,isPinned:t})}function R({chat:e,folderId:t}){const{id:n,accessHash:i}=e;return Object(a.g)(new s.Api.folders.EditPeerFolders({folderPeers:[new s.Api.InputFolderPeer({peer:Object(d.i)(n,i),folderId:t})]}),!0)}async function O(){const e=await Object(a.g)(new s.Api.messages.GetDialogFilters);if(e)return{byId:Object(u.a)(e.map(r.a),"id"),orderedIds:e.map(({id:e})=>e)}}async function U(){const e=await Object(a.g)(new s.Api.messages.GetSuggestedDialogFilters);if(e)return e.map(r.b)}async function T({id:e,folderUpdate:t}){const n=Object(d.d)(t);await Object(a.g)(new s.Api.messages.UpdateDialogFilter({id:e,filter:n}))&&g({"@type":"updateChatFolder",id:e,folder:t})}async function B(e){const t=await Object(a.g)(new s.Api.messages.UpdateDialogFilter({id:e,filter:void 0})),n=await U();t&&g({"@type":"updateChatFolder",id:e,folder:void 0}),n&&g({"@type":"updateRecommendedChatFolders",folders:n})}async function D({chat:e,hasUnreadMark:t}){const{id:n,accessHash:i}=e;await Object(a.g)(new s.Api.messages.MarkDialogUnread({peer:new s.Api.InputDialogPeer({peer:Object(d.i)(n,i)}),unread:t||void 0}))&&g({"@type":"updateChat",id:e.id,chat:{hasUnreadMark:t}})}async function x(e){const t=await Object(a.g)(new s.Api.contacts.ResolveUsername({username:e}));if(!t)return;const{users:n,chats:i}=t,o=i.length?Object(r.d)(i[0]):Object(r.d)(n[0]);return o?(Z(t),o):void 0}function j({chat:e,isEnabled:t}){const{id:n,accessHash:i}=e,r=Object(d.g)(n,i);return Object(a.g)(new s.Api.channels.TogglePreHistoryHidden({channel:r,enabled:t}),!0)}function N({chat:e,bannedRights:t}){const{id:n,accessHash:i}=e,r=Object(d.i)(n,i);return Object(a.g)(new s.Api.messages.EditChatDefaultBannedRights({peer:r,bannedRights:Object(d.b)(t)}),!0)}function F({chat:e,user:t,bannedRights:n}){const i=Object(d.g)(e.id,e.accessHash),r=Object(d.g)(t.id,t.accessHash);return Object(a.g)(new s.Api.channels.EditBanned({channel:i,userId:r,bannedRights:Object(d.b)(n)}),!0)}function V({chat:e,user:t,adminRights:n,customTitle:i=""}){const r=Object(d.g)(e.id,e.accessHash),o=Object(d.g)(t.id,t.accessHash);return Object(a.g)(new s.Api.channels.EditAdmin({channel:r,userId:o,adminRights:Object(d.a)(n),rank:i}),!0)}async function L(e,t){const n=Object(d.g)(e.id,e.accessHash);await Object(a.g)(n instanceof s.Api.InputChannel?new s.Api.channels.EditTitle({channel:n,title:t}):new s.Api.messages.EditChatTitle({chatId:n,title:t}),!0)}async function q(e,t){await Object(a.g)(new s.Api.messages.EditChatAbout({peer:Object(d.i)(e.id,e.accessHash),about:t}))&&g({"@type":"updateChatFullInfo",id:e.id,fullInfo:{about:t}})}function H({chat:e,isEnabled:t}){const{id:n,accessHash:i}=e,r=Object(d.g)(n,i);return Object(a.g)(new s.Api.channels.ToggleSignatures({channel:r,enabled:t}),!0)}async function z(e,t,n="recent",o){let u;switch(n){case"kicked":u=new s.Api.ChannelParticipantsKicked({q:""});break;case"admin":u=new s.Api.ChannelParticipantsAdmins;break;default:u=new s.Api.ChannelParticipantsRecent}const l=await Object(a.g)(new s.Api.channels.GetParticipants({channel:Object(d.g)(e,t),filter:u,offset:o,limit:i.q}));if(l&&!(l instanceof s.Api.channels.ChannelParticipantsNotModified))return Z(l),{members:Object(r.h)(l),users:l.users.map(c.a).filter(Boolean)}}async function K(){const e=await Object(a.g)(new s.Api.channels.GetGroupsForDiscussion);if(e)return Z(e),e.chats.map(e=>Object(r.d)(e))}function G({channel:e,chat:t}){return Object(a.g)(new s.Api.channels.SetDiscussionGroup({broadcast:Object(d.i)(e.id,e.accessHash),group:t?Object(d.i)(t.id,t.accessHash):new s.Api.InputChannelEmpty}))}async function W(e){const t=await Object(a.g)(new s.Api.messages.MigrateChat({chatId:Object(d.g)(e.id)}),!0);if(t&&t instanceof s.Api.Updates)return Z(t),Object(r.d)(t.chats[1]);i.f&&console.error("Unexpected channel creation update",t)}async function $(e){const t=await Object(a.g)(new s.Api.messages.CheckChatInvite({hash:e}));if(t)return t instanceof s.Api.ChatInvite?void await Object(a.g)(new s.Api.messages.ImportChatInvite({hash:e}),!0):Object(r.d)(t.chat)}function J(e){const t={};return e.chats.forEach(e=>{t["chat"+e.id]=e}),e.users.forEach(e=>{t["user"+e.id]=e}),t}function Z(e){"users"in e&&e.users.forEach(e=>{e instanceof s.Api.User&&(l.a.users[e.id]=e)}),"chats"in e&&e.chats.forEach(e=>{(e instanceof s.Api.Chat||e instanceof s.Api.Channel)&&(l.a.chats[e.id]=e)}),"messages"in e&&e.messages.forEach(e=>{e instanceof s.Api.Message&&Object(d.t)(e)&&Object(f.a)(e)})}},function(e,t,n){(function(t){const s=n(15),i=n(36);function a(e,n=!0,i=!1){let a=t.from(e);const r=a.length;n&&(a=a.reverse());let o=s(a.toString("hex"),16);return i&&Math.floor(o.toString("2").length/8)>=r&&(o=o.subtract(s(2).pow(s(8*r)))),o}function r(e,n=8){const i=s(e),a=[];for(let e=0;e<n;e++)a[e]=i.shiftRight(8*e).and(255);return t.from(a)}function o(e,n,i=!0,a=!1){const r=(e=s(e)).bitLength();if(n<Math.ceil(r/8))throw new Error("OverflowError: int too big to convert");if(!a&&e.lesser(s(0)))throw new Error("Cannot convert to unsigned");let o=!1;e.lesser(s(0))&&(o=!0,e=e.abs());const c=e.toString("16").padStart(2*n,"0");let u=t.from(c,"hex");if(i&&(u=u.reverse()),a&&o)if(i){let e=!1;0!==u[0]&&(u[0]-=1);for(let t=0;t<u.length;t++)0!==u[t]?(e&&(u[t]-=1,e=!1),u[t]=255-u[t]):e=!0}else{u[u.length-1]=256-u[u.length-1];for(let e=0;e<u.length-1;e++)u[e]=255-u[e]}return u}function c(e){return t.from(i.randomBytes(e))}function u(e){const t=i.createHash("sha1");return t.update(e),t.digest()}let l=null;e.exports={readBigIntFromBuffer:a,readBufferFromBigInt:o,generateRandomLong:function(e=!0){return a(c(8),!0,e)},mod:function(e,t){return(e%t+t)%t},crc32:function(e){l||(l=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}()),t.isBuffer(e)||(e=t.from(e));let n=-1;for(let t=0;t<e.length;t++){const s=e[t];n=l[255&(n^s)]^n>>>8}return(-1^n)>>>0},generateRandomBytes:c,generateKeyDataFromNonce:async function(e,n){e=r(e,16),n=r(n,32);const[s,i,a]=await Promise.all([u(t.concat([n,e])),u(t.concat([e,n])),u(t.concat([n,n]))]);return{key:t.concat([s,i.slice(0,12)]),iv:t.concat([i.slice(12,20),a,n.slice(0,4)])}},sha1:u,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 i=s.one,a=e;for(;t.greater(s.zero);){const e=t.remainder(s(2));t=t.divide(s(2)),e.eq(s.one)&&(i=i.multiply(a),i=i.remainder(n)),a=a.multiply(a),a=a.remainder(n)}return i},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,i=Math.floor((n+8-1)/8);return o(s(e),i,!1,t)},toSignedLittleBuffer:r,convertToLittle:function(e){const n=t.alloc(4*e.length);for(let t=0;t<e.length;t++)n.writeUInt32BE(e[t],4*t);return n}}}).call(this,n(12).Buffer)},function(e,t,n){"use strict";n.d(t,"o",(function(){return m})),n.d(t,"b",(function(){return y})),n.d(t,"d",(function(){return b})),n.d(t,"e",(function(){return _})),n.d(t,"c",(function(){return w})),n.d(t,"j",(function(){return A})),n.d(t,"h",(function(){return I})),n.d(t,"i",(function(){return P})),n.d(t,"m",(function(){return S})),n.d(t,"a",(function(){return C})),n.d(t,"k",(function(){return M})),n.d(t,"l",(function(){return k})),n.d(t,"n",(function(){return E})),n.d(t,"g",(function(){return O})),n.d(t,"f",(function(){return U}));var s=n(0),i=n(4),a=n(14),r=n(3),o=n(22),c=n(19),u=n(34);const l={USD:"$",EUR:"€",GBP:"£",JPY:"¥",RUB:"₽",UAH:"₴",INR:"₹",AED:"د.إ"};function d(e){return e&&l[e]||""}var f=n(2),g=n(16);let p,h=i.l;function m(e){p=e}function y(e){const t=Object(g.c)(e);if(t&&(e instanceof s.Api.Message||e instanceof s.Api.MessageService))return v(t,e)}function b(e){return v(Object(r.k)({userId:e.userId}),{...e,fromId:Object(f.o)(e.out?p:e.userId)})}function _(e){return v(Object(r.k)({chatId:e.chatId}),{...e,fromId:Object(f.o)(e.fromId)})}function w(e,t){const n=h++;let s={};return e.media&&(s={...P(e.media)}),!e.message||s.sticker||s.poll||s.contact||(s={...s,text:A(e.message,e.entities)}),{id:n,chatId:i.u,date:e.inboxDate||t/1e3,content:s,isOutgoing:!1}}function v(e,t){const n=t.fromId?Object(r.k)(t.fromId):void 0,i=!n&&e===p,a=t.out&&!t.post||i&&!t.fwdFrom;let o={};t.media&&(o={...P(t.media)}),!t.message||o.sticker||o.poll||o.contact||(o={...o,text:A(t.message,t.entities)});const u=t.action&&function(e,t,n,i){if(e instanceof s.Api.MessageActionEmpty)return;let a,o="",u="other";const l="users"in e?e.users&&e.users[0]:"userId"in e&&e.userId||void 0;let f;if(e instanceof s.Api.MessageActionChatCreate)o=`%action_origin% created the group «${e.title}»`;else if(e instanceof s.Api.MessageActionChatEditTitle)o=n?`Channel renamed to «${e.title}»`:`%action_origin% changed group name to «${e.title}»`;else if(e instanceof s.Api.MessageActionChatEditPhoto)o=n?"Channel photo updated":"%action_origin% updated group photo";else if(e instanceof s.Api.MessageActionChatDeletePhoto)o=n?"Channel photo was deleted":"Chat photo was deleted";else if(e instanceof s.Api.MessageActionChatAddUser)o=t&&t!==l?"%action_origin% added %target_user% to the group":"%target_user% joined the group";else if(e instanceof s.Api.MessageActionChatDeleteUser)o=t&&t!==l?"%action_origin% removed %target_user% from the group":"%target_user% left the group";else if(e instanceof s.Api.MessageActionChatJoinedByLink)o="%action_origin% joined the chat from invitation link";else if(e instanceof s.Api.MessageActionChannelCreate)o="Channel created";else if(e instanceof s.Api.MessageActionChatMigrateTo)o="Migrated to %target_chat%",f=Object(r.k)(e);else if(e instanceof s.Api.MessageActionChannelMigrateFrom)o="Migrated from %target_chat%",f=Object(r.k)(e);else if(e instanceof s.Api.MessageActionPinMessage)o="%action_origin% pinned %message%";else if(e instanceof s.Api.MessageActionHistoryClear)o="Chat history was cleared",u="historyClear";else if(e instanceof s.Api.MessageActionPhoneCall){if(o=`${i?"Outgoing":"Incoming"} ${e.video?"Video":"Phone"} Call`,e.duration){const t=Math.max(Math.round(e.duration/60),1);o+=` (${t} min${t>1?"s":""})`}}else if(e instanceof s.Api.MessageActionContactSignUp)o="%action_origin% joined Telegram";else if(e instanceof s.Api.MessageActionPaymentSent){const t=d(e.currency),n=(Number(e.totalAmount)/100).toFixed(2);o=`You successfully transferred ${t}${n} to shop for %product%`}else o="%ACTION_NOT_IMPLEMENTED%";"photo"in e&&e.photo instanceof s.Api.Photo&&(Object(g.b)(e.photo),a=Object(c.a)(e.photo));return{text:o,type:u,targetUserId:l,targetChatId:f,photo:a}}(t.action,n,Boolean(t.post),a);u&&(o.action=u);const{replyToMsgId:l,replyToTopId:f}=t.replyTo||{},h=t.editDate&&!t.editHide,{inlineButtons:m,keyboardButtons:y}=function(e){const{id:t,replyMarkup:n,media:i}=e;if(!n)return i instanceof s.Api.MessageMediaWebPage&&i.webpage instanceof s.Api.WebPage&&"telegram_message"===i.webpage.type?{inlineButtons:[[{type:"url",text:"Show Message",messageId:t,value:i.webpage.url}]]}:void 0;if(!(n instanceof s.Api.ReplyKeyboardMarkup||n instanceof s.Api.ReplyInlineMarkup))return;const a=n.rows.map(({buttons:e})=>e.map(e=>{let n,a,{text:r}=e;return e instanceof s.Api.KeyboardButton?(n="command",a=r):e instanceof s.Api.KeyboardButtonUrl?(n="url",a=e.url):e instanceof s.Api.KeyboardButtonCallback?(n="callback",a=String(e.data)):e instanceof s.Api.KeyboardButtonRequestPoll?n="requestPoll":e instanceof s.Api.KeyboardButtonBuy?(i instanceof s.Api.MessageMediaInvoice&&i.receiptMsgId&&(r="Receipt",a=i.receiptMsgId),n="buy"):n="NOT_SUPPORTED",{type:n,text:r,messageId:t,value:a}}));return{[n instanceof s.Api.ReplyKeyboardMarkup?"keyboardButtons":"inlineButtons"]:a}}(t)||{},b=t.fwdFrom&&function(e,t=!1){const n=e.savedFromPeer&&Object(r.k)(e.savedFromPeer),s=e.fromId&&Object(r.k)(e.fromId);return{isChannelPost:Boolean(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,i),{replies:_,mediaUnread:w,postAuthor:v}=t,I=t.groupedId&&t.groupedId.toString(),S=Boolean(I)&&!(o.document||o.audio),C=t.replyMarkup instanceof s.Api.ReplyKeyboardHide;return{id:t.id,chatId:e,isOutgoing:a,content:o,date:t.date,senderId:n||t.out&&t.post&&p||e,views:t.views,isFromScheduled:t.fromScheduled,...l&&{replyToMessageId:l},...f&&{replyToTopMessageId:f},...b&&{forwardInfo:b},...h&&{isEdited:h},...w&&{isMediaUnread:w},...t.mentioned&&w&&{hasUnreadMention:!0},...I&&{groupedId:I,isInAlbum:S},inlineButtons:m,...y&&{keyboardButtons:y},...C&&{shouldHideKeyboardButtons:C},...t.viaBotId&&{viaBotId:t.viaBotId},..._&&_.comments&&{threadInfo:D(_,t.id,e)},...v&&{adminTitle:v}}}function A(e,t){return{text:e,...t&&{entities:t.map(B)}}}function I(e){if(!(e instanceof s.Api.DraftMessageEmpty)&&e.message)return{formattedText:A(e.message,e.entities),replyingToId:e.replyToMsgId}}function P(e){const t=function(e){if(!(e instanceof s.Api.MessageMediaDocument&&e.document&&e.document instanceof s.Api.Document))return;return Object(o.a)(e.document)}(e);if(t)return{sticker:t};const n=function(e){if(!(e instanceof s.Api.MessageMediaPhoto&&e.photo&&e.photo instanceof s.Api.Photo))return;if(e.ttlSeconds)return;return Object(c.a)(e.photo)}(e);if(n)return{photo:n};const i=function(e){if(!(e instanceof s.Api.MessageMediaDocument&&e.document instanceof s.Api.Document&&e.document.mimeType.startsWith("video")))return;return S(e.document)}(e);if(i)return{video:i};const r=function(e){if(!(e instanceof s.Api.MessageMediaDocument&&e.document&&e.document instanceof s.Api.Document))return;const t=e.document.attributes.find(e=>e instanceof s.Api.DocumentAttributeAudio);if(!t||t.voice)return;return{fileName:R(e.document,"audio"),...Object(a.b)(e.document,["size","mimeType"]),...Object(a.b)(t,["duration","performer","title"])}}(e);if(r)return{audio:r};const u=function(e){if(!(e instanceof s.Api.MessageMediaDocument&&e.document&&e.document instanceof s.Api.Document))return;const t=e.document.attributes.find(e=>e instanceof s.Api.DocumentAttributeAudio);if(!t||!t.voice)return;const{duration:n,waveform:i}=t;return{duration:n,waveform:i?Array.from(i):void 0}}(e);if(u)return{voice:u};const l=function(e){if(!(e instanceof s.Api.MessageMediaDocument&&e.document))return;if(e.ttlSeconds)return;return C(e.document)}(e);if(l)return{document:l};const f=function(e){if(!(e instanceof s.Api.MessageMediaContact))return;return Object(a.b)(e,["firstName","lastName","phoneNumber","userId"])}(e);if(f)return{contact:f};const g=function(e){if(!(e instanceof s.Api.MessageMediaPoll))return;return M(e.poll,e.results)}(e);if(g)return{poll:g};const p=E(e);if(p)return{webPage:p};const h=function(e){if(!(e instanceof s.Api.MessageMediaInvoice))return;return function(e){const{description:t,title:n,photo:s,test:i,totalAmount:a,currency:r,receiptMsgId:o}=e,c=d(r);return{text:t,title:n,photoUrl:s&&s.url,receiptMsgId:o,description:`${c}${(Number(a)/100).toFixed(2)} ${i?"TEST INVOICE":""}`}}(e)}(e);return h?{invoice:h}:void 0}function S(e){if(e instanceof s.Api.DocumentEmpty)return;const{id:t,mimeType:n,thumbs:i,size:a,attributes:r}=e,o=r.find(e=>e instanceof s.Api.DocumentAttributeVideo);if(!o)return;const u=r.find(e=>e instanceof s.Api.DocumentAttributeAnimated),{duration:l,w:d,h:f,supportsStreaming:g=!1,roundMessage:p=!1}=o;return{id:String(t),mimeType:n,duration:l,fileName:R(e,"video"),width:d,height:f,supportsStreaming:g,isRound:p,isGif:Boolean(u),thumbnail:Object(c.e)(i),size:a}}function C(e){if(!(e instanceof s.Api.Document))return;const{id:t,size:n,mimeType:i,date:a,thumbs:r}=e,o=r&&Object(c.e)(r);return{id:String(t),size:n,mimeType:i,timestamp:a,fileName:R(e),thumbnail:o}}function M(e,t){const{id:n,answers:s}=e,i=s.map(e=>({text:e.text,option:String.fromCharCode(...e.option)}));return{id:n.toString(),summary:{isPublic:e.publicVoters,...Object(a.b)(e,["closed","multipleChoice","quiz","question","closePeriod","closeDate"]),answers:i},results:k(t)}}function k(e){const{results:t,totalVoters:n,recentVoters:s,solution:i,solutionEntities:a}=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:i,...a&&{solutionEntities:a.map(B)}}}function E(e){if(!(e instanceof s.Api.MessageMediaWebPage&&e.webpage instanceof s.Api.WebPage))return;const{id:t,photo:n,document:i}=e.webpage;return{id:Number(t),...Object(a.b)(e.webpage,["url","displayUrl","siteName","title","description"]),photo:n&&n instanceof s.Api.Photo?{id:String(n.id),thumbnail:Object(c.e)(n.sizes),sizes:n.sizes.filter(e=>e instanceof s.Api.PhotoSize).map(c.b)}:void 0,...i&&{hasDocument:!0}}}function R(e,t="file"){const{mimeType:n,attributes:i}=e,a=i.find(e=>e instanceof s.Api.DocumentAttributeFilename);if(a)return a.fileName;const r=n.split("/")[1];return`${t}${String(e.id)}.${r}`}function O(e,t,n,s,i,a,r,o,c,l){const d=h++,f=i&&function(e){const{filename:t,blobUrl:n,previewBlobUrl:s,mimeType:i,size:a}=e;if(e.quick){const{width:r,height:o,duration:c}=e.quick;return i.startsWith("image/")?{photo:{id:"temp",sizes:[],thumbnail:{width:r,height:o,dataUri:""},blobUrl:n}}:{video:{id:"temp",mimeType:i,duration:c||0,fileName:t,width:r,height:o,blobUrl:n,...s&&{thumbnail:{width:r,height:o,dataUri:s}},size:a}}}if(e.voice){const{duration:t,waveform:n}=e.voice,{data:s}=Object(u.a)(n,63);return{voice:{duration:t,waveform:s}}}return i.startsWith("audio/")?{audio:{mimeType:i,fileName:t,size:a,duration:200}}:{document:{mimeType:i,fileName:t,size:a,...s&&{previewBlobUrl:s}}}}(i),g="chatTypeChannel"===e.type;return{id:d,chatId:e.id,content:{...t&&{text:{text:t,entities:n}},...f,...a&&{sticker:a},...r&&{video:r},...o&&T(o,d)},date:l||Math.round(Date.now()/1e3),isOutgoing:!g,senderId:p,...s&&{replyToMessageId:s},...c&&{groupedId:c,...f&&(f.photo||f.video)&&{isInAlbum:!0}},...l&&{isScheduled:!0}}}function U(e,t){const n=h++,{content:s,chatId:i,id:a,senderId:r,groupedId:o,isInAlbum:c}=t,u=s.audio,l=e.id===p&&(i!==e.id||t.forwardInfo)&&!u;return{id:n,chatId:e.id,content:s,date:Math.round(Date.now()/1e3),isOutgoing:!l&&"chatTypeChannel"!==e.type,senderId:p,sendingState:"messageSendingStatePending",...r!==p&&!u&&{forwardInfo:{isChannelPost:!1,fromChatId:i,fromMessageId:a,senderUserId:r}},groupedId:o,isInAlbum:c}}function T(e,t){return{poll:{id:t.toString(),summary:Object(a.b)(e.summary,["question","answers"]),results:{}}}}function B(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 D(e,t,n){const{channelId:s,replies:a,maxId:o,readMaxId:c,recentRepliers:u}=e;if(s===i.i)return;return{threadId:t,...n!==s?{chatId:Object(r.k)({channelId:s}),originChannelId:n}:{chatId:n},messagesCount:a,lastMessageId:o,lastReadInboxMessageId:c,...u&&{recentReplierIds:u.map(r.k)}}}},function(e,t,n){"use strict";(function(e){n.d(t,"m",(function(){return y})),n.d(t,"g",(function(){return b})),n.d(t,"e",(function(){return _})),n.d(t,"v",(function(){return v})),n.d(t,"d",(function(){return I})),n.d(t,"s",(function(){return P})),n.d(t,"q",(function(){return C})),n.d(t,"y",(function(){return M})),n.d(t,"b",(function(){return k})),n.d(t,"c",(function(){return E})),n.d(t,"a",(function(){return R})),n.d(t,"o",(function(){return O})),n.d(t,"p",(function(){return U})),n.d(t,"r",(function(){return T})),n.d(t,"u",(function(){return B})),n.d(t,"t",(function(){return D})),n.d(t,"j",(function(){return x})),n.d(t,"w",(function(){return j})),n.d(t,"n",(function(){return N})),n.d(t,"l",(function(){return F})),n.d(t,"k",(function(){return V})),n.d(t,"i",(function(){return L})),n.d(t,"x",(function(){return q})),n.d(t,"f",(function(){return H})),n.d(t,"h",(function(){return K}));var s=n(0),i=n(11),a=n(4),r=n(1),o=n(9),c=n(13),u=n(2),l=n(5),d=n(3),f=n(35),g=n(16),p=n(34),h=n(7);let m;function y(e){m=e}async function b({chat:e,threadId:t,...n}){const a=t===i.MAIN_THREAD_ID?s.Api.messages.GetHistory:s.Api.messages.GetReplies;let l;try{l=await Object(r.g)(new a({peer:Object(u.i)(e.id,e.accessHash),...t!==i.MAIN_THREAD_ID&&{msgId:t},...n}),void 0,!0)}catch(t){"CHANNEL_PRIVATE"===t.message&&m({"@type":"updateChat",id:e.id,chat:{isRestricted:!0}})}if(!l||l instanceof s.Api.messages.MessagesNotModified||!l.messages)return;z(l);const f=l.messages.map(o.b).filter(Boolean),g=l.users.map(c.a).filter(Boolean),p=l.chats.map(e=>Object(d.d)(e)).filter(Boolean),h=f.map(({threadInfo:e})=>e).filter(Boolean);let y;if(l.messages.length)if(l instanceof s.Api.messages.Messages)y=l.messages[l.messages.length-1].id;else if(n.offsetId&&l.offsetIdOffset){const e=l.messages.findIndex(e=>e.id===n.offsetId);l.messages.length-e+l.offsetIdOffset>=l.count&&(y=l.messages[l.messages.length-1].id)}return{messages:f,users:g,chats:p,threadInfos:h,firstMessageId:y}}async function _({chat:e,messageId:t}){const n="channel"===Object(u.s)(e.id),a=await Object(r.g)(n?new s.Api.channels.GetMessages({channel:Object(u.g)(e.id,e.accessHash),id:[new s.Api.InputMessageID({id:t})]}):new s.Api.messages.GetMessages({id:[new s.Api.InputMessageID({id:t})]}));if(!a||a instanceof s.Api.messages.MessagesNotModified)return;const l=a.messages[0];if(!l)return;if(l instanceof s.Api.MessageEmpty)return i.MESSAGE_DELETED;const d=l&&Object(o.b)(l);if(!d)return;l instanceof s.Api.Message&&Object(g.a)(l);return{message:d,users:a.users.map(c.a).filter(Boolean)}}let w=Promise.resolve();function v({chat:e,text:t,entities:n,replyingTo:i,attachment:c,sticker:d,gif:f,poll:g,isSilent:p,scheduledAt:h,groupedId:y,noWebPage:b},_){const v=Object(o.g)(e,t,n,i,c,d,f,g,y,h);m({"@type":v.isScheduled?"newScheduledMessage":"newMessage",id:v.id,chatId:e.id,message:v}),setTimeout(()=>{m({"@type":v.isScheduled?"updateScheduledMessage":"updateMessage",id:v.id,chatId:e.id,message:{sendingState:"messageSendingStatePending"}})},1e3);const I=Object(u.r)();if(l.a.localMessages[I.toString()]=v,y)return function({chat:e,text:t,entities:n,replyingTo:i,attachment:o,groupedId:c,isSilent:l,scheduledAt:d},f,g,p){let h=-1;A[c]||(A[c]={counter:0,singleMediaByIndex:{}});h=A[c].counter++;const m=w;return w=(async()=>{let y;try{y=await S(g,o,p)}catch(e){return a.f&&console.warn(e),A[c].counter--,void await m}const b=await async function(e,t){const n=await Object(r.g)(new s.Api.messages.UploadMedia({peer:e,media:t}));if(n instanceof s.Api.MessageMediaPhoto&&n.photo&&n.photo instanceof s.Api.Photo){const{photo:{id:e,accessHash:t,fileReference:i}}=n;return new s.Api.InputMediaPhoto({id:new s.Api.InputPhoto({id:e,accessHash:t,fileReference:i})})}if(n instanceof s.Api.MessageMediaDocument&&n.document&&n.document instanceof s.Api.Document){const{document:{id:e,accessHash:t,fileReference:i}}=n;return new s.Api.InputMediaDocument({id:new s.Api.InputDocument({id:e,accessHash:t,fileReference:i})})}return}(Object(u.i)(e.id,e.accessHash),y);if(await m,!b)return A[c].counter--,void(a.f&&console.warn("Failed to upload grouped media"));if(A[c].singleMediaByIndex[h]=new s.Api.InputSingleMedia({media:b,randomId:f,message:t||"",entities:n?n.map(u.n):void 0}),Object.keys(A[c].singleMediaByIndex).length<A[c].counter)return;const{singleMediaByIndex:_}=A[c];delete A[c],await Object(r.g)(new s.Api.messages.SendMultiMedia({clearDraft:!0,peer:Object(u.i)(e.id,e.accessHash),multiMedia:Object.values(_),replyToMsgId:i,...l&&{silent:l},...d&&{scheduleDate:d}}),!0)})(),w}({chat:e,text:t,entities:n,replyingTo:i,attachment:c,groupedId:y,isSilent:p,scheduledAt:h},I,v,_);const P=w;return w=(async()=>{let o;if(c)try{o=await S(v,c,_)}catch(e){return a.f&&console.warn(e),void await P}else d?o=Object(u.h)(d):f?o=Object(u.h)(f):g&&(o=Object(u.j)(g,I));await P;const l=o?s.Api.messages.SendMedia:s.Api.messages.SendMessage;await Object(r.g)(new l({clearDraft:!0,message:t||"",entities:n?n.map(u.n):void 0,peer:Object(u.i)(e.id,e.accessHash),randomId:I,...p&&{silent:p},...h&&{scheduleDate:h},...i&&{replyToMsgId:i},...o&&{media:o},...b&&{noWebpage:b}}),!0)})(),w}const A={};async function I({chat:e,message:t,text:n,entities:i}){const a=1e3*t.date>Date.now(),o={content:{...t.content,...n&&{text:{text:n,entities:i}}}};m({"@type":a?"updateScheduledMessage":"updateMessage",id:t.id,chatId:e.id,message:o}),l.a.localMessages[t.id]={...t,...o};const c=i&&i.map(u.n);await Object(r.g)(new s.Api.messages.EditMessage({message:n||"",entities:c,peer:Object(u.i)(e.id,e.accessHash),id:t.id,...a&&{scheduleDate:t.date}}),!0)}async function P({chat:e,message:t,scheduledAt:n}){await Object(r.g)(new s.Api.messages.EditMessage({peer:Object(u.i)(e.id,e.accessHash),id:t.id,scheduleDate:n}),!0)}async function S(t,n,i){const{filename:a,blobUrl:o,mimeType:c,quick:u,voice:l}=n,d=await Object(f.b)(o,a),g=e=>{i.isCanceled?g.isCanceled=!0:i(e,t.id)},h=await Object(r.i)(d,g),m=[new s.Api.DocumentAttributeFilename({fileName:a})];if(u){if(c.startsWith("image/"))return new s.Api.InputMediaUploadedPhoto({file:h});{const{width:e,height:t,duration:n}=u;void 0!==n&&m.push(new s.Api.DocumentAttributeVideo({duration:n,w:e,h:t}))}}if(l){const{duration:t,waveform:n}=l,{data:i}=Object(p.a)(n,63);m.push(new s.Api.DocumentAttributeAudio({voice:!0,duration:t,waveform:e.from(i)}))}return new s.Api.InputMediaUploadedDocument({file:h,mimeType:c,attributes:m})}async function C({chat:e,messageId:t,isUnpin:n,isOneSide:i,isSilent:a}){await Object(r.g)(new s.Api.messages.UpdatePinnedMessage({peer:Object(u.i)(e.id,e.accessHash),id:t,...n&&{unpin:!0},...i&&{pmOneside:!0},...a&&{silent:!0}}),!0)}async function M({chat:e}){await Object(r.g)(new s.Api.messages.UnpinAllMessages({peer:Object(u.i)(e.id,e.accessHash)}),!0)}async function k({chat:e,messageIds:t,shouldDeleteForAll:n}){const i="channel"===Object(u.s)(e.id);await Object(r.g)(i?new s.Api.channels.DeleteMessages({channel:Object(u.g)(e.id,e.accessHash),id:t}):new s.Api.messages.DeleteMessages({id:t,...n&&{revoke:!0}}))&&m({"@type":"deleteMessages",ids:t,...i&&{chatId:e.id}})}async function E({chat:e,messageIds:t}){await Object(r.g)(new s.Api.messages.DeleteScheduledMessages({peer:Object(u.i)(e.id,e.accessHash),id:t}))&&m({"@type":"deleteScheduledMessages",ids:t,chatId:e.id})}async function R({chat:e,shouldDeleteForAll:t,maxId:n}){const i="channel"===Object(u.s)(e.id);await Object(r.g)(i?new s.Api.channels.DeleteHistory({channel:Object(u.g)(e.id,e.accessHash),maxId:n}):new s.Api.messages.DeleteHistory({peer:Object(u.i)(e.id,e.accessHash),...t&&{revoke:!0},...!t&&{just_clear:!0},maxId:n}))&&m({"@type":"deleteHistory",chatId:e.id})}async function O({chat:e,threadId:t,maxId:n}){const a="channel"===Object(u.s)(e.id);a&&t===i.MAIN_THREAD_ID?await Object(r.g)(new s.Api.channels.ReadHistory({channel:Object(u.g)(e.id,e.accessHash),maxId:n})):a?await Object(r.g)(new s.Api.messages.ReadDiscussion({peer:Object(u.i)(e.id,e.accessHash),msgId:t,readMaxId:n})):await Object(r.g)(new s.Api.messages.ReadHistory({peer:Object(u.i)(e.id,e.accessHash),maxId:n})),t===i.MAIN_THREAD_ID?Object(h.u)(e):T({chat:e,threadId:t})}async function U({chat:e,messageIds:t}){const n="channel"===Object(u.s)(e.id);await Object(r.g)(n?new s.Api.channels.ReadMessageContents({channel:Object(u.g)(e.id,e.accessHash),id:t}):new s.Api.messages.ReadMessageContents({id:t})),m({...n?{"@type":"updateChannelMessages",channelId:e.id}:{"@type":"updateCommonBoxMessages"},ids:t,messageUpdate:{hasUnreadMention:!1,isMediaUnread:!1}})}async function T({chat:e,threadId:t}){const[n,i]=await Promise.all([Object(r.g)(new s.Api.messages.GetDiscussionMessage({peer:Object(u.i)(e.id,e.accessHash),msgId:t})),Object(r.g)(new s.Api.messages.GetReplies({peer:Object(u.i)(e.id,e.accessHash),msgId:t,limit:1}))]);if(!n||!n.messages.length)return;const a=Object(g.c)(n.messages[0]);if(!a)return;m({"@type":"updateThreadInfo",chatId:a,threadId:t,threadInfo:{topMessageId:n.messages[n.messages.length-1].id,lastReadInboxMessageId:n.readInboxMaxId,messagesCount:i instanceof s.Api.messages.ChannelMessages?i.count:void 0}});n.chats.map(e=>Object(d.d)(e)).filter(Boolean).forEach(e=>{m({"@type":"updateChat",id:e.id,chat:e})})}async function B({chatOrUser:e,type:t,query:n,topMessageId:i,minDate:a,maxDate:l,...d}){let f;switch(t){case"media":f=new s.Api.InputMessagesFilterPhotoVideo;break;case"documents":f=new s.Api.InputMessagesFilterDocument;break;case"links":f=new s.Api.InputMessagesFilterUrl;break;case"audio":f=new s.Api.InputMessagesFilterMusic;break;case"voice":f=new s.Api.InputMessagesFilterVoice;break;case"profilePhoto":f=new s.Api.InputMessagesFilterChatPhotos;break;case"text":default:f=new s.Api.InputMessagesFilterEmpty}const g=await Object(r.g)(new s.Api.messages.Search({peer:Object(u.i)(e.id,e.accessHash),filter:f,q:n||"",topMsgId:i,minDate:a,maxDate:l,...d}));if(!g||g instanceof s.Api.messages.MessagesNotModified||!g.messages)return;z(g);const p=g.messages.map(o.b).filter(Boolean),h=g.users.map(c.a).filter(Boolean);let m,y=p.length;return(g instanceof s.Api.messages.MessagesSlice||g instanceof s.Api.messages.ChannelMessages)&&(y=g.count,p.length&&(m=p[p.length-1].id)),{messages:p,users:h,totalCount:y,nextOffsetId:m}}async function D({query:e,offsetRate:t=0,limit:n,type:i="text",minDate:u,maxDate:l}){let f;switch(i){case"media":f=new s.Api.InputMessagesFilterPhotoVideo;break;case"documents":f=new s.Api.InputMessagesFilterDocument;break;case"links":f=new s.Api.InputMessagesFilterUrl;break;case"audio":f=new s.Api.InputMessagesFilterMusic;break;case"voice":f=new s.Api.InputMessagesFilterVoice;break;case"text":default:if(!(e||l&&u))return;f=new s.Api.InputMessagesFilterEmpty}const g=await Object(r.g)(new s.Api.messages.SearchGlobal({q:e,offsetRate:t,offsetPeer:new s.Api.InputPeerEmpty,limit:n,filter:f,folderId:a.a,minDate:u,maxDate:l}));if(!g||g instanceof s.Api.messages.MessagesNotModified||!g.messages)return;z({chats:g.chats,users:g.users,messages:g.messages});const p=g.chats.map(e=>Object(d.d)(e)).filter(Boolean),h=g.users.map(c.a).filter(Boolean),m=g.messages.map(o.b).filter(Boolean);let y,b=m.length;return(g instanceof s.Api.messages.MessagesSlice||g instanceof s.Api.messages.ChannelMessages)&&(b=g.count,m.length&&(y=m[m.length-1].id)),{messages:m,users:h,chats:p,totalCount:b,nextRate:"nextRate"in g&&g.nextRate?g.nextRate:y}}async function x({message:e}){const t=await Object(r.g)(new s.Api.messages.GetWebPagePreview({message:e}));return t&&Object(o.n)(t)}async function j({chat:t,messageId:n,options:i}){const{id:a,accessHash:o}=t;await Object(r.g)(new s.Api.messages.SendVote({peer:Object(u.i)(a,o),msgId:n,options:i.map(t=>e.from(t))}),!0)}async function N({chat:t,messageId:n,option:i,offset:a,limit:o,shouldResetVoters:l}){const{id:d,accessHash:f}=t,g=await Object(r.g)(new s.Api.messages.GetPollVotes({peer:Object(u.i)(d,f),id:n,...i&&{option:e.from(i)},...a&&{offset:a},...o&&{limit:o}}));if(!g)return;z({chats:[],users:g.users,messages:[]});const p=g.users.map(c.a).filter(Boolean),h=g.votes.map(e=>({userId:e.userId,date:e.date}));return{count:g.count,votes:h,users:p,nextOffset:g.nextOffset,shouldResetVoters:l}}async function F({fromChat:e,toChat:t,messages:n}){const i=n.map(({id:e})=>e),a=n.map(u.r);n.forEach((e,n)=>{const s=Object(o.f)(t,e);l.a.localMessages[String(a[n])]=s,m({"@type":"newMessage",id:s.id,chatId:t.id,message:s})}),await Object(r.g)(new s.Api.messages.ForwardMessages({fromPeer:Object(u.i)(e.id,e.accessHash),toPeer:Object(u.i)(t.id,t.accessHash),randomId:a,id:i}),!0)}async function V({chat:e,timestamp:t}){const n=await Object(r.g)(new s.Api.messages.GetHistory({peer:Object(u.i)(e.id,e.accessHash),offsetDate:t,addOffset:-1,limit:1}));if(n&&!(n instanceof s.Api.messages.MessagesNotModified)&&n.messages&&n.messages.length)return n.messages[0].id}async function L({chat:e,hash:t=0}){const{id:n,accessHash:i}=e,a=await Object(r.g)(new s.Api.messages.GetScheduledHistory({peer:Object(u.i)(n,i),hash:t}));if(!a||a instanceof s.Api.messages.MessagesNotModified||!a.messages)return;z(a);const c=a.messages.map(o.b).filter(Boolean);return{messages:c,hash:Object(u.q)(c.map(e=>e.id))}}async function q({chat:e,ids:t}){const{id:n,accessHash:i}=e;await Object(r.g)(new s.Api.messages.SendScheduledMessages({peer:Object(u.i)(n,i),id:t}),!0)}function H({chat:e,message:t}){return Object(r.g)(new s.Api.channels.ExportMessageLink({id:t.id,channel:Object(u.g)(e.id,e.accessHash),...t.isInAlbum&&{grouped:!0},...t.threadInfo&&t.threadInfo.topMessageId!==t.id&&{thread:!0}}))}function z(e){e.users.forEach(e=>{e instanceof s.Api.User&&(l.a.users[e.id]=e)}),e.chats.forEach(e=>{(e instanceof s.Api.Chat||e instanceof s.Api.Channel)&&(l.a.chats[e.id]=e)}),e.messages.forEach(e=>{(e instanceof s.Api.Message&&Object(u.t)(e)||e instanceof s.Api.MessageService&&Object(u.u)(e))&&Object(g.a)(e)})}async function K({chat:e}){const t=await Object(r.g)(new s.Api.messages.Search({peer:Object(u.i)(e.id,e.accessHash),filter:new s.Api.InputMessagesFilterPinned,q:"",limit:a.s}));if(!t||t instanceof s.Api.messages.MessagesNotModified||!t.messages)return;z(t);return{messages:t.messages.map(o.b).filter(Boolean),users:t.users.map(c.a).filter(Boolean),chats:t.chats.map(e=>Object(d.d)(e)).filter(Boolean)}}}).call(this,n(12).Buffer)},function(e,t,n){"use strict";var s=n(65);n.o(s,"ApiMediaFormat")&&n.d(t,"ApiMediaFormat",(function(){return s.ApiMediaFormat})),n.o(s,"ApiMessageEntityTypes")&&n.d(t,"ApiMessageEntityTypes",(function(){return s.ApiMessageEntityTypes})),n.o(s,"MAIN_THREAD_ID")&&n.d(t,"MAIN_THREAD_ID",(function(){return s.MAIN_THREAD_ID})),n.o(s,"MESSAGE_DELETED")&&n.d(t,"MESSAGE_DELETED",(function(){return s.MESSAGE_DELETED}));var i=n(66);n.o(i,"ApiMediaFormat")&&n.d(t,"ApiMediaFormat",(function(){return i.ApiMediaFormat})),n.o(i,"ApiMessageEntityTypes")&&n.d(t,"ApiMessageEntityTypes",(function(){return i.ApiMessageEntityTypes})),n.o(i,"MAIN_THREAD_ID")&&n.d(t,"MAIN_THREAD_ID",(function(){return i.MAIN_THREAD_ID})),n.o(i,"MESSAGE_DELETED")&&n.d(t,"MESSAGE_DELETED",(function(){return i.MESSAGE_DELETED}));var a=n(67);n.d(t,"ApiMessageEntityTypes",(function(){return a.a})),n.d(t,"MAIN_THREAD_ID",(function(){return a.b})),n.d(t,"MESSAGE_DELETED",(function(){return a.c}));var r=n(68);n.o(r,"ApiMediaFormat")&&n.d(t,"ApiMediaFormat",(function(){return r.ApiMediaFormat}));var o=n(69);n.d(t,"ApiMediaFormat",(function(){return o.a}));n(70),n(71)},function(e,t,n){"use strict";(function(e){var s=n(73),i=n(74),a=n(75);function r(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(r()<t)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=c.prototype:(null===e&&(e=new c(t)),e.length=t),e}function c(e,t,n){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return d(this,e)}return u(this,e,t,n)}function u(e,t,n,s){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,s){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(s||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===s?new Uint8Array(t):void 0===s?new Uint8Array(t,n):new Uint8Array(t,n,s);c.TYPED_ARRAY_SUPPORT?(e=t).__proto__=c.prototype:e=f(e,t);return e}(e,t,n,s):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!c.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var s=0|p(t,n),i=(e=o(e,s)).write(t,n);i!==s&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(c.isBuffer(t)){var n=0|g(t.length);return 0===(e=o(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(s=t.length)!=s?o(e,0):f(e,t);if("Buffer"===t.type&&a(t.data))return f(e,t.data)}var s;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function d(e,t){if(l(t),e=o(e,t<0?0:0|g(t)),!c.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function f(e,t){var n=t.length<0?0:0|g(t.length);e=o(e,n);for(var s=0;s<n;s+=1)e[s]=255&t[s];return e}function g(e){if(e>=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|e}function p(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var s=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return L(e).length;default:if(s)return V(e).length;t=(""+t).toLowerCase(),s=!0}}function h(e,t,n){var s=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return E(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return M(this,t,n);case"latin1":case"binary":return k(this,t,n);case"base64":return S(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(s)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),s=!0}}function m(e,t,n){var s=e[t];e[t]=e[n],e[n]=s}function y(e,t,n,s,i){if(0===e.length)return-1;if("string"==typeof n?(s=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=c.from(t,s)),c.isBuffer(t))return 0===t.length?-1:b(e,t,n,s,i);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,s,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,s,i){var a,r=1,o=e.length,c=t.length;if(void 0!==s&&("ucs2"===(s=String(s).toLowerCase())||"ucs-2"===s||"utf16le"===s||"utf-16le"===s)){if(e.length<2||t.length<2)return-1;r=2,o/=2,c/=2,n/=2}function u(e,t){return 1===r?e[t]:e.readUInt16BE(t*r)}if(i){var l=-1;for(a=n;a<o;a++)if(u(e,a)===u(t,-1===l?0:a-l)){if(-1===l&&(l=a),a-l+1===c)return l*r}else-1!==l&&(a-=a-l),l=-1}else for(n+c>o&&(n=o-c),a=n;a>=0;a--){for(var d=!0,f=0;f<c;f++)if(u(e,a+f)!==u(t,f)){d=!1;break}if(d)return a}return-1}function _(e,t,n,s){n=Number(n)||0;var i=e.length-n;s?(s=Number(s))>i&&(s=i):s=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");s>a/2&&(s=a/2);for(var r=0;r<s;++r){var o=parseInt(t.substr(2*r,2),16);if(isNaN(o))return r;e[n+r]=o}return r}function w(e,t,n,s){return q(V(t,e.length-n),e,n,s)}function v(e,t,n,s){return q(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,s)}function A(e,t,n,s){return v(e,t,n,s)}function I(e,t,n,s){return q(L(t),e,n,s)}function P(e,t,n,s){return q(function(e,t){for(var n,s,i,a=[],r=0;r<e.length&&!((t-=2)<0);++r)n=e.charCodeAt(r),s=n>>8,i=n%256,a.push(i),a.push(s);return a}(t,e.length-n),e,n,s)}function S(e,t,n){return 0===t&&n===e.length?s.fromByteArray(e):s.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);for(var s=[],i=t;i<n;){var a,r,o,c,u=e[i],l=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=n)switch(d){case 1:u<128&&(l=u);break;case 2:128==(192&(a=e[i+1]))&&(c=(31&u)<<6|63&a)>127&&(l=c);break;case 3:a=e[i+1],r=e[i+2],128==(192&a)&&128==(192&r)&&(c=(15&u)<<12|(63&a)<<6|63&r)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:a=e[i+1],r=e[i+2],o=e[i+3],128==(192&a)&&128==(192&r)&&128==(192&o)&&(c=(15&u)<<18|(63&a)<<12|(63&r)<<6|63&o)>65535&&c<1114112&&(l=c)}null===l?(l=65533,d=1):l>65535&&(l-=65536,s.push(l>>>10&1023|55296),l=56320|1023&l),s.push(l),i+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",s=0;for(;s<t;)n+=String.fromCharCode.apply(String,e.slice(s,s+=4096));return n}(s)}t.Buffer=c,t.SlowBuffer=function(e){+e!=e&&(e=0);return c.alloc(+e)},t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=r(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,n){return u(null,e,t,n)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,n){return function(e,t,n,s){return l(t),t<=0?o(e,t):void 0!==n?"string"==typeof s?o(e,t).fill(n,s):o(e,t).fill(n):o(e,t)}(null,e,t,n)},c.allocUnsafe=function(e){return d(null,e)},c.allocUnsafeSlow=function(e){return d(null,e)},c.isBuffer=function(e){return!(null==e||!e._isBuffer)},c.compare=function(e,t){if(!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,s=t.length,i=0,a=Math.min(n,s);i<a;++i)if(e[i]!==t[i]){n=e[i],s=t[i];break}return n<s?-1:s<n?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!a(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var s=c.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var r=e[n];if(!c.isBuffer(r))throw new TypeError('"list" argument must be an Array of Buffers');r.copy(s,i),i+=r.length}return s},c.byteLength=p,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},c.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},c.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},c.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?C(this,0,e):h.apply(this,arguments)},c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},c.prototype.compare=function(e,t,n,s,i){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===s&&(s=0),void 0===i&&(i=this.length),t<0||n>e.length||s<0||i>this.length)throw new RangeError("out of range index");if(s>=i&&t>=n)return 0;if(s>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(s>>>=0),r=(n>>>=0)-(t>>>=0),o=Math.min(a,r),u=this.slice(s,i),l=e.slice(t,n),d=0;d<o;++d)if(u[d]!==l[d]){a=u[d],r=l[d];break}return a<r?-1:r<a?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return y(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return y(this,e,t,n,!1)},c.prototype.write=function(e,t,n,s){if(void 0===t)s="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)s=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===s&&(s="utf8")):(s=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");s||(s="utf8");for(var a=!1;;)switch(s){case"hex":return _(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return v(this,e,t,n);case"latin1":case"binary":return A(this,e,t,n);case"base64":return I(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+s);s=(""+s).toLowerCase(),a=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function M(e,t,n){var s="";n=Math.min(e.length,n);for(var i=t;i<n;++i)s+=String.fromCharCode(127&e[i]);return s}function k(e,t,n){var s="";n=Math.min(e.length,n);for(var i=t;i<n;++i)s+=String.fromCharCode(e[i]);return s}function E(e,t,n){var s=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>s)&&(n=s);for(var i="",a=t;a<n;++a)i+=F(e[a]);return i}function R(e,t,n){for(var s=e.slice(t,n),i="",a=0;a<s.length;a+=2)i+=String.fromCharCode(s[a]+256*s[a+1]);return i}function O(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,n,s,i,a){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(n+s>e.length)throw new RangeError("Index out of range")}function T(e,t,n,s){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-n,2);i<a;++i)e[n+i]=(t&255<<8*(s?i:1-i))>>>8*(s?i:1-i)}function B(e,t,n,s){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-n,4);i<a;++i)e[n+i]=t>>>8*(s?i:3-i)&255}function D(e,t,n,s,i,a){if(n+s>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function x(e,t,n,s,a){return a||D(e,0,n,4),i.write(e,t,n,s,23,4),n+4}function j(e,t,n,s,a){return a||D(e,0,n,8),i.write(e,t,n,s,52,8),n+8}c.prototype.slice=function(e,t){var n,s=this.length;if((e=~~e)<0?(e+=s)<0&&(e=0):e>s&&(e=s),(t=void 0===t?s:~~t)<0?(t+=s)<0&&(t=0):t>s&&(t=s),t<e&&(t=e),c.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=c.prototype;else{var i=t-e;n=new c(i,void 0);for(var a=0;a<i;++a)n[a]=this[a+e]}return n},c.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var s=this[e],i=1,a=0;++a<t&&(i*=256);)s+=this[e+a]*i;return s},c.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var s=this[e+--t],i=1;t>0&&(i*=256);)s+=this[e+--t]*i;return s},c.prototype.readUInt8=function(e,t){return t||O(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var s=this[e],i=1,a=0;++a<t&&(i*=256);)s+=this[e+a]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var s=t,i=1,a=this[e+--s];s>0&&(i*=256);)a+=this[e+--s]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},c.prototype.readInt8=function(e,t){return t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||O(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||O(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||O(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||O(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||O(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||O(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,s){(e=+e,t|=0,n|=0,s)||U(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},c.prototype.writeUIntBE=function(e,t,n,s){(e=+e,t|=0,n|=0,s)||U(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):T(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):T(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):B(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):B(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,s){if(e=+e,t|=0,!s){var i=Math.pow(2,8*n-1);U(this,e,t,n,i-1,-i)}var a=0,r=1,o=0;for(this[t]=255&e;++a<n&&(r*=256);)e<0&&0===o&&0!==this[t+a-1]&&(o=1),this[t+a]=(e/r>>0)-o&255;return t+n},c.prototype.writeIntBE=function(e,t,n,s){if(e=+e,t|=0,!s){var i=Math.pow(2,8*n-1);U(this,e,t,n,i-1,-i)}var a=n-1,r=1,o=0;for(this[t+a]=255&e;--a>=0&&(r*=256);)e<0&&0===o&&0!==this[t+a+1]&&(o=1),this[t+a]=(e/r>>0)-o&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):T(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):T(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):B(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):B(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return x(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return x(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return j(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return j(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,s){if(n||(n=0),s||0===s||(s=this.length),t>=e.length&&(t=e.length),t||(t=0),s>0&&s<n&&(s=n),s===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(s<0)throw new RangeError("sourceEnd out of bounds");s>this.length&&(s=this.length),e.length-t<s-n&&(s=e.length-t+n);var i,a=s-n;if(this===e&&n<t&&t<s)for(i=a-1;i>=0;--i)e[i+t]=this[i+n];else if(a<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+a),t);return a},c.prototype.fill=function(e,t,n,s){if("string"==typeof e){if("string"==typeof t?(s=t,t=0,n=this.length):"string"==typeof n&&(s=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==s&&"string"!=typeof s)throw new TypeError("encoding must be a string");if("string"==typeof s&&!c.isEncoding(s))throw new TypeError("Unknown encoding: "+s)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var a;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a<n;++a)this[a]=e;else{var r=c.isBuffer(e)?e:V(new c(e,s).toString()),o=r.length;for(a=0;a<n-t;++a)this[a+t]=r[a%o]}return this};var N=/[^+\/0-9A-Za-z-_]/g;function F(e){return e<16?"0"+e.toString(16):e.toString(16)}function V(e,t){var n;t=t||1/0;for(var s=e.length,i=null,a=[],r=0;r<s;++r){if((n=e.charCodeAt(r))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(r+1===s){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function L(e){return s.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(N,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(e,t,n,s){for(var i=0;i<s&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(44))},function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"a",(function(){return a})),n.d(t,"c",(function(){return o}));var s=n(0);function i(e){const{about:t,commonChatsCount:n,pinnedMsgId:s,botInfo:i,notifySettings:{silent:r,muteUntil:o}}=e,c=r||"number"==typeof o&&Date.now()<1e3*o;return{...a(e.user),fullInfo:{bio:t,commonChatsCount:n,pinnedMessageId:s,isMuted:c,...i&&{botDescription:i.description}}}}function a(e){if(!(e instanceof s.Api.User))return;const{id:t,firstName:n,lastName:i}=e,a=e.photo instanceof s.Api.UserProfilePhoto?String(e.photo.photoId):void 0;return{id:t,isMin:Boolean(e.min),...e.self&&{isSelf:!0},...e.verified&&{isVerified:!0},...(e.contact||e.mutualContact)&&{isContact:!0},type:r(e),...n&&{firstName:n},...i&&{lastName:i},username:e.username||"",phoneNumber:e.phone||"",status:o(e.status),...e.accessHash&&{accessHash:String(e.accessHash)},...a&&{avatarHash:a}}}function r(e){return e.bot?"userTypeBot":e.deleted?"userTypeDeleted":"userTypeRegular"}function o(e){return!e||e instanceof s.Api.UserStatusEmpty?{type:"userStatusEmpty"}:e instanceof s.Api.UserStatusOnline?{type:"userStatusOnline",expires:e.expires}:e instanceof s.Api.UserStatusOffline?{type:"userStatusOffline",wasOnline:e.wasOnline}:e instanceof s.Api.UserStatusRecently?{type:"userStatusRecently"}:e instanceof s.Api.UserStatusLastWeek?{type:"userStatusLastWeek"}:{type:"userStatusLastMonth"}}},function(e,t,n){"use strict";function s(e,t){return e.reduce((e,n)=>(e[n[t]]=n,e),{})}function i(e,t){return t.reduce((t,n)=>(t[n]=e[n],t),{})}function a(e,t){return t.reduce((t,n)=>(e[n]&&(t[n]=e[n]),t),{})}n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return a}))},function(e,t,n){(function(e){var s,i=function(e){"use strict";var t=1e7,n=9007199254740992,s=d(n),a="function"==typeof BigInt;function r(e,t,n,s){return void 0===e?r[0]:void 0!==t&&(10!=+t||n)?V(e,t,n,s):K(e)}function o(e,t){this.value=e,this.sign=t,this.isSmall=!1}function c(e){this.value=e,this.sign=e<0,this.isSmall=!0}function u(e){this.value=e}function l(e){return-n<e&&e<n}function d(e){return e<1e7?[e]:e<1e14?[e%1e7,Math.floor(e/1e7)]:[e%1e7,Math.floor(e/1e7)%1e7,Math.floor(e/1e14)]}function f(e){g(e);var n=e.length;if(n<4&&k(e,s)<0)switch(n){case 0:return 0;case 1:return e[0];case 2:return e[0]+e[1]*t;default:return e[0]+(e[1]+e[2]*t)*t}return e}function g(e){for(var t=e.length;0===e[--t];);e.length=t+1}function p(e){for(var t=new Array(e),n=-1;++n<e;)t[n]=0;return t}function h(e){return e>0?Math.floor(e):Math.ceil(e)}function m(e,n){var s,i,a=e.length,r=n.length,o=new Array(a),c=0,u=t;for(i=0;i<r;i++)c=(s=e[i]+n[i]+c)>=u?1:0,o[i]=s-c*u;for(;i<a;)c=(s=e[i]+c)===u?1:0,o[i++]=s-c*u;return c>0&&o.push(c),o}function y(e,t){return e.length>=t.length?m(e,t):m(t,e)}function b(e,n){var s,i,a=e.length,r=new Array(a),o=t;for(i=0;i<a;i++)s=e[i]-o+n,n=Math.floor(s/o),r[i]=s-n*o,n+=1;for(;n>0;)r[i++]=n%o,n=Math.floor(n/o);return r}function _(e,t){var n,s,i=e.length,a=t.length,r=new Array(i),o=0;for(n=0;n<a;n++)(s=e[n]-o-t[n])<0?(s+=1e7,o=1):o=0,r[n]=s;for(n=a;n<i;n++){if(!((s=e[n]-o)<0)){r[n++]=s;break}s+=1e7,r[n]=s}for(;n<i;n++)r[n]=e[n];return g(r),r}function w(e,t,n){var s,i,a=e.length,r=new Array(a),u=-t;for(s=0;s<a;s++)i=e[s]+u,u=Math.floor(i/1e7),i%=1e7,r[s]=i<0?i+1e7:i;return"number"==typeof(r=f(r))?(n&&(r=-r),new c(r)):new o(r,n)}function v(e,t){var n,s,i,a,r=e.length,o=t.length,c=p(r+o);for(i=0;i<r;++i){a=e[i];for(var u=0;u<o;++u)n=a*t[u]+c[i+u],s=Math.floor(n/1e7),c[i+u]=n-1e7*s,c[i+u+1]+=s}return g(c),c}function A(e,n){var s,i,a=e.length,r=new Array(a),o=t,c=0;for(i=0;i<a;i++)s=e[i]*n+c,c=Math.floor(s/o),r[i]=s-c*o;for(;c>0;)r[i++]=c%o,c=Math.floor(c/o);return r}function I(e,t){for(var n=[];t-- >0;)n.push(0);return n.concat(e)}function P(e,n,s){return new o(e<t?A(n,e):v(n,d(e)),s)}function S(e){var t,n,s,i,a=e.length,r=p(a+a);for(s=0;s<a;s++){n=0-(i=e[s])*i;for(var o=s;o<a;o++)t=i*e[o]*2+r[s+o]+n,n=Math.floor(t/1e7),r[s+o]=t-1e7*n;r[s+a]=n}return g(r),r}function C(e,t){var n,s,i,a,r=e.length,o=p(r);for(i=0,n=r-1;n>=0;--n)i=(a=1e7*i+e[n])-(s=h(a/t))*t,o[n]=0|s;return[o,0|i]}function M(e,n){var s,i=K(n);if(a)return[new u(e.value/i.value),new u(e.value%i.value)];var l,m=e.value,y=i.value;if(0===y)throw new Error("Cannot divide by zero");if(e.isSmall)return i.isSmall?[new c(h(m/y)),new c(m%y)]:[r[0],e];if(i.isSmall){if(1===y)return[e,r[0]];if(-1==y)return[e.negate(),r[0]];var b=Math.abs(y);if(b<t){l=f((s=C(m,b))[0]);var w=s[1];return e.sign&&(w=-w),"number"==typeof l?(e.sign!==i.sign&&(l=-l),[new c(l),new c(w)]):[new o(l,e.sign!==i.sign),new c(w)]}y=d(b)}var v=k(m,y);if(-1===v)return[r[0],e];if(0===v)return[r[e.sign===i.sign?1:-1],r[0]];l=(s=m.length+y.length<=200?function(e,n){var s,i,a,r,o,c,u,l=e.length,d=n.length,g=t,h=p(n.length),m=n[d-1],y=Math.ceil(g/(2*m)),b=A(e,y),_=A(n,y);for(b.length<=l&&b.push(0),_.push(0),m=_[d-1],i=l-d;i>=0;i--){for(s=g-1,b[i+d]!==m&&(s=Math.floor((b[i+d]*g+b[i+d-1])/m)),a=0,r=0,c=_.length,o=0;o<c;o++)a+=s*_[o],u=Math.floor(a/g),r+=b[i+o]-(a-u*g),a=u,r<0?(b[i+o]=r+g,r=-1):(b[i+o]=r,r=0);for(;0!==r;){for(s-=1,a=0,o=0;o<c;o++)(a+=b[i+o]-g+_[o])<0?(b[i+o]=a+g,a=0):(b[i+o]=a,a=1);r+=a}h[i]=s}return b=C(b,y)[0],[f(h),f(b)]}(m,y):function(e,t){for(var n,s,i,a,r,o=e.length,c=t.length,u=[],l=[];o;)if(l.unshift(e[--o]),g(l),k(l,t)<0)u.push(0);else{i=1e7*l[(s=l.length)-1]+l[s-2],a=1e7*t[c-1]+t[c-2],s>c&&(i=1e7*(i+1)),n=Math.ceil(i/a);do{if(k(r=A(t,n),l)<=0)break;n--}while(n);u.push(n),l=_(l,r)}return u.reverse(),[f(u),f(l)]}(m,y))[0];var I=e.sign!==i.sign,P=s[1],S=e.sign;return"number"==typeof l?(I&&(l=-l),l=new c(l)):l=new o(l,I),"number"==typeof P?(S&&(P=-P),P=new c(P)):P=new o(P,S),[l,P]}function k(e,t){if(e.length!==t.length)return e.length>t.length?1:-1;for(var n=e.length-1;n>=0;n--)if(e[n]!==t[n])return e[n]>t[n]?1:-1;return 0}function E(e){var t=e.abs();return!t.isUnit()&&(!!(t.equals(2)||t.equals(3)||t.equals(5))||!(t.isEven()||t.isDivisibleBy(3)||t.isDivisibleBy(5))&&(!!t.lesser(49)||void 0))}function R(e,t){for(var n,s,a,r=e.prev(),o=r,c=0;o.isEven();)o=o.divide(2),c++;e:for(s=0;s<t.length;s++)if(!e.lesser(t[s])&&!(a=i(t[s]).modPow(o,e)).isUnit()&&!a.equals(r)){for(n=c-1;0!=n;n--){if((a=a.square().mod(e)).isUnit())return!1;if(a.equals(r))continue e}return!1}return!0}o.prototype=Object.create(r.prototype),c.prototype=Object.create(r.prototype),u.prototype=Object.create(r.prototype),o.prototype.add=function(e){var t=K(e);if(this.sign!==t.sign)return this.subtract(t.negate());var n=this.value,s=t.value;return t.isSmall?new o(b(n,Math.abs(s)),this.sign):new o(y(n,s),this.sign)},o.prototype.plus=o.prototype.add,c.prototype.add=function(e){var t=K(e),n=this.value;if(n<0!==t.sign)return this.subtract(t.negate());var s=t.value;if(t.isSmall){if(l(n+s))return new c(n+s);s=d(Math.abs(s))}return new o(b(s,Math.abs(n)),n<0)},c.prototype.plus=c.prototype.add,u.prototype.add=function(e){return new u(this.value+K(e).value)},u.prototype.plus=u.prototype.add,o.prototype.subtract=function(e){var t=K(e);if(this.sign!==t.sign)return this.add(t.negate());var n=this.value,s=t.value;return t.isSmall?w(n,Math.abs(s),this.sign):function(e,t,n){var s;return k(e,t)>=0?s=_(e,t):(s=_(t,e),n=!n),"number"==typeof(s=f(s))?(n&&(s=-s),new c(s)):new o(s,n)}(n,s,this.sign)},o.prototype.minus=o.prototype.subtract,c.prototype.subtract=function(e){var t=K(e),n=this.value;if(n<0!==t.sign)return this.add(t.negate());var s=t.value;return t.isSmall?new c(n-s):w(s,Math.abs(n),n>=0)},c.prototype.minus=c.prototype.subtract,u.prototype.subtract=function(e){return new u(this.value-K(e).value)},u.prototype.minus=u.prototype.subtract,o.prototype.negate=function(){return new o(this.value,!this.sign)},c.prototype.negate=function(){var e=this.sign,t=new c(-this.value);return t.sign=!e,t},u.prototype.negate=function(){return new u(-this.value)},o.prototype.abs=function(){return new o(this.value,!1)},c.prototype.abs=function(){return new c(Math.abs(this.value))},u.prototype.abs=function(){return new u(this.value>=0?this.value:-this.value)},o.prototype.multiply=function(e){var n,s,i,a=K(e),c=this.value,u=a.value,l=this.sign!==a.sign;if(a.isSmall){if(0===u)return r[0];if(1===u)return this;if(-1===u)return this.negate();if((n=Math.abs(u))<t)return new o(A(c,n),l);u=d(n)}return s=c.length,i=u.length,new o(-.012*s-.012*i+15e-6*s*i>0?function e(t,n){var s=Math.max(t.length,n.length);if(s<=30)return v(t,n);s=Math.ceil(s/2);var i=t.slice(s),a=t.slice(0,s),r=n.slice(s),o=n.slice(0,s),c=e(a,o),u=e(i,r),l=e(y(a,i),y(o,r)),d=y(y(c,I(_(_(l,c),u),s)),I(u,2*s));return g(d),d}(c,u):v(c,u),l)},o.prototype.times=o.prototype.multiply,c.prototype._multiplyBySmall=function(e){return l(e.value*this.value)?new c(e.value*this.value):P(Math.abs(e.value),d(Math.abs(this.value)),this.sign!==e.sign)},o.prototype._multiplyBySmall=function(e){return 0===e.value?r[0]:1===e.value?this:-1===e.value?this.negate():P(Math.abs(e.value),this.value,this.sign!==e.sign)},c.prototype.multiply=function(e){return K(e)._multiplyBySmall(this)},c.prototype.times=c.prototype.multiply,u.prototype.multiply=function(e){return new u(this.value*K(e).value)},u.prototype.times=u.prototype.multiply,o.prototype.square=function(){return new o(S(this.value),!1)},c.prototype.square=function(){var e=this.value*this.value;return l(e)?new c(e):new o(S(d(Math.abs(this.value))),!1)},u.prototype.square=function(e){return new u(this.value*this.value)},o.prototype.divmod=function(e){var t=M(this,e);return{quotient:t[0],remainder:t[1]}},u.prototype.divmod=c.prototype.divmod=o.prototype.divmod,o.prototype.divide=function(e){return M(this,e)[0]},u.prototype.over=u.prototype.divide=function(e){return new u(this.value/K(e).value)},c.prototype.over=c.prototype.divide=o.prototype.over=o.prototype.divide,o.prototype.mod=function(e){return M(this,e)[1]},u.prototype.mod=u.prototype.remainder=function(e){return new u(this.value%K(e).value)},c.prototype.remainder=c.prototype.mod=o.prototype.remainder=o.prototype.mod,o.prototype.pow=function(e){var t,n,s,i=K(e),a=this.value,o=i.value;if(0===o)return r[1];if(0===a)return r[0];if(1===a)return r[1];if(-1===a)return i.isEven()?r[1]:r[-1];if(i.sign)return r[0];if(!i.isSmall)throw new Error("The exponent "+i.toString()+" is too large.");if(this.isSmall&&l(t=Math.pow(a,o)))return new c(h(t));for(n=this,s=r[1];!0&o&&(s=s.times(n),--o),0!==o;)o/=2,n=n.square();return s},c.prototype.pow=o.prototype.pow,u.prototype.pow=function(e){var t=K(e),n=this.value,s=t.value,i=BigInt(0),a=BigInt(1),o=BigInt(2);if(s===i)return r[1];if(n===i)return r[0];if(n===a)return r[1];if(n===BigInt(-1))return t.isEven()?r[1]:r[-1];if(t.isNegative())return new u(i);for(var c=this,l=r[1];(s&a)===a&&(l=l.times(c),--s),s!==i;)s/=o,c=c.square();return l},o.prototype.modPow=function(e,t){if(e=K(e),(t=K(t)).isZero())throw new Error("Cannot take modPow with modulus 0");var n=r[1],s=this.mod(t);for(e.isNegative()&&(e=e.multiply(r[-1]),s=s.modInv(t));e.isPositive();){if(s.isZero())return r[0];e.isOdd()&&(n=n.multiply(s).mod(t)),e=e.divide(2),s=s.square().mod(t)}return n},u.prototype.modPow=c.prototype.modPow=o.prototype.modPow,o.prototype.compareAbs=function(e){var t=K(e),n=this.value,s=t.value;return t.isSmall?1:k(n,s)},c.prototype.compareAbs=function(e){var t=K(e),n=Math.abs(this.value),s=t.value;return t.isSmall?n===(s=Math.abs(s))?0:n>s?1:-1:-1},u.prototype.compareAbs=function(e){var t=this.value,n=K(e).value;return(t=t>=0?t:-t)===(n=n>=0?n:-n)?0:t>n?1:-1},o.prototype.compare=function(e){if(e===1/0)return-1;if(e===-1/0)return 1;var t=K(e),n=this.value,s=t.value;return this.sign!==t.sign?t.sign?1:-1:t.isSmall?this.sign?-1:1:k(n,s)*(this.sign?-1:1)},o.prototype.compareTo=o.prototype.compare,c.prototype.compare=function(e){if(e===1/0)return-1;if(e===-1/0)return 1;var t=K(e),n=this.value,s=t.value;return t.isSmall?n==s?0:n>s?1:-1:n<0!==t.sign?n<0?-1:1:n<0?1:-1},c.prototype.compareTo=c.prototype.compare,u.prototype.compare=function(e){if(e===1/0)return-1;if(e===-1/0)return 1;var t=this.value,n=K(e).value;return t===n?0:t>n?1:-1},u.prototype.compareTo=u.prototype.compare,o.prototype.equals=function(e){return 0===this.compare(e)},u.prototype.eq=u.prototype.equals=c.prototype.eq=c.prototype.equals=o.prototype.eq=o.prototype.equals,o.prototype.notEquals=function(e){return 0!==this.compare(e)},u.prototype.neq=u.prototype.notEquals=c.prototype.neq=c.prototype.notEquals=o.prototype.neq=o.prototype.notEquals,o.prototype.greater=function(e){return this.compare(e)>0},u.prototype.gt=u.prototype.greater=c.prototype.gt=c.prototype.greater=o.prototype.gt=o.prototype.greater,o.prototype.lesser=function(e){return this.compare(e)<0},u.prototype.lt=u.prototype.lesser=c.prototype.lt=c.prototype.lesser=o.prototype.lt=o.prototype.lesser,o.prototype.greaterOrEquals=function(e){return this.compare(e)>=0},u.prototype.geq=u.prototype.greaterOrEquals=c.prototype.geq=c.prototype.greaterOrEquals=o.prototype.geq=o.prototype.greaterOrEquals,o.prototype.lesserOrEquals=function(e){return this.compare(e)<=0},u.prototype.leq=u.prototype.lesserOrEquals=c.prototype.leq=c.prototype.lesserOrEquals=o.prototype.leq=o.prototype.lesserOrEquals,o.prototype.isEven=function(){return 0==(1&this.value[0])},c.prototype.isEven=function(){return 0==(1&this.value)},u.prototype.isEven=function(){return(this.value&BigInt(1))===BigInt(0)},o.prototype.isOdd=function(){return 1==(1&this.value[0])},c.prototype.isOdd=function(){return 1==(1&this.value)},u.prototype.isOdd=function(){return(this.value&BigInt(1))===BigInt(1)},o.prototype.isPositive=function(){return!this.sign},c.prototype.isPositive=function(){return this.value>0},u.prototype.isPositive=c.prototype.isPositive,o.prototype.isNegative=function(){return this.sign},c.prototype.isNegative=function(){return this.value<0},u.prototype.isNegative=c.prototype.isNegative,o.prototype.isUnit=function(){return!1},c.prototype.isUnit=function(){return 1===Math.abs(this.value)},u.prototype.isUnit=function(){return this.abs().value===BigInt(1)},o.prototype.isZero=function(){return!1},c.prototype.isZero=function(){return 0===this.value},u.prototype.isZero=function(){return this.value===BigInt(0)},o.prototype.isDivisibleBy=function(e){var t=K(e);return!t.isZero()&&(!!t.isUnit()||(0===t.compareAbs(2)?this.isEven():this.mod(t).isZero()))},u.prototype.isDivisibleBy=c.prototype.isDivisibleBy=o.prototype.isDivisibleBy,o.prototype.isPrime=function(e){var t=E(this);if(void 0!==t)return t;var n=this.abs(),s=n.bitLength();if(s<=64)return R(n,[2,3,5,7,11,13,17,19,23,29,31,37]);for(var a=Math.log(2)*s.toJSNumber(),r=Math.ceil(!0===e?2*Math.pow(a,2):a),o=[],c=0;c<r;c++)o.push(i(c+2));return R(n,o)},u.prototype.isPrime=c.prototype.isPrime=o.prototype.isPrime,o.prototype.isProbablePrime=function(e,t){var n=E(this);if(void 0!==n)return n;for(var s=this.abs(),a=void 0===e?5:e,r=[],o=0;o<a;o++)r.push(i.randBetween(2,s.minus(2),t));return R(s,r)},u.prototype.isProbablePrime=c.prototype.isProbablePrime=o.prototype.isProbablePrime,o.prototype.modInv=function(e){for(var t,n,s,a=i.zero,r=i.one,o=K(e),c=this.abs();!c.isZero();)t=o.divide(c),n=a,s=o,a=r,o=c,r=n.subtract(t.multiply(r)),c=s.subtract(t.multiply(c));if(!o.isUnit())throw new Error(this.toString()+" and "+e.toString()+" are not co-prime");return-1===a.compare(0)&&(a=a.add(e)),this.isNegative()?a.negate():a},u.prototype.modInv=c.prototype.modInv=o.prototype.modInv,o.prototype.next=function(){var e=this.value;return this.sign?w(e,1,this.sign):new o(b(e,1),this.sign)},c.prototype.next=function(){var e=this.value;return e+1<n?new c(e+1):new o(s,!1)},u.prototype.next=function(){return new u(this.value+BigInt(1))},o.prototype.prev=function(){var e=this.value;return this.sign?new o(b(e,1),!0):w(e,1,this.sign)},c.prototype.prev=function(){var e=this.value;return e-1>-n?new c(e-1):new o(s,!0)},u.prototype.prev=function(){return new u(this.value-BigInt(1))};for(var O=[1];2*O[O.length-1]<=t;)O.push(2*O[O.length-1]);var U=O.length,T=O[U-1];function B(e){return Math.abs(e)<=t}function D(e,t,n){t=K(t);for(var s=e.isNegative(),a=t.isNegative(),r=s?e.not():e,o=a?t.not():t,c=0,u=0,l=null,d=null,f=[];!r.isZero()||!o.isZero();)c=(l=M(r,T))[1].toJSNumber(),s&&(c=T-1-c),u=(d=M(o,T))[1].toJSNumber(),a&&(u=T-1-u),r=l[0],o=d[0],f.push(n(c,u));for(var g=0!==n(s?1:0,a?1:0)?i(-1):i(0),p=f.length-1;p>=0;p-=1)g=g.multiply(T).add(i(f[p]));return g}o.prototype.shiftLeft=function(e){var t=K(e).toJSNumber();if(!B(t))throw new Error(String(t)+" is too large for shifting.");if(t<0)return this.shiftRight(-t);var n=this;if(n.isZero())return n;for(;t>=U;)n=n.multiply(T),t-=U-1;return n.multiply(O[t])},u.prototype.shiftLeft=function(e){return e=K(e),new u(this.value<<e.value)},c.prototype.shiftLeft=o.prototype.shiftLeft,o.prototype.shiftRight=function(e){var t,n=K(e).toJSNumber();if(!B(n))throw new Error(String(n)+" is too large for shifting.");if(n<0)return this.shiftLeft(-n);for(var s=this;n>=U;){if(s.isZero()||s.isNegative()&&s.isUnit())return s;s=(t=M(s,T))[1].isNegative()?t[0].prev():t[0],n-=U-1}return(t=M(s,O[n]))[1].isNegative()?t[0].prev():t[0]},u.prototype.shiftRight=function(e){return e=K(e),new u(this.value>>e.value)},c.prototype.shiftRight=o.prototype.shiftRight,o.prototype.not=function(){return this.negate().prev()},u.prototype.not=c.prototype.not=o.prototype.not,o.prototype.and=function(e){return D(this,e,(function(e,t){return e&t}))},u.prototype.and=c.prototype.and=o.prototype.and,o.prototype.or=function(e){return D(this,e,(function(e,t){return e|t}))},u.prototype.or=c.prototype.or=o.prototype.or,o.prototype.xor=function(e){return D(this,e,(function(e,t){return e^t}))},u.prototype.xor=c.prototype.xor=o.prototype.xor;function x(e){var n=e.value,s="number"==typeof n?n|1<<30:"bigint"==typeof n?n|BigInt(1<<30):n[0]+n[1]*t|1073758208;return s&-s}function j(e,t){return e=K(e),t=K(t),e.greater(t)?e:t}function N(e,t){return e=K(e),t=K(t),e.lesser(t)?e:t}function F(e,t){if(e=K(e).abs(),t=K(t).abs(),e.equals(t))return e;if(e.isZero())return t;if(t.isZero())return e;for(var n,s,i=r[1];e.isEven()&&t.isEven();)n=N(x(e),x(t)),e=e.divide(n),t=t.divide(n),i=i.multiply(n);for(;e.isEven();)e=e.divide(x(e));do{for(;t.isEven();)t=t.divide(x(t));e.greater(t)&&(s=t,t=e,e=s),t=t.subtract(e)}while(!t.isZero());return i.isUnit()?e:e.multiply(i)}o.prototype.bitLength=function(){var e=this;return e.compareTo(i(0))<0&&(e=e.negate().subtract(i(1))),0===e.compareTo(i(0))?i(0):i(function e(t,n){if(n.compareTo(t)<=0){var s=e(t,n.square(n)),a=s.p,r=s.e,o=a.multiply(n);return o.compareTo(t)<=0?{p:o,e:2*r+1}:{p:a,e:2*r}}return{p:i(1),e:0}}(e,i(2)).e).add(i(1))},u.prototype.bitLength=c.prototype.bitLength=o.prototype.bitLength;var V=function(e,t,n,s){n=n||"0123456789abcdefghijklmnopqrstuvwxyz",e=String(e),s||(e=e.toLowerCase(),n=n.toLowerCase());var i,a=e.length,r=Math.abs(t),o={};for(i=0;i<n.length;i++)o[n[i]]=i;for(i=0;i<a;i++){if("-"!==(l=e[i])&&(l in o&&o[l]>=r)){if("1"===l&&1===r)continue;throw new Error(l+" is not a valid digit in base "+t+".")}}t=K(t);var c=[],u="-"===e[0];for(i=u?1:0;i<e.length;i++){var l;if((l=e[i])in o)c.push(K(o[l]));else{if("<"!==l)throw new Error(l+" is not a valid character");var d=i;do{i++}while(">"!==e[i]&&i<e.length);c.push(K(e.slice(d+1,i)))}}return L(c,t,u)};function L(e,t,n){var s,i=r[0],a=r[1];for(s=e.length-1;s>=0;s--)i=i.add(e[s].times(a)),a=a.times(t);return n?i.negate():i}function q(e,t){if((t=i(t)).isZero()){if(e.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(t.equals(-1)){if(e.isZero())return{value:[0],isNegative:!1};if(e.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-e.toJSNumber())).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var n=Array.apply(null,Array(e.toJSNumber()-1)).map(Array.prototype.valueOf,[0,1]);return n.unshift([1]),{value:[].concat.apply([],n),isNegative:!1}}var s=!1;if(e.isNegative()&&t.isPositive()&&(s=!0,e=e.abs()),t.isUnit())return e.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(e.toJSNumber())).map(Number.prototype.valueOf,1),isNegative:s};for(var a,r=[],o=e;o.isNegative()||o.compareAbs(t)>=0;){a=o.divmod(t),o=a.quotient;var c=a.remainder;c.isNegative()&&(c=t.minus(c).abs(),o=o.next()),r.push(c.toJSNumber())}return r.push(o.toJSNumber()),{value:r.reverse(),isNegative:s}}function H(e,t,n){var s=q(e,t);return(s.isNegative?"-":"")+s.value.map((function(e){return function(e,t){return e<(t=t||"0123456789abcdefghijklmnopqrstuvwxyz").length?t[e]:"<"+e+">"}(e,n)})).join("")}function z(e){if(l(+e)){var t=+e;if(t===h(t))return a?new u(BigInt(t)):new c(t);throw new Error("Invalid integer: "+e)}var n="-"===e[0];n&&(e=e.slice(1));var s=e.split(/e/i);if(s.length>2)throw new Error("Invalid integer: "+s.join("e"));if(2===s.length){var i=s[1];if("+"===i[0]&&(i=i.slice(1)),(i=+i)!==h(i)||!l(i))throw new Error("Invalid integer: "+i+" is not a valid exponent.");var r=s[0],d=r.indexOf(".");if(d>=0&&(i-=r.length-d-1,r=r.slice(0,d)+r.slice(d+1)),i<0)throw new Error("Cannot include negative exponent part for integers");e=r+=new Array(i+1).join("0")}if(!/^([0-9][0-9]*)$/.test(e))throw new Error("Invalid integer: "+e);if(a)return new u(BigInt(n?"-"+e:e));for(var f=[],p=e.length,m=p-7;p>0;)f.push(+e.slice(m,p)),(m-=7)<0&&(m=0),p-=7;return g(f),new o(f,n)}function K(e){return"number"==typeof e?function(e){if(a)return new u(BigInt(e));if(l(e)){if(e!==h(e))throw new Error(e+" is not an integer.");return new c(e)}return z(e.toString())}(e):"string"==typeof e?z(e):"bigint"==typeof e?new u(e):e}o.prototype.toArray=function(e){return q(this,e)},c.prototype.toArray=function(e){return q(this,e)},u.prototype.toArray=function(e){return q(this,e)},o.prototype.toString=function(e,t){if(void 0===e&&(e=10),10!==e)return H(this,e,t);for(var n,s=this.value,i=s.length,a=String(s[--i]);--i>=0;)n=String(s[i]),a+="0000000".slice(n.length)+n;return(this.sign?"-":"")+a},c.prototype.toString=function(e,t){return void 0===e&&(e=10),10!=e?H(this,e,t):String(this.value)},u.prototype.toString=c.prototype.toString,u.prototype.toJSON=o.prototype.toJSON=c.prototype.toJSON=function(){return this.toString()},o.prototype.valueOf=function(){return parseInt(this.toString(),10)},o.prototype.toJSNumber=o.prototype.valueOf,c.prototype.valueOf=function(){return this.value},c.prototype.toJSNumber=c.prototype.valueOf,u.prototype.valueOf=u.prototype.toJSNumber=function(){return parseInt(this.toString(),10)};for(var G=0;G<1e3;G++)r[G]=K(G),G>0&&(r[-G]=K(-G));return r.one=r[1],r.zero=r[0],r.minusOne=r[-1],r.max=j,r.min=N,r.gcd=F,r.lcm=function(e,t){return e=K(e).abs(),t=K(t).abs(),e.divide(F(e,t)).multiply(t)},r.isInstance=function(e){return e instanceof o||e instanceof c||e instanceof u},r.randBetween=function(e,n,s){e=K(e),n=K(n);var i=s||Math.random,a=N(e,n),o=j(e,n).subtract(a).add(1);if(o.isSmall)return a.add(Math.floor(i()*o));for(var c=q(o,t).value,u=[],l=!0,d=0;d<c.length;d++){var f=l?c[d]:t,g=h(i()*f);u.push(g),g<f&&(l=!1)}return a.add(r.fromArray(u,t,!1))},r.fromArray=function(e,t,n){return L(e.map(K),K(t||10),n)},r}();e.hasOwnProperty("exports")&&(e.exports=i),void 0===(s=function(){return i}.call(t,n,t,e))||(e.exports=s)}).call(this,n(76)(e))},function(e,t,n){"use strict";n.d(t,"c",(function(){return r})),n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return c}));var s=n(0),i=n(5),a=n(3);function r(e){if(e instanceof s.Api.Message||e instanceof s.Api.MessageService)return Object(a.k)(e.peerId)}function o(e){const t=`${r(e)}-${e.id}`;i.a.messages[t]=e,e instanceof s.Api.Message&&e.media instanceof s.Api.MessageMediaDocument&&e.media.document instanceof s.Api.Document&&(i.a.documents[String(e.media.document.id)]=e.media.document),e instanceof s.Api.MessageService&&"photo"in e.action&&c(e.action.photo)}function c(e){e instanceof s.Api.Photo&&(i.a.photos[String(e.id)]=e)}},function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"g",(function(){return u})),n.d(t,"e",(function(){return l})),n.d(t,"f",(function(){return d})),n.d(t,"i",(function(){return f})),n.d(t,"h",(function(){return g})),n.d(t,"b",(function(){return p})),n.d(t,"c",(function(){return h})),n.d(t,"d",(function(){return m})),n.d(t,"l",(function(){return b})),n.d(t,"j",(function(){return _})),n.d(t,"k",(function(){return w})),n.d(t,"m",(function(){return v})),n.d(t,"n",(function(){return A})),n.d(t,"o",(function(){return I}));var s=n(0),i=n(4);const a={PHONE_NUMBER_INVALID:"Invalid Phone Number",PHONE_CODE_INVALID:"Invalid Code",PASSWORD_HASH_INVALID:"Invalid Password",PHONE_PASSWORD_FLOOD:"You have tried logging in too many times"},r={};let o;function c(e){o=e}function u(){return o(y("authorizationStateWaitPhoneNumber")),new Promise((e,t)=>{r.resolve=e,r.reject=t})}function l(e=!1){return o({...y("authorizationStateWaitCode"),isCodeViaApp:e}),new Promise((e,t)=>{r.resolve=e,r.reject=t})}function d(e){return o({...y("authorizationStateWaitPassword"),hint:e}),new Promise(e=>{r.resolve=e})}function f(){return o(y("authorizationStateWaitRegistration")),new Promise(e=>{r.resolve=e})}function g(e){return o({...y("authorizationStateWaitQrCode"),qrCode:{token:btoa(String.fromCharCode(...e.token)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),expires:e.expires}}),new Promise((e,t)=>{r.reject=t})}function p(e){let t;if(e instanceof s.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=a[e.message];t||(t="Unexpected Error",i.f&&console.error(e)),o({"@type":"updateAuthorizationError",message:t})}function h(e){o({...y("authorizationStateReady"),sessionId:e})}function m(e){o({"@type":"updateCurrentUser",currentUser:e})}function y(e){return{"@type":"updateAuthorizationState",authorizationState:e}}function b(e){r.resolve&&r.resolve(e)}function _(e){r.resolve&&r.resolve(e)}function w(e){r.resolve&&r.resolve(e)}function v(e){const{firstName:t,lastName:n}=e;r.resolve&&r.resolve([t,n])}function A(){r.reject&&r.reject(new Error("RESTART_AUTH"))}function I(){r.reject&&r.reject(new Error("RESTART_AUTH_WITH_QR"))}},function(e,t,n){"use strict";function s(e,t=!1,n="image/jpeg"){return`${t?"":`data:${n};base64,`}${btoa(String.fromCharCode(...e))}`}function i(e){if(!e)return;const{flags:t,CONSTRUCTOR_ID:n,SUBCLASS_OF_ID:s,className:i,classType:a,...r}=e;return r}n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return i}))},function(e,t,n){"use strict";n.d(t,"e",(function(){return c})),n.d(t,"c",(function(){return u})),n.d(t,"d",(function(){return l})),n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return f}));var s=n(0),i=n(21),a=n(18);function r(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 o={w:100,h:100};function c(e,t){if(!e||!e.length)return;const n=e.find(e=>e instanceof s.Api.PhotoStrippedSize);if(!n)return;const r=e.filter(e=>e instanceof s.Api.PhotoSize),{w:c,h:u}=r&&r.length?r[r.length-1]:o,{bytes:l}=n;return{dataUri:Object(a.a)(t&&"image/jpeg"!==t?l:Object(i.strippedPhotoToJpg)(l),void 0,t),width:c,height:u}}function u(e){const{w:t,h:n,bytes:s}=e;return{dataUri:Object(a.a)(s,void 0,"image/webp"),width:t,height:n}}function l(e,t){const{w:n,h:s}=t;return{dataUri:"data:image/svg+xml;utf8,"+r(e.bytes,n,s),width:n,height:s}}function d(e){const t=e.sizes.filter(e=>e instanceof s.Api.PhotoSize).map(f);return{id:String(e.id),thumbnail:c(e.sizes),sizes:t}}function f(e){const{w:t,h:n,type:s}=e;return{width:t,height:n,type:s}}},function(e,t,n){const s=n(6),{serializeBytes:i,serializeDate:a}=n(45);e.exports={constructors:s,requests:s,patched:null,serializeBytes:i,serializeDate:a}},function(e,t,n){(function(t){const{constructors:s}=n(20),i=(new RegExp("@|(?:https?:\\/\\/)?(?:www\\.)?(?:telegram\\.(?:me|dog)|t\\.me)\\/(@|joinchat\\/)?"),t.from("ffd8ffe000104a46494600010100000100010000ffdb004300281c1e231e19282321232d2b28303c64413c37373c7b585d4964918099968f808c8aa0b4e6c3a0aadaad8a8cc8ffcbdaeef5ffffff9bc1fffffffaffe6fdfff8ffdb0043012b2d2d3c353c76414176f8a58ca5f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8ffc00011080000000003012200021101031101ffc4001f0000010501010101010100000000000000000102030405060708090a0bffc400b5100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9faffc4001f0100030101010101010101010000000000000102030405060708090a0bffc400b51100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffda000c03010002110311003f00","hex")),a=t.from("ffd9","hex");new RegExp("tg:\\/\\/(join)\\?invite="),new RegExp("^([a-z]((?!__)[\\w\\d]){3,30}[a-z\\d]|gif|vid|pic|bing|wiki|imdb|bold|vote|like|coub)$");function r(e,t){throw new Error(`Cannot cast ${e.className} to any kind of ${t}`)}e.exports={getMessageId:function(e){if(null==e)return null;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,i=!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 s.User){if(t.isSelf&&n)return new s.InputPeerSelf;if(void 0===t.accessHash&&i)throw new Error("User without accessHash or min info cannot be input");return new s.InputPeerUser({userId:t.id,accessHash:t.accessHash})}if(t instanceof s.Chat||t instanceof s.ChatEmpty||t instanceof s.ChatForbidden)return new s.InputPeerChat({chatId:t.id});if(t instanceof s.Channel){if(void 0===t.accessHash&&i)throw new TypeError("Channel without accessHash or min info cannot be input");return new s.InputPeerChannel({channelId:t.id,accessHash:t.accessHash})}return t instanceof s.ChannelForbidden?new s.InputPeerChannel({channelId:t.id,accessHash:t.accessHash}):t instanceof s.InputUser?new s.InputPeerUser({userId:t.userId,accessHash:t.accessHash}):t instanceof s.InputChannel?new s.InputPeerChannel({channelId:t.channelId,accessHash:t.accessHash}):t instanceof s.UserEmpty?new s.InputPeerEmpty:t instanceof s.UserFull?e(t.user):t instanceof s.ChatFull?new s.InputPeerChat({chatId:t.id}):t instanceof s.PeerChat?new s.InputPeerChat(t.chatId):void r(t,"InputPeer")},getDisplayName:function(e){return e instanceof s.User?e.lastName&&e.firstName?`${e.firstName} ${e.lastName}`:e.firstName?e.firstName:e.lastName?e.lastName:"":e instanceof s.Chat||e instanceof s.Channel?e.title:""},getAppropriatedPartSize:function(e){if(e<=104857600)return 128;if(e<=786432e3)return 256;if(e<=1572864e3)return 512;throw new Error("File size too large")},strippedPhotoToJpg:function(e){if(e.length<3||1!==e[0])return e;const n=t.from(i);return n[164]=e[1],n[166]=e[2],t.concat([n,e.slice(3),a])},getDC:function(e,t=!1){switch(e){case 1:return{id:1,ipAddress:"pluto.web.telegram.org",port:443};case 2:return{id:2,ipAddress:"venus.web.telegram.org",port:443};case 3:return{id:3,ipAddress:"aurora.web.telegram.org",port:443};case 4:return{id:4,ipAddress:"vesta.web.telegram.org",port:443};case 5:return{id:5,ipAddress:"flora.web.telegram.org",port:443};default:throw new Error("Cannot find the DC with the ID of "+e)}}}}).call(this,n(12).Buffer)},function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return c})),n.d(t,"c",(function(){return u}));var s=n(0),i=n(4),a=n(19),r=n(5);function o(e){if(e instanceof s.Api.DocumentEmpty)return;const t=e.attributes.find(e=>e instanceof s.Api.DocumentAttributeSticker);if(!t)return;const n=e.attributes.find(e=>e instanceof s.Api.DocumentAttributeImageSize),r=t.stickerset,o=t.alt,c="application/x-tgsticker"===e.mimeType,u=e.thumbs&&e.thumbs.find(e=>e instanceof s.Api.PhotoCachedSize),l=e.thumbs&&e.thumbs.find(e=>e instanceof s.Api.PhotoPathSize),d=u?Object(a.c)(u):l&&n?Object(a.d)(l,n):void 0,{w:f,h:g}=u||n||{};return{id:String(e.id),stickerSetId:r.id?String(r.id):i.r,stickerSetAccessHash:String(r.accessHash),emoji:o,isAnimated:c,width:f,height:g,thumbnail:d}}function c(e){const{archived:t,animated:n,installedDate:s,id:i,accessHash:a,title:r,thumb:o,count:c,hash:u}=e;return{archived:t,isAnimated:n,installedDate:s,id:String(i),accessHash:String(a),title:r,hasThumbnail:Boolean(o),count:c,hash:u}}function u(e){const t=c(e.set),n=e instanceof s.Api.StickerSetMultiCovered?e.covers:[e.cover];return t.covers=[],n.forEach(e=>{if(e instanceof s.Api.Document){const n=o(e);n&&(t.covers.push(n),r.a.documents[String(e.id)]=e)}}),t}},function(e,t){class n extends Error{constructor(){super("The read operation was cancelled.")}}class s 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 i 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=null;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 r 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 c,u,l;l={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."},(u="ErrorMessages")in(c=o)?Object.defineProperty(c,u,{value:l,enumerable:!0,configurable:!0,writable:!0}):c[u]=l,e.exports={ReadCancelledError:n,TypeNotFoundError:s,InvalidChecksumError:i,InvalidBufferError:a,SecurityError:r,CdnFileTamperedError:class extends r{constructor(){super("The CDN file has been altered and its download cancelled.")}},BadMessageError:o}},function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return o})),n.d(t,"c",(function(){return c})),n.d(t,"d",(function(){return u}));var s=n(0),i=n(9),a=n(14);function r(e){if(e instanceof s.Api.WallPaperNoFile)return;const{slug:t}=e,n=Object(i.a)(e.document);return n?{slug:t,document:n}:void 0}function o(e){return{isCurrent:Boolean(e.current),isOfficialApp:Boolean(e.officialApp),isPasswordPending:Boolean(e.passwordPending),hash:String(e.hash),...Object(a.b)(e,["deviceModel","platform","systemVersion","appName","appVersion","dateCreated","dateActive","ip","country","region"])}}function c(e){switch(e.className){case"PrivacyKeyPhoneNumber":return"phoneNumber";case"PrivacyKeyStatusTimestamp":return"lastSeen";case"PrivacyKeyProfilePhoto":return"profilePhoto";case"PrivacyKeyForwards":return"forwards";case"PrivacyKeyChatInvite":return"chatInvite"}}function u(e){let t,n,i,a,r;return e.forEach(e=>{e instanceof s.Api.PrivacyValueAllowAll?t=t||"everybody":e instanceof s.Api.PrivacyValueAllowContacts?t=t||"contacts":e instanceof s.Api.PrivacyValueDisallowContacts?t=t||"nonContacts":e instanceof s.Api.PrivacyValueDisallowAll?t=t||"nobody":e instanceof s.Api.PrivacyValueAllowUsers?n=e.users:e instanceof s.Api.PrivacyValueDisallowUsers?a=e.users:e instanceof s.Api.PrivacyValueAllowChatParticipants?i=e.chats.map(e=>-e):e instanceof s.Api.PrivacyValueDisallowChatParticipants&&(r=e.chats.map(e=>-e))}),t||(t="nobody"),{visibility:t,allowUserIds:n||[],allowChatIds:i||[],blockUserIds:a||[],blockChatIds:r||[]}}},function(e,t,n){const{TypeNotFoundError:s}=n(23),{coreObjects:i}=n(51),{tlobjects:a}=n(53),{readBigIntFromBuffer:r}=n(8);e.exports=class{constructor(e){this.stream=e,this._last=null,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 r(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=a[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=i[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=null}tellPosition(){return this.offset}setPosition(e){this.offset=e}seek(e){this.offset+=e}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return m})),n.d(t,"b",(function(){return b}));var s=n(0),i=n(14),a=n(9),r=n(3),o=n(13),c=n(2),u=n(5),l=n(18),d=n(4),f=n(16),g=n(24),p=n(19);let h;function m(e){h=e}const y=new Set;function b(e,t){if(e instanceof s.connection.UpdateConnectionState){let t;switch(e.state){case s.connection.UpdateConnectionState.disconnected:t="connectionStateConnecting";break;case s.connection.UpdateConnectionState.broken:t="connectionStateBroken";break;case s.connection.UpdateConnectionState.connected:default:t="connectionStateReady"}h({"@type":"updateConnectionState",connectionState:t})}else if(e instanceof s.Api.UpdateNewMessage||e instanceof s.Api.UpdateNewScheduledMessage||e instanceof s.Api.UpdateNewChannelMessage||e instanceof s.Api.UpdateShortChatMessage||e instanceof s.Api.UpdateShortMessage||e instanceof s.Api.UpdateServiceNotification){let t;if(e instanceof s.Api.UpdateShortChatMessage)t=Object(a.e)(e);else if(e instanceof s.Api.UpdateShortMessage)t=Object(a.d)(e);else if(e instanceof s.Api.UpdateServiceNotification){const n=Date.now();t=Object(a.c)(e,n),Object(c.t)(e)&&Object(f.a)(Object(c.m)(t.id,t.chatId,e))}else{if(e.message instanceof s.Api.MessageEmpty)return void(d.f&&console.error("Unexpected update:",e.className,e));e.message instanceof s.Api.Message&&Object(c.t)(e.message)&&Object(f.a)(e.message),t=Object(a.b)(e.message)}const n=e._entities;if(n&&n.length&&(n.filter(e=>e instanceof s.Api.User).map(o.a).forEach(e=>{e&&h({"@type":"updateUser",id:e.id,user:e})}),n.filter(e=>e instanceof s.Api.Chat||e instanceof s.Api.Channel).map(e=>Object(r.d)(e)).forEach(e=>{e&&h({"@type":"updateChat",id:e.id,chat:e})})),e instanceof s.Api.UpdateNewScheduledMessage?h({"@type":y.has(t.id)?"updateScheduledMessage":"newScheduledMessage",id:t.id,chatId:t.chatId,message:t}):h({"@type":y.has(t.id)?"updateMessage":"newMessage",id:t.id,chatId:t.chatId,message:t}),e.message instanceof s.Api.MessageService){const{action:n}=e.message;if(n instanceof s.Api.MessageActionChatEditTitle)h({"@type":"updateChat",id:t.chatId,chat:{title:n.title}});else if(n instanceof s.Api.MessageActionChatEditPhoto){const i=Object(c.c)(n.photo),a=Object(r.e)(i),o=Math.abs(Object(f.c)(e.message));u.a.chats[o]&&(u.a.chats[o].photo=i),Object(f.b)(n.photo),a&&h({"@type":"updateChat",id:t.chatId,chat:{avatarHash:a},...n.photo instanceof s.Api.Photo&&{newProfilePhoto:Object(p.a)(n.photo)}})}else if(n instanceof s.Api.MessageActionChatDeletePhoto){const n=Math.abs(Object(f.c)(e.message));u.a.chats[n]&&(u.a.chats[n].photo=new s.Api.ChatPhotoEmpty),h({"@type":"updateChat",id:t.chatId,chat:{avatarHash:void 0}})}else n instanceof s.Api.MessageActionChatDeleteUser?e._entities&&e._entities.some(e=>e instanceof s.Api.User&&!!e.self&&e.id===n.userId)&&h({"@type":"updateChatLeave",id:t.chatId}):n instanceof s.Api.MessageActionChatAddUser&&e._entities&&e._entities.some(e=>e instanceof s.Api.User&&!!e.self&&n.users.includes(e.id))&&h({"@type":"updateChatJoin",id:t.chatId})}}else if(e instanceof s.Api.UpdateEditMessage||e instanceof s.Api.UpdateEditChannelMessage){if(e.message instanceof s.Api.MessageEmpty)return void(d.f&&console.error("Unexpected update:",e.className,e));e.message instanceof s.Api.Message&&Object(c.t)(e.message)&&Object(f.a)(e.message);const t=Object(a.b)(e.message);h({"@type":"updateMessage",id:t.id,chatId:t.chatId,message:t})}else if(e instanceof s.Api.UpdateDeleteMessages)h({"@type":"deleteMessages",ids:e.messages});else if(e instanceof s.Api.UpdateDeleteScheduledMessages)h({"@type":"deleteScheduledMessages",ids:e.messages,chatId:Object(r.j)(e.peer)});else if(e instanceof s.Api.UpdateDeleteChannelMessages){const t=Object(r.k)({channelId:e.channelId}),n=e.messages,i=n.filter(e=>u.a.messages[`${t}-${e}`]),a=n.filter(e=>!u.a.messages[`${t}-${e}`]),o=n.map(e=>{const n=u.a.messages[`${t}-${e}`];return n&&n instanceof s.Api.MessageService&&"photo"in n.action?String(n.action.photo.id):void 0}).filter(Boolean);i.length&&h({"@type":"deleteMessages",ids:i,chatId:t}),o.length&&h({"@type":"deleteProfilePhotos",ids:o,chatId:t}),a.length&&setTimeout(()=>{h({"@type":"deleteMessages",ids:a,chatId:t})},1e3)}else if((t instanceof s.Api.messages.SendMessage||t instanceof s.Api.messages.SendMedia||t instanceof s.Api.messages.SendMultiMedia||t instanceof s.Api.messages.ForwardMessages)&&(e instanceof s.Api.UpdateMessageID||e instanceof s.Api.UpdateShortSentMessage)){let n;"randomId"in e?n=e.randomId:"randomId"in t&&(n=t.randomId);const i=n&&u.a.localMessages[n.toString()];if(!i)throw new Error("Local message not found");let r;if(e instanceof s.Api.UpdateShortSentMessage){i.content.text&&e.entities&&(r={text:Object(a.j)(i.content.text.text,e.entities)}),e.media&&(r={...r,...Object(a.i)(e.media)});const t=Object(c.m)(e.id,i.chatId,e);Object(c.t)(t)&&Object(f.a)(t)}y.add(e.id);const o="date"in e&&1e3*e.date<Date.now();h({"@type":i.isScheduled&&!o?"updateScheduledMessageSendSucceeded":"updateMessageSendSucceeded",chatId:i.chatId,localId:i.id,message:{...i,...r&&{content:{...i.content,...r}},id:e.id,sendingState:void 0,..."date"in e&&{date:e.date}}})}else if(e instanceof s.Api.UpdateReadMessagesContents)h({"@type":"updateCommonBoxMessages",ids:e.messages,messageUpdate:{hasUnreadMention:!1,isMediaUnread:!1}});else if(e instanceof s.Api.UpdateChannelReadMessagesContents)h({"@type":"updateChannelMessages",channelId:e.channelId,ids:e.messages,messageUpdate:{hasUnreadMention:!1,isMediaUnread:!1}});else if(e instanceof s.Api.UpdateMessagePoll){const{pollId:t,poll:n,results:s}=e;if(n){const e=Object(a.k)(n,s);h({"@type":"updateMessagePoll",pollId:t.toString(),pollUpdate:e})}else{const e=Object(a.l)(s);h({"@type":"updateMessagePoll",pollId:t.toString(),pollUpdate:{results:e}})}}else if(e instanceof s.Api.UpdateMessagePollVote)h({"@type":"updateMessagePollVote",pollId:e.pollId.toString(),userId:e.userId,options:e.options.map(e=>String.fromCharCode(...e))});else if(e instanceof s.Api.UpdateChannelMessageViews)h({"@type":"updateMessage",chatId:Object(r.k)({channelId:e.channelId}),id:e.id,message:{views:e.views}});else if(e instanceof s.Api.UpdateReadHistoryInbox)h({"@type":"updateChatInbox",id:Object(r.k)(e.peer),chat:{lastReadInboxMessageId:e.maxId,unreadCount:e.stillUnreadCount}});else if(e instanceof s.Api.UpdateReadHistoryOutbox)h({"@type":"updateChat",id:Object(r.k)(e.peer),chat:{lastReadOutboxMessageId:e.maxId}});else if(e instanceof s.Api.UpdateReadChannelInbox)h({"@type":"updateChat",id:Object(r.k)({channelId:e.channelId}),chat:{lastReadInboxMessageId:e.maxId,unreadCount:e.stillUnreadCount}});else if(e instanceof s.Api.UpdateReadChannelOutbox)h({"@type":"updateChat",id:Object(r.k)({channelId:e.channelId}),chat:{lastReadOutboxMessageId:e.maxId}});else if(e instanceof s.Api.UpdateDialogPinned&&e.peer instanceof s.Api.DialogPeer)h({"@type":"updateChatPinned",id:Object(r.k)(e.peer.peer),isPinned:e.pinned||!1});else if(e instanceof s.Api.UpdatePinnedDialogs){const t=e.order?e.order.filter(e=>e instanceof s.Api.DialogPeer).map(e=>Object(r.k)(e.peer)):[];h({"@type":"updatePinnedChatIds",ids:t,folderId:e.folderId||void 0})}else if(e instanceof s.Api.UpdateFolderPeers)e.folderPeers.forEach(e=>{const{folderId:t,peer:n}=e;h({"@type":"updateChatListType",id:Object(r.k)(n),folderId:t})});else if(e instanceof s.Api.UpdateDialogFilter){const{id:t,filter:n}=e,s=n?Object(r.a)(n):void 0;h({"@type":"updateChatFolder",id:t,folder:s})}else if(e instanceof s.Api.UpdateDialogFilterOrder)h({"@type":"updateChatFoldersOrder",orderedIds:e.order});else if(e instanceof s.Api.UpdateChatParticipants){const t=Object(r.h)(e.participants);h({"@type":"updateChatMembers",id:Object(r.k)({chatId:e.participants.chatId}),replacedMembers:t})}else if(e instanceof s.Api.UpdateChatParticipantAdd){const t=Object(r.g)(Object(i.b)(e,["userId","inviterId","date"]));h({"@type":"updateChatMembers",id:Object(r.k)({chatId:e.chatId}),addedMember:t})}else if(e instanceof s.Api.UpdateChatParticipantDelete){const{userId:t}=e;h({"@type":"updateChatMembers",id:Object(r.k)({chatId:e.chatId}),deletedMemberId:t})}else if(e instanceof s.Api.UpdatePinnedMessages||e instanceof s.Api.UpdatePinnedChannelMessages){const t=e instanceof s.Api.UpdatePinnedMessages?e.peer:{channelId:e.channelId},n=Object(r.k)(t);h({"@type":"updatePinnedIds",chatId:n,messageIds:e.messages,isPinned:e.pinned})}else if(e instanceof s.Api.UpdateNotifySettings&&e.peer instanceof s.Api.NotifyPeer){const{silent:t,muteUntil:n}=e.notifySettings;h({"@type":"updateChat",id:Object(r.k)(e.peer.peer),chat:{isMuted:t||"number"==typeof n&&Date.now()<1e3*n}})}else if(e instanceof s.Api.UpdateUserTyping||e instanceof s.Api.UpdateChatUserTyping){const t=e instanceof s.Api.UpdateUserTyping?e.userId:Object(r.k)({chatId:e.chatId});h({"@type":"updateChatTypingStatus",id:t,typingStatus:Object(r.i)(e)})}else if(e instanceof s.Api.UpdateChannelUserTyping){const t=Object(r.k)({channelId:e.channelId});h({"@type":"updateChatTypingStatus",id:t,typingStatus:Object(r.i)(e)})}else if(e instanceof s.Api.UpdateChannel){const{_entities:t}=e;if(!t)return;const n=t.find(e=>e instanceof s.Api.Channel||e instanceof s.Api.ChannelForbidden);if(n instanceof s.Api.Channel){const t=Object(r.d)(n);t&&(h({"@type":"updateChat",id:t.id,chat:t}),h({"@type":t.isNotJoined?"updateChatLeave":"updateChatJoin",id:Object(r.k)({channelId:e.channelId})}))}else if(n instanceof s.Api.ChannelForbidden){const t=Object(r.k)({channelId:e.channelId});h({"@type":"updateChat",id:t,chat:{isRestricted:!0}}),h({"@type":"updateChatLeave",id:t})}else 0===t.length&&h({"@type":"resetMessages",id:Object(r.k)({chatId:e.channelId})})}else if(e instanceof s.Api.UpdateDialogUnreadMark&&e.peer instanceof s.Api.DialogPeer)h({"@type":"updateChat",id:Object(r.k)(e.peer.peer),chat:{hasUnreadMark:e.unread}});else if(e instanceof s.Api.UpdateChatDefaultBannedRights)h({"@type":"updateChat",id:Object(r.k)(e.peer),chat:{defaultBannedRights:Object(l.b)(e.defaultBannedRights)}});else if(e instanceof s.Api.UpdateUserStatus){const{userId:t,status:n}=e;h({"@type":"updateUserStatus",userId:t,status:Object(o.c)(n)})}else if(e instanceof s.Api.UpdateUserName){const t=u.a.users[e.userId],n=t&&t.mutualContact&&!t.self?Object(i.b)(e,["username"]):Object(i.b)(e,["firstName","lastName","username"]);h({"@type":"updateUser",id:e.userId,user:n})}else if(e instanceof s.Api.UpdateUserPhoto){const{userId:t,photo:n}=e,s=Object(r.e)(n);u.a.users[t]&&(u.a.users[t].photo=n),h({"@type":"updateUser",id:t,user:{avatarHash:s}})}else if(e instanceof s.Api.UpdateUserPhone){const{userId:t,phone:n}=e;h({"@type":"updateUser",id:t,user:{phoneNumber:n}})}else if(e instanceof s.Api.UpdatePeerSettings){const{_entities:t}=e;if(!t)return;t&&t.length&&(t.filter(e=>e instanceof s.Api.User&&!e.contact).forEach(e=>{h({"@type":"deleteUser",id:e.id})}),t.filter(e=>e instanceof s.Api.User&&e.contact).map(o.a).forEach(e=>{e&&h({"@type":"updateUser",id:e.id,user:e})}))}else if(e instanceof s.Api.UpdateNotifySettings){const{notifySettings:{showPreviews:t,silent:n,muteUntil:s},peer:{className:i}}=e,a="NotifyUsers"===i?"contact":"NotifyChats"===i?"group":"NotifyBroadcasts"===i?"broadcast":void 0;if(!a)return;h({"@type":"updateNotifySettings",peerType:a,isSilent:Boolean(n||"number"==typeof s&&Date.now()<1e3*s),isShowPreviews:Boolean(t)})}else if(e instanceof s.Api.UpdatePeerBlocked)h({"@type":"updatePeerBlocked",id:Object(r.k)(e.peerId),isBlocked:e.blocked});else if(e instanceof s.Api.UpdatePrivacy){const t=Object(g.c)(e.key);t&&h({"@type":"updatePrivacy",key:t,rules:Object(g.d)(e.rules)})}else if(e instanceof s.Api.UpdateContactsReset)h({"@type":"updateResetContactList"});else if(e instanceof s.Api.UpdateFavedStickers)h({"@type":"updateFavoriteStickers"});else if(d.f){const t="object"==typeof e&&"className"in e?e.className:e;console.warn("[GramJs/updater] Unexpected update:",t)}}},function(e,t,n){const{RPCError:s}=n(37),{rpcErrorRe:i}=n(48);e.exports={RPCMessageToError:function(e,t){for(const[n,s]of i){const i=e.errorMessage.match(n);if(i){return new s({request:t,capture:2===i.length?parseInt(i[1]):null})}}return new s(e.errorMessage,t)},...n(23),...n(37),...n(48)}},function(e,t,n){"use strict";function s(e,t,n=!0){let s,i,a;return(...r)=>{i=!0,a=r,s||(n&&(i=!1,e(...a)),s=self.setInterval(()=>{if(!i)return self.clearInterval(s),void(s=void 0);i=!1,e(...a)},t))}}function i(e){return a(r,e)}function a(e,t){let n,s=!1;return(...i)=>{n=i,s||(s=!0,e(()=>{s=!1,t(...n)}))}}function r(e){Promise.resolve().then(e)}n.d(t,"b",(function(){return s})),n.d(t,"c",(function(){return i})),n.d(t,"a",(function(){return o}));const o=e=>new Promise(t=>{setTimeout(()=>t(),e)})},function(e,t,n){(function(t){const s=n(15),{constructors:i}=(n(62),n(20)),{readBigIntFromBuffer:a,readBufferFromBigInt:r,sha256:o,bigIntMod:c,modExp:u,generateRandomBytes:l}=n(8),d=n(36);function f(e,n){if(!t.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(n))throw new Error("Changing passwords unsupported")}function g(e){return t.concat([t.alloc(256-e.length),e])}function p(e){return r(e,256,!1)}function h(e,t){const n=t.subtract(e);return!(n.lesser(s(0))||n.bitLength()<1984||e.bitLength()<1984||Math.floor((e.bitLength()+7)/8)>256)}function m(e,t){const n=Math.min(e.length,t.length);for(let s=0;s<n;s++)e[s]=e[s]^t[s];return e}async function y(e,n){const s=await o(t.concat([e.salt1,t.from(n,"utf-8"),e.salt1])),i=await o(t.concat([e.salt2,s,e.salt2])),a=await function(e,t,n){return d.pbkdf2(e,t,n,64,"sha512")}(i,e.salt1,1e5);return o(t.concat([e.salt2,a,e.salt2]))}e.exports={computeCheck:async function(e,n){const r=e.currentAlgo;if(!(r instanceof i.PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow))throw new Error("Unsupported password algorithm "+r.className);const d=await y(r,n),b=a(r.p,!1),{g:_}=r,w=a(e.srp_B,!1);try{f(r.p,_)}catch(e){throw new Error("bad /g in password")}if(!function(e,t){return e.greater(s(0))&&t.subtract(e).greater(s(0))}(w,b))throw new Error("bad b in check");const v=a(d,!1),A=g(r.p),I=p(_),P=g(e.srp_B),S=u(s(_),v,b),C=a(await o(t.concat([A,I])),!1),M=c(C.multiply(S),b),[k,E,R]=await(async()=>{for(;;){const e=l(256),n=a(e,!1),i=u(s(_),n,b);if(h(i,b)){const e=p(i),r=a(await o(t.concat([e,P])),!1);if(r.greater(s(0)))return[n,e,r]}}})(),O=c(w.subtract(M),b);if(!h(O,b))throw new Error("bad gB");const U=R.multiply(v),T=k.add(U),B=u(O,T,b),[D,x,j,N,F]=await Promise.all([o(p(B)),o(A),o(I),o(r.salt1),o(r.salt2)]),V=await o(t.concat([m(x,j),N,F,E,P,D]));return new i.InputCheckPasswordSRP({srpId:e.srpId,A:t.from(E),M1:V})},computeDigest:async function(e,t){try{f(e.p,e.g)}catch(e){throw new Error("bad p/g in password")}return p(u(s(e.g),a(await y(e,t),!1),a(e.p,!1)))}}}).call(this,n(12).Buffer)},function(e,t,n){n(21),n(20).constructors;const s=n(49);e.exports=class extends s{constructor(){super(),this._serverAddress=null,this._dcId=0,this._port=null,this._takeoutId=null,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}}},function(e,t,n){(function(t){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{inflate:i}=n(43),{serializeBytes:a}=n(20);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 t.from(e)}static ungzip(e){return t.from(i(e))}static async read(e){if(e.readInt(!1)!==r.CONSTRUCTOR_ID)throw new Error("not equal");return await r.gzip(e.tgReadBytes())}static async fromReader(e){return new r(await r.ungzip(e.tgReadBytes()))}async toBytes(){const e=t.alloc(4);return e.writeUInt32LE(r.CONSTRUCTOR_ID,0),t.concat([e,a(await r.gzip(this.data))])}}s(r,"CONSTRUCTOR_ID",812830625),s(r,"classType","constructor"),e.exports=r}).call(this,n(12).Buffer)},function(e,t,n){(function(t){const{sha1:s,toSignedLittleBuffer:i,readBufferFromBigInt:a,readBigIntFromBuffer:r}=n(8),o=n(25),{sleep:c}=n(8);class u{constructor(e,t){if(!t||!e)return;this._key=e,this._hash=t;const n=new o(t);this.auxHash=n.readLong(!1),n.read(4),this.keyId=n.readLong(!1)}async setKey(e){if(!e)return void(this._key=this.auxHash=this.keyId=this._hash=null);if(e instanceof u)return this._key=e._key,this.auxHash=e.auxHash,this.keyId=e.keyId,void(this._hash=e._hash);this._key=e,this._hash=await s(this._key);const t=new o(this._hash);this.auxHash=t.readLong(!1),t.read(4),this.keyId=t.readLong(!1)}async waitForKey(){for(;!this.keyId;)await c(20)}getKey(){return this._key}async calcNewNonceHash(e,n){e=i(e,32);const o=t.alloc(1);o.writeUInt8(n,0);const c=t.concat([e,t.concat([o,a(this.auxHash,8,!0)])]),u=(await s(c)).slice(4,20);return r(u,!0,!0)}equals(e){return e instanceof this.constructor&&this._key&&e.getKey()&&e.getKey().equals(this._key)}}e.exports=u}).call(this,n(12).Buffer)},function(e,t,n){const s=n(47),i=n(50),a=n(25),r=n(54),o=n(55),c=n(56);e.exports={BinaryWriter:i,BinaryReader:a,MessagePacker:o,AsyncQueue:c,Logger:s,PromisedWebSockets:r}},function(e,t,n){"use strict";function s(e,t){let n=0;const s=new Array(t),i=e.length/t,a=e[0],r=e[e.length-1];for(let l=0;l<t;l++){var o,c,u;const t=Math.floor(l*i),d=((null!==(o=e[t-1])&&void 0!==o?o:a)+(null!==(c=e[t])&&void 0!==c?c:a)+(null!==(u=e[t+1])&&void 0!==u?u:r))/3;s[l]=d,n<d&&(n=d)}return{data:s,peak:n}}n.d(t,"a",(function(){return s}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return a}));n(28);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}"undefined"==typeof File&&(self.File=class extends Blob{constructor(e,t,n){if(n){const{type:t,...i}=n;super(e,{type:t}),s(this,"name",void 0),Object.assign(this,i)}else super(e),s(this,"name",void 0);this.name=t}});function i(e){return new Promise((t,n)=>{const s=new FileReader;s.onload=e=>{const{result:s}=e.target||{};"string"==typeof s&&t(s),n(new Error("Failed to read blob"))},s.onerror=n,s.readAsDataURL(e)})}async function a(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)}},function(e,t,n){(function(t){const s=n(46).default,{i2ab:i,ab2i:a}=n(77),{getWords:r}=n(78);class o{constructor(e){this.setBytes(e)}setBytes(e){e=t.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 c{constructor(e,t){t instanceof o||(t=new o(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new s(r(e))}update(e){return this.encrypt(e)}encrypt(e){const n=t.from(e);for(let e=0;e<n.length;e++)16===this._remainingCounterIndex&&(this._remainingCounter=t.from(i(this._aes.encrypt(a(this._counter._counter)))),this._remainingCounterIndex=0,this._counter.increment()),n[e]^=this._remainingCounter[this._remainingCounterIndex++];return n}}class u{constructor(e){this.algorithm=e}update(e){this.data=new Uint8Array(e)}async digest(){return"sha1"===this.algorithm?t.from(await self.crypto.subtle.digest("SHA-1",this.data)):"sha256"===this.algorithm?t.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 c(t,n)},createDecipheriv:function(e,t,n){if(e.includes("ECB"))throw new Error("Not supported");return new c(t,n)},randomBytes:function(e){const t=new Uint8Array(e);return crypto.getRandomValues(t),t},createHash:function(e){return new u(e)},pbkdf2:async function(e,n,s){const i=await crypto.subtle.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]);return t.from(await crypto.subtle.deriveBits({name:"PBKDF2",hash:"SHA-512",salt:n,iterations:s},i,512))}}}).call(this,n(12).Buffer)},function(e,t){function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class s extends Error{constructor(e,t,n=null){super("RPCError {0}: {1}{2}".replace("{0}",n).replace("{1}",e).replace("{2}",s._fmtRequest(t))),this.code=n,this.message=e}static _fmtRequest(e){return e?` (caused by ${e.className})`:""}}e.exports={RPCError:s,InvalidDCError:class extends s{constructor(e,t,n){super(t,e,n),this.code=n||303,this.message=t||"ERROR_SEE_OTHER"}},BadRequestError:class extends s{constructor(...e){super(...e),n(this,"code",400),n(this,"message","BAD_REQUEST")}},UnauthorizedError:class extends s{constructor(...e){super(...e),n(this,"code",401),n(this,"message","UNAUTHORIZED")}},ForbiddenError:class extends s{constructor(...e){super(...e),n(this,"code",403),n(this,"message","FORBIDDEN")}},NotFoundError:class extends s{constructor(...e){super(...e),n(this,"code",404),n(this,"message","NOT_FOUND")}},AuthKeyError:class extends s{constructor(...e){super(...e),n(this,"code",406),n(this,"message","AUTH_KEY")}},FloodError:class extends s{constructor(...e){super(...e),n(this,"code",420),n(this,"message","FLOOD")}},ServerError:class extends s{constructor(...e){super(...e),n(this,"code",500),n(this,"message","INTERNAL")}},TimedOutError:class extends s{constructor(...e){super(...e),n(this,"code",503),n(this,"message","Timeout")}}}},function(e,t){function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class s{constructor(e,t,n){this.msgId=e,this.seqNo=t,this.obj=n,this.classType="constructor"}}n(s,"SIZE_OVERHEAD",12),n(s,"classType","constructor"),e.exports=s},function(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 i=n(38);class a{constructor(e){this.CONSTRUCTOR_ID=1945237724,this.messages=e,this.classType="constructor"}static async fromReader(e){const t=[],n=e.readInt();for(let s=0;s<n;s++){const n=e.readLong(),s=e.readInt(),a=e.readInt(),r=e.tellPosition(),o=e.tgReadObject();e.setPosition(r+a);const c=new i(n,s,o);t.push(c)}return new a(t)}}s(a,"CONSTRUCTOR_ID",1945237724),s(a,"classType","constructor"),s(a,"MAXIMUM_SIZE",1044448),s(a,"MAXIMUM_LENGTH",100),e.exports=a},function(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 i=n(58),a=n(61),r=n(57);class o{constructor(e){this.state=e}}s(o,"disconnected",-1),s(o,"connected",1),s(o,"broken",0);const{Connection:c,ConnectionTCPFull:u,ConnectionTCPAbridged:l,ConnectionTCPObfuscated:d}=n(91);e.exports={Connection:c,ConnectionTCPFull:u,ConnectionTCPAbridged:l,ConnectionTCPObfuscated:d,MTProtoPlainSender:i,doAuthentication:a,MTProtoSender:r,UpdateConnectionState:o}},function(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 i=n(54),a=n(56);class r{constructor(e,t,n,r){s(this,"PacketCodecClass",null),this._ip=e,this._port=t,this._dcId=n,this._log=r,this._connected=!1,this._sendTask=null,this._recvTask=null,this._codec=null,this._obfuscation=null,this._sendArray=new a,this._recvArray=new a,this.socket=new i}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(){this._connected=!1,await this._recvArray.push(null),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=null);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)}async _send(e){const t=this._codec.encodePacket(e);this.socket.write(t)}async _recv(){return await this._codec.readPacket(this.socket)}toString(){return`${this._ip}:${this._port}/${this.constructor.name.replace("Connection","")}`}}e.exports={Connection:r,PacketCodec:class{constructor(e){this._conn=e}encodePacket(e){throw new Error("Not Implemented")}async readPacket(e){throw new Error("Not Implemented")}},ObfuscatedConnection:class extends r{constructor(...e){super(...e),s(this,"ObfuscatedIO",null)}async _initConn(){this._obfuscation=new this.ObfuscatedIO(this),this.socket.write(this._obfuscation.header)}_send(e){this._obfuscation.write(this._codec.encodePacket(e))}async _recv(){return await this._codec.readPacket(this._obfuscation)}}}},function(e,t,n){(function(t){const s=n(30),i=n(32),a=n(21);e.exports=class extends s{constructor(e){super(),this._storageKey=e,this._authKeys={}}get authKey(){throw new Error("Not supported")}set authKey(e){throw new Error("Not supported")}async load(){if(this._storageKey)try{const e=await this._fetchFromCache(),{mainDcId:n,keys:s,hashes:r}=JSON.parse(e),{ipAddress:o,port:c}=a.getDC(n);this.setDC(n,o,c,!0),Object.keys(s).forEach(e=>{s[e]&&r[e]&&(this._authKeys[e]=new i(t.from(s[e].data),t.from(r[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()}async _updateStorage(){if(!this._storageKey)return;const e={mainDcId:this._dcId,keys:{},hashes:{}};Object.keys(this._authKeys).map(t=>{const n=this._authKeys[t];e.keys[t]=n._key,e.hashes[t]=n._hash});try{await this._saveToCache(JSON.stringify(e))}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)}}async _delete(){throw new Error("Not Implemented")}async _fetchFromCache(){throw new Error("Not Implemented")}async _saveToCache(e){throw new Error("Not Implemented")}}}).call(this,n(12).Buffer)},function(e,t,n){e.exports=function e(t,n,s){function i(r,o){if(!n[r]){if(!t[r]){if(a)return a(r,!0);var c=new Error("Cannot find module '"+r+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[r]={exports:{}};t[r][0].call(u.exports,(function(e){return i(t[r][1][e]||e)}),u,u.exports,e,t,n,s)}return n[r].exports}for(var a=!1,r=0;r<s.length;r++)i(s[r]);return i}({1:[function(e,t,n){"use strict";var s="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}n.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var s in n)i(n,s)&&(e[s]=n[s])}}return e},n.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var a={arraySet:function(e,t,n,s,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+s),i);else for(var a=0;a<s;a++)e[i+a]=t[n+a]},flattenChunks:function(e){var t,n,s,i,a,r;for(s=0,t=0,n=e.length;t<n;t++)s+=e[t].length;for(r=new Uint8Array(s),i=0,t=0,n=e.length;t<n;t++)a=e[t],r.set(a,i),i+=a.length;return r}},r={arraySet:function(e,t,n,s,i){for(var a=0;a<s;a++)e[i+a]=t[n+a]},flattenChunks:function(e){return[].concat.apply([],e)}};n.setTyped=function(e){e?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,a)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,r))},n.setTyped(s)},{}],2:[function(e,t,n){"use strict";var s=e("./common"),i=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){a=!1}for(var r=new s.Buf8(256),o=0;o<256;o++)r[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;function c(e,t){if(t<65534&&(e.subarray&&a||!e.subarray&&i))return String.fromCharCode.apply(null,s.shrinkBuf(e,t));for(var n="",r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n}r[254]=r[254]=1,n.string2buf=function(e){var t,n,i,a,r,o=e.length,c=0;for(a=0;a<o;a++)55296==(64512&(n=e.charCodeAt(a)))&&a+1<o&&56320==(64512&(i=e.charCodeAt(a+1)))&&(n=65536+(n-55296<<10)+(i-56320),a++),c+=n<128?1:n<2048?2:n<65536?3:4;for(t=new s.Buf8(c),r=0,a=0;r<c;a++)55296==(64512&(n=e.charCodeAt(a)))&&a+1<o&&56320==(64512&(i=e.charCodeAt(a+1)))&&(n=65536+(n-55296<<10)+(i-56320),a++),n<128?t[r++]=n:n<2048?(t[r++]=192|n>>>6,t[r++]=128|63&n):n<65536?(t[r++]=224|n>>>12,t[r++]=128|n>>>6&63,t[r++]=128|63&n):(t[r++]=240|n>>>18,t[r++]=128|n>>>12&63,t[r++]=128|n>>>6&63,t[r++]=128|63&n);return t},n.buf2binstring=function(e){return c(e,e.length)},n.binstring2buf=function(e){for(var t=new s.Buf8(e.length),n=0,i=t.length;n<i;n++)t[n]=e.charCodeAt(n);return t},n.buf2string=function(e,t){var n,s,i,a,o=t||e.length,u=new Array(2*o);for(s=0,n=0;n<o;)if((i=e[n++])<128)u[s++]=i;else if((a=r[i])>4)u[s++]=65533,n+=a-1;else{for(i&=2===a?31:3===a?15:7;a>1&&n<o;)i=i<<6|63&e[n++],a--;a>1?u[s++]=65533:i<65536?u[s++]=i:(i-=65536,u[s++]=55296|i>>10&1023,u[s++]=56320|1023&i)}return c(u,s)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+r[e[n]]>t?n:t}},{"./common":1}],3:[function(e,t,n){"use strict";t.exports=function(e,t,n,s){for(var i=65535&e|0,a=e>>>16&65535|0,r=0;0!==n;){n-=r=n>2e3?2e3:n;do{a=a+(i=i+t[s++]|0)|0}while(--r);i%=65521,a%=65521}return i|a<<16|0}},{}],4:[function(e,t,n){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],5:[function(e,t,n){"use strict";var s=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var a=s,r=i+n;e^=-1;for(var o=i;o<r;o++)e=e>>>8^a[255&(e^t[o])];return-1^e}},{}],6:[function(e,t,n){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],7:[function(e,t,n){"use strict";t.exports=function(e,t){var n,s,i,a,r,o,c,u,l,d,f,g,p,h,m,y,b,_,w,v,A,I,P,S,C;n=e.state,s=e.next_in,S=e.input,i=s+(e.avail_in-5),a=e.next_out,C=e.output,r=a-(t-e.avail_out),o=a+(e.avail_out-257),c=n.dmax,u=n.wsize,l=n.whave,d=n.wnext,f=n.window,g=n.hold,p=n.bits,h=n.lencode,m=n.distcode,y=(1<<n.lenbits)-1,b=(1<<n.distbits)-1;e:do{p<15&&(g+=S[s++]<<p,p+=8,g+=S[s++]<<p,p+=8),_=h[g&y];t:for(;;){if(g>>>=w=_>>>24,p-=w,0==(w=_>>>16&255))C[a++]=65535&_;else{if(!(16&w)){if(0==(64&w)){_=h[(65535&_)+(g&(1<<w)-1)];continue t}if(32&w){n.mode=12;break e}e.msg="invalid literal/length code",n.mode=30;break e}v=65535&_,(w&=15)&&(p<w&&(g+=S[s++]<<p,p+=8),v+=g&(1<<w)-1,g>>>=w,p-=w),p<15&&(g+=S[s++]<<p,p+=8,g+=S[s++]<<p,p+=8),_=m[g&b];n:for(;;){if(g>>>=w=_>>>24,p-=w,!(16&(w=_>>>16&255))){if(0==(64&w)){_=m[(65535&_)+(g&(1<<w)-1)];continue n}e.msg="invalid distance code",n.mode=30;break e}if(A=65535&_,p<(w&=15)&&(g+=S[s++]<<p,(p+=8)<w&&(g+=S[s++]<<p,p+=8)),(A+=g&(1<<w)-1)>c){e.msg="invalid distance too far back",n.mode=30;break e}if(g>>>=w,p-=w,A>(w=a-r)){if((w=A-w)>l&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(I=0,P=f,0===d){if(I+=u-w,w<v){v-=w;do{C[a++]=f[I++]}while(--w);I=a-A,P=C}}else if(d<w){if(I+=u+d-w,(w-=d)<v){v-=w;do{C[a++]=f[I++]}while(--w);if(I=0,d<v){v-=w=d;do{C[a++]=f[I++]}while(--w);I=a-A,P=C}}}else if(I+=d-w,w<v){v-=w;do{C[a++]=f[I++]}while(--w);I=a-A,P=C}for(;v>2;)C[a++]=P[I++],C[a++]=P[I++],C[a++]=P[I++],v-=3;v&&(C[a++]=P[I++],v>1&&(C[a++]=P[I++]))}else{I=a-A;do{C[a++]=C[I++],C[a++]=C[I++],C[a++]=C[I++],v-=3}while(v>2);v&&(C[a++]=C[I++],v>1&&(C[a++]=C[I++]))}break}}break}}while(s<i&&a<o);s-=v=p>>3,g&=(1<<(p-=v<<3))-1,e.next_in=s,e.next_out=a,e.avail_in=s<i?i-s+5:5-(s-i),e.avail_out=a<o?o-a+257:257-(a-o),n.hold=g,n.bits=p}},{}],8:[function(e,t,n){"use strict";var s=e("../utils/common"),i=e("./adler32"),a=e("./crc32"),r=e("./inffast"),o=e("./inftrees");function c(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function u(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function l(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new s.Buf32(852),t.distcode=t.distdyn=new s.Buf32(592),t.sane=1,t.back=-1,0):-2}function d(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,l(e)):-2}function f(e,t){var n,s;return e&&e.state?(s=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?-2:(null!==s.window&&s.wbits!==t&&(s.window=null),s.wrap=n,s.wbits=t,d(e))):-2}function g(e,t){var n,s;return e?(s=new u,e.state=s,s.window=null,0!==(n=f(e,t))&&(e.state=null),n):-2}var p,h,m=!0;function y(e){if(m){var t;for(p=new s.Buf32(512),h=new s.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(o(1,e.lens,0,288,p,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;o(2,e.lens,0,32,h,0,e.work,{bits:5}),m=!1}e.lencode=p,e.lenbits=9,e.distcode=h,e.distbits=5}function b(e,t,n,i){var a,r=e.state;return null===r.window&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0,r.window=new s.Buf8(r.wsize)),i>=r.wsize?(s.arraySet(r.window,t,n-r.wsize,r.wsize,0),r.wnext=0,r.whave=r.wsize):((a=r.wsize-r.wnext)>i&&(a=i),s.arraySet(r.window,t,n-i,a,r.wnext),(i-=a)?(s.arraySet(r.window,t,n-i,i,0),r.wnext=i,r.whave=r.wsize):(r.wnext+=a,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=a))),0}n.inflateReset=d,n.inflateReset2=f,n.inflateResetKeep=l,n.inflateInit=function(e){return g(e,15)},n.inflateInit2=g,n.inflate=function(e,t){var n,u,l,d,f,g,p,h,m,_,w,v,A,I,P,S,C,M,k,E,R,O,U,T,B=0,D=new s.Buf8(4),x=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return-2;12===(n=e.state).mode&&(n.mode=13),f=e.next_out,l=e.output,p=e.avail_out,d=e.next_in,u=e.input,g=e.avail_in,h=n.hold,m=n.bits,_=g,w=p,O=0;e:for(;;)switch(n.mode){case 1:if(0===n.wrap){n.mode=13;break}for(;m<16;){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}if(2&n.wrap&&35615===h){n.check=0,D[0]=255&h,D[1]=h>>>8&255,n.check=a(n.check,D,2,0),h=0,m=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&h)<<8)+(h>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&h)){e.msg="unknown compression method",n.mode=30;break}if(m-=4,R=8+(15&(h>>>=4)),0===n.wbits)n.wbits=R;else if(R>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<<R,e.adler=n.check=1,n.mode=512&h?10:12,h=0,m=0;break;case 2:for(;m<16;){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}if(n.flags=h,8!=(255&n.flags)){e.msg="unknown compression method",n.mode=30;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=30;break}n.head&&(n.head.text=h>>8&1),512&n.flags&&(D[0]=255&h,D[1]=h>>>8&255,n.check=a(n.check,D,2,0)),h=0,m=0,n.mode=3;case 3:for(;m<32;){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}n.head&&(n.head.time=h),512&n.flags&&(D[0]=255&h,D[1]=h>>>8&255,D[2]=h>>>16&255,D[3]=h>>>24&255,n.check=a(n.check,D,4,0)),h=0,m=0,n.mode=4;case 4:for(;m<16;){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}n.head&&(n.head.xflags=255&h,n.head.os=h>>8),512&n.flags&&(D[0]=255&h,D[1]=h>>>8&255,n.check=a(n.check,D,2,0)),h=0,m=0,n.mode=5;case 5:if(1024&n.flags){for(;m<16;){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}n.length=h,n.head&&(n.head.extra_len=h),512&n.flags&&(D[0]=255&h,D[1]=h>>>8&255,n.check=a(n.check,D,2,0)),h=0,m=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((v=n.length)>g&&(v=g),v&&(n.head&&(R=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),s.arraySet(n.head.extra,u,d,v,R)),512&n.flags&&(n.check=a(n.check,u,v,d)),g-=v,d+=v,n.length-=v),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===g)break e;v=0;do{R=u[d+v++],n.head&&R&&n.length<65536&&(n.head.name+=String.fromCharCode(R))}while(R&&v<g);if(512&n.flags&&(n.check=a(n.check,u,v,d)),g-=v,d+=v,R)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===g)break e;v=0;do{R=u[d+v++],n.head&&R&&n.length<65536&&(n.head.comment+=String.fromCharCode(R))}while(R&&v<g);if(512&n.flags&&(n.check=a(n.check,u,v,d)),g-=v,d+=v,R)break e}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;m<16;){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}if(h!==(65535&n.check)){e.msg="header crc mismatch",n.mode=30;break}h=0,m=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;m<32;){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}e.adler=n.check=c(h),h=0,m=0,n.mode=11;case 11:if(0===n.havedict)return e.next_out=f,e.avail_out=p,e.next_in=d,e.avail_in=g,n.hold=h,n.bits=m,2;e.adler=n.check=1,n.mode=12;case 12:if(5===t||6===t)break e;case 13:if(n.last){h>>>=7&m,m-=7&m,n.mode=27;break}for(;m<3;){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}switch(n.last=1&h,m-=1,3&(h>>>=1)){case 0:n.mode=14;break;case 1:if(y(n),n.mode=20,6===t){h>>>=2,m-=2;break e}break;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}h>>>=2,m-=2;break;case 14:for(h>>>=7&m,m-=7&m;m<32;){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}if((65535&h)!=(h>>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&h,h=0,m=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(v=n.length){if(v>g&&(v=g),v>p&&(v=p),0===v)break e;s.arraySet(l,u,d,v,f),g-=v,d+=v,p-=v,f+=v,n.length-=v;break}n.mode=12;break;case 17:for(;m<14;){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}if(n.nlen=257+(31&h),h>>>=5,m-=5,n.ndist=1+(31&h),h>>>=5,m-=5,n.ncode=4+(15&h),h>>>=4,m-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=30;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;m<3;){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}n.lens[x[n.have++]]=7&h,h>>>=3,m-=3}for(;n.have<19;)n.lens[x[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,U={bits:n.lenbits},O=o(0,n.lens,0,19,n.lencode,0,n.work,U),n.lenbits=U.bits,O){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;S=(B=n.lencode[h&(1<<n.lenbits)-1])>>>16&255,C=65535&B,!((P=B>>>24)<=m);){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}if(C<16)h>>>=P,m-=P,n.lens[n.have++]=C;else{if(16===C){for(T=P+2;m<T;){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}if(h>>>=P,m-=P,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}R=n.lens[n.have-1],v=3+(3&h),h>>>=2,m-=2}else if(17===C){for(T=P+3;m<T;){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}m-=P,R=0,v=3+(7&(h>>>=P)),h>>>=3,m-=3}else{for(T=P+7;m<T;){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}m-=P,R=0,v=11+(127&(h>>>=P)),h>>>=7,m-=7}if(n.have+v>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;v--;)n.lens[n.have++]=R}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,U={bits:n.lenbits},O=o(1,n.lens,0,n.nlen,n.lencode,0,n.work,U),n.lenbits=U.bits,O){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,U={bits:n.distbits},O=o(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,U),n.distbits=U.bits,O){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(g>=6&&p>=258){e.next_out=f,e.avail_out=p,e.next_in=d,e.avail_in=g,n.hold=h,n.bits=m,r(e,w),f=e.next_out,l=e.output,p=e.avail_out,d=e.next_in,u=e.input,g=e.avail_in,h=n.hold,m=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;S=(B=n.lencode[h&(1<<n.lenbits)-1])>>>16&255,C=65535&B,!((P=B>>>24)<=m);){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}if(S&&0==(240&S)){for(M=P,k=S,E=C;S=(B=n.lencode[E+((h&(1<<M+k)-1)>>M)])>>>16&255,C=65535&B,!(M+(P=B>>>24)<=m);){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}h>>>=M,m-=M,n.back+=M}if(h>>>=P,m-=P,n.back+=P,n.length=C,0===S){n.mode=26;break}if(32&S){n.back=-1,n.mode=12;break}if(64&S){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&S,n.mode=22;case 22:if(n.extra){for(T=n.extra;m<T;){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}n.length+=h&(1<<n.extra)-1,h>>>=n.extra,m-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;S=(B=n.distcode[h&(1<<n.distbits)-1])>>>16&255,C=65535&B,!((P=B>>>24)<=m);){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}if(0==(240&S)){for(M=P,k=S,E=C;S=(B=n.distcode[E+((h&(1<<M+k)-1)>>M)])>>>16&255,C=65535&B,!(M+(P=B>>>24)<=m);){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}h>>>=M,m-=M,n.back+=M}if(h>>>=P,m-=P,n.back+=P,64&S){e.msg="invalid distance code",n.mode=30;break}n.offset=C,n.extra=15&S,n.mode=24;case 24:if(n.extra){for(T=n.extra;m<T;){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}n.offset+=h&(1<<n.extra)-1,h>>>=n.extra,m-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===p)break e;if(v=w-p,n.offset>v){if((v=n.offset-v)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}v>n.wnext?(v-=n.wnext,A=n.wsize-v):A=n.wnext-v,v>n.length&&(v=n.length),I=n.window}else I=l,A=f-n.offset,v=n.length;v>p&&(v=p),p-=v,n.length-=v;do{l[f++]=I[A++]}while(--v);0===n.length&&(n.mode=21);break;case 26:if(0===p)break e;l[f++]=n.length,p--,n.mode=21;break;case 27:if(n.wrap){for(;m<32;){if(0===g)break e;g--,h|=u[d++]<<m,m+=8}if(w-=p,e.total_out+=w,n.total+=w,w&&(e.adler=n.check=n.flags?a(n.check,l,w,f-w):i(n.check,l,w,f-w)),w=p,(n.flags?h:c(h))!==n.check){e.msg="incorrect data check",n.mode=30;break}h=0,m=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;m<32;){if(0===g)break e;g--,h+=u[d++]<<m,m+=8}if(h!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=30;break}h=0,m=0}n.mode=29;case 29:O=1;break e;case 30:O=-3;break e;case 31:return-4;case 32:default:return-2}return e.next_out=f,e.avail_out=p,e.next_in=d,e.avail_in=g,n.hold=h,n.bits=m,(n.wsize||w!==e.avail_out&&n.mode<30&&(n.mode<27||4!==t))&&b(e,e.output,e.next_out,w-e.avail_out)?(n.mode=31,-4):(_-=e.avail_in,w-=e.avail_out,e.total_in+=_,e.total_out+=w,n.total+=w,n.wrap&&w&&(e.adler=n.check=n.flags?a(n.check,l,w,e.next_out-w):i(n.check,l,w,e.next_out-w)),e.data_type=n.bits+(n.last?64:0)+(12===n.mode?128:0)+(20===n.mode||15===n.mode?256:0),(0===_&&0===w||4===t)&&0===O&&(O=-5),O)},n.inflateEnd=function(e){if(!e||!e.state)return-2;var t=e.state;return t.window&&(t.window=null),e.state=null,0},n.inflateGetHeader=function(e,t){var n;return e&&e.state?0==(2&(n=e.state).wrap)?-2:(n.head=t,t.done=!1,0):-2},n.inflateSetDictionary=function(e,t){var n,s=t.length;return e&&e.state?0!==(n=e.state).wrap&&11!==n.mode?-2:11===n.mode&&i(1,t,s,0)!==n.check?-3:b(e,t,s,s)?(n.mode=31,-4):(n.havedict=1,0):-2},n.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":1,"./adler32":3,"./crc32":5,"./inffast":7,"./inftrees":9}],9:[function(e,t,n){"use strict";var s=e("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],r=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],o=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,n,c,u,l,d,f){var g,p,h,m,y,b,_,w,v,A=f.bits,I=0,P=0,S=0,C=0,M=0,k=0,E=0,R=0,O=0,U=0,T=null,B=0,D=new s.Buf16(16),x=new s.Buf16(16),j=null,N=0;for(I=0;I<=15;I++)D[I]=0;for(P=0;P<c;P++)D[t[n+P]]++;for(M=A,C=15;C>=1&&0===D[C];C--);if(M>C&&(M=C),0===C)return u[l++]=20971520,u[l++]=20971520,f.bits=1,0;for(S=1;S<C&&0===D[S];S++);for(M<S&&(M=S),R=1,I=1;I<=15;I++)if(R<<=1,(R-=D[I])<0)return-1;if(R>0&&(0===e||1!==C))return-1;for(x[1]=0,I=1;I<15;I++)x[I+1]=x[I]+D[I];for(P=0;P<c;P++)0!==t[n+P]&&(d[x[t[n+P]]++]=P);if(0===e?(T=j=d,b=19):1===e?(T=i,B-=257,j=a,N-=257,b=256):(T=r,j=o,b=-1),U=0,P=0,I=S,y=l,k=M,E=0,h=-1,m=(O=1<<M)-1,1===e&&O>852||2===e&&O>592)return 1;for(;;){_=I-E,d[P]<b?(w=0,v=d[P]):d[P]>b?(w=j[N+d[P]],v=T[B+d[P]]):(w=96,v=0),g=1<<I-E,S=p=1<<k;do{u[y+(U>>E)+(p-=g)]=_<<24|w<<16|v|0}while(0!==p);for(g=1<<I-1;U&g;)g>>=1;if(0!==g?(U&=g-1,U+=g):U=0,P++,0==--D[I]){if(I===C)break;I=t[n+d[P]]}if(I>M&&(U&m)!==h){for(0===E&&(E=M),y+=S,R=1<<(k=I-E);k+E<C&&!((R-=D[k+E])<=0);)k++,R<<=1;if(O+=1<<k,1===e&&O>852||2===e&&O>592)return 1;u[h=U&m]=M<<24|k<<16|y-l|0}}return 0!==U&&(u[y+U]=I-E<<24|64<<16|0),f.bits=M,0}},{"../utils/common":1}],10:[function(e,t,n){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],11:[function(e,t,n){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],"/lib/inflate.js":[function(e,t,n){"use strict";var s=e("./zlib/inflate"),i=e("./utils/common"),a=e("./utils/strings"),r=e("./zlib/constants"),o=e("./zlib/messages"),c=e("./zlib/zstream"),u=e("./zlib/gzheader"),l=Object.prototype.toString;function d(e){if(!(this instanceof d))return new d(e);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var n=s.inflateInit2(this.strm,t.windowBits);if(n!==r.Z_OK)throw new Error(o[n]);if(this.header=new u,s.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=a.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=s.inflateSetDictionary(this.strm,t.dictionary))!==r.Z_OK))throw new Error(o[n])}function f(e,t){var n=new d(t);if(n.push(e,!0),n.err)throw n.msg||o[n.err];return n.result}d.prototype.push=function(e,t){var n,o,c,u,d,f=this.strm,g=this.options.chunkSize,p=this.options.dictionary,h=!1;if(this.ended)return!1;o=t===~~t?t:!0===t?r.Z_FINISH:r.Z_NO_FLUSH,"string"==typeof e?f.input=a.binstring2buf(e):"[object ArrayBuffer]"===l.call(e)?f.input=new Uint8Array(e):f.input=e,f.next_in=0,f.avail_in=f.input.length;do{if(0===f.avail_out&&(f.output=new i.Buf8(g),f.next_out=0,f.avail_out=g),(n=s.inflate(f,r.Z_NO_FLUSH))===r.Z_NEED_DICT&&p&&(n=s.inflateSetDictionary(this.strm,p)),n===r.Z_BUF_ERROR&&!0===h&&(n=r.Z_OK,h=!1),n!==r.Z_STREAM_END&&n!==r.Z_OK)return this.onEnd(n),this.ended=!0,!1;f.next_out&&(0!==f.avail_out&&n!==r.Z_STREAM_END&&(0!==f.avail_in||o!==r.Z_FINISH&&o!==r.Z_SYNC_FLUSH)||("string"===this.options.to?(c=a.utf8border(f.output,f.next_out),u=f.next_out-c,d=a.buf2string(f.output,c),f.next_out=u,f.avail_out=g-u,u&&i.arraySet(f.output,f.output,c,u,0),this.onData(d)):this.onData(i.shrinkBuf(f.output,f.next_out)))),0===f.avail_in&&0===f.avail_out&&(h=!0)}while((f.avail_in>0||0===f.avail_out)&&n!==r.Z_STREAM_END);return n===r.Z_STREAM_END&&(o=r.Z_FINISH),o===r.Z_FINISH?(n=s.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===r.Z_OK):o!==r.Z_SYNC_FLUSH||(this.onEnd(r.Z_OK),f.avail_out=0,!0)},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){e===r.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Inflate=d,n.inflate=f,n.inflateRaw=function(e,t){return(t=t||{}).raw=!0,f(e,t)},n.ungzip=f},{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js")},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){(function(t){const n=e=>e.replace(/(?:^|_)([a-z])/g,(e,t)=>t.toUpperCase()).replace(/_/g,""),s=e=>e.replace(/([-_][a-z])/g,e=>e.toUpperCase().replace("-","").replace("_","")),i=new Set([3162085175,2574415285,1072550713,3300522427,1450380236]),a=new Set([85337187,2211011308,2851430293,1013613780,1459478408,3504867164,3045658042,1715713620,3608339646,4110704415,812830625]);let r=null;function o(e){r||(r=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}()),t.isBuffer(e)||(e=t.from(e));let n=-1;for(let t=0;t<e.length;t++){const s=e[t];n=r[255&(n^s)]^n>>>8}return(-1^n)>>>0}const c=(e,i)=>{const a=e.match(/([\w.]+)(?:#([0-9a-fA-F]+))?(?:\s{?\w+:[\w\d<>#.?!]+}?)*\s=\s([\w\d<>#.?]+);$/);if(!a)throw new Error("Cannot parse TLObject "+e);const r=l(/({)?(\w+):([\w\d<>#.?!]+)}?/,e),c={name:a[1],constructorId:parseInt(a[2],16),argsConfig:{},subclassOfId:o(a[3]),result:a[3],isFunction:i,namespace:null};if(!c.constructorId){const e="";let n;n=Object.values(c.argsConfig).length?" "+Object.keys(c.argsConfig).map(e=>e.toString()).join(" "):"";const s=`${c.name}${e}${n} = ${c.result}`.replace(/(:|\?)bytes /g,"$1string ").replace(/</g," ").replace(/>|{|}/g,"").replace(/ \w+:flags\.\d+\?true/g,"");"inputMediaInvoice"===c.name&&c.name,c.constructorId=o(t.from(s,"utf8"))}for(const[e,t,n]of r)void 0===e&&(c.argsConfig[s(t)]=u(t,n));return c.name.includes(".")&&([c.namespace,c.name]=c.name.split(/\.(.+)/)),c.name=n(c.name),c};function u(e,t){const n={isVector:!1,isFlag:!1,skipConstructorId:!1,flagIndex:-1,flagIndicator:!0,type:null,useVectorId:null};e="self"===e?"is_self":e;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}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};e.exports={findAll:l,parseTl:function*(e,t,n=[],s=i){(n||[]).reduce((e,t)=>({...e,[t.name]:t}),{});const r=[],o={},u={},l=e;let d=!1;for(let e of l.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;d="functions"===e}else try{const t=c(e,d);if(s.has(t.constructorId))continue;r.push(t),t.isFunction||(u[t.result]||(u[t.result]=[]),o[t.name]=t,u[t.result].push(t))}catch(e){if(!e.toString().includes("vector#1cb5c415"))throw e}}for(const e of r)if(a.has(e.constructorId))for(const t in e.argsConfig)"string"===e.argsConfig[t].type&&(e.argsConfig[t].type="bytes");for(const e of r)yield e},buildArgConfig:u,fromLine:c,CORE_TYPES:i,serializeDate:function(e){if(!e)return t.alloc(4).fill(0);if(e instanceof Date&&(e=Math.floor((Date.now()-e.getTime())/1e3)),"number"==typeof e){const n=t.alloc(4);return n.writeInt32LE(e,0),n}throw Error(`Cannot interpret "${e}" as a date`)},serializeBytes:function(e){if(!(e instanceof t)){if("string"!=typeof e)throw Error("Bytes or str expected, not "+e.constructor.name);e=t.from(e)}const n=[];let s;return e.length<254?(s=(e.length+1)%4,0!==s&&(s=4-s),n.push(t.from([e.length])),n.push(e)):(s=e.length%4,0!==s&&(s=4-s),n.push(t.from([254,e.length%256,(e.length>>8)%256,(e.length>>16)%256])),n.push(e)),n.push(t.alloc(s).fill(0)),t.concat(n)},snakeToCamelCase:n,variableSnakeToCamelCase:s}}).call(this,n(12).Buffer)},function(e,t,n){"use strict";n.r(t),n.d(t,"CTR",(function(){return y})),n.d(t,"IGE",(function(){return m}));var s=new Uint8Array(256),i=new Uint8Array(256),a=new Uint32Array(256),r=new Uint32Array(256),o=new Uint32Array(256),c=new Uint32Array(256),u=new Uint32Array(256),l=new Uint32Array(256),d=new Uint32Array(256),f=new Uint32Array(256);function g(e){if(e instanceof Uint32Array)return e;if("string"==typeof e){if(e.length%4!=0)for(var t=e.length%4;t<=4;t++)e+="\0x00";var n=new Uint32Array(e.length/4);for(t=0;t<e.length;t+=4)n[t/4]=(i=t,(s=e).charCodeAt(i)<<24^s.charCodeAt(i+1)<<16^s.charCodeAt(i+2)<<8^s.charCodeAt(i+3));return n}var s,i;if(e instanceof Uint8Array){for(n=new Uint32Array(e.length/4),t=0;t<e.length;t+=4)n[t/4]=e[t]<<24^e[t+1]<<16^e[t+2]<<8^e[t+3];return n}throw new Error("Unable to create 32-bit words")}function p(e,t,n){void 0===n&&(n=e);for(var s=0;s<e.length;s++)n[s]=e[s]^t[s]}!function(){for(var e,t,n,g,p,h=new Uint8Array(256),m=new Uint8Array(256),y=0,b=0,_=0;_<256;_++)h[_]=_<<1^283*(_>>7),m[h[_]^_]=_;for(;!s[y];y^=e||1)n=(n=b^b<<1^b<<2^b<<3^b<<4)>>8^255&n^99,s[y]=n,i[n]=y,p=16843009*h[t=h[e=h[y]]]^65537*t^257*e^16843008*y,g=257*h[n]^16843008*n,a[y]=g=g<<24^g>>>8,r[y]=g=g<<24^g>>>8,o[y]=g=g<<24^g>>>8,c[y]=g=g<<24^g>>>8,u[n]=p=p<<24^p>>>8,l[n]=p=p<<24^p>>>8,d[n]=p=p<<24^p>>>8,f[n]=p=p<<24^p>>>8,b=m[b]||1}();var h=function(){function e(e){var t=g(e);if(4!==t.length&&6!==t.length&&8!==t.length)throw new Error("Invalid key size");this.encKey=new Uint32Array(4*t.length+28),this.decKey=new Uint32Array(4*t.length+28),this.encKey.set(t);for(var n,i=1,a=t.length;a<4*t.length+28;a++)n=this.encKey[a-1],(a%t.length==0||8===t.length&&a%t.length==4)&&(n=s[n>>>24]<<24^s[n>>16&255]<<16^s[n>>8&255]<<8^s[255&n],a%t.length==0&&(n=n<<8^n>>>24^i<<24,i=i<<1^283*(i>>7))),this.encKey[a]=this.encKey[a-t.length]^n;for(var r=0;a;r++,a--)n=this.encKey[3&r?a:a-4],this.decKey[r]=a<=4||r<4?n:u[s[n>>>24]]^l[s[n>>16&255]]^d[s[n>>8&255]]^f[s[255&n]]}return e.prototype.encrypt=function(e){for(var t,n,i,u=g(e),l=new Uint32Array(4),d=u[0]^this.encKey[0],f=u[1]^this.encKey[1],p=u[2]^this.encKey[2],h=u[3]^this.encKey[3],m=this.encKey.length/4-2,y=4,b=0;b<m;b++)t=a[d>>>24]^r[f>>16&255]^o[p>>8&255]^c[255&h]^this.encKey[y],n=a[f>>>24]^r[p>>16&255]^o[h>>8&255]^c[255&d]^this.encKey[y+1],i=a[p>>>24]^r[h>>16&255]^o[d>>8&255]^c[255&f]^this.encKey[y+2],h=a[h>>>24]^r[d>>16&255]^o[f>>8&255]^c[255&p]^this.encKey[y+3],d=t,f=n,p=i,y+=4;for(b=0;b<4;b++)l[b]=s[d>>>24]<<24^s[f>>16&255]<<16^s[p>>8&255]<<8^s[255&h]^this.encKey[y++],t=d,d=f,f=p,p=h,h=t;return l},e.prototype.decrypt=function(e){for(var t,n,s,a=g(e),r=new Uint32Array(4),o=a[0]^this.decKey[0],c=a[3]^this.decKey[1],p=a[2]^this.decKey[2],h=a[1]^this.decKey[3],m=this.decKey.length/4-2,y=4,b=0;b<m;b++)t=u[o>>>24]^l[c>>16&255]^d[p>>8&255]^f[255&h]^this.decKey[y],n=u[c>>>24]^l[p>>16&255]^d[h>>8&255]^f[255&o]^this.decKey[y+1],s=u[p>>>24]^l[h>>16&255]^d[o>>8&255]^f[255&c]^this.decKey[y+2],h=u[h>>>24]^l[o>>16&255]^d[c>>8&255]^f[255&p]^this.decKey[y+3],o=t,c=n,p=s,y+=4;for(b=0;b<4;b++)r[3&-b]=i[o>>>24]<<24^i[c>>16&255]<<16^i[p>>8&255]<<8^i[255&h]^this.decKey[y++],t=o,o=c,c=p,p=h,h=t;return r},e}(),m=function(){function e(e,t,n){void 0===n&&(n=16),this.key=g(e),this.iv=g(t),this.cipher=new h(e),this.blockSize=n/4}return e.prototype.encrypt=function(e,t){for(var n=g(e),s=t||new Uint32Array(n.length),i=this.iv.subarray(this.blockSize,this.iv.length),a=this.iv.subarray(0,this.blockSize),r=new Uint32Array(this.blockSize),o=0;o<n.length;o+=this.blockSize){var c=n.subarray(o,o+this.blockSize);p(c,a,r);var u=this.cipher.encrypt(r);p(u,i),i=c,a=u;for(var l=o,d=0;l<n.length&&d<4;l++,d++)s[l]=u[d]}return s},e.prototype.decrypt=function(e,t){for(var n=g(e),s=t||new Uint32Array(n.length),i=this.iv.subarray(this.blockSize,this.iv.length),a=this.iv.subarray(0,this.blockSize),r=new Uint32Array(this.blockSize),o=0;o<s.length;o+=this.blockSize){var c=n.subarray(o,o+this.blockSize);p(c,i,r);var u=this.cipher.decrypt(r);p(u,a),a=c,i=u;for(var l=o,d=0;l<s.length&&d<4;l++,d++)s[l]=u[d]}return s},e}(),y=function(){function e(e,t,n){if(void 0===n&&(n=16),this.offset=0,this.key=g(e),this.counter=g(t),this.cipher=new h(e),this.blockSize=n/4,4!==this.counter.length)throw new Error("AES-CTR mode counter must be 16 bytes length")}return e.prototype.encrypt=function(e,t){for(var n=g(e),s=t||new Uint32Array(n.length),i=this.offset,a=0;a<n.length;a+=this.blockSize){for(var r=this.cipher.encrypt(this.counter),o=a,c=i;o<n.length&&c<this.blockSize;o++,c++)s[o]=r[c]^n[o];n.length-a>=this.blockSize&&this.incrementCounter(),i&&(a-=i,i=0)}return this.offset=(this.offset+n.length%4)%4,s},e.prototype.decrypt=function(e,t){return this.encrypt(e,t)},e.prototype.incrementCounter=function(){for(var e=this.counter.length-1;e>=0&&!(++this.counter[e]<4294967295);e--);},e}();t.default=h},function(e,t,n){(function(t){let n=null;class s{constructor(e){n||(n=e||"debug"),this.isBrowser=void 0===t||"renderer"===t.type||!0===t.browser||t.__nwjs,this.isBrowser?this.colors={start:"%c",warn:"color : #ff00ff",info:"color : #ffff00",debug:"color : #00ffff",error:"color : #ff0000",end:""}:this.colors={start:"",warn:"",info:"",debug:"",error:"",end:""},this.messageFormat="[%t] [%l] - [%m]"}static setLevel(e){n=e}canSend(e){return s.levels.indexOf(n)>=s.levels.indexOf(e)}warn(e){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){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,t,s){n&&this.canSend(e)&&(this.isBrowser?console.log(this.colors.start+this.format(t,e),s):console.log(s+this.format(t,e)+this.colors.end))}}var i,a,r;r=["error","warn","info","debug"],(a="levels")in(i=s)?Object.defineProperty(i,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):i[a]=r,e.exports=s}).call(this,n(83))},function(e,t,n){const{RPCError:s,InvalidDCError:i,FloodError:a,BadRequestError:r}=n(37);class o extends i{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 i{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 u extends a{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 a{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 d extends a{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 f extends i{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 g extends i{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 p extends r{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 h=[[/FILE_MIGRATE_(\d+)/,f],[/FLOOD_TEST_PHONE_WAIT_(\d+)/,d],[/FLOOD_WAIT_(\d+)/,l],[/PHONE_MIGRATE_(\d+)/,c],[/SLOWMODE_WAIT_(\d+)/,u],[/USER_MIGRATE_(\d+)/,o],[/NETWORK_MIGRATE_(\d+)/,g],[/EMAIL_UNCONFIRMED_(\d+)/,p]];e.exports={rpcErrorRe:h,FileMigrateError:f,FloodTestPhoneWaitError:d,FloodWaitError:l,PhoneMigrateError:c,SlowModeWaitError:u,UserMigrateError:o,NetworkMigrateError:g,EmailUnconfirmedError:p}},function(e,t){e.exports=class{constructor(){}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")}}},function(e,t,n){(function(t){e.exports=class{constructor(e){this._stream=e}write(e){this._stream=t.concat([this._stream,e])}getValue(){return this._stream}}}).call(this,n(12).Buffer)},function(e,t,n){const s=n(38),i=n(52),a=n(39),r=n(31),o={[i.CONSTRUCTOR_ID]:i,[r.CONSTRUCTOR_ID]:r,[a.CONSTRUCTOR_ID]:a};e.exports={TLMessage:s,RPCResult:i,MessageContainer:a,GZIPPacked:r,coreObjects:o}},function(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:i}=n(20).constructors,a=n(31);class r{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===i.CONSTRUCTOR_ID?new r(t,null,i.fromReader(e)):n===a.CONSTRUCTOR_ID?new r(t,(await a.fromReader(e)).data):(e.seek(-4),new r(t,e.read(),null))}}s(r,"CONSTRUCTOR_ID",4082920705),s(r,"classType","constructor"),e.exports=r},function(e,t,n){const s=n(6),i={};for(const e of Object.values(s))if(e.CONSTRUCTOR_ID)i[e.CONSTRUCTOR_ID]=e;else for(const t of Object.values(e))i[t.CONSTRUCTOR_ID]=t;e.exports={LAYER:121,tlobjects:i}},function(e,t,n){(function(t){const{Mutex:s}=n(84),i=new s,a=n(86).w3cwebsocket,r=new Error("WebSocket was closed");e.exports=class{constructor(){this.client=null,this.closed=!0}async readExactly(e){let n=t.alloc(0);for(;;){const s=await this.read(e);if(n=t.concat([n,s]),!(e-=s.length))return n}}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=t.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`}async connect(e,n){return this.stream=t.alloc(0),this.canRead=new Promise(e=>{this.resolveRead=e}),this.closed=!1,this.website=this.getWebSocketLink(n,e),this.client=new a(this.website,"binary"),new Promise((e,t)=>{this.client.onopen=()=>{this.receive(),e(this)},this.client.onerror=e=>{t(e)},this.client.onclose=()=>{this.resolveRead(!1),this.closed=!0},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}async receive(){this.client.onmessage=async e=>{const n=await i.acquire();try{const s=e.data instanceof ArrayBuffer?t.from(e.data):t.from(await new Response(e.data).arrayBuffer());this.stream=t.concat([this.stream,s]),this.resolveRead(!0)}finally{n()}}}}}).call(this,n(12).Buffer)},function(e,t,n){(function(t){const s=n(39),i=n(38),a=n(50);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){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,n=new a(t.alloc(0));const r=[];let o=0;for(;this._queue.length&&r.length<=s.MAXIMUM_LENGTH;){const e=this._queue.shift();if(o+=e.data.length+i.SIZE_OVERHEAD,o<=s.MAXIMUM_SIZE){let t;e.after&&(t=e.after.msgId),e.msgId=await this._state.writeDataAsMessage(n,e.data,"request"===e.request.classType,t),this._log.debug(`Assigned msgId = ${e.msgId} to ${e.request.className||e.request.constructor.name}`),r.push(e)}else{if(r.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"),o=0}}if(!r.length)return null;if(r.length>1){const i=t.alloc(8);i.writeUInt32LE(s.CONSTRUCTOR_ID,0),i.writeInt32LE(r.length,4),e=t.concat([i,n.getValue()]),n=new a(t.alloc(0));const o=await this._state.writeDataAsMessage(n,e,!1);for(const e of r)e.containerId=o}return e=n.getValue(),{batch:r,data:e}}rejectAll(){this._pendingStates.forEach(e=>{e.reject(new Error("Disconnect"))})}}}).call(this,n(12).Buffer)},function(e,t){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}}},function(e,t,n){const s=n(58),i=n(59),a=n(8),r=n(32),o=n(61),c=n(52),u=n(39),l=n(31),d=n(90),{MsgsAck:f,upload:g,MsgsStateInfo:p,Pong:h}=n(20).constructors,m=n(55),y=n(25),{UpdateConnectionState:b}=n(40),{BadMessageError:_}=n(23),{BadServerSalt:w,BadMsgNotification:v,MsgDetailedInfo:A,MsgNewDetailedInfo:I,NewSessionCreated:P,FutureSalts:S,MsgsStateReq:C,MsgResendReq:M,MsgsAllInfo:k}=n(20).constructors,{SecurityError:E}=n(23),{InvalidBufferError:R}=n(23),{LogOut:O}=n(20).requests.auth,{RPCMessageToError:U}=n(27),{TypeNotFoundError:T}=n(23);class B{constructor(e,t){const n={...B.DEFAULT_OPTIONS,...t};this._connection=null,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._user_connected=!1,this._reconnecting=!1,this._disconnected=!0,this._send_loop_handle=null,this._recv_loop_handle=null,this.authKey=e||new r,this._state=new i(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),[u.CONSTRUCTOR_ID]:this._handleContainer.bind(this),[l.CONSTRUCTOR_ID]:this._handleGzipPacked.bind(this),[h.CONSTRUCTOR_ID]:this._handlePong.bind(this),[w.CONSTRUCTOR_ID]:this._handleBadServerSalt.bind(this),[v.CONSTRUCTOR_ID]:this._handleBadNotification.bind(this),[A.CONSTRUCTOR_ID]:this._handleDetailedInfo.bind(this),[I.CONSTRUCTOR_ID]:this._handleNewDetailedInfo.bind(this),[P.CONSTRUCTOR_ID]:this._handleNewSessionCreated.bind(this),[f.CONSTRUCTOR_ID]:this._handleAck.bind(this),[S.CONSTRUCTOR_ID]:this._handleFutureSalts.bind(this),[C.CONSTRUCTOR_ID]:this._handleStateForgotten.bind(this),[M.CONSTRUCTOR_ID]:this._handleStateForgotten.bind(this),[k.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._connection=e;for(let e=0;e<this._retries;e++)try{await this._connect(),this._updateCallback&&this._updateCallback(new b(b.connected));break}catch(t){this._updateCallback&&0===e&&this._updateCallback(new b(b.disconnected)),this._log.error("WebSocket connection failed attempt: "+(e+1)),await a.sleep(this._delay)}}isConnected(){return this._user_connected}async disconnect(){await this._disconnect()}send(e){if(!this._user_connected)throw new Error("Cannot send requests while disconnected");const t=new d(e);return this._send_queue.append(t),t.promise}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._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 o(e,this._log);this._log.debug("Generated new auth_key successfully"),await this.authKey.setKey(t.authKey),this._state.time_offset=t.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(e=null){this._send_queue.rejectAll(),null!==this._connection?(this._updateCallback&&this._updateCallback(new b(b.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 d(new f({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 this._log.warn("Connection closed while receiving data"),void this.reconnect()}try{t=await this._state.decryptMessageData(e)}catch(e){if(e instanceof T){this._log.info(`Type ${e.invalidConstructorId} not found, remaining data ${e.remaining}`);continue}if(e instanceof E){this._log.warn("Security error while unpacking a received message: "+e);continue}return e instanceof R?(this._log.info("Broken authorization key; resetting"),void(this._updateCallback&&this._isMainSender?this._updateCallback(new b(b.broken)):this._onConnectionBreak&&!this._isMainSender&&this._onConnectionBreak(this._dcId))):(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 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]),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&&delete this._pending_state[t.reqMsgId],this._log.debug("Handling RPC result for message "+t.reqMsgId),!n)try{if(!(new y(t.body).tgReadObject()instanceof g.File))throw new T("Not an upload.File")}catch(e){if(this._log.error(e),e instanceof T)return void this._log.info("Received response without parent request: "+t.body);throw e}if(t.error){const e=U(t.error,n.request);this._send_queue.append(new d(new f({msgIds:[n.msgId]}))),n.reject(e)}else{const e=new y(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 y(e.obj.data);e.obj=t.tgReadObject(),await this._processMessage(e)}async _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`)}async _handlePong(e){const t=e.obj;this._log.debug("Handling pong for message "+t.msgId);const n=this._pending_state[t.msgId];delete this._pending_state[t.msgId],n&&n.resolve(t)}async _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")}async _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._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 _(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")}async _handleDetailedInfo(e){const t=e.obj.answerMsgId;this._log.debug("Handling detailed info for message "+t),this._pending_ack.add(t)}async _handleNewDetailedInfo(e){const t=e.obj.answerMsgId;this._log.debug("Handling new detailed info for message "+t),this._pending_ack.add(t)}async _handleNewSessionCreated(e){this._log.debug("Handling new session created"),this._state.salt=e.obj.serverSalt}async _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 O&&(delete this._pending_state[e],t.resolve(!0))}}async _handleFutureSalts(e){this._log.debug("Handling future salts for message "+e.msgId);const t=this._pending_state[e.msgId];t&&(delete this._pending_state[e],t.resolve(e.obj))}async _handleStateForgotten(e){this._send_queue.append(new d(new p(e.msgId,String.fromCharCode(1).repeat(e.obj.msgIds))))}async _handleMsgAll(e){}async reconnect(){this._user_connected&&!this._reconnecting&&(this._reconnecting=!0,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(null),this._state.reset(),await this.connect(this._connection,!0),this._reconnecting=!1,this._pending_state={},this._autoReconnectCallback&&await this._autoReconnectCallback()}}var D,x,j;j={logger:null,retries:1/0,delay:2e3,autoReconnect:!0,connectTimeout:null,authKeyCallback:null,updateCallback:null,autoReconnectCallback:null,isMainSender:null,onConnectionBreak:null},(x="DEFAULT_OPTIONS")in(D=B)?Object.defineProperty(D,x,{value:j,enumerable:!0,configurable:!0,writable:!0}):D[x]=j,e.exports=B},function(e,t,n){(function(t){const s=n(15),i=(n(8),n(59)),a=n(25),{InvalidBufferError:r}=n(23),{toSignedLittleBuffer:o}=n(8);e.exports=class{constructor(e,t){this._state=new i(e,t),this._connection=e}async send(e){let n=e.getBytes(),i=this._state._getNewMsgId();const c=o(i,8),u=t.alloc(4);u.writeInt32LE(n.length,0);const l=t.concat([t.concat([t.alloc(8),c,u]),n]);if(await this._connection.send(l),n=await this._connection.recv(),n.length<8)throw new r(n);const d=new a(n);if(d.readLong().neq(s(0)))throw new Error("Bad authKeyId");if(i=d.readLong(),i.eq(s(0)))throw new Error("Bad msgId");if(d.readInt()<=0)throw new Error("Bad length");return d.tgReadObject()}}}).call(this,n(12).Buffer)},function(e,t,n){(function(t){const s=n(8),i=n(60),a=n(25),r=n(31),{TLMessage:o}=n(51),{SecurityError:c,InvalidBufferError:u}=n(23),{InvokeAfterMsg:l}=n(20).requests,d=n(15),{toSignedLittleBuffer:f,readBufferFromBigInt:g}=n(8),{readBigIntFromBuffer:p}=n(8);e.exports=class{constructor(e,t){this.authKey=e,this._log=t,this.timeOffset=0,this.salt=0,this.id=this._sequence=this._lastMsgId=null,this.reset()}reset(){this.id=s.generateRandomLong(!0),this._sequence=0,this._lastMsgId=d(0)}updateMessageId(e){e.msgId=this._getNewMsgId()}async _calcKey(e,n,i){const a=!0===i?0:8,[r,o]=await Promise.all([s.sha256(t.concat([n,e.slice(a,a+36)])),s.sha256(t.concat([e.slice(a+40,a+76),n]))]);return{key:t.concat([r.slice(0,8),o.slice(8,24),r.slice(24,32)]),iv:t.concat([o.slice(0,8),r.slice(8,24),o.slice(24,32)])}}async writeDataAsMessage(e,n,s,i){const a=this._getNewMsgId(),o=this._getSeqNo(s);let c;c=i?await r.gzipIfSmaller(s,new l(i,n).getBytes()):await r.gzipIfSmaller(s,n);const u=t.alloc(4);u.writeInt32LE(o,0);const d=t.alloc(4);d.writeInt32LE(c.length,0);const g=f(a,8);return e.write(t.concat([g,u,d])),e.write(c),a}async encryptMessageData(e){await this.authKey.waitForKey();const n=f(this.salt,8),a=f(this.id,8);e=t.concat([t.concat([n,a]),e]);const r=s.generateRandomBytes(s.mod(-(e.length+12),16)+12),o=(await s.sha256(t.concat([this.authKey.getKey().slice(88,120),e,r]))).slice(8,24),{iv:c,key:u}=await this._calcKey(this.authKey.getKey(),o,!0),l=s.readBufferFromBigInt(this.authKey.keyId,8);return t.concat([l,o,new i(u,c).encryptIge(t.concat([e,r]))])}async decryptMessageData(e){if(e.length<8)throw new u(e);if(e.length<0)throw new c("Server replied with negative length");if(e.length%4!=0)throw new c("Server replied with length not divisible by 4");if(s.readBigIntFromBuffer(e.slice(0,8)).neq(this.authKey.keyId))throw new c("Server replied with an invalid auth key");const n=e.slice(8,24),{iv:r,key:l}=await this._calcKey(this.authKey.getKey(),n,!1);e=new i(l,r).decryptIge(e.slice(24));const d=await s.sha256(t.concat([this.authKey.getKey().slice(96,128),e]));if(!n.equals(d.slice(8,24)))throw new c("Received msg_key doesn't match with expected one");const f=new a(e);f.readLong();if(!f.readLong().eq(this.id))throw new c("Server replied with a wrong session ID");const g=f.readLong(),p=f.readInt(),h=f.readInt(),m=e.length-h;if(m<12||m>1024)throw new c("Server replied with the wrong message padding");const y=f.tgReadObject();return new o(g,p,y)}_getNewMsgId(){const e=(new Date).getTime()/1e3+this.timeOffset,t=Math.floor(1e9*(e-Math.floor(e)));let n=d(Math.floor(e)).shiftLeft(d(32)).or(d(t).shiftLeft(d(2)));return this._lastMsgId.greaterOrEquals(n)&&(n=this._lastMsgId.add(d(4))),this._lastMsgId=n,n}updateTimeOffset(e){const t=this._getNewMsgId(),n=this.timeOffset,s=Math.floor((new Date).getTime()/1e3),i=e.shiftRight(d(32));return this.timeOffset=i-s,this.timeOffset!==n&&(this._lastMsgId=d(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}}}).call(this,n(12).Buffer)},function(e,t,n){(function(t){const{IGE:s}=n(46),i=n(8);e.exports=class{constructor(e,t){this.ige=new s(e,t)}decryptIge(e){return i.convertToLittle(this.ige.decrypt(e))}encryptIge(e){const n=e.length%16;return n&&(e=t.concat([e,i.generateRandomBytes(16-n)])),i.convertToLittle(this.ige.encrypt(e))}}}).call(this,n(12).Buffer)},function(e,t,n){(function(t){const s=n(15),i=n(60),a=n(32),r=n(62),o=n(89),c=n(8),{constructors:u,requests:l}=n(20),d=n(25),{SecurityError:f}=n(23);e.exports=async function(e,n){let g=c.generateRandomBytes(16);const p=c.readBigIntFromBuffer(g,!1,!0),h=await e.send(new l.ReqPqMulti({nonce:p}));if(n.debug("Starting authKey generation step 1"),!(h instanceof u.ResPQ))throw new Error("Step 1 answer was "+h);if(h.nonce.neq(p))throw new f("Step 1 invalid nonce from server");const m=c.readBigIntFromBuffer(h.pq,!1,!0);n.debug("Finished authKey generation step 1"),n.debug("Starting authKey generation step 2");let{p:y,q:b}=r.factorize(m);y=c.getByteArray(y),b=c.getByteArray(b),g=c.generateRandomBytes(32);const _=c.readBigIntFromBuffer(g,!0,!0),w=new u.PQInnerData({pq:c.getByteArray(m),p:y,q:b,nonce:h.nonce,serverNonce:h.serverNonce,newNonce:_});let v=null,A=null;for(const e of h.serverPublicKeyFingerprints)if(v=await o.encrypt(e.toString(),w.getBytes()),null!=v){A=e;break}if(null==v)throw new f("Step 2 could not find a valid key for fingerprints");const I=await e.send(new l.ReqDHParams({nonce:h.nonce,serverNonce:h.serverNonce,p:y,q:b,publicKeyFingerprint:A,encryptedData:v}));if(!(I instanceof u.ServerDHParamsOk||I instanceof u.ServerDHParamsFail))throw new Error("Step 2.1 answer was "+I);if(I.nonce.neq(h.nonce))throw new f("Step 2 invalid nonce from server");if(I.serverNonce.neq(h.serverNonce))throw new f("Step 2 invalid server nonce from server");if(I instanceof u.ServerDHParamsFail){const e=await c.sha1(c.toSignedLittleBuffer(_,32).slice(4,20)),t=c.readBigIntFromBuffer(e,!0,!0);if(I.newNonceHash.neq(t))throw new f("Step 2 invalid DH fail nonce from server")}if(!(I instanceof u.ServerDHParamsOk))throw new Error("Step 2.2 answer was "+I);n.debug("Finished authKey generation step 2"),n.debug("Starting authKey generation step 3");const{key:P,iv:S}=await c.generateKeyDataFromNonce(h.serverNonce,_);if(I.encryptedAnswer.length%16!=0)throw new f("Step 3 AES block size mismatch");const C=new i(P,S),M=C.decryptIge(I.encryptedAnswer),k=new d(M);k.read(20);const E=k.tgReadObject();if(!(E instanceof u.ServerDHInnerData))throw new Error("Step 3 answer was "+E);if(E.nonce.neq(h.nonce))throw new f("Step 3 Invalid nonce in encrypted answer");if(E.serverNonce.neq(h.serverNonce))throw new f("Step 3 Invalid server nonce in encrypted answer");const R=c.readBigIntFromBuffer(E.dhPrime,!1,!1),O=c.readBigIntFromBuffer(E.gA,!1,!1),U=E.serverTime-Math.floor((new Date).getTime()/1e3),T=c.readBigIntFromBuffer(c.generateRandomBytes(256),!1,!1),B=c.modExp(s(E.g),T,R),D=c.modExp(O,T,R),x=new u.ClientDHInnerData({nonce:h.nonce,serverNonce:h.serverNonce,retryId:0,gB:c.getByteArray(B,!1)}).getBytes(),j=t.concat([await c.sha1(x),x]),N=C.encryptIge(j),F=await e.send(new l.SetClientDHParams({nonce:h.nonce,serverNonce:h.serverNonce,encryptedData:N})),V=[u.DhGenOk,u.DhGenRetry,u.DhGenFail];if(!(F instanceof V[0]||F instanceof V[1]||F instanceof V[2]))throw new Error("Step 3.1 answer was "+F);const{name:L}=F.constructor;if(F.nonce.neq(h.nonce))throw new f(`Step 3 invalid ${L} nonce from server`);if(F.serverNonce.neq(h.serverNonce))throw new f(`Step 3 invalid ${L} server nonce from server`);const q=new a;await q.setKey(c.getByteArray(D));const H=1+V.indexOf(F.constructor),z=await q.calcNewNonceHash(_,H);if(F["newNonceHash"+H].neq(z))throw new f("Step 3 invalid new nonce hash");if(!(F instanceof u.DhGenOk))throw new Error("Step 3.2 answer was "+F);return n.debug("Finished authKey generation step 3"),{authKey:q,timeOffset:U}}}).call(this,n(12).Buffer)},function(e,t,n){const s=n(15),{modExp:i}=n(8);class a{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)),r=s.randBetween(s(1),e.minus(1));let o,c=s.one,u=s.one,l=s.one,d=s.zero,f=s.zero;for(;c.eq(s.one);){d=t;for(let a=0;s(a).lesser(u);a++)t=i(t,s(2),e).add(n).remainder(e);for(o=s.zero;o.lesser(u)&&c.eq(s.one);){f=t;const g=s.min(r,u.minus(o));for(let a=0;s(a).lesser(g);a++)t=i(t,s(2),e).add(n).remainder(e),l=l.multiply(d.minus(t).abs()).remainder(e);c=a.gcd(l,e),o=o.add(r)}u=u.multiply(2)}if(c.eq(e))for(;f=i(f,s(2),e).add(n).remainder(e),c=a.gcd(d.minus(f).abs(),e),!c.greater(1););const g=c;return l=e.divide(c),g<l?{p:g,q:l}:{p:l,q:g}}}e.exports=a},function(e,t,n){(function(t){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 i=n(15),{readBufferFromBigInt:a}=n(8),{Connection:r,PacketCodec:o}=n(41);class c extends o{constructor(e){super(e),this.tag=c.tag,this.obfuscateTag=c.obfuscateTag}encodePacket(e){let n=e.length>>2;if(n<127){const e=t.alloc(1);e.writeUInt8(n,0),n=e}else n=t.concat([t.from("7f","hex"),a(i(n),3)]);return t.concat([n,e])}async readPacket(e){let n=(await e.read(1))[0];return n>=127&&(n=t.concat([await e.read(3),t.alloc(1)]).readInt32LE(0)),await e.read(n<<2)}}s(c,"tag",t.from("ef","hex")),s(c,"obfuscateTag",t.from("efefefef","hex"));e.exports={ConnectionTCPAbridged:class extends r{constructor(...e){super(...e),s(this,"PacketCodecClass",c)}},AbridgedPacketCodec:c}}).call(this,n(12).Buffer)},function(e,t,n){(function(t){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{generateRandomBytes:i}=n(8),{ObfuscatedConnection:a}=n(41),{AbridgedPacketCodec:r}=n(63),o=n(93);class c{constructor(e){s(this,"header",null),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 n=[t.from("50567247","hex"),t.from("474554","hex"),t.from("504f5354","hex"),t.from("eeeeeeee","hex")];let s;for(;;)if(s=i(64),239!==s[0]&&!s.slice(4,8).equals(t.alloc(4))){let e=!0;for(const t of n)if(t.equals(s.slice(0,4))){e=!1;break}if(e)break}s=s.toJSON().data;const a=t.from(s.slice(8,56)).reverse(),r=t.from(s.slice(8,40)),c=t.from(s.slice(40,56)),u=t.from(a.slice(0,32)),l=t.from(a.slice(32,48)),d=new o(r,c),f=new o(u,l);return s=t.concat([t.from(s.slice(0,56)),e.obfuscateTag,t.from(s.slice(60))]),s=t.concat([t.from(s.slice(0,56)),t.from(d.encrypt(s).slice(56,64)),t.from(s.slice(64))]),{random:s,encryptor:d,decryptor:f}}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 a{constructor(...e){super(...e),s(this,"ObfuscatedIO",c),s(this,"PacketCodecClass",r)}}}}).call(this,n(12).Buffer)},function(e,t){},function(e,t){},function(e,t,n){"use strict";let s;n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return a})),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"}(s||(s={}));const i=-1,a="MESSAGE_DELETED"},function(e,t){},function(e,t,n){"use strict";let s;n.d(t,"a",(function(){return s})),function(e){e[e.DataUri=0]="DataUri",e[e.BlobUrl=1]="BlobUrl",e[e.Lottie=2]="Lottie",e[e.Progressive=3]="Progressive",e[e.Stream=4]="Stream"}(s||(s={}))},function(e,t){},function(e,t){},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return r}));var s=n(1),i=n(0),a=n(2);async function r({chatId:t,accessHash:n,messageId:r,data:o}){const c=await Object(s.g)(new i.Api.messages.GetBotCallbackAnswer({peer:Object(a.i)(t,n),msgId:r,data:e.from(o)}));if(c)return c}}).call(this,n(12).Buffer)},function(e,t,n){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],s=t[1];return 3*(n+s)/4-s},t.toByteArray=function(e){var t,n,s=u(e),r=s[0],o=s[1],c=new a(function(e,t,n){return 3*(t+n)/4-n}(0,r,o)),l=0,d=o>0?r-4:r;for(n=0;n<d;n+=4)t=i[e.charCodeAt(n)]<<18|i[e.charCodeAt(n+1)]<<12|i[e.charCodeAt(n+2)]<<6|i[e.charCodeAt(n+3)],c[l++]=t>>16&255,c[l++]=t>>8&255,c[l++]=255&t;2===o&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,c[l++]=255&t);1===o&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t);return c},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],r=0,o=n-i;r<o;r+=16383)a.push(l(e,r,r+16383>o?o:r+16383));1===i?(t=e[n-1],a.push(s[t>>2]+s[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],a.push(s[t>>10]+s[t>>4&63]+s[t<<2&63]+"="));return a.join("")};for(var s=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,c=r.length;o<c;++o)s[o]=r[o],i[r.charCodeAt(o)]=o;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var i,a,r=[],o=t;o<n;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),r.push(s[(a=i)>>18&63]+s[a>>12&63]+s[a>>6&63]+s[63&a]);return r.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,s,i){var a,r,o=8*i-s-1,c=(1<<o)-1,u=c>>1,l=-7,d=n?i-1:0,f=n?-1:1,g=e[t+d];for(d+=f,a=g&(1<<-l)-1,g>>=-l,l+=o;l>0;a=256*a+e[t+d],d+=f,l-=8);for(r=a&(1<<-l)-1,a>>=-l,l+=s;l>0;r=256*r+e[t+d],d+=f,l-=8);if(0===a)a=1-u;else{if(a===c)return r?NaN:1/0*(g?-1:1);r+=Math.pow(2,s),a-=u}return(g?-1:1)*r*Math.pow(2,a-s)},t.write=function(e,t,n,s,i,a){var r,o,c,u=8*a-i-1,l=(1<<u)-1,d=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,g=s?0:a-1,p=s?1:-1,h=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,r=l):(r=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-r))<1&&(r--,c*=2),(t+=r+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(r++,c/=2),r+d>=l?(o=0,r=l):r+d>=1?(o=(t*c-1)*Math.pow(2,i),r+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,i),r=0));i>=8;e[n+g]=255&o,g+=p,o/=256,i-=8);for(r=r<<i|o,u+=i;u>0;e[n+g]=255&r,g+=p,r/=256,u-=8);e[n+g-p]|=128*h}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(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 i=e[s];t[n++]=i>>>24,t[n++]=i>>16&255,t[n++]=i>>8&255,t[n++]=255&i}return t.buffer}function i(e){return e.buffer}function a(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 r(e){return new Uint32Array(e)}n.r(t),n.d(t,"i2abLow",(function(){return s})),n.d(t,"i2abBig",(function(){return i})),n.d(t,"ab2iLow",(function(){return a})),n.d(t,"ab2iBig",(function(){return r})),n.d(t,"isBigEndian",(function(){return o})),n.d(t,"i2ab",(function(){return c})),n.d(t,"ab2i",(function(){return u}));const o=1===new Uint8Array(new Uint32Array([16909060]))[0],c=o?i:s,u=o?r:a},function(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 i(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 a(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",(function(){return s})),n.d(t,"getWords",(function(){return i})),n.d(t,"xor",(function(){return a}))},function(e,t){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#23ab23d2 flags:# id:InputDocument ttl_seconds:flags.0?int = 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#f4e096c3 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param: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#27d69997 flags:# big:flags.0?true peer:InputPeer volume_id:long local_id:int = InputFileLocation;\ninputStickerSetThumb#dbaeae9 stickerset:InputStickerSet volume_id:long local_id: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 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#69d3ab26 flags:# has_video:flags.0?true photo_id:long photo_small:FileLocation photo_big:FileLocation 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 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 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#1b7c9db3 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:ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int = ChatFull;\nchannelFull#f0e6672a 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: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 = 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#d20b9f3c flags:# has_video:flags.0?true photo_small:FileLocation photo_big:FileLocation dc_id:int = ChatPhoto;\nmessageEmpty#83e5de54 id:int = Message;\nmessage#58ae39c9 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> = Message;\nmessageService#286fa604 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 = 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;\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#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize;\nphotoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize;\nphotoStrippedSize#e0b0bc2e type:string bytes:bytes = PhotoSize;\nphotoSizeProgressive#5aa86a51 type:string location:FileLocation 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 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#8af40b25 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#e1746d0a text:string = ReportReason;\ninputReportReasonCopyright#9b89f93a = ReportReason;\ninputReportReasonGeoIrrelevant#dbd4feed = ReportReason;\nuserFull#edf17c12 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 = 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#9a65ea1f chat_id:int user_id:int 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#54826690 flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint 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#42f88f2c poll_id:long user_id:int options:Vector<bytes> = 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;\nupdateChannelParticipant#65d2b464 flags:# channel_id:int date:int user_id:int prev_participant:flags.0?ChannelParticipant new_participant:flags.1?ChannelParticipant qts:int = 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#ff2abe9f flags:# channel_id:int top_msg_id:flags.0?int user_id:int 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;\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#2296d2c8 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> = Updates;\nupdateShortChatMessage#402d5dbb 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> = 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#11f1331c flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector<MessageEntity> = 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#1da7158f flags:# can_not_skip:flags.0?true id:int version:string text:string entities:Vector<MessageEntity> document:flags.1?Document url:flags.2?string = 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#13d6dd27 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;\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#ad2641f8 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 = 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;\nchatInviteEmpty#69df3769 = ExportedChatInvite;\nchatInviteExported#fc2e05bc link:string = 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#eeb46f27 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 thumb:flags.4?PhotoSize thumb_dc_id: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#f4108aa0 flags:# single_use:flags.1?true selective:flags.2?true = ReplyMarkup;\nreplyKeyboardMarkup#3502758c flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector<KeyboardButtonRow> = 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#1c0facaf flags:# left:flags.0?true user_id:int kicked_by:int date:int banned_rights:ChatBannedRights = ChannelParticipant;\nchannelParticipantLeft#c3c6796b user_id:int = 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#f56ee2a8 count:int participants:Vector<ChannelParticipant> users:Vector<User> = channels.ChannelParticipants;\nchannels.channelParticipantsNotModified#f0173fe9 = channels.ChannelParticipants;\nchannels.channelParticipant#d0d9b163 participant:ChannelParticipant 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;\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;\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:# 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#c30aa358 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> = 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#3f56aea3 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true 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#500911e1 flags:# date:int bot_id:int invoice:Invoice provider_id:int info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption 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;\ninputPaymentCredentialsAndroidPay#ca05d50e payment_token:DataJSON google_transaction_id:string = 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;\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 = 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 = 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#8427bbac = 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#5086cf8 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int second_background_color:flags.4?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;\nfileLocationToBeDeprecated#bc7fc6cd volume_id:long local_id:int = FileLocation;\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;\n// Some unused classes were removed below this line\nvideoSize#e831c556 flags:# type:string location:FileLocation w:int h:int size:int video_start_ts:flags.0?double = VideoSize;\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;\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.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.getWallPapers#aabb1763 hash:int = account.WallPapers;\naccount.uploadWallPaper#dd853661 file:InputFile mime_type:string settings:WallPaperSettings = WallPaper;\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.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;\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.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.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#df7534c peer:InputPeer = 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.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.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.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;\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;\nhelp.getConfig#c4f9186b = Config;\nhelp.getNearestDc#1fb33026 = NearestDc;\nhelp.getSupport#9cdf08cd = help.Support;\nhelp.acceptTermsOfService#ee72f79a id:DataJSON = Bool;\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#546dd7a6 channel:InputChannel user_id:InputUser = 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 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.exportMessageLink#e63fadeb flags:# grouped:flags.0?true thread:flags.1?true channel:InputChannel id:int = ExportedMessageLink;\nchannels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates;\nchannels.editBanned#72796912 channel:InputChannel user_id:InputUser 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#99f09745 msg_id:int = payments.PaymentForm;\npayments.getPaymentReceipt#a092a980 msg_id:int = payments.PaymentReceipt;\npayments.validateRequestedInfo#770a8e74 flags:# save:flags.0?true msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo;\npayments.sendPaymentForm#2b8879b3 flags:# msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials = payments.PaymentResult;\npayments.getSavedInfo#227d824b = payments.SavedInfo;\nlangpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference;\nlangpack.getLanguages#42c6978f lang_pack:string = Vector<LangPackLanguage>;\nfolders.editPeerFolders#6847d0ab folder_peers:Vector<InputFolderPeer> = Updates;\n// LAYER 121\n"},function(e,t){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_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;\n"},function(e,t,n){const s=n(82),i=n(47),{sleep:a}=n(8),r=n(27),o=n(30),c=n(8),{BinaryWriter:u}=n(33),l=n(21),d=n(49),{LAYER:f}=n(53),{constructors:g,requests:p}=n(20),h=n(57),{UpdateConnectionState:m}=n(40),{ConnectionTCPObfuscated:y}=n(64),{authFlow:b,checkAuthorization:_}=n(94),{downloadFile:w}=n(95),{uploadFile:v}=n(96),{updateTwoFaSettings:A}=n(97),I=["w","y","d","x","c","m","b","a","s"];class P{constructor(e,t,n,a=P.DEFAULT_OPTIONS){if(void 0===t||void 0===n)throw Error('Your API ID or Hash are invalid. Please read "Requirements" on README.md');const r={...P.DEFAULT_OPTIONS,...a};if(this.apiId=t,this.apiHash=n,this._useIPV6=r.useIPV6,"string"==typeof r.baseLogger?this._log=new i:this._log=r.baseLogger,"string"!=typeof e&&e){if(!(e instanceof d))throw new Error("The given session must be str or a session instance")}else try{throw new Error("not implemented")}catch(t){e=new o}this.floodSleepLimit=r.floodSleepLimit,this._eventBuilders=[],this._phoneCodeHash={},this.session=e,this.apiId=parseInt(t),this.apiHash=n,this._requestRetries=r.requestRetries,this._connectionRetries=r.connectionRetries,this._retryDelay=r.retryDelay||0,r.proxy&&this._log.warn("proxies are not supported"),this._proxy=r.proxy,this._timeout=r.timeout,this._autoReconnect=r.autoReconnect,this._connection=r.connection,this._floodWaitedRequests={},this._initWith=e=>new p.InvokeWithLayer({layer:f,query:new p.InitConnection({apiId:this.apiId,deviceModel:r.deviceModel||s.type().toString()||"Unknown",systemVersion:r.systemVersion||s.release().toString()||"1.0",appVersion:r.appVersion||"1.0",langCode:r.langCode,langPack:"",systemLangCode:r.systemLangCode,query:e,proxy:null})}),this._args=r,this._config=null,this.phoneCodeHashes=[],this._borrowedSenderPromises={},this._additionalDcsDisabled=r.additionalDcsDisabled}async connect(){await this._initSession(),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});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 p.help.GetConfig({}))),this._updateLoop()}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]":"venus.web.telegram.org",this._args.useWSS?443:80)}async _updateLoop(){for(;this.isConnected();){await c.sleep(3e3);try{await E(()=>k(this._sender.send(new p.Ping({pingId:c.getRandomInt(Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER)})),1500),3,100)}catch(e){return await this.disconnect(),void this.connect()}if((new Date).getTime()-this._lastRequest>18e5)try{await this.invoke(new p.updates.GetState)}catch(e){}}}async disconnect(){this._sender&&await this._sender.disconnect(),await Promise.all(Object.values(this._borrowedSenderPromises).map(e=>e.then(e=>{if(e)return e.disconnect()}))),this._borrowedSenderPromises={}}async destroy(){await this.disconnect(),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(null),this.session.setAuthKey(null),await this.disconnect(),this.connect()}async _authKeyCallback(e,t){this.session.setAuthKey(e,t)}_cleanupBorrowedSender(e){delete this._borrowedSenderPromises[e]}async _borrowExportedSender(e){if(this._additionalDcsDisabled)return;let t=this._borrowedSenderPromises[e];return t||(t=this._createExportedSender(e),this._borrowedSenderPromises[e]=t,t.then(t=>{t||delete this._borrowedSenderPromises[e]})),t}async _createExportedSender(e){const t=l.getDC(e),n=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._cleanupBorrowedSender.bind(this)});for(let s=0;s<5;s++)try{if(await n.connect(new this._connection(t.ipAddress,t.port,e,this._log)),this.session.dcId!==e){this._log.info("Exporting authorization for data center "+t.ipAddress);const s=await this.invoke(new p.auth.ExportAuthorization({dcId:e})),i=this._initWith(new p.auth.ImportAuthorization({id:s.id,bytes:s.bytes}));await n.send(i)}return n.dcId=e,n}catch(e){await n.disconnect()}return null}async downloadFile(e,t={}){return w(this,e,t)}async downloadMedia(e,t){let n,s;if(e instanceof g.Message?(n=e.date,s=e.media):(n=(new Date).getTime(),s=e),"string"==typeof s)throw new Error("not implemented");return s instanceof g.MessageMediaWebPage&&s.webpage instanceof g.WebPage&&(s=s.webpage.document||s.webpage.photo),s instanceof g.MessageMediaPhoto||s instanceof g.Photo?this._downloadPhoto(s,t):s instanceof g.MessageMediaDocument||s instanceof g.Document?this._downloadDocument(s,t):s instanceof g.MessageMediaContact?this._downloadContact(s,t):s instanceof g.WebDocument||s instanceof g.WebDocumentNoProxy?this._downloadWebDocument(s,t):void 0}async downloadProfilePhoto(e,t=!1){const n=t?"x":"m";let s,i,a;if([765557111,3316604308,524706233,3566872215].includes(e.SUBCLASS_OF_ID)){if(!e.photo)return e.chatPhoto?this._downloadPhoto(e.chatPhoto,{sizeType:n}):null;s=e.photo}else s=e;if(!(s instanceof g.UserProfilePhoto||s instanceof g.ChatPhoto))return null;{i=s.dcId;const n=t?s.photoBig:s.photoSmall;a=new g.InputPeerPhotoFileLocation({peer:l.getInputPeer(e),localId:n.localId,volumeId:n.volumeId,big:t})}try{return this.downloadFile(a,{dcId:i})}catch(e){throw e}}async downloadStickerSetThumb(e){if(!e.thumb||!e.thumb.location)return;const{location:t}=e.thumb;return this.downloadFile(new g.InputStickerSetThumb({stickerset:new g.InputStickerSetID({id:e.id,accessHash:e.accessHash}),localId:t.localId,volumeId:t.volumeId}),{dcId:e.thumbDcId})}_pickFileSize(e,t){if(!t||!e||!e.length)return null;let n;for(let s=I.indexOf(t);s<I.length;s++)if(n=e.find(e=>e.type===I[s]),n)return n;return null}_downloadCachedPhotoSize(e){let t;return t=e instanceof g.PhotoStrippedSize?l.strippedPhotoToJpg(e.bytes):e.bytes,t}async _downloadPhoto(e,t){if(e instanceof g.MessageMediaPhoto&&(e=e.photo),!(e instanceof g.Photo))return;const n=this._pickFileSize(e.sizes,t.sizeType);return!n||n instanceof g.PhotoSizeEmpty?void 0:n instanceof g.PhotoCachedSize||n instanceof g.PhotoStrippedSize?this._downloadCachedPhotoSize(n):this.downloadFile(new g.InputPhotoFileLocation({id:e.id,accessHash:e.accessHash,fileReference:e.fileReference,thumbSize:n.type}),{dcId:e.dcId,fileSize:n.size,progressCallback:t.progressCallback})}async _downloadDocument(e,t){if(e instanceof g.MessageMediaDocument&&(e=e.document),!(e instanceof g.Document))return;let n=null;if(t.sizeType){if(n=e.thumbs?this._pickFileSize(e.thumbs,t.sizeType):null,!n&&e.mimeType.startsWith("video/"))return;if(n&&(n instanceof g.PhotoCachedSize||n instanceof g.PhotoStrippedSize))return this._downloadCachedPhotoSize(n)}return this.downloadFile(new g.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")}_downloadWebDocument(e,t){throw new Error("not implemented")}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++)try{const t=this._sender.send(e);return await t}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 a(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 a(1e3*e.seconds)}else{if(!(e instanceof r.PhoneMigrateError||e instanceof r.NetworkMigrateError||e instanceof r.UserMigrateError))throw e;this._log.info("Phone migrated to "+e.newDc);if((e instanceof r.PhoneMigrateError||e instanceof r.NetworkMigrateError)&&await _(this))throw e;await this._switchDC(e.newDc)}}throw new Error(`Request was unsuccessful ${t} time(s)`)}async getMe(){try{return(await this.invoke(new p.users.GetUsers({id:[new g.InputUserSelf]})))[0]}catch(e){}}async start(e){if(this.isConnected()||await this.connect(),await _(this))return;const t={apiId:this.apiId,apiHash:this.apiHash};await b(this,t,e)}uploadFile(e){return v(this,e)}updateTwoFaSettings(e){return A(this,e)}addEventHandler(e,t){this._eventBuilders.push([t,e])}_handleUpdate(e){if(e instanceof g.Updates||e instanceof g.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 g.UpdateShort?this._processUpdate(e.update,null):this._processUpdate(e,null)}_processUpdate(e,t,n){e._entities=n||[];const s={update:e,others:t};this._dispatchUpdate(s)}async _dispatchUpdate(e={update:null,others:null,channelId:null,ptsDate:null}){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 S,C,M;async function k(e,t){return Promise.race([e,c.sleep(t).then(()=>Promise.reject(new Error("TIMEOUT")))])}async function E(e,t,n){for(let s=0;s<t;s++)try{return await e()}catch(e){if(s===t-1)throw e;await c.sleep(n)}}M={connection:y,useIPV6:!1,proxy:null,timeout:10,requestRetries:5,connectionRetries:1/0,retryDelay:1e3,autoReconnect:!0,sequentialUpdates:!1,floodSleepLimit:60,deviceModel:null,systemVersion:null,appVersion:null,langCode:"en",systemLangCode:"en",baseLogger:"gramjs",useWSS:!1,additionalDcsDisabled:!1},(C="DEFAULT_OPTIONS")in(S=P)?Object.defineProperty(S,C,{value:M,enumerable:!0,configurable:!0,writable:!0}):S[C]=M,e.exports=P},function(e,t){t.endianness=function(){return"LE"},t.hostname=function(){return"undefined"!=typeof location?location.hostname:""},t.loadavg=function(){return[]},t.uptime=function(){return 0},t.freemem=function(){return Number.MAX_VALUE},t.totalmem=function(){return Number.MAX_VALUE},t.cpus=function(){return[]},t.type=function(){return"Browser"},t.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},t.networkInterfaces=t.getNetworkInterfaces=function(){return{}},t.arch=function(){return"javascript"},t.platform=function(){return"browser"},t.tmpdir=t.tmpDir=function(){return"/tmp"},t.EOL="\n",t.homedir=function(){return"/"}},function(e,t){var n,s,i=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(e){n=a}try{s="function"==typeof clearTimeout?clearTimeout:r}catch(e){s=r}}();var c,u=[],l=!1,d=-1;function f(){l&&c&&(l=!1,c.length?u=c.concat(u):d=-1,u.length&&g())}function g(){if(!l){var e=o(f);l=!0;for(var t=u.length;t;){for(c=u,u=[];++d<t;)c&&c[d].run();d=-1,t=u.length}c=null,l=!1,function(e){if(s===clearTimeout)return clearTimeout(e);if((s===r||!s)&&clearTimeout)return s=clearTimeout,clearTimeout(e);try{s(e)}catch(t){try{return s.call(null,e)}catch(t){return s.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function h(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new p(e,t)),1!==u.length||l||o(g)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=h,i.addListener=h,i.once=h,i.off=h,i.removeListener=h,i.removeAllListeners=h,i.emit=h,i.prependListener=h,i.prependOnceListener=h,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=n(85);t.Mutex=s.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(){this._queue=[],this._pending=!1}return e.prototype.isLocked=function(){return this._pending},e.prototype.acquire=function(){var e=this,t=new Promise((function(t){return e._queue.push(t)}));return this._pending||this._dispatchNext(),t},e.prototype.runExclusive=function(e){return this.acquire().then((function(t){var n;try{n=e()}catch(e){throw t(),e}return Promise.resolve(n).then((function(e){return t(),e}),(function(e){throw t(),e}))}))},e.prototype._dispatchNext=function(){this._queue.length>0?(this._pending=!0,this._queue.shift()(this._dispatchNext.bind(this))):this._pending=!1},e}();t.default=s},function(e,t,n){(function(t){var s=function(){return this||void 0===t?this:t}(),i=s.WebSocket||s.MozWebSocket,a=n(87);function r(e,t){return t?new i(e,t):new i(e)}i&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach((function(e){Object.defineProperty(r,e,{get:function(){return i[e]}})})),e.exports={w3cwebsocket:i?r:null,version:a}}).call(this,n(44))},function(e,t,n){e.exports=n(88).version},function(e){e.exports=JSON.parse('{"_args":[["websocket@1.0.30","/Users/alexander/dev/telegram-t"]],"_from":"websocket@1.0.30","_id":"websocket@1.0.30","_inBundle":false,"_integrity":"sha512-aO6klgaTdSMkhfl5VVJzD5fm+Srhh5jLYbS15+OiI1sN6h/RU/XW6WN9J1uVIpUKNmsTvT3Hs35XAFjn9NMfOw==","_location":"/websocket","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"websocket@1.0.30","name":"websocket","escapedName":"websocket","rawSpec":"1.0.30","saveSpec":null,"fetchSpec":"1.0.30"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/websocket/-/websocket-1.0.30.tgz","_spec":"1.0.30","_where":"/Users/alexander/dev/telegram-t","author":{"name":"Brian McKelvey","email":"theturtle32@gmail.com","url":"https://github.com/theturtle32"},"browser":"lib/browser.js","bugs":{"url":"https://github.com/theturtle32/WebSocket-Node/issues"},"config":{"verbose":false},"contributors":[{"name":"Iñaki Baz Castillo","email":"ibc@aliax.net","url":"http://dev.sipdoc.net"}],"dependencies":{"debug":"^2.2.0","nan":"^2.14.0","typedarray-to-buffer":"^3.1.5","yaeti":"^0.0.6"},"description":"Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.","devDependencies":{"buffer-equal":"^1.0.0","faucet":"^0.0.1","gulp":"^4.0.2","gulp-jshint":"^2.0.4","jshint":"^2.0.0","jshint-stylish":"^2.2.1","tape":"^4.9.1"},"directories":{"lib":"./lib"},"engines":{"node":">=0.10.0"},"homepage":"https://github.com/theturtle32/WebSocket-Node","keywords":["websocket","websockets","socket","networking","comet","push","RFC-6455","realtime","server","client"],"license":"Apache-2.0","main":"index","name":"websocket","repository":{"type":"git","url":"git+https://github.com/theturtle32/WebSocket-Node.git"},"scripts":{"gulp":"gulp","install":"(node-gyp rebuild 2> builderror.log) || (exit 0)","test":"faucet test/unit"},"version":"1.0.30"}')},function(e,t,n){(function(t){const s=n(15),{readBigIntFromBuffer:i,readBufferFromBigInt:a,getByteArray:r,sha1:o,generateRandomBytes:c,modExp:u}=n(8),l=[{fingerprint:[40,85,94,156,117,240,61,22,65,244,169,2,33,107,232,108,2,43,180,195],n:s("24403446649145068056824081744112065346446136066297307473868293895086332508101251964919587745984311372853053253457835208829824428441874946556659953519213382748319518214765985662663680818277989736779506318868003755216402538945900388706898101286548187286716959100102939636333452457308619454821845196109544157601096359148241435922125602449263164512290854366930013825808102403072317738266383237191313714482187326643144603633877219028262697593882410403273959074350849923041765639673335775605842311578109726403165298875058941765362622936097839775380070572921007586266115476975819175319995527916042178582540628652481530373407"),e:65537},{fingerprint:[140,171,9,34,146,246,166,50,10,170,229,247,155,114,28,177,29,106,153,154],n:s("25081407810410225030931722734886059247598515157516470397242545867550116598436968553551465554653745201634977779380884774534457386795922003815072071558370597290368737862981871277312823942822144802509055492512145589734772907225259038113414940384446493111736999668652848440655603157665903721517224934142301456312994547591626081517162758808439979745328030376796953660042629868902013177751703385501412640560275067171555763725421377065095231095517201241069856888933358280729674273422117201596511978645878544308102076746465468955910659145532699238576978901011112475698963666091510778777356966351191806495199073754705289253783"),e:65537},{fingerprint:[243,218,109,239,16,202,176,78,167,8,255,209,120,234,205,112,111,42,91,176],n:s("22347337644621997830323797217583448833849627595286505527328214795712874535417149457567295215523199212899872122674023936713124024124676488204889357563104452250187725437815819680799441376434162907889288526863223004380906766451781702435861040049293189979755757428366240570457372226323943522935844086838355728767565415115131238950994049041950699006558441163206523696546297006014416576123345545601004508537089192869558480948139679182328810531942418921113328804749485349441503927570568778905918696883174575510385552845625481490900659718413892216221539684717773483326240872061786759868040623935592404144262688161923519030977"),e:65537},{fingerprint:[128,80,214,72,77,244,98,7,201,250,37,244,227,51,96,199,182,37,224,113],n:s("24573455207957565047870011785254215390918912369814947541785386299516827003508659346069416840622922416779652050319196701077275060353178142796963682024347858398319926119639265555410256455471016400261630917813337515247954638555325280392998950756512879748873422896798579889820248358636937659872379948616822902110696986481638776226860777480684653756042166610633513404129518040549077551227082262066602286208338952016035637334787564972991208252928951876463555456715923743181359826124083963758009484867346318483872552977652588089928761806897223231500970500186019991032176060579816348322451864584743414550721639495547636008351"),e:65537}],d={};l.forEach(({fingerprint:e,...t})=>{d[i(e.slice(-8),!0,!0)]=t}),e.exports={encrypt:async function(e,n){const r=d[e];if(!r)return;const l=c(235-n.length),f=t.concat([await o(n),n,l]),g=i(f,!1),p=u(g,s(r.e),r.n);return a(p,256,!1)}}}).call(this,n(12).Buffer)},function(e,t){e.exports=class{constructor(e,t=null){this.containerId=null,this.msgId=null,this.request=e,this.data=e.getBytes(),this.after=t,this.result=null,this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}},function(e,t,n){const{Connection:s}=n(41),{ConnectionTCPFull:i}=n(92),{ConnectionTCPAbridged:a}=n(63),{ConnectionTCPObfuscated:r}=n(64);e.exports={Connection:s,ConnectionTCPFull:i,ConnectionTCPAbridged:a,ConnectionTCPObfuscated:r}},function(e,t){},function(e,t,n){(function(t){const s=n(36);e.exports=class{constructor(e,n){if(!t.isBuffer(e)||!t.isBuffer(n)||16!==n.length)throw new Error("Key and iv need to be a buffer");this.cipher=s.createCipheriv("AES-256-CTR",e,n)}encrypt(e){return t.from(this.cipher.update(e))}}}).call(this,n(12).Buffer)},function(e,t,n){"use strict";n.r(t),n.d(t,"authFlow",(function(){return u})),n.d(t,"checkAuthorization",(function(){return l}));var s=n(6),i=n.n(s),a=n(21),r=n.n(a),o=n(8),c=n(29);async function u(e,t,n){const s="phoneNumber"in n?await d(e,t,n):await async function(e,t,n){const{apiId:s,apiHash:a}=t,{botAuthToken:r}=n,{user:o}=await e.invoke(new i.a.auth.ImportBotAuthorization({apiId:s,apiHash:a,botAuthToken:r}));return o}(e,t,n);e._log.info("Signed in successfully as",r.a.getDisplayName(s))}async function l(e){try{return await e.invoke(new i.a.updates.GetState),!0}catch(e){return!1}}async function d(e,t,n){let s,a,r,o=!1;for(;;)try{if("function"==typeof n.phoneNumber)try{s=await n.phoneNumber()}catch(s){if("RESTART_AUTH_WITH_QR"===s.message)return f(e,t,n);throw s}else s=n.phoneNumber;const i=await g(e,t,s,n.forceSMS);if(a=i.phoneCodeHash,o=i.isCodeViaApp,"string"!=typeof a)throw new Error("Failed to retrieve phone code hash");break}catch(e){if("function"!=typeof n.phoneNumber)throw e;n.onError(e)}let c,u=!1;for(;;)try{try{r=await n.phoneCode(o)}catch(s){if("RESTART_AUTH"===s.message)return d(e,t,n)}if(!r)throw new Error("Code is empty");const l=await e.invoke(new i.a.auth.SignIn({phoneNumber:s,phoneCodeHash:a,phoneCode:r}));if(l instanceof i.a.auth.AuthorizationSignUpRequired){u=!0,c=l.termsOfService;break}return l.user}catch(s){if("SESSION_PASSWORD_NEEDED"===s.message)return p(e,t,n);n.onError(s)}if(u)for(;;)try{const[t,r]=await n.firstAndLastNames();if(!t)throw new Error("First name is required");const{user:o}=await e.invoke(new i.a.auth.SignUp({phoneNumber:s,phoneCodeHash:a,firstName:t,lastName:r}));return c&&await e.invoke(new i.a.help.AcceptTermsOfService({id:c.id})),o}catch(e){n.onError(e)}return n.onError(new Error("Auth failed")),d(e,t,n)}async function f(e,t,n){let s=!1;const a=(async()=>{for(;!s;){const t=await e.invoke(new i.a.auth.ExportLoginToken({apiId:Number("739222"),apiHash:"60d1e1063c72d4bc4cfdda99e8906f94",exceptIds:[]}));if(!(t instanceof i.a.auth.LoginToken))throw new Error("Unexpected");const{token:s,expires:a}=t;await Promise.race([n.qrCode({token:s,expires:a}),Object(o.sleep)(3e4)])}})(),r=new Promise(t=>{e.addEventHandler(e=>{e instanceof i.a.UpdateLoginToken&&t()},{build:e=>e})});try{await Promise.race([r,a])}catch(s){if("RESTART_AUTH"===s.message)return d(e,t,n);throw s}finally{s=!0}try{const t=await e.invoke(new i.a.auth.ExportLoginToken({apiId:Number("739222"),apiHash:"60d1e1063c72d4bc4cfdda99e8906f94",exceptIds:[]}));if(t instanceof i.a.auth.LoginTokenSuccess&&t.authorization instanceof i.a.auth.Authorization)return t.authorization.user;if(t instanceof i.a.auth.LoginTokenMigrateTo){await e._switchDC(t.dcId);const n=await e.invoke(new i.a.auth.ImportLoginToken({token:t.token}));if(n instanceof i.a.auth.LoginTokenSuccess&&n.authorization instanceof i.a.auth.Authorization)return n.authorization.user}}catch(s){if("SESSION_PASSWORD_NEEDED"===s.message)return p(e,t,n);throw s}throw void 0}async function g(e,t,n,s=!1){try{const{apiId:a,apiHash:r}=t,o=await e.invoke(new i.a.auth.SendCode({phoneNumber:n,apiId:a,apiHash:r,settings:new i.a.CodeSettings}));if(!s||o.type instanceof i.a.auth.SentCodeTypeSms)return{phoneCodeHash:o.phoneCodeHash,isCodeViaApp:o.type instanceof i.a.auth.SentCodeTypeApp};const c=await e.invoke(new i.a.auth.ResendCode({phoneNumber:n,phoneCodeHash:o.phoneCodeHash}));return{phoneCodeHash:c.phoneCodeHash,isCodeViaApp:c.type instanceof i.a.auth.SentCodeTypeApp}}catch(i){if("AUTH_RESTART"===i.message)return g(e,t,n,s);throw i}}async function p(e,t,n){for(;;)try{const t=await e.invoke(new i.a.account.GetPassword),s=await n.password(t.hint);if(!s)throw new Error("Password is empty");const a=await Object(c.computeCheck)(t,s),{user:r}=await e.invoke(new i.a.auth.CheckPassword({password:a}));return r}catch(e){n.onError(e)}}},function(e,t,n){"use strict";n.r(t),function(e){n.d(t,"downloadFile",(function(){return c}));var s=n(6),i=n.n(s),a=n(21),r=n(8);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}async function c(t,n,s){let{partSizeKb:o,fileSize:c,workers:l=1,end:d}=s;const{dcId:f,progressCallback:g,start:p=0}=s;d=d&&d<c?d:c-1,o||(o=c?Object(a.getAppropriatedPartSize)(c):64);const h=1024*o,m=d?Math.ceil((d-p)/h):1;if(h%4096!=0)throw new Error("The part size must be evenly divisible by 4096");let y;if(f)try{y=await t._borrowExportedSender(f)}catch(e){if(t._log.error(e),"DC_ID_INVALID"!==e.message)throw e;y=t._sender}else y=t._sender;t._log.info(`Downloading file in chunks of ${h} bytes`);const b=new u(l),_=[];let w=p,v=!1,A=0;for(g&&g(A);;){let e=h,t=!1;if(Math.floor(w/1048576)!==Math.floor((w+e-1)/1048576)&&(e=1048576-w%1048576,t=!0),await b.requestWorker(),v){await b.releaseWorker();break}if(_.push((async()=>{try{const s=await Promise.race([await y.send(new i.a.upload.GetFile({location:n,offset:w,limit:e,precise:t||void 0})),Object(r.sleep)(15e3).then(()=>Promise.reject(new Error("REQUEST_TIMEOUT")))]);if(g){if(g.isCanceled)throw new Error("USER_CANCELED");A+=1/m,g(A)}return!d&&s.bytes.length<e&&(v=!0),s.bytes}catch(e){throw v=!0,e}finally{b.releaseWorker()}})()),w+=e,d&&w>d)break}const I=(await Promise.all(_)).filter(Boolean),P=d?d+1-p:void 0;return e.concat(I,P)}class u{constructor(e){this.maxWorkers=e,o(this,"deferred",void 0),o(this,"activeWorkers",0)}requestWorker(){return this.activeWorkers++,this.activeWorkers>this.maxWorkers?(this.deferred=function(){let e;return{promise:new Promise(t=>{e=t}),resolve:e}}(),this.deferred.promise):Promise.resolve()}releaseWorker(){this.activeWorkers--,this.deferred&&this.activeWorkers<=this.maxWorkers&&this.deferred.resolve()}}}.call(this,n(12).Buffer)},function(e,t,n){"use strict";n.r(t),function(e){n.d(t,"uploadFile",(function(){return o}));var s=n(6),i=n.n(s),a=n(8),r=n(21);async function o(t,n){const{file:s,onProgress:o}=n;let{workers:c}=n;const{name:u,size:l}=s,d=Object(a.readBigIntFromBuffer)(Object(a.generateRandomBytes)(8),!0,!0),f=l>10485760,g=1024*Object(r.getAppropriatedPartSize)(l),p=Math.floor((l+g-1)/g),h=e.from(await function(e){return new Response(e).arrayBuffer()}(s)),m=await t._borrowExportedSender(t.session.dcId);c&&l||(c=1),c>=p&&(c=p);let y=0;o&&o(y);for(let e=0;e<p;e+=c){const t=[];let n=e+c;n>p&&(n=p);for(let s=e;s<n;s++){const e=h.slice(s*g,(s+1)*g);t.push((async()=>{if(await m.send(f?new i.a.upload.SaveBigFilePart({fileId:d,filePart:s,fileTotalParts:p,bytes:e}):new i.a.upload.SaveFilePart({fileId:d,filePart:s,bytes:e})),o){if(o.isCanceled)throw new Error("USER_CANCELED");y+=1/p,o(y)}})())}try{await Promise.race([await Promise.all(t),Object(a.sleep)(15e3*c).then(()=>Promise.reject(new Error("TIMEOUT")))])}catch(t){if("TIMEOUT"===t.message){console.warn("Upload timeout. Retrying..."),e-=c;continue}throw t}}return f?new i.a.InputFileBig({id:d,parts:p,name:u}):new i.a.InputFile({id:d,parts:p,name:u,md5Checksum:""})}}.call(this,n(12).Buffer)},function(e,t,n){"use strict";n.r(t),function(e){n.d(t,"updateTwoFaSettings",(function(){return u}));var s=n(6),i=n.n(s),a=n(8),r=n(29),o=n(27),c=n.n(o);async function u(t,{isCheckPassword:n,currentPassword:s,newPassword:o,hint:u="",email:l,emailCodeCallback:d,onEmailCodeError:f}){if(!o&&!s)throw new Error("Neither `currentPassword` nor `newPassword` is present");if(l&&(!d||!f))throw new Error("`email` present without `emailCodeCallback` and `onEmailCodeError`");const g=await t.invoke(new i.a.account.GetPassword);g.newAlgo instanceof i.a.PasswordKdfAlgoUnknown||(g.newAlgo.salt1=e.concat([g.newAlgo.salt1,Object(a.generateRandomBytes)(32)])),!g.hasPassword&&s&&(s=void 0);const p=s?await Object(r.computeCheck)(g,s):new i.a.InputCheckPasswordEmpty;if(n)await t.invoke(new i.a.auth.CheckPassword({password:p}));else try{await t.invoke(new i.a.account.UpdatePasswordSettings({password:p,newSettings:new i.a.account.PasswordInputSettings({newAlgo:g.newAlgo,newPasswordHash:o?await Object(r.computeDigest)(g.newAlgo,o):e.alloc(0),hint:u,email:l,newSecureSettings:void 0})}))}catch(e){if(!(e instanceof c.a.EmailUnconfirmedError))throw e;for(;;)try{const n=await d(e.codeLength);if(!n)throw new Error("Code is empty");await t.invoke(new i.a.account.ConfirmPasswordEmail({code:n}));break}catch(e){f(e)}}}}.call(this,n(12).Buffer)},function(e,t){e.exports="0.0.2"},function(e,t,n){const s=n(100),i=n(101);class a extends Error{}e.exports={NewMessage:s,StopPropagation:a,Raw:i}},function(e,t){},function(e,t,n){const{EventBuilder:s}=n(102);e.exports=class extends s{constructor(e={types:null,func:null}){super(),e.types?this.types=e.types:this.types=!0}build(e,t=null){return e}}},function(e,t){e.exports={EventBuilder:class{constructor(e={chats:null,blacklistChats:null,func:null}){this.chats=e.chats,this.blacklistChats=Boolean(e.blacklistChats),this.resolved=!1,this.func=e.func}build(e,t=null){}},EventCommon:class{}}},function(e,t,n){const s=n(30),i=n(104),a=n(105),r=n(106),o=n(107);e.exports={Memory:s,StringSession:i,CacheApiSession:a,LocalStorageSession:r,IdbSession:o}},function(e,t,n){(function(t){const s=n(30),i=n(32),a=n(25);class r extends s{constructor(e=null){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 a(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 t.from(e,"base64")}async load(){this._key&&(this._authKey=new i,await this._authKey.setKey(this._key))}save(){if(!this.authKey)return"";const e=t.from([this.dcId]),n=t.from(this.serverAddress),s=t.alloc(2);s.writeInt16BE(n.length,0);const i=t.alloc(2);return i.writeInt16BE(this.port,0),"1"+r.encode(t.concat([e,s,n,i,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}).call(this,n(12).Buffer)},function(e,t,n){const s=n(42);e.exports=class extends s{async _delete(){const e=new Request(this._storageKey);return(await self.caches.open("GramJs")).delete(e)}async _fetchFromCache(){const e=new Request(this._storageKey),t=await self.caches.open("GramJs"),n=await t.match(e);return n?n.text():null}async _saveToCache(e){const t=new Request(this._storageKey),n=new Response(e);return(await self.caches.open("GramJs")).put(t,n)}}},function(e,t,n){const s=n(42);e.exports=class extends s{async _delete(){return localStorage.removeItem(this._storageKey)}async _fetchFromCache(e){return localStorage.getItem(this._storageKey)}async _saveToCache(e,t){return localStorage.setItem(this._storageKey,t)}}},function(e,t,n){const s=n(108),i=n(42);e.exports=class extends i{async _delete(){return s.del("GramJs:"+this._storageKey)}async _fetchFromCache(){return s.get("GramJs:"+this._storageKey)}async _saveToCache(e){return s.set("GramJs:"+this._storageKey,e)}}},function(e,t,n){"use strict";function s(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function i(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const i=s(n);return(e,n)=>i.then(s=>n(s.transaction(t,e).objectStore(t)))}let a;function r(){return a||(a=i("keyval-store","keyval")),a}function o(e,t=r()){return t("readonly",t=>s(t.get(e)))}function c(e,t,n=r()){return n("readwrite",n=>(n.put(t,e),s(n.transaction)))}function u(e,t=r()){return t("readwrite",t=>(e.forEach(e=>t.put(e[1],e[0])),s(t.transaction)))}function l(e,t=r()){return t("readonly",t=>Promise.all(e.map(e=>s(t.get(e)))))}function d(e,t,n=r()){return n("readwrite",n=>new Promise((i,a)=>{n.get(e).onsuccess=function(){try{n.put(t(this.result),e),i(s(n.transaction))}catch(e){a(e)}}}))}function f(e,t=r()){return t("readwrite",t=>(t.delete(e),s(t.transaction)))}function g(e=r()){return e("readwrite",e=>(e.clear(),s(e.transaction)))}function p(e,t){return e("readonly",e=>(e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},s(e.transaction)))}function h(e=r()){const t=[];return p(e,e=>t.push(e.key)).then(()=>t)}function m(e=r()){const t=[];return p(e,e=>t.push(e.value)).then(()=>t)}function y(e=r()){const t=[];return p(e,e=>t.push([e.key,e.value])).then(()=>t)}n.r(t),n.d(t,"clear",(function(){return g})),n.d(t,"createStore",(function(){return i})),n.d(t,"del",(function(){return f})),n.d(t,"entries",(function(){return y})),n.d(t,"get",(function(){return o})),n.d(t,"getMany",(function(){return l})),n.d(t,"keys",(function(){return h})),n.d(t,"promisifyRequest",(function(){return s})),n.d(t,"set",(function(){return c})),n.d(t,"setMany",(function(){return u})),n.d(t,"update",(function(){return d})),n.d(t,"values",(function(){return m}))},function(e,t,n){"use strict";n.r(t);var s={};n.r(s),n.d(s,"destroy",(function(){return g.a})),n.d(s,"disconnect",(function(){return g.b})),n.d(s,"downloadMedia",(function(){return g.c})),n.d(s,"fetchCurrentUser",(function(){return g.d})),n.d(s,"provideAuthPhoneNumber",(function(){return o.l})),n.d(s,"provideAuthCode",(function(){return o.j})),n.d(s,"provideAuthPassword",(function(){return o.k})),n.d(s,"provideAuthRegistration",(function(){return o.m})),n.d(s,"restartAuth",(function(){return o.n})),n.d(s,"restartAuthWithQr",(function(){return o.o})),n.d(s,"fetchChats",(function(){return c.j})),n.d(s,"fetchFullChat",(function(){return c.k})),n.d(s,"searchChats",(function(){return c.w})),n.d(s,"requestChatUpdate",(function(){return c.u})),n.d(s,"saveDraft",(function(){return c.v})),n.d(s,"clearDraft",(function(){return c.a})),n.d(s,"fetchChat",(function(){return c.h})),n.d(s,"updateChatMutedState",(function(){return c.H})),n.d(s,"createChannel",(function(){return c.b})),n.d(s,"joinChannel",(function(){return c.q})),n.d(s,"leaveChannel",(function(){return c.r})),n.d(s,"deleteChannel",(function(){return c.d})),n.d(s,"createGroupChat",(function(){return c.c})),n.d(s,"editChatPhoto",(function(){return c.g})),n.d(s,"toggleChatPinned",(function(){return c.z})),n.d(s,"toggleChatArchived",(function(){return c.y})),n.d(s,"toggleDialogUnread",(function(){return c.A})),n.d(s,"fetchChatFolders",(function(){return c.i})),n.d(s,"editChatFolder",(function(){return c.f})),n.d(s,"deleteChatFolder",(function(){return c.e})),n.d(s,"fetchRecommendedChatFolders",(function(){return c.n})),n.d(s,"getChatByUsername",(function(){return c.o})),n.d(s,"togglePreHistoryHidden",(function(){return c.B})),n.d(s,"updateChatDefaultBannedRights",(function(){return c.F})),n.d(s,"updateChatMemberBannedRights",(function(){return c.G})),n.d(s,"updateChatTitle",(function(){return c.I})),n.d(s,"updateChatAbout",(function(){return c.D})),n.d(s,"toggleSignatures",(function(){return c.C})),n.d(s,"updateChatAdmin",(function(){return c.E})),n.d(s,"fetchGroupsForDiscussion",(function(){return c.l})),n.d(s,"setDiscussionGroup",(function(){return c.x})),n.d(s,"migrateChat",(function(){return c.s})),n.d(s,"openChatByInvite",(function(){return c.t})),n.d(s,"fetchMembers",(function(){return c.m})),n.d(s,"fetchMessages",(function(){return u.g})),n.d(s,"fetchMessage",(function(){return u.e})),n.d(s,"sendMessage",(function(){return u.v})),n.d(s,"pinMessage",(function(){return u.q})),n.d(s,"unpinAllMessages",(function(){return u.y})),n.d(s,"deleteMessages",(function(){return u.b})),n.d(s,"deleteHistory",(function(){return u.a})),n.d(s,"markMessageListRead",(function(){return u.o})),n.d(s,"markMessagesRead",(function(){return u.p})),n.d(s,"requestThreadInfoUpdate",(function(){return u.r})),n.d(s,"searchMessagesLocal",(function(){return u.u})),n.d(s,"searchMessagesGlobal",(function(){return u.t})),n.d(s,"fetchWebPagePreview",(function(){return u.j})),n.d(s,"editMessage",(function(){return u.d})),n.d(s,"forwardMessages",(function(){return u.l})),n.d(s,"loadPollOptionResults",(function(){return u.n})),n.d(s,"sendPollVote",(function(){return u.w})),n.d(s,"findFirstMessageIdAfterDate",(function(){return u.k})),n.d(s,"fetchPinnedMessages",(function(){return u.h})),n.d(s,"fetchScheduledHistory",(function(){return u.i})),n.d(s,"sendScheduledMessages",(function(){return u.x})),n.d(s,"rescheduleMessage",(function(){return u.s})),n.d(s,"deleteScheduledMessages",(function(){return u.c})),n.d(s,"fetchMessageLink",(function(){return u.f})),n.d(s,"fetchFullUser",(function(){return v})),n.d(s,"fetchNearestCountry",(function(){return A})),n.d(s,"fetchTopUsers",(function(){return I})),n.d(s,"fetchContactList",(function(){return P})),n.d(s,"fetchUsers",(function(){return S})),n.d(s,"updateContact",(function(){return C})),n.d(s,"deleteUser",(function(){return M})),n.d(s,"fetchProfilePhotos",(function(){return k})),n.d(s,"fetchStickerSets",(function(){return B})),n.d(s,"fetchRecentStickers",(function(){return D})),n.d(s,"fetchFavoriteStickers",(function(){return x})),n.d(s,"fetchFeaturedStickers",(function(){return j})),n.d(s,"faveSticker",(function(){return N})),n.d(s,"fetchStickers",(function(){return F})),n.d(s,"fetchSavedGifs",(function(){return q})),n.d(s,"searchStickers",(function(){return L})),n.d(s,"installStickerSet",(function(){return H})),n.d(s,"uninstallStickerSet",(function(){return z})),n.d(s,"searchGifs",(function(){return K})),n.d(s,"fetchAnimatedEmojis",(function(){return V})),n.d(s,"fetchStickersForEmoji",(function(){return G})),n.d(s,"checkChatUsername",(function(){return J})),n.d(s,"setChatUsername",(function(){return Z})),n.d(s,"updatePrivateLink",(function(){return Y})),n.d(s,"updateProfile",(function(){return fe})),n.d(s,"checkUsername",(function(){return ge})),n.d(s,"updateUsername",(function(){return pe})),n.d(s,"fetchBlockedContacts",(function(){return _e})),n.d(s,"blockContact",(function(){return we})),n.d(s,"unblockContact",(function(){return ve})),n.d(s,"updateProfilePhoto",(function(){return he})),n.d(s,"uploadProfilePhoto",(function(){return me})),n.d(s,"fetchWallpapers",(function(){return ye})),n.d(s,"uploadWallpaper",(function(){return be})),n.d(s,"fetchAuthorizations",(function(){return Ae})),n.d(s,"terminateAuthorization",(function(){return Ie})),n.d(s,"terminateAllAuthorizations",(function(){return Pe})),n.d(s,"loadNotificationsSettings",(function(){return Se})),n.d(s,"updateContactSignUpNotification",(function(){return Ce})),n.d(s,"updateNotificationSettings",(function(){return Me})),n.d(s,"fetchLanguages",(function(){return ke})),n.d(s,"fetchLangPack",(function(){return Ee})),n.d(s,"fetchPrivacySettings",(function(){return Re})),n.d(s,"setPrivacySettings",(function(){return Te})),n.d(s,"registerDevice",(function(){return Oe})),n.d(s,"unregisterDevice",(function(){return Ue})),n.d(s,"getPasswordInfo",(function(){return te})),n.d(s,"checkPassword",(function(){return se})),n.d(s,"clearPassword",(function(){return ie})),n.d(s,"updatePassword",(function(){return ae})),n.d(s,"updateRecoveryEmail",(function(){return re})),n.d(s,"provideRecoveryEmailCode",(function(){return oe})),n.d(s,"answerCallbackButton",(function(){return De.a})),n.d(s,"validateRequestedInfo",(function(){return je})),n.d(s,"sendPaymentForm",(function(){return Ne})),n.d(s,"getPaymentForm",(function(){return Fe})),n.d(s,"getReceipt",(function(){return Ve}));var i=n(4),a=n(28),r=n(26),o=n(17),c=n(7),u=n(10),l=n(15),d=n.n(l),f=n(0),g=n(1),p=n(2),h=n(13),m=n(3),y=n(19),b=n(5),_=n(16);let w;async function v({id:e,accessHash:t}){const n=Object(p.g)(e,t);if(!(n instanceof f.Api.InputUser))return;const s=await Object(g.g)(new f.Api.users.GetFullUser({id:n}));if(!s)return;const i=Object(h.b)(s);w({"@type":"updateUser",id:e,user:{fullInfo:i.fullInfo}})}async function A(){const e=await Object(g.g)(new f.Api.help.GetNearestDc);return e?e.country:void 0}async function I({hash:e=0}){const t=await Object(g.g)(new f.Api.contacts.GetTopPeers({hash:e,correspondents:!0}));if(!(t instanceof f.Api.contacts.TopPeers))return;const n=t.users.map(h.a).filter(e=>!!e&&!e.isSelf),s=n.map(({id:e})=>e);return{hash:Object(p.q)(s),ids:s,users:n}}async function P({hash:e=0}){const t=await Object(g.g)(new f.Api.contacts.GetContacts({hash:e}));if(t&&!(t instanceof f.Api.contacts.ContactsNotModified))return t.users.forEach(e=>{e instanceof f.Api.User&&(b.a.users[e.id]=e)}),{hash:Object(p.q)([t.savedCount,...t.contacts.map(({userId:e})=>e)]),users:t.users.map(h.a).filter(Boolean),chats:t.users.map(e=>Object(m.d)(e)).filter(Boolean)}}async function S({users:e}){const t=await Object(g.g)(new f.Api.users.GetUsers({id:e.map(({id:e,accessHash:t})=>Object(p.i)(e,t))}));if(t&&t.length)return t.forEach(e=>{e instanceof f.Api.User&&(b.a.users[e.id]=e)}),t.map(h.a).filter(Boolean)}function C({phone:e,firstName:t,lastName:n}){return Object(g.g)(new f.Api.contacts.ImportContacts({contacts:[Object(p.e)({phone:e||"",firstName:t||"",lastName:n||""})]}))}async function M({id:e,accessHash:t}){const n=Object(p.g)(e,t);if(!(n instanceof f.Api.InputUser))return;await Object(g.g)(new f.Api.contacts.DeleteContacts({id:[n]}))&&w({"@type":"deleteUser",id:e})}async function k(e,t){if(e){const{id:t,accessHash:n}=e,s=await Object(g.g)(new f.Api.photos.GetUserPhotos({userId:Object(p.g)(t,n),limit:i.t,offset:0,maxId:d()("0")}));if(!s)return;return function(e){e.photos.forEach(_.b)}(s),{photos:s.photos.filter(e=>e instanceof f.Api.Photo).map(y.a)}}const n=await Object(u.u)({chatOrUser:t,type:"profilePhoto",limit:i.t});if(!n)return;const{messages:s,users:a}=n;return{photos:s.map(e=>e.content.action.photo).filter(Boolean),users:a}}var E=n(22),R=n(9);let O,U,T;async function B({hash:e}){const t=await Object(g.g)(new f.Api.messages.GetAllStickers({hash:e}));if(t&&!(t instanceof f.Api.messages.AllStickersNotModified))return t.sets.forEach(e=>{e.thumb&&(b.a.stickerSets[String(e.id)]=e)}),{hash:t.hash,sets:t.sets.map(E.b)}}async function D({hash:e}){const t=await Object(g.g)(new f.Api.messages.GetRecentStickers({hash:e}));if(t&&!(t instanceof f.Api.messages.RecentStickersNotModified))return{hash:t.hash,stickers:W(t.stickers)}}async function x({hash:e}){const t=await Object(g.g)(new f.Api.messages.GetFavedStickers({hash:e}));if(t&&!(t instanceof f.Api.messages.FavedStickersNotModified))return{hash:t.hash,stickers:W(t.stickers)}}async function j({hash:e}){const t=await Object(g.g)(new f.Api.messages.GetFeaturedStickers({hash:e}));if(t&&!(t instanceof f.Api.messages.FeaturedStickersNotModified))return{hash:t.hash,sets:t.sets.map(E.c)}}async function N({sticker:e,unfave:t}){const n=new f.Api.messages.FaveSticker({id:Object(p.f)(e),unfave:t});await Object(g.g)(n)&&O({"@type":"updateFavoriteStickers"})}async function F({stickerSetId:e,accessHash:t}){const n=await Object(g.g)(new f.Api.messages.GetStickerSet({stickerset:Object(p.l)(e,t)}));var s;if(n)return{set:Object(E.b)(n.set),stickers:W(n.documents),packs:(s=n.packs,s.reduce((e,{emoticon:t,documents:n})=>(e[t]=n.map(e=>Object(E.a)(b.a.documents[String(e)])).filter(Boolean),e),{}))}}async function V(){const e=await Object(g.g)(new f.Api.messages.GetStickerSet({stickerset:new f.Api.InputStickerSetAnimatedEmoji}));if(e)return{set:Object(E.b)(e.set),stickers:W(e.documents)}}async function L({query:e,hash:t}){const n=await Object(g.g)(new f.Api.messages.SearchStickerSets({q:e,hash:t}));if(n&&!(n instanceof f.Api.messages.FoundStickerSetsNotModified))return{hash:n.hash,sets:n.sets.map(E.c)}}async function q({hash:e}){const t=await Object(g.g)(new f.Api.messages.GetSavedGifs({hash:e}));if(t&&!(t instanceof f.Api.messages.SavedGifsNotModified))return{hash:t.hash,gifs:$(t.gifs)}}async function H({stickerSetId:e,accessHash:t}){await Object(g.g)(new f.Api.messages.InstallStickerSet({stickerset:Object(p.l)(e,t)}))&&O({"@type":"updateStickerSet",id:e,stickerSet:{installedDate:Date.now()}})}async function z({stickerSetId:e,accessHash:t}){await Object(g.g)(new f.Api.messages.UninstallStickerSet({stickerset:Object(p.l)(e,t)}))&&O({"@type":"updateStickerSet",id:e,stickerSet:{installedDate:void 0}})}async function K({query:e,offset:t=""}){if(!U){const e=await Object(g.g)(new f.Api.help.GetConfig);if(!e)return;const t=await Object(g.g)(new f.Api.contacts.ResolveUsername({username:e.gifSearchUsername}));if(!(t&&t.users[0]instanceof f.Api.User))return;U=new f.Api.InputUser({userId:t.peer.userId,accessHash:t.users[0].accessHash})}const n=await Object(g.g)(new f.Api.messages.GetInlineBotResults({bot:U,peer:new f.Api.InputPeerEmpty,query:e,offset:t}));if(!n)return;const s=n.results.map(e=>{if(e instanceof f.Api.BotInlineMediaResult)return e.document}).filter(Boolean);return{nextOffset:n.nextOffset,gifs:$(s)}}async function G({emoji:e,hash:t=0}){const n=await Object(g.g)(new f.Api.messages.GetStickers({emoticon:e,hash:t}));if(n&&!(n instanceof f.Api.messages.StickersNotModified))return{stickers:W(n.stickers),hash:n.hash}}function W(e){return e.map(e=>{if(e instanceof f.Api.Document){const t=Object(E.a)(e);if(t)return b.a.documents[String(e.id)]=e,t}}).filter(Boolean)}function $(e){return e.map(e=>{if(e instanceof f.Api.Document){const t=Object(R.m)(e);if(t)return b.a.documents[String(e.id)]=e,t}}).filter(Boolean)}async function J({username:e}){try{return await Object(g.g)(new f.Api.channels.CheckUsername({channel:new f.Api.InputChannelEmpty,username:e}),void 0,!0)}catch(e){return!1}}async function Z({chat:e,username:t}){await Object(g.g)(new f.Api.channels.UpdateUsername({channel:Object(p.g)(e.id,e.accessHash),username:t}))&&T({"@type":"updateChat",id:e.id,chat:{username:t}})}async function Y({chat:e}){const t=await Object(g.g)(new f.Api.messages.ExportChatInvite({peer:Object(p.i)(e.id,e.accessHash)}));t&&t instanceof f.Api.ChatInviteExported&&T({"@type":"updateChatFullInfo",id:e.id,fullInfo:{inviteLink:t.link}})}const Q={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"},X={};let ee;async function te(){const e=await Object(g.g)(new f.Api.account.GetPassword);if(!e)return;const{hint:t,hasPassword:n}=e;return{hint:t,hasPassword:n}}function ne(e){return ee({"@type":"updateTwoFaStateWaitCode",length:e}),new Promise((e,t)=>{X.resolve=e,X.reject=t})}async function se(e){try{return await Object(g.h)({isCheckPassword:!0,currentPassword:e}),!0}catch(e){return ce(e),!1}}async function ie(e){try{return await Object(g.h)({currentPassword:e}),!0}catch(e){return ce(e),!1}}async function ae(e,t,n,s){try{return await Object(g.h)({currentPassword:e,newPassword:t,hint:n,email:s,emailCodeCallback:ne,onEmailCodeError:ce}),!0}catch(e){return ce(e),!1}}async function re(e,t){try{return await Object(g.h)({currentPassword:e,newPassword:e,email:t,emailCodeCallback:ne,onEmailCodeError:ce}),!0}catch(e){return ce(e),!1}}function oe(e){X.resolve(e)}function ce(e){let t;if(e instanceof f.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=Q[e.message];t||(t="Unexpected Error",i.f&&console.error(e)),ee({"@type":"updateTwoFaError",message:t})}var ue=n(24),le=n(18),de=n(14);function fe({firstName:e,lastName:t,about:n}){return Object(g.g)(new f.Api.account.UpdateProfile({firstName:e||"",lastName:t||"",about:n||""}))}function ge(e){return Object(g.g)(new f.Api.account.CheckUsername({username:e}))}function pe(e){return Object(g.g)(new f.Api.account.UpdateUsername({username:e}))}async function he(e){const t=await Object(g.i)(e);return Object(g.g)(new f.Api.photos.UploadProfilePhoto({file:t}))}async function me(e){const t=await Object(g.i)(e);await Object(g.g)(new f.Api.photos.UploadProfilePhoto({file:t}))}async function ye(e){const t=await Object(g.g)(new f.Api.account.GetWallPapers({hash:e}));if(!t||t instanceof f.Api.account.WallPapersNotModified)return;const n=t.wallpapers.filter(e=>e instanceof f.Api.WallPaper&&e.document instanceof f.Api.Document&&(!e.pattern&&"application/x-tgwallpattern"!==e.document.mimeType));return n.forEach(e=>{b.a.documents[String(e.document.id)]=e.document}),{hash:t.hash,wallpapers:n.map(ue.b).filter(Boolean)}}async function be(e){const t=await Object(g.i)(e),n=await Object(g.g)(new f.Api.account.UploadWallPaper({file:t,mimeType:e.type,settings:new f.Api.WallPaperSettings}));if(!(n&&n instanceof f.Api.WallPaper))return;const s=Object(ue.b)(n);return s?(b.a.documents[String(n.document.id)]=n.document,{wallpaper:s}):void 0}async function _e(){const e=await Object(g.g)(new f.Api.contacts.GetBlocked({limit:i.e}));if(e)return Be(e),{users:e.users.map(h.a).filter(Boolean),chats:e.chats.map(e=>Object(m.d)(e,void 0,!0)).filter(Boolean),blockedIds:e.blocked.map(e=>Object(m.k)(e.peerId)),totalCount:e instanceof f.Api.contacts.BlockedSlice?e.count:e.blocked.length}}function we(e){return Object(g.g)(new f.Api.contacts.Block({id:Object(p.o)(e)}))}function ve(e,t){return Object(g.g)(new f.Api.contacts.Unblock({id:Object(p.i)(e,t)}))}async function Ae(){const e=await Object(g.g)(new f.Api.account.GetAuthorizations);if(e)return e.authorizations.map(ue.a)}function Ie(e){return Object(g.g)(new f.Api.account.ResetAuthorization({hash:d()(e)}))}function Pe(){return Object(g.g)(new f.Api.auth.ResetAuthorizations)}async function Se(){const[e,t,n,s]=await Promise.all([Object(g.g)(new f.Api.account.GetContactSignUpNotification),Object(g.g)(new f.Api.account.GetNotifySettings({peer:new f.Api.InputNotifyUsers})),Object(g.g)(new f.Api.account.GetNotifySettings({peer:new f.Api.InputNotifyChats})),Object(g.g)(new f.Api.account.GetNotifySettings({peer:new f.Api.InputNotifyBroadcasts}))]);if(!t||!n||!s)return!1;const{silent:i,muteUntil:a,showPreviews:r}=t,{silent:o,muteUntil:c,showPreviews:u}=n,{silent:l,muteUntil:d,showPreviews:p}=s;return{hasContactJoinedNotifications:!e,hasPrivateChatsNotifications:!(i||"number"==typeof a&&Date.now()<1e3*a),hasPrivateChatsMessagePreview:r,hasGroupNotifications:!(o||"number"==typeof c&&Date.now()<1e3*c),hasGroupMessagePreview:u,hasBroadcastNotifications:!(l||"number"==typeof d&&Date.now()<1e3*d),hasBroadcastMessagePreview:p}}function Ce(e){return Object(g.g)(new f.Api.account.SetContactSignUpNotification({silent:e}))}function Me(e,{isSilent:t,isShowPreviews:n}){let s;s="contact"===e?new f.Api.InputNotifyUsers:"group"===e?new f.Api.InputNotifyChats:new f.Api.InputNotifyBroadcasts;const i={showPreviews:n,silent:t,muteUntil:t?2**31-1:void 0};return Object(g.g)(new f.Api.account.UpdateNotifySettings({peer:s,settings:new f.Api.InputPeerNotifySettings(i)}))}async function ke(){const e=await Object(g.g)(new f.Api.langpack.GetLanguages({langPack:i.h}));if(e)return e.map(le.b)}async function Ee({sourceLangPacks:e,langCode:t}){const n=(await Promise.all(e.map(e=>Object(g.g)(new f.Api.langpack.GetLangPack({langPack:e,langCode:t}))))).filter(Boolean).map(e=>Object(de.a)(e.strings.map(le.b),"key"));if(n.length)return{langPack:Object.assign({},...n.reverse())}}async function Re(e){const t=Object(p.k)(e),n=await Object(g.g)(new f.Api.account.GetPrivacy({key:t}));if(n)return Be(n),Object(ue.d)(n.rules)}function Oe(e){const t=Object(g.e)().session.getAuthKey().getKey();return Object(g.g)(new f.Api.account.RegisterDevice({tokenType:10,secret:t,appSandbox:!1,otherUids:[],token:e}))}function Ue(e){return Object(g.g)(new f.Api.account.UnregisterDevice({tokenType:10,otherUids:[],token:e}))}async function Te(e,t){const n=Object(p.k)(e),s=[];switch(t.allowedUsers&&s.push(new f.Api.InputPrivacyValueAllowUsers({users:t.allowedUsers.map(({id:e,accessHash:t})=>Object(p.i)(e,t))})),t.allowedChats&&s.push(new f.Api.InputPrivacyValueAllowChatParticipants({chats:t.allowedChats.map(({id:e})=>-e)})),t.blockedUsers&&s.push(new f.Api.InputPrivacyValueDisallowUsers({users:t.blockedUsers.map(({id:e,accessHash:t})=>Object(p.i)(e,t))})),t.blockedChats&&s.push(new f.Api.InputPrivacyValueDisallowChatParticipants({chats:t.blockedChats.map(({id:e})=>-e)})),t.visibility){case"everybody":s.push(new f.Api.InputPrivacyValueAllowAll);break;case"contacts":s.push(new f.Api.InputPrivacyValueAllowContacts);break;case"nonContacts":s.push(new f.Api.InputPrivacyValueDisallowContacts);break;case"nobody":s.push(new f.Api.InputPrivacyValueDisallowAll)}const i=await Object(g.g)(new f.Api.account.SetPrivacy({key:n,rules:s}));if(i)return Be(i),Object(ue.d)(i.rules)}function Be(e){e.users.forEach(e=>{e instanceof f.Api.User&&(b.a.users[e.id]=e)}),e.chats.forEach(e=>{(e instanceof f.Api.Chat||e instanceof f.Api.Channel)&&(b.a.chats[e.id]=e)})}var De=n(72);function xe(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 je({messageId:e,requestInfo:t,shouldSave:n}){const s=await Object(g.g)(new f.Api.payments.ValidateRequestedInfo({msgId:e,save:n||void 0,info:Object(p.p)(t)}));if(!s)return;const{id:i,shippingOptions:a}=s;return i?{id:i,shippingOptions:xe(a)}:void 0}function Ne({messageId:e,requestedInfoId:t,shippingOptionId:n,credentials:s}){return Object(g.g)(new f.Api.payments.SendPaymentForm({msgId:e,requestedInfoId:t,shippingOptionId:n,credentials:new f.Api.InputPaymentCredentials({save:s.save,data:new f.Api.DataJSON({data:JSON.stringify(s.data)})})}),!0)}async function Fe({messageId:e}){const t=await Object(g.g)(new f.Api.payments.GetPaymentForm({msgId:e}));if(t)return function(e){const{canSaveCredentials:t,passwordMissing:n,providerId:s,nativeProvider:i,nativeParams:a,savedInfo:r,invoice:o}=e,{test:c,nameRequested:u,phoneRequested:l,emailRequested:d,shippingAddressRequested:f,flexible:g,phoneToProvider:p,emailToProvider:h,currency:m,prices:y}=o,b=y.map(({label:e,amount:t})=>({label:e,amount:Number(t.value)})),_=a?JSON.parse(a.data):{};return{canSaveCredentials:t,passwordMissing:n,providerId:s,nativeProvider:i,savedInfo:r,invoice:{test:c,nameRequested:u,phoneRequested:l,emailRequested:d,shippingAddressRequested:f,flexible:g,phoneToProvider:p,emailToProvider:h,currency:m,prices:b},nativeParams:{needCardholderName:_.need_cardholder_name,needCountry:_.need_country,needZip:_.need_zip,publishableKey:_.publishable_key}}}(t)}async function Ve(e){const t=await Object(g.g)(new f.Api.payments.GetPaymentReceipt({msgId:e}));if(t)return function(e){const{invoice:t,info:n,shipping:s,currency:i,totalAmount:a,credentialsTitle:r}=e,{shippingAddress:o,phone:c,name:u}=n||{},{prices:l}=t,d=l.map(({label:e,amount:t})=>({label:e,amount:Number(t.value)}));let f,g;return s&&(f=s.prices.map(({label:e,amount:t})=>({label:e,amount:Number(t.value)})),g=s.title),{currency:i,prices:d,info:{shippingAddress:o,phone:c,name:u},totalAmount:Number(a.value),credentialsTitle:r,shippingPrices:f,shippingMethod:g}}(t)}let Le;async function qe(e,t=""){Le=e,Object(r.a)(We),Object(o.a)(We),Object(c.p)(We),Object(u.m)(We),function(e){w=e}(We),function(e){O=e}(We),function(e){T=e}(We),function(e){ee=e}(We),await Object(g.f)(t,We)}const He=Object(a.c)((function(e){if(!Ge||e!==Ke)return;const t=Ge;Ge=void 0,t.forEach(Le)}));let ze,Ke,Ge;function We(e){Ge?Ge.push(e):Ge=[e],ze&&!i.b.has(e["@type"])||(ze=Object(a.b)(He,i.c,!0),Ke=Math.random()),ze(Ke)}self.onerror=e=>{console.error(e),Ze({type:"unhandledError",error:{message:e.error.message||"Uncaught exception in worker"}})},self.addEventListener("unhandledrejection",e=>{console.error(e),Ze({type:"unhandledError",error:{message:e.reason.message||"Uncaught rejection in worker"}})});const $e=new Map;function Je(e){Ze({type:"update",update:e})}function Ze(e,t){t?postMessage(e,[t]):postMessage(e)}i.f&&console.log(">>> FINISH LOAD WORKER"),onmessage=async e=>{const{data:t}=e;switch(t.type){case"initApi":await qe(Je,t.args[0]);break;case"callMethod":{const{messageId:e,name:n,args:a}=t;try{if(e){const t=(...t)=>{const n=t[t.length-1];Ze({type:"methodCallback",messageId:e,callbackArgs:t},n instanceof ArrayBuffer?n:void 0)};$e.set(e,t),a.push(t)}const t=await function(e,...t){return s[e](...t)}(n,...a),{arrayBuffer:i}="object"==typeof t&&"arrayBuffer"in t&&t||{};e&&Ze({type:"methodResponse",messageId:e,response:t},i)}catch(t){i.f&&console.error(t),e&&Ze({type:"methodResponse",messageId:e,error:{message:t.message}})}e&&$e.delete(e);break}case"cancelProgress":{const e=$e.get(t.messageId);e&&(e.isCanceled=!0);break}}}}]);
//# sourceMappingURL=f52f8cb8dd6763aaca42.worker.js.map