mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
7 lines
212 KiB
JavaScript
7 lines
212 KiB
JavaScript
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.Discord=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var f=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),g=a("./InternalClient.js"),h=a("events"),i=function(a){function b(c){d(this,b),a.call(this),this.options=c||{},this.internal=new g(this)}return e(b,a),b.prototype.login=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?function(a,b){}:arguments[2],d=this;return new Promise(function(e,f){d.internal.login(a,b).then(function(a){c(null,a),e(a)})["catch"](function(a){c(a),f(a)})})},b.prototype.logout=function(){var a=arguments.length<=0||void 0===arguments[0]?function(a){}:arguments[0],b=this;return new Promise(function(c,d){b.internal.logout().then(function(){a(),c()})["catch"](function(b){a(b),d(b)})})},b.prototype.sendMessage=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],d=arguments.length<=3||void 0===arguments[3]?function(a,b){}:arguments[3],e=this;return new Promise(function(f,g){"function"==typeof c&&(d=c),e.internal.sendMessage(a,b,c).then(function(a){d(null,a),f(a)})["catch"](function(a){d(a),g(a)})})},b.prototype.sendTTSMessage=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?function(a,b){}:arguments[2],d=this;return new Promise(function(e,f){d.sendMessage(a,b,{tts:!0}).then(function(a){c(null,a),e(a)})["catch"](function(a){c(a),f(a)})})},b.prototype.reply=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],d=arguments.length<=3||void 0===arguments[3]?function(a,b){}:arguments[3],e=this;return new Promise(function(f,g){"function"==typeof c&&(d=c);var h=e.internal.resolver.resolveMessage(a);if(h)b=h.author+", "+b,e.internal.sendMessage(h,b,c).then(function(a){d(null,a),f(a)})["catch"](function(a){d(a),g(a)});else{var i=new Error("Destination not resolvable to a message!");d(i),g(i)}})},b.prototype.replyTTS=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?function(){}:arguments[2];return new Promise(function(d,e){self.reply(a,b,{tts:!0}).then(function(a){c(null,a),d(a)})["catch"](function(a){c(a),e(a)})})},b.prototype.deleteMessage=function(a){var b=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],c=arguments.length<=2||void 0===arguments[2]?function(a){}:arguments[2],d=this;return new Promise(function(e,f){"function"==typeof b&&(c=b),d.internal.deleteMessage(a,b).then(function(){c(),e()})["catch"](function(a){c(a),f(a)})})},b.prototype.updateMessage=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],d=arguments.length<=3||void 0===arguments[3]?function(a,b){}:arguments[3],e=this;return new Promise(function(f,g){"function"==typeof c&&(d=c),e.internal.updateMessage(a,b,c).then(function(a){d(null,a),f(a)})["catch"](function(a){d(a),g(a)})})},b.prototype.getChannelLogs=function(a){var b=arguments.length<=1||void 0===arguments[1]?500:arguments[1],c=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],d=arguments.length<=3||void 0===arguments[3]?function(a,b){}:arguments[3],e=this;return new Promise(function(f,g){"function"==typeof c&&(d=c),e.internal.getChannelLogs(a,b,c).then(function(a){d(null,a),f(a)})["catch"](function(a){d(a),g(a)})})},b.prototype.getBans=function(a){var b=arguments.length<=1||void 0===arguments[1]?function(a,b){}:arguments[1],c=this;return new Promise(function(d,e){c.internal.getBans(a).then(function(a){b(null,a),d(a)})["catch"](function(a){b(a),e(a)})})},b.prototype.sendFile=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?"image.png":arguments[2],d=arguments.length<=3||void 0===arguments[3]?function(a,b){}:arguments[3],e=this;return new Promise(function(f,g){e.internal.sendFile(a,b,c).then(function(a){d(null,a),f(a)})["catch"](function(a){d(a),g(a)})})},b.prototype.joinServer=function(a){var b=arguments.length<=1||void 0===arguments[1]?function(a,b){}:arguments[1],c=this;return new Promise(function(d,e){c.internal.joinServer(a).then(function(a){b(null,a),d(a)})["catch"](function(a){b(a),e(a)})})},b.prototype.createServer=function(a){var b=arguments.length<=1||void 0===arguments[1]?"london":arguments[1],c=arguments.length<=2||void 0===arguments[2]?function(a,b){}:arguments[2],d=this;return new Promise(function(e,f){d.internal.createServer(a,b).then(function(a){c(null,a),e(a)})["catch"](function(a){c(a),f(a)})})},b.prototype.leaveServer=function(a){var b=arguments.length<=1||void 0===arguments[1]?function(a){}:arguments[1],c=this;return new Promise(function(d,e){c.internal.leaveServer(a).then(function(){b(),d()})["catch"](function(a){b(a),e(a)})})},b.prototype.createChannel=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?"text":arguments[2],d=arguments.length<=3||void 0===arguments[3]?function(a,b){}:arguments[3],e=this;return new Promise(function(f,g){"function"==typeof c&&(d=c),e.internal.createChannel(a,b,c).then(function(a){d(a),f(a)})["catch"](function(a){d(a),g(a)})})},b.prototype.deleteChannel=function(a){var b=arguments.length<=1||void 0===arguments[1]?function(a){}:arguments[1],c=this;return new Promise(function(d,e){c.internal.deleteChannel(a).then(function(){b(),d()})["catch"](function(a){b(a),e(a)})})},b.prototype.banMember=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?1:arguments[2],d=arguments.length<=3||void 0===arguments[3]?function(a){}:arguments[3],e=this;return new Promise(function(f,g){"function"==typeof c&&(d=c),e.internal.banMember(a,b,c).then(function(){d(),f()})["catch"](function(a){d(a),g(a)})})},b.prototype.unbanMember=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?function(a){}:arguments[2],d=this;return new Promise(function(e,f){d.internal.unbanMember(a,b).then(function(){c(),e()})["catch"](function(a){c(a),f(a)})})},b.prototype.kickMember=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?function(a){}:arguments[2],d=this;return new Promise(function(e,f){d.internal.kickMember(a,b).then(function(){c(),e()})["catch"](function(a){c(a),f(a)})})},b.prototype.createRole=function(a){var b=arguments.length<=1||void 0===arguments[1]?null:arguments[1],c=arguments.length<=2||void 0===arguments[2]?function(a,b){}:arguments[2],d=this;return new Promise(function(e,f){"function"==typeof b&&(c=b),d.internal.createRole(a,b).then(function(a){c(null,a),e(a)})["catch"](function(a){c(a),f(a)})})},b.prototype.updateRole=function(a){var b=arguments.length<=1||void 0===arguments[1]?null:arguments[1],c=arguments.length<=2||void 0===arguments[2]?function(a,b){}:arguments[2],d=this;return new Promise(function(e,f){"function"==typeof b&&(c=b),d.internal.updateRole(a,b).then(function(a){c(null,a),e(a)})["catch"](function(a){c(a),f(a)})})},b.prototype.deleteRole=function(a){var b=arguments.length<=1||void 0===arguments[1]?function(a){}:arguments[1],c=this;return new Promise(function(d,e){c.internal.deleteRole(a).then(function(){b(),d()})["catch"](function(a){b(a),e(a)})})},b.prototype.addMemberToRole=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?function(a){}:arguments[2],d=this;return new Promise(function(e,f){d.internal.addMemberToRole(a,b).then(function(){c(),e()})["catch"](function(a){c(a),f(a)})})},b.prototype.addUserToRole=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?function(a){}:arguments[2];return this.addMemberToRole(a,b,c)},b.prototype.removeMemberFromRole=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?function(a){}:arguments[2],d=this;return new Promise(function(e,f){d.internal.removeMemberFromRole(a,b).then(function(){c(),e()})["catch"](function(a){c(a),f(a)})})},b.prototype.removeUserFromRole=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?function(a){}:arguments[2];return this.removeUserFromRole(a,b,c)},b.prototype.createInvite=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?function(a,b){}:arguments[2],d=this;return new Promise(function(e,f){"function"==typeof b&&(c=b),d.internal.createInvite(a,b).then(function(a){c(null,a),e(a)})["catch"](function(a){c(a),f(a)})})},b.prototype.deleteInvite=function(a){var b=arguments.length<=1||void 0===arguments[1]?function(a){}:arguments[1],c=this;return new Promise(function(d,e){c.internal.deleteInvite(a).then(function(){b(),d()})["catch"](function(a){b(a),e(a)})})},b.prototype.overwritePermissions=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],d=arguments.length<=3||void 0===arguments[3]?function(a){}:arguments[3],e=this;return new Promise(function(f,g){e.internal.overwritePermissions(a,b,c).then(function(){d(),f()})["catch"](function(a){d(a),g(a)})})},b.prototype.setStatus=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?function(a){}:arguments[2],d=this;return new Promise(function(e,f){"function"==typeof b?c=b:"function"==typeof a&&(c=a),d.internal.setStatus(a,b).then(function(){c(),e()})["catch"](function(a){c(a),f(a)})})},b.prototype.sendTyping=function(a){var b=arguments.length<=1||void 0===arguments[1]?function(a){}:arguments[1],c=this;return new Promise(function(d,e){c.internal.sendTyping(a).then(function(){b(),d()})["catch"](function(a){b(a),e(a)})})},b.prototype.setTopic=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?function(a){}:arguments[2],d=this;return new Promise(function(e,f){d.internal.setTopic(a,b).then(function(){c(),e()})["catch"](function(a){c(a),f(a)})})},b.prototype.setChannelName=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?function(a){}:arguments[2],d=this;return new Promise(function(e,f){d.internal.setChannelName(a,b).then(function(){c(),e()})["catch"](function(a){c(a),f(a)})})},b.prototype.setChannelNameAndTopic=function(a,b,c){var d=arguments.length<=3||void 0===arguments[3]?function(a){}:arguments[3],e=this;return new Promise(function(f,g){e.internal.setChannelNameAndTopic(a,b,c).then(function(){d(),f()})["catch"](function(a){d(a),g(a)})})},b.prototype.updateChannel=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?function(a){}:arguments[2],d=this;return new Promise(function(e,f){d.internal.updateChannel(a,b).then(function(){c(),e()})["catch"](function(a){c(a),f(a)})})},b.prototype.startTyping=function(a){var b=arguments.length<=1||void 0===arguments[1]?function(a){}:arguments[1],c=this;return new Promise(function(d,e){c.internal.startTyping(a).then(function(){b(null),d()})["catch"](function(a){b(a),e(a)})})},b.prototype.stopTyping=function(a){var b=arguments.length<=1||void 0===arguments[1]?function(a){}:arguments[1],c=this;return new Promise(function(d,e){c.internal.stopTyping(a).then(function(){b(null),d()})["catch"](function(a){b(a),e(a)})})},b.prototype.updateDetails=function(a){var b=arguments.length<=1||void 0===arguments[1]?function(a){}:arguments[1],c=this;return new Promise(function(d,e){c.internal.updateDetails(a).then(function(){b(),d()})["catch"](function(a){b(a),e(a)})})},b.prototype.setUsername=function(a){var b=arguments.length<=1||void 0===arguments[1]?function(a){}:arguments[1],c=this;return new Promise(function(d,e){c.internal.setUsername(a).then(function(){b(),d()})["catch"](function(a){b(a),e(a)})})},b.prototype.setAvatar=function(a){var b=arguments.length<=1||void 0===arguments[1]?function(a){}:arguments[1],c=this;return new Promise(function(d,e){c.internal.setAvatar(a).then(function(){b(),d()})["catch"](function(a){b(a),e(a)})})},b.prototype.joinVoiceChannel=function(a){var b=arguments.length<=1||void 0===arguments[1]?function(a){}:arguments[1],c=this;return new Promise(function(d,e){c.internal.joinVoiceChannel(a).then(function(a){b(null,a),d(a)})["catch"](function(a){b(a),e(a)})})},b.prototype.leaveVoiceChannel=function(){var a=arguments.length<=0||void 0===arguments[0]?function(a){}:arguments[0],b=this;return new Promise(function(c,d){b.internal.leaveVoiceChannel().then(function(){a(),c()})["catch"](function(b){a(b),d(b)})})},f(b,[{key:"users",get:function(){return this.internal.users}},{key:"channels",get:function(){return this.internal.channels}},{key:"servers",get:function(){return this.internal.servers}},{key:"privateChannels",get:function(){return this.internal.private_channels}},{key:"voiceConnection",get:function(){return this.internal.voiceConnection}},{key:"readyTime",get:function(){return this.internal.readyTime}},{key:"uptime",get:function(){return this.internal.uptime}},{key:"user",get:function(){return this.internal.user}}]),b}(h);b.exports=i},{"./InternalClient.js":3,events:49}],2:[function(a,b,c){"use strict";c.IDLE=0,c.LOGGING_IN=1,c.LOGGED_IN=2,c.READY=3,c.DISCONNECTED=4},{}],3:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var e,f=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),g=(a("events"),a("superagent")),h=a("ws"),i=a("./ConnectionState.js"),j=a("../Constants.js"),k=j.Endpoints,l=j.PacketType,m=a("../Util/Cache.js"),n=a("./Resolver/Resolver.js"),o=a("../Structures/User.js"),p=a("../Structures/Channel.js"),q=a("../Structures/TextChannel.js"),r=a("../Structures/VoiceChannel.js"),s=a("../Structures/PMChannel.js"),t=a("../Structures/Server.js"),u=a("../Structures/Message.js"),v=a("../Structures/Role.js"),w=a("../Structures/Invite.js"),x=a("../Voice/VoiceConnection.js"),y=function(){function b(c){d(this,b),this.client=c,this.state=i.IDLE,this.websocket=null,this.client.options.compress&&(e=a("zlib")),this.users=new m,this.channels=new m,this.servers=new m,this.private_channels=new m,this.typingIntervals=[],this.voiceConnection=null,this.resolver=new n(this),this.readyTime=null}return b.prototype.leaveVoiceChannel=function(){var a=this;return new Promise(function(b,c){a.voiceConnection?(a.voiceConnection.destroy(),a.voiceConnection=null,b()):b()})},b.prototype.joinVoiceChannel=function(a){var b=this;return new Promise(function(c,d){var e=b.resolver.resolveVoiceChannel(a);if(e){var f=function(){var a,f,g,h=e.server,i=function j(i){var k=JSON.parse(i);if("VOICE_STATE_UPDATE"===k.t)a=k.d.session_id;else if("VOICE_SERVER_UPDATE"===k.t){f=k.d.token,g=k.d.endpoint;var l=b.voiceConnection=new x(e,b.client,a,f,h,g);l.on("ready",function(){return c(l)}),l.on("error",d),b.client.emit("debug","removed temporary voice websocket listeners"),b.websocket.removeListener("message",j)}};b.websocket.on("message",i),b.sendWS({op:4,d:{guild_id:h.id,channel_id:e.id,self_mute:!1,self_deaf:!1}})};b.leaveVoiceChannel().then(f)}else d(new Error("voice channel does not exist"))})},b.prototype.createServer=function(a){var b=arguments.length<=1||void 0===arguments[1]?"london":arguments[1],c=this;return new Promise(function(d,e){a=c.resolver.resolveString(a),g.post(k.SERVERS).set("authorization",c.token).send({name:a,region:b}).end(function(a,b){if(a)e(new Error(a));else var f=setInterval(function(){c.servers.get("id",b.body.id)&&(clearInterval(f),d(c.servers.get("id",b.body.id)))},20)})})},b.prototype.joinServer=function(a){var b=this;return new Promise(function(c,d){a=b.resolver.resolveInviteID(a),a?g.post(k.INVITE(a)).set("authorization",b.token).end(function(a,e){if(a)d(a);else var f=setInterval(function(){b.servers.get("id",e.body.guild.id)&&(clearInterval(f),c(b.servers.get("id",e.body.guild.id)))},20)}):d(new Error("Not a valid invite"))})},b.prototype.leaveServer=function(a){var b=this;return new Promise(function(c,d){var e=b.resolver.resolveServer(a);e?g.del(k.SERVER(e.id)).set("authorization",b.token).end(function(a,f){if(a)d(new Error(a));else{for(var g=e.channels,h=Array.isArray(g),i=0,g=h?g:g[Symbol.iterator]();;){var j;if(h){if(i>=g.length)break;j=g[i++]}else{if(i=g.next(),i.done)break;j=i.value}var k=j;b.channels.remove(k)}b.servers.remove(e),c()}}):d(new Error("server did not resolve"))})},b.prototype.login=function(a,b){var c=this,d=c.client;return new Promise(function(e,f){c.state===i.DISCONNECTED||c.state===i.IDLE?(c.state=i.LOGGING_IN,g.post(k.LOGIN).send({email:a,password:b}).end(function(g,h){if(g)c.state=i.DISCONNECTED,c.websocket=null,d.emit("disconnected"),f(new Error(g));else{var j=h.body.token;c.state=i.LOGGED_IN,c.token=j,c.email=a,c.password=b,c.getGateway().then(function(a){c.createWS(a),e(j)})["catch"](function(a){c.state=i.DISCONNECTED,d.emit("disconnected"),f(new Error(g))})}})):f(new Error("already logging in/logged in/ready!"))})},b.prototype.logout=function(){var a=this,b=this;return new Promise(function(c,d){return b.state===i.DISCONNECTED||b.state===i.IDLE?void d(new Error("Client is not logged in!")):void g.post(k.LOGOUT).set("authorization",b.token).end(function(e,f){e?d(new Error(e)):(a.websocket&&(a.websocket.close(),a.websocket=null),b.token=null,b.email=null,b.password=null,b.state=i.DISCONNECTED,c())})})},b.prototype.startPM=function(a){var b=this;return new Promise(function(c,d){var e=b.resolver.resolveUser(a);e?g.post(""+k.USER_CHANNELS(e.id)).set("authorization",b.token).send({recipient_id:e.id}).end(function(a,e){a?d(new Error(a)):c(b.private_channels.add(new s(e.body,b.client)))}):d(new Error("Unable to resolve resUser to a User"))})},b.prototype.getGateway=function(){var a=this;return new Promise(function(b,c){g.get(k.GATEWAY).set("authorization",a.token).end(function(a,d){a?c(a):b(d.body.url)})})},b.prototype.sendMessage=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],d=this;return new Promise(function(e,f){function h(a){var h=d.resolver.resolveString(b),i=d.resolver.resolveMentions(h);g.post(k.CHANNEL_MESSAGES(a.id)).set("authorization",d.token).send({content:h,mentions:i,tts:c.tts}).end(function(b,c){b?f(new Error(b)):e(a.messages.add(new u(c.body,a,d.client)))})}d.resolver.resolveChannel(a).then(h)["catch"](function(a){return f(new Error("Error resolving destination - "+a))})})},b.prototype.deleteMessage=function(a){var b=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],c=this;return new Promise(function(d,e){var f=c.resolver.resolveMessage(a);if(f){var h=function(){g.del(k.CHANNEL_MESSAGE(f.channel.id,f.id)).set("authorization",c.token).end(function(a,b){a?e(new Error(a)):(f.channel.messages.remove(f),d())})};b.wait?setTimeout(h,b.wait):h()}else e(new Error("Supplied message did not resolve to a message!"))})},b.prototype.updateMessage=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],d=this;return new Promise(function(e,f){var h=d.resolver.resolveMessage(a);if(h){var i=d.resolver.resolveString(b),j=d.resolver.resolveMentions(i);g.patch(k.CHANNEL_MESSAGE(h.channel.id,h.id)).set("authorization",d.token).send({content:i,tts:c.tts,mentions:j}).end(function(a,b){a?f(new Error(a)):e(h.channel.messages.update(h,new u(b.body,h.channel,d.client)))})}else f(new Error("Supplied message did not resolve to a message!"))})},b.prototype.sendFile=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?"image.png":arguments[2],d=this;return new Promise(function(e,f){function h(a){var h=d.resolver.resolveFile(b);g.post(k.CHANNEL_MESSAGES(a.id)).set("authorization",d.token).attach("file",h,c).end(function(b,c){b?f(new Error(b)):e(a.messages.add(new u(c.body,a,d.client)))})}d.resolver.resolveChannel(a).then(h)["catch"](function(a){return f(new Error("couldn't resolve to channel - "+a))})})},b.prototype.getChannelLogs=function(a){var b=arguments.length<=1||void 0===arguments[1]?500:arguments[1],c=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],d=this;return new Promise(function(e,f){function h(a){c.before&&(c.before=d.resolver.resolveMessage(c.before)),c.after&&(c.after=d.resolver.resolveMessage(c.after));var h=[];c.before&&h.push("before="+c.before.id),c.after&&h.push("after="+c.after.id);var i=h.join();""!==i&&(i="&"+h.join()),g.get(k.CHANNEL_MESSAGES(a.id)+"?limit="+b+i).set("authorization",d.token).end(function(b,c){if(b)f(new Error(b));else{var g=[];c.body.forEach(function(b){g.push(a.messages.add(new u(b,a,d.client)))}),e(g)}})}d.resolver.resolveChannel(a).then(h)["catch"](function(a){return f(new Error("couldn't resolve to channel - "+a))})})},b.prototype.getBans=function(a){var b=this;return new Promise(function(c,d){a=b.resolver.resolveServer(a),g.get(""+k.SERVER_BANS(a.id)).set("authorization",b.token).end(function(a,e){if(a)d(new Error(a));else{var f=[];e.body.forEach(function(a){f.push(b.users.add(new o(a.user,b.client)))}),c(f)}})})},b.prototype.createChannel=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?"text":arguments[2],d=this;return new Promise(function(e,f){a=d.resolver.resolveServer(a),g.post(k.SERVER_CHANNELS(a.id)).set("authorization",d.token).send({name:b,type:c}).end(function(b,c){if(b)f(b);else{var g;g="text"===c.body.type?new q(c.body,d.client,a):new r(c.body,d.client,a),e(a.channels.add(d.channels.add(g)))}})})},b.prototype.deleteChannel=function(a){var b=this;return new Promise(function(c,d){function e(a){g.del(k.CHANNEL(a.id)).set("authorization",b.token).end(function(e,f){e?d(e):(a.server.channels.remove(a),b.channels.remove(a),c())})}b.resolver.resolveChannel(a).then(e)["catch"](d)})},b.prototype.banMember=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?1:arguments[2],d=this;return new Promise(function(e,f){a=d.resolver.resolveUser(a),b=d.resolver.resolveServer(b),g.put(k.SERVER_BANS(b.id)+"/"+a.id+"/?delete-message-days="+c).set("authorization",d.token).end(function(a,b){a?f(a):e()})})},b.prototype.unbanMember=function(a,b){var c=this;return new Promise(function(d,e){b=c.resolver.resolveServer(b),a=c.resolver.resolveUser(a),g.del(k.SERVER_BANS(b.id)+"/"+a.id).set("authorization",c.token).end(function(a,b){a?e(a):d()})})},b.prototype.kickMember=function(a,b){var c=this;return new Promise(function(d,e){a=c.resolver.resolveUser(a),b=c.resolver.resolveServer(b),g.del(k.SERVER_MEMBERS(b.id)+"/"+a.id).set("authorization",c.token).end(function(a,b){a?e(a):d()})})},b.prototype.createRole=function(a,b){var c=this;return new Promise(function(d,e){a=c.resolver.resolveServer(a),g.post(k.SERVER_ROLES(a.id)).set("authorization",c.token).end(function(f,g){if(f)e(f);else{var h=a.roles.add(new v(g.body,a,c.client));b?c.updateRole(h,b).then(d)["catch"](e):d(h)}})})},b.prototype.updateRole=function(a,b){var c=this;return b=b||{},b.permissions=b.permissions||[],new Promise(function(d,e){for(var f=c.resolver.resolveServer(a.server),h=0,i=b.permissions,l=Array.isArray(i),m=0,i=l?i:i[Symbol.iterator]();;){var n;if(l){if(m>=i.length)break;n=i[m++]}else{if(m=i.next(),m.done)break;n=m.value}var o=n;h|=o instanceof String||"string"==typeof o?j.Permissions[o]||0:o}b.color=b.color||0,g.patch(k.SERVER_ROLES(f.id)+"/"+a.id).set("authorization",c.token).send({color:b.color||a.color,hoist:b.hoist||a.hoist,name:b.name||a.name,permissions:h}).end(function(b,g){if(b)e(b);else{var h=new v(g.body,f,c.client);d(f.roles.update(a,h))}})})},b.prototype.deleteRole=function(a){var b=this;return new Promise(function(c,d){g.del(k.SERVER_ROLES(a.server.id)+"/"+a.id).set("authorization",b.token).end(function(a,b){a?d(a):c()})})},b.prototype.addMemberToRole=function(a,b){var c=this;return new Promise(function(d,e){if(a=c.resolver.resolveUser(a),!a||!b)return void e(new Error("member/role not in server"));if(b.server.memberMap[a.id]){var f=b.server.memberMap[a.id].roles.map(function(a){return a.id}).concat(b.id);g.patch(k.SERVER_MEMBERS(b.server.id)+"/"+a.id).set("authorization",c.token).send({roles:f}).end(function(a){a?e(a):d()})}else e(new Error("member not in server"))})},b.prototype.removeMemberFromRole=function(a,b){var c=this;return new Promise(function(d,e){if(a=c.resolver.resolveUser(a),!a||!b)return void e(new Error("member/role not in server"));if(b.server.memberMap[a.id]){var f=b.server.memberMap[a.id].roles.map(function(a){return a.id});for(var h in f)f[h]===b.id&&f.splice(h,1);g.patch(k.SERVER_MEMBERS(b.server.id)+"/"+a.id).set("authorization",c.token).send({roles:f}).end(function(a){a?e(a):d()})}else e(new Error("member not in server"))})},b.prototype.createInvite=function(a,b){var c=this;return new Promise(function(d,e){if(a instanceof p||a instanceof t||(a=c.resolver.resolveServer(a)||c.resolver.resolveChannel(a)),!a)return void e(new Error("couldn't resolve where"));b?(b.max_age=b.maxAge||0,b.max_uses=b.maxUses||0,b.temporary=b.temporary||!1,b.xkcdpass=b.xkcd||!1):b={validate:null};var f;f=a instanceof p?k.CHANNEL_INVITES(a.id):k.SERVER_INVITES(a.id),g.post(f).set("authorization",c.token).send(b).end(function(a,b){a?e(a):d(new w(b.body,c.channels.get("id",b.body.channel.id),c.client))})})},b.prototype.deleteInvite=function(a){var b=this;return new Promise(function(c,d){a=b.resolver.resolveInviteID(a),a?g.del(k.INVITE(a)).set("authorization",b.token).end(function(a,b){a?d(a):c()}):d(new Error("Not a valid invite"))})},b.prototype.overwritePermissions=function(a,b,c){var d=this;return new Promise(function(e,f){function h(a){var h;b instanceof o&&(h=b);var i={};if(i.allow=0,i.deny=0,c.allow=c.allow||[],c.deny=c.deny||[],b instanceof v)i.id=b.id,i.type="role";else{if(!h)return void f(new Error("role incorrect"));i.id=h.id,i.type="member"}for(var l in c)c[l]?l instanceof String||"string"==typeof l?i.allow|=j.Permissions[l]||0:i.allow|=l:l instanceof String||"string"==typeof l?i.deny|=j.Permissions[l]||0:i.deny|=l;g.put(k.CHANNEL_PERMISSIONS(a.id)+"/"+i.id).set("authorization",d.token).send(i).end(function(a){a?f(a):e()})}a=d.resolver.resolveChannel(a)["catch"](f).then(h)})},b.prototype.setStatus=function(a,b){var c=this;return new Promise(function(d,e){var f={op:3,d:{idle_since:null,game_id:null}};a&&(f.d.idle_since=Date.now()),"number"==typeof b&&(f.d.game_id=b),c.sendWS(f),d()})},b.prototype.sendTyping=function(a){var b=this;return new Promise(function(c,d){function e(a){g.post(k.CHANNEL(a.id)+"/typing").set("authorization",b.token).end(function(a,b){a?d(a):c()})}b.resolver.resolveChannel(a).then(e)["catch"](d)})},b.prototype.startTyping=function(a){var b=this;return new Promise(function(c,d){function e(a){return b.typingIntervals[a.id]?void d(new Error("Already typing in that channel")):(b.sendTyping(a),void(b.typingIntervals[a.id]=setInterval(function(){return b.sendTyping(a)},4e3)))}b.resolver.resolveChannel(a).then(e)["catch"](d)})},b.prototype.stopTyping=function(a){var b=this;return new Promise(function(c,d){function e(a){return b.typingIntervals[a.id]?(clearInterval(b.typingIntervals[a.id]),void(b.typingIntervals[a.id]=!1)):void d(new Error("Not typing in that channel"))}b.resolver.resolveChannel(a).then(e)["catch"](d)})},b.prototype.updateDetails=function(a){var b=this;return new Promise(function(c,d){g.patch(k.ME).set("authorization",b.token).send({avatar:b.resolver.resolveToBase64(a.avatar)||b.user.avatar,email:a.email||b.email,new_password:a.newPassword||null,password:a.password||b.password,username:a.username||b.user.username}).end(function(a){a?d(a):c()})})},b.prototype.setAvatar=function(a){return this.updateDetails({avatar:a})},b.prototype.setUsername=function(a){return this.updateDetails({username:a})},b.prototype.setTopic=function(a){var b=arguments.length<=1||void 0===arguments[1]?"":arguments[1],c=this;return new Promise(function(d,e){function f(a){g.patch(k.CHANNEL(a.id)).set("authorization",c.token).send({name:a.name,position:a.position,topic:b}).end(function(b,c){b?e(b):(a.topic=c.body.topic,d())})}c.resolver.resolveChannel(a).then(f)["catch"](e)})},b.prototype.setChannelName=function(a){var b=arguments.length<=1||void 0===arguments[1]?"discordjs_is_the_best":arguments[1],c=this;return new Promise(function(d,e){function f(a){g.patch(k.CHANNEL(a.id)).set("authorization",c.token).send({name:b,position:a.position,topic:a.topic}).end(function(b,c){b?e(b):(a.name=c.body.name,d())})}c.resolver.resolveChannel(a).then(f)["catch"](e)})},b.prototype.setChannelNameAndTopic=function(a){var b=arguments.length<=1||void 0===arguments[1]?"discordjs_is_the_best":arguments[1],c=arguments.length<=2||void 0===arguments[2]?"":arguments[2],d=this;return new Promise(function(e,f){function h(a){g.patch(k.CHANNEL(a.id)).set("authorization",d.token).send({name:b,position:a.position,topic:c}).end(function(b,c){b?f(b):(a.name=c.body.name,a.topic=c.body.topic,e())})}d.resolver.resolveChannel(a).then(h)["catch"](f)})},b.prototype.updateChannel=function(a,b){return this.setChannelNameAndTopic(a,b.name,b.topic)},b.prototype.ack=function(a){var b=this;return new Promise(function(c,d){a=b.resolver.resolveMessage(a),a?g.post(k.CHANNEL_MESSAGE(a.channel.id,a.id)+"/ack").set("authorization",b.token).end(function(a){a?d(a):c()}):d(new Error("Message does not exist"))})},b.prototype.sendWS=function(a){this.websocket&&this.websocket.send(JSON.stringify(a))},b.prototype.createWS=function(b){var c=this,d=c.client;return this.websocket?!1:(this.websocket=new h(b),this.websocket.onopen=function(){c.sendWS({op:2,d:{token:c.token,v:3,compress:c.client.options.compress,properties:{$os:"discord.js",$browser:"discord.js",$device:"discord.js",$referrer:"discord.js",$referring_domain:"discord.js"}}})},this.websocket.onclose=function(){c.websocket=null,c.state=i.DISCONNECTED,d.emit("disconnected")},this.websocket.onerror=function(a){d.emit("error",a)},void(this.websocket.onmessage=function(b){"Binary"===b.type&&(e||(e=a("zlib")),b.data=e.inflateSync(b.data).toString());var f,g;try{f=JSON.parse(b.data),g=f.d}catch(b){return void d.emit("error",b)}switch(d.emit("raw",f),f.t){case l.READY:var h=Date.now();c.user=c.users.add(new o(g.user,d)),g.guilds.forEach(function(a){c.servers.add(new t(a,d))}),g.private_channels.forEach(function(a){c.private_channels.add(new s(a,d))}),c.state=i.READY,setInterval(function(){return c.sendWS({op:1,d:Date.now()})},g.heartbeat_interval),d.emit("ready"),d.emit("debug","ready packet took "+(Date.now()-h)+"ms to process"),d.emit("debug","ready with "+c.servers.length+" servers, "+c.channels.length+" channels and "+c.users.length+" users cached."),c.readyTime=Date.now();break;case l.MESSAGE_CREATE:var j=c.channels.get("id",g.channel_id)||c.private_channels.get("id",g.channel_id);if(j){var k=j.messages.add(new u(g,j,d));d.emit("message",k),c.ack(k)}else d.emit("warn","message created but channel is not cached");break;case l.MESSAGE_DELETE:var j=c.channels.get("id",g.channel_id)||c.private_channels.get("id",g.channel_id);if(j){var k=j.messages.get("id",g.id);d.emit("messageDeleted",k),k&&j.messages.remove(k)}else d.emit("warn","message was deleted but channel is not cached");break;case l.MESSAGE_UPDATE:var j=c.channels.get("id",g.channel_id)||c.private_channels.get("id",g.channel_id);if(j){var k=j.messages.get("id",g.id);if(k){g.nonce=g.nonce||k.nonce,g.attachments=g.attachments||k.attachments,g.tts=g.tts||k.tts,g.embeds=g.embeds||k.embeds,g.timestamp=g.timestamp||k.timestamp,
|
||
g.mention_everyone=g.mention_everyone||k.everyoneMentioned,g.content=g.content||k.content,g.mentions=g.mentions||k.mentions,g.author=g.author||k.author;var m=j.messages.update(k,new u(g,j,d));d.emit("messageUpdated",m,k)}}else d.emit("warn","message was updated but channel is not cached");break;case l.SERVER_CREATE:var n=c.servers.get("id",g.id);n||(c.servers.add(new t(g,d)),d.emit("serverCreated",n));break;case l.SERVER_DELETE:var n=c.servers.get("id",g.id);if(n){for(var p=n.channels,w=Array.isArray(p),x=0,p=w?p:p[Symbol.iterator]();;){var y;if(w){if(x>=p.length)break;y=p[x++]}else{if(x=p.next(),x.done)break;y=x.value}var j=y;c.channels.remove(j)}c.servers.remove(n),d.emit("serverDeleted",n)}else d.emit("warn","server was deleted but it was not in the cache");break;case l.SERVER_UPDATE:var n=c.servers.get("id",g.id);if(n){g.members=g.members||[],g.channels=g.channels||[];var z=new t(g,c);z.members=n.members,z.memberMap=n.memberMap,z.channels=n.channels,z.equalsStrict(n)?d.emit("debug","received server update but server already updated"):(c.servers.update(n,z),d.emit("serverUpdated",n,z))}else n||(d.emit("warn","server was updated but it was not in the cache"),c.servers.add(new t(g,c)),d.emit("serverCreated",n));break;case l.CHANNEL_CREATE:var j=c.channels.get("id",g.id);if(j)d.emit("warn","channel created but already in cache");else{var n=c.servers.get("id",g.guild_id);if(n)if(g.is_private)d.emit("channelCreated",c.private_channels.add(new s(g,d)));else{var A=null;A="text"===g.type?c.channels.add(new q(g,d,n)):c.channels.add(new r(g,d,n)),d.emit("channelCreated",n.channels.add(A))}else d.emit("warn","channel created but server does not exist")}break;case l.CHANNEL_DELETE:var j=c.channels.get("id",g.id);j?(j.server&&j.server.channels.remove(j),c.channels.remove(j),d.emit("channelDeleted",j)):d.emit("warn","channel deleted but already out of cache?");break;case l.CHANNEL_UPDATE:var j=c.channels.get("id",g.id)||c.private_channels.get("id",g.id);if(j)if(j instanceof s)d.emit("channelUpdated",j,c.private_channels.update(j,new s(g,d)));else if(j.server)if("text"===j.type){var A=new q(g,d,j.server);A.messages=j.messages,j.server.channels.update(j,A),c.channels.update(j,A),d.emit("channelUpdated",j,A)}else{var A=new r(g,d,j.server);j.server.channels.update(j,A),c.channels.update(j,A),d.emit("channelUpdated",j,A)}else d.emit("warn","channel updated but server non-existant");else d.emit("warn","channel updated but not in cache");break;case l.SERVER_ROLE_CREATE:var n=c.servers.get("id",g.guild_id);n?d.emit("serverRoleCreated",n.roles.add(new v(g.role,n,d)),n):d.emit("warn","server role made but server not in cache");break;case l.SERVER_ROLE_DELETE:var n=c.servers.get("id",g.guild_id);if(n){var B=n.roles.get("id",g.role_id);B?(n.roles.remove(B),d.emit("serverRoleDeleted",B)):d.emit("warn","server role deleted but role not in cache")}else d.emit("warn","server role deleted but server not in cache");break;case l.SERVER_ROLE_UPDATE:var n=c.servers.get("id",g.guild_id);if(n){var B=n.roles.get("id",g.role.id);if(B){var C=new v(g.role,n,d);n.roles.update(B,C),d.emit("serverRoleUpdated",B,C)}else d.emit("warn","server role updated but role not in cache")}else d.emit("warn","server role updated but server not in cache");break;case l.SERVER_MEMBER_ADD:var n=c.servers.get("id",g.guild_id);n?(n.memberMap[g.user.id]={roles:g.roles.map(function(a){return n.roles.get("id",a)}),mute:!1,deaf:!1,joinedAt:Date.parse(g.joined_at)},d.emit("serverNewMember",n,n.members.add(c.users.add(new o(g.user,d))))):d.emit("warn","server member added but server doesn't exist in cache");break;case l.SERVER_MEMBER_REMOVE:var n=c.servers.get("id",g.guild_id);if(n){var D=c.users.get("id",g.user.id);D?(n.memberMap[g.user.id]=null,n.members.remove(D),d.emit("serverMemberRemoved",n,D)):d.emit("warn","server member removed but user doesn't exist in cache")}else d.emit("warn","server member removed but server doesn't exist in cache");break;case l.SERVER_MEMBER_UPDATE:var n=c.servers.get("id",g.guild_id);if(n){var D=c.users.get("id",g.user.id);D?(n.memberMap[g.user.id].roles=g.roles.map(function(a){return n.roles.get("id",a)}),n.memberMap[g.user.id].mute=g.mute,n.memberMap[g.user.id].deaf=g.deaf,d.emit("serverMemberUpdated",n,D)):d.emit("warn","server member removed but user doesn't exist in cache")}else d.emit("warn","server member updated but server doesn't exist in cache");break;case l.PRESENCE_UPDATE:var D=c.users.get("id",g.user.id);if(D){g.user.username=g.user.username||D.username,g.user.id=g.user.id||D.id,g.user.avatar=g.user.avatar||D.avatar,g.user.discriminator=g.user.discriminator||D.discriminator;var E=new o(g.user,d);E.equalsStrict(D)?(d.emit("presence",D,g.status,g.game_id),D.status=g.status,D.gameID=g.game_id):(d.emit("userUpdate",D,E),c.users.update(D,E))}else d.emit("warn","presence update but user not in cache");break;case l.TYPING:var D=c.users.get("id",g.user_id),j=c.channels.get("id",g.channel_id)||c.private_channels.get("id",g.channel_id);D&&j?(D.typing.since?(D.typing.since=Date.now(),D.typing.channel=j):(D.typing.since=Date.now(),D.typing.channel=j,d.emit("userTypingStart",D,j)),setTimeout(function(){Date.now()-D.typing.since>5500&&(D.typing.since=null,D.typing.channel=null,d.emit("userTypingStop",D,j))},6e3)):d.emit("warn","user typing but user or channel not existant in cache");break;case l.SERVER_BAN_ADD:var D=c.users.get("id",g.user.id),n=c.servers.get("id",g.guild_id);D&&n?d.emit("userBanned",D,n):d.emit("warn","user banned but user/server not in cache.");break;case l.SERVER_BAN_REMOVE:var D=c.users.get("id",g.user.id),n=c.servers.get("id",g.guild_id);D&&n?d.emit("userUnbanned",D,n):d.emit("warn","user unbanned but user/server not in cache.")}}))},f(b,[{key:"uptime",get:function(){return this.readyTime?Date.now()-this.readyTime:null}}]),b}();b.exports=y},{"../Constants.js":5,"../Structures/Channel.js":6,"../Structures/Invite.js":8,"../Structures/Message.js":9,"../Structures/PMChannel.js":10,"../Structures/Role.js":12,"../Structures/Server.js":13,"../Structures/TextChannel.js":15,"../Structures/User.js":16,"../Structures/VoiceChannel.js":17,"../Util/Cache.js":19,"../Voice/VoiceConnection.js":23,"./ConnectionState.js":2,"./Resolver/Resolver.js":4,events:49,superagent:80,ws:83,zlib:44}],4:[function(a,b,c){(function(c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var e=a("fs"),f=a("../../Structures/User.js"),g=a("../../Structures/Channel.js"),h=a("../../Structures/TextChannel.js"),i=a("../../Structures/VoiceChannel.js"),j=a("../../Structures/ServerChannel.js"),k=a("../../Structures/PMChannel.js"),l=a("../../Structures/Server.js"),m=a("../../Structures/Message.js"),n=a("../../Structures/Invite.js"),o=function(){function a(b){d(this,a),this.internal=b}return a.prototype.resolveToBase64=function(a){return a instanceof c&&(a=a.toString("base64"),a="data:image/jpg;base64,"+a),a},a.prototype.resolveInviteID=function(a){if(a instanceof n)return a.id;if("string"==typeof a||a instanceof String){if(0===a.indexOf("http")){var b=a.split("/");return b.pop()}return a}return null},a.prototype.resolveServer=function(a){return a instanceof l?a:a instanceof j?a.server:a instanceof String||"string"==typeof a?this.internal.servers.get("id",a):a instanceof m&&a.channel instanceof h?a.server:null},a.prototype.resolveFile=function(a){return"string"==typeof a||a instanceof String?e.createReadStream(a):a},a.prototype.resolveMentions=function(a){for(var b=[],c=a.match(/<@[^>]*>/g)||[],d=Array.isArray(c),e=0,c=d?c:c[Symbol.iterator]();;){var f;if(d){if(e>=c.length)break;f=c[e++]}else{if(e=c.next(),e.done)break;f=e.value}var g=f;b.push(g.substring(2,g.length-1))}return b},a.prototype.resolveString=function(a){var b=a;return a instanceof Array&&(b=a.join("\n")),b.toString()},a.prototype.resolveUser=function(a){var b=null;if(a instanceof f)b=a;else if(a instanceof m)b=a.author;else if(a instanceof h){var c=a.lastMessage;c&&(b=c.author)}else a instanceof l?b=a.owner:a instanceof k?b=a.recipient:(a instanceof String||"string"==typeof a)&&(b=this.client.internal.users.get("id",a));return b},a.prototype.resolveMessage=function(a){var b=null;return a instanceof h||a instanceof k?b=a.lastMessage:a instanceof m&&(b=a),b},a.prototype.resolveVoiceChannel=function(a){return a instanceof i?a:null},a.prototype.resolveChannel=function(a){var b=this;return new Promise(function(c,d){var e=null;if(a instanceof m)e=a.channel;else if(a instanceof g)e=a;else if(a instanceof l)e=a.channels.get("id",a.id);else if(a instanceof String||"string"==typeof a)e=b.internal.channels.get("id",a);else if(a instanceof f){for(var h=!1,i=b.internal.private_channels,j=Array.isArray(i),k=0,i=j?i:i[Symbol.iterator]();;){var n;if(j){if(k>=i.length)break;n=i[k++]}else{if(k=i.next(),k.done)break;n=k.value}var o=n;if(o.recipient.equals(a)){h=o;break}}if(!h)return void b.internal.startPM(a).then(function(a){return c(a)})["catch"](function(a){return d(a)});e=h}e?c(e):d(new Error("Didn't found anything"))})},a}();b.exports=o}).call(this,a("buffer").Buffer)},{"../../Structures/Channel.js":6,"../../Structures/Invite.js":8,"../../Structures/Message.js":9,"../../Structures/PMChannel.js":10,"../../Structures/Server.js":13,"../../Structures/ServerChannel.js":14,"../../Structures/TextChannel.js":15,"../../Structures/User.js":16,"../../Structures/VoiceChannel.js":17,buffer:45,fs:29}],5:[function(a,b,c){"use strict";var d="https://discordapp.com/api",e={LOGIN:d+"/auth/login",LOGOUT:d+"/auth/logout",ME:d+"/users/@me",GATEWAY:d+"/gateway",USER_CHANNELS:function(a){return d+"/users/"+a+"/channels"},AVATAR:function(a,b){return d+"/users/"+a+"/avatars/"+b+".jpg"},INVITE:function(a){return d+"/invite/"+a},SERVERS:d+"/guilds",SERVER:function(a){return e.SERVERS+"/"+a},SERVER_ICON:function(a,b){return e.SERVER(a)+"/icons/"+b+".jpg"},SERVER_PRUNE:function(a){return e.SERVER(a)+"/prune"},SERVER_EMBED:function(a){return e.SERVER(a)+"/embed"},SERVER_INVITES:function(a){return e.SERVER(a)+"/invites"},SERVER_ROLES:function(a){return e.SERVER(a)+"/roles"},SERVER_BANS:function(a){return e.SERVER(a)+"/bans"},SERVER_INTEGRATIONS:function(a){return e.SERVER(a)+"/integrations"},SERVER_MEMBERS:function(a){return e.SERVER(a)+"/members"},SERVER_CHANNELS:function(a){return e.SERVER(a)+"/channels"},CHANNELS:d+"/channels",CHANNEL:function(a){return e.CHANNELS+"/"+a},CHANNEL_MESSAGES:function(a){return e.CHANNEL(a)+"/messages"},CHANNEL_INVITES:function(a){return e.CHANNEL(a)+"/invites"},CHANNEL_TYPING:function(a){return e.CHANNEL(a)+"/typing"},CHANNEL_PERMISSIONS:function(a){return e.CHANNEL(a)+"/permissions"},CHANNEL_MESSAGE:function(a,b){return e.CHANNEL_MESSAGES(a)+"/"+b}},f={createInstantInvite:1,kickMembers:2,banMembers:4,manageRoles:8,managePermissions:8,manageChannels:16,manageChannel:16,manageServer:32,readMessages:1024,sendMessages:2048,sendTTSMessages:4096,manageMessages:8192,embedLinks:16384,attachFiles:32768,readMessageHistory:65536,mentionEveryone:1<<17,voiceConnect:1<<20,voiceSpeak:1<<21,voiceMuteMembers:1<<22,voiceDeafenMembers:1<<23,voiceMoveMembers:1<<24,voiceUseVAD:1<<25},g={READY:"READY",MESSAGE_CREATE:"MESSAGE_CREATE",MESSAGE_UPDATE:"MESSAGE_UPDATE",MESSAGE_DELETE:"MESSAGE_DELETE",SERVER_CREATE:"GUILD_CREATE",SERVER_DELETE:"GUILD_DELETE",SERVER_UPDATE:"GUILD_UPDATE",CHANNEL_CREATE:"CHANNEL_CREATE",CHANNEL_DELETE:"CHANNEL_DELETE",CHANNEL_UPDATE:"CHANNEL_UPDATE",SERVER_ROLE_CREATE:"GUILD_ROLE_CREATE",SERVER_ROLE_DELETE:"GUILD_ROLE_DELETE",SERVER_ROLE_UPDATE:"GUILD_ROLE_UPDATE",SERVER_MEMBER_ADD:"GUILD_MEMBER_ADD",SERVER_MEMBER_REMOVE:"GUILD_MEMBER_REMOVE",SERVER_MEMBER_UPDATE:"GUILD_MEMBER_UPDATE",PRESENCE_UPDATE:"PRESENCE_UPDATE",TYPING:"TYPING_START",SERVER_BAN_ADD:"GUILD_BAN_ADD",SERVER_BAN_REMOVE:"GUILD_BAN_REMOVE"};c.API_ENDPOINT=d,c.Endpoints=e,c.PacketType=g,c.Permissions=f},{}],6:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var f=a("../Util/Equality.js"),g=(a("../Util/Cache.js"),a("./PermissionOverwrite.js"),a("../Util/ArgumentRegulariser.js").reg),h=function(a){function b(c,e){d(this,b),a.call(this),this.id=c.id,this.client=e}return e(b,a),b.prototype["delete"]=function(){return this.client.deleteChannel.apply(this.client,g(this,arguments))},b}(f);b.exports=h},{"../Util/ArgumentRegulariser.js":18,"../Util/Cache.js":19,"../Util/Equality.js":20,"./PermissionOverwrite.js":11}],7:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var e=a("../Constants.js").Permissions,f=function(){function a(b){d(this,a),this.permissions=b}return a.prototype.serialise=function(a){var b=this,c=function(c){return b.hasPermission(c,a)};return{createInstantInvite:c(e.createInstantInvite),kickMembers:c(e.kickMembers),banMembers:c(e.banMembers),managePermissions:c(e.managePermissions),manageChannel:c(e.manageChannel),manageServer:c(e.manageServer),readMessages:c(e.readMessages),sendMessages:c(e.sendMessages),sendTTSMessages:c(e.sendTTSMessages),manageMessages:c(e.manageMessages),embedLinks:c(e.embedLinks),attachFiles:c(e.attachFiles),readMessageHistory:c(e.readMessageHistory),mentionEveryone:c(e.mentionEveryone),voiceConnect:c(e.voiceConnect),voiceSpeak:c(e.voiceSpeak),voiceMuteMembers:c(e.voiceMuteMembers),voiceDeafenMembers:c(e.voiceDeafenMembers),voiceMoveMembers:c(e.voiceMoveMembers),voiceUseVAD:c(e.voiceUseVAD)}},a.prototype.serialize=function(){return this.serialise()},a.prototype.hasPermission=function(a){var b=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];return(a instanceof String||"string"==typeof a)&&(a=e[a]),a?!b&&this.permissions&e.manageRoles?!0:!!(this.permissions&a):!1},a}();b.exports=f},{"../Constants.js":5}],8:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var e=(a("./Server.js"),a("./ServerChannel.js"),function(){function a(b,c,e){d(this,a),this.maxAge=b.max_age,this.code=b.code,this.server=c.server,this.channel=c,this.revoked=b.revoked,this.createdAt=Date.parse(b.created_at),this.temporary=b.temporary,this.uses=b.uses,this.maxUses=b.uses,this.inviter=e.internal.users.get("id",b.inviter.id),this.xkcd=b.xkcdpass}return a.prototype.toString=function(){return"https://discord.gg/"+this.code},a}());b.exports=e},{"./Server.js":13,"./ServerChannel.js":14}],9:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var f=a("../Util/Cache.js"),g=a("./User.js"),h=a("../Util/ArgumentRegulariser.js").reg,i=a("../Util/Equality"),j=function(a){function b(c,e,h){var i=this;d(this,b),a.call(this),this.channel=e,this.client=h,this.nonce=c.nonce,this.attachments=c.attachments,this.tts=c.tts,this.embeds=c.embeds,this.timestamp=Date.parse(c.timestamp),this.everyoneMentioned=c.mention_everyone,this.id=c.id,c.edited_timestamp&&(this.editedTimestamp=Date.parse(c.edited_timestamp)),c.author instanceof g?this.author=c.author:this.author=h.internal.users.add(new g(c.author,h)),this.content=c.content,this.mentions=new f,c.mentions.forEach(function(a){a instanceof g?i.mentions.push(a):i.mentions.add(h.internal.users.add(new g(a,h)))})}return e(b,a),b.prototype.isMentioned=function(a){return a=this.client.internal.resolver.resolveUser(a),a?this.mentions.has("id",a.id):!1},b.prototype.toString=function(){return this.content},b.prototype["delete"]=function(){return this.client.deleteMessage.apply(this.client,h(this,arguments))},b.prototype.update=function(){return this.client.updateMessage.apply(this.client,h(this,arguments))},b.prototype.reply=function(){return this.client.reply.apply(this.client,h(this,arguments))},b.prototype.replyTTS=function(){return this.client.replyTTS.apply(this.client,h(this,arguments))},b}(i);b.exports=j},{"../Util/ArgumentRegulariser.js":18,"../Util/Cache.js":19,"../Util/Equality":20,"./User.js":16}],10:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var f=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),g=a("./Channel.js"),h=a("./User.js"),i=(a("../Util/Equality.js"),a("../Util/Cache.js")),j=a("../Util/ArgumentRegulariser.js").reg,k=function(a){function b(c,e){d(this,b),a.call(this,c,e),this.type=c.type||"text",this.lastMessageId=c.last_message_id,this.messages=new i("id",1e3),this.recipient=this.client.internal.users.add(new h(c.recipient,this.client))}return e(b,a),b.prototype.toString=function(){return this.recipient.toString()},b.prototype.sendMessage=function(){return this.client.sendMessage.apply(this.client,j(this,arguments))},b.prototype.sendTTSMessage=function(){return this.client.sendTTSMessage.apply(this.client,j(this,arguments))},f(b,[{key:"lastMessage",get:function(){return this.messages.get("id",this.lastMessageID)}}]),b}(g);b.exports=k},{"../Util/ArgumentRegulariser.js":18,"../Util/Cache.js":19,"../Util/Equality.js":20,"./Channel.js":6,"./User.js":16}],11:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=a("../Constants.js").Permissions,g=function(){function a(b){d(this,a),this.id=b.id,this.type=b.type,this.deny=b.deny,this.allow=b.allow}return a.prototype.setAllowed=function(a){var b=this;a.forEach(function(a){(a instanceof String||"string"==typeof a)&&(a=f[a]),a&&(b.allow|=1<<a)})},a.prototype.setDenied=function(a){var b=this;a.forEach(function(a){(a instanceof String||"string"==typeof a)&&(a=f[a]),a&&(b.deny|=1<<a)})},e(a,[{key:"allowed",get:function(){var a=[];for(var b in f)"manageRoles"!==b&&"manageChannels"!==b&&this.allow&f[b]&&a.push(b);return a}},{key:"denied",get:function(){var a=[];for(var b in f)"manageRoles"!==b&&"manageChannels"!==b&&this.deny&f[b]&&a.push(b);return a}}]),a}();b.exports=g},{"../Constants.js":5}],12:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var e=a("../Constants.js").Permissions,f=[e.createInstantInvite,e.readMessages,e.readMessageHistory,e.sendMessages,e.sendTTSMessages,e.embedLinks,e.attachFiles,e.readMessageHistory,e.mentionEveryone,e.voiceConnect,e.voiceSpeak,e.voiceUseVAD].reduce(function(a,b){return a|b},0),g=function(){function a(b,c,e){d(this,a),this.position=b.position||-1,this.permissions=b.permissions||("@everyone"===b.name?f:0),this.name=b.name||"@everyone",this.managed=b.managed||!1,this.id=b.id,this.hoist=b.hoist||!1,this.color=b.color||0,this.server=c,this.client=e}return a.prototype.serialise=function(a){var b=this,c=function(c){return b.hasPermission(c,a)};return{createInstantInvite:c(e.createInstantInvite),kickMembers:c(e.kickMembers),banMembers:c(e.banMembers),manageRoles:c(e.manageRoles),manageChannels:c(e.manageChannels),manageServer:c(e.manageServer),readMessages:c(e.readMessages),sendMessages:c(e.sendMessages),sendTTSMessages:c(e.sendTTSMessages),manageMessages:c(e.manageMessages),embedLinks:c(e.embedLinks),attachFiles:c(e.attachFiles),readMessageHistory:c(e.readMessageHistory),mentionEveryone:c(e.mentionEveryone),voiceConnect:c(e.voiceConnect),voiceSpeak:c(e.voiceSpeak),voiceMuteMembers:c(e.voiceMuteMembers),voiceDeafenMembers:c(e.voiceDeafenMembers),voiceMoveMembers:c(e.voiceMoveMembers),voiceUseVAD:c(e.voiceUseVAD)}},a.prototype.serialize=function(){return this.serialise()},a.prototype.hasPermission=function(a){var b=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];return(a instanceof String||"string"==typeof a)&&(a=e[a]),a?!b&&this.permissions&e.manageRoles?!0:!!(this.permissions&a):!1},a.prototype.setPermission=function(a,b){(a instanceof String||"string"==typeof a)&&(a=e[a]),a&&(b?this.permissions|=a:this.permissions&=~a)},a.prototype.setPermissions=function(a){var b=this;a.forEach(function(a,c){(c instanceof String||"string"==typeof c)&&(c=e[c]),c&&b.setPermission(c,a)})},a.prototype.colorAsHex=function(){for(var a=this.color.toString();a.length<6;)a="0"+a;return"#"+a},a}();b.exports=g},{"../Constants.js":5}],13:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var f=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),g=a("../Util/Equality.js"),h=a("../Constants.js").Endpoints,i=a("../Util/Cache.js"),j=a("./User.js"),k=a("./TextChannel.js"),l=a("./VoiceChannel.js"),m=a("./Role.js"),n=["region","ownerID","name","id","icon","afkTimeout","afkChannelID"],o=function(a){function b(c,e){var f=this;d(this,b),a.call(this);var g=this;this.client=e,this.region=c.region,this.ownerID=c.owner_id,this.name=c.name,this.id=c.id,this.members=new i,this.channels=new i,this.roles=new i,this.icon=c.icon,this.afkTimeout=c.afkTimeout,this.afkChannelID=c.afk_channel_id,this.memberMap={};var g=this;if(c.roles.forEach(function(a){f.roles.add(new m(a,f,e))}),c.members.forEach(function(a){f.memberMap[a.user.id]={roles:a.roles.map(function(a){return g.roles.get("id",a)}),mute:a.mute,deaf:a.deaf,joinedAt:Date.parse(a.joined_at)};var b=e.internal.users.add(new j(a.user,e));f.members.add(b)}),c.channels.forEach(function(a){if("text"===a.type){var b=e.internal.channels.add(new k(a,e,f));f.channels.add(b)}else{var b=e.internal.channels.add(new l(a,e,f));f.channels.add(b)}}),c.presences)for(var h=c.presences,n=Array.isArray(h),o=0,h=n?h:h[Symbol.iterator]();;){var p;if(n){if(o>=h.length)break;p=h[o++]}else{if(o=h.next(),o.done)break;p=o.value}var q=p,r=e.internal.users.get("id",q.user.id);r&&(r.status=q.status,r.gameID=q.game_id)}}return e(b,a),b.prototype.rolesOfUser=function(a){return a=this.client.internal.resolver.resolveUser(a),a?this.memberMap[a.id]?this.memberMap[a.id].roles:[]:null},b.prototype.rolesOf=function(a){return this.rolesOfUser(a)},b.prototype.toString=function(){return this.name},b.prototype.equalsStrict=function(a){if(!(a instanceof b))return!1;for(var c=n,d=Array.isArray(c),e=0,c=d?c:c[Symbol.iterator]();;){var f;if(d){if(e>=c.length)break;f=c[e++]}else{if(e=c.next(),e.done)break;f=e.value}var g=f;if(a[g]!==this[g])return!1}return!0},f(b,[{key:"iconURL",get:function(){return this.icon?h.SERVER_ICON(this.id,this.icon):null}},{key:"afkChannel",get:function(){return this.channels.get("id",this.afkChannelID)}},{key:"defaultChannel",get:function(){return this.channels.get("id",this.id)}},{key:"owner",get:function(){return this.members.get("id",this.ownerID)}}]),b}(g);b.exports=o},{"../Constants.js":5,"../Util/Cache.js":19,"../Util/Equality.js":20,"./Role.js":12,"./TextChannel.js":15,"./User.js":16,"./VoiceChannel.js":17}],14:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var f=a("./Channel.js"),g=a("../Util/Cache.js"),h=a("./PermissionOverwrite.js"),i=a("./ChannelPermissions.js"),j=a("../Util/ArgumentRegulariser.js").reg,k=function(a){function b(c,e,f){var i=this;d(this,b),a.call(this,c,e),this.name=c.name,this.type=c.type,this.position=c.position,this.permissionOverwrites=new g,this.server=f,c.permission_overwrites.forEach(function(a){i.permissionOverwrites.add(new h(a))})}return e(b,a),b.prototype.permissionsOf=function(a){if(a=this.client.internal.resolver.resolveUser(a)){if(this.server.owner.equals(a))return new i(4294967295);var b=this.server.roles.get("name","@everyone"),c=[b].concat(this.server.rolesOf(a)||[]),d=c.map(function(a){return a.id}),e=[],f=[];this.permissionOverwrites.forEach(function(b){"member"===b.type&&b.id===a.id?f.push(b):"role"===b.type&&b.id in d&&e.push(b)});for(var g=0,h=c,j=Array.isArray(h),k=0,h=j?h:h[Symbol.iterator]();;){var l;if(j){if(k>=h.length)break;l=h[k++]}else{if(k=h.next(),k.done)break;l=k.value}var m=l;g|=m.permissions}for(var n=e.concat(f),o=Array.isArray(n),p=0,n=o?n:n[Symbol.iterator]();;){var q;if(o){if(p>=n.length)break;q=n[p++]}else{if(p=n.next(),p.done)break;q=p.value}var r=q;g&=~r.deny,g|=r.allow}return new i(g)}return null},b.prototype.permsOf=function(a){return this.permissionsOf(a)},b.prototype.mention=function(){return"<#"+this.id+">"},b.prototype.toString=function(){return this.mention()},b.prototype.setName=function(){return this.client.setChannelName.apply(this.client,j(this,arguments))},b}(f);b.exports=k},{"../Util/ArgumentRegulariser.js":18,"../Util/Cache.js":19,"./Channel.js":6,"./ChannelPermissions.js":7,"./PermissionOverwrite.js":11}],15:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var f=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),g=a("./ServerChannel.js"),h=a("../Util/Cache.js"),i=a("../Util/ArgumentRegulariser.js").reg,j=function(a){function b(c,e,f){d(this,b),a.call(this,c,e,f),this.topic=c.topic,this.lastMessageID=c.last_message_id,this.messages=new h("id",e.options.maximumMessages)}return e(b,a),b.prototype.setTopic=function(){return this.client.setTopic.apply(this.client,i(this,arguments))},b.prototype.setNameAndTopic=function(){return this.client.setChannelNameAndTopic.apply(this.client,i(this,arguments))},b.prototype.update=function(){return this.client.updateChannel.apply(this.client,i(this,arguments))},b.prototype.sendMessage=function(){return this.client.sendMessage.apply(this.client,i(this,arguments))},b.prototype.sendTTSMessage=function(){return this.client.sendTTSMessage.apply(this.client,i(this,arguments))},f(b,[{key:"lastMessage",get:function(){return this.messages.get("id",this.lastMessageID)}}]),b}(g);b.exports=j},{"../Util/ArgumentRegulariser.js":18,"../Util/Cache.js":19,"./ServerChannel.js":14}],16:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var f=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),g=a("../Util/Equality.js"),h=a("../Constants.js").Endpoints,i=function(a){function b(c,e){d(this,b),a.call(this),this.client=e,this.username=c.username,this.discriminator=c.discriminator,this.id=c.id,this.avatar=c.avatar,this.status=c.status||"offline",this.gameID=c.game_id||null,this.typing={since:null,channel:null}}return e(b,a),b.prototype.mention=function(){return"<@"+this.id+">"},b.prototype.toString=function(){return this.mention()},b.prototype.equalsStrict=function(a){return a instanceof b?this.id===a.id&&this.username===a.username&&this.discriminator===a.discriminator&&this.avatar===a.avatar&&this.status===a.status&&this.gameID===a.gameID:!1},f(b,[{key:"avatarURL",get:function(){return this.avatar?h.AVATAR(this.id,this.avatar):null}}]),b}(g);b.exports=i},{"../Constants.js":5,"../Util/Equality.js":20}],17:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var f=a("./ServerChannel.js"),g=function(a){function b(c,e,f){d(this,b),a.call(this,c,e,f)}return e(b,a),b}(f);b.exports=g},{"./ServerChannel.js":14}],18:[function(a,b,c){"use strict";c.reg=function(a,b){return[a].concat(Array.prototype.slice.call(b))}},{}],19:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var f=function(a){function b(c,e){d(this,b),a.call(this),this.discrim=c||"id"}return e(b,a),b.prototype.get=function(a,b){var c=null;return this.forEach(function(d,e,f){return d.hasOwnProperty(a)&&d[a]==b?void(c=d):void 0}),c},b.prototype.has=function(a,b){return!!this.get(a,b)},b.prototype.getAll=function(a,c){var d=new b(this.discrim);return this.forEach(function(b,e,f){return b.hasOwnProperty(a)&&b[a]==c?void d.push(b):void 0}),d},b.prototype.add=function(a){for(var b=!1,c=this,d=Array.isArray(c),e=0,c=d?c:c[Symbol.iterator]();;){var f;if(d){if(e>=c.length)break;f=c[e++]}else{if(e=c.next(),e.done)break;f=e.value}var g=f;if(g[this.discrim]===a[this.discrim]){b=g;break}}return b?b:(this.limit&&this.length>=this.limit&&this.splice(0,1),this.push(a),a)},b.prototype.update=function(a,b){var c=this.get(this.discrim,a[this.discrim]);if(c){var d=this.indexOf(c);return this[d]=b,this[d]}return!1},b.prototype.remove=function(a){var b=this.indexOf(a);if(~b)this.splice(b,1);else{var c=this.get(this.discrim,a[this.discrim]);c&&this.splice(this.indexOf(c),1)}return!1},b}(Array);b.exports=f;
|
||
},{}],20:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(){function a(){d(this,a)}return a.prototype.equals=function(a){return a&&a[this.eqDiscriminator]==this[this.eqDiscriminator]?!0:!1},a.prototype.equalsStrict=function(a){},e(a,[{key:"eqDiscriminator",get:function(){return"id"}}]),a}();b.exports=f},{}],21:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var e,f=a("child_process");try{e=a("node-opus")}catch(g){}var h=(a("./VoicePacket.js"),function(){function a(){d(this,a),e&&(this.opus=new e.OpusEncoder(48e3,1)),this.choice=!1}return a.prototype.opusBuffer=function(a){return this.opus.encode(a,1920)},a.prototype.getCommand=function(a){if(this.choice&&a)return h;for(var b=["avconv","ffmpeg"],c=b,d=Array.isArray(c),e=0,c=d?c:c[Symbol.iterator]();;){var g;if(d){if(e>=c.length)break;g=c[e++]}else{if(e=c.next(),e.done)break;g=e.value}var h=g,i=f.spawnSync(h);if(!i.error)return this.choice=h,h}return"help"},a.prototype.encodeStream=function(a){var b=arguments.length<=1||void 0===arguments[1]?function(a,b){}:arguments[1],c=this;return new Promise(function(d,e){var g=f.spawn(c.getCommand(),["-f","s16le","-ar","48000","-ac","1","-af","volume=1","pipe:1","-i","-"]);a.pipe(g.stdin),g.stdout.once("readable",function(){b(null,{proc:g,stream:g.stdout,instream:a}),d({proc:g,stream:g.stdout,instream:a})}),g.stdout.on("end",function(){b("end"),e("end")}),g.stdout.on("close",function(){b("close"),e("close")})})},a.prototype.encodeFile=function(a){var b=arguments.length<=1||void 0===arguments[1]?function(a,b){}:arguments[1],c=this;return new Promise(function(d,e){var g=f.spawn(c.getCommand(),["-f","s16le","-ar","48000","-ac","1","-af","volume=1","pipe:1","-i",a]);g.stdout.once("readable",function(){b(null,{proc:g,stream:g.stdout}),d({proc:g,stream:g.stdout})}),g.stdout.on("end",function(){b("end"),e("end")}),g.stdout.on("close",function(){b("close"),e("close")})})},a}());b.exports=h},{"./VoicePacket.js":24,child_process:29,"node-opus":73}],22:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var f=a("events"),g=function(a){function b(){d(this,b),a.call(this)}return e(b,a),b}(f);b.exports=g},{events:49}],23:[function(a,b,c){(function(c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var f=a("ws"),g=a("dns"),h=a("dgram"),i=(a("fs"),a("./AudioEncoder.js")),j=a("./VoicePacket.js"),k=a("./StreamIntent.js"),l=a("events"),m=function(a){function b(c,e,f,g,h,j){d(this,b),a.call(this),this.id=c.id,this.voiceChannel=c,this.client=e,this.session=f,this.token=g,this.server=h,this.endpoint=j.replace(":80",""),this.vWS=null,this.ready=!1,this.vWSData={},this.encoder=new i,this.udp=null,this.playingIntent=null,this.playing=!1,this.streamTime=0,this.streamProc=null,this.KAI=null,this.init()}return e(b,a),b.prototype.destroy=function(){this.stopPlaying(),this.KAI&&clearInterval(this.KAI),this.vWS.close(),this.udp.close(),this.client.internal.sendWS({op:4,d:{guild_id:null,channel_id:null,self_mute:!0,self_deaf:!1}})},b.prototype.stopPlaying=function(){this.playing=!1,this.playingIntent=null,this.instream&&(this.instream.end(),this.instream.destroy())},b.prototype.playStream=function(a){function b(){if(!c.playingIntent||!c.playing)return c.setSpeaking(!1),void i.emit("end");try{var k=a.read(1920);if(!k)return void setTimeout(b,10*h);if(1920!==k.length)return j?(i.emit("end"),a.destroy(),void c.setSpeaking(!1)):(j=!0,void setTimeout(b,10*h));g++,65535>e+10?e+=1:e=0,4294967295>f+9600?f+=960:f=0,c.sendBuffer(k,e,f,function(a){});var l=d+g*h;c.streamTime=g*h,setTimeout(b,h+(l-Date.now())),c.playing||c.setSpeaking(!0),i.emit("time",c.streamTime)}catch(m){i.emit("error",m)}}var c=this,d=Date.now(),e=0,f=0,g=0,h=20;c.playingIntent&&c.stopPlaying(),c.playing=!0;var i=new k,j=!1;return c.playingIntent=i,c.setSpeaking(!0),b(),i},b.prototype.setSpeaking=function(a){this.playing=a,this.vWS.readyState===f.OPEN&&this.vWS.send(JSON.stringify({op:5,d:{speaking:a,delay:0}}))},b.prototype.sendPacket=function(a){var b=arguments.length<=1||void 0===arguments[1]?function(a){}:arguments[1],c=this;c.playing=!0;try{c.vWS.readyState===f.OPEN&&c.udp.send(a,0,a.length,c.vWSData.port,c.endpoint,b)}catch(d){return c.playing=!1,b(d),!1}},b.prototype.sendBuffer=function(a,b,c,d){var e=this;e.playing=!0;try{if(!e.encoder.opus)return e.playing=!1,e.emit("error","No Opus!"),void e.client.emit("debug","Tried to use node-opus, but opus not available - install it!");var f=e.encoder.opusBuffer(a),g=new j(f,b,c,e.vWSData.ssrc);return e.sendPacket(g,d)}catch(h){return e.playing=!1,e.emit("error",h),!1}},b.prototype.test=function(){this.playFile("C:/users/amish/desktop/audio.mp3").then(function(a){a.on("time",function(a){console.log("Time",a)})})},b.prototype.playFile=function(a){var b=this,c=arguments.length<=1||void 0===arguments[1]?function(a,b){}:arguments[1],d=this;return new Promise(function(e,f){function g(){var a=arguments.length<=0||void 0===arguments[0]?!0:arguments[0];f(a),c(a)}b.encoder.encodeFile(a)["catch"](g).then(function(a){d.streamProc=a.proc;var b=d.playStream(a.stream);e(b),c(null,b)})})},b.prototype.playRawStream=function(a){var b=this,c=arguments.length<=1||void 0===arguments[1]?function(a,b){}:arguments[1],d=this;return new Promise(function(e,f){function g(){var a=arguments.length<=0||void 0===arguments[0]?!0:arguments[0];f(a),c(a)}b.encoder.encodeStream(a)["catch"](g).then(function(a){d.streamProc=a.proc,d.instream=a.instream;var b=d.playStream(a.stream);e(b),c(null,b)})})},b.prototype.init=function(){var a=this,b=this;g.lookup(this.endpoint,function(d,e,g){b.endpoint=e;var i=b.vWS=new f("wss://"+a.endpoint,null,{rejectUnauthorized:!1}),j=b.udp=h.createSocket("udp4"),k=!0,l="",m="";j.bind({exclusive:!0}),j.on("message",function(a,c){var d=JSON.parse(JSON.stringify(a)).data;if(k===!0){for(var e=4;e<d.indexOf(0,e);e++)l+=String.fromCharCode(d[e]);m=a.readUIntLE(a.length-2,2).toString(10);var f={op:1,d:{protocol:"udp",data:{address:l,port:Number(m),mode:b.vWSData.modes[0]}}};i.send(JSON.stringify(f)),k=!1}}),i.on("open",function(){i.send(JSON.stringify({op:0,d:{server_id:b.server.id,user_id:b.client.internal.user.id,session_id:b.session,token:b.token}}))});var n;i.on("message",function(a){var d=JSON.parse(a);switch(d.op){case 2:b.vWSData=d.d,n=setInterval(function(){i&&i.readyState===f.OPEN&&i.send(JSON.stringify({op:3,d:null}))},d.d.heartbeat_interval),b.KAI=n;var e=new c(70);e.writeUIntBE(d.d.ssrc,0,4),j.send(e,0,e.length,d.d.port,b.endpoint,function(a){a&&b.emit("error",a)});break;case 4:b.ready=!0,b.mode=d.d.mode,b.emit("ready",b)}})})},b}(l);b.exports=m}).call(this,a("buffer").Buffer)},{"./AudioEncoder.js":21,"./StreamIntent.js":22,"./VoicePacket.js":24,buffer:45,dgram:29,dns:29,events:49,fs:29,ws:83}],24:[function(a,b,c){(function(a){"use strict";function c(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var d=function e(b,d,f,g){c(this,e);var h=b,i=new a(h.length+12);i.fill(0),i[0]=128,i[1]=120,i.writeUIntBE(d,2,2),i.writeUIntBE(f,4,4),i.writeUIntBE(g,8,4);for(var j=0;j<h.length;j++)i[j+12]=h[j];return i};b.exports=d}).call(this,a("buffer").Buffer)},{buffer:45}],25:[function(a,b,c){"use strict";b.exports={Client:a("./Client/Client"),Channel:a("./Structures/Channel"),ChannelPermissions:a("./Structures/ChannelPermissions"),Invite:a("./Structures/Invite"),Message:a("./Structures/Message"),PermissionOverwrite:a("./Structures/PermissionOverwrite"),PMChannel:a("./Structures/PMChannel"),Role:a("./Structures/Role"),Server:a("./Structures/Server"),ServerChannel:a("./Structures/ServerChannel"),TextChannel:a("./Structures/TextChannel"),User:a("./Structures/User"),VoiceChannel:a("./Structures/VoiceChannel"),Constants:a("./Constants.js")}},{"./Client/Client":1,"./Constants.js":5,"./Structures/Channel":6,"./Structures/ChannelPermissions":7,"./Structures/Invite":8,"./Structures/Message":9,"./Structures/PMChannel":10,"./Structures/PermissionOverwrite":11,"./Structures/Role":12,"./Structures/Server":13,"./Structures/ServerChannel":14,"./Structures/TextChannel":15,"./Structures/User":16,"./Structures/VoiceChannel":17}],26:[function(a,b,c){(function(d,e){function f(b){"string"==typeof b?b={bindings:b}:b||(b={}),b.__proto__=l,b.module_root||(b.module_root=c.getRoot(c.getFileName())),".node"!=h.extname(b.bindings)&&(b.bindings+=".node");for(var d,e,f,g=[],j=0,k=b["try"].length;k>j;j++){d=i.apply(null,b["try"][j].map(function(a){return b[a]||a})),g.push(d);try{return e=b.path?a.resolve(d):a(d),b.path||(e.path=d),e}catch(m){if(!/not find/i.test(m.message))throw m}}throw f=new Error("Could not locate the bindings file. Tried:\n"+g.map(function(a){return b.arrow+a}).join("\n")),f.tries=g,f}var g=a("fs"),h=a("path"),i=h.join,j=h.dirname,k=g.existsSync||h.existsSync,l={arrow:d.env.NODE_BINDINGS_ARROW||" → ",compiled:d.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:d.platform,arch:d.arch,version:d.versions.node,bindings:"bindings.node","try":[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"]]};b.exports=c=f,c.getFileName=function(a){var b,c=Error.prepareStackTrace,d=Error.stackTraceLimit,f={};return Error.stackTraceLimit=10,Error.prepareStackTrace=function(c,d){for(var f=0,g=d.length;g>f;f++)if(b=d[f].getFileName(),b!==e){if(!a)return;if(b!==a)return}},Error.captureStackTrace(f),f.stack,Error.prepareStackTrace=c,Error.stackTraceLimit=d,b},c.getRoot=function(a){for(var b,c=j(a);;){if("."===c&&(c=d.cwd()),k(i(c,"package.json"))||k(i(c,"node_modules")))return c;if(b===c)throw new Error('Could not find module root given file: "'+a+'". Do you have a `package.json` file? ');b=c,c=i(c,"..")}}}).call(this,a("_process"),"/node_modules\\bindings\\bindings.js")},{_process:54,fs:29,path:53}],27:[function(a,b,c){function d(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function e(){var a=arguments,b=this.useColors;if(a[0]=(b?"%c":"")+this.namespace+(b?" %c":" ")+a[0]+(b?"%c ":" ")+"+"+c.humanize(this.diff),!b)return a;var d="color: "+this.color;a=[a[0],d,"color: inherit"].concat(Array.prototype.slice.call(a,1));var e=0,f=0;return a[0].replace(/%[a-z%]/g,function(a){"%%"!==a&&(e++,"%c"===a&&(f=e))}),a.splice(f,0,d),a}function f(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function g(a){try{null==a?c.storage.removeItem("debug"):c.storage.debug=a}catch(b){}}function h(){var a;try{a=c.storage.debug}catch(b){}return a}function i(){try{return window.localStorage}catch(a){}}c=b.exports=a("./debug"),c.log=f,c.formatArgs=e,c.save=g,c.load=h,c.useColors=d,c.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:i(),c.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],c.formatters.j=function(a){return JSON.stringify(a)},c.enable(h())},{"./debug":28}],28:[function(a,b,c){function d(){return c.colors[k++%c.colors.length]}function e(a){function b(){}function e(){var a=e,b=+new Date,f=b-(j||b);a.diff=f,a.prev=j,a.curr=b,j=b,null==a.useColors&&(a.useColors=c.useColors()),null==a.color&&a.useColors&&(a.color=d());var g=Array.prototype.slice.call(arguments);g[0]=c.coerce(g[0]),"string"!=typeof g[0]&&(g=["%o"].concat(g));var h=0;g[0]=g[0].replace(/%([a-z%])/g,function(b,d){if("%%"===b)return b;h++;var e=c.formatters[d];if("function"==typeof e){var f=g[h];b=e.call(a,f),g.splice(h,1),h--}return b}),"function"==typeof c.formatArgs&&(g=c.formatArgs.apply(a,g));var i=e.log||c.log||console.log.bind(console);i.apply(a,g)}b.enabled=!1,e.enabled=!0;var f=c.enabled(a)?e:b;return f.namespace=a,f}function f(a){c.save(a);for(var b=(a||"").split(/[\s,]+/),d=b.length,e=0;d>e;e++)b[e]&&(a=b[e].replace(/\*/g,".*?"),"-"===a[0]?c.skips.push(new RegExp("^"+a.substr(1)+"$")):c.names.push(new RegExp("^"+a+"$")))}function g(){c.enable("")}function h(a){var b,d;for(b=0,d=c.skips.length;d>b;b++)if(c.skips[b].test(a))return!1;for(b=0,d=c.names.length;d>b;b++)if(c.names[b].test(a))return!0;return!1}function i(a){return a instanceof Error?a.stack||a.message:a}c=b.exports=e,c.coerce=i,c.disable=g,c.enable=f,c.enabled=h,c.humanize=a("ms"),c.names=[],c.skips=[],c.formatters={};var j,k=0},{ms:72}],29:[function(a,b,c){},{}],30:[function(a,b,c){function d(a,b){return n.isUndefined(b)?""+b:n.isNumber(b)&&!isFinite(b)?b.toString():n.isFunction(b)||n.isRegExp(b)?b.toString():b}function e(a,b){return n.isString(a)?a.length<b?a:a.slice(0,b):a}function f(a){return e(JSON.stringify(a.actual,d),128)+" "+a.operator+" "+e(JSON.stringify(a.expected,d),128)}function g(a,b,c,d,e){throw new q.AssertionError({message:c,actual:a,expected:b,operator:d,stackStartFunction:e})}function h(a,b){a||g(a,!0,b,"==",q.ok)}function i(a,b){if(a===b)return!0;if(n.isBuffer(a)&&n.isBuffer(b)){if(a.length!=b.length)return!1;for(var c=0;c<a.length;c++)if(a[c]!==b[c])return!1;return!0}return n.isDate(a)&&n.isDate(b)?a.getTime()===b.getTime():n.isRegExp(a)&&n.isRegExp(b)?a.source===b.source&&a.global===b.global&&a.multiline===b.multiline&&a.lastIndex===b.lastIndex&&a.ignoreCase===b.ignoreCase:n.isObject(a)||n.isObject(b)?k(a,b):a==b}function j(a){return"[object Arguments]"==Object.prototype.toString.call(a)}function k(a,b){if(n.isNullOrUndefined(a)||n.isNullOrUndefined(b))return!1;if(a.prototype!==b.prototype)return!1;if(n.isPrimitive(a)||n.isPrimitive(b))return a===b;var c=j(a),d=j(b);if(c&&!d||!c&&d)return!1;if(c)return a=o.call(a),b=o.call(b),i(a,b);var e,f,g=r(a),h=r(b);if(g.length!=h.length)return!1;for(g.sort(),h.sort(),f=g.length-1;f>=0;f--)if(g[f]!=h[f])return!1;for(f=g.length-1;f>=0;f--)if(e=g[f],!i(a[e],b[e]))return!1;return!0}function l(a,b){return a&&b?"[object RegExp]"==Object.prototype.toString.call(b)?b.test(a):a instanceof b?!0:b.call({},a)===!0?!0:!1:!1}function m(a,b,c,d){var e;n.isString(c)&&(d=c,c=null);try{b()}catch(f){e=f}if(d=(c&&c.name?" ("+c.name+").":".")+(d?" "+d:"."),a&&!e&&g(e,c,"Missing expected exception"+d),!a&&l(e,c)&&g(e,c,"Got unwanted exception"+d),a&&e&&c&&!l(e,c)||!a&&e)throw e}var n=a("util/"),o=Array.prototype.slice,p=Object.prototype.hasOwnProperty,q=b.exports=h;q.AssertionError=function(a){this.name="AssertionError",this.actual=a.actual,this.expected=a.expected,this.operator=a.operator,a.message?(this.message=a.message,this.generatedMessage=!1):(this.message=f(this),this.generatedMessage=!0);var b=a.stackStartFunction||g;if(Error.captureStackTrace)Error.captureStackTrace(this,b);else{var c=new Error;if(c.stack){var d=c.stack,e=b.name,h=d.indexOf("\n"+e);if(h>=0){var i=d.indexOf("\n",h+1);d=d.substring(i+1)}this.stack=d}}},n.inherits(q.AssertionError,Error),q.fail=g,q.ok=h,q.equal=function(a,b,c){a!=b&&g(a,b,c,"==",q.equal)},q.notEqual=function(a,b,c){a==b&&g(a,b,c,"!=",q.notEqual)},q.deepEqual=function(a,b,c){i(a,b)||g(a,b,c,"deepEqual",q.deepEqual)},q.notDeepEqual=function(a,b,c){i(a,b)&&g(a,b,c,"notDeepEqual",q.notDeepEqual)},q.strictEqual=function(a,b,c){a!==b&&g(a,b,c,"===",q.strictEqual)},q.notStrictEqual=function(a,b,c){a===b&&g(a,b,c,"!==",q.notStrictEqual)},q["throws"]=function(a,b,c){m.apply(this,[!0].concat(o.call(arguments)))},q.doesNotThrow=function(a,b){m.apply(this,[!1].concat(o.call(arguments)))},q.ifError=function(a){if(a)throw a};var r=Object.keys||function(a){var b=[];for(var c in a)p.call(a,c)&&b.push(c);return b}},{"util/":71}],31:[function(a,b,c){arguments[4][29][0].apply(c,arguments)},{dup:29}],32:[function(a,b,c){"use strict";var d="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;c.assign=function(a){for(var b=Array.prototype.slice.call(arguments,1);b.length;){var c=b.shift();if(c){if("object"!=typeof c)throw new TypeError(c+"must be non-object");for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])}}return a},c.shrinkBuf=function(a,b){return a.length===b?a:a.subarray?a.subarray(0,b):(a.length=b,a)};var e={arraySet:function(a,b,c,d,e){if(b.subarray&&a.subarray)return void a.set(b.subarray(c,c+d),e);for(var f=0;d>f;f++)a[e+f]=b[c+f]},flattenChunks:function(a){var b,c,d,e,f,g;for(d=0,b=0,c=a.length;c>b;b++)d+=a[b].length;for(g=new Uint8Array(d),e=0,b=0,c=a.length;c>b;b++)f=a[b],g.set(f,e),e+=f.length;return g}},f={arraySet:function(a,b,c,d,e){for(var f=0;d>f;f++)a[e+f]=b[c+f]},flattenChunks:function(a){return[].concat.apply([],a)}};c.setTyped=function(a){a?(c.Buf8=Uint8Array,c.Buf16=Uint16Array,c.Buf32=Int32Array,c.assign(c,e)):(c.Buf8=Array,c.Buf16=Array,c.Buf32=Array,c.assign(c,f))},c.setTyped(d)},{}],33:[function(a,b,c){"use strict";function d(a,b,c,d){for(var e=65535&a|0,f=a>>>16&65535|0,g=0;0!==c;){g=c>2e3?2e3:c,c-=g;do e=e+b[d++]|0,f=f+e|0;while(--g);e%=65521,f%=65521}return e|f<<16|0}b.exports=d},{}],34:[function(a,b,c){b.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}},{}],35:[function(a,b,c){"use strict";function d(){for(var a,b=[],c=0;256>c;c++){a=c;for(var d=0;8>d;d++)a=1&a?3988292384^a>>>1:a>>>1;b[c]=a}return b}function e(a,b,c,d){var e=f,g=d+c;a=-1^a;for(var h=d;g>h;h++)a=a>>>8^e[255&(a^b[h])];return-1^a}var f=d();b.exports=e},{}],36:[function(a,b,c){"use strict";function d(a,b){return a.msg=G[b],b}function e(a){return(a<<1)-(a>4?9:0)}function f(a){for(var b=a.length;--b>=0;)a[b]=0}function g(a){var b=a.state,c=b.pending;c>a.avail_out&&(c=a.avail_out),0!==c&&(C.arraySet(a.output,b.pending_buf,b.pending_out,c,a.next_out),a.next_out+=c,b.pending_out+=c,a.total_out+=c,a.avail_out-=c,b.pending-=c,0===b.pending&&(b.pending_out=0))}function h(a,b){D._tr_flush_block(a,a.block_start>=0?a.block_start:-1,a.strstart-a.block_start,b),a.block_start=a.strstart,g(a.strm)}function i(a,b){a.pending_buf[a.pending++]=b}function j(a,b){a.pending_buf[a.pending++]=b>>>8&255,a.pending_buf[a.pending++]=255&b}function k(a,b,c,d){var e=a.avail_in;return e>d&&(e=d),0===e?0:(a.avail_in-=e,C.arraySet(b,a.input,a.next_in,e,c),1===a.state.wrap?a.adler=E(a.adler,b,e,c):2===a.state.wrap&&(a.adler=F(a.adler,b,e,c)),a.next_in+=e,a.total_in+=e,e)}function l(a,b){var c,d,e=a.max_chain_length,f=a.strstart,g=a.prev_length,h=a.nice_match,i=a.strstart>a.w_size-ja?a.strstart-(a.w_size-ja):0,j=a.window,k=a.w_mask,l=a.prev,m=a.strstart+ia,n=j[f+g-1],o=j[f+g];a.prev_length>=a.good_match&&(e>>=2),h>a.lookahead&&(h=a.lookahead);do if(c=b,j[c+g]===o&&j[c+g-1]===n&&j[c]===j[f]&&j[++c]===j[f+1]){f+=2,c++;do;while(j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&m>f);if(d=ia-(m-f),f=m-ia,d>g){if(a.match_start=b,g=d,d>=h)break;n=j[f+g-1],o=j[f+g]}}while((b=l[b&k])>i&&0!==--e);return g<=a.lookahead?g:a.lookahead}function m(a){var b,c,d,e,f,g=a.w_size;do{if(e=a.window_size-a.lookahead-a.strstart,a.strstart>=g+(g-ja)){C.arraySet(a.window,a.window,g,g,0),a.match_start-=g,a.strstart-=g,a.block_start-=g,c=a.hash_size,b=c;do d=a.head[--b],a.head[b]=d>=g?d-g:0;while(--c);c=g,b=c;do d=a.prev[--b],a.prev[b]=d>=g?d-g:0;while(--c);e+=g}if(0===a.strm.avail_in)break;if(c=k(a.strm,a.window,a.strstart+a.lookahead,e),a.lookahead+=c,a.lookahead+a.insert>=ha)for(f=a.strstart-a.insert,a.ins_h=a.window[f],a.ins_h=(a.ins_h<<a.hash_shift^a.window[f+1])&a.hash_mask;a.insert&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[f+ha-1])&a.hash_mask,a.prev[f&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=f,f++,a.insert--,!(a.lookahead+a.insert<ha)););}while(a.lookahead<ja&&0!==a.strm.avail_in)}function n(a,b){var c=65535;for(c>a.pending_buf_size-5&&(c=a.pending_buf_size-5);;){if(a.lookahead<=1){if(m(a),0===a.lookahead&&b===H)return sa;if(0===a.lookahead)break}a.strstart+=a.lookahead,a.lookahead=0;var d=a.block_start+c;if((0===a.strstart||a.strstart>=d)&&(a.lookahead=a.strstart-d,a.strstart=d,h(a,!1),0===a.strm.avail_out))return sa;if(a.strstart-a.block_start>=a.w_size-ja&&(h(a,!1),0===a.strm.avail_out))return sa}return a.insert=0,b===K?(h(a,!0),0===a.strm.avail_out?ua:va):a.strstart>a.block_start&&(h(a,!1),0===a.strm.avail_out)?sa:sa}function o(a,b){for(var c,d;;){if(a.lookahead<ja){if(m(a),a.lookahead<ja&&b===H)return sa;if(0===a.lookahead)break}if(c=0,a.lookahead>=ha&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ha-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),0!==c&&a.strstart-c<=a.w_size-ja&&(a.match_length=l(a,c)),a.match_length>=ha)if(d=D._tr_tally(a,a.strstart-a.match_start,a.match_length-ha),a.lookahead-=a.match_length,a.match_length<=a.max_lazy_match&&a.lookahead>=ha){a.match_length--;do a.strstart++,a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ha-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart;while(0!==--a.match_length);a.strstart++}else a.strstart+=a.match_length,a.match_length=0,a.ins_h=a.window[a.strstart],a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+1])&a.hash_mask;else d=D._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++;if(d&&(h(a,!1),0===a.strm.avail_out))return sa}return a.insert=a.strstart<ha-1?a.strstart:ha-1,b===K?(h(a,!0),0===a.strm.avail_out?ua:va):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?sa:ta}function p(a,b){for(var c,d,e;;){if(a.lookahead<ja){if(m(a),a.lookahead<ja&&b===H)return sa;if(0===a.lookahead)break}if(c=0,a.lookahead>=ha&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ha-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),a.prev_length=a.match_length,a.prev_match=a.match_start,a.match_length=ha-1,0!==c&&a.prev_length<a.max_lazy_match&&a.strstart-c<=a.w_size-ja&&(a.match_length=l(a,c),a.match_length<=5&&(a.strategy===S||a.match_length===ha&&a.strstart-a.match_start>4096)&&(a.match_length=ha-1)),a.prev_length>=ha&&a.match_length<=a.prev_length){e=a.strstart+a.lookahead-ha,d=D._tr_tally(a,a.strstart-1-a.prev_match,a.prev_length-ha),a.lookahead-=a.prev_length-1,a.prev_length-=2;do++a.strstart<=e&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ha-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart);while(0!==--a.prev_length);if(a.match_available=0,a.match_length=ha-1,a.strstart++,d&&(h(a,!1),0===a.strm.avail_out))return sa}else if(a.match_available){if(d=D._tr_tally(a,0,a.window[a.strstart-1]),d&&h(a,!1),a.strstart++,a.lookahead--,0===a.strm.avail_out)return sa}else a.match_available=1,a.strstart++,a.lookahead--}return a.match_available&&(d=D._tr_tally(a,0,a.window[a.strstart-1]),a.match_available=0),a.insert=a.strstart<ha-1?a.strstart:ha-1,b===K?(h(a,!0),0===a.strm.avail_out?ua:va):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?sa:ta}function q(a,b){for(var c,d,e,f,g=a.window;;){if(a.lookahead<=ia){if(m(a),a.lookahead<=ia&&b===H)return sa;if(0===a.lookahead)break}if(a.match_length=0,a.lookahead>=ha&&a.strstart>0&&(e=a.strstart-1,d=g[e],d===g[++e]&&d===g[++e]&&d===g[++e])){f=a.strstart+ia;do;while(d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&f>e);a.match_length=ia-(f-e),a.match_length>a.lookahead&&(a.match_length=a.lookahead)}if(a.match_length>=ha?(c=D._tr_tally(a,1,a.match_length-ha),a.lookahead-=a.match_length,a.strstart+=a.match_length,a.match_length=0):(c=D._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++),c&&(h(a,!1),0===a.strm.avail_out))return sa}return a.insert=0,b===K?(h(a,!0),0===a.strm.avail_out?ua:va):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?sa:ta}function r(a,b){for(var c;;){if(0===a.lookahead&&(m(a),0===a.lookahead)){if(b===H)return sa;break}if(a.match_length=0,c=D._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++,c&&(h(a,!1),0===a.strm.avail_out))return sa}return a.insert=0,b===K?(h(a,!0),0===a.strm.avail_out?ua:va):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?sa:ta}function s(a){a.window_size=2*a.w_size,f(a.head),a.max_lazy_match=B[a.level].max_lazy,a.good_match=B[a.level].good_length,a.nice_match=B[a.level].nice_length,a.max_chain_length=B[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=ha-1,a.match_available=0,a.ins_h=0}function t(){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=Y,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 C.Buf16(2*fa),this.dyn_dtree=new C.Buf16(2*(2*da+1)),this.bl_tree=new C.Buf16(2*(2*ea+1)),f(this.dyn_ltree),f(this.dyn_dtree),f(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new C.Buf16(ga+1),this.heap=new C.Buf16(2*ca+1),f(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new C.Buf16(2*ca+1),f(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 u(a){var b;return a&&a.state?(a.total_in=a.total_out=0,a.data_type=X,b=a.state,b.pending=0,b.pending_out=0,b.wrap<0&&(b.wrap=-b.wrap),b.status=b.wrap?la:qa,a.adler=2===b.wrap?0:1,b.last_flush=H,D._tr_init(b),M):d(a,O)}function v(a){var b=u(a);return b===M&&s(a.state),b}function w(a,b){return a&&a.state?2!==a.state.wrap?O:(a.state.gzhead=b,M):O}function x(a,b,c,e,f,g){if(!a)return O;var h=1;if(b===R&&(b=6),0>e?(h=0,e=-e):e>15&&(h=2,e-=16),1>f||f>Z||c!==Y||8>e||e>15||0>b||b>9||0>g||g>V)return d(a,O);8===e&&(e=9);var i=new t;return a.state=i,i.strm=a,i.wrap=h,i.gzhead=null,i.w_bits=e,i.w_size=1<<i.w_bits,i.w_mask=i.w_size-1,i.hash_bits=f+7,i.hash_size=1<<i.hash_bits,i.hash_mask=i.hash_size-1,i.hash_shift=~~((i.hash_bits+ha-1)/ha),i.window=new C.Buf8(2*i.w_size),i.head=new C.Buf16(i.hash_size),i.prev=new C.Buf16(i.w_size),i.lit_bufsize=1<<f+6,i.pending_buf_size=4*i.lit_bufsize,i.pending_buf=new C.Buf8(i.pending_buf_size),i.d_buf=i.lit_bufsize>>1,i.l_buf=3*i.lit_bufsize,i.level=b,i.strategy=g,i.method=c,v(a)}function y(a,b){return x(a,b,Y,$,_,W)}function z(a,b){var c,h,k,l;if(!a||!a.state||b>L||0>b)return a?d(a,O):O;if(h=a.state,!a.output||!a.input&&0!==a.avail_in||h.status===ra&&b!==K)return d(a,0===a.avail_out?Q:O);if(h.strm=a,c=h.last_flush,h.last_flush=b,h.status===la)if(2===h.wrap)a.adler=0,i(h,31),i(h,139),i(h,8),h.gzhead?(i(h,(h.gzhead.text?1:0)+(h.gzhead.hcrc?2:0)+(h.gzhead.extra?4:0)+(h.gzhead.name?8:0)+(h.gzhead.comment?16:0)),i(h,255&h.gzhead.time),i(h,h.gzhead.time>>8&255),i(h,h.gzhead.time>>16&255),i(h,h.gzhead.time>>24&255),i(h,9===h.level?2:h.strategy>=T||h.level<2?4:0),i(h,255&h.gzhead.os),h.gzhead.extra&&h.gzhead.extra.length&&(i(h,255&h.gzhead.extra.length),i(h,h.gzhead.extra.length>>8&255)),h.gzhead.hcrc&&(a.adler=F(a.adler,h.pending_buf,h.pending,0)),h.gzindex=0,h.status=ma):(i(h,0),i(h,0),i(h,0),i(h,0),i(h,0),i(h,9===h.level?2:h.strategy>=T||h.level<2?4:0),i(h,wa),h.status=qa);else{var m=Y+(h.w_bits-8<<4)<<8,n=-1;n=h.strategy>=T||h.level<2?0:h.level<6?1:6===h.level?2:3,m|=n<<6,0!==h.strstart&&(m|=ka),m+=31-m%31,h.status=qa,j(h,m),0!==h.strstart&&(j(h,a.adler>>>16),j(h,65535&a.adler)),a.adler=1}if(h.status===ma)if(h.gzhead.extra){for(k=h.pending;h.gzindex<(65535&h.gzhead.extra.length)&&(h.pending!==h.pending_buf_size||(h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending!==h.pending_buf_size));)i(h,255&h.gzhead.extra[h.gzindex]),h.gzindex++;h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),h.gzindex===h.gzhead.extra.length&&(h.gzindex=0,h.status=na)}else h.status=na;if(h.status===na)if(h.gzhead.name){k=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending===h.pending_buf_size)){l=1;break}l=h.gzindex<h.gzhead.name.length?255&h.gzhead.name.charCodeAt(h.gzindex++):0,i(h,l)}while(0!==l);h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),0===l&&(h.gzindex=0,h.status=oa)}else h.status=oa;if(h.status===oa)if(h.gzhead.comment){k=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending===h.pending_buf_size)){l=1;break}l=h.gzindex<h.gzhead.comment.length?255&h.gzhead.comment.charCodeAt(h.gzindex++):0,i(h,l)}while(0!==l);h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),0===l&&(h.status=pa)}else h.status=pa;if(h.status===pa&&(h.gzhead.hcrc?(h.pending+2>h.pending_buf_size&&g(a),h.pending+2<=h.pending_buf_size&&(i(h,255&a.adler),i(h,a.adler>>8&255),a.adler=0,h.status=qa)):h.status=qa),0!==h.pending){if(g(a),0===a.avail_out)return h.last_flush=-1,M}else if(0===a.avail_in&&e(b)<=e(c)&&b!==K)return d(a,Q);if(h.status===ra&&0!==a.avail_in)return d(a,Q);if(0!==a.avail_in||0!==h.lookahead||b!==H&&h.status!==ra){var o=h.strategy===T?r(h,b):h.strategy===U?q(h,b):B[h.level].func(h,b);if((o===ua||o===va)&&(h.status=ra),o===sa||o===ua)return 0===a.avail_out&&(h.last_flush=-1),M;if(o===ta&&(b===I?D._tr_align(h):b!==L&&(D._tr_stored_block(h,0,0,!1),b===J&&(f(h.head),0===h.lookahead&&(h.strstart=0,h.block_start=0,h.insert=0))),g(a),0===a.avail_out))return h.last_flush=-1,M}return b!==K?M:h.wrap<=0?N:(2===h.wrap?(i(h,255&a.adler),i(h,a.adler>>8&255),i(h,a.adler>>16&255),i(h,a.adler>>24&255),i(h,255&a.total_in),i(h,a.total_in>>8&255),i(h,a.total_in>>16&255),i(h,a.total_in>>24&255)):(j(h,a.adler>>>16),j(h,65535&a.adler)),g(a),h.wrap>0&&(h.wrap=-h.wrap),0!==h.pending?M:N)}function A(a){var b;return a&&a.state?(b=a.state.status,b!==la&&b!==ma&&b!==na&&b!==oa&&b!==pa&&b!==qa&&b!==ra?d(a,O):(a.state=null,b===qa?d(a,P):M)):O}var B,C=a("../utils/common"),D=a("./trees"),E=a("./adler32"),F=a("./crc32"),G=a("./messages"),H=0,I=1,J=3,K=4,L=5,M=0,N=1,O=-2,P=-3,Q=-5,R=-1,S=1,T=2,U=3,V=4,W=0,X=2,Y=8,Z=9,$=15,_=8,aa=29,ba=256,ca=ba+1+aa,da=30,ea=19,fa=2*ca+1,ga=15,ha=3,ia=258,ja=ia+ha+1,ka=32,la=42,ma=69,na=73,oa=91,pa=103,qa=113,ra=666,sa=1,ta=2,ua=3,va=4,wa=3,xa=function(a,b,c,d,e){
|
||
this.good_length=a,this.max_lazy=b,this.nice_length=c,this.max_chain=d,this.func=e};B=[new xa(0,0,0,0,n),new xa(4,4,8,4,o),new xa(4,5,16,8,o),new xa(4,6,32,32,o),new xa(4,4,16,16,p),new xa(8,16,32,32,p),new xa(8,16,128,128,p),new xa(8,32,128,256,p),new xa(32,128,258,1024,p),new xa(32,258,258,4096,p)],c.deflateInit=y,c.deflateInit2=x,c.deflateReset=v,c.deflateResetKeep=u,c.deflateSetHeader=w,c.deflate=z,c.deflateEnd=A,c.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":32,"./adler32":33,"./crc32":35,"./messages":40,"./trees":41}],37:[function(a,b,c){"use strict";var d=30,e=12;b.exports=function(a,b){var c,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C;c=a.state,f=a.next_in,B=a.input,g=f+(a.avail_in-5),h=a.next_out,C=a.output,i=h-(b-a.avail_out),j=h+(a.avail_out-257),k=c.dmax,l=c.wsize,m=c.whave,n=c.wnext,o=c.window,p=c.hold,q=c.bits,r=c.lencode,s=c.distcode,t=(1<<c.lenbits)-1,u=(1<<c.distbits)-1;a:do{15>q&&(p+=B[f++]<<q,q+=8,p+=B[f++]<<q,q+=8),v=r[p&t];b:for(;;){if(w=v>>>24,p>>>=w,q-=w,w=v>>>16&255,0===w)C[h++]=65535&v;else{if(!(16&w)){if(0===(64&w)){v=r[(65535&v)+(p&(1<<w)-1)];continue b}if(32&w){c.mode=e;break a}a.msg="invalid literal/length code",c.mode=d;break a}x=65535&v,w&=15,w&&(w>q&&(p+=B[f++]<<q,q+=8),x+=p&(1<<w)-1,p>>>=w,q-=w),15>q&&(p+=B[f++]<<q,q+=8,p+=B[f++]<<q,q+=8),v=s[p&u];c:for(;;){if(w=v>>>24,p>>>=w,q-=w,w=v>>>16&255,!(16&w)){if(0===(64&w)){v=s[(65535&v)+(p&(1<<w)-1)];continue c}a.msg="invalid distance code",c.mode=d;break a}if(y=65535&v,w&=15,w>q&&(p+=B[f++]<<q,q+=8,w>q&&(p+=B[f++]<<q,q+=8)),y+=p&(1<<w)-1,y>k){a.msg="invalid distance too far back",c.mode=d;break a}if(p>>>=w,q-=w,w=h-i,y>w){if(w=y-w,w>m&&c.sane){a.msg="invalid distance too far back",c.mode=d;break a}if(z=0,A=o,0===n){if(z+=l-w,x>w){x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}}else if(w>n){if(z+=l+n-w,w-=n,x>w){x-=w;do C[h++]=o[z++];while(--w);if(z=0,x>n){w=n,x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}}}else if(z+=n-w,x>w){x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}for(;x>2;)C[h++]=A[z++],C[h++]=A[z++],C[h++]=A[z++],x-=3;x&&(C[h++]=A[z++],x>1&&(C[h++]=A[z++]))}else{z=h-y;do C[h++]=C[z++],C[h++]=C[z++],C[h++]=C[z++],x-=3;while(x>2);x&&(C[h++]=C[z++],x>1&&(C[h++]=C[z++]))}break}}break}}while(g>f&&j>h);x=q>>3,f-=x,q-=x<<3,p&=(1<<q)-1,a.next_in=f,a.next_out=h,a.avail_in=g>f?5+(g-f):5-(f-g),a.avail_out=j>h?257+(j-h):257-(h-j),c.hold=p,c.bits=q}},{}],38:[function(a,b,c){"use strict";function d(a){return(a>>>24&255)+(a>>>8&65280)+((65280&a)<<8)+((255&a)<<24)}function e(){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 r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function f(a){var b;return a&&a.state?(b=a.state,a.total_in=a.total_out=b.total=0,a.msg="",b.wrap&&(a.adler=1&b.wrap),b.mode=K,b.last=0,b.havedict=0,b.dmax=32768,b.head=null,b.hold=0,b.bits=0,b.lencode=b.lendyn=new r.Buf32(oa),b.distcode=b.distdyn=new r.Buf32(pa),b.sane=1,b.back=-1,C):F}function g(a){var b;return a&&a.state?(b=a.state,b.wsize=0,b.whave=0,b.wnext=0,f(a)):F}function h(a,b){var c,d;return a&&a.state?(d=a.state,0>b?(c=0,b=-b):(c=(b>>4)+1,48>b&&(b&=15)),b&&(8>b||b>15)?F:(null!==d.window&&d.wbits!==b&&(d.window=null),d.wrap=c,d.wbits=b,g(a))):F}function i(a,b){var c,d;return a?(d=new e,a.state=d,d.window=null,c=h(a,b),c!==C&&(a.state=null),c):F}function j(a){return i(a,ra)}function k(a){if(sa){var b;for(p=new r.Buf32(512),q=new r.Buf32(32),b=0;144>b;)a.lens[b++]=8;for(;256>b;)a.lens[b++]=9;for(;280>b;)a.lens[b++]=7;for(;288>b;)a.lens[b++]=8;for(v(x,a.lens,0,288,p,0,a.work,{bits:9}),b=0;32>b;)a.lens[b++]=5;v(y,a.lens,0,32,q,0,a.work,{bits:5}),sa=!1}a.lencode=p,a.lenbits=9,a.distcode=q,a.distbits=5}function l(a,b,c,d){var e,f=a.state;return null===f.window&&(f.wsize=1<<f.wbits,f.wnext=0,f.whave=0,f.window=new r.Buf8(f.wsize)),d>=f.wsize?(r.arraySet(f.window,b,c-f.wsize,f.wsize,0),f.wnext=0,f.whave=f.wsize):(e=f.wsize-f.wnext,e>d&&(e=d),r.arraySet(f.window,b,c-d,e,f.wnext),d-=e,d?(r.arraySet(f.window,b,c-d,d,0),f.wnext=d,f.whave=f.wsize):(f.wnext+=e,f.wnext===f.wsize&&(f.wnext=0),f.whave<f.wsize&&(f.whave+=e))),0}function m(a,b){var c,e,f,g,h,i,j,m,n,o,p,q,oa,pa,qa,ra,sa,ta,ua,va,wa,xa,ya,za,Aa=0,Ba=new r.Buf8(4),Ca=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!a||!a.state||!a.output||!a.input&&0!==a.avail_in)return F;c=a.state,c.mode===V&&(c.mode=W),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,o=i,p=j,xa=C;a:for(;;)switch(c.mode){case K:if(0===c.wrap){c.mode=W;break}for(;16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(2&c.wrap&&35615===m){c.check=0,Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=t(c.check,Ba,2,0),m=0,n=0,c.mode=L;break}if(c.flags=0,c.head&&(c.head.done=!1),!(1&c.wrap)||(((255&m)<<8)+(m>>8))%31){a.msg="incorrect header check",c.mode=la;break}if((15&m)!==J){a.msg="unknown compression method",c.mode=la;break}if(m>>>=4,n-=4,wa=(15&m)+8,0===c.wbits)c.wbits=wa;else if(wa>c.wbits){a.msg="invalid window size",c.mode=la;break}c.dmax=1<<wa,a.adler=c.check=1,c.mode=512&m?T:V,m=0,n=0;break;case L:for(;16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(c.flags=m,(255&c.flags)!==J){a.msg="unknown compression method",c.mode=la;break}if(57344&c.flags){a.msg="unknown header flags set",c.mode=la;break}c.head&&(c.head.text=m>>8&1),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=t(c.check,Ba,2,0)),m=0,n=0,c.mode=M;case M:for(;32>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.head&&(c.head.time=m),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,Ba[2]=m>>>16&255,Ba[3]=m>>>24&255,c.check=t(c.check,Ba,4,0)),m=0,n=0,c.mode=N;case N:for(;16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.head&&(c.head.xflags=255&m,c.head.os=m>>8),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=t(c.check,Ba,2,0)),m=0,n=0,c.mode=O;case O:if(1024&c.flags){for(;16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.length=m,c.head&&(c.head.extra_len=m),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=t(c.check,Ba,2,0)),m=0,n=0}else c.head&&(c.head.extra=null);c.mode=P;case P:if(1024&c.flags&&(q=c.length,q>i&&(q=i),q&&(c.head&&(wa=c.head.extra_len-c.length,c.head.extra||(c.head.extra=new Array(c.head.extra_len)),r.arraySet(c.head.extra,e,g,q,wa)),512&c.flags&&(c.check=t(c.check,e,q,g)),i-=q,g+=q,c.length-=q),c.length))break a;c.length=0,c.mode=Q;case Q:if(2048&c.flags){if(0===i)break a;q=0;do wa=e[g+q++],c.head&&wa&&c.length<65536&&(c.head.name+=String.fromCharCode(wa));while(wa&&i>q);if(512&c.flags&&(c.check=t(c.check,e,q,g)),i-=q,g+=q,wa)break a}else c.head&&(c.head.name=null);c.length=0,c.mode=R;case R:if(4096&c.flags){if(0===i)break a;q=0;do wa=e[g+q++],c.head&&wa&&c.length<65536&&(c.head.comment+=String.fromCharCode(wa));while(wa&&i>q);if(512&c.flags&&(c.check=t(c.check,e,q,g)),i-=q,g+=q,wa)break a}else c.head&&(c.head.comment=null);c.mode=S;case S:if(512&c.flags){for(;16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m!==(65535&c.check)){a.msg="header crc mismatch",c.mode=la;break}m=0,n=0}c.head&&(c.head.hcrc=c.flags>>9&1,c.head.done=!0),a.adler=c.check=0,c.mode=V;break;case T:for(;32>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}a.adler=c.check=d(m),m=0,n=0,c.mode=U;case U:if(0===c.havedict)return a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,E;a.adler=c.check=1,c.mode=V;case V:if(b===A||b===B)break a;case W:if(c.last){m>>>=7&n,n-=7&n,c.mode=ia;break}for(;3>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}switch(c.last=1&m,m>>>=1,n-=1,3&m){case 0:c.mode=X;break;case 1:if(k(c),c.mode=ba,b===B){m>>>=2,n-=2;break a}break;case 2:c.mode=$;break;case 3:a.msg="invalid block type",c.mode=la}m>>>=2,n-=2;break;case X:for(m>>>=7&n,n-=7&n;32>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if((65535&m)!==(m>>>16^65535)){a.msg="invalid stored block lengths",c.mode=la;break}if(c.length=65535&m,m=0,n=0,c.mode=Y,b===B)break a;case Y:c.mode=Z;case Z:if(q=c.length){if(q>i&&(q=i),q>j&&(q=j),0===q)break a;r.arraySet(f,e,g,q,h),i-=q,g+=q,j-=q,h+=q,c.length-=q;break}c.mode=V;break;case $:for(;14>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(c.nlen=(31&m)+257,m>>>=5,n-=5,c.ndist=(31&m)+1,m>>>=5,n-=5,c.ncode=(15&m)+4,m>>>=4,n-=4,c.nlen>286||c.ndist>30){a.msg="too many length or distance symbols",c.mode=la;break}c.have=0,c.mode=_;case _:for(;c.have<c.ncode;){for(;3>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.lens[Ca[c.have++]]=7&m,m>>>=3,n-=3}for(;c.have<19;)c.lens[Ca[c.have++]]=0;if(c.lencode=c.lendyn,c.lenbits=7,ya={bits:c.lenbits},xa=v(w,c.lens,0,19,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid code lengths set",c.mode=la;break}c.have=0,c.mode=aa;case aa:for(;c.have<c.nlen+c.ndist;){for(;Aa=c.lencode[m&(1<<c.lenbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(n>=qa);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(16>sa)m>>>=qa,n-=qa,c.lens[c.have++]=sa;else{if(16===sa){for(za=qa+2;za>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m>>>=qa,n-=qa,0===c.have){a.msg="invalid bit length repeat",c.mode=la;break}wa=c.lens[c.have-1],q=3+(3&m),m>>>=2,n-=2}else if(17===sa){for(za=qa+3;za>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=qa,n-=qa,wa=0,q=3+(7&m),m>>>=3,n-=3}else{for(za=qa+7;za>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=qa,n-=qa,wa=0,q=11+(127&m),m>>>=7,n-=7}if(c.have+q>c.nlen+c.ndist){a.msg="invalid bit length repeat",c.mode=la;break}for(;q--;)c.lens[c.have++]=wa}}if(c.mode===la)break;if(0===c.lens[256]){a.msg="invalid code -- missing end-of-block",c.mode=la;break}if(c.lenbits=9,ya={bits:c.lenbits},xa=v(x,c.lens,0,c.nlen,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid literal/lengths set",c.mode=la;break}if(c.distbits=6,c.distcode=c.distdyn,ya={bits:c.distbits},xa=v(y,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,ya),c.distbits=ya.bits,xa){a.msg="invalid distances set",c.mode=la;break}if(c.mode=ba,b===B)break a;case ba:c.mode=ca;case ca:if(i>=6&&j>=258){a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,u(a,p),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,c.mode===V&&(c.back=-1);break}for(c.back=0;Aa=c.lencode[m&(1<<c.lenbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(n>=qa);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(ra&&0===(240&ra)){for(ta=qa,ua=ra,va=sa;Aa=c.lencode[va+((m&(1<<ta+ua)-1)>>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(n>=ta+qa);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,c.length=sa,0===ra){c.mode=ha;break}if(32&ra){c.back=-1,c.mode=V;break}if(64&ra){a.msg="invalid literal/length code",c.mode=la;break}c.extra=15&ra,c.mode=da;case da:if(c.extra){for(za=c.extra;za>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.length+=m&(1<<c.extra)-1,m>>>=c.extra,n-=c.extra,c.back+=c.extra}c.was=c.length,c.mode=ea;case ea:for(;Aa=c.distcode[m&(1<<c.distbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(n>=qa);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(0===(240&ra)){for(ta=qa,ua=ra,va=sa;Aa=c.distcode[va+((m&(1<<ta+ua)-1)>>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(n>=ta+qa);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,64&ra){a.msg="invalid distance code",c.mode=la;break}c.offset=sa,c.extra=15&ra,c.mode=fa;case fa:if(c.extra){for(za=c.extra;za>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.offset+=m&(1<<c.extra)-1,m>>>=c.extra,n-=c.extra,c.back+=c.extra}if(c.offset>c.dmax){a.msg="invalid distance too far back",c.mode=la;break}c.mode=ga;case ga:if(0===j)break a;if(q=p-j,c.offset>q){if(q=c.offset-q,q>c.whave&&c.sane){a.msg="invalid distance too far back",c.mode=la;break}q>c.wnext?(q-=c.wnext,oa=c.wsize-q):oa=c.wnext-q,q>c.length&&(q=c.length),pa=c.window}else pa=f,oa=h-c.offset,q=c.length;q>j&&(q=j),j-=q,c.length-=q;do f[h++]=pa[oa++];while(--q);0===c.length&&(c.mode=ca);break;case ha:if(0===j)break a;f[h++]=c.length,j--,c.mode=ca;break;case ia:if(c.wrap){for(;32>n;){if(0===i)break a;i--,m|=e[g++]<<n,n+=8}if(p-=j,a.total_out+=p,c.total+=p,p&&(a.adler=c.check=c.flags?t(c.check,f,p,h-p):s(c.check,f,p,h-p)),p=j,(c.flags?m:d(m))!==c.check){a.msg="incorrect data check",c.mode=la;break}m=0,n=0}c.mode=ja;case ja:if(c.wrap&&c.flags){for(;32>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m!==(4294967295&c.total)){a.msg="incorrect length check",c.mode=la;break}m=0,n=0}c.mode=ka;case ka:xa=D;break a;case la:xa=G;break a;case ma:return H;case na:default:return F}return a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,(c.wsize||p!==a.avail_out&&c.mode<la&&(c.mode<ia||b!==z))&&l(a,a.output,a.next_out,p-a.avail_out)?(c.mode=ma,H):(o-=a.avail_in,p-=a.avail_out,a.total_in+=o,a.total_out+=p,c.total+=p,c.wrap&&p&&(a.adler=c.check=c.flags?t(c.check,f,p,a.next_out-p):s(c.check,f,p,a.next_out-p)),a.data_type=c.bits+(c.last?64:0)+(c.mode===V?128:0)+(c.mode===ba||c.mode===Y?256:0),(0===o&&0===p||b===z)&&xa===C&&(xa=I),xa)}function n(a){if(!a||!a.state)return F;var b=a.state;return b.window&&(b.window=null),a.state=null,C}function o(a,b){var c;return a&&a.state?(c=a.state,0===(2&c.wrap)?F:(c.head=b,b.done=!1,C)):F}var p,q,r=a("../utils/common"),s=a("./adler32"),t=a("./crc32"),u=a("./inffast"),v=a("./inftrees"),w=0,x=1,y=2,z=4,A=5,B=6,C=0,D=1,E=2,F=-2,G=-3,H=-4,I=-5,J=8,K=1,L=2,M=3,N=4,O=5,P=6,Q=7,R=8,S=9,T=10,U=11,V=12,W=13,X=14,Y=15,Z=16,$=17,_=18,aa=19,ba=20,ca=21,da=22,ea=23,fa=24,ga=25,ha=26,ia=27,ja=28,ka=29,la=30,ma=31,na=32,oa=852,pa=592,qa=15,ra=qa,sa=!0;c.inflateReset=g,c.inflateReset2=h,c.inflateResetKeep=f,c.inflateInit=j,c.inflateInit2=i,c.inflate=m,c.inflateEnd=n,c.inflateGetHeader=o,c.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":32,"./adler32":33,"./crc32":35,"./inffast":37,"./inftrees":39}],39:[function(a,b,c){"use strict";var d=a("../utils/common"),e=15,f=852,g=592,h=0,i=1,j=2,k=[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],m=[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],n=[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];b.exports=function(a,b,c,o,p,q,r,s){var t,u,v,w,x,y,z,A,B,C=s.bits,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=null,O=0,P=new d.Buf16(e+1),Q=new d.Buf16(e+1),R=null,S=0;for(D=0;e>=D;D++)P[D]=0;for(E=0;o>E;E++)P[b[c+E]]++;for(H=C,G=e;G>=1&&0===P[G];G--);if(H>G&&(H=G),0===G)return p[q++]=20971520,p[q++]=20971520,s.bits=1,0;for(F=1;G>F&&0===P[F];F++);for(F>H&&(H=F),K=1,D=1;e>=D;D++)if(K<<=1,K-=P[D],0>K)return-1;if(K>0&&(a===h||1!==G))return-1;for(Q[1]=0,D=1;e>D;D++)Q[D+1]=Q[D]+P[D];for(E=0;o>E;E++)0!==b[c+E]&&(r[Q[b[c+E]]++]=E);if(a===h?(N=R=r,y=19):a===i?(N=k,O-=257,R=l,S-=257,y=256):(N=m,R=n,y=-1),M=0,E=0,D=F,x=q,I=H,J=0,v=-1,L=1<<H,w=L-1,a===i&&L>f||a===j&&L>g)return 1;for(var T=0;;){T++,z=D-J,r[E]<y?(A=0,B=r[E]):r[E]>y?(A=R[S+r[E]],B=N[O+r[E]]):(A=96,B=0),t=1<<D-J,u=1<<I,F=u;do u-=t,p[x+(M>>J)+u]=z<<24|A<<16|B|0;while(0!==u);for(t=1<<D-1;M&t;)t>>=1;if(0!==t?(M&=t-1,M+=t):M=0,E++,0===--P[D]){if(D===G)break;D=b[c+r[E]]}if(D>H&&(M&w)!==v){for(0===J&&(J=H),x+=F,I=D-J,K=1<<I;G>I+J&&(K-=P[I+J],!(0>=K));)I++,K<<=1;if(L+=1<<I,a===i&&L>f||a===j&&L>g)return 1;v=M&w,p[v]=H<<24|I<<16|x-q|0}}return 0!==M&&(p[x+M]=D-J<<24|64<<16|0),s.bits=H,0}},{"../utils/common":32}],40:[function(a,b,c){"use strict";b.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"}},{}],41:[function(a,b,c){"use strict";function d(a){for(var b=a.length;--b>=0;)a[b]=0}function e(a){return 256>a?ga[a]:ga[256+(a>>>7)]}function f(a,b){a.pending_buf[a.pending++]=255&b,a.pending_buf[a.pending++]=b>>>8&255}function g(a,b,c){a.bi_valid>V-c?(a.bi_buf|=b<<a.bi_valid&65535,f(a,a.bi_buf),a.bi_buf=b>>V-a.bi_valid,a.bi_valid+=c-V):(a.bi_buf|=b<<a.bi_valid&65535,a.bi_valid+=c)}function h(a,b,c){g(a,c[2*b],c[2*b+1])}function i(a,b){var c=0;do c|=1&a,a>>>=1,c<<=1;while(--b>0);return c>>>1}function j(a){16===a.bi_valid?(f(a,a.bi_buf),a.bi_buf=0,a.bi_valid=0):a.bi_valid>=8&&(a.pending_buf[a.pending++]=255&a.bi_buf,a.bi_buf>>=8,a.bi_valid-=8)}function k(a,b){var c,d,e,f,g,h,i=b.dyn_tree,j=b.max_code,k=b.stat_desc.static_tree,l=b.stat_desc.has_stree,m=b.stat_desc.extra_bits,n=b.stat_desc.extra_base,o=b.stat_desc.max_length,p=0;for(f=0;U>=f;f++)a.bl_count[f]=0;for(i[2*a.heap[a.heap_max]+1]=0,c=a.heap_max+1;T>c;c++)d=a.heap[c],f=i[2*i[2*d+1]+1]+1,f>o&&(f=o,p++),i[2*d+1]=f,d>j||(a.bl_count[f]++,g=0,d>=n&&(g=m[d-n]),h=i[2*d],a.opt_len+=h*(f+g),l&&(a.static_len+=h*(k[2*d+1]+g)));if(0!==p){do{for(f=o-1;0===a.bl_count[f];)f--;a.bl_count[f]--,a.bl_count[f+1]+=2,a.bl_count[o]--,p-=2}while(p>0);for(f=o;0!==f;f--)for(d=a.bl_count[f];0!==d;)e=a.heap[--c],e>j||(i[2*e+1]!==f&&(a.opt_len+=(f-i[2*e+1])*i[2*e],i[2*e+1]=f),d--)}}function l(a,b,c){var d,e,f=new Array(U+1),g=0;for(d=1;U>=d;d++)f[d]=g=g+c[d-1]<<1;for(e=0;b>=e;e++){var h=a[2*e+1];0!==h&&(a[2*e]=i(f[h]++,h))}}function m(){var a,b,c,d,e,f=new Array(U+1);for(c=0,d=0;O-1>d;d++)for(ia[d]=c,a=0;a<1<<_[d];a++)ha[c++]=d;for(ha[c-1]=d,e=0,d=0;16>d;d++)for(ja[d]=e,a=0;a<1<<aa[d];a++)ga[e++]=d;for(e>>=7;R>d;d++)for(ja[d]=e<<7,a=0;a<1<<aa[d]-7;a++)ga[256+e++]=d;for(b=0;U>=b;b++)f[b]=0;for(a=0;143>=a;)ea[2*a+1]=8,a++,f[8]++;for(;255>=a;)ea[2*a+1]=9,a++,f[9]++;for(;279>=a;)ea[2*a+1]=7,a++,f[7]++;for(;287>=a;)ea[2*a+1]=8,a++,f[8]++;for(l(ea,Q+1,f),a=0;R>a;a++)fa[2*a+1]=5,fa[2*a]=i(a,5);ka=new na(ea,_,P+1,Q,U),la=new na(fa,aa,0,R,U),ma=new na(new Array(0),ba,0,S,W)}function n(a){var b;for(b=0;Q>b;b++)a.dyn_ltree[2*b]=0;for(b=0;R>b;b++)a.dyn_dtree[2*b]=0;for(b=0;S>b;b++)a.bl_tree[2*b]=0;a.dyn_ltree[2*X]=1,a.opt_len=a.static_len=0,a.last_lit=a.matches=0}function o(a){a.bi_valid>8?f(a,a.bi_buf):a.bi_valid>0&&(a.pending_buf[a.pending++]=a.bi_buf),a.bi_buf=0,a.bi_valid=0}function p(a,b,c,d){o(a),d&&(f(a,c),f(a,~c)),E.arraySet(a.pending_buf,a.window,b,c,a.pending),a.pending+=c}function q(a,b,c,d){var e=2*b,f=2*c;return a[e]<a[f]||a[e]===a[f]&&d[b]<=d[c]}function r(a,b,c){for(var d=a.heap[c],e=c<<1;e<=a.heap_len&&(e<a.heap_len&&q(b,a.heap[e+1],a.heap[e],a.depth)&&e++,!q(b,d,a.heap[e],a.depth));)a.heap[c]=a.heap[e],c=e,e<<=1;a.heap[c]=d}function s(a,b,c){var d,f,i,j,k=0;if(0!==a.last_lit)do d=a.pending_buf[a.d_buf+2*k]<<8|a.pending_buf[a.d_buf+2*k+1],f=a.pending_buf[a.l_buf+k],k++,0===d?h(a,f,b):(i=ha[f],h(a,i+P+1,b),j=_[i],0!==j&&(f-=ia[i],g(a,f,j)),d--,i=e(d),h(a,i,c),j=aa[i],0!==j&&(d-=ja[i],g(a,d,j)));while(k<a.last_lit);h(a,X,b)}function t(a,b){var c,d,e,f=b.dyn_tree,g=b.stat_desc.static_tree,h=b.stat_desc.has_stree,i=b.stat_desc.elems,j=-1;for(a.heap_len=0,a.heap_max=T,c=0;i>c;c++)0!==f[2*c]?(a.heap[++a.heap_len]=j=c,a.depth[c]=0):f[2*c+1]=0;for(;a.heap_len<2;)e=a.heap[++a.heap_len]=2>j?++j:0,f[2*e]=1,a.depth[e]=0,a.opt_len--,h&&(a.static_len-=g[2*e+1]);for(b.max_code=j,c=a.heap_len>>1;c>=1;c--)r(a,f,c);e=i;do c=a.heap[1],a.heap[1]=a.heap[a.heap_len--],r(a,f,1),d=a.heap[1],a.heap[--a.heap_max]=c,a.heap[--a.heap_max]=d,f[2*e]=f[2*c]+f[2*d],a.depth[e]=(a.depth[c]>=a.depth[d]?a.depth[c]:a.depth[d])+1,f[2*c+1]=f[2*d+1]=e,a.heap[1]=e++,r(a,f,1);while(a.heap_len>=2);a.heap[--a.heap_max]=a.heap[1],k(a,b),l(f,j,a.bl_count)}function u(a,b,c){var d,e,f=-1,g=b[1],h=0,i=7,j=4;for(0===g&&(i=138,j=3),b[2*(c+1)+1]=65535,d=0;c>=d;d++)e=g,g=b[2*(d+1)+1],++h<i&&e===g||(j>h?a.bl_tree[2*e]+=h:0!==e?(e!==f&&a.bl_tree[2*e]++,a.bl_tree[2*Y]++):10>=h?a.bl_tree[2*Z]++:a.bl_tree[2*$]++,h=0,f=e,0===g?(i=138,j=3):e===g?(i=6,j=3):(i=7,j=4))}function v(a,b,c){var d,e,f=-1,i=b[1],j=0,k=7,l=4;for(0===i&&(k=138,l=3),d=0;c>=d;d++)if(e=i,i=b[2*(d+1)+1],!(++j<k&&e===i)){if(l>j){do h(a,e,a.bl_tree);while(0!==--j)}else 0!==e?(e!==f&&(h(a,e,a.bl_tree),j--),h(a,Y,a.bl_tree),g(a,j-3,2)):10>=j?(h(a,Z,a.bl_tree),g(a,j-3,3)):(h(a,$,a.bl_tree),g(a,j-11,7));j=0,f=e,0===i?(k=138,l=3):e===i?(k=6,l=3):(k=7,l=4)}}function w(a){var b;for(u(a,a.dyn_ltree,a.l_desc.max_code),u(a,a.dyn_dtree,a.d_desc.max_code),t(a,a.bl_desc),b=S-1;b>=3&&0===a.bl_tree[2*ca[b]+1];b--);return a.opt_len+=3*(b+1)+5+5+4,b}function x(a,b,c,d){var e;for(g(a,b-257,5),g(a,c-1,5),g(a,d-4,4),e=0;d>e;e++)g(a,a.bl_tree[2*ca[e]+1],3);v(a,a.dyn_ltree,b-1),v(a,a.dyn_dtree,c-1)}function y(a){var b,c=4093624447;for(b=0;31>=b;b++,c>>>=1)if(1&c&&0!==a.dyn_ltree[2*b])return G;if(0!==a.dyn_ltree[18]||0!==a.dyn_ltree[20]||0!==a.dyn_ltree[26])return H;for(b=32;P>b;b++)if(0!==a.dyn_ltree[2*b])return H;return G}function z(a){pa||(m(),pa=!0),a.l_desc=new oa(a.dyn_ltree,ka),a.d_desc=new oa(a.dyn_dtree,la),a.bl_desc=new oa(a.bl_tree,ma),a.bi_buf=0,a.bi_valid=0,n(a)}function A(a,b,c,d){g(a,(J<<1)+(d?1:0),3),p(a,b,c,!0)}function B(a){g(a,K<<1,3),h(a,X,ea),j(a)}function C(a,b,c,d){var e,f,h=0;a.level>0?(a.strm.data_type===I&&(a.strm.data_type=y(a)),t(a,a.l_desc),t(a,a.d_desc),h=w(a),e=a.opt_len+3+7>>>3,f=a.static_len+3+7>>>3,e>=f&&(e=f)):e=f=c+5,e>=c+4&&-1!==b?A(a,b,c,d):a.strategy===F||f===e?(g(a,(K<<1)+(d?1:0),3),s(a,ea,fa)):(g(a,(L<<1)+(d?1:0),3),x(a,a.l_desc.max_code+1,a.d_desc.max_code+1,h+1),s(a,a.dyn_ltree,a.dyn_dtree)),n(a),d&&o(a)}function D(a,b,c){return a.pending_buf[a.d_buf+2*a.last_lit]=b>>>8&255,a.pending_buf[a.d_buf+2*a.last_lit+1]=255&b,a.pending_buf[a.l_buf+a.last_lit]=255&c,a.last_lit++,0===b?a.dyn_ltree[2*c]++:(a.matches++,b--,a.dyn_ltree[2*(ha[c]+P+1)]++,a.dyn_dtree[2*e(b)]++),a.last_lit===a.lit_bufsize-1}var E=a("../utils/common"),F=4,G=0,H=1,I=2,J=0,K=1,L=2,M=3,N=258,O=29,P=256,Q=P+1+O,R=30,S=19,T=2*Q+1,U=15,V=16,W=7,X=256,Y=16,Z=17,$=18,_=[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],aa=[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],ba=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],ca=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],da=512,ea=new Array(2*(Q+2));d(ea);var fa=new Array(2*R);d(fa);var ga=new Array(da);d(ga);var ha=new Array(N-M+1);d(ha);var ia=new Array(O);d(ia);var ja=new Array(R);d(ja);var ka,la,ma,na=function(a,b,c,d,e){this.static_tree=a,this.extra_bits=b,this.extra_base=c,this.elems=d,this.max_length=e,this.has_stree=a&&a.length},oa=function(a,b){this.dyn_tree=a,this.max_code=0,this.stat_desc=b},pa=!1;c._tr_init=z,c._tr_stored_block=A,c._tr_flush_block=C,c._tr_tally=D,c._tr_align=B},{"../utils/common":32}],42:[function(a,b,c){"use strict";function d(){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}b.exports=d},{}],43:[function(a,b,c){(function(b,d){function e(a){if(a<c.DEFLATE||a>c.UNZIP)throw new TypeError("Bad argument");this.mode=a,this.init_done=!1,this.write_in_progress=!1,this.pending_close=!1,this.windowBits=0,this.level=0,this.memLevel=0,this.strategy=0,this.dictionary=null}function f(a,b){for(var c=0;c<a.length;c++)this[b+c]=a[c]}var g=a("pako/lib/zlib/messages"),h=a("pako/lib/zlib/zstream"),i=a("pako/lib/zlib/deflate.js"),j=a("pako/lib/zlib/inflate.js"),k=a("pako/lib/zlib/constants");for(var l in k)c[l]=k[l];c.NONE=0,c.DEFLATE=1,c.INFLATE=2,c.GZIP=3,c.GUNZIP=4,c.DEFLATERAW=5,c.INFLATERAW=6,c.UNZIP=7,e.prototype.init=function(a,b,d,e,f){switch(this.windowBits=a,this.level=b,this.memLevel=d,this.strategy=e,(this.mode===c.GZIP||this.mode===c.GUNZIP)&&(this.windowBits+=16),this.mode===c.UNZIP&&(this.windowBits+=32),(this.mode===c.DEFLATERAW||this.mode===c.INFLATERAW)&&(this.windowBits=-this.windowBits),this.strm=new h,this.mode){case c.DEFLATE:case c.GZIP:case c.DEFLATERAW:var g=i.deflateInit2(this.strm,this.level,c.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case c.INFLATE:case c.GUNZIP:case c.INFLATERAW:case c.UNZIP:var g=j.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}return g!==c.Z_OK?void this._error(g):(this.write_in_progress=!1,void(this.init_done=!0))},e.prototype.params=function(){throw new Error("deflateParams Not supported")},e.prototype._writeCheck=function(){if(!this.init_done)throw new Error("write before init");if(this.mode===c.NONE)throw new Error("already finalized");if(this.write_in_progress)throw new Error("write already in progress");if(this.pending_close)throw new Error("close is pending")},e.prototype.write=function(a,c,d,e,f,g,h){this._writeCheck(),this.write_in_progress=!0;var i=this;return b.nextTick(function(){i.write_in_progress=!1;var b=i._write(a,c,d,e,f,g,h);i.callback(b[0],b[1]),i.pending_close&&i.close()}),this},e.prototype.writeSync=function(a,b,c,d,e,f,g){return this._writeCheck(),this._write(a,b,c,d,e,f,g)},e.prototype._write=function(a,b,e,g,h,k,l){if(this.write_in_progress=!0,a!==c.Z_NO_FLUSH&&a!==c.Z_PARTIAL_FLUSH&&a!==c.Z_SYNC_FLUSH&&a!==c.Z_FULL_FLUSH&&a!==c.Z_FINISH&&a!==c.Z_BLOCK)throw new Error("Invalid flush value");null==b&&(b=new d(0),g=0,e=0),h._set?h.set=h._set:h.set=f;var m=this.strm;switch(m.avail_in=g,m.input=b,m.next_in=e,m.avail_out=l,m.output=h,m.next_out=k,this.mode){case c.DEFLATE:case c.GZIP:case c.DEFLATERAW:var n=i.deflate(m,a);break;case c.UNZIP:case c.INFLATE:case c.GUNZIP:case c.INFLATERAW:var n=j.inflate(m,a);break;default:throw new Error("Unknown mode "+this.mode)}return n!==c.Z_STREAM_END&&n!==c.Z_OK&&this._error(n),this.write_in_progress=!1,[m.avail_in,m.avail_out]},e.prototype.close=function(){return this.write_in_progress?void(this.pending_close=!0):(this.pending_close=!1,this.mode===c.DEFLATE||this.mode===c.GZIP||this.mode===c.DEFLATERAW?i.deflateEnd(this.strm):j.inflateEnd(this.strm),void(this.mode=c.NONE))},e.prototype.reset=function(){switch(this.mode){case c.DEFLATE:case c.DEFLATERAW:var a=i.deflateReset(this.strm);break;case c.INFLATE:case c.INFLATERAW:var a=j.inflateReset(this.strm)}a!==c.Z_OK&&this._error(a)},e.prototype._error=function(a){this.onerror(g[a]+": "+this.strm.msg,a),this.write_in_progress=!1,this.pending_close&&this.close()},c.Zlib=e}).call(this,a("_process"),a("buffer").Buffer)},{_process:54,buffer:45,"pako/lib/zlib/constants":34,"pako/lib/zlib/deflate.js":36,"pako/lib/zlib/inflate.js":38,"pako/lib/zlib/messages":40,"pako/lib/zlib/zstream":42}],44:[function(a,b,c){(function(b,d){function e(a,b,c){function e(){for(var b;null!==(b=a.read());)h.push(b),i+=b.length;a.once("readable",e)}function f(b){a.removeListener("end",g),a.removeListener("readable",e),c(b)}function g(){var b=d.concat(h,i);h=[],c(null,b),a.close()}var h=[],i=0;a.on("error",f),a.on("end",g),a.end(b),e()}function f(a,b){if("string"==typeof b&&(b=new d(b)),!d.isBuffer(b))throw new TypeError("Not a string or buffer");var c=p.Z_FINISH;return a._processChunk(b,c)}function g(a){return this instanceof g?void n.call(this,a,p.DEFLATE):new g(a)}function h(a){return this instanceof h?void n.call(this,a,p.INFLATE):new h(a)}function i(a){return this instanceof i?void n.call(this,a,p.GZIP):new i(a)}function j(a){return this instanceof j?void n.call(this,a,p.GUNZIP):new j(a)}function k(a){return this instanceof k?void n.call(this,a,p.DEFLATERAW):new k(a)}function l(a){return this instanceof l?void n.call(this,a,p.INFLATERAW):new l(a)}function m(a){return this instanceof m?void n.call(this,a,p.UNZIP):new m(a)}function n(a,b){if(this._opts=a=a||{},this._chunkSize=a.chunkSize||c.Z_DEFAULT_CHUNK,o.call(this,a),a.flush&&a.flush!==p.Z_NO_FLUSH&&a.flush!==p.Z_PARTIAL_FLUSH&&a.flush!==p.Z_SYNC_FLUSH&&a.flush!==p.Z_FULL_FLUSH&&a.flush!==p.Z_FINISH&&a.flush!==p.Z_BLOCK)throw new Error("Invalid flush flag: "+a.flush);if(this._flushFlag=a.flush||p.Z_NO_FLUSH,a.chunkSize&&(a.chunkSize<c.Z_MIN_CHUNK||a.chunkSize>c.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+a.chunkSize);if(a.windowBits&&(a.windowBits<c.Z_MIN_WINDOWBITS||a.windowBits>c.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+a.windowBits);if(a.level&&(a.level<c.Z_MIN_LEVEL||a.level>c.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+a.level);if(a.memLevel&&(a.memLevel<c.Z_MIN_MEMLEVEL||a.memLevel>c.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+a.memLevel);if(a.strategy&&a.strategy!=c.Z_FILTERED&&a.strategy!=c.Z_HUFFMAN_ONLY&&a.strategy!=c.Z_RLE&&a.strategy!=c.Z_FIXED&&a.strategy!=c.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+a.strategy);if(a.dictionary&&!d.isBuffer(a.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._binding=new p.Zlib(b);var e=this;this._hadError=!1,this._binding.onerror=function(a,b){e._binding=null,e._hadError=!0;var d=new Error(a);d.errno=b,d.code=c.codes[b],e.emit("error",d)};var f=c.Z_DEFAULT_COMPRESSION;"number"==typeof a.level&&(f=a.level);var g=c.Z_DEFAULT_STRATEGY;"number"==typeof a.strategy&&(g=a.strategy),this._binding.init(a.windowBits||c.Z_DEFAULT_WINDOWBITS,f,a.memLevel||c.Z_DEFAULT_MEMLEVEL,g,a.dictionary),this._buffer=new d(this._chunkSize),this._offset=0,this._closed=!1,this._level=f,this._strategy=g,this.once("end",this.close)}var o=a("_stream_transform"),p=a("./binding"),q=a("util"),r=a("assert").ok;p.Z_MIN_WINDOWBITS=8,p.Z_MAX_WINDOWBITS=15,p.Z_DEFAULT_WINDOWBITS=15,p.Z_MIN_CHUNK=64,p.Z_MAX_CHUNK=1/0,p.Z_DEFAULT_CHUNK=16384,p.Z_MIN_MEMLEVEL=1,p.Z_MAX_MEMLEVEL=9,p.Z_DEFAULT_MEMLEVEL=8,p.Z_MIN_LEVEL=-1,p.Z_MAX_LEVEL=9,p.Z_DEFAULT_LEVEL=p.Z_DEFAULT_COMPRESSION,Object.keys(p).forEach(function(a){a.match(/^Z/)&&(c[a]=p[a])}),c.codes={Z_OK:p.Z_OK,Z_STREAM_END:p.Z_STREAM_END,Z_NEED_DICT:p.Z_NEED_DICT,Z_ERRNO:p.Z_ERRNO,Z_STREAM_ERROR:p.Z_STREAM_ERROR,Z_DATA_ERROR:p.Z_DATA_ERROR,Z_MEM_ERROR:p.Z_MEM_ERROR,Z_BUF_ERROR:p.Z_BUF_ERROR,Z_VERSION_ERROR:p.Z_VERSION_ERROR},Object.keys(c.codes).forEach(function(a){c.codes[c.codes[a]]=a}),c.Deflate=g,c.Inflate=h,c.Gzip=i,c.Gunzip=j,c.DeflateRaw=k,c.InflateRaw=l,c.Unzip=m,c.createDeflate=function(a){return new g(a)},c.createInflate=function(a){return new h(a)},c.createDeflateRaw=function(a){return new k(a)},c.createInflateRaw=function(a){return new l(a)},c.createGzip=function(a){return new i(a)},c.createGunzip=function(a){return new j(a)},c.createUnzip=function(a){return new m(a)},c.deflate=function(a,b,c){return"function"==typeof b&&(c=b,b={}),e(new g(b),a,c)},c.deflateSync=function(a,b){return f(new g(b),a)},c.gzip=function(a,b,c){return"function"==typeof b&&(c=b,b={}),e(new i(b),a,c)},c.gzipSync=function(a,b){return f(new i(b),a)},c.deflateRaw=function(a,b,c){return"function"==typeof b&&(c=b,b={}),e(new k(b),a,c)},c.deflateRawSync=function(a,b){return f(new k(b),a)},c.unzip=function(a,b,c){return"function"==typeof b&&(c=b,b={}),e(new m(b),a,c)},c.unzipSync=function(a,b){return f(new m(b),a)},c.inflate=function(a,b,c){return"function"==typeof b&&(c=b,b={}),e(new h(b),a,c)},c.inflateSync=function(a,b){return f(new h(b),a)},c.gunzip=function(a,b,c){return"function"==typeof b&&(c=b,b={}),e(new j(b),a,c)},c.gunzipSync=function(a,b){return f(new j(b),a)},c.inflateRaw=function(a,b,c){return"function"==typeof b&&(c=b,b={}),e(new l(b),a,c)},c.inflateRawSync=function(a,b){return f(new l(b),a)},q.inherits(n,o),n.prototype.params=function(a,d,e){if(a<c.Z_MIN_LEVEL||a>c.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+a);if(d!=c.Z_FILTERED&&d!=c.Z_HUFFMAN_ONLY&&d!=c.Z_RLE&&d!=c.Z_FIXED&&d!=c.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+d);if(this._level!==a||this._strategy!==d){var f=this;this.flush(p.Z_SYNC_FLUSH,function(){f._binding.params(a,d),f._hadError||(f._level=a,f._strategy=d,e&&e())})}else b.nextTick(e)},n.prototype.reset=function(){return this._binding.reset()},n.prototype._flush=function(a){this._transform(new d(0),"",a)},n.prototype.flush=function(a,c){var e=this._writableState;if(("function"==typeof a||void 0===a&&!c)&&(c=a,a=p.Z_FULL_FLUSH),e.ended)c&&b.nextTick(c);else if(e.ending)c&&this.once("end",c);else if(e.needDrain){var f=this;this.once("drain",function(){f.flush(c)})}else this._flushFlag=a,
|
||
this.write(new d(0),"",c)},n.prototype.close=function(a){if(a&&b.nextTick(a),!this._closed){this._closed=!0,this._binding.close();var c=this;b.nextTick(function(){c.emit("close")})}},n.prototype._transform=function(a,b,c){var e,f=this._writableState,g=f.ending||f.ended,h=g&&(!a||f.length===a.length);if(null===!a&&!d.isBuffer(a))return c(new Error("invalid input"));h?e=p.Z_FINISH:(e=this._flushFlag,a.length>=f.length&&(this._flushFlag=this._opts.flush||p.Z_NO_FLUSH));this._processChunk(a,e,c)},n.prototype._processChunk=function(a,b,c){function e(k,n){if(!i._hadError){var o=g-n;if(r(o>=0,"have should not go down"),o>0){var p=i._buffer.slice(i._offset,i._offset+o);i._offset+=o,j?i.push(p):(l.push(p),m+=p.length)}if((0===n||i._offset>=i._chunkSize)&&(g=i._chunkSize,i._offset=0,i._buffer=new d(i._chunkSize)),0===n){if(h+=f-k,f=k,!j)return!0;var q=i._binding.write(b,a,h,f,i._buffer,i._offset,i._chunkSize);return q.callback=e,void(q.buffer=a)}return j?void c():!1}}var f=a&&a.length,g=this._chunkSize-this._offset,h=0,i=this,j="function"==typeof c;if(!j){var k,l=[],m=0;this.on("error",function(a){k=a});do var n=this._binding.writeSync(b,a,h,f,this._buffer,this._offset,g);while(!this._hadError&&e(n[0],n[1]));if(this._hadError)throw k;var o=d.concat(l,m);return this.close(),o}var p=this._binding.write(b,a,h,f,this._buffer,this._offset,g);p.buffer=a,p.callback=e},q.inherits(g,n),q.inherits(h,n),q.inherits(i,n),q.inherits(j,n),q.inherits(k,n),q.inherits(l,n),q.inherits(m,n)}).call(this,a("_process"),a("buffer").Buffer)},{"./binding":43,_process:54,_stream_transform:66,assert:30,buffer:45,util:71}],45:[function(a,b,c){(function(b){function d(){return e.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function e(a){return this instanceof e?(this.length=0,this.parent=void 0,"number"==typeof a?f(this,a):"string"==typeof a?g(this,a,arguments.length>1?arguments[1]:"utf8"):h(this,a)):arguments.length>1?new e(a,arguments[1]):new e(a)}function f(a,b){if(a=o(a,0>b?0:0|p(b)),!e.TYPED_ARRAY_SUPPORT)for(var c=0;b>c;c++)a[c]=0;return a}function g(a,b,c){("string"!=typeof c||""===c)&&(c="utf8");var d=0|r(b,c);return a=o(a,d),a.write(b,c),a}function h(a,b){if(e.isBuffer(b))return i(a,b);if(X(b))return j(a,b);if(null==b)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(b.buffer instanceof ArrayBuffer)return k(a,b);if(b instanceof ArrayBuffer)return l(a,b)}return b.length?m(a,b):n(a,b)}function i(a,b){var c=0|p(b.length);return a=o(a,c),b.copy(a,0,0,c),a}function j(a,b){var c=0|p(b.length);a=o(a,c);for(var d=0;c>d;d+=1)a[d]=255&b[d];return a}function k(a,b){var c=0|p(b.length);a=o(a,c);for(var d=0;c>d;d+=1)a[d]=255&b[d];return a}function l(a,b){return e.TYPED_ARRAY_SUPPORT?(b.byteLength,a=e._augment(new Uint8Array(b))):a=k(a,new Uint8Array(b)),a}function m(a,b){var c=0|p(b.length);a=o(a,c);for(var d=0;c>d;d+=1)a[d]=255&b[d];return a}function n(a,b){var c,d=0;"Buffer"===b.type&&X(b.data)&&(c=b.data,d=0|p(c.length)),a=o(a,d);for(var e=0;d>e;e+=1)a[e]=255&c[e];return a}function o(a,b){e.TYPED_ARRAY_SUPPORT?(a=e._augment(new Uint8Array(b)),a.__proto__=e.prototype):(a.length=b,a._isBuffer=!0);var c=0!==b&&b<=e.poolSize>>>1;return c&&(a.parent=Y),a}function p(a){if(a>=d())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+d().toString(16)+" bytes");return 0|a}function q(a,b){if(!(this instanceof q))return new q(a,b);var c=new e(a,b);return delete c.parent,c}function r(a,b){"string"!=typeof a&&(a=""+a);var c=a.length;if(0===c)return 0;for(var d=!1;;)switch(b){case"ascii":case"binary":case"raw":case"raws":return c;case"utf8":case"utf-8":return Q(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return T(a).length;default:if(d)return Q(a).length;b=(""+b).toLowerCase(),d=!0}}function s(a,b,c){var d=!1;if(b=0|b,c=void 0===c||c===1/0?this.length:0|c,a||(a="utf8"),0>b&&(b=0),c>this.length&&(c=this.length),b>=c)return"";for(;;)switch(a){case"hex":return E(this,b,c);case"utf8":case"utf-8":return A(this,b,c);case"ascii":return C(this,b,c);case"binary":return D(this,b,c);case"base64":return z(this,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,b,c);default:if(d)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),d=!0}}function t(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;if(f%2!==0)throw new Error("Invalid hex string");d>f/2&&(d=f/2);for(var g=0;d>g;g++){var h=parseInt(b.substr(2*g,2),16);if(isNaN(h))throw new Error("Invalid hex string");a[c+g]=h}return g}function u(a,b,c,d){return U(Q(b,a.length-c),a,c,d)}function v(a,b,c,d){return U(R(b),a,c,d)}function w(a,b,c,d){return v(a,b,c,d)}function x(a,b,c,d){return U(T(b),a,c,d)}function y(a,b,c,d){return U(S(b,a.length-c),a,c,d)}function z(a,b,c){return 0===b&&c===a.length?V.fromByteArray(a):V.fromByteArray(a.slice(b,c))}function A(a,b,c){c=Math.min(a.length,c);for(var d=[],e=b;c>e;){var f=a[e],g=null,h=f>239?4:f>223?3:f>191?2:1;if(c>=e+h){var i,j,k,l;switch(h){case 1:128>f&&(g=f);break;case 2:i=a[e+1],128===(192&i)&&(l=(31&f)<<6|63&i,l>127&&(g=l));break;case 3:i=a[e+1],j=a[e+2],128===(192&i)&&128===(192&j)&&(l=(15&f)<<12|(63&i)<<6|63&j,l>2047&&(55296>l||l>57343)&&(g=l));break;case 4:i=a[e+1],j=a[e+2],k=a[e+3],128===(192&i)&&128===(192&j)&&128===(192&k)&&(l=(15&f)<<18|(63&i)<<12|(63&j)<<6|63&k,l>65535&&1114112>l&&(g=l))}}null===g?(g=65533,h=1):g>65535&&(g-=65536,d.push(g>>>10&1023|55296),g=56320|1023&g),d.push(g),e+=h}return B(d)}function B(a){var b=a.length;if(Z>=b)return String.fromCharCode.apply(String,a);for(var c="",d=0;b>d;)c+=String.fromCharCode.apply(String,a.slice(d,d+=Z));return c}function C(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(127&a[e]);return d}function D(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(a[e]);return d}function E(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;f++)e+=P(a[f]);return e}function F(a,b,c){for(var d=a.slice(b,c),e="",f=0;f<d.length;f+=2)e+=String.fromCharCode(d[f]+256*d[f+1]);return e}function G(a,b,c){if(a%1!==0||0>a)throw new RangeError("offset is not uint");if(a+b>c)throw new RangeError("Trying to access beyond buffer length")}function H(a,b,c,d,f,g){if(!e.isBuffer(a))throw new TypeError("buffer must be a Buffer instance");if(b>f||g>b)throw new RangeError("value is out of bounds");if(c+d>a.length)throw new RangeError("index out of range")}function I(a,b,c,d){0>b&&(b=65535+b+1);for(var e=0,f=Math.min(a.length-c,2);f>e;e++)a[c+e]=(b&255<<8*(d?e:1-e))>>>8*(d?e:1-e)}function J(a,b,c,d){0>b&&(b=4294967295+b+1);for(var e=0,f=Math.min(a.length-c,4);f>e;e++)a[c+e]=b>>>8*(d?e:3-e)&255}function K(a,b,c,d,e,f){if(b>e||f>b)throw new RangeError("value is out of bounds");if(c+d>a.length)throw new RangeError("index out of range");if(0>c)throw new RangeError("index out of range")}function L(a,b,c,d,e){return e||K(a,b,c,4,3.4028234663852886e38,-3.4028234663852886e38),W.write(a,b,c,d,23,4),c+4}function M(a,b,c,d,e){return e||K(a,b,c,8,1.7976931348623157e308,-1.7976931348623157e308),W.write(a,b,c,d,52,8),c+8}function N(a){if(a=O(a).replace(_,""),a.length<2)return"";for(;a.length%4!==0;)a+="=";return a}function O(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function P(a){return 16>a?"0"+a.toString(16):a.toString(16)}function Q(a,b){b=b||1/0;for(var c,d=a.length,e=null,f=[],g=0;d>g;g++){if(c=a.charCodeAt(g),c>55295&&57344>c){if(!e){if(c>56319){(b-=3)>-1&&f.push(239,191,189);continue}if(g+1===d){(b-=3)>-1&&f.push(239,191,189);continue}e=c;continue}if(56320>c){(b-=3)>-1&&f.push(239,191,189),e=c;continue}c=e-55296<<10|c-56320|65536}else e&&(b-=3)>-1&&f.push(239,191,189);if(e=null,128>c){if((b-=1)<0)break;f.push(c)}else if(2048>c){if((b-=2)<0)break;f.push(c>>6|192,63&c|128)}else if(65536>c){if((b-=3)<0)break;f.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(1114112>c))throw new Error("Invalid code point");if((b-=4)<0)break;f.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return f}function R(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function S(a,b){for(var c,d,e,f=[],g=0;g<a.length&&!((b-=2)<0);g++)c=a.charCodeAt(g),d=c>>8,e=c%256,f.push(e),f.push(d);return f}function T(a){return V.toByteArray(N(a))}function U(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);e++)b[e+c]=a[e];return e}var V=a("base64-js"),W=a("ieee754"),X=a("is-array");c.Buffer=e,c.SlowBuffer=q,c.INSPECT_MAX_BYTES=50,e.poolSize=8192;var Y={};e.TYPED_ARRAY_SUPPORT=void 0!==b.TYPED_ARRAY_SUPPORT?b.TYPED_ARRAY_SUPPORT:function(){function a(){}try{var b=new Uint8Array(1);return b.foo=function(){return 42},b.constructor=a,42===b.foo()&&b.constructor===a&&"function"==typeof b.subarray&&0===b.subarray(1,1).byteLength}catch(c){return!1}}(),e.TYPED_ARRAY_SUPPORT&&(e.prototype.__proto__=Uint8Array.prototype,e.__proto__=Uint8Array),e.isBuffer=function(a){return!(null==a||!a._isBuffer)},e.compare=function(a,b){if(!e.isBuffer(a)||!e.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var c=a.length,d=b.length,f=0,g=Math.min(c,d);g>f&&a[f]===b[f];)++f;return f!==g&&(c=a[f],d=b[f]),d>c?-1:c>d?1:0},e.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},e.concat=function(a,b){if(!X(a))throw new TypeError("list argument must be an Array of Buffers.");if(0===a.length)return new e(0);var c;if(void 0===b)for(b=0,c=0;c<a.length;c++)b+=a[c].length;var d=new e(b),f=0;for(c=0;c<a.length;c++){var g=a[c];g.copy(d,f),f+=g.length}return d},e.byteLength=r,e.prototype.length=void 0,e.prototype.parent=void 0,e.prototype.toString=function(){var a=0|this.length;return 0===a?"":0===arguments.length?A(this,0,a):s.apply(this,arguments)},e.prototype.equals=function(a){if(!e.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:0===e.compare(this,a)},e.prototype.inspect=function(){var a="",b=c.INSPECT_MAX_BYTES;return this.length>0&&(a=this.toString("hex",0,b).match(/.{2}/g).join(" "),this.length>b&&(a+=" ... ")),"<Buffer "+a+">"},e.prototype.compare=function(a){if(!e.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?0:e.compare(this,a)},e.prototype.indexOf=function(a,b){function c(a,b,c){for(var d=-1,e=0;c+e<a.length;e++)if(a[c+e]===b[-1===d?0:e-d]){if(-1===d&&(d=e),e-d+1===b.length)return c+d}else d=-1;return-1}if(b>2147483647?b=2147483647:-2147483648>b&&(b=-2147483648),b>>=0,0===this.length)return-1;if(b>=this.length)return-1;if(0>b&&(b=Math.max(this.length+b,0)),"string"==typeof a)return 0===a.length?-1:String.prototype.indexOf.call(this,a,b);if(e.isBuffer(a))return c(this,a,b);if("number"==typeof a)return e.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,a,b):c(this,[a],b);throw new TypeError("val must be string, number or Buffer")},e.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},e.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},e.prototype.write=function(a,b,c,d){if(void 0===b)d="utf8",c=this.length,b=0;else if(void 0===c&&"string"==typeof b)d=b,c=this.length,b=0;else if(isFinite(b))b=0|b,isFinite(c)?(c=0|c,void 0===d&&(d="utf8")):(d=c,c=void 0);else{var e=d;d=b,b=0|c,c=e}var f=this.length-b;if((void 0===c||c>f)&&(c=f),a.length>0&&(0>c||0>b)||b>this.length)throw new RangeError("attempt to write outside buffer bounds");d||(d="utf8");for(var g=!1;;)switch(d){case"hex":return t(this,a,b,c);case"utf8":case"utf-8":return u(this,a,b,c);case"ascii":return v(this,a,b,c);case"binary":return w(this,a,b,c);case"base64":return x(this,a,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y(this,a,b,c);default:if(g)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),g=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;e.prototype.slice=function(a,b){var c=this.length;a=~~a,b=void 0===b?c:~~b,0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c),0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c),a>b&&(b=a);var d;if(e.TYPED_ARRAY_SUPPORT)d=e._augment(this.subarray(a,b));else{var f=b-a;d=new e(f,void 0);for(var g=0;f>g;g++)d[g]=this[g+a]}return d.length&&(d.parent=this.parent||this),d},e.prototype.readUIntLE=function(a,b,c){a=0|a,b=0|b,c||G(a,b,this.length);for(var d=this[a],e=1,f=0;++f<b&&(e*=256);)d+=this[a+f]*e;return d},e.prototype.readUIntBE=function(a,b,c){a=0|a,b=0|b,c||G(a,b,this.length);for(var d=this[a+--b],e=1;b>0&&(e*=256);)d+=this[a+--b]*e;return d},e.prototype.readUInt8=function(a,b){return b||G(a,1,this.length),this[a]},e.prototype.readUInt16LE=function(a,b){return b||G(a,2,this.length),this[a]|this[a+1]<<8},e.prototype.readUInt16BE=function(a,b){return b||G(a,2,this.length),this[a]<<8|this[a+1]},e.prototype.readUInt32LE=function(a,b){return b||G(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]},e.prototype.readUInt32BE=function(a,b){return b||G(a,4,this.length),16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])},e.prototype.readIntLE=function(a,b,c){a=0|a,b=0|b,c||G(a,b,this.length);for(var d=this[a],e=1,f=0;++f<b&&(e*=256);)d+=this[a+f]*e;return e*=128,d>=e&&(d-=Math.pow(2,8*b)),d},e.prototype.readIntBE=function(a,b,c){a=0|a,b=0|b,c||G(a,b,this.length);for(var d=b,e=1,f=this[a+--d];d>0&&(e*=256);)f+=this[a+--d]*e;return e*=128,f>=e&&(f-=Math.pow(2,8*b)),f},e.prototype.readInt8=function(a,b){return b||G(a,1,this.length),128&this[a]?-1*(255-this[a]+1):this[a]},e.prototype.readInt16LE=function(a,b){b||G(a,2,this.length);var c=this[a]|this[a+1]<<8;return 32768&c?4294901760|c:c},e.prototype.readInt16BE=function(a,b){b||G(a,2,this.length);var c=this[a+1]|this[a]<<8;return 32768&c?4294901760|c:c},e.prototype.readInt32LE=function(a,b){return b||G(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},e.prototype.readInt32BE=function(a,b){return b||G(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},e.prototype.readFloatLE=function(a,b){return b||G(a,4,this.length),W.read(this,a,!0,23,4)},e.prototype.readFloatBE=function(a,b){return b||G(a,4,this.length),W.read(this,a,!1,23,4)},e.prototype.readDoubleLE=function(a,b){return b||G(a,8,this.length),W.read(this,a,!0,52,8)},e.prototype.readDoubleBE=function(a,b){return b||G(a,8,this.length),W.read(this,a,!1,52,8)},e.prototype.writeUIntLE=function(a,b,c,d){a=+a,b=0|b,c=0|c,d||H(this,a,b,c,Math.pow(2,8*c),0);var e=1,f=0;for(this[b]=255&a;++f<c&&(e*=256);)this[b+f]=a/e&255;return b+c},e.prototype.writeUIntBE=function(a,b,c,d){a=+a,b=0|b,c=0|c,d||H(this,a,b,c,Math.pow(2,8*c),0);var e=c-1,f=1;for(this[b+e]=255&a;--e>=0&&(f*=256);)this[b+e]=a/f&255;return b+c},e.prototype.writeUInt8=function(a,b,c){return a=+a,b=0|b,c||H(this,a,b,1,255,0),e.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),this[b]=a,b+1},e.prototype.writeUInt16LE=function(a,b,c){return a=+a,b=0|b,c||H(this,a,b,2,65535,0),e.TYPED_ARRAY_SUPPORT?(this[b]=a,this[b+1]=a>>>8):I(this,a,b,!0),b+2},e.prototype.writeUInt16BE=function(a,b,c){return a=+a,b=0|b,c||H(this,a,b,2,65535,0),e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a):I(this,a,b,!1),b+2},e.prototype.writeUInt32LE=function(a,b,c){return a=+a,b=0|b,c||H(this,a,b,4,4294967295,0),e.TYPED_ARRAY_SUPPORT?(this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=a):J(this,a,b,!0),b+4},e.prototype.writeUInt32BE=function(a,b,c){return a=+a,b=0|b,c||H(this,a,b,4,4294967295,0),e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=a):J(this,a,b,!1),b+4},e.prototype.writeIntLE=function(a,b,c,d){if(a=+a,b=0|b,!d){var e=Math.pow(2,8*c-1);H(this,a,b,c,e-1,-e)}var f=0,g=1,h=0>a?1:0;for(this[b]=255&a;++f<c&&(g*=256);)this[b+f]=(a/g>>0)-h&255;return b+c},e.prototype.writeIntBE=function(a,b,c,d){if(a=+a,b=0|b,!d){var e=Math.pow(2,8*c-1);H(this,a,b,c,e-1,-e)}var f=c-1,g=1,h=0>a?1:0;for(this[b+f]=255&a;--f>=0&&(g*=256);)this[b+f]=(a/g>>0)-h&255;return b+c},e.prototype.writeInt8=function(a,b,c){return a=+a,b=0|b,c||H(this,a,b,1,127,-128),e.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),0>a&&(a=255+a+1),this[b]=a,b+1},e.prototype.writeInt16LE=function(a,b,c){return a=+a,b=0|b,c||H(this,a,b,2,32767,-32768),e.TYPED_ARRAY_SUPPORT?(this[b]=a,this[b+1]=a>>>8):I(this,a,b,!0),b+2},e.prototype.writeInt16BE=function(a,b,c){return a=+a,b=0|b,c||H(this,a,b,2,32767,-32768),e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a):I(this,a,b,!1),b+2},e.prototype.writeInt32LE=function(a,b,c){return a=+a,b=0|b,c||H(this,a,b,4,2147483647,-2147483648),e.TYPED_ARRAY_SUPPORT?(this[b]=a,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24):J(this,a,b,!0),b+4},e.prototype.writeInt32BE=function(a,b,c){return a=+a,b=0|b,c||H(this,a,b,4,2147483647,-2147483648),0>a&&(a=4294967295+a+1),e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=a):J(this,a,b,!1),b+4},e.prototype.writeFloatLE=function(a,b,c){return L(this,a,b,!0,c)},e.prototype.writeFloatBE=function(a,b,c){return L(this,a,b,!1,c)},e.prototype.writeDoubleLE=function(a,b,c){return M(this,a,b,!0,c)},e.prototype.writeDoubleBE=function(a,b,c){return M(this,a,b,!1,c)},e.prototype.copy=function(a,b,c,d){if(c||(c=0),d||0===d||(d=this.length),b>=a.length&&(b=a.length),b||(b=0),d>0&&c>d&&(d=c),d===c)return 0;if(0===a.length||0===this.length)return 0;if(0>b)throw new RangeError("targetStart out of bounds");if(0>c||c>=this.length)throw new RangeError("sourceStart out of bounds");if(0>d)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);var f,g=d-c;if(this===a&&b>c&&d>b)for(f=g-1;f>=0;f--)a[f+b]=this[f+c];else if(1e3>g||!e.TYPED_ARRAY_SUPPORT)for(f=0;g>f;f++)a[f+b]=this[f+c];else a._set(this.subarray(c,c+g),b);return g},e.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),b>c)throw new RangeError("end < start");if(c!==b&&0!==this.length){if(0>b||b>=this.length)throw new RangeError("start out of bounds");if(0>c||c>this.length)throw new RangeError("end out of bounds");var d;if("number"==typeof a)for(d=b;c>d;d++)this[d]=a;else{var e=Q(a.toString()),f=e.length;for(d=b;c>d;d++)this[d]=e[d%f]}return this}},e.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(e.TYPED_ARRAY_SUPPORT)return new e(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;c>b;b+=1)a[b]=this[b];return a.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var $=e.prototype;e._augment=function(a){return a.constructor=e,a._isBuffer=!0,a._set=a.set,a.get=$.get,a.set=$.set,a.write=$.write,a.toString=$.toString,a.toLocaleString=$.toString,a.toJSON=$.toJSON,a.equals=$.equals,a.compare=$.compare,a.indexOf=$.indexOf,a.copy=$.copy,a.slice=$.slice,a.readUIntLE=$.readUIntLE,a.readUIntBE=$.readUIntBE,a.readUInt8=$.readUInt8,a.readUInt16LE=$.readUInt16LE,a.readUInt16BE=$.readUInt16BE,a.readUInt32LE=$.readUInt32LE,a.readUInt32BE=$.readUInt32BE,a.readIntLE=$.readIntLE,a.readIntBE=$.readIntBE,a.readInt8=$.readInt8,a.readInt16LE=$.readInt16LE,a.readInt16BE=$.readInt16BE,a.readInt32LE=$.readInt32LE,a.readInt32BE=$.readInt32BE,a.readFloatLE=$.readFloatLE,a.readFloatBE=$.readFloatBE,a.readDoubleLE=$.readDoubleLE,a.readDoubleBE=$.readDoubleBE,a.writeUInt8=$.writeUInt8,a.writeUIntLE=$.writeUIntLE,a.writeUIntBE=$.writeUIntBE,a.writeUInt16LE=$.writeUInt16LE,a.writeUInt16BE=$.writeUInt16BE,a.writeUInt32LE=$.writeUInt32LE,a.writeUInt32BE=$.writeUInt32BE,a.writeIntLE=$.writeIntLE,a.writeIntBE=$.writeIntBE,a.writeInt8=$.writeInt8,a.writeInt16LE=$.writeInt16LE,a.writeInt16BE=$.writeInt16BE,a.writeInt32LE=$.writeInt32LE,a.writeInt32BE=$.writeInt32BE,a.writeFloatLE=$.writeFloatLE,a.writeFloatBE=$.writeFloatBE,a.writeDoubleLE=$.writeDoubleLE,a.writeDoubleBE=$.writeDoubleBE,a.fill=$.fill,a.inspect=$.inspect,a.toArrayBuffer=$.toArrayBuffer,a};var _=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":46,ieee754:47,"is-array":48}],46:[function(a,b,c){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(a){"use strict";function b(a){var b=a.charCodeAt(0);return b===g||b===l?62:b===h||b===m?63:i>b?-1:i+10>b?b-i+26+26:k+26>b?b-k:j+26>b?b-j+26:void 0}function c(a){function c(a){j[l++]=a}var d,e,g,h,i,j;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new f(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,e=0;g>d;d+=4,e+=3)h=b(a.charAt(d))<<18|b(a.charAt(d+1))<<12|b(a.charAt(d+2))<<6|b(a.charAt(d+3)),c((16711680&h)>>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function e(a){function b(a){return d.charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var e,f,g,h=a.length%3,i="";for(e=0,g=a.length-h;g>e;e+=3)f=(a[e]<<16)+(a[e+1]<<8)+a[e+2],i+=c(f);switch(h){case 1:f=a[a.length-1],i+=b(f>>2),i+=b(f<<4&63),i+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],i+=b(f>>10),i+=b(f>>4&63),i+=b(f<<2&63),i+="="}return i}var f="undefined"!=typeof Uint8Array?Uint8Array:Array,g="+".charCodeAt(0),h="/".charCodeAt(0),i="0".charCodeAt(0),j="a".charCodeAt(0),k="A".charCodeAt(0),l="-".charCodeAt(0),m="_".charCodeAt(0);a.toByteArray=c,a.fromByteArray=e}("undefined"==typeof c?this.base64js={}:c)},{}],47:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?NaN:(n?-1:1)*(1/0);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||b===1/0?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],48:[function(a,b,c){var d=Array.isArray,e=Object.prototype.toString;b.exports=d||function(a){return!!a&&"[object Array]"==e.call(a)}},{}],49:[function(a,b,c){function d(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function e(a){return"function"==typeof a}function f(a){return"number"==typeof a}function g(a){return"object"==typeof a&&null!==a}function h(a){return void 0===a}b.exports=d,d.EventEmitter=d,d.prototype._events=void 0,d.prototype._maxListeners=void 0,d.defaultMaxListeners=10,d.prototype.setMaxListeners=function(a){if(!f(a)||0>a||isNaN(a))throw TypeError("n must be a positive number");return this._maxListeners=a,this},d.prototype.emit=function(a){var b,c,d,f,i,j;if(this._events||(this._events={}),"error"===a&&(!this._events.error||g(this._events.error)&&!this._events.error.length)){if(b=arguments[1],b instanceof Error)throw b;throw TypeError('Uncaught, unspecified "error" event.')}if(c=this._events[a],h(c))return!1;if(e(c))switch(arguments.length){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(d=arguments.length,f=new Array(d-1),i=1;d>i;i++)f[i-1]=arguments[i];c.apply(this,f)}else if(g(c)){for(d=arguments.length,f=new Array(d-1),i=1;d>i;i++)f[i-1]=arguments[i];for(j=c.slice(),d=j.length,i=0;d>i;i++)j[i].apply(this,f)}return!0},d.prototype.addListener=function(a,b){var c;if(!e(b))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",a,e(b.listener)?b.listener:b),this._events[a]?g(this._events[a])?this._events[a].push(b):this._events[a]=[this._events[a],b]:this._events[a]=b,g(this._events[a])&&!this._events[a].warned){var c;c=h(this._maxListeners)?d.defaultMaxListeners:this._maxListeners,c&&c>0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),"function"==typeof console.trace&&console.trace())}return this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){function c(){this.removeListener(a,c),d||(d=!0,b.apply(this,arguments))}if(!e(b))throw TypeError("listener must be a function");var d=!1;return c.listener=b,this.on(a,c),this},d.prototype.removeListener=function(a,b){var c,d,f,h;if(!e(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(c=this._events[a],f=c.length,d=-1,c===b||e(c.listener)&&c.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(g(c)){for(h=f;h-->0;)if(c[h]===b||c[h].listener&&c[h].listener===b){d=h;break}if(0>d)return this;1===c.length?(c.length=0,delete this._events[a]):c.splice(d,1),this._events.removeListener&&this.emit("removeListener",a,b)}return this},d.prototype.removeAllListeners=function(a){var b,c;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);return this.removeAllListeners("removeListener"),this._events={},this}if(c=this._events[a],e(c))this.removeListener(a,c);else for(;c.length;)this.removeListener(a,c[c.length-1]);return delete this._events[a],this},d.prototype.listeners=function(a){var b;return b=this._events&&this._events[a]?e(this._events[a])?[this._events[a]]:this._events[a].slice():[]},d.listenerCount=function(a,b){var c;return c=a._events&&a._events[b]?e(a._events[b])?1:a._events[b].length:0}},{}],50:[function(a,b,c){"function"==typeof Object.create?b.exports=function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:b.exports=function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],51:[function(a,b,c){b.exports=function(a){return!(null==a||!(a._isBuffer||a.constructor&&"function"==typeof a.constructor.isBuffer&&a.constructor.isBuffer(a)))}},{}],52:[function(a,b,c){b.exports=Array.isArray||function(a){return"[object Array]"==Object.prototype.toString.call(a)}},{}],53:[function(a,b,c){(function(a){function b(a,b){for(var c=0,d=a.length-1;d>=0;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c--;c)a.unshift("..");return a}function d(a,b){if(a.filter)return a.filter(b);for(var c=[],d=0;d<a.length;d++)b(a[d],d,a)&&c.push(a[d]);return c}var e=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,f=function(a){return e.exec(a).slice(1)};c.resolve=function(){for(var c="",e=!1,f=arguments.length-1;f>=-1&&!e;f--){var g=f>=0?arguments[f]:a.cwd();if("string"!=typeof g)throw new TypeError("Arguments to path.resolve must be strings");g&&(c=g+"/"+c,e="/"===g.charAt(0))}return c=b(d(c.split("/"),function(a){return!!a}),!e).join("/"),(e?"/":"")+c||"."},c.normalize=function(a){var e=c.isAbsolute(a),f="/"===g(a,-1);return a=b(d(a.split("/"),function(a){return!!a}),!e).join("/"),a||e||(a="."),a&&f&&(a+="/"),(e?"/":"")+a},c.isAbsolute=function(a){return"/"===a.charAt(0)},c.join=function(){var a=Array.prototype.slice.call(arguments,0);return c.normalize(d(a,function(a,b){if("string"!=typeof a)throw new TypeError("Arguments to path.join must be strings");return a}).join("/"))},c.relative=function(a,b){function d(a){for(var b=0;b<a.length&&""===a[b];b++);for(var c=a.length-1;c>=0&&""===a[c];c--);return b>c?[]:a.slice(b,c-b+1)}a=c.resolve(a).substr(1),b=c.resolve(b).substr(1);for(var e=d(a.split("/")),f=d(b.split("/")),g=Math.min(e.length,f.length),h=g,i=0;g>i;i++)if(e[i]!==f[i]){h=i;break}for(var j=[],i=h;i<e.length;i++)j.push("..");return j=j.concat(f.slice(h)),j.join("/")},c.sep="/",c.delimiter=":",c.dirname=function(a){var b=f(a),c=b[0],d=b[1];return c||d?(d&&(d=d.substr(0,d.length-1)),c+d):"."},c.basename=function(a,b){var c=f(a)[2];return b&&c.substr(-1*b.length)===b&&(c=c.substr(0,c.length-b.length)),c},c.extname=function(a){return f(a)[3]};var g="b"==="ab".substr(-1)?function(a,b,c){return a.substr(b,c)}:function(a,b,c){return 0>b&&(b=a.length+b),a.substr(b,c)}}).call(this,a("_process"))},{_process:54}],54:[function(a,b,c){function d(){k=!1,h.length?j=h.concat(j):l=-1,j.length&&e()}function e(){if(!k){var a=setTimeout(d);k=!0;for(var b=j.length;b;){for(h=j,j=[];++l<b;)h&&h[l].run();l=-1,b=j.length}h=null,k=!1,clearTimeout(a)}}function f(a,b){this.fun=a,this.array=b}function g(){}var h,i=b.exports={},j=[],k=!1,l=-1;i.nextTick=function(a){var b=new Array(arguments.length-1);if(arguments.length>1)for(var c=1;c<arguments.length;c++)b[c-1]=arguments[c];j.push(new f(a,b)),1!==j.length||k||setTimeout(e,0)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.binding=function(a){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(a){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],55:[function(a,b,c){b.exports=a("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":56}],56:[function(a,b,c){"use strict";function d(a){return this instanceof d?(j.call(this,a),k.call(this,a),a&&a.readable===!1&&(this.readable=!1),a&&a.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,a&&a.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",e)):new d(a)}function e(){this.allowHalfOpen||this._writableState.ended||h(f,this)}function f(a){a.end()}var g=Object.keys||function(a){var b=[];for(var c in a)b.push(c);return b};b.exports=d;var h=a("process-nextick-args"),i=a("core-util-is");i.inherits=a("inherits");var j=a("./_stream_readable"),k=a("./_stream_writable");i.inherits(d,j);for(var l=g(k.prototype),m=0;m<l.length;m++){var n=l[m];d.prototype[n]||(d.prototype[n]=k.prototype[n])}},{"./_stream_readable":58,"./_stream_writable":60,"core-util-is":61,inherits:50,"process-nextick-args":62}],57:[function(a,b,c){"use strict";function d(a){return this instanceof d?void e.call(this,a):new d(a)}b.exports=d;var e=a("./_stream_transform"),f=a("core-util-is");f.inherits=a("inherits"),f.inherits(d,e),d.prototype._transform=function(a,b,c){c(null,a)}},{"./_stream_transform":59,"core-util-is":61,inherits:50}],58:[function(a,b,c){(function(c){"use strict";function d(b,c){var d=a("./_stream_duplex");b=b||{},this.objectMode=!!b.objectMode,c instanceof d&&(this.objectMode=this.objectMode||!!b.readableObjectMode);var e=b.highWaterMark,f=this.objectMode?16:16384;this.highWaterMark=e||0===e?e:f,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.defaultEncoding=b.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,b.encoding&&(G||(G=a("string_decoder/").StringDecoder),this.decoder=new G(b.encoding),this.encoding=b.encoding)}function e(b){a("./_stream_duplex");return this instanceof e?(this._readableState=new d(b,this),this.readable=!0,
|
||
b&&"function"==typeof b.read&&(this._read=b.read),void D.call(this)):new e(b)}function f(a,b,c,d,e){var f=j(b,c);if(f)a.emit("error",f);else if(null===c)b.reading=!1,k(a,b);else if(b.objectMode||c&&c.length>0)if(b.ended&&!e){var h=new Error("stream.push() after EOF");a.emit("error",h)}else if(b.endEmitted&&e){var h=new Error("stream.unshift() after end event");a.emit("error",h)}else!b.decoder||e||d||(c=b.decoder.write(c)),e||(b.reading=!1),b.flowing&&0===b.length&&!b.sync?(a.emit("data",c),a.read(0)):(b.length+=b.objectMode?1:c.length,e?b.buffer.unshift(c):b.buffer.push(c),b.needReadable&&l(a)),n(a,b);else e||(b.reading=!1);return g(b)}function g(a){return!a.ended&&(a.needReadable||a.length<a.highWaterMark||0===a.length)}function h(a){if(a>=H)a=H;else{a--;for(var b=1;32>b;b<<=1)a|=a>>b;a++}return a}function i(a,b){return 0===b.length&&b.ended?0:b.objectMode?0===a?0:1:null===a||isNaN(a)?b.flowing&&b.buffer.length?b.buffer[0].length:b.length:0>=a?0:(a>b.highWaterMark&&(b.highWaterMark=h(a)),a>b.length?b.ended?b.length:(b.needReadable=!0,0):a)}function j(a,b){var c=null;return B.isBuffer(b)||"string"==typeof b||null===b||void 0===b||a.objectMode||(c=new TypeError("Invalid non-string/buffer chunk")),c}function k(a,b){if(!b.ended){if(b.decoder){var c=b.decoder.end();c&&c.length&&(b.buffer.push(c),b.length+=b.objectMode?1:c.length)}b.ended=!0,l(a)}}function l(a){var b=a._readableState;b.needReadable=!1,b.emittedReadable||(F("emitReadable",b.flowing),b.emittedReadable=!0,b.sync?z(m,a):m(a))}function m(a){F("emit readable"),a.emit("readable"),t(a)}function n(a,b){b.readingMore||(b.readingMore=!0,z(o,a,b))}function o(a,b){for(var c=b.length;!b.reading&&!b.flowing&&!b.ended&&b.length<b.highWaterMark&&(F("maybeReadMore read 0"),a.read(0),c!==b.length);)c=b.length;b.readingMore=!1}function p(a){return function(){var b=a._readableState;F("pipeOnDrain",b.awaitDrain),b.awaitDrain&&b.awaitDrain--,0===b.awaitDrain&&C.listenerCount(a,"data")&&(b.flowing=!0,t(a))}}function q(a){F("readable nexttick read 0"),a.read(0)}function r(a,b){b.resumeScheduled||(b.resumeScheduled=!0,z(s,a,b))}function s(a,b){b.reading||(F("resume read 0"),a.read(0)),b.resumeScheduled=!1,a.emit("resume"),t(a),b.flowing&&!b.reading&&a.read(0)}function t(a){var b=a._readableState;if(F("flow",b.flowing),b.flowing)do var c=a.read();while(null!==c&&b.flowing)}function u(a,b){var c,d=b.buffer,e=b.length,f=!!b.decoder,g=!!b.objectMode;if(0===d.length)return null;if(0===e)c=null;else if(g)c=d.shift();else if(!a||a>=e)c=f?d.join(""):B.concat(d,e),d.length=0;else if(a<d[0].length){var h=d[0];c=h.slice(0,a),d[0]=h.slice(a)}else if(a===d[0].length)c=d.shift();else{c=f?"":new B(a);for(var i=0,j=0,k=d.length;k>j&&a>i;j++){var h=d[0],l=Math.min(a-i,h.length);f?c+=h.slice(0,l):h.copy(c,i,0,l),l<h.length?d[0]=h.slice(l):d.shift(),i+=l}}return c}function v(a){var b=a._readableState;if(b.length>0)throw new Error("endReadable called on non-empty stream");b.endEmitted||(b.ended=!0,z(w,b,a))}function w(a,b){a.endEmitted||0!==a.length||(a.endEmitted=!0,b.readable=!1,b.emit("end"))}function x(a,b){for(var c=0,d=a.length;d>c;c++)b(a[c],c)}function y(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1}b.exports=e;var z=a("process-nextick-args"),A=a("isarray"),B=a("buffer").Buffer;e.ReadableState=d;var C=a("events").EventEmitter;C.listenerCount||(C.listenerCount=function(a,b){return a.listeners(b).length});var D;!function(){try{D=a("stream")}catch(b){}finally{D||(D=a("events").EventEmitter)}}();var B=a("buffer").Buffer,E=a("core-util-is");E.inherits=a("inherits");var F=a("util");F=F&&F.debuglog?F.debuglog("stream"):function(){};var G;E.inherits(e,D),e.prototype.push=function(a,b){var c=this._readableState;return c.objectMode||"string"!=typeof a||(b=b||c.defaultEncoding,b!==c.encoding&&(a=new B(a,b),b="")),f(this,c,a,b,!1)},e.prototype.unshift=function(a){var b=this._readableState;return f(this,b,a,"",!0)},e.prototype.isPaused=function(){return this._readableState.flowing===!1},e.prototype.setEncoding=function(b){return G||(G=a("string_decoder/").StringDecoder),this._readableState.decoder=new G(b),this._readableState.encoding=b,this};var H=8388608;e.prototype.read=function(a){F("read",a);var b=this._readableState,c=a;if(("number"!=typeof a||a>0)&&(b.emittedReadable=!1),0===a&&b.needReadable&&(b.length>=b.highWaterMark||b.ended))return F("read: emitReadable",b.length,b.ended),0===b.length&&b.ended?v(this):l(this),null;if(a=i(a,b),0===a&&b.ended)return 0===b.length&&v(this),null;var d=b.needReadable;F("need readable",d),(0===b.length||b.length-a<b.highWaterMark)&&(d=!0,F("length less than watermark",d)),(b.ended||b.reading)&&(d=!1,F("reading or ended",d)),d&&(F("do read"),b.reading=!0,b.sync=!0,0===b.length&&(b.needReadable=!0),this._read(b.highWaterMark),b.sync=!1),d&&!b.reading&&(a=i(c,b));var e;return e=a>0?u(a,b):null,null===e&&(b.needReadable=!0,a=0),b.length-=a,0!==b.length||b.ended||(b.needReadable=!0),c!==a&&b.ended&&0===b.length&&v(this),null!==e&&this.emit("data",e),e},e.prototype._read=function(a){this.emit("error",new Error("not implemented"))},e.prototype.pipe=function(a,b){function d(a){F("onunpipe"),a===l&&f()}function e(){F("onend"),a.end()}function f(){F("cleanup"),a.removeListener("close",i),a.removeListener("finish",j),a.removeListener("drain",q),a.removeListener("error",h),a.removeListener("unpipe",d),l.removeListener("end",e),l.removeListener("end",f),l.removeListener("data",g),!m.awaitDrain||a._writableState&&!a._writableState.needDrain||q()}function g(b){F("ondata");var c=a.write(b);!1===c&&(F("false write response, pause",l._readableState.awaitDrain),l._readableState.awaitDrain++,l.pause())}function h(b){F("onerror",b),k(),a.removeListener("error",h),0===C.listenerCount(a,"error")&&a.emit("error",b)}function i(){a.removeListener("finish",j),k()}function j(){F("onfinish"),a.removeListener("close",i),k()}function k(){F("unpipe"),l.unpipe(a)}var l=this,m=this._readableState;switch(m.pipesCount){case 0:m.pipes=a;break;case 1:m.pipes=[m.pipes,a];break;default:m.pipes.push(a)}m.pipesCount+=1,F("pipe count=%d opts=%j",m.pipesCount,b);var n=(!b||b.end!==!1)&&a!==c.stdout&&a!==c.stderr,o=n?e:f;m.endEmitted?z(o):l.once("end",o),a.on("unpipe",d);var q=p(l);return a.on("drain",q),l.on("data",g),a._events&&a._events.error?A(a._events.error)?a._events.error.unshift(h):a._events.error=[h,a._events.error]:a.on("error",h),a.once("close",i),a.once("finish",j),a.emit("pipe",l),m.flowing||(F("pipe resume"),l.resume()),a},e.prototype.unpipe=function(a){var b=this._readableState;if(0===b.pipesCount)return this;if(1===b.pipesCount)return a&&a!==b.pipes?this:(a||(a=b.pipes),b.pipes=null,b.pipesCount=0,b.flowing=!1,a&&a.emit("unpipe",this),this);if(!a){var c=b.pipes,d=b.pipesCount;b.pipes=null,b.pipesCount=0,b.flowing=!1;for(var e=0;d>e;e++)c[e].emit("unpipe",this);return this}var e=y(b.pipes,a);return-1===e?this:(b.pipes.splice(e,1),b.pipesCount-=1,1===b.pipesCount&&(b.pipes=b.pipes[0]),a.emit("unpipe",this),this)},e.prototype.on=function(a,b){var c=D.prototype.on.call(this,a,b);if("data"===a&&!1!==this._readableState.flowing&&this.resume(),"readable"===a&&this.readable){var d=this._readableState;d.readableListening||(d.readableListening=!0,d.emittedReadable=!1,d.needReadable=!0,d.reading?d.length&&l(this,d):z(q,this))}return c},e.prototype.addListener=e.prototype.on,e.prototype.resume=function(){var a=this._readableState;return a.flowing||(F("resume"),a.flowing=!0,r(this,a)),this},e.prototype.pause=function(){return F("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(F("pause"),this._readableState.flowing=!1,this.emit("pause")),this},e.prototype.wrap=function(a){var b=this._readableState,c=!1,d=this;a.on("end",function(){if(F("wrapped end"),b.decoder&&!b.ended){var a=b.decoder.end();a&&a.length&&d.push(a)}d.push(null)}),a.on("data",function(e){if(F("wrapped data"),b.decoder&&(e=b.decoder.write(e)),(!b.objectMode||null!==e&&void 0!==e)&&(b.objectMode||e&&e.length)){var f=d.push(e);f||(c=!0,a.pause())}});for(var e in a)void 0===this[e]&&"function"==typeof a[e]&&(this[e]=function(b){return function(){return a[b].apply(a,arguments)}}(e));var f=["error","close","destroy","pause","resume"];return x(f,function(b){a.on(b,d.emit.bind(d,b))}),d._read=function(b){F("wrapped _read",b),c&&(c=!1,a.resume())},d},e._fromList=u}).call(this,a("_process"))},{"./_stream_duplex":56,_process:54,buffer:45,"core-util-is":61,events:49,inherits:50,isarray:52,"process-nextick-args":62,"string_decoder/":69,util:31}],59:[function(a,b,c){"use strict";function d(a){this.afterTransform=function(b,c){return e(a,b,c)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function e(a,b,c){var d=a._transformState;d.transforming=!1;var e=d.writecb;if(!e)return a.emit("error",new Error("no writecb in Transform class"));d.writechunk=null,d.writecb=null,null!==c&&void 0!==c&&a.push(c),e&&e(b);var f=a._readableState;f.reading=!1,(f.needReadable||f.length<f.highWaterMark)&&a._read(f.highWaterMark)}function f(a){if(!(this instanceof f))return new f(a);h.call(this,a),this._transformState=new d(this);var b=this;this._readableState.needReadable=!0,this._readableState.sync=!1,a&&("function"==typeof a.transform&&(this._transform=a.transform),"function"==typeof a.flush&&(this._flush=a.flush)),this.once("prefinish",function(){"function"==typeof this._flush?this._flush(function(a){g(b,a)}):g(b)})}function g(a,b){if(b)return a.emit("error",b);var c=a._writableState,d=a._transformState;if(c.length)throw new Error("calling transform done when ws.length != 0");if(d.transforming)throw new Error("calling transform done when still transforming");return a.push(null)}b.exports=f;var h=a("./_stream_duplex"),i=a("core-util-is");i.inherits=a("inherits"),i.inherits(f,h),f.prototype.push=function(a,b){return this._transformState.needTransform=!1,h.prototype.push.call(this,a,b)},f.prototype._transform=function(a,b,c){throw new Error("not implemented")},f.prototype._write=function(a,b,c){var d=this._transformState;if(d.writecb=c,d.writechunk=a,d.writeencoding=b,!d.transforming){var e=this._readableState;(d.needTransform||e.needReadable||e.length<e.highWaterMark)&&this._read(e.highWaterMark)}},f.prototype._read=function(a){var b=this._transformState;null!==b.writechunk&&b.writecb&&!b.transforming?(b.transforming=!0,this._transform(b.writechunk,b.writeencoding,b.afterTransform)):b.needTransform=!0}},{"./_stream_duplex":56,"core-util-is":61,inherits:50}],60:[function(a,b,c){"use strict";function d(){}function e(a,b,c){this.chunk=a,this.encoding=b,this.callback=c,this.next=null}function f(b,c){var d=a("./_stream_duplex");b=b||{},this.objectMode=!!b.objectMode,c instanceof d&&(this.objectMode=this.objectMode||!!b.writableObjectMode);var e=b.highWaterMark,f=this.objectMode?16:16384;this.highWaterMark=e||0===e?e:f,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var g=b.decodeStrings===!1;this.decodeStrings=!g,this.defaultEncoding=b.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(a){o(c,a)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1}function g(b){var c=a("./_stream_duplex");return this instanceof g||this instanceof c?(this._writableState=new f(b,this),this.writable=!0,b&&("function"==typeof b.write&&(this._write=b.write),"function"==typeof b.writev&&(this._writev=b.writev)),void z.call(this)):new g(b)}function h(a,b){var c=new Error("write after end");a.emit("error",c),w(b,c)}function i(a,b,c,d){var e=!0;if(!x.isBuffer(c)&&"string"!=typeof c&&null!==c&&void 0!==c&&!b.objectMode){var f=new TypeError("Invalid non-string/buffer chunk");a.emit("error",f),w(d,f),e=!1}return e}function j(a,b,c){return a.objectMode||a.decodeStrings===!1||"string"!=typeof b||(b=new x(b,c)),b}function k(a,b,c,d,f){c=j(b,c,d),x.isBuffer(c)&&(d="buffer");var g=b.objectMode?1:c.length;b.length+=g;var h=b.length<b.highWaterMark;if(h||(b.needDrain=!0),b.writing||b.corked){var i=b.lastBufferedRequest;b.lastBufferedRequest=new e(c,d,f),i?i.next=b.lastBufferedRequest:b.bufferedRequest=b.lastBufferedRequest}else l(a,b,!1,g,c,d,f);return h}function l(a,b,c,d,e,f,g){b.writelen=d,b.writecb=g,b.writing=!0,b.sync=!0,c?a._writev(e,b.onwrite):a._write(e,f,b.onwrite),b.sync=!1}function m(a,b,c,d,e){--b.pendingcb,c?w(e,d):e(d),a._writableState.errorEmitted=!0,a.emit("error",d)}function n(a){a.writing=!1,a.writecb=null,a.length-=a.writelen,a.writelen=0}function o(a,b){var c=a._writableState,d=c.sync,e=c.writecb;if(n(c),b)m(a,c,d,b,e);else{var f=s(c);f||c.corked||c.bufferProcessing||!c.bufferedRequest||r(a,c),d?w(p,a,c,f,e):p(a,c,f,e)}}function p(a,b,c,d){c||q(a,b),b.pendingcb--,d(),u(a,b)}function q(a,b){0===b.length&&b.needDrain&&(b.needDrain=!1,a.emit("drain"))}function r(a,b){b.bufferProcessing=!0;var c=b.bufferedRequest;if(a._writev&&c&&c.next){for(var d=[],e=[];c;)e.push(c.callback),d.push(c),c=c.next;b.pendingcb++,b.lastBufferedRequest=null,l(a,b,!0,b.length,d,"",function(a){for(var c=0;c<e.length;c++)b.pendingcb--,e[c](a)})}else{for(;c;){var f=c.chunk,g=c.encoding,h=c.callback,i=b.objectMode?1:f.length;if(l(a,b,!1,i,f,g,h),c=c.next,b.writing)break}null===c&&(b.lastBufferedRequest=null)}b.bufferedRequest=c,b.bufferProcessing=!1}function s(a){return a.ending&&0===a.length&&null===a.bufferedRequest&&!a.finished&&!a.writing}function t(a,b){b.prefinished||(b.prefinished=!0,a.emit("prefinish"))}function u(a,b){var c=s(b);return c&&(0===b.pendingcb?(t(a,b),b.finished=!0,a.emit("finish")):t(a,b)),c}function v(a,b,c){b.ending=!0,u(a,b),c&&(b.finished?w(c):a.once("finish",c)),b.ended=!0}b.exports=g;var w=a("process-nextick-args"),x=a("buffer").Buffer;g.WritableState=f;var y=a("core-util-is");y.inherits=a("inherits");var z;!function(){try{z=a("stream")}catch(b){}finally{z||(z=a("events").EventEmitter)}}();var x=a("buffer").Buffer;y.inherits(g,z),f.prototype.getBuffer=function(){for(var a=this.bufferedRequest,b=[];a;)b.push(a),a=a.next;return b},function(){try{Object.defineProperty(f.prototype,"buffer",{get:a("util-deprecate")(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer() instead.")})}catch(b){}}(),g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},g.prototype.write=function(a,b,c){var e=this._writableState,f=!1;return"function"==typeof b&&(c=b,b=null),x.isBuffer(a)?b="buffer":b||(b=e.defaultEncoding),"function"!=typeof c&&(c=d),e.ended?h(this,c):i(this,e,a,c)&&(e.pendingcb++,f=k(this,e,a,b,c)),f},g.prototype.cork=function(){var a=this._writableState;a.corked++},g.prototype.uncork=function(){var a=this._writableState;a.corked&&(a.corked--,a.writing||a.corked||a.finished||a.bufferProcessing||!a.bufferedRequest||r(this,a))},g.prototype.setDefaultEncoding=function(a){if("string"==typeof a&&(a=a.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((a+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+a);this._writableState.defaultEncoding=a},g.prototype._write=function(a,b,c){c(new Error("not implemented"))},g.prototype._writev=null,g.prototype.end=function(a,b,c){var d=this._writableState;"function"==typeof a?(c=a,a=null,b=null):"function"==typeof b&&(c=b,b=null),null!==a&&void 0!==a&&this.write(a,b),d.corked&&(d.corked=1,this.uncork()),d.ending||d.finished||v(this,d,c)}},{"./_stream_duplex":56,buffer:45,"core-util-is":61,events:49,inherits:50,"process-nextick-args":62,"util-deprecate":63}],61:[function(a,b,c){(function(a){function b(a){return Array.isArray(a)}function d(a){return"boolean"==typeof a}function e(a){return null===a}function f(a){return null==a}function g(a){return"number"==typeof a}function h(a){return"string"==typeof a}function i(a){return"symbol"==typeof a}function j(a){return void 0===a}function k(a){return l(a)&&"[object RegExp]"===r(a)}function l(a){return"object"==typeof a&&null!==a}function m(a){return l(a)&&"[object Date]"===r(a)}function n(a){return l(a)&&("[object Error]"===r(a)||a instanceof Error)}function o(a){return"function"==typeof a}function p(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function q(b){return a.isBuffer(b)}function r(a){return Object.prototype.toString.call(a)}c.isArray=b,c.isBoolean=d,c.isNull=e,c.isNullOrUndefined=f,c.isNumber=g,c.isString=h,c.isSymbol=i,c.isUndefined=j,c.isRegExp=k,c.isObject=l,c.isDate=m,c.isError=n,c.isFunction=o,c.isPrimitive=p,c.isBuffer=q}).call(this,{isBuffer:a("C:\\Users\\amish\\Documents\\Programming\\discord.js\\node_modules\\grunt-browserify\\node_modules\\browserify\\node_modules\\insert-module-globals\\node_modules\\is-buffer\\index.js")})},{"C:\\Users\\amish\\Documents\\Programming\\discord.js\\node_modules\\grunt-browserify\\node_modules\\browserify\\node_modules\\insert-module-globals\\node_modules\\is-buffer\\index.js":51}],62:[function(a,b,c){(function(a){"use strict";function c(b){for(var c=new Array(arguments.length-1),d=0;d<c.length;)c[d++]=arguments[d];a.nextTick(function(){b.apply(null,c)})}b.exports=c}).call(this,a("_process"))},{_process:54}],63:[function(a,b,c){(function(a){function c(a,b){function c(){if(!e){if(d("throwDeprecation"))throw new Error(b);d("traceDeprecation")?console.trace(b):console.warn(b),e=!0}return a.apply(this,arguments)}if(d("noDeprecation"))return a;var e=!1;return c}function d(b){if(!a.localStorage)return!1;var c=a.localStorage[b];return null==c?!1:"true"===String(c).toLowerCase()}b.exports=c}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],64:[function(a,b,c){b.exports=a("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":57}],65:[function(a,b,c){var d=function(){try{return a("stream")}catch(b){}}();c=b.exports=a("./lib/_stream_readable.js"),c.Stream=d||c,c.Readable=c,c.Writable=a("./lib/_stream_writable.js"),c.Duplex=a("./lib/_stream_duplex.js"),c.Transform=a("./lib/_stream_transform.js"),c.PassThrough=a("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":56,"./lib/_stream_passthrough.js":57,"./lib/_stream_readable.js":58,"./lib/_stream_transform.js":59,"./lib/_stream_writable.js":60}],66:[function(a,b,c){b.exports=a("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":59}],67:[function(a,b,c){b.exports=a("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":60}],68:[function(a,b,c){function d(){e.call(this)}b.exports=d;var e=a("events").EventEmitter,f=a("inherits");f(d,e),d.Readable=a("readable-stream/readable.js"),d.Writable=a("readable-stream/writable.js"),d.Duplex=a("readable-stream/duplex.js"),d.Transform=a("readable-stream/transform.js"),d.PassThrough=a("readable-stream/passthrough.js"),d.Stream=d,d.prototype.pipe=function(a,b){function c(b){a.writable&&!1===a.write(b)&&j.pause&&j.pause()}function d(){j.readable&&j.resume&&j.resume()}function f(){k||(k=!0,a.end())}function g(){k||(k=!0,"function"==typeof a.destroy&&a.destroy())}function h(a){if(i(),0===e.listenerCount(this,"error"))throw a}function i(){j.removeListener("data",c),a.removeListener("drain",d),j.removeListener("end",f),j.removeListener("close",g),j.removeListener("error",h),a.removeListener("error",h),j.removeListener("end",i),j.removeListener("close",i),a.removeListener("close",i)}var j=this;j.on("data",c),a.on("drain",d),a._isStdio||b&&b.end===!1||(j.on("end",f),j.on("close",g));var k=!1;return j.on("error",h),a.on("error",h),j.on("end",i),j.on("close",i),a.on("close",i),a.emit("pipe",j),a}},{events:49,inherits:50,"readable-stream/duplex.js":55,"readable-stream/passthrough.js":64,"readable-stream/readable.js":65,"readable-stream/transform.js":66,"readable-stream/writable.js":67}],69:[function(a,b,c){function d(a){if(a&&!i(a))throw new Error("Unknown encoding: "+a)}function e(a){return a.toString(this.encoding)}function f(a){this.charReceived=a.length%2,this.charLength=this.charReceived?2:0}function g(a){this.charReceived=a.length%3,this.charLength=this.charReceived?3:0}var h=a("buffer").Buffer,i=h.isEncoding||function(a){switch(a&&a.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},j=c.StringDecoder=function(a){switch(this.encoding=(a||"utf8").toLowerCase().replace(/[-_]/,""),d(a),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=f;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=g;break;default:return void(this.write=e)}this.charBuffer=new h(6),this.charReceived=0,this.charLength=0};j.prototype.write=function(a){for(var b="";this.charLength;){var c=a.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:a.length;if(a.copy(this.charBuffer,this.charReceived,0,c),this.charReceived+=c,this.charReceived<this.charLength)return"";a=a.slice(c,a.length),b=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var d=b.charCodeAt(b.length-1);if(!(d>=55296&&56319>=d)){if(this.charReceived=this.charLength=0,0===a.length)return b;break}this.charLength+=this.surrogateSize,b=""}this.detectIncompleteChar(a);var e=a.length;this.charLength&&(a.copy(this.charBuffer,0,a.length-this.charReceived,e),e-=this.charReceived),b+=a.toString(this.encoding,0,e);var e=b.length-1,d=b.charCodeAt(e);if(d>=55296&&56319>=d){var f=this.surrogateSize;return this.charLength+=f,this.charReceived+=f,this.charBuffer.copy(this.charBuffer,f,0,f),a.copy(this.charBuffer,0,0,f),b.substring(0,e)}return b},j.prototype.detectIncompleteChar=function(a){for(var b=a.length>=3?3:a.length;b>0;b--){var c=a[a.length-b];if(1==b&&c>>5==6){this.charLength=2;break}if(2>=b&&c>>4==14){this.charLength=3;break}if(3>=b&&c>>3==30){this.charLength=4;break}}this.charReceived=b},j.prototype.end=function(a){var b="";if(a&&a.length&&(b=this.write(a)),this.charReceived){var c=this.charReceived,d=this.charBuffer,e=this.encoding;b+=d.slice(0,c).toString(e)}return b}},{buffer:45}],70:[function(a,b,c){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8}},{}],71:[function(a,b,c){(function(b,d){function e(a,b){var d={seen:[],stylize:g};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),p(b)?d.showHidden=b:b&&c._extend(d,b),v(d.showHidden)&&(d.showHidden=!1),v(d.depth)&&(d.depth=2),v(d.colors)&&(d.colors=!1),v(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=f),i(d,a,d.depth)}function f(a,b){var c=e.styles[b];return c?"["+e.colors[c][0]+"m"+a+"["+e.colors[c][1]+"m":a}function g(a,b){return a}function h(a){var b={};return a.forEach(function(a,c){b[a]=!0}),b}function i(a,b,d){if(a.customInspect&&b&&A(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return t(e)||(e=i(a,e,d)),e}var f=j(a,b);if(f)return f;var g=Object.keys(b),p=h(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),z(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return k(b);if(0===g.length){if(A(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(w(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(y(b))return a.stylize(Date.prototype.toString.call(b),"date");if(z(b))return k(b)}var r="",s=!1,u=["{","}"];if(o(b)&&(s=!0,u=["[","]"]),A(b)){var v=b.name?": "+b.name:"";r=" [Function"+v+"]"}if(w(b)&&(r=" "+RegExp.prototype.toString.call(b)),y(b)&&(r=" "+Date.prototype.toUTCString.call(b)),z(b)&&(r=" "+k(b)),0===g.length&&(!s||0==b.length))return u[0]+r+u[1];if(0>d)return w(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var x;return x=s?l(a,b,d,p,g):g.map(function(c){return m(a,b,d,p,c,s)}),a.seen.pop(),n(x,r,u)}function j(a,b){if(v(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return s(b)?a.stylize(""+b,"number"):p(b)?a.stylize(""+b,"boolean"):q(b)?a.stylize("null","null"):void 0}function k(a){return"["+Error.prototype.toString.call(a)+"]"}function l(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)F(b,String(g))?f.push(m(a,b,c,d,String(g),!0)):f.push("");return e.forEach(function(e){e.match(/^\d+$/)||f.push(m(a,b,c,d,e,!0))}),f}function m(a,b,c,d,e,f){var g,h,j;if(j=Object.getOwnPropertyDescriptor(b,e)||{value:b[e]},j.get?h=j.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):j.set&&(h=a.stylize("[Setter]","special")),F(d,e)||(g="["+e+"]"),h||(a.seen.indexOf(j.value)<0?(h=q(c)?i(a,j.value,null):i(a,j.value,c-1),h.indexOf("\n")>-1&&(h=f?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),v(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function n(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function o(a){return Array.isArray(a)}function p(a){return"boolean"==typeof a}function q(a){return null===a}function r(a){return null==a}function s(a){return"number"==typeof a}function t(a){return"string"==typeof a}function u(a){return"symbol"==typeof a}function v(a){return void 0===a}function w(a){return x(a)&&"[object RegExp]"===C(a)}function x(a){return"object"==typeof a&&null!==a}function y(a){return x(a)&&"[object Date]"===C(a)}function z(a){return x(a)&&("[object Error]"===C(a)||a instanceof Error)}function A(a){return"function"==typeof a}function B(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function C(a){return Object.prototype.toString.call(a)}function D(a){return 10>a?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),J[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=/%[sdj%]/g;c.format=function(a){if(!t(a)){for(var b=[],c=0;c<arguments.length;c++)b.push(e(arguments[c]));return b.join(" ")}for(var c=1,d=arguments,f=d.length,g=String(a).replace(G,function(a){if("%%"===a)return"%";if(c>=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(b){return"[Circular]"}default:return a}}),h=d[c];f>c;h=d[++c])g+=q(h)||!x(h)?" "+h:" "+e(h);return g},c.deprecate=function(a,e){function f(){if(!g){if(b.throwDeprecation)throw new Error(e);b.traceDeprecation?console.trace(e):console.error(e),g=!0}return a.apply(this,arguments)}if(v(d.process))return function(){return c.deprecate(a,e).apply(this,arguments)};if(b.noDeprecation===!0)return a;var g=!1;return f};var H,I={};c.debuglog=function(a){if(v(H)&&(H=b.env.NODE_DEBUG||""),a=a.toUpperCase(),!I[a])if(new RegExp("\\b"+a+"\\b","i").test(H)){var d=b.pid;I[a]=function(){var b=c.format.apply(c,arguments);console.error("%s %d: %s",a,d,b)}}else I[a]=function(){};return I[a]},c.inspect=e,e.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},e.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},c.isArray=o,c.isBoolean=p,c.isNull=q,c.isNullOrUndefined=r,c.isNumber=s,c.isString=t,c.isSymbol=u,c.isUndefined=v,c.isRegExp=w,c.isObject=x,c.isDate=y,c.isError=z,c.isFunction=A,c.isPrimitive=B,c.isBuffer=a("./support/isBuffer");var J=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c.log=function(){console.log("%s - %s",E(),c.format.apply(c,arguments))},c.inherits=a("inherits"),c._extend=function(a,b){if(!b||!x(b))return a;for(var c=Object.keys(b),d=c.length;d--;)a[c[d]]=b[c[d]];return a}}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":70,_process:54,inherits:50}],72:[function(a,b,c){function d(a){if(a=""+a,!(a.length>1e4)){var b=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(a);if(b){var c=parseFloat(b[1]),d=(b[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return c*l;case"days":case"day":case"d":return c*k;case"hours":case"hour":case"hrs":case"hr":case"h":return c*j;case"minutes":case"minute":case"mins":case"min":case"m":return c*i;case"seconds":case"second":case"secs":case"sec":case"s":return c*h;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c}}}}function e(a){return a>=k?Math.round(a/k)+"d":a>=j?Math.round(a/j)+"h":a>=i?Math.round(a/i)+"m":a>=h?Math.round(a/h)+"s":a+"ms"}function f(a){return g(a,k,"day")||g(a,j,"hour")||g(a,i,"minute")||g(a,h,"second")||a+" ms"}function g(a,b,c){return b>a?void 0:1.5*b>a?Math.floor(a/b)+" "+c:Math.ceil(a/b)+" "+c+"s"}var h=1e3,i=60*h,j=60*i,k=24*j,l=365.25*k;b.exports=function(a,b){return b=b||{},"string"==typeof a?d(a):b["long"]?f(a):e(a)}},{}],73:[function(a,b,c){"use strict";var d=a("./lib/OpusEncoder"),e=a("./lib/Encoder"),f=a("./lib/Decoder");c.OpusEncoder=d,c.Encoder=e,c.Decoder=f},{"./lib/Decoder":74,"./lib/Encoder":75,"./lib/OpusEncoder":76}],74:[function(a,b,c){var d=a("util"),e=a("stream").Transform,f=(a("ogg-packet"),a("./OpusEncoder")),g=function(a,b,c){e.call(this,{readableObjectMode:!0}),this.rate=a||48e3,this.channels=b||1,this.frameSize=c||.04*this.rate,this.encoder=null,this.header={},this.tags=null,this.pos=0,this.samplesWritten=0,this.packetBuffer=[]};d.inherits(g,e),g.prototype._transform=function(a,b,c){this.encoder?this.tags?this._processInput(a):this.tags={}:this._parseHeader(a),c()},g.prototype._parseHeader=function(a){var b=a.packet,c=b.slice(0,8);return"OpusHead"!==c.toString("ascii")?this.emit("error","Bad header"):(this.header.version=b.readUInt8(8),this.header.channels=b.readUInt8(9),this.header.preSkip=b.readUInt16LE(10),this.header.rate=b.readUInt32LE(12),this.header.gain=b.readUInt16LE(16),this.header.channelMap=b.readUInt8(18),this.emit("format",{channels:this.header.channels,sampleRate:this.header.rate,bitDepth:16,"float":!1,signed:!0,gain:this.header.gain,preSkip:this.header.preSkip,version:this.header.version}),void(this.encoder=new f(this.header.rate,this.header.channels)))},g.prototype._processInput=function(a){var b=a.packet,c=this.encoder.decode(b);this.push(c)},b.exports=g},{"./OpusEncoder":76,"ogg-packet":77,stream:68,util:71}],75:[function(a,b,c){(function(c){var d=a("util"),e=a("stream").Transform,f=a("ogg-packet"),g=a("./OpusEncoder"),h=function(a,b,d){e.call(this,{readableObjectMode:!0}),this.rate=a||48e3,this.channels=b||1,this.frameSize=d||.04*this.rate,this.encoder=new g(this.rate,this.channels),this.frameOverflow=new c(0),this.headerWritten=!1,this.pos=0,this.samplesWritten=0};d.inherits(h,e),h.prototype._transform=function(a,b,c){this.headerWritten||this._writeHeader(),this._processOutput(a),c()},h.prototype._writeHeader=function(){var a=new c("OpusHead","ascii"),b=new c([1,this.channels,0,0,(255&this.rate)>>0,(65280&this.rate)>>8,(16711680&this.rate)>>16,(4278190080&this.rate)>>24,0,0,0]),d=c.concat([a,b]),e=new f;e.packet=d,e.bytes=d.length,e.b_o_s=1,e.e_o_s=0,e.granulepos=0,e.packetno=this.pos++,
|
||
this.push(e),a=new c("OpusTags","ascii");var g=new c("node-opus","ascii"),h=new c(4);h.writeUInt32LE(g.length,0);var i=new c(4);i.writeUInt32LE(0,0),d=new c.concat([a,h,g,i,new c([255])]),e=new f,e.packet=d,e.bytes=d.length,e.b_o_s=0,e.e_o_s=0,e.granulepos=0,e.packetno=this.pos++,e.flush=!0,this.push(e),this.headerWritten=!0},h.prototype._processOutput=function(a){for(var b=a.length+this.frameOverflow.length,d=2*this.frameSize*this.channels;b>=d;){var e;this.frameOverflow?(e=c.concat([this.frameOverflow,a.slice(0,d-this.frameOverflow.length)]),a=a.slice(d-this.frameOverflow.length),this.frameOverflow=null):(e=a.slice(0,d),a=a.slice(d)),this._flushFrame(e),b-=d}this.frameOverflow=a},h.prototype._flushFrame=function(a,b){var c=this.encoder.encode(a),d=new f;d.packet=c,d.bytes=c.length,d.b_o_s=0,d.e_o_s=0,d.granulepos=this.samplesWritten,d.packetno=this.pos++,d.flush=!0,this.samplesWritten+=this.frameSize,this.push(d)},h.prototype._flush=function(a){var b=new f;b.packet=new c(0),b.bytes=0,b.b_o_s=0,b.e_o_s=1,b.granulepos=this.pos,b.packetno=this.pos++,b.flush=!0,this.push(b),a()},b.exports=h}).call(this,a("buffer").Buffer)},{"./OpusEncoder":76,buffer:45,"ogg-packet":77,stream:68,util:71}],76:[function(a,b,c){"use strict";var d=a("bindings")("node-opus");b.exports=d.OpusEncoder},{bindings:26}],77:[function(a,b,c){var d=a("ref-struct");b.exports=d({packet:"uchar *",bytes:"long",b_o_s:"long",e_o_s:"long",granulepos:"int64",packetno:"int64"})},{"ref-struct":78}],78:[function(a,b,c){(function(c){function d(){function a(b,d){if(!(this instanceof a))return new a(b,d);m("creating new struct instance");var e;if(c.isBuffer(b)?(m("using passed-in Buffer instance to back the struct",b),l(b.length>=a.size,"Buffer instance must be at least "+a.size+" bytes to back this struct type"),e=b,b=d):(m("creating new Buffer instance to back the struct (size: %d)",a.size),e=new c(a.size)),e.type=a,this["ref.buffer"]=e,b)for(var f in b)this[f]=b[f];a._instanceCreated=!0}m('defining new struct "type"'),a.prototype=Object.create(n,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),a.defineProperty=h,a.toString=g,a.fields={},a.size=0,a.alignment=0,a.indirection=1,a.get=e,a.set=f;var b=arguments[0];return Array.isArray(b)?b.forEach(function(b){var c=b[0],d=b[1];a.defineProperty(d,c)}):"object"==typeof b&&Object.keys(b).forEach(function(c){var d=b[c];a.defineProperty(c,d)}),a}function e(a,b){return m('Struct "type" getter for buffer at offset',a,b),b>0&&(a=a.slice(b)),new this(a)}function f(a,b,c){m('Struct "type" setter for buffer at offset',a,b,c);var d=c instanceof this;d?c["ref.buffer"].copy(a,b,0,this.size):(b>0&&(a=a.slice(b)),new this(a,c))}function g(){return"[StructType]"}function h(a,b){m("defining new struct type field",a),b=j.coerceType(b),l(!this._instanceCreated,'an instance of this Struct type has already been created, cannot add new "fields" anymore'),l.equal("string",typeof a,'expected a "string" field name'),l(b&&/object|function/i.test(typeof b)&&"size"in b&&"indirection"in b,'expected a "type" object describing the field type: "'+b+'"'),l(b.indirection>1||b.size>0,'"type" object must have a size greater than 0'),l(!(a in this.prototype),'the field "'+a+'" already exists in this Struct type');var c={type:b};this.fields[a]=c;var d={enumerable:!0,configurable:!0};d.get=function(){return m('getting "%s" struct field (offset: %d)',a,c.offset),j.get(this["ref.buffer"],c.offset,b)},d.set=function(d){return m('setting "%s" struct field (offset: %d)',a,c.offset,d),j.set(this["ref.buffer"],c.offset,d,b)},i(this),Object.defineProperty(this.prototype,a,d)}function i(a){function b(b){var c=a.size,d=1===b.indirection?b.alignment:j.alignof.pointer,e=(d-c%d)%d,f=1===b.indirection?b.size:j.sizeof.pointer;return c+=e,l.equal(c%d,0,"offset should align"),a.size=c+f,c}a.size=0,a.alignment=0;var c=Object.keys(a.fields);c.forEach(function(b){var c=a.fields[b],d=c.type,e=d.alignment||j.alignof.pointer;d.indirection>1&&(e=j.alignof.pointer),a.alignment=Math.max(a.alignment,e)}),c.forEach(function(c){var d=a.fields[c],e=d.type;if(null!=e.fixedLength){d.offset=b(e.type);for(var f=1;f<e.fixedLength;f++)b(e.type)}else d.offset=b(e)});var d=a.size%a.alignment;d>0&&(m("additional padding to the end of struct:",a.alignment-d),a.size+=a.alignment-d)}var j=a("ref"),k=a("util"),l=a("assert"),m=a("debug")("ref:struct");b.exports=d;var n={};n["ref.buffer"]=j.NULL,n.toObject=function(){var a={};return Object.keys(this.constructor.fields).forEach(function(b){a[b]=this[b]},this),a},n.toJSON=function(){return this.toObject()},n.inspect=function(){var a=this.toObject();return Object.keys(this).forEach(function(b){a[b]=this[b]},this),k.inspect(a)},n.ref=function(){return this["ref.buffer"]}}).call(this,a("buffer").Buffer)},{assert:30,buffer:45,debug:27,ref:79,util:71}],79:[function(a,b,c){(function(d){function e(a){return"refinspect"===a.name?a:function(){var b=a.apply(this,arguments);return b.replace("Buffer","Buffer@0x"+this.hexAddress())}}var f=a("assert"),g=a("debug")("ref");c=b.exports=a("bindings")("binding"),c.refType=function(a){var b=c.coerceType(a),d=Object.create(b);return d.indirection++,b.name&&(d.name=b.name+"*"),d},c.derefType=function(a){var b=c.coerceType(a);if(1===b.indirection)throw new Error("Cannot create deref'd type for type with indirection 1");var d=Object.getPrototypeOf(b);return d.indirection!==b.indirection-1&&(d=Object.create(b),d.indirection--),d},c.coerceType=function(a){var b=a;if("string"==typeof b){if(b=c.types[a])return b;if(b=a.replace(/\s+/g,"").toLowerCase(),"pointer"===b)b=c.refType(c.types["void"]);else if("string"===b)b=c.types.CString;else{var d=0;if(b=b.replace(/\*/g,function(){return d++,""}),b=c.types[b],d>0){if(!(b&&"size"in b&&"indirection"in b))throw new TypeError('could not determine a proper "type" from: '+JSON.stringify(a));for(var e=0;d>e;e++)b=c.refType(b)}}}if(!(b&&"size"in b&&"indirection"in b))throw new TypeError('could not determine a proper "type" from: '+JSON.stringify(a));return b},c.getType=function(a){return a.type||(g('WARN: no "type" found on buffer, setting default "type"',a),a.type={},a.type.size=a.length,a.type.indirection=1,a.type.get=function(){throw new Error('unknown "type"; cannot get()')},a.type.set=function(){throw new Error('unknown "type"; cannot set()')}),c.coerceType(a.type)},c.get=function(a,b,d){if(b||(b=0),d=d?c.coerceType(d):c.getType(a),g("get(): (offset: %d)",b,a),f(d.indirection>0,'"indirection" level must be at least 1'),1===d.indirection)return d.get(a,b);var e=2===d.indirection?d.size:c.sizeof.pointer,h=c.readPointer(a,b,e);return h.type=c.derefType(d),h},c.set=function(a,b,d,e){b||(b=0),e=e?c.coerceType(e):c.getType(a),g("set(): (offset: %d)",b,a,d),f(e.indirection>=1,'"indirection" level must be at least 1'),1===e.indirection?e.set(a,b,d):c.writePointer(a,b,d)},c.alloc=function(a,b){var e=c.coerceType(a);g('allocating Buffer for type with "size"',e.size);var f;f=1===e.indirection?e.size:c.sizeof.pointer;var h=new d(f);return h.type=e,arguments.length>=2&&(g("setting value on allocated buffer",b),c.set(h,0,b,e)),h},c.allocCString=function(a,b){if(null==a||d.isBuffer(a)&&c.isNull(a))return c.NULL;var e=d.byteLength(a,b)+1,f=new d(e);return c.writeCString(f,0,a,b),f.type=m,f},c.writeCString=function(a,b,c,e){f(d.isBuffer(a),"expected a Buffer as the first argument"),f.equal("string",typeof c,'expected a "string" as the third argument'),b||(b=0),e||(e="utf8");var g=a.length-b,h=a.write(c,b,g,e);a.writeUInt8(0,b+h)},c["readInt64"+c.endianness]=c.readInt64,c["readUInt64"+c.endianness]=c.readUInt64,c["writeInt64"+c.endianness]=c.writeInt64,c["writeUInt64"+c.endianness]=c.writeUInt64;var h="LE"==c.endianness?"BE":"LE",i=new d(c.sizeof.int64),j=new d(c.sizeof.uint64);c["readInt64"+h]=function(a,b){for(var d=0;d<c.sizeof.int64;d++)i[d]=a[b+c.sizeof.int64-d-1];return c.readInt64(i,0)},c["readUInt64"+h]=function(a,b){for(var d=0;d<c.sizeof.uint64;d++)j[d]=a[b+c.sizeof.uint64-d-1];return c.readUInt64(j,0)},c["writeInt64"+h]=function(a,b,d){c.writeInt64(i,0,d);for(var e=0;e<c.sizeof.int64;e++)a[b+e]=i[c.sizeof.int64-e-1]},c["writeUInt64"+h]=function(a,b,d){c.writeUInt64(j,0,d);for(var e=0;e<c.sizeof.uint64;e++)a[b+e]=j[c.sizeof.uint64-e-1]},c.ref=function(a){g("creating a reference to buffer",a);var b=c.refType(c.getType(a));return c.alloc(b,a)},c.deref=function(a){return g("dereferencing buffer",a),c.get(a)},c._attach=function(a,b){a._refs||(a._refs=[]),a._refs.push(b)},c._writeObject=c.writeObject,c.writeObject=function(a,b,d,e){g("writing Object to buffer",a,b,d,e),c._writeObject(a,b,d,e),c._attach(a,d)},c._writePointer=c.writePointer,c.writePointer=function(a,b,d){g("writing pointer to buffer",a,b,d),c._writePointer(a,b,d),c._attach(a,d)},c._reinterpret=c.reinterpret,c.reinterpret=function(a,b,d){g('reinterpreting buffer to "%d" bytes',b);var e=c._reinterpret(a,b,d||0);return c._attach(e,a),e},c._reinterpretUntilZeros=c.reinterpretUntilZeros,c.reinterpretUntilZeros=function(a,b,d){g('reinterpreting buffer to until "%d" NULL (0) bytes are found',b);var e=c._reinterpretUntilZeros(a,b,d||0);return c._attach(e,a),e};var k=c.types={};k["void"]={size:0,indirection:1,get:function(a,b){return g("getting `void` type (returns `null`)"),null},set:function(a,b,c){g("setting `void` type (no-op)")}},k.int8={size:c.sizeof.int8,indirection:1,get:function(a,b){return a.readInt8(b||0)},set:function(a,b,c){return"string"==typeof c&&(c=c.charCodeAt(0)),a.writeInt8(c,b||0)}},k.uint8={size:c.sizeof.uint8,indirection:1,get:function(a,b){return a.readUInt8(b||0)},set:function(a,b,c){return"string"==typeof c&&(c=c.charCodeAt(0)),a.writeUInt8(c,b||0)}},k.int16={size:c.sizeof.int16,indirection:1,get:function(a,b){return a["readInt16"+c.endianness](b||0)},set:function(a,b,d){return a["writeInt16"+c.endianness](d,b||0)}},k.uint16={size:c.sizeof.uint16,indirection:1,get:function(a,b){return a["readUInt16"+c.endianness](b||0)},set:function(a,b,d){return a["writeUInt16"+c.endianness](d,b||0)}},k.int32={size:c.sizeof.int32,indirection:1,get:function(a,b){return a["readInt32"+c.endianness](b||0)},set:function(a,b,d){return a["writeInt32"+c.endianness](d,b||0)}},k.uint32={size:c.sizeof.uint32,indirection:1,get:function(a,b){return a["readUInt32"+c.endianness](b||0)},set:function(a,b,d){return a["writeUInt32"+c.endianness](d,b||0)}},k.int64={size:c.sizeof.int64,indirection:1,get:function(a,b){return a["readInt64"+c.endianness](b||0)},set:function(a,b,d){return a["writeInt64"+c.endianness](d,b||0)}},k.uint64={size:c.sizeof.uint64,indirection:1,get:function(a,b){return a["readUInt64"+c.endianness](b||0)},set:function(a,b,d){return a["writeUInt64"+c.endianness](d,b||0)}},k["float"]={size:c.sizeof["float"],indirection:1,get:function(a,b){return a["readFloat"+c.endianness](b||0)},set:function(a,b,d){return a["writeFloat"+c.endianness](d,b||0)}},k["double"]={size:c.sizeof["double"],indirection:1,get:function(a,b){return a["readDouble"+c.endianness](b||0)},set:function(a,b,d){return a["writeDouble"+c.endianness](d,b||0)}},k.Object={size:c.sizeof.Object,indirection:1,get:function(a,b){return a.readObject(b||0)},set:function(a,b,c){return a.writeObject(c,b||0)}},k.CString={size:c.sizeof.pointer,alignment:c.alignof.pointer,indirection:1,get:function(a,b){var d=c.readPointer(a,b);return c.isNull(d)?null:c.readCString(d,0)},set:function(a,b,e){var f;return f=d.isBuffer(e)?e:c.allocCString(e),c.writePointer(a,b,f)}};var l=!1;Object.defineProperty(k,"Utf8String",{enumerable:!1,configurable:!0,get:function(){return l||(l=!0,console.error('"Utf8String" type is deprecated, use "CString" instead')),k.CString}}),["bool","byte","char","uchar","short","ushort","int","uint","long","ulong","longlong","ulonglong","size_t"].forEach(function(a){var b="bool"===a||"byte"===a||"size_t"===a||"u"===a[0],d=c.sizeof[a];f(d>=1&&8>=d);var e="int"+8*d;b&&(e="u"+e);var g=c.types[e];f(g),c.types[a]=Object.create(g)}),Object.keys(c.alignof).forEach(function(a){"pointer"!==a&&(c.types[a].alignment=c.alignof[a],f(c.types[a].alignment>0))}),c.types.bool.get=function(a){return function(b,c){return a(b,c)?!0:!1}}(c.types.bool.get),c.types.bool.set=function(a){return function(b,c,d){return"number"!=typeof d&&(d=d?1:0),a(b,c,d)}}(c.types.bool.set),Object.keys(c.types).forEach(function(a){c.types[a].name=a});var m=c.refType(c.types["char"]);if(c.NULL.type=c.types["void"],c.NULL_POINTER=c.ref(c.NULL),d.prototype.address=function(){return c.address(this,0)},d.prototype.hexAddress=function(){return c.hexAddress(this,0)},d.prototype.isNull=function(){return c.isNull(this,0)},d.prototype.ref=function(){return c.ref(this)},d.prototype.deref=function(){return c.deref(this)},d.prototype.readObject=function(a){return c.readObject(this,a)},d.prototype.writeObject=function(a,b){return c.writeObject(this,b,a)},d.prototype.readPointer=function(a,b){return c.readPointer(this,a,b)},d.prototype.writePointer=function(a,b){return c.writePointer(this,b,a)},d.prototype.readCString=function(a){return c.readCString(this,a)},d.prototype.writeCString=function(a,b,d){return c.writeCString(this,b,a,d)},d.prototype.readInt64BE=function(a){return c.readInt64BE(this,a)},d.prototype.writeInt64BE=function(a,b){return c.writeInt64BE(this,b,a)},d.prototype.readUInt64BE=function(a){return c.readUInt64BE(this,a)},d.prototype.writeUInt64BE=function(a,b){return c.writeUInt64BE(this,b,a)},d.prototype.readInt64LE=function(a){return c.readInt64LE(this,a)},d.prototype.writeInt64LE=function(a,b){return c.writeInt64LE(this,b,a)},d.prototype.readUInt64LE=function(a){return c.readUInt64LE(this,a)},d.prototype.writeUInt64LE=function(a,b){return c.writeUInt64LE(this,b,a)},d.prototype.reinterpret=function(a,b){return c.reinterpret(this,a,b)},d.prototype.reinterpretUntilZeros=function(a,b){return c.reinterpretUntilZeros(this,a,b)},d.prototype.inspect=e(d.prototype.inspect),!(c.NULL instanceof d)){g("extending SlowBuffer's prototype since it doesn't inherit from Buffer.prototype");var n=a("buffer").SlowBuffer;n.prototype.address=d.prototype.address,n.prototype.hexAddress=d.prototype.hexAddress,n.prototype.isNull=d.prototype.isNull,n.prototype.ref=d.prototype.ref,n.prototype.deref=d.prototype.deref,n.prototype.readObject=d.prototype.readObject,n.prototype.writeObject=d.prototype.writeObject,n.prototype.readPointer=d.prototype.readPointer,n.prototype.writePointer=d.prototype.writePointer,n.prototype.readCString=d.prototype.readCString,n.prototype.writeCString=d.prototype.writeCString,n.prototype.reinterpret=d.prototype.reinterpret,n.prototype.reinterpretUntilZeros=d.prototype.reinterpretUntilZeros,n.prototype.readInt64BE=d.prototype.readInt64BE,n.prototype.writeInt64BE=d.prototype.writeInt64BE,n.prototype.readUInt64BE=d.prototype.readUInt64BE,n.prototype.writeUInt64BE=d.prototype.writeUInt64BE,n.prototype.readInt64LE=d.prototype.readInt64LE,n.prototype.writeInt64LE=d.prototype.writeInt64LE,n.prototype.readUInt64LE=d.prototype.readUInt64LE,n.prototype.writeUInt64LE=d.prototype.writeUInt64LE,n.prototype.inspect=e(n.prototype.inspect)}}).call(this,a("buffer").Buffer)},{assert:30,bindings:26,buffer:45,debug:27}],80:[function(a,b,c){function d(){}function e(a){var b={}.toString.call(a);switch(b){case"[object File]":case"[object Blob]":case"[object FormData]":return!0;default:return!1}}function f(a){return a===Object(a)}function g(a){if(!f(a))return a;var b=[];for(var c in a)null!=a[c]&&b.push(encodeURIComponent(c)+"="+encodeURIComponent(a[c]));return b.join("&")}function h(a){for(var b,c,d={},e=a.split("&"),f=0,g=e.length;g>f;++f)c=e[f],b=c.split("="),d[decodeURIComponent(b[0])]=decodeURIComponent(b[1]);return d}function i(a){var b,c,d,e,f=a.split(/\r?\n/),g={};f.pop();for(var h=0,i=f.length;i>h;++h)c=f[h],b=c.indexOf(":"),d=c.slice(0,b).toLowerCase(),e=r(c.slice(b+1)),g[d]=e;return g}function j(a){return a.split(/ *; */).shift()}function k(a){return q(a.split(/ *; */),function(a,b){var c=b.split(/ *= */),d=c.shift(),e=c.shift();return d&&e&&(a[d]=e),a},{})}function l(a,b){b=b||{},this.req=a,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=i(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 m(a,b){var c=this;p.call(this),this._query=this._query||[],this.method=a,this.url=b,this.header={},this._header={},this.on("end",function(){var a=null,b=null;try{b=new l(c)}catch(d){return a=new Error("Parser is unable to parse the response"),a.parse=!0,a.original=d,c.callback(a)}if(c.emit("response",b),a)return c.callback(a,b);if(b.status>=200&&b.status<300)return c.callback(a,b);var e=new Error(b.statusText||"Unsuccessful HTTP response");e.original=a,e.response=b,e.status=b.status,c.callback(e,b)})}function n(a,b){return"function"==typeof b?new m("GET",a).end(b):1==arguments.length?new m("GET",a):new m(a,b)}var o,p=a("emitter"),q=a("reduce");o="undefined"!=typeof window?window:"undefined"!=typeof self?self:this,n.getXHR=function(){if(!(!o.XMLHttpRequest||o.location&&"file:"==o.location.protocol&&o.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(a){}return!1};var r="".trim?function(a){return a.trim()}:function(a){return a.replace(/(^\s*|\s*$)/g,"")};n.serializeObject=g,n.parseString=h,n.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"},n.serialize={"application/x-www-form-urlencoded":g,"application/json":JSON.stringify},n.parse={"application/x-www-form-urlencoded":h,"application/json":JSON.parse},l.prototype.get=function(a){return this.header[a.toLowerCase()]},l.prototype.setHeaderProperties=function(a){var b=this.header["content-type"]||"";this.type=j(b);var c=k(b);for(var d in c)this[d]=c[d]},l.prototype.parse=function(a){return this.parser=a,this},l.prototype.parseBody=function(a){var b=this.parser||n.parse[this.type];return b&&a&&(a.length||a instanceof Object)?b(a):null},l.prototype.setStatusProperties=function(a){1223===a&&(a=204);var b=a/100|0;this.status=this.statusCode=a,this.statusType=b,this.info=1==b,this.ok=2==b,this.clientError=4==b,this.serverError=5==b,this.error=4==b||5==b?this.toError():!1,this.accepted=202==a,this.noContent=204==a,this.badRequest=400==a,this.unauthorized=401==a,this.notAcceptable=406==a,this.notFound=404==a,this.forbidden=403==a},l.prototype.toError=function(){var a=this.req,b=a.method,c=a.url,d="cannot "+b+" "+c+" ("+this.status+")",e=new Error(d);return e.status=this.status,e.method=b,e.url=c,e},n.Response=l,p(m.prototype),m.prototype.use=function(a){return a(this),this},m.prototype.timeout=function(a){return this._timeout=a,this},m.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},m.prototype.abort=function(){return this.aborted?void 0:(this.aborted=!0,this.xhr.abort(),this.clearTimeout(),this.emit("abort"),this)},m.prototype.set=function(a,b){if(f(a)){for(var c in a)this.set(c,a[c]);return this}return this._header[a.toLowerCase()]=b,this.header[a]=b,this},m.prototype.unset=function(a){return delete this._header[a.toLowerCase()],delete this.header[a],this},m.prototype.getHeader=function(a){return this._header[a.toLowerCase()]},m.prototype.type=function(a){return this.set("Content-Type",n.types[a]||a),this},m.prototype.accept=function(a){return this.set("Accept",n.types[a]||a),this},m.prototype.auth=function(a,b){var c=btoa(a+":"+b);return this.set("Authorization","Basic "+c),this},m.prototype.query=function(a){return"string"!=typeof a&&(a=g(a)),a&&this._query.push(a),this},m.prototype.field=function(a,b){return this._formData||(this._formData=new o.FormData),this._formData.append(a,b),this},m.prototype.attach=function(a,b,c){return this._formData||(this._formData=new o.FormData),this._formData.append(a,b,c),this},m.prototype.send=function(a){var b=f(a),c=this.getHeader("Content-Type");if(b&&f(this._data))for(var d in a)this._data[d]=a[d];else"string"==typeof a?(c||this.type("form"),c=this.getHeader("Content-Type"),"application/x-www-form-urlencoded"==c?this._data=this._data?this._data+"&"+a:a:this._data=(this._data||"")+a):this._data=a;return!b||e(a)?this:(c||this.type("json"),this)},m.prototype.callback=function(a,b){var c=this._callback;this.clearTimeout(),c(a,b)},m.prototype.crossDomainError=function(){var a=new Error("Origin is not allowed by Access-Control-Allow-Origin");a.crossDomain=!0,this.callback(a)},m.prototype.timeoutError=function(){var a=this._timeout,b=new Error("timeout of "+a+"ms exceeded");b.timeout=a,this.callback(b)},m.prototype.withCredentials=function(){return this._withCredentials=!0,this},m.prototype.end=function(a){var b=this,c=this.xhr=n.getXHR(),f=this._query.join("&"),g=this._timeout,h=this._formData||this._data;this._callback=a||d,c.onreadystatechange=function(){if(4==c.readyState){var a;try{a=c.status}catch(d){a=0}if(0==a){if(b.timedout)return b.timeoutError();if(b.aborted)return;return b.crossDomainError()}b.emit("end")}};var i=function(a){a.total>0&&(a.percent=a.loaded/a.total*100),b.emit("progress",a)};this.hasListeners("progress")&&(c.onprogress=i);try{c.upload&&this.hasListeners("progress")&&(c.upload.onprogress=i)}catch(j){}if(g&&!this._timer&&(this._timer=setTimeout(function(){b.timedout=!0,b.abort()},g)),f&&(f=n.serializeObject(f),this.url+=~this.url.indexOf("?")?"&"+f:"?"+f),c.open(this.method,this.url,!0),this._withCredentials&&(c.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof h&&!e(h)){var k=this.getHeader("Content-Type"),l=n.serialize[k?k.split(";")[0]:""];l&&(h=l(h))}for(var m in this.header)null!=this.header[m]&&c.setRequestHeader(m,this.header[m]);return this.emit("request",this),c.send(h),this},m.prototype.then=function(a,b){return this.end(function(c,d){c?b(c):a(d)})},n.Request=m,n.get=function(a,b,c){var d=n("GET",a);return"function"==typeof b&&(c=b,b=null),b&&d.query(b),c&&d.end(c),d},n.head=function(a,b,c){var d=n("HEAD",a);return"function"==typeof b&&(c=b,b=null),b&&d.send(b),c&&d.end(c),d},n.del=function(a,b){var c=n("DELETE",a);return b&&c.end(b),c},n.patch=function(a,b,c){var d=n("PATCH",a);return"function"==typeof b&&(c=b,b=null),b&&d.send(b),c&&d.end(c),d},n.post=function(a,b,c){var d=n("POST",a);return"function"==typeof b&&(c=b,b=null),b&&d.send(b),c&&d.end(c),d},n.put=function(a,b,c){var d=n("PUT",a);return"function"==typeof b&&(c=b,b=null),b&&d.send(b),c&&d.end(c),d},b.exports=n},{emitter:81,reduce:82}],81:[function(a,b,c){function d(a){return a?e(a):void 0}function e(a){for(var b in d.prototype)a[b]=d.prototype[b];return a}b.exports=d,d.prototype.on=d.prototype.addEventListener=function(a,b){return this._callbacks=this._callbacks||{},(this._callbacks[a]=this._callbacks[a]||[]).push(b),this},d.prototype.once=function(a,b){function c(){d.off(a,c),b.apply(this,arguments)}var d=this;return this._callbacks=this._callbacks||{},c.fn=b,this.on(a,c),this},d.prototype.off=d.prototype.removeListener=d.prototype.removeAllListeners=d.prototype.removeEventListener=function(a,b){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var c=this._callbacks[a];if(!c)return this;if(1==arguments.length)return delete this._callbacks[a],this;for(var d,e=0;e<c.length;e++)if(d=c[e],d===b||d.fn===b){c.splice(e,1);break}return this},d.prototype.emit=function(a){this._callbacks=this._callbacks||{};var b=[].slice.call(arguments,1),c=this._callbacks[a];if(c){c=c.slice(0);for(var d=0,e=c.length;e>d;++d)c[d].apply(this,b)}return this},d.prototype.listeners=function(a){return this._callbacks=this._callbacks||{},this._callbacks[a]||[]},d.prototype.hasListeners=function(a){return!!this.listeners(a).length}},{}],82:[function(a,b,c){b.exports=function(a,b,c){for(var d=0,e=a.length,f=3==arguments.length?c:a[d++];e>d;)f=b.call(null,f,a[d],++d,a);return f}},{}],83:[function(a,b,c){function d(a,b,c){var d;return d=b?new f(a,b):new f(a)}var e=function(){return this}(),f=e.WebSocket||e.MozWebSocket;b.exports=f?d:null,f&&(d.prototype=f.prototype)},{}]},{},[25])(25)}); |