-
Notifications
You must be signed in to change notification settings - Fork 0
/
DoH.js
62 lines (57 loc) · 129 KB
/
DoH.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const dns = 'https://223.6.6.6/dns-query'
const timeout = 2 * 1000
const type = ['A', 'AAAA']
const ttl = 600
// prettier-ignore
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).doh=e()}}((function(){return function e(t,r,n){function o(s,a){if(!r[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var f=r[s]={exports:{}};t[s][0].call(f.exports,(function(e){return o(t[s][1][e]||e)}),f,f.exports,e,t,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}({1:[function(e,t,r){(function(r){(function(){const n=e("dns-packet"),o=(e("https"),e("http"),e("base32-encode"));e("url").URL;"undefined"!=typeof window&&window.URL;const i=["GET","POST"];class s extends Error{constructor(e="",...t){super(),this.name="MethodNotAllowedError",this.message=e}}function a(e){return-1!==i.indexOf(e)}function u(e,t="A"){return{type:"query",id:0,flags:n.RECURSION_DESIRED,questions:[{type:t,name:e}]}}function c(e,t,o,i,s){return new Promise(((a,u)=>{const c=n.encode(e);if(i||(i={Accept:"application/dns-message","User-Agent":"dohjs/0.2.0"}),"POST"===o)Object.assign(i,{"Content-Type":"application/dns-message","Content-Length":c.length});else if("GET"===o){const e=c.toString("base64").toString("utf-8").replace(/=/g,"");t=`${t}?dns=${e}`}$httpClient[o.toLowerCase()]({url:t,headers:i,"binary-mode":!0,timeout:s?s/1e3:5,body:c},(function(e,t,o){if(e||!o)return u(e||new Error("No data returned"));try{const e=n.decode(r.from(o.buffer));a(e)}catch(e){u(e)}}))}))}const f={sendDohMsg:c,DohResolver:class{constructor(e){this.nameserver_url=e}query(e,t="A",r="POST",n=null,o=null){return new Promise(((i,f)=>{if(!a(r))return f(new s(`Request method ${r} not allowed. Must be either 'GET' or 'POST'`));c(u(e,t),this.nameserver_url,r,n,o).then(i).catch(f)}))}},makeQuery:u,MethodNotAllowedError:s,isMethodAllowed:a,prettify:function(e){for(const t of(e.answers||[]).concat(e.authorities||[]))if(t.hasOwnProperty("data"))switch(t.type){case"TXT":t.data=t.data.toString("utf8");break;case"DNSKEY":t.data.key=t.data.key.toString("base64").replace("=","");break;case"DS":t.data.digest=t.data.digest.toString("hex");break;case"NSEC3":t.data.salt=t.data.salt.toString("hex"),t.data.nextDomain=o(t.data.nextDomain,"RFC4648-HEX").replace("=","");break;case"RRSIG":t.data.signature=t.data.signature.toString("base64").replace("=","")}for(const t of e.additionals||[])if("OPT"===t.type)for(const e of t.options)if(12===e.code)e.length=e.data.length,e.data=e.data.toString("hex").substring(0,80),80===e.data.length&&(e.data+="...");return e},dnsPacket:n};t.exports=f}).call(this)}).call(this,e("buffer").Buffer)},{"base32-encode":2,buffer:5,"dns-packet":8,http:25,https:14,url:45}],2:[function(e,t,r){t.exports=function(e,t,r){var n,o;switch(r=r||{},t){case"RFC3548":case"RFC4648":n="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",o=!0;break;case"RFC4648-HEX":n="0123456789ABCDEFGHIJKLMNOPQRSTUV",o=!0;break;case"Crockford":n="0123456789ABCDEFGHJKMNPQRSTVWXYZ",o=!1;break;default:throw new Error("Unknown base32 variant: "+t)}for(var i=void 0!==r.padding?r.padding:o,s=e.byteLength,a=new Uint8Array(e),u=0,c=0,f="",l=0;l<s;l++)for(c=c<<8|a[l],u+=8;u>=5;)f+=n[c>>>u-5&31],u-=5;if(u>0&&(f+=n[c<<5-u&31]),i)for(;f.length%8!=0;)f+="=";return f}},{}],3:[function(e,t,r){"use strict";r.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return 3*(r+n)/4-n},r.toByteArray=function(e){var t,r,n=u(e),s=n[0],a=n[1],c=new i(function(e,t,r){return 3*(t+r)/4-r}(0,s,a)),f=0,l=a>0?s-4:s;for(r=0;r<l;r+=4)t=o[e.charCodeAt(r)]<<18|o[e.charCodeAt(r+1)]<<12|o[e.charCodeAt(r+2)]<<6|o[e.charCodeAt(r+3)],c[f++]=t>>16&255,c[f++]=t>>8&255,c[f++]=255&t;2===a&&(t=o[e.charCodeAt(r)]<<2|o[e.charCodeAt(r+1)]>>4,c[f++]=255&t);1===a&&(t=o[e.charCodeAt(r)]<<10|o[e.charCodeAt(r+1)]<<4|o[e.charCodeAt(r+2)]>>2,c[f++]=t>>8&255,c[f++]=255&t);return c},r.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],s=16383,a=0,u=r-o;a<u;a+=s)i.push(c(e,a,a+s>u?u:a+s));1===o?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=s[a],o[s.charCodeAt(a)]=a;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,r){for(var o,i,s=[],a=t;a<r;a+=3)o=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},{}],4:[function(e,t,r){},{}],5:[function(e,t,r){(function(t){(function(){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
"use strict";var t=e("base64-js"),n=e("ieee754");r.Buffer=s,r.SlowBuffer=function(e){+e!=e&&(e=0);return s.alloc(+e)},r.INSPECT_MAX_BYTES=50;var o=2147483647;function i(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=s.prototype,t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return a(e,t,r)}function a(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|h(e,t),n=i(r),o=n.write(e,t);o!==r&&(n=n.slice(0,o));return n}(e,t);if(ArrayBuffer.isView(e))return f(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(q(e,ArrayBuffer)||e&&q(e.buffer,ArrayBuffer))return function(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r);return n.__proto__=s.prototype,n}(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return s.from(n,t,r);var o=function(e){if(s.isBuffer(e)){var t=0|l(e.length),r=i(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||F(e.length)?i(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return u(e),i(e<0?0:0|l(e))}function f(e){for(var t=e.length<0?0:0|l(e.length),r=i(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function l(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function h(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||q(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return M(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return D(e).length;default:if(o)return n?-1:M(e).length;t=(""+t).toLowerCase(),o=!0}}function d(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return L(this,t,r);case"utf8":case"utf-8":return R(this,t,r);case"ascii":return T(this,t,r);case"latin1":case"binary":return U(this,t,r);case"base64":return S(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function p(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),F(r=+r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,n,o){var i,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var f=-1;for(i=r;i<a;i++)if(c(e,i)===c(t,-1===f?0:i-f)){if(-1===f&&(f=i),i-f+1===u)return f*s}else-1!==f&&(i-=i-f),f=-1}else for(r+u>a&&(r=a-u),i=r;i>=0;i--){for(var l=!0,h=0;h<u;h++)if(c(e,i+h)!==c(t,h)){l=!1;break}if(l)return i}return-1}function b(e,t,r,n){r=Number(r)||0;var o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=t.length;n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(F(a))return s;e[r+s]=a}return s}function m(e,t,r,n){return j(M(t,e.length-r),e,r,n)}function w(e,t,r,n){return j(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function v(e,t,r,n){return w(e,t,r,n)}function E(e,t,r,n){return j(D(t),e,r,n)}function _(e,t,r,n){return j(function(e,t){for(var r,n,o,i=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function S(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function R(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var i,s,a,u,c=e[o],f=null,l=c>239?4:c>223?3:c>191?2:1;if(o+l<=r)switch(l){case 1:c<128&&(f=c);break;case 2:128==(192&(i=e[o+1]))&&(u=(31&c)<<6|63&i)>127&&(f=u);break;case 3:i=e[o+1],s=e[o+2],128==(192&i)&&128==(192&s)&&(u=(15&c)<<12|(63&i)<<6|63&s)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:i=e[o+1],s=e[o+2],a=e[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(f=u)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),o+=l}return function(e){var t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=I));return r}(n)}r.kMaxLength=o,s.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),s.poolSize=8192,s.from=function(e,t,r){return a(e,t,r)},s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,s.alloc=function(e,t,r){return function(e,t,r){return u(e),e<=0?i(e):void 0!==t?"string"==typeof r?i(e).fill(t,r):i(e).fill(t):i(e)}(e,t,r)},s.allocUnsafe=function(e){return c(e)},s.allocUnsafeSlow=function(e){return c(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),q(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,o=0,i=Math.min(r,n);o<i;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=s.allocUnsafe(t),o=0;for(r=0;r<e.length;++r){var i=e[r];if(q(i,Uint8Array)&&(i=s.from(i)),!s.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o),o+=i.length}return n},s.byteLength=h,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)p(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)p(this,t,t+3),p(this,t+1,t+2);return this},s.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)p(this,t,t+7),p(this,t+1,t+6),p(this,t+2,t+5),p(this,t+3,t+4);return this},s.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?R(this,0,e):d.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s.prototype.compare=function(e,t,r,n,o){if(q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),u=Math.min(i,a),c=this.slice(n,o),f=e.slice(t,r),l=0;l<u;++l)if(c[l]!==f[l]){i=c[l],a=f[l];break}return i<a?-1:a<i?1:0},s.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)},s.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return m(this,e,t,r);case"ascii":return w(this,e,t,r);case"latin1":case"binary":return v(this,e,t,r);case"base64":return E(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function T(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function U(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function L(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=t;i<r;++i)o+=k(e[i]);return o}function A(e,t,r){for(var n=e.slice(t,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function O(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function C(e,t,r,n,o,i){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function B(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function x(e,t,r,o,i){return t=+t,r>>>=0,i||B(e,0,r,4),n.write(e,t,r,o,23,4),r+4}function N(e,t,r,o,i){return t=+t,r>>>=0,i||B(e,0,r,8),n.write(e,t,r,o,52,8),r+8}s.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return n.__proto__=s.prototype,n},s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n},s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);for(var n=this[e+--t],o=1;t>0&&(o*=256);)n+=this[e+--t]*o;return n},s.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},s.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||O(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),n.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||C(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i<r&&(o*=256);)this[t+i]=e/o&255;return t+r},s.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||C(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+r},s.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);C(this,e,t,r,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i<r&&(s*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);C(this,e,t,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,r){return x(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return x(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return N(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return N(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var o=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var i=o-1;i>=0;--i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return o},s.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var o=e.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(e=o)}}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var a=s.isBuffer(e)?e:s.from(e,n),u=a.length;if(0===u)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=a[i%u]}return this};var P=/[^+/0-9A-Za-z-_]/g;function k(e){return e<16?"0"+e.toString(16):e.toString(16)}function M(e,t){var r;t=t||1/0;for(var n=e.length,o=null,i=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function D(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(P,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function j(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function F(e){return e!=e}}).call(this)}).call(this,e("buffer").Buffer)},{"base64-js":3,buffer:5,ieee754:15}],6:[function(e,t,r){t.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},{}],7:[function(e,t,r){"use strict";r.toString=function(e){switch(e){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+e},r.toClass=function(e){switch(e.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}},{}],8:[function(e,t,r){(function(t){(function(){"use strict";const n=e("./types"),o=e("./rcodes"),i=e("./opcodes"),s=e("./classes"),a=e("./optioncodes"),u=e("ip"),c=32768,f=r.txt=r.name={};f.encode=function(e,r,n){r||(r=t.allocUnsafe(f.encodingLength(e))),n||(n=0);const o=n,i=e.replace(/^\.|\.$/gm,"");if(i.length){const e=i.split(".");for(let t=0;t<e.length;t++){const o=r.write(e[t],n+1);r[n]=o,n+=o+1}}return r[n++]=0,f.encode.bytes=n-o,r},f.encode.bytes=0,f.decode=function(e,t){t||(t=0);const r=[],n=t;let o=e[t++];if(0===o)return f.decode.bytes=1,".";if(o>=192){const r=f.decode(e,e.readUInt16BE(t-1)-49152);return f.decode.bytes=2,r}for(;o;){if(o>=192){r.push(f.decode(e,e.readUInt16BE(t-1)-49152)),t++;break}r.push(e.toString("utf-8",t,t+o)),t+=o,o=e[t++]}return f.decode.bytes=t-n,r.join(".")},f.decode.bytes=0,f.encodingLength=function(e){return"."===e?1:t.byteLength(e.replace(/^\.|\.$/gm,""))+2};const l={encode:function(e,r,n){r||(r=t.allocUnsafe(l.encodingLength(e))),n||(n=0);const o=r.write(e,n+1);return r[n]=o,l.encode.bytes=o+1,r}};l.encode.bytes=0,l.decode=function(e,t){t||(t=0);const r=e[t],n=e.toString("utf-8",t+1,t+1+r);return l.decode.bytes=r+1,n},l.decode.bytes=0,l.encodingLength=function(e){return t.byteLength(e)+1};const h={encode:function(e,t,r){t||(t=h.encodingLength(e)),r||(r=0);const n=32767&(e.flags||0),o="response"===e.type?32768:0;return t.writeUInt16BE(e.id||0,r),t.writeUInt16BE(n|o,r+2),t.writeUInt16BE(e.questions.length,r+4),t.writeUInt16BE(e.answers.length,r+6),t.writeUInt16BE(e.authorities.length,r+8),t.writeUInt16BE(e.additionals.length,r+10),t}};h.encode.bytes=12,h.decode=function(e,t){if(t||(t=0),e.length<12)throw new Error("Header must be 12 bytes");const r=e.readUInt16BE(t+2);return{id:e.readUInt16BE(t),type:32768&r?"response":"query",flags:32767&r,flag_qr:1==(r>>15&1),opcode:i.toString(r>>11&15),flag_aa:1==(r>>10&1),flag_tc:1==(r>>9&1),flag_rd:1==(r>>8&1),flag_ra:1==(r>>7&1),flag_z:1==(r>>6&1),flag_ad:1==(r>>5&1),flag_cd:1==(r>>4&1),rcode:o.toString(15&r),questions:new Array(e.readUInt16BE(t+4)),answers:new Array(e.readUInt16BE(t+6)),authorities:new Array(e.readUInt16BE(t+8)),additionals:new Array(e.readUInt16BE(t+10))}},h.decode.bytes=12,h.encodingLength=function(){return 12};const d=r.unknown={};d.encode=function(e,r,n){return r||(r=t.allocUnsafe(d.encodingLength(e))),n||(n=0),r.writeUInt16BE(e.length,n),e.copy(r,n+2),d.encode.bytes=e.length+2,r},d.encode.bytes=0,d.decode=function(e,t){t||(t=0);const r=e.readUInt16BE(t),n=e.slice(t+2,t+2+r);return d.decode.bytes=r+2,n},d.decode.bytes=0,d.encodingLength=function(e){return e.length+2};const p=r.ns={};p.encode=function(e,r,n){return r||(r=t.allocUnsafe(p.encodingLength(e))),n||(n=0),f.encode(e,r,n+2),r.writeUInt16BE(f.encode.bytes,n),p.encode.bytes=f.encode.bytes+2,r},p.encode.bytes=0,p.decode=function(e,t){t||(t=0);const r=e.readUInt16BE(t),n=f.decode(e,t+2);return p.decode.bytes=r+2,n},p.decode.bytes=0,p.encodingLength=function(e){return f.encodingLength(e)+2};const g=r.soa={};g.encode=function(e,r,n){r||(r=t.allocUnsafe(g.encodingLength(e))),n||(n=0);const o=n;return n+=2,f.encode(e.mname,r,n),n+=f.encode.bytes,f.encode(e.rname,r,n),n+=f.encode.bytes,r.writeUInt32BE(e.serial||0,n),n+=4,r.writeUInt32BE(e.refresh||0,n),n+=4,r.writeUInt32BE(e.retry||0,n),n+=4,r.writeUInt32BE(e.expire||0,n),n+=4,r.writeUInt32BE(e.minimum||0,n),n+=4,r.writeUInt16BE(n-o-2,o),g.encode.bytes=n-o,r},g.encode.bytes=0,g.decode=function(e,t){t||(t=0);const r=t,n={};return t+=2,n.mname=f.decode(e,t),t+=f.decode.bytes,n.rname=f.decode(e,t),t+=f.decode.bytes,n.serial=e.readUInt32BE(t),t+=4,n.refresh=e.readUInt32BE(t),t+=4,n.retry=e.readUInt32BE(t),t+=4,n.expire=e.readUInt32BE(t),t+=4,n.minimum=e.readUInt32BE(t),t+=4,g.decode.bytes=t-r,n},g.decode.bytes=0,g.encodingLength=function(e){return 22+f.encodingLength(e.mname)+f.encodingLength(e.rname)};const y=r.txt={};y.encode=function(e,r,n){Array.isArray(e)||(e=[e]);for(let r=0;r<e.length;r++)if("string"==typeof e[r]&&(e[r]=t.from(e[r])),!t.isBuffer(e[r]))throw new Error("Must be a Buffer");r||(r=t.allocUnsafe(y.encodingLength(e))),n||(n=0);const o=n;return n+=2,e.forEach((function(e){r[n++]=e.length,e.copy(r,n,0,e.length),n+=e.length})),r.writeUInt16BE(n-o-2,o),y.encode.bytes=n-o,r},y.encode.bytes=0,y.decode=function(e,t){t||(t=0);const r=t;let n=e.readUInt16BE(t);t+=2;let o=[];for(;n>0;){const r=e[t++];if(--n,n<r)throw new Error("Buffer overflow");o.push(e.slice(t,t+r)),t+=r,n-=r}return y.decode.bytes=t-r,o},y.decode.bytes=0,y.encodingLength=function(e){Array.isArray(e)||(e=[e]);let r=2;return e.forEach((function(e){r+="string"==typeof e?t.byteLength(e)+1:e.length+1})),r};const b=r.null={};b.encode=function(e,r,n){r||(r=t.allocUnsafe(b.encodingLength(e))),n||(n=0),"string"==typeof e&&(e=t.from(e)),e||(e=t.allocUnsafe(0));const o=n;n+=2;const i=e.length;return e.copy(r,n,0,i),n+=i,r.writeUInt16BE(n-o-2,o),b.encode.bytes=n-o,r},b.encode.bytes=0,b.decode=function(e,t){t||(t=0);const r=t,n=e.readUInt16BE(t);t+=2;const o=e.slice(t,t+n);return t+=n,b.decode.bytes=t-r,o},b.decode.bytes=0,b.encodingLength=function(e){return e?(t.isBuffer(e)?e.length:t.byteLength(e))+2:2};const m=r.hinfo={};m.encode=function(e,r,n){r||(r=t.allocUnsafe(m.encodingLength(e))),n||(n=0);const o=n;return n+=2,l.encode(e.cpu,r,n),n+=l.encode.bytes,l.encode(e.os,r,n),n+=l.encode.bytes,r.writeUInt16BE(n-o-2,o),m.encode.bytes=n-o,r},m.encode.bytes=0,m.decode=function(e,t){t||(t=0);const r=t,n={};return t+=2,n.cpu=l.decode(e,t),t+=l.decode.bytes,n.os=l.decode(e,t),t+=l.decode.bytes,m.decode.bytes=t-r,n},m.decode.bytes=0,m.encodingLength=function(e){return l.encodingLength(e.cpu)+l.encodingLength(e.os)+2};const w=r.ptr={},v=r.cname=w,E=r.dname=w;w.encode=function(e,r,n){return r||(r=t.allocUnsafe(w.encodingLength(e))),n||(n=0),f.encode(e,r,n+2),r.writeUInt16BE(f.encode.bytes,n),w.encode.bytes=f.encode.bytes+2,r},w.encode.bytes=0,w.decode=function(e,t){t||(t=0);const r=f.decode(e,t+2);return w.decode.bytes=f.decode.bytes+2,r},w.decode.bytes=0,w.encodingLength=function(e){return f.encodingLength(e)+2};const _=r.srv={};_.encode=function(e,r,n){r||(r=t.allocUnsafe(_.encodingLength(e))),n||(n=0),r.writeUInt16BE(e.priority||0,n+2),r.writeUInt16BE(e.weight||0,n+4),r.writeUInt16BE(e.port||0,n+6),f.encode(e.target,r,n+8);const o=f.encode.bytes+6;return r.writeUInt16BE(o,n),_.encode.bytes=o+2,r},_.encode.bytes=0,_.decode=function(e,t){t||(t=0);const r=e.readUInt16BE(t),n={};return n.priority=e.readUInt16BE(t+2),n.weight=e.readUInt16BE(t+4),n.port=e.readUInt16BE(t+6),n.target=f.decode(e,t+8),_.decode.bytes=r+2,n},_.decode.bytes=0,_.encodingLength=function(e){return 8+f.encodingLength(e.target)};const S=r.caa={};S.ISSUER_CRITICAL=128,S.encode=function(e,r,n){const o=S.encodingLength(e);return r||(r=t.allocUnsafe(S.encodingLength(e))),n||(n=0),e.issuerCritical&&(e.flags=S.ISSUER_CRITICAL),r.writeUInt16BE(o-2,n),n+=2,r.writeUInt8(e.flags||0,n),n+=1,l.encode(e.tag,r,n),n+=l.encode.bytes,r.write(e.value,n),n+=t.byteLength(e.value),S.encode.bytes=o,r},S.encode.bytes=0,S.decode=function(e,t){t||(t=0);const r=e.readUInt16BE(t),n=t+=2,o={};return o.flags=e.readUInt8(t),t+=1,o.tag=l.decode(e,t),t+=l.decode.bytes,o.value=e.toString("utf-8",t,n+r),o.issuerCritical=!!(o.flags&S.ISSUER_CRITICAL),S.decode.bytes=r+2,o},S.decode.bytes=0,S.encodingLength=function(e){return l.encodingLength(e.tag)+l.encodingLength(e.value)+2};const R=r.mx={};R.encode=function(e,r,n){r||(r=t.allocUnsafe(R.encodingLength(e))),n||(n=0);const o=n;return n+=2,r.writeUInt16BE(e.preference||0,n),n+=2,f.encode(e.exchange,r,n),n+=f.encode.bytes,r.writeUInt16BE(n-o-2,o),R.encode.bytes=n-o,r},R.encode.bytes=0,R.decode=function(e,t){t||(t=0);const r=t,n={};return t+=2,n.preference=e.readUInt16BE(t),t+=2,n.exchange=f.decode(e,t),t+=f.decode.bytes,R.decode.bytes=t-r,n},R.encodingLength=function(e){return 4+f.encodingLength(e.exchange)};const I=r.a={};I.encode=function(e,r,n){return r||(r=t.allocUnsafe(I.encodingLength(e))),n||(n=0),r.writeUInt16BE(4,n),n+=2,u.toBuffer(e,r,n),I.encode.bytes=6,r},I.encode.bytes=0,I.decode=function(e,t){t||(t=0),t+=2;const r=u.toString(e,t,4);return I.decode.bytes=6,r},I.decode.bytes=0,I.encodingLength=function(){return 6};const T=r.aaaa={};T.encode=function(e,r,n){return r||(r=t.allocUnsafe(T.encodingLength(e))),n||(n=0),r.writeUInt16BE(16,n),n+=2,u.toBuffer(e,r,n),T.encode.bytes=18,r},T.encode.bytes=0,T.decode=function(e,t){t||(t=0),t+=2;const r=u.toString(e,t,16);return T.decode.bytes=18,r},T.decode.bytes=0,T.encodingLength=function(){return 18};const U=r.option={};U.encode=function(e,r,n){r||(r=t.allocUnsafe(U.encodingLength(e))),n||(n=0);const o=n,i=a.toCode(e.code);if(r.writeUInt16BE(i,n),n+=2,e.data)r.writeUInt16BE(e.data.length,n),n+=2,e.data.copy(r,n),n+=e.data.length;else switch(i){case 8:const t=e.sourcePrefixLength||0,o=e.family||(u.isV4Format(e.ip)?1:2),i=u.toBuffer(e.ip),s=Math.ceil(t/8);r.writeUInt16BE(s+4,n),n+=2,r.writeUInt16BE(o,n),n+=2,r.writeUInt8(t,n++),r.writeUInt8(e.scopePrefixLength||0,n++),i.copy(r,n,0,s),n+=s;break;case 11:e.timeout?(r.writeUInt16BE(2,n),n+=2,r.writeUInt16BE(e.timeout,n),n+=2):(r.writeUInt16BE(0,n),n+=2);break;case 12:const a=e.length||0;r.writeUInt16BE(a,n),n+=2,r.fill(0,n,n+a),n+=a;break;case 14:const c=2*e.tags.length;r.writeUInt16BE(c,n),n+=2;for(const t of e.tags)r.writeUInt16BE(t,n),n+=2;break;default:throw new Error(`Unknown roption code: ${e.code}`)}return U.encode.bytes=n-o,r},U.encode.bytes=0,U.decode=function(e,r){r||(r=0);const n={};n.code=e.readUInt16BE(r),n.type=a.toString(n.code),r+=2;const o=e.readUInt16BE(r);switch(r+=2,n.data=e.slice(r,r+o),n.code){case 8:n.family=e.readUInt16BE(r),r+=2,n.sourcePrefixLength=e.readUInt8(r++),n.scopePrefixLength=e.readUInt8(r++);const i=t.alloc(1===n.family?4:16);e.copy(i,0,r,r+o-4),n.ip=u.toString(i);break;case 11:o>0&&(n.timeout=e.readUInt16BE(r),r+=2);break;case 14:n.tags=[];for(let t=0;t<o;t+=2)n.tags.push(e.readUInt16BE(r)),r+=2}return U.decode.bytes=o+4,n},U.decode.bytes=0,U.encodingLength=function(e){if(e.data)return e.data.length+4;switch(a.toCode(e.code)){case 8:const t=e.sourcePrefixLength||0;return Math.ceil(t/8)+8;case 11:return"number"==typeof e.timeout?6:4;case 12:return e.length+4;case 14:return 4+2*e.tags.length}throw new Error(`Unknown roption code: ${e.code}`)};const L=r.opt={};L.encode=function(e,r,n){r||(r=t.allocUnsafe(L.encodingLength(e))),n||(n=0);const o=n,i=j(e,U);return r.writeUInt16BE(i,n),n=q(e,U,r,n+2),L.encode.bytes=n-o,r},L.encode.bytes=0,L.decode=function(e,t){t||(t=0);const r=t,n=[];let o=e.readUInt16BE(t);t+=2;let i=0;for(;o>0;)n[i++]=U.decode(e,t),t+=U.decode.bytes,o-=U.decode.bytes;return L.decode.bytes=t-r,n},L.decode.bytes=0,L.encodingLength=function(e){return 2+j(e||[],U)};const A=r.dnskey={};A.PROTOCOL_DNSSEC=3,A.ZONE_KEY=128,A.SECURE_ENTRYPOINT=32768,A.encode=function(e,r,n){r||(r=t.allocUnsafe(A.encodingLength(e))),n||(n=0);const o=n,i=e.key;if(!t.isBuffer(i))throw new Error("Key must be a Buffer");return n+=2,r.writeUInt16BE(e.flags,n),n+=2,r.writeUInt8(A.PROTOCOL_DNSSEC,n),n+=1,r.writeUInt8(e.algorithm,n),n+=1,i.copy(r,n,0,i.length),n+=i.length,A.encode.bytes=n-o,r.writeUInt16BE(A.encode.bytes-2,o),r},A.encode.bytes=0,A.decode=function(e,t){t||(t=0);const r=t;var n={},o=e.readUInt16BE(t);if(t+=2,n.flags=e.readUInt16BE(t),t+=2,e.readUInt8(t)!==A.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return t+=1,n.algorithm=e.readUInt8(t),t+=1,n.key=e.slice(t,r+o+2),t+=n.key.length,A.decode.bytes=t-r,n},A.decode.bytes=0,A.encodingLength=function(e){return 6+t.byteLength(e.key)};const O=r.rrsig={};O.encode=function(e,r,o){r||(r=t.allocUnsafe(O.encodingLength(e))),o||(o=0);const i=o,s=e.signature;if(!t.isBuffer(s))throw new Error("Signature must be a Buffer");return o+=2,r.writeUInt16BE(n.toType(e.typeCovered),o),o+=2,r.writeUInt8(e.algorithm,o),o+=1,r.writeUInt8(e.labels,o),o+=1,r.writeUInt32BE(e.originalTTL,o),o+=4,r.writeUInt32BE(e.expiration,o),o+=4,r.writeUInt32BE(e.inception,o),o+=4,r.writeUInt16BE(e.keyTag,o),o+=2,f.encode(e.signersName,r,o),o+=f.encode.bytes,s.copy(r,o,0,s.length),o+=s.length,O.encode.bytes=o-i,r.writeUInt16BE(O.encode.bytes-2,i),r},O.encode.bytes=0,O.decode=function(e,t){t||(t=0);const r=t;var o={},i=e.readUInt16BE(t);return t+=2,o.typeCovered=n.toString(e.readUInt16BE(t)),t+=2,o.algorithm=e.readUInt8(t),t+=1,o.labels=e.readUInt8(t),t+=1,o.originalTTL=e.readUInt32BE(t),t+=4,o.expiration=e.readUInt32BE(t),t+=4,o.inception=e.readUInt32BE(t),t+=4,o.keyTag=e.readUInt16BE(t),t+=2,o.signersName=f.decode(e,t),t+=f.decode.bytes,o.signature=e.slice(t,r+i+2),t+=o.signature.length,O.decode.bytes=t-r,o},O.decode.bytes=0,O.encodingLength=function(e){return 20+f.encodingLength(e.signersName)+t.byteLength(e.signature)};const C=r.rp={};C.encode=function(e,r,n){r||(r=t.allocUnsafe(C.encodingLength(e))),n||(n=0);const o=n;return n+=2,f.encode(e.mbox||".",r,n),n+=f.encode.bytes,f.encode(e.txt||".",r,n),n+=f.encode.bytes,C.encode.bytes=n-o,r.writeUInt16BE(C.encode.bytes-2,o),r},C.encode.bytes=0,C.decode=function(e,t){t||(t=0);const r=t,n={};return t+=2,n.mbox=f.decode(e,t)||".",t+=f.decode.bytes,n.txt=f.decode(e,t)||".",t+=f.decode.bytes,C.decode.bytes=t-r,n},C.decode.bytes=0,C.encodingLength=function(e){return 2+f.encodingLength(e.mbox||".")+f.encodingLength(e.txt||".")};const B={encode:function(e,r,o){r||(r=t.allocUnsafe(B.encodingLength(e))),o||(o=0);const i=o;for(var s=[],a=0;a<e.length;a++){var u=n.toType(e[a]);void 0===s[u>>8]&&(s[u>>8]=[]),s[u>>8][u>>3&31]|=1<<7-(7&u)}for(a=0;a<s.length;a++)if(void 0!==s[a]){var c=t.from(s[a]);r.writeUInt8(a,o),o+=1,r.writeUInt8(c.length,o),o+=1,c.copy(r,o),o+=c.length}return B.encode.bytes=o-i,r}};B.encode.bytes=0,B.decode=function(e,t,r){t||(t=0);const o=t;for(var i=[];t-o<r;){var s=e.readUInt8(t);t+=1;var a=e.readUInt8(t);t+=1;for(var u=0;u<a;u++)for(var c=e.readUInt8(t+u),f=0;f<8;f++)if(c&1<<7-f){var l=n.toString(s<<8|u<<3|f);i.push(l)}t+=a}return B.decode.bytes=t-o,i},B.decode.bytes=0,B.encodingLength=function(e){for(var t=[],r=0;r<e.length;r++){var o=n.toType(e[r]);t[o>>8]=Math.max(t[o>>8]||0,255&o)}var i=0;for(r=0;r<t.length;r++)void 0!==t[r]&&(i+=2+Math.ceil((t[r]+1)/8));return i};const x=r.nsec={};x.encode=function(e,r,n){r||(r=t.allocUnsafe(x.encodingLength(e))),n||(n=0);const o=n;return n+=2,f.encode(e.nextDomain,r,n),n+=f.encode.bytes,B.encode(e.rrtypes,r,n),n+=B.encode.bytes,x.encode.bytes=n-o,r.writeUInt16BE(x.encode.bytes-2,o),r},x.encode.bytes=0,x.decode=function(e,t){t||(t=0);const r=t;var n={},o=e.readUInt16BE(t);return t+=2,n.nextDomain=f.decode(e,t),t+=f.decode.bytes,n.rrtypes=B.decode(e,t,o-(t-r)),t+=B.decode.bytes,x.decode.bytes=t-r,n},x.decode.bytes=0,x.encodingLength=function(e){return 2+f.encodingLength(e.nextDomain)+B.encodingLength(e.rrtypes)};const N=r.nsec3={};N.encode=function(e,r,n){r||(r=t.allocUnsafe(N.encodingLength(e))),n||(n=0);const o=n,i=e.salt;if(!t.isBuffer(i))throw new Error("salt must be a Buffer");const s=e.nextDomain;if(!t.isBuffer(s))throw new Error("nextDomain must be a Buffer");return n+=2,r.writeUInt8(e.algorithm,n),n+=1,r.writeUInt8(e.flags,n),n+=1,r.writeUInt16BE(e.iterations,n),n+=2,r.writeUInt8(i.length,n),n+=1,i.copy(r,n,0,i.length),n+=i.length,r.writeUInt8(s.length,n),n+=1,s.copy(r,n,0,s.length),n+=s.length,B.encode(e.rrtypes,r,n),n+=B.encode.bytes,N.encode.bytes=n-o,r.writeUInt16BE(N.encode.bytes-2,o),r},N.encode.bytes=0,N.decode=function(e,t){t||(t=0);const r=t;var n={},o=e.readUInt16BE(t);t+=2,n.algorithm=e.readUInt8(t),t+=1,n.flags=e.readUInt8(t),t+=1,n.iterations=e.readUInt16BE(t),t+=2;const i=e.readUInt8(t);t+=1,n.salt=e.slice(t,t+i),t+=i;const s=e.readUInt8(t);return t+=1,n.nextDomain=e.slice(t,t+s),t+=s,n.rrtypes=B.decode(e,t,o-(t-r)),t+=B.decode.bytes,N.decode.bytes=t-r,n},N.decode.bytes=0,N.encodingLength=function(e){return 8+e.salt.length+e.nextDomain.length+B.encodingLength(e.rrtypes)};const P=r.ds={};P.encode=function(e,r,n){r||(r=t.allocUnsafe(P.encodingLength(e))),n||(n=0);const o=n,i=e.digest;if(!t.isBuffer(i))throw new Error("Digest must be a Buffer");return n+=2,r.writeUInt16BE(e.keyTag,n),n+=2,r.writeUInt8(e.algorithm,n),n+=1,r.writeUInt8(e.digestType,n),n+=1,i.copy(r,n,0,i.length),n+=i.length,P.encode.bytes=n-o,r.writeUInt16BE(P.encode.bytes-2,o),r},P.encode.bytes=0,P.decode=function(e,t){t||(t=0);const r=t;var n={},o=e.readUInt16BE(t);return t+=2,n.keyTag=e.readUInt16BE(t),t+=2,n.algorithm=e.readUInt8(t),t+=1,n.digestType=e.readUInt8(t),t+=1,n.digest=e.slice(t,r+o+2),t+=n.digest.length,P.decode.bytes=t-r,n},P.decode.bytes=0,P.encodingLength=function(e){return 6+t.byteLength(e.digest)};const k=r.record=function(e){switch(e.toUpperCase()){case"A":return I;case"PTR":return w;case"CNAME":return v;case"DNAME":return E;case"TXT":return y;case"NULL":return b;case"AAAA":return T;case"SRV":return _;case"HINFO":return m;case"CAA":return S;case"NS":return p;case"SOA":return g;case"MX":return R;case"OPT":return L;case"DNSKEY":return A;case"RRSIG":return O;case"RP":return C;case"NSEC":return x;case"NSEC3":return N;case"DS":return P}return d},M=r.answer={};M.encode=function(e,r,o){r||(r=t.allocUnsafe(M.encodingLength(e))),o||(o=0);const i=o;if(f.encode(e.name,r,o),o+=f.encode.bytes,r.writeUInt16BE(n.toType(e.type),o),"OPT"===e.type.toUpperCase()){if("."!==e.name)throw new Error("OPT name must be root.");r.writeUInt16BE(e.udpPayloadSize||4096,o+2),r.writeUInt8(e.extendedRcode||0,o+4),r.writeUInt8(e.ednsVersion||0,o+5),r.writeUInt16BE(e.flags||0,o+6),o+=8,L.encode(e.options||[],r,o),o+=L.encode.bytes}else{let t=s.toClass(void 0===e.class?"IN":e.class);e.flush&&(t|=c),r.writeUInt16BE(t,o+2),r.writeUInt32BE(e.ttl||0,o+4),o+=8;const n=k(e.type);n.encode(e.data,r,o),o+=n.encode.bytes}return M.encode.bytes=o-i,r},M.encode.bytes=0,M.decode=function(e,t){t||(t=0);const r={},o=t;if(r.name=f.decode(e,t),t+=f.decode.bytes,r.type=n.toString(e.readUInt16BE(t)),"OPT"===r.type)r.udpPayloadSize=e.readUInt16BE(t+2),r.extendedRcode=e.readUInt8(t+4),r.ednsVersion=e.readUInt8(t+5),r.flags=e.readUInt16BE(t+6),r.flag_do=1==(r.flags>>15&1),r.options=L.decode(e,t+8),t+=8+L.decode.bytes;else{const n=e.readUInt16BE(t+2);r.ttl=e.readUInt32BE(t+4),r.class=s.toString(-32769&n),r.flush=!!(n&c);const o=k(r.type);r.data=o.decode(e,t+8),t+=8+o.decode.bytes}return M.decode.bytes=t-o,r},M.decode.bytes=0,M.encodingLength=function(e){const t=null!==e.data&&void 0!==e.data?e.data:e.options;return f.encodingLength(e.name)+8+k(e.type).encodingLength(t)};const D=r.question={};function j(e,t){let r=0;for(let n=0;n<e.length;n++)r+=t.encodingLength(e[n]);return r}function q(e,t,r,n){for(let o=0;o<e.length;o++)t.encode(e[o],r,n),n+=t.encode.bytes;return n}function F(e,t,r,n){for(let o=0;o<e.length;o++)e[o]=t.decode(r,n),n+=t.decode.bytes;return n}D.encode=function(e,r,o){r||(r=t.allocUnsafe(D.encodingLength(e))),o||(o=0);const i=o;return f.encode(e.name,r,o),o+=f.encode.bytes,r.writeUInt16BE(n.toType(e.type),o),o+=2,r.writeUInt16BE(s.toClass(void 0===e.class?"IN":e.class),o),o+=2,D.encode.bytes=o-i,e},D.encode.bytes=0,D.decode=function(e,t){t||(t=0);const r=t,o={};o.name=f.decode(e,t),t+=f.decode.bytes,o.type=n.toString(e.readUInt16BE(t)),t+=2,o.class=s.toString(e.readUInt16BE(t)),t+=2;return!!(32768&o.class)&&(o.class&=-32769),D.decode.bytes=t-r,o},D.decode.bytes=0,D.encodingLength=function(e){return f.encodingLength(e.name)+4},r.AUTHORITATIVE_ANSWER=1024,r.TRUNCATED_RESPONSE=512,r.RECURSION_DESIRED=256,r.RECURSION_AVAILABLE=128,r.AUTHENTIC_DATA=32,r.CHECKING_DISABLED=16,r.DNSSEC_OK=32768,r.encode=function(e,n,o){n||(n=t.allocUnsafe(r.encodingLength(e))),o||(o=0);const i=o;return e.questions||(e.questions=[]),e.answers||(e.answers=[]),e.authorities||(e.authorities=[]),e.additionals||(e.additionals=[]),h.encode(e,n,o),o+=h.encode.bytes,o=q(e.questions,D,n,o),o=q(e.answers,M,n,o),o=q(e.authorities,M,n,o),o=q(e.additionals,M,n,o),r.encode.bytes=o-i,n},r.encode.bytes=0,r.decode=function(e,t){t||(t=0);const n=t,o=h.decode(e,t);return t+=h.decode.bytes,t=F(o.questions,D,e,t),t=F(o.answers,M,e,t),t=F(o.authorities,M,e,t),t=F(o.additionals,M,e,t),r.decode.bytes=t-n,o},r.decode.bytes=0,r.encodingLength=function(e){return h.encodingLength(e)+j(e.questions||[],D)+j(e.answers||[],M)+j(e.authorities||[],M)+j(e.additionals||[],M)},r.streamEncode=function(e){const n=r.encode(e),o=t.allocUnsafe(2);o.writeUInt16BE(n.byteLength);const i=t.concat([o,n]);return r.streamEncode.bytes=i.byteLength,i},r.streamEncode.bytes=0,r.streamDecode=function(e){const t=e.readUInt16BE(0);if(e.byteLength<t+2)return null;const n=r.decode(e.slice(2));return r.streamDecode.bytes=r.decode.bytes,n},r.streamDecode.bytes=0}).call(this)}).call(this,e("buffer").Buffer)},{"./classes":7,"./opcodes":9,"./optioncodes":10,"./rcodes":11,"./types":12,buffer:5,ip:17}],9:[function(e,t,r){"use strict";r.toString=function(e){switch(e){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+e},r.toOpcode=function(e){switch(e.toUpperCase()){case"QUERY":return 0;case"IQUERY":return 1;case"STATUS":return 2;case"OPCODE_3":return 3;case"NOTIFY":return 4;case"UPDATE":return 5;case"OPCODE_6":return 6;case"OPCODE_7":return 7;case"OPCODE_8":return 8;case"OPCODE_9":return 9;case"OPCODE_10":return 10;case"OPCODE_11":return 11;case"OPCODE_12":return 12;case"OPCODE_13":return 13;case"OPCODE_14":return 14;case"OPCODE_15":return 15}return 0}},{}],10:[function(e,t,r){"use strict";r.toString=function(e){switch(e){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}return e<0?null:`OPTION_${e}`},r.toCode=function(e){if("number"==typeof e)return e;if(!e)return-1;switch(e.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}const t=e.match(/_(\d+)$/);return t?parseInt(t[1],10):-1}},{}],11:[function(e,t,r){"use strict";r.toString=function(e){switch(e){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+e},r.toRcode=function(e){switch(e.toUpperCase()){case"NOERROR":return 0;case"FORMERR":return 1;case"SERVFAIL":return 2;case"NXDOMAIN":return 3;case"NOTIMP":return 4;case"REFUSED":return 5;case"YXDOMAIN":return 6;case"YXRRSET":return 7;case"NXRRSET":return 8;case"NOTAUTH":return 9;case"NOTZONE":return 10;case"RCODE_11":return 11;case"RCODE_12":return 12;case"RCODE_13":return 13;case"RCODE_14":return 14;case"RCODE_15":return 15}return 0}},{}],12:[function(e,t,r){"use strict";r.toString=function(e){switch(e){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+e},r.toType=function(e){switch(e.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":case"*":return 255}return e.toUpperCase().startsWith("UNKNOWN_")?parseInt(e.slice(8)):0}},{}],13:[function(e,t,r){var n=Object.create||function(e){var t=function(){};return t.prototype=e,new t},o=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return r},i=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function s(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=n(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._maxListeners=void 0;var a,u=10;try{var c={};Object.defineProperty&&Object.defineProperty(c,"x",{value:0}),a=0===c.x}catch(e){a=!1}function f(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function l(e,t,r,o){var i,s,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((s=e._events)?(s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),a=s[t]):(s=e._events=n(null),e._eventsCount=0),a){if("function"==typeof a?a=s[t]=o?[r,a]:[a,r]:o?a.unshift(r):a.push(r),!a.warned&&(i=f(e))&&i>0&&a.length>i){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",u.name,u.message)}}else a=s[t]=r,++e._eventsCount;return e}function h(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t<e.length;++t)e[t]=arguments[t];this.listener.apply(this.target,e)}}function d(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=i.call(h,n);return o.listener=r,n.wrapFn=o,o}function p(e,t,r){var n=e._events;if(!n)return[];var o=n[t];return o?"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):y(o,o.length):[]}function g(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function y(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}a?Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||e!=e)throw new TypeError('"defaultMaxListeners" must be a positive number');u=e}}):s.defaultMaxListeners=u,s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return f(this)},s.prototype.emit=function(e){var t,r,n,o,i,s,a="error"===e;if(s=this._events)a=a&&null==s.error;else if(!a)return!1;if(a){if(arguments.length>1&&(t=arguments[1]),t instanceof Error)throw t;var u=new Error('Unhandled "error" event. ('+t+")");throw u.context=t,u}if(!(r=s[e]))return!1;var c="function"==typeof r;switch(n=arguments.length){case 1:!function(e,t,r){if(t)e.call(r);else for(var n=e.length,o=y(e,n),i=0;i<n;++i)o[i].call(r)}(r,c,this);break;case 2:!function(e,t,r,n){if(t)e.call(r,n);else for(var o=e.length,i=y(e,o),s=0;s<o;++s)i[s].call(r,n)}(r,c,this,arguments[1]);break;case 3:!function(e,t,r,n,o){if(t)e.call(r,n,o);else for(var i=e.length,s=y(e,i),a=0;a<i;++a)s[a].call(r,n,o)}(r,c,this,arguments[1],arguments[2]);break;case 4:!function(e,t,r,n,o,i){if(t)e.call(r,n,o,i);else for(var s=e.length,a=y(e,s),u=0;u<s;++u)a[u].call(r,n,o,i)}(r,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(o=new Array(n-1),i=1;i<n;i++)o[i-1]=arguments[i];!function(e,t,r,n){if(t)e.apply(r,n);else for(var o=e.length,i=y(e,o),s=0;s<o;++s)i[s].apply(r,n)}(r,c,this,o)}return!0},s.prototype.addListener=function(e,t){return l(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return l(this,e,t,!0)},s.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,d(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,d(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,o,i,s,a;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(o=this._events))return this;if(!(r=o[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=n(null):(delete o[e],o.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){a=r[s].listener,i=s;break}if(i<0)return this;0===i?r.shift():function(e,t){for(var r=t,n=r+1,o=e.length;n<o;r+=1,n+=1)e[r]=e[n];e.pop()}(r,i),1===r.length&&(o[e]=r[0]),o.removeListener&&this.emit("removeListener",e,a||t)}return this},s.prototype.removeAllListeners=function(e){var t,r,i;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=n(null),this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=n(null):delete r[e]),this;if(0===arguments.length){var s,a=o(r);for(i=0;i<a.length;++i)"removeListener"!==(s=a[i])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=n(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},s.prototype.listenerCount=g,s.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],14:[function(e,t,r){var n=e("http"),o=e("url"),i=t.exports;for(var s in n)n.hasOwnProperty(s)&&(i[s]=n[s]);function a(e){if("string"==typeof e&&(e=o.parse(e)),e.protocol||(e.protocol="https:"),"https:"!==e.protocol)throw new Error('Protocol "'+e.protocol+'" not supported. Expected "https:"');return e}i.request=function(e,t){return e=a(e),n.request.call(this,e,t)},i.get=function(e,t){return e=a(e),n.get.call(this,e,t)}},{http:25,url:45}],15:[function(e,t,r){
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
r.read=function(e,t,r,n,o){var i,s,a=8*o-n-1,u=(1<<a)-1,c=u>>1,f=-7,l=r?o-1:0,h=r?-1:1,d=e[t+l];for(l+=h,i=d&(1<<-f)-1,d>>=-f,f+=a;f>0;i=256*i+e[t+l],l+=h,f-=8);for(s=i&(1<<-f)-1,i>>=-f,f+=n;f>0;s=256*s+e[t+l],l+=h,f-=8);if(0===i)i=1-c;else{if(i===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),i-=c}return(d?-1:1)*s*Math.pow(2,i-n)},r.write=function(e,t,r,n,o,i){var s,a,u,c=8*i-o-1,f=(1<<c)-1,l=f>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(t*u-1)*Math.pow(2,o),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,o),s=0));o>=8;e[r+d]=255&a,d+=p,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;e[r+d]=255&s,d+=p,s/=256,c-=8);e[r+d-p]|=128*g}},{}],16:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},{}],17:[function(e,t,r){"use strict";var n=r,o=e("buffer").Buffer,i=e("os");n.toBuffer=function(e,t,r){var n;if(r=~~r,this.isV4Format(e))n=t||new o(r+4),e.split(/\./g).map((function(e){n[r++]=255&parseInt(e,10)}));else if(this.isV6Format(e)){var i,s=e.split(":",8);for(i=0;i<s.length;i++){var a;this.isV4Format(s[i])&&(a=this.toBuffer(s[i]),s[i]=a.slice(0,2).toString("hex")),a&&++i<8&&s.splice(i,0,a.slice(2,4).toString("hex"))}if(""===s[0])for(;s.length<8;)s.unshift("0");else if(""===s[s.length-1])for(;s.length<8;)s.push("0");else if(s.length<8){for(i=0;i<s.length&&""!==s[i];i++);var u=[i,1];for(i=9-s.length;i>0;i--)u.push("0");s.splice.apply(s,u)}for(n=t||new o(r+16),i=0;i<s.length;i++){var c=parseInt(s[i],16);n[r++]=c>>8&255,n[r++]=255&c}}if(!n)throw Error("Invalid ip address: "+e);return n},n.toString=function(e,t,r){t=~~t;var n=[];if(4===(r=r||e.length-t)){for(var o=0;o<r;o++)n.push(e[t+o]);n=n.join(".")}else if(16===r){for(o=0;o<r;o+=2)n.push(e.readUInt16BE(t+o).toString(16));n=(n=(n=n.join(":")).replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3")).replace(/:{3,4}/,"::")}return n};var s=/^(\d{1,3}\.){3,3}\d{1,3}$/,a=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i;function u(e){return e?e.toLowerCase():"ipv4"}n.isV4Format=function(e){return s.test(e)},n.isV6Format=function(e){return a.test(e)},n.fromPrefixLen=function(e,t){var r=4;"ipv6"===(t=e>32?"ipv6":u(t))&&(r=16);for(var i=new o(r),s=0,a=i.length;s<a;++s){var c=8;e<8&&(c=e),e-=c,i[s]=255&~(255>>c)}return n.toString(i)},n.mask=function(e,t){e=n.toBuffer(e),t=n.toBuffer(t);var r=new o(Math.max(e.length,t.length)),i=0;if(e.length===t.length)for(i=0;i<e.length;i++)r[i]=e[i]&t[i];else if(4===t.length)for(i=0;i<t.length;i++)r[i]=e[e.length-4+i]&t[i];else{for(i=0;i<r.length-6;i++)r[i]=0;for(r[10]=255,r[11]=255,i=0;i<e.length;i++)r[i+12]=e[i]&t[i+12];i+=12}for(;i<r.length;i++)r[i]=0;return n.toString(r)},n.cidr=function(e){var t=e.split("/"),r=t[0];if(2!==t.length)throw new Error("invalid CIDR subnet: "+r);var o=n.fromPrefixLen(parseInt(t[1],10));return n.mask(r,o)},n.subnet=function(e,t){for(var r=n.toLong(n.mask(e,t)),o=n.toBuffer(t),i=0,s=0;s<o.length;s++)if(255===o[s])i+=8;else for(var a=255&o[s];a;)a=a<<1&255,i++;var u=Math.pow(2,32-i);return{networkAddress:n.fromLong(r),firstAddress:u<=2?n.fromLong(r):n.fromLong(r+1),lastAddress:u<=2?n.fromLong(r+u-1):n.fromLong(r+u-2),broadcastAddress:n.fromLong(r+u-1),subnetMask:t,subnetMaskLength:i,numHosts:u<=2?u:u-2,length:u,contains:function(e){return r===n.toLong(n.mask(e,t))}}},n.cidrSubnet=function(e){var t=e.split("/"),r=t[0];if(2!==t.length)throw new Error("invalid CIDR subnet: "+r);var o=n.fromPrefixLen(parseInt(t[1],10));return n.subnet(r,o)},n.not=function(e){for(var t=n.toBuffer(e),r=0;r<t.length;r++)t[r]=255^t[r];return n.toString(t)},n.or=function(e,t){if(e=n.toBuffer(e),t=n.toBuffer(t),e.length===t.length){for(var r=0;r<e.length;++r)e[r]|=t[r];return n.toString(e)}var o=e,i=t;t.length>e.length&&(o=t,i=e);var s=o.length-i.length;for(r=s;r<o.length;++r)o[r]|=i[r-s];return n.toString(o)},n.isEqual=function(e,t){if(e=n.toBuffer(e),t=n.toBuffer(t),e.length===t.length){for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}if(4===t.length){var o=t;t=e,e=o}for(r=0;r<10;r++)if(0!==t[r])return!1;var i=t.readUInt16BE(10);if(0!==i&&65535!==i)return!1;for(r=0;r<4;r++)if(e[r]!==t[r+12])return!1;return!0},n.isPrivate=function(e){return/^(::f{4}:)?10\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^(::f{4}:)?192\.168\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^(::f{4}:)?172\.(1[6-9]|2\d|30|31)\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^(::f{4}:)?169\.254\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^f[cd][0-9a-f]{2}:/i.test(e)||/^fe80:/i.test(e)||/^::1$/.test(e)||/^::$/.test(e)},n.isPublic=function(e){return!n.isPrivate(e)},n.isLoopback=function(e){return/^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/.test(e)||/^fe80::1$/.test(e)||/^::1$/.test(e)||/^::$/.test(e)},n.loopback=function(e){if("ipv4"!==(e=u(e))&&"ipv6"!==e)throw new Error("family must be ipv4 or ipv6");return"ipv4"===e?"127.0.0.1":"fe80::1"},n.address=function(e,t){var r,o=i.networkInterfaces();if(t=u(t),e&&"private"!==e&&"public"!==e){var s=o[e].filter((function(e){return e.family.toLowerCase()===t}));if(0===s.length)return;return s[0].address}return(r=Object.keys(o).map((function(r){var i=o[r].filter((function(r){return r.family=r.family.toLowerCase(),r.family===t&&!n.isLoopback(r.address)&&(!e||("public"===e?n.isPrivate(r.address):n.isPublic(r.address)))}));return i.length?i[0].address:void 0})).filter(Boolean)).length?r[0]:n.loopback(t)},n.toLong=function(e){var t=0;return e.split(".").forEach((function(e){t<<=8,t+=parseInt(e)})),t>>>0},n.fromLong=function(e){return(e>>>24)+"."+(e>>16&255)+"."+(e>>8&255)+"."+(255&e)}},{buffer:5,os:18}],18:[function(e,t,r){r.endianness=function(){return"LE"},r.hostname=function(){return"undefined"!=typeof location?location.hostname:""},r.loadavg=function(){return[]},r.uptime=function(){return 0},r.freemem=function(){return Number.MAX_VALUE},r.totalmem=function(){return Number.MAX_VALUE},r.cpus=function(){return[]},r.type=function(){return"Browser"},r.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},r.networkInterfaces=r.getNetworkInterfaces=function(){return{}},r.arch=function(){return"javascript"},r.platform=function(){return"browser"},r.tmpdir=r.tmpDir=function(){return"/tmp"},r.EOL="\n",r.homedir=function(){return"/"}},{}],19:[function(e,t,r){var n,o,i=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{o="function"==typeof clearTimeout?clearTimeout:a}catch(e){o=a}}();var c,f=[],l=!1,h=-1;function d(){l&&c&&(l=!1,c.length?f=c.concat(f):h=-1,f.length&&p())}function p(){if(!l){var e=u(d);l=!0;for(var t=f.length;t;){for(c=f,f=[];++h<t;)c&&c[h].run();h=-1,t=f.length}c=null,l=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===a||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{return o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(e)}}function g(e,t){this.fun=e,this.array=t}function y(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];f.push(new g(e,t)),1!==f.length||l||u(p)},g.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=y,i.addListener=y,i.once=y,i.off=y,i.removeListener=y,i.removeAllListeners=y,i.emit=y,i.prependListener=y,i.prependOnceListener=y,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],20:[function(e,t,r){(function(e){(function(){!function(n){var o="object"==typeof r&&r&&!r.nodeType&&r,i="object"==typeof t&&t&&!t.nodeType&&t,s="object"==typeof e&&e;s.global!==s&&s.window!==s&&s.self!==s||(n=s);var a,u,c=2147483647,f=36,l=1,h=26,d=38,p=700,g=72,y=128,b="-",m=/^xn--/,w=/[^\x20-\x7E]/,v=/[\x2E\u3002\uFF0E\uFF61]/g,E={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},_=f-l,S=Math.floor,R=String.fromCharCode;function I(e){throw new RangeError(E[e])}function T(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function U(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+T((e=e.replace(v,".")).split("."),t).join(".")}function L(e){for(var t,r,n=[],o=0,i=e.length;o<i;)(t=e.charCodeAt(o++))>=55296&&t<=56319&&o<i?56320==(64512&(r=e.charCodeAt(o++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),o--):n.push(t);return n}function A(e){return T(e,(function(e){var t="";return e>65535&&(t+=R((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=R(e)})).join("")}function O(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function C(e,t,r){var n=0;for(e=r?S(e/p):e>>1,e+=S(e/t);e>_*h>>1;n+=f)e=S(e/_);return S(n+(_+1)*e/(e+d))}function B(e){var t,r,n,o,i,s,a,u,d,p,m,w=[],v=e.length,E=0,_=y,R=g;for((r=e.lastIndexOf(b))<0&&(r=0),n=0;n<r;++n)e.charCodeAt(n)>=128&&I("not-basic"),w.push(e.charCodeAt(n));for(o=r>0?r+1:0;o<v;){for(i=E,s=1,a=f;o>=v&&I("invalid-input"),((u=(m=e.charCodeAt(o++))-48<10?m-22:m-65<26?m-65:m-97<26?m-97:f)>=f||u>S((c-E)/s))&&I("overflow"),E+=u*s,!(u<(d=a<=R?l:a>=R+h?h:a-R));a+=f)s>S(c/(p=f-d))&&I("overflow"),s*=p;R=C(E-i,t=w.length+1,0==i),S(E/t)>c-_&&I("overflow"),_+=S(E/t),E%=t,w.splice(E++,0,_)}return A(w)}function x(e){var t,r,n,o,i,s,a,u,d,p,m,w,v,E,_,T=[];for(w=(e=L(e)).length,t=y,r=0,i=g,s=0;s<w;++s)(m=e[s])<128&&T.push(R(m));for(n=o=T.length,o&&T.push(b);n<w;){for(a=c,s=0;s<w;++s)(m=e[s])>=t&&m<a&&(a=m);for(a-t>S((c-r)/(v=n+1))&&I("overflow"),r+=(a-t)*v,t=a,s=0;s<w;++s)if((m=e[s])<t&&++r>c&&I("overflow"),m==t){for(u=r,d=f;!(u<(p=d<=i?l:d>=i+h?h:d-i));d+=f)_=u-p,E=f-p,T.push(R(O(p+_%E,0))),u=S(_/E);T.push(R(O(u,0))),i=C(r,v,n==o),r=0,++n}++r,++t}return T.join("")}if(a={version:"1.4.1",ucs2:{decode:L,encode:A},decode:B,encode:x,toASCII:function(e){return U(e,(function(e){return w.test(e)?"xn--"+x(e):e}))},toUnicode:function(e){return U(e,(function(e){return m.test(e)?B(e.slice(4).toLowerCase()):e}))}},o&&i)if(t.exports==o)i.exports=a;else for(u in a)a.hasOwnProperty(u)&&(o[u]=a[u]);else n.punycode=a}(this)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],21:[function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,r,i){t=t||"&",r=r||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;i&&"number"==typeof i.maxKeys&&(u=i.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var f=0;f<c;++f){var l,h,d,p,g=e[f].replace(a,"%20"),y=g.indexOf(r);y>=0?(l=g.substr(0,y),h=g.substr(y+1)):(l=g,h=""),d=decodeURIComponent(l),p=decodeURIComponent(h),n(s,d)?o(s[d])?s[d].push(p):s[d]=[s[d],p]:s[d]=p}return s};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],22:[function(e,t,r){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,r,a){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?i(s(e),(function(s){var a=encodeURIComponent(n(s))+r;return o(e[s])?i(e[s],(function(e){return a+encodeURIComponent(n(e))})).join(t):a+encodeURIComponent(n(e[s]))})).join(t):a?encodeURIComponent(n(a))+r+encodeURIComponent(n(e)):""};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function i(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n<e.length;n++)r.push(t(e[n],n));return r}var s=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t}},{}],23:[function(e,t,r){"use strict";r.decode=r.parse=e("./decode"),r.encode=r.stringify=e("./encode")},{"./decode":21,"./encode":22}],24:[function(e,t,r){
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
var n=e("buffer"),o=n.Buffer;function i(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return o(e,t,r)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?t.exports=n:(i(n,r),r.Buffer=s),s.prototype=Object.create(o.prototype),i(o,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=o(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},{buffer:5}],25:[function(e,t,r){(function(t){(function(){var n=e("./lib/request"),o=e("./lib/response"),i=e("xtend"),s=e("builtin-status-codes"),a=e("url"),u=r;u.request=function(e,r){e="string"==typeof e?a.parse(e):i(e);var o=-1===t.location.protocol.search(/^https?:$/)?"http:":"",s=e.protocol||o,u=e.hostname||e.host,c=e.port,f=e.path||"/";u&&-1!==u.indexOf(":")&&(u="["+u+"]"),e.url=(u?s+"//"+u:"")+(c?":"+c:"")+f,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var l=new n(e);return r&&l.on("response",r),l},u.get=function(e,t){var r=u.request(e,t);return r.end(),r},u.ClientRequest=n,u.IncomingMessage=o.IncomingMessage,u.Agent=function(){},u.Agent.defaultMaxSockets=4,u.globalAgent=new u.Agent,u.STATUS_CODES=s,u.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/request":27,"./lib/response":28,"builtin-status-codes":6,url:45,xtend:48}],26:[function(e,t,r){(function(e){(function(){var t;function n(){if(void 0!==t)return t;if(e.XMLHttpRequest){t=new e.XMLHttpRequest;try{t.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){t=null}}else t=null;return t}function o(e){return"function"==typeof e}r.fetch=o(e.fetch)&&o(e.ReadableStream),r.writableStream=o(e.WritableStream),r.abortController=o(e.AbortController),r.arraybuffer=r.fetch||!0,r.msstream=!r.fetch&&!0,r.mozchunkedarraybuffer=!r.fetch&&!0,r.overrideMimeType=r.fetch||!!n()&&o(n().overrideMimeType),t=null}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],27:[function(e,t,r){(function(r,n,o){(function(){var i=e("./capability"),s=e("inherits"),a=e("./response"),u=e("readable-stream"),c=a.IncomingMessage,f=a.readyStates;var l=t.exports=function(e){var t,r=this;u.Writable.call(r),r._opts=e,r._body=[],r._headers={},e.auth&&r.setHeader("Authorization","Basic "+o.from(e.auth).toString("base64")),Object.keys(e.headers).forEach((function(t){r.setHeader(t,e.headers[t])}));var n=!0;if("disable-fetch"===e.mode||"requestTimeout"in e&&!i.abortController)n=!1,t=!0;else if("prefer-streaming"===e.mode)t=!1;else if("allow-wrong-content-type"===e.mode)t=!i.overrideMimeType;else{if(e.mode&&"default"!==e.mode&&"prefer-fast"!==e.mode)throw new Error("Invalid value for opts.mode");t=!0}r._mode=function(e,t){return i.fetch&&t?"fetch":i.mozchunkedarraybuffer?"moz-chunked-arraybuffer":i.msstream?"ms-stream":i.arraybuffer&&e?"arraybuffer":"text"}(t,n),r._fetchTimer=null,r.on("finish",(function(){r._onFinish()}))};s(l,u.Writable),l.prototype.setHeader=function(e,t){var r=e.toLowerCase();-1===h.indexOf(r)&&(this._headers[r]={name:e,value:t})},l.prototype.getHeader=function(e){var t=this._headers[e.toLowerCase()];return t?t.value:null},l.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},l.prototype._onFinish=function(){var e=this;if(!e._destroyed){var t=e._opts,o=e._headers,s=null;"GET"!==t.method&&"HEAD"!==t.method&&(s=new Blob(e._body,{type:(o["content-type"]||{}).value||""}));var a=[];if(Object.keys(o).forEach((function(e){var t=o[e].name,r=o[e].value;Array.isArray(r)?r.forEach((function(e){a.push([t,e])})):a.push([t,r])})),"fetch"===e._mode){var u=null;if(i.abortController){var c=new AbortController;u=c.signal,e._fetchAbortController=c,"requestTimeout"in t&&0!==t.requestTimeout&&(e._fetchTimer=n.setTimeout((function(){e.emit("requestTimeout"),e._fetchAbortController&&e._fetchAbortController.abort()}),t.requestTimeout))}n.fetch(e._opts.url,{method:e._opts.method,headers:a,body:s||void 0,mode:"cors",credentials:t.withCredentials?"include":"same-origin",signal:u}).then((function(t){e._fetchResponse=t,e._connect()}),(function(t){n.clearTimeout(e._fetchTimer),e._destroyed||e.emit("error",t)}))}else{console.log("!!!!!!!!!!!!!!!!!");var l=e._xhr=new n.XMLHttpRequest;try{l.open(e._opts.method,e._opts.url,!0)}catch(t){return void r.nextTick((function(){e.emit("error",t)}))}"responseType"in l&&(l.responseType=e._mode),"withCredentials"in l&&(l.withCredentials=!!t.withCredentials),"text"===e._mode&&"overrideMimeType"in l&&l.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in t&&(l.timeout=t.requestTimeout,l.ontimeout=function(){e.emit("requestTimeout")}),a.forEach((function(e){l.setRequestHeader(e[0],e[1])})),e._response=null,l.onreadystatechange=function(){switch(l.readyState){case f.LOADING:case f.DONE:e._onXHRProgress()}},"moz-chunked-arraybuffer"===e._mode&&(l.onprogress=function(){e._onXHRProgress()}),l.onerror=function(){e._destroyed||e.emit("error",new Error("XHR error"))};try{l.send(s)}catch(t){return void r.nextTick((function(){e.emit("error",t)}))}}}},l.prototype._onXHRProgress=function(){var e=this;(function(e){try{var t=e.status;return null!==t&&0!==t}catch(e){return!1}})(e._xhr)&&!e._destroyed&&(e._response||e._connect(),e._response._onXHRProgress())},l.prototype._connect=function(){var e=this;e._destroyed||(e._response=new c(e._xhr,e._fetchResponse,e._mode,e._fetchTimer),e._response.on("error",(function(t){e.emit("error",t)})),e.emit("response",e._response))},l.prototype._write=function(e,t,r){this._body.push(e),r()},l.prototype.abort=l.prototype.destroy=function(){var e=this;e._destroyed=!0,n.clearTimeout(e._fetchTimer),e._response&&(e._response._destroyed=!0),e._xhr?e._xhr.abort():e._fetchAbortController&&e._fetchAbortController.abort()},l.prototype.end=function(e,t,r){"function"==typeof e&&(r=e,e=void 0),u.Writable.prototype.end.call(this,e,t,r)},l.prototype.flushHeaders=function(){},l.prototype.setTimeout=function(){},l.prototype.setNoDelay=function(){},l.prototype.setSocketKeepAlive=function(){};var h=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer)},{"./capability":26,"./response":28,_process:19,buffer:5,inherits:16,"readable-stream":43}],28:[function(e,t,r){(function(t,n,o){(function(){var i=e("./capability"),s=e("inherits"),a=e("readable-stream"),u=r.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},c=r.IncomingMessage=function(e,r,s,u){var c=this;if(a.Readable.call(c),c._mode=s,c.headers={},c.rawHeaders=[],c.trailers={},c.rawTrailers=[],c.on("end",(function(){t.nextTick((function(){c.emit("close")}))})),"fetch"===s){if(c._fetchResponse=r,c.url=r.url,c.statusCode=r.status,c.statusMessage=r.statusText,r.headers.forEach((function(e,t){c.headers[t.toLowerCase()]=e,c.rawHeaders.push(t,e)})),i.writableStream){var f=new WritableStream({write:function(e){return new Promise((function(t,r){c._destroyed?r():c.push(o.from(e))?t():c._resumeFetch=t}))},close:function(){n.clearTimeout(u),c._destroyed||c.push(null)},abort:function(e){c._destroyed||c.emit("error",e)}});try{return void r.body.pipeTo(f).catch((function(e){n.clearTimeout(u),c._destroyed||c.emit("error",e)}))}catch(e){}}var l=r.body.getReader();!function e(){l.read().then((function(t){if(!c._destroyed){if(t.done)return n.clearTimeout(u),void c.push(null);c.push(o.from(t.value)),e()}})).catch((function(e){n.clearTimeout(u),c._destroyed||c.emit("error",e)}))}()}else{if(c._xhr=e,c._pos=0,c.url=e.responseURL,c.statusCode=e.status,c.statusMessage=e.statusText,e.getAllResponseHeaders().split(/\r?\n/).forEach((function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var r=t[1].toLowerCase();"set-cookie"===r?(void 0===c.headers[r]&&(c.headers[r]=[]),c.headers[r].push(t[2])):void 0!==c.headers[r]?c.headers[r]+=", "+t[2]:c.headers[r]=t[2],c.rawHeaders.push(t[1],t[2])}})),c._charset="x-user-defined",!i.overrideMimeType){var h=c.rawHeaders["mime-type"];if(h){var d=h.match(/;\s*charset=([^;])(;|$)/);d&&(c._charset=d[1].toLowerCase())}c._charset||(c._charset="utf-8")}}};s(c,a.Readable),c.prototype._read=function(){var e=this._resumeFetch;e&&(this._resumeFetch=null,e())},c.prototype._onXHRProgress=function(){var e=this,t=e._xhr,r=null;switch(e._mode){case"text":if((r=t.responseText).length>e._pos){var i=r.substr(e._pos);if("x-user-defined"===e._charset){for(var s=o.alloc(i.length),a=0;a<i.length;a++)s[a]=255&i.charCodeAt(a);e.push(s)}else e.push(i,e._charset);e._pos=r.length}break;case"arraybuffer":if(t.readyState!==u.DONE||!t.response)break;r=t.response,e.push(o.from(new Uint8Array(r)));break;case"moz-chunked-arraybuffer":if(r=t.response,t.readyState!==u.LOADING||!r)break;e.push(o.from(new Uint8Array(r)));break;case"ms-stream":if(r=t.response,t.readyState!==u.LOADING)break;var c=new n.MSStreamReader;c.onprogress=function(){c.result.byteLength>e._pos&&(e.push(o.from(new Uint8Array(c.result.slice(e._pos)))),e._pos=c.result.byteLength)},c.onload=function(){e.push(null)},c.readAsArrayBuffer(r)}e._xhr.readyState===u.DONE&&"ms-stream"!==e._mode&&e.push(null)}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer)},{"./capability":26,_process:19,buffer:5,inherits:16,"readable-stream":43}],29:[function(e,t,r){"use strict";var n={};function o(e,t,r){r||(r=Error);var o=function(e){var r,n;function o(r,n,o){return e.call(this,function(e,r,n){return"string"==typeof t?t:t(e,r,n)}(r,n,o))||this}return n=e,(r=o).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,o}(r);o.prototype.name=r.name,o.prototype.code=e,n[e]=o}function i(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}o("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),o("ERR_INVALID_ARG_TYPE",(function(e,t,r){var n,o,s,a;if("string"==typeof t&&(o="not ",t.substr(!s||s<0?0:+s,o.length)===o)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))a="The ".concat(e," ").concat(n," ").concat(i(t,"type"));else{var u=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";a='The "'.concat(e,'" ').concat(u," ").concat(n," ").concat(i(t,"type"))}return a+=". Received type ".concat(typeof r)}),TypeError),o("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),o("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),o("ERR_STREAM_PREMATURE_CLOSE","Premature close"),o("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),o("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),o("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),o("ERR_STREAM_WRITE_AFTER_END","write after end"),o("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),o("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),o("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],30:[function(e,t,r){(function(r){(function(){"use strict";var n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=c;var o=e("./_stream_readable"),i=e("./_stream_writable");e("inherits")(c,o);for(var s=n(i.prototype),a=0;a<s.length;a++){var u=s[a];c.prototype[u]||(c.prototype[u]=i.prototype[u])}function c(e){if(!(this instanceof c))return new c(e);o.call(this,e),i.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",f)))}function f(){this._writableState.ended||r.nextTick(l,this)}function l(e){e.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})}).call(this)}).call(this,e("_process"))},{"./_stream_readable":32,"./_stream_writable":34,_process:19,inherits:16}],31:[function(e,t,r){"use strict";t.exports=o;var n=e("./_stream_transform");function o(e){if(!(this instanceof o))return new o(e);n.call(this,e)}e("inherits")(o,n),o.prototype._transform=function(e,t,r){r(null,e)}},{"./_stream_transform":33,inherits:16}],32:[function(e,t,r){(function(r,n){(function(){"use strict";var o;t.exports=I,I.ReadableState=R;e("events").EventEmitter;var i=function(e,t){return e.listeners(t).length},s=e("./internal/streams/stream"),a=e("buffer").Buffer,u=n.Uint8Array||function(){};var c,f=e("util");c=f&&f.debuglog?f.debuglog("stream"):function(){};var l,h,d,p=e("./internal/streams/buffer_list"),g=e("./internal/streams/destroy"),y=e("./internal/streams/state").getHighWaterMark,b=e("../errors").codes,m=b.ERR_INVALID_ARG_TYPE,w=b.ERR_STREAM_PUSH_AFTER_EOF,v=b.ERR_METHOD_NOT_IMPLEMENTED,E=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;e("inherits")(I,s);var _=g.errorOrDestroy,S=["error","close","destroy","pause","resume"];function R(t,r,n){o=o||e("./_stream_duplex"),t=t||{},"boolean"!=typeof n&&(n=r instanceof o),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=y(this,t,"readableHighWaterMark",n),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=e("string_decoder/").StringDecoder),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function I(t){if(o=o||e("./_stream_duplex"),!(this instanceof I))return new I(t);var r=this instanceof o;this._readableState=new R(t,this,r),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),s.call(this)}function T(e,t,r,n,o){c("readableAddChunk",t);var i,s=e._readableState;if(null===t)s.reading=!1,function(e,t){if(c("onEofChunk"),t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?O(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,C(e)))}(e,s);else if(o||(i=function(e,t){var r;n=t,a.isBuffer(n)||n instanceof u||"string"==typeof t||void 0===t||e.objectMode||(r=new m("chunk",["string","Buffer","Uint8Array"],t));var n;return r}(s,t)),i)_(e,i);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===a.prototype||(t=function(e){return a.from(e)}(t)),n)s.endEmitted?_(e,new E):U(e,s,t,!0);else if(s.ended)_(e,new w);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?U(e,s,t,!1):B(e,s)):U(e,s,t,!1)}else n||(s.reading=!1,B(e,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function U(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&O(e)),B(e,t)}Object.defineProperty(I.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),I.prototype.destroy=g.destroy,I.prototype._undestroy=g.undestroy,I.prototype._destroy=function(e,t){t(e)},I.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=a.from(e,t),t=""),r=!0),T(this,e,t,!1,r)},I.prototype.unshift=function(e){return T(this,e,null,!0,!1)},I.prototype.isPaused=function(){return!1===this._readableState.flowing},I.prototype.setEncoding=function(t){l||(l=e("string_decoder/").StringDecoder);var r=new l(t);this._readableState.decoder=r,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,o="";null!==n;)o+=r.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==o&&this._readableState.buffer.push(o),this._readableState.length=o.length,this};var L=1073741824;function A(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=L?e=L:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e){var t=e._readableState;c("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(c("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(C,e))}function C(e){var t=e._readableState;c("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function B(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(x,e,t))}function x(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(c("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function N(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function P(e){c("readable nexttick read 0"),e.read(0)}function k(e,t){c("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),M(e),t.flowing&&!t.reading&&e.read(0)}function M(e){var t=e._readableState;for(c("flow",t.flowing);t.flowing&&null!==e.read(););}function D(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function j(e){var t=e._readableState;c("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(q,t,e))}function q(e,t){if(c("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function F(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}I.prototype.read=function(e){c("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return c("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?j(this):O(this),null;if(0===(e=A(e,t))&&t.ended)return 0===t.length&&j(this),null;var n,o=t.needReadable;return c("need readable",o),(0===t.length||t.length-e<t.highWaterMark)&&c("length less than watermark",o=!0),t.ended||t.reading?c("reading or ended",o=!1):o&&(c("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=A(r,t))),null===(n=e>0?D(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&j(this)),null!==n&&this.emit("data",n),n},I.prototype._read=function(e){_(this,new v("_read()"))},I.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,c("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?u:y;function a(t,r){c("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,c("cleanup"),e.removeListener("close",p),e.removeListener("finish",g),e.removeListener("drain",f),e.removeListener("error",d),e.removeListener("unpipe",a),n.removeListener("end",u),n.removeListener("end",y),n.removeListener("data",h),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function u(){c("onend"),e.end()}o.endEmitted?r.nextTick(s):n.once("end",s),e.on("unpipe",a);var f=function(e){return function(){var t=e._readableState;c("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&i(e,"data")&&(t.flowing=!0,M(e))}}(n);e.on("drain",f);var l=!1;function h(t){c("ondata");var r=e.write(t);c("dest.write",r),!1===r&&((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==F(o.pipes,e))&&!l&&(c("false write response, pause",o.awaitDrain),o.awaitDrain++),n.pause())}function d(t){c("onerror",t),y(),e.removeListener("error",d),0===i(e,"error")&&_(e,t)}function p(){e.removeListener("finish",g),y()}function g(){c("onfinish"),e.removeListener("close",p),y()}function y(){c("unpipe"),n.unpipe(e)}return n.on("data",h),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",d),e.once("close",p),e.once("finish",g),e.emit("pipe",n),o.flowing||(c("pipe resume"),n.resume()),e},I.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,o=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<o;i++)n[i].emit("unpipe",this,{hasUnpiped:!1});return this}var s=F(t.pipes,e);return-1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},I.prototype.on=function(e,t){var n=s.prototype.on.call(this,e,t),o=this._readableState;return"data"===e?(o.readableListening=this.listenerCount("readable")>0,!1!==o.flowing&&this.resume()):"readable"===e&&(o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.flowing=!1,o.emittedReadable=!1,c("on readable",o.length,o.reading),o.length?O(this):o.reading||r.nextTick(P,this))),n},I.prototype.addListener=I.prototype.on,I.prototype.removeListener=function(e,t){var n=s.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(N,this),n},I.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(N,this),t},I.prototype.resume=function(){var e=this._readableState;return e.flowing||(c("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(k,e,t))}(this,e)),e.paused=!1,this},I.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},I.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var o in e.on("end",(function(){if(c("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(o){(c("wrapped data"),r.decoder&&(o=r.decoder.write(o)),r.objectMode&&null==o)||(r.objectMode||o&&o.length)&&(t.push(o)||(n=!0,e.pause()))})),e)void 0===this[o]&&"function"==typeof e[o]&&(this[o]=function(t){return function(){return e[t].apply(e,arguments)}}(o));for(var i=0;i<S.length;i++)e.on(S[i],this.emit.bind(this,S[i]));return this._read=function(t){c("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(I.prototype[Symbol.asyncIterator]=function(){return void 0===h&&(h=e("./internal/streams/async_iterator")),h(this)}),Object.defineProperty(I.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(I.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(I.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),I._fromList=D,Object.defineProperty(I.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(I.from=function(t,r){return void 0===d&&(d=e("./internal/streams/from")),d(I,t,r)})}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":29,"./_stream_duplex":30,"./internal/streams/async_iterator":35,"./internal/streams/buffer_list":36,"./internal/streams/destroy":37,"./internal/streams/from":39,"./internal/streams/state":41,"./internal/streams/stream":42,_process:19,buffer:5,events:13,inherits:16,"string_decoder/":44,util:4}],33:[function(e,t,r){"use strict";t.exports=f;var n=e("../errors").codes,o=n.ERR_METHOD_NOT_IMPLEMENTED,i=n.ERR_MULTIPLE_CALLBACK,s=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,u=e("./_stream_duplex");function c(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new i);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var o=this._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}function f(e){if(!(this instanceof f))return new f(e);u.call(this,e),this._transformState={afterTransform:c.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",l)}function l(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?h(this,null,null):this._flush((function(t,r){h(e,t,r)}))}function h(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new a;if(e._transformState.transforming)throw new s;return e.push(null)}e("inherits")(f,u),f.prototype.push=function(e,t){return this._transformState.needTransform=!1,u.prototype.push.call(this,e,t)},f.prototype._transform=function(e,t,r){r(new o("_transform()"))},f.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var o=this._readableState;(n.needTransform||o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}},f.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},f.prototype._destroy=function(e,t){u.prototype._destroy.call(this,e,(function(e){t(e)}))}},{"../errors":29,"./_stream_duplex":30,inherits:16}],34:[function(e,t,r){(function(r,n){(function(){"use strict";function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var o=n.callback;t.pendingcb--,o(r),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}var i;t.exports=I,I.WritableState=R;var s={deprecate:e("util-deprecate")},a=e("./internal/streams/stream"),u=e("buffer").Buffer,c=n.Uint8Array||function(){};var f,l=e("./internal/streams/destroy"),h=e("./internal/streams/state").getHighWaterMark,d=e("../errors").codes,p=d.ERR_INVALID_ARG_TYPE,g=d.ERR_METHOD_NOT_IMPLEMENTED,y=d.ERR_MULTIPLE_CALLBACK,b=d.ERR_STREAM_CANNOT_PIPE,m=d.ERR_STREAM_DESTROYED,w=d.ERR_STREAM_NULL_VALUES,v=d.ERR_STREAM_WRITE_AFTER_END,E=d.ERR_UNKNOWN_ENCODING,_=l.errorOrDestroy;function S(){}function R(t,n,s){i=i||e("./_stream_duplex"),t=t||{},"boolean"!=typeof s&&(s=n instanceof i),this.objectMode=!!t.objectMode,s&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=h(this,t,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,o=n.sync,i=n.writecb;if("function"!=typeof i)throw new y;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,o,i){--t.pendingcb,n?(r.nextTick(i,o),r.nextTick(C,e,t),e._writableState.errorEmitted=!0,_(e,o)):(i(o),e._writableState.errorEmitted=!0,_(e,o),C(e,t))}(e,n,o,t,i);else{var s=A(n)||e.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||L(e,n),o?r.nextTick(U,e,n,s,i):U(e,n,s,i)}}(n,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function I(t){var r=this instanceof(i=i||e("./_stream_duplex"));if(!r&&!f.call(I,this))return new I(t);this._writableState=new R(t,this,r),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),a.call(this)}function T(e,t,r,n,o,i,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new m("write")):r?e._writev(o,t.onwrite):e._write(o,i,t.onwrite),t.sync=!1}function U(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),C(e,t)}function L(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),s=t.corkedRequestsFree;s.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,T(e,t,!0,t.length,i,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,f=r.encoding,l=r.callback;if(T(e,t,!1,t.objectMode?1:c.length,c,f,l),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function A(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function O(e,t){e._final((function(r){t.pendingcb--,r&&_(e,r),t.prefinished=!0,e.emit("prefinish"),C(e,t)}))}function C(e,t){var n=A(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,r.nextTick(O,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var o=e._readableState;(!o||o.autoDestroy&&o.endEmitted)&&e.destroy()}return n}e("inherits")(I,a),R.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(R.prototype,"buffer",{get:s.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(f=Function.prototype[Symbol.hasInstance],Object.defineProperty(I,Symbol.hasInstance,{value:function(e){return!!f.call(this,e)||this===I&&(e&&e._writableState instanceof R)}})):f=function(e){return e instanceof this},I.prototype.pipe=function(){_(this,new b)},I.prototype.write=function(e,t,n){var o,i=this._writableState,s=!1,a=!i.objectMode&&(o=e,u.isBuffer(o)||o instanceof c);return a&&!u.isBuffer(e)&&(e=function(e){return u.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=S),i.ending?function(e,t){var n=new v;_(e,n),r.nextTick(t,n)}(this,n):(a||function(e,t,n,o){var i;return null===n?i=new w:"string"==typeof n||t.objectMode||(i=new p("chunk",["string","Buffer"],n)),!i||(_(e,i),r.nextTick(o,i),!1)}(this,i,e,n))&&(i.pendingcb++,s=function(e,t,r,n,o,i){if(!r){var s=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=u.from(t,r));return t}(t,n,o);n!==s&&(r=!0,o="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var c=t.length<t.highWaterMark;c||(t.needDrain=!0);if(t.writing||t.corked){var f=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:o,isBuf:r,callback:i,next:null},f?f.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else T(e,t,!1,a,n,o,i);return c}(this,i,a,e,t,n)),s},I.prototype.cork=function(){this._writableState.corked++},I.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||L(this,e))},I.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new E(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(I.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(I.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),I.prototype._write=function(e,t,r){r(new g("_write()"))},I.prototype._writev=null,I.prototype.end=function(e,t,n){var o=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),o.corked&&(o.corked=1,this.uncork()),o.ending||function(e,t,n){t.ending=!0,C(e,t),n&&(t.finished?r.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,o,n),this},Object.defineProperty(I.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(I.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),I.prototype.destroy=l.destroy,I.prototype._undestroy=l.undestroy,I.prototype._destroy=function(e,t){t(e)}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":29,"./_stream_duplex":30,"./internal/streams/destroy":37,"./internal/streams/state":41,"./internal/streams/stream":42,_process:19,buffer:5,inherits:16,"util-deprecate":47}],35:[function(e,t,r){(function(r){(function(){"use strict";var n;function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var i=e("./end-of-stream"),s=Symbol("lastResolve"),a=Symbol("lastReject"),u=Symbol("error"),c=Symbol("ended"),f=Symbol("lastPromise"),l=Symbol("handlePromise"),h=Symbol("stream");function d(e,t){return{value:e,done:t}}function p(e){var t=e[s];if(null!==t){var r=e[h].read();null!==r&&(e[f]=null,e[s]=null,e[a]=null,t(d(r,!1)))}}function g(e){r.nextTick(p,e)}var y=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((o(n={get stream(){return this[h]},next:function(){var e=this,t=this[u];if(null!==t)return Promise.reject(t);if(this[c])return Promise.resolve(d(void 0,!0));if(this[h].destroyed)return new Promise((function(t,n){r.nextTick((function(){e[u]?n(e[u]):t(d(void 0,!0))}))}));var n,o=this[f];if(o)n=new Promise(function(e,t){return function(r,n){e.then((function(){t[c]?r(d(void 0,!0)):t[l](r,n)}),n)}}(o,this));else{var i=this[h].read();if(null!==i)return Promise.resolve(d(i,!1));n=new Promise(this[l])}return this[f]=n,n}},Symbol.asyncIterator,(function(){return this})),o(n,"return",(function(){var e=this;return new Promise((function(t,r){e[h].destroy(null,(function(e){e?r(e):t(d(void 0,!0))}))}))})),n),y);t.exports=function(e){var t,r=Object.create(b,(o(t={},h,{value:e,writable:!0}),o(t,s,{value:null,writable:!0}),o(t,a,{value:null,writable:!0}),o(t,u,{value:null,writable:!0}),o(t,c,{value:e._readableState.endEmitted,writable:!0}),o(t,l,{value:function(e,t){var n=r[h].read();n?(r[f]=null,r[s]=null,r[a]=null,e(d(n,!1))):(r[s]=e,r[a]=t)},writable:!0}),t));return r[f]=null,i(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[a];return null!==t&&(r[f]=null,r[s]=null,r[a]=null,t(e)),void(r[u]=e)}var n=r[s];null!==n&&(r[f]=null,r[s]=null,r[a]=null,n(d(void 0,!0))),r[c]=!0})),e.on("readable",g.bind(null,r)),r}}).call(this)}).call(this,e("_process"))},{"./end-of-stream":38,_process:19}],36:[function(e,t,r){"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var s=e("buffer").Buffer,a=e("util").inspect,u=a&&a.custom||"inspect";t.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,r,c;return t=e,r=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return s.alloc(0);for(var t,r,n,o=s.allocUnsafe(e>>>0),i=this.head,a=0;i;)t=i.data,r=o,n=a,s.prototype.copy.call(t,r,n),a+=i.data.length,i=i.next;return o}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var o=t.data,i=e>o.length?o.length:e;if(i===o.length?n+=o:n+=o.slice(0,e),0==(e-=i)){i===o.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=o.slice(i));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=s.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var o=r.data,i=e>o.length?o.length:e;if(o.copy(t,t.length-e,0,i),0==(e-=i)){i===o.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=o.slice(i));break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return a(this,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},t,{depth:0,customInspect:!1}))}}],r&&i(t.prototype,r),c&&i(t,c),e}()},{buffer:5,util:4}],37:[function(e,t,r){(function(e){(function(){"use strict";function r(e,t){o(e,t),n(e)}function n(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function o(e,t){e.emit("error",t)}t.exports={destroy:function(t,i){var s=this,a=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return a||u?(i?i(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(o,this,t)):e.nextTick(o,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!i&&t?s._writableState?s._writableState.errorEmitted?e.nextTick(n,s):(s._writableState.errorEmitted=!0,e.nextTick(r,s,t)):e.nextTick(r,s,t):i?(e.nextTick(n,s),i(t)):e.nextTick(n,s)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}).call(this)}).call(this,e("_process"))},{_process:19}],38:[function(e,t,r){"use strict";var n=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function o(){}t.exports=function e(t,r,i){if("function"==typeof r)return e(t,null,r);r||(r={}),i=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];e.apply(this,n)}}}(i||o);var s=r.readable||!1!==r.readable&&t.readable,a=r.writable||!1!==r.writable&&t.writable,u=function(){t.writable||f()},c=t._writableState&&t._writableState.finished,f=function(){a=!1,c=!0,s||i.call(t)},l=t._readableState&&t._readableState.endEmitted,h=function(){s=!1,l=!0,a||i.call(t)},d=function(e){i.call(t,e)},p=function(){var e;return s&&!l?(t._readableState&&t._readableState.ended||(e=new n),i.call(t,e)):a&&!c?(t._writableState&&t._writableState.ended||(e=new n),i.call(t,e)):void 0},g=function(){t.req.on("finish",f)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?a&&!t._writableState&&(t.on("end",u),t.on("close",u)):(t.on("complete",f),t.on("abort",p),t.req?g():t.on("request",g)),t.on("end",h),t.on("finish",f),!1!==r.error&&t.on("error",d),t.on("close",p),function(){t.removeListener("complete",f),t.removeListener("abort",p),t.removeListener("request",g),t.req&&t.req.removeListener("finish",f),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",f),t.removeListener("end",h),t.removeListener("error",d),t.removeListener("close",p)}}},{"../../../errors":29}],39:[function(e,t,r){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],40:[function(e,t,r){"use strict";var n;var o=e("../../../errors").codes,i=o.ERR_MISSING_ARGS,s=o.ERR_STREAM_DESTROYED;function a(e){if(e)throw e}function u(e){e()}function c(e,t){return e.pipe(t)}t.exports=function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];var f,l=function(e){return e.length?"function"!=typeof e[e.length-1]?a:e.pop():a}(r);if(Array.isArray(r[0])&&(r=r[0]),r.length<2)throw new i("streams");var h=r.map((function(t,o){var i=o<r.length-1;return function(t,r,o,i){i=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(i);var a=!1;t.on("close",(function(){a=!0})),void 0===n&&(n=e("./end-of-stream")),n(t,{readable:r,writable:o},(function(e){if(e)return i(e);a=!0,i()}));var u=!1;return function(e){if(!a&&!u)return u=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void i(e||new s("pipe"))}}(t,i,o>0,(function(e){f||(f=e),e&&h.forEach(u),i||(h.forEach(u),l(f))}))}));return r.reduce(c)}},{"../../../errors":29,"./end-of-stream":38}],41:[function(e,t,r){"use strict";var n=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(e,t,r,o){var i=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,o,r);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new n(o?r:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384}}},{"../../../errors":29}],42:[function(e,t,r){t.exports=e("events").EventEmitter},{events:13}],43:[function(e,t,r){(r=t.exports=e("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js"),r.finished=e("./lib/internal/streams/end-of-stream.js"),r.pipeline=e("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":30,"./lib/_stream_passthrough.js":31,"./lib/_stream_readable.js":32,"./lib/_stream_transform.js":33,"./lib/_stream_writable.js":34,"./lib/internal/streams/end-of-stream.js":38,"./lib/internal/streams/pipeline.js":40}],44:[function(e,t,r){"use strict";var n=e("safe-buffer").Buffer,o=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function i(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===o||!o(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=c,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=f,this.end=l,t=3;break;default:return this.write=h,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function f(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}r.StringDecoder=i,i.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},i.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},i.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var o=s(t[n]);if(o>=0)return o>0&&(e.lastNeed=o-1),o;if(--n<r||-2===o)return 0;if(o=s(t[n]),o>=0)return o>0&&(e.lastNeed=o-2),o;if(--n<r||-2===o)return 0;if(o=s(t[n]),o>=0)return o>0&&(2===o?o=0:e.lastNeed=o-3),o;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},i.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":24}],45:[function(e,t,r){"use strict";var n=e("punycode"),o=e("./util");function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}r.parse=w,r.resolve=function(e,t){return w(e,!1,!0).resolve(t)},r.resolveObject=function(e,t){return e?w(e,!1,!0).resolveObject(t):t},r.format=function(e){o.isString(e)&&(e=w(e));return e instanceof i?e.format():i.prototype.format.call(e)},r.Url=i;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),f=["'"].concat(c),l=["%","/","?",";","#"].concat(f),h=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},m=e("querystring");function w(e,t,r){if(e&&o.isObject(e)&&e instanceof i)return e;var n=new i;return n.parse(e,t,r),n}i.prototype.parse=function(e,t,r){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),a=-1!==i&&i<e.indexOf("#")?"?":"#",c=e.split(a);c[0]=c[0].replace(/\\/g,"/");var w=e=c.join(a);if(w=w.trim(),!r&&1===e.split("#").length){var v=u.exec(w);if(v)return this.path=w,this.href=w,this.pathname=v[1],v[2]?(this.search=v[2],this.query=t?m.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var E=s.exec(w);if(E){var _=(E=E[0]).toLowerCase();this.protocol=_,w=w.substr(E.length)}if(r||E||w.match(/^\/\/[^@\/]+@[^@\/]+/)){var S="//"===w.substr(0,2);!S||E&&y[E]||(w=w.substr(2),this.slashes=!0)}if(!y[E]&&(S||E&&!b[E])){for(var R,I,T=-1,U=0;U<h.length;U++){-1!==(L=w.indexOf(h[U]))&&(-1===T||L<T)&&(T=L)}-1!==(I=-1===T?w.lastIndexOf("@"):w.lastIndexOf("@",T))&&(R=w.slice(0,I),w=w.slice(I+1),this.auth=decodeURIComponent(R)),T=-1;for(U=0;U<l.length;U++){var L;-1!==(L=w.indexOf(l[U]))&&(-1===T||L<T)&&(T=L)}-1===T&&(T=w.length),this.host=w.slice(0,T),w=w.slice(T),this.parseHost(),this.hostname=this.hostname||"";var A="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!A)for(var O=this.hostname.split(/\./),C=(U=0,O.length);U<C;U++){var B=O[U];if(B&&!B.match(d)){for(var x="",N=0,P=B.length;N<P;N++)B.charCodeAt(N)>127?x+="x":x+=B[N];if(!x.match(d)){var k=O.slice(0,U),M=O.slice(U+1),D=B.match(p);D&&(k.push(D[1]),M.unshift(D[2])),M.length&&(w="/"+M.join(".")+w),this.hostname=k.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),A||(this.hostname=n.toASCII(this.hostname));var j=this.port?":"+this.port:"",q=this.hostname||"";this.host=q+j,this.href+=this.host,A&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==w[0]&&(w="/"+w))}if(!g[_])for(U=0,C=f.length;U<C;U++){var F=f[U];if(-1!==w.indexOf(F)){var H=encodeURIComponent(F);H===F&&(H=escape(F)),w=w.split(F).join(H)}}var W=w.indexOf("#");-1!==W&&(this.hash=w.substr(W),w=w.slice(0,W));var Y=w.indexOf("?");if(-1!==Y?(this.search=w.substr(Y),this.query=w.substr(Y+1),t&&(this.query=m.parse(this.query)),w=w.slice(0,Y)):t&&(this.search="",this.query={}),w&&(this.pathname=w),b[_]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){j=this.pathname||"";var K=this.search||"";this.path=j+K}return this.href=this.format(),this},i.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",r=this.pathname||"",n=this.hash||"",i=!1,s="";this.host?i=e+this.host:this.hostname&&(i=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&o.isObject(this.query)&&Object.keys(this.query).length&&(s=m.stringify(this.query));var a=this.search||s&&"?"+s||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||b[t])&&!1!==i?(i="//"+(i||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):i||(i=""),n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),t+i+(r=r.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(a=a.replace("#","%23"))+n},i.prototype.resolve=function(e){return this.resolveObject(w(e,!1,!0)).format()},i.prototype.resolveObject=function(e){if(o.isString(e)){var t=new i;t.parse(e,!1,!0),e=t}for(var r=new i,n=Object.keys(this),s=0;s<n.length;s++){var a=n[s];r[a]=this[a]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var u=Object.keys(e),c=0;c<u.length;c++){var f=u[c];"protocol"!==f&&(r[f]=e[f])}return b[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!b[e.protocol]){for(var l=Object.keys(e),h=0;h<l.length;h++){var d=l[h];r[d]=e[d]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||y[e.protocol])r.pathname=e.pathname;else{for(var p=(e.pathname||"").split("/");p.length&&!(e.host=p.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),r.pathname=p.join("/")}if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var g=r.pathname||"",m=r.search||"";r.path=g+m}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var w=r.pathname&&"/"===r.pathname.charAt(0),v=e.host||e.pathname&&"/"===e.pathname.charAt(0),E=v||w||r.host&&e.pathname,_=E,S=r.pathname&&r.pathname.split("/")||[],R=(p=e.pathname&&e.pathname.split("/")||[],r.protocol&&!b[r.protocol]);if(R&&(r.hostname="",r.port=null,r.host&&(""===S[0]?S[0]=r.host:S.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===p[0]?p[0]=e.host:p.unshift(e.host)),e.host=null),E=E&&(""===p[0]||""===S[0])),v)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,S=p;else if(p.length)S||(S=[]),S.pop(),S=S.concat(p),r.search=e.search,r.query=e.query;else if(!o.isNullOrUndefined(e.search)){if(R)r.hostname=r.host=S.shift(),(A=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=A.shift(),r.host=r.hostname=A.shift());return r.search=e.search,r.query=e.query,o.isNull(r.pathname)&&o.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!S.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var I=S.slice(-1)[0],T=(r.host||e.host||S.length>1)&&("."===I||".."===I)||""===I,U=0,L=S.length;L>=0;L--)"."===(I=S[L])?S.splice(L,1):".."===I?(S.splice(L,1),U++):U&&(S.splice(L,1),U--);if(!E&&!_)for(;U--;U)S.unshift("..");!E||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),T&&"/"!==S.join("/").substr(-1)&&S.push("");var A,O=""===S[0]||S[0]&&"/"===S[0].charAt(0);R&&(r.hostname=r.host=O?"":S.length?S.shift():"",(A=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=A.shift(),r.host=r.hostname=A.shift()));return(E=E||r.host&&S.length)&&!O&&S.unshift(""),S.length?r.pathname=S.join("/"):(r.pathname=null,r.path=null),o.isNull(r.pathname)&&o.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},i.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{"./util":46,punycode:20,querystring:23}],46:[function(e,t,r){"use strict";t.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],47:[function(e,t,r){(function(e){(function(){function r(t){try{if(!e.localStorage)return!1}catch(e){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(e,t){if(r("noDeprecation"))return e;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],48:[function(e,t,r){t.exports=function(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var o in r)n.call(r,o)&&(e[o]=r[o])}return e};var n=Object.prototype.hasOwnProperty},{}]},{},[1])(1)}));
const result = { addresses: [], ttl }
const resolver = new doh.DohResolver(dns)
const aLookup = resolver.query($domain, 'A', undefined, undefined, timeout)
const aaaaLookup = resolver.query($domain, 'AAAA', undefined, undefined, timeout)
const lookups = {
A: {
lookup: aLookup,
resolve: response => {
response.answers.forEach(ans => {
if (ans.type === 'A' && type.includes(ans.type) && ans.data) {
if (ans.ttl > 0 && ans.ttl < result.ttl) {
result.ttl = ans.ttl
}
result.addresses.push(ans.data)
}
})
},
},
AAAA: {
lookup: aaaaLookup,
resolve: response => {
response.answers.forEach(ans => {
if (ans.type === 'AAAA' && type.includes(ans.type) && ans.data) {
if (ans.ttl > 0 && ans.ttl < result.ttl) {
result.ttl = ans.ttl
}
result.addresses.push(ans.data)
}
})
},
},
}
!(async () => {
const results = await Promise.all(type.map(i => lookups[i].lookup))
type.map((i, index) => lookups[i].resolve(results[index]))
$done(result)
})().catch(async e => {
console.log(e)
$done({})
})