mirror of
https://github.com/danbulant/discord.js
synced 2026-06-19 14:41:36 +00:00
13 lines
No EOL
198 KiB
JavaScript
13 lines
No EOL
198 KiB
JavaScript
!function(t){function e(i){if(n[i])return n[i].exports;var s=n[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,e),s.l=!0,s.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,e,n){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=58)}([function(t,e,n){(function(t){e.Package=n(27),e.DefaultOptions={apiRequestMethod:"sequential",shardId:0,shardCount:0,messageCacheMaxSize:200,messageCacheLifetime:0,messageSweepInterval:0,fetchAllMembers:!1,disableEveryone:!1,sync:!1,restWsBridgeTimeout:5e3,disabledEvents:[],ws:{large_threshold:250,compress:"undefined"==typeof window,properties:{$os:t?t.platform:"discord.js",$browser:"discord.js",$device:"discord.js",$referrer:"",$referring_domain:""}}},e.Errors={NO_TOKEN:"Request to use token, but token was unavailable to the client.",NO_BOT_ACCOUNT:"Only bot accounts are able to make use of this feature.",NO_USER_ACCOUNT:"Only user accounts are able to make use of this feature.",BAD_WS_MESSAGE:"A bad message was received from the websocket; either bad compression, or not JSON.",TOOK_TOO_LONG:"Something took too long to do.",NOT_A_PERMISSION:"Invalid permission string or number.",INVALID_RATE_LIMIT_METHOD:"Unknown rate limiting method.",BAD_LOGIN:"Incorrect login details were provided.",INVALID_SHARD:"Invalid shard settings were provided."};const i=e.PROTOCOL_VERSION=6,s=e.HOST=`https://discordapp.com`,r=e.API=`${s}/api/v${i}`,o=e.Endpoints={login:`${r}/auth/login`,logout:`${r}/auth/logout`,gateway:`${r}/gateway`,botGateway:`${r}/gateway/bot`,invite:t=>`${r}/invite/${t}`,inviteLink:t=>`https://discord.gg/${t}`,assets:t=>`${s}/assets/${t}`,CDN:"https://cdn.discordapp.com",user:t=>`${r}/users/${t}`,userChannels:t=>`${o.user(t)}/channels`,userProfile:t=>`${o.user(t)}/profile`,avatar:(t,e)=>"1"===t?e:`${o.user(t)}/avatars/${e}.jpg`,me:`${r}/users/@me`,meGuild:t=>`${o.me}/guilds/${t}`,relationships:t=>`${o.user(t)}/relationships`,note:t=>`${o.me}/notes/${t}`,guilds:`${r}/guilds`,guild:t=>`${o.guilds}/${t}`,guildIcon:(t,e)=>`${o.CDN}/icons/${t}/${e}.jpg`,guildSplash:(t,e)=>`${o.CDN}/splashes/${t}/${e}.jpg`,guildPrune:t=>`${o.guild(t)}/prune`,guildEmbed:t=>`${o.guild(t)}/embed`,guildInvites:t=>`${o.guild(t)}/invites`,guildRoles:t=>`${o.guild(t)}/roles`,guildRole:(t,e)=>`${o.guildRoles(t)}/${e}`,guildBans:t=>`${o.guild(t)}/bans`,guildIntegrations:t=>`${o.guild(t)}/integrations`,guildMembers:t=>`${o.guild(t)}/members`,guildMember:(t,e)=>`${o.guildMembers(t)}/${e}`,guildMemberRole:(t,e,n)=>`${o.guildMember(t,e)}/roles/${n}`,guildMemberNickname:t=>`${o.guildMember(t,"@me")}/nick`,guildChannels:t=>`${o.guild(t)}/channels`,guildEmojis:t=>`${o.guild(t)}/emojis`,channels:`${r}/channels`,channel:t=>`${o.channels}/${t}`,channelMessages:t=>`${o.channel(t)}/messages`,channelInvites:t=>`${o.channel(t)}/invites`,channelTyping:t=>`${o.channel(t)}/typing`,channelPermissions:t=>`${o.channel(t)}/permissions`,channelMessage:(t,e)=>`${o.channelMessages(t)}/${e}`,channelWebhooks:t=>`${o.channel(t)}/webhooks`,messageReactions:(t,e)=>`${o.channelMessage(t,e)}/reactions`,messageReaction:(t,e,n,i)=>`${o.messageReactions(t,e)}/${n}`+`${i?`?limit=${i}`:""}`,selfMessageReaction:(t,e,n,i)=>`${o.messageReaction(t,e,n,i)}/@me`,userMessageReaction:(t,e,n,i,s)=>`${o.messageReaction(t,e,n,i)}/${s}`,webhook:(t,e)=>`${r}/webhooks/${t}${e?`/${e}`:""}`,myApplication:`${r}/oauth2/applications/@me`,getApp:t=>`${r}/oauth2/authorize?client_id=${t}`,emoji:t=>`${o.CDN}/emojis/${t}.png`};e.Status={READY:0,CONNECTING:1,RECONNECTING:2,IDLE:3,NEARLY:4,DISCONNECTED:5},e.ChannelTypes={text:0,DM:1,voice:2,groupDM:3},e.OPCodes={DISPATCH:0,HEARTBEAT:1,IDENTIFY:2,STATUS_UPDATE:3,VOICE_STATE_UPDATE:4,VOICE_GUILD_PING:5,RESUME:6,RECONNECT:7,REQUEST_GUILD_MEMBERS:8,INVALID_SESSION:9,HELLO:10,HEARTBEAT_ACK:11},e.VoiceOPCodes={IDENTIFY:0,SELECT_PROTOCOL:1,READY:2,HEARTBEAT:3,SESSION_DESCRIPTION:4,SPEAKING:5},e.Events={READY:"ready",GUILD_CREATE:"guildCreate",GUILD_DELETE:"guildDelete",GUILD_UPDATE:"guildUpdate",GUILD_UNAVAILABLE:"guildUnavailable",GUILD_AVAILABLE:"guildAvailable",GUILD_MEMBER_ADD:"guildMemberAdd",GUILD_MEMBER_REMOVE:"guildMemberRemove",GUILD_MEMBER_UPDATE:"guildMemberUpdate",GUILD_MEMBER_AVAILABLE:"guildMemberAvailable",GUILD_MEMBER_SPEAKING:"guildMemberSpeaking",GUILD_MEMBERS_CHUNK:"guildMembersChunk",GUILD_ROLE_CREATE:"roleCreate",GUILD_ROLE_DELETE:"roleDelete",GUILD_ROLE_UPDATE:"roleUpdate",GUILD_EMOJI_CREATE:"guildEmojiCreate",GUILD_EMOJI_DELETE:"guildEmojiDelete",GUILD_EMOJI_UPDATE:"guildEmojiUpdate",GUILD_BAN_ADD:"guildBanAdd",GUILD_BAN_REMOVE:"guildBanRemove",CHANNEL_CREATE:"channelCreate",CHANNEL_DELETE:"channelDelete",CHANNEL_UPDATE:"channelUpdate",CHANNEL_PINS_UPDATE:"channelPinsUpdate",MESSAGE_CREATE:"message",MESSAGE_DELETE:"messageDelete",MESSAGE_UPDATE:"messageUpdate",MESSAGE_BULK_DELETE:"messageDeleteBulk",MESSAGE_REACTION_ADD:"messageReactionAdd",MESSAGE_REACTION_REMOVE:"messageReactionRemove",MESSAGE_REACTION_REMOVE_ALL:"messageReactionRemoveAll",USER_UPDATE:"userUpdate",USER_NOTE_UPDATE:"userNoteUpdate",PRESENCE_UPDATE:"presenceUpdate",VOICE_STATE_UPDATE:"voiceStateUpdate",TYPING_START:"typingStart",TYPING_STOP:"typingStop",DISCONNECT:"disconnect",RECONNECTING:"reconnecting",ERROR:"error",WARN:"warn",DEBUG:"debug"},e.WSEvents={READY:"READY",GUILD_SYNC:"GUILD_SYNC",GUILD_CREATE:"GUILD_CREATE",GUILD_DELETE:"GUILD_DELETE",GUILD_UPDATE:"GUILD_UPDATE",GUILD_MEMBER_ADD:"GUILD_MEMBER_ADD",GUILD_MEMBER_REMOVE:"GUILD_MEMBER_REMOVE",GUILD_MEMBER_UPDATE:"GUILD_MEMBER_UPDATE",GUILD_MEMBERS_CHUNK:"GUILD_MEMBERS_CHUNK",GUILD_ROLE_CREATE:"GUILD_ROLE_CREATE",GUILD_ROLE_DELETE:"GUILD_ROLE_DELETE",GUILD_ROLE_UPDATE:"GUILD_ROLE_UPDATE",GUILD_BAN_ADD:"GUILD_BAN_ADD",GUILD_BAN_REMOVE:"GUILD_BAN_REMOVE",CHANNEL_CREATE:"CHANNEL_CREATE",CHANNEL_DELETE:"CHANNEL_DELETE",CHANNEL_UPDATE:"CHANNEL_UPDATE",CHANNEL_PINS_UPDATE:"CHANNEL_PINS_UPDATE",MESSAGE_CREATE:"MESSAGE_CREATE",MESSAGE_DELETE:"MESSAGE_DELETE",MESSAGE_UPDATE:"MESSAGE_UPDATE",MESSAGE_DELETE_BULK:"MESSAGE_DELETE_BULK",MESSAGE_REACTION_ADD:"MESSAGE_REACTION_ADD",MESSAGE_REACTION_REMOVE:"MESSAGE_REACTION_REMOVE",MESSAGE_REACTION_REMOVE_ALL:"MESSAGE_REACTION_REMOVE_ALL",USER_UPDATE:"USER_UPDATE",USER_NOTE_UPDATE:"USER_NOTE_UPDATE",PRESENCE_UPDATE:"PRESENCE_UPDATE",VOICE_STATE_UPDATE:"VOICE_STATE_UPDATE",TYPING_START:"TYPING_START",VOICE_SERVER_UPDATE:"VOICE_SERVER_UPDATE",RELATIONSHIP_ADD:"RELATIONSHIP_ADD",RELATIONSHIP_REMOVE:"RELATIONSHIP_REMOVE"},e.MessageTypes={0:"DEFAULT",1:"RECIPIENT_ADD",2:"RECIPIENT_REMOVE",3:"CALL",4:"CHANNEL_NAME_CHANGE",5:"CHANNEL_ICON_CHANGE",6:"PINS_ADD"},e.DefaultAvatars={BLURPLE:"6debd47ed13483642cf09e832ed0bc1b",GREY:"322c936a8c8be1b803cd94861bdfa868",GREEN:"dd4dbc0016779df1378e7812eabaa04d",ORANGE:"0e291f67c9274a1abdddeb3fd919cbaa",RED:"1cbd08c76f8af6dddce02c5138971129"};const a=e.PermissionFlags={CREATE_INSTANT_INVITE:1,KICK_MEMBERS:2,BAN_MEMBERS:4,ADMINISTRATOR:8,MANAGE_CHANNELS:16,MANAGE_GUILD:32,ADD_REACTIONS:64,READ_MESSAGES:1024,SEND_MESSAGES:2048,SEND_TTS_MESSAGES:4096,MANAGE_MESSAGES:8192,EMBED_LINKS:16384,ATTACH_FILES:32768,READ_MESSAGE_HISTORY:65536,MENTION_EVERYONE:1<<17,EXTERNAL_EMOJIS:1<<18,CONNECT:1<<20,SPEAK:1<<21,MUTE_MEMBERS:1<<22,DEAFEN_MEMBERS:1<<23,MOVE_MEMBERS:1<<24,USE_VAD:1<<25,CHANGE_NICKNAME:1<<26,MANAGE_NICKNAMES:1<<27,MANAGE_ROLES_OR_PERMISSIONS:1<<28,MANAGE_WEBHOOKS:1<<29,MANAGE_EMOJIS:1<<30};let h=0;for(const u in a)h|=a[u];e.ALL_PERMISSIONS=h,e.DEFAULT_PERMISSIONS=104324097}).call(e,n(24))},function(t,e){class n{constructor(t){this.packetManager=t}handle(t){return t}}t.exports=n},function(t,e){class n{constructor(t){this.client=t}handle(t){return t}}t.exports=n},function(t,e){class n extends Map{constructor(t){super(t),this._array=null,this._keyArray=null}set(t,e){return this._array=null,this._keyArray=null,super.set(t,e)}delete(t){return this._array=null,this._keyArray=null,super.delete(t)}array(){return this._array&&this._array.length===this.size||(this._array=Array.from(this.values())),this._array}keyArray(){return this._keyArray&&this._keyArray.length===this.size||(this._keyArray=Array.from(this.keys())),this._keyArray}first(){return this.values().next().value}firstKey(){return this.keys().next().value}last(){const t=this.array();return t[t.length-1]}lastKey(){const t=this.keyArray();return t[t.length-1]}random(){const t=this.array();return t[Math.floor(Math.random()*t.length)]}randomKey(){const t=this.keyArray();return t[Math.floor(Math.random()*t.length)]}findAll(t,e){if("string"!=typeof t)throw new TypeError("Key must be a string.");if("undefined"==typeof e)throw new Error("Value must be specified.");const n=[];for(const i of this.values())i[t]===e&&n.push(i);return n}find(t,e){if("string"==typeof t){if("undefined"==typeof e)throw new Error("Value must be specified.");if("id"===t)throw new RangeError("Don't use .find() with IDs. Instead, use .get(id).");for(const n of this.values())if(n[t]===e)return n;return null}if("function"==typeof t){for(const[e,n]of this)if(t(n,e,this))return n;return null}throw new Error("First argument must be a property string or a function.")}findKey(t,e){if("string"==typeof t){if("undefined"==typeof e)throw new Error("Value must be specified.");for(const[n,i]of this)if(i[t]===e)return n;return null}if("function"==typeof t){for(const[e,n]of this)if(t(n,e,this))return e;return null}throw new Error("First argument must be a property string or a function.")}exists(t,e){if("id"===t)throw new RangeError("Don't use .exists() with IDs. Instead, use .has(id).");return Boolean(this.find(t,e))}filter(t,e){e&&(t=t.bind(e));const i=new n;for(const[s,r]of this)t(r,s,this)&&i.set(s,r);return i}filterArray(t,e){e&&(t=t.bind(e));const n=[];for(const[i,s]of this)t(s,i,this)&&n.push(s);return n}map(t,e){e&&(t=t.bind(e));const n=new Array(this.size);let i=0;for(const[s,r]of this)n[i++]=t(r,s,this);return n}some(t,e){e&&(t=t.bind(e));for(const[n,i]of this)if(t(i,n,this))return!0;return!1}every(t,e){e&&(t=t.bind(e));for(const[n,i]of this)if(!t(i,n,this))return!1;return!0}reduce(t,e){let n=e;for(const[i,s]of this)n=t(n,s,i,this);return n}concat(...t){const e=new this.constructor;for(const[n,i]of this)e.set(n,i);for(const s of t)for(const[n,i]of s)e.set(n,i);return e}deleteAll(){const t=[];for(const e of this.values())e.delete&&t.push(e.delete());return t}equals(t){return!!t&&(this===t||this.size===t.size&&!this.find((e,n)=>{const i=t.get(n);return i!==e||void 0===i&&!t.has(n)}))}}t.exports=n},function(t,e){t.exports=function(t){const e=Object.create(t);return Object.assign(e,t),e}},function(t,e){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;e.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])}}return t},e.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var i={arraySet:function(t,e,n,i,s){if(e.subarray&&t.subarray)return void t.set(e.subarray(n,n+i),s);for(var r=0;r<i;r++)t[s+r]=e[n+r]},flattenChunks:function(t){var e,n,i,s,r,o;for(i=0,e=0,n=t.length;e<n;e++)i+=t[e].length;for(o=new Uint8Array(i),s=0,e=0,n=t.length;e<n;e++)r=t[e],o.set(r,s),s+=r.length;return o}},s={arraySet:function(t,e,n,i,s){for(var r=0;r<i;r++)t[s+r]=e[n+r]},flattenChunks:function(t){return[].concat.apply([],t)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,i)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,s))},e.setTyped(n)},function(t,e,n){const i=n(11),s=n(0),r=n(7).Presence;class o{constructor(t,e){Object.defineProperty(this,"client",{value:t}),e&&this.setup(e)}setup(t){this.id=t.id,this.username=t.username,this.discriminator=t.discriminator,this.avatar=t.avatar,this.bot=Boolean(t.bot),this.lastMessageID=null}patch(t){for(const e of["id","username","discriminator","avatar","bot"])"undefined"!=typeof t[e]&&(this[e]=t[e])}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}get presence(){if(this.client.presences.has(this.id))return this.client.presences.get(this.id);for(const t of this.client.guilds.values())if(t.presences.has(this.id))return t.presences.get(this.id);return new r}get avatarURL(){return this.avatar?s.Endpoints.avatar(this.id,this.avatar):null}get defaultAvatarURL(){let t=Object.values(s.DefaultAvatars),e=this.discriminator%t.length;return s.Endpoints.assets(`${t[e]}.png`)}get displayAvatarURL(){return this.avatarURL||this.defaultAvatarURL}get note(){return this.client.user.notes.get(this.id)||null}typingIn(t){return t=this.client.resolver.resolveChannel(t),t._typing.has(this.id)}typingSinceIn(t){return t=this.client.resolver.resolveChannel(t),t._typing.has(this.id)?new Date(t._typing.get(this.id).since):null}typingDurationIn(t){return t=this.client.resolver.resolveChannel(t),t._typing.has(this.id)?t._typing.get(this.id).elapsedTime:-1}deleteDM(){return this.client.rest.methods.deleteChannel(this)}addFriend(){return this.client.rest.methods.addFriend(this)}removeFriend(){return this.client.rest.methods.removeFriend(this)}block(){return this.client.rest.methods.blockUser(this)}unblock(){return this.client.rest.methods.unblockUser(this)}fetchProfile(){return this.client.rest.methods.fetchUserProfile(this)}setNote(t){return this.client.rest.methods.setNote(this,t)}equals(t){let e=t&&this.id===t.id&&this.username===t.username&&this.discriminator===t.discriminator&&this.avatar===t.avatar&&this.bot===Boolean(t.bot);return e}toString(){return`<@${this.id}>`}sendMessage(){}sendTTSMessage(){}sendEmbed(){}sendFile(){}sendCode(){}}i.applyToClass(o),t.exports=o},function(t,e){class n{constructor(t={}){this.status=t.status||"offline",this.game=t.game?new i(t.game):null}update(t){this.status=t.status||this.status,this.game=t.game?new i(t.game):null}equals(t){return this===t||(t&&this.status===t.status&&this.game?this.game.equals(t.game):!t.game)}}class i{constructor(t){this.name=t.name,this.type=t.type,this.url=t.url||null}get streaming(){return 1===this.type}equals(t){return this===t||t&&this.name===t.name&&this.type===t.type&&this.url===t.url}}e.Presence=n,e.Game=i},function(t,e,n){const i=n(0);class s{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.guild=t,e&&this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.color=t.color,this.hoist=t.hoist,this.position=t.position,this.permissions=t.permissions,this.managed=t.managed,this.mentionable=t.mentionable}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let t=this.color.toString(16);for(;t.length<6;)t=`0${t}`;return`#${t}`}get members(){return this.guild.members.filter(t=>t.roles.has(this.id))}get editable(){if(this.managed)return!1;const t=this.guild.member(this.client.user);return!!t.hasPermission(i.PermissionFlags.MANAGE_ROLES_OR_PERMISSIONS)&&t.highestRole.comparePositionTo(this)>0}serialize(){const t={};for(const e in i.PermissionFlags)t[e]=this.hasPermission(e);return t}hasPermission(t,e=false){return t=this.client.resolver.resolvePermission(t),!e&&(this.permissions&i.PermissionFlags.ADMINISTRATOR)>0||(this.permissions&t)>0}hasPermissions(t,e=false){return t.every(t=>this.hasPermission(t,e))}comparePositionTo(t){return this.constructor.comparePositions(this,t)}edit(t){return this.client.rest.methods.updateGuildRole(this,t)}setName(t){return this.edit({name:t})}setColor(t){return this.edit({color:t})}setHoist(t){return this.edit({hoist:t})}setPosition(t){return this.guild.setRolePosition(this,t).then(()=>this)}setPermissions(t){return this.edit({permissions:t})}setMentionable(t){return this.edit({mentionable:t})}delete(){return this.client.rest.methods.deleteGuildRole(this)}equals(t){return t&&this.id===t.id&&this.name===t.name&&this.color===t.color&&this.hoist===t.hoist&&this.position===t.position&&this.permissions===t.permissions&&this.managed===t.managed}toString(){return`<@&${this.id}>`}static comparePositions(t,e){return t.position===e.position?e.id-t.id:t.position-e.position}}t.exports=s},function(t,e){class n{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.type=null,e&&this.setup(e)}setup(t){this.id=t.id}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}delete(){return this.client.rest.methods.deleteChannel(this)}}t.exports=n},function(t,e,n){const i=n(0),s=n(3);class r{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.guild=t,this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.requiresColons=t.require_colons,this.managed=t.managed,this._roles=t.roles}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}get roles(){const t=new s;for(const e of this._roles)this.guild.roles.has(e)&&t.set(e,this.guild.roles.get(e));return t}get url(){return i.Endpoints.emoji(this.id)}toString(){return this.requiresColons?`<:${this.name}:${this.id}>`:this.name}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}}t.exports=r},function(t,e,n){const i=n(23),s=n(14),r=n(34),o=n(3),a=n(41),h=n(15);class u{constructor(){this.messages=new o,this.lastMessageID=null}sendMessage(t,e={}){return this.client.rest.methods.sendMessage(this,t,e)}sendTTSMessage(t,e={}){return Object.assign(e,{tts:!0}),this.client.rest.methods.sendMessage(this,t,e)}sendEmbed(t,e,n={}){t instanceof a||(t=new a(t));let i;return e&&("string"==typeof e?i=e:n=e),n.embed=t,this.sendMessage(i,n)}sendFile(t,e,n,s={}){return e||(e="string"==typeof t?i.basename(t):t&&t.path?i.basename(t.path):"file.jpg"),this.client.resolver.resolveBuffer(t).then(t=>this.client.rest.methods.sendMessage(this,n,s,{file:t,name:e}))}sendCode(t,e,n={}){return n.split&&("object"!=typeof n.split&&(n.split={}),n.split.prepend||(n.split.prepend=`\`\`\`${t||""}
|
||
`),n.split.append||(n.split.append="\n```")),e=h(this.client.resolver.resolveString(e),!0),this.sendMessage(`\`\`\`${t||""}
|
||
${e}
|
||
\`\`\``,n)}fetchMessage(t){return this.client.rest.methods.getChannelMessage(this,t).then(t=>{const e=t instanceof s?t:new s(this,t,this.client);return this._cacheMessage(e),e})}fetchMessages(t={}){return this.client.rest.methods.getChannelMessages(this,t).then(t=>{const e=new o;for(const n of t){const t=new s(this,n,this.client);e.set(n.id,t),this._cacheMessage(t)}return e})}fetchPinnedMessages(){return this.client.rest.methods.getChannelPinnedMessages(this).then(t=>{const e=new o;for(const n of t){const t=new s(this,n,this.client);e.set(n.id,t),this._cacheMessage(t)}return e})}startTyping(t){if("undefined"!=typeof t&&t<1)throw new RangeError("Count must be at least 1.");if(this.client.user._typing.has(this.id)){const e=this.client.user._typing.get(this.id);e.count=t||e.count+1}else this.client.user._typing.set(this.id,{count:t||1,interval:this.client.setInterval(()=>{this.client.rest.methods.sendTyping(this.id)},4e3)}),this.client.rest.methods.sendTyping(this.id)}stopTyping(t=false){if(this.client.user._typing.has(this.id)){const e=this.client.user._typing.get(this.id);e.count--,(e.count<=0||t)&&(this.client.clearInterval(e.interval),this.client.user._typing.delete(this.id))}}get typing(){return this.client.user._typing.has(this.id)}get typingCount(){return this.client.user._typing.has(this.id)?this.client.user._typing.get(this.id).count:0}createCollector(t,e={}){return new r(this,t,e)}awaitMessages(t,e={}){return new Promise((n,i)=>{const s=this.createCollector(t,e);s.on("end",(t,s)=>{e.errors&&e.errors.includes(s)?i(t):n(t)})})}bulkDelete(t){if(!isNaN(t))return this.fetchMessages({limit:t}).then(t=>this.bulkDelete(t));if(t instanceof Array||t instanceof o){const e=t instanceof o?t.keyArray():t.map(t=>t.id);return this.client.rest.methods.bulkDeleteMessages(this,e)}throw new TypeError("The messages must be an Array, Collection, or number.")}_cacheMessage(t){const e=this.client.options.messageCacheMaxSize;return 0===e?null:(this.messages.size>=e&&e>0&&this.messages.delete(this.messages.firstKey()),this.messages.set(t.id,t),t)}}e.applyToClass=((t,e=false)=>{const n=["sendMessage","sendTTSMessage","sendEmbed","sendFile","sendCode"];e&&(n.push("_cacheMessage"),n.push("fetchMessages"),n.push("fetchMessage"),n.push("bulkDelete"),n.push("startTyping"),n.push("stopTyping"),n.push("typing"),n.push("typingCount"),n.push("fetchPinnedMessages"),n.push("createCollector"),n.push("awaitMessages"));for(const i of n)Object.defineProperty(t.prototype,i,Object.getOwnPropertyDescriptor(u.prototype,i))})},function(t,e,n){const i=n(9),s=n(8),r=n(40),o=n(17),a=n(0),h=n(3);class u extends i{constructor(t,e){super(t.client,e),this.guild=t}setup(t){if(super.setup(t),this.name=t.name,this.position=t.position,this.permissionOverwrites=new h,t.permission_overwrites)for(const e of t.permission_overwrites)this.permissionOverwrites.set(e.id,new r(this,e))}permissionsFor(t){if(t=this.client.resolver.resolveGuildMember(this.guild,t),!t)return null;if(t.id===this.guild.ownerID)return new o(t,a.ALL_PERMISSIONS);let e=0;const n=t.roles;for(const i of n.values())e|=i.permissions;const s=this.overwritesFor(t,!0,n);for(const r of s.role.concat(s.member))e&=~r.deny,e|=r.allow;const h=Boolean(e&a.PermissionFlags.ADMINISTRATOR);return h&&(e=a.ALL_PERMISSIONS),new o(t,e)}overwritesFor(t,e=false,n=null){if(e||(t=this.client.resolver.resolveGuildMember(this.guild,t)),!t)return[];n=n||t.roles;const i=[],s=[];for(const r of this.permissionOverwrites.values())r.id===t.id?s.push(r):n.has(r.id)&&i.push(r);return{role:i,member:s}}overwritePermissions(t,e){const n={allow:0,deny:0};if(t instanceof s)n.type="role";else if(this.guild.roles.has(t))t=this.guild.roles.get(t),n.type="role";else if(t=this.client.resolver.resolveUser(t),n.type="member",!t)return Promise.reject(new TypeError("Supplied parameter was neither a User nor a Role."));n.id=t.id;const i=this.permissionOverwrites.get(t.id);i&&(n.allow=i.allow,n.deny=i.deny);for(const r in e)e[r]===!0?(n.allow|=a.PermissionFlags[r]||0,n.deny&=~(a.PermissionFlags[r]||0)):e[r]===!1?(n.allow&=~(a.PermissionFlags[r]||0),n.deny|=a.PermissionFlags[r]||0):null===e[r]&&(n.allow&=~(a.PermissionFlags[r]||0),n.deny&=~(a.PermissionFlags[r]||0));return this.client.rest.methods.setChannelOverwrite(this,n)}edit(t){return this.client.rest.methods.updateChannel(this,t)}setName(t){return this.edit({name:t})}setPosition(t){return this.client.rest.methods.updateChannel(this,{position:t})}setTopic(t){return this.client.rest.methods.updateChannel(this,{topic:t})}createInvite(t={}){return this.client.rest.methods.createChannelInvite(this,t)}clone(t=this.name,e=true){return this.guild.createChannel(t,this.type,e?this.permissionOverwrites:[])}equals(t){let e=t&&this.id===t.id&&this.type===t.type&&this.topic===t.topic&&this.position===t.position&&this.name===t.name;return e&&(e=this.permissionOverwrites&&t.permissionOverwrites?this.permissionOverwrites.equals(t.permissionOverwrites):!this.permissionOverwrites&&!t.permissionOverwrites),e}toString(){return`<#${this.id}>`}}t.exports=u},function(t,e,n){const i=n(11),s=n(8),r=n(17),o=n(0),a=n(3),h=n(7).Presence;class u{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.guild=t,this.user={},this._roles=[],e&&this.setup(e),this.lastMessageID=null}setup(t){this.serverDeaf=t.deaf,this.serverMute=t.mute,this.selfMute=t.self_mute,this.selfDeaf=t.self_deaf,this.voiceSessionID=t.session_id,this.voiceChannelID=t.channel_id,this.speaking=!1,this.nickname=t.nick||null,this.joinedTimestamp=new Date(t.joined_at).getTime(),this.user=t.user,this._roles=t.roles}get joinedAt(){return new Date(this.joinedTimestamp)}get presence(){return this.frozenPresence||this.guild.presences.get(this.id)||new h}get roles(){const t=new a,e=this.guild.roles.get(this.guild.id);e&&t.set(e.id,e);for(const n of this._roles){const e=this.guild.roles.get(n);e&&t.set(e.id,e)}return t}get highestRole(){return this.roles.reduce((t,e)=>!t||e.comparePositionTo(t)>0?e:t)}get mute(){return this.selfMute||this.serverMute}get deaf(){return this.selfDeaf||this.serverDeaf}get voiceChannel(){return this.guild.channels.get(this.voiceChannelID)}get id(){return this.user.id}get displayName(){return this.nickname||this.user.username}get permissions(){if(this.user.id===this.guild.ownerID)return new r(this,o.ALL_PERMISSIONS);let t=0;const e=this.roles;for(const n of e.values())t|=n.permissions;const i=Boolean(t&o.PermissionFlags.ADMINISTRATOR);return i&&(t=o.ALL_PERMISSIONS),new r(this,t)}get kickable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const t=this.guild.member(this.client.user);return!!t.hasPermission(o.PermissionFlags.KICK_MEMBERS)&&t.highestRole.comparePositionTo(this.highestRole)>0}get bannable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const t=this.guild.member(this.client.user);return!!t.hasPermission(o.PermissionFlags.BAN_MEMBERS)&&t.highestRole.comparePositionTo(this.highestRole)>0}permissionsIn(t){if(t=this.client.resolver.resolveChannel(t),!t||!t.guild)throw new Error("Could not resolve channel to a guild channel.");return t.permissionsFor(this)}hasPermission(t,e=false){return!e&&this.user.id===this.guild.ownerID||this.roles.some(n=>n.hasPermission(t,e))}hasPermissions(t,e=false){return!e&&this.user.id===this.guild.ownerID||t.every(t=>this.hasPermission(t,e))}missingPermissions(t,e=false){return t.filter(t=>!this.hasPermission(t,e))}edit(t){return this.client.rest.methods.updateGuildMember(this,t)}setMute(t){return this.edit({mute:t})}setDeaf(t){return this.edit({deaf:t})}setVoiceChannel(t){return this.edit({channel:t})}setRoles(t){return this.edit({roles:t})}addRole(t){return t instanceof s||(t=this.guild.roles.get(t)),this.client.rest.methods.addMemberRole(this,t)}addRoles(t){let e;if(t instanceof a){e=this._roles.slice();for(const n of t.values())e.push(n.id)}else e=this._roles.concat(t);return this.edit({roles:e})}removeRole(t){return t instanceof s||(t=this.guild.roles.get(t)),this.client.rest.methods.removeMemberRole(this,t)}removeRoles(t){const e=this._roles.slice();if(t instanceof a)for(const n of t.values()){const t=e.indexOf(n.id);t>=0&&e.splice(t,1)}else for(const n of t){const t=e.indexOf(n instanceof s?n.id:n);t>=0&&e.splice(t,1)}return this.edit({roles:e})}setNickname(t){return this.edit({nick:t})}deleteDM(){return this.client.rest.methods.deleteChannel(this)}kick(){return this.client.rest.methods.kickGuildMember(this.guild,this)}ban(t=0){return this.client.rest.methods.banGuildMember(this.guild,this,t)}toString(){return`<@${this.nickname?"!":""}${this.user.id}>`}sendMessage(){}sendTTSMessage(){}sendFile(){}sendCode(){}}i.applyToClass(u),t.exports=u},function(t,e,n){const i=n(33),s=n(35),r=n(36),o=n(3),a=n(0),h=n(15),u=n(58);class c{constructor(t,e,n){Object.defineProperty(this,"client",{value:n}),this.channel=t,e&&this.setup(e)}setup(t){this.id=t.id,this.type=a.MessageTypes[t.type],this.content=t.content,this.author=this.client.dataManager.newUser(t.author),this.member=this.guild?this.guild.member(this.author)||null:null,this.pinned=t.pinned,this.tts=t.tts,this.nonce=t.nonce,this.system=6===t.type,this.embeds=t.embeds.map(t=>new s(this,t)),this.attachments=new o;for(const e of t.attachments)this.attachments.set(e.id,new i(this,e));this.createdTimestamp=new Date(t.timestamp).getTime(),this.editedTimestamp=t.edited_timestamp?new Date(t.edited_timestamp).getTime():null,this.mentions={users:new o,roles:new o,channels:new o,everyone:t.mention_everyone};for(const n of t.mentions){let t=this.client.users.get(n.id);t?this.mentions.users.set(t.id,t):(t=this.client.dataManager.newUser(n),this.mentions.users.set(t.id,t))}if(t.mention_roles)for(const n of t.mention_roles){const t=this.channel.guild.roles.get(n);t&&this.mentions.roles.set(t.id,t)}if(this.channel.guild){const e=t.content.match(/<#([0-9]{14,20})>/g)||[];for(const n of e){const t=this.channel.guild.channels.get(n.match(/([0-9]{14,20})/g)[0]);t&&this.mentions.channels.set(t.id,t)}}if(this._edits=[],this.reactions=new o,t.reactions&&t.reactions.length>0)for(const h of t.reactions){const t=h.emoji.id?`${h.emoji.name}:${h.emoji.id}`:h.emoji.name;this.reactions.set(t,new r(this,h.emoji,h.count,h.me))}this.webhookID=t.webhook_id||null}patch(t){if(t.author&&(this.author=this.client.users.get(t.author.id),this.guild&&(this.member=this.guild.member(this.author))),t.content&&(this.content=t.content),t.timestamp&&(this.createdTimestamp=new Date(t.timestamp).getTime()),t.edited_timestamp&&(this.editedTimestamp=t.edited_timestamp?new Date(t.edited_timestamp).getTime():null),"tts"in t&&(this.tts=t.tts),"mention_everyone"in t&&(this.mentions.everyone=t.mention_everyone),t.nonce&&(this.nonce=t.nonce),t.embeds&&(this.embeds=t.embeds.map(t=>new s(this,t))),t.type>-1&&(this.system=!1,6===t.type&&(this.system=!0)),t.attachments){this.attachments=new o;for(const e of t.attachments)this.attachments.set(e.id,new i(this,e))}if(t.mentions)for(const e of t.mentions){let t=this.client.users.get(e.id);t?this.mentions.users.set(t.id,t):(t=this.client.dataManager.newUser(e),this.mentions.users.set(t.id,t))}if(t.mention_roles)for(const e of t.mention_roles){const t=this.channel.guild.roles.get(e);t&&this.mentions.roles.set(t.id,t)}if(t.id&&(this.id=t.id),this.channel.guild&&t.content){const e=t.content.match(/<#([0-9]{14,20})>/g)||[];for(const n of e){const t=this.channel.guild.channels.get(n.match(/([0-9]{14,20})/g)[0]);t&&this.mentions.channels.set(t.id,t)}}if(t.reactions&&(this.reactions=new o,t.reactions.length>0))for(const n of t.reactions){const e=n.emoji.id?`${n.emoji.name}:${n.emoji.id}`:n.emoji.name;this.reactions.set(e,new r(this,t.emoji,t.count,t.me))}}get createdAt(){return new Date(this.createdTimestamp)}get editedAt(){return this.editedTimestamp?new Date(this.editedTimestamp):null}get guild(){return this.channel.guild||null}get cleanContent(){return this.content.replace(/@(everyone|here)/g,"@$1").replace(/<@!?[0-9]+>/g,t=>{const e=t.replace(/<|!|>|@/g,"");if("dm"===this.channel.type||"group"===this.channel.type)return this.client.users.has(e)?`@${this.client.users.get(e).username}`:t;const n=this.channel.guild.members.get(e);if(n)return n.nickname?`@${n.nickname}`:`@${n.user.username}`;{const n=this.client.users.get(e);return n?`@${n.username}`:t}}).replace(/<#[0-9]+>/g,t=>{const e=this.client.channels.get(t.replace(/<|#|>/g,""));return e?`#${e.name}`:t}).replace(/<@&[0-9]+>/g,t=>{if("dm"===this.channel.type||"group"===this.channel.type)return t;const e=this.guild.roles.get(t.replace(/<|@|>|&/g,""));return e?`@${e.name}`:t})}get edits(){const t=this._edits.slice();return t.unshift(this),t}get editable(){return this.author.id===this.client.user.id}get deletable(){return this.author.id===this.client.user.id||this.guild&&this.channel.permissionsFor(this.client.user).hasPermission(a.PermissionFlags.MANAGE_MESSAGES)}get pinnable(){return!this.guild||this.channel.permissionsFor(this.client.user).hasPermission(a.PermissionFlags.MANAGE_MESSAGES)}isMentioned(t){return t=t&&t.id?t.id:t,this.mentions.users.has(t)||this.mentions.channels.has(t)||this.mentions.roles.has(t)}isMemberMentioned(t){return!!this.mentions.everyone||(!!this.mentions.users.has(t.id)||!!(t instanceof u.GuildMember&&t.roles.some(t=>this.mentions.roles.has(t.id))))}edit(t,e={}){return this.client.rest.methods.updateMessage(this,t,e)}editCode(t,e){return e=h(this.client.resolver.resolveString(e),!0),this.edit(`\`\`\`${t||""}
|
||
${e}
|
||
\`\`\``)}pin(){return this.client.rest.methods.pinMessage(this)}unpin(){return this.client.rest.methods.unpinMessage(this)}react(t){if(t=this.client.resolver.resolveEmojiIdentifier(t),!t)throw new TypeError("Emoji must be a string or Emoji/ReactionEmoji");return this.client.rest.methods.addMessageReaction(this,t)}clearReactions(){return this.client.rest.methods.removeMessageReactions(this)}delete(t=0){return t<=0?this.client.rest.methods.deleteMessage(this):new Promise(e=>{this.client.setTimeout(()=>{e(this.delete())},t)})}reply(t,e={}){t=this.client.resolver.resolveString(t);const n=this.guild?`${this.author}, `:"";return t=`${n}${t}`,e.split&&("object"!=typeof e.split&&(e.split={}),e.split.prepend||(e.split.prepend=n)),this.client.rest.methods.sendMessage(this.channel,t,e)}fetchWebhook(){return this.webhookID?this.client.fetchWebhook(this.webhookID):Promise.reject(new Error("The message was not sent by a webhook."))}equals(t,e){if(!t)return!1;const n=!t.author&&!t.attachments;if(n)return this.id===t.id&&this.embeds.length===t.embeds.length;let i=this.id===t.id&&this.author.id===t.author.id&&this.content===t.content&&this.tts===t.tts&&this.nonce===t.nonce&&this.embeds.length===t.embeds.length&&this.attachments.length===t.attachments.length;return i&&e&&(i=this.mentions.everyone===t.mentions.everyone&&this.createdTimestamp===new Date(e.timestamp).getTime()&&this.editedTimestamp===new Date(e.edited_timestamp).getTime()),i}toString(){return this.content}_addReaction(t,e){const n=t.id?`${t.name}:${t.id}`:t.name;let i;return this.reactions.has(n)?(i=this.reactions.get(n),i.me||(i.me=e.id===this.client.user.id)):(i=new r(this,t,0,e.id===this.client.user.id),this.reactions.set(n,i)),i.users.has(e.id)?null:(i.users.set(e.id,e),i.count++,i)}_removeReaction(t,e){const n=t.id||t;if(this.reactions.has(n)){const t=this.reactions.get(n);if(t.users.has(e.id))return t.users.delete(e.id),t.count--,e.id===this.client.user.id&&(t.me=!1),t}return null}_clearReactions(){this.reactions.clear()}}t.exports=c},function(t,e){t.exports=function(t,e=false,n=false){return e?t.replace(/```/g,"```"):n?t.replace(/\\(`|\\)/g,"$1").replace(/(`|\\)/g,"\\$1"):t.replace(/\\(\*|_|`|~|\\)/g,"$1").replace(/(\*|_|`|~|\\)/g,"\\$1")}},function(t,e,n){"use strict";(function(t,i){function s(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}function r(){return t.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,n){if(r()<n)throw new RangeError("Invalid typed array length");return t.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(n),e.__proto__=t.prototype):(null===e&&(e=new t(n)),e.length=n),e}function t(e,n,i){if(!(t.TYPED_ARRAY_SUPPORT||this instanceof t))return new t(e,n,i);if("number"==typeof e){if("string"==typeof n)throw new Error("If encoding is specified then the first argument must be a string");return c(this,e)}return a(this,e,n,i)}function a(t,e,n,i){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?f(t,e,n,i):"string"==typeof e?l(t,e,n):p(t,e)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function u(t,e,n,i){return h(e),e<=0?o(t,e):void 0!==n?"string"==typeof i?o(t,e).fill(n,i):o(t,e).fill(n):o(t,e)}function c(e,n){if(h(n),e=o(e,n<0?0:0|m(n)),!t.TYPED_ARRAY_SUPPORT)for(var i=0;i<n;++i)e[i]=0;return e}function l(e,n,i){if("string"==typeof i&&""!==i||(i="utf8"),!t.isEncoding(i))throw new TypeError('"encoding" must be a valid string encoding');var s=0|_(n,i);e=o(e,s);var r=e.write(n,i);return r!==s&&(e=e.slice(0,r)),e}function d(t,e){var n=e.length<0?0:0|m(e.length);t=o(t,n);for(var i=0;i<n;i+=1)t[i]=255&e[i];return t}function f(e,n,i,s){if(n.byteLength,i<0||n.byteLength<i)throw new RangeError("'offset' is out of bounds");if(n.byteLength<i+(s||0))throw new RangeError("'length' is out of bounds");return n=void 0===i&&void 0===s?new Uint8Array(n):void 0===s?new Uint8Array(n,i):new Uint8Array(n,i,s),t.TYPED_ARRAY_SUPPORT?(e=n,e.__proto__=t.prototype):e=d(e,n),e}function p(e,n){if(t.isBuffer(n)){var i=0|m(n.length);return e=o(e,i),0===e.length?e:(n.copy(e,0,0,i),e)}if(n){if("undefined"!=typeof ArrayBuffer&&n.buffer instanceof ArrayBuffer||"length"in n)return"number"!=typeof n.length||$(n.length)?o(e,0):d(e,n);if("Buffer"===n.type&&Q(n.data))return d(e,n.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function m(t){if(t>=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|t}function g(e){return+e!=e&&(e=0),t.alloc(+e)}function _(e,n){if(t.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 i=e.length;if(0===i)return 0;for(var s=!1;;)switch(n){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return W(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return Z(e).length;default:if(s)return W(e).length;n=(""+n).toLowerCase(),s=!0}}function E(t,e,n){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,e>>>=0,n<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return L(this,e,n);case"utf8":case"utf-8":return S(this,e,n);case"ascii":return C(this,e,n);case"latin1":case"binary":return x(this,e,n);case"base64":return M(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,e,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function w(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}function v(e,n,i,s,r){if(0===e.length)return-1;if("string"==typeof i?(s=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=r?0:e.length-1),i<0&&(i=e.length+i),i>=e.length){if(r)return-1;i=e.length-1}else if(i<0){if(!r)return-1;i=0}if("string"==typeof n&&(n=t.from(n,s)),t.isBuffer(n))return 0===n.length?-1:b(e,n,i,s,r);if("number"==typeof n)return n&=255,t.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,n,i):Uint8Array.prototype.lastIndexOf.call(e,n,i):b(e,[n],i,s,r);throw new TypeError("val must be string, number or Buffer")}function b(t,e,n,i,s){function r(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,a=t.length,h=e.length;if(void 0!==i&&(i=String(i).toLowerCase(),"ucs2"===i||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;o=2,a/=2,h/=2,n/=2}var u;if(s){var c=-1;for(u=n;u<a;u++)if(r(t,u)===r(e,c===-1?0:u-c)){if(c===-1&&(c=u),u-c+1===h)return c*o}else c!==-1&&(u-=u-c),c=-1}else for(n+h>a&&(n=a-h),u=n;u>=0;u--){for(var l=!0,d=0;d<h;d++)if(r(t,u+d)!==r(e,d)){l=!1;break}if(l)return u}return-1}function y(t,e,n,i){n=Number(n)||0;var s=t.length-n;i?(i=Number(i),i>s&&(i=s)):i=s;var r=e.length;if(r%2!==0)throw new TypeError("Invalid hex string");i>r/2&&(i=r/2);for(var o=0;o<i;++o){var a=parseInt(e.substr(2*o,2),16);if(isNaN(a))return o;t[n+o]=a}return o}function A(t,e,n,i){return K(W(e,t.length-n),t,n,i)}function R(t,e,n,i){return K(Y(e),t,n,i)}function k(t,e,n,i){return R(t,e,n,i)}function T(t,e,n,i){return K(Z(e),t,n,i)}function D(t,e,n,i){return K(V(e,t.length-n),t,n,i)}function M(t,e,n){return 0===e&&n===t.length?X.fromByteArray(t):X.fromByteArray(t.slice(e,n))}function S(t,e,n){n=Math.min(t.length,n);for(var i=[],s=e;s<n;){var r=t[s],o=null,a=r>239?4:r>223?3:r>191?2:1;if(s+a<=n){var h,u,c,l;switch(a){case 1:r<128&&(o=r);break;case 2:h=t[s+1],128===(192&h)&&(l=(31&r)<<6|63&h,l>127&&(o=l));break;case 3:h=t[s+1],u=t[s+2],128===(192&h)&&128===(192&u)&&(l=(15&r)<<12|(63&h)<<6|63&u,l>2047&&(l<55296||l>57343)&&(o=l));break;case 4:h=t[s+1],u=t[s+2],c=t[s+3],128===(192&h)&&128===(192&u)&&128===(192&c)&&(l=(15&r)<<18|(63&h)<<12|(63&u)<<6|63&c,l>65535&&l<1114112&&(o=l))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|1023&o),i.push(o),s+=a}return I(i)}function I(t){var e=t.length;if(e<=tt)return String.fromCharCode.apply(String,t);for(var n="",i=0;i<e;)n+=String.fromCharCode.apply(String,t.slice(i,i+=tt));return n}function C(t,e,n){var i="";n=Math.min(t.length,n);for(var s=e;s<n;++s)i+=String.fromCharCode(127&t[s]);return i}function x(t,e,n){var i="";n=Math.min(t.length,n);for(var s=e;s<n;++s)i+=String.fromCharCode(t[s]);return i}function L(t,e,n){var i=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>i)&&(n=i);for(var s="",r=e;r<n;++r)s+=F(t[r]);return s}function U(t,e,n){for(var i=t.slice(e,n),s="",r=0;r<i.length;r+=2)s+=String.fromCharCode(i[r]+256*i[r+1]);return s}function P(t,e,n){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function N(e,n,i,s,r,o){if(!t.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>r||n<o)throw new RangeError('"value" argument is out of bounds');if(i+s>e.length)throw new RangeError("Index out of range")}function O(t,e,n,i){e<0&&(e=65535+e+1);for(var s=0,r=Math.min(t.length-n,2);s<r;++s)t[n+s]=(e&255<<8*(i?s:1-s))>>>8*(i?s:1-s)}function B(t,e,n,i){e<0&&(e=4294967295+e+1);for(var s=0,r=Math.min(t.length-n,4);s<r;++s)t[n+s]=e>>>8*(i?s:3-s)&255}function G(t,e,n,i,s,r){if(n+i>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(t,e,n,i,s){return s||G(t,e,n,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(t,e,n,i,23,4),n+4}function q(t,e,n,i,s){return s||G(t,e,n,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(t,e,n,i,52,8),n+8}function z(t){if(t=H(t).replace(et,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function H(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function F(t){return t<16?"0"+t.toString(16):t.toString(16)}function W(t,e){e=e||1/0;for(var n,i=t.length,s=null,r=[],o=0;o<i;++o){if(n=t.charCodeAt(o),n>55295&&n<57344){if(!s){if(n>56319){(e-=3)>-1&&r.push(239,191,189);continue}if(o+1===i){(e-=3)>-1&&r.push(239,191,189);continue}s=n;continue}if(n<56320){(e-=3)>-1&&r.push(239,191,189),s=n;continue}n=(s-55296<<10|n-56320)+65536}else s&&(e-=3)>-1&&r.push(239,191,189);if(s=null,n<128){if((e-=1)<0)break;r.push(n)}else if(n<2048){if((e-=2)<0)break;r.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;r.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;r.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return r}function Y(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}function V(t,e){for(var n,i,s,r=[],o=0;o<t.length&&!((e-=2)<0);++o)n=t.charCodeAt(o),i=n>>8,s=n%256,r.push(s),r.push(i);return r}function Z(t){return X.toByteArray(z(t))}function K(t,e,n,i){for(var s=0;s<i&&!(s+n>=e.length||s>=t.length);++s)e[s+n]=t[s];return s}function $(t){return t!==t}var X=n(63),J=n(65),Q=n(66);e.Buffer=t,e.SlowBuffer=g,e.INSPECT_MAX_BYTES=50,t.TYPED_ARRAY_SUPPORT=void 0!==i.TYPED_ARRAY_SUPPORT?i.TYPED_ARRAY_SUPPORT:s(),e.kMaxLength=r(),t.poolSize=8192,t._augment=function(e){return e.__proto__=t.prototype,e},t.from=function(t,e,n){return a(null,t,e,n)},t.TYPED_ARRAY_SUPPORT&&(t.prototype.__proto__=Uint8Array.prototype,t.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&t[Symbol.species]===t&&Object.defineProperty(t,Symbol.species,{value:null,configurable:!0})),t.alloc=function(t,e,n){return u(null,t,e,n)},t.allocUnsafe=function(t){return c(null,t)},t.allocUnsafeSlow=function(t){return c(null,t)},t.isBuffer=function(t){return!(null==t||!t._isBuffer)},t.compare=function(e,n){if(!t.isBuffer(e)||!t.isBuffer(n))throw new TypeError("Arguments must be Buffers");if(e===n)return 0;for(var i=e.length,s=n.length,r=0,o=Math.min(i,s);r<o;++r)if(e[r]!==n[r]){i=e[r],s=n[r];break}return i<s?-1:s<i?1:0},t.isEncoding=function(t){switch(String(t).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}},t.concat=function(e,n){if(!Q(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return t.alloc(0);var i;if(void 0===n)for(n=0,i=0;i<e.length;++i)n+=e[i].length;var s=t.allocUnsafe(n),r=0;for(i=0;i<e.length;++i){var o=e[i];if(!t.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(s,r),r+=o.length}return s},t.byteLength=_,t.prototype._isBuffer=!0,t.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)w(this,e,e+1);return this},t.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)w(this,e,e+3),w(this,e+1,e+2);return this},t.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)w(this,e,e+7),w(this,e+1,e+6),w(this,e+2,e+5),w(this,e+3,e+4);return this},t.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?S(this,0,t):E.apply(this,arguments)},t.prototype.equals=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===t.compare(this,e)},t.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},t.prototype.compare=function(e,n,i,s,r){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===n&&(n=0),void 0===i&&(i=e?e.length:0),void 0===s&&(s=0),void 0===r&&(r=this.length),n<0||i>e.length||s<0||r>this.length)throw new RangeError("out of range index");if(s>=r&&n>=i)return 0;if(s>=r)return-1;if(n>=i)return 1;if(n>>>=0,i>>>=0,s>>>=0,r>>>=0,this===e)return 0;for(var o=r-s,a=i-n,h=Math.min(o,a),u=this.slice(s,r),c=e.slice(n,i),l=0;l<h;++l)if(u[l]!==c[l]){o=u[l],a=c[l];break}return o<a?-1:a<o?1:0},t.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1},t.prototype.indexOf=function(t,e,n){return v(this,t,e,n,!0)},t.prototype.lastIndexOf=function(t,e,n){return v(this,t,e,n,!1)},t.prototype.write=function(t,e,n,i){if(void 0===e)i="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)i=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}var s=this.length-e;if((void 0===n||n>s)&&(n=s),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var r=!1;;)switch(i){case"hex":return y(this,t,e,n);case"utf8":case"utf-8":return A(this,t,e,n);case"ascii":return R(this,t,e,n);case"latin1":case"binary":return k(this,t,e,n);case"base64":return T(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,t,e,n);default:if(r)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),r=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;t.prototype.slice=function(e,n){var i=this.length;e=~~e,n=void 0===n?i:~~n,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),n<0?(n+=i,n<0&&(n=0)):n>i&&(n=i),n<e&&(n=e);var s;if(t.TYPED_ARRAY_SUPPORT)s=this.subarray(e,n),s.__proto__=t.prototype;else{var r=n-e;s=new t(r,void 0);for(var o=0;o<r;++o)s[o]=this[o+e]}return s},t.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||P(t,e,this.length);for(var i=this[t],s=1,r=0;++r<e&&(s*=256);)i+=this[t+r]*s;return i},t.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||P(t,e,this.length);for(var i=this[t+--e],s=1;e>0&&(s*=256);)i+=this[t+--e]*s;return i},t.prototype.readUInt8=function(t,e){return e||P(t,1,this.length),this[t]},t.prototype.readUInt16LE=function(t,e){return e||P(t,2,this.length),this[t]|this[t+1]<<8},t.prototype.readUInt16BE=function(t,e){return e||P(t,2,this.length),this[t]<<8|this[t+1]},t.prototype.readUInt32LE=function(t,e){return e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},t.prototype.readUInt32BE=function(t,e){return e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},t.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||P(t,e,this.length);for(var i=this[t],s=1,r=0;++r<e&&(s*=256);)i+=this[t+r]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*e)),i},t.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||P(t,e,this.length);for(var i=e,s=1,r=this[t+--i];i>0&&(s*=256);)r+=this[t+--i]*s;return s*=128,r>=s&&(r-=Math.pow(2,8*e)),r},t.prototype.readInt8=function(t,e){return e||P(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},t.prototype.readInt16LE=function(t,e){e||P(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},t.prototype.readInt16BE=function(t,e){e||P(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},t.prototype.readInt32LE=function(t,e){return e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},t.prototype.readInt32BE=function(t,e){return e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},t.prototype.readFloatLE=function(t,e){return e||P(t,4,this.length),J.read(this,t,!0,23,4)},t.prototype.readFloatBE=function(t,e){return e||P(t,4,this.length),J.read(this,t,!1,23,4)},t.prototype.readDoubleLE=function(t,e){return e||P(t,8,this.length),J.read(this,t,!0,52,8)},t.prototype.readDoubleBE=function(t,e){return e||P(t,8,this.length),J.read(this,t,!1,52,8)},t.prototype.writeUIntLE=function(t,e,n,i){if(t=+t,e|=0,n|=0,!i){var s=Math.pow(2,8*n)-1;N(this,t,e,n,s,0)}var r=1,o=0;for(this[e]=255&t;++o<n&&(r*=256);)this[e+o]=t/r&255;return e+n},t.prototype.writeUIntBE=function(t,e,n,i){if(t=+t,e|=0,n|=0,!i){var s=Math.pow(2,8*n)-1;N(this,t,e,n,s,0)}var r=n-1,o=1;for(this[e+r]=255&t;--r>=0&&(o*=256);)this[e+r]=t/o&255;return e+n},t.prototype.writeUInt8=function(e,n,i){return e=+e,n|=0,i||N(this,e,n,1,255,0),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[n]=255&e,n+1},t.prototype.writeUInt16LE=function(e,n,i){return e=+e,n|=0,i||N(this,e,n,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[n]=255&e,this[n+1]=e>>>8):O(this,e,n,!0),n+2},t.prototype.writeUInt16BE=function(e,n,i){return e=+e,n|=0,i||N(this,e,n,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[n]=e>>>8,this[n+1]=255&e):O(this,e,n,!1),n+2},t.prototype.writeUInt32LE=function(e,n,i){return e=+e,n|=0,i||N(this,e,n,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[n+3]=e>>>24,this[n+2]=e>>>16,this[n+1]=e>>>8,this[n]=255&e):B(this,e,n,!0),n+4},t.prototype.writeUInt32BE=function(e,n,i){return e=+e,n|=0,i||N(this,e,n,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=255&e):B(this,e,n,!1),n+4},t.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e|=0,!i){var s=Math.pow(2,8*n-1);N(this,t,e,n,s-1,-s)}var r=0,o=1,a=0;for(this[e]=255&t;++r<n&&(o*=256);)t<0&&0===a&&0!==this[e+r-1]&&(a=1),this[e+r]=(t/o>>0)-a&255;return e+n},t.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e|=0,!i){var s=Math.pow(2,8*n-1);N(this,t,e,n,s-1,-s)}var r=n-1,o=1,a=0;for(this[e+r]=255&t;--r>=0&&(o*=256);)t<0&&0===a&&0!==this[e+r+1]&&(a=1),this[e+r]=(t/o>>0)-a&255;return e+n},t.prototype.writeInt8=function(e,n,i){return e=+e,n|=0,i||N(this,e,n,1,127,-128),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[n]=255&e,n+1},t.prototype.writeInt16LE=function(e,n,i){return e=+e,n|=0,i||N(this,e,n,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[n]=255&e,this[n+1]=e>>>8):O(this,e,n,!0),n+2},t.prototype.writeInt16BE=function(e,n,i){return e=+e,n|=0,i||N(this,e,n,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[n]=e>>>8,this[n+1]=255&e):O(this,e,n,!1),n+2},t.prototype.writeInt32LE=function(e,n,i){return e=+e,n|=0,i||N(this,e,n,4,2147483647,-2147483648),t.TYPED_ARRAY_SUPPORT?(this[n]=255&e,this[n+1]=e>>>8,this[n+2]=e>>>16,this[n+3]=e>>>24):B(this,e,n,!0),n+4},t.prototype.writeInt32BE=function(e,n,i){return e=+e,n|=0,i||N(this,e,n,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),t.TYPED_ARRAY_SUPPORT?(this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=255&e):B(this,e,n,!1),n+4},t.prototype.writeFloatLE=function(t,e,n){return j(this,t,e,!0,n)},t.prototype.writeFloatBE=function(t,e,n){return j(this,t,e,!1,n)},t.prototype.writeDoubleLE=function(t,e,n){return q(this,t,e,!0,n)},t.prototype.writeDoubleBE=function(t,e,n){return q(this,t,e,!1,n)},t.prototype.copy=function(e,n,i,s){if(i||(i=0),s||0===s||(s=this.length),n>=e.length&&(n=e.length),n||(n=0),s>0&&s<i&&(s=i),s===i)return 0;if(0===e.length||0===this.length)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=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-n<s-i&&(s=e.length-n+i);var r,o=s-i;if(this===e&&i<n&&n<s)for(r=o-1;r>=0;--r)e[r+n]=this[r+i];else if(o<1e3||!t.TYPED_ARRAY_SUPPORT)for(r=0;r<o;++r)e[r+n]=this[r+i];else Uint8Array.prototype.set.call(e,this.subarray(i,i+o),n);return o},t.prototype.fill=function(e,n,i,s){if("string"==typeof e){if("string"==typeof n?(s=n,n=0,i=this.length):"string"==typeof i&&(s=i,i=this.length),1===e.length){var r=e.charCodeAt(0);r<256&&(e=r)}if(void 0!==s&&"string"!=typeof s)throw new TypeError("encoding must be a string");if("string"==typeof s&&!t.isEncoding(s))throw new TypeError("Unknown encoding: "+s)}else"number"==typeof e&&(e&=255);if(n<0||this.length<n||this.length<i)throw new RangeError("Out of range index");if(i<=n)return this;n>>>=0,i=void 0===i?this.length:i>>>0,e||(e=0);var o;if("number"==typeof e)for(o=n;o<i;++o)this[o]=e;else{var a=t.isBuffer(e)?e:W(new t(e,s).toString()),h=a.length;for(o=0;o<i-n;++o)this[o+n]=a[o%h]}return this};var et=/[^+\/0-9A-Za-z-_]/g}).call(e,n(16).Buffer,n(78))},function(t,e,n){const i=n(0);class s{constructor(t,e){this.member=t,this.raw=e}serialize(){const t={};for(const e in i.PermissionFlags)t[e]=this.hasPermission(e);return t}hasPermission(t,e=false){return t=this.member.client.resolver.resolvePermission(t),!e&&(this.raw&i.PermissionFlags.ADMINISTRATOR)>0||(this.raw&t)>0}hasPermissions(t,e=false){return t.every(t=>this.hasPermission(t,e))}missingPermissions(t,e=false){return t.filter(t=>!this.hasPermission(t,e))}}t.exports=s},function(t,e,n){const i=n(6),s=n(8),r=n(10),o=n(7).Presence,a=n(13),h=n(0),u=n(3),c=n(4),l=n(150);class d{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.members=new u,this.channels=new u,this.roles=new u,this.presences=new u,e&&(e.unavailable?(this.available=!1,this.id=e.id):(this.available=!0,this.setup(e)))}setup(t){this.name=t.name,this.icon=t.icon,this.splash=t.splash,this.region=t.region,this.memberCount=t.member_count||this.memberCount,this.large=t.large||this.large,this.features=t.features,this.applicationID=t.application_id,this.emojis=new u;for(const e of t.emojis)this.emojis.set(e.id,new r(this,e));if(this.afkTimeout=t.afk_timeout,this.afkChannelID=t.afk_channel_id,this.embedEnabled=t.embed_enabled,this.verificationLevel=t.verification_level,this.joinedTimestamp=t.joined_at?new Date(t.joined_at).getTime():this.joinedTimestamp,this.id=t.id,this.available=!t.unavailable,this.features=t.features||this.features||[],t.members){this.members.clear();for(const e of t.members)this._addMember(e,!1)}if(t.owner_id&&(this.ownerID=t.owner_id),t.channels){this.channels.clear();for(const e of t.channels)this.client.dataManager.newChannel(e,this)}if(t.roles){this.roles.clear();for(const e of t.roles){const t=new s(this,e);this.roles.set(t.id,t)}}if(t.presences)for(const n of t.presences)this._setPresence(n.user.id,n);if(this._rawVoiceStates=new u,t.voice_states)for(const i of t.voice_states){this._rawVoiceStates.set(i.user_id,i);const t=this.members.get(i.user_id);t&&(t.serverMute=i.mute,t.serverDeaf=i.deaf,t.selfMute=i.self_mute,t.selfDeaf=i.self_deaf,t.voiceSessionID=i.session_id,t.voiceChannelID=i.channel_id,this.channels.get(i.channel_id).members.set(t.user.id,t))}}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}get joinedAt(){return new Date(this.joinedTimestamp)}get iconURL(){return this.icon?h.Endpoints.guildIcon(this.id,this.icon):null}get splashURL(){return this.splash?h.Endpoints.guildSplash(this.id,this.splash):null}get owner(){return this.members.get(this.ownerID)}get voiceConnection(){return this.client.browser?null:this.client.voice.connections.get(this.id)||null}get defaultChannel(){return this.channels.get(this.id)}member(t){return this.client.resolver.resolveGuildMember(this,t)}fetchBans(){return this.client.rest.methods.getGuildBans(this)}fetchInvites(){return this.client.rest.methods.getGuildInvites(this)}fetchWebhooks(){return this.client.rest.methods.getGuildWebhooks(this)}fetchMember(t){return this._fetchWaiter?Promise.reject(new Error("Already fetching guild members.")):(t=this.client.resolver.resolveUser(t),t?this.members.has(t.id)?Promise.resolve(this.members.get(t.id)):this.client.rest.methods.getGuildMember(this,t):Promise.reject(new Error("User is not cached. Use Client.fetchUser first.")))}fetchMembers(t=""){return new Promise((e,n)=>{if(this._fetchWaiter)throw new Error("Already fetching guild members in ${this.id}.");return this.memberCount===this.members.size?void e(this):(this._fetchWaiter=e,this.client.ws.send({op:h.OPCodes.REQUEST_GUILD_MEMBERS,d:{guild_id:this.id,query:t,limit:0}}),this._checkChunks(),void this.client.setTimeout(()=>n(new Error("Members didn't arrive in time.")),12e4))})}edit(t){return this.client.rest.methods.updateGuild(this,t)}setName(t){return this.edit({name:t})}setRegion(t){return this.edit({region:t})}setVerificationLevel(t){return this.edit({verificationLevel:t})}setAFKChannel(t){return this.edit({afkChannel:t})}setAFKTimeout(t){return this.edit({afkTimeout:t})}setIcon(t){return this.edit({icon:t})}setOwner(t){return this.edit({owner:t})}setSplash(t){return this.edit({splash:t})}ban(t,e=0){return this.client.rest.methods.banGuildMember(this,t,e)}unban(t){return this.client.rest.methods.unbanGuildMember(this,t)}pruneMembers(t,e=false){if("number"!=typeof t)throw new TypeError("Days must be a number.");return this.client.rest.methods.pruneGuildMembers(this,t,e)}sync(){this.client.user.bot||this.client.syncGuilds([this])}createChannel(t,e,n){return this.client.rest.methods.createChannel(this,t,e,n)}createRole(t){const e=this.client.rest.methods.createGuildRole(this);return t?e.then(e=>e.edit(t)):e}createEmoji(t,e){return new Promise(n=>{t.startsWith("data:")?n(this.client.rest.methods.createEmoji(this,t,e)):this.client.resolver.resolveBuffer(t).then(t=>n(this.client.rest.methods.createEmoji(this,t,e)))})}deleteEmoji(t){return t instanceof r||(t=this.emojis.get(t)),this.client.rest.methods.deleteEmoji(t)}leave(){return this.client.rest.methods.leaveGuild(this)}delete(){return this.client.rest.methods.deleteGuild(this)}setRolePosition(t,e){if(t instanceof s)t=t.id;else if("string"!=typeof t)return Promise.reject(new Error("Supplied role is not a role or string."));if(e=Number(e),isNaN(e))return Promise.reject(new Error("Supplied position is not a number."));const n=this.roles.map(n=>({id:n.id,position:n.id===t?e:n.position<e?n.position:n.position+1}));return this.client.rest.methods.setRolePositions(this.id,n)}equals(t){let e=t&&this.id===t.id&&this.available===!t.unavailable&&this.splash===t.splash&&this.region===t.region&&this.name===t.name&&this.memberCount===t.member_count&&this.large===t.large&&this.icon===t.icon&&l(this.features,t.features)&&this.ownerID===t.owner_id&&this.verificationLevel===t.verification_level&&this.embedEnabled===t.embed_enabled;return e&&(this.embedChannel?this.embedChannel.id!==t.embed_channel_id&&(e=!1):t.embed_channel_id&&(e=!1)),e}toString(){return this.name}_addMember(t,e=true){const n=this.members.has(t.user.id);t.user instanceof i||(t.user=this.client.dataManager.newUser(t.user)),t.joined_at=t.joined_at||0;const s=new a(this,t);if(this.members.set(s.id,s),this._rawVoiceStates&&this._rawVoiceStates.has(s.user.id)){const t=this._rawVoiceStates.get(s.user.id);s.serverMute=t.mute,s.serverDeaf=t.deaf,s.selfMute=t.self_mute,s.selfDeaf=t.self_deaf,s.voiceSessionID=t.session_id,s.voiceChannelID=t.channel_id,this.channels.get(t.channel_id).members.set(s.user.id,s)}return this.client.ws.status===h.Status.READY&&e&&!n&&this.client.emit(h.Events.GUILD_MEMBER_ADD,s),this._checkChunks(),s}_updateMember(t,e){const n=c(t);e.roles&&(t._roles=e.roles),"undefined"!=typeof e.nick&&(t.nickname=e.nick);const i=t.nickname!==n.nickname||!l(t._roles,n._roles);return this.client.ws.status===h.Status.READY&&i&&this.client.emit(h.Events.GUILD_MEMBER_UPDATE,n,t),{old:n,mem:t}}_removeMember(t){this.members.delete(t.id),this._checkChunks()}_memberSpeakUpdate(t,e){const n=this.members.get(t);n&&n.speaking!==e&&(n.speaking=e,this.client.emit(h.Events.GUILD_MEMBER_SPEAKING,n,e))}_setPresence(t,e){return this.presences.get(t)?void this.presences.get(t).update(e):void this.presences.set(t,new o(e))}_checkChunks(){this._fetchWaiter&&this.members.size===this.memberCount&&(this._fetchWaiter(this),this._fetchWaiter=null)}}t.exports=d},function(t,e){class n{constructor(t,e,n){this.reaction=t,this.name=e,this.id=n}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}toString(){return this.id?`<:${this.name}:${this.id}>`:this.name}}t.exports=n},function(t,e,n){const i=n(23),s=n(15);class r{constructor(t,e,n){t?(Object.defineProperty(this,"client",{value:t}),e&&this.setup(e)):(this.id=e,this.token=n,Object.defineProperty(this,"client",{value:this}))}setup(t){this.name=t.name,this.token=t.token,this.avatar=t.avatar,this.id=t.id,this.guildID=t.guild_id,this.channelID=t.channel_id,t.user&&(this.owner=t.user)}sendMessage(t,e={}){return this.client.rest.methods.sendWebhookMessage(this,t,e)}sendSlackMessage(t){return this.client.rest.methods.sendSlackWebhookMessage(this,t)}sendTTSMessage(t,e={}){return Object.assign(e,{tts:!0}),this.client.rest.methods.sendWebhookMessage(this,t,e)}sendFile(t,e,n,s={}){return e||(e="string"==typeof t?i.basename(t):t&&t.path?i.basename(t.path):"file.jpg"),this.client.resolver.resolveBuffer(t).then(t=>this.client.rest.methods.sendWebhookMessage(this,n,s,{file:t,name:e}))}sendCode(t,e,n={}){return n.split&&("object"!=typeof n.split&&(n.split={}),n.split.prepend||(n.split.prepend=`\`\`\`${t||""}
|
||
`),n.split.append||(n.split.append="\n```")),e=s(this.client.resolver.resolveString(e),!0),this.sendMessage(`\`\`\`${t||""}
|
||
${e}
|
||
\`\`\``,n)}edit(t=this.name,e){return e?this.client.resolver.resolveBuffer(e).then(e=>{const n=this.client.resolver.resolveBase64(e);return this.client.rest.methods.editWebhook(this,t,n)}):this.client.rest.methods.editWebhook(this,t).then(t=>{return this.setup(t),this})}delete(){return this.client.rest.methods.deleteWebhook(this)}}t.exports=r},function(t,e){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function s(t){return"number"==typeof t}function r(t){return"object"==typeof t&&null!==t}function o(t){return void 0===t}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!s(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,n,s,a,h,u;if(this._events||(this._events={}),"error"===t&&(!this._events.error||r(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var c=new Error('Uncaught, unspecified "error" event. ('+e+")");throw c.context=e,c}if(n=this._events[t],o(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),n.apply(this,a)}else if(r(n))for(a=Array.prototype.slice.call(arguments,1),u=n.slice(),s=u.length,h=0;h<s;h++)u[h].apply(this,a);return!0},n.prototype.addListener=function(t,e){var s;if(!i(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e),this._events[t]?r(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,r(this._events[t])&&!this._events[t].warned&&(s=o(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,s&&s>0&&this._events[t].length>s&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function n(){this.removeListener(t,n),s||(s=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var s=!1;return n.listener=e,this.on(t,n),this},n.prototype.removeListener=function(t,e){var n,s,o,a;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,s=-1,n===e||i(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(r(n)){for(a=o;a-- >0;)if(n[a]===e||n[a].listener&&n[a].listener===e){s=a;break}if(s<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(s,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],i(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e){"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"}},function(t,e,n){(function(t){function n(t,e){for(var n=0,i=t.length-1;i>=0;i--){var s=t[i];"."===s?t.splice(i,1):".."===s?(t.splice(i,1),n++):n&&(t.splice(i,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function i(t,e){if(t.filter)return t.filter(e);for(var n=[],i=0;i<t.length;i++)e(t[i],i,t)&&n.push(t[i]);return n}var s=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,r=function(t){return s.exec(t).slice(1)};e.resolve=function(){for(var e="",s=!1,r=arguments.length-1;r>=-1&&!s;r--){var o=r>=0?arguments[r]:t.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(e=o+"/"+e,s="/"===o.charAt(0))}return e=n(i(e.split("/"),function(t){return!!t}),!s).join("/"),(s?"/":"")+e||"."},e.normalize=function(t){var s=e.isAbsolute(t),r="/"===o(t,-1);return t=n(i(t.split("/"),function(t){return!!t}),!s).join("/"),t||s||(t="."),t&&r&&(t+="/"),(s?"/":"")+t},e.isAbsolute=function(t){return"/"===t.charAt(0)},e.join=function(){var t=Array.prototype.slice.call(arguments,0);return e.normalize(i(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},e.relative=function(t,n){function i(t){for(var e=0;e<t.length&&""===t[e];e++);for(var n=t.length-1;n>=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=e.resolve(t).substr(1),n=e.resolve(n).substr(1);for(var s=i(t.split("/")),r=i(n.split("/")),o=Math.min(s.length,r.length),a=o,h=0;h<o;h++)if(s[h]!==r[h]){a=h;break}for(var u=[],h=a;h<s.length;h++)u.push("..");return u=u.concat(r.slice(a)),u.join("/")},e.sep="/",e.delimiter=":",e.dirname=function(t){var e=r(t),n=e[0],i=e[1];return n||i?(i&&(i=i.substr(0,i.length-1)),n+i):"."},e.basename=function(t,e){var n=r(t)[2];return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n},e.extname=function(t){return r(t)[3]};var o="b"==="ab".substr(-1)?function(t,e,n){return t.substr(e,n)}:function(t,e,n){return e<0&&(e=t.length+e),t.substr(e,n)}}).call(e,n(24))},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(t){if(c===setTimeout)return setTimeout(t,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(t,0);try{return c(t,0)}catch(e){try{return c.call(null,t,0)}catch(e){return c.call(this,t,0)}}}function r(t){if(l===clearTimeout)return clearTimeout(t);if((l===i||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(t);try{return l(t)}catch(e){try{return l.call(null,t)}catch(e){return l.call(this,t)}}}function o(){m&&f&&(m=!1,f.length?p=f.concat(p):g=-1,p.length&&a())}function a(){if(!m){var t=s(o);m=!0;for(var e=p.length;e;){for(f=p,p=[];++g<e;)f&&f[g].run();g=-1,e=p.length}f=null,m=!1,r(t)}}function h(t,e){this.fun=t,this.array=e}function u(){}var c,l,d=t.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:n}catch(t){c=n}try{l="function"==typeof clearTimeout?clearTimeout:i}catch(t){l=i}}();var f,p=[],m=!1,g=-1;d.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];p.push(new h(t,e)),1!==p.length||m||s(a)},h.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=u,d.addListener=u,d.once=u,d.off=u,d.removeListener=u,d.removeAllListeners=u,d.emit=u,d.binding=function(t){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(t){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(t,e,n){function i(){}function s(t){if(!_(t))return t;var e=[];for(var n in t)r(e,n,t[n]);return e.join("&")}function r(t,e,n){if(null!=n)if(Array.isArray(n))n.forEach(function(n){r(t,e,n)});else if(_(n))for(var i in n)r(t,e+"["+i+"]",n[i]);else t.push(encodeURIComponent(e)+"="+encodeURIComponent(n));else null===n&&t.push(encodeURIComponent(e))}function o(t){for(var e,n,i={},s=t.split("&"),r=0,o=s.length;r<o;++r)e=s[r],n=e.indexOf("="),n==-1?i[decodeURIComponent(e)]="":i[decodeURIComponent(e.slice(0,n))]=decodeURIComponent(e.slice(n+1));return i}function a(t){var e,n,i,s,r=t.split(/\r?\n/),o={};r.pop();for(var a=0,h=r.length;a<h;++a)n=r[a],e=n.indexOf(":"),i=n.slice(0,e).toLowerCase(),s=v(n.slice(e+1)),o[i]=s;return o}function h(t){return/[\/+]json\b/.test(t)}function u(t){return t.split(/ *; */).shift()}function c(t){return t.split(/ *; */).reduce(function(t,e){var n=e.split(/ *= */),i=n.shift(),s=n.shift();return i&&s&&(t[i]=s),t},{})}function l(t,e){e=e||{},this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||"undefined"==typeof this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText,this._setStatusProperties(this.xhr.status),this.header=this.headers=a(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),this.body="HEAD"!=this.req.method?this._parseBody(this.text?this.text:this.xhr.response):null}function d(t,e){var n=this;this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",function(){var t=null,e=null;try{e=new l(n)}catch(e){return t=new Error("Parser is unable to parse the response"),t.parse=!0,t.original=e,n.xhr?(t.rawResponse="undefined"==typeof n.xhr.responseType?n.xhr.responseText:n.xhr.response,t.statusCode=n.xhr.status?n.xhr.status:null):(t.rawResponse=null,t.statusCode=null),n.callback(t)}n.emit("response",e);var i;try{(e.status<200||e.status>=300)&&(i=new Error(e.statusText||"Unsuccessful HTTP response"),i.original=t,i.response=e,i.status=e.status)}catch(t){i=t}i?n.callback(i,e):n.callback(null,e)})}function f(t,e){var n=w("DELETE",t);return e&&n.end(e),n}var p;"undefined"!=typeof window?p=window:"undefined"!=typeof self?p=self:(console.warn("Using browser-only version of superagent in non-browser environment"),p=this);var m=n(64),g=n(77),_=n(26),E=n(76),w=e=t.exports=function(t,n){return"function"==typeof n?new e.Request("GET",t).end(n):1==arguments.length?new e.Request("GET",t):new e.Request(t,n)};e.Request=d,w.getXHR=function(){if(!(!p.XMLHttpRequest||p.location&&"file:"==p.location.protocol&&p.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}throw Error("Browser-only verison of superagent could not find XHR")};var v="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};w.serializeObject=s,w.parseString=o,w.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},w.serialize={"application/x-www-form-urlencoded":s,"application/json":JSON.stringify},w.parse={"application/x-www-form-urlencoded":o,"application/json":JSON.parse},l.prototype.get=function(t){return this.header[t.toLowerCase()]},l.prototype._setHeaderProperties=function(t){var e=this.header["content-type"]||"";this.type=u(e);var n=c(e);for(var i in n)this[i]=n[i]},l.prototype._parseBody=function(t){var e=w.parse[this.type];return!e&&h(this.type)&&(e=w.parse["application/json"]),e&&t&&(t.length||t instanceof Object)?e(t):null},l.prototype._setStatusProperties=function(t){1223===t&&(t=204);var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},l.prototype.toError=function(){var t=this.req,e=t.method,n=t.url,i="cannot "+e+" "+n+" ("+this.status+")",s=new Error(i);return s.status=this.status,s.method=e,s.url=n,s},w.Response=l,m(d.prototype),g(d.prototype),d.prototype.type=function(t){return this.set("Content-Type",w.types[t]||t),this},d.prototype.responseType=function(t){return this._responseType=t,this},d.prototype.accept=function(t){return this.set("Accept",w.types[t]||t),this},d.prototype.auth=function(t,e,n){switch(n||(n={type:"basic"}),n.type){case"basic":var i=btoa(t+":"+e);this.set("Authorization","Basic "+i);break;case"auto":this.username=t,this.password=e}return this},d.prototype.query=function(t){return"string"!=typeof t&&(t=s(t)),t&&this._query.push(t),this},d.prototype.attach=function(t,e,n){if(this._data)throw Error("superagent can't mix .send() and .attach()");return this._getFormData().append(t,e,n||e.name),this},d.prototype._getFormData=function(){return this._formData||(this._formData=new p.FormData),this._formData},d.prototype.callback=function(t,e){var n=this._callback;this.clearTimeout(),t&&this.emit("error",t),n(t,e)},d.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},d.prototype.buffer=d.prototype.ca=d.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},d.prototype.pipe=d.prototype.write=function(){throw Error("Streaming is not supported in browser version of superagent")},d.prototype._timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},d.prototype._appendQueryString=function(){var t=this._query.join("&");t&&(this.url+=~this.url.indexOf("?")?"&"+t:"?"+t)},d.prototype._isHost=function(t){return t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},d.prototype.end=function(t){var e=this,n=this.xhr=w.getXHR(),s=this._timeout,r=this._formData||this._data;this._callback=t||i,n.onreadystatechange=function(){if(4==n.readyState){var t;try{t=n.status}catch(e){t=0}if(0==t){if(e.timedout)return e._timeoutError();if(e._aborted)return;return e.crossDomainError()}e.emit("end")}};var o=function(t,n){n.total>0&&(n.percent=n.loaded/n.total*100),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{n.onprogress=o.bind(null,"download"),n.upload&&(n.upload.onprogress=o.bind(null,"upload"))}catch(t){}if(s&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},s)),this._appendQueryString(),this._sort){var a=this.url.indexOf("?");if(~a){var u=this.url.substring(a+1).split("&");E(this._sort)?u.sort(this._sort):u.sort()}this.url=this.url.substring(0,a)+"?"+u.join("&")}if(this.username&&this.password?n.open(this.method,this.url,!0,this.username,this.password):n.open(this.method,this.url,!0),this._withCredentials&&(n.withCredentials=!0),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof r&&!this._isHost(r)){var c=this._header["content-type"],l=this._serializer||w.serialize[c?c.split(";")[0]:""];!l&&h(c)&&(l=w.serialize["application/json"]),l&&(r=l(r))}for(var d in this.header)null!=this.header[d]&&n.setRequestHeader(d,this.header[d]);return this._responseType&&(n.responseType=this._responseType),this.emit("request",this),n.send("undefined"!=typeof r?r:null),this},w.get=function(t,e,n){var i=w("GET",t);return"function"==typeof e&&(n=e,e=null),e&&i.query(e),n&&i.end(n),i},w.head=function(t,e,n){var i=w("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},w.options=function(t,e,n){var i=w("OPTIONS",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},w.del=f,w.delete=f,w.patch=function(t,e,n){var i=w("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},w.post=function(t,e,n){var i=w("POST",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},w.put=function(t,e,n){var i=w("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i}},function(t,e){function n(t){return null!==t&&"object"==typeof t}t.exports=n},function(t,e){t.exports={name:"discord.js",version:"10.0.1",description:"A powerful library for interacting with the Discord API",main:"./src/index",types:"./typings/index.d.ts",scripts:{test:"eslint src && docgen --source src --custom docs/index.yml",docs:"docgen --source src --custom docs/index.yml --output docs/docs.json","test-docs":"docgen --source src --custom docs",lint:"eslint src","web-dist":"node ./node_modules/parallel-webpack/bin/run.js"},repository:{type:"git",url:"git+https://github.com/hydrabolt/discord.js.git"},keywords:["discord","api","bot","client","node","discordapp"],author:"Amish Shah <amishshah.2k@gmail.com>",license:"Apache-2.0",bugs:{url:"https://github.com/hydrabolt/discord.js/issues"},homepage:"https://github.com/hydrabolt/discord.js#readme",dependencies:{"@types/node":"^6.0.51",pako:"^1.0.3",superagent:"^3.0.0",tweetnacl:"^0.14.3",ws:"^1.1.1"},peerDependencies:{erlpack:"github:hammerandchisel/erlpack","node-opus":"^0.2.0",opusscript:"^0.0.1",uws:"^0.11.1"},devDependencies:{bufferutil:"^1.2.1","discord.js-docgen":"github:hydrabolt/discord.js-docgen",eslint:"^3.10.0","jsdoc-to-markdown":"^2.0.0","json-loader":"^0.5.4","parallel-webpack":"^1.5.0","uglify-js":"github:mishoo/UglifyJS2#harmony","utf-8-validate":"^1.2.1",webpack:"2.1.0-beta.27"},engines:{node:">=6.0.0"},browser:{ws:!1,uws:!1,erlpack:!1,opusscript:!1,"node-opus":!1,"tweet-nacl":!1,"src/sharding/Shard.js":!1,"src/sharding/ShardClientUtil.js":!1,"src/sharding/ShardingManager.js":!1,"src/client/voice/dispatcher/StreamDispatcher.js":!1,"src/client/voice/opus/BaseOpusEngine.js":!1,"src/client/voice/opus/NodeOpusEngine.js":!1,"src/client/voice/opus/OpusEngineList.js":!1,"src/client/voice/opus/OpusScriptEngine.js":!1,"src/client/voice/pcm/ConverterEngine.js":!1,"src/client/voice/pcm/ConverterEngineList.js":!1,"src/client/voice/pcm/FfmpegConverterEngine.js":!1,"src/client/voice/player/AudioPlayer.js":!1,"src/client/voice/player/BasePlayer.js":!1,"src/client/voice/player/DefaultPlayer.js":!1,"src/client/voice/receiver/VoiceReadable.js":!1,"src/client/voice/receiver/VoiceReceiver.js":!1,"src/client/voice/util/SecretKey.js":!1,"src/client/voice/ClientVoiceManager.js":!1,"src/client/voice/VoiceConnection.js":!1,"src/client/voice/VoiceUDPClient.js":!1,"src/client/voice/VoiceWebSocket.js":!1}}},function(t,e,n){const i=n(6),s=n(37);class r extends s{setup(t){super.setup(t),this.flags=t.flags,this.owner=new i(this.client,t.owner)}}t.exports=r},function(t,e,n){const i=n(6),s=n(3);class r extends i{setup(t){super.setup(t),this.verified=t.verified,this.email=t.email,this.localPresence={},this._typing=new Map,this.friends=new s,this.blocked=new s,this.notes=new s}edit(t){return this.client.rest.methods.updateCurrentUser(t)}setUsername(t){return this.client.rest.methods.updateCurrentUser({username:t})}setEmail(t){return this.client.rest.methods.updateCurrentUser({email:t})}setPassword(t){return this.client.rest.methods.updateCurrentUser({password:t})}setAvatar(t){return t.startsWith("data:")?this.client.rest.methods.updateCurrentUser({avatar:t}):this.client.resolver.resolveBuffer(t).then(t=>this.client.rest.methods.updateCurrentUser({avatar:t}))}setStatus(t){return this.setPresence({status:t})}setGame(t,e){return this.setPresence({game:{name:t,url:e}})}setAFK(t){return this.setPresence({afk:t})}addFriend(t){return t=this.client.resolver.resolveUser(t),this.client.rest.methods.addFriend(t)}removeFriend(t){return t=this.client.resolver.resolveUser(t),this.client.rest.methods.removeFriend(t)}createGuild(t,e,n=null){return n?n.startsWith("data:")?this.client.rest.methods.createGuild({name:t,icon:n,region:e}):this.client.resolver.resolveBuffer(n).then(n=>this.client.rest.methods.createGuild({name:t,icon:n,region:e})):this.client.rest.methods.createGuild({name:t,icon:n,region:e})}setPresence(t){return new Promise(e=>{let n=this.localPresence.status||this.presence.status,i=this.localPresence.game,s=this.localPresence.afk||this.presence.afk;if(!i&&this.presence.game&&(i={name:this.presence.game.name,type:this.presence.game.type,url:this.presence.game.url}),t.status){if("string"!=typeof t.status)throw new TypeError("Status must be a string");n=t.status}t.game&&(i=t.game,i.url&&(i.type=1)),"undefined"!=typeof t.afk&&(s=t.afk),s=Boolean(s),this.localPresence={status:n,game:i,afk:s},this.localPresence.since=0,this.localPresence.game=this.localPresence.game||null,this.client.ws.send({op:3,d:this.localPresence}),this.client._setPresence(this.id,this.localPresence),e(this)})}}t.exports=r},function(t,e,n){const i=n(9),s=n(11),r=n(3);class o extends i{constructor(t,e){super(t,e),this.type="dm",this.messages=new r,this._typing=new Map}setup(t){super.setup(t),this.recipient=this.client.dataManager.newUser(t.recipients[0]),this.lastMessageID=t.last_message_id}toString(){return this.recipient.toString()}sendMessage(){}sendTTSMessage(){}sendEmbed(){}sendFile(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}bulkDelete(){}_cacheMessage(){}}s.applyToClass(o,!0),t.exports=o},function(t,e,n){const i=n(9),s=n(11),r=n(3);class o extends i{constructor(t,e){super(t,e),this.type="group",this.messages=new r,this._typing=new Map}setup(t){if(super.setup(t),this.name=t.name,this.icon=t.icon,this.ownerID=t.owner_id,this.recipients||(this.recipients=new r),t.recipients)for(const e of t.recipients){const t=this.client.dataManager.newUser(e);this.recipients.set(t.id,t)}this.lastMessageID=t.last_message_id}get owner(){return this.client.users.get(this.ownerID)}equals(t){const e=t&&this.id===t.id&&this.name===t.name&&this.icon===t.icon&&this.ownerID===t.ownerID;return e?this.recipients.equals(t.recipients):e}toString(){return this.name}sendMessage(){}sendTTSMessage(){}sendEmbed(){}sendFile(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}bulkDelete(){}_cacheMessage(){}}s.applyToClass(o,!0),t.exports=o},function(t,e,n){const i=n(38),s=n(39),r=n(0);class o{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.guild=this.client.guilds.get(t.guild.id)||new i(this.client,t.guild),this.code=t.code,this.temporary=t.temporary,this.maxAge=t.max_age,this.uses=t.uses,this.maxUses=t.max_uses,t.inviter&&(this.inviter=this.client.dataManager.newUser(t.inviter)),this.channel=this.client.channels.get(t.channel.id)||new s(this.client,t.channel),this.createdTimestamp=new Date(t.created_at).getTime()}get createdAt(){return new Date(this.createdTimestamp)}get expiresTimestamp(){return this.createdTimestamp+1e3*this.maxAge}get expiresAt(){return new Date(this.expiresTimestamp)}get url(){return r.Endpoints.inviteLink(this.code)}delete(){return this.client.rest.methods.deleteInvite(this)}toString(){return this.url}}t.exports=o},function(t,e){class n{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.message=t,this.setup(e)}setup(t){this.id=t.id,this.filename=t.filename,this.filesize=t.size,this.url=t.url,this.proxyURL=t.proxy_url,this.height=t.height,this.width=t.width}}t.exports=n},function(t,e,n){const i=n(21).EventEmitter,s=n(3);class r extends i{constructor(t,e,n={}){super(),this.channel=t,this.filter=e,this.options=n,this.ended=!1,this.collected=new s,this.listener=(t=>this.verify(t)),this.channel.client.on("message",this.listener),n.time&&this.channel.client.setTimeout(()=>this.stop("time"),n.time)}verify(t){return(!this.channel||this.channel.id===t.channel.id)&&(!!this.filter(t,this)&&(this.collected.set(t.id,t),this.emit("message",t,this),this.collected.size>=this.options.maxMatches?this.stop("matchesLimit"):this.options.max&&this.collected.size===this.options.max&&this.stop("limit"),!0))}get next(){return new Promise((t,e)=>{if(this.ended)return void e(this.collected);const n=()=>{this.removeListener("message",i),this.removeListener("end",s)},i=(...e)=>{n(),t(...e)},s=(...t)=>{n(),e(...t)};this.once("message",i),this.once("end",s)})}stop(t="user"){this.ended||(this.ended=!0,this.channel.client.removeListener("message",this.listener),this.emit("end",this.collected,t))}}t.exports=r},function(t,e){class n{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.message=t,this.setup(e)}setup(t){if(this.type=t.type,this.title=t.title,this.description=t.description,this.url=t.url,this.color=t.color,this.fields=[],t.fields)for(const e of t.fields)this.fields.push(new o(this,e));this.createdTimestamp=t.timestamp,this.thumbnail=t.thumbnail?new i(this,t.thumbnail):null,this.author=t.author?new r(this,t.author):null,this.provider=t.provider?new s(this,t.provider):null,this.footer=t.footer?new a(this,t.footer):null}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let t=this.color.toString(16);for(;t.length<6;)t=`0${t}`;return`#${t}`}}class i{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.url=t.url,this.proxyURL=t.proxy_url,this.height=t.height,this.width=t.width}}class s{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.name=t.name,this.url=t.url}}class r{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.name=t.name,this.url=t.url,this.iconURL=t.icon_url}}class o{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.name=t.name,this.value=t.value,this.inline=t.inline}}class a{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.text=t.text,this.iconURL=t.icon_url,this.proxyIconUrl=t.proxy_icon_url}}n.Thumbnail=i,n.Provider=s,n.Author=r,n.Field=o,n.Footer=a,t.exports=n},function(t,e,n){const i=n(3),s=n(10),r=n(19);class o{constructor(t,e,n,s){this.message=t,this.me=s,this.count=n||0,this.users=new i,this._emoji=new r(this,e.name,e.id)}get emoji(){if(this._emoji instanceof s)return this._emoji;if(this._emoji.id){const t=this.message.client.emojis;if(t.has(this._emoji.id)){const e=t.get(this._emoji.id);return this._emoji=e,e}}return this._emoji}remove(t=this.message.client.user){const e=this.message;return t=this.message.client.resolver.resolveUserID(t),t?e.client.rest.methods.removeMessageReaction(e,this.emoji.identifier,t):Promise.reject("Couldn't resolve the user ID to remove from the reaction.")}fetchUsers(t=100){const e=this.message;return e.client.rest.methods.getMessageReactionUsers(e,this.emoji.identifier,t).then(t=>{this.users=new i;for(const e of t){const t=this.message.client.dataManager.newUser(e);this.users.set(t.id,t)}return this.count=this.users.size,t})}}t.exports=o},function(t,e){class n{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.description=t.description,this.icon=t.icon,this.iconURL=`https://cdn.discordapp.com/app-icons/${this.id}/${this.icon}.jpg`,this.rpcOrigins=t.rpc_origins}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}toString(){return this.name}}t.exports=n},function(t,e){class n{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.icon=t.icon,this.splash=t.splash}}t.exports=n},function(t,e,n){const i=n(0);class s{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.type=i.ChannelTypes.text===t.type?"text":"voice"}}t.exports=s},function(t,e){class n{constructor(t,e){Object.defineProperty(this,"channel",{value:t}),e&&this.setup(e)}setup(t){this.id=t.id,this.type=t.type,this.deny=t.deny,this.allow=t.allow}delete(){return this.channel.client.rest.methods.deletePermissionOverwrites(this)}}t.exports=n},function(t,e){class n{constructor(t={}){this.title=t.title,this.description=t.description,this.url=t.url,this.color=t.color,this.author=t.author,this.timestamp=t.timestamp,this.fields=t.fields||[],this.thumbnail=t.thumbnail,this.image=t.image,this.footer=t.footer}setTitle(t){if(t.length>256)throw new RangeError("RichEmbed titles may not exceed 256 characters.");return this.title=t,this}setDescription(t){if(t.length>2048)throw new RangeError("RichEmbed descriptions may not exceed 2048 characters.");return this.description=t,this}setURL(t){return this.url=t,this}setColor(t){if(t instanceof Array?t=(t[0]<<16)+(t[1]<<8)+t[2]:"string"==typeof t&&t.startsWith("#")&&(t=parseInt(t.replace("#",""),16)),t<0||t>16777215)throw new RangeError("RichEmbed color must be within the range 0 - 16777215 (0xFFFFFF).");if(t&&isNaN(parseInt(t)))throw new TypeError("Unable to convert RichEmbed color to a number.");return this.color=t,this}setAuthor(t,e,n){return this.author={name:t,icon_url:e,url:n},this}setTimestamp(t=new Date){return this.timestamp=t,this}addField(t,e,n=false){if(this.fields.length>=25)throw new RangeError("RichEmbeds may not exceed 25 fields.");if(t.length>256)throw new RangeError("RichEmbed field names may not exceed 256 characters.");if("undefined"!=typeof e&&(e instanceof Array?e=e.join("\n"):"string"!=typeof e&&(e=String(e))),e.length>1024)throw new RangeError("RichEmbed field values may not exceed 1024 characters.");return this.fields.push({name:t,value:e,inline:n}),this}setThumbnail(t){return this.thumbnail={url:t},this}setImage(t){return this.image={url:t},this}setFooter(t,e){if(t.length>2048)throw new RangeError("RichEmbed footer text may not exceed 2048 characters.");return this.footer={text:t,icon_url:e},this}}t.exports=n},function(t,e,n){const i=n(12),s=n(11),r=n(3);class o extends i{constructor(t,e){super(t,e),this.type="text",this.messages=new r,this._typing=new Map}setup(t){super.setup(t),this.topic=t.topic,this.lastMessageID=t.last_message_id}get members(){const t=new r;for(const e of this.guild.members.values())this.permissionsFor(e).hasPermission("READ_MESSAGES")&&t.set(e.id,e);return t}fetchWebhooks(){return this.client.rest.methods.getChannelWebhooks(this)}createWebhook(t,e){return new Promise(n=>{e.startsWith("data:")?n(this.client.rest.methods.createWebhook(this,t,e)):this.client.resolver.resolveBuffer(e).then(e=>n(this.client.rest.methods.createWebhook(this,t,e)))})}sendMessage(){}sendTTSMessage(){}sendEmbed(){}sendFile(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}bulkDelete(){}_cacheMessage(){}}s.applyToClass(o,!0),t.exports=o},function(t,e,n){const i=n(12),s=n(3);class r extends i{constructor(t,e){super(t,e),this.members=new s,this.type="voice"}setup(t){super.setup(t),this.bitrate=t.bitrate,this.userLimit=t.user_limit}get connection(){const t=this.guild.voiceConnection;return t&&t.channel.id===this.id?t:null}get joinable(){return!this.client.browser&&this.permissionsFor(this.client.user).hasPermission("CONNECT")}get speakable(){return this.permissionsFor(this.client.user).hasPermission("SPEAK")}setBitrate(t){return this.edit({bitrate:t})}setUserLimit(t){return this.edit({userLimit:t})}join(){return this.client.browser?Promise.reject(new Error("Voice connections are not available in browsers.")):this.client.voice.joinChannel(this)}leave(){if(!this.client.browser){const t=this.client.voice.connections.get(this.guild.id);t&&t.channel.id===this.id&&t.disconnect()}}}t.exports=r},function(t,e){t.exports=function(t,{maxLength=1950,char="\n",prepend="",append=""}={}){if(t.length<=maxLength)return t;const e=t.split(char);if(1===e.length)throw new Error("Message exceeds the max length and contains no split characters.");const n=[""];let i=0;for(let s=0;s<e.length;s++)n[i].length+e[s].length+1>maxLength&&(n[i]+=append,n.push(prepend),
|
||
i++),n[i]+=(n[i].length>0&&n[i]!==prepend?char:"")+e[s];return n}},function(t,e,n){"use strict";function i(t,e){if(e<65537&&(t.subarray&&o||!t.subarray&&r))return String.fromCharCode.apply(null,s.shrinkBuf(t,e));for(var n="",i=0;i<e;i++)n+=String.fromCharCode(t[i]);return n}var s=n(5),r=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(t){r=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){o=!1}for(var a=new s.Buf8(256),h=0;h<256;h++)a[h]=h>=252?6:h>=248?5:h>=240?4:h>=224?3:h>=192?2:1;a[254]=a[254]=1,e.string2buf=function(t){var e,n,i,r,o,a=t.length,h=0;for(r=0;r<a;r++)n=t.charCodeAt(r),55296===(64512&n)&&r+1<a&&(i=t.charCodeAt(r+1),56320===(64512&i)&&(n=65536+(n-55296<<10)+(i-56320),r++)),h+=n<128?1:n<2048?2:n<65536?3:4;for(e=new s.Buf8(h),o=0,r=0;o<h;r++)n=t.charCodeAt(r),55296===(64512&n)&&r+1<a&&(i=t.charCodeAt(r+1),56320===(64512&i)&&(n=65536+(n-55296<<10)+(i-56320),r++)),n<128?e[o++]=n:n<2048?(e[o++]=192|n>>>6,e[o++]=128|63&n):n<65536?(e[o++]=224|n>>>12,e[o++]=128|n>>>6&63,e[o++]=128|63&n):(e[o++]=240|n>>>18,e[o++]=128|n>>>12&63,e[o++]=128|n>>>6&63,e[o++]=128|63&n);return e},e.buf2binstring=function(t){return i(t,t.length)},e.binstring2buf=function(t){for(var e=new s.Buf8(t.length),n=0,i=e.length;n<i;n++)e[n]=t.charCodeAt(n);return e},e.buf2string=function(t,e){var n,s,r,o,h=e||t.length,u=new Array(2*h);for(s=0,n=0;n<h;)if(r=t[n++],r<128)u[s++]=r;else if(o=a[r],o>4)u[s++]=65533,n+=o-1;else{for(r&=2===o?31:3===o?15:7;o>1&&n<h;)r=r<<6|63&t[n++],o--;o>1?u[s++]=65533:r<65536?u[s++]=r:(r-=65536,u[s++]=55296|r>>10&1023,u[s++]=56320|1023&r)}return i(u,s)},e.utf8border=function(t,e){var n;for(e=e||t.length,e>t.length&&(e=t.length),n=e-1;n>=0&&128===(192&t[n]);)n--;return n<0?e:0===n?e:n+a[t[n]]>e?n:e}},function(t,e){"use strict";function n(t,e,n,i){for(var s=65535&t|0,r=t>>>16&65535|0,o=0;0!==n;){o=n>2e3?2e3:n,n-=o;do s=s+e[i++]|0,r=r+s|0;while(--o);s%=65521,r%=65521}return s|r<<16|0}t.exports=n},function(t,e){"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}},function(t,e){"use strict";function n(){for(var t,e=[],n=0;n<256;n++){t=n;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}function i(t,e,n,i){var r=s,o=i+n;t^=-1;for(var a=i;a<o;a++)t=t>>>8^r[255&(t^e[a])];return t^-1}var s=n();t.exports=i},function(t,e){"use strict";function n(){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}t.exports=n},function(t,e){},function(t,e,n){(function(e){const i=n(23),s=n(50),r=n(25),o=n(0),a=n(54),h=n(6),u=n(14),c=n(18),l=n(9),d=n(13),f=n(10),p=n(19);class m{constructor(t){this.client=t}resolveUser(t){return t instanceof h?t:"string"==typeof t?this.client.users.get(t)||null:t instanceof d?t.user:t instanceof u?t.author:t instanceof c?t.owner:null}resolveUserID(t){return t instanceof h||t instanceof d?t.id:"string"==typeof t?t||null:t instanceof u?t.author.id:t instanceof c?t.ownerID:null}resolveGuild(t){return t instanceof c?t:"string"==typeof t?this.client.guilds.get(t)||null:null}resolveGuildMember(t,e){return e instanceof d?e:(t=this.resolveGuild(t),e=this.resolveUser(e),t&&e?t.members.get(e.id)||null:null)}resolveChannel(t){return t instanceof l?t:t instanceof u?t.channel:t instanceof c?t.channels.get(t.id)||null:"string"==typeof t?this.client.channels.get(t)||null:null}resolveInviteCode(t){const e=/discord(?:app)?\.(?:gg|com\/invite)\/([a-z0-9]{5})/i,n=e.exec(t);return n&&n[1]?n[1]:t}resolvePermission(t){if("string"==typeof t&&(t=o.PermissionFlags[t]),"number"!=typeof t||t<1)throw new Error(o.Errors.NOT_A_PERMISSION);return t}resolveString(t){return"string"==typeof t?t:t instanceof Array?t.join("\n"):String(t)}resolveBase64(t){return t instanceof e?`data:image/jpg;base64,${t.toString("base64")}`:t}resolveBuffer(t){return t instanceof e?Promise.resolve(t):this.client.browser&&t instanceof ArrayBuffer?Promise.resolve(a(t)):"string"==typeof t?new Promise((n,o)=>{if(/^https?:\/\//.test(t)){const i=r.get(t).set("Content-Type","blob");this.client.browser&&i.responseType("arraybuffer"),i.end((t,i)=>{return t?o(t):this.client.browser?n(a(i.xhr.response)):i.body instanceof e?n(i.body):o(new TypeError("The response body isn't a Buffer."))})}else{const e=i.resolve(t);s.stat(e,(t,i)=>{if(t&&o(t),!i||!i.isFile())throw new Error(`The file could not be found: ${e}`);s.readFile(e,(t,e)=>{t?o(t):n(e)})})}}):Promise.reject(new TypeError("The resource must be a string or Buffer."))}resolveEmojiIdentifier(t){return t instanceof f||t instanceof p?t.identifier:"string"!=typeof t||t.includes("%")?null:encodeURIComponent(t)}}t.exports=m}).call(e,n(16).Buffer)},function(t,e,n){const i=n(112),s=n(109),r=n(111),o=n(110),a=n(108),h=n(0);class u{constructor(t){this.client=t,this.handlers={},this.userAgentManager=new i(this),this.methods=new s(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1}push(t,e){return new Promise((n,i)=>{t.push({request:e,resolve:n,reject:i})})}getRequestHandler(){switch(this.client.options.apiRequestMethod){case"sequential":return r;case"burst":return o;default:throw new Error(h.Errors.INVALID_RATE_LIMIT_METHOD)}}makeRequest(t,e,n,i,s){const r=new a(this,t,e,n,i,s);if(!this.handlers[r.route]){const t=this.getRequestHandler();this.handlers[r.route]=new t(this,r.route)}return this.push(this.handlers[r.route],r)}}t.exports=u},function(t,e){class n{constructor(t){this.restManager=t,this.queue=[]}get globalLimit(){return this.restManager.globallyRateLimited}set globalLimit(t){this.restManager.globallyRateLimited=t}push(t){this.queue.push(t)}handle(){}}t.exports=n},function(t,e,n){(function(e){function n(t){const n=new e(t.byteLength),i=new Uint8Array(t);for(var s=0;s<n.length;++s)n[s]=i[s];return n}function i(t){const e=new ArrayBuffer(2*t.length),n=new Uint16Array(e);for(var i=0,s=t.length;i<s;i++)n[i]=t.charCodeAt(i);return e}t.exports=function(t){return"string"==typeof t&&(t=i(t)),n(t)}}).call(e,n(16).Buffer)},function(t,e){t.exports=function t(e,n){if(!n)return e;for(const i in e)({}).hasOwnProperty.call(n,i)?n[i]===Object(n[i])&&(n[i]=t(e[i],n[i])):n[i]=e[i];return n}},function(module,exports,__webpack_require__){(function(process){const EventEmitter=__webpack_require__(21).EventEmitter,mergeDefault=__webpack_require__(55),Constants=__webpack_require__(0),RESTManager=__webpack_require__(52),ClientDataManager=__webpack_require__(79),ClientManager=__webpack_require__(80),ClientDataResolver=__webpack_require__(51),ClientVoiceManager=__webpack_require__(153),WebSocketManager=__webpack_require__(113),ActionsManager=__webpack_require__(81),Collection=__webpack_require__(3),Presence=__webpack_require__(7).Presence,ShardClientUtil=__webpack_require__(152);class Client extends EventEmitter{constructor(t={}){super(),!t.shardId&&"SHARD_ID"in process.env&&(t.shardId=Number(process.env.SHARD_ID)),!t.shardCount&&"SHARD_COUNT"in process.env&&(t.shardCount=Number(process.env.SHARD_COUNT)),this.options=mergeDefault(Constants.DefaultOptions,t),this._validateOptions(),this.rest=new RESTManager(this),this.dataManager=new ClientDataManager(this),this.manager=new ClientManager(this),this.ws=new WebSocketManager(this),this.resolver=new ClientDataResolver(this),this.actions=new ActionsManager(this),this.voice=this.browser?null:new ClientVoiceManager(this),this.shard=process.send?ShardClientUtil.singleton(this):null,this.users=new Collection,this.guilds=new Collection,this.channels=new Collection,this.presences=new Collection,!this.token&&"CLIENT_TOKEN"in process.env?this.token=process.env.CLIENT_TOKEN:this.token=null,this.user=null,this.readyAt=null,this.pings=[],this._pingTimestamp=0,this._timeouts=new Set,this._intervals=new Set,this.options.messageSweepInterval>0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get status(){return this.ws.status}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get ping(){return this.pings.reduce((t,e)=>t+e,0)/this.pings.length}get voiceConnections(){return this.browser?new Collection:this.voice.connections}get emojis(){const t=new Collection;for(const e of this.guilds.values())for(const n of e.emojis.values())t.set(n.id,n);return t}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}get browser(){return"undefined"!=typeof window}login(t){return this.rest.methods.login(t)}destroy(){for(const t of this._timeouts)clearTimeout(t);for(const e of this._intervals)clearInterval(e);return this._timeouts.clear(),this._intervals.clear(),this.token=null,this.email=null,this.password=null,this.manager.destroy()}syncGuilds(t=this.guilds){this.user.bot||this.ws.send({op:12,d:t instanceof Collection?t.keyArray():t.map(t=>t.id)})}fetchUser(t){return this.users.has(t)?Promise.resolve(this.users.get(t)):this.rest.methods.getUser(t)}fetchInvite(t){const e=this.resolver.resolveInviteCode(t);return this.rest.methods.getInvite(e)}fetchWebhook(t,e){return this.rest.methods.getWebhook(t,e)}sweepMessages(t=this.options.messageCacheLifetime){if("number"!=typeof t||isNaN(t))throw new TypeError("The lifetime must be a number.");if(t<=0)return this.emit("debug","Didn't sweep messages - lifetime is unlimited"),-1;const e=1e3*t,n=Date.now();let i=0,s=0;for(const r of this.channels.values())if(r.messages){i++;for(const t of r.messages.values())n-(t.editedTimestamp||t.createdTimestamp)>e&&(r.messages.delete(t.id),s++)}return this.emit("debug",`Swept ${s} messages older than ${t} seconds in ${i} text-based channels`),s}fetchApplication(){if(!this.user.bot)throw new Error(Constants.Errors.NO_BOT_ACCOUNT);return this.rest.methods.getMyApplication()}setTimeout(t,e,...n){const i=setTimeout(()=>{t(),this._timeouts.delete(i)},e,...n);return this._timeouts.add(i),i}clearTimeout(t){clearTimeout(t),this._timeouts.delete(t)}setInterval(t,e,...n){const i=setInterval(t,e,...n);return this._intervals.add(i),i}clearInterval(t){clearInterval(t),this._intervals.delete(t)}_pong(t){this.pings.unshift(Date.now()-t),this.pings.length>3&&(this.pings.length=3)}_setPresence(t,e){return this.presences.get(t)?void this.presences.get(t).update(e):void this.presences.set(t,new Presence(e))}_eval(script){return eval(script)}_validateOptions(t=this.options){if("number"!=typeof t.shardCount||isNaN(t.shardCount))throw new TypeError("The shardCount option must be a number.");if("number"!=typeof t.shardId||isNaN(t.shardId))throw new TypeError("The shardId option must be a number.");if(t.shardCount<0)throw new RangeError("The shardCount option must be at least 0.");if(t.shardId<0)throw new RangeError("The shardId option must be at least 0.");if(0!==t.shardId&&t.shardId>=t.shardCount)throw new RangeError("The shardId option must be less than shardCount.");if("number"!=typeof t.messageCacheMaxSize||isNaN(t.messageCacheMaxSize))throw new TypeError("The messageCacheMaxSize option must be a number.");if("number"!=typeof t.messageCacheLifetime||isNaN(t.messageCacheLifetime))throw new TypeError("The messageCacheLifetime option must be a number.");if("number"!=typeof t.messageSweepInterval||isNaN(t.messageSweepInterval))throw new TypeError("The messageSweepInterval option must be a number.");if("boolean"!=typeof t.fetchAllMembers)throw new TypeError("The fetchAllMembers option must be a boolean.");if("boolean"!=typeof t.disableEveryone)throw new TypeError("The disableEveryone option must be a boolean.");if("number"!=typeof t.restWsBridgeTimeout||isNaN(t.restWsBridgeTimeout))throw new TypeError("The restWsBridgeTimeout option must be a number.");if(!(t.disabledEvents instanceof Array))throw new TypeError("The disabledEvents option must be an Array.")}}module.exports=Client}).call(exports,__webpack_require__(24))},function(t,e,n){const i=n(20),s=n(52),r=n(51),o=n(55),a=n(0);class h extends i{constructor(t,e,n){super(null,t,e),this.options=o(a.DefaultOptions,n),this.rest=new s(this),this.resolver=new r(this)}}t.exports=h},function(t,e,n){t.exports={Client:n(56),WebhookClient:n(57),Shard:n(60),ShardClientUtil:n(61),ShardingManager:n(62),Collection:n(3),splitMessage:n(44),escapeMarkdown:n(15),fetchRecommendedShards:n(59),Channel:n(9),ClientOAuth2Application:n(28),ClientUser:n(29),DMChannel:n(30),Emoji:n(10),EvaluatedPermissions:n(17),Game:n(7).Game,GroupDMChannel:n(31),Guild:n(18),GuildChannel:n(12),GuildMember:n(13),Invite:n(32),Message:n(14),MessageAttachment:n(33),MessageCollector:n(34),MessageEmbed:n(35),MessageReaction:n(36),OAuth2Application:n(37),PartialGuild:n(38),PartialGuildChannel:n(39),PermissionOverwrites:n(40),Presence:n(7).Presence,ReactionEmoji:n(19),RichEmbed:n(41),Role:n(8),TextChannel:n(42),User:n(6),VoiceChannel:n(43),Webhook:n(20),version:n(27).version,Constants:n(0)},"undefined"!=typeof window&&(window.Discord=t.exports)},function(t,e,n){const i=n(25),s=n(0).Endpoints.botGateway;t.exports=function(t){return new Promise((e,n)=>{if(!t)throw new Error("A token must be provided.");i.get(s).set("Authorization",`Bot ${t.replace(/^Bot\s*/i,"")}`).end((t,i)=>{t&&n(t),e(i.body.shards)})})}},function(t,e){},function(t,e){},function(t,e){},function(t,e){"use strict";function n(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return 3*t.length/4-n(t)}function s(t){var e,i,s,r,o,a,h=t.length;o=n(t),a=new c(3*h/4-o),s=o>0?h-4:h;var l=0;for(e=0,i=0;e<s;e+=4,i+=3)r=u[t.charCodeAt(e)]<<18|u[t.charCodeAt(e+1)]<<12|u[t.charCodeAt(e+2)]<<6|u[t.charCodeAt(e+3)],a[l++]=r>>16&255,a[l++]=r>>8&255,a[l++]=255&r;return 2===o?(r=u[t.charCodeAt(e)]<<2|u[t.charCodeAt(e+1)]>>4,a[l++]=255&r):1===o&&(r=u[t.charCodeAt(e)]<<10|u[t.charCodeAt(e+1)]<<4|u[t.charCodeAt(e+2)]>>2,a[l++]=r>>8&255,a[l++]=255&r),a}function r(t){return h[t>>18&63]+h[t>>12&63]+h[t>>6&63]+h[63&t]}function o(t,e,n){for(var i,s=[],o=e;o<n;o+=3)i=(t[o]<<16)+(t[o+1]<<8)+t[o+2],s.push(r(i));return s.join("")}function a(t){for(var e,n=t.length,i=n%3,s="",r=[],a=16383,u=0,c=n-i;u<c;u+=a)r.push(o(t,u,u+a>c?c:u+a));return 1===i?(e=t[n-1],s+=h[e>>2],s+=h[e<<4&63],s+="=="):2===i&&(e=(t[n-2]<<8)+t[n-1],s+=h[e>>10],s+=h[e>>4&63],s+=h[e<<2&63],s+="="),r.push(s),r.join("")}e.byteLength=i,e.toByteArray=s,e.fromByteArray=a;for(var h=[],u=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,f=l.length;d<f;++d)h[d]=l[d],u[l.charCodeAt(d)]=d;u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63},function(t,e,n){function i(t){if(t)return s(t)}function s(t){for(var e in i.prototype)t[e]=i.prototype[e];return t}t.exports=i,i.prototype.on=i.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},i.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},i.prototype.off=i.prototype.removeListener=i.prototype.removeAllListeners=i.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i,s=0;s<n.length;s++)if(i=n[s],i===e||i.fn===e){n.splice(s,1);break}return this},i.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks["$"+t];if(n){n=n.slice(0);for(var i=0,s=n.length;i<s;++i)n[i].apply(this,e)}return this},i.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},i.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e){e.read=function(t,e,n,i,s){var r,o,a=8*s-i-1,h=(1<<a)-1,u=h>>1,c=-7,l=n?s-1:0,d=n?-1:1,f=t[e+l];for(l+=d,r=f&(1<<-c)-1,f>>=-c,c+=a;c>0;r=256*r+t[e+l],l+=d,c-=8);for(o=r&(1<<-c)-1,r>>=-c,c+=i;c>0;o=256*o+t[e+l],l+=d,c-=8);if(0===r)r=1-u;else{if(r===h)return o?NaN:(f?-1:1)*(1/0);o+=Math.pow(2,i),r-=u}return(f?-1:1)*o*Math.pow(2,r-i)},e.write=function(t,e,n,i,s,r){var o,a,h,u=8*r-s-1,c=(1<<u)-1,l=c>>1,d=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:r-1,p=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-o))<1&&(o--,h*=2),e+=o+l>=1?d/h:d*Math.pow(2,1-l),e*h>=2&&(o++,h/=2),o+l>=c?(a=0,o=c):o+l>=1?(a=(e*h-1)*Math.pow(2,s),o+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,s),o=0));s>=8;t[n+f]=255&a,f+=p,a/=256,s-=8);for(o=o<<s|a,u+=s;u>0;t[n+f]=255&o,f+=p,o/=256,u-=8);t[n+f-p]|=128*m}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){"use strict";var i=n(5).assign,s=n(68),r=n(69),o=n(47),a={};i(a,s,r,o),t.exports=a},function(t,e,n){"use strict";function i(t){if(!(this instanceof i))return new i(t);this.options=h.assign({level:E,method:v,chunkSize:16384,windowBits:15,memLevel:8,strategy:w,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var n=a.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==m)throw new Error(c[n]);if(e.header&&a.deflateSetHeader(this.strm,e.header),e.dictionary){var s;if(s="string"==typeof e.dictionary?u.string2buf(e.dictionary):"[object ArrayBuffer]"===d.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,n=a.deflateSetDictionary(this.strm,s),n!==m)throw new Error(c[n]);this._dict_set=!0}}function s(t,e){var n=new i(e);if(n.push(t,!0),n.err)throw n.msg;return n.result}function r(t,e){return e=e||{},e.raw=!0,s(t,e)}function o(t,e){return e=e||{},e.gzip=!0,s(t,e)}var a=n(70),h=n(5),u=n(45),c=n(22),l=n(49),d=Object.prototype.toString,f=0,p=4,m=0,g=1,_=2,E=-1,w=0,v=8;i.prototype.push=function(t,e){var n,i,s=this.strm,r=this.options.chunkSize;if(this.ended)return!1;i=e===~~e?e:e===!0?p:f,"string"==typeof t?s.input=u.string2buf(t):"[object ArrayBuffer]"===d.call(t)?s.input=new Uint8Array(t):s.input=t,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new h.Buf8(r),s.next_out=0,s.avail_out=r),n=a.deflate(s,i),n!==g&&n!==m)return this.onEnd(n),this.ended=!0,!1;0!==s.avail_out&&(0!==s.avail_in||i!==p&&i!==_)||("string"===this.options.to?this.onData(u.buf2binstring(h.shrinkBuf(s.output,s.next_out))):this.onData(h.shrinkBuf(s.output,s.next_out)))}while((s.avail_in>0||0===s.avail_out)&&n!==g);return i===p?(n=a.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===m):i!==_||(this.onEnd(m),s.avail_out=0,!0)},i.prototype.onData=function(t){this.chunks.push(t)},i.prototype.onEnd=function(t){t===m&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=h.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Deflate=i,e.deflate=s,e.deflateRaw=r,e.gzip=o},function(t,e,n){"use strict";function i(t){if(!(this instanceof i))return new i(t);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0===(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var n=o.inflateInit2(this.strm,e.windowBits);if(n!==u.Z_OK)throw new Error(c[n]);this.header=new d,o.inflateGetHeader(this.strm,this.header)}function s(t,e){var n=new i(e);if(n.push(t,!0),n.err)throw n.msg;return n.result}function r(t,e){return e=e||{},e.raw=!0,s(t,e)}var o=n(73),a=n(5),h=n(45),u=n(47),c=n(22),l=n(49),d=n(71),f=Object.prototype.toString;i.prototype.push=function(t,e){var n,i,s,r,c,l,d=this.strm,p=this.options.chunkSize,m=this.options.dictionary,g=!1;if(this.ended)return!1;i=e===~~e?e:e===!0?u.Z_FINISH:u.Z_NO_FLUSH,"string"==typeof t?d.input=h.binstring2buf(t):"[object ArrayBuffer]"===f.call(t)?d.input=new Uint8Array(t):d.input=t,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new a.Buf8(p),d.next_out=0,d.avail_out=p),n=o.inflate(d,u.Z_NO_FLUSH),n===u.Z_NEED_DICT&&m&&(l="string"==typeof m?h.string2buf(m):"[object ArrayBuffer]"===f.call(m)?new Uint8Array(m):m,n=o.inflateSetDictionary(this.strm,l)),n===u.Z_BUF_ERROR&&g===!0&&(n=u.Z_OK,g=!1),n!==u.Z_STREAM_END&&n!==u.Z_OK)return this.onEnd(n),this.ended=!0,!1;d.next_out&&(0!==d.avail_out&&n!==u.Z_STREAM_END&&(0!==d.avail_in||i!==u.Z_FINISH&&i!==u.Z_SYNC_FLUSH)||("string"===this.options.to?(s=h.utf8border(d.output,d.next_out),r=d.next_out-s,c=h.buf2string(d.output,s),d.next_out=r,d.avail_out=p-r,r&&a.arraySet(d.output,d.output,s,r,0),this.onData(c)):this.onData(a.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(g=!0)}while((d.avail_in>0||0===d.avail_out)&&n!==u.Z_STREAM_END);return n===u.Z_STREAM_END&&(i=u.Z_FINISH),i===u.Z_FINISH?(n=o.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===u.Z_OK):i!==u.Z_SYNC_FLUSH||(this.onEnd(u.Z_OK),d.avail_out=0,!0)},i.prototype.onData=function(t){this.chunks.push(t)},i.prototype.onEnd=function(t){t===u.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Inflate=i,e.inflate=s,e.inflateRaw=r,e.ungzip=s},function(t,e,n){"use strict";function i(t,e){return t.msg=U[e],e}function s(t){return(t<<1)-(t>4?9:0)}function r(t){for(var e=t.length;--e>=0;)t[e]=0}function o(t){var e=t.state,n=e.pending;n>t.avail_out&&(n=t.avail_out),0!==n&&(I.arraySet(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))}function a(t,e){C._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,o(t.strm)}function h(t,e){t.pending_buf[t.pending++]=e}function u(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function c(t,e,n,i){var s=t.avail_in;return s>i&&(s=i),0===s?0:(t.avail_in-=s,I.arraySet(e,t.input,t.next_in,s,n),1===t.state.wrap?t.adler=x(t.adler,e,s,n):2===t.state.wrap&&(t.adler=L(t.adler,e,s,n)),t.next_in+=s,t.total_in+=s,s)}function l(t,e){var n,i,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match,h=t.strstart>t.w_size-lt?t.strstart-(t.w_size-lt):0,u=t.window,c=t.w_mask,l=t.prev,d=t.strstart+ct,f=u[r+o-1],p=u[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do if(n=e,u[n+o]===p&&u[n+o-1]===f&&u[n]===u[r]&&u[++n]===u[r+1]){r+=2,n++;do;while(u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&r<d);if(i=ct-(d-r),r=d-ct,i>o){if(t.match_start=e,o=i,i>=a)break;f=u[r+o-1],p=u[r+o]}}while((e=l[e&c])>h&&0!==--s);return o<=t.lookahead?o:t.lookahead}function d(t){var e,n,i,s,r,o=t.w_size;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=o+(o-lt)){I.arraySet(t.window,t.window,o,o,0),t.match_start-=o,t.strstart-=o,t.block_start-=o,n=t.hash_size,e=n;do i=t.head[--e],t.head[e]=i>=o?i-o:0;while(--n);n=o,e=n;do i=t.prev[--e],t.prev[e]=i>=o?i-o:0;while(--n);s+=o}if(0===t.strm.avail_in)break;if(n=c(t.strm,t.window,t.strstart+t.lookahead,s),t.lookahead+=n,t.lookahead+t.insert>=ut)for(r=t.strstart-t.insert,t.ins_h=t.window[r],t.ins_h=(t.ins_h<<t.hash_shift^t.window[r+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[r+ut-1])&t.hash_mask,t.prev[r&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=r,r++,t.insert--,!(t.lookahead+t.insert<ut)););}while(t.lookahead<lt&&0!==t.strm.avail_in)}function f(t,e){var n=65535;for(n>t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(d(t),0===t.lookahead&&e===P)return vt;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+n;if((0===t.strstart||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,a(t,!1),0===t.strm.avail_out))return vt;if(t.strstart-t.block_start>=t.w_size-lt&&(a(t,!1),0===t.strm.avail_out))return vt}return t.insert=0,e===B?(a(t,!0),0===t.strm.avail_out?yt:At):t.strstart>t.block_start&&(a(t,!1),0===t.strm.avail_out)?vt:vt}function p(t,e){for(var n,i;;){if(t.lookahead<lt){if(d(t),t.lookahead<lt&&e===P)return vt;if(0===t.lookahead)break}if(n=0,t.lookahead>=ut&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+ut-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==n&&t.strstart-n<=t.w_size-lt&&(t.match_length=l(t,n)),t.match_length>=ut)if(i=C._tr_tally(t,t.strstart-t.match_start,t.match_length-ut),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=ut){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+ut-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(0!==--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else i=C._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(a(t,!1),0===t.strm.avail_out))return vt}return t.insert=t.strstart<ut-1?t.strstart:ut-1,e===B?(a(t,!0),0===t.strm.avail_out?yt:At):t.last_lit&&(a(t,!1),0===t.strm.avail_out)?vt:bt}function m(t,e){for(var n,i,s;;){if(t.lookahead<lt){if(d(t),t.lookahead<lt&&e===P)return vt;if(0===t.lookahead)break}if(n=0,t.lookahead>=ut&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+ut-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=ut-1,0!==n&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-lt&&(t.match_length=l(t,n),t.match_length<=5&&(t.strategy===Y||t.match_length===ut&&t.strstart-t.match_start>4096)&&(t.match_length=ut-1)),t.prev_length>=ut&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-ut,i=C._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-ut),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=s&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+ut-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(0!==--t.prev_length);if(t.match_available=0,t.match_length=ut-1,t.strstart++,i&&(a(t,!1),0===t.strm.avail_out))return vt}else if(t.match_available){if(i=C._tr_tally(t,0,t.window[t.strstart-1]),i&&a(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return vt}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=C._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<ut-1?t.strstart:ut-1,e===B?(a(t,!0),0===t.strm.avail_out?yt:At):t.last_lit&&(a(t,!1),0===t.strm.avail_out)?vt:bt}function g(t,e){for(var n,i,s,r,o=t.window;;){if(t.lookahead<=ct){if(d(t),t.lookahead<=ct&&e===P)return vt;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=ut&&t.strstart>0&&(s=t.strstart-1,i=o[s],i===o[++s]&&i===o[++s]&&i===o[++s])){r=t.strstart+ct;do;while(i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&s<r);t.match_length=ct-(r-s),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=ut?(n=C._tr_tally(t,1,t.match_length-ut),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=C._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(a(t,!1),0===t.strm.avail_out))return vt}return t.insert=0,e===B?(a(t,!0),0===t.strm.avail_out?yt:At):t.last_lit&&(a(t,!1),0===t.strm.avail_out)?vt:bt}function _(t,e){for(var n;;){if(0===t.lookahead&&(d(t),0===t.lookahead)){if(e===P)return vt;break}if(t.match_length=0,n=C._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(a(t,!1),0===t.strm.avail_out))return vt}return t.insert=0,e===B?(a(t,!0),0===t.strm.avail_out?yt:At):t.last_lit&&(a(t,!1),0===t.strm.avail_out)?vt:bt}function E(t,e,n,i,s){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=i,this.func=s}function w(t){t.window_size=2*t.w_size,r(t.head),t.max_lazy_match=S[t.level].max_lazy,t.good_match=S[t.level].good_length,t.nice_match=S[t.level].nice_length,t.max_chain_length=S[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=ut-1,t.match_available=0,t.ins_h=0}function v(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=J,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new I.Buf16(2*at),this.dyn_dtree=new I.Buf16(2*(2*rt+1)),this.bl_tree=new I.Buf16(2*(2*ot+1)),r(this.dyn_ltree),r(this.dyn_dtree),r(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new I.Buf16(ht+1),this.heap=new I.Buf16(2*st+1),r(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new I.Buf16(2*st+1),r(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function b(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=X,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?ft:Et,t.adler=2===e.wrap?0:1,e.last_flush=P,C._tr_init(e),j):i(t,z)}function y(t){var e=b(t);return e===j&&w(t.state),e}function A(t,e){return t&&t.state?2!==t.state.wrap?z:(t.state.gzhead=e,j):z}function R(t,e,n,s,r,o){if(!t)return z;var a=1;if(e===W&&(e=6),s<0?(a=0,s=-s):s>15&&(a=2,s-=16),r<1||r>Q||n!==J||s<8||s>15||e<0||e>9||o<0||o>K)return i(t,z);8===s&&(s=9);var h=new v;return t.state=h,h.strm=t,h.wrap=a,h.gzhead=null,h.w_bits=s,h.w_size=1<<h.w_bits,h.w_mask=h.w_size-1,h.hash_bits=r+7,h.hash_size=1<<h.hash_bits,h.hash_mask=h.hash_size-1,h.hash_shift=~~((h.hash_bits+ut-1)/ut),h.window=new I.Buf8(2*h.w_size),h.head=new I.Buf16(h.hash_size),h.prev=new I.Buf16(h.w_size),h.lit_bufsize=1<<r+6,h.pending_buf_size=4*h.lit_bufsize,h.pending_buf=new I.Buf8(h.pending_buf_size),h.d_buf=1*h.lit_bufsize,h.l_buf=3*h.lit_bufsize,h.level=e,h.strategy=o,h.method=n,y(t)}function k(t,e){return R(t,e,J,tt,et,$)}function T(t,e){var n,a,c,l;if(!t||!t.state||e>G||e<0)return t?i(t,z):z;if(a=t.state,!t.output||!t.input&&0!==t.avail_in||a.status===wt&&e!==B)return i(t,0===t.avail_out?F:z);if(a.strm=t,n=a.last_flush,a.last_flush=e,a.status===ft)if(2===a.wrap)t.adler=0,h(a,31),h(a,139),h(a,8),a.gzhead?(h(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),h(a,255&a.gzhead.time),h(a,a.gzhead.time>>8&255),h(a,a.gzhead.time>>16&255),h(a,a.gzhead.time>>24&255),h(a,9===a.level?2:a.strategy>=V||a.level<2?4:0),h(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(h(a,255&a.gzhead.extra.length),h(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(t.adler=L(t.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=pt):(h(a,0),h(a,0),h(a,0),h(a,0),h(a,0),h(a,9===a.level?2:a.strategy>=V||a.level<2?4:0),h(a,Rt),a.status=Et);else{var d=J+(a.w_bits-8<<4)<<8,f=-1;f=a.strategy>=V||a.level<2?0:a.level<6?1:6===a.level?2:3,d|=f<<6,0!==a.strstart&&(d|=dt),d+=31-d%31,a.status=Et,
|
||
u(a,d),0!==a.strstart&&(u(a,t.adler>>>16),u(a,65535&t.adler)),t.adler=1}if(a.status===pt)if(a.gzhead.extra){for(c=a.pending;a.gzindex<(65535&a.gzhead.extra.length)&&(a.pending!==a.pending_buf_size||(a.gzhead.hcrc&&a.pending>c&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),o(t),c=a.pending,a.pending!==a.pending_buf_size));)h(a,255&a.gzhead.extra[a.gzindex]),a.gzindex++;a.gzhead.hcrc&&a.pending>c&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=mt)}else a.status=mt;if(a.status===mt)if(a.gzhead.name){c=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>c&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),o(t),c=a.pending,a.pending===a.pending_buf_size)){l=1;break}l=a.gzindex<a.gzhead.name.length?255&a.gzhead.name.charCodeAt(a.gzindex++):0,h(a,l)}while(0!==l);a.gzhead.hcrc&&a.pending>c&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),0===l&&(a.gzindex=0,a.status=gt)}else a.status=gt;if(a.status===gt)if(a.gzhead.comment){c=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>c&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),o(t),c=a.pending,a.pending===a.pending_buf_size)){l=1;break}l=a.gzindex<a.gzhead.comment.length?255&a.gzhead.comment.charCodeAt(a.gzindex++):0,h(a,l)}while(0!==l);a.gzhead.hcrc&&a.pending>c&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),0===l&&(a.status=_t)}else a.status=_t;if(a.status===_t&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&o(t),a.pending+2<=a.pending_buf_size&&(h(a,255&t.adler),h(a,t.adler>>8&255),t.adler=0,a.status=Et)):a.status=Et),0!==a.pending){if(o(t),0===t.avail_out)return a.last_flush=-1,j}else if(0===t.avail_in&&s(e)<=s(n)&&e!==B)return i(t,F);if(a.status===wt&&0!==t.avail_in)return i(t,F);if(0!==t.avail_in||0!==a.lookahead||e!==P&&a.status!==wt){var p=a.strategy===V?_(a,e):a.strategy===Z?g(a,e):S[a.level].func(a,e);if(p!==yt&&p!==At||(a.status=wt),p===vt||p===yt)return 0===t.avail_out&&(a.last_flush=-1),j;if(p===bt&&(e===N?C._tr_align(a):e!==G&&(C._tr_stored_block(a,0,0,!1),e===O&&(r(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),o(t),0===t.avail_out))return a.last_flush=-1,j}return e!==B?j:a.wrap<=0?q:(2===a.wrap?(h(a,255&t.adler),h(a,t.adler>>8&255),h(a,t.adler>>16&255),h(a,t.adler>>24&255),h(a,255&t.total_in),h(a,t.total_in>>8&255),h(a,t.total_in>>16&255),h(a,t.total_in>>24&255)):(u(a,t.adler>>>16),u(a,65535&t.adler)),o(t),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?j:q)}function D(t){var e;return t&&t.state?(e=t.state.status,e!==ft&&e!==pt&&e!==mt&&e!==gt&&e!==_t&&e!==Et&&e!==wt?i(t,z):(t.state=null,e===Et?i(t,H):j)):z}function M(t,e){var n,i,s,o,a,h,u,c,l=e.length;if(!t||!t.state)return z;if(n=t.state,o=n.wrap,2===o||1===o&&n.status!==ft||n.lookahead)return z;for(1===o&&(t.adler=x(t.adler,e,l,0)),n.wrap=0,l>=n.w_size&&(0===o&&(r(n.head),n.strstart=0,n.block_start=0,n.insert=0),c=new I.Buf8(n.w_size),I.arraySet(c,e,l-n.w_size,n.w_size,0),e=c,l=n.w_size),a=t.avail_in,h=t.next_in,u=t.input,t.avail_in=l,t.next_in=0,t.input=e,d(n);n.lookahead>=ut;){i=n.strstart,s=n.lookahead-(ut-1);do n.ins_h=(n.ins_h<<n.hash_shift^n.window[i+ut-1])&n.hash_mask,n.prev[i&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=i,i++;while(--s);n.strstart=i,n.lookahead=ut-1,d(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=ut-1,n.match_available=0,t.next_in=h,t.input=u,t.avail_in=a,n.wrap=o,j}var S,I=n(5),C=n(75),x=n(46),L=n(48),U=n(22),P=0,N=1,O=3,B=4,G=5,j=0,q=1,z=-2,H=-3,F=-5,W=-1,Y=1,V=2,Z=3,K=4,$=0,X=2,J=8,Q=9,tt=15,et=8,nt=29,it=256,st=it+1+nt,rt=30,ot=19,at=2*st+1,ht=15,ut=3,ct=258,lt=ct+ut+1,dt=32,ft=42,pt=69,mt=73,gt=91,_t=103,Et=113,wt=666,vt=1,bt=2,yt=3,At=4,Rt=3;S=[new E(0,0,0,0,f),new E(4,4,8,4,p),new E(4,5,16,8,p),new E(4,6,32,32,p),new E(4,4,16,16,m),new E(8,16,32,32,m),new E(8,16,128,128,m),new E(8,32,128,256,m),new E(32,128,258,1024,m),new E(32,258,258,4096,m)],e.deflateInit=k,e.deflateInit2=R,e.deflateReset=y,e.deflateResetKeep=b,e.deflateSetHeader=A,e.deflate=T,e.deflateEnd=D,e.deflateSetDictionary=M,e.deflateInfo="pako deflate (from Nodeca project)"},function(t,e){"use strict";function n(){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}t.exports=n},function(t,e){"use strict";var n=30,i=12;t.exports=function(t,e){var s,r,o,a,h,u,c,l,d,f,p,m,g,_,E,w,v,b,y,A,R,k,T,D,M;s=t.state,r=t.next_in,D=t.input,o=r+(t.avail_in-5),a=t.next_out,M=t.output,h=a-(e-t.avail_out),u=a+(t.avail_out-257),c=s.dmax,l=s.wsize,d=s.whave,f=s.wnext,p=s.window,m=s.hold,g=s.bits,_=s.lencode,E=s.distcode,w=(1<<s.lenbits)-1,v=(1<<s.distbits)-1;t:do{g<15&&(m+=D[r++]<<g,g+=8,m+=D[r++]<<g,g+=8),b=_[m&w];e:for(;;){if(y=b>>>24,m>>>=y,g-=y,y=b>>>16&255,0===y)M[a++]=65535&b;else{if(!(16&y)){if(0===(64&y)){b=_[(65535&b)+(m&(1<<y)-1)];continue e}if(32&y){s.mode=i;break t}t.msg="invalid literal/length code",s.mode=n;break t}A=65535&b,y&=15,y&&(g<y&&(m+=D[r++]<<g,g+=8),A+=m&(1<<y)-1,m>>>=y,g-=y),g<15&&(m+=D[r++]<<g,g+=8,m+=D[r++]<<g,g+=8),b=E[m&v];n:for(;;){if(y=b>>>24,m>>>=y,g-=y,y=b>>>16&255,!(16&y)){if(0===(64&y)){b=E[(65535&b)+(m&(1<<y)-1)];continue n}t.msg="invalid distance code",s.mode=n;break t}if(R=65535&b,y&=15,g<y&&(m+=D[r++]<<g,g+=8,g<y&&(m+=D[r++]<<g,g+=8)),R+=m&(1<<y)-1,R>c){t.msg="invalid distance too far back",s.mode=n;break t}if(m>>>=y,g-=y,y=a-h,R>y){if(y=R-y,y>d&&s.sane){t.msg="invalid distance too far back",s.mode=n;break t}if(k=0,T=p,0===f){if(k+=l-y,y<A){A-=y;do M[a++]=p[k++];while(--y);k=a-R,T=M}}else if(f<y){if(k+=l+f-y,y-=f,y<A){A-=y;do M[a++]=p[k++];while(--y);if(k=0,f<A){y=f,A-=y;do M[a++]=p[k++];while(--y);k=a-R,T=M}}}else if(k+=f-y,y<A){A-=y;do M[a++]=p[k++];while(--y);k=a-R,T=M}for(;A>2;)M[a++]=T[k++],M[a++]=T[k++],M[a++]=T[k++],A-=3;A&&(M[a++]=T[k++],A>1&&(M[a++]=T[k++]))}else{k=a-R;do M[a++]=M[k++],M[a++]=M[k++],M[a++]=M[k++],A-=3;while(A>2);A&&(M[a++]=M[k++],A>1&&(M[a++]=M[k++]))}break}}break}}while(r<o&&a<u);A=g>>3,r-=A,g-=A<<3,m&=(1<<g)-1,t.next_in=r,t.next_out=a,t.avail_in=r<o?5+(o-r):5-(r-o),t.avail_out=a<u?257+(u-a):257-(a-u),s.hold=m,s.bits=g}},function(t,e,n){"use strict";function i(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function s(){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 E.Buf16(320),this.work=new E.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function r(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=O,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new E.Buf32(mt),e.distcode=e.distdyn=new E.Buf32(gt),e.sane=1,e.back=-1,S):x}function o(t){var e;return t&&t.state?(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,r(t)):x}function a(t,e){var n,i;return t&&t.state?(i=t.state,e<0?(n=0,e=-e):(n=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15)?x:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=n,i.wbits=e,o(t))):x}function h(t,e){var n,i;return t?(i=new s,t.state=i,i.window=null,n=a(t,e),n!==S&&(t.state=null),n):x}function u(t){return h(t,Et)}function c(t){if(wt){var e;for(g=new E.Buf32(512),_=new E.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(y(R,t.lens,0,288,g,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;y(k,t.lens,0,32,_,0,t.work,{bits:5}),wt=!1}t.lencode=g,t.lenbits=9,t.distcode=_,t.distbits=5}function l(t,e,n,i){var s,r=t.state;return null===r.window&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0,r.window=new E.Buf8(r.wsize)),i>=r.wsize?(E.arraySet(r.window,e,n-r.wsize,r.wsize,0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>i&&(s=i),E.arraySet(r.window,e,n-i,s,r.wnext),i-=s,i?(E.arraySet(r.window,e,n-i,i,0),r.wnext=i,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=s))),0}function d(t,e){var n,s,r,o,a,h,u,d,f,p,m,g,_,mt,gt,_t,Et,wt,vt,bt,yt,At,Rt,kt,Tt=0,Dt=new E.Buf8(4),Mt=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return x;n=t.state,n.mode===Z&&(n.mode=K),a=t.next_out,r=t.output,u=t.avail_out,o=t.next_in,s=t.input,h=t.avail_in,d=n.hold,f=n.bits,p=h,m=u,At=S;t:for(;;)switch(n.mode){case O:if(0===n.wrap){n.mode=K;break}for(;f<16;){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}if(2&n.wrap&&35615===d){n.check=0,Dt[0]=255&d,Dt[1]=d>>>8&255,n.check=v(n.check,Dt,2,0),d=0,f=0,n.mode=B;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&d)<<8)+(d>>8))%31){t.msg="incorrect header check",n.mode=dt;break}if((15&d)!==N){t.msg="unknown compression method",n.mode=dt;break}if(d>>>=4,f-=4,yt=(15&d)+8,0===n.wbits)n.wbits=yt;else if(yt>n.wbits){t.msg="invalid window size",n.mode=dt;break}n.dmax=1<<yt,t.adler=n.check=1,n.mode=512&d?Y:Z,d=0,f=0;break;case B:for(;f<16;){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}if(n.flags=d,(255&n.flags)!==N){t.msg="unknown compression method",n.mode=dt;break}if(57344&n.flags){t.msg="unknown header flags set",n.mode=dt;break}n.head&&(n.head.text=d>>8&1),512&n.flags&&(Dt[0]=255&d,Dt[1]=d>>>8&255,n.check=v(n.check,Dt,2,0)),d=0,f=0,n.mode=G;case G:for(;f<32;){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}n.head&&(n.head.time=d),512&n.flags&&(Dt[0]=255&d,Dt[1]=d>>>8&255,Dt[2]=d>>>16&255,Dt[3]=d>>>24&255,n.check=v(n.check,Dt,4,0)),d=0,f=0,n.mode=j;case j:for(;f<16;){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}n.head&&(n.head.xflags=255&d,n.head.os=d>>8),512&n.flags&&(Dt[0]=255&d,Dt[1]=d>>>8&255,n.check=v(n.check,Dt,2,0)),d=0,f=0,n.mode=q;case q:if(1024&n.flags){for(;f<16;){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}n.length=d,n.head&&(n.head.extra_len=d),512&n.flags&&(Dt[0]=255&d,Dt[1]=d>>>8&255,n.check=v(n.check,Dt,2,0)),d=0,f=0}else n.head&&(n.head.extra=null);n.mode=z;case z:if(1024&n.flags&&(g=n.length,g>h&&(g=h),g&&(n.head&&(yt=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),E.arraySet(n.head.extra,s,o,g,yt)),512&n.flags&&(n.check=v(n.check,s,g,o)),h-=g,o+=g,n.length-=g),n.length))break t;n.length=0,n.mode=H;case H:if(2048&n.flags){if(0===h)break t;g=0;do yt=s[o+g++],n.head&&yt&&n.length<65536&&(n.head.name+=String.fromCharCode(yt));while(yt&&g<h);if(512&n.flags&&(n.check=v(n.check,s,g,o)),h-=g,o+=g,yt)break t}else n.head&&(n.head.name=null);n.length=0,n.mode=F;case F:if(4096&n.flags){if(0===h)break t;g=0;do yt=s[o+g++],n.head&&yt&&n.length<65536&&(n.head.comment+=String.fromCharCode(yt));while(yt&&g<h);if(512&n.flags&&(n.check=v(n.check,s,g,o)),h-=g,o+=g,yt)break t}else n.head&&(n.head.comment=null);n.mode=W;case W:if(512&n.flags){for(;f<16;){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}if(d!==(65535&n.check)){t.msg="header crc mismatch",n.mode=dt;break}d=0,f=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=Z;break;case Y:for(;f<32;){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}t.adler=n.check=i(d),d=0,f=0,n.mode=V;case V:if(0===n.havedict)return t.next_out=a,t.avail_out=u,t.next_in=o,t.avail_in=h,n.hold=d,n.bits=f,C;t.adler=n.check=1,n.mode=Z;case Z:if(e===D||e===M)break t;case K:if(n.last){d>>>=7&f,f-=7&f,n.mode=ut;break}for(;f<3;){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}switch(n.last=1&d,d>>>=1,f-=1,3&d){case 0:n.mode=$;break;case 1:if(c(n),n.mode=nt,e===M){d>>>=2,f-=2;break t}break;case 2:n.mode=Q;break;case 3:t.msg="invalid block type",n.mode=dt}d>>>=2,f-=2;break;case $:for(d>>>=7&f,f-=7&f;f<32;){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}if((65535&d)!==(d>>>16^65535)){t.msg="invalid stored block lengths",n.mode=dt;break}if(n.length=65535&d,d=0,f=0,n.mode=X,e===M)break t;case X:n.mode=J;case J:if(g=n.length){if(g>h&&(g=h),g>u&&(g=u),0===g)break t;E.arraySet(r,s,o,g,a),h-=g,o+=g,u-=g,a+=g,n.length-=g;break}n.mode=Z;break;case Q:for(;f<14;){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}if(n.nlen=(31&d)+257,d>>>=5,f-=5,n.ndist=(31&d)+1,d>>>=5,f-=5,n.ncode=(15&d)+4,d>>>=4,f-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=dt;break}n.have=0,n.mode=tt;case tt:for(;n.have<n.ncode;){for(;f<3;){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}n.lens[Mt[n.have++]]=7&d,d>>>=3,f-=3}for(;n.have<19;)n.lens[Mt[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,Rt={bits:n.lenbits},At=y(A,n.lens,0,19,n.lencode,0,n.work,Rt),n.lenbits=Rt.bits,At){t.msg="invalid code lengths set",n.mode=dt;break}n.have=0,n.mode=et;case et:for(;n.have<n.nlen+n.ndist;){for(;Tt=n.lencode[d&(1<<n.lenbits)-1],gt=Tt>>>24,_t=Tt>>>16&255,Et=65535&Tt,!(gt<=f);){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}if(Et<16)d>>>=gt,f-=gt,n.lens[n.have++]=Et;else{if(16===Et){for(kt=gt+2;f<kt;){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}if(d>>>=gt,f-=gt,0===n.have){t.msg="invalid bit length repeat",n.mode=dt;break}yt=n.lens[n.have-1],g=3+(3&d),d>>>=2,f-=2}else if(17===Et){for(kt=gt+3;f<kt;){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}d>>>=gt,f-=gt,yt=0,g=3+(7&d),d>>>=3,f-=3}else{for(kt=gt+7;f<kt;){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}d>>>=gt,f-=gt,yt=0,g=11+(127&d),d>>>=7,f-=7}if(n.have+g>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=dt;break}for(;g--;)n.lens[n.have++]=yt}}if(n.mode===dt)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=dt;break}if(n.lenbits=9,Rt={bits:n.lenbits},At=y(R,n.lens,0,n.nlen,n.lencode,0,n.work,Rt),n.lenbits=Rt.bits,At){t.msg="invalid literal/lengths set",n.mode=dt;break}if(n.distbits=6,n.distcode=n.distdyn,Rt={bits:n.distbits},At=y(k,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,Rt),n.distbits=Rt.bits,At){t.msg="invalid distances set",n.mode=dt;break}if(n.mode=nt,e===M)break t;case nt:n.mode=it;case it:if(h>=6&&u>=258){t.next_out=a,t.avail_out=u,t.next_in=o,t.avail_in=h,n.hold=d,n.bits=f,b(t,m),a=t.next_out,r=t.output,u=t.avail_out,o=t.next_in,s=t.input,h=t.avail_in,d=n.hold,f=n.bits,n.mode===Z&&(n.back=-1);break}for(n.back=0;Tt=n.lencode[d&(1<<n.lenbits)-1],gt=Tt>>>24,_t=Tt>>>16&255,Et=65535&Tt,!(gt<=f);){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}if(_t&&0===(240&_t)){for(wt=gt,vt=_t,bt=Et;Tt=n.lencode[bt+((d&(1<<wt+vt)-1)>>wt)],gt=Tt>>>24,_t=Tt>>>16&255,Et=65535&Tt,!(wt+gt<=f);){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}d>>>=wt,f-=wt,n.back+=wt}if(d>>>=gt,f-=gt,n.back+=gt,n.length=Et,0===_t){n.mode=ht;break}if(32&_t){n.back=-1,n.mode=Z;break}if(64&_t){t.msg="invalid literal/length code",n.mode=dt;break}n.extra=15&_t,n.mode=st;case st:if(n.extra){for(kt=n.extra;f<kt;){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}n.length+=d&(1<<n.extra)-1,d>>>=n.extra,f-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=rt;case rt:for(;Tt=n.distcode[d&(1<<n.distbits)-1],gt=Tt>>>24,_t=Tt>>>16&255,Et=65535&Tt,!(gt<=f);){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}if(0===(240&_t)){for(wt=gt,vt=_t,bt=Et;Tt=n.distcode[bt+((d&(1<<wt+vt)-1)>>wt)],gt=Tt>>>24,_t=Tt>>>16&255,Et=65535&Tt,!(wt+gt<=f);){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}d>>>=wt,f-=wt,n.back+=wt}if(d>>>=gt,f-=gt,n.back+=gt,64&_t){t.msg="invalid distance code",n.mode=dt;break}n.offset=Et,n.extra=15&_t,n.mode=ot;case ot:if(n.extra){for(kt=n.extra;f<kt;){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}n.offset+=d&(1<<n.extra)-1,d>>>=n.extra,f-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=dt;break}n.mode=at;case at:if(0===u)break t;if(g=m-u,n.offset>g){if(g=n.offset-g,g>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=dt;break}g>n.wnext?(g-=n.wnext,_=n.wsize-g):_=n.wnext-g,g>n.length&&(g=n.length),mt=n.window}else mt=r,_=a-n.offset,g=n.length;g>u&&(g=u),u-=g,n.length-=g;do r[a++]=mt[_++];while(--g);0===n.length&&(n.mode=it);break;case ht:if(0===u)break t;r[a++]=n.length,u--,n.mode=it;break;case ut:if(n.wrap){for(;f<32;){if(0===h)break t;h--,d|=s[o++]<<f,f+=8}if(m-=u,t.total_out+=m,n.total+=m,m&&(t.adler=n.check=n.flags?v(n.check,r,m,a-m):w(n.check,r,m,a-m)),m=u,(n.flags?d:i(d))!==n.check){t.msg="incorrect data check",n.mode=dt;break}d=0,f=0}n.mode=ct;case ct:if(n.wrap&&n.flags){for(;f<32;){if(0===h)break t;h--,d+=s[o++]<<f,f+=8}if(d!==(4294967295&n.total)){t.msg="incorrect length check",n.mode=dt;break}d=0,f=0}n.mode=lt;case lt:At=I;break t;case dt:At=L;break t;case ft:return U;case pt:default:return x}return t.next_out=a,t.avail_out=u,t.next_in=o,t.avail_in=h,n.hold=d,n.bits=f,(n.wsize||m!==t.avail_out&&n.mode<dt&&(n.mode<ut||e!==T))&&l(t,t.output,t.next_out,m-t.avail_out)?(n.mode=ft,U):(p-=t.avail_in,m-=t.avail_out,t.total_in+=p,t.total_out+=m,n.total+=m,n.wrap&&m&&(t.adler=n.check=n.flags?v(n.check,r,m,t.next_out-m):w(n.check,r,m,t.next_out-m)),t.data_type=n.bits+(n.last?64:0)+(n.mode===Z?128:0)+(n.mode===nt||n.mode===X?256:0),(0===p&&0===m||e===T)&&At===S&&(At=P),At)}function f(t){if(!t||!t.state)return x;var e=t.state;return e.window&&(e.window=null),t.state=null,S}function p(t,e){var n;return t&&t.state?(n=t.state,0===(2&n.wrap)?x:(n.head=e,e.done=!1,S)):x}function m(t,e){var n,i,s,r=e.length;return t&&t.state?(n=t.state,0!==n.wrap&&n.mode!==V?x:n.mode===V&&(i=1,i=w(i,e,r,0),i!==n.check)?L:(s=l(t,e,r,r))?(n.mode=ft,U):(n.havedict=1,S)):x}var g,_,E=n(5),w=n(46),v=n(48),b=n(72),y=n(74),A=0,R=1,k=2,T=4,D=5,M=6,S=0,I=1,C=2,x=-2,L=-3,U=-4,P=-5,N=8,O=1,B=2,G=3,j=4,q=5,z=6,H=7,F=8,W=9,Y=10,V=11,Z=12,K=13,$=14,X=15,J=16,Q=17,tt=18,et=19,nt=20,it=21,st=22,rt=23,ot=24,at=25,ht=26,ut=27,ct=28,lt=29,dt=30,ft=31,pt=32,mt=852,gt=592,_t=15,Et=_t,wt=!0;e.inflateReset=o,e.inflateReset2=a,e.inflateResetKeep=r,e.inflateInit=u,e.inflateInit2=h,e.inflate=d,e.inflateEnd=f,e.inflateGetHeader=p,e.inflateSetDictionary=m,e.inflateInfo="pako inflate (from Nodeca project)"},function(t,e,n){"use strict";var i=n(5),s=15,r=852,o=592,a=0,h=1,u=2,c=[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],l=[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],d=[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],f=[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(t,e,n,p,m,g,_,E){var w,v,b,y,A,R,k,T,D,M=E.bits,S=0,I=0,C=0,x=0,L=0,U=0,P=0,N=0,O=0,B=0,G=null,j=0,q=new i.Buf16(s+1),z=new i.Buf16(s+1),H=null,F=0;for(S=0;S<=s;S++)q[S]=0;for(I=0;I<p;I++)q[e[n+I]]++;for(L=M,x=s;x>=1&&0===q[x];x--);if(L>x&&(L=x),0===x)return m[g++]=20971520,m[g++]=20971520,E.bits=1,0;for(C=1;C<x&&0===q[C];C++);for(L<C&&(L=C),N=1,S=1;S<=s;S++)if(N<<=1,N-=q[S],N<0)return-1;if(N>0&&(t===a||1!==x))return-1;for(z[1]=0,S=1;S<s;S++)z[S+1]=z[S]+q[S];for(I=0;I<p;I++)0!==e[n+I]&&(_[z[e[n+I]]++]=I);if(t===a?(G=H=_,R=19):t===h?(G=c,j-=257,H=l,F-=257,R=256):(G=d,H=f,R=-1),B=0,I=0,S=C,A=g,U=L,P=0,b=-1,O=1<<L,y=O-1,t===h&&O>r||t===u&&O>o)return 1;for(var W=0;;){W++,k=S-P,_[I]<R?(T=0,D=_[I]):_[I]>R?(T=H[F+_[I]],D=G[j+_[I]]):(T=96,D=0),w=1<<S-P,v=1<<U,C=v;do v-=w,m[A+(B>>P)+v]=k<<24|T<<16|D|0;while(0!==v);for(w=1<<S-1;B&w;)w>>=1;if(0!==w?(B&=w-1,B+=w):B=0,I++,0===--q[S]){if(S===x)break;S=e[n+_[I]]}if(S>L&&(B&y)!==b){for(0===P&&(P=L),A+=C,U=S-P,N=1<<U;U+P<x&&(N-=q[U+P],!(N<=0));)U++,N<<=1;if(O+=1<<U,t===h&&O>r||t===u&&O>o)return 1;b=B&y,m[b]=L<<24|U<<16|A-g|0}}return 0!==B&&(m[A+B]=S-P<<24|64<<16|0),E.bits=L,0}},function(t,e,n){"use strict";function i(t){for(var e=t.length;--e>=0;)t[e]=0}function s(t,e,n,i,s){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=i,this.max_length=s,this.has_stree=t&&t.length}function r(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function o(t){return t<256?ht[t]:ht[256+(t>>>7)]}function a(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function h(t,e,n){t.bi_valid>K-n?(t.bi_buf|=e<<t.bi_valid&65535,a(t,t.bi_buf),t.bi_buf=e>>K-t.bi_valid,t.bi_valid+=n-K):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=n)}function u(t,e,n){h(t,n[2*e],n[2*e+1])}function c(t,e){var n=0;do n|=1&t,t>>>=1,n<<=1;while(--e>0);return n>>>1}function l(t){16===t.bi_valid?(a(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}function d(t,e){var n,i,s,r,o,a,h=e.dyn_tree,u=e.max_code,c=e.stat_desc.static_tree,l=e.stat_desc.has_stree,d=e.stat_desc.extra_bits,f=e.stat_desc.extra_base,p=e.stat_desc.max_length,m=0;for(r=0;r<=Z;r++)t.bl_count[r]=0;for(h[2*t.heap[t.heap_max]+1]=0,n=t.heap_max+1;n<V;n++)i=t.heap[n],r=h[2*h[2*i+1]+1]+1,r>p&&(r=p,m++),h[2*i+1]=r,i>u||(t.bl_count[r]++,o=0,i>=f&&(o=d[i-f]),a=h[2*i],t.opt_len+=a*(r+o),l&&(t.static_len+=a*(c[2*i+1]+o)));if(0!==m){do{for(r=p-1;0===t.bl_count[r];)r--;t.bl_count[r]--,t.bl_count[r+1]+=2,t.bl_count[p]--,m-=2}while(m>0);for(r=p;0!==r;r--)for(i=t.bl_count[r];0!==i;)s=t.heap[--n],s>u||(h[2*s+1]!==r&&(t.opt_len+=(r-h[2*s+1])*h[2*s],h[2*s+1]=r),i--)}}function f(t,e,n){var i,s,r=new Array(Z+1),o=0;for(i=1;i<=Z;i++)r[i]=o=o+n[i-1]<<1;for(s=0;s<=e;s++){var a=t[2*s+1];0!==a&&(t[2*s]=c(r[a]++,a))}}function p(){var t,e,n,i,r,o=new Array(Z+1);for(n=0,i=0;i<z-1;i++)for(ct[i]=n,t=0;t<1<<et[i];t++)ut[n++]=i;for(ut[n-1]=i,r=0,i=0;i<16;i++)for(lt[i]=r,t=0;t<1<<nt[i];t++)ht[r++]=i;for(r>>=7;i<W;i++)for(lt[i]=r<<7,t=0;t<1<<nt[i]-7;t++)ht[256+r++]=i;for(e=0;e<=Z;e++)o[e]=0;for(t=0;t<=143;)ot[2*t+1]=8,t++,o[8]++;for(;t<=255;)ot[2*t+1]=9,t++,o[9]++;for(;t<=279;)ot[2*t+1]=7,t++,o[7]++;for(;t<=287;)ot[2*t+1]=8,t++,o[8]++;for(f(ot,F+1,o),t=0;t<W;t++)at[2*t+1]=5,at[2*t]=c(t,5);dt=new s(ot,et,H+1,F,Z),ft=new s(at,nt,0,W,Z),pt=new s(new Array(0),it,0,Y,$)}function m(t){var e;for(e=0;e<F;e++)t.dyn_ltree[2*e]=0;for(e=0;e<W;e++)t.dyn_dtree[2*e]=0;for(e=0;e<Y;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*X]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function g(t){t.bi_valid>8?a(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function _(t,e,n,i){g(t),i&&(a(t,n),a(t,~n)),x.arraySet(t.pending_buf,t.window,e,n,t.pending),t.pending+=n}function E(t,e,n,i){var s=2*e,r=2*n;return t[s]<t[r]||t[s]===t[r]&&i[e]<=i[n]}function w(t,e,n){for(var i=t.heap[n],s=n<<1;s<=t.heap_len&&(s<t.heap_len&&E(e,t.heap[s+1],t.heap[s],t.depth)&&s++,!E(e,i,t.heap[s],t.depth));)t.heap[n]=t.heap[s],n=s,s<<=1;t.heap[n]=i}function v(t,e,n){var i,s,r,a,c=0;if(0!==t.last_lit)do i=t.pending_buf[t.d_buf+2*c]<<8|t.pending_buf[t.d_buf+2*c+1],s=t.pending_buf[t.l_buf+c],c++,0===i?u(t,s,e):(r=ut[s],u(t,r+H+1,e),a=et[r],0!==a&&(s-=ct[r],h(t,s,a)),i--,r=o(i),u(t,r,n),a=nt[r],0!==a&&(i-=lt[r],h(t,i,a)));while(c<t.last_lit);u(t,X,e)}function b(t,e){var n,i,s,r=e.dyn_tree,o=e.stat_desc.static_tree,a=e.stat_desc.has_stree,h=e.stat_desc.elems,u=-1;for(t.heap_len=0,t.heap_max=V,n=0;n<h;n++)0!==r[2*n]?(t.heap[++t.heap_len]=u=n,t.depth[n]=0):r[2*n+1]=0;for(;t.heap_len<2;)s=t.heap[++t.heap_len]=u<2?++u:0,r[2*s]=1,t.depth[s]=0,t.opt_len--,a&&(t.static_len-=o[2*s+1]);for(e.max_code=u,n=t.heap_len>>1;n>=1;n--)w(t,r,n);s=h;do n=t.heap[1],t.heap[1]=t.heap[t.heap_len--],w(t,r,1),i=t.heap[1],t.heap[--t.heap_max]=n,t.heap[--t.heap_max]=i,r[2*s]=r[2*n]+r[2*i],t.depth[s]=(t.depth[n]>=t.depth[i]?t.depth[n]:t.depth[i])+1,r[2*n+1]=r[2*i+1]=s,t.heap[1]=s++,w(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],d(t,e),f(r,u,t.bl_count)}function y(t,e,n){var i,s,r=-1,o=e[1],a=0,h=7,u=4;for(0===o&&(h=138,u=3),e[2*(n+1)+1]=65535,i=0;i<=n;i++)s=o,o=e[2*(i+1)+1],++a<h&&s===o||(a<u?t.bl_tree[2*s]+=a:0!==s?(s!==r&&t.bl_tree[2*s]++,t.bl_tree[2*J]++):a<=10?t.bl_tree[2*Q]++:t.bl_tree[2*tt]++,a=0,r=s,0===o?(h=138,u=3):s===o?(h=6,u=3):(h=7,u=4))}function A(t,e,n){var i,s,r=-1,o=e[1],a=0,c=7,l=4;for(0===o&&(c=138,l=3),i=0;i<=n;i++)if(s=o,o=e[2*(i+1)+1],!(++a<c&&s===o)){if(a<l){do u(t,s,t.bl_tree);while(0!==--a)}else 0!==s?(s!==r&&(u(t,s,t.bl_tree),a--),u(t,J,t.bl_tree),h(t,a-3,2)):a<=10?(u(t,Q,t.bl_tree),h(t,a-3,3)):(u(t,tt,t.bl_tree),h(t,a-11,7));a=0,r=s,0===o?(c=138,l=3):s===o?(c=6,l=3):(c=7,l=4)}}function R(t){var e;for(y(t,t.dyn_ltree,t.l_desc.max_code),y(t,t.dyn_dtree,t.d_desc.max_code),b(t,t.bl_desc),e=Y-1;e>=3&&0===t.bl_tree[2*st[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}function k(t,e,n,i){var s;for(h(t,e-257,5),h(t,n-1,5),h(t,i-4,4),s=0;s<i;s++)h(t,t.bl_tree[2*st[s]+1],3);A(t,t.dyn_ltree,e-1),A(t,t.dyn_dtree,n-1)}function T(t){var e,n=4093624447;for(e=0;e<=31;e++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return U;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return P;for(e=32;e<H;e++)if(0!==t.dyn_ltree[2*e])return P;return U}function D(t){mt||(p(),mt=!0),t.l_desc=new r(t.dyn_ltree,dt),t.d_desc=new r(t.dyn_dtree,ft),t.bl_desc=new r(t.bl_tree,pt),t.bi_buf=0,t.bi_valid=0,m(t)}function M(t,e,n,i){h(t,(O<<1)+(i?1:0),3),_(t,e,n,!0)}function S(t){h(t,B<<1,3),u(t,X,ot),l(t)}function I(t,e,n,i){var s,r,o=0;t.level>0?(t.strm.data_type===N&&(t.strm.data_type=T(t)),b(t,t.l_desc),b(t,t.d_desc),o=R(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=n+5,n+4<=s&&e!==-1?M(t,e,n,i):t.strategy===L||r===s?(h(t,(B<<1)+(i?1:0),3),v(t,ot,at)):(h(t,(G<<1)+(i?1:0),3),k(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),v(t,t.dyn_ltree,t.dyn_dtree)),m(t),i&&g(t)}function C(t,e,n){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&n,t.last_lit++,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(ut[n]+H+1)]++,t.dyn_dtree[2*o(e)]++),t.last_lit===t.lit_bufsize-1}var x=n(5),L=4,U=0,P=1,N=2,O=0,B=1,G=2,j=3,q=258,z=29,H=256,F=H+1+z,W=30,Y=19,V=2*F+1,Z=15,K=16,$=7,X=256,J=16,Q=17,tt=18,et=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],nt=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],it=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],st=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],rt=512,ot=new Array(2*(F+2));i(ot);var at=new Array(2*W);i(at);var ht=new Array(rt);i(ht);var ut=new Array(q-j+1);i(ut);var ct=new Array(z);i(ct);var lt=new Array(W);i(lt);var dt,ft,pt,mt=!1;e._tr_init=D,e._tr_stored_block=M,e._tr_flush_block=I,e._tr_tally=C,e._tr_align=S},function(t,e,n){function i(t){var e=s(t)?Object.prototype.toString.call(t):"";return"[object Function]"===e}var s=n(26);t.exports=i},function(t,e,n){function i(t){if(t)return s(t)}function s(t){for(var e in i.prototype)t[e]=i.prototype[e];return t}var r=n(26);t.exports=i,i.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},i.prototype.parse=function(t){return this._parser=t,this},i.prototype.serialize=function(t){return this._serializer=t,this},i.prototype.timeout=function(t){return this._timeout=t,this},i.prototype.then=function(t,e){if(!this._fullfilledPromise){var n=this;this._fullfilledPromise=new Promise(function(t,e){n.end(function(n,i){n?e(n):t(i)})})}return this._fullfilledPromise.then(t,e)},i.prototype.catch=function(t){return this.then(void 0,t)},i.prototype.use=function(t){return t(this),this},i.prototype.get=function(t){return this._header[t.toLowerCase()]},i.prototype.getHeader=i.prototype.get,i.prototype.set=function(t,e){if(r(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},i.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},i.prototype.field=function(t,e){if(null===t||void 0===t)throw new Error(".field(name, val) name can not be empty");if(r(t)){for(var n in t)this.field(n,t[n]);return this}if(Array.isArray(e)){for(var i in e)this.field(t,e[i]);return this}if(null===e||void 0===e)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof e&&(e=""+e),this._getFormData().append(t,e),this},i.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},i.prototype.withCredentials=function(){return this._withCredentials=!0,this},i.prototype.redirects=function(t){return this._maxRedirects=t,this},i.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},i.prototype.send=function(t){var e=r(t),n=this._header["content-type"];if(e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(e&&r(this._data))for(var i in t)this._data[i]=t[i];else"string"==typeof t?(n||this.type("form"),n=this._header["content-type"],"application/x-www-form-urlencoded"==n?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(n||this.type("json"),this)},i.prototype.sortQuery=function(t){return this._sort="undefined"==typeof t||t,this}},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){const i=n(0),s=n(4),r=n(18),o=n(6),a=n(30),h=n(10),u=n(42),c=n(43),l=n(12),d=n(31);class f{constructor(t){this.client=t}get pastReady(){return this.client.ws.status===i.Status.READY}newGuild(t){const e=this.client.guilds.has(t.id),n=new r(this.client,t);return this.client.guilds.set(n.id,n),this.pastReady&&!e&&(this.client.options.fetchAllMembers?n.fetchMembers().then(()=>{this.client.emit(i.Events.GUILD_CREATE,n)}):this.client.emit(i.Events.GUILD_CREATE,n)),n}newUser(t){if(this.client.users.has(t.id))return this.client.users.get(t.id);const e=new o(this.client,t);return this.client.users.set(e.id,e),e}newChannel(t,e){const n=this.client.channels.has(t.id);let s;return t.type===i.ChannelTypes.DM?s=new a(this.client,t):t.type===i.ChannelTypes.groupDM?s=new d(this.client,t):(e=e||this.client.guilds.get(t.guild_id),e&&(t.type===i.ChannelTypes.text?(s=new u(e,t),e.channels.set(s.id,s)):t.type===i.ChannelTypes.voice&&(s=new c(e,t),e.channels.set(s.id,s)))),s?(this.pastReady&&!n&&this.client.emit(i.Events.CHANNEL_CREATE,s),this.client.channels.set(s.id,s),s):null}newEmoji(t,e){const n=e.emojis.has(t.id);if(t&&!n){let n=new h(e,t);return this.client.emit(i.Events.EMOJI_CREATE,n),e.emojis.set(n.id,n),n}return n?e.emojis.get(t.id):null}killEmoji(t){t instanceof h&&t.guild&&(this.client.emit(i.Events.EMOJI_DELETE,t),t.guild.emojis.delete(t.id))}killGuild(t){const e=this.client.guilds.has(t.id);this.client.guilds.delete(t.id),e&&this.pastReady&&this.client.emit(i.Events.GUILD_DELETE,t)}killUser(t){this.client.users.delete(t.id)}killChannel(t){this.client.channels.delete(t.id),t instanceof l&&t.guild.channels.delete(t.id)}updateGuild(t,e){const n=s(t);t.setup(e),this.pastReady&&this.client.emit(i.Events.GUILD_UPDATE,n,t)}updateChannel(t,e){t.setup(e)}updateEmoji(t,e){const n=s(t);t.setup(e),this.client.emit(i.Events.GUILD_EMOJI_UPDATE,n,t)}}t.exports=f},function(t,e,n){const i=n(0);class s{constructor(t){this.client=t,this.heartbeatInterval=null}connectToWebSocket(t,e,n){this.client.emit(i.Events.DEBUG,`Authenticated using token ${t}`),this.client.token=t;const s=this.client.setTimeout(()=>n(new Error(i.Errors.TOOK_TOO_LONG)),3e5);this.client.rest.methods.getGateway().then(r=>{this.client.emit(i.Events.DEBUG,`Using gateway ${r}`),this.client.ws.connect(r),this.client.ws.once("close",t=>{4004===t.code&&n(new Error(i.Errors.BAD_LOGIN)),4010===t.code&&n(new Error(i.Errors.INVALID_SHARD))}),this.client.once(i.Events.READY,()=>{e(t),this.client.clearTimeout(s)})},n)}setupKeepAlive(t){this.heartbeatInterval=this.client.setInterval(()=>{this.client.emit("debug","Sending heartbeat"),this.client._pingTimestamp=Date.now(),this.client.ws.send({op:i.OPCodes.HEARTBEAT,d:this.client.ws.sequence},!0)},t)}destroy(){return new Promise(t=>{this.client.ws.destroy(),this.client.user.bot?t():t(this.client.rest.methods.logout())})}}t.exports=s},function(t,e,n){class i{constructor(t){this.client=t,this.register(n(98)),this.register(n(99)),this.register(n(100)),this.register(n(104)),this.register(n(101)),this.register(n(102)),this.register(n(103)),this.register(n(82)),
|
||
this.register(n(83)),this.register(n(84)),this.register(n(86)),this.register(n(97)),this.register(n(90)),this.register(n(91)),this.register(n(85)),this.register(n(92)),this.register(n(93)),this.register(n(94)),this.register(n(105)),this.register(n(107)),this.register(n(106)),this.register(n(96)),this.register(n(87)),this.register(n(88)),this.register(n(89)),this.register(n(95))}register(t){this[t.name.replace(/Action$/,"")]=new t(this.client)}}t.exports=i},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client,n=e.dataManager.newChannel(t);return{channel:n}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client;let n=e.channels.get(t.id);return n?(e.dataManager.killChannel(n),this.deleted.set(n.id,n),this.scheduleForDeletion(n.id)):n=this.deleted.get(t.id)||null,{channel:n}}scheduleForDeletion(t){this.client.setTimeout(()=>this.deleted.delete(t),this.client.options.restWsBridgeTimeout)}}t.exports=s},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client,n=e.channels.get(t.id);if(n){const i=r(n);return n.setup(t),e.emit(s.Events.CHANNEL_UPDATE,i,n),{old:i,updated:n}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client,n=e.guilds.get(t.guild_id),i=e.dataManager.newUser(t.user);n&&i&&e.emit(s.Events.GUILD_BAN_REMOVE,n,i)}}t.exports=r},function(t,e,n){const i=n(2),s=n(0);class r extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client;let n=e.guilds.get(t.id);if(n){if(n.available&&t.unavailable)return n.available=!1,e.emit(s.Events.GUILD_UNAVAILABLE,n),{guild:null};e.guilds.delete(n.id),this.deleted.set(n.id,n),this.scheduleForDeletion(n.id)}else n=this.deleted.get(t.id)||null;return{guild:n}}scheduleForDeletion(t){this.client.setTimeout(()=>this.deleted.delete(t),this.client.options.restWsBridgeTimeout)}}t.exports=r},function(t,e,n){const i=n(2);class s extends i{handle(t,e){const n=this.client,i=n.dataManager.newEmoji(t,e);return{emoji:i}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client;return e.dataManager.killEmoji(t),{data:t}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{handle(t,e){const n=this.client;for(let i of t.emojis){const t=e.emojis.has(i.id);t?n.dataManager.updateEmoji(e.emojis.get(i.id),i):i=n.dataManager.newEmoji(i,e)}for(let i of e.emojis)t.emoijs.has(i.id)||n.dataManager.killEmoji(i);return{emojis:t.emojis}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{handle(t,e){const n=t._addMember(e,!1);return{member:n}}}t.exports=s},function(t,e,n){const i=n(2),s=n(0);class r extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n){let i=n.members.get(t.user.id);return i?(n.memberCount--,n._removeMember(i),this.deleted.set(n.id+t.user.id,i),e.status===s.Status.READY&&e.emit(s.Events.GUILD_MEMBER_REMOVE,i),this.scheduleForDeletion(n.id,t.user.id)):i=this.deleted.get(n.id+t.user.id)||null,{guild:n,member:i}}return{guild:n,member:null}}scheduleForDeletion(t,e){this.client.setTimeout(()=>this.deleted.delete(t+e),this.client.options.restWsBridgeTimeout)}}t.exports=r},function(t,e,n){const i=n(2),s=n(0),r=n(8);class o extends i{handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n){const i=n.roles.has(t.role.id),o=new r(n,t.role);return n.roles.set(o.id,o),i||e.emit(s.Events.GUILD_ROLE_CREATE,o),{role:o}}return{role:null}}}t.exports=o},function(t,e,n){const i=n(2),s=n(0);class r extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n){let i=n.roles.get(t.role_id);return i?(n.roles.delete(t.role_id),this.deleted.set(n.id+t.role_id,i),this.scheduleForDeletion(n.id,t.role_id),e.emit(s.Events.GUILD_ROLE_DELETE,i)):i=this.deleted.get(n.id+t.role_id)||null,{role:i}}return{role:null}}scheduleForDeletion(t,e){this.client.setTimeout(()=>this.deleted.delete(t+e),this.client.options.restWsBridgeTimeout)}}t.exports=r},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n){const i=t.role;let o=null;const a=n.roles.get(i.id);return a&&(o=r(a),a.setup(t.role),e.emit(s.Events.GUILD_ROLE_UPDATE,o,a)),{old:o,updated:a}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n)for(const i of t.roles){const t=n.roles.get(i.id);t&&(t.position=i.position)}return{guild:n}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client,n=e.guilds.get(t.id);if(n){t.presences=t.presences||[];for(const e of t.presences)n._setPresence(e.user.id,e);t.members=t.members||[];for(const i of t.members){const t=n.members.get(i.user.id);t?n._updateMember(t,i):n._addMember(i,!1)}}}}t.exports=s},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client,n=e.guilds.get(t.id);if(n){const i=r(n);return n.setup(t),e.emit(s.Events.GUILD_UPDATE,i,n),{old:i,updated:n}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){const i=n(2),s=n(14);class r extends i{handle(t){const e=this.client,n=e.channels.get((t instanceof Array?t[0]:t).channel_id),i=e.users.get((t instanceof Array?t[0]:t).author.id);if(n){const r=n.guild?n.guild.member(i):null;if(t instanceof Array){const o=new Array(t.length);for(let a=0;a<t.length;a++)o[a]=n._cacheMessage(new s(n,t[a],e));return n.lastMessageID=o[o.length-1].id,i&&(i.lastMessageID=o[o.length-1].id),r&&(r.lastMessageID=o[o.length-1].id),{messages:o}}{const o=n._cacheMessage(new s(n,t,e));return n.lastMessageID=t.id,i&&(i.lastMessageID=t.id),r&&(r.lastMessageID=t.id),{message:o}}}return{message:null}}}t.exports=r},function(t,e,n){const i=n(2);class s extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client,n=e.channels.get(t.channel_id);if(n){let e=n.messages.get(t.id);return e?(n.messages.delete(e.id),this.deleted.set(n.id+e.id,e),this.scheduleForDeletion(n.id,e.id)):e=this.deleted.get(n.id+t.id)||null,{message:e}}return{message:null}}scheduleForDeletion(t,e){this.client.setTimeout(()=>this.deleted.delete(t+e),this.client.options.restWsBridgeTimeout)}}t.exports=s},function(t,e,n){const i=n(2),s=n(3),r=n(0);class o extends i{handle(t){const e=this.client,n=e.channels.get(t.channel_id),i=t.ids,o=new s;for(const a of i){const t=n.messages.get(a);t&&o.set(t.id,t)}return o.size>0&&e.emit(r.Events.MESSAGE_BULK_DELETE,o),{messages:o}}}t.exports=o},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client.users.get(t.user_id);if(!e)return!1;const n=this.client.channels.get(t.channel_id);if(!n||"voice"===n.type)return!1;const i=n.messages.get(t.message_id);if(!i)return!1;if(!t.emoji)return!1;const r=i._addReaction(t.emoji,e);return r&&this.client.emit(s.Events.MESSAGE_REACTION_ADD,r,e),{message:i,reaction:r,user:e}}}t.exports=r},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client.users.get(t.user_id);if(!e)return!1;const n=this.client.channels.get(t.channel_id);if(!n||"voice"===n.type)return!1;const i=n.messages.get(t.message_id);if(!i)return!1;if(!t.emoji)return!1;const r=i._removeReaction(t.emoji,e);return r&&this.client.emit(s.Events.MESSAGE_REACTION_REMOVE,r,e),{message:i,reaction:r,user:e}}}t.exports=r},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client.channels.get(t.channel_id);if(!e||"voice"===e.type)return!1;const n=e.messages.get(t.message_id);return!!n&&(n._clearReactions(),this.client.emit(s.Events.MESSAGE_REACTION_REMOVE_ALL,n),{message:n})}}t.exports=r},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client,n=e.channels.get(t.channel_id);if(n){const i=n.messages.get(t.id);if(i){const n=r(i);return i.patch(t),i._edits.unshift(n),e.emit(s.Events.MESSAGE_UPDATE,n,i),{old:n,updated:i}}return{old:i,updated:i}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client,n=e.dataManager.newUser(t);return{user:n}}}t.exports=s},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client,n=e.user.notes.get(t.id),i=t.note.length?t.note:null;return e.user.notes.set(t.id,i),e.emit(s.Events.USER_NOTE_UPDATE,t.id,n,i),{old:n,updated:i}}}t.exports=r},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client;if(e.user){if(e.user.equals(t))return{old:e.user,updated:e.user};const n=r(e.user);return e.user.patch(t),e.emit(s.Events.USER_UPDATE,n,e.user),{old:n,updated:e.user}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){function i(t){let e=t.split("?")[0];if(e.includes("/channels/")||e.includes("/guilds/")){const t=~e.indexOf("/channels/")?e.indexOf("/channels/"):e.indexOf("/guilds/"),n=e.substring(t).split("/")[2];e=e.replace(/(\d{8,})/g,":id").replace(":id",n)}return e}const s=n(25),r=n(0);class o{constructor(t,e,n,s,r,o){this.rest=t,this.method=e,this.url=n,this.auth=s,this.data=r,this.file=o,this.route=i(this.url)}getAuth(){if(this.rest.client.token&&this.rest.client.user&&this.rest.client.user.bot)return`Bot ${this.rest.client.token}`;if(this.rest.client.token)return this.rest.client.token;throw new Error(r.Errors.NO_TOKEN)}gen(){const t=s[this.method](this.url);if(this.auth&&t.set("authorization",this.getAuth()),this.file&&this.file.file){t.attach("file",this.file.file,this.file.name),this.data=this.data||{};for(const e in this.data)this.data[e]&&t.field(e,this.data[e])}else this.data&&t.send(this.data);return this.rest.client.browser||t.set("User-Agent",this.rest.userAgentManager.userAgent),t}}t.exports=o},function(t,e,n){const i=n(0),s=n(3),r=n(44),o=n(151),a=n(6),h=n(13),u=n(8),c=n(32),l=n(20),d=n(149),f=n(28);class p{constructor(t){this.rest=t}login(t=this.rest.client.token){return new Promise((e,n)=>{t=t.replace(/^Bot\s*/i,""),this.rest.client.manager.connectToWebSocket(t,e,n)})}logout(){return this.rest.makeRequest("post",i.Endpoints.logout,!0,{})}getGateway(){return this.rest.makeRequest("get",i.Endpoints.gateway,!0).then(t=>{return this.rest.client.ws.gateway=`${t.url}/?v=${i.PROTOCOL_VERSION}`,this.rest.client.ws.gateway})}getBotGateway(){return this.rest.makeRequest("get",i.Endpoints.botGateway,!0)}sendMessage(t,e,{tts,nonce,embed,disableEveryone,split}={},n=null){return new Promise((i,s)=>{"undefined"!=typeof e&&(e=this.rest.client.resolver.resolveString(e)),e&&((disableEveryone||"undefined"==typeof disableEveryone&&this.rest.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@$1")),split&&(e=r(e,"object"==typeof split?split:{}))),t instanceof a||t instanceof h?this.createDM(t).then(t=>{this._sendMessageRequest(t,e,n,tts,nonce,embed,i,s)},s):this._sendMessageRequest(t,e,n,tts,nonce,embed,i,s)})}_sendMessageRequest(t,e,n,s,r,o,a,h){if(e instanceof Array){const u=[];let c=this.rest.makeRequest("post",i.Endpoints.channelMessages(t.id),!0,{content:e[0],tts:s,nonce:r},n).catch(h);for(let l=1;l<=e.length;l++)if(l<e.length){const a=l;c=c.then(h=>{return u.push(h),this.rest.makeRequest("post",i.Endpoints.channelMessages(t.id),!0,{content:e[a],tts:s,nonce:r,embed:o},n)},h)}else c.then(t=>{u.push(t),a(this.rest.client.actions.MessageCreate.handle(u).messages)},h)}else this.rest.makeRequest("post",i.Endpoints.channelMessages(t.id),!0,{content:e,tts:s,nonce:r,embed:o},n).then(t=>a(this.rest.client.actions.MessageCreate.handle(t).message),h)}deleteMessage(t){return this.rest.makeRequest("del",i.Endpoints.channelMessage(t.channel.id,t.id),!0).then(()=>this.rest.client.actions.MessageDelete.handle({id:t.id,channel_id:t.channel.id}).message)}bulkDeleteMessages(t,e){return this.rest.makeRequest("post",`${i.Endpoints.channelMessages(t.id)}/bulk_delete`,!0,{messages:e}).then(()=>this.rest.client.actions.MessageDeleteBulk.handle({channel_id:t.id,ids:e}).messages)}updateMessage(t,e,{embed}={}){return e=this.rest.client.resolver.resolveString(e),this.rest.makeRequest("patch",i.Endpoints.channelMessage(t.channel.id,t.id),!0,{content:e,embed:embed}).then(t=>this.rest.client.actions.MessageUpdate.handle(t).updated)}createChannel(t,e,n,r){return r instanceof s&&(r=r.array()),this.rest.makeRequest("post",i.Endpoints.guildChannels(t.id),!0,{name:e,type:n,permission_overwrites:r}).then(t=>this.rest.client.actions.ChannelCreate.handle(t).channel)}createDM(t){const e=this.getExistingDM(t);return e?Promise.resolve(e):this.rest.makeRequest("post",i.Endpoints.userChannels(this.rest.client.user.id),!0,{recipient_id:t.id}).then(t=>this.rest.client.actions.ChannelCreate.handle(t).channel)}getExistingDM(t){return this.rest.client.channels.find(e=>e.recipient&&e.recipient.id===t.id)}deleteChannel(t){return(t instanceof a||t instanceof h)&&(t=this.getExistingDM(t)),t?this.rest.makeRequest("del",i.Endpoints.channel(t.id),!0).then(e=>{return e.id=t.id,this.rest.client.actions.ChannelDelete.handle(e).channel}):Promise.reject(new Error("No channel to delete."))}updateChannel(t,e){const n={};return n.name=(e.name||t.name).trim(),n.topic=e.topic||t.topic,n.position=e.position||t.position,n.bitrate=e.bitrate||t.bitrate,n.user_limit=e.userLimit||t.userLimit,this.rest.makeRequest("patch",i.Endpoints.channel(t.id),!0,n).then(t=>this.rest.client.actions.ChannelUpdate.handle(t).updated)}leaveGuild(t){return t.ownerID===this.rest.client.user.id?Promise.reject(new Error("Guild is owned by the client.")):this.rest.makeRequest("del",i.Endpoints.meGuild(t.id),!0).then(()=>this.rest.client.actions.GuildDelete.handle({id:t.id}).guild)}createGuild(t){return t.icon=this.rest.client.resolver.resolveBase64(t.icon)||null,t.region=t.region||"us-central",new Promise((e,n)=>{this.rest.makeRequest("post",i.Endpoints.guilds,!0,t).then(t=>{if(this.rest.client.guilds.has(t.id))return void e(this.rest.client.guilds.get(t.id));const i=n=>{n.id===t.id&&(this.rest.client.removeListener("guildCreate",i),this.rest.client.clearTimeout(s),e(n))};this.rest.client.on("guildCreate",i);const s=this.rest.client.setTimeout(()=>{this.rest.client.removeListener("guildCreate",i),n(new Error("Took too long to receive guild data."))},1e4)},n)})}deleteGuild(t){return this.rest.makeRequest("del",i.Endpoints.guild(t.id),!0).then(()=>this.rest.client.actions.GuildDelete.handle({id:t.id}).guild)}getUser(t){return this.rest.makeRequest("get",i.Endpoints.user(t),!0).then(t=>this.rest.client.actions.UserGet.handle(t).user)}updateCurrentUser(t){const e=this.rest.client.user,n={};return n.username=t.username||e.username,n.avatar=this.rest.client.resolver.resolveBase64(t.avatar)||e.avatar,e.bot||(n.email=t.email||e.email,n.password=this.rest.client.password,t.new_password&&(n.new_password=t.newPassword)),this.rest.makeRequest("patch",i.Endpoints.me,!0,n).then(t=>this.rest.client.actions.UserUpdate.handle(t).updated)}updateGuild(t,e){const n={};return e.name&&(n.name=e.name),e.region&&(n.region=e.region),e.verificationLevel&&(n.verification_level=Number(e.verificationLevel)),e.afkChannel&&(n.afk_channel_id=this.rest.client.resolver.resolveChannel(e.afkChannel).id),e.afkTimeout&&(n.afk_timeout=Number(e.afkTimeout)),e.icon&&(n.icon=this.rest.client.resolver.resolveBase64(e.icon)),e.owner&&(n.owner_id=this.rest.client.resolver.resolveUser(e.owner).id),e.splash&&(n.splash=this.rest.client.resolver.resolveBase64(e.splash)),this.rest.makeRequest("patch",i.Endpoints.guild(t.id),!0,n).then(t=>this.rest.client.actions.GuildUpdate.handle(t).updated)}kickGuildMember(t,e){return this.rest.makeRequest("del",i.Endpoints.guildMember(t.id,e.id),!0).then(()=>this.rest.client.actions.GuildMemberRemove.handle({guild_id:t.id,user:e.user}).member)}createGuildRole(t){return this.rest.makeRequest("post",i.Endpoints.guildRoles(t.id),!0).then(e=>this.rest.client.actions.GuildRoleCreate.handle({guild_id:t.id,role:e}).role)}deleteGuildRole(t){return this.rest.makeRequest("del",i.Endpoints.guildRole(t.guild.id,t.id),!0).then(()=>this.rest.client.actions.GuildRoleDelete.handle({guild_id:t.guild.id,role_id:t.id}).role)}setChannelOverwrite(t,e){return this.rest.makeRequest("put",`${i.Endpoints.channelPermissions(t.id)}/${e.id}`,!0,e)}deletePermissionOverwrites(t){return this.rest.makeRequest("del",`${i.Endpoints.channelPermissions(t.channel.id)}/${t.id}`,!0).then(()=>t)}getChannelMessages(t,e={}){const n=[];e.limit&&n.push(`limit=${e.limit}`),e.around?n.push(`around=${e.around}`):e.before?n.push(`before=${e.before}`):e.after&&n.push(`after=${e.after}`);let s=i.Endpoints.channelMessages(t.id);return n.length>0&&(s+=`?${n.join("&")}`),this.rest.makeRequest("get",s,!0)}getChannelMessage(t,e){const n=t.messages.get(e);return n?Promise.resolve(n):this.rest.makeRequest("get",i.Endpoints.channelMessage(t.id,e),!0)}getGuildMember(t,e){return this.rest.makeRequest("get",i.Endpoints.guildMember(t.id,e.id),!0).then(e=>this.rest.client.actions.GuildMemberGet.handle(t,e).member)}updateGuildMember(t,e){e.channel&&(e.channel_id=this.rest.client.resolver.resolveChannel(e.channel).id),e.roles&&(e.roles=e.roles.map(t=>t instanceof u?t.id:t));let n=i.Endpoints.guildMember(t.guild.id,t.id);if(t.id===this.rest.client.user.id){const s=Object.keys(e);1===s.length&&"nick"===s[0]&&(n=i.Endpoints.guildMemberNickname(t.guild.id))}return this.rest.makeRequest("patch",n,!0,e).then(e=>t.guild._updateMember(t,e).mem)}addMemberRole(t,e){return this.rest.makeRequest("put",i.Endpoints.guildMemberRole(t.guild.id,t.id,e.id),!0).then(()=>{return t._roles.includes(e.id)||t._roles.push(e.id),t})}removeMemberRole(t,e){return this.rest.makeRequest("delete",i.Endpoints.guildMemberRole(t.guild.id,t.id,e.id),!0).then(()=>{const n=t._roles.indexOf(e.id);return n>=0&&t._roles.splice(n,1),t})}sendTyping(t){return this.rest.makeRequest("post",`${i.Endpoints.channel(t)}/typing`,!0)}banGuildMember(t,e,n=0){const s=this.rest.client.resolver.resolveUserID(e);return s?this.rest.makeRequest("put",`${i.Endpoints.guildBans(t.id)}/${s}?delete-message-days=${n}`,!0,{"delete-message-days":n}).then(()=>{if(e instanceof h)return e;const n=this.rest.client.resolver.resolveUser(s);return n?(e=this.rest.client.resolver.resolveGuildMember(t,n),e||n):s}):Promise.reject(new Error("Couldn't resolve the user ID to ban."))}unbanGuildMember(t,e){return new Promise((n,s)=>{const r=this.rest.client.resolver.resolveUserID(e);if(!r)throw new Error("Couldn't resolve the user ID to unban.");const o=(e,s)=>{e.id===t.id&&s.id===r&&(this.rest.client.removeListener(i.Events.GUILD_BAN_REMOVE,o),this.rest.client.clearTimeout(a),n(s))};this.rest.client.on(i.Events.GUILD_BAN_REMOVE,o);const a=this.rest.client.setTimeout(()=>{this.rest.client.removeListener(i.Events.GUILD_BAN_REMOVE,o),s(new Error("Took too long to receive the ban remove event."))},1e4);this.rest.makeRequest("del",`${i.Endpoints.guildBans(t.id)}/${r}`,!0).catch(t=>{this.rest.client.removeListener(i.Events.GUILD_BAN_REMOVE,o),this.rest.client.clearTimeout(a),s(t)})})}getGuildBans(t){return this.rest.makeRequest("get",i.Endpoints.guildBans(t.id),!0).then(t=>{const e=new s;for(const n of t){const t=this.rest.client.dataManager.newUser(n.user);e.set(t.id,t)}return e})}updateGuildRole(t,e){const n={};if(n.name=e.name||t.name,n.position="undefined"!=typeof e.position?e.position:t.position,n.color=e.color||t.color,"string"==typeof n.color&&n.color.startsWith("#")&&(n.color=parseInt(n.color.replace("#",""),16)),n.hoist="undefined"!=typeof e.hoist?e.hoist:t.hoist,n.mentionable="undefined"!=typeof e.mentionable?e.mentionable:t.mentionable,e.permissions){let t=0;for(let s of e.permissions)"string"==typeof s&&(s=i.PermissionFlags[s]),t|=s;n.permissions=t}else n.permissions=t.permissions;return this.rest.makeRequest("patch",i.Endpoints.guildRole(t.guild.id,t.id),!0,n).then(e=>this.rest.client.actions.GuildRoleUpdate.handle({role:e,guild_id:t.guild.id}).updated)}pinMessage(t){return this.rest.makeRequest("put",`${i.Endpoints.channel(t.channel.id)}/pins/${t.id}`,!0).then(()=>t)}unpinMessage(t){return this.rest.makeRequest("del",`${i.Endpoints.channel(t.channel.id)}/pins/${t.id}`,!0).then(()=>t)}getChannelPinnedMessages(t){return this.rest.makeRequest("get",`${i.Endpoints.channel(t.id)}/pins`,!0)}createChannelInvite(t,e){const n={};return n.temporary=e.temporary,n.max_age=e.maxAge,n.max_uses=e.maxUses,this.rest.makeRequest("post",`${i.Endpoints.channelInvites(t.id)}`,!0,n).then(t=>new c(this.rest.client,t))}deleteInvite(t){return this.rest.makeRequest("del",i.Endpoints.invite(t.code),!0).then(()=>t)}getInvite(t){return this.rest.makeRequest("get",i.Endpoints.invite(t),!0).then(t=>new c(this.rest.client,t))}getGuildInvites(t){return this.rest.makeRequest("get",i.Endpoints.guildInvites(t.id),!0).then(t=>{const e=new s;for(const n of t){const t=new c(this.rest.client,n);e.set(t.code,t)}return e})}pruneGuildMembers(t,e,n){return this.rest.makeRequest(n?"get":"post",`${i.Endpoints.guildPrune(t.id)}?days=${e}`,!0).then(t=>t.pruned)}createEmoji(t,e,n){return this.rest.makeRequest("post",`${i.Endpoints.guildEmojis(t.id)}`,!0,{name:n,image:e}).then(e=>this.rest.client.actions.EmojiCreate.handle(e,t).emoji)}deleteEmoji(t){return this.rest.makeRequest("delete",`${i.Endpoints.guildEmojis(t.guild.id)}/${t.id}`,!0).then(()=>this.rest.client.actions.EmojiDelete.handle(t).data)}getWebhook(t,e){return this.rest.makeRequest("get",i.Endpoints.webhook(t,e),!e).then(t=>new l(this.rest.client,t))}getGuildWebhooks(t){return this.rest.makeRequest("get",i.Endpoints.guildWebhooks(t.id),!0).then(t=>{const e=new s;for(const n of t)e.set(n.id,new l(this.rest.client,n));return e})}getChannelWebhooks(t){return this.rest.makeRequest("get",i.Endpoints.channelWebhooks(t.id),!0).then(t=>{const e=new s;for(const n of t)e.set(n.id,new l(this.rest.client,n));return e})}createWebhook(t,e,n){return this.rest.makeRequest("post",i.Endpoints.channelWebhooks(t.id),!0,{name:e,avatar:n}).then(t=>new l(this.rest.client,t))}editWebhook(t,e,n){return this.rest.makeRequest("patch",i.Endpoints.webhook(t.id,t.token),!1,{name:e,avatar:n}).then(e=>{return t.name=e.name,t.avatar=e.avatar,t})}deleteWebhook(t){return this.rest.makeRequest("delete",i.Endpoints.webhook(t.id,t.token),!1)}sendWebhookMessage(t,e,{avatarURL,tts,disableEveryone,embeds}={},n=null){return"undefined"!=typeof e&&(e=this.rest.client.resolver.resolveString(e)),e&&(disableEveryone||"undefined"==typeof disableEveryone&&this.rest.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@$1")),this.rest.makeRequest("post",`${i.Endpoints.webhook(t.id,t.token)}?wait=true`,!1,{username:t.name,avatar_url:avatarURL,content:e,tts:tts,file:n,embeds:embeds})}sendSlackWebhookMessage(t,e){return this.rest.makeRequest("post",`${i.Endpoints.webhook(t.id,t.token)}/slack?wait=true`,!1,e)}fetchUserProfile(t){return this.rest.makeRequest("get",i.Endpoints.userProfile(t.id),!0).then(e=>new d(t,e))}addFriend(t){return this.rest.makeRequest("post",i.Endpoints.relationships("@me"),!0,{username:t.username,discriminator:t.discriminator}).then(()=>t)}removeFriend(t){return this.rest.makeRequest("delete",`${i.Endpoints.relationships("@me")}/${t.id}`,!0).then(()=>t)}blockUser(t){return this.rest.makeRequest("put",`${i.Endpoints.relationships("@me")}/${t.id}`,!0,{type:2}).then(()=>t)}unblockUser(t){return this.rest.makeRequest("delete",`${i.Endpoints.relationships("@me")}/${t.id}`,!0).then(()=>t)}setRolePositions(t,e){return this.rest.makeRequest("patch",i.Endpoints.guildRoles(t),!0,e).then(()=>this.rest.client.actions.GuildRolesPositionUpdate.handle({guild_id:t,roles:e}).guild)}addMessageReaction(t,e){return this.rest.makeRequest("put",i.Endpoints.selfMessageReaction(t.channel.id,t.id,e),!0).then(()=>this.rest.client.actions.MessageReactionAdd.handle({user_id:this.rest.client.user.id,message_id:t.id,emoji:o(e),channel_id:t.channel.id}).reaction)}removeMessageReaction(t,e,n){let s=i.Endpoints.selfMessageReaction(t.channel.id,t.id,e);return n.id!==this.rest.client.user.id&&(s=i.Endpoints.userMessageReaction(t.channel.id,t.id,e,null,n.id)),this.rest.makeRequest("delete",s,!0).then(()=>this.rest.client.actions.MessageReactionRemove.handle({user_id:n.id,message_id:t.id,emoji:o(e),channel_id:t.channel.id}).reaction)}removeMessageReactions(t){return this.rest.makeRequest("delete",i.Endpoints.messageReactions(t.channel.id,t.id),!0).then(()=>t)}getMessageReactionUsers(t,e,n=100){return this.rest.makeRequest("get",i.Endpoints.messageReaction(t.channel.id,t.id,e,n),!0)}getMyApplication(){return this.rest.makeRequest("get",i.Endpoints.myApplication,!0).then(t=>new f(this.rest.client,t))}setNote(t,e){return this.rest.makeRequest("put",i.Endpoints.note(t.id),!0,{note:e}).then(()=>t)}}t.exports=p},function(t,e,n){const i=n(53);class s extends i{constructor(t,e){super(t,e),this.requestRemaining=1,this.first=!0}push(t){super.push(t),this.handle()}handleNext(t){this.waiting||(this.waiting=!0,this.restManager.client.setTimeout(()=>{this.requestRemaining=this.requestLimit,this.waiting=!1,this.handle()},t))}execute(t){t.request.gen().end((e,n)=>{if(n&&n.headers&&(this.requestLimit=n.headers["x-ratelimit-limit"],this.requestResetTime=1e3*Number(n.headers["x-ratelimit-reset"]),this.requestRemaining=Number(n.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(n.headers.date).getTime(),this.handleNext(this.requestResetTime-Date.now()+this.timeDifference+1e3)),e)429===e.status?(this.requestRemaining=0,this.queue.unshift(t),this.restManager.client.setTimeout(()=>{this.globalLimit=!1,this.handle()},Number(n.headers["retry-after"])+500),n.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):t.reject(e);else{this.globalLimit=!1;const e=n&&n.body?n.body:{};t.resolve(e),this.first&&(this.first=!1,this.handle())}})}handle(){if(super.handle(),!(this.requestRemaining<1||0===this.queue.length||this.globalLimit))for(;this.queue.length>0&&this.requestRemaining>0;)this.execute(this.queue.shift()),this.requestRemaining--}}t.exports=s},function(t,e,n){const i=n(53);class s extends i{constructor(t,e){super(t,e),this.waiting=!1,this.endpoint=e,this.timeDifference=0}push(t){super.push(t),this.handle()}execute(t){return new Promise(e=>{t.request.gen().end((n,i)=>{if(i&&i.headers&&(this.requestLimit=i.headers["x-ratelimit-limit"],this.requestResetTime=1e3*Number(i.headers["x-ratelimit-reset"]),this.requestRemaining=Number(i.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(i.headers.date).getTime()),n)429===n.status?(this.restManager.client.setTimeout(()=>{this.waiting=!1,this.globalLimit=!1,e()},Number(i.headers["retry-after"])+500),i.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):(this.queue.shift(),this.waiting=!1,t.reject(n),e(n));else{this.queue.shift(),this.globalLimit=!1;const n=i&&i.body?i.body:{};t.resolve(n),0===this.requestRemaining?this.restManager.client.setTimeout(()=>{this.waiting=!1,e(n)},this.requestResetTime-Date.now()+this.timeDifference+1e3):(this.waiting=!1,e(n))}})})}handle(){if(super.handle(),!this.waiting&&0!==this.queue.length&&!this.globalLimit){this.waiting=!0;const t=this.queue[0];this.execute(t).then(()=>this.handle())}}}t.exports=s},function(t,e,n){const i=n(0);class s{constructor(t){this.restManager=t,this._userAgent={url:"https://github.com/hydrabolt/discord.js",version:i.Package.version}}set(t){this._userAgent.url=t.url||"https://github.com/hydrabolt/discord.js",this._userAgent.version=t.version||i.Package.version}get userAgent(){return`DiscordBot (${this._userAgent.url}, ${this._userAgent.version})`}}t.exports=s},function(t,e,n){(function(e){const i="undefined"!=typeof window,s=n(21).EventEmitter,r=n(0),o=n(54),a=n(67),h=n(50),u=n(114);let c,l,d=JSON.stringify;if(i)c=window.WebSocket;else{try{c=n(155)}catch(t){c=n(156)}try{l=n(154),d=l.pack}catch(t){l=null}}class f extends s{constructor(t){super(),this.client=t,this.packetManager=new u(this),this.status=r.Status.IDLE,this.sessionID=null,this.sequence=-1,this.gateway=null,this.normalReady=!1,this.ws=null,this.disabledEvents={};for(const e of t.options.disabledEvents)this.disabledEvents[e]=!0;this.first=!0}_connect(t){this.client.emit("debug",`Connecting to gateway ${t}`),this.normalReady=!1,this.status!==r.Status.RECONNECTING&&(this.status=r.Status.CONNECTING),this.ws=new c(t),i&&(this.ws.binaryType="arraybuffer"),this.ws.onopen=this.eventOpen.bind(this),this.ws.onmessage=this.eventMessage.bind(this),this.ws.onclose=this.eventClose.bind(this),this.ws.onerror=this.eventError.bind(this),this._queue=[],this._remaining=3}connect(t){t=`${t}&encoding=${l?"etf":"json"}`,this.first?(this._connect(t),this.first=!1):this.client.setTimeout(()=>this._connect(t),5500)}send(t,e=false){return e?void this._send(d(t)):(this._queue.push(d(t)),void this.doQueue())}destroy(){this.ws.close(1e3),this._queue=[],this.status=r.Status.IDLE}_send(t){this.ws.readyState===c.OPEN&&(this.emit("send",t),this.ws.send(t))}doQueue(){const t=this._queue[0];if(this.ws.readyState===c.OPEN&&t){if(0===this._remaining)return void this.client.setTimeout(this.doQueue.bind(this),1e3);this._remaining--,this._send(t),this._queue.shift(),this.doQueue(),this.client.setTimeout(()=>this._remaining++,1e3)}}eventOpen(){this.client.emit("debug","Connection to gateway opened"),this.status===r.Status.RECONNECTING?this._sendResume():this._sendNewIdentify()}_sendResume(){if(!this.sessionID)return void this._sendNewIdentify();this.client.emit("debug","Identifying as resumed session");const t={token:this.client.token,session_id:this.sessionID,seq:this.sequence};this.send({op:r.OPCodes.RESUME,d:t})}_sendNewIdentify(){this.reconnecting=!1;const t=this.client.options.ws;t.token=this.client.token,this.client.options.shardCount>0&&(t.shard=[Number(this.client.options.shardId),Number(this.client.options.shardCount)]),this.client.emit("debug","Identifying as new session"),this.send({op:r.OPCodes.IDENTIFY,d:t}),this.sequence=-1}eventClose(t){this.emit("close",t),this.client.clearInterval(this.client.manager.heartbeatInterval),this.status=r.Status.DISCONNECTED,this.reconnecting||this.client.emit(r.Events.DISCONNECT),4004!==t.code&&4010!==t.code&&(this.reconnecting||1e3===t.code||this.tryReconnect())}eventMessage(t){const e=this.tryParseEventData(t.data);return null===e?(this.eventError(new Error(r.Errors.BAD_WS_MESSAGE)),!1):(this.client.emit("raw",e),e.op===r.OPCodes.HELLO&&this.client.manager.setupKeepAlive(e.d.heartbeat_interval),this.packetManager.handle(e))}parseEventData(t){return l?(t instanceof ArrayBuffer&&(t=o(t)),l.unpack(t)):(t instanceof ArrayBuffer?t=a.inflate(t,{to:"string"}):t instanceof e&&(t=h.inflateSync(t).toString()),JSON.parse(t))}tryParseEventData(t){try{return this.parseEventData(t)}catch(t){return null}}eventError(t){this.client.listenerCount("error")>0&&this.client.emit("error",t),this.tryReconnect()}_emitReady(t=true){this.status=r.Status.READY,this.client.emit(r.Events.READY),this.packetManager.handleQueue(),this.normalReady=t}checkIfReady(){if(this.status!==r.Status.READY&&this.status!==r.Status.NEARLY){let t=0;for(const e of this.client.guilds.keys())t+=this.client.guilds.get(e).available?0:1;if(0===t){if(this.status=r.Status.NEARLY,this.client.options.fetchAllMembers){const t=this.client.guilds.map(t=>t.fetchMembers());return void Promise.all(t).then(()=>this._emitReady(),t=>{this.client.emit(r.Events.WARN,"Error in pre-ready guild member fetching"),this.client.emit(r.Events.ERROR,t),this._emitReady()})}this._emitReady()}}}tryReconnect(){this.status!==r.Status.RECONNECTING&&this.status!==r.Status.CONNECTING&&(this.status=r.Status.RECONNECTING,this.ws.close(),this.packetManager.handleQueue(),this.client.emit(r.Events.RECONNECTING),this.connect(this.client.ws.gateway))}}t.exports=f}).call(e,n(16).Buffer)},function(t,e,n){const i=n(0),s=[i.WSEvents.READY,i.WSEvents.GUILD_CREATE,i.WSEvents.GUILD_DELETE,i.WSEvents.GUILD_MEMBERS_CHUNK,i.WSEvents.GUILD_MEMBER_ADD,i.WSEvents.GUILD_MEMBER_REMOVE];class r{constructor(t){this.ws=t,this.handlers={},this.queue=[],
|
||
this.register(i.WSEvents.READY,n(140)),this.register(i.WSEvents.GUILD_CREATE,n(121)),this.register(i.WSEvents.GUILD_DELETE,n(122)),this.register(i.WSEvents.GUILD_UPDATE,n(131)),this.register(i.WSEvents.GUILD_BAN_ADD,n(119)),this.register(i.WSEvents.GUILD_BAN_REMOVE,n(120)),this.register(i.WSEvents.GUILD_MEMBER_ADD,n(123)),this.register(i.WSEvents.GUILD_MEMBER_REMOVE,n(124)),this.register(i.WSEvents.GUILD_MEMBER_UPDATE,n(125)),this.register(i.WSEvents.GUILD_ROLE_CREATE,n(127)),this.register(i.WSEvents.GUILD_ROLE_DELETE,n(128)),this.register(i.WSEvents.GUILD_ROLE_UPDATE,n(129)),this.register(i.WSEvents.GUILD_MEMBERS_CHUNK,n(126)),this.register(i.WSEvents.CHANNEL_CREATE,n(115)),this.register(i.WSEvents.CHANNEL_DELETE,n(116)),this.register(i.WSEvents.CHANNEL_UPDATE,n(118)),this.register(i.WSEvents.CHANNEL_PINS_UPDATE,n(117)),this.register(i.WSEvents.PRESENCE_UPDATE,n(139)),this.register(i.WSEvents.USER_UPDATE,n(145)),this.register(i.WSEvents.USER_NOTE_UPDATE,n(144)),this.register(i.WSEvents.VOICE_STATE_UPDATE,n(147)),this.register(i.WSEvents.TYPING_START,n(143)),this.register(i.WSEvents.MESSAGE_CREATE,n(132)),this.register(i.WSEvents.MESSAGE_DELETE,n(133)),this.register(i.WSEvents.MESSAGE_UPDATE,n(138)),this.register(i.WSEvents.MESSAGE_DELETE_BULK,n(134)),this.register(i.WSEvents.VOICE_SERVER_UPDATE,n(146)),this.register(i.WSEvents.GUILD_SYNC,n(130)),this.register(i.WSEvents.RELATIONSHIP_ADD,n(141)),this.register(i.WSEvents.RELATIONSHIP_REMOVE,n(142)),this.register(i.WSEvents.MESSAGE_REACTION_ADD,n(135)),this.register(i.WSEvents.MESSAGE_REACTION_REMOVE,n(136)),this.register(i.WSEvents.MESSAGE_REACTION_REMOVE_ALL,n(137))}get client(){return this.ws.client}register(t,e){this.handlers[t]=new e(this)}handleQueue(){this.queue.forEach((t,e)=>{this.handle(this.queue[e]),this.queue.splice(e,1)})}setSequence(t){t&&t>this.ws.sequence&&(this.ws.sequence=t)}handle(t){return t.op===i.OPCodes.RECONNECT?(this.setSequence(t.s),this.ws.tryReconnect(),!1):t.op===i.OPCodes.INVALID_SESSION?(this.ws.sessionID=null,this.ws._sendNewIdentify(),!1):(t.op===i.OPCodes.HEARTBEAT_ACK&&(this.ws.client._pong(this.ws.client._pingTimestamp),this.ws.client.emit("debug","Heartbeat acknowledged")),this.ws.status===i.Status.RECONNECTING&&(this.ws.reconnecting=!1,this.ws.checkIfReady()),this.setSequence(t.s),void 0===this.ws.disabledEvents[t.t]&&(this.ws.status!==i.Status.READY&&s.indexOf(t.t)===-1?(this.queue.push(t),!1):!!this.handlers[t.t]&&this.handlers[t.t].handle(t)))}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.ChannelCreate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.ChannelDelete.handle(n);i.channel&&e.emit(s.Events.CHANNEL_DELETE,i.channel)}}t.exports=r},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.channels.get(n.channel_id),r=new Date(n.last_pin_timestamp);i&&r&&e.emit(s.Events.CHANNEL_PINS_UPDATE,i,r)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.ChannelUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id),r=e.users.get(n.user.id);i&&r&&e.emit(s.Events.GUILD_BAN_ADD,i,r)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildBanRemove.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.id);i?i.available||n.unavailable||(i.setup(n),this.packetManager.ws.checkIfReady()):e.dataManager.newGuild(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.GuildDelete.handle(n);i.guild&&e.emit(s.Events.GUILD_DELETE,i.guild)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);i&&(i.memberCount++,i._addMember(n))}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildMemberRemove.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);if(i){const t=i.members.get(n.user.id);t&&i._updateMember(t,n)}}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id),r=[];if(i)for(const o of n.members)r.push(i._addMember(o,!1));i._checkChunks(),e.emit(s.Events.GUILD_MEMBERS_CHUNK,r)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildRoleCreate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildRoleDelete.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildRoleUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildSync.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.MessageCreate.handle(n);i.message&&e.emit(s.Events.MESSAGE_CREATE,i.message)}}t.exports=r},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.MessageDelete.handle(n);i.message&&e.emit(s.Events.MESSAGE_DELETE,i.message)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageDeleteBulk.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageReactionAdd.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageReactionRemove.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageReactionRemoveAll.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0),r=n(4);class o extends i{handle(t){const e=this.packetManager.client,n=t.d;let i=e.users.get(n.user.id);const o=e.guilds.get(n.guild_id);if(!i){if(!n.user.username)return;i=e.dataManager.newUser(n.user)}const a=r(i);if(i.patch(n.user),i.equals(a)||e.emit(s.Events.USER_UPDATE,a,i),o){let t=o.members.get(i.id);if(t||"offline"===n.status||(t=o._addMember({user:i,roles:n.roles,deaf:!1,mute:!1},!1),e.emit(s.Events.GUILD_MEMBER_AVAILABLE,t)),t){const a=r(t);t.presence&&(a.frozenPresence=r(t.presence)),o._setPresence(i.id,n),e.emit(s.Events.PRESENCE_UPDATE,a,t)}else o._setPresence(i.id,n)}}}t.exports=o},function(t,e,n){const i=n(1),s=n(29);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=new s(e,n.user);e.user=i,e.readyAt=new Date,e.users.set(i.id,i);for(const r of n.guilds)e.dataManager.newGuild(r);for(const o of n.private_channels)e.dataManager.newChannel(o);for(const a of n.relationships){const t=e.dataManager.newUser(a.user);1===a.type?e.user.friends.set(t.id,t):2===a.type&&e.user.blocked.set(t.id,t)}n.presences=n.presences||[];for(const h of n.presences)e.dataManager.newUser(h.user),e._setPresence(h.user.id,h);if(n.notes)for(const u in n.notes){let t=n.notes[u];t.length||(t=null),e.user.notes.set(u,t)}!e.user.bot&&e.options.sync&&e.setInterval(e.syncGuilds.bind(e),3e4),e.once("ready",e.syncGuilds.bind(e)),e.users.has("1")||e.dataManager.newUser({id:"1",username:"Clyde",discriminator:"0000",avatar:"https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png",bot:!0,status:"online",game:null,verified:!0}),e.setTimeout(()=>{e.ws.normalReady||e.ws._emitReady(!1)},1200*n.guilds.length),this.packetManager.ws.sessionID=n.session_id,this.packetManager.ws.checkIfReady()}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;1===n.type?e.fetchUser(n.id).then(t=>{e.user.friends.set(t.id,t)}):2===n.type&&e.fetchUser(n.id).then(t=>{e.user.blocked.set(t.id,t)})}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;2===n.type?e.user.blocked.has(n.id)&&e.user.blocked.delete(n.id):1===n.type&&e.user.friends.has(n.id)&&e.user.friends.delete(n.id)}}t.exports=s},function(t,e,n){function i(t,e){return t.client.setTimeout(()=>{t.client.emit(r.Events.TYPING_STOP,t,e,t._typing.get(e.id)),t._typing.delete(e.id)},6e3)}const s=n(1),r=n(0);class o extends s{handle(t){const e=this.packetManager.client,n=t.d,s=e.channels.get(n.channel_id),o=e.users.get(n.user_id),h=new Date(1e3*n.timestamp);if(s&&o){if("voice"===s.type)return void e.emit(r.Events.WARN,`Discord sent a typing packet to voice channel ${s.id}`);if(s._typing.has(o.id)){const t=s._typing.get(o.id);t.lastTimestamp=h,t.resetTimeout(i(s,o))}else s._typing.set(o.id,new a(e,h,h,i(s,o))),e.emit(r.Events.TYPING_START,s,o)}}}class a{constructor(t,e,n,i){this.client=t,this.since=e,this.lastTimestamp=n,this._timeout=i}resetTimeout(t){this.client.clearTimeout(this._timeout),this._timeout=t}get elapsedTime(){return Date.now()-this.since}}t.exports=o},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.UserNoteUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.UserUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.emit("self.voiceServer",n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0),r=n(4);class o extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);if(i){const t=i.members.get(n.user_id);if(t){const i=r(t);t.voiceChannel&&t.voiceChannel.id!==n.channel_id&&t.voiceChannel.members.delete(i.id),n.channel_id||(t.speaking=null),t.user.id===e.user.id&&n.channel_id&&e.emit("self.voiceStateUpdate",n);const o=e.channels.get(n.channel_id);o&&o.members.set(t.user.id,t),t.serverMute=n.mute,t.serverDeaf=n.deaf,t.selfMute=n.self_mute,t.selfDeaf=n.self_deaf,t.voiceSessionID=n.session_id,t.voiceChannelID=n.channel_id,e.emit(s.Events.VOICE_STATE_UPDATE,i,t)}}}}t.exports=o},function(t,e){class n{constructor(t,e){this.user=t,this.setup(e)}setup(t){this.type=t.type,this.name=t.name,this.id=t.id,this.revoked=t.revoked,this.integrations=t.integrations}}t.exports=n},function(t,e,n){const i=n(3),s=n(148);class r{constructor(t,e){this.user=t,Object.defineProperty(this,"client",{value:t.client}),this.mutualGuilds=new i,this.connections=new i,this.setup(e)}setup(t){this.premium=t.premium;for(const e of t.mutual_guilds)this.client.guilds.has(e.id)&&this.mutualGuilds.set(e.id,this.client.guilds.get(e.id));for(const n of t.connected_accounts)this.connections.set(n.id,new s(this.user,n))}}t.exports=r},function(t,e){t.exports=function(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(const n in t){const i=t[n],s=e.indexOf(i);s&&e.splice(s,1)}return 0===e.length}},function(t,e){t.exports=function(t){if(t.includes("%")&&(t=decodeURIComponent(t)),t.includes(":")){const[e,n]=t.split(":");return{name:e,id:n}}return{name:t,id:null}}},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){}]); |