c?c:h+o));return 1===i?(e=t[n-1],s+=u[e>>2],s+=u[e<<4&63],s+="=="):2===i&&(e=(t[n-2]<<8)+t[n-1],s+=u[e>>10],s+=u[e>>4&63],s+=u[e<<2&63],s+="="),r.push(s),r.join("")}e.byteLength=s,e.toByteArray=r,e.fromByteArray=h;for(var u=[],c=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=f.length;d>1,c=-7,l=n?s-1:0,f=n?-1:1,d=t[e+l];for(l+=f,r=d&(1<<-c)-1,d>>=-c,c+=a;c>0;r=256*r+t[e+l],l+=f,c-=8);for(o=r&(1<<-c)-1,r>>=-c,c+=i;c>0;o=256*o+t[e+l],l+=f,c-=8);if(0===r)r=1-u;else{if(r===h)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,i),r-=u}return(d?-1:1)*o*Math.pow(2,r-i)},e.write=function(t,e,n,i,s,r){var o,a,h,u=8*r-s-1,c=(1<>1,f=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:r-1,p=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-o))<1&&(o--,h*=2),e+=o+l>=1?f/h:f*Math.pow(2,1-l),e*h>=2&&(o++,h/=2),o+l>=c?(a=0,o=c):o+l>=1?(a=(e*h-1)*Math.pow(2,s),o+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,s),o=0));s>=8;t[n+d]=255&a,d+=p,a/=256,s-=8);for(o=o<0;t[n+d]=255&o,d+=p,o/=256,u-=8);t[n+d-p]|=128*m}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){"use strict";var i=n(5).assign,s=n(70),r=n(71),o=n(49),a={};i(a,s,r,o),t.exports=a},function(t,e,n){"use strict";function i(t){if(!(this instanceof i))return new i(t);this.options=h.assign({level:v,method:w,chunkSize:16384,windowBits:15,memLevel:8,strategy:E,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var n=a.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==m)throw new Error(c[n]);if(e.header&&a.deflateSetHeader(this.strm,e.header),e.dictionary){var s;if(s="string"==typeof e.dictionary?u.string2buf(e.dictionary):"[object ArrayBuffer]"===f.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,n=a.deflateSetDictionary(this.strm,s),n!==m)throw new Error(c[n]);this._dict_set=!0}}function s(t,e){var n=new i(e);if(n.push(t,!0),n.err)throw n.msg||c[n.err];return n.result}function r(t,e){return e=e||{},e.raw=!0,s(t,e)}function o(t,e){return e=e||{},e.gzip=!0,s(t,e)}var a=n(72),h=n(5),u=n(47),c=n(24),l=n(51),f=Object.prototype.toString,d=0,p=4,m=0,g=1,_=2,v=-1,E=0,w=8;i.prototype.push=function(t,e){var n,i,s=this.strm,r=this.options.chunkSize;if(this.ended)return!1;i=e===~~e?e:e===!0?p:d,"string"==typeof t?s.input=u.string2buf(t):"[object ArrayBuffer]"===f.call(t)?s.input=new Uint8Array(t):s.input=t,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new h.Buf8(r),s.next_out=0,s.avail_out=r),n=a.deflate(s,i),n!==g&&n!==m)return this.onEnd(n),this.ended=!0,!1;0!==s.avail_out&&(0!==s.avail_in||i!==p&&i!==_)||("string"===this.options.to?this.onData(u.buf2binstring(h.shrinkBuf(s.output,s.next_out))):this.onData(h.shrinkBuf(s.output,s.next_out)))}while((s.avail_in>0||0===s.avail_out)&&n!==g);return i===p?(n=a.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===m):i!==_||(this.onEnd(m),s.avail_out=0,!0)},i.prototype.onData=function(t){this.chunks.push(t)},i.prototype.onEnd=function(t){t===m&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=h.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Deflate=i,e.deflate=s,e.deflateRaw=r,e.gzip=o},function(t,e,n){"use strict";function i(t){if(!(this instanceof i))return new i(t);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0===(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var n=o.inflateInit2(this.strm,e.windowBits);if(n!==u.Z_OK)throw new Error(c[n]);this.header=new f,o.inflateGetHeader(this.strm,this.header)}function s(t,e){var n=new i(e);if(n.push(t,!0),n.err)throw n.msg||c[n.err];return n.result}function r(t,e){return e=e||{},e.raw=!0,s(t,e)}var o=n(75),a=n(5),h=n(47),u=n(49),c=n(24),l=n(51),f=n(73),d=Object.prototype.toString;i.prototype.push=function(t,e){var n,i,s,r,c,l,f=this.strm,p=this.options.chunkSize,m=this.options.dictionary,g=!1;if(this.ended)return!1;i=e===~~e?e:e===!0?u.Z_FINISH:u.Z_NO_FLUSH,"string"==typeof t?f.input=h.binstring2buf(t):"[object ArrayBuffer]"===d.call(t)?f.input=new Uint8Array(t):f.input=t,f.next_in=0,f.avail_in=f.input.length;do{if(0===f.avail_out&&(f.output=new a.Buf8(p),f.next_out=0,f.avail_out=p),n=o.inflate(f,u.Z_NO_FLUSH),n===u.Z_NEED_DICT&&m&&(l="string"==typeof m?h.string2buf(m):"[object ArrayBuffer]"===d.call(m)?new Uint8Array(m):m,n=o.inflateSetDictionary(this.strm,l)),n===u.Z_BUF_ERROR&&g===!0&&(n=u.Z_OK,g=!1),n!==u.Z_STREAM_END&&n!==u.Z_OK)return this.onEnd(n),this.ended=!0,!1;f.next_out&&(0!==f.avail_out&&n!==u.Z_STREAM_END&&(0!==f.avail_in||i!==u.Z_FINISH&&i!==u.Z_SYNC_FLUSH)||("string"===this.options.to?(s=h.utf8border(f.output,f.next_out),r=f.next_out-s,c=h.buf2string(f.output,s),f.next_out=r,f.avail_out=p-r,r&&a.arraySet(f.output,f.output,s,r,0),this.onData(c)):this.onData(a.shrinkBuf(f.output,f.next_out)))),0===f.avail_in&&0===f.avail_out&&(g=!0)}while((f.avail_in>0||0===f.avail_out)&&n!==u.Z_STREAM_END);return n===u.Z_STREAM_END&&(i=u.Z_FINISH),i===u.Z_FINISH?(n=o.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===u.Z_OK):i!==u.Z_SYNC_FLUSH||(this.onEnd(u.Z_OK),f.avail_out=0,!0)},i.prototype.onData=function(t){this.chunks.push(t)},i.prototype.onEnd=function(t){t===u.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Inflate=i,e.inflate=s,e.inflateRaw=r,e.ungzip=s},function(t,e,n){"use strict";function i(t,e){return t.msg=U[e],e}function s(t){return(t<<1)-(t>4?9:0)}function r(t){for(var e=t.length;--e>=0;)t[e]=0}function o(t){var e=t.state,n=e.pending;n>t.avail_out&&(n=t.avail_out),0!==n&&(I.arraySet(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))}function a(t,e){C._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,o(t.strm)}function h(t,e){t.pending_buf[t.pending++]=e}function u(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function c(t,e,n,i){var s=t.avail_in;return s>i&&(s=i),0===s?0:(t.avail_in-=s,I.arraySet(e,t.input,t.next_in,s,n),1===t.state.wrap?t.adler=x(t.adler,e,s,n):2===t.state.wrap&&(t.adler=L(t.adler,e,s,n)),t.next_in+=s,t.total_in+=s,s)}function l(t,e){var n,i,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match,h=t.strstart>t.w_size-lt?t.strstart-(t.w_size-lt):0,u=t.window,c=t.w_mask,l=t.prev,f=t.strstart+ct,d=u[r+o-1],p=u[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do if(n=e,u[n+o]===p&&u[n+o-1]===d&&u[n]===u[r]&&u[++n]===u[r+1]){r+=2,n++;do;while(u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&ro){if(t.match_start=e,o=i,i>=a)break;d=u[r+o-1],p=u[r+o]}}while((e=l[e&c])>h&&0!==--s);return o<=t.lookahead?o:t.lookahead}function f(t){var e,n,i,s,r,o=t.w_size;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=o+(o-lt)){I.arraySet(t.window,t.window,o,o,0),t.match_start-=o,t.strstart-=o,t.block_start-=o,n=t.hash_size,e=n;do i=t.head[--e],t.head[e]=i>=o?i-o:0;while(--n);n=o,e=n;do i=t.prev[--e],t.prev[e]=i>=o?i-o:0;while(--n);s+=o}if(0===t.strm.avail_in)break;if(n=c(t.strm,t.window,t.strstart+t.lookahead,s),t.lookahead+=n,t.lookahead+t.insert>=ut)for(r=t.strstart-t.insert,t.ins_h=t.window[r],t.ins_h=(t.ins_h<t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(f(t),0===t.lookahead&&e===N)return wt;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+n;if((0===t.strstart||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,a(t,!1),0===t.strm.avail_out))return wt;if(t.strstart-t.block_start>=t.w_size-lt&&(a(t,!1),0===t.strm.avail_out))return wt}return t.insert=0,e===B?(a(t,!0),0===t.strm.avail_out?yt:At):t.strstart>t.block_start&&(a(t,!1),0===t.strm.avail_out)?wt:wt}function p(t,e){for(var n,i;;){if(t.lookahead=ut&&(t.ins_h=(t.ins_h<=ut)if(i=C._tr_tally(t,t.strstart-t.match_start,t.match_length-ut),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=ut){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<=ut&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=ut-1)),t.prev_length>=ut&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-ut,i=C._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-ut),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=s&&(t.ins_h=(t.ins_h<=ut&&t.strstart>0&&(s=t.strstart-1,i=o[s],i===o[++s]&&i===o[++s]&&i===o[++s])){r=t.strstart+ct;do;while(i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=ut?(n=C._tr_tally(t,1,t.match_length-ut),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=C._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(a(t,!1),0===t.strm.avail_out))return wt}return t.insert=0,e===B?(a(t,!0),0===t.strm.avail_out?yt:At):t.last_lit&&(a(t,!1),0===t.strm.avail_out)?wt:bt}function _(t,e){for(var n;;){if(0===t.lookahead&&(f(t),0===t.lookahead)){if(e===N)return wt;break}if(t.match_length=0,n=C._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(a(t,!1),0===t.strm.avail_out))return wt}return t.insert=0,e===B?(a(t,!0),0===t.strm.avail_out?yt:At):t.last_lit&&(a(t,!1),0===t.strm.avail_out)?wt:bt}function v(t,e,n,i,s){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=i,this.func=s}function E(t){t.window_size=2*t.w_size,r(t.head),t.max_lazy_match=M[t.level].max_lazy,t.good_match=M[t.level].good_length,t.nice_match=M[t.level].nice_length,t.max_chain_length=M[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=ut-1,t.match_available=0,t.ins_h=0}function w(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=J,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new I.Buf16(2*at),this.dyn_dtree=new I.Buf16(2*(2*rt+1)),this.bl_tree=new I.Buf16(2*(2*ot+1)),r(this.dyn_ltree),r(this.dyn_dtree),r(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new I.Buf16(ht+1),this.heap=new I.Buf16(2*st+1),r(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new I.Buf16(2*st+1),r(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function b(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=X,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?dt:vt,t.adler=2===e.wrap?0:1,e.last_flush=N,C._tr_init(e),j):i(t,z)}function y(t){var e=b(t);return e===j&&E(t.state),e}function A(t,e){return t&&t.state?2!==t.state.wrap?z:(t.state.gzhead=e,j):z}function T(t,e,n,s,r,o){if(!t)return z;var a=1;if(e===V&&(e=6),s<0?(a=0,s=-s):s>15&&(a=2,s-=16),r<1||r>Q||n!==J||s<8||s>15||e<0||e>9||o<0||o>Z)return i(t,z);8===s&&(s=9);var h=new w;return t.state=h,h.strm=t,h.wrap=a,h.gzhead=null,h.w_bits=s,h.w_size=1<G||e<0)return t?i(t,z):z;if(a=t.state,!t.output||!t.input&&0!==t.avail_in||a.status===Et&&e!==B)return i(t,0===t.avail_out?F:z);if(a.strm=t,n=a.last_flush,a.last_flush=e,a.status===dt)if(2===a.wrap)t.adler=0,h(a,31),h(a,139),h(a,8),a.gzhead?(h(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),h(a,255&a.gzhead.time),h(a,a.gzhead.time>>8&255),h(a,a.gzhead.time>>16&255),h(a,a.gzhead.time>>24&255),h(a,9===a.level?2:a.strategy>=W||a.level<2?4:0),h(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(h(a,255&a.gzhead.extra.length),h(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(t.adler=L(t.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=pt):(h(a,0),h(a,0),h(a,0),h(a,0),h(a,0),h(a,9===a.level?2:a.strategy>=W||a.level<2?4:0),h(a,Tt),a.status=vt);else{var f=J+(a.w_bits-8<<4)<<8,d=-1;d=a.strategy>=W||a.level<2?0:a.level<6?1:6===a.level?2:3,f|=d<<6,0!==a.strstart&&(f|=ft),f+=31-f%31,a.status=vt,u(a,f),0!==a.strstart&&(u(a,t.adler>>>16),u(a,65535&t.adler)),t.adler=1}if(a.status===pt)if(a.gzhead.extra){for(c=a.pending;a.gzindex<(65535&a.gzhead.extra.length)&&(a.pending!==a.pending_buf_size||(a.gzhead.hcrc&&a.pending>c&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),o(t),c=a.pending,a.pending!==a.pending_buf_size));)h(a,255&a.gzhead.extra[a.gzindex]),a.gzindex++;a.gzhead.hcrc&&a.pending>c&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=mt)}else a.status=mt;if(a.status===mt)if(a.gzhead.name){c=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>c&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),o(t),c=a.pending,a.pending===a.pending_buf_size)){l=1;break}l=a.gzindexc&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),0===l&&(a.gzindex=0,a.status=gt)}else a.status=gt;if(a.status===gt)if(a.gzhead.comment){c=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>c&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),o(t),c=a.pending,a.pending===a.pending_buf_size)){l=1;break}l=a.gzindexc&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),0===l&&(a.status=_t)}else a.status=_t;if(a.status===_t&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&o(t),a.pending+2<=a.pending_buf_size&&(h(a,255&t.adler),h(a,t.adler>>8&255),t.adler=0,a.status=vt)):a.status=vt),0!==a.pending){if(o(t),0===t.avail_out)return a.last_flush=-1,j}else if(0===t.avail_in&&s(e)<=s(n)&&e!==B)return i(t,F);if(a.status===Et&&0!==t.avail_in)return i(t,F);if(0!==t.avail_in||0!==a.lookahead||e!==N&&a.status!==Et){var p=a.strategy===W?_(a,e):a.strategy===K?g(a,e):M[a.level].func(a,e);if(p!==yt&&p!==At||(a.status=Et),p===wt||p===yt)return 0===t.avail_out&&(a.last_flush=-1),j;if(p===bt&&(e===O?C._tr_align(a):e!==G&&(C._tr_stored_block(a,0,0,!1),e===P&&(r(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),o(t),0===t.avail_out))return a.last_flush=-1,j}return e!==B?j:a.wrap<=0?q:(2===a.wrap?(h(a,255&t.adler),h(a,t.adler>>8&255),h(a,t.adler>>16&255),h(a,t.adler>>24&255),h(a,255&t.total_in),h(a,t.total_in>>8&255),h(a,t.total_in>>16&255),h(a,t.total_in>>24&255)):(u(a,t.adler>>>16),u(a,65535&t.adler)),o(t),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?j:q)}function D(t){var e;return t&&t.state?(e=t.state.status,e!==dt&&e!==pt&&e!==mt&&e!==gt&&e!==_t&&e!==vt&&e!==Et?i(t,z):(t.state=null,e===vt?i(t,H):j)):z}function S(t,e){var n,i,s,o,a,h,u,c,l=e.length;if(!t||!t.state)return z;if(n=t.state,o=n.wrap,2===o||1===o&&n.status!==dt||n.lookahead)return z;for(1===o&&(t.adler=x(t.adler,e,l,0)),n.wrap=0,l>=n.w_size&&(0===o&&(r(n.head),n.strstart=0,n.block_start=0,n.insert=0),c=new I.Buf8(n.w_size),I.arraySet(c,e,l-n.w_size,n.w_size,0),e=c,l=n.w_size),a=t.avail_in,h=t.next_in,u=t.input,t.avail_in=l,t.next_in=0,t.input=e,f(n);n.lookahead>=ut;){i=n.strstart,s=n.lookahead-(ut-1);do n.ins_h=(n.ins_h<>>24,m>>>=y,g-=y,y=b>>>16&255,0===y)S[a++]=65535&b;else{if(!(16&y)){if(0===(64&y)){b=_[(65535&b)+(m&(1<>>=y,g-=y),g<15&&(m+=D[r++]<>>24,m>>>=y,g-=y,y=b>>>16&255,!(16&y)){if(0===(64&y)){b=v[(65535&b)+(m&(1<c){t.msg="invalid distance too far back",n.mode=i;break t}if(m>>>=y,g-=y,y=a-h,T>y){if(y=T-y,y>f&&n.sane){t.msg="invalid distance too far back",n.mode=i;break t}if(k=0,R=p,0===d){if(k+=l-y,y2;)S[a++]=R[k++],S[a++]=R[k++],S[a++]=R[k++],A-=3;A&&(S[a++]=R[k++],A>1&&(S[a++]=R[k++]))}else{k=a-T;do S[a++]=S[k++],S[a++]=S[k++],S[a++]=S[k++],A-=3;while(A>2);A&&(S[a++]=S[k++],A>1&&(S[a++]=S[k++]))}break}}break}}while(r>3,r-=A,g-=A<<3,m&=(1<>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function s(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new v.Buf16(320),this.work=new v.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function r(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=P,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new v.Buf32(mt),e.distcode=e.distdyn=new v.Buf32(gt),e.sane=1,e.back=-1,M):x}function o(t){var e;return t&&t.state?(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,r(t)):x}function a(t,e){var n,i;return t&&t.state?(i=t.state,e<0?(n=0,e=-e):(n=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15)?x:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=n,i.wbits=e,o(t))):x}function h(t,e){var n,i;return t?(i=new s,t.state=i,i.window=null,n=a(t,e),n!==M&&(t.state=null),n):x}function u(t){return h(t,vt)}function c(t){if(Et){var e;for(g=new v.Buf32(512),_=new v.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(y(T,t.lens,0,288,g,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;y(k,t.lens,0,32,_,0,t.work,{bits:5}),Et=!1}t.lencode=g,t.lenbits=9,t.distcode=_,t.distbits=5}function l(t,e,n,i){var s,r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(v.arraySet(r.window,e,n-r.wsize,r.wsize,0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>i&&(s=i),v.arraySet(r.window,e,n-i,s,r.wnext),i-=s,i?(v.arraySet(r.window,e,n-i,i,0),r.wnext=i,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whave>>8&255,n.check=w(n.check,Dt,2,0),f=0,d=0,n.mode=B;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&f)<<8)+(f>>8))%31){t.msg="incorrect header check",n.mode=ft;break}if((15&f)!==O){t.msg="unknown compression method",n.mode=ft;break}if(f>>>=4,d-=4,yt=(15&f)+8,0===n.wbits)n.wbits=yt;else if(yt>n.wbits){t.msg="invalid window size",n.mode=ft;break}n.dmax=1<>8&1),512&n.flags&&(Dt[0]=255&f,Dt[1]=f>>>8&255,n.check=w(n.check,Dt,2,0)),f=0,d=0,n.mode=G;case G:for(;d<32;){if(0===h)break t;h--,f+=s[o++]<>>8&255,Dt[2]=f>>>16&255,Dt[3]=f>>>24&255,n.check=w(n.check,Dt,4,0)),f=0,d=0,n.mode=j;case j:for(;d<16;){if(0===h)break t;h--,f+=s[o++]<>8),512&n.flags&&(Dt[0]=255&f,Dt[1]=f>>>8&255,n.check=w(n.check,Dt,2,0)),f=0,d=0,n.mode=q;case q:if(1024&n.flags){for(;d<16;){if(0===h)break t;h--,f+=s[o++]<>>8&255,n.check=w(n.check,Dt,2,0)),f=0,d=0}else n.head&&(n.head.extra=null);n.mode=z;case z:if(1024&n.flags&&(g=n.length,g>h&&(g=h),g&&(n.head&&(yt=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),v.arraySet(n.head.extra,s,o,g,yt)),512&n.flags&&(n.check=w(n.check,s,g,o)),h-=g,o+=g,n.length-=g),n.length))break t;n.length=0,n.mode=H;case H:if(2048&n.flags){if(0===h)break t;g=0;do yt=s[o+g++],n.head&&yt&&n.length<65536&&(n.head.name+=String.fromCharCode(yt));while(yt&&g>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=K;break;case Y:for(;d<32;){if(0===h)break t;h--,f+=s[o++]<>>=7&d,d-=7&d,n.mode=ut;break}for(;d<3;){if(0===h)break t;h--,f+=s[o++]<>>=1,
+d-=1,3&f){case 0:n.mode=$;break;case 1:if(c(n),n.mode=nt,e===S){f>>>=2,d-=2;break t}break;case 2:n.mode=Q;break;case 3:t.msg="invalid block type",n.mode=ft}f>>>=2,d-=2;break;case $:for(f>>>=7&d,d-=7&d;d<32;){if(0===h)break t;h--,f+=s[o++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=ft;break}if(n.length=65535&f,f=0,d=0,n.mode=X,e===S)break t;case X:n.mode=J;case J:if(g=n.length){if(g>h&&(g=h),g>u&&(g=u),0===g)break t;v.arraySet(r,s,o,g,a),h-=g,o+=g,u-=g,a+=g,n.length-=g;break}n.mode=K;break;case Q:for(;d<14;){if(0===h)break t;h--,f+=s[o++]<>>=5,d-=5,n.ndist=(31&f)+1,f>>>=5,d-=5,n.ncode=(15&f)+4,f>>>=4,d-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=ft;break}n.have=0,n.mode=tt;case tt:for(;n.have>>=3,d-=3}for(;n.have<19;)n.lens[St[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,Tt={bits:n.lenbits},At=y(A,n.lens,0,19,n.lencode,0,n.work,Tt),n.lenbits=Tt.bits,At){t.msg="invalid code lengths set",n.mode=ft;break}n.have=0,n.mode=et;case et:for(;n.have>>24,_t=Rt>>>16&255,vt=65535&Rt,!(gt<=d);){if(0===h)break t;h--,f+=s[o++]<>>=gt,d-=gt,n.lens[n.have++]=vt;else{if(16===vt){for(kt=gt+2;d>>=gt,d-=gt,0===n.have){t.msg="invalid bit length repeat",n.mode=ft;break}yt=n.lens[n.have-1],g=3+(3&f),f>>>=2,d-=2}else if(17===vt){for(kt=gt+3;d>>=gt,d-=gt,yt=0,g=3+(7&f),f>>>=3,d-=3}else{for(kt=gt+7;d>>=gt,d-=gt,yt=0,g=11+(127&f),f>>>=7,d-=7}if(n.have+g>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=ft;break}for(;g--;)n.lens[n.have++]=yt}}if(n.mode===ft)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=ft;break}if(n.lenbits=9,Tt={bits:n.lenbits},At=y(T,n.lens,0,n.nlen,n.lencode,0,n.work,Tt),n.lenbits=Tt.bits,At){t.msg="invalid literal/lengths set",n.mode=ft;break}if(n.distbits=6,n.distcode=n.distdyn,Tt={bits:n.distbits},At=y(k,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,Tt),n.distbits=Tt.bits,At){t.msg="invalid distances set",n.mode=ft;break}if(n.mode=nt,e===S)break t;case nt:n.mode=it;case it:if(h>=6&&u>=258){t.next_out=a,t.avail_out=u,t.next_in=o,t.avail_in=h,n.hold=f,n.bits=d,b(t,m),a=t.next_out,r=t.output,u=t.avail_out,o=t.next_in,s=t.input,h=t.avail_in,f=n.hold,d=n.bits,n.mode===K&&(n.back=-1);break}for(n.back=0;Rt=n.lencode[f&(1<>>24,_t=Rt>>>16&255,vt=65535&Rt,!(gt<=d);){if(0===h)break t;h--,f+=s[o++]<>Et)],gt=Rt>>>24,_t=Rt>>>16&255,vt=65535&Rt,!(Et+gt<=d);){if(0===h)break t;h--,f+=s[o++]<>>=Et,d-=Et,n.back+=Et}if(f>>>=gt,d-=gt,n.back+=gt,n.length=vt,0===_t){n.mode=ht;break}if(32&_t){n.back=-1,n.mode=K;break}if(64&_t){t.msg="invalid literal/length code",n.mode=ft;break}n.extra=15&_t,n.mode=st;case st:if(n.extra){for(kt=n.extra;d>>=n.extra,d-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=rt;case rt:for(;Rt=n.distcode[f&(1<>>24,_t=Rt>>>16&255,vt=65535&Rt,!(gt<=d);){if(0===h)break t;h--,f+=s[o++]<>Et)],gt=Rt>>>24,_t=Rt>>>16&255,vt=65535&Rt,!(Et+gt<=d);){if(0===h)break t;h--,f+=s[o++]<>>=Et,d-=Et,n.back+=Et}if(f>>>=gt,d-=gt,n.back+=gt,64&_t){t.msg="invalid distance code",n.mode=ft;break}n.offset=vt,n.extra=15&_t,n.mode=ot;case ot:if(n.extra){for(kt=n.extra;d>>=n.extra,d-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=ft;break}n.mode=at;case at:if(0===u)break t;if(g=m-u,n.offset>g){if(g=n.offset-g,g>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=ft;break}g>n.wnext?(g-=n.wnext,_=n.wsize-g):_=n.wnext-g,g>n.length&&(g=n.length),mt=n.window}else mt=r,_=a-n.offset,g=n.length;g>u&&(g=u),u-=g,n.length-=g;do r[a++]=mt[_++];while(--g);0===n.length&&(n.mode=it);break;case ht:if(0===u)break t;r[a++]=n.length,u--,n.mode=it;break;case ut:if(n.wrap){for(;d<32;){if(0===h)break t;h--,f|=s[o++]<=1&&0===q[x];x--);if(L>x&&(L=x),0===x)return m[g++]=20971520,m[g++]=20971520,v.bits=1,0;for(C=1;C0&&(t===a||1!==x))return-1;for(z[1]=0,M=1;Mr||t===u&&P>o)return 1;for(;;){k=M-N,_[I]T?(R=H[F+_[I]],D=G[j+_[I]]):(R=96,D=0),E=1<>N)+w]=k<<24|R<<16|D|0;while(0!==w);for(E=1<>=1;if(0!==E?(B&=E-1,B+=E):B=0,I++,0===--q[M]){if(M===x)break;M=e[n+_[I]]}if(M>L&&(B&y)!==b){for(0===N&&(N=L),A+=C,U=M-N,O=1<r||t===u&&P>o)return 1;b=B&y,m[b]=L<<24|U<<16|A-g|0}}return 0!==B&&(m[A+B]=M-N<<24|64<<16|0),v.bits=L,0}},function(t,e,n){"use strict";function i(t){for(var e=t.length;--e>=0;)t[e]=0}function s(t,e,n,i,s){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=i,this.max_length=s,this.has_stree=t&&t.length}function r(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function o(t){return t<256?ht[t]:ht[256+(t>>>7)]}function a(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function h(t,e,n){t.bi_valid>Z-n?(t.bi_buf|=e<>Z-t.bi_valid,t.bi_valid+=n-Z):(t.bi_buf|=e<>>=1,n<<=1;while(--e>0);return n>>>1}function l(t){16===t.bi_valid?(a(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}function f(t,e){var n,i,s,r,o,a,h=e.dyn_tree,u=e.max_code,c=e.stat_desc.static_tree,l=e.stat_desc.has_stree,f=e.stat_desc.extra_bits,d=e.stat_desc.extra_base,p=e.stat_desc.max_length,m=0;for(r=0;r<=K;r++)t.bl_count[r]=0;for(h[2*t.heap[t.heap_max]+1]=0,n=t.heap_max+1;np&&(r=p,m++),h[2*i+1]=r,i>u||(t.bl_count[r]++,o=0,i>=d&&(o=f[i-d]),a=h[2*i],t.opt_len+=a*(r+o),l&&(t.static_len+=a*(c[2*i+1]+o)));if(0!==m){do{for(r=p-1;0===t.bl_count[r];)r--;t.bl_count[r]--,t.bl_count[r+1]+=2,t.bl_count[p]--,m-=2}while(m>0);for(r=p;0!==r;r--)for(i=t.bl_count[r];0!==i;)s=t.heap[--n],s>u||(h[2*s+1]!==r&&(t.opt_len+=(r-h[2*s+1])*h[2*s],h[2*s+1]=r),i--)}}function d(t,e,n){var i,s,r=new Array(K+1),o=0;for(i=1;i<=K;i++)r[i]=o=o+n[i-1]<<1;for(s=0;s<=e;s++){var a=t[2*s+1];0!==a&&(t[2*s]=c(r[a]++,a))}}function p(){var t,e,n,i,r,o=new Array(K+1);for(n=0,i=0;i>=7;i8?a(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function _(t,e,n,i){g(t),i&&(a(t,n),a(t,~n)),x.arraySet(t.pending_buf,t.window,e,n,t.pending),t.pending+=n}function v(t,e,n,i){var s=2*e,r=2*n;return t[s]>1;n>=1;n--)E(t,r,n);s=h;do n=t.heap[1],t.heap[1]=t.heap[t.heap_len--],E(t,r,1),i=t.heap[1],t.heap[--t.heap_max]=n,t.heap[--t.heap_max]=i,r[2*s]=r[2*n]+r[2*i],t.depth[s]=(t.depth[n]>=t.depth[i]?t.depth[n]:t.depth[i])+1,r[2*n+1]=r[2*i+1]=s,t.heap[1]=s++,E(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],f(t,e),d(r,u,t.bl_count)}function y(t,e,n){var i,s,r=-1,o=e[1],a=0,h=7,u=4;for(0===o&&(h=138,u=3),e[2*(n+1)+1]=65535,i=0;i<=n;i++)s=o,o=e[2*(i+1)+1],++a=3&&0===t.bl_tree[2*st[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}function k(t,e,n,i){var s;for(h(t,e-257,5),h(t,n-1,5),h(t,i-4,4),s=0;s>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return U;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return N;for(e=32;e0?(t.strm.data_type===O&&(t.strm.data_type=R(t)),b(t,t.l_desc),b(t,t.d_desc),o=T(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=n+5,n+4<=s&&e!==-1?S(t,e,n,i):t.strategy===L||r===s?(h(t,(B<<1)+(i?1:0),3),w(t,ot,at)):(h(t,(G<<1)+(i?1:0),3),k(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),w(t,t.dyn_ltree,t.dyn_dtree)),m(t),i&&g(t)}function C(t,e,n){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&n,t.last_lit++,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(ut[n]+H+1)]++,t.dyn_dtree[2*o(e)]++),t.last_lit===t.lit_bufsize-1}var x=n(5),L=4,U=0,N=1,O=2,P=0,B=1,G=2,j=3,q=258,z=29,H=256,F=H+1+z,V=30,Y=19,W=2*F+1,K=15,Z=16,$=7,X=256,J=16,Q=17,tt=18,et=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],nt=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],it=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],st=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],rt=512,ot=new Array(2*(F+2));i(ot);var at=new Array(2*V);i(at);var ht=new Array(rt);i(ht);var ut=new Array(q-j+1);i(ut);var ct=new Array(z);i(ct);var lt=new Array(V);i(lt);var ft,dt,pt,mt=!1;e._tr_init=D,e._tr_stored_block=S,e._tr_flush_block=I,e._tr_tally=C,e._tr_align=M},function(t,e,n){"use strict";function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,n,r){e=e||"&",n=n||"=";var o={};if("string"!=typeof t||0===t.length)return o;var a=/\+/g;t=t.split(e);var h=1e3;r&&"number"==typeof r.maxKeys&&(h=r.maxKeys);var u=t.length;h>0&&u>h&&(u=h);for(var c=0;c=0?(l=m.substr(0,g),f=m.substr(g+1)):(l=m,f=""),d=decodeURIComponent(l),p=decodeURIComponent(f),i(o,d)?s(o[d])?o[d].push(p):o[d]=[o[d],p]:o[d]=p}return o};var s=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,n){"use strict";function i(t,e){if(t.map)return t.map(e);for(var n=[],i=0;i=200&&t.status<300)},i.prototype.get=function(t){return this._header[t.toLowerCase()]},i.prototype.getHeader=i.prototype.get,i.prototype.set=function(t,e){if(r(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},i.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},i.prototype.field=function(t,e){if(null===t||void 0===t)throw new Error(".field(name, val) name can not be empty");if(r(t)){for(var n in t)this.field(n,t[n]);return this}if(Array.isArray(e)){for(var i in e)this.field(t,e[i]);return this}if(null===e||void 0===e)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof e&&(e=""+e),this._getFormData().append(t,e),this},i.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},i.prototype.withCredentials=function(){return this._withCredentials=!0,this},i.prototype.redirects=function(t){return this._maxRedirects=t,this},i.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},i.prototype.send=function(t){var e=r(t),n=this._header["content-type"];if(e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(e&&r(this._data))for(var i in t)this._data[i]=t[i];else"string"==typeof t?(n||this.type("form"),n=this._header["content-type"],"application/x-www-form-urlencoded"==n?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(n||this.type("json"),this)},i.prototype.sortQuery=function(t){return this._sort="undefined"==typeof t||t,this},i.prototype._timeoutError=function(t,e){if(!this._aborted){var n=new Error(t+e+"ms exceeded");n.timeout=e,n.code="ECONNABORTED",this.timedout=!0,this.abort(),this.callback(n)}},i.prototype._setTimeouts=function(){var t=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){t._timeoutError("Timeout of ",t._timeout)},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){t._timeoutError("Response timeout of ",t._responseTimeout)},this._responseTimeout))}},function(t,e,n){function i(t){if(t)return s(t)}function s(t){for(var e in i.prototype)t[e]=i.prototype[e];return t}var r=n(85);t.exports=i,i.prototype.get=function(t){return this.header[t.toLowerCase()]},i.prototype._setHeaderProperties=function(t){var e=t["content-type"]||"";this.type=r.type(e);var n=r.params(e);for(var i in n)this[i]=n[i];this.links={};try{t.link&&(this.links=r.parseLinks(t.link))}catch(t){}},i.prototype._setStatusProperties=function(t){var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.redirect=3==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.forbidden=403==t,this.notFound=404==t}},function(t,e){e.type=function(t){return t.split(/ *; */).shift()},e.params=function(t){return t.split(/ *; */).reduce(function(t,e){var n=e.split(/ *= */),i=n.shift(),s=n.shift();return i&&s&&(t[i]=s),t},{})},e.parseLinks=function(t){return t.split(/ *, */).reduce(function(t,e){var n=e.split(/ *; */),i=n[0].slice(1,-1),s=n[1].split(/ *= */)[1].slice(1,-1);return t[s]=i,t},{})},e.cleanHeader=function(t,e){return delete t["content-type"],delete t["content-length"],delete t["transfer-encoding"],delete t.host,e&&delete t.cookie,t}},function(t,e,n){function i(t,e){this._id=t,this._clearFn=e}var s=Function.prototype.apply;e.setTimeout=function(){return new i(s.call(setTimeout,window,arguments),clearTimeout)},e.setInterval=function(){return new i(s.call(setInterval,window,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(window,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(81),e.setImmediate=setImmediate,e.clearImmediate=clearImmediate},function(t,e,n){const i=n(0),s=n(4),r=n(14),o=n(6),a=n(32),h=n(10),u=n(43),c=n(44),l=n(15),f=n(33);class d{constructor(t){this.client=t}get pastReady(){return this.client.ws.status===i.Status.READY}newGuild(t){const e=this.client.guilds.has(t.id),n=new r(this.client,t);return this.client.guilds.set(n.id,n),this.pastReady&&!e&&(this.client.options.fetchAllMembers?n.fetchMembers().then(()=>{this.client.emit(i.Events.GUILD_CREATE,n)}):this.client.emit(i.Events.GUILD_CREATE,n)),n}newUser(t){if(this.client.users.has(t.id))return this.client.users.get(t.id);const e=new o(this.client,t);return this.client.users.set(e.id,e),e}newChannel(t,e){const n=this.client.channels.has(t.id);let s;return t.type===i.ChannelTypes.DM?s=new a(this.client,t):t.type===i.ChannelTypes.groupDM?s=new f(this.client,t):(e=e||this.client.guilds.get(t.guild_id),e&&(t.type===i.ChannelTypes.text?(s=new u(e,t),e.channels.set(s.id,s)):t.type===i.ChannelTypes.voice&&(s=new c(e,t),e.channels.set(s.id,s)))),s?(this.pastReady&&!n&&this.client.emit(i.Events.CHANNEL_CREATE,s),this.client.channels.set(s.id,s),s):null}newEmoji(t,e){const n=e.emojis.has(t.id);if(t&&!n){let n=new h(e,t);return this.client.emit(i.Events.GUILD_EMOJI_CREATE,n),e.emojis.set(n.id,n),n}return n?e.emojis.get(t.id):null}killEmoji(t){t instanceof h&&t.guild&&(this.client.emit(i.Events.GUILD_EMOJI_DELETE,t),t.guild.emojis.delete(t.id))}killGuild(t){const e=this.client.guilds.has(t.id);this.client.guilds.delete(t.id),e&&this.pastReady&&this.client.emit(i.Events.GUILD_DELETE,t)}killUser(t){this.client.users.delete(t.id)}killChannel(t){this.client.channels.delete(t.id),t instanceof l&&t.guild.channels.delete(t.id)}updateGuild(t,e){const n=s(t);t.setup(e),this.pastReady&&this.client.emit(i.Events.GUILD_UPDATE,n,t)}updateChannel(t,e){t.setup(e)}updateEmoji(t,e){const n=s(t);t.setup(e),this.client.emit(i.Events.GUILD_EMOJI_UPDATE,n,t)}}t.exports=d},function(t,e,n){const i=n(0);class s{constructor(t){this.client=t,this.heartbeatInterval=null}connectToWebSocket(t,e,n){this.client.emit(i.Events.DEBUG,`Authenticated using token ${t}`),this.client.token=t;const s=this.client.setTimeout(()=>n(new Error(i.Errors.TOOK_TOO_LONG)),3e5);this.client.rest.methods.getGateway().then(r=>{this.client.emit(i.Events.DEBUG,`Using gateway ${r}`),this.client.ws.connect(r),this.client.ws.once("close",t=>{4004===t.code&&n(new Error(i.Errors.BAD_LOGIN)),4010===t.code&&n(new Error(i.Errors.INVALID_SHARD)),4011===t.code&&n(new Error(i.Errors.SHARDING_REQUIRED))}),this.client.once(i.Events.READY,()=>{e(t),this.client.clearTimeout(s)})},n)}setupKeepAlive(t){this.heartbeatInterval=this.client.setInterval(()=>this.client.ws.heartbeat(!0),t)}destroy(){return this.client.ws.destroy(),this.client.user.bot?(this.client.token=null,Promise.resolve()):this.client.rest.methods.logout().then(()=>{this.client.token=null})}}t.exports=s},function(t,e,n){class i{constructor(t){this.client=t,this.register(n(106)),this.register(n(107)),this.register(n(108)),this.register(n(112)),this.register(n(109)),this.register(n(110)),this.register(n(111)),this.register(n(90)),this.register(n(91)),this.register(n(92)),this.register(n(94)),this.register(n(105)),this.register(n(98)),this.register(n(99)),this.register(n(93)),this.register(n(100)),this.register(n(101)),this.register(n(102)),this.register(n(113)),this.register(n(115)),this.register(n(114)),this.register(n(104)),this.register(n(95)),this.register(n(96)),this.register(n(97)),this.register(n(103))}register(t){this[t.name.replace(/Action$/,"")]=new t(this.client)}}t.exports=i},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client,n=e.dataManager.newChannel(t);return{channel:n}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client;let n=e.channels.get(t.id);return n?(e.dataManager.killChannel(n),this.deleted.set(n.id,n),this.scheduleForDeletion(n.id)):n=this.deleted.get(t.id)||null,{channel:n}}scheduleForDeletion(t){this.client.setTimeout(()=>this.deleted.delete(t),this.client.options.restWsBridgeTimeout)}}t.exports=s},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client,n=e.channels.get(t.id);if(n){const i=r(n);return n.setup(t),e.emit(s.Events.CHANNEL_UPDATE,i,n),{old:i,updated:n}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client,n=e.guilds.get(t.guild_id),i=e.dataManager.newUser(t.user);n&&i&&e.emit(s.Events.GUILD_BAN_REMOVE,n,i)}}t.exports=r},function(t,e,n){const i=n(2),s=n(0);class r extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client;let n=e.guilds.get(t.id);if(n){for(const i of n.channels.values())"text"===i.type&&i.stopTyping(!0);if(n.available&&t.unavailable)return n.available=!1,e.emit(s.Events.GUILD_UNAVAILABLE,n),{guild:null};e.guilds.delete(n.id),this.deleted.set(n.id,n),this.scheduleForDeletion(n.id)}else n=this.deleted.get(t.id)||null;return{guild:n}}scheduleForDeletion(t){this.client.setTimeout(()=>this.deleted.delete(t),this.client.options.restWsBridgeTimeout)}}t.exports=r},function(t,e,n){const i=n(2);class s extends i{handle(t,e){const n=this.client,i=n.dataManager.newEmoji(e,t);return{emoji:i}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client;return e.dataManager.killEmoji(t),{emoji:t}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{handle(t,e){this.client.dataManager.updateEmoji(t,e)}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{handle(t,e){const n=t._addMember(e,!1);return{member:n}}}t.exports=s},function(t,e,n){const i=n(2),s=n(0);class r extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n){let i=n.members.get(t.user.id);return i?(n.memberCount--,n._removeMember(i),this.deleted.set(n.id+t.user.id,i),e.status===s.Status.READY&&e.emit(s.Events.GUILD_MEMBER_REMOVE,i),this.scheduleForDeletion(n.id,t.user.id)):i=this.deleted.get(n.id+t.user.id)||null,{guild:n,member:i}}return{guild:n,member:null}}scheduleForDeletion(t,e){this.client.setTimeout(()=>this.deleted.delete(t+e),this.client.options.restWsBridgeTimeout)}}t.exports=r},function(t,e,n){const i=n(2),s=n(0),r=n(9);class o extends i{handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n){const i=n.roles.has(t.role.id),o=new r(n,t.role);return n.roles.set(o.id,o),i||e.emit(s.Events.GUILD_ROLE_CREATE,o),{role:o}}return{role:null}}}t.exports=o},function(t,e,n){const i=n(2),s=n(0);class r extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n){let i=n.roles.get(t.role_id);return i?(n.roles.delete(t.role_id),this.deleted.set(n.id+t.role_id,i),this.scheduleForDeletion(n.id,t.role_id),e.emit(s.Events.GUILD_ROLE_DELETE,i)):i=this.deleted.get(n.id+t.role_id)||null,{role:i}}return{role:null}}scheduleForDeletion(t,e){this.client.setTimeout(()=>this.deleted.delete(t+e),this.client.options.restWsBridgeTimeout)}}t.exports=r},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n){const i=t.role;let o=null;const a=n.roles.get(i.id);return a&&(o=r(a),a.setup(t.role),e.emit(s.Events.GUILD_ROLE_UPDATE,o,a)),{old:o,updated:a}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n)for(const i of t.roles){const t=n.roles.get(i.id);t&&(t.position=i.position)}return{guild:n}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client,n=e.guilds.get(t.id);if(n){if(t.presences)for(const e of t.presences)n._setPresence(e.user.id,e);if(t.members)for(const i of t.members){const t=n.members.get(i.user.id);t?n._updateMember(t,i):n._addMember(i,!1)}"large"in t&&(n.large=t.large)}}}t.exports=s},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client,n=e.guilds.get(t.id);if(n){const i=r(n);return n.setup(t),e.emit(s.Events.GUILD_UPDATE,i,n),
+{old:i,updated:n}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){const i=n(2),s=n(12);class r extends i{handle(t){const e=this.client,n=e.channels.get((t instanceof Array?t[0]:t).channel_id),i=e.users.get((t instanceof Array?t[0]:t).author.id);if(n){const r=n.guild?n.guild.member(i):null;if(t instanceof Array){const o=new Array(t.length);for(let a=0;athis.deleted.delete(t+e),this.client.options.restWsBridgeTimeout)}}t.exports=s},function(t,e,n){const i=n(2),s=n(3),r=n(0);class o extends i{handle(t){const e=this.client,n=e.channels.get(t.channel_id),i=t.ids,o=new s;for(const a of i){const t=n.messages.get(a);t&&o.set(t.id,t)}return o.size>0&&e.emit(r.Events.MESSAGE_BULK_DELETE,o),{messages:o}}}t.exports=o},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client.users.get(t.user_id);if(!e)return!1;const n=this.client.channels.get(t.channel_id);if(!n||"voice"===n.type)return!1;const i=n.messages.get(t.message_id);if(!i)return!1;if(!t.emoji)return!1;const r=i._addReaction(t.emoji,e);return r&&this.client.emit(s.Events.MESSAGE_REACTION_ADD,r,e),{message:i,reaction:r,user:e}}}t.exports=r},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client.users.get(t.user_id);if(!e)return!1;const n=this.client.channels.get(t.channel_id);if(!n||"voice"===n.type)return!1;const i=n.messages.get(t.message_id);if(!i)return!1;if(!t.emoji)return!1;const r=i._removeReaction(t.emoji,e);return r&&this.client.emit(s.Events.MESSAGE_REACTION_REMOVE,r,e),{message:i,reaction:r,user:e}}}t.exports=r},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client.channels.get(t.channel_id);if(!e||"voice"===e.type)return!1;const n=e.messages.get(t.message_id);return!!n&&(n._clearReactions(),this.client.emit(s.Events.MESSAGE_REACTION_REMOVE_ALL,n),{message:n})}}t.exports=r},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client,n=e.channels.get(t.channel_id);if(n){const i=n.messages.get(t.id);if(i){const n=r(i);return i.patch(t),i._edits.unshift(n),e.emit(s.Events.MESSAGE_UPDATE,n,i),{old:n,updated:i}}return{old:i,updated:i}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client,n=e.dataManager.newUser(t);return{user:n}}}t.exports=s},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client,n=e.user.notes.get(t.id),i=t.note.length?t.note:null;return e.user.notes.set(t.id,i),e.emit(s.Events.USER_NOTE_UPDATE,t.id,n,i),{old:n,updated:i}}}t.exports=r},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client;if(e.user){if(e.user.equals(t))return{old:e.user,updated:e.user};const n=r(e.user);return e.user.patch(t),e.emit(s.Events.USER_UPDATE,n,e.user),{old:n,updated:e.user}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){const i=n(26),s=n(0);class r{constructor(t,e,n,i,s,r){this.rest=t,this.method=e,this.url=n,this.auth=i,this.data=s,this.file=r,this.route=this.getRoute(this.url)}getRoute(t){let e=t.split("?")[0];if(e.includes("/channels/")||e.includes("/guilds/")){const t=e.includes("/channels/")?e.indexOf("/channels/"):e.indexOf("/guilds/"),n=e.substring(t).split("/")[2];e=e.replace(/(\d{8,})/g,":id").replace(":id",n)}return e}getAuth(){if(this.rest.client.token&&this.rest.client.user&&this.rest.client.user.bot)return`Bot ${this.rest.client.token}`;if(this.rest.client.token)return this.rest.client.token;throw new Error(s.Errors.NO_TOKEN)}gen(){const t=i[this.method](this.url);return this.auth&&t.set("authorization",this.getAuth()),this.file&&this.file.file?(t.attach("file",this.file.file,this.file.name),this.data=this.data||{},t.field("payload_json",JSON.stringify(this.data))):this.data&&t.send(this.data),this.rest.client.browser||t.set("User-Agent",this.rest.userAgentManager.userAgent),t}}t.exports=r},function(t,e,n){const i=n(80),s=n(0),r=n(3),o=n(45),a=n(161),h=n(23),u=n(162),c=n(16),l=n(6),f=n(11),d=n(12),p=n(9),m=n(34),g=n(22),_=n(159),v=n(30),E=n(8),w=n(14);class b{constructor(t){this.rest=t,this.client=t.client}login(t=this.client.token){return new Promise((e,n)=>{if("string"!=typeof t)throw new Error(s.Errors.INVALID_TOKEN);t=t.replace(/^Bot\s*/i,""),this.client.manager.connectToWebSocket(t,e,n)})}logout(){return this.rest.makeRequest("post",s.Endpoints.logout,!0,{})}getGateway(){return this.rest.makeRequest("get",s.Endpoints.gateway,!0).then(t=>{return this.client.ws.gateway=`${t.url}/?v=${s.PROTOCOL_VERSION}`,this.client.ws.gateway})}getBotGateway(){return this.rest.makeRequest("get",s.Endpoints.botGateway,!0)}sendMessage(t,e,{tts,nonce,embed,disableEveryone,split,code,reply}={},n=null){return new Promise((i,r)=>{if("undefined"!=typeof e&&(e=this.client.resolver.resolveString(e)),e){if(split&&"object"!=typeof split&&(split={}),"undefined"==typeof code||"boolean"==typeof code&&code!==!0||(e=h(this.client.resolver.resolveString(e),!0),e=`\`\`\`${"boolean"!=typeof code?code||"":""}
${e}
-\`\`\``),(disableEveryone||"undefined"==typeof disableEveryone&&this.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@$1")),reply&&!(t instanceof c||t instanceof l)&&"dm"!==t.type){const t=this.client.resolver.resolveUserID(reply),n=`<@${reply instanceof l&&reply.nickname?"!":""}${t}>`;e=`${n}${e?`, ${e}`:""}`,split&&(split.prepend=`${n}, ${split.prepend||""}`)}split&&(e=o(e,split))}else if(reply&&!(t instanceof c||t instanceof l)&&"dm"!==t.type){const t=this.client.resolver.resolveUserID(reply);e=`<@${reply instanceof l&&reply.nickname?"!":""}${t}>`}const a=t=>{if(e instanceof Array){const s=[];!function e(r,o){const a=o===r.length?{tts:tts,embed:embed}:{tts:tts};t.send(r[o],a,o===r.length?n:null).then(t=>{return s.push(t),o>=r.length?i(s):e(r,++o)})}(e,0)}else this.rest.makeRequest("post",s.Endpoints.channelMessages(t.id),!0,{content:e,tts:tts,nonce:nonce,embed:embed},n).then(t=>i(this.client.actions.MessageCreate.handle(t).message),r)};t instanceof c||t instanceof l?this.createDM(t).then(a,r):a(t)})}updateMessage(t,e,{embed,code,reply}={}){if("undefined"!=typeof e&&(e=this.client.resolver.resolveString(e)),"undefined"==typeof code||"boolean"==typeof code&&code!==!0||(e=h(this.client.resolver.resolveString(e),!0),e=`\`\`\`${"boolean"!=typeof code?code||"":""}
+\`\`\``),(disableEveryone||"undefined"==typeof disableEveryone&&this.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@$1")),reply&&!(t instanceof l||t instanceof f)&&"dm"!==t.type){const t=this.client.resolver.resolveUserID(reply),n=`<@${reply instanceof f&&reply.nickname?"!":""}${t}>`;e=`${n}${e?`, ${e}`:""}`,split&&(split.prepend=`${n}, ${split.prepend||""}`)}split&&(e=o(e,split))}else if(reply&&!(t instanceof l||t instanceof f)&&"dm"!==t.type){const t=this.client.resolver.resolveUserID(reply);e=`<@${reply instanceof f&&reply.nickname?"!":""}${t}>`}const a=t=>{if(e instanceof Array){const s=[];!function e(r,o){const a=o===r.length?{tts:tts,embed:embed}:{tts:tts};t.send(r[o],a,o===r.length?n:null).then(t=>{return s.push(t),o>=r.length?i(s):e(r,++o)})}(e,0)}else this.rest.makeRequest("post",s.Endpoints.channelMessages(t.id),!0,{content:e,tts:tts,nonce:nonce,embed:embed},n).then(t=>i(this.client.actions.MessageCreate.handle(t).message),r)};t instanceof l||t instanceof f?this.createDM(t).then(a,r):a(t)})}updateMessage(t,e,{embed,code,reply}={}){if("undefined"!=typeof e&&(e=this.client.resolver.resolveString(e)),"undefined"==typeof code||"boolean"==typeof code&&code!==!0||(e=h(this.client.resolver.resolveString(e),!0),e=`\`\`\`${"boolean"!=typeof code?code||"":""}
${e}
-\`\`\``),reply&&"dm"!==t.channel.type){const t=this.client.resolver.resolveUserID(reply),n=`<@${reply instanceof l&&reply.nickname?"!":""}${t}>`;e=`${n}${e?`, ${e}`:""}`}return this.rest.makeRequest("patch",s.Endpoints.channelMessage(t.channel.id,t.id),!0,{content:e,embed:embed}).then(t=>this.client.actions.MessageUpdate.handle(t).updated)}deleteMessage(t){return this.rest.makeRequest("del",s.Endpoints.channelMessage(t.channel.id,t.id),!0).then(()=>this.client.actions.MessageDelete.handle({id:t.id,channel_id:t.channel.id}).message)}bulkDeleteMessages(t,e){return this.rest.makeRequest("post",`${s.Endpoints.channelMessages(t.id)}/bulk_delete`,!0,{messages:e}).then(()=>this.client.actions.MessageDeleteBulk.handle({channel_id:t.id,ids:e}).messages)}search(t,e){e=u(e,this.client);const n=i.stringify(e);let r;if(t instanceof v)r="channel";else{if(!(t instanceof E))throw new TypeError("Target must be a TextChannel, DMChannel, GroupDMChannel, or Guild.");r="guild"}const o=`${s.Endpoints[`${r}Search`](t.id)}?${n}`;return this.rest.makeRequest("get",o,!0).then(t=>{const e=t.messages.map(t=>t.map(t=>new f(this.client.channels.get(t.channel_id),t,this.client)));return{totalResults:t.total_results,messages:e}})}createChannel(t,e,n,i){return i instanceof r&&(i=i.array()),this.rest.makeRequest("post",s.Endpoints.guildChannels(t.id),!0,{name:e,type:n,permission_overwrites:i}).then(t=>this.client.actions.ChannelCreate.handle(t).channel)}createDM(t){const e=this.getExistingDM(t);return e?Promise.resolve(e):this.rest.makeRequest("post",s.Endpoints.userChannels(this.client.user.id),!0,{recipient_id:t.id}).then(t=>this.client.actions.ChannelCreate.handle(t).channel)}getExistingDM(t){return this.client.channels.find(e=>e.recipient&&e.recipient.id===t.id)}deleteChannel(t){return(t instanceof c||t instanceof l)&&(t=this.getExistingDM(t)),t?this.rest.makeRequest("del",s.Endpoints.channel(t.id),!0).then(e=>{return e.id=t.id,this.client.actions.ChannelDelete.handle(e).channel}):Promise.reject(new Error("No channel to delete."))}updateChannel(t,e){const n={};return n.name=(e.name||t.name).trim(),n.topic=e.topic||t.topic,n.position=e.position||t.position,n.bitrate=e.bitrate||t.bitrate,n.user_limit=e.userLimit||t.userLimit,this.rest.makeRequest("patch",s.Endpoints.channel(t.id),!0,n).then(t=>this.client.actions.ChannelUpdate.handle(t).updated)}leaveGuild(t){return t.ownerID===this.client.user.id?Promise.reject(new Error("Guild is owned by the client.")):this.rest.makeRequest("del",s.Endpoints.meGuild(t.id),!0).then(()=>this.client.actions.GuildDelete.handle({id:t.id}).guild)}createGuild(t){return t.icon=this.client.resolver.resolveBase64(t.icon)||null,t.region=t.region||"us-central",new Promise((e,n)=>{this.rest.makeRequest("post",s.Endpoints.guilds,!0,t).then(t=>{if(this.client.guilds.has(t.id))return void e(this.client.guilds.get(t.id));const i=n=>{n.id===t.id&&(this.client.removeListener("guildCreate",i),this.client.clearTimeout(s),e(n))};this.client.on("guildCreate",i);const s=this.client.setTimeout(()=>{this.client.removeListener("guildCreate",i),n(new Error("Took too long to receive guild data."))},1e4)},n)})}deleteGuild(t){return this.rest.makeRequest("del",s.Endpoints.guild(t.id),!0).then(()=>this.client.actions.GuildDelete.handle({id:t.id}).guild)}getUser(t){return this.rest.makeRequest("get",s.Endpoints.user(t),!0).then(t=>this.client.actions.UserGet.handle(t).user)}updateCurrentUser(t,e){const n=this.client.user,i={};return i.username=t.username||n.username,i.avatar=this.client.resolver.resolveBase64(t.avatar)||n.avatar,n.bot||(i.email=t.email||n.email,i.password=e,t.new_password&&(i.new_password=t.newPassword)),this.rest.makeRequest("patch",s.Endpoints.me,!0,i).then(t=>this.client.actions.UserUpdate.handle(t).updated)}updateGuild(t,e){const n={};return e.name&&(n.name=e.name),e.region&&(n.region=e.region),e.verificationLevel&&(n.verification_level=Number(e.verificationLevel)),e.afkChannel&&(n.afk_channel_id=this.client.resolver.resolveChannel(e.afkChannel).id),e.afkTimeout&&(n.afk_timeout=Number(e.afkTimeout)),e.icon&&(n.icon=this.client.resolver.resolveBase64(e.icon)),e.owner&&(n.owner_id=this.client.resolver.resolveUser(e.owner).id),e.splash&&(n.splash=this.client.resolver.resolveBase64(e.splash)),this.rest.makeRequest("patch",s.Endpoints.guild(t.id),!0,n).then(t=>this.client.actions.GuildUpdate.handle(t).updated)}kickGuildMember(t,e){return this.rest.makeRequest("del",s.Endpoints.guildMember(t.id,e.id),!0).then(()=>this.client.actions.GuildMemberRemove.handle({guild_id:t.id,user:e.user}).member)}createGuildRole(t){return this.rest.makeRequest("post",s.Endpoints.guildRoles(t.id),!0).then(e=>this.client.actions.GuildRoleCreate.handle({guild_id:t.id,role:e}).role)}deleteGuildRole(t){return this.rest.makeRequest("del",s.Endpoints.guildRole(t.guild.id,t.id),!0).then(()=>this.client.actions.GuildRoleDelete.handle({guild_id:t.guild.id,role_id:t.id}).role)}setChannelOverwrite(t,e){return this.rest.makeRequest("put",`${s.Endpoints.channelPermissions(t.id)}/${e.id}`,!0,e)}deletePermissionOverwrites(t){return this.rest.makeRequest("del",`${s.Endpoints.channelPermissions(t.channel.id)}/${t.id}`,!0).then(()=>t)}getChannelMessages(t,e={}){const n=[];e.limit&&n.push(`limit=${e.limit}`),e.around?n.push(`around=${e.around}`):e.before?n.push(`before=${e.before}`):e.after&&n.push(`after=${e.after}`);let i=s.Endpoints.channelMessages(t.id);return n.length>0&&(i+=`?${n.join("&")}`),this.rest.makeRequest("get",i,!0)}getChannelMessage(t,e){const n=t.messages.get(e);return n?Promise.resolve(n):this.rest.makeRequest("get",s.Endpoints.channelMessage(t.id,e),!0)}getGuildMember(t,e){return this.rest.makeRequest("get",s.Endpoints.guildMember(t.id,e.id),!0).then(e=>this.client.actions.GuildMemberGet.handle(t,e).member)}updateGuildMember(t,e){e.channel&&(e.channel_id=this.client.resolver.resolveChannel(e.channel).id),e.roles&&(e.roles=e.roles.map(t=>t instanceof d?t.id:t));let n=s.Endpoints.guildMember(t.guild.id,t.id);if(t.id===this.client.user.id){const i=Object.keys(e);1===i.length&&"nick"===i[0]&&(n=s.Endpoints.guildMemberNickname(t.guild.id))}return this.rest.makeRequest("patch",n,!0,e).then(e=>t.guild._updateMember(t,e).mem)}addMemberRole(t,e){return this.rest.makeRequest("put",s.Endpoints.guildMemberRole(t.guild.id,t.id,e.id),!0).then(()=>{return t._roles.includes(e.id)||t._roles.push(e.id),t})}removeMemberRole(t,e){return this.rest.makeRequest("delete",s.Endpoints.guildMemberRole(t.guild.id,t.id,e.id),!0).then(()=>{const n=t._roles.indexOf(e.id);return n>=0&&t._roles.splice(n,1),t})}sendTyping(t){return this.rest.makeRequest("post",`${s.Endpoints.channel(t)}/typing`,!0)}banGuildMember(t,e,n=0){const i=this.client.resolver.resolveUserID(e);return i?this.rest.makeRequest("put",`${s.Endpoints.guildBans(t.id)}/${i}?delete-message-days=${n}`,!0,{"delete-message-days":n}).then(()=>{if(e instanceof l)return e;const n=this.client.resolver.resolveUser(i);return n?(e=this.client.resolver.resolveGuildMember(t,n),e||n):i}):Promise.reject(new Error("Couldn't resolve the user ID to ban."))}unbanGuildMember(t,e){return new Promise((n,i)=>{const r=this.client.resolver.resolveUserID(e);if(!r)throw new Error("Couldn't resolve the user ID to unban.");const o=(e,i)=>{e.id===t.id&&i.id===r&&(this.client.removeListener(s.Events.GUILD_BAN_REMOVE,o),this.client.clearTimeout(a),n(i))};this.client.on(s.Events.GUILD_BAN_REMOVE,o);const a=this.client.setTimeout(()=>{this.client.removeListener(s.Events.GUILD_BAN_REMOVE,o),i(new Error("Took too long to receive the ban remove event."))},1e4);this.rest.makeRequest("del",`${s.Endpoints.guildBans(t.id)}/${r}`,!0).catch(t=>{this.client.removeListener(s.Events.GUILD_BAN_REMOVE,o),this.client.clearTimeout(a),i(t)})})}getGuildBans(t){return this.rest.makeRequest("get",s.Endpoints.guildBans(t.id),!0).then(t=>{const e=new r;for(const n of t){const t=this.client.dataManager.newUser(n.user);e.set(t.id,t)}return e})}updateGuildRole(t,e){const n={};if(n.name=e.name||t.name,n.position="undefined"!=typeof e.position?e.position:t.position,n.color=this.client.resolver.resolveColor(e.color||t.color),n.hoist="undefined"!=typeof e.hoist?e.hoist:t.hoist,n.mentionable="undefined"!=typeof e.mentionable?e.mentionable:t.mentionable,e.permissions){let t=0;for(let i of e.permissions)"string"==typeof i&&(i=s.PermissionFlags[i]),t|=i;n.permissions=t}else n.permissions=t.permissions;return this.rest.makeRequest("patch",s.Endpoints.guildRole(t.guild.id,t.id),!0,n).then(e=>this.client.actions.GuildRoleUpdate.handle({role:e,guild_id:t.guild.id}).updated)}pinMessage(t){return this.rest.makeRequest("put",`${s.Endpoints.channel(t.channel.id)}/pins/${t.id}`,!0).then(()=>t)}unpinMessage(t){return this.rest.makeRequest("del",`${s.Endpoints.channel(t.channel.id)}/pins/${t.id}`,!0).then(()=>t)}getChannelPinnedMessages(t){return this.rest.makeRequest("get",`${s.Endpoints.channel(t.id)}/pins`,!0)}createChannelInvite(t,e){const n={};return n.temporary=e.temporary,n.max_age=e.maxAge,n.max_uses=e.maxUses,this.rest.makeRequest("post",`${s.Endpoints.channelInvites(t.id)}`,!0,n).then(t=>new p(this.client,t))}deleteInvite(t){return this.rest.makeRequest("del",s.Endpoints.invite(t.code),!0).then(()=>t)}getInvite(t){return this.rest.makeRequest("get",s.Endpoints.invite(t),!0).then(t=>new p(this.client,t))}getGuildInvites(t){return this.rest.makeRequest("get",s.Endpoints.guildInvites(t.id),!0).then(t=>{const e=new r;for(const n of t){const t=new p(this.client,n);e.set(t.code,t)}return e})}pruneGuildMembers(t,e,n){return this.rest.makeRequest(n?"get":"post",`${s.Endpoints.guildPrune(t.id)}?days=${e}`,!0).then(t=>t.pruned)}createEmoji(t,e,n){return this.rest.makeRequest("post",`${s.Endpoints.guildEmojis(t.id)}`,!0,{name:n,image:e}).then(e=>this.client.actions.EmojiCreate.handle(e,t).emoji)}deleteEmoji(t){return this.rest.makeRequest("delete",`${s.Endpoints.guildEmojis(t.guild.id)}/${t.id}`,!0).then(()=>this.client.actions.EmojiDelete.handle(t).data)}getWebhook(t,e){return this.rest.makeRequest("get",s.Endpoints.webhook(t,e),!e).then(t=>new m(this.client,t))}getGuildWebhooks(t){return this.rest.makeRequest("get",s.Endpoints.guildWebhooks(t.id),!0).then(t=>{const e=new r;for(const n of t)e.set(n.id,new m(this.client,n));return e})}getChannelWebhooks(t){return this.rest.makeRequest("get",s.Endpoints.channelWebhooks(t.id),!0).then(t=>{const e=new r;for(const n of t)e.set(n.id,new m(this.client,n));return e})}createWebhook(t,e,n){return this.rest.makeRequest("post",s.Endpoints.channelWebhooks(t.id),!0,{name:e,avatar:n}).then(t=>new m(this.client,t))}editWebhook(t,e,n){return this.rest.makeRequest("patch",s.Endpoints.webhook(t.id,t.token),!1,{name:e,avatar:n}).then(e=>{return t.name=e.name,t.avatar=e.avatar,t})}deleteWebhook(t){return this.rest.makeRequest("delete",s.Endpoints.webhook(t.id,t.token),!1)}sendWebhookMessage(t,e,{avatarURL,tts,disableEveryone,embeds,username}={},n=null){return username=username||t.name,"undefined"!=typeof e&&(e=this.client.resolver.resolveString(e)),e&&(disableEveryone||"undefined"==typeof disableEveryone&&this.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@$1")),this.rest.makeRequest("post",`${s.Endpoints.webhook(t.id,t.token)}?wait=true`,!1,{username:username,avatar_url:avatarURL,content:e,tts:tts,embeds:embeds},n)}sendSlackWebhookMessage(t,e){return this.rest.makeRequest("post",`${s.Endpoints.webhook(t.id,t.token)}/slack?wait=true`,!1,e)}fetchUserProfile(t){return this.rest.makeRequest("get",s.Endpoints.userProfile(t.id),!0).then(e=>new g(t,e))}fetchMeMentions(t){return t.guild&&(t.guild=t.guild.id?t.guild.id:t.guild),this.rest.makeRequest("get",s.Endpoints.meMentions(t.limit,t.roles,t.everyone,t.guild)).then(t=>t.body.map(t=>new f(this.client.channels.get(t.channel_id),t,this.client)))}addFriend(t){return this.rest.makeRequest("post",s.Endpoints.relationships("@me"),!0,{username:t.username,discriminator:t.discriminator}).then(()=>t)}removeFriend(t){return this.rest.makeRequest("delete",`${s.Endpoints.relationships("@me")}/${t.id}`,!0).then(()=>t)}blockUser(t){return this.rest.makeRequest("put",`${s.Endpoints.relationships("@me")}/${t.id}`,!0,{type:2}).then(()=>t)}unblockUser(t){return this.rest.makeRequest("delete",`${s.Endpoints.relationships("@me")}/${t.id}`,!0).then(()=>t)}setRolePositions(t,e){return this.rest.makeRequest("patch",s.Endpoints.guildRoles(t),!0,e).then(()=>this.client.actions.GuildRolesPositionUpdate.handle({guild_id:t,roles:e}).guild)}addMessageReaction(t,e){return this.rest.makeRequest("put",s.Endpoints.selfMessageReaction(t.channel.id,t.id,e),!0).then(()=>this.client.actions.MessageReactionAdd.handle({user_id:this.client.user.id,message_id:t.id,emoji:a(e),channel_id:t.channel.id}).reaction)}removeMessageReaction(t,e,n){let i=s.Endpoints.selfMessageReaction(t.channel.id,t.id,e);return n!==this.client.user.id&&(i=s.Endpoints.userMessageReaction(t.channel.id,t.id,e,null,n.id)),this.rest.makeRequest("delete",i,!0).then(()=>this.client.actions.MessageReactionRemove.handle({user_id:n,message_id:t.id,emoji:a(e),channel_id:t.channel.id}).reaction)}removeMessageReactions(t){return this.rest.makeRequest("delete",s.Endpoints.messageReactions(t.channel.id,t.id),!0).then(()=>t)}getMessageReactionUsers(t,e,n=100){return this.rest.makeRequest("get",s.Endpoints.messageReaction(t.channel.id,t.id,e,n),!0)}getMyApplication(){return this.rest.makeRequest("get",s.Endpoints.myApplication,!0).then(t=>new _(this.client,t))}setNote(t,e){return this.rest.makeRequest("put",s.Endpoints.note(t.id),!0,{note:e}).then(()=>t)}}t.exports=w},function(t,e,n){const i=n(55);class s extends i{constructor(t,e){super(t,e),this.requestRemaining=1,this.first=!0}push(t){super.push(t),this.handle()}handleNext(t){this.waiting||(this.waiting=!0,this.restManager.client.setTimeout(()=>{this.requestRemaining=this.requestLimit,this.waiting=!1,this.handle()},t))}execute(t){t.request.gen().end((e,n)=>{if(n&&n.headers&&(this.requestLimit=n.headers["x-ratelimit-limit"],this.requestResetTime=1e3*Number(n.headers["x-ratelimit-reset"]),this.requestRemaining=Number(n.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(n.headers.date).getTime(),this.handleNext(this.requestResetTime-Date.now()+this.timeDifference+this.restManager.client.options.restTimeOffset)),e)429===e.status?(this.requestRemaining=0,this.queue.unshift(t),this.restManager.client.setTimeout(()=>{this.globalLimit=!1,this.handle()},Number(n.headers["retry-after"])+this.restManager.client.options.restTimeOffset),n.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):t.reject(e);else{this.globalLimit=!1;const e=n&&n.body?n.body:{};t.resolve(e),this.first&&(this.first=!1,this.handle())}})}handle(){if(super.handle(),!(this.requestRemaining<1||0===this.queue.length||this.globalLimit))for(;this.queue.length>0&&this.requestRemaining>0;)this.execute(this.queue.shift()),this.requestRemaining--}}t.exports=s},function(t,e,n){const i=n(55);class s extends i{constructor(t,e){super(t,e),this.waiting=!1,this.endpoint=e,this.timeDifference=0}push(t){super.push(t),this.handle()}execute(t){return new Promise(e=>{t.request.gen().end((n,i)=>{if(i&&i.headers&&(this.requestLimit=i.headers["x-ratelimit-limit"],this.requestResetTime=1e3*Number(i.headers["x-ratelimit-reset"]),this.requestRemaining=Number(i.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(i.headers.date).getTime()),n)429===n.status?(this.restManager.client.setTimeout(()=>{this.waiting=!1,this.globalLimit=!1,e()},Number(i.headers["retry-after"])+this.restManager.client.options.restTimeOffset),i.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):(this.queue.shift(),this.waiting=!1,t.reject(n),e(n));else{this.queue.shift(),this.globalLimit=!1;const n=i&&i.body?i.body:{};t.resolve(n),0===this.requestRemaining?this.restManager.client.setTimeout(()=>{this.waiting=!1,e(n)},this.requestResetTime-Date.now()+this.timeDifference+this.restManager.client.options.restTimeOffset):(this.waiting=!1,e(n))}})})}handle(){if(super.handle(),!this.waiting&&0!==this.queue.length&&!this.globalLimit){this.waiting=!0;const t=this.queue[0];this.execute(t).then(()=>this.handle())}}}t.exports=s},function(t,e,n){const i=n(0);class s{constructor(t){this.restManager=t,this._userAgent={url:"https://github.com/hydrabolt/discord.js",version:i.Package.version}}set(t){this._userAgent.url=t.url||"https://github.com/hydrabolt/discord.js",this._userAgent.version=t.version||i.Package.version}get userAgent(){return`DiscordBot (${this._userAgent.url}, ${this._userAgent.version})`}}t.exports=s},function(t,e,n){(function(e,i){const s=n(17).EventEmitter,r=n(166),o=n(165),a=n(3),h=["-analyzeduration","0","-loglevel","0","-f","s16le","-ar","48000","-ac","2"];class u extends s{constructor(t){super(),this.client=t,this._dispatchers=new a,this._encoders=new a,this.prism=new r,this.currentTranscoder=null,this.tickInterval=null,this._volume=1}get dispatchers(){let t=[];for(const e of this._dispatchers.values())t=t.concat(Array.from(e.values()));return t}applyVolume(t,n=this._volume){if(1===n)return t;const i=e.alloc(t.length);for(let s=0;s=t.length-1);s+=2){const e=Math.min(32767,Math.max(-32767,Math.floor(n*t.readInt16LE(s))));i.writeInt16LE(e,s)}return i}setVolume(t){this._volume=t}setVolumeDecibels(t){this.setVolume(Math.pow(10,t/20))}setVolumeLogarithmic(t){this.setVolume(Math.pow(t,1.660964))}get volume(){return this._volume}get _playableStream(){return this.currentTranscoder?this.currentTranscoder.transcoder.output||this.currentTranscoder.options.stream:null}unregisterDispatcher(t,e){const n=e||t.volume;this.emit("unsubscribe",t);for(const i of this._dispatchers.values())i.delete(t),i.size||(this._dispatchers.delete(n),this._encoders.delete(n))}registerDispatcher(t){this._dispatchers.has(t.volume)||(this._dispatchers.set(t.volume,new Set),this._encoders.set(t.volume,o.fetch()));const e=this._dispatchers.get(t.volume);e.has(t)||(e.add(t),t.once("end",()=>this.unregisterDispatcher(t)),t.on("volumeChange",(e,n)=>{this.unregisterDispatcher(t,e),this._dispatchers.has(n)||(this._dispatchers.set(n,new Set),this._encoders.set(n,o.fetch())),this._dispatchers.get(n).add(t)}),this.emit("subscribe",t))}killCurrentTranscoder(){this.currentTranscoder&&(this.currentTranscoder.transcoder&&this.currentTranscoder.transcoder.kill(),this.currentTranscoder=null,this.emit("end"))}playStream(t,{seek=0,volume=1,passes=1}={}){const e={seek:seek,volume:volume,passes:passes};return e.stream=t,this._playTranscodable(t,e)}playFile(t,{seek=0,volume=1,passes=1}={}){const e={seek:seek,volume:volume,passes:passes};return this._playTranscodable(`file:${t}`,e)}_playTranscodable(t,e){this.killCurrentTranscoder();const n=this.prism.transcode({type:"ffmpeg",media:t,ffmpegArguments:h.concat(["-ss",String(e.seek)])});return n.once("error",t=>{this.listenerCount("error")>0?this.emit("error",t):this.emit("warn",t)}),n.once("end",()=>this.killCurrentTranscoder()),this.currentTranscoder={transcoder:n,options:e},n.output.once("readable",()=>this._startPlaying()),this}playConvertedStream(t,{seek=0,volume=1,passes=1}={}){this.killCurrentTranscoder();const e={seek:seek,volume:volume,passes:passes,stream:t};return this.currentTranscoder={options:e},t.once("readable",()=>this._startPlaying()),this}playArbitraryInput(t,{seek=0,volume=1,passes=1}={}){const e={seek:seek,volume:volume,passes:passes};return this.player.playUnknownStream(t,e)}pause(){this.paused=!0;for(const t of this._dispatchers.values())for(const e of t.values())e.pause()}resume(){this.paused=!1;for(const t of this._dispatchers.values())for(const e of t.values())e.resume()}_startPlaying(){this.tickInterval&&clearInterval(this.tickInterval),this._startTime=Date.now(),this._count=0,this._pausedTime=0,this._missed=0,this.tick()}tick(){if(this._playableStream){if(this.paused)return this._pausedTime+=20,void setTimeout(()=>this.tick(),20);const t=this._playableStream,n=3840;let s=t.read(n);if(!s)return this._missed++,void(this._missed<5?(this._pausedTime+=200,setTimeout(()=>this.tick(),200)):this.killCurrentTranscoder());if(this._missed=0,s.length!==n){const t=e.alloc(n).fill(0);s.copy(t),s=t}let r={};const o=t=>{if(r[t])return r[t];const e=this._encoders.get(t),n=e.encode(this.applyVolume(s,this._volume*t));return r[t]=n,n};for(const a of this.dispatchers){const t=a.volume;i(()=>{a.process(s,!0,o(t))})}const h=20+(this._startTime+this._pausedTime+20*this._count-Date.now());this._count++,setTimeout(()=>this.tick(),h)}}end(){this.killCurrentTranscoder()}destroy(){this.end();for(const t of this._dispatchers.values())for(const e of t.values())e.destroy("end","broadcast ended")}}t.exports=u}).call(e,n(16).Buffer,n(86).setImmediate)},function(t,e,n){(function(e){const i="undefined"!=typeof window,s=n(17).EventEmitter,r=n(0),o=n(56),a=n(69),h=n(53),u=n(123);let c,l,f=JSON.stringify;if(i)c=window.WebSocket;else{try{c=n(168)}catch(t){c=n(169)}try{l=n(167),f=l.pack}catch(t){l=null}}class d extends s{constructor(t){super(),this.client=t,this.packetManager=new u(this),this.status=r.Status.IDLE,this.sessionID=null,this.sequence=-1,this.gateway=null,this.normalReady=!1,this.ws=null,this.disabledEvents={};for(const e of t.options.disabledEvents)this.disabledEvents[e]=!0;this.first=!0,this.lastHeartbeatAck=!0}_connect(t){this.client.emit("debug",`Connecting to gateway ${t}`),this.normalReady=!1,this.status!==r.Status.RECONNECTING&&(this.status=r.Status.CONNECTING),this.ws=new c(t),i&&(this.ws.binaryType="arraybuffer"),this.ws.onopen=this.eventOpen.bind(this),this.ws.onmessage=this.eventMessage.bind(this),this.ws.onclose=this.eventClose.bind(this),this.ws.onerror=this.eventError.bind(this),this._queue=[],this._remaining=120,this.client.setInterval(()=>{this._remaining=120,this._remainingReset=Date.now()},6e4)}connect(t){t=`${t}&encoding=${l?"etf":"json"}`,this.first?(this._connect(t),this.first=!1):this.client.setTimeout(()=>this._connect(t),5500)}heartbeat(t){return t&&!this.lastHeartbeatAck?void this.ws.close(1007):(this.client.emit("debug","Sending heartbeat"),this.client._pingTimestamp=Date.now(),this.client.ws.send({op:r.OPCodes.HEARTBEAT,d:this.sequence},!0),void(this.lastHeartbeatAck=!1))}send(t,e=false){return e?void this._send(f(t)):(this._queue.push(f(t)),void this.doQueue())}destroy(){this.ws.close(1e3),this._queue=[],this.status=r.Status.IDLE}_send(t){this.ws.readyState===c.OPEN&&(this.emit("send",t),this.ws.send(t))}doQueue(){const t=this._queue[0];if(this.ws.readyState===c.OPEN&&t){if(0===this.remaining)return void this.client.setTimeout(this.doQueue.bind(this),Date.now()-this.remainingReset);this._remaining--,this._send(t),this._queue.shift(),this.doQueue()}}eventOpen(){this.client.emit("debug","Connection to gateway opened"),this.lastHeartbeatAck=!0,this.status===r.Status.RECONNECTING?this._sendResume():this._sendNewIdentify()}_sendResume(){if(!this.sessionID)return void this._sendNewIdentify();this.client.emit("debug","Identifying as resumed session");const t={token:this.client.token,session_id:this.sessionID,seq:this.sequence};this.send({op:r.OPCodes.RESUME,d:t})}_sendNewIdentify(){this.reconnecting=!1;const t=this.client.options.ws;t.token=this.client.token,this.client.options.shardCount>0&&(t.shard=[Number(this.client.options.shardId),Number(this.client.options.shardCount)]),this.client.emit("debug","Identifying as new session"),this.send({op:r.OPCodes.IDENTIFY,d:t}),this.sequence=-1}eventClose(t){this.emit("close",t),this.client.clearInterval(this.client.manager.heartbeatInterval),this.status=r.Status.DISCONNECTED,this._queue=[],this.reconnecting||this.client.emit(r.Events.DISCONNECT,t),[4004,4010,4011].includes(t.code)||this.reconnecting||1e3===t.code||this.tryReconnect()}eventMessage(t){const e=this.tryParseEventData(t.data);return null===e?(this.eventError(new Error(r.Errors.BAD_WS_MESSAGE)),!1):(this.client.emit("raw",e),e.op===r.OPCodes.HELLO&&this.client.manager.setupKeepAlive(e.d.heartbeat_interval),this.packetManager.handle(e))}parseEventData(t){return l?(t instanceof ArrayBuffer&&(t=o(t)),l.unpack(t)):(t instanceof ArrayBuffer?t=a.inflate(t,{to:"string"}):t instanceof e&&(t=h.inflateSync(t).toString()),JSON.parse(t))}tryParseEventData(t){try{return this.parseEventData(t)}catch(t){return null}}eventError(t){this.client.listenerCount("error")>0&&this.client.emit("error",t),this.tryReconnect()}_emitReady(t=true){this.status=r.Status.READY,this.client.emit(r.Events.READY),this.packetManager.handleQueue(),this.normalReady=t}checkIfReady(){if(this.status!==r.Status.READY&&this.status!==r.Status.NEARLY){let t=0;for(const e of this.client.guilds.keys())t+=this.client.guilds.get(e).available?0:1;if(0===t){if(this.status=r.Status.NEARLY,this.client.options.fetchAllMembers){const t=this.client.guilds.map(t=>t.fetchMembers());return void Promise.all(t).then(()=>this._emitReady(),t=>{this.client.emit(r.Events.WARN,"Error in pre-ready guild member fetching"),this.client.emit(r.Events.ERROR,t),this._emitReady()})}this._emitReady()}}}tryReconnect(){this.status!==r.Status.RECONNECTING&&this.status!==r.Status.CONNECTING&&(this.status=r.Status.RECONNECTING,this.ws.close(),this.packetManager.handleQueue(),this.client.emit(r.Events.RECONNECTING),this.connect(this.client.ws.gateway))}}t.exports=d}).call(e,n(16).Buffer)},function(t,e,n){const i=n(0),s=[i.WSEvents.READY,i.WSEvents.GUILD_CREATE,i.WSEvents.GUILD_DELETE,i.WSEvents.GUILD_MEMBERS_CHUNK,i.WSEvents.GUILD_MEMBER_ADD,i.WSEvents.GUILD_MEMBER_REMOVE];class r{constructor(t){this.ws=t,this.handlers={},this.queue=[],this.register(i.WSEvents.READY,n(150)),this.register(i.WSEvents.GUILD_CREATE,n(130)),this.register(i.WSEvents.GUILD_DELETE,n(131)),this.register(i.WSEvents.GUILD_UPDATE,n(141)),this.register(i.WSEvents.GUILD_BAN_ADD,n(128)),this.register(i.WSEvents.GUILD_BAN_REMOVE,n(129)),this.register(i.WSEvents.GUILD_MEMBER_ADD,n(133)),this.register(i.WSEvents.GUILD_MEMBER_REMOVE,n(134)),this.register(i.WSEvents.GUILD_MEMBER_UPDATE,n(135)),this.register(i.WSEvents.GUILD_ROLE_CREATE,n(137)),this.register(i.WSEvents.GUILD_ROLE_DELETE,n(138)),this.register(i.WSEvents.GUILD_ROLE_UPDATE,n(139)),this.register(i.WSEvents.GUILD_EMOJIS_UPDATE,n(132)),this.register(i.WSEvents.GUILD_MEMBERS_CHUNK,n(136)),this.register(i.WSEvents.CHANNEL_CREATE,n(124)),this.register(i.WSEvents.CHANNEL_DELETE,n(125)),this.register(i.WSEvents.CHANNEL_UPDATE,n(127)),this.register(i.WSEvents.CHANNEL_PINS_UPDATE,n(126)),this.register(i.WSEvents.PRESENCE_UPDATE,n(149)),this.register(i.WSEvents.USER_UPDATE,n(155)),this.register(i.WSEvents.USER_NOTE_UPDATE,n(154)),this.register(i.WSEvents.VOICE_STATE_UPDATE,n(157)),this.register(i.WSEvents.TYPING_START,n(153)),this.register(i.WSEvents.MESSAGE_CREATE,n(142)),this.register(i.WSEvents.MESSAGE_DELETE,n(143)),this.register(i.WSEvents.MESSAGE_UPDATE,n(148)),this.register(i.WSEvents.MESSAGE_DELETE_BULK,n(144)),this.register(i.WSEvents.VOICE_SERVER_UPDATE,n(156)),this.register(i.WSEvents.GUILD_SYNC,n(140)),this.register(i.WSEvents.RELATIONSHIP_ADD,n(151)),this.register(i.WSEvents.RELATIONSHIP_REMOVE,n(152)),this.register(i.WSEvents.MESSAGE_REACTION_ADD,n(145)),this.register(i.WSEvents.MESSAGE_REACTION_REMOVE,n(146)),this.register(i.WSEvents.MESSAGE_REACTION_REMOVE_ALL,n(147))}get client(){return this.ws.client}register(t,e){this.handlers[t]=new e(this)}handleQueue(){this.queue.forEach((t,e)=>{this.handle(this.queue[e]),this.queue.splice(e,1)})}setSequence(t){t&&t>this.ws.sequence&&(this.ws.sequence=t)}handle(t){return t.op===i.OPCodes.RECONNECT?(this.setSequence(t.s),this.ws.tryReconnect(),!1):t.op===i.OPCodes.INVALID_SESSION?(t.d?setTimeout(()=>{this.ws._sendResume()},2500):(this.ws.sessionID=null,this.ws._sendNewIdentify()),!1):(t.op===i.OPCodes.HEARTBEAT_ACK?(this.ws.client._pong(this.ws.client._pingTimestamp),this.ws.lastHeartbeatAck=!0,this.ws.client.emit("debug","Heartbeat acknowledged")):t.op===i.OPCodes.HEARTBEAT&&(this.client.ws.send({op:i.OPCodes.HEARTBEAT,d:this.client.ws.sequence}),this.ws.client.emit("debug","Received gateway heartbeat")),this.ws.status===i.Status.RECONNECTING&&(this.ws.reconnecting=!1,this.ws.checkIfReady()),this.setSequence(t.s),void 0===this.ws.disabledEvents[t.t]&&(this.ws.status!==i.Status.READY&&s.indexOf(t.t)===-1?(this.queue.push(t),!1):!!this.handlers[t.t]&&this.handlers[t.t].handle(t)))}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.ChannelCreate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.ChannelDelete.handle(n);i.channel&&e.emit(s.Events.CHANNEL_DELETE,i.channel)}}t.exports=r},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.channels.get(n.channel_id),r=new Date(n.last_pin_timestamp);i&&r&&e.emit(s.Events.CHANNEL_PINS_UPDATE,i,r)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.ChannelUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id),r=e.users.get(n.user.id);i&&r&&e.emit(s.Events.GUILD_BAN_ADD,i,r)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildBanRemove.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.id);i?i.available||n.unavailable||(i.setup(n),this.packetManager.ws.checkIfReady()):e.dataManager.newGuild(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.GuildDelete.handle(n);i.guild&&e.emit(s.Events.GUILD_DELETE,i.guild)}}t.exports=r},function(t,e,n){function i(t){const e=new Map;for(const n of t)e.set(...n);return e}const s=n(1);class r extends s{handle(t){const e=this.packetManager.client,n=t.d,s=e.guilds.get(n.guild_id);if(s&&s.emojis){const t=i(s.emojis.entries());for(const r of n.emojis){const n=s.emojis.get(r.id);n?(t.delete(r.id),n.equals(r,!0)||e.actions.GuildEmojiUpdate.handle(n,r)):e.actions.GuildEmojiCreate.handle(s,r)}for(const r of t.values())e.actions.GuildEmojiDelete.handle(r)}}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);i&&(i.memberCount++,i._addMember(n))}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildMemberRemove.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);if(i){const t=i.members.get(n.user.id);t&&i._updateMember(t,n)}}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);if(i){const t=n.members.map(t=>i._addMember(t,!1));i._checkChunks(),e.emit(s.Events.GUILD_MEMBERS_CHUNK,t),e.ws.lastHeartbeatAck=!0}}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildRoleCreate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildRoleDelete.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildRoleUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildSync.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.MessageCreate.handle(n);i.message&&e.emit(s.Events.MESSAGE_CREATE,i.message);
-}}t.exports=r},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.MessageDelete.handle(n);i.message&&e.emit(s.Events.MESSAGE_DELETE,i.message)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageDeleteBulk.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageReactionAdd.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageReactionRemove.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageReactionRemoveAll.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0),r=n(4);class o extends i{handle(t){const e=this.packetManager.client,n=t.d;let i=e.users.get(n.user.id);const o=e.guilds.get(n.guild_id);if(!i){if(!n.user.username)return;i=e.dataManager.newUser(n.user)}const a=r(i);if(i.patch(n.user),i.equals(a)||e.emit(s.Events.USER_UPDATE,a,i),o){let t=o.members.get(i.id);if(t||"offline"===n.status||(t=o._addMember({user:i,roles:n.roles,deaf:!1,mute:!1},!1),e.emit(s.Events.GUILD_MEMBER_AVAILABLE,t)),t){if(0===e.listenerCount(s.Events.PRESENCE_UPDATE))return void o._setPresence(i.id,n);const a=r(t);t.presence&&(a.frozenPresence=r(t.presence)),o._setPresence(i.id,n),e.emit(s.Events.PRESENCE_UPDATE,a,t)}else o._setPresence(i.id,n)}}}t.exports=o},function(t,e,n){const i=n(1),s=n(31);class r extends i{handle(t){const e=this.packetManager.client,n=t.d;e.ws.heartbeat();const i=new s(e,n.user);i.settings=n.user_settings,e.user=i,e.readyAt=new Date,e.users.set(i.id,i);for(const r of n.guilds)e.dataManager.newGuild(r);for(const o of n.private_channels)e.dataManager.newChannel(o);for(const a of n.relationships){const t=e.dataManager.newUser(a.user);1===a.type?e.user.friends.set(t.id,t):2===a.type&&e.user.blocked.set(t.id,t)}n.presences=n.presences||[];for(const h of n.presences)e.dataManager.newUser(h.user),e._setPresence(h.user.id,h);if(n.notes)for(const u in n.notes){let t=n.notes[u];t.length||(t=null),e.user.notes.set(u,t)}!e.user.bot&&e.options.sync&&e.setInterval(e.syncGuilds.bind(e),3e4),e.once("ready",e.syncGuilds.bind(e)),e.users.has("1")||e.dataManager.newUser({id:"1",username:"Clyde",discriminator:"0000",avatar:"https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png",bot:!0,status:"online",game:null,verified:!0}),e.setTimeout(()=>{e.ws.normalReady||e.ws._emitReady(!1)},1200*n.guilds.length),this.packetManager.ws.sessionID=n.session_id,this.packetManager.ws.checkIfReady()}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;1===n.type?e.fetchUser(n.id).then(t=>{e.user.friends.set(t.id,t)}):2===n.type&&e.fetchUser(n.id).then(t=>{e.user.blocked.set(t.id,t)})}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;2===n.type?e.user.blocked.has(n.id)&&e.user.blocked.delete(n.id):1===n.type&&e.user.friends.has(n.id)&&e.user.friends.delete(n.id)}}t.exports=s},function(t,e,n){function i(t,e){return t.client.setTimeout(()=>{t.client.emit(r.Events.TYPING_STOP,t,e,t._typing.get(e.id)),t._typing.delete(e.id)},6e3)}const s=n(1),r=n(0);class o extends s{handle(t){const e=this.packetManager.client,n=t.d,s=e.channels.get(n.channel_id),o=e.users.get(n.user_id),h=new Date(1e3*n.timestamp);if(s&&o){if("voice"===s.type)return void e.emit(r.Events.WARN,`Discord sent a typing packet to voice channel ${s.id}`);if(s._typing.has(o.id)){const t=s._typing.get(o.id);t.lastTimestamp=h,t.resetTimeout(i(s,o))}else s._typing.set(o.id,new a(e,h,h,i(s,o))),e.emit(r.Events.TYPING_START,s,o)}}}class a{constructor(t,e,n,i){this.client=t,this.since=e,this.lastTimestamp=n,this._timeout=i}resetTimeout(t){this.client.clearTimeout(this._timeout),this._timeout=t}get elapsedTime(){return Date.now()-this.since}}t.exports=o},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.UserNoteUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.UserUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.emit("self.voiceServer",n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0),r=n(4);class o extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);if(i){const t=i.members.get(n.user_id);if(t){const i=r(t);t.voiceChannel&&t.voiceChannel.id!==n.channel_id&&t.voiceChannel.members.delete(i.id),n.channel_id||(t.speaking=null),t.user.id===e.user.id&&n.channel_id&&e.emit("self.voiceStateUpdate",n);const o=e.channels.get(n.channel_id);o&&o.members.set(t.user.id,t),t.serverMute=n.mute,t.serverDeaf=n.deaf,t.selfMute=n.self_mute,t.selfDeaf=n.self_deaf,t.voiceSessionID=n.session_id,t.voiceChannelID=n.channel_id,e.emit(s.Events.VOICE_STATE_UPDATE,i,t)}}}}t.exports=o},function(t,e){class n{constructor(t,e){this.user=t,this.setup(e)}setup(t){this.type=t.type,this.name=t.name,this.id=t.id,this.revoked=t.revoked,this.integrations=t.integrations}}t.exports=n},function(t,e,n){const i=n(3),s=n(158);class r{constructor(t,e){this.user=t,Object.defineProperty(this,"client",{value:t.client}),this.mutualGuilds=new i,this.connections=new i,this.setup(e)}setup(t){this.premium=t.premium;for(const e of t.mutual_guilds)this.client.guilds.has(e.id)&&this.mutualGuilds.set(e.id,this.client.guilds.get(e.id));for(const n of t.connected_accounts)this.connections.set(n.id,new s(this.user,n))}}t.exports=r},function(t,e){t.exports=function(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(const n in t){const i=t[n],s=e.indexOf(i);s&&e.splice(s,1)}return 0===e.length}},function(t,e){t.exports=function(t){if(t.includes("%")&&(t=decodeURIComponent(t)),t.includes(":")){const[e,n]=t.split(":");return{name:e,id:n}}return{name:t,id:null}}},function(t,e,n){const i=n(46);t.exports=function(t,e){if(t.before&&(t.before instanceof Date||(t.before=new Date(t.before)),t.maxID=i.fromNumber(t.before.getTime()-14200704e5).shiftLeft(22).toString()),t.after&&(t.after instanceof Date||(t.after=new Date(t.after)),t.minID=i.fromNumber(t.after.getTime()-14200704e5).shiftLeft(22).toString()),t.during){t.during instanceof Date||(t.during=new Date(t.during));const e=t.during.getTime()-14200704e5;t.minID=i.fromNumber(e).shiftLeft(22).toString(),t.maxID=i.fromNumber(e+864e5).shiftLeft(22).toString()}return t.channel&&(t.channel=e.resolver.resolveChannelID(t.channel)),t.author&&(t.author=e.resolver.resolveUserID(t.author)),t.mentions&&(t.mentions=e.resolver.resolveUserID(t.options.mentions)),{content:t.content,max_id:t.maxID,min_id:t.minID,has:t.has,channel_id:t.channel,author_id:t.author,author_type:t.authorType,context_size:t.contextSize,sort_by:t.sortBy,sort_order:t.sortOrder,limit:t.limit,offset:t.offset,mentions:t.mentions,mentions_everyone:t.mentionsEveryone,link_hostname:t.linkHostname,embed_provider:t.embedProvider,embed_type:t.embedType,attachment_filename:t.attachmentFilename,attachment_extension:t.attachmentExtension}}},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e,n){t.exports={Client:n(58),WebhookClient:n(59),Shard:n(62),ShardClientUtil:n(63),ShardingManager:n(64),Collection:n(3),splitMessage:n(45),escapeMarkdown:n(22),fetchRecommendedShards:n(61),Snowflake:n(23),SnowflakeUtil:n(23),Channel:n(8),ClientOAuth2Application:n(30),ClientUser:n(31),DMChannel:n(32),Emoji:n(10),EvaluatedPermissions:n(19),Game:n(7).Game,GroupDMChannel:n(33),Guild:n(14),GuildChannel:n(15),GuildMember:n(11),Invite:n(34),Message:n(12),MessageAttachment:n(35),MessageCollector:n(36),MessageEmbed:n(37),MessageReaction:n(38),OAuth2Application:n(39),PartialGuild:n(40),PartialGuildChannel:n(41),PermissionOverwrites:n(42),Presence:n(7).Presence,ReactionEmoji:n(20),RichEmbed:n(60),Role:n(9),TextChannel:n(43),User:n(6),VoiceChannel:n(44),Webhook:n(21),version:n(29).version,Constants:n(0)},"undefined"!=typeof window&&(window.Discord=t.exports)}]);
\ No newline at end of file
+\`\`\``),reply&&"dm"!==t.channel.type){const t=this.client.resolver.resolveUserID(reply),n=`<@${reply instanceof f&&reply.nickname?"!":""}${t}>`;e=`${n}${e?`, ${e}`:""}`}return this.rest.makeRequest("patch",s.Endpoints.channelMessage(t.channel.id,t.id),!0,{content:e,embed:embed}).then(t=>this.client.actions.MessageUpdate.handle(t).updated)}deleteMessage(t){return this.rest.makeRequest("del",s.Endpoints.channelMessage(t.channel.id,t.id),!0).then(()=>this.client.actions.MessageDelete.handle({id:t.id,channel_id:t.channel.id}).message)}bulkDeleteMessages(t,e,n){return n&&(e=e.filter(t=>Date.now()-c.deconstruct(t).date.getTime()<12096e5)),this.rest.makeRequest("post",`${s.Endpoints.channelMessages(t.id)}/bulk_delete`,!0,{messages:e}).then(()=>this.client.actions.MessageDeleteBulk.handle({channel_id:t.id,ids:e}).messages)}search(t,e){e=u(e,this.client);const n=i.stringify(e);let r;if(t instanceof E)r="channel";else{if(!(t instanceof w))throw new TypeError("Target must be a TextChannel, DMChannel, GroupDMChannel, or Guild.");r="guild"}const o=`${s.Endpoints[`${r}Search`](t.id)}?${n}`;return this.rest.makeRequest("get",o,!0).then(t=>{const e=t.messages.map(t=>t.map(t=>new d(this.client.channels.get(t.channel_id),t,this.client)));return{totalResults:t.total_results,messages:e}})}createChannel(t,e,n,i){return i instanceof r&&(i=i.array()),this.rest.makeRequest("post",s.Endpoints.guildChannels(t.id),!0,{name:e,type:n,permission_overwrites:i}).then(t=>this.client.actions.ChannelCreate.handle(t).channel)}createDM(t){const e=this.getExistingDM(t);return e?Promise.resolve(e):this.rest.makeRequest("post",s.Endpoints.userChannels(this.client.user.id),!0,{recipient_id:t.id}).then(t=>this.client.actions.ChannelCreate.handle(t).channel)}getExistingDM(t){return this.client.channels.find(e=>e.recipient&&e.recipient.id===t.id)}deleteChannel(t){return(t instanceof l||t instanceof f)&&(t=this.getExistingDM(t)),t?this.rest.makeRequest("del",s.Endpoints.channel(t.id),!0).then(e=>{return e.id=t.id,this.client.actions.ChannelDelete.handle(e).channel}):Promise.reject(new Error("No channel to delete."))}updateChannel(t,e){const n={};return n.name=(e.name||t.name).trim(),n.topic=e.topic||t.topic,n.position=e.position||t.position,n.bitrate=e.bitrate||t.bitrate,n.user_limit=e.userLimit||t.userLimit,this.rest.makeRequest("patch",s.Endpoints.channel(t.id),!0,n).then(t=>this.client.actions.ChannelUpdate.handle(t).updated)}leaveGuild(t){return t.ownerID===this.client.user.id?Promise.reject(new Error("Guild is owned by the client.")):this.rest.makeRequest("del",s.Endpoints.meGuild(t.id),!0).then(()=>this.client.actions.GuildDelete.handle({id:t.id}).guild)}createGuild(t){return t.icon=this.client.resolver.resolveBase64(t.icon)||null,t.region=t.region||"us-central",new Promise((e,n)=>{this.rest.makeRequest("post",s.Endpoints.guilds,!0,t).then(t=>{if(this.client.guilds.has(t.id))return void e(this.client.guilds.get(t.id));const i=n=>{n.id===t.id&&(this.client.removeListener("guildCreate",i),this.client.clearTimeout(s),e(n))};this.client.on("guildCreate",i);const s=this.client.setTimeout(()=>{this.client.removeListener("guildCreate",i),n(new Error("Took too long to receive guild data."))},1e4)},n)})}deleteGuild(t){return this.rest.makeRequest("del",s.Endpoints.guild(t.id),!0).then(()=>this.client.actions.GuildDelete.handle({id:t.id}).guild)}getUser(t,e){return this.rest.makeRequest("get",s.Endpoints.user(t),!0).then(t=>{return e?this.client.actions.UserGet.handle(t).user:new l(this.client,t)})}updateCurrentUser(t,e){const n=this.client.user,i={};return i.username=t.username||n.username,i.avatar=this.client.resolver.resolveBase64(t.avatar)||n.avatar,n.bot||(i.email=t.email||n.email,i.password=e,t.new_password&&(i.new_password=t.newPassword)),this.rest.makeRequest("patch",s.Endpoints.me,!0,i).then(t=>this.client.actions.UserUpdate.handle(t).updated)}updateGuild(t,e){const n={};return e.name&&(n.name=e.name),e.region&&(n.region=e.region),e.verificationLevel&&(n.verification_level=Number(e.verificationLevel)),e.afkChannel&&(n.afk_channel_id=this.client.resolver.resolveChannel(e.afkChannel).id),e.afkTimeout&&(n.afk_timeout=Number(e.afkTimeout)),e.icon&&(n.icon=this.client.resolver.resolveBase64(e.icon)),e.owner&&(n.owner_id=this.client.resolver.resolveUser(e.owner).id),e.splash&&(n.splash=this.client.resolver.resolveBase64(e.splash)),this.rest.makeRequest("patch",s.Endpoints.guild(t.id),!0,n).then(t=>this.client.actions.GuildUpdate.handle(t).updated)}kickGuildMember(t,e){return this.rest.makeRequest("del",s.Endpoints.guildMember(t.id,e.id),!0).then(()=>this.client.actions.GuildMemberRemove.handle({guild_id:t.id,user:e.user}).member)}createGuildRole(t){return this.rest.makeRequest("post",s.Endpoints.guildRoles(t.id),!0).then(e=>this.client.actions.GuildRoleCreate.handle({guild_id:t.id,role:e}).role)}deleteGuildRole(t){return this.rest.makeRequest("del",s.Endpoints.guildRole(t.guild.id,t.id),!0).then(()=>this.client.actions.GuildRoleDelete.handle({guild_id:t.guild.id,role_id:t.id}).role)}setChannelOverwrite(t,e){return this.rest.makeRequest("put",`${s.Endpoints.channelPermissions(t.id)}/${e.id}`,!0,e)}deletePermissionOverwrites(t){return this.rest.makeRequest("del",`${s.Endpoints.channelPermissions(t.channel.id)}/${t.id}`,!0).then(()=>t)}getChannelMessages(t,e={}){const n=[];e.limit&&n.push(`limit=${e.limit}`),e.around?n.push(`around=${e.around}`):e.before?n.push(`before=${e.before}`):e.after&&n.push(`after=${e.after}`);let i=s.Endpoints.channelMessages(t.id);return n.length>0&&(i+=`?${n.join("&")}`),this.rest.makeRequest("get",i,!0)}getChannelMessage(t,e){const n=t.messages.get(e);return n?Promise.resolve(n):this.rest.makeRequest("get",s.Endpoints.channelMessage(t.id,e),!0)}getGuildMember(t,e,n){return this.rest.makeRequest("get",s.Endpoints.guildMember(t.id,e.id),!0).then(e=>{return n?this.client.actions.GuildMemberGet.handle(t,e).member:new f(t,e)})}updateGuildMember(t,e){e.channel&&(e.channel_id=this.client.resolver.resolveChannel(e.channel).id),e.roles&&(e.roles=e.roles.map(t=>t instanceof p?t.id:t));let n=s.Endpoints.guildMember(t.guild.id,t.id);if(t.id===this.client.user.id){const i=Object.keys(e);1===i.length&&"nick"===i[0]&&(n=s.Endpoints.guildMemberNickname(t.guild.id))}return this.rest.makeRequest("patch",n,!0,e).then(e=>t.guild._updateMember(t,e).mem)}addMemberRole(t,e){return this.rest.makeRequest("put",s.Endpoints.guildMemberRole(t.guild.id,t.id,e.id),!0).then(()=>{return t._roles.includes(e.id)||t._roles.push(e.id),t})}removeMemberRole(t,e){return this.rest.makeRequest("delete",s.Endpoints.guildMemberRole(t.guild.id,t.id,e.id),!0).then(()=>{const n=t._roles.indexOf(e.id);return n>=0&&t._roles.splice(n,1),t})}sendTyping(t){return this.rest.makeRequest("post",`${s.Endpoints.channel(t)}/typing`,!0)}banGuildMember(t,e,n=0){const i=this.client.resolver.resolveUserID(e);return i?this.rest.makeRequest("put",`${s.Endpoints.guildBans(t.id)}/${i}?delete-message-days=${n}`,!0,{"delete-message-days":n}).then(()=>{if(e instanceof f)return e;const n=this.client.resolver.resolveUser(i);return n?(e=this.client.resolver.resolveGuildMember(t,n),e||n):i}):Promise.reject(new Error("Couldn't resolve the user ID to ban."))}unbanGuildMember(t,e){return new Promise((n,i)=>{const r=this.client.resolver.resolveUserID(e);if(!r)throw new Error("Couldn't resolve the user ID to unban.");const o=(e,i)=>{e.id===t.id&&i.id===r&&(this.client.removeListener(s.Events.GUILD_BAN_REMOVE,o),this.client.clearTimeout(a),n(i))};this.client.on(s.Events.GUILD_BAN_REMOVE,o);const a=this.client.setTimeout(()=>{this.client.removeListener(s.Events.GUILD_BAN_REMOVE,o),i(new Error("Took too long to receive the ban remove event."))},1e4);this.rest.makeRequest("del",`${s.Endpoints.guildBans(t.id)}/${r}`,!0).catch(t=>{this.client.removeListener(s.Events.GUILD_BAN_REMOVE,o),this.client.clearTimeout(a),i(t)})})}getGuildBans(t){return this.rest.makeRequest("get",s.Endpoints.guildBans(t.id),!0).then(t=>{const e=new r;for(const n of t){const t=this.client.dataManager.newUser(n.user);e.set(t.id,t)}return e})}updateGuildRole(t,e){const n={};if(n.name=e.name||t.name,n.position="undefined"!=typeof e.position?e.position:t.position,n.color=this.client.resolver.resolveColor(e.color||t.color),n.hoist="undefined"!=typeof e.hoist?e.hoist:t.hoist,n.mentionable="undefined"!=typeof e.mentionable?e.mentionable:t.mentionable,e.permissions){let t=0;for(let i of e.permissions)"string"==typeof i&&(i=s.PermissionFlags[i]),t|=i;n.permissions=t}else n.permissions=t.permissions;return this.rest.makeRequest("patch",s.Endpoints.guildRole(t.guild.id,t.id),!0,n).then(e=>this.client.actions.GuildRoleUpdate.handle({role:e,guild_id:t.guild.id}).updated)}pinMessage(t){return this.rest.makeRequest("put",`${s.Endpoints.channel(t.channel.id)}/pins/${t.id}`,!0).then(()=>t)}unpinMessage(t){return this.rest.makeRequest("del",`${s.Endpoints.channel(t.channel.id)}/pins/${t.id}`,!0).then(()=>t)}getChannelPinnedMessages(t){return this.rest.makeRequest("get",`${s.Endpoints.channel(t.id)}/pins`,!0)}createChannelInvite(t,e){const n={};return n.temporary=e.temporary,n.max_age=e.maxAge,n.max_uses=e.maxUses,this.rest.makeRequest("post",`${s.Endpoints.channelInvites(t.id)}`,!0,n).then(t=>new m(this.client,t))}deleteInvite(t){return this.rest.makeRequest("del",s.Endpoints.invite(t.code),!0).then(()=>t)}getInvite(t){return this.rest.makeRequest("get",s.Endpoints.invite(t),!0).then(t=>new m(this.client,t))}getGuildInvites(t){return this.rest.makeRequest("get",s.Endpoints.guildInvites(t.id),!0).then(t=>{const e=new r;for(const n of t){const t=new m(this.client,n);e.set(t.code,t)}return e})}pruneGuildMembers(t,e,n){return this.rest.makeRequest(n?"get":"post",`${s.Endpoints.guildPrune(t.id)}?days=${e}`,!0).then(t=>t.pruned)}createEmoji(t,e,n){return this.rest.makeRequest("post",`${s.Endpoints.guildEmojis(t.id)}`,!0,{name:n,image:e}).then(e=>this.client.actions.EmojiCreate.handle(e,t).emoji)}deleteEmoji(t){return this.rest.makeRequest("delete",`${s.Endpoints.guildEmojis(t.guild.id)}/${t.id}`,!0).then(()=>this.client.actions.EmojiDelete.handle(t).data)}getWebhook(t,e){return this.rest.makeRequest("get",s.Endpoints.webhook(t,e),!e).then(t=>new g(this.client,t))}getGuildWebhooks(t){return this.rest.makeRequest("get",s.Endpoints.guildWebhooks(t.id),!0).then(t=>{const e=new r;for(const n of t)e.set(n.id,new g(this.client,n));return e})}getChannelWebhooks(t){return this.rest.makeRequest("get",s.Endpoints.channelWebhooks(t.id),!0).then(t=>{const e=new r;for(const n of t)e.set(n.id,new g(this.client,n));return e})}createWebhook(t,e,n){return this.rest.makeRequest("post",s.Endpoints.channelWebhooks(t.id),!0,{name:e,avatar:n}).then(t=>new g(this.client,t))}editWebhook(t,e,n){return this.rest.makeRequest("patch",s.Endpoints.webhook(t.id,t.token),!1,{name:e,avatar:n}).then(e=>{return t.name=e.name,t.avatar=e.avatar,t})}deleteWebhook(t){return this.rest.makeRequest("delete",s.Endpoints.webhook(t.id,t.token),!1)}sendWebhookMessage(t,e,{avatarURL,tts,disableEveryone,embeds,username}={},n=null){return username=username||t.name,"undefined"!=typeof e&&(e=this.client.resolver.resolveString(e)),e&&(disableEveryone||"undefined"==typeof disableEveryone&&this.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@$1")),this.rest.makeRequest("post",`${s.Endpoints.webhook(t.id,t.token)}?wait=true`,!1,{username:username,avatar_url:avatarURL,content:e,tts:tts,embeds:embeds},n)}sendSlackWebhookMessage(t,e){return this.rest.makeRequest("post",`${s.Endpoints.webhook(t.id,t.token)}/slack?wait=true`,!1,e)}fetchUserProfile(t){return this.rest.makeRequest("get",s.Endpoints.userProfile(t.id),!0).then(e=>new _(t,e))}fetchMeMentions(t){return t.guild&&(t.guild=t.guild.id?t.guild.id:t.guild),this.rest.makeRequest("get",s.Endpoints.meMentions(t.limit,t.roles,t.everyone,t.guild)).then(t=>t.body.map(t=>new d(this.client.channels.get(t.channel_id),t,this.client)))}addFriend(t){return this.rest.makeRequest("post",s.Endpoints.relationships("@me"),!0,{username:t.username,discriminator:t.discriminator}).then(()=>t)}removeFriend(t){return this.rest.makeRequest("delete",`${s.Endpoints.relationships("@me")}/${t.id}`,!0).then(()=>t)}blockUser(t){return this.rest.makeRequest("put",`${s.Endpoints.relationships("@me")}/${t.id}`,!0,{type:2}).then(()=>t)}unblockUser(t){return this.rest.makeRequest("delete",`${s.Endpoints.relationships("@me")}/${t.id}`,!0).then(()=>t)}setRolePositions(t,e){return this.rest.makeRequest("patch",s.Endpoints.guildRoles(t),!0,e).then(()=>this.client.actions.GuildRolesPositionUpdate.handle({guild_id:t,roles:e}).guild)}addMessageReaction(t,e){return this.rest.makeRequest("put",s.Endpoints.selfMessageReaction(t.channel.id,t.id,e),!0).then(()=>this.client.actions.MessageReactionAdd.handle({user_id:this.client.user.id,message_id:t.id,emoji:a(e),channel_id:t.channel.id}).reaction)}removeMessageReaction(t,e,n){let i=s.Endpoints.selfMessageReaction(t.channel.id,t.id,e);return n!==this.client.user.id&&(i=s.Endpoints.userMessageReaction(t.channel.id,t.id,e,null,n.id)),this.rest.makeRequest("delete",i,!0).then(()=>this.client.actions.MessageReactionRemove.handle({user_id:n,message_id:t.id,emoji:a(e),channel_id:t.channel.id}).reaction)}removeMessageReactions(t){return this.rest.makeRequest("delete",s.Endpoints.messageReactions(t.channel.id,t.id),!0).then(()=>t)}getMessageReactionUsers(t,e,n=100){return this.rest.makeRequest("get",s.Endpoints.messageReaction(t.channel.id,t.id,e,n),!0)}getMyApplication(){return this.rest.makeRequest("get",s.Endpoints.myApplication,!0).then(t=>new v(this.client,t))}setNote(t,e){return this.rest.makeRequest("put",s.Endpoints.note(t.id),!0,{note:e}).then(()=>t)}acceptInvite(t){return t.id&&(t=t.id),new Promise((e,n)=>this.rest.makeRequest("post",s.Endpoints.invite(t),!0).then(t=>{const i=n=>{n.id===t.id&&(e(n),this.client.removeListener("guildCreate",i))};this.client.on("guildCreate",i),this.client.setTimeout(()=>{this.client.removeListener("guildCreate",i),n(new Error("Accepting invite timed out"))},12e4)}))}}t.exports=b},function(t,e,n){const i=n(55);class s extends i{constructor(t,e){super(t,e),this.requestRemaining=1,this.first=!0}push(t){super.push(t),this.handle()}handleNext(t){this.waiting||(this.waiting=!0,this.restManager.client.setTimeout(()=>{this.requestRemaining=this.requestLimit,this.waiting=!1,this.handle()},t))}execute(t){t.request.gen().end((e,n)=>{if(n&&n.headers&&(this.requestLimit=n.headers["x-ratelimit-limit"],this.requestResetTime=1e3*Number(n.headers["x-ratelimit-reset"]),this.requestRemaining=Number(n.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(n.headers.date).getTime(),this.handleNext(this.requestResetTime-Date.now()+this.timeDifference+this.restManager.client.options.restTimeOffset)),e)429===e.status?(this.requestRemaining=0,this.queue.unshift(t),this.restManager.client.setTimeout(()=>{this.globalLimit=!1,this.handle()},Number(n.headers["retry-after"])+this.restManager.client.options.restTimeOffset),n.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):t.reject(e);else{this.globalLimit=!1;const e=n&&n.body?n.body:{};t.resolve(e),this.first&&(this.first=!1,this.handle())}})}handle(){if(super.handle(),!(this.requestRemaining<1||0===this.queue.length||this.globalLimit))for(;this.queue.length>0&&this.requestRemaining>0;)this.execute(this.queue.shift()),this.requestRemaining--}}t.exports=s},function(t,e,n){const i=n(55);class s extends i{constructor(t,e){super(t,e),this.waiting=!1,this.endpoint=e,this.timeDifference=0}push(t){super.push(t),this.handle()}execute(t){return new Promise(e=>{t.request.gen().end((n,i)=>{if(i&&i.headers&&(this.requestLimit=i.headers["x-ratelimit-limit"],this.requestResetTime=1e3*Number(i.headers["x-ratelimit-reset"]),this.requestRemaining=Number(i.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(i.headers.date).getTime()),n)429===n.status?(this.restManager.client.setTimeout(()=>{this.waiting=!1,this.globalLimit=!1,e()},Number(i.headers["retry-after"])+this.restManager.client.options.restTimeOffset),i.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):(this.queue.shift(),this.waiting=!1,t.reject(n),e(n));else{this.queue.shift(),this.globalLimit=!1;const n=i&&i.body?i.body:{};t.resolve(n),0===this.requestRemaining?this.restManager.client.setTimeout(()=>{this.waiting=!1,e(n)},this.requestResetTime-Date.now()+this.timeDifference+this.restManager.client.options.restTimeOffset):(this.waiting=!1,e(n))}})})}handle(){if(super.handle(),!this.waiting&&0!==this.queue.length&&!this.globalLimit){this.waiting=!0;const t=this.queue[0];this.execute(t).then(()=>this.handle())}}}t.exports=s},function(t,e,n){const i=n(0);class s{constructor(t){this.restManager=t,this._userAgent={url:"https://github.com/hydrabolt/discord.js",version:i.Package.version}}set(t){this._userAgent.url=t.url||"https://github.com/hydrabolt/discord.js",this._userAgent.version=t.version||i.Package.version}get userAgent(){return`DiscordBot (${this._userAgent.url}, ${this._userAgent.version})`}}t.exports=s},function(t,e,n){(function(e,i){const s=n(18).EventEmitter,r=n(166),o=n(165),a=n(3),h=["-analyzeduration","0","-loglevel","0","-f","s16le","-ar","48000","-ac","2"];class u extends s{constructor(t){super(),this.client=t,this._dispatchers=new a,this._encoders=new a,this.prism=new r,this.currentTranscoder=null,this.tickInterval=null,this._volume=1}get dispatchers(){let t=[];for(const e of this._dispatchers.values())t=t.concat(Array.from(e.values()));return t}applyVolume(t,n=this._volume){if(1===n)return t;const i=e.alloc(t.length);for(let s=0;s=t.length-1);s+=2){const e=Math.min(32767,Math.max(-32767,Math.floor(n*t.readInt16LE(s))));i.writeInt16LE(e,s)}return i}setVolume(t){this._volume=t}setVolumeDecibels(t){this.setVolume(Math.pow(10,t/20))}setVolumeLogarithmic(t){this.setVolume(Math.pow(t,1.660964))}get volume(){return this._volume}get _playableStream(){return this.currentTranscoder?this.currentTranscoder.transcoder.output||this.currentTranscoder.options.stream:null}unregisterDispatcher(t,e){const n=e||t.volume;this.emit("unsubscribe",t);for(const i of this._dispatchers.values())i.delete(t),i.size||(this._dispatchers.delete(n),this._encoders.delete(n))}registerDispatcher(t){this._dispatchers.has(t.volume)||(this._dispatchers.set(t.volume,new Set),this._encoders.set(t.volume,o.fetch()));const e=this._dispatchers.get(t.volume);e.has(t)||(e.add(t),t.once("end",()=>this.unregisterDispatcher(t)),t.on("volumeChange",(e,n)=>{this.unregisterDispatcher(t,e),this._dispatchers.has(n)||(this._dispatchers.set(n,new Set),this._encoders.set(n,o.fetch())),this._dispatchers.get(n).add(t)}),this.emit("subscribe",t))}killCurrentTranscoder(){this.currentTranscoder&&(this.currentTranscoder.transcoder&&this.currentTranscoder.transcoder.kill(),this.currentTranscoder=null,this.emit("end"))}playStream(t,{seek=0,volume=1,passes=1}={}){const e={seek:seek,volume:volume,passes:passes};return e.stream=t,this._playTranscodable(t,e)}playFile(t,{seek=0,volume=1,passes=1}={}){const e={seek:seek,volume:volume,passes:passes};return this._playTranscodable(`file:${t}`,e)}_playTranscodable(t,e){this.killCurrentTranscoder();const n=this.prism.transcode({type:"ffmpeg",media:t,ffmpegArguments:h.concat(["-ss",String(e.seek)])});return n.once("error",t=>{this.listenerCount("error")>0?this.emit("error",t):this.emit("warn",t)}),n.once("end",()=>this.killCurrentTranscoder()),this.currentTranscoder={transcoder:n,options:e},n.output.once("readable",()=>this._startPlaying()),this}playConvertedStream(t,{seek=0,volume=1,passes=1}={}){this.killCurrentTranscoder();const e={seek:seek,volume:volume,passes:passes,stream:t};return this.currentTranscoder={options:e},t.once("readable",()=>this._startPlaying()),this}playArbitraryInput(t,{seek=0,volume=1,passes=1}={}){const e={seek:seek,volume:volume,passes:passes};return this.player.playUnknownStream(t,e)}pause(){this.paused=!0;for(const t of this._dispatchers.values())for(const e of t.values())e.pause()}resume(){this.paused=!1;for(const t of this._dispatchers.values())for(const e of t.values())e.resume()}_startPlaying(){this.tickInterval&&clearInterval(this.tickInterval),this._startTime=Date.now(),this._count=0,this._pausedTime=0,this._missed=0,this.tick()}tick(){if(this._playableStream){if(this.paused)return this._pausedTime+=20,void setTimeout(()=>this.tick(),20);const t=this._playableStream,n=3840;let s=t.read(n);if(!s)return this._missed++,void(this._missed<5?(this._pausedTime+=200,setTimeout(()=>this.tick(),200)):this.killCurrentTranscoder());if(this._missed=0,s.length!==n){const t=e.alloc(n).fill(0);s.copy(t),s=t}let r={};const o=t=>{if(r[t])return r[t];const e=this._encoders.get(t),n=e.encode(this.applyVolume(s,this._volume*t));return r[t]=n,n};for(const a of this.dispatchers){const t=a.volume;i(()=>{a.process(s,!0,o(t))})}const h=20+(this._startTime+this._pausedTime+20*this._count-Date.now());this._count++,setTimeout(()=>this.tick(),h)}}end(){this.killCurrentTranscoder()}destroy(){this.end();for(const t of this._dispatchers.values())for(const e of t.values())e.destroy("end","broadcast ended")}}t.exports=u}).call(e,n(17).Buffer,n(86).setImmediate)},function(t,e,n){(function(e){const i="undefined"!=typeof window,s=n(18).EventEmitter,r=n(0),o=n(56),a=n(69),h=n(53),u=n(123);let c,l,f=JSON.stringify;if(i)c=window.WebSocket;else{try{c=n(168)}catch(t){c=n(169)}try{l=n(167),f=l.pack}catch(t){l=null}}class d extends s{constructor(t){super(),this.client=t,this.packetManager=new u(this),this.status=r.Status.IDLE,this.sessionID=null,this.sequence=-1,this.gateway=null,this.normalReady=!1,this.ws=null,this.disabledEvents={};for(const e of t.options.disabledEvents)this.disabledEvents[e]=!0;this.first=!0,this.lastHeartbeatAck=!0}_connect(t){this.client.emit("debug",`Connecting to gateway ${t}`),this.normalReady=!1,this.status!==r.Status.RECONNECTING&&(this.status=r.Status.CONNECTING),this.ws=new c(t),i&&(this.ws.binaryType="arraybuffer"),this.ws.onopen=this.eventOpen.bind(this),this.ws.onmessage=this.eventMessage.bind(this),this.ws.onclose=this.eventClose.bind(this),this.ws.onerror=this.eventError.bind(this),this._queue=[],this._remaining=120,this.client.setInterval(()=>{this._remaining=120,this._remainingReset=Date.now()},6e4)}connect(t){t=`${t}&encoding=${l?"etf":"json"}`,this.first?(this._connect(t),this.first=!1):this.client.setTimeout(()=>this._connect(t),5500)}heartbeat(t){return t&&!this.lastHeartbeatAck?void this.ws.close(1007):(this.client.emit("debug","Sending heartbeat"),this.client._pingTimestamp=Date.now(),this.client.ws.send({op:r.OPCodes.HEARTBEAT,d:this.sequence},!0),void(this.lastHeartbeatAck=!1))}send(t,e=false){return e?void this._send(f(t)):(this._queue.push(f(t)),void this.doQueue())}destroy(){this.ws.close(1e3),this._queue=[],this.status=r.Status.IDLE}_send(t){this.ws.readyState===c.OPEN&&(this.emit("send",t),this.ws.send(t))}doQueue(){const t=this._queue[0];if(this.ws.readyState===c.OPEN&&t){if(0===this.remaining)return void this.client.setTimeout(this.doQueue.bind(this),Date.now()-this.remainingReset);this._remaining--,this._send(t),this._queue.shift(),this.doQueue()}}eventOpen(){this.client.emit("debug","Connection to gateway opened"),this.lastHeartbeatAck=!0,this.status===r.Status.RECONNECTING?this._sendResume():this._sendNewIdentify()}_sendResume(){if(!this.sessionID)return void this._sendNewIdentify();this.client.emit("debug","Identifying as resumed session");const t={token:this.client.token,session_id:this.sessionID,seq:this.sequence};this.send({op:r.OPCodes.RESUME,d:t})}_sendNewIdentify(){this.reconnecting=!1;const t=this.client.options.ws;t.token=this.client.token,this.client.options.shardCount>0&&(t.shard=[Number(this.client.options.shardId),Number(this.client.options.shardCount)]),this.client.emit("debug","Identifying as new session"),this.send({op:r.OPCodes.IDENTIFY,d:t}),this.sequence=-1}eventClose(t){this.emit("close",t),this.client.clearInterval(this.client.manager.heartbeatInterval),this.status=r.Status.DISCONNECTED,this._queue=[],this.reconnecting||this.client.emit(r.Events.DISCONNECT,t),[4004,4010,4011].includes(t.code)||this.reconnecting||1e3===t.code||this.tryReconnect()}eventMessage(t){const e=this.tryParseEventData(t.data);return null===e?(this.eventError(new Error(r.Errors.BAD_WS_MESSAGE)),!1):(this.client.emit("raw",e),e.op===r.OPCodes.HELLO&&this.client.manager.setupKeepAlive(e.d.heartbeat_interval),this.packetManager.handle(e))}parseEventData(t){return l?(t instanceof ArrayBuffer&&(t=o(t)),l.unpack(t)):(t instanceof ArrayBuffer?t=a.inflate(t,{to:"string"}):t instanceof e&&(t=h.inflateSync(t).toString()),JSON.parse(t))}tryParseEventData(t){try{return this.parseEventData(t)}catch(t){return null}}eventError(t){this.client.listenerCount("error")>0&&this.client.emit("error",t),this.tryReconnect()}_emitReady(t=true){this.status=r.Status.READY,this.client.emit(r.Events.READY),this.packetManager.handleQueue(),this.normalReady=t}checkIfReady(){if(this.status!==r.Status.READY&&this.status!==r.Status.NEARLY){let t=0;for(const e of this.client.guilds.keys())t+=this.client.guilds.get(e).available?0:1;if(0===t){if(this.status=r.Status.NEARLY,this.client.options.fetchAllMembers){const t=this.client.guilds.map(t=>t.fetchMembers());return void Promise.all(t).then(()=>this._emitReady(),t=>{this.client.emit(r.Events.WARN,"Error in pre-ready guild member fetching"),this.client.emit(r.Events.ERROR,t),this._emitReady()})}this._emitReady()}}}tryReconnect(){this.status!==r.Status.RECONNECTING&&this.status!==r.Status.CONNECTING&&(this.status=r.Status.RECONNECTING,this.ws.close(),this.packetManager.handleQueue(),this.client.emit(r.Events.RECONNECTING),this.connect(this.client.ws.gateway))}}t.exports=d}).call(e,n(17).Buffer)},function(t,e,n){const i=n(0),s=[i.WSEvents.READY,i.WSEvents.GUILD_CREATE,i.WSEvents.GUILD_DELETE,i.WSEvents.GUILD_MEMBERS_CHUNK,i.WSEvents.GUILD_MEMBER_ADD,i.WSEvents.GUILD_MEMBER_REMOVE];class r{constructor(t){this.ws=t,this.handlers={},this.queue=[],this.register(i.WSEvents.READY,n(150)),this.register(i.WSEvents.GUILD_CREATE,n(130)),this.register(i.WSEvents.GUILD_DELETE,n(131)),this.register(i.WSEvents.GUILD_UPDATE,n(141)),this.register(i.WSEvents.GUILD_BAN_ADD,n(128)),this.register(i.WSEvents.GUILD_BAN_REMOVE,n(129)),this.register(i.WSEvents.GUILD_MEMBER_ADD,n(133)),this.register(i.WSEvents.GUILD_MEMBER_REMOVE,n(134)),this.register(i.WSEvents.GUILD_MEMBER_UPDATE,n(135)),this.register(i.WSEvents.GUILD_ROLE_CREATE,n(137)),this.register(i.WSEvents.GUILD_ROLE_DELETE,n(138)),this.register(i.WSEvents.GUILD_ROLE_UPDATE,n(139)),this.register(i.WSEvents.GUILD_EMOJIS_UPDATE,n(132)),this.register(i.WSEvents.GUILD_MEMBERS_CHUNK,n(136)),this.register(i.WSEvents.CHANNEL_CREATE,n(124)),this.register(i.WSEvents.CHANNEL_DELETE,n(125)),this.register(i.WSEvents.CHANNEL_UPDATE,n(127)),this.register(i.WSEvents.CHANNEL_PINS_UPDATE,n(126)),this.register(i.WSEvents.PRESENCE_UPDATE,n(149)),this.register(i.WSEvents.USER_UPDATE,n(155)),this.register(i.WSEvents.USER_NOTE_UPDATE,n(154)),this.register(i.WSEvents.VOICE_STATE_UPDATE,n(157)),this.register(i.WSEvents.TYPING_START,n(153)),this.register(i.WSEvents.MESSAGE_CREATE,n(142)),this.register(i.WSEvents.MESSAGE_DELETE,n(143)),this.register(i.WSEvents.MESSAGE_UPDATE,n(148)),this.register(i.WSEvents.MESSAGE_DELETE_BULK,n(144)),this.register(i.WSEvents.VOICE_SERVER_UPDATE,n(156)),this.register(i.WSEvents.GUILD_SYNC,n(140)),this.register(i.WSEvents.RELATIONSHIP_ADD,n(151)),this.register(i.WSEvents.RELATIONSHIP_REMOVE,n(152)),this.register(i.WSEvents.MESSAGE_REACTION_ADD,n(145)),this.register(i.WSEvents.MESSAGE_REACTION_REMOVE,n(146)),this.register(i.WSEvents.MESSAGE_REACTION_REMOVE_ALL,n(147))}get client(){return this.ws.client}register(t,e){this.handlers[t]=new e(this)}handleQueue(){this.queue.forEach((t,e)=>{this.handle(this.queue[e]),this.queue.splice(e,1)})}setSequence(t){t&&t>this.ws.sequence&&(this.ws.sequence=t)}handle(t){return t.op===i.OPCodes.RECONNECT?(this.setSequence(t.s),this.ws.tryReconnect(),!1):t.op===i.OPCodes.INVALID_SESSION?(t.d?setTimeout(()=>{this.ws._sendResume()},2500):(this.ws.sessionID=null,this.ws._sendNewIdentify()),!1):(t.op===i.OPCodes.HEARTBEAT_ACK?(this.ws.client._pong(this.ws.client._pingTimestamp),this.ws.lastHeartbeatAck=!0,this.ws.client.emit("debug","Heartbeat acknowledged")):t.op===i.OPCodes.HEARTBEAT&&(this.client.ws.send({op:i.OPCodes.HEARTBEAT,d:this.client.ws.sequence}),this.ws.client.emit("debug","Received gateway heartbeat")),this.ws.status===i.Status.RECONNECTING&&(this.ws.reconnecting=!1,this.ws.checkIfReady()),this.setSequence(t.s),void 0===this.ws.disabledEvents[t.t]&&(this.ws.status!==i.Status.READY&&s.indexOf(t.t)===-1?(this.queue.push(t),!1):!!this.handlers[t.t]&&this.handlers[t.t].handle(t)))}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.ChannelCreate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.ChannelDelete.handle(n);i.channel&&e.emit(s.Events.CHANNEL_DELETE,i.channel)}}t.exports=r},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.channels.get(n.channel_id),r=new Date(n.last_pin_timestamp);i&&r&&e.emit(s.Events.CHANNEL_PINS_UPDATE,i,r)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.ChannelUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id),r=e.users.get(n.user.id);i&&r&&e.emit(s.Events.GUILD_BAN_ADD,i,r)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildBanRemove.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.id);i?i.available||n.unavailable||(i.setup(n),this.packetManager.ws.checkIfReady()):e.dataManager.newGuild(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.GuildDelete.handle(n);i.guild&&e.emit(s.Events.GUILD_DELETE,i.guild)}}t.exports=r},function(t,e,n){function i(t){const e=new Map;for(const n of t)e.set(...n);return e}const s=n(1);class r extends s{handle(t){const e=this.packetManager.client,n=t.d,s=e.guilds.get(n.guild_id);if(s&&s.emojis){const t=i(s.emojis.entries());for(const r of n.emojis){const n=s.emojis.get(r.id);n?(t.delete(r.id),n.equals(r,!0)||e.actions.GuildEmojiUpdate.handle(n,r)):e.actions.GuildEmojiCreate.handle(s,r)}for(const r of t.values())e.actions.GuildEmojiDelete.handle(r)}}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);i&&(i.memberCount++,i._addMember(n))}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildMemberRemove.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);if(i){const t=i.members.get(n.user.id);t&&i._updateMember(t,n)}}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);if(i){const t=n.members.map(t=>i._addMember(t,!1));i._checkChunks(),e.emit(s.Events.GUILD_MEMBERS_CHUNK,t),e.ws.lastHeartbeatAck=!0}}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildRoleCreate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildRoleDelete.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildRoleUpdate.handle(n);
+}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildSync.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.MessageCreate.handle(n);i.message&&e.emit(s.Events.MESSAGE_CREATE,i.message)}}t.exports=r},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.MessageDelete.handle(n);i.message&&e.emit(s.Events.MESSAGE_DELETE,i.message)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageDeleteBulk.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageReactionAdd.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageReactionRemove.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageReactionRemoveAll.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0),r=n(4);class o extends i{handle(t){const e=this.packetManager.client,n=t.d;let i=e.users.get(n.user.id);const o=e.guilds.get(n.guild_id);if(!i){if(!n.user.username)return;i=e.dataManager.newUser(n.user)}const a=r(i);if(i.patch(n.user),i.equals(a)||e.emit(s.Events.USER_UPDATE,a,i),o){let t=o.members.get(i.id);if(t||"offline"===n.status||(t=o._addMember({user:i,roles:n.roles,deaf:!1,mute:!1},!1),e.emit(s.Events.GUILD_MEMBER_AVAILABLE,t)),t){if(0===e.listenerCount(s.Events.PRESENCE_UPDATE))return void o._setPresence(i.id,n);const a=r(t);t.presence&&(a.frozenPresence=r(t.presence)),o._setPresence(i.id,n),e.emit(s.Events.PRESENCE_UPDATE,a,t)}else o._setPresence(i.id,n)}}}t.exports=o},function(t,e,n){const i=n(1),s=n(31);class r extends i{handle(t){const e=this.packetManager.client,n=t.d;e.ws.heartbeat();const i=new s(e,n.user);i.settings=n.user_settings,e.user=i,e.readyAt=new Date,e.users.set(i.id,i);for(const r of n.guilds)e.dataManager.newGuild(r);for(const o of n.private_channels)e.dataManager.newChannel(o);for(const a of n.relationships){const t=e.dataManager.newUser(a.user);1===a.type?e.user.friends.set(t.id,t):2===a.type&&e.user.blocked.set(t.id,t)}n.presences=n.presences||[];for(const h of n.presences)e.dataManager.newUser(h.user),e._setPresence(h.user.id,h);if(n.notes)for(const u in n.notes){let t=n.notes[u];t.length||(t=null),e.user.notes.set(u,t)}!e.user.bot&&e.options.sync&&e.setInterval(e.syncGuilds.bind(e),3e4),e.once("ready",e.syncGuilds.bind(e)),e.users.has("1")||e.dataManager.newUser({id:"1",username:"Clyde",discriminator:"0000",avatar:"https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png",bot:!0,status:"online",game:null,verified:!0}),e.setTimeout(()=>{e.ws.normalReady||e.ws._emitReady(!1)},1200*n.guilds.length),this.packetManager.ws.sessionID=n.session_id,this.packetManager.ws.checkIfReady()}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;1===n.type?e.fetchUser(n.id).then(t=>{e.user.friends.set(t.id,t)}):2===n.type&&e.fetchUser(n.id).then(t=>{e.user.blocked.set(t.id,t)})}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;2===n.type?e.user.blocked.has(n.id)&&e.user.blocked.delete(n.id):1===n.type&&e.user.friends.has(n.id)&&e.user.friends.delete(n.id)}}t.exports=s},function(t,e,n){function i(t,e){return t.client.setTimeout(()=>{t.client.emit(r.Events.TYPING_STOP,t,e,t._typing.get(e.id)),t._typing.delete(e.id)},6e3)}const s=n(1),r=n(0);class o extends s{handle(t){const e=this.packetManager.client,n=t.d,s=e.channels.get(n.channel_id),o=e.users.get(n.user_id),h=new Date(1e3*n.timestamp);if(s&&o){if("voice"===s.type)return void e.emit(r.Events.WARN,`Discord sent a typing packet to voice channel ${s.id}`);if(s._typing.has(o.id)){const t=s._typing.get(o.id);t.lastTimestamp=h,t.resetTimeout(i(s,o))}else s._typing.set(o.id,new a(e,h,h,i(s,o))),e.emit(r.Events.TYPING_START,s,o)}}}class a{constructor(t,e,n,i){this.client=t,this.since=e,this.lastTimestamp=n,this._timeout=i}resetTimeout(t){this.client.clearTimeout(this._timeout),this._timeout=t}get elapsedTime(){return Date.now()-this.since}}t.exports=o},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.UserNoteUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.UserUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.emit("self.voiceServer",n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0),r=n(4);class o extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);if(i){const t=i.members.get(n.user_id);if(t){const i=r(t);t.voiceChannel&&t.voiceChannel.id!==n.channel_id&&t.voiceChannel.members.delete(i.id),n.channel_id||(t.speaking=null),t.user.id===e.user.id&&n.channel_id&&e.emit("self.voiceStateUpdate",n);const o=e.channels.get(n.channel_id);o&&o.members.set(t.user.id,t),t.serverMute=n.mute,t.serverDeaf=n.deaf,t.selfMute=n.self_mute,t.selfDeaf=n.self_deaf,t.voiceSessionID=n.session_id,t.voiceChannelID=n.channel_id,e.emit(s.Events.VOICE_STATE_UPDATE,i,t)}}}}t.exports=o},function(t,e){class n{constructor(t,e){this.user=t,this.setup(e)}setup(t){this.type=t.type,this.name=t.name,this.id=t.id,this.revoked=t.revoked,this.integrations=t.integrations}}t.exports=n},function(t,e,n){const i=n(3),s=n(158);class r{constructor(t,e){this.user=t,Object.defineProperty(this,"client",{value:t.client}),this.mutualGuilds=new i,this.connections=new i,this.setup(e)}setup(t){this.premium=t.premium;for(const e of t.mutual_guilds)this.client.guilds.has(e.id)&&this.mutualGuilds.set(e.id,this.client.guilds.get(e.id));for(const n of t.connected_accounts)this.connections.set(n.id,new s(this.user,n))}}t.exports=r},function(t,e){t.exports=function(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(const n in t){const i=t[n],s=e.indexOf(i);s&&e.splice(s,1)}return 0===e.length}},function(t,e){t.exports=function(t){if(t.includes("%")&&(t=decodeURIComponent(t)),t.includes(":")){const[e,n]=t.split(":");return{name:e,id:n}}return{name:t,id:null}}},function(t,e,n){const i=n(46);t.exports=function(t,e){if(t.before&&(t.before instanceof Date||(t.before=new Date(t.before)),t.maxID=i.fromNumber(t.before.getTime()-14200704e5).shiftLeft(22).toString()),t.after&&(t.after instanceof Date||(t.after=new Date(t.after)),t.minID=i.fromNumber(t.after.getTime()-14200704e5).shiftLeft(22).toString()),t.during){t.during instanceof Date||(t.during=new Date(t.during));const e=t.during.getTime()-14200704e5;t.minID=i.fromNumber(e).shiftLeft(22).toString(),t.maxID=i.fromNumber(e+864e5).shiftLeft(22).toString()}return t.channel&&(t.channel=e.resolver.resolveChannelID(t.channel)),t.author&&(t.author=e.resolver.resolveUserID(t.author)),t.mentions&&(t.mentions=e.resolver.resolveUserID(t.options.mentions)),{content:t.content,max_id:t.maxID,min_id:t.minID,has:t.has,channel_id:t.channel,author_id:t.author,author_type:t.authorType,context_size:t.contextSize,sort_by:t.sortBy,sort_order:t.sortOrder,limit:t.limit,offset:t.offset,mentions:t.mentions,mentions_everyone:t.mentionsEveryone,link_hostname:t.linkHostname,embed_provider:t.embedProvider,embed_type:t.embedType,attachment_filename:t.attachmentFilename,attachment_extension:t.attachmentExtension}}},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e,n){t.exports={Client:n(58),WebhookClient:n(59),Shard:n(62),ShardClientUtil:n(63),ShardingManager:n(64),Collection:n(3),splitMessage:n(45),escapeMarkdown:n(23),fetchRecommendedShards:n(61),Snowflake:n(16),SnowflakeUtil:n(16),Channel:n(8),ClientOAuth2Application:n(30),ClientUser:n(31),DMChannel:n(32),Emoji:n(10),EvaluatedPermissions:n(20),Game:n(7).Game,GroupDMChannel:n(33),Guild:n(14),GuildChannel:n(15),GuildMember:n(11),Invite:n(34),Message:n(12),MessageAttachment:n(35),MessageCollector:n(36),MessageEmbed:n(37),MessageReaction:n(38),OAuth2Application:n(39),PartialGuild:n(40),PartialGuildChannel:n(41),PermissionOverwrites:n(42),Presence:n(7).Presence,ReactionEmoji:n(21),RichEmbed:n(60),Role:n(9),TextChannel:n(43),User:n(6),VoiceChannel:n(44),Webhook:n(22),version:n(29).version,Constants:n(0)},"undefined"!=typeof window&&(window.Discord=t.exports)}]);
\ No newline at end of file