diff --git a/API.md b/API.md index 3796824..1f1d21d 100644 --- a/API.md +++ b/API.md @@ -441,20 +441,23 @@ returns: Depends on mime type; If text/* returns text Oherwise Buffer -##### p_GET(url, {start, end}) +##### p_GET(url, {start, end, retries}) Shortcut to do a HTTP/POST get, sets `mode: cors, redirect: follow, keepalive: true, cache: default` -start: First byte to retrieve -end: Last byte to retrieve (undefined means end of file) +start: First byte to retrieve +end: Last byte to retrieve (undefined means end of file) +wantstream: Return a stream rather than data +retries: How may times to retry if fails at the network layer (i.e. 404 is a success) Note that it passes start and end as the Range header, most servers support it, but it does not (yet) explicitly check the result. -##### p_POST(url, type, data) +##### p_POST(url, type, data, {retries}) Shortcut to do a HTTP/HTTPS POST. sets same options as p_GET data: Data to send to fetch, typically the body, -type: Currently not passed as header{Content-type} because fetch appears to ignore it. +contenttype: Currently not passed as header{Content-type} because fetch appears to ignore it. +retries: How may times to retry if fails at the network layer (i.e. 404 is a success) ## TransportHTTP diff --git a/README.md b/README.md index 99310fd..bef70c9 100644 --- a/README.md +++ b/README.md @@ -132,3 +132,7 @@ See [Dweb document index](./DOCUMENTINDEX.md) for a list of the repos that make * 0.1.37: IPFS - dont stop it if we didnt start it (were stopping via API) * 0.1.37: Start move to unpromisify pattern v5 * 0.1.37: IPFS - updated to (significant) v0.34.0 API changes +* 0.1.38: httptools - adds retries +* 0.1.38: WOLK - added to the library +* 0.1.39: WOLK - updated wolk.js module to fix bugs + diff --git a/TransportHTTP.js b/TransportHTTP.js index 0694232..31f76c1 100644 --- a/TransportHTTP.js +++ b/TransportHTTP.js @@ -88,7 +88,7 @@ class TransportHTTP extends Transport { Fetch from underlying transport, Fetch is used both for contenthash requests and table as when passed to SmartDict.p_fetch may not know what we have url: Of resource - which is turned into the HTTP url in p_httpfetch - opts: {start, end} see p_GET for documentation + opts: {start, end, retries} see p_GET for documentation throws: TransportError if fails */ //if (!(url && url.includes(':') )) diff --git a/TransportWOLK.js b/TransportWOLK.js index b60cadc..1bdcc88 100644 --- a/TransportWOLK.js +++ b/TransportWOLK.js @@ -58,10 +58,10 @@ class TransportWOLK extends Transport { .then( async () => { //TODO-WOLK check - I'm just not familiar with this construct - an async function inside a .then if( this.wolk.ecdsaKey == undefined || this.wolk.ecdsaKey == null ) { var wolkName = "user" + Math.floor((Math.random() * 1000) + 1); - debug("WOLK: createAccount because ecdsaKey null") + debug("createAccount because ecdsaKey null") return await this.wolk.createAccount(wolkName) .then( hash => { - debug("[WOLK] Account Created: [" + wolkName + "] hash: " + hash + " KEY: " + this.wolk.ecdsaKey) + debug("Account Created: [" + wolkName + "] hash: " + hash + " KEY: " + this.wolk.ecdsaKey) }) .catch( err => { throw new Error("Error Creating Account: " + err); diff --git a/dist/dweb-transports-bundle.js b/dist/dweb-transports-bundle.js index 92ab323..2a0dfab 100644 --- a/dist/dweb-transports-bundle.js +++ b/dist/dweb-transports-bundle.js @@ -1,11 +1,11 @@ -!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function t(){return e.default}:function t(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=676)}([function(e,t,r){"use strict";(function(e){ +!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function t(){return e.default}:function t(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=734)}([function(e,t,n){"use strict";(function(e){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -var n=r(682),i=r(346),o=r(37);function s(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}function a(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function v(e){return+e!=e&&(e=0),c.alloc(+e)}function _(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Q(e).length;default:if(n)return J(e).length;t=(""+t).toLowerCase(),n=!0}}function w(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,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return j(this,t,r);case"utf8":case"utf-8":return B(this,t,r);case"ascii":return N(this,t,r);case"latin1":case"binary":return L(this,t,r);case"base64":return R(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function S(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function E(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:k(e,t,r,n,i);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):k(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function k(e,t,r,n,i){var o=1,s=e.length,a=t.length,u;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,s/=2,a/=2,r/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var f=-1;for(u=r;us&&(r=s-a),u=r;u>=0;u--){for(var h=!0,l=0;li&&(n=i)):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s239?4:o>223?3:o>191?2:1,u,c,f,h;if(i+a<=r)switch(a){case 1:o<128&&(s=o);break;case 2:u=e[i+1],128==(192&u)&&(h=(31&o)<<6|63&u,h>127&&(s=h));break;case 3:u=e[i+1],c=e[i+2],128==(192&u)&&128==(192&c)&&(h=(15&o)<<12|(63&u)<<6|63&c,h>2047&&(h<55296||h>57343)&&(s=h));break;case 4:u=e[i+1],c=e[i+2],f=e[i+3],128==(192&u)&&128==(192&c)&&128==(192&f)&&(h=(15&o)<<18|(63&u)<<12|(63&c)<<6|63&f,h>65535&&h<1114112&&(s=h))}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return M(n)}t.Buffer=c,t.SlowBuffer=v,t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:s(),t.kMaxLength=a(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,r){return f(null,e,t,r)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,r){return l(null,e,t,r)},c.allocUnsafe=function(e){return d(null,e)},c.allocUnsafeSlow=function(e){return d(null,e)},c.isBuffer=function e(t){return!(null==t||!t._isBuffer)},c.compare=function e(t,r){if(!c.isBuffer(t)||!c.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var n=t.length,i=r.length,o=0,s=Math.min(n,i);o0&&(r=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(r+=" ... ")),""},c.prototype.compare=function e(t,r,n,i,o){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),r<0||n>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var s=o-i,a=n-r,u=Math.min(s,a),f=this.slice(i,o),h=t.slice(r,n),l=0;lo)&&(n=o),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return x(this,t,r,n);case"utf8":case"utf-8":return C(this,t,r,n);case"ascii":return A(this,t,r,n);case"latin1":case"binary":return I(this,t,r,n);case"base64":return T(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},c.prototype.toJSON=function e(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var P=4096;function M(e){var t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,r,n,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function q(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i>>8*(n?i:1-i)}function z(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i>>8*(n?i:3-i)&255}function H(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function K(e,t,r,n,o){return o||H(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),i.write(e,t,r,n,23,4),r+4}function W(e,t,r,n,o){return o||H(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function e(t,r){var n=this.length,i;if(t=~~t,r=void 0===r?n:~~r,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r0&&(o*=256);)i+=this[t+--r]*o;return i},c.prototype.readUInt8=function e(t,r){return r||F(t,1,this.length),this[t]},c.prototype.readUInt16LE=function e(t,r){return r||F(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function e(t,r){return r||F(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function e(t,r){return r||F(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUInt32BE=function e(t,r){return r||F(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function e(t,r,n){t|=0,r|=0,n||F(t,r,this.length);for(var i=this[t],o=1,s=0;++s=o&&(i-=Math.pow(2,8*r)),i},c.prototype.readIntBE=function e(t,r,n){t|=0,r|=0,n||F(t,r,this.length);for(var i=r,o=1,s=this[t+--i];i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*r)),s},c.prototype.readInt8=function e(t,r){return r||F(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function e(t,r){r||F(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function e(t,r){r||F(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function e(t,r){return r||F(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function e(t,r){return r||F(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function e(t,r){return r||F(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function e(t,r){return r||F(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function e(t,r){return r||F(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function e(t,r){return r||F(t,8,this.length),i.read(this,t,!1,52,8)},c.prototype.writeUIntLE=function e(t,r,n,i){if(t=+t,r|=0,n|=0,!i){var o=Math.pow(2,8*n)-1;U(this,t,r,n,o,0)}var s=1,a=0;for(this[r]=255&t;++a=0&&(a*=256);)this[r+s]=t/a&255;return r+n},c.prototype.writeUInt8=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,1,255,0),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},c.prototype.writeUInt16LE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):q(this,t,r,!0),r+2},c.prototype.writeUInt16BE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):q(this,t,r,!1),r+2},c.prototype.writeUInt32LE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):z(this,t,r,!0),r+4},c.prototype.writeUInt32BE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):z(this,t,r,!1),r+4},c.prototype.writeIntLE=function e(t,r,n,i){if(t=+t,r|=0,!i){var o=Math.pow(2,8*n-1);U(this,t,r,n,o-1,-o)}var s=0,a=1,u=0;for(this[r]=255&t;++s>0)-u&255;return r+n},c.prototype.writeIntBE=function e(t,r,n,i){if(t=+t,r|=0,!i){var o=Math.pow(2,8*n-1);U(this,t,r,n,o-1,-o)}var s=n-1,a=1,u=0;for(this[r+s]=255&t;--s>=0&&(a*=256);)t<0&&0===u&&0!==this[r+s+1]&&(u=1),this[r+s]=(t/a>>0)-u&255;return r+n},c.prototype.writeInt8=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,1,127,-128),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},c.prototype.writeInt16LE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):q(this,t,r,!0),r+2},c.prototype.writeInt16BE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):q(this,t,r,!1),r+2},c.prototype.writeInt32LE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):z(this,t,r,!0),r+4},c.prototype.writeInt32BE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),c.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):z(this,t,r,!1),r+4},c.prototype.writeFloatLE=function e(t,r,n){return K(this,t,r,!0,n)},c.prototype.writeFloatBE=function e(t,r,n){return K(this,t,r,!1,n)},c.prototype.writeDoubleLE=function e(t,r,n){return W(this,t,r,!0,n)},c.prototype.writeDoubleBE=function e(t,r,n){return W(this,t,r,!1,n)},c.prototype.copy=function e(t,r,n,i){if(n||(n=0),i||0===i||(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r=0;--s)t[s+r]=this[s+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(s=0;s>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=r;s55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.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;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function X(e){for(var t=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function Q(e){return n.toByteArray(G(e))}function ee(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function te(e){return e!=e}}).call(this,r(8))},function(e,t){"function"==typeof Object.create?e.exports=function e(t,r){t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function e(t,r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}},function(e,t){var r=e.exports={},n,i;function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!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 u(e){if(i===clearTimeout)return clearTimeout(e);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{return i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(e){i=s}}();var c=[],f=!1,h,l=-1;function d(){f&&h&&(f=!1,h.length?c=h.concat(c):l=-1,c.length&&p())}function p(){if(!f){var e=a(d);f=!0;for(var t=c.length;t;){for(h=c,c=[];++l1)for(var r=1;r=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function v(e){return+e!=e&&(e=0),l.alloc(+e)}function _(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Q(e).length;default:if(r)return J(e).length;t=(""+t).toLowerCase(),r=!0}}function w(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return L(this,t,n);case"utf8":case"utf-8":return P(this,t,n);case"ascii":return N(this,t,n);case"latin1":case"binary":return M(this,t,n);case"base64":return O(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function k(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function S(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:E(e,t,n,r,i);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):E(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function E(e,t,n,r,i){var o=1,s=e.length,a=t.length,u;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,a/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(u=n;us&&(n=s-a),u=n;u>=0;u--){for(var f=!0,h=0;hi&&(r=i)):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s239?4:o>223?3:o>191?2:1,u,l,c,f;if(i+a<=n)switch(a){case 1:o<128&&(s=o);break;case 2:u=e[i+1],128==(192&u)&&(f=(31&o)<<6|63&u,f>127&&(s=f));break;case 3:u=e[i+1],l=e[i+2],128==(192&u)&&128==(192&l)&&(f=(15&o)<<12|(63&u)<<6|63&l,f>2047&&(f<55296||f>57343)&&(s=f));break;case 4:u=e[i+1],l=e[i+2],c=e[i+3],128==(192&u)&&128==(192&l)&&128==(192&c)&&(f=(15&o)<<18|(63&u)<<12|(63&l)<<6|63&c,f>65535&&f<1114112&&(s=f))}null===s?(s=65533,a=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s),i+=a}return R(r)}t.Buffer=l,t.SlowBuffer=v,t.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:s(),t.kMaxLength=a(),l.poolSize=8192,l._augment=function(e){return e.__proto__=l.prototype,e},l.from=function(e,t,n){return c(null,e,t,n)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(e,t,n){return h(null,e,t,n)},l.allocUnsafe=function(e){return p(null,e)},l.allocUnsafeSlow=function(e){return p(null,e)},l.isBuffer=function e(t){return!(null==t||!t._isBuffer)},l.compare=function e(t,n){if(!l.isBuffer(t)||!l.isBuffer(n))throw new TypeError("Arguments must be Buffers");if(t===n)return 0;for(var r=t.length,i=n.length,o=0,s=Math.min(r,i);o0&&(n=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(n+=" ... ")),""},l.prototype.compare=function e(t,n,r,i,o){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===n&&(n=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),n<0||r>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&n>=r)return 0;if(i>=o)return-1;if(n>=r)return 1;if(n>>>=0,r>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var s=o-i,a=r-n,u=Math.min(s,a),c=this.slice(i,o),f=t.slice(n,r),h=0;ho)&&(r=o),t.length>0&&(r<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return x(this,t,n,r);case"utf8":case"utf-8":return C(this,t,n,r);case"ascii":return A(this,t,n,r);case"latin1":case"binary":return I(this,t,n,r);case"base64":return T(this,t,n,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,t,n,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},l.prototype.toJSON=function e(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var B=4096;function R(e){var t=e.length;if(t<=B)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,n,r,i,o){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function z(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function q(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function K(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function H(e,t,n,r,o){return o||K(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),i.write(e,t,n,r,23,4),n+4}function V(e,t,n,r,o){return o||K(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),i.write(e,t,n,r,52,8),n+8}l.prototype.slice=function e(t,n){var r=this.length,i;if(t=~~t,n=void 0===n?r:~~n,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),n<0?(n+=r,n<0&&(n=0)):n>r&&(n=r),n0&&(o*=256);)i+=this[t+--n]*o;return i},l.prototype.readUInt8=function e(t,n){return n||D(t,1,this.length),this[t]},l.prototype.readUInt16LE=function e(t,n){return n||D(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUInt16BE=function e(t,n){return n||D(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUInt32LE=function e(t,n){return n||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUInt32BE=function e(t,n){return n||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readIntLE=function e(t,n,r){t|=0,n|=0,r||D(t,n,this.length);for(var i=this[t],o=1,s=0;++s=o&&(i-=Math.pow(2,8*n)),i},l.prototype.readIntBE=function e(t,n,r){t|=0,n|=0,r||D(t,n,this.length);for(var i=n,o=1,s=this[t+--i];i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*n)),s},l.prototype.readInt8=function e(t,n){return n||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function e(t,n){n||D(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function e(t,n){n||D(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function e(t,n){return n||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function e(t,n){return n||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readFloatLE=function e(t,n){return n||D(t,4,this.length),i.read(this,t,!0,23,4)},l.prototype.readFloatBE=function e(t,n){return n||D(t,4,this.length),i.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function e(t,n){return n||D(t,8,this.length),i.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function e(t,n){return n||D(t,8,this.length),i.read(this,t,!1,52,8)},l.prototype.writeUIntLE=function e(t,n,r,i){if(t=+t,n|=0,r|=0,!i){var o=Math.pow(2,8*r)-1;U(this,t,n,r,o,0)}var s=1,a=0;for(this[n]=255&t;++a=0&&(a*=256);)this[n+s]=t/a&255;return n+r},l.prototype.writeUInt8=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,1,255,0),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[n]=255&t,n+1},l.prototype.writeUInt16LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[n]=255&t,this[n+1]=t>>>8):z(this,t,n,!0),n+2},l.prototype.writeUInt16BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[n]=t>>>8,this[n+1]=255&t):z(this,t,n,!1),n+2},l.prototype.writeUInt32LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[n+3]=t>>>24,this[n+2]=t>>>16,this[n+1]=t>>>8,this[n]=255&t):q(this,t,n,!0),n+4},l.prototype.writeUInt32BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=255&t):q(this,t,n,!1),n+4},l.prototype.writeIntLE=function e(t,n,r,i){if(t=+t,n|=0,!i){var o=Math.pow(2,8*r-1);U(this,t,n,r,o-1,-o)}var s=0,a=1,u=0;for(this[n]=255&t;++s>0)-u&255;return n+r},l.prototype.writeIntBE=function e(t,n,r,i){if(t=+t,n|=0,!i){var o=Math.pow(2,8*r-1);U(this,t,n,r,o-1,-o)}var s=r-1,a=1,u=0;for(this[n+s]=255&t;--s>=0&&(a*=256);)t<0&&0===u&&0!==this[n+s+1]&&(u=1),this[n+s]=(t/a>>0)-u&255;return n+r},l.prototype.writeInt8=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,1,127,-128),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[n]=255&t,n+1},l.prototype.writeInt16LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[n]=255&t,this[n+1]=t>>>8):z(this,t,n,!0),n+2},l.prototype.writeInt16BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[n]=t>>>8,this[n+1]=255&t):z(this,t,n,!1),n+2},l.prototype.writeInt32LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[n]=255&t,this[n+1]=t>>>8,this[n+2]=t>>>16,this[n+3]=t>>>24):q(this,t,n,!0),n+4},l.prototype.writeInt32BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),l.TYPED_ARRAY_SUPPORT?(this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=255&t):q(this,t,n,!1),n+4},l.prototype.writeFloatLE=function e(t,n,r){return H(this,t,n,!0,r)},l.prototype.writeFloatBE=function e(t,n,r){return H(this,t,n,!1,r)},l.prototype.writeDoubleLE=function e(t,n,r){return V(this,t,n,!0,r)},l.prototype.writeDoubleBE=function e(t,n,r){return V(this,t,n,!1,r)},l.prototype.copy=function e(t,n,r,i){if(r||(r=0),i||0===i||(i=this.length),n>=t.length&&(n=t.length),n||(n=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-n=0;--s)t[s+n]=this[s+r];else if(o<1e3||!l.TYPED_ARRAY_SUPPORT)for(s=0;s>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(s=n;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Z(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function Q(e){return r.toByteArray($(e))}function ee(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function te(e){return e!=e}}).call(this,n(8))},function(e,t){"function"==typeof Object.create?e.exports=function e(t,n){t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function e(t,n){t.super_=n;var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}},function(e,t){var n=e.exports={},r,i;function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}function u(e){if(i===clearTimeout)return clearTimeout(e);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{return i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(e){i=s}}();var l=[],c=!1,f,h=-1;function p(){c&&f&&(c=!1,f.length?l=f.concat(l):h=-1,l.length&&d())}function d(){if(!c){var e=a(p);c=!0;for(var t=l.length;t;){for(f=l,l=[];++h1)for(var n=1;n0?r[n]:null,o="function"==typeof i?i:null;return o?e.apply(t,r):new Promise(function(n,i){r.push(function(e,t){if(e)return i(e);n(t)}),e.apply(t,r)})}};e.exports=function(e,t){t=t||{};var r=Object.prototype.toString.call(e);if("[object Object]"===r||"[object Array]"===r){var i=t.replace?e:{};for(var o in e)e.hasOwnProperty(o)&&(i[o]=n(e[o]));return i}return n(e,t.context||e)}},function(e,t,r){var n=r(0),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(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 i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},function(e,t,r){(function(e){function r(e){return Array.isArray?Array.isArray(e):"[object Array]"===m(e)}function n(e){return"boolean"==typeof e}function i(e){return null===e}function o(e){return null==e}function s(e){return"number"==typeof e}function a(e){return"string"==typeof e}function u(e){return"symbol"==typeof e}function c(e){return void 0===e}function f(e){return"[object RegExp]"===m(e)}function h(e){return"object"==typeof e&&null!==e}function l(e){return"[object Date]"===m(e)}function d(e){return"[object Error]"===m(e)||e instanceof Error}function p(e){return"function"==typeof e}function g(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function m(e){return Object.prototype.toString.call(e)}t.isArray=r,t.isBoolean=n,t.isNull=i,t.isNullOrUndefined=o,t.isNumber=s,t.isString=a,t.isSymbol=u,t.isUndefined=c,t.isRegExp=f,t.isObject=h,t.isDate=l,t.isError=d,t.isFunction=p,t.isPrimitive=g,t.isBuffer=e.isBuffer}).call(this,r(0).Buffer)},function(e,t,r){(function(n){function i(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))}),t.splice(i,0,r)}function s(...e){return"object"==typeof console&&console.log&&console.log(...e)}function a(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}}function u(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e}function c(){try{return localStorage}catch(e){}}t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage=c(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=r(681)(t);const{formatters:f}=e.exports;f.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,r(2))},function(e,t,r){"use strict";var n="object"==typeof Reflect?Reflect:null,i=n&&"function"==typeof n.apply?n.apply:function e(t,r,n){return Function.prototype.apply.call(t,r,n)},o;function s(e){console&&console.warn&&console.warn(e)}o=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function e(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function e(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function e(t){return t!=t};function u(){u.init.call(this)}e.exports=u,u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var c=10;function f(e){return void 0===e._maxListeners?u.defaultMaxListeners:e._maxListeners}function h(e,t,r,n){var i,o,a;if("function"!=typeof r)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r);if(o=e._events,void 0===o?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),i=f(e),i>0&&a.length>i&&!a.warned){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,s(u)}return e}function l(){for(var e=[],t=0;t0&&(a=r[0]),a instanceof Error)throw a;var u=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw u.context=a,u}var c=s[t];if(void 0===c)return!1;if("function"==typeof c)i(c,this,r);else for(var f=c.length,h=m(c,f),n=0;n=0;s--)if(n[s]===r||n[s].listener===r){a=n[s].listener,o=s;break}if(o<0)return this;0===o?n.shift():b(n,o),1===n.length&&(i[t]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",t,a||r)}return this},u.prototype.off=u.prototype.removeListener,u.prototype.removeAllListeners=function e(t){var r,n,i;if(n=this._events,void 0===n)return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var o=Object.keys(n),s;for(i=0;i=0;i--)this.removeListener(t,r[i]);return this},u.prototype.listeners=function e(t){return p(this,t,!0)},u.prototype.rawListeners=function e(t){return p(this,t,!1)},u.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},u.prototype.listenerCount=g,u.prototype.eventNames=function e(){return this._eventsCount>0?o(this._events):[]}},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";(function(t){const n=r(33),i=r(95),o=r(718),s=r(264),a=r(720),u=r(51);class c{constructor(r,s,a){if(e.exports.isCID(r)){let e=r;return this.version=e.version,this.codec=e.codec,void(this.multihash=t.from(e.multihash))}if("string"==typeof r)if(i.isEncoded(r)){const e=i.decode(r);r=parseInt(e.slice(0,1).toString("hex"),16),s=o.getCodec(e.slice(1)),a=o.rmPrefix(e.slice(1))}else s="dag-pb",a=n.fromB58String(r),r=0;else if(t.isBuffer(r)){const e=r.slice(0,1),t=parseInt(e.toString("hex"),16);if(0===t||1===t){const e=r;r=t,s=o.getCodec(e.slice(1)),a=o.rmPrefix(e.slice(1))}else s="dag-pb",a=r,r=0}this.codec=s,this.version=r,this.multihash=a,c.validateCID(this)}get buffer(){switch(this.version){case 0:return this.multihash;case 1:return t.concat([t.from("01","hex"),o.getCodeVarint(this.codec),this.multihash]);default:throw new Error("unsupported version")}}get prefix(){return t.concat([t.from(`0${this.version}`,"hex"),o.getCodeVarint(this.codec),n.prefix(this.multihash)])}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:e,length:t}=n.decode(this.multihash);if("sha2-256"!==e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(32!==t)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new f(0,this.codec,this.multihash)}toV1(){return new f(1,this.codec,this.multihash)}toBaseEncodedString(e){switch(e=e||"base58btc",this.version){case 0:if("base58btc"!==e)throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");return n.toB58String(this.multihash);case 1:return i.encode(e,this.buffer).toString();default:throw new Error("Unsupported version")}}toString(e){return this.toBaseEncodedString(e)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(e){return this.codec===e.codec&&this.version===e.version&&this.multihash.equals(e.multihash)}static validateCID(e){let t=a.checkCIDComponents(e);if(t)throw new Error(t)}}const f=u(c,{className:"CID",symbolName:"@ipld/js-cid/CID"});f.codecs=s,e.exports=f}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){function r(e,r,n,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o=arguments.length,s,a;switch(o){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function t(){e.call(null,r)});case 3:return t.nextTick(function t(){e.call(null,r,n)});case 4:return t.nextTick(function t(){e.call(null,r,n,i)});default:for(s=new Array(o-1),a=0;a>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function c(e,t,r){var n=t.length-1;if(n=0?(i>0&&(e.lastNeed=i-1),i):--n=0?(i>0&&(e.lastNeed=i-2),i):--n=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0))}function f(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,"�"}}function h(e){var t=this.lastTotal-this.lastNeed,r=f(this,e,t);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 l(e,t){var r=c(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)}function d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t}function p(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 g(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 m(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 b(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function y(e){return e.toString(this.encoding)}function v(e){return e&&e.length?this.write(e):""}t.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r0?n[r]:null,o="function"==typeof i?i:null;return o?e.apply(t,n):new Promise(function(r,i){n.push(function(e,t){if(e)return i(e);r(t)}),e.apply(t,n)})}};e.exports=function(e,t){t=t||{};var n=Object.prototype.toString.call(e);if("[object Object]"===n||"[object Array]"===n){var i=t.replace?e:{};for(var o in e)e.hasOwnProperty(o)&&(i[o]=r(e[o]));return i}return r(e,t.context||e)}},function(e,t,n){var r=n(0),i=r.Buffer;function o(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=s),o(i,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},s.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){(function(r){function i(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))}),t.splice(i,0,n)}function s(...e){return"object"==typeof console&&console.log&&console.log(...e)}function a(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}}function u(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function l(){try{return localStorage}catch(e){}}t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage=l(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=n(738)(t);const{formatters:c}=e.exports;c.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,n(2))},function(e,t,n){"use strict";var r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function e(t,n,r){return Function.prototype.apply.call(t,n,r)},o;function s(e){console&&console.warn&&console.warn(e)}o=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function e(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function e(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function e(t){return t!=t};function u(){u.init.call(this)}e.exports=u,u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var l=10;function c(e){return void 0===e._maxListeners?u.defaultMaxListeners:e._maxListeners}function f(e,t,n,r){var i,o,a;if("function"!=typeof n)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n);if(o=e._events,void 0===o?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]),void 0===a)a=o[t]=n,++e._eventsCount;else if("function"==typeof a?a=o[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),i=c(e),i>0&&a.length>i&&!a.warned){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,s(u)}return e}function h(){for(var e=[],t=0;t0&&(a=n[0]),a instanceof Error)throw a;var u=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw u.context=a,u}var l=s[t];if(void 0===l)return!1;if("function"==typeof l)i(l,this,n);else for(var c=l.length,f=g(l,c),r=0;r=0;s--)if(r[s]===n||r[s].listener===n){a=r[s].listener,o=s;break}if(o<0)return this;0===o?r.shift():y(r,o),1===r.length&&(i[t]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",t,a||n)}return this},u.prototype.off=u.prototype.removeListener,u.prototype.removeAllListeners=function e(t){var n,r,i;if(r=this._events,void 0===r)return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var o=Object.keys(r),s;for(i=0;i=0;i--)this.removeListener(t,n[i]);return this},u.prototype.listeners=function e(t){return d(this,t,!0)},u.prototype.rawListeners=function e(t){return d(this,t,!1)},u.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},u.prototype.listenerCount=m,u.prototype.eventNames=function e(){return this._eventsCount>0?o(this._events):[]}},function(e,t,n){(function(e){function n(e){return Array.isArray?Array.isArray(e):"[object Array]"===g(e)}function r(e){return"boolean"==typeof e}function i(e){return null===e}function o(e){return null==e}function s(e){return"number"==typeof e}function a(e){return"string"==typeof e}function u(e){return"symbol"==typeof e}function l(e){return void 0===e}function c(e){return"[object RegExp]"===g(e)}function f(e){return"object"==typeof e&&null!==e}function h(e){return"[object Date]"===g(e)}function p(e){return"[object Error]"===g(e)||e instanceof Error}function d(e){return"function"==typeof e}function m(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function g(e){return Object.prototype.toString.call(e)}t.isArray=n,t.isBoolean=r,t.isNull=i,t.isNullOrUndefined=o,t.isNumber=s,t.isString=a,t.isSymbol=u,t.isUndefined=l,t.isRegExp=c,t.isObject=f,t.isDate=h,t.isError=p,t.isFunction=d,t.isPrimitive=m,t.isBuffer=e.isBuffer}).call(this,n(0).Buffer)},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";(function(t){const r=n(42),i=n(105),o=n(777),s=n(293),a=n(782),u=n(60);class l{constructor(n,s,a){if(e.exports.isCID(n)){let e=n;return this.version=e.version,this.codec=e.codec,void(this.multihash=t.from(e.multihash))}if("string"==typeof n)if(i.isEncoded(n)){const e=i.decode(n);n=parseInt(e.slice(0,1).toString("hex"),16),s=o.getCodec(e.slice(1)),a=o.rmPrefix(e.slice(1))}else s="dag-pb",a=r.fromB58String(n),n=0;else if(t.isBuffer(n)){const e=n.slice(0,1),t=parseInt(e.toString("hex"),16);if(0===t||1===t){const e=n;n=t,s=o.getCodec(e.slice(1)),a=o.rmPrefix(e.slice(1))}else s="dag-pb",a=n,n=0}this.codec=s,this.version=n,this.multihash=a,l.validateCID(this)}get buffer(){let e=this._buffer;if(!e){if(0===this.version)e=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");e=t.concat([t.from("01","hex"),o.getCodeVarint(this.codec),this.multihash])}Object.defineProperty(this,"_buffer",{value:e})}return e}get prefix(){return t.concat([t.from(`0${this.version}`,"hex"),o.getCodeVarint(this.codec),r.prefix(this.multihash)])}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:e,length:t}=r.decode(this.multihash);if("sha2-256"!==e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(32!==t)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new c(0,this.codec,this.multihash)}toV1(){return new c(1,this.codec,this.multihash)}toBaseEncodedString(e){switch(e=e||"base58btc",this.version){case 0:if("base58btc"!==e)throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");return r.toB58String(this.multihash);case 1:return i.encode(e,this.buffer).toString();default:throw new Error("Unsupported version")}}toString(e){return this.toBaseEncodedString(e)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(e){return this.codec===e.codec&&this.version===e.version&&this.multihash.equals(e.multihash)}static validateCID(e){let t=a.checkCIDComponents(e);if(t)throw new Error(t)}}const c=u(l,{className:"CID",symbolName:"@ipld/js-cid/CID"});c.codecs=s,e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){function n(e,n,r,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o=arguments.length,s,a;switch(o){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function t(){e.call(null,n)});case 3:return t.nextTick(function t(){e.call(null,n,r)});case 4:return t.nextTick(function t(){e.call(null,n,r,i)});default:for(s=new Array(o-1),a=0;a=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),u=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),b(n)?r.showHidden=n:n&&t._extend(r,n),E(r.showHidden)&&(r.showHidden=!1),E(r.depth)&&(r.depth=2),E(r.colors)&&(r.colors=!1),E(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),f(r,e,r.depth)}function u(e,t){var n=a.styles[t];return n?"["+a.colors[n][0]+"m"+e+"["+a.colors[n][1]+"m":e}function l(e,t){return e}function c(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function f(e,n,r){if(e.customInspect&&n&&T(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return k(i)||(i=f(e,i,r)),i}var o=h(e,n);if(o)return o;var s=Object.keys(n),a=c(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(n)),I(n)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return p(n);if(0===s.length){if(T(n)){var u=n.name?": "+n.name:"";return e.stylize("[Function"+u+"]","special")}if(x(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(A(n))return e.stylize(Date.prototype.toString.call(n),"date");if(I(n))return p(n)}var l="",b=!1,v=["{","}"],_;if(y(n)&&(b=!0,v=["[","]"]),T(n)){var w=n.name?": "+n.name:"";l=" [Function"+w+"]"}return x(n)&&(l=" "+RegExp.prototype.toString.call(n)),A(n)&&(l=" "+Date.prototype.toUTCString.call(n)),I(n)&&(l=" "+p(n)),0!==s.length||b&&0!=n.length?r<0?x(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),_=b?d(e,n,r,a,s):s.map(function(t){return m(e,n,r,a,t,b)}),e.seen.pop(),g(_,l,v)):v[0]+l+v[1]}function h(e,t){if(E(t))return e.stylize("undefined","undefined");if(k(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return w(t)?e.stylize(""+t,"number"):b(t)?e.stylize(""+t,"boolean"):v(t)?e.stylize("null","null"):void 0}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,n,r,i){for(var o=[],s=0,a=t.length;s-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n"))):a=e.stylize("[Circular]","special")),E(s)){if(o&&i.match(/^\d+$/))return a;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function g(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function y(e){return Array.isArray(e)}function b(e){return"boolean"==typeof e}function v(e){return null===e}function _(e){return null==e}function w(e){return"number"==typeof e}function k(e){return"string"==typeof e}function S(e){return"symbol"==typeof e}function E(e){return void 0===e}function x(e){return C(e)&&"[object RegExp]"===O(e)}function C(e){return"object"==typeof e&&null!==e}function A(e){return C(e)&&"[object Date]"===O(e)}function I(e){return C(e)&&("[object Error]"===O(e)||e instanceof Error)}function T(e){return"function"==typeof e}function j(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function O(e){return Object.prototype.toString.call(e)}function P(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(n){if(E(s)&&(s=e.env.NODE_DEBUG||""),n=n.toUpperCase(),!o[n])if(new RegExp("\\b"+n+"\\b","i").test(s)){var r=e.pid;o[n]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",n,r,e)}}else o[n]=function(){};return o[n]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=y,t.isBoolean=b,t.isNull=v,t.isNullOrUndefined=_,t.isNumber=w,t.isString=k,t.isSymbol=S,t.isUndefined=E,t.isRegExp=x,t.isObject=C,t.isDate=A,t.isError=I,t.isFunction=T,t.isPrimitive=j,t.isBuffer=n(795);var B=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function R(){var e=new Date,t=[P(e.getHours()),P(e.getMinutes()),P(e.getSeconds())].join(":");return[e.getDate(),B[e.getMonth()],t].join(" ")}function N(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",R(),t.format.apply(t,arguments))},t.inherits=n(1),t._extend=function(e,t){if(!t||!C(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};var M="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function L(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}function F(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');function n(){for(var n=[],r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e,t,n){var r=t.length-1;if(r=0?(i>0&&(e.lastNeed=i-1),i):--r=0?(i>0&&(e.lastNeed=i-2),i):--r=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0))}function c(e,t,n){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,"�"}}function f(e){var t=this.lastTotal-this.lastNeed,n=c(this,e,t);return void 0!==n?n: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 h(e,t){var n=l(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)}function p(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t}function d(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function m(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function g(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?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-n))}function y(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function b(e){return e.toString(this.encoding)}function v(e){return e&&e.length?this.write(e):""}t.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n @@ -37,35 +37,275 @@ var n=function(e,t){return function(){var r=Array.prototype.slice.call(arguments * Based on Underscore.js 1.8.3 * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license - */(function(){var o,s="3.10.1",a=1,u=2,c=4,f=8,h=16,l=32,d=64,p=128,g=256,m=30,b="...",y=150,v=16,_=200,w=1,S=2,E="Expected a function",k="__lodash_placeholder__",x="[object Arguments]",C="[object Array]",A="[object Boolean]",I="[object Date]",T="[object Error]",O="[object Function]",R="[object Map]",B="[object Number]",P="[object Object]",M="[object RegExp]",N="[object Set]",L="[object String]",j="[object WeakMap]",D="[object ArrayBuffer]",F="[object Float32Array]",U="[object Float64Array]",q="[object Int8Array]",z="[object Int16Array]",H="[object Int32Array]",K="[object Uint8Array]",W="[object Uint8ClampedArray]",V="[object Uint16Array]",G="[object Uint32Array]",$=/\b__p \+= '';/g,Y=/\b(__p \+=) '' \+/g,J=/(__e\(.*?\)|\b__t\)) \+\n'';/g,X=/&(?:amp|lt|gt|quot|#39|#96);/g,Z=/[&<>"'`]/g,Q=RegExp(X.source),ee=RegExp(Z.source),te=/<%-([\s\S]+?)%>/g,re=/<%([\s\S]+?)%>/g,ne=/<%=([\s\S]+?)%>/g,ie=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,oe=/^\w*$/,se=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,ae=/^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,ue=RegExp(ae.source),ce=/[\u0300-\u036f\ufe20-\ufe23]/g,fe=/\\(\\)?/g,he=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,le=/\w*$/,de=/^0[xX]/,pe=/^\[object .+?Constructor\]$/,ge=/^\d+$/,me=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,be=/($^)/,ye=/['\n\r\u2028\u2029\\]/g,ve=(_e="[A-Z\\xc0-\\xd6\\xd8-\\xde]",we="[a-z\\xdf-\\xf6\\xf8-\\xff]+",RegExp(_e+"+(?="+_e+we+")|"+_e+"?"+we+"|"+_e+"+|[0-9]+","g")),_e,we,Se=["Array","ArrayBuffer","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Math","Number","Object","RegExp","Set","String","_","clearTimeout","isFinite","parseFloat","parseInt","setTimeout","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap"],Ee=-1,ke={};ke[F]=ke[U]=ke[q]=ke[z]=ke[H]=ke[K]=ke[W]=ke[V]=ke[G]=!0,ke[x]=ke[C]=ke[D]=ke[A]=ke[I]=ke[T]=ke[O]=ke[R]=ke[B]=ke[P]=ke[M]=ke[N]=ke[L]=ke[j]=!1;var xe={};xe[x]=xe[C]=xe[D]=xe[A]=xe[I]=xe[F]=xe[U]=xe[q]=xe[z]=xe[H]=xe[B]=xe[P]=xe[M]=xe[L]=xe[K]=xe[W]=xe[V]=xe[G]=!0,xe[T]=xe[O]=xe[R]=xe[N]=xe[j]=!1;var Ce={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"},Ae={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Ie={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Te={function:!0,object:!0},Oe={0:"x30",1:"x31",2:"x32",3:"x33",4:"x34",5:"x35",6:"x36",7:"x37",8:"x38",9:"x39",A:"x41",B:"x42",C:"x43",D:"x44",E:"x45",F:"x46",a:"x61",b:"x62",c:"x63",d:"x64",e:"x65",f:"x66",n:"x6e",r:"x72",t:"x74",u:"x75",v:"x76",x:"x78"},Re={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Be=Te[typeof t]&&t&&!t.nodeType&&t,Pe=Te[typeof e]&&e&&!e.nodeType&&e,Me=Be&&Pe&&"object"==typeof n&&n&&n.Object&&n,Ne=Te[typeof self]&&self&&self.Object&&self,Le=Te[typeof window]&&window&&window.Object&&window,je=Pe&&Pe.exports===Be&&Be,De=Me||Le!==(this&&this.window)&&Le||Ne||this;function Fe(e,t){if(e!==t){var r=null===e,n=e===o,i=e==e,s=null===t,a=t===o,u=t==t;if(e>t&&!s||!i||r&&!a&&u||n&&u)return 1;if(e-1;);return r}function We(e,t){for(var r=e.length;r--&&t.indexOf(e.charAt(r))>-1;);return r}function Ve(e,t){return Fe(e.criteria,t.criteria)||e.index-t.index}function Ge(e,t,r){for(var n=-1,i=e.criteria,o=t.criteria,s=i.length,a=r.length;++n=a)return u;var c=r[n];return u*("asc"===c||!0===c?1:-1)}}return e.index-t.index}function $e(e){return Ce[e]}function Ye(e){return Ae[e]}function Je(e,t,r){return t?e=Oe[e]:r&&(e=Re[e]),"\\"+e}function Xe(e){return"\\"+Re[e]}function Ze(e,t,r){for(var n=e.length,i=t+(r?0:-1);r?i--:++i=9&&e<=13||32==e||160==e||5760==e||6158==e||e>=8192&&(e<=8202||8232==e||8233==e||8239==e||8287==e||12288==e||65279==e)}function tt(e,t){for(var r=-1,n=e.length,i=-1,o=[];++r>>1,Rt=9007199254740991,Bt=pt&&new pt,Pt={};function Mt(e){if(Qe(e)&&!ys(e)&&!(e instanceof Dt)){if(e instanceof Lt)return e;if(Re.call(e,"__chain__")&&Re.call(e,"__wrapped__"))return vi(e)}return new Lt(e)}function Nt(){}function Lt(e,t,r){this.__wrapped__=e,this.__actions__=r||[],this.__chain__=!!t}var jt=Mt.support={};function Dt(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=At,this.__views__=[]}function Ft(){var e=new Dt(this.__wrapped__);return e.__actions__=Xt(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Xt(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Xt(this.__views__),e}function Ut(){if(this.__filtered__){var e=new Dt(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function qt(){var e=this.__wrapped__.value(),t=this.__dir__,r=ys(e),n=t<0,i=r?e.length:0,o=Yn(0,i,this.__views__),s=o.start,a=o.end,u=a-s,c=n?a:s-1,f=this.__iteratees__,h=f.length,l=0,d=St(u,this.__takeCount__);if(!r||i<_||i==u&&d==u)return nn(n&&r?e.reverse():e,this.__actions__);var p=[];e:for(;u--&&l=_?mn(t):null,u=t.length;a&&(o=$t,s=!1,t=a);e:for(;++ii?0:i+r),n=n===o||n>i?i:+n||0,n<0&&(n+=i),i=r>n?0:n>>>0,r>>>=0;rs?0:s+r),n=n===o||n>s?s:+n||0,n<0&&(n+=s),s=r>n?0:n-r>>>0,r>>>=0;for(var a=t(s);++i=_,a=s?mn():null,u=[];a?(n=$t,o=!1):(s=!1,a=t?[]:u);e:for(;++r>>1,s=e[o];(r?s<=t:s2?r[i-2]:o,a=i>2?r[2]:o,u=i>1?r[i-1]:o;for("function"==typeof s?(s=an(s,u,5),i-=2):(s="function"==typeof u?u:o,i-=s?1:0),a&&ri(r[0],r[1],a)&&(s=i<3?o:s,i=1);++n-1?r[s]:o}return Cr(r,n,e)}}function En(e){return function(t,r,n){return t&&t.length?(r=zn(r,n,3),Ue(t,r,e)):-1}}function kn(e){return function(t,r,n){return r=zn(r,n,3),Cr(t,r,e,!0)}}function xn(e){return function(){for(var r,n=arguments.length,i=e?n:-1,s=0,a=t(n);e?i--:++i=_)return r.plant(t).value();for(var i=0,o=n?a[i].apply(this,e):t;++i=t||!vt(t))return"";var i=t-n;return r=null==r?" ":r+"",Ia(r,gt(i/r.length)).slice(0,i)}function Nn(e,r,n,i){var o=r&a,s=yn(e);function u(){for(var r=-1,a=arguments.length,c=-1,f=i.length,h=t(f+a);++cc))return!1;for(;++u-1&&e%1==0&&e-1&&e%1==0&&e<=Rt}function si(e){return e==e&&!As(e)}function ai(e,t){var r=e[1],n=t[1],i=r|n,o=i0){if(++di>=y)return e}else di=0;return $r(e,t)}),di,pi;function gi(e){for(var t=ia(e),r=t.length,n=r&&e.length,i=!!n&&oi(n)&&(ys(e)||bs(e)),o=-1,s=[];++o=120?mn(n&&u):null}var c=e[0],f=-1,h=c?c.length:0,l=i[0];e:for(;++f-1;)lt.call(t,o,1);return t}var Fi=cs(function(e,t){t=Ar(t);var r=dr(e,t);return Wr(e,t.sort(Fe)),r});function Ui(e,t,r){var n=[];if(!e||!e.length)return n;var i=-1,o=[],s=e.length;for(t=zn(t,r,3);++i2?e[t-2]:o,n=t>1?e[t-1]:o;return t>2&&"function"==typeof r?t-=2:(r=t>1&&"function"==typeof n?(--t,n):o,n=o),e.length=t,Zi(e,r,n)});function io(e){var t=Mt(e);return t.__chain__=!0,t}function oo(e,t,r){return t.call(r,e),e}function so(e,t,r){return t.call(r,e)}function ao(){return io(this)}function uo(){return new Lt(this.value(),this.__chain__)}var co=cs(function(e){return e=Ar(e),this.thru(function(t){return Jt(ys(t)?t:[bi(t)],e)})});function fo(e){for(var t,r=this;r instanceof Nt;){var n=vi(r);t?i.__wrapped__=n:t=n;var i=n;r=r.__wrapped__}return i.__wrapped__=e,t}function ho(){var e=this.__wrapped__,t=function(e){return r&&r.__dir__<0?e:e.reverse()};if(e instanceof Dt){var r=e;return this.__actions__.length&&(r=new Dt(this)),r=r.reverse(),r.__actions__.push({func:so,args:[t],thisArg:o}),new Lt(r,this.__chain__)}return this.thru(t)}function lo(){return this.value()+""}function po(){return nn(this.__wrapped__,this.__actions__)}var go=cs(function(e,t){return dr(e,Ar(t))}),mo=hn(function(e,t,r){Re.call(e,r)?++e[r]:e[r]=1});function bo(e,t,r){var n=ys(e)?er:Sr;return r&&ri(e,t,r)&&(t=o),"function"==typeof t&&r===o||(t=zn(t,r,3)),n(e,t)}function yo(e,t,r){var n=ys(e)?rr:xr;return t=zn(t,r,3),n(e,t)}var vo=Sn(_r),_o=Sn(wr,!0);function wo(e,t){return vo(e,Fr(t))}var So=Cn(Zt,_r),Eo=Cn(Qt,wr),ko=hn(function(e,t,r){Re.call(e,r)?e[r].push(t):e[r]=[t]});function xo(e,t,r,n){var i=e?Vn(e):0;return oi(i)||(e=da(e),i=e.length),r="number"!=typeof r||n&&ri(t,r,n)?0:r<0?wt(i+r,0):r||0,"string"==typeof e||!ys(e)&&Ns(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&Wn(e,t,r)>-1}var Co=hn(function(e,t,r){e[r]=t}),Ao=cs(function(e,r,n){var i=-1,s="function"==typeof r,a=ni(r),u=ei(e)?t(e.length):[];return _r(e,function(e){var t=s?r:a&&null!=e?e[r]:o;u[++i]=t?t.apply(e,n):Qn(e,r,n)}),u});function Io(e,t,r){var n=ys(e)?nr:Dr;return t=zn(t,r,3),n(e,t)}var To=hn(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]});function Oo(e,t){return Io(e,Ja(t))}var Ro=Bn(or,_r),Bo=Bn(sr,wr);function Po(e,t,r){var n=ys(e)?rr:xr;return t=zn(t,r,3),n(e,function(e,r,n){return!t(e,r,n)})}function Mo(e,t,r){if(r?ri(e,t,r):null==t){e=mi(e);var n=e.length;return n>0?e[Vr(0,n-1)]:o}var i=-1,s=Us(e),n=s.length,a=n-1;for(t=St(t<0?0:+t||0,n);++i0&&(r=t.apply(this,arguments)),e<=1&&(t=o),r}}var Vo=cs(function(e,t,r){var n=a;if(r.length){var i=tt(r,Vo.placeholder);n|=l}return Dn(e,n,t,r,i)}),Go=cs(function(e,t){t=t.length?Ar(t):Qs(e);for(var r=-1,n=t.length;++rt?m(f,i):c=ht(b,e)}function y(){m(d,c)}function v(){if(n=arguments,a=zo(),u=this,f=d&&(c||!p),!1===l)var r=p&&!c;else{i||p||(h=a);var g=l-(a-h),m=g<=0||g>l;m?(i&&(i=je(i)),h=a,s=e.apply(u,n)):i||(i=ht(y,g))}return m&&c?c=je(c):c||t===l||(c=ht(b,t)),r&&(m=!0,s=e.apply(u,n)),!m||c||i||(n=u=o),s}return v.cancel=g,v}var Zo=cs(function(e,t){return yr(e,1,t)}),Qo=cs(function(e,t,r){return yr(e,t,r)}),es=xn(),ts=xn(!0);function rs(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new Ce(E);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s),s};return r.cache=new rs.Cache,r}var ns=cs(function(e,t){if(t=Ar(t),"function"!=typeof e||!er(t,ze))throw new Ce(E);var r=t.length;return cs(function(n){for(var i=St(n.length,r);i--;)n[i]=t[i](n[i]);return e.apply(this,n)})});function is(e){if("function"!=typeof e)throw new Ce(E);return function(){return!e.apply(this,arguments)}}function os(e){return Wo(2,e)}var ss=Rn(l),as=Rn(d),us=cs(function(e,t){return Dn(e,g,o,o,o,Ar(t))});function cs(e,r){if("function"!=typeof e)throw new Ce(E);return r=wt(r===o?e.length-1:+r||0,0),function(){for(var n=arguments,i=-1,o=wt(n.length-r,0),s=t(o);++it}function ms(e,t){return e>=t}function bs(e){return Qe(e)&&ei(e)&&Re.call(e,"callee")&&!ct.call(e,"callee")}var ys=yt||function(e){return Qe(e)&&oi(e.length)&&Pe.call(e)==C};function vs(e){return!0===e||!1===e||Qe(e)&&Pe.call(e)==A}function _s(e){return Qe(e)&&Pe.call(e)==I}function ws(e){return!!e&&1===e.nodeType&&Qe(e)&&!Ps(e)}function Ss(e){return null==e||(ei(e)&&(ys(e)||Ns(e)||bs(e)||Qe(e)&&Cs(e.splice))?!e.length:!na(e).length)}function Es(e,t,r,n){r="function"==typeof r?an(r,n,3):o;var i=r?r(e,t):o;return i===o?Nr(e,t,r):!!i}function ks(e){return Qe(e)&&"string"==typeof e.message&&Pe.call(e)==T}function xs(e){return"number"==typeof e&&vt(e)}function Cs(e){return As(e)&&Pe.call(e)==O}function As(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Is(e,t,r,n){return r="function"==typeof r?an(r,n,3):o,jr(e,Gn(t),r)}function Ts(e){return Bs(e)&&e!=+e}function Os(e){return null!=e&&(Cs(e)?Ne.test(Oe.call(e)):Qe(e)&&pe.test(e))}function Rs(e){return null===e}function Bs(e){return"number"==typeof e||Qe(e)&&Pe.call(e)==B}function Ps(e){var t,r;return!(!Qe(e)||Pe.call(e)!=P||bs(e)||!(Re.call(e,"constructor")||(t=e.constructor,"function"!=typeof t||t instanceof t)))&&(Or(e,function(e,t){r=t}),r===o||Re.call(e,r))}function Ms(e){return As(e)&&Pe.call(e)==M}function Ns(e){return"string"==typeof e||Qe(e)&&Pe.call(e)==L}function Ls(e){return Qe(e)&&oi(e.length)&&!!ke[Pe.call(e)]}function js(e){return e===o}function Ds(e,t){return e0;++i=St(t,r)&&e=0&&e.indexOf(t,r)==r}function wa(e){return e=He(e),e&&ee.test(e)?e.replace(Z,Ye):e}function Sa(e){return e=He(e),e&&ue.test(e)?e.replace(ae,Je):e||"(?:)"}var Ea=bn(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()});function ka(e,t,r){e=He(e),t=+t;var n=e.length;if(n>=t||!vt(t))return e;var i=(t-n)/2,o=bt(i),s=gt(i);return r=Mn("",s,r),r.slice(0,o)+e+r}var xa=On(),Ca=On(!0);function Aa(e,t,r){return(r?ri(e,t,r):null==t)?t=0:t&&(t=+t),e=Pa(e),kt(e,t||(de.test(e)?16:10))}function Ia(e,t){var r="";if(e=He(e),t=+t,t<1||!e||!vt(t))return r;do{t%2&&(r+=e),t=bt(t/2),e+=e}while(t);return r}var Ta=bn(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}),Oa=bn(function(e,t,r){return e+(r?" ":"")+(t.charAt(0).toUpperCase()+t.slice(1))});function Ra(e,t,r){return e=He(e),r=null==r?0:St(r<0?0:+r||0,e.length),e.lastIndexOf(t,r)==r}function Ba(e,t,r){var n=Mt.templateSettings;r&&ri(e,t,r)&&(t=r=o),e=He(e),t=hr(lr({},r||t),n,fr);var s=hr(lr({},t.imports),n.imports,fr),a=na(s),u=tn(s,a),c,f,h=0,l=t.interpolate||be,d="__p += '",p=_e((t.escape||be).source+"|"+l.source+"|"+(l===ne?he:be).source+"|"+(t.evaluate||be).source+"|$","g"),g="//# sourceURL="+("sourceURL"in t?t.sourceURL:"lodash.templateSources["+ ++Ee+"]")+"\n";e.replace(p,function(t,r,n,i,o,s){return n||(n=i),d+=e.slice(h,s).replace(ye,Xe),r&&(c=!0,d+="' +\n__e("+r+") +\n'"),o&&(f=!0,d+="';\n"+o+";\n__p += '"),n&&(d+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),h=s+t.length,t}),d+="';\n";var m=t.variable;m||(d="with (obj) {\n"+d+"\n}\n"),d=(f?d.replace($,""):d).replace(Y,"$1").replace(J,"$1;"),d="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(c?", __e = _.escape":"")+(f?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var b=Fa(function(){return i(a,g+"return "+d).apply(o,u)});if(b.source=d,ks(b))throw b;return b}function Pa(e,t,r){var n=e;return e=He(e),e?(r?ri(n,t,r):null==t)?e.slice(nt(e),it(e)+1):(t+="",e.slice(Ke(e,t),We(e,t)+1)):e}function Ma(e,t,r){var n=e;return e=He(e),e?(r?ri(n,t,r):null==t)?e.slice(nt(e)):e.slice(Ke(e,t+"")):e}function Na(e,t,r){var n=e;return e=He(e),e?(r?ri(n,t,r):null==t)?e.slice(0,it(e)+1):e.slice(0,We(e,t+"")+1):e}function La(e,t,r){r&&ri(e,t,r)&&(t=o);var n=m,i=b;if(null!=t)if(As(t)){var s="separator"in t?t.separator:s;n="length"in t?+t.length||0:n,i="omission"in t?He(t.omission):i}else n=+t||0;if(e=He(e),n>=e.length)return e;var a=n-i.length;if(a<1)return i;var u=e.slice(0,a);if(null==s)return u+i;if(Ms(s)){if(e.slice(a).search(s)){var c,f,h=e.slice(0,a);for(s.global||(s=_e(s.source,(le.exec(s)||"")+"g")),s.lastIndex=0;c=s.exec(h);)f=c.index;u=u.slice(0,null==f?a:f)}}else if(e.indexOf(s,a)!=a){var l=u.lastIndexOf(s);l>-1&&(u=u.slice(0,l))}return u+i}function ja(e){return e=He(e),e&&Q.test(e)?e.replace(X,ot):e}function Da(e,t,r){return r&&ri(e,t,r)&&(t=o),e=He(e),e.match(t||ve)||[]}var Fa=cs(function(e,t){try{return e.apply(o,t)}catch(e){return ks(e)?e:new n(e)}});function Ua(e,t,r){return r&&ri(e,t,r)&&(t=o),Qe(e)?Ha(e):gr(e,t)}function qa(e){return function(){return e}}function za(e){return e}function Ha(e){return Fr(mr(e,!0))}function Ka(e,t){return Ur(e,mr(t,!0))}var Wa=cs(function(e,t){return function(r){return Qn(r,e,t)}}),Va=cs(function(e,t){return function(r){return Qn(e,r,t)}});function Ga(e,t,r){if(null==r){var n=As(t),i=n?na(t):o,s=i&&i.length?Pr(t,i):o;(s?s.length:n)||(s=!1,r=t,t=e,e=this)}s||(s=Pr(t,na(t)));var a=!0,u=-1,c=Cs(e),f=s.length;!1===r?a=!1:As(r)&&"chain"in r&&(a=r.chain);for(;++u0||t<0)?new Dt(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==o&&(t=+t||0,r=t<0?r.dropRight(-t):r.take(t-e)),r)},Dt.prototype.takeRightWhile=function(e,t){return this.reverse().takeWhile(e,t).reverse()},Dt.prototype.toArray=function(){return this.take(At)},Rr(Dt.prototype,function(e,t){var r=/^(?:filter|map|reject)|While$/.test(t),n=/^(?:first|last)$/.test(t),i=Mt[n?"take"+("last"==t?"Right":""):t];i&&(Mt.prototype[t]=function(){var t=n?[1]:arguments,s=this.__chain__,a=this.__wrapped__,u=!!this.__actions__.length,c=a instanceof Dt,f=t[0],h=c||ys(a);h&&r&&"function"==typeof f&&1!=f.length&&(c=h=!1);var l=function(e){return n&&s?i(e,1)[0]:i.apply(o,ir([e],t))},d={func:so,args:[l],thisArg:o},p=c&&!u;if(n&&!s)return p?(a=a.clone(),a.__actions__.push(d),e.call(a)):i.call(o,this.value())[0];if(!n&&h){a=p?a:new Dt(this);var g=e.apply(a,t);return g.__actions__.push(d),new Lt(g,s)}return this.thru(l)})}),Zt(["join","pop","push","replace","shift","sort","splice","split","unshift"],function(e){var t=(/^(?:replace|split)$/.test(e)?Te:Ae)[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:join|pop|replace|shift)$/.test(e);Mt.prototype[e]=function(){var e=arguments;return n&&!this.__chain__?t.apply(this.value(),e):this[r](function(r){return t.apply(r,e)})}}),Rr(Dt.prototype,function(e,t){var r=Mt[t];if(r){var n=r.name,i=Pt[n]||(Pt[n]=[]);i.push({name:t,func:r})}}),Pt[Pn(o,u).name]=[{name:"wrapper",func:o}],Dt.prototype.clone=Ft,Dt.prototype.reverse=Ut,Dt.prototype.value=qt,Mt.prototype.chain=ao,Mt.prototype.commit=uo,Mt.prototype.concat=co,Mt.prototype.plant=fo,Mt.prototype.reverse=ho,Mt.prototype.toString=lo,Mt.prototype.run=Mt.prototype.toJSON=Mt.prototype.valueOf=Mt.prototype.value=po,Mt.prototype.collect=Mt.prototype.map,Mt.prototype.head=Mt.prototype.first,Mt.prototype.select=Mt.prototype.filter,Mt.prototype.tail=Mt.prototype.rest,Mt}var at=st();De._=at,i=function(){return at}.call(t,r,t,e),i===o||(e.exports=i)}).call(this)}).call(this,r(70)(e),r(8))},function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){"use strict";const n=r(602),i=r(603),o=r(21);e.exports=(e=>{const t=n();if("function"==typeof e)return e;if("object"==typeof e)return i(e);if("string"==typeof e){const r=o(e).nodeAddress();return t.host=r.address,t.port=r.port,i(t)}throw new Error("Argument must be a send function or a config object.")})},function(e,t,r){"use strict";var n=r(721),i=r(725),o=r(729);for(var s in t=e.exports=r(12),t.pull=t,n)t[s]=n[s];for(var s in o)t[s]=o[s];for(var s in i)t[s]=i[s]},function(e,t,r){"use strict";function n(e,t,r){var n=e instanceof Error?e:new Error(e),i;if("object"==typeof t?r=t:null!=t&&(n.code=t),r)for(i in r)n[i]=r[i];return n}e.exports=n},function(e,t,r){"use strict";(function(n){const i=r(33),o=r(423),s=r(27),a=r(11),u=r(51);class c{constructor(e,t,r){s(n.isBuffer(e),"invalid id provided"),t&&r&&s(t.public.bytes.equals(r.bytes),"inconsistent arguments"),this._id=e,this._idB58String=i.toB58String(this.id),this._privKey=t,this._pubKey=r}get id(){return this._id}set id(e){throw new Error("Id is immutable")}get privKey(){return this._privKey}set privKey(e){this._privKey=e}get pubKey(){return this._pubKey?this._pubKey:this._privKey?this._privKey.public:void 0}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return o.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return o.marshalPrivateKey(this.privKey)}toPrint(){let e=this.toB58String();e.startsWith("Qm")&&(e=e.slice(2));let t=6;return e.length"}toJSON(){return{id:this.toB58String(),privKey:h(this.marshalPrivKey()),pubKey:h(this.marshalPubKey())}}toHexString(){return i.toHexString(this.id)}toBytes(){return this.id}toB58String(){return this._idB58String}isEqual(e){if(n.isBuffer(e))return this.id.equals(e);if(e.id)return this.id.equals(e.id);throw new Error("not valid Id")}isValid(e){this.privKey&&this.privKey.public&&this.privKey.public.bytes&&n.isBuffer(this.pubKey.bytes)&&this.privKey.public.bytes.equals(this.pubKey.bytes)?e():e(new Error("Keys not match"))}}const f=u(c,{className:"PeerId",symbolName:"@libp2p/js-peer-id/PeerId"});function h(e){if(e)return e.toString("base64")}t=e.exports=f,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.generateKeyPair("RSA",e.bits,t),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)})],(e,r,n)=>{if(e)return t(e);t(null,new f(r,n))})},t.createFromHexString=function(e){return new f(i.fromHexString(e))},t.createFromBytes=function(e){return new f(e)},t.createFromB58String=function(e){return new f(i.fromB58String(e))},t.createFromPubKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r;try{let i=e;if("string"==typeof i&&(i=n.from(e,"base64")),!n.isBuffer(i))throw new Error("Supplied key is neither a base64 string nor a buffer");r=o.unmarshalPublicKey(i)}catch(e){return t(e)}r.hash((e,n)=>{if(e)return t(e);t(null,new f(n,null,r))})},t.createFromPrivKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r=e;try{if("string"==typeof r&&(r=n.from(e,"base64")),!n.isBuffer(r))throw new Error("Supplied key is neither a base64 string nor a buffer")}catch(e){return t(e)}a([e=>o.unmarshalPrivateKey(r,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)})],(e,r,n)=>{if(e)return t(e);t(null,new f(r,n,n.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r,s,u,c;try{r=i.fromB58String(e.id),s=e.privKey&&n.from(e.privKey,"base64"),u=e.pubKey&&n.from(e.pubKey,"base64"),c=u&&o.unmarshalPublicKey(u)}catch(e){return t(e)}s?a([e=>o.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)}),(e,t,r)=>{c?c.hash((n,i)=>{r(n,e,t,i)}):r(null,e,t)}],(e,n,i,o)=>e?t(e):c&&!n.equals(o)?t(new Error("Public and private key do not match")):r&&!n.equals(r)?t(new Error("Id and private key do not match")):void t(null,new f(r,i,c))):t(null,new f(r,null,c))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(875),o=r(292),s=r(34),a=r(79),u=r(51),c=new Error("Sorry, Not Implemented Yet."),f=u.proto(function(e){if(!(this instanceof f))return new f(e);if(null==e&&(e=""),e instanceof n)this.buffer=i.fromBuffer(e);else if("string"==typeof e||e instanceof String){if(e.length>0&&"/"!==e.charAt(0))throw new Error(`multiaddr "${e}" must start with a "/"`);this.buffer=i.fromString(e)}else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=i.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});f.prototype.toString=function e(){return i.bufferToString(this.buffer)},f.prototype.toOptions=function e(){const t={},r=this.toString().split("/");return t.family="ip4"===r[1]?"ipv4":"ipv6",t.host=r[2],t.transport=r[3],t.port=r[4],t},f.prototype.inspect=function e(){return""},f.prototype.protos=function e(){return this.protoCodes().map(e=>Object.assign({},o(e)))},f.prototype.protoCodes=function e(){const t=[],r=this.buffer;let n=0;for(;ne.name)},f.prototype.tuples=function e(){return i.bufferToTuples(this.buffer)},f.prototype.stringTuples=function e(){const t=i.bufferToTuples(this.buffer);return i.tuplesToStringTuples(t)},f.prototype.encapsulate=function e(t){return t=f(t),f(this.toString()+t.toString())},f.prototype.decapsulate=function e(t){t=t.toString();const r=this.toString(),n=r.lastIndexOf(t);if(n<0)throw new Error("Address "+this+" does not contain subaddress: "+t);return f(r.slice(0,n))},f.prototype.getPeerId=function e(){let t=null;try{t=this.stringTuples().filter(e=>{if(e[0]===o.names.ipfs.code)return!0})[0][1],a.decode(t)}catch(e){t=null}return t},f.prototype.equals=function e(t){return this.buffer.equals(t.buffer)},f.prototype.nodeAddress=function e(){const t=this.protoCodes(),r=this.protoNames(),n=this.toString().split("/").slice(1);if(n.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(4!==t[0]&&41!==t[0]&&54!==t[0]&&55!==t[0])throw new Error(`no protocol with name: "'${r[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if("tcp"!==n[2]&&"udp"!==n[2])throw new Error(`no protocol with name: "'${r[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:41===t[0]||55===t[0]?6:4,address:n[1],port:n[3]}},f.fromNodeAddress=function e(t,r){if(!t)throw new Error("requires node address object");if(!r)throw new Error("requires transport protocol");const n="IPv6"===t.family?"ip6":"ip4";return f("/"+[n,t.address,r,t.port].join("/"))},f.prototype.isThinWaistAddress=function e(t){const r=(t||this).protos();return 2===r.length&&((4===r[0].code||41===r[0].code)&&(6===r[1].code||273===r[1].code))},f.prototype.fromStupidString=function e(t){throw c},f.protocols=o,f.isName=function e(t){return!!f.isMultiaddr(t)&&t.protos().some(e=>e.resolvable)},f.resolve=function e(t,r){return f.isMultiaddr(t)&&f.isName(t)?r(new Error("not implemented yet")):r(new Error("not a valid name"))},t=e.exports=f}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(76),i=r(15);e.exports={checkState:function(e,t){if(!e)throw new n.InvalidState(t)},checkArgument:function(e,t,r,i){if(!e)throw new n.InvalidArgument(t,r,i)},checkArgumentType:function(e,t,o){if(o=o||"(unknown name)",i.isString(t)){if("Buffer"===t){var s=r(26);if(!s.isBuffer(e))throw new n.InvalidArgumentType(e,t,o)}else if(typeof e!==t)throw new n.InvalidArgumentType(e,t,o)}else if(!(e instanceof t))throw new n.InvalidArgumentType(e,t.name,o)}}},function(e,t,r){t=e.exports=r(347),t.Stream=t,t.Readable=t,t.Writable=r(351),t.Duplex=r(121),t.Transform=r(352),t.PassThrough=r(691)},function(e,t,r){var n=r(1028);function i(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function o(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},r=e.name||"Function wrapped with `once`";return t.onceError=r+" shouldn't be called more than once",t.called=!1,t}e.exports=n(i),e.exports.strict=n(o),i.proto=i(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(this)},configurable:!0})})},function(e,t,r){const n=r(4).Buffer,i=r(288),o=r(112),s=r(1297),a=r(43),u=r(83),c=r(556),f=r(30),h=r(1299),l=f.OP_RESERVED;function d(e){return u.Number(e)&&(e===f.OP_0||e>=f.OP_1&&e<=f.OP_16||e===f.OP_1NEGATE)}function p(e){return u.Buffer(e)||d(e)}function g(e){return u.Array(e)&&e.every(p)}function m(e){return 0===e.length?f.OP_0:1===e.length?e[0]>=1&&e[0]<=16?l+e[0]:129===e[0]?f.OP_1NEGATE:void 0:void 0}function b(e){if(n.isBuffer(e))return e;a(u.Array,e);const t=e.reduce(function(e,t){return n.isBuffer(t)?1===t.length&&void 0!==m(t)?e+1:e+s.encodingLength(t.length)+t.length:e+1},0),r=n.allocUnsafe(t);let i=0;if(e.forEach(function(e){if(n.isBuffer(e)){const t=m(e);if(void 0!==t)return r.writeUInt8(t,i),void(i+=1);i+=s.encode(r,e.length,i),e.copy(r,i),i+=e.length}else r.writeUInt8(e,i),i+=1}),i!==r.length)throw new Error("Could not decode chunks");return r}function y(e){if(u.Array(e))return e;a(u.Buffer,e);const t=[];let r=0;for(;rf.OP_0&&n<=f.OP_PUSHDATA4){const n=s.decode(e,r);if(null===n)return null;if(r+=n.size,r+n.number>e.length)return null;const i=e.slice(r,r+n.number);r+=n.number;const o=m(i);void 0!==o?t.push(o):t.push(i)}else t.push(n),r+=1}return t}function v(e){return n.isBuffer(e)&&(e=y(e)),e.map(function(e){if(n.isBuffer(e)){const t=m(e);if(void 0===t)return e.toString("hex");e=t}return h[e]}).join(" ")}function _(e){return a(u.String,e),b(e.split(" ").map(function(e){return void 0!==f[e]?f[e]:(a(u.Hex,e),n.from(e,"hex"))}))}function w(e){return e=y(e),a(g,e),e.map(function(e){return n.isBuffer(e)?e:e===f.OP_0?n.allocUnsafe(0):c.encode(e-l)})}function S(e){return o.isPoint(e)}function E(e){const t=-129&e;return t>0&&t<4}function k(e){return!!n.isBuffer(e)&&(!!E(e[e.length-1])&&i.check(e.slice(0,-1)))}e.exports={compile:b,decompile:y,fromASM:_,toASM:v,toStack:w,number:r(556),signature:r(1300),isCanonicalPubKey:S,isCanonicalScriptSignature:k,isPushOnly:g,isDefinedHashType:E}},function(e,t,r){"use strict";(function(t){var n=r(0),i=r(27),o=r(36),s=r(22);function a(e,t){if(e.length!==t.length)return!1;for(var r=e.length,n=0;n>24&255),n.push(r>>16&255),n.push(r>>8&255),n.push(255&r),new t(n)},integerFromBuffer:function e(t){return s.checkArgumentType(t,"Buffer","buffer"),t[0]<<24|t[1]<<16|t[2]<<8|t[3]},integerFromSingleByteBuffer:function e(t){return s.checkArgumentType(t,"Buffer","buffer"),t[0]},bufferToHex:function e(t){return s.checkArgumentType(t,"Buffer","buffer"),t.toString("hex")},reverse:function e(t){for(var r=new n.Buffer(t.length),i=0;i"'`]/g,Q=RegExp(Z.source),ee=RegExp(X.source),te=/<%-([\s\S]+?)%>/g,ne=/<%([\s\S]+?)%>/g,re=/<%=([\s\S]+?)%>/g,ie=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,oe=/^\w*$/,se=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,ae=/^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,ue=RegExp(ae.source),le=/[\u0300-\u036f\ufe20-\ufe23]/g,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,he=/\w*$/,pe=/^0[xX]/,de=/^\[object .+?Constructor\]$/,me=/^\d+$/,ge=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,ye=/($^)/,be=/['\n\r\u2028\u2029\\]/g,ve=(_e="[A-Z\\xc0-\\xd6\\xd8-\\xde]",we="[a-z\\xdf-\\xf6\\xf8-\\xff]+",RegExp(_e+"+(?="+_e+we+")|"+_e+"?"+we+"|"+_e+"+|[0-9]+","g")),_e,we,ke=["Array","ArrayBuffer","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Math","Number","Object","RegExp","Set","String","_","clearTimeout","isFinite","parseFloat","parseInt","setTimeout","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap"],Se=-1,Ee={};Ee[D]=Ee[U]=Ee[z]=Ee[q]=Ee[K]=Ee[H]=Ee[V]=Ee[W]=Ee[$]=!0,Ee[x]=Ee[C]=Ee[F]=Ee[A]=Ee[I]=Ee[T]=Ee[j]=Ee[O]=Ee[P]=Ee[B]=Ee[R]=Ee[N]=Ee[M]=Ee[L]=!1;var xe={};xe[x]=xe[C]=xe[F]=xe[A]=xe[I]=xe[D]=xe[U]=xe[z]=xe[q]=xe[K]=xe[P]=xe[B]=xe[R]=xe[M]=xe[H]=xe[V]=xe[W]=xe[$]=!0,xe[T]=xe[j]=xe[O]=xe[N]=xe[L]=!1;var Ce={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"},Ae={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Ie={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Te={function:!0,object:!0},je={0:"x30",1:"x31",2:"x32",3:"x33",4:"x34",5:"x35",6:"x36",7:"x37",8:"x38",9:"x39",A:"x41",B:"x42",C:"x43",D:"x44",E:"x45",F:"x46",a:"x61",b:"x62",c:"x63",d:"x64",e:"x65",f:"x66",n:"x6e",r:"x72",t:"x74",u:"x75",v:"x76",x:"x78"},Oe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Pe=Te[typeof t]&&t&&!t.nodeType&&t,Be=Te[typeof e]&&e&&!e.nodeType&&e,Re=Pe&&Be&&"object"==typeof r&&r&&r.Object&&r,Ne=Te[typeof self]&&self&&self.Object&&self,Me=Te[typeof window]&&window&&window.Object&&window,Le=Be&&Be.exports===Pe&&Pe,Fe=Re||Me!==(this&&this.window)&&Me||Ne||this;function De(e,t){if(e!==t){var n=null===e,r=e===o,i=e==e,s=null===t,a=t===o,u=t==t;if(e>t&&!s||!i||n&&!a&&u||r&&u)return 1;if(e-1;);return n}function Ve(e,t){for(var n=e.length;n--&&t.indexOf(e.charAt(n))>-1;);return n}function We(e,t){return De(e.criteria,t.criteria)||e.index-t.index}function $e(e,t,n){for(var r=-1,i=e.criteria,o=t.criteria,s=i.length,a=n.length;++r=a)return u;var l=n[r];return u*("asc"===l||!0===l?1:-1)}}return e.index-t.index}function Ge(e){return Ce[e]}function Ye(e){return Ae[e]}function Je(e,t,n){return t?e=je[e]:n&&(e=Oe[e]),"\\"+e}function Ze(e){return"\\"+Oe[e]}function Xe(e,t,n){for(var r=e.length,i=t+(n?0:-1);n?i--:++i=9&&e<=13||32==e||160==e||5760==e||6158==e||e>=8192&&(e<=8202||8232==e||8233==e||8239==e||8287==e||12288==e||65279==e)}function tt(e,t){for(var n=-1,r=e.length,i=-1,o=[];++n>>1,Ot=9007199254740991,Pt=dt&&new dt,Bt={};function Rt(e){if(Qe(e)&&!bs(e)&&!(e instanceof Ft)){if(e instanceof Mt)return e;if(Oe.call(e,"__chain__")&&Oe.call(e,"__wrapped__"))return vi(e)}return new Mt(e)}function Nt(){}function Mt(e,t,n){this.__wrapped__=e,this.__actions__=n||[],this.__chain__=!!t}var Lt=Rt.support={};function Ft(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=At,this.__views__=[]}function Dt(){var e=new Ft(this.__wrapped__);return e.__actions__=Zt(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Zt(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Zt(this.__views__),e}function Ut(){if(this.__filtered__){var e=new Ft(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function zt(){var e=this.__wrapped__.value(),t=this.__dir__,n=bs(e),r=t<0,i=n?e.length:0,o=Yr(0,i,this.__views__),s=o.start,a=o.end,u=a-s,l=r?a:s-1,c=this.__iteratees__,f=c.length,h=0,p=kt(u,this.__takeCount__);if(!n||i<_||i==u&&p==u)return ir(r&&n?e.reverse():e,this.__actions__);var d=[];e:for(;u--&&h=_?gr(t):null,u=t.length;a&&(o=Gt,s=!1,t=a);e:for(;++ii?0:i+n),r=r===o||r>i?i:+r||0,r<0&&(r+=i),i=n>r?0:r>>>0,n>>>=0;ns?0:s+n),r=r===o||r>s?s:+r||0,r<0&&(r+=s),s=n>r?0:r-n>>>0,n>>>=0;for(var a=t(s);++i=_,a=s?gr():null,u=[];a?(r=Gt,o=!1):(s=!1,a=t?[]:u);e:for(;++n>>1,s=e[o];(n?s<=t:s2?n[i-2]:o,a=i>2?n[2]:o,u=i>1?n[i-1]:o;for("function"==typeof s?(s=ar(s,u,5),i-=2):(s="function"==typeof u?u:o,i-=s?1:0),a&&ni(n[0],n[1],a)&&(s=i<3?o:s,i=1);++r-1?n[s]:o}return An(n,r,e)}}function Sr(e){return function(t,n,r){return t&&t.length?(n=qr(n,r,3),Ue(t,n,e)):-1}}function Er(e){return function(t,n,r){return n=qr(n,r,3),An(t,n,e,!0)}}function xr(e){return function(){for(var n,r=arguments.length,i=e?r:-1,s=0,a=t(r);e?i--:++i=_)return n.plant(t).value();for(var i=0,o=r?a[i].apply(this,e):t;++i=t||!vt(t))return"";var i=t-r;return n=null==n?" ":n+"",Ia(n,mt(i/n.length)).slice(0,i)}function Nr(e,n,r,i){var o=n&a,s=br(e);function u(){for(var n=-1,a=arguments.length,l=-1,c=i.length,f=t(c+a);++ll))return!1;for(;++u-1&&e%1==0&&e-1&&e%1==0&&e<=Ot}function si(e){return e==e&&!As(e)}function ai(e,t){var n=e[1],r=t[1],i=n|r,o=i0){if(++pi>=b)return e}else pi=0;return Yn(e,t)}),pi,di;function mi(e){for(var t=ia(e),n=t.length,r=n&&e.length,i=!!r&&oi(r)&&(bs(e)||ys(e)),o=-1,s=[];++o=120?gr(r&&u):null}var l=e[0],c=-1,f=l?l.length:0,h=i[0];e:for(;++c-1;)ht.call(t,o,1);return t}var Di=ls(function(e,t){t=In(t);var n=dn(e,t);return Wn(e,t.sort(De)),n});function Ui(e,t,n){var r=[];if(!e||!e.length)return r;var i=-1,o=[],s=e.length;for(t=qr(t,n,3);++i2?e[t-2]:o,r=t>1?e[t-1]:o;return t>2&&"function"==typeof n?t-=2:(n=t>1&&"function"==typeof r?(--t,r):o,r=o),e.length=t,Xi(e,n,r)});function io(e){var t=Rt(e);return t.__chain__=!0,t}function oo(e,t,n){return t.call(n,e),e}function so(e,t,n){return t.call(n,e)}function ao(){return io(this)}function uo(){return new Mt(this.value(),this.__chain__)}var lo=ls(function(e){return e=In(e),this.thru(function(t){return Jt(bs(t)?t:[yi(t)],e)})});function co(e){for(var t,n=this;n instanceof Nt;){var r=vi(n);t?i.__wrapped__=r:t=r;var i=r;n=n.__wrapped__}return i.__wrapped__=e,t}function fo(){var e=this.__wrapped__,t=function(e){return n&&n.__dir__<0?e:e.reverse()};if(e instanceof Ft){var n=e;return this.__actions__.length&&(n=new Ft(this)),n=n.reverse(),n.__actions__.push({func:so,args:[t],thisArg:o}),new Mt(n,this.__chain__)}return this.thru(t)}function ho(){return this.value()+""}function po(){return ir(this.__wrapped__,this.__actions__)}var mo=ls(function(e,t){return dn(e,In(t))}),go=fr(function(e,t,n){Oe.call(e,n)?++e[n]:e[n]=1});function yo(e,t,n){var r=bs(e)?en:Sn;return n&&ni(e,t,n)&&(t=o),"function"==typeof t&&n===o||(t=qr(t,n,3)),r(e,t)}function bo(e,t,n){var r=bs(e)?nn:Cn;return t=qr(t,n,3),r(e,t)}var vo=kr(wn),_o=kr(kn,!0);function wo(e,t){return vo(e,Un(t))}var ko=Cr(Xt,wn),So=Cr(Qt,kn),Eo=fr(function(e,t,n){Oe.call(e,n)?e[n].push(t):e[n]=[t]});function xo(e,t,n,r){var i=e?Wr(e):0;return oi(i)||(e=pa(e),i=e.length),n="number"!=typeof n||r&&ni(t,n,r)?0:n<0?wt(i+n,0):n||0,"string"==typeof e||!bs(e)&&Ns(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Vr(e,t,n)>-1}var Co=fr(function(e,t,n){e[n]=t}),Ao=ls(function(e,n,r){var i=-1,s="function"==typeof n,a=ri(n),u=ei(e)?t(e.length):[];return wn(e,function(e){var t=s?n:a&&null!=e?e[n]:o;u[++i]=t?t.apply(e,r):Qr(e,n,r)}),u});function Io(e,t,n){var r=bs(e)?rn:Dn;return t=qr(t,n,3),r(e,t)}var To=fr(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});function jo(e,t){return Io(e,Ja(t))}var Oo=Pr(sn,wn),Po=Pr(an,kn);function Bo(e,t,n){var r=bs(e)?nn:Cn;return t=qr(t,n,3),r(e,function(e,n,r){return!t(e,n,r)})}function Ro(e,t,n){if(n?ni(e,t,n):null==t){e=gi(e);var r=e.length;return r>0?e[$n(0,r-1)]:o}var i=-1,s=Us(e),r=s.length,a=r-1;for(t=kt(t<0?0:+t||0,r);++i0&&(n=t.apply(this,arguments)),e<=1&&(t=o),n}}var Wo=ls(function(e,t,n){var r=a;if(n.length){var i=tt(n,Wo.placeholder);r|=h}return Fr(e,r,t,n,i)}),$o=ls(function(e,t){t=t.length?In(t):Qs(e);for(var n=-1,r=t.length;++nt?g(c,i):l=ft(y,e)}function b(){g(p,l)}function v(){if(r=arguments,a=qo(),u=this,c=p&&(l||!d),!1===h)var n=d&&!l;else{i||d||(f=a);var m=h-(a-f),g=m<=0||m>h;g?(i&&(i=Le(i)),f=a,s=e.apply(u,r)):i||(i=ft(b,m))}return g&&l?l=Le(l):l||t===h||(l=ft(y,t)),n&&(g=!0,s=e.apply(u,r)),!g||l||i||(r=u=o),s}return v.cancel=m,v}var Xo=ls(function(e,t){return vn(e,1,t)}),Qo=ls(function(e,t,n){return vn(e,t,n)}),es=xr(),ts=xr(!0);function ns(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new Ce(S);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s),s};return n.cache=new ns.Cache,n}var rs=ls(function(e,t){if(t=In(t),"function"!=typeof e||!en(t,qe))throw new Ce(S);var n=t.length;return ls(function(r){for(var i=kt(r.length,n);i--;)r[i]=t[i](r[i]);return e.apply(this,r)})});function is(e){if("function"!=typeof e)throw new Ce(S);return function(){return!e.apply(this,arguments)}}function os(e){return Vo(2,e)}var ss=Or(h),as=Or(p),us=ls(function(e,t){return Fr(e,m,o,o,o,In(t))});function ls(e,n){if("function"!=typeof e)throw new Ce(S);return n=wt(n===o?e.length-1:+n||0,0),function(){for(var r=arguments,i=-1,o=wt(r.length-n,0),s=t(o);++it}function gs(e,t){return e>=t}function ys(e){return Qe(e)&&ei(e)&&Oe.call(e,"callee")&&!lt.call(e,"callee")}var bs=bt||function(e){return Qe(e)&&oi(e.length)&&Be.call(e)==C};function vs(e){return!0===e||!1===e||Qe(e)&&Be.call(e)==A}function _s(e){return Qe(e)&&Be.call(e)==I}function ws(e){return!!e&&1===e.nodeType&&Qe(e)&&!Bs(e)}function ks(e){return null==e||(ei(e)&&(bs(e)||Ns(e)||ys(e)||Qe(e)&&Cs(e.splice))?!e.length:!ra(e).length)}function Ss(e,t,n,r){n="function"==typeof n?ar(n,r,3):o;var i=n?n(e,t):o;return i===o?Mn(e,t,n):!!i}function Es(e){return Qe(e)&&"string"==typeof e.message&&Be.call(e)==T}function xs(e){return"number"==typeof e&&vt(e)}function Cs(e){return As(e)&&Be.call(e)==j}function As(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Is(e,t,n,r){return n="function"==typeof n?ar(n,r,3):o,Fn(e,$r(t),n)}function Ts(e){return Ps(e)&&e!=+e}function js(e){return null!=e&&(Cs(e)?Ne.test(je.call(e)):Qe(e)&&de.test(e))}function Os(e){return null===e}function Ps(e){return"number"==typeof e||Qe(e)&&Be.call(e)==P}function Bs(e){var t,n;return!(!Qe(e)||Be.call(e)!=B||ys(e)||!(Oe.call(e,"constructor")||(t=e.constructor,"function"!=typeof t||t instanceof t)))&&(On(e,function(e,t){n=t}),n===o||Oe.call(e,n))}function Rs(e){return As(e)&&Be.call(e)==R}function Ns(e){return"string"==typeof e||Qe(e)&&Be.call(e)==M}function Ms(e){return Qe(e)&&oi(e.length)&&!!Ee[Be.call(e)]}function Ls(e){return e===o}function Fs(e,t){return e0;++i=kt(t,n)&&e=0&&e.indexOf(t,n)==n}function wa(e){return e=Ke(e),e&&ee.test(e)?e.replace(X,Ye):e}function ka(e){return e=Ke(e),e&&ue.test(e)?e.replace(ae,Je):e||"(?:)"}var Sa=yr(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()});function Ea(e,t,n){e=Ke(e),t=+t;var r=e.length;if(r>=t||!vt(t))return e;var i=(t-r)/2,o=yt(i),s=mt(i);return n=Rr("",s,n),n.slice(0,o)+e+n}var xa=jr(),Ca=jr(!0);function Aa(e,t,n){return(n?ni(e,t,n):null==t)?t=0:t&&(t=+t),e=Ba(e),Et(e,t||(pe.test(e)?16:10))}function Ia(e,t){var n="";if(e=Ke(e),t=+t,t<1||!e||!vt(t))return n;do{t%2&&(n+=e),t=yt(t/2),e+=e}while(t);return n}var Ta=yr(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),ja=yr(function(e,t,n){return e+(n?" ":"")+(t.charAt(0).toUpperCase()+t.slice(1))});function Oa(e,t,n){return e=Ke(e),n=null==n?0:kt(n<0?0:+n||0,e.length),e.lastIndexOf(t,n)==n}function Pa(e,t,n){var r=Rt.templateSettings;n&&ni(e,t,n)&&(t=n=o),e=Ke(e),t=hn(pn({},n||t),r,fn);var s=hn(pn({},t.imports),r.imports,fn),a=ra(s),u=nr(s,a),l,c,f=0,h=t.interpolate||ye,p="__p += '",d=_e((t.escape||ye).source+"|"+h.source+"|"+(h===re?fe:ye).source+"|"+(t.evaluate||ye).source+"|$","g"),m="//# sourceURL="+("sourceURL"in t?t.sourceURL:"lodash.templateSources["+ ++Se+"]")+"\n";e.replace(d,function(t,n,r,i,o,s){return r||(r=i),p+=e.slice(f,s).replace(be,Ze),n&&(l=!0,p+="' +\n__e("+n+") +\n'"),o&&(c=!0,p+="';\n"+o+";\n__p += '"),r&&(p+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),f=s+t.length,t}),p+="';\n";var g=t.variable;g||(p="with (obj) {\n"+p+"\n}\n"),p=(c?p.replace(G,""):p).replace(Y,"$1").replace(J,"$1;"),p="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(l?", __e = _.escape":"")+(c?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var y=Da(function(){return i(a,m+"return "+p).apply(o,u)});if(y.source=p,Es(y))throw y;return y}function Ba(e,t,n){var r=e;return e=Ke(e),e?(n?ni(r,t,n):null==t)?e.slice(rt(e),it(e)+1):(t+="",e.slice(He(e,t),Ve(e,t)+1)):e}function Ra(e,t,n){var r=e;return e=Ke(e),e?(n?ni(r,t,n):null==t)?e.slice(rt(e)):e.slice(He(e,t+"")):e}function Na(e,t,n){var r=e;return e=Ke(e),e?(n?ni(r,t,n):null==t)?e.slice(0,it(e)+1):e.slice(0,Ve(e,t+"")+1):e}function Ma(e,t,n){n&&ni(e,t,n)&&(t=o);var r=g,i=y;if(null!=t)if(As(t)){var s="separator"in t?t.separator:s;r="length"in t?+t.length||0:r,i="omission"in t?Ke(t.omission):i}else r=+t||0;if(e=Ke(e),r>=e.length)return e;var a=r-i.length;if(a<1)return i;var u=e.slice(0,a);if(null==s)return u+i;if(Rs(s)){if(e.slice(a).search(s)){var l,c,f=e.slice(0,a);for(s.global||(s=_e(s.source,(he.exec(s)||"")+"g")),s.lastIndex=0;l=s.exec(f);)c=l.index;u=u.slice(0,null==c?a:c)}}else if(e.indexOf(s,a)!=a){var h=u.lastIndexOf(s);h>-1&&(u=u.slice(0,h))}return u+i}function La(e){return e=Ke(e),e&&Q.test(e)?e.replace(Z,ot):e}function Fa(e,t,n){return n&&ni(e,t,n)&&(t=o),e=Ke(e),e.match(t||ve)||[]}var Da=ls(function(e,t){try{return e.apply(o,t)}catch(e){return Es(e)?e:new r(e)}});function Ua(e,t,n){return n&&ni(e,t,n)&&(t=o),Qe(e)?Ka(e):gn(e,t)}function za(e){return function(){return e}}function qa(e){return e}function Ka(e){return Un(yn(e,!0))}function Ha(e,t){return zn(e,yn(t,!0))}var Va=ls(function(e,t){return function(n){return Qr(n,e,t)}}),Wa=ls(function(e,t){return function(n){return Qr(e,n,t)}});function $a(e,t,n){if(null==n){var r=As(t),i=r?ra(t):o,s=i&&i.length?Rn(t,i):o;(s?s.length:r)||(s=!1,n=t,t=e,e=this)}s||(s=Rn(t,ra(t)));var a=!0,u=-1,l=Cs(e),c=s.length;!1===n?a=!1:As(n)&&"chain"in n&&(a=n.chain);for(;++u0||t<0)?new Ft(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==o&&(t=+t||0,n=t<0?n.dropRight(-t):n.take(t-e)),n)},Ft.prototype.takeRightWhile=function(e,t){return this.reverse().takeWhile(e,t).reverse()},Ft.prototype.toArray=function(){return this.take(At)},Pn(Ft.prototype,function(e,t){var n=/^(?:filter|map|reject)|While$/.test(t),r=/^(?:first|last)$/.test(t),i=Rt[r?"take"+("last"==t?"Right":""):t];i&&(Rt.prototype[t]=function(){var t=r?[1]:arguments,s=this.__chain__,a=this.__wrapped__,u=!!this.__actions__.length,l=a instanceof Ft,c=t[0],f=l||bs(a);f&&n&&"function"==typeof c&&1!=c.length&&(l=f=!1);var h=function(e){return r&&s?i(e,1)[0]:i.apply(o,on([e],t))},p={func:so,args:[h],thisArg:o},d=l&&!u;if(r&&!s)return d?(a=a.clone(),a.__actions__.push(p),e.call(a)):i.call(o,this.value())[0];if(!r&&f){a=d?a:new Ft(this);var m=e.apply(a,t);return m.__actions__.push(p),new Mt(m,s)}return this.thru(h)})}),Xt(["join","pop","push","replace","shift","sort","splice","split","unshift"],function(e){var t=(/^(?:replace|split)$/.test(e)?Te:Ae)[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:join|pop|replace|shift)$/.test(e);Rt.prototype[e]=function(){var e=arguments;return r&&!this.__chain__?t.apply(this.value(),e):this[n](function(n){return t.apply(n,e)})}}),Pn(Ft.prototype,function(e,t){var n=Rt[t];if(n){var r=n.name,i=Bt[r]||(Bt[r]=[]);i.push({name:t,func:n})}}),Bt[Br(o,u).name]=[{name:"wrapper",func:o}],Ft.prototype.clone=Dt,Ft.prototype.reverse=Ut,Ft.prototype.value=zt,Rt.prototype.chain=ao,Rt.prototype.commit=uo,Rt.prototype.concat=lo,Rt.prototype.plant=co,Rt.prototype.reverse=fo,Rt.prototype.toString=ho,Rt.prototype.run=Rt.prototype.toJSON=Rt.prototype.valueOf=Rt.prototype.value=po,Rt.prototype.collect=Rt.prototype.map,Rt.prototype.head=Rt.prototype.first,Rt.prototype.select=Rt.prototype.filter,Rt.prototype.tail=Rt.prototype.rest,Rt}var at=st();Fe._=at,i=function(){return at}.call(t,n,t,e),i===o||(e.exports=i)}).call(this)}).call(this,n(75)(e),n(8))},function(e,t,n){"use strict";(function(t){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -function n(e,t){if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i=0;h--)if(u[h]!==c[h])return!1;for(h=u.length-1;h>=0;h--)if(f=u[h],!v(e[f],t[f],r,n))return!1;return!0}function S(e,t,r){v(e,t,!0)&&b(e,t,r,"notDeepStrictEqual",S)}function E(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function k(e){var t;try{e()}catch(e){t=e}return t}function x(e,t,r,n){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=k(t),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&b(i,r,"Missing expected exception"+n);var s="string"==typeof n,a=!e&&o.isError(i),u=!e&&i&&!r;if((a&&s&&E(i,r)||u)&&b(i,r,"Got unwanted exception"+n),e&&i&&r&&!E(i,r)||!e&&i)throw i}h.AssertionError=function e(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=m(this),this.generatedMessage=!0);var r=t.stackStartFunction||b;if(Error.captureStackTrace)Error.captureStackTrace(this,r);else{var n=new Error;if(n.stack){var i=n.stack,o=d(r),s=i.indexOf("\n"+o);if(s>=0){var a=i.indexOf("\n",s+1);i=i.substring(a+1)}this.stack=i}}},o.inherits(h.AssertionError,Error),h.fail=b,h.ok=y,h.equal=function e(t,r,n){t!=r&&b(t,r,n,"==",h.equal)},h.notEqual=function e(t,r,n){t==r&&b(t,r,n,"!=",h.notEqual)},h.deepEqual=function e(t,r,n){v(t,r,!1)||b(t,r,n,"deepEqual",h.deepEqual)},h.deepStrictEqual=function e(t,r,n){v(t,r,!0)||b(t,r,n,"deepStrictEqual",h.deepStrictEqual)},h.notDeepEqual=function e(t,r,n){v(t,r,!1)&&b(t,r,n,"notDeepEqual",h.notDeepEqual)},h.notDeepStrictEqual=S,h.strictEqual=function e(t,r,n){t!==r&&b(t,r,n,"===",h.strictEqual)},h.notStrictEqual=function e(t,r,n){t===r&&b(t,r,n,"!==",h.notStrictEqual)},h.throws=function(e,t,r){x(!0,e,t,r)},h.doesNotThrow=function(e,t,r){x(!1,e,t,r)},h.ifError=function(e){if(e)throw e};var C=Object.keys||function(e){var t=[];for(var r in e)s.call(e,r)&&t.push(r);return t}}).call(this,r(8))},function(e,t,r){"use strict";const n=r(373),i=r(736),o=r(269),s=r(376);t.Key=n,t.MemoryDatastore=i,t.utils=o,t.Errors=s},function(e,t,r){(function(t,n){var i=r(16),o=r(828),s=e.exports=i.util=i.util||{};function a(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function u(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(s.isArrayBuffer(e)||s.isArrayBufferView(e))if(void 0!==n&&e instanceof n)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r15?(i=Date.now(),u(e)):(r.push(e),1===r.length&&a.setAttribute("a",o=!o))}}s.nextTick=s.setImmediate}(),s.isNodejs=void 0!==t&&t.versions&&t.versions.node,s.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},s.isArrayBufferView=function(e){return e&&s.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},s.ByteBuffer=u,s.ByteStringBuffer=u;var c=4096;function f(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=s.isArrayBuffer(e),n=s.isArrayBufferView(e);if(r||n)return this.data=r?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==e&&void 0!==e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)}s.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},s.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},s.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},s.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},s.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),t>>>=1,t>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},s.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},s.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(s.encodeUtf8(e))},s.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},s.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},s.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},s.ByteStringBuffer.prototype.putInt=function(e,t){a(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},s.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},s.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},s.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},s.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},s.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},s.ByteStringBuffer.prototype.copy=function(){var e=s.createBuffer(this.data);return e.read=this.read,e},s.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},s.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},s.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},s.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},s.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},s.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},s.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},s.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},s.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},s.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},s.DataBuffer.prototype.putInt=function(e,t){a(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},s.DataBuffer.prototype.putSignedInt=function(e,t){return a(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},s.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},s.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},s.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},s.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},s.DataBuffer.prototype.copy=function(){return new s.DataBuffer(this)},s.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},s.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},s.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},s.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(r+=e),t>>>=1,t>0&&(e+=e);return r},s.xorBytes=function(e,t,r){for(var n="",i="",o="",s=0,a=0;r>0;--r,++s)i=e.charCodeAt(s)^t.charCodeAt(s),a>=10&&(n+=o,o="",a=0),o+=String.fromCharCode(i),++a;return n+=o,n},s.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,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,-1,-1,-1,-1,-1,-1,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],d="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";s.encode64=function(e,t){for(var r="",n="",i,o,s,a=0;a>2),r+=h.charAt((3&i)<<4|o>>4),isNaN(o)?r+="==":(r+=h.charAt((15&o)<<2|s>>6),r+=isNaN(s)?"=":h.charAt(63&s)),t&&r.length>t&&(n+=r.substr(0,t)+"\r\n",r=r.substr(t));return n+=r,n},s.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t="",r,n,i,o,s=0;s>4),64!==i&&(t+=String.fromCharCode((15&n)<<4|i>>2),64!==o&&(t+=String.fromCharCode((3&i)<<6|o)));return t},s.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},s.decodeUtf8=function(e){return decodeURIComponent(escape(e))},s.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:o.encode,decode:o.decode}},s.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},s.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var i=r,o=0;o>2),r+=h.charAt((3&i)<<4|o>>4),isNaN(o)?r+="==":(r+=h.charAt((15&o)<<2|s>>6),r+=isNaN(s)?"=":h.charAt(63&s)),t&&r.length>t&&(n+=r.substr(0,t)+"\r\n",r=r.substr(t));return n+=r,n},s.binary.base64.decode=function(e,t,r){var n=t,i,o,s,a;n||(n=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var u=0,c=r;u>4,64!==s&&(n[c++]=(15&o)<<4|s>>2,64!==a&&(n[c++]=(3&s)<<6|a));return t?c-r:n.subarray(0,c)},s.binary.base58.encode=function(e,t){return s.binary.baseN.encode(e,d,t)},s.binary.base58.decode=function(e,t){return s.binary.baseN.decode(e,d,t)},s.text={utf8:{},utf16:{}},s.text.utf8.encode=function(e,t,r){e=s.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var i=r,o=0;o0?(o=r[n].substring(0,i),s=r[n].substring(i+1)):(o=r[n],s=null),o in t||(t[o]=[]),o in Object.prototype||null===s||t[o].push(unescape(s))}return t},r;return void 0===e?(null===w&&(w="undefined"!=typeof window&&window.location&&window.location.search?t(window.location.search.substring(1)):{}),r=w):r=t(e),r},s.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var i=t.split("/");i.length>0&&""===i[0]&&i.shift();var o=""===r?{}:s.getQueryVariables(r);return{pathString:t,queryString:r,path:i,query:o}},s.makeRequest=function(e){var t=s.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var n;return void 0===e?n=t.query:(n=t.query[e],n&&void 0!==r&&(n=n[r])),n},getQueryLast:function(e,t){var n,i=r.getQuery(e);return n=i?i[i.length-1]:t,n}};return r},s.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},s.setPath=function(e,t,r){if("object"==typeof e&&null!==e)for(var n=0,i=t.length;n0&&o.push(n),s=t.lastIndex;var a=r[0][1];switch(a){case"s":case"o":i");break;case"%":o.push("%");break;default:o.push("<%"+a+"?>")}}return o.push(e.substring(s)),o.join("")},s.formatNumber=function(e,t,r,n){var i=e,o=isNaN(t=Math.abs(t))?2:t,s=void 0===r?",":r,a=void 0===n?".":n,u=i<0?"-":"",c=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",f=c.length>3?c.length%3:0;return u+(f?c.substr(0,f)+a:"")+c.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+a)+(o?s+Math.abs(i-c).toFixed(o).slice(2):"")},s.formatSize=function(e){return e=e>=1073741824?s.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?s.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?s.formatNumber(e/1024,0)+" KiB":s.formatNumber(e,0)+" bytes",e},s.bytesFromIP=function(e){return-1!==e.indexOf(".")?s.bytesFromIPv4(e):-1!==e.indexOf(":")?s.bytesFromIPv6(e):null},s.bytesFromIPv4=function(e){if(e=e.split("."),4!==e.length)return null;for(var t=s.createBuffer(),r=0;rr[n].end-r[n].start&&(n=r.length-1)):r.push({start:u,end:u})}t.push(o)}if(r.length>0){var c=r[n];c.end-c.start>0&&(t.splice(c.start,c.end-c.start+1,""),0===c.start&&t.unshift(""),7===c.end&&t.push(""))}return t.join(":")},s.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in s&&!e.update)return t(null,s.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return s.cores=navigator.hardwareConcurrency,t(null,s.cores);if("undefined"==typeof Worker)return s.cores=1,t(null,s.cores);if("undefined"==typeof Blob)return s.cores=2,t(null,s.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){for(var t=Date.now(),r=t+4;Date.now()a.st&&i.sti.st&&a.st 3 bytes.");let s=o.decode(n);if(!t.isValidCode(s))throw new Error(`multihash unknown function code: 0x${s.toString(16)}`);n=n.slice(o.decode.bytes);let a=o.decode(n);if(a<1)throw new Error(`multihash invalid length: 0x${a.toString(16)}`);if(n=n.slice(o.decode.bytes),n.length!==a)throw new Error(`multihash length inconsistent: 0x${n.toString("hex")}`);return{code:s,name:i.codes[s],length:a,digest:n}},t.encode=function r(n,i,s){if(!n||!i)throw new Error("multihash encode requires at least two args: digest, code");const a=t.coerceCode(i);if(!e.isBuffer(n))throw new Error("digest should be a Buffer");if(null==s&&(s=n.length),s&&n.length!==s)throw new Error("digest length should be equal to specified length.");return e.concat([e.from(o.encode(a)),e.from(o.encode(s)),n])},t.coerceCode=function e(r){let n=r;if("string"==typeof r){if(!i.names[r])throw new Error(`Unrecognized hash function named: ${r}`);n=i.names[r]}if("number"!=typeof n)throw new Error(`Hash function code should be a number. Got: ${n}`);if(!i.codes[n]&&!t.isAppCode(n))throw new Error(`Unrecognized function code: ${n}`);return n},t.isAppCode=function e(t){return t>0&&t<16},t.isValidCode=function e(r){return!!t.isAppCode(r)||!!i.codes[r]},t.validate=s,t.prefix=function e(t){return s(t),t.slice(0,2)}}).call(this,r(0).Buffer)},function(e,t,r){e.exports={encode:r(710),decode:r(711),encodingLength:r(712)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(370),i=a(n),o=r(267),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){(0,i.default)(s.default,e,t)}e.exports=t.default},function(e,t,r){"use strict";var n=r(15),i=function e(t){return!!n.isString(t)&&/^[0-9a-fA-F]+$/.test(t)};e.exports={isValidJSON:function e(t){var r;if(!n.isString(t))return!1;try{r=JSON.parse(t)}catch(e){return!1}return"object"==typeof r},isHexa:i,isHexaString:i,cloneArray:function(e){return[].concat(e)},defineImmutable:function e(t,r){return Object.keys(r).forEach(function(e){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,value:r[e]})}),t},isNaturalNumber:function e(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t&&t>=0}}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){(function(t){function r(e,t){if(n("noDeprecation"))return e;var r=!1;function i(){if(!r){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return i}function n(e){try{if(!t.localStorage)return!1}catch(e){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=r}).call(this,r(8))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isAsync=void 0;var n=r(193),i=o(n);function o(e){return e&&e.__esModule?e:{default:e}}var s="function"==typeof Symbol;function a(e){return s&&"AsyncFunction"===e[Symbol.toStringTag]}function u(e){return a(e)?(0,i.default)(e):e}t.default=u,t.isAsync=a},function(e,t,r){"use strict";var n=r(365);e.exports=function e(t,r){if(!t)return function(e,t){return e?n(t,e,r):t(!0)};Array.isArray(t)||(t=Object.keys(t).map(function(e){return t[e]}));var i=0;return function(e,o){if(e)return n(o,e,r);i>=t.length?o(!0):o(null,t[i++])}}},function(e,t){e.exports=n;var r=Object.prototype.hasOwnProperty;function n(){for(var e={},t=0;t{if("function"==typeof e)return t=e,e=null,void n.create((e,r)=>{if(e)return t(e);t(null,new a(r))});"function"==typeof e.toJSON?t(null,new a(e)):n.createFromJSON(e,(e,r)=>t(e,new a(r)))}),a.isPeerInfo=(e=>Boolean("object"==typeof e&&e.id&&e.multiaddrs)),e.exports=a},function(e,t,r){var n=r(555),i=r(319),o=n.tfJSON,s=n.TfTypeError,a=n.TfPropertyTypeError,u=n.tfSubError,c=n.getValueTypeName,f={arrayOf:function e(t,r){function n(e,n){return!!i.Array(e)&&(!i.Nil(e)&&(!(void 0!==r.minLength&&e.lengthr.maxLength)&&((void 0===r.length||e.length===r.length)&&e.every(function(e,r){try{return l(t,e,n)}catch(e){throw u(e,r)}})))))}return t=h(t),r=r||{},n.toJSON=function(){var e="["+o(t)+"]";return void 0!==r.length?e+="{"+r.length+"}":void 0===r.minLength&&void 0===r.maxLength||(e+="{"+(void 0===r.minLength?0:r.minLength)+","+(void 0===r.maxLength?1/0:r.maxLength)+"}"),e},n},maybe:function e(t){function r(r,n){return i.Nil(r)||t(r,n,e)}return t=h(t),r.toJSON=function(){return"?"+o(t)},r},map:function e(t,r){function n(e,n){if(!i.Object(e))return!1;if(i.Nil(e))return!1;for(var o in e){try{r&&l(r,o,n)}catch(e){throw u(e,o,"key")}try{var s=e[o];l(t,s,n)}catch(e){throw u(e,o)}}return!0}return t=h(t),r&&(r=h(r)),n.toJSON=r?function(){return"{"+o(r)+": "+o(t)+"}"}:function(){return"{"+o(t)+"}"},n},object:function e(t){var r={};for(var n in t)r[n]=h(t[n]);function s(e,t){if(!i.Object(e))return!1;if(i.Nil(e))return!1;var n;try{for(n in r){var o=r[n],s=e[n];l(o,s,t)}}catch(e){throw u(e,n)}if(t)for(n in e)if(!r[n])throw new a(void 0,n);return!0}return s.toJSON=function(){return o(r)},s},anyOf:function e(){var t=[].slice.call(arguments).map(h);function r(e,r){return t.some(function(t){try{return l(t,e,r)}catch(e){return!1}})}return r.toJSON=function(){return t.map(o).join("|")},r},allOf:function e(){var t=[].slice.call(arguments).map(h);function r(e,r){return t.every(function(t){try{return l(t,e,r)}catch(e){return!1}})}return r.toJSON=function(){return t.map(o).join(" & ")},r},quacksLike:function e(t){function r(e){return t===c(e)}return r.toJSON=function(){return t},r},tuple:function e(){var t=[].slice.call(arguments).map(h);function r(e,r){return!i.Nil(e)&&(!i.Nil(e.length)&&((!r||e.length===t.length)&&t.every(function(t,n){try{return l(t,e[n],r)}catch(e){throw u(e,n)}})))}return r.toJSON=function(){return"("+t.map(o).join(", ")+")"},r},value:function e(t){function r(e){return e===t}return r.toJSON=function(){return t},r}};function h(e){if(i.String(e))return"?"===e[0]?f.maybe(e.slice(1)):i[e]||f.quacksLike(e);if(e&&i.Object(e)){if(i.Array(e)){if(1!==e.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return f.arrayOf(e[0])}return f.object(e)}return i.Function(e)?e:f.value(e)}function l(e,t,r,n){if(i.Function(e)){if(e(t,r))return!0;throw new s(n||e,t)}return l(h(e),t,r)}for(var d in f.oneOf=f.anyOf,i)l[d]=i[d];for(d in f)l[d]=f[d];var p=r(1298);for(d in p)l[d]=p[d];l.compile=h,l.TfTypeError=s,l.TfPropertyTypeError=a,e.exports=l},function(e,t,r){"use strict";const n=r(60),i=n(r(1127)),o=i.Data,s=["raw","directory","file","metadata","symlink","hamt-sharded-directory"],a=["directory","hamt-sharded-directory"];function u(e,t){if(!(this instanceof u))return new u(e,t);if(-1===s.indexOf(e))throw new Error("Type: "+e+" is not valid");this.type=e,this.data=t,this.blockSizes=[],this.addBlockSize=(e=>{this.blockSizes.push(e)}),this.removeBlockSize=(e=>{this.blockSizes.splice(e,1)}),this.fileSize=(()=>{if(a.indexOf(this.type)>=0)return;let e=0;return this.blockSizes.forEach(t=>{e+=t}),t&&(e+=t.length),e}),this.marshal=(()=>{let e;switch(this.type){case"raw":e=o.DataType.Raw;break;case"directory":e=o.DataType.Directory;break;case"file":e=o.DataType.File;break;case"metadata":e=o.DataType.Metadata;break;case"symlink":e=o.DataType.Symlink;break;case"hamt-sharded-directory":e=o.DataType.HAMTShard;break;default:throw new Error(`Unkown type: "${this.type}"`)}let t=this.fileSize(),r=this.data;this.data&&this.data.length||(r=void 0);let n=this.blockSizes;return this.blockSizes&&this.blockSizes.length||(n=void 0),o.encode({Type:e,Data:r,filesize:t,blocksizes:n,hashType:this.hashType,fanout:this.fanout})})}u.unmarshal=(e=>{const t=o.decode(e);t.Data||(t.Data=void 0);const r=new u(s[t.Type],t.Data);return r.blockSizes=t.blocksizes,r}),t=e.exports=u},function(e,t,r){"use strict";(function(t){var n=r(90),i=r(22),o=r(15),s=function(e){for(var r=new t(e.length),n=0;ne.size?r=n.trim(r,o):o0&&0==(127&e[e.length-1])&&(e.length<=1||0==(128&e[e.length-2])))throw new Error("non-minimally encoded script number");return n.fromSM(e,{endian:"little"})},n.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})},n.prototype.gt=function(e){return this.cmp(e)>0},n.prototype.gte=function(e){return this.cmp(e)>=0},n.prototype.lt=function(e){return this.cmp(e)<0},n.trim=function(e,t){return e.slice(t-e.length,e.length)},n.pad=function(e,r,n){for(var i=new t(n),o=0;o",'"',"`"," ","\r","\n","\t"],f=["{","}","|","\\","^","`"].concat(c),h=["'"].concat(f),l=["%","/","?",";","#"].concat(h),d=["/","?","#"],p=255,g=/^[+a-z0-9A-Z_-]{0,63}$/,m=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,b={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_=r(256);function w(e,t,r){if(e&&i.isObject(e)&&e instanceof o)return e;var n=new o;return n.parse(e,t,r),n}function S(e){return i.isString(e)&&(e=w(e)),e instanceof o?e.format():o.prototype.format.call(e)}function E(e,t){return w(e,!1,!0).resolve(t)}function k(e,t){return e?w(e,!1,!0).resolveObject(t):t}o.prototype.parse=function(e,t,r){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o127?M+="x":M+=P[N];if(!M.match(g)){var j=R.slice(0,C),D=R.slice(C+1),F=P.match(m);F&&(j.push(F[1]),D.unshift(F[2])),D.length&&(p="/"+D.join(".")+p),this.hostname=j.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),O||(this.hostname=n.toASCII(this.hostname));var U=this.port?":"+this.port:"",q=this.hostname||"";this.host=q+U,this.href+=this.host,O&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==p[0]&&(p="/"+p))}if(!b[E])for(var C=0,B=h.length;C0)&&r.host.split("@");x&&(r.auth=x.shift(),r.host=r.hostname=x.shift())}return r.search=e.search,r.query=e.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!E.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var C=E.slice(-1)[0],A=(r.host||e.host||E.length>1)&&("."===C||".."===C)||""===C,I=0,T=E.length;T>=0;T--)C=E[T],"."===C?E.splice(T,1):".."===C?(E.splice(T,1),I++):I&&(E.splice(T,1),I--);if(!w&&!S)for(;I--;I)E.unshift("..");!w||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),A&&"/"!==E.join("/").substr(-1)&&E.push("");var O=""===E[0]||E[0]&&"/"===E[0].charAt(0);if(k){r.hostname=r.host=O?"":E.length?E.shift():"";var x=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");x&&(r.auth=x.shift(),r.host=r.hostname=x.shift())}return w=w||r.host&&E.length,w&&!O&&E.unshift(""),E.length?r.pathname=E.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.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},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(190),i=a(n),o=r(370),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){(0,s.default)(i.default,e,t)}e.exports=t.default},function(e,t,r){"use strict";(function(t){const n=r(33),i=r(800);function o(e,t,r,i){if("function"==typeof r&&(i=r,r=void 0),!i)throw new Error("Missing callback");o.digest(e,t,r,(e,o)=>{if(e)return i(e);i(null,n.encode(o,t,r))})}e.exports=o,o.Buffer=t,o.multihash=n,o.digest=function(e,t,r,n){if("function"==typeof r&&(n=r,r=void 0),!n)throw new Error("Missing callback");let i=n,s;r&&(i=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=n.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions)}).call(this,r(0).Buffer)},function(e,t,r){(function(t){var n=r(24),i=r(169),o=r(1053),s=function(){},a=/^v?\.0/.test(t.version),u=function(e){return"function"==typeof e},c=function(e){return!!a&&(!!o&&((e instanceof(o.ReadStream||s)||e instanceof(o.WriteStream||s))&&u(e.close)))},f=function(e){return e.setHeader&&u(e.abort)},h=function(e,t,r,o){o=n(o);var a=!1;e.on("close",function(){a=!0}),i(e,{readable:t,writable:r},function(e){if(e)return o(e);a=!0,o()});var h=!1;return function(t){if(!a&&!h)return h=!0,c(e)?e.close(s):f(e)?e.abort():u(e.destroy)?e.destroy():void o(t||new Error("stream was destroyed"))}},l=function(e){e()},d=function(e,t){return e.pipe(t)},p=function(){var e=Array.prototype.slice.call(arguments),t=u(e[e.length-1]||s)&&e.pop()||s,r;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new Error("pump requires two streams per minimum");var n=e.map(function(i,o){var s=o0;return h(i,s,a,function(e){r||(r=e),e&&n.forEach(l),s||(n.forEach(l),t(r))})});return e.reduce(d)};e.exports=p}).call(this,r(2))},function(e,t,r){"use strict";(function(t){var n=r(115),i=r(26),o=r(22),s=e.exports;s.sha1=function(e){return o.checkArgument(i.isBuffer(e)),n.createHash("sha1").update(e).digest()},s.sha1.blocksize=512,s.sha256=function(e){return o.checkArgument(i.isBuffer(e)),n.createHash("sha256").update(e).digest()},s.sha256.blocksize=512,s.sha256sha256=function(e){return o.checkArgument(i.isBuffer(e)),s.sha256(s.sha256(e))},s.ripemd160=function(e){return o.checkArgument(i.isBuffer(e)),n.createHash("ripemd160").update(e).digest()},s.sha256ripemd160=function(e){return o.checkArgument(i.isBuffer(e)),s.ripemd160(s.sha256(e))},s.sha512=function(e){return o.checkArgument(i.isBuffer(e)),n.createHash("sha512").update(e).digest()},s.sha512.blocksize=1024,s.hmac=function(e,r,n){o.checkArgument(i.isBuffer(r)),o.checkArgument(i.isBuffer(n)),o.checkArgument(e.blocksize);var s=e.blocksize/8;if(n.length>s)n=e(n);else if(n!(!e||!e[n])),i}function i(e,{className:t,symbolName:r,withoutNew:n}){const i=Symbol.for(r),o={[t]:function(...t){if(n&&!(this instanceof o))return new o(...t);const r=e.call(this,...t)||this;return r&&!r[i]&&Object.defineProperty(r,i,{value:!0}),r}}[t];return o.prototype=Object.create(e.prototype),o.prototype.constructor=o,Object.defineProperty(o.prototype,Symbol.toStringTag,{get:()=>t}),o[`is${t}`]=(e=>!(!e||!e[i])),o}e.exports=n,e.exports.proto=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=f;var n=r(190),i=c(n),o=r(371),s=c(o),a=r(39),u=c(a);function c(e){return e&&e.__esModule?e:{default:e}}function f(e,t,r){(0,i.default)(e,(0,s.default)((0,u.default)(t)),r)}e.exports=t.default},function(e,t,r){(function(e){var n=Object.getOwnPropertyDescriptors||function e(t){for(var r=Object.keys(t),n={},i=0;i=o)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),u=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),y(r)?n.showHidden=r:r&&t._extend(n,r),k(n.showHidden)&&(n.showHidden=!1),k(n.depth)&&(n.depth=2),k(n.colors)&&(n.colors=!1),k(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),h(n,e,n.depth)}function u(e,t){var r=a.styles[t];return r?"["+a.colors[r][0]+"m"+e+"["+a.colors[r][1]+"m":e}function c(e,t){return e}function f(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}function h(e,r,n){if(e.customInspect&&r&&T(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return S(i)||(i=h(e,i,n)),i}var o=l(e,r);if(o)return o;var s=Object.keys(r),a=f(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),I(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return d(r);if(0===s.length){if(T(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(x(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(A(r))return e.stylize(Date.prototype.toString.call(r),"date");if(I(r))return d(r)}var c="",y=!1,v=["{","}"],_;if(b(r)&&(y=!0,v=["[","]"]),T(r)){var w=r.name?": "+r.name:"";c=" [Function"+w+"]"}return x(r)&&(c=" "+RegExp.prototype.toString.call(r)),A(r)&&(c=" "+Date.prototype.toUTCString.call(r)),I(r)&&(c=" "+d(r)),0!==s.length||y&&0!=r.length?n<0?x(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),_=y?p(e,r,n,a,s):s.map(function(t){return g(e,r,n,a,t,y)}),e.seen.pop(),m(_,c,v)):v[0]+c+v[1]}function l(e,t){if(k(t))return e.stylize("undefined","undefined");if(S(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return w(t)?e.stylize(""+t,"number"):y(t)?e.stylize(""+t,"boolean"):v(t)?e.stylize("null","null"):void 0}function d(e){return"["+Error.prototype.toString.call(e)+"]"}function p(e,t,r,n,i){for(var o=[],s=0,a=t.length;s-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n"))):a=e.stylize("[Circular]","special")),k(s)){if(o&&i.match(/^\d+$/))return a;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function m(e,t,r){var n=0,i=e.reduce(function(e,t){return n++,t.indexOf("\n")>=0&&n++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function b(e){return Array.isArray(e)}function y(e){return"boolean"==typeof e}function v(e){return null===e}function _(e){return null==e}function w(e){return"number"==typeof e}function S(e){return"string"==typeof e}function E(e){return"symbol"==typeof e}function k(e){return void 0===e}function x(e){return C(e)&&"[object RegExp]"===R(e)}function C(e){return"object"==typeof e&&null!==e}function A(e){return C(e)&&"[object Date]"===R(e)}function I(e){return C(e)&&("[object Error]"===R(e)||e instanceof Error)}function T(e){return"function"==typeof e}function O(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function R(e){return Object.prototype.toString.call(e)}function B(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(r){if(k(s)&&(s=e.env.NODE_DEBUG||""),r=r.toUpperCase(),!o[r])if(new RegExp("\\b"+r+"\\b","i").test(s)){var n=e.pid;o[r]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",r,n,e)}}else o[r]=function(){};return o[r]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=b,t.isBoolean=y,t.isNull=v,t.isNullOrUndefined=_,t.isNumber=w,t.isString=S,t.isSymbol=E,t.isUndefined=k,t.isRegExp=x,t.isObject=C,t.isDate=A,t.isError=I,t.isFunction=T,t.isPrimitive=O,t.isBuffer=r(733);var P=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function M(){var e=new Date,t=[B(e.getHours()),B(e.getMinutes()),B(e.getSeconds())].join(":");return[e.getDate(),P[e.getMonth()],t].join(" ")}function N(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",M(),t.format.apply(t,arguments))},t.inherits=r(1),t._extend=function(e,t){if(!t||!C(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};var L="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function j(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}function D(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');function r(){for(var r=[],n=0;n=10;h/=10,c++);return b.e=c,void(b.c=[e])}m=String(e)}else{if(m=String(e),!s.test(m))return n(b,m,p);b.s=45==m.charCodeAt(0)?(m=m.slice(1),-1):1}(c=m.indexOf("."))>-1&&(m=m.replace(".","")),(h=m.search(/e/i))>0?(c<0&&(c=h),c+=+m.slice(h+1),m=m.substring(0,h)):c<0&&(c=m.length)}else{if(w(t,2,N.length,"Base"),m=String(e),10==t)return b=new H(e instanceof H?e:m),G(b,x+b.e+1,C);if(p="number"==typeof e,p){if(0*e!=0)return n(b,m,p,t);if(b.s=1/e<0?(m=m.slice(1),-1):1,H.DEBUG&&m.replace(/^0\.0*|\./,"").length>15)throw Error(f+e);p=!1}else b.s=45===m.charCodeAt(0)?(m=m.slice(1),-1):1;for(i=N.slice(0,t),c=h=0,g=m.length;hc){c=g;continue}}else if(!a&&(m==m.toUpperCase()&&(m=m.toLowerCase())||m==m.toLowerCase()&&(m=m.toUpperCase()))){a=!0,h=-1,c=0;continue}return n(b,String(e),p,t)}m=r(m,t,10,b.s),(c=m.indexOf("."))>-1?m=m.replace(".",""):c=m.length}for(h=0;48===m.charCodeAt(h);h++);for(g=m.length;48===m.charCodeAt(--g););if(m=m.slice(h,++g),m){if(g-=h,p&&H.DEBUG&&g>15&&(e>d||e!==u(e)))throw Error(f+b.s*e);if(c=c-h-1,c>O)b.c=b.e=null;else if(c=I)?E(u,s):k(u,s,"0");else if(e=G(new H(e),t,r),o=e.e,u=v(e.c),a=u.length,1==n||2==n&&(t<=o||o<=A)){for(;aa){if(--t>0)for(u+=".";t--;u+="0");}else if(t+=o-a,t>0)for(o+1==a&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function W(e,t){for(var r,n=1,i=new H(e[0]);n=10;i/=10,n++);return(r=n+r*l-1)>O?e.c=e.e=null:r=10;c/=10,i++);if(o=t-i,o<0)o+=l,s=t,f=m[d=0],g=f/b[i-s-1]%10|0;else if(d=a((o+1)/l),d>=m.length){if(!n)break e;for(;m.length<=d;m.push(0));f=g=0,i=1,o%=l,s=o-l+1}else{for(f=c=m[d],i=1;c>=10;c/=10,i++);o%=l,s=o-l+i,g=s<0?0:f/b[i-s-1]%10|0}if(n=n||t<0||null!=m[d+1]||(s<0?f:f%b[i-s-1]),n=r<4?(g||n)&&(0==r||r==(e.s<0?3:2)):g>5||5==g&&(4==r||n||6==r&&(o>0?s>0?f/b[i-s]:0:m[d-1])%10&1||r==(e.s<0?8:7)),t<1||!m[0])return m.length=0,n?(t-=e.e+1,m[0]=b[(l-t%l)%l],e.e=-t||0):m[0]=e.e=0,e;if(0==o?(m.length=d,c=1,d--):(m.length=d+1,c=b[l-o],m[d]=s>0?u(f/b[i-s]%b[s])*c:0),n)for(;;){if(0==d){for(o=1,s=m[0];s>=10;s/=10,o++);for(s=m[0]+=c,c=1;s>=10;s/=10,c++);o!=c&&(e.e++,m[0]==h&&(m[0]=1));break}if(m[d]+=c,m[d]!=h)break;m[d--]=0,c=1}for(o=m.length;0===m[--o];m.pop());}e.e>O?e.c=e.e=null:e.e=I?E(t,r):k(t,r,"0"),e.s<0?"-"+t:t)}return H.clone=b,H.ROUND_UP=0,H.ROUND_DOWN=1,H.ROUND_CEIL=2,H.ROUND_FLOOR=3,H.ROUND_HALF_UP=4,H.ROUND_HALF_DOWN=5,H.ROUND_HALF_EVEN=6,H.ROUND_HALF_CEIL=7,H.ROUND_HALF_FLOOR=8,H.EUCLID=9,H.config=H.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(c+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(r=e[t],w(r,0,m,t),x=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(r=e[t],w(r,0,8,t),C=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&(r=e[t],r&&r.pop?(w(r[0],-m,0,t),w(r[1],0,m,t),A=r[0],I=r[1]):(w(r,-m,m,t),A=-(I=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if(r=e[t],r&&r.pop)w(r[0],-m,-1,t),w(r[1],1,m,t),T=r[0],O=r[1];else{if(w(r,-m,m,t),!r)throw Error(c+t+" cannot be zero: "+r);T=-(O=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if(r=e[t],r!==!!r)throw Error(c+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw R=!r,Error(c+"crypto unavailable");R=r}else R=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(r=e[t],w(r,0,9,t),B=r),e.hasOwnProperty(t="POW_PRECISION")&&(r=e[t],w(r,0,m,t),P=r),e.hasOwnProperty(t="FORMAT")){if(r=e[t],"object"!=typeof r)throw Error(c+t+" not an object: "+r);M=r}if(e.hasOwnProperty(t="ALPHABET")){if(r=e[t],"string"!=typeof r||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(c+t+" invalid: "+r);N=r}}return{DECIMAL_PLACES:x,ROUNDING_MODE:C,EXPONENTIAL_AT:[A,I],RANGE:[T,O],CRYPTO:R,MODULO_MODE:B,POW_PRECISION:P,FORMAT:M,ALPHABET:N}},H.isBigNumber=function(e){return e instanceof H||e&&!0===e._isBigNumber||!1},H.maximum=H.max=function(){return W(arguments,i.lt)},H.minimum=H.min=function(){return W(arguments,i.gt)},H.random=(L=9007199254740992,j=Math.random()*L&2097151?function(){return u(Math.random()*L)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,s,f=0,h=[],d=new H(o);if(null==e?e=x:w(e,0,m),i=a(e/l),R)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));f>>11),s>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[f]=r[0],t[f+1]=r[1]):(h.push(s%1e14),f+=2);f=i/2}else{if(!crypto.randomBytes)throw R=!1,Error(c+"crypto unavailable");for(t=crypto.randomBytes(i*=7);f=9e15?crypto.randomBytes(7).copy(t,f):(h.push(s%1e14),f+=7);f=i/7}if(!R)for(;f=10;s/=10,f++);fr-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/r|0,o[i]%=r)}return o.reverse()}return function(n,i,o,s,a){var u,c,f,h,l,d,p,g,m=n.indexOf("."),b=x,y=C;for(m>=0&&(h=P,P=0,n=n.replace(".",""),g=new H(i),d=g.pow(n.length-m),P=h,g.c=r(k(v(d.c),d.e,"0"),10,o,e),g.e=g.c.length),p=r(n,i,o,a?(u=N,e):(u=e,N)),f=h=p.length;0==p[--h];p.pop());if(!p[0])return u.charAt(0);if(m<0?--f:(d.c=p,d.e=f,d.s=s,d=t(d,g,b,y,o),p=d.c,l=d.r,f=d.e),c=f+b+1,m=p[c],h=o/2,l=l||c<0||null!=p[c+1],l=y<4?(null!=m||l)&&(0==y||y==(d.s<0?3:2)):m>h||m==h&&(4==y||l||6==y&&1&p[c-1]||y==(d.s<0?8:7)),c<1||!p[0])n=l?k(u.charAt(1),-b,u.charAt(0)):u.charAt(0);else{if(p.length=c,l)for(--o;++p[--c]>o;)p[c]=0,c||(++f,p=[1].concat(p));for(h=p.length;!p[--h];);for(m=0,n="";m<=h;n+=u.charAt(p[m++]));n=k(n,f,u.charAt(0))}return n}}(),t=function(){function e(e,t,r){var n,i,o,s,a=0,u=e.length,c=t%g,f=t/g|0;for(e=e.slice();u--;)o=e[u]%g,s=e[u]/g|0,n=f*o+s*c,i=c*o+n%g*g+a,a=(i/r|0)+(n/g|0)+f*s,e[u]=i%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]1;e.splice(0,1));}return function(n,i,o,s,a){var c,f,d,p,g,m,b,v,_,w,S,E,k,x,C,A,I,T=n.s==i.s?1:-1,O=n.c,R=i.c;if(!(O&&O[0]&&R&&R[0]))return new H(n.s&&i.s&&(O?!R||O[0]!=R[0]:R)?O&&0==O[0]||!R?0*T:T/0:NaN);for(v=new H(T),_=v.c=[],f=n.e-i.e,T=o+f+1,a||(a=h,f=y(n.e/l)-y(i.e/l),T=T/l|0),d=0;R[d]==(O[d]||0);d++);if(R[d]>(O[d]||0)&&f--,T<0)_.push(1),p=!0;else{for(x=O.length,A=R.length,d=0,T+=2,g=u(a/(R[0]+1)),g>1&&(R=e(R,g,a),O=e(O,g,a),A=R.length,x=O.length),k=A,w=O.slice(0,A),S=w.length;S=a/2&&C++;do{if(g=0,c=t(R,w,A,S),c<0){if(E=w[0],A!=S&&(E=E*a+(w[1]||0)),g=u(E/C),g>1)for(g>=a&&(g=a-1),m=e(R,g,a),b=m.length,S=w.length;1==t(m,w,b,S);)g--,r(m,A=10;T/=10,d++);G(v,o+(v.e=d+f*l-1)+1,s,p)}else v.e=f,v.r=+p;return v}}(),D=/^(-?)0([xbo])(?=\w[\w.]*$)/i,F=/^([^.]+)\.$/,U=/^\.([^.]+)$/,q=/^-?(Infinity|NaN)$/,z=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(e,t,r,n){var i,o=r?t:t.replace(z,"");if(q.test(o))e.s=isNaN(o)?null:o<0?-1:1,e.c=e.e=null;else{if(!r&&(o=o.replace(D,function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t}),n&&(i=n,o=o.replace(F,"$1").replace(U,"0.$1")),t!=o))return new H(o,i);if(H.DEBUG)throw Error(c+"Not a"+(n?" base "+n:"")+" number: "+t);e.c=e.e=e.s=null}},i.absoluteValue=i.abs=function(){var e=new H(this);return e.s<0&&(e.s=1),e},i.comparedTo=function(e,t){return _(this,new H(e,t))},i.decimalPlaces=i.dp=function(e,t){var r,n,i,o=this;if(null!=e)return w(e,0,m),null==t?t=C:w(t,0,8),G(new H(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-y(this.e/l))*l,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},i.dividedBy=i.div=function(e,r){return t(this,new H(e,r),x,C)},i.dividedToIntegerBy=i.idiv=function(e,r){return t(this,new H(e,r),0,1)},i.exponentiatedBy=i.pow=function(e,t){var r,n,i,s,f,h,d,p,g,m=this;if(e=new H(e),e.c&&!e.isInteger())throw Error(c+"Exponent not an integer: "+$(e));if(null!=t&&(t=new H(t)),h=e.e>14,!m.c||!m.c[0]||1==m.c[0]&&!m.e&&1==m.c.length||!e.c||!e.c[0])return g=new H(Math.pow(+$(m),h?2-S(e):+$(e))),t?g.mod(t):g;if(d=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new H(NaN);n=!d&&m.isInteger()&&t.isInteger(),n&&(m=m.mod(t))}else{if(e.e>9&&(m.e>0||m.e<-1||(0==m.e?m.c[0]>1||h&&m.c[1]>=24e7:m.c[0]<8e13||h&&m.c[0]<=9999975e7)))return s=m.s<0&&S(e)?-0:0,m.e>-1&&(s=1/s),new H(d?1/s:s);P&&(s=a(P/l+2))}for(h?(r=new H(.5),d&&(e.s=1),p=S(e)):(i=Math.abs(+$(e)),p=i%2),g=new H(o);;){if(p){if(g=g.times(m),!g.c)break;s?g.c.length>s&&(g.c.length=s):n&&(g=g.mod(t))}if(i){if(i=u(i/2),0===i)break;p=i%2}else if(e=e.times(r),G(e,e.e+1,1),e.e>14)p=S(e);else{if(i=+$(e),0===i)break;p=i%2}m=m.times(m),s?m.c&&m.c.length>s&&(m.c.length=s):n&&(m=m.mod(t))}return n?g:(d&&(g=o.div(g)),t?g.mod(t):s?G(g,P,C,f):g)},i.integerValue=function(e){var t=new H(this);return null==e?e=C:w(e,0,8),G(t,t.e+1,e)},i.isEqualTo=i.eq=function(e,t){return 0===_(this,new H(e,t))},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(e,t){return _(this,new H(e,t))>0},i.isGreaterThanOrEqualTo=i.gte=function(e,t){return 1===(t=_(this,new H(e,t)))||0===t},i.isInteger=function(){return!!this.c&&y(this.e/l)>this.c.length-2},i.isLessThan=i.lt=function(e,t){return _(this,new H(e,t))<0},i.isLessThanOrEqualTo=i.lte=function(e,t){return-1===(t=_(this,new H(e,t)))||0===t},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&0==this.c[0]},i.minus=function(e,t){var r,n,i,o,s=this,a=s.s;if(e=new H(e,t),t=e.s,!a||!t)return new H(NaN);if(a!=t)return e.s=-t,s.plus(e);var u=s.e/l,c=e.e/l,f=s.c,d=e.c;if(!u||!c){if(!f||!d)return f?(e.s=-t,e):new H(d?s:NaN);if(!f[0]||!d[0])return d[0]?(e.s=-t,e):new H(f[0]?s:3==C?-0:0)}if(u=y(u),c=y(c),f=f.slice(),a=u-c){for((o=a<0)?(a=-a,i=f):(c=u,i=d),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(o=(a=f.length)<(t=d.length))?a:t,a=t=0;t0)for(;t--;f[r++]=0);for(t=h-1;n>a;){if(f[--n]=0;){for(r=0,p=E[i]%_,m=E[i]/_|0,s=u,o=i+s;o>i;)c=S[--s]%_,f=S[s]/_|0,a=m*c+f*p,c=p*c+a%_*_+b[o]+r,r=(c/v|0)+(a/_|0)+m*f,b[o--]=c%v;b[o]=r}return r?++n:b.splice(0,1),V(e,b,n)},i.negated=function(){var e=new H(this);return e.s=-e.s||null,e},i.plus=function(e,t){var r,n=this,i=n.s;if(e=new H(e,t),t=e.s,!i||!t)return new H(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/l,s=e.e/l,a=n.c,u=e.c;if(!o||!s){if(!a||!u)return new H(i/0);if(!a[0]||!u[0])return u[0]?e:new H(a[0]?n:0*i)}if(o=y(o),s=y(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=u):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for(i=a.length,t=u.length,i-t<0&&(r=u,u=a,a=r,t=i),i=0;t;)i=(a[--t]=a[t]+u[t]+i)/h|0,a[t]=h===a[t]?0:a[t]%h;return i&&(a=[i].concat(a),++s),V(e,a,s)},i.precision=i.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return w(e,1,m),null==t?t=C:w(t,0,8),G(new H(o),e,t);if(!(r=o.c))return null;if(i=r.length-1,n=i*l+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},i.shiftedBy=function(e){return w(e,-d,d),this.times("1e"+e)},i.squareRoot=i.sqrt=function(){var e,r,n,i,o,s=this,a=s.c,u=s.s,c=s.e,f=x+4,h=new H("0.5");if(1!==u||!a||!a[0])return new H(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);if(u=Math.sqrt(+$(s)),0==u||u==1/0?(r=v(a),(r.length+c)%2==0&&(r+="0"),u=Math.sqrt(+r),c=y((c+1)/2)-(c<0||c%2),u==1/0?r="1e"+c:(r=u.toExponential(),r=r.slice(0,r.indexOf("e")+1)+c),n=new H(r)):n=new H(u+""),n.c[0])for(c=n.e,u=c+f,u<3&&(u=0);;)if(o=n,n=h.times(o.plus(t(s,o,f,1))),v(o.c).slice(0,u)===(r=v(n.c)).slice(0,u)){if(n.e0&&g>0){for(o=g%a||a,h=p.substr(0,o);o0&&(h+=f+p.slice(o)),d&&(h="-"+h)}n=l?h+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?l.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):l):h}return(r.prefix||"")+n+(r.suffix||"")},i.toFraction=function(e){var r,n,i,s,a,u,f,h,d,g,m,b,y=this,_=y.c;if(null!=e&&(f=new H(e),!f.isInteger()&&(f.c||1!==f.s)||f.lt(o)))throw Error(c+"Argument "+(f.isInteger()?"out of range: ":"not an integer: ")+$(f));if(!_)return new H(y);for(r=new H(o),d=n=new H(o),i=h=new H(o),b=v(_),a=r.e=b.length-y.e-1,r.c[0]=p[(u=a%l)<0?l+u:u],e=!e||f.comparedTo(r)>0?a>0?r:d:f,u=O,O=1/0,f=new H(b),h.c[0]=0;g=t(f,r,0,1),s=n.plus(g.times(i)),1!=s.comparedTo(e);)n=i,i=s,d=h.plus(g.times(s=d)),h=s,r=f.minus(g.times(s=r)),f=s;return s=t(e.minus(n),i,0,1),h=h.plus(s.times(d)),n=n.plus(s.times(i)),h.s=d.s=y.s,a*=2,m=t(d,i,a,C).minus(y).abs().comparedTo(t(h,n,a,C).minus(y).abs())<1?[d,i]:[h,n],O=u,m},i.toNumber=function(){return+$(this)},i.toPrecision=function(e,t){return null!=e&&w(e,1,m),K(this,e,t,2)},i.toString=function(e){var t,n=this,i=n.s,o=n.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=A||o>=I?E(v(n.c),o):k(v(n.c),o,"0"):10===e?(n=G(new H(n),x+o+1,C),t=k(v(n.c),n.e,"0")):(w(e,2,N.length,"Base"),t=r(k(v(n.c),o,"0"),10,e,i,!0)),i<0&&n.c[0]&&(t="-"+t)),t},i.valueOf=i.toJSON=function(){return $(this)},i._isBigNumber=!0,"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator&&(i[Symbol.toStringTag]="BigNumber",i[Symbol.for("nodejs.util.inspect.custom")]=i.valueOf),null!=e&&H.set(e),H}function y(e){var t=0|e;return e>0||e===t?t:t-1}function v(e){for(var t,r,n=1,i=e.length,o=e[0]+"";nc^r?1:-1;for(a=(u=i.length)<(c=o.length)?u:c,s=0;so[s]^r?1:-1;return u==c?0:u>c^r?1:-1}function w(e,t,r,n){if(er||e!==(e<0?a(e):u(e)))throw Error(c+(n||"Argument")+("number"==typeof e?er?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function S(e){var t=e.c.length-1;return y(e.e/l)==t&&e.c[t]%2!=0}function E(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function k(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(n=e.length,++t>n){for(i=r,t-=n;--t;i+=r);e+=i}else t=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return n}function u(e,t,r,n){for(var i=0,o=Math.min(e.length,r),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function e(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function e(t,r){return t.cmp(r)>0?t:r},o.min=function e(t,r){return t.cmp(r)<0?t:r},o.prototype._init=function e(t,r,i){if("number"==typeof t)return this._initNumber(t,r,i);if("object"==typeof t)return this._initArray(t,r,i);"hex"===r&&(r=16),n(r===(0|r)&&r>=2&&r<=36),t=t.toString().replace(/\s+/g,"");var o=0;"-"===t[0]&&o++,16===r?this._parseHex(t,o):this._parseBase(t,r,o),"-"===t[0]&&(this.negative=1),this.strip(),"le"===i&&this._initArray(this.toArray(),r,i)},o.prototype._initNumber=function e(t,r,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),r,i)},o.prototype._initArray=function e(t,r,i){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var o=0;o=0;o-=3)a=t[o]|t[o-1]<<8|t[o-2]<<16,this.words[s]|=a<>>26-u&67108863,u+=24,u>=26&&(u-=26,s++);else if("le"===i)for(o=0,s=0;o>>26-u&67108863,u+=24,u>=26&&(u-=26,s++);return this.strip()},o.prototype._parseHex=function e(t,r){this.length=Math.ceil((t.length-r)/6),this.words=new Array(this.length);for(var n=0;n=r;n-=6)o=a(t,n,n+6),this.words[i]|=o<>>26-s&4194303,s+=24,s>=26&&(s-=26,i++);n+6!==r&&(o=a(t,r,n+6),this.words[i]|=o<>>26-s&4194303),this.strip()},o.prototype._parseBase=function e(t,r,n){this.words=[0],this.length=1;for(var i=0,o=1;o<=67108863;o*=r)i++;i--,o=o/r|0;for(var s=t.length-n,a=s%i,c=Math.min(s,s-a)+n,f=0,h=n;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function e(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function e(){return(this.red?""};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function l(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}function d(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var c=1;c>>26,h=67108863&u,l=Math.min(c,t.length-1),d=Math.max(0,c-e.length+1);d<=l;d++){var p=c-d|0;i=0|e.words[p],o=0|t.words[d],s=i*o+h,f+=s/67108864|0,h=67108863&s}r.words[c]=0|h,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}o.prototype.toString=function e(t,r){var i;if(t=t||10,r=0|r||1,16===t||"hex"===t){i="";for(var o=0,s=0,a=0;a>>24-o&16777215,i=0!==s||a!==this.length-1?c[6-l.length]+l+i:l+i,o+=2,o>=26&&(o-=26,a--)}for(0!==s&&(i=s.toString(16)+i);i.length%r!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var d=f[t],p=h[t];i="";var g=this.clone();for(g.negative=0;!g.isZero();){var m=g.modn(p).toString(t);g=g.idivn(p),i=g.isZero()?m+i:c[d-m.length]+m+i}for(this.isZero()&&(i="0"+i);i.length%r!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function e(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function e(){return this.toString(16)},o.prototype.toBuffer=function e(t,r){return n(void 0!==s),this.toArrayLike(s,t,r)},o.prototype.toArray=function e(t,r){return this.toArrayLike(Array,t,r)},o.prototype.toArrayLike=function e(t,r,i){var o=this.byteLength(),s=i||Math.max(1,o);n(o<=s,"byte array longer than desired length"),n(s>0,"Requested array length <= 0"),this.strip();var a="le"===r,u=new t(s),c,f,h=this.clone();if(a){for(f=0;!h.isZero();f++)c=h.andln(255),h.iushrn(8),u[f]=c;for(;f=4096&&(n+=13,r>>>=13),r>=64&&(n+=7,r>>>=7),r>=8&&(n+=4,r>>>=4),r>=2&&(n+=2,r>>>=2),n+r},o.prototype._zeroBits=function e(t){if(0===t)return 26;var r=t,n=0;return 0==(8191&r)&&(n+=13,r>>>=13),0==(127&r)&&(n+=7,r>>>=7),0==(15&r)&&(n+=4,r>>>=4),0==(3&r)&&(n+=2,r>>>=2),0==(1&r)&&n++,n},o.prototype.bitLength=function e(){var t=this.words[this.length-1],r=this._countBits(t);return 26*(this.length-1)+r},o.prototype.zeroBits=function e(){if(this.isZero())return 0;for(var t=0,r=0;rt.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function e(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function e(t){var r;r=this.length>t.length?t:this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function e(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function e(t){var r,n;this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function e(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function e(t){n("number"==typeof t&&t>=0);var r=0|Math.ceil(t/26),i=t%26;this._expand(r),i>0&&r--;for(var o=0;o0&&(this.words[o]=~this.words[o]&67108863>>26-i),this.strip()},o.prototype.notn=function e(t){return this.clone().inotn(t)},o.prototype.setn=function e(t,r){n("number"==typeof t&&t>=0);var i=t/26|0,o=t%26;return this._expand(i+1),this.words[i]=r?this.words[i]|1<t.length?(n=this,i=t):(n=t,i=this);for(var o=0,s=0;s>>26;for(;0!==o&&s>>26;if(this.length=n.length,0!==o)this.words[this.length]=o,this.length++;else if(n!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function e(t){if(0!==t.negative){t.negative=0;var r=this.iadd(t);return t.negative=1,r._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n=this.cmp(t),i,o;if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(i=this,o=t):(i=t,o=this);for(var s=0,a=0;a>26,this.words[a]=67108863&r;for(;0!==s&&a>26,this.words[a]=67108863&r;if(0===s&&a>>13,p=0|i[1],g=8191&p,m=p>>>13,b=0|i[2],y=8191&b,v=b>>>13,_=0|i[3],w=8191&_,S=_>>>13,E=0|i[4],k=8191&E,x=E>>>13,C=0|i[5],A=8191&C,I=C>>>13,T=0|i[6],O=8191&T,R=T>>>13,B=0|i[7],P=8191&B,M=B>>>13,N=0|i[8],L=8191&N,j=N>>>13,D=0|i[9],F=8191&D,U=D>>>13,q=0|o[0],z=8191&q,H=q>>>13,K=0|o[1],W=8191&K,V=K>>>13,G=0|o[2],$=8191&G,Y=G>>>13,J=0|o[3],X=8191&J,Z=J>>>13,Q=0|o[4],ee=8191&Q,te=Q>>>13,re=0|o[5],ne=8191&re,ie=re>>>13,oe=0|o[6],se=8191&oe,ae=oe>>>13,ue=0|o[7],ce=8191&ue,fe=ue>>>13,he=0|o[8],le=8191&he,de=he>>>13,pe=0|o[9],ge=8191&pe,me=pe>>>13;n.negative=t.negative^r.negative,n.length=19,u=Math.imul(l,z),c=Math.imul(l,H),c=c+Math.imul(d,z)|0,f=Math.imul(d,H);var be=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(be>>>26)|0,be&=67108863,u=Math.imul(g,z),c=Math.imul(g,H),c=c+Math.imul(m,z)|0,f=Math.imul(m,H),u=u+Math.imul(l,W)|0,c=c+Math.imul(l,V)|0,c=c+Math.imul(d,W)|0,f=f+Math.imul(d,V)|0;var ye=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(ye>>>26)|0,ye&=67108863,u=Math.imul(y,z),c=Math.imul(y,H),c=c+Math.imul(v,z)|0,f=Math.imul(v,H),u=u+Math.imul(g,W)|0,c=c+Math.imul(g,V)|0,c=c+Math.imul(m,W)|0,f=f+Math.imul(m,V)|0,u=u+Math.imul(l,$)|0,c=c+Math.imul(l,Y)|0,c=c+Math.imul(d,$)|0,f=f+Math.imul(d,Y)|0;var ve=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(ve>>>26)|0,ve&=67108863,u=Math.imul(w,z),c=Math.imul(w,H),c=c+Math.imul(S,z)|0,f=Math.imul(S,H),u=u+Math.imul(y,W)|0,c=c+Math.imul(y,V)|0,c=c+Math.imul(v,W)|0,f=f+Math.imul(v,V)|0,u=u+Math.imul(g,$)|0,c=c+Math.imul(g,Y)|0,c=c+Math.imul(m,$)|0,f=f+Math.imul(m,Y)|0,u=u+Math.imul(l,X)|0,c=c+Math.imul(l,Z)|0,c=c+Math.imul(d,X)|0,f=f+Math.imul(d,Z)|0;var _e=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(_e>>>26)|0,_e&=67108863,u=Math.imul(k,z),c=Math.imul(k,H),c=c+Math.imul(x,z)|0,f=Math.imul(x,H),u=u+Math.imul(w,W)|0,c=c+Math.imul(w,V)|0,c=c+Math.imul(S,W)|0,f=f+Math.imul(S,V)|0,u=u+Math.imul(y,$)|0,c=c+Math.imul(y,Y)|0,c=c+Math.imul(v,$)|0,f=f+Math.imul(v,Y)|0,u=u+Math.imul(g,X)|0,c=c+Math.imul(g,Z)|0,c=c+Math.imul(m,X)|0,f=f+Math.imul(m,Z)|0,u=u+Math.imul(l,ee)|0,c=c+Math.imul(l,te)|0,c=c+Math.imul(d,ee)|0,f=f+Math.imul(d,te)|0;var we=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(we>>>26)|0,we&=67108863,u=Math.imul(A,z),c=Math.imul(A,H),c=c+Math.imul(I,z)|0,f=Math.imul(I,H),u=u+Math.imul(k,W)|0,c=c+Math.imul(k,V)|0,c=c+Math.imul(x,W)|0,f=f+Math.imul(x,V)|0,u=u+Math.imul(w,$)|0,c=c+Math.imul(w,Y)|0,c=c+Math.imul(S,$)|0,f=f+Math.imul(S,Y)|0,u=u+Math.imul(y,X)|0,c=c+Math.imul(y,Z)|0,c=c+Math.imul(v,X)|0,f=f+Math.imul(v,Z)|0,u=u+Math.imul(g,ee)|0,c=c+Math.imul(g,te)|0,c=c+Math.imul(m,ee)|0,f=f+Math.imul(m,te)|0,u=u+Math.imul(l,ne)|0,c=c+Math.imul(l,ie)|0,c=c+Math.imul(d,ne)|0,f=f+Math.imul(d,ie)|0;var Se=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Se>>>26)|0,Se&=67108863,u=Math.imul(O,z),c=Math.imul(O,H),c=c+Math.imul(R,z)|0,f=Math.imul(R,H),u=u+Math.imul(A,W)|0,c=c+Math.imul(A,V)|0,c=c+Math.imul(I,W)|0,f=f+Math.imul(I,V)|0,u=u+Math.imul(k,$)|0,c=c+Math.imul(k,Y)|0,c=c+Math.imul(x,$)|0,f=f+Math.imul(x,Y)|0,u=u+Math.imul(w,X)|0,c=c+Math.imul(w,Z)|0,c=c+Math.imul(S,X)|0,f=f+Math.imul(S,Z)|0,u=u+Math.imul(y,ee)|0,c=c+Math.imul(y,te)|0,c=c+Math.imul(v,ee)|0,f=f+Math.imul(v,te)|0,u=u+Math.imul(g,ne)|0,c=c+Math.imul(g,ie)|0,c=c+Math.imul(m,ne)|0,f=f+Math.imul(m,ie)|0,u=u+Math.imul(l,se)|0,c=c+Math.imul(l,ae)|0,c=c+Math.imul(d,se)|0,f=f+Math.imul(d,ae)|0;var Ee=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,u=Math.imul(P,z),c=Math.imul(P,H),c=c+Math.imul(M,z)|0,f=Math.imul(M,H),u=u+Math.imul(O,W)|0,c=c+Math.imul(O,V)|0,c=c+Math.imul(R,W)|0,f=f+Math.imul(R,V)|0,u=u+Math.imul(A,$)|0,c=c+Math.imul(A,Y)|0,c=c+Math.imul(I,$)|0,f=f+Math.imul(I,Y)|0,u=u+Math.imul(k,X)|0,c=c+Math.imul(k,Z)|0,c=c+Math.imul(x,X)|0,f=f+Math.imul(x,Z)|0,u=u+Math.imul(w,ee)|0,c=c+Math.imul(w,te)|0,c=c+Math.imul(S,ee)|0,f=f+Math.imul(S,te)|0,u=u+Math.imul(y,ne)|0,c=c+Math.imul(y,ie)|0,c=c+Math.imul(v,ne)|0,f=f+Math.imul(v,ie)|0,u=u+Math.imul(g,se)|0,c=c+Math.imul(g,ae)|0,c=c+Math.imul(m,se)|0,f=f+Math.imul(m,ae)|0,u=u+Math.imul(l,ce)|0,c=c+Math.imul(l,fe)|0,c=c+Math.imul(d,ce)|0,f=f+Math.imul(d,fe)|0;var ke=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(ke>>>26)|0,ke&=67108863,u=Math.imul(L,z),c=Math.imul(L,H),c=c+Math.imul(j,z)|0,f=Math.imul(j,H),u=u+Math.imul(P,W)|0,c=c+Math.imul(P,V)|0,c=c+Math.imul(M,W)|0,f=f+Math.imul(M,V)|0,u=u+Math.imul(O,$)|0,c=c+Math.imul(O,Y)|0,c=c+Math.imul(R,$)|0,f=f+Math.imul(R,Y)|0,u=u+Math.imul(A,X)|0,c=c+Math.imul(A,Z)|0,c=c+Math.imul(I,X)|0,f=f+Math.imul(I,Z)|0,u=u+Math.imul(k,ee)|0,c=c+Math.imul(k,te)|0,c=c+Math.imul(x,ee)|0,f=f+Math.imul(x,te)|0,u=u+Math.imul(w,ne)|0,c=c+Math.imul(w,ie)|0,c=c+Math.imul(S,ne)|0,f=f+Math.imul(S,ie)|0,u=u+Math.imul(y,se)|0,c=c+Math.imul(y,ae)|0,c=c+Math.imul(v,se)|0,f=f+Math.imul(v,ae)|0,u=u+Math.imul(g,ce)|0,c=c+Math.imul(g,fe)|0,c=c+Math.imul(m,ce)|0,f=f+Math.imul(m,fe)|0,u=u+Math.imul(l,le)|0,c=c+Math.imul(l,de)|0,c=c+Math.imul(d,le)|0,f=f+Math.imul(d,de)|0;var xe=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(xe>>>26)|0,xe&=67108863,u=Math.imul(F,z),c=Math.imul(F,H),c=c+Math.imul(U,z)|0,f=Math.imul(U,H),u=u+Math.imul(L,W)|0,c=c+Math.imul(L,V)|0,c=c+Math.imul(j,W)|0,f=f+Math.imul(j,V)|0,u=u+Math.imul(P,$)|0,c=c+Math.imul(P,Y)|0,c=c+Math.imul(M,$)|0,f=f+Math.imul(M,Y)|0,u=u+Math.imul(O,X)|0,c=c+Math.imul(O,Z)|0,c=c+Math.imul(R,X)|0,f=f+Math.imul(R,Z)|0,u=u+Math.imul(A,ee)|0,c=c+Math.imul(A,te)|0,c=c+Math.imul(I,ee)|0,f=f+Math.imul(I,te)|0,u=u+Math.imul(k,ne)|0,c=c+Math.imul(k,ie)|0,c=c+Math.imul(x,ne)|0,f=f+Math.imul(x,ie)|0,u=u+Math.imul(w,se)|0,c=c+Math.imul(w,ae)|0,c=c+Math.imul(S,se)|0,f=f+Math.imul(S,ae)|0,u=u+Math.imul(y,ce)|0,c=c+Math.imul(y,fe)|0,c=c+Math.imul(v,ce)|0,f=f+Math.imul(v,fe)|0,u=u+Math.imul(g,le)|0,c=c+Math.imul(g,de)|0,c=c+Math.imul(m,le)|0,f=f+Math.imul(m,de)|0,u=u+Math.imul(l,ge)|0,c=c+Math.imul(l,me)|0,c=c+Math.imul(d,ge)|0,f=f+Math.imul(d,me)|0;var Ce=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,u=Math.imul(F,W),c=Math.imul(F,V),c=c+Math.imul(U,W)|0,f=Math.imul(U,V),u=u+Math.imul(L,$)|0,c=c+Math.imul(L,Y)|0,c=c+Math.imul(j,$)|0,f=f+Math.imul(j,Y)|0,u=u+Math.imul(P,X)|0,c=c+Math.imul(P,Z)|0,c=c+Math.imul(M,X)|0,f=f+Math.imul(M,Z)|0,u=u+Math.imul(O,ee)|0,c=c+Math.imul(O,te)|0,c=c+Math.imul(R,ee)|0,f=f+Math.imul(R,te)|0,u=u+Math.imul(A,ne)|0,c=c+Math.imul(A,ie)|0,c=c+Math.imul(I,ne)|0,f=f+Math.imul(I,ie)|0,u=u+Math.imul(k,se)|0,c=c+Math.imul(k,ae)|0,c=c+Math.imul(x,se)|0,f=f+Math.imul(x,ae)|0,u=u+Math.imul(w,ce)|0,c=c+Math.imul(w,fe)|0,c=c+Math.imul(S,ce)|0,f=f+Math.imul(S,fe)|0,u=u+Math.imul(y,le)|0,c=c+Math.imul(y,de)|0,c=c+Math.imul(v,le)|0,f=f+Math.imul(v,de)|0,u=u+Math.imul(g,ge)|0,c=c+Math.imul(g,me)|0,c=c+Math.imul(m,ge)|0,f=f+Math.imul(m,me)|0;var Ae=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,u=Math.imul(F,$),c=Math.imul(F,Y),c=c+Math.imul(U,$)|0,f=Math.imul(U,Y),u=u+Math.imul(L,X)|0,c=c+Math.imul(L,Z)|0,c=c+Math.imul(j,X)|0,f=f+Math.imul(j,Z)|0,u=u+Math.imul(P,ee)|0,c=c+Math.imul(P,te)|0,c=c+Math.imul(M,ee)|0,f=f+Math.imul(M,te)|0,u=u+Math.imul(O,ne)|0,c=c+Math.imul(O,ie)|0,c=c+Math.imul(R,ne)|0,f=f+Math.imul(R,ie)|0,u=u+Math.imul(A,se)|0,c=c+Math.imul(A,ae)|0,c=c+Math.imul(I,se)|0,f=f+Math.imul(I,ae)|0,u=u+Math.imul(k,ce)|0,c=c+Math.imul(k,fe)|0,c=c+Math.imul(x,ce)|0,f=f+Math.imul(x,fe)|0,u=u+Math.imul(w,le)|0,c=c+Math.imul(w,de)|0,c=c+Math.imul(S,le)|0,f=f+Math.imul(S,de)|0,u=u+Math.imul(y,ge)|0,c=c+Math.imul(y,me)|0,c=c+Math.imul(v,ge)|0,f=f+Math.imul(v,me)|0;var Ie=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,u=Math.imul(F,X),c=Math.imul(F,Z),c=c+Math.imul(U,X)|0,f=Math.imul(U,Z),u=u+Math.imul(L,ee)|0,c=c+Math.imul(L,te)|0,c=c+Math.imul(j,ee)|0,f=f+Math.imul(j,te)|0,u=u+Math.imul(P,ne)|0,c=c+Math.imul(P,ie)|0,c=c+Math.imul(M,ne)|0,f=f+Math.imul(M,ie)|0,u=u+Math.imul(O,se)|0,c=c+Math.imul(O,ae)|0,c=c+Math.imul(R,se)|0,f=f+Math.imul(R,ae)|0,u=u+Math.imul(A,ce)|0,c=c+Math.imul(A,fe)|0,c=c+Math.imul(I,ce)|0,f=f+Math.imul(I,fe)|0,u=u+Math.imul(k,le)|0,c=c+Math.imul(k,de)|0,c=c+Math.imul(x,le)|0,f=f+Math.imul(x,de)|0,u=u+Math.imul(w,ge)|0,c=c+Math.imul(w,me)|0,c=c+Math.imul(S,ge)|0,f=f+Math.imul(S,me)|0;var Te=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Te>>>26)|0,Te&=67108863,u=Math.imul(F,ee),c=Math.imul(F,te),c=c+Math.imul(U,ee)|0,f=Math.imul(U,te),u=u+Math.imul(L,ne)|0,c=c+Math.imul(L,ie)|0,c=c+Math.imul(j,ne)|0,f=f+Math.imul(j,ie)|0,u=u+Math.imul(P,se)|0,c=c+Math.imul(P,ae)|0,c=c+Math.imul(M,se)|0,f=f+Math.imul(M,ae)|0,u=u+Math.imul(O,ce)|0,c=c+Math.imul(O,fe)|0,c=c+Math.imul(R,ce)|0,f=f+Math.imul(R,fe)|0,u=u+Math.imul(A,le)|0,c=c+Math.imul(A,de)|0,c=c+Math.imul(I,le)|0,f=f+Math.imul(I,de)|0,u=u+Math.imul(k,ge)|0,c=c+Math.imul(k,me)|0,c=c+Math.imul(x,ge)|0,f=f+Math.imul(x,me)|0;var Oe=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,u=Math.imul(F,ne),c=Math.imul(F,ie),c=c+Math.imul(U,ne)|0,f=Math.imul(U,ie),u=u+Math.imul(L,se)|0,c=c+Math.imul(L,ae)|0,c=c+Math.imul(j,se)|0,f=f+Math.imul(j,ae)|0,u=u+Math.imul(P,ce)|0,c=c+Math.imul(P,fe)|0,c=c+Math.imul(M,ce)|0,f=f+Math.imul(M,fe)|0,u=u+Math.imul(O,le)|0,c=c+Math.imul(O,de)|0,c=c+Math.imul(R,le)|0,f=f+Math.imul(R,de)|0,u=u+Math.imul(A,ge)|0,c=c+Math.imul(A,me)|0,c=c+Math.imul(I,ge)|0,f=f+Math.imul(I,me)|0;var Re=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Re>>>26)|0,Re&=67108863,u=Math.imul(F,se),c=Math.imul(F,ae),c=c+Math.imul(U,se)|0,f=Math.imul(U,ae),u=u+Math.imul(L,ce)|0,c=c+Math.imul(L,fe)|0,c=c+Math.imul(j,ce)|0,f=f+Math.imul(j,fe)|0,u=u+Math.imul(P,le)|0,c=c+Math.imul(P,de)|0,c=c+Math.imul(M,le)|0,f=f+Math.imul(M,de)|0,u=u+Math.imul(O,ge)|0,c=c+Math.imul(O,me)|0,c=c+Math.imul(R,ge)|0,f=f+Math.imul(R,me)|0;var Be=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Be>>>26)|0,Be&=67108863,u=Math.imul(F,ce),c=Math.imul(F,fe),c=c+Math.imul(U,ce)|0,f=Math.imul(U,fe),u=u+Math.imul(L,le)|0,c=c+Math.imul(L,de)|0,c=c+Math.imul(j,le)|0,f=f+Math.imul(j,de)|0,u=u+Math.imul(P,ge)|0,c=c+Math.imul(P,me)|0,c=c+Math.imul(M,ge)|0,f=f+Math.imul(M,me)|0;var Pe=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,u=Math.imul(F,le),c=Math.imul(F,de),c=c+Math.imul(U,le)|0,f=Math.imul(U,de),u=u+Math.imul(L,ge)|0,c=c+Math.imul(L,me)|0,c=c+Math.imul(j,ge)|0,f=f+Math.imul(j,me)|0;var Me=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Me>>>26)|0,Me&=67108863,u=Math.imul(F,ge),c=Math.imul(F,me),c=c+Math.imul(U,ge)|0,f=Math.imul(U,me);var Ne=(a+u|0)+((8191&c)<<13)|0;return a=(f+(c>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,s[0]=be,s[1]=ye,s[2]=ve,s[3]=_e,s[4]=we,s[5]=Se,s[6]=Ee,s[7]=ke,s[8]=xe,s[9]=Ce,s[10]=Ae,s[11]=Ie,s[12]=Te,s[13]=Oe,s[14]=Re,s[15]=Be,s[16]=Pe,s[17]=Me,s[18]=Ne,0!==a&&(s[19]=a,n.length++),n};function g(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0,i+=s>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}function m(e,t,r){var n=new b;return n.mulp(e,t,r)}function b(e,t){this.x=e,this.y=t}Math.imul||(p=d),o.prototype.mulTo=function e(t,r){var n,i=this.length+t.length;return n=10===this.length&&10===t.length?p(this,t,r):i<63?d(this,t,r):i<1024?g(this,t,r):m(this,t,r),n},b.prototype.makeRBT=function e(t){for(var r=new Array(t),n=o.prototype._countBits(t)-1,i=0;i>=1;return i},b.prototype.permute=function e(t,r,n,i,o,s){for(var a=0;a>>=1)o++;return 1<>>=13,i[2*a+1]=8191&s,s>>>=13;for(a=2*r;a>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),this},o.prototype.muln=function e(t){return this.clone().imuln(t)},o.prototype.sqr=function e(){return this.mul(this)},o.prototype.isqr=function e(){return this.imul(this.clone())},o.prototype.pow=function e(t){var r=l(t);if(0===r.length)return new o(1);for(var n=this,i=0;i=0);var r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r,s;if(0!==r){var a=0;for(s=0;s>>26-r}a&&(this.words[s]=a,this.length++)}if(0!==i){for(s=this.length-1;s>=0;s--)this.words[s+i]=this.words[s];for(s=0;s=0),o=r?(r-r%26)/26:0;var s=t%26,a=Math.min((t-s)/26,this.length),u=67108863^67108863>>>s<a)for(this.length-=a,f=0;f=0&&(0!==h||f>=o);f--){var l=0|this.words[f];this.words[f]=h<<26-s|l>>>s,h=l&u}return c&&0!==h&&(c.words[c.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function e(t,r,i){return n(0===this.negative),this.iushrn(t,r,i)},o.prototype.shln=function e(t){return this.clone().ishln(t)},o.prototype.ushln=function e(t){return this.clone().iushln(t)},o.prototype.shrn=function e(t){return this.clone().ishrn(t)},o.prototype.ushrn=function e(t){return this.clone().iushrn(t)},o.prototype.testn=function e(t){n("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26,o=1<=0);var r=t%26,i=(t-r)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==r&&i++,this.length=Math.min(i,this.length),0!==r){var o=67108863^67108863>>>r<=67108864;r++)this.words[r]-=67108864,r===this.length-1?this.words[r+1]=1:this.words[r+1]++;return this.length=Math.max(this.length,r+1),this},o.prototype.isubn=function e(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var r=0;r>26)-(c/67108864|0),this.words[s+i]=67108863&a}for(;s>26,this.words[s+i]=67108863&a;if(0===u)return this.strip();for(n(-1===u),u=0,s=0;s>26,this.words[s]=67108863&a;return this.negative=1,this.strip()},o.prototype._wordDiv=function e(t,r){var n=this.length-t.length,i=this.clone(),s=t,a=0|s.words[s.length-1],u=this._countBits(a);n=26-u,0!==n&&(s=s.ushln(n),i.iushln(n),a=0|s.words[s.length-1]);var c=i.length-s.length,f;if("mod"!==r){f=new o(null),f.length=c+1,f.words=new Array(f.length);for(var h=0;h=0;d--){var p=67108864*(0|i.words[s.length+d])+(0|i.words[s.length+d-1]);for(p=Math.min(p/a|0,67108863),i._ishlnsubmul(s,p,d);0!==i.negative;)p--,i.negative=0,i._ishlnsubmul(s,1,d),i.isZero()||(i.negative^=1);f&&(f.words[d]=p)}return f&&f.strip(),i.strip(),"div"!==r&&0!==n&&i.iushrn(n),{div:f||null,mod:i}},o.prototype.divmod=function e(t,r,i){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(u=this.neg().divmod(t,r),"mod"!==r&&(s=u.div.neg()),"div"!==r&&(a=u.mod.neg(),i&&0!==a.negative&&a.iadd(t)),{div:s,mod:a}):0===this.negative&&0!==t.negative?(u=this.divmod(t.neg(),r),"mod"!==r&&(s=u.div.neg()),{div:s,mod:u.mod}):0!=(this.negative&t.negative)?(u=this.neg().divmod(t.neg(),r),"div"!==r&&(a=u.mod.neg(),i&&0!==a.negative&&a.isub(t)),{div:u.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===r?{div:this.divn(t.words[0]),mod:null}:"mod"===r?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,r);var s,a,u},o.prototype.div=function e(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function e(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function e(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function e(t){var r=this.divmod(t);if(r.mod.isZero())return r.div;var n=0!==r.div.negative?r.mod.isub(t):r.mod,i=t.ushrn(1),o=t.andln(1),s=n.cmp(i);return s<0||1===o&&0===s?r.div:0!==r.div.negative?r.div.isubn(1):r.div.iaddn(1)},o.prototype.modn=function e(t){n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return i},o.prototype.idivn=function e(t){n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this.strip()},o.prototype.divn=function e(t){return this.clone().idivn(t)},o.prototype.egcd=function e(t){n(0===t.negative),n(!t.isZero());var r=this,i=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var s=new o(1),a=new o(0),u=new o(0),c=new o(1),f=0;r.isEven()&&i.isEven();)r.iushrn(1),i.iushrn(1),++f;for(var h=i.clone(),l=r.clone();!r.isZero();){for(var d=0,p=1;0==(r.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(r.iushrn(d);d-- >0;)(s.isOdd()||a.isOdd())&&(s.iadd(h),a.isub(l)),s.iushrn(1),a.iushrn(1);for(var g=0,m=1;0==(i.words[0]&m)&&g<26;++g,m<<=1);if(g>0)for(i.iushrn(g);g-- >0;)(u.isOdd()||c.isOdd())&&(u.iadd(h),c.isub(l)),u.iushrn(1),c.iushrn(1);r.cmp(i)>=0?(r.isub(i),s.isub(u),a.isub(c)):(i.isub(r),u.isub(s),c.isub(a))}return{a:u,b:c,gcd:i.iushln(f)}},o.prototype._invmp=function e(t){n(0===t.negative),n(!t.isZero());var r=this,i=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var s=new o(1),a=new o(0),u=i.clone(),c;r.cmpn(1)>0&&i.cmpn(1)>0;){for(var f=0,h=1;0==(r.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,d=1;0==(i.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(i.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);r.cmp(i)>=0?(r.isub(i),s.isub(a)):(i.isub(r),a.isub(s))}return c=0===r.cmpn(1)?s:a,c.cmpn(0)<0&&c.iadd(t),c},o.prototype.gcd=function e(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var r=this.clone(),n=t.clone();r.negative=0,n.negative=0;for(var i=0;r.isEven()&&n.isEven();i++)r.iushrn(1),n.iushrn(1);for(;;){for(;r.isEven();)r.iushrn(1);for(;n.isEven();)n.iushrn(1);var o=r.cmp(n);if(o<0){var s=r;r=n,n=s}else if(0===o||0===n.cmpn(1))break;r.isub(n)}return n.iushln(i)},o.prototype.invm=function e(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function e(){return 0==(1&this.words[0])},o.prototype.isOdd=function e(){return 1==(1&this.words[0])},o.prototype.andln=function e(t){return this.words[0]&t},o.prototype.bincn=function e(t){n("number"==typeof t);var r=t%26,i=(t-r)/26,o=1<>>26,u&=67108863,this.words[a]=u}return 0!==s&&(this.words[a]=s,this.length++),this},o.prototype.isZero=function e(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function e(t){var r=t<0,i;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)i=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var o=0|this.words[0];i=o===t?0:ot.length)return 1;if(this.length=0;n--){var i=0|this.words[n],o=0|t.words[n];if(i!==o){io&&(r=1);break}}return r},o.prototype.gtn=function e(t){return 1===this.cmpn(t)},o.prototype.gt=function e(t){return 1===this.cmp(t)},o.prototype.gten=function e(t){return this.cmpn(t)>=0},o.prototype.gte=function e(t){return this.cmp(t)>=0},o.prototype.ltn=function e(t){return-1===this.cmpn(t)},o.prototype.lt=function e(t){return-1===this.cmp(t)},o.prototype.lten=function e(t){return this.cmpn(t)<=0},o.prototype.lte=function e(t){return this.cmp(t)<=0},o.prototype.eqn=function e(t){return 0===this.cmpn(t)},o.prototype.eq=function e(t){return 0===this.cmp(t)},o.red=function e(t){return new k(t)},o.prototype.toRed=function e(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function e(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function e(t){return this.red=t,this},o.prototype.forceRed=function e(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function e(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function e(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function e(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function e(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function e(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function e(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function e(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function e(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function e(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function e(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function e(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function e(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function e(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function _(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function S(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function x(e){k.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function e(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function e(t){var r=t,n;do{this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),n=r.bitLength()}while(n>this.n);var i=n0?r.isub(this.p):r.strip(),r},v.prototype.split=function e(t,r){t.iushrn(this.n,0,r)},v.prototype.imulK=function e(t){return t.imul(this.k)},i(_,v),_.prototype.split=function e(t,r){for(var n=4194303,i=Math.min(t.length,9),o=0;o>>22,s=a}s>>>=22,t.words[o-10]=s,0===s&&t.length>10?t.length-=10:t.length-=9},_.prototype.imulK=function e(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var r=0,n=0;n>>=26,t.words[n]=o,r=i}return 0!==r&&(t.words[t.length++]=r),t},o._prime=function e(t){if(y[t])return y[t];var e;if("k256"===t)e=new _;else if("p224"===t)e=new w;else if("p192"===t)e=new S;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return y[t]=e,e},k.prototype._verify1=function e(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},k.prototype._verify2=function e(t,r){n(0==(t.negative|r.negative),"red works only with positives"),n(t.red&&t.red===r.red,"red works only with red numbers")},k.prototype.imod=function e(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},k.prototype.neg=function e(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function e(t,r){this._verify2(t,r);var n=t.add(r);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},k.prototype.iadd=function e(t,r){this._verify2(t,r);var n=t.iadd(r);return n.cmp(this.m)>=0&&n.isub(this.m),n},k.prototype.sub=function e(t,r){this._verify2(t,r);var n=t.sub(r);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},k.prototype.isub=function e(t,r){this._verify2(t,r);var n=t.isub(r);return n.cmpn(0)<0&&n.iadd(this.m),n},k.prototype.shl=function e(t,r){return this._verify1(t),this.imod(t.ushln(r))},k.prototype.imul=function e(t,r){return this._verify2(t,r),this.imod(t.imul(r))},k.prototype.mul=function e(t,r){return this._verify2(t,r),this.imod(t.mul(r))},k.prototype.isqr=function e(t){return this.imul(t,t.clone())},k.prototype.sqr=function e(t){return this.mul(t,t)},k.prototype.sqrt=function e(t){if(t.isZero())return t.clone();var r=this.m.andln(3);if(n(r%2==1),3===r){var i=this.m.add(new o(1)).iushrn(2);return this.pow(t,i)}for(var s=this.m.subn(1),a=0;!s.isZero()&&0===s.andln(1);)a++,s.iushrn(1);n(!s.isZero());var u=new o(1).toRed(this),c=u.redNeg(),f=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,f).cmp(c);)h.redIAdd(c);for(var l=this.pow(h,s),d=this.pow(t,s.addn(1).iushrn(1)),p=this.pow(t,s),g=a;0!==p.cmp(u);){for(var m=p,b=0;0!==m.cmp(u);b++)m=m.redSqr();n(b=0;s--){for(var h=r.words[s],l=f-1;l>=0;l--){var d=h>>l&1;a!==i[0]&&(a=this.sqr(a)),0!==d||0!==u?(u<<=1,u|=d,c++,(4===c||0===s&&0===l)&&(a=this.mul(a,i[u]),c=0,u=0)):c=0}f=26}return a},k.prototype.convertTo=function e(t){var r=t.umod(this.m);return r===t?r.clone():r},k.prototype.convertFrom=function e(t){var r=t.clone();return r.red=null,r},o.mont=function e(t){return new x(t)},i(x,k),x.prototype.convertTo=function e(t){return this.imod(t.ushln(this.shift))},x.prototype.convertFrom=function e(t){var r=this.imod(t.mul(this.rinv));return r.red=null,r},x.prototype.imul=function e(t,r){if(t.isZero()||r.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(r),i=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},x.prototype.mul=function e(t,r){if(t.isZero()||r.isZero())return new o(0)._forceRed(this);var n=t.mul(r),i=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=n.isub(i).iushrn(this.shift),a=s;return s.cmp(this.m)>=0?a=s.isub(this.m):s.cmpn(0)<0&&(a=s.iadd(this.m)),a._forceRed(this)},x.prototype.invm=function e(t){var r=this.imod(t._invmp(this.m).mul(this.r2));return r._forceRed(this)}}(e,this)}).call(this,r(70)(e))},function(e,t,r){"use strict";(function(t){const n=r(79),i=r(33),o=r(95),s=r(9),a=/^https?:\/\/[^/]+\/(ip(f|n)s)\/((\w+).*)/,u=/^\/(ip(f|n)s)\/((\w+).*)/,c=1,f=4,h=/^https?:\/\/([^/]+)\.(ip(?:f|n)s)\.[^/]+/,l=1,d=2;function p(e){const r=v(e);try{const e=t.from(n.decode(r));return i.decode(e),!0}catch(e){return!1}}function g(e){try{return o.isEncoded(e)}catch(e){return!1}}function m(e){try{return s.isCID(new s(e))}catch(e){return!1}}function b(e,t,r=c,n=f){const i=v(e);if(!i)return!1;const o=i.match(t);if(!o)return!1;if("ipfs"!==o[r])return!1;let s=o[n];return s&&t===h&&(s=s.toLowerCase()),m(s)}function y(e,t,r=c,n){const i=v(e);if(!i)return!1;const o=i.match(t);if(!o)return!1;if("ipns"!==o[r])return!1;if(n&&t===h){let e=o[n];return e=e.toLowerCase(),m(e)}return!0}function v(e){return t.isBuffer(e)?n.encode(e):"string"==typeof e&&e}const _=e=>b(e,h,2,1),w=e=>y(e,h,2,1);e.exports={multihash:p,cid:m,base32cid:e=>"base32"===g(e)&&m(e),ipfsSubdomain:_,ipnsSubdomain:w,subdomain:e=>_(e)||w(e),subdomainPattern:h,ipfsUrl:e=>b(e,a),ipnsUrl:e=>y(e,a),url:e=>b(e,a)||y(e,a),urlPattern:a,ipfsPath:e=>b(e,u),ipnsPath:e=>y(e,u),path:e=>b(e,u)||y(e,u),pathPattern:u,urlOrPath:e=>b(e,a)||y(e,a)||b(e,u)||y(e,u)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";t.Connection=r(994)},function(e,t){function r(){}e.exports=r},function(e,t,r){t.source=r(199),t.through=r(794),t.sink=r(404),t.duplex=r(405)},function(e,t,r){"use strict";(function(t){var n=r(811),i=r(815),o=function(e){if(!e)return null;var t={};return Object.keys(e).forEach(function(r){t[r]=e[r].value}),t};e.exports=function(e,r){if(r||(r={}),!e)throw new Error("Pass in a .proto string or a protobuf-schema parsed object");var s="object"!=typeof e||t.isBuffer(e)?n.parse(e):e,a=function(){var e=this;i(s,r.encodings||{}).forEach(function(t){e[t.name]=o(t.values)||t})};return a.prototype.toString=function(){return n.stringify(s)},a.prototype.toJSON=function(){return s},new a}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(442),i=r(882),o=r(423);t=e.exports,t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(286),t.pbkdf2=r(894)},function(e,t,r){"use strict";const n=r(925),i=r(926);t.encode=n,t.decode=i.decode,t.decodeFromReader=i.decodeFromReader},function(e,t){function r(e,t){"function"==typeof e&&(t=e,e=!1);var r=[],n,i,o;function s(e,t){e&&(n=e,i&&f(n)),i=t,c()}function a(e){o=o||e||!0,c()}function u(e){o||(i?f(n,e):r.push(e))}return e?{push:u,end:a,source:s,buffer:r}:(s.push=u,s.end=a,s.buffer=r,s);function c(){i&&(n?f(n):!r.length&&o?f(o):r.length&&f(null,r.shift()))}function f(e,r){var n=i;if(e&&t){var o=t;t=null,o(!0===e?null:e)}i=null,n(e,r)}}e.exports=r},function(e,t,r){"use strict";var n=t;n.version=r(1273).version,n.utils=r(1274),n.rand=r(1275),n.curve=r(240),n.curves=r(1281),n.ec=r(1289),n.eddsa=r(1293)},function(e,t){var r=Array.isArray;e.exports=r},function(e,t,r){"use strict";function n(e){return e}var i=r(163);e.exports=function e(t){return t?(t=i(t),function(e){return function(r,n){e(r,function(r,i){try{i=r?null:t(i)}catch(t){return e(t,function(){return n(t)})}n(r,i)})}}):n}},function(e,t,r){"use strict";var n=r(367);e.exports=function e(t){return t=n(t),function(e){return function r(n,i){for(var o,s=!0;s;)s=!1,o=!0,e(n,function(e,n){if(!e&&!t(n))return o?s=!0:r(e,i);i(e,n)}),o=!1}}}},function(e,t,r){(function(n){var i=r(12),o=r(491);function s(e,t){function r(){i(),t()}function n(e){i(),t(e)}function i(){e.removeListener("close",r),e.removeListener("error",n)}e.on("close",r),e.on("error",n)}function s(e){e.destroy?e.destroy():console.error("warning, stream-to-pull-stream: \nthe wrapped node-stream does not implement `destroy`, \nthis may cause resource leaks.")}function a(e,t,r){var i,a=!1,u;function c(){u||(u=!0,r&&r(!0===i?null:i))}function f(){a||(a=!0,l(),i?c():e(i=!0,c))}function h(t){l(),i||e(i=t,c)}function l(){t.on("finish",f),t.removeListener("close",f),t.removeListener("error",h)}t.on("close",f),t.on("finish",f),t.on("error",h),n.nextTick(function(){o(function(r){e(null,function(e,n){if(i=i||e,!0===e)return t._isStdio?c():t.end();if(i=i||e)return s(t),c(i);if(t._isStdio)t.write(n,function(){r()});else{var o=t.write(n);!1===o?t.once("drain",r):r()}})})})}function u(e,t,r){function n(i){t.forEach(function(t){e.removeListener(t,n)}),r(i)}return t.forEach(function(t){e.on(t,n)}),e}function c(e){var t=!1,r=!1,n;function i(){var t=e.read();if(null!==t&&n){var r=n;n=null,r(null,t)}}return e.on("readable",function(){r=!0,n&&i()}).on("end",function(){t=!0,n&&n(t)}).on("error",function(e){t=e,n&&n(t)}),function(e,o){n=o,t?o(t):r&&i()}}function f(e){var t=[],r=[],n,i=!1,o;function a(){for(;(t.length||n)&&r.length;)r.shift()(t.length?null:n,t.shift());!t.length&&i&&(i=!1,e.resume())}return e.on("data",function(r){t.push(r),a(),t.length&&e.pause&&(i=!0,e.pause())}),e.on("end",function(){n=!0,a()}),e.on("close",function(){n=!0,a()}),e.on("error",function(e){n=e,a()}),function(t,i){if(!i)throw new Error("*must* provide cb");if(t){function o(){for(;r.length;)r.shift()(t);i(t)}if(n)return o();e.once("close",o),s(e)}else r.push(i),a()}}var h=f,l=function(e,t){return function(r){return a(r,e,t)}},d=function(e){return f(e)};t=e.exports=function(e,t){return e.writable&&e.write?e.readable?function(r){return a(r,e,t),f(e)}:l(e,t):d(e)},t.sink=l,t.source=d,t.read=h,t.read1=f,t.read2=c,t.duplex=function(e,t){return{source:d(e),sink:l(e,t)}},t.transform=function(e){return function(t){var r=d(e);return l(e)(t),r}}}).call(this,r(2))},function(e,t,r){"use strict";(function(t){var n=r(26),i=r(27),o=function e(t){if(!(this instanceof e))return new e(t);t?this.set(t):this.bufs=[]};o.prototype.set=function(e){return this.bufs=e.bufs||this.bufs||[],this},o.prototype.toBuffer=function(){return this.concat()},o.prototype.concat=function(){return t.concat(this.bufs)},o.prototype.write=function(e){return i(n.isBuffer(e)),this.bufs.push(e),this},o.prototype.writeReverse=function(e){return i(n.isBuffer(e)),this.bufs.push(n.reverse(e)),this},o.prototype.writeUInt8=function(e){var r=new t(1);return r.writeUInt8(e,0),this.write(r),this},o.prototype.writeUInt16BE=function(e){var r=new t(2);return r.writeUInt16BE(e,0),this.write(r),this},o.prototype.writeUInt16LE=function(e){var r=new t(2);return r.writeUInt16LE(e,0),this.write(r),this},o.prototype.writeUInt32BE=function(e){var r=new t(4);return r.writeUInt32BE(e,0),this.write(r),this},o.prototype.writeInt32LE=function(e){var r=new t(4);return r.writeInt32LE(e,0),this.write(r),this},o.prototype.writeUInt32LE=function(e){var r=new t(4);return r.writeUInt32LE(e,0),this.write(r),this},o.prototype.writeUInt64BEBN=function(e){var t=e.toBuffer({size:8});return this.write(t),this},o.prototype.writeUInt64LEBN=function(e){var t=e.toBuffer({size:8});return this.writeReverse(t),this},o.prototype.writeVarintNum=function(e){var t=o.varintBufNum(e);return this.write(t),this},o.prototype.writeVarintBN=function(e){var t=o.varintBufBN(e);return this.write(t),this},o.varintBufNum=function(e){var r=void 0;return e<253?(r=new t(1),r.writeUInt8(e,0)):e<65536?(r=new t(3),r.writeUInt8(253,0),r.writeUInt16LE(e,1)):e<4294967296?(r=new t(5),r.writeUInt8(254,0),r.writeUInt32LE(e,1)):(r=new t(9),r.writeUInt8(255,0),r.writeInt32LE(-1&e,1),r.writeUInt32LE(Math.floor(e/4294967296),5)),r},o.varintBufBN=function(e){var r=void 0,n=e.toNumber();if(n<253)r=new t(1),r.writeUInt8(n,0);else if(n<65536)r=new t(3),r.writeUInt8(253,0),r.writeUInt16LE(n,1);else if(n<4294967296)r=new t(5),r.writeUInt8(254,0),r.writeUInt32LE(n,1);else{var i=new o;i.writeUInt8(255),i.writeUInt64LEBN(e);var r=i.concat()}return r},e.exports=o}).call(this,r(0).Buffer)},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t){var r=1e3,n=60*r,i=60*n,o=24*i,s=7*o,a=365.25*o;function u(e){if(e=String(e),!(e.length>100)){var t=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var u=parseFloat(t[1]),c=(t[2]||"ms").toLowerCase();switch(c){case"years":case"year":case"yrs":case"yr":case"y":return u*a;case"weeks":case"week":case"w":return u*s;case"days":case"day":case"d":return u*o;case"hours":case"hour":case"hrs":case"hr":case"h":return u*i;case"minutes":case"minute":case"mins":case"min":case"m":return u*n;case"seconds":case"second":case"secs":case"sec":case"s":return u*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}}}function c(e){var t=Math.abs(e);return t>=o?Math.round(e/o)+"d":t>=i?Math.round(e/i)+"h":t>=n?Math.round(e/n)+"m":t>=r?Math.round(e/r)+"s":e+"ms"}function f(e){var t=Math.abs(e);return t>=o?h(e,t,o,"day"):t>=i?h(e,t,i,"hour"):t>=n?h(e,t,n,"minute"):t>=r?h(e,t,r,"second"):e+" ms"}function h(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}e.exports=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return u(e);if("number"===r&&!1===isNaN(e))return t.long?f(e):c(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,r){"use strict";e.exports=function e(t){return function(e,r){r(t)}}},function(e,t,r){(function(e){function r(e,t){for(var r=0,n=e.length-1;n>=0;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}var n=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(e){return n.exec(e).slice(1)};function o(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n=-1&&!n;i--){var s=i>=0?arguments[i]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,n="/"===s.charAt(0))}return t=r(o(t.split("/"),function(e){return!!e}),!n).join("/"),(n?"/":"")+t||"."},t.normalize=function(e){var n=t.isAbsolute(e),i="/"===s(e,-1);return e=r(o(e.split("/"),function(e){return!!e}),!n).join("/"),e||n||(e="."),e&&i&&(e+="/"),(n?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(o(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,r){function n(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=t.resolve(e).substr(1),r=t.resolve(r).substr(1);for(var i=n(e.split("/")),o=n(r.split("/")),s=Math.min(i.length,o.length),a=s,u=0;u73)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-3)return!1;var t=e[3];if(5+t>=e.length)return!1;var r=e[5+t];if(t+r+7!==e.length)return!1;var n=e.slice(4);if(2!==e[2])return!1;if(0===t)return!1;if(128&n[0])return!1;if(t>1&&0===n[0]&&!(128&n[1]))return!1;var i=e.slice(6+t);return 2===e[6+t-2]&&(0!==r&&(!(128&i[0])&&!(r>1&&0===i[0]&&!(128&i[1]))))},u.prototype.hasLowS=function(){return!this.s.lt(new n(1))&&!this.s.gt(new n("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex"))},u.prototype.hasDefinedHashtype=function(){if(!a.isNaturalNumber(this.nhashtype))return!1;var e=this.nhashtype&~u.SIGHASH_ANYONECANPAY;return!(eu.SIGHASH_SINGLE)},u.prototype.toTxFormat=function(){var e=this.toDER(),r=new t(1);return r.writeUInt8(this.nhashtype,0),t.concat([e,r])},u.SIGHASH_ALL=1,u.SIGHASH_NONE=2,u.SIGHASH_SINGLE=3,u.SIGHASH_ANYONECANPAY=128,e.exports=u}).call(this,r(0).Buffer)},function(e,t,r){e.exports=r(576),e.exports.Interpreter=r(1396)},function(e,t,r){var n=r(361),i="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";e.exports=n(i)},function(e,t,r){"use strict";function n(e){return e}var i=r(163);e.exports=function e(t){if(!t)return n;t=i(t);var r=!1,o,s;return function(e){return function n(i,a){if(s)return a(s);i?(s=i,e(i,r?function(e){r?o=a:a(i)}:function(e){a(i)})):e(null,function(e,i){e?a(e):s?a(s):(r=!0,t(i,function(e,t){r=!1,s?(a(s),o&&o(s)):e?n(e,a):a(null,t)}))})}}}},function(e,t,r){"use strict";const n=r(21),i=T("dns4"),o=T("dns6"),s=I(T("dnsaddr"),i,o),a=I(T("ip4"),T("ip6")),u=I(A(a,T("tcp")),A(s,T("tcp"))),c=A(a,T("udp")),f=A(c,T("utp")),h=I(A(s,T("tcp")),s),l=I(A(u,T("ws")),A(h,T("ws"))),d=I(A(u,T("wss")),A(h,T("wss"))),p=I(A(u,T("http")),A(a,T("http")),A(h,T("http")),A(h)),g=I(A(u,T("https")),A(a,T("https")),A(h,T("https"))),m=I(A(l,T("p2p-webrtc-star"),T("ipfs")),A(d,T("p2p-webrtc-star"),T("ipfs"))),b=I(A(l,T("p2p-websocket-star"),T("ipfs")),A(d,T("p2p-websocket-star"),T("ipfs")),A(l,T("p2p-websocket-star")),A(d,T("p2p-websocket-star"))),y=I(A(p,T("p2p-webrtc-direct")),A(g,T("p2p-webrtc-direct"))),v=I(l,d,p,g,m,y,u,f),_=I(A(v,T("p2p-stardust"),T("ipfs")),A(v,T("p2p-stardust")));let w=I(A(v,T("ipfs")),m,T("ipfs"));const S=I(A(w,T("p2p-circuit"),w),A(w,T("p2p-circuit")),A(T("p2p-circuit"),w),A(v,T("p2p-circuit")),A(T("p2p-circuit"),v),T("p2p-circuit")),E=()=>I(A(S,E),S),k=E(),x=I(A(k,w,k),A(w,k),A(k,w),k,w);function C(e){return function t(r){if("string"==typeof r)try{r=n(r)}catch(e){return!1}let i=e(r.protoNames());return null!==i&&0===i.length}}function A(){const e=Array.from(arguments);function t(t){return t.length{if(t="function"==typeof e?e().partialMatch(t):e.partialMatch(t),null===t)return!0}),t)}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:C(t),partialMatch:t}}function I(){const e=Array.from(arguments);function t(t){let r=null;return e.some(e=>{const n="function"==typeof e?e().partialMatch(t):e.partialMatch(t);if(n)return r=n,!0}),r}const r={toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:C(t),partialMatch:t};return r}function T(e){const t=e;function r(e){if("string"==typeof e)try{e=n(e)}catch(e){return!1}const r=e.protoNames();return 1===r.length&&r[0]===t}function i(e){return 0===e.length?null:e[0]===t?e.slice(1):null}return{toString:function(){return t},matches:r,partialMatch:i}}t.DNS=h,t.DNS4=i,t.DNS6=o,t.IP=a,t.TCP=u,t.UDP=c,t.UTP=f,t.HTTP=p,t.HTTPS=g,t.WebSockets=l,t.WebSocketsSecure=d,t.WebSocketStar=b,t.WebRTCStar=m,t.WebRTCDirect=y,t.Reliable=v,t.Stardust=_,t.Circuit=k,t.IPFS=x},function(e,t,r){"use strict";var n=r(98),i=r(1);function o(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function s(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for(e=e.replace(/[^a-z0-9]+/gi,""),e.length%2!=0&&(e="0"+e),i=0;i>6|192,r[n++]=63&s|128):o(e,i)?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++i)),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=63&s|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=63&s|128)}else for(i=0;i>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24;return t>>>0}function c(e,t){for(var r="",n=0;n>>0}return s}function d(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r}function p(e,t){return e>>>t|e<<32-t}function g(e,t){return e<>>32-t}function m(e,t){return e+t>>>0}function b(e,t,r){return e+t+r>>>0}function y(e,t,r,n){return e+t+r+n>>>0}function v(e,t,r,n,i){return e+t+r+n+i>>>0}function _(e,t,r,n){var i=e[t],o=e[t+1],s=n+o>>>0,a=(s>>0,e[t+1]=s}function w(e,t,r,n){var i=t+n>>>0,o=(i>>0}function S(e,t,r,n){var i=t+n;return i>>>0}function E(e,t,r,n,i,o,s,a){var u=0,c=t;c=c+n>>>0,u+=c>>0,u+=c>>0,u+=c>>0}function k(e,t,r,n,i,o,s,a){var u=t+n+o+a;return u>>>0}function x(e,t,r,n,i,o,s,a,u,c){var f=0,h=t;h=h+n>>>0,f+=h>>0,f+=h>>0,f+=h>>0,f+=h>>0}function C(e,t,r,n,i,o,s,a,u,c){var f=t+n+o+a+c;return f>>>0}function A(e,t,r){var n=t<<32-r|e>>>r;return n>>>0}function I(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}function T(e,t,r){return e>>>r}function O(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}t.inherits=i,t.toArray=s,t.toHex=a,t.htonl=u,t.toHex32=c,t.zero2=f,t.zero8=h,t.join32=l,t.split32=d,t.rotr32=p,t.rotl32=g,t.sum32=m,t.sum32_3=b,t.sum32_4=y,t.sum32_5=v,t.sum64=_,t.sum64_hi=w,t.sum64_lo=S,t.sum64_4_hi=E,t.sum64_4_lo=k,t.sum64_5_hi=x,t.sum64_5_lo=C,t.rotr64_hi=A,t.rotr64_lo=I,t.shr64_hi=T,t.shr64_lo=O},function(e,t,r){const n=r(43),i=Math.pow(2,31)-1;function o(e){return n.UInt32(e)&&e<=i}function s(e){return n.String(e)&&e.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}s.toJSON=function(){return"BIP32 derivation path"};const a=21e14;function u(e){return n.UInt53(e)&&e<=a}const c=n.quacksLike("Point"),f=n.compile({messagePrefix:n.oneOf(n.Buffer,n.String),bip32:{public:n.UInt32,private:n.UInt32},pubKeyHash:n.UInt8,scriptHash:n.UInt8,wif:n.UInt8}),h={BIP32Path:s,Buffer256bit:n.BufferN(32),ECPoint:c,Hash160bit:n.BufferN(20),Hash256bit:n.BufferN(32),Network:f,Satoshi:u,UInt31:o};for(var l in n)h[l]=n[l];e.exports=h},function(e,t,r){"use strict";var n=t;n.version=r(1378).version,n.utils=r(1379),n.rand=r(1380),n.hmacDRBG=r(1381),n.curve=r(244),n.curves=r(1391),n.ec=r(1393)},function(e,t,r){"use strict";(function(t){var n=r(45),i=r(143),o=r(50),s=r(36),a=r(116),u=r(15),c=r(22);function f(e,t){if(!(this instanceof f))return new f(e,t);if(c.checkArgument(e,"First argument is required, please include public key data."),e instanceof f)return e;t=t||{};var r=this._classifyArgs(e,t);return r.point.validate(),s.defineImmutable(this,{point:r.point,compressed:r.compressed,network:r.network||a.defaultNetwork}),this}f.prototype._classifyArgs=function(e,r){var n={compressed:u.isUndefined(r.compressed)||r.compressed};if(e instanceof i)n.point=e;else if(e.x&&e.y)n=f._transformObject(e);else if("string"==typeof e)n=f._transformDER(new t(e,"hex"));else if(f._isBuffer(e))n=f._transformDER(e);else{if(!f._isPrivateKey(e))throw new TypeError("First argument is an unrecognized data format.");n=f._transformPrivateKey(e)}return n.network||(n.network=u.isUndefined(r.network)?void 0:a.get(r.network)),n},f._isPrivateKey=function(e){var t=r(245);return e instanceof t},f._isBuffer=function(e){return e instanceof t||e instanceof Uint8Array},f._transformPrivateKey=function(e){c.checkArgument(f._isPrivateKey(e),"Must be an instance of PrivateKey");var t={};return t.point=i.getG().mul(e.bn),t.compressed=e.compressed,t.network=e.network,t},f._transformDER=function(e,t){c.checkArgument(f._isBuffer(e),"Must be a hex buffer of DER encoded public key");var r={},o,s,a,h;if(t=!!u.isUndefined(t)||t,4!==e[0]&&(t||6!==e[0]&&7!==e[0]))if(3===e[0])a=e.slice(1),o=new n(a),r=f._transformX(!0,o),r.compressed=!0;else{if(2!==e[0])throw new TypeError("Invalid DER format public key");a=e.slice(1),o=new n(a),r=f._transformX(!1,o),r.compressed=!0}else{if(a=e.slice(1,33),h=e.slice(33,65),32!==a.length||32!==h.length||65!==e.length)throw new TypeError("Length of x and y must be 32 bytes");o=new n(a),s=new n(h),r.point=new i(o,s),r.compressed=!1}return r},f._transformX=function(e,t){c.checkArgument("boolean"==typeof e,"Must specify whether y is odd or not (true or false)");var r={};return r.point=i.fromX(e,t),r},f._transformObject=function(e){var t=new n(e.x,"hex"),r=new n(e.y,"hex"),o=new i(t,r);return new f(o,{compressed:e.compressed})},f.fromPrivateKey=function(e){c.checkArgument(f._isPrivateKey(e),"Must be an instance of PrivateKey");var t=f._transformPrivateKey(e);return new f(t.point,{compressed:t.compressed,network:t.network})},f.fromDER=f.fromBuffer=function(e,t){c.checkArgument(f._isBuffer(e),"Must be a hex buffer of DER encoded public key");var r=f._transformDER(e,t);return new f(r.point,{compressed:r.compressed})},f.fromPoint=function(e,t){return c.checkArgument(e instanceof i,"First argument must be an instance of Point."),new f(e,{compressed:t})},f.fromString=function(e,r){var n=new t(e,r||"hex"),i=f._transformDER(n);return new f(i.point,{compressed:i.compressed})},f.fromX=function(e,t){var r=f._transformX(e,t);return new f(r.point,{compressed:r.compressed})},f.getValidationError=function(e){var t;try{new f(e)}catch(e){t=e}return t},f.isValid=function(e){return!f.getValidationError(e)},f.prototype.toObject=f.prototype.toJSON=function e(){return{x:this.point.getX().toString("hex",2),y:this.point.getY().toString("hex",2),compressed:this.compressed}},f.prototype.toBuffer=f.prototype.toDER=function(){var e=this.point.getX(),r=this.point.getY(),n=e.toBuffer({size:32}),i=r.toBuffer({size:32}),o;if(this.compressed){var s=i[i.length-1]%2;return o=new t(s?[3]:[2]),t.concat([o,n])}return o=new t([4]),t.concat([o,n,i])},f.prototype._getID=function e(){return o.sha256ripemd160(this.toBuffer())},f.prototype.toAddress=function(e){var t=r(117);return t.fromPublicKey(this,e||this.network)},f.prototype.toString=function(){return this.toDER().toString("hex")},f.prototype.inspect=function(){return""},e.exports=f}).call(this,r(0).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(159),i=a(n),o=r(360),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,i.default)(s.default),e.exports=t.default},function(e,t,r){var n=r(354),i="object"==typeof self&&self&&self.Object===Object&&self,o=n||i||Function("return this")();e.exports=o},function(e,t,r){"use strict";(function(n){Object.defineProperty(t,"__esModule",{value:!0});var i=r(194),o;o=i.hasNextTick?n.nextTick:i.hasSetImmediate?setImmediate:i.fallback,t.default=(0,i.wrap)(o),e.exports=t.default}).call(this,r(2))},function(e,t,r){(function(t){var n=r(97);e.exports=o,e.exports.source=function(e){return o(null,e)},e.exports.sink=function(e){return o(e,null)};var i="undefined"==typeof setImmediate?t.nextTick:setImmediate;function o(e,t){e&&"object"==typeof e&&(t=e.source,e=e.sink);var r=[],o=[],s,a,u=new n,c;u.writable=u.readable=!0,u.write=function(e){return r.length?r.shift()(null,e):o.push(e),r.length||(a=!0),!!r.length},u.end=function(){t?o.length?m():t(s=!0,r.length?r.shift():function(){}):r.length&&r.shift()(!0)},u.source=function(e,t){o.length?(t(null,o.shift()),o.length||u.emit("drain")):((s=s||e)?t(s):r.push(t),a&&(a=!1,u.emit("drain")))},e&&(c=e(u.source)),c&&!t&&(t=c);var f=[],h=[],l=!1,d=!1,p=!1;if(u.sink=function(e){t=e,i(m)},t){u.sink(t);var g=u.pipe.bind(u);u.pipe=function(e,t){var r=g(e,t);return u.paused&&u.resume(),r}}function m(){if(d=!1,t&&!p){for(;f.length&&!u.paused;)u.emit("data",f.shift());if(!u.paused){if(l)return u.emit("end");p=!0,t(null,function e(r,n){p=!1,u.paused?(!0===r?l=r:r?u.emit("error",r):f.push(n),d=!0):r&&!0!==(s=r)?u.emit("error",r):(s=s||r)?u.emit("end"):(u.emit("data",n),p=!0,t(null,e))})}}}return u.pause=function(){return u.paused=!0,u},u.resume=function(){return u.paused=!1,m(),u},u.destroy=function(){!s&&t&&t(s=!0,function(){}),s=!0,r.length&&r.shift()(!0),u.emit("close")},u}}).call(this,r(2))},function(e,t,r){(function(e){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function i(e,t,r){if(null!==e&&"object"==typeof e&&Array.isArray(e.words))return e;this.sign=!1,this.words=null,this.length=0,this.red=null,"le"!==t&&"be"!==t||(r=t,t=10),null!==e&&this._init(e||0,t||10,r||"be")}function o(e,t,r){for(var n=0,i=Math.min(e.length,r),o=t;o=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return n}function s(e,t,r,n){for(var i=0,o=Math.min(e.length,r),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26,i.prototype._init=function e(t,n,i){if("number"==typeof t)return t<0&&(this.sign=!0,t=-t),void(t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3));if("object"==typeof t)return this._initArray(t,n,i);"hex"===n&&(n=16),r(n===(0|n)&&n>=2&&n<=36),t=t.toString().replace(/\s+/g,"");var o=0;"-"===t[0]&&o++,16===n?this._parseHex(t,o):this._parseBase(t,n,o),"-"===t[0]&&(this.sign=!0),this.strip()},i.prototype._initArray=function e(t,n,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var o=0;o=0;o-=3){var u=t[o]|t[o-1]<<8|t[o-2]<<16;this.words[a]|=u<>>26-s&67108863,s+=24,s>=26&&(s-=26,a++)}else if("le"===i)for(var o=0,a=0;o>>26-s&67108863,s+=24,s>=26&&(s-=26,a++)}return this.strip()},i.prototype._parseHex=function e(t,r){this.length=Math.ceil((t.length-r)/6),this.words=new Array(this.length);for(var n=0;n=r;n-=6){var a=o(t,n,n+6);this.words[s]|=a<>>26-i&4194303,i+=24,i>=26&&(i-=26,s++)}if(n+6!==r){var a=o(t,r,n+6);this.words[s]|=a<>>26-i&4194303}this.strip()},i.prototype._parseBase=function e(t,r,n){this.words=[0],this.length=1;for(var i=0,o=1;o<=67108863;o*=r)i++;i--,o=o/r|0;for(var a=t.length-n,u=a%i,c=Math.min(a,a-u)+n,f=0,h=n;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function e(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},i.prototype.inspect=function e(){return(this.red?""};var a=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],u=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function e(t,n){if(t=t||10,16===t||"hex"===t){for(var i="",o=0,n=0|n||1,s=0,f=0;f>>24-o&16777215,i=0!==s||f!==this.length-1?a[6-l.length]+l+i:l+i,o+=2,o>=26&&(o-=26,f--)}for(0!==s&&(i=s.toString(16)+i);i.length%n!=0;)i="0"+i;return this.sign&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var d=u[t],p=c[t],i="",g=this.clone();for(g.sign=!1;0!==g.cmpn(0);){var m=g.modn(p).toString(t);g=g.idivn(p),i=0!==g.cmpn(0)?a[d-m.length]+m+i:m+i}return 0===this.cmpn(0)&&(i="0"+i),this.sign&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},i.prototype.toJSON=function e(){return this.toString(16)},i.prototype.toArray=function e(){this.strip();var t=new Array(this.byteLength());t[0]=0;for(var r=this.clone(),n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),t[t.length-n-1]=i}return t},Math.clz32?i.prototype._countBits=function e(t){return 32-Math.clz32(t)}:i.prototype._countBits=function e(t){var r=t,n=0;return r>=4096&&(n+=13,r>>>=13),r>=64&&(n+=7,r>>>=7),r>=8&&(n+=4,r>>>=4),r>=2&&(n+=2,r>>>=2),n+r},i.prototype._zeroBits=function e(t){if(0===t)return 26;var r=t,n=0;return 0==(8191&r)&&(n+=13,r>>>=13),0==(127&r)&&(n+=7,r>>>=7),0==(15&r)&&(n+=4,r>>>=4),0==(3&r)&&(n+=2,r>>>=2),0==(1&r)&&n++,n},i.prototype.bitLength=function e(){var t=0,r=this.words[this.length-1],t=this._countBits(r);return 26*(this.length-1)+t},i.prototype.zeroBits=function e(){if(0===this.cmpn(0))return 0;for(var t=0,r=0;rt.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.iand=function e(t){var r;this.sign=this.sign&&t.sign,r=this.length>t.length?t:this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.ixor=function e(t){var r,n;this.sign=this.sign||t.sign,this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.setn=function e(t,n){r("number"==typeof t&&t>=0);for(var i=t/26|0,o=t%26;this.length<=i;)this.words[this.length++]=0;return this.words[i]=n?this.words[i]|1<t.length?(n=this,i=t):(n=t,i=this);for(var o=0,s=0;s>>26}for(;0!==o&&s>>26}if(this.length=n.length,0!==o)this.words[this.length]=o,this.length++;else if(n!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function e(t){if(t.sign){t.sign=!1;var r=this.iadd(t);return t.sign=!0,r._normSign()}if(this.sign)return this.sign=!1,this.iadd(t),this.sign=!0,this._normSign();var n=this.cmp(t),i,o;if(0===n)return this.sign=!1,this.length=1,this.words[0]=0,this;n>0?(i=this,o=t):(i=t,o=this);for(var s=0,a=0;a>26,this.words[a]=67108863&r}for(;0!==s&&a>26,this.words[a]=67108863&r}if(0===s&&a>>26,s=67108863&n,a=Math.min(i,t.length-1),u=Math.max(0,i-this.length+1);u<=a;u++){var c=i-u,f=0|this.words[c],h=0|t.words[u],l=f*h,d=67108863&l;o=o+(l/67108864|0)|0,d=d+s|0,s=67108863&d,o=o+(d>>>26)|0}r.words[i]=s,n=o}return 0!==n?r.words[i]=n:r.length--,r.strip()},i.prototype._bigMulTo=function e(t,r){r.sign=t.sign!==this.sign,r.length=this.length+t.length;for(var n=0,i=0,o=0;o>>26)|0,i+=s>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()},i.prototype.mulTo=function e(t,r){var n;return n=this.length+t.length<63?this._smallMulTo(t,r):this._bigMulTo(t,r),n},i.prototype.mul=function e(t){var r=new i(null);return r.words=new Array(this.length+t.length),this.mulTo(t,r)},i.prototype.imul=function e(t){if(0===this.cmpn(0)||0===t.cmpn(0))return this.words[0]=0,this.length=1,this;var r=this.length,n=t.length;this.sign=t.sign!==this.sign,this.length=this.length+t.length,this.words[this.length-1]=0;for(var i=this.length-2;i>=0;i--){for(var o=0,s=0,a=Math.min(i,n-1),u=Math.max(0,i-r+1);u<=a;u++){var c=i-u,f=this.words[c],h=t.words[u],l=f*h,d=67108863&l;o+=l/67108864|0,d+=s,s=67108863&d,o+=d>>>26}this.words[i]=s,this.words[i+1]+=o,o=0}for(var o=0,c=1;c>>26}return this.strip()},i.prototype.imuln=function e(t){r("number"==typeof t);for(var n=0,i=0;i>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),this},i.prototype.sqr=function e(){return this.mul(this)},i.prototype.isqr=function e(){return this.mul(this)},i.prototype.ishln=function e(t){r("number"==typeof t&&t>=0);var n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){for(var s=0,a=0;a>>26-n}s&&(this.words[a]=s,this.length++)}if(0!==i){for(var a=this.length-1;a>=0;a--)this.words[a+i]=this.words[a];for(var a=0;a=0),o=n?(n-n%26)/26:0;var s=t%26,a=Math.min((t-s)/26,this.length),u=67108863^67108863>>>s<a){this.length-=a;for(var f=0;f=0&&(0!==h||f>=o);f--){var l=this.words[f];this.words[f]=h<<26-s|l>>>s,h=l&u}return c&&0!==h&&(c.words[c.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},i.prototype.shln=function e(t){return this.clone().ishln(t)},i.prototype.shrn=function e(t){return this.clone().ishrn(t)},i.prototype.testn=function e(t){r("number"==typeof t&&t>=0);var n=t%26,i=(t-n)/26,o=1<=0);var n=t%26,i=(t-n)/26;if(r(!this.sign,"imaskn works only with positive numbers"),0!==n&&i++,this.length=Math.min(i,this.length),0!==n){var o=67108863^67108863>>>n<=67108864;r++)this.words[r]-=67108864,r===this.length-1?this.words[r+1]=1:this.words[r+1]++;return this.length=Math.max(this.length,r+1),this},i.prototype.isubn=function e(t){if(r("number"==typeof t),t<0)return this.iaddn(-t);if(this.sign)return this.sign=!1,this.iaddn(t),this.sign=!0,this;this.words[0]-=t;for(var n=0;n>26)-(f/67108864|0),this.words[s+i]=67108863&c}for(;s>26,this.words[s+i]=67108863&c}if(0===u)return this.strip();r(-1===u),u=0;for(var s=0;s>26,this.words[s]=67108863&c}return this.sign=!0,this.strip()},i.prototype._wordDiv=function e(t,r){var n=this.length-t.length,o=this.clone(),s=t,a=s.words[s.length-1],u=this._countBits(a);n=26-u,0!==n&&(s=s.shln(n),o.ishln(n),a=s.words[s.length-1]);var c=o.length-s.length,f;if("mod"!==r){f=new i(null),f.length=c+1,f.words=new Array(f.length);for(var h=0;h=0;d--){var p=67108864*o.words[s.length+d]+o.words[s.length+d-1];for(p=Math.min(p/a|0,67108863),o._ishlnsubmul(s,p,d);o.sign;)p--,o.sign=!1,o._ishlnsubmul(s,1,d),0!==o.cmpn(0)&&(o.sign=!o.sign);f&&(f.words[d]=p)}return f&&f.strip(),o.strip(),"div"!==r&&0!==n&&o.ishrn(n),{div:f||null,mod:o}},i.prototype.divmod=function e(t,n){if(r(0!==t.cmpn(0)),this.sign&&!t.sign){var o=this.neg().divmod(t,n),s,a;return"mod"!==n&&(s=o.div.neg()),"div"!==n&&(a=0===o.mod.cmpn(0)?o.mod:t.sub(o.mod)),{div:s,mod:a}}if(!this.sign&&t.sign){var o=this.divmod(t.neg(),n),s;return"mod"!==n&&(s=o.div.neg()),{div:s,mod:o.mod}}return this.sign&&t.sign?this.neg().divmod(t.neg(),n):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===n?{div:this.divn(t.words[0]),mod:null}:"mod"===n?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,n)},i.prototype.div=function e(t){return this.divmod(t,"div").div},i.prototype.mod=function e(t){return this.divmod(t,"mod").mod},i.prototype.divRound=function e(t){var r=this.divmod(t);if(0===r.mod.cmpn(0))return r.div;var n=r.div.sign?r.mod.isub(t):r.mod,i=t.shrn(1),o=t.andln(1),s=n.cmp(i);return s<0||1===o&&0===s?r.div:r.div.sign?r.div.isubn(1):r.div.iaddn(1)},i.prototype.modn=function e(t){r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+this.words[o])%t;return i},i.prototype.idivn=function e(t){r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=this.words[i]+67108864*n;this.words[i]=o/t|0,n=o%t}return this.strip()},i.prototype.divn=function e(t){return this.clone().idivn(t)},i.prototype.egcd=function e(t){r(!t.sign),r(0!==t.cmpn(0));var n=this,o=t.clone();n=n.sign?n.mod(t):n.clone();for(var s=new i(1),a=new i(0),u=new i(0),c=new i(1),f=0;n.isEven()&&o.isEven();)n.ishrn(1),o.ishrn(1),++f;for(var h=o.clone(),l=n.clone();0!==n.cmpn(0);){for(;n.isEven();)n.ishrn(1),s.isEven()&&a.isEven()?(s.ishrn(1),a.ishrn(1)):(s.iadd(h).ishrn(1),a.isub(l).ishrn(1));for(;o.isEven();)o.ishrn(1),u.isEven()&&c.isEven()?(u.ishrn(1),c.ishrn(1)):(u.iadd(h).ishrn(1),c.isub(l).ishrn(1));n.cmp(o)>=0?(n.isub(o),s.isub(u),a.isub(c)):(o.isub(n),u.isub(s),c.isub(a))}return{a:u,b:c,gcd:o.ishln(f)}},i.prototype._invmp=function e(t){r(!t.sign),r(0!==t.cmpn(0));var n=this,o=t.clone();n=n.sign?n.mod(t):n.clone();for(var s=new i(1),a=new i(0),u=o.clone();n.cmpn(1)>0&&o.cmpn(1)>0;){for(;n.isEven();)n.ishrn(1),s.isEven()?s.ishrn(1):s.iadd(u).ishrn(1);for(;o.isEven();)o.ishrn(1),a.isEven()?a.ishrn(1):a.iadd(u).ishrn(1);n.cmp(o)>=0?(n.isub(o),s.isub(a)):(o.isub(n),a.isub(s))}return 0===n.cmpn(1)?s:a},i.prototype.gcd=function e(t){if(0===this.cmpn(0))return t.clone();if(0===t.cmpn(0))return this.clone();var r=this.clone(),n=t.clone();r.sign=!1,n.sign=!1;for(var i=0;r.isEven()&&n.isEven();i++)r.ishrn(1),n.ishrn(1);for(;;){for(;r.isEven();)r.ishrn(1);for(;n.isEven();)n.ishrn(1);var o=r.cmp(n);if(o<0){var s=r;r=n,n=s}else if(0===o||0===n.cmpn(1))break;r.isub(n)}return n.ishln(i)},i.prototype.invm=function e(t){return this.egcd(t).a.mod(t)},i.prototype.isEven=function e(){return 0==(1&this.words[0])},i.prototype.isOdd=function e(){return 1==(1&this.words[0])},i.prototype.andln=function e(t){return this.words[0]&t},i.prototype.bincn=function e(t){r("number"==typeof t);var n=t%26,i=(t-n)/26,o=1<>>26,u&=67108863,this.words[s]=u}return 0!==a&&(this.words[s]=a,this.length++),this},i.prototype.cmpn=function e(t){var r=t<0,n;if(r&&(t=-t),this.sign&&!r)return-1;if(!this.sign&&r)return 1;if(t&=67108863,this.strip(),this.length>1)n=1;else{var i=this.words[0];n=i===t?0:it.length)return 1;if(this.length=0;n--){var i=this.words[n],o=t.words[n];if(i!==o){io&&(r=1);break}}return r},i.red=function e(t){return new m(t)},i.prototype.toRed=function e(t){return r(!this.red,"Already a number in reduction context"),r(!this.sign,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function e(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function e(t){return this.red=t,this},i.prototype.forceRed=function e(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function e(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function e(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function e(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function e(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function e(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function e(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function e(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function e(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function e(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function e(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function e(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function e(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function e(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var f={k256:null,p224:null,p192:null,p25519:null};function h(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function l(){h.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function d(){h.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function p(){h.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function g(){h.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function m(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else this.m=e,this.prime=null}function b(e){m.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv.sign=!0,this.minv=this.minv.mod(this.r)}h.prototype._tmp=function e(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},h.prototype.ireduce=function e(t){var r=t,n;do{this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),n=r.bitLength()}while(n>this.n);var i=n0?r.isub(this.p):r.strip(),r},h.prototype.split=function e(t,r){t.ishrn(this.n,0,r)},h.prototype.imulK=function e(t){return t.imul(this.k)},n(l,h),l.prototype.split=function e(t,r){for(var n=4194303,i=Math.min(t.length,9),o=0;o>>22,s=a}t.words[o-10]=s>>>22,t.length-=9},l.prototype.imulK=function e(t){var r;t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var n=0,i=0;i>>=26,t.words[n]=o,r=i}return 0!==r&&(t.words[t.length++]=r),t},i._prime=function e(t){if(f[t])return f[t];var e;if("k256"===t)e=new l;else if("p224"===t)e=new d;else if("p192"===t)e=new p;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new g}return f[t]=e,e},m.prototype._verify1=function e(t){r(!t.sign,"red works only with positives"),r(t.red,"red works only with red numbers")},m.prototype._verify2=function e(t,n){r(!t.sign&&!n.sign,"red works only with positives"),r(t.red&&t.red===n.red,"red works only with red numbers")},m.prototype.imod=function e(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.mod(this.m)._forceRed(this)},m.prototype.neg=function e(t){var r=t.clone();return r.sign=!r.sign,r.iadd(this.m)._forceRed(this)},m.prototype.add=function e(t,r){this._verify2(t,r);var n=t.add(r);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},m.prototype.iadd=function e(t,r){this._verify2(t,r);var n=t.iadd(r);return n.cmp(this.m)>=0&&n.isub(this.m),n},m.prototype.sub=function e(t,r){this._verify2(t,r);var n=t.sub(r);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},m.prototype.isub=function e(t,r){this._verify2(t,r);var n=t.isub(r);return n.cmpn(0)<0&&n.iadd(this.m),n},m.prototype.shl=function e(t,r){return this._verify1(t),this.imod(t.shln(r))},m.prototype.imul=function e(t,r){return this._verify2(t,r),this.imod(t.imul(r))},m.prototype.mul=function e(t,r){return this._verify2(t,r),this.imod(t.mul(r))},m.prototype.isqr=function e(t){return this.imul(t,t)},m.prototype.sqr=function e(t){return this.mul(t,t)},m.prototype.sqrt=function e(t){if(0===t.cmpn(0))return t.clone();var n=this.m.andln(3);if(r(n%2==1),3===n){var o=this.m.add(new i(1)).ishrn(2),s=this.pow(t,o);return s}for(var a=this.m.subn(1),u=0;0!==a.cmpn(0)&&0===a.andln(1);)u++,a.ishrn(1);r(0!==a.cmpn(0));var c=new i(1).toRed(this),f=c.redNeg(),h=this.m.subn(1).ishrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,h).cmp(f);)l.redIAdd(f);for(var d=this.pow(l,a),s=this.pow(t,a.addn(1).ishrn(1)),p=this.pow(t,a),g=u;0!==p.cmp(c);){for(var m=p,b=0;0!==m.cmp(c);b++)m=m.redSqr();r(b=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},b.prototype.mul=function e(t,r){if(0===t.cmpn(0)||0===r.cmpn(0))return new i(0)._forceRed(this);var n=t.mul(r),o=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=n.isub(o).ishrn(this.shift),a=s;return s.cmp(this.m)>=0?a=s.isub(this.m):s.cmpn(0)<0&&(a=s.iadd(this.m)),a._forceRed(this)},b.prototype.invm=function e(t){var r=this.imod(t._invmp(this.m).mul(this.r2));return r._forceRed(this)}}(e,this)}).call(this,r(70)(e))},function(e,t){"function"==typeof Object.create?e.exports=function e(t,r){t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function e(t,r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}},function(e,t,r){"use strict";(function(t){const n=r(9);e.exports=function(e){if(t.isBuffer(e))return new n(e).toString();if(n.isCID(e))return e.toString();if("string"!=typeof e)throw new Error("unexpected cid type: "+typeof e);return new n(e.split("/")[0]),e}}).call(this,r(0).Buffer)},function(e,t){errors={};class r extends Error{constructor(e){super(e||"Coding Error"),this.name="CodingError"}}errors.CodingError=r;class n extends Error{constructor(e){super("To be implemented: "+e),this.name="ToBeImplementedError"}}errors.ToBeImplementedError=n;class i extends Error{constructor(e){super(e||"Transport failure"),this.name="TransportError"}}errors.TransportError=i;class o extends Error{constructor(e){super(e||"Timed out"),this.name="TimeoutError"}}errors.TimeoutError=o;class s extends Error{constructor(e){super(e||"Intentionally Unimplemented Function"),this.name="IntentionallyUnimplementedError"}}errors.IntentionallyUnimplementedError=s,t=e.exports=errors},function(e,t,r){"use strict";function n(e,t){t|=0;for(var r=Math.max(e.length-t,0),n=Array(r),i=0;i=this.buf.length},a.prototype.finished=a.prototype.eof,a.prototype.read=function(e){i.checkArgument(!n.isUndefined(e),"Must specify a length");var t=this.buf.slice(this.pos,this.pos+e);return this.pos=this.pos+e,t},a.prototype.readAll=function(){var e=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,e},a.prototype.readUInt8=function(){var e=this.buf.readUInt8(this.pos);return this.pos=this.pos+1,e},a.prototype.readUInt16BE=function(){var e=this.buf.readUInt16BE(this.pos);return this.pos=this.pos+2,e},a.prototype.readUInt16LE=function(){var e=this.buf.readUInt16LE(this.pos);return this.pos=this.pos+2,e},a.prototype.readUInt32BE=function(){var e=this.buf.readUInt32BE(this.pos);return this.pos=this.pos+4,e},a.prototype.readUInt32LE=function(){var e=this.buf.readUInt32LE(this.pos);return this.pos=this.pos+4,e},a.prototype.readUInt64BEBN=function(){var e=this.buf.slice(this.pos,this.pos+8),t=s.fromBuffer(e);return this.pos=this.pos+8,t},a.prototype.readUInt64LEBN=function(){var e=this.buf.readUInt32LE(this.pos),t=this.buf.readUInt32LE(this.pos+4),r=4294967296*t+e,n;if(r<=9007199254740991)n=new s(r);else{var i=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);n=new s(i,10,"le")}return this.pos=this.pos+8,n},a.prototype.readVarintNum=function(){var e=this.readUInt8();switch(e){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var t=this.readUInt64LEBN(),r=t.toNumber();if(r<=Math.pow(2,53))return r;throw new Error("number too large to retain precision - use readVarintBN");default:return e}},a.prototype.readVarLengthBuffer=function(){var e=this.readVarintNum(),t=this.read(e);return i.checkState(t.length===e,"Invalid length while reading varlength buffer. Expected to read: "+e+" and read "+t.length),t},a.prototype.readVarintBuf=function(){var e=this.buf.readUInt8(this.pos);switch(e){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}},a.prototype.readVarintBN=function(){var e=this.readUInt8();switch(e){case 253:return new s(this.readUInt16LE());case 254:return new s(this.readUInt32LE());case 255:return this.readUInt64LEBN();default:return new s(e)}},a.prototype.reverse=function(){for(var e=new t(this.buf.length),r=0;r=_.outputs.length)return new t(p,"hex");for(_.outputs.length=d+1,v=0;v9007199254740991?"transaction txout satoshis greater than max safe integer":this._satoshis!==this._satoshisBN.toNumber()?"transaction txout satoshis has corrupted value":this._satoshis<0&&"transaction txout negative"},d.prototype.toObject=d.prototype.toJSON=function e(){var t={satoshis:this.satoshis};return t.script=this._scriptBuffer.toString("hex"),t},d.fromObject=function(e){return new d(e)},d.prototype.setScriptFromBuffer=function(e){this._scriptBuffer=e;try{this._script=c.fromBuffer(this._scriptBuffer),this._script._isOutput=!0}catch(e){if(!(e instanceof h.Script.InvalidBuffer))throw e;this._script=null}},d.prototype.setScript=function(e){if(e instanceof c)this._scriptBuffer=e.toBuffer(),this._script=e,this._script._isOutput=!0;else if(n.isString(e))this._script=c.fromString(e),this._scriptBuffer=this._script.toBuffer(),this._script._isOutput=!0;else{if(!s.isBuffer(e))throw new TypeError("Invalid argument type: script");this.setScriptFromBuffer(e)}return this},d.prototype.inspect=function(){var e;return e=this.script?this.script.inspect():this._scriptBuffer.toString("hex"),""},d.fromBufferReader=function(e){var t={};t.satoshis=e.readUInt64LEBN();var r=e.readVarintNum();return t.script=0!==r?e.read(r):new o.Buffer([]),new d(t)},d.prototype.toBufferWriter=function(e){e||(e=new u),e.writeUInt64LEBN(this._satoshisBN);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e},e.exports=d},function(e,t,r){"use strict";const n=r(49),i=r(184);function o(e,t){n(e,i(e=>t(null,e)),e=>{e&&t(e)})}e.exports=o},function(e,t,r){"use strict";var n=r(10),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=h;var o=r(5);o.inherits=r(1);var s=r(399),a=r(274);o.inherits(h,s);for(var u=i(a.prototype),c=0;c`}toJSON(){return this._json||(this._json=Object.freeze({name:this.name,size:this.size,cid:this._cid.toBaseEncodedString()})),Object.assign({},this._json)}get name(){return this._name}get nameAsBuffer(){return null!==this._nameBuf?this._nameBuf:(this._nameBuf=n.from(this._name),this._nameBuf)}set name(e){throw new Error("Can't set property: 'name' is immutable")}get size(){return this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}get cid(){return this._cid}set cid(e){throw new Error("Can't set property: 'cid' is immutable")}}t=e.exports=s(a,{className:"DAGLink",symbolName:"@ipld/js-ipld-dag-pb/daglink"}),t.create=r(822),t.util=r(823)}).call(this,r(0).Buffer)},function(e,t,r){var n=r(16);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},function(e,t,r){var n=r(4).Buffer,i=r(97).Transform,o=r(13).StringDecoder,s=r(1);function a(e){i.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}s(a,i),a.prototype.update=function(e,t,r){"string"==typeof e&&(e=n.from(e,t));var i=this._update(e);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(e,t,r){var n;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){n=e}finally{r(n)}},a.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},a.prototype._finalOrDigest=function(e){var t=this.__final()||n.alloc(0);return e&&(t=this._toString(t,e,!0)),t},a.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new o(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var n=this._decoder.write(e);return r&&(n+=this._decoder.end()),n},e.exports=a},function(e,t,r){"use strict";const n=r(6),i=(e,t)=>{const r=["bitswap"];t&&r.push(t),e&&r.push(`${e.toB58String().slice(0,8)}`);const i=n(r.join(":"));return i.error=n(r.concat(["error"]).join(":")),i},o=(e,t,r)=>{let n=0;const i=r.length;for(;n{let r=0;const n=t.length,i=[];let s;for(;rt.reduce((t,r)=>{const n=e(r);return t[n]?t[n].push(r):t[n]=[r],t},{}),u=(e,t,r)=>t.filter(t=>!o(e,t,r)),c=(e,t)=>Array.prototype.slice.call(t,0).sort((t,r)=>{const n=e(t),i=e(r);return ni?1:0});e.exports={logger:i,includesWith:o,uniqWith:s,groupBy:a,pullAllWith:u,sortBy:c}},function(e,t,r){var n=r(939),i=r(942);function o(e,t){var r=i(e,t);return n(r)?r:void 0}e.exports=o},function(e,t,r){var n=r(457),i=r(63),o=r(228),s=r(229);function a(e){var t=0;return function(r,n,i){t++||e(r,n,i)}}function u(e){return"function"==typeof e}e.exports=function(e,t){u(e)&&(t=e,e={}),t=a(t||function e(){});var r=n(e&&e.timeout||5e3),c=i(function(e){e&&t(e)}),f=s();return{handshake:{read:r.read,abort:function(e){c.end(e),r.abort(e,function(e){}),t(e)},write:c.push,rest:function(){return c.end(),{source:r.read(),sink:f.sink}}},sink:r,source:o([c,f.source])}}},function(e,t,r){"use strict";(function(t){const n=r(12),i=r(40),o=r(72),s=r(67),a=r(66),u=r(9),c=r(1189).createResolver;function f(e){let r=e,n="/";if(t.isBuffer(e)&&(r=new u(e).toBaseEncodedString()),"string"==typeof e){0===e.indexOf("/ipfs/")&&(e=r=e.substring(6));const t=e.indexOf("/");t>0&&(r=e.substring(0,t),n=e.substring(t))}else u.isCID(r)&&(r=r.toBaseEncodedString());return r=new u(r).toBaseEncodedString(),{base:r,rest:d(n)}}const h={maxDepth:1/0,offset:void 0,length:void 0,fullPath:!1};function l(e){return e.reduce((e,t)=>(e.length&&(e+="/"),e+t),"")}e.exports=((e,t,r)=>{let d;r=Object.assign({},h,r);try{d=f(e)}catch(e){return o(e)}const p=l([d.base].concat(d.rest.slice(0,d.rest.length-1))).length,g=new u(d.base);return n(i([{multihash:g.buffer,name:d.base,path:d.base,pathRest:d.rest,depth:0}]),c(t,r),s(Boolean),a(e=>({depth:e.depth,name:e.name,path:r.fullPath?e.path:m(e),size:e.size,hash:e.multihash,content:e.content,type:e.type})));function m(e){if(!d.rest.length)return e.path;let t=e.path.substring(p);return"/"===t.charAt(0)&&(t=t.substring(1)),t||(t=d.rest[d.rest.length-1]||d.base),t}});const d=(e="")=>(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean)}).call(this,r(0).Buffer)},function(e,t,r){(function(t){const n=r(55),i=r(64).ec,o=new i("secp256k1"),s=r(1296),a=t.alloc(32,0),u=t.from("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),c=t.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex"),f=o.curve.n,h=f.shrn(1),l=o.curve.g,d="Expected Private",p="Expected Point",g="Expected Tweak",m="Expected Hash",b="Expected Signature";function y(e){return t.isBuffer(e)&&32===e.length}function v(e){return!!y(e)&&e.compare(u)<0}function _(e){if(!t.isBuffer(e))return!1;if(e.length<33)return!1;const r=e[0],n=e.slice(1,33);if(0===n.compare(a))return!1;if(n.compare(c)>=0)return!1;if((2===r||3===r)&&33===e.length)return!0;const i=e.slice(33);return 0!==i.compare(a)&&(!(i.compare(c)>=0)&&(4===r&&65===e.length))}function w(e){return 4!==e[0]}function S(e){return!!_(e)&&w(e)}function E(e){return!!y(e)&&(e.compare(a)>0&&e.compare(u)<0)}function k(e){const r=e.slice(0,32),n=e.slice(32,64);return t.isBuffer(e)&&64===e.length&&r.compare(u)<0&&n.compare(u)<0}function x(e,t){return void 0===e&&void 0!==t?w(t):void 0===e||e}function C(e){return new n(e)}function A(e){return e.toArrayLike(t,"be",32)}function I(e){return o.curve.decodePoint(e)}function T(e,r){return t.from(e._encode(r))}function O(e,t,r){if(!_(e))throw new TypeError(p);if(!_(t))throw new TypeError(p);const n=I(e),i=I(t),o=n.add(i);if(o.isInfinity())return null;const s=x(r,e);return T(o,s)}function R(e,t,r){if(!_(e))throw new TypeError(p);if(!v(t))throw new TypeError(g);const n=x(r,e),i=I(e);if(0===t.compare(a))return T(i,n);const o=C(t),s=l.mul(o),u=i.add(s);return u.isInfinity()?null:T(u,n)}function B(e,t){if(!_(e))throw new TypeError(p);const r=I(e);if(r.isInfinity())throw new TypeError(p);return T(r,t)}function P(e,t){if(!E(e))throw new TypeError(d);const r=C(e),n=l.mul(r);if(n.isInfinity())return null;const i=x(t);return T(n,i)}function M(e,t,r){if(!_(e))throw new TypeError(p);if(!v(t))throw new TypeError(g);const n=x(r,e),i=I(e),o=C(t),s=i.mul(o);return s.isInfinity()?null:T(s,n)}function N(e,t){if(!E(e))throw new TypeError(d);if(!v(t))throw new TypeError(g);const r=C(e),n=C(t),i=A(r.add(n).umod(f));return E(i)?i:null}function L(e,t){if(!E(e))throw new TypeError(d);if(!v(t))throw new TypeError(g);const r=C(e),n=C(t),i=A(r.sub(n).umod(f));return E(i)?i:null}function j(e,r){if(!y(e))throw new TypeError(m);if(!E(r))throw new TypeError(d);const n=C(r),i=C(e);let o,a;s(e,r,function(e){const t=C(e),r=l.mul(t);return!r.isInfinity()&&(o=r.x.umod(f),0!==o.isZero()&&(a=t.invm(f).mul(i.add(n.mul(o))).umod(f),0!==a.isZero()))},E),a.cmp(h)>0&&(a=f.sub(a));const u=t.allocUnsafe(64);return A(o).copy(u,0),A(a).copy(u,32),u}function D(e,t,r){if(!y(e))throw new TypeError(m);if(!_(t))throw new TypeError(p);if(!k(r))throw new TypeError(b);const n=I(t),i=C(r.slice(0,32)),o=C(r.slice(32,64));if(i.gtn(0)<=0)return!1;if(o.gtn(0)<=0)return!1;const s=C(e),a=o.invm(f),u=s.mul(a).umod(f),c=i.mul(a).umod(f),h=l.mulAdd(u,n,c);if(h.isInfinity())return!1;const d=h.x,g=d.umod(f);return g.eq(i)}e.exports={isPoint:_,isPointCompressed:S,isPrivate:E,pointAdd:O,pointAddScalar:R,pointCompress:B,pointFromScalar:P,pointMultiply:M,privateAdd:N,privateSub:L,sign:j,verify:D}}).call(this,r(0).Buffer)},function(e,t){function r(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:function(){let e=r.call(this);return this[t]=e,e},set:function(e){Object.defineProperty(this,t,{configurable:!0,enumerable:!0,value:e,writable:!0})}})}function n(e){let t;return function(){return void 0!==t?t:(t=e(),t)}}e.exports={prop:r,value:n}},function(e,t,r){"use strict";t.ethAccountSnapshot=r(563),t.ethBlock=r(568),t.ethBlockList=r(1360),t.ethStateTrie=r(1361),t.ethStorageTrie=r(1364),t.ethTx=r(570),t.ethTxTrie=r(1367)},function(e,t){},function(e,t,r){"use strict";var n=r(15),i=r(26),o=r(36),s=[],a={};function u(){}function c(e,t){if(~s.indexOf(e))return e;if(!t)return a[e];n.isArray(t)||(t=[t]);var r=function(t){return s[i][t]===e};for(var i in s)if(n.any(t,r))return s[i]}function f(e){var t=new u;return o.defineImmutable(t,{name:e.name,alias:e.alias,pubkeyhash:e.pubkeyhash,privatekey:e.privatekey,scripthash:e.scripthash,xpubkey:e.xpubkey,xprivkey:e.xprivkey,zaddr:e.zaddr,zkey:e.zkey}),e.networkMagic&&o.defineImmutable(t,{networkMagic:i.integerAsBuffer(e.networkMagic)}),e.port&&o.defineImmutable(t,{port:e.port}),e.dnsSeeds&&o.defineImmutable(t,{dnsSeeds:e.dnsSeeds}),n.each(t,function(e){n.isUndefined(e)||n.isObject(e)||(a[e]=t)}),s.push(t),t}function h(e){for(var t=0;t"},e.exports=h;var l=r(78)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(10),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=h;var o=r(5);o.inherits=r(1);var s=r(595),a=r(598);o.inherits(h,s);for(var u=i(a.prototype),c=0;c!e.status)}static p_connectedNames(e){const t=this._connected().map(e=>e.name);if(!e)return new Promise((e,r)=>e(t));e(null,t)}static async p_connectedNamesParm(){return(await this.p_connectedNames()).map(e=>"transport="+e).join("&")}static async p_statuses(){return this._transports.map(e=>({name:e.name,status:e.status}))}static validFor(e,t,r){return"string"==typeof e&&(e=[e]),e&&e[0]||["store","newlisturls","newdatabase","newtable"].includes(t)?e&&e.length>0?[].concat(...e.map(e=>"string"==typeof e?n.parse(e):e).map(e=>this._connected().filter(r=>r.supports(e,t)).map(t=>[e,t]))):this._connected().filter(e=>e.supports(void 0,t)).map(e=>[void 0,e]):(console.error("Transports.validFor called with invalid arguments: urls=",e,"func=",t),[])}static async p_urlsValidFor(e,t,r){return this.validFor(e,t,r).map(e=>e[0])}static http(){return u._connected().find(e=>"HTTP"===e.name)}static ipfs(){return u._connected().find(e=>"IPFS"===e.name)}static webtorrent(){return u._connected().find(e=>"WEBTORRENT"===e.name)}static gun(){return u._connected().find(e=>"GUN"===e.name)}static async p_resolveNames(e){return this.mirror?Array.isArray(e)?this.gatewayUrls(e):this.gatewayUrl(url):this.namingcb?await this.namingcb(e):e}static resolveNamesWith(e){this.namingcb=e}static async _p_rawstore(e,t){let r=[],n=await Promise.all(e.map(async function(e){try{s("Storing %d bytes to %s",t.length,e.name);let n=await e.p_rawstore(t);return s("Storing %d bytes to %s succeeded: %s",t.length,e.name,n),n}catch(n){return s("Storing %d bytes to %s failed: %s",t.length,e.name,n.message),void r.push(n)}}));if(n=n.filter(e=>!!e),!n.length)throw s("Storing %d bytes failed on all transports",t.length),new i.TransportError(r.map(e=>e.message).join(", "));return n}static async p_rawstore(e){let t=this.validFor(void 0,"store").map(([e,t])=>t);if(!t.length)throw s("Storing %d bytes failed: no transports available",e.length),new i.TransportError("Transports.p_rawstore: Cant find transport for store");return this._p_rawstore(t,e)}static async p_rawlist(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"list");if(!t.length)throw new i.TransportError('Transports.p_rawlist: Cant find transport to "list" urls:'+e.join(","));let r=[],n=await Promise.all(t.map(async function([e,t]){try{s("Listing %s via %s",e,t.name);let n=await t.p_rawlist(e);return s("Listing %s via %s retrieved %d items",e,t.name,n.length),n}catch(n){return s("Listing %s via %s failed: %s",e,t.name,n.message),r.push(n),[]}}));if(r.length>=t.length)throw s("Listing %o failed on all transports",e),new i.TransportError(r.map(e=>e.message).join(", "));let o={};return[].concat(...n).filter(e=>!o[e.signature]&&(o[e.signature]=!0))}static async p_rawfetch(e,t={}){if(!e.length)throw new i.TransportError("Transports.p_rawfetch given an empty list of urls");let r=await this.p_resolveNames(e);if(!r.length)throw new i.TransportError("Transports.p_rawfetch none of the urls resolved: "+e);let n=this.validFor(r,"fetch");if(!n.length)throw new i.TransportError("Transports.p_rawfetch cant find any transport for urls: "+r);let o=[],a=[];for(const[e,r]of n)try{s("Fetching %s via %s",e.href,r.name);let n=await r.p_rawfetch(e,t);return s("Fetching %s via %s succeeded %d bytes",e.href,r.name,n.length),t.relay&&a.length&&(s("Fetching attempting relay of %d bytes from %s to %o",n.length,e.href,a.map(e=>e.name)),this._p_rawstore(a,n).then(e=>s("Fetching relayed %d bytes to %o",n.length,e))),n}catch(t){a.push(r),o.push(t),s("Fetching %s via %s failed: %s",e.href,r.name,t.message)}throw s("Fetching %o failed on all transports",e),new i.TransportError(o.map(e=>e.message).join(", "))}static async p_rawadd(e,t){e=await this.p_resolveNames(e);let r=this.validFor(e,"add");if(!r.length)throw s("Adding to %o failed: no transports available",e),new i.TransportError("Transports.p_rawstore: Cant find transport for urls:"+e.join(","));let n=[];if(await Promise.all(r.map(async function([e,r]){try{return s("Adding to %s via %s",e,r.name),await r.p_rawadd(e,t),void s("Adding to %s via %s succeeded",e,r.name)}catch(t){return s("Adding to %s via %s failed: %s",e,r.name,t.message),void n.push(t)}})),n.length>=r.length)throw s("Adding to %o failed on all transports",e),new i.TransportError(n.map(e=>e.message).join(", "))}static listmonitor(e,t,r={}){this.validFor(e,"listmonitor").map(([e,n])=>{n.listmonitor(e,t,r),s("Monitoring list %s via %s",e,n.name)})}static async p_newlisturls(e){let t=await Promise.all(this.validFor(void 0,"newlisturls").map(([t,r])=>r.p_newlisturls(e)));return[t.map(e=>e[0]),t.map(e=>e[1])]}static async p_f_createReadStream(e,{wanturl:t=!1,preferredTransports:r=[]}={}){let n=this.validFor(e,"createReadStream",{});if(!n.length)throw s("Opening stream to %o failed: no transports available",e),new i.TransportError("Transports.p_createReadStream cant find any transport for urls: "+e);let o=[];n.sort((e,t)=>(r.indexOf(e[1].name)+1||999+Math.random())-(r.indexOf(t[1].name)+1||999+Math.random()));for(const[e,r]of n)try{s("Opening stream to %s via %s",e.href,r.name);let n=await r.p_f_createReadStream(e,{wanturl:t});return s("Opening stream to %s via %s succeeded",e.href,r.name),n}catch(t){o.push(t),s("Opening stream to %s via %s failed: %s",e.href,r.name,t.message)}throw s("Opening stream to %o failed on all transports",e),new i.TransportError(o.map(e=>e.message).join(", "))}static createReadStream(e,t,r){"function"==typeof t&&(r=t,t={start:0}),DwebTransports.p_f_createReadStream(e).then(e=>{let n=e(t);if(!r)return n;r(null,n)}).catch(e=>{e instanceof i.TransportError?console.warn("Transports.createReadStream caught",e.message):console.error("Transports.createReadStream caught",e),r?r(e):reject(e)})}static async p_get(e,t){let r=this.validFor(e,"get"),n=Array.isArray(t)?`${t.length} keys`:t;if(!r.length)throw s("Getting %s from %o failed: no transports available",n,e),new i.TransportError("Transports.p_get cant find any transport to get keys from urls: "+e);let o=[];for(const[e,i]of r)try{s("Getting %s from %s via %s",n,e.href,i.name);let r=await i.p_get(e,t);return s("Getting %s from %s via %s succeeded length=%d",n,e.href,i.name,r.length),r}catch(t){o.push(t),s("Getting %s from %s via %s failed: %s",n,e.href,i.name,t.message)}throw s("Getting %s from %o failed on all transports",n,e),new i.TransportError(o.map(e=>e.message).join(", "))}static async p_set(e,t,r){e=await this.p_resolveNames(e);let n="object"==typeof t?`${t.length} keys`:t,o=this.validFor(e,"set");if(!o.length)throw s("Setting %s on %o failed: no transports available",n,e),new i.TransportError("Transports.p_set cant find any transport for urls: "+e);let a=[],u=!1;if(await Promise.all(o.map(async function([e,i]){try{s("Setting %s on %s via %s",n,e.href,i.name),await i.p_set(e,t,r),s("Setting %s on %s via %s succeeded",n,e.href,i.name),u=!0}catch(t){s("Setting %s on %s via %s failed: %s",n,e.href,i.name,t.message),a.push(t)}})),!u)throw s("Setting %s on %o failed on all transports",n,e),new i.TransportError(a.map(e=>e.message).join(", "))}static async p_delete(e,t){e=await this.p_resolveNames(e);let r=Array.isArray(t)?`${t.length} keys`:t,n=this.validFor(e,"set");if(!n.length)throw s("Deleting %s on %o failed: no transports available",r,e),new i.TransportError("Transports.p_set cant find any transport for urls: "+e);let o=[],a=!1;if(await Promise.all(n.map(async function([e,n]){try{s("Deleting %s on %s via %s",r,e.href,n.name),await n.p_delete(e,t),s("Deleting %s on %s via %s succeeded",r,e.href,n.name),a=!0}catch(t){s("Deleting %s on %s via %s failed: %s",r,e.href,n.name,t.message),o.push(t)}})),!a)throw s("Deleting %s on %o failed on all transports",r,e),new i.TransportError(o.map(e=>e.message).join(", "))}static async p_keys(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"keys");if(!t.length)throw s("Getting all keys on %o failed: no transports available",e),new i.TransportError("Transports.p_keys cant find any transport for urls: "+e);let r=[];for(const[e,n]of t)try{s("Getting all keys on %s via %s",e.href,n.name);let t=await n.p_keys(e);return s("Getting all keys on %s via %s succeeded with %d keys",e.href,n.name,t.length),t}catch(t){r.push(t),s("Getting all keys on %s via %s failed: %s",e.href,n.name,t.message)}throw s("Getting all keys on %o failed on all transports",e),new i.TransportError(r.map(e=>e.message).join(", "))}static async p_getall(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"getall");if(!t.length)throw s("Getting all values on %o failed: no transports available",e),new i.TransportError("Transports.p_getall cant find any transport for urls: "+e);let r=[];for(const[e,n]of t)try{s("Getting all values on %s via %s",e.href,n.name);let t=await n.p_getall(e);return s("Getting all values on %s via %s succeeded with %d values",e.href,n.name,t.length),t}catch(t){r.push(t),s("Getting all values on %s via %s failed: %s",e.href,n.name,t.message)}throw s("Getting all keys on %o failed on all transports",e),new i.TransportError(r.map(e=>e.message).join(", "))}static async p_newdatabase(e){let t=await Promise.all(this.validFor(void 0,"newdatabase").map(([t,r])=>r.p_newdatabase(e)));return{privateurls:t.map(e=>e.privateurl),publicurls:t.map(e=>e.publicurl)}}static async p_newtable(e,t){let r=await Promise.all(this.validFor(void 0,"newtable").map(([r,n])=>n.p_newtable(e,t)));return{privateurls:r.map(e=>e.privateurl),publicurls:r.map(e=>e.publicurl)}}static async p_connection(e){e=await this.p_resolveNames(e),await Promise.all(this.validFor(e,"connection").map(([e,t])=>t.p_connection(e)))}static monitor(e,t,{current:r=!1}={}){this.validFor(e,"monitor").map(([e,n])=>{s("Monitoring table %s via %s",e,n.name),n.monitor(e,t,{current:r})})}static addtransport(e){u._transports.push(e)}static setup0(e,t,r){let n={http:{urlbase:"http://localhost:4244"}};return e.map(e=>{let r=this._transportclasses["LOCAL"===e?"HTTP":e];return r?(s("Setting up connection to %s with options %o",e,t),r.setup0("LOCAL"===e?n:t)):void s("Connection to %s unavailable",e)}).filter(e=>!!e)}static p_setup1(e,t){const r=Promise.all(this._transports.filter(e=>!this._optionspaused.includes(e.name)).map(t=>(s("Connection stage 1 to %s",t.name),t.p_setup1(e))));if(!t)return r;r.catch(e=>t(e)).then(e=>t(null,e))}static p_setup2(e,t){const r=Promise.all(this._transports.filter(e=>!this._optionspaused.includes(e.name)).map(t=>(s("Connection stage 2 to %s",t.name),t.p_setup2(e))));if(!t)return r;r.catch(e=>t(e)).then(e=>t(null,e))}static p_stop(e,t){const r=Promise.all(this._connected().map(t=>(s("Stopping %s",t.name),t.p_stop(e))));if(!t)return r;r.catch(e=>t(e)).then(e=>t(null,e))}static async refreshstatus(e){let t=["transportstatus0","transportstatus1","transportstatus2","transportstatus3","transportstatus4"],r=e.statuselement;r&&(r.classList.remove(...t),r.classList.add(t[e.status])),u.statuscb&&u.statuscb(e)}static connect(e,t){const r=this.p_connect(e);if(!t)return r;r.catch(e=>t(e)).then(e=>t(null,e))}static async p_connect(e){try{e=e||{};let t=e.transports;this._optionspaused=(e.paused||[]).map(e=>e.toUpperCase()),t&&t.length||(t=e.defaulttransports||[]),t.length||(t=["HTTP","YJS","IPFS","WEBTORRENT","GUN"]),t=t.map(e=>e.toUpperCase());let r=this.setup0(t,e);if(["statuscb","mirror"].forEach(t=>{e[t]&&(this[t]=e[t])}),e.statuselement){let t=e.statuselement;for(;t.lastChild;)t.removeChild(t.lastChild);t.appendChild(o.createElement("UL",{},r.map(e=>{let t=o.createElement("LI",{onclick:"this.source.togglePaused(DwebTransports.refreshstatus);",source:e,name:e.name},e.name);return e.statuselement=t,t})))}await this.p_setup1(this.refreshstatus),await this.p_setup2(this.refreshstatus),s("Connection completed to %o",this._connected().map(e=>e.name))}catch(e){throw console.error("ERROR in p_connect:",e.message),e}}static async p_urlsFrom(e){if("string"==typeof e&&(e="["===e[0]?JSON.parse(e):e.includes(",")?e.split(","):[e]),!Array.isArray(e))throw new Error(`Unparsable url: ${e}`);return e}static async p_httpfetchurl(e){return u.http()._url(e.find(e=>e.startsWith("contenthash")||e.startsWith("http")),"content/rawfetch")}static canonicalName(e,t={}){"string"!=typeof e&&(e=n.parse(e).href);const r=["dweb.me","ipfs.io"],i=["ipfs","gun","magnet","yjs","arc","contenthash","http","https"],o=["arc","http","https"],s=[/^http[s]?:[/]+([^/]+)[/](\w+)[/](.*)/i],a=[/^dweb:[/]+(\w+)[/]+(.*)/i,/^\w+:[/]+(\w+)[/](.*)/i,/^(\w+):[/]*(.*)/i,/^[/]*(\w+)[/](.*)/i,/^[/]*dweb[/]*(\w+)[/](.*)/i],u=[/^http[s]?:[/]+[^/]+[/](archive).(org)[/]*(.*)/i,/^http[s]?:[/]+dweb.(\w+)[.]([^/]+)[/]*(.*)/i,/^(http[s])?:[/]+([^/]+)[/]+(.*)/i];for(let t of s){let n=e.match(t);if(n&&r.includes(n[1])&&i.includes(n[2]))return{proto:n[2],internal:n[3]}}for(let t of u){let r=e.match(t);if(r)return i.includes(r[1])?{proto:r[1],internal:o.includes(r[1])?[r[2],r[3]].join("/"):r[3]}:{proto:"arc",internal:[[r[1],r[2]].join("."),r[3]].join("/")}}for(let t of a){let r=e.match(t);if(r&&i.includes(r[1]))return{proto:r[1],internal:r[2]}}}static canonicalUrl(e,t={}){let r=this.canonicalName(e,t);return r.protocol+":/"+r.internal}static _o2url(e){return["http","https"].includes(e.proto)?[e.proto,e.internal].join("://"):e.proto?[this.mirror,e.proto,e.internal].join("/"):e.internal}static gatewayUrl(e){let t=u.canonicalName(e);return t?this._o2url(t):e}static gatewayUrls(e){const t=e.map(e=>u.canonicalName(e)||{proto:void 0,internal:e}),r=t.filter(e=>["arc"].includes(e.proto));return(r.length?r:t).map(e=>this._o2url(e))}}u._transports=[],u.namingcb=void 0,u._transportclasses={},u.httptools=a,t=e.exports=u},function(e,t,r){"use strict";(function(t){var n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=c;var i=r(347),o=r(351);r(1)(c,i);for(var s=n(o.prototype),a=0;at){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},i.create=function(e,t,r,o,s){if(n.util.isArray(o)){for(var a=[],u=0;ut){if(n.strict){var g=new Error("Too few bytes to read ASN.1 value.");throw g.available=e.length(),g.remaining=t,g.requested=l,g}l=t}var m=32==(32&c);if(m)if(d=[],void 0===l)for(;;){if(o(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}u=e.length(),d.push(a(e,t,r+1,n)),t-=u-e.length()}else for(;l>0;)u=e.length(),d.push(a(e,l,r+1,n)),t-=u-e.length(),l-=u-e.length();if(void 0===d&&f===i.Class.UNIVERSAL&&h===i.Type.BITSTRING&&(p=e.bytes(l)),void 0===d&&n.decodeBitStrings&&f===i.Class.UNIVERSAL&&h===i.Type.BITSTRING&&l>1){var b=e.read,y=t,v=0;if(h===i.Type.BITSTRING&&(o(e,t,1),v=e.getByte(),t--),0===v)try{u=e.length();var _={verbose:n.verbose,strict:!0,decodeBitStrings:!0},w=a(e,t,r+1,_),S=u-e.length();t-=S,h==i.Type.BITSTRING&&S++;var E=w.tagClass;S!==l||E!==i.Class.UNIVERSAL&&E!==i.Class.CONTEXT_SPECIFIC||(d=[w])}catch(e){}void 0===d&&(e.read=b,t=y)}if(void 0===d){if(void 0===l){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");l=t}if(h===i.Type.BMPSTRING)for(d="";l>0;l-=2)o(e,t,2),d+=String.fromCharCode(e.getInt16()),t-=2;else d=e.getBytes(l)}var k=void 0===p?null:{bitStringContents:p};return i.create(f,h,m,d,k)}i.fromDer=function(e,t){return void 0===t&&(t={strict:!0,decodeBitStrings:!0}),"boolean"==typeof t&&(t={strict:t,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"==typeof e&&(e=n.util.createBuffer(e)),a(e,e.length(),0,t)},i.toDer=function(e){var t=n.util.createBuffer(),r=e.tagClass|e.type,o=n.util.createBuffer(),s=!1;if("bitStringContents"in e&&(s=!0,e.original&&(s=i.equals(e,e.original))),s)o.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:o.putByte(0);for(var a=0;a1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?o.putBytes(e.value.substr(1)):o.putBytes(e.value);if(t.putByte(r),o.length()<=127)t.putByte(127&o.length());else{var u=o.length(),c="";do{c+=String.fromCharCode(255&u),u>>>=8}while(u>0);t.putByte(128|c.length);for(var a=c.length-1;a>=0;--a)t.putByte(c.charCodeAt(a))}return t.putBuffer(o),t},i.oidToDer=function(e){var t=e.split("."),r=n.util.createBuffer(),i,o,s,a;r.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var u=2;u>>=7,i||(a|=128),o.push(a),i=!1}while(s>0);for(var c=o.length-1;c>=0;--c)r.putByte(o[c])}return r},i.derToOid=function(e){var t;"string"==typeof e&&(e=n.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var i=0;e.length()>0;)r=e.getByte(),i<<=7,128&r?i+=127&r:(t+="."+(i+r),i=0);return t},i.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),o=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),a=0;if(e.length>11){var u=e.charAt(10),c=10;"+"!==u&&"-"!==u&&(a=parseInt(e.substr(10,2),10),c+=2)}if(t.setUTCFullYear(r,n,i),t.setUTCHours(o,s,a,0),c&&(u=e.charAt(c),"+"===u||"-"===u)){var f=parseInt(e.substr(c+1,2),10),h=parseInt(e.substr(c+4,2),10),l=60*f+h;l*=6e4,"+"===u?t.setTime(+t-l):t.setTime(+t+l)}return t},i.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),u=0,c=0,f=!1;"Z"===e.charAt(e.length-1)&&(f=!0);var h=e.length-5,l=e.charAt(h);if("+"===l||"-"===l){var d=parseInt(e.substr(h+1,2),10),p=parseInt(e.substr(h+4,2),10);c=60*d+p,c*=6e4,"+"===l&&(c*=-1),f=!0}return"."===e.charAt(14)&&(u=1e3*parseFloat(e.substr(14),10)),f?(t.setUTCFullYear(r,n,i),t.setUTCHours(o,s,a,u),t.setTime(+t+c)):(t.setFullYear(r,n,i),t.setHours(o,s,a,u)),t},i.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},i.derToInteger=function(e){"string"==typeof e&&(e=n.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},i.validate=function(e,t,r,o){var s=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)o&&(e.tagClass!==t.tagClass&&o.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&o.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(s=!0,t.value&&n.util.isArray(t.value))for(var a=0,u=0;s&&u0&&(o+="\n");for(var s="",a=0;a1?o+="0x"+n.util.bytesToHex(e.value.slice(1)):o+="(none)",e.value.length>0){var l=e.value.charCodeAt(0);1==l?o+=" (1 unused bit shown)":l>1&&(o+=" ("+l+" unused bits shown)")}}else e.type===i.Type.OCTETSTRING?(u.test(e.value)||(o+="("+e.value+") "),o+="0x"+n.util.bytesToHex(e.value)):e.type===i.Type.UTF8?o+=n.util.decodeUtf8(e.value):e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?o+=e.value:u.test(e.value)?o+="0x"+n.util.bytesToHex(e.value):0===e.value.length?o+="[null]":o+=e.value}return o}},function(e,t,r){var n=r(16);r(210),r(830),r(831),r(29),n.random&&n.random.getBytes?e.exports=n.random:function(t){var r={},i=new Array(4),o=n.util.createBuffer();function s(){var e=n.prng.create(r);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}r.formatKey=function(e){var t=n.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),n.aes._expandKey(e,!1)},r.formatSeed=function(e){var t=n.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},r.cipher=function(e,t){return n.aes._updateBlock(e,t,i,!1),o.putInt32(i[0]),o.putInt32(i[1]),o.putInt32(i[2]),o.putInt32(i[3]),o.getBytes()},r.increment=function(e){return++e[3],e},r.md=n.md.sha256;var a=s(),u=null;if("undefined"!=typeof window){var c=window.crypto||window.msCrypto;c&&c.getRandomValues&&(u=function(e){return c.getRandomValues(e)})}if(n.options.usePureJavaScript||!n.util.isNodejs&&!u){if("undefined"==typeof window||window.document,a.collectInt(+new Date,32),"undefined"!=typeof navigator){var f="";for(var h in navigator)try{"string"==typeof navigator[h]&&(f+=navigator[h])}catch(e){}a.collect(f),f=null}t&&(t().mousemove(function(e){a.collectInt(e.clientX,16),a.collectInt(e.clientY,16)}),t().keypress(function(e){a.collectInt(e.charCode,8)}))}if(n.random)for(var h in a)n.random[h]=a[h];else n.random=a;n.random.createInstance=s,e.exports=n.random}("undefined"!=typeof jQuery?jQuery:null)},function(e,t,r){"use strict";const n=t;n.bignum=r(55),n.define=r(841).define,n.base=r(165),n.constants=r(430),n.decoders=r(846),n.encoders=r(848)},function(e,t,r){"use strict";var n=r(1),i=r(290),o=r(436),s=r(437),a=r(107);function u(e){a.call(this,"digest"),this._hash=e}n(u,a),u.prototype._update=function(e){this._hash.update(e)},u.prototype._final=function(){return this._hash.digest()},e.exports=function e(t){return t=t.toLowerCase(),"md5"===t?new i:"rmd160"===t||"ripemd160"===t?new o:new u(s(t))}},function(e,t,r){var n=r(4).Buffer;function i(e,t){this._block=n.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}i.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=n.from(e,t));for(var r=this._block,i=this._blockSize,o=e.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(458),i=a(n),o=r(195),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)(i.default,1),e.exports=t.default},function(e,t,r){function n(e){if(e)return i(e)}function i(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}e.exports=n,n.prototype.on=n.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},n.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r=this._callbacks["$"+e],n;if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i1?{type:d[i],data:e.substring(1)}:{type:d[i]}:p}var s=new Uint8Array(e),i=s[0],a=o(e,1);return g&&"blob"===r&&(a=new g([a])),{type:d[i],data:a}},t.decodeBase64Packet=function(e,t){var r=d[e.charAt(0)];if(!u)return{type:r,data:{base64:!0,data:e.substr(1)}};var n=u.decode(e.substr(1));return"blob"===t&&g&&(n=new g([n])),{type:r,data:n}},t.encodePayload=function(e,r,n){"function"==typeof r&&(n=r,r=null);var o=i(e);if(r&&o)return g&&!h?t.encodePayloadAsBlob(e,n):t.encodePayloadAsArrayBuffer(e,n);if(!e.length)return n("0:");function s(e){return e.length+":"+e}function a(e,n){t.encodePacket(e,!!o&&r,!1,function(e){n(null,s(e))})}w(e,a,function(e,t){return n(t.join(""))})},t.decodePayload=function(e,r,n){if("string"!=typeof e)return t.decodePayloadAsBinary(e,r,n);var i;if("function"==typeof r&&(n=r,r=null),""===e)return n(p,0,1);for(var o="",s,a,u=0,c=e.length;u0;){for(var a=new Uint8Array(i),u=0===a[0],c="",f=1;255!==a[f];f++){if(c.length>310)return n(p,0,1);c+=a[f]}i=o(i,2+c.length),c=parseInt(c);var h=o(i,0,c);if(u)try{h=String.fromCharCode.apply(null,new Uint8Array(h))}catch(e){var l=new Uint8Array(h);h="";for(var f=0;f65536)throw new Error("requested too many random bytes");var i=new t.Uint8Array(e);e>0&&s.getRandomValues(i);var a=o.from(i.buffer);return"function"==typeof r?n.nextTick(function(){r(null,a)}):a}s&&s.getRandomValues?e.exports=a:e.exports=i}).call(this,r(8),r(2))},function(e,t,r){"use strict";var n=r(10),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=h;var o=r(5);o.inherits=r(1);var s=r(486),a=r(489);o.inherits(h,s);for(var u=i(a.prototype),c=0;c{const r=n(e,t);return(e,t,n)=>{r(e,t,(e,t)=>{if(e)return n(e);n(null,t[0])})}})},function(e,t,r){"use strict";var n=r(10),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=h;var o=r(5);o.inherits=r(1);var s=r(628),a=r(631);o.inherits(h,s);for(var u=i(a.prototype),c=0;c{setTimeout(()=>{r(t)},e)})}class a{constructor(e){}static setup0(e){throw new o.IntentionallyUnimplementedError("Intentionally undefined function Transport.setup0 should have been subclassed")}p_setup1(e){return this}p_setup2(e){return this}static async p_setup(e,t){let r=await this.setup0(e).p_setup1(t);return r.p_setup2(t)}p_stop(e){return new Promise((t,r)=>{this.status=a.STATUS_FAILED,e&&e(this),t()})}togglePaused(e){switch(this.status){case a.STATUS_CONNECTED:this.status=a.STATUS_PAUSED;break;case a.STATUS_PAUSED:this.status=a.STATUS_CONNECTED;break;case a.STATUS_LOADED:this.p_setup1(e).then(t=>t.p_setup2(e))}e&&e(this)}async p_status(){return this.status}supports(e,t){if("string"==typeof e&&(e=n.parse(e)),e&&!e.protocol)throw new Error("URL failed to specific a scheme (before :) "+e.href);return(!e||this.supportURLs.includes(e.protocol.slice(0,-1)))&&(!t||this.supportFunctions.includes(t))}p_rawstore(e,t){throw new o.ToBeImplementedError("Intentionally undefined function Transport.p_rawstore should have been subclassed")}async p_rawstoreCaught(e){try{return await this.p_rawstore(e)}catch(e){}}p_store(){throw new o.ToBeImplementedError("Undefined function Transport.p_store - may define higher level semantics here (see Python)")}p_rawfetch(e,{timeoutMS:t,start:r,end:n,relay:i=!1}={}){return console.assert(!1,"Intentionally undefined function Transport.p_rawfetch should have been subclassed"),"UNIMPLEMENTED"}p_fetch(){throw new o.ToBeImplementedError("Undefined function Transport.p_fetch - may define higher level semantics here (see Python)")}p_rawadd(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_rawadd")}p_rawlist(e){throw new o.ToBeImplementedError("Undefined function Transport.p_rawlist")}p_list(){throw new Error("Undefined function Transport.p_list")}p_newlisturls(e){throw new Error("undefined function Transport.p_newlisturls")}p_rawreverse(e){throw new o.ToBeImplementedError("Undefined function Transport.p_rawreverse")}listmonitor(e,t,{current:r=!1}={}){console.log("Undefined function Transport.listmonitor")}async p_newdatabase(e){throw new o.ToBeImplementedError("Undefined function Transport.p_newdatabase")}async p_newtable(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_newtable")}async p_set(e,t,r){throw new o.ToBeImplementedError("Undefined function Transport.p_set")}async p_get(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_get")}async p_delete(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_delete")}async p_keys(e){throw new o.ToBeImplementedError("Undefined function Transport.p_keys")}async p_getall(e){throw new o.ToBeImplementedError("Undefined function Transport.p_keys")}static async p_f_createReadStream(e,{wanturl:t=!1}){}static mergeoptions(e){let t={};for(let r=0;r",n),console.assert("bar"===n.testkey2.foo&&2===n.testkey3[1]&&!n.testkey),await s(200),console.log(this.name,"p_test_kvt complete")}catch(e){throw console.log("Exception thrown in ",this.name,"p_test_kvt:",e.message),e}}}a.STATUS_CONNECTED=0,a.STATUS_FAILED=1,a.STATUS_STARTING=2,a.STATUS_LOADED=3,a.STATUS_PAUSED=4,a.STATUSTEXT=["Connected","Failed","Starting","Loaded","Paused"],t=e.exports=a},function(e,t,r){"use strict";function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var i={};function o(e,t,r){function o(e,r,n){return"string"==typeof t?t:t(e,r,n)}r||(r=Error);var s=function(e){function t(t,r,n){return e.call(this,o(t,r,n))||this}return n(t,e),t}(r);s.prototype.name=r.name,s.prototype.code=e,i[e]=s}function s(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))}function a(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}function u(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function c(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}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,i;if("string"==typeof t&&a(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be",u(e," argument"))i="The ".concat(e," ").concat(n," ").concat(s(t,"type"));else{var o=c(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(o," ").concat(n," ").concat(s(t,"type"))}return i+=". Received type ".concat(typeof r),i},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"),e.exports.codes=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(190),i=a(n),o=r(39),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e){return function(t,r,n){return e(i.default,t,(0,s.default)(r),n)}}e.exports=t.default},function(e,t,r){var n=r(259),i=r(260);function o(e){return null!=e&&i(e.length)&&!n(e)}e.exports=o},function(e,t,r){var n=r(87),i=n.Symbol;e.exports=i},function(e,t,r){"use strict";e.exports=function e(t,r){var n,i;function o(e){if(n=e,i)return o.abort();!function e(){for(var o=!0,s=!1;o;)if(s=!1,n(null,function(a,u){if(s=!0,a=a||i){if(o=!1,r)r(!0===a?null:a);else if(a&&!0!==a)throw a}else t&&!1===t(u)||i?(o=!1,n(i||!0,r||function(){})):o||e()}),!s)return void(o=!1)}()}return o.abort=function(e,t){if("function"==typeof e&&(t=e,e=!0),i=e||!0,n)return n(i,t||function(){})},o}},function(e,t){e.exports=function e(t){return t&&("string"==typeof t?function(e){return e[t]}:"object"==typeof t&&"function"==typeof t.exec?function(e){var r=t.exec(e);return r&&r[0]}:t)}},function(e,t,r){var n=r(16);n.pki=n.pki||{};var i=e.exports=n.pki.oids=n.oids=n.oids||{};function o(e,t){i[e]=t,i[t]=e}function s(e,t){i[e]=t}o("1.2.840.113549.1.1.1","rsaEncryption"),o("1.2.840.113549.1.1.4","md5WithRSAEncryption"),o("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),o("1.2.840.113549.1.1.7","RSAES-OAEP"),o("1.2.840.113549.1.1.8","mgf1"),o("1.2.840.113549.1.1.9","pSpecified"),o("1.2.840.113549.1.1.10","RSASSA-PSS"),o("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),o("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),o("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),o("1.2.840.10040.4.3","dsa-with-sha1"),o("1.3.14.3.2.7","desCBC"),o("1.3.14.3.2.26","sha1"),o("2.16.840.1.101.3.4.2.1","sha256"),o("2.16.840.1.101.3.4.2.2","sha384"),o("2.16.840.1.101.3.4.2.3","sha512"),o("1.2.840.113549.2.5","md5"),o("1.2.840.113549.1.7.1","data"),o("1.2.840.113549.1.7.2","signedData"),o("1.2.840.113549.1.7.3","envelopedData"),o("1.2.840.113549.1.7.4","signedAndEnvelopedData"),o("1.2.840.113549.1.7.5","digestedData"),o("1.2.840.113549.1.7.6","encryptedData"),o("1.2.840.113549.1.9.1","emailAddress"),o("1.2.840.113549.1.9.2","unstructuredName"),o("1.2.840.113549.1.9.3","contentType"),o("1.2.840.113549.1.9.4","messageDigest"),o("1.2.840.113549.1.9.5","signingTime"),o("1.2.840.113549.1.9.6","counterSignature"),o("1.2.840.113549.1.9.7","challengePassword"),o("1.2.840.113549.1.9.8","unstructuredAddress"),o("1.2.840.113549.1.9.14","extensionRequest"),o("1.2.840.113549.1.9.20","friendlyName"),o("1.2.840.113549.1.9.21","localKeyId"),o("1.2.840.113549.1.9.22.1","x509Certificate"),o("1.2.840.113549.1.12.10.1.1","keyBag"),o("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),o("1.2.840.113549.1.12.10.1.3","certBag"),o("1.2.840.113549.1.12.10.1.4","crlBag"),o("1.2.840.113549.1.12.10.1.5","secretBag"),o("1.2.840.113549.1.12.10.1.6","safeContentsBag"),o("1.2.840.113549.1.5.13","pkcs5PBES2"),o("1.2.840.113549.1.5.12","pkcs5PBKDF2"),o("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),o("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),o("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),o("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),o("1.2.840.113549.2.7","hmacWithSHA1"),o("1.2.840.113549.2.8","hmacWithSHA224"),o("1.2.840.113549.2.9","hmacWithSHA256"),o("1.2.840.113549.2.10","hmacWithSHA384"),o("1.2.840.113549.2.11","hmacWithSHA512"),o("1.2.840.113549.3.7","des-EDE3-CBC"),o("2.16.840.1.101.3.4.1.2","aes128-CBC"),o("2.16.840.1.101.3.4.1.22","aes192-CBC"),o("2.16.840.1.101.3.4.1.42","aes256-CBC"),o("2.5.4.3","commonName"),o("2.5.4.5","serialName"),o("2.5.4.6","countryName"),o("2.5.4.7","localityName"),o("2.5.4.8","stateOrProvinceName"),o("2.5.4.10","organizationName"),o("2.5.4.11","organizationalUnitName"),o("2.16.840.1.113730.1.1","nsCertType"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),o("2.5.29.14","subjectKeyIdentifier"),o("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),o("2.5.29.17","subjectAltName"),o("2.5.29.18","issuerAltName"),o("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),o("2.5.29.31","cRLDistributionPoints"),o("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),o("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),o("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),o("1.3.6.1.4.1.11129.2.4.2","timestampList"),o("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),o("1.3.6.1.5.5.7.3.1","serverAuth"),o("1.3.6.1.5.5.7.3.2","clientAuth"),o("1.3.6.1.5.5.7.3.3","codeSigning"),o("1.3.6.1.5.5.7.3.4","emailProtection"),o("1.3.6.1.5.5.7.3.8","timeStamping")},function(e,t,r){"use strict";const n=t;n.Reporter=r(843).Reporter,n.DecoderBuffer=r(429).DecoderBuffer,n.EncoderBuffer=r(429).EncoderBuffer,n.Node=r(844)},function(e,t,r){(function(t){e.exports=function e(r,n){for(var i=Math.min(r.length,n.length),o=new t(i),s=0;s{const s=new i(Date.now()+Number(n)).toString(),a=h.ValidityType.EOL;y(e,t,r,s,a,o)},b=(e,t,r,n,i)=>{const o=h.ValidityType.EOL;y(e,t,r,n,o,i)},y=(e,t,r,n,i,o)=>{x(e,t,i,n,(e,s)=>{if(e)return f.error("record signature creation failed"),o(Object.assign(new Error("record signature verification failed"),{code:d.ERR_SIGNATURE_CREATION}));const a={value:t,signature:s,validityType:i,validity:n,sequence:r};return f(`ipns entry for ${t} created`),o(null,a)})},v=(e,t,r)=>{const{value:n,validityType:i,validity:o}=t,s=A(n,i,o);e.verify(s,t.signature,(e,t)=>{if(e||!t)return f.error("record signature verification failed"),r(Object.assign(new Error("record signature verification failed"),{code:d.ERR_SIGNATURE_VERIFICATION}));if(i===h.ValidityType.EOL){let e;try{e=l(o.toString())}catch(e){return f.error("unrecognized validity format (not an rfc3339 format)"),r(Object.assign(new Error("unrecognized validity format (not an rfc3339 format)"),{code:d.ERR_UNRECOGNIZED_FORMAT}))}if(e{if(!e||!e.bytes||!t){const e="one or more of the provided parameters are not defined";return f.error(e),r(Object.assign(new Error(e),{code:d.ERR_UNDEFINED_PARAMETER}))}a.createFromPubKey(e.bytes,(n,i)=>{if(n)return f.error(n),r(Object.assign(new Error(n),{code:d.ERR_PEER_ID_FROM_PUBLIC_KEY}));let o;try{o=I(i)}catch(n){return f.error(n),r(Object.assign(new Error(n),{code:d.ERR_PUBLIC_KEY_FROM_ID}))}if(o)return r(null,null);try{t.pubKey=s.keys.marshalPublicKey(e)}catch(n){return f.error(n),r(n)}r(null,t)})},w=(e,t,r)=>{if(!t||!e){const e="one or more of the provided parameters are not defined";return f.error(e),r(Object.assign(new Error(e),{code:d.ERR_UNDEFINED_PARAMETER}))}if(t.pubKey){let e;try{e=s.keys.unmarshalPublicKey(t.pubKey)}catch(e){return f.error(e),r(e)}return r(null,e)}r(null,e.pubKey)},S=e=>n(e,"RFC4648",{padding:!1}),E=e=>new o(`/ipns/${S(e)}`),k=e=>{const r=t.from("/pk/"),n=t.from("/ipns/");return{routingPubKey:new o(t.concat([r,e])),pkKey:new o(S(t.concat([r,e]))),routingKey:new o(t.concat([n,e])),ipnsKey:new o(S(t.concat([n,e])))}},x=(e,t,r,n,i)=>{const o=A(t,r,n);e.sign(o,(e,t)=>e?i(e):i(null,t))},C=e=>{if("0"===e.toString())return"EOL";{const t=`unrecognized validity type ${e.toString()}`;throw f.error(t),Object.assign(new Error(t),{code:d.ERR_UNRECOGNIZED_VALIDITY})}},A=(e,r,n)=>{const i=t.from(e),o=t.from(C(r)),s=t.from(n);return t.concat([i,s,o])},I=e=>{const t=u.decode(e.id);return t.code!==p?null:s.keys.unmarshalPublicKey(t.digest)},T=h.encode,O=h.decode,R={validate:(e,t,r)=>{const n=O(e),i=t.slice("/ipns/".length);let o;try{o=a.createFromBytes(i)}catch(e){return r(e)}w(o,n,(e,t)=>{if(e)return r(e);v(t,n,e=>{if(e)return r(e);r(null,!0)})})},select:(e,t,r)=>{const n=O(e),i=O(t),o=n.sequence>i.sequence?0:1;if("function"!=typeof r)return o;r(null,o)}};e.exports={create:m,createWithExpiration:b,validate:v,embedPublicKey:_,extractPublicKey:w,getLocalKey:E,getIdKeys:k,marshal:T,unmarshal:O,validator:R,namespace:"/ipns/",namespaceLength:"/ipns/".length}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(24),i=function(){},o=function(e){return e.setHeader&&"function"==typeof e.abort},s=function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length},a=function(e,t,r){if("function"==typeof t)return a(e,null,t);t||(t={}),r=n(r||i);var u=e._writableState,c=e._readableState,f=t.readable||!1!==t.readable&&e.readable,h=t.writable||!1!==t.writable&&e.writable,l=function(){e.writable||d()},d=function(){h=!1,f||r.call(e)},p=function(){f=!1,h||r.call(e)},g=function(t){r.call(e,t?new Error("exited with error code: "+t):null)},m=function(t){r.call(e,t)},b=function(){return(!f||c&&c.ended)&&(!h||u&&u.ended)?void 0:r.call(e,new Error("premature close"))},y=function(){e.req.on("finish",d)};return o(e)?(e.on("complete",d),e.on("abort",b),e.req?y():e.on("request",y)):h&&!u&&(e.on("end",l),e.on("close",l)),s(e)&&e.on("exit",g),e.on("end",p),e.on("finish",d),!1!==t.error&&e.on("error",m),e.on("close",b),function(){e.removeListener("complete",d),e.removeListener("abort",b),e.removeListener("request",y),e.req&&e.req.removeListener("finish",d),e.removeListener("end",l),e.removeListener("close",l),e.removeListener("finish",d),e.removeListener("exit",g),e.removeListener("end",p),e.removeListener("error",m),e.removeListener("close",b)}};e.exports=a},function(e,t,r){const n=r(7).EventEmitter,i=r(27),o=r(1064);function s(e,t){"object"==typeof e&&(t=e,e="START"),i.equal(typeof e,"string"),i.equal(typeof t,"object"),i.ok(t[e],"invalid starting state "+e),i.ok(o.validate(t));const r=new n;return u._graph=o.reachable(t),u._emitter=r,u._events=t,u._state=e,u.emit=u,u.on=s,u;function s(e,t){r.on(e,t)}function u(e){const t=u._events[u._state][e];if(!a(u._state,t,u._graph)){const t="invalid transition: "+u._state+" -> "+e;return r.emit("error",t)}const n=u._state+":leave",i=t+":enter";return u._state?o():s();function o(){r._events[n]?r.emit(n,s):s()}function s(){r._events[i]?r.emit(i,c):c()}function c(){u._state=t,r.emit(t),r.emit("done")}}}function a(e,t,r){if(!t)return!1;if(!e)return!0;const n=r[e];return!(!n||!n[t])&&1===n[t].length}e.exports=s},function(e,t,r){"use strict";const n=r(21),i=r(42),o=r(20),s=r(172);e.exports=function(e){function t(e){let t=null;if(n.isMultiaddr(e)){const r=n(e);t=r.getPeerId()}else i.isPeerInfo(e)&&(t=e.id.toB58String());return t}function r(t){let r;if(i.isPeerInfo(t))r=t;else if(n.isMultiaddr(t)){const n=t.getPeerId();try{r=e._peerBook.get(n)}catch(e){r=new i(o.createFromB58String(n))}r.multiaddrs.add(t)}else if(o.isPeerId(t)){const n=t.toB58String();r=e._peerBook.has(n)?e._peerBook.get(n):t}return r}function a(t){return e.muxedConns[t]||e.conns[t]}function u(e,t,r){return r=r||(()=>{}),e.write(s.CircuitRelay.encode({type:s.CircuitRelay.Type.STATUS,code:t})),r()}function c(e,t,r,i){try{e.dstPeer.addrs.forEach(e=>n(e))}catch(e){return u(t,r===s.CircuitRelay.Type.HOP?s.CircuitRelay.Status.HOP_DST_MULTIADDR_INVALID:s.CircuitRelay.Status.STOP_DST_MULTIADDR_INVALID),i(e)}try{e.srcPeer.addrs.forEach(e=>n(e))}catch(e){return u(t,r===s.CircuitRelay.Type.HOP?s.CircuitRelay.Status.HOP_SRC_MULTIADDR_INVALID:s.CircuitRelay.Status.STOP_SRC_MULTIADDR_INVALID),i(e)}return i(null)}function f(e){return"string"==typeof e?o.createFromB58String(e):o.createFromBytes(e)}return{getB58String:t,peerInfoFromMa:r,isPeerConnected:a,validateAddrs:c,writeResponse:u,peerIdFromId:f}}},function(e,t,r){"use strict";const n=r(60);e.exports=n("\nmessage CircuitRelay {\n\n enum Status {\n SUCCESS = 100;\n HOP_SRC_ADDR_TOO_LONG = 220;\n HOP_DST_ADDR_TOO_LONG = 221;\n HOP_SRC_MULTIADDR_INVALID = 250;\n HOP_DST_MULTIADDR_INVALID = 251;\n HOP_NO_CONN_TO_DST = 260;\n HOP_CANT_DIAL_DST = 261;\n HOP_CANT_OPEN_DST_STREAM = 262;\n HOP_CANT_SPEAK_RELAY = 270;\n HOP_CANT_RELAY_TO_SELF = 280;\n STOP_SRC_ADDR_TOO_LONG = 320;\n STOP_DST_ADDR_TOO_LONG = 321;\n STOP_SRC_MULTIADDR_INVALID = 350;\n STOP_DST_MULTIADDR_INVALID = 351;\n STOP_RELAY_REFUSED = 390;\n MALFORMED_MESSAGE = 400;\n }\n\n enum Type { // RPC identifier, either HOP, STOP or STATUS\n HOP = 1;\n STOP = 2;\n STATUS = 3;\n CAN_HOP = 4;\n }\n\n message Peer {\n required bytes id = 1; // peer id\n repeated bytes addrs = 2; // peer's known addresses\n }\n\n optional Type type = 1; // Type of the message\n\n optional Peer srcPeer = 2; // srcPeer and dstPeer are used when Type is HOP or STATUS\n optional Peer dstPeer = 3;\n\n optional Status code = 4; // Status code, used when Type is STATUS\n}\n")},function(e,t,r){"use strict";const n=r(3),i=r(86),o=r(56),s=r(9),a="ERR_BAD_PATH";function u(e){const t=new Error("invalid ipfs ref path");e=e.replace(/^\/ipfs\//,"");const r=e.match(/([^/]+(?:\/[^/]+)*)\/?$/);if(!r)throw t;const[n,...i]=r[1].split("/");if(o.cid(n))return{hash:n,links:i};throw t}t.OFFLINE_ERROR="This command must be run in online mode. Try running 'ipfs daemon' first.";const c=e=>{if(o.cid(e))return`/ipfs/${e}`;if(o.path(e))return e;throw Object.assign(new Error(`invalid ${e} path`),{code:a})},f=n(function(e,r,n){Array.isArray(r)||(r=[r]),i(r,(r,n)=>{if("string"!=typeof r){let e;try{e=new s(r)}catch(e){return n(e)}return n(null,e.buffer)}let i;try{i=t.parseIpfsPath(r)}catch(e){return n(e)}const o=new s(i.hash),a=i.links;if(!a.length)return n(null,o.buffer);function u(t,r,i,o){if(i)return n(i);if(!r.length)return n(null,t.buffer);const s=r[0],a=o.links.find(e=>e.name===s);if(!a)return n(new Error(`no link named "${s}" under ${t.toBaseEncodedString()}`));e.get(a.cid,u.bind(null,a.cid,r.slice(1)))}e.get(o,u.bind(null,o,a))},n)});t.normalizePath=c,t.parseIpfsPath=u,t.resolvePath=f},function(e,t){function r(e){return"function"==typeof e}function n(e){return"object"==typeof e&&i(e.source)&&o(e.sink)}function i(e){return r(e)&&2===e.length}function o(e){return r(e)&&1===e.length}t.isDuplex=n,t.isSource=i,t.isSink=o},function(e,t,r){var n=r(491);e.exports=function(e,t){return function(r){var i=[],o,s;function a(e){i.push(e)}e=e||function(e){this.queue(e)},t=t||function(){this.queue(null)};var u={emit:function(e,t){"data"==e&&a(t),"end"==e&&(o=!0,a(null)),"error"==e&&(s=t)},queue:a},c;return function(a,f){if(o=o||a,a)return r(a,function(){if(c){var e=c;c=null,e(a)}f(a)});c=f,n(function n(a){if(c)if(f=c,s)c=null,f(s);else if(i.length){var h=i.shift();c=null,f(null===h,h)}else r(o,function(i,h){if(i&&!0!==i)return s=i,a();if(o=o||i)t.call(u);else if(null!==h&&(e.call(u,h),s||o))return r(s||o,function(){c=null,f(s||o)});a(n)})})}}}},function(e,t,r){"use strict";var n=r(82),i=r(98);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=o,o.prototype.update=function e(t,r){if(t=n.toArray(t,r),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var i=t.length%this._delta8;this.pending=t.slice(t.length-i,t.length),0===this.pending.length&&(this.pending=null),t=n.join32(t,0,t.length-i,this.endian);for(var o=0;o>>24&255,i[o++]=t>>>16&255,i[o++]=t>>>8&255,i[o++]=255&t}else for(i[o++]=255&t,i[o++]=t>>>8&255,i[o++]=t>>>16&255,i[o++]=t>>>24&255,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,s=8;st.length)throw new Error("invalid rlp: total length is larger than the data");if(s=t.slice(n,h),0===s.length)throw new Error("invalid rlp, List has a invalid length");for(;s.length;)a=c(s),u.push(a.data),s=a.remainder;return{data:u,remainder:t.slice(h)}}function f(e){return"0x"===e.slice(0,2)}function h(e){return"string"!=typeof e?e:f(e)?e.slice(2):e}function l(e){var t=e.toString(16);return t.length%2?"0"+t:t}function d(e){return e.length%2?"0"+e:e}function p(t){var r=l(t);return e.from(r,"hex")}function g(t){if(!e.isBuffer(t)){if("string"==typeof t)return f(t)?e.from(d(h(t)),"hex"):e.from(t);if("number"==typeof t)return t?p(t):e.from([]);if(null===t||void 0===t)return e.from([]);if(t instanceof Uint8Array)return e.from(t);if(n.isBN(t))return e.from(t.toArray());throw new Error("invalid type")}return t}t.encode=i,t.decode=a,t.getLength=u}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(9),i=r(33);function o(e,t,r){r=r||{};const o=r.hashAlg||"keccak-256",s=void 0===r.version?1:r.version,a=i.encode(t,o);return new n(s,e,a)}e.exports=o},function(e,t,r){"use strict";const n=r(11),i=r(565),o=r(566);function s(e,t,r){const s=o(e,t),a={multicodec:e,defaultHashAlg:"keccak-256",resolve:f,tree:u,isLink:i(f),_resolveFromEthObject:h,_treeFromEthObject:c,_mapFromEthObject:r};return{resolver:a,util:s};function u(e,t,r){"function"==typeof t&&(r=t,t=void 0),t||(t={}),n([t=>s.deserialize(e,t),(e,r)=>c(e,t,r)],r)}function c(e,t,i){n([n=>r(e,t,n),(e,t)=>t(null,e.map(e=>e.path))],i)}function f(e,t,r){n([t=>s.deserialize(e,t),(e,r)=>h(e,t,r)],r)}function h(e,t,n){if(!t||"/"===t){const t={value:e,remainderPath:""};return n(null,t)}r(e,{},(e,r)=>{if(e)return n(e);const i=t.split("/");let o=r.filter(e=>e.path===t.slice(0,e.path.length));o=o.filter(e=>e.path.split("/").every((e,t)=>e===i[t]));const s=o.sort((e,t)=>t.path.length-e.path.length),a=s[0];if(!a){let e=new Error('Path not found ("'+t+'").');return n(e)}const u=t.slice(a.path.length+1),c={value:a.value,remainderPath:u};return n(null,c)})}}e.exports=s},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(246),o=r(0),s=r(50).sha256sha256,a=function e(r){if(!(this instanceof e))return new e(r);if(t.isBuffer(r)){var n=r;this.fromBuffer(n)}else if("string"==typeof r){var i=r;this.fromString(i)}else r&&this.set(r)};a.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this},a.validChecksum=function e(t,r){return n.isString(t)&&(t=new o.Buffer(i.decode(t))),n.isString(r)&&(r=new o.Buffer(i.decode(r))),r||(r=t.slice(-4),t=t.slice(0,-4)),a.checksum(t).toString("hex")===r.toString("hex")},a.decode=function(e){if("string"!=typeof e)throw new Error("Input must be a string");var r=new t(i.decode(e));if(r.length<4)throw new Error("Input string too short");var n=r.slice(0,-4),o=r.slice(-4),a=s(n),u=a.slice(0,4);if(o.toString("hex")!==u.toString("hex"))throw new Error("Checksum mismatch");return n},a.checksum=function(e){return s(e).slice(0,4)},a.encode=function(e){if(!t.isBuffer(e))throw new Error("Input must be a buffer");var r=new t(e.length+4),n=a.checksum(e);return e.copy(r),n.copy(r,e.length),i.encode(r)},a.prototype.fromBuffer=function(e){return this.buf=e,this},a.prototype.fromString=function(e){var t=a.decode(e);return this.buf=t,this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toString=function(){return a.encode(this.buf)},e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(15),i=r(22),o=r(76),s=r(69),a=r(0),u=r(26),c=r(36),f=r(78),h=r(101),l=r(102),d=4294967295,p=d-2,g=d,m=d-1;function b(e){return this instanceof b?e?this._fromObject(e):void 0:new b(e)}b.MAXINT=d,b.DEFAULT_SEQNUMBER=4294967295,b.DEFAULT_LOCKTIME_SEQNUMBER=4294967294,b.DEFAULT_RBF_SEQNUMBER=4294967293,Object.defineProperty(b.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this.isNull()?null:(this._script||(this._script=new f(this._scriptBuffer),this._script._isInput=!0),this._script)}}),b.fromObject=function(e){i.checkArgument(n.isObject(e));var t=new b;return t._fromObject(e)},b.prototype._fromObject=function(e){var t;if(t=n.isString(e.prevTxId)&&c.isHexa(e.prevTxId)?new a.Buffer(e.prevTxId,"hex"):e.prevTxId,this.output=e.output?e.output instanceof l?e.output:new l(e.output):void 0,this.prevTxId=t||e.txidbuf,this.outputIndex=n.isUndefined(e.outputIndex)?e.txoutnum:e.outputIndex,this.sequenceNumber=n.isUndefined(e.sequenceNumber)?n.isUndefined(e.seqnum)?4294967295:e.seqnum:e.sequenceNumber,n.isUndefined(e.script)&&n.isUndefined(e.scriptBuffer))throw new o.Transaction.Input.MissingScript;return this.setScript(e.scriptBuffer||e.script),this},b.prototype.toObject=b.prototype.toJSON=function e(){var t={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(t.scriptString=this.script.toString()),this.output&&(t.output=this.output.toObject()),t},b.fromBufferReader=function(e){var t=new b;return t.prevTxId=e.readReverse(32),t.outputIndex=e.readUInt32LE(),t._scriptBuffer=e.readVarLengthBuffer(),t.sequenceNumber=e.readUInt32LE(),t},b.prototype.toBufferWriter=function(e){e||(e=new s),e.writeReverse(this.prevTxId),e.writeUInt32LE(this.outputIndex);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e.writeUInt32LE(this.sequenceNumber),e},b.prototype.setScript=function(e){if(this._script=null,e instanceof f)this._script=e,this._script._isInput=!0,this._scriptBuffer=e.toBuffer();else if(c.isHexa(e))this._scriptBuffer=new a.Buffer(e,"hex");else if(n.isString(e))this._script=new f(e),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else{if(!u.isBuffer(e))throw new TypeError("Invalid argument type: script");this._scriptBuffer=new a.Buffer(e)}return this},b.prototype.getSignatures=function(){throw new o.AbstractMethodInvoked("Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: "+JSON.stringify(this))},b.prototype.isFullySigned=function(){throw new o.AbstractMethodInvoked("Input#isFullySigned")},b.prototype.isFinal=function(){return 4294967295!==this.sequenceNumber},b.prototype.addSignature=function(){throw new o.AbstractMethodInvoked("Input#addSignature")},b.prototype.clearSignatures=function(){throw new o.AbstractMethodInvoked("Input#clearSignatures")},b.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,h.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script)},b.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},b.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},e.exports=b},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(22),o=r(91),s=r(26),a=r(36),u=r(85),c=r(76),f=r(77);function h(e){if(!(this instanceof h))return new h(e);if(e instanceof h)return e;if(n.isObject(e))return this._fromObject(e);throw new c.InvalidArgument("TransactionSignatures must be instantiated from an object")}o(h,f),h.prototype._fromObject=function(e){return this._checkObjectArgs(e),this.publicKey=new u(e.publicKey),this.prevTxId=s.isBuffer(e.prevTxId)?e.prevTxId:new t(e.prevTxId,"hex"),this.outputIndex=e.outputIndex,this.inputIndex=e.inputIndex,this.signature=e.signature instanceof f?e.signature:s.isBuffer(e.signature)?f.fromBuffer(e.signature):f.fromString(e.signature),this.sigtype=e.sigtype,this},h.prototype._checkObjectArgs=function(e){i.checkArgument(u(e.publicKey),"publicKey"),i.checkArgument(!n.isUndefined(e.inputIndex),"inputIndex"),i.checkArgument(!n.isUndefined(e.outputIndex),"outputIndex"),i.checkState(n.isNumber(e.inputIndex),"inputIndex must be a number"),i.checkState(n.isNumber(e.outputIndex),"outputIndex must be a number"),i.checkArgument(e.signature,"signature"),i.checkArgument(e.prevTxId,"prevTxId"),i.checkState(e.signature instanceof f||s.isBuffer(e.signature)||a.isHexa(e.signature),"signature must be a buffer or hexa value"),i.checkState(s.isBuffer(e.prevTxId)||a.isHexa(e.prevTxId),"prevTxId must be a buffer or hexa value"),i.checkArgument(e.sigtype,"sigtype"),i.checkState(n.isNumber(e.sigtype),"sigtype must be a number")},h.prototype.toObject=h.prototype.toJSON=function e(){return{publicKey:this.publicKey.toString(),prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,inputIndex:this.inputIndex,signature:this.signature.toString(),sigtype:this.sigtype}},h.fromObject=function(e){return i.checkArgument(e),new h(e)},e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){(function(t){var n=r(23).Writable,i=r(1),o=r(250);if("undefined"==typeof Uint8Array)var s=r(1411).Uint8Array;else var s=Uint8Array;function a(e,t){if(!(this instanceof a))return new a(e,t);"function"==typeof e&&(t=e,e={}),e||(e={});var r=e.encoding,i=!1;r?(r=String(r).toLowerCase(),"u8"!==r&&"uint8"!==r||(r="uint8array")):i=!0,n.call(this,{objectMode:!0}),this.encoding=r,this.shouldInferEncoding=i,t&&this.on("finish",function(){t(this.getBody())}),this.body=[]}e.exports=a,i(a,n),a.prototype._write=function(e,t,r){this.body.push(e),r()},a.prototype.inferEncoding=function(e){var r=void 0===e?this.body[0]:e;return t.isBuffer(r)?"buffer":"undefined"!=typeof Uint8Array&&r instanceof Uint8Array?"uint8array":Array.isArray(r)?"array":"string"==typeof r?"string":"[object Object]"===Object.prototype.toString.call(r)?"object":"buffer"},a.prototype.getBody=function(){return this.encoding||0!==this.body.length?(this.shouldInferEncoding&&(this.encoding=this.inferEncoding()),"array"===this.encoding?d(this.body):"string"===this.encoding?h(this.body):"buffer"===this.encoding?l(this.body):"uint8array"===this.encoding?p(this.body):this.body):[]};var u=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)};function c(e){return/Array\]$/.test(Object.prototype.toString.call(e))}function f(e){return"string"==typeof e||c(e)||e&&"function"==typeof e.subarray}function h(e){for(var r=[],n=!1,i=0;ir=>{let h,l=!1,d=!1;r=r?Object.assign({},r,r.qs):{};const p=new u,g=new n({objectMode:!0});g._read=(e=>{}),g._write=((e,t,n)=>{const o=s(n);try{const n=a(e,r).map(e=>Object.assign({headers:c(e)},e));d=!0,i(n,(e,r)=>p.write(e,t,r),e=>{if(d=!1,e)return o(e);l&&p.end(),o()})}catch(e){o(e)}}),g.once("finish",()=>{l||(l=!0,d||p.end())});const m=r.qs||{};m["cid-version"]=f(r,"cid-version","cidVersion"),m["raw-leaves"]=f(r,"raw-leaves","rawLeaves"),m["only-hash"]=f(r,"only-hash","onlyHash"),m["wrap-with-directory"]=f(r,"wrap-with-directory","wrapWithDirectory"),m.hash=f(r,"hash","hashAlg");const b={path:t,qs:m,args:r.args,multipart:!0,multipartBoundary:p._boundary,stream:!0,recursive:!0,progress:r.progress};return p.on("error",e=>{g.emit("error",e)}),h=e(b,(e,t)=>{if(e)return g.emit("error",e);if(!t)return g.push(null);if(!o(t))return g.push(t),void g.push(null);if(t.on("error",e=>g.emit("error",e)),r.converter){t.on("data",e=>{e.Bytes&&r.progress&&r.progress(e.Bytes)});const e=r.converter,n=new e;n.once("end",()=>g.push(null)),n.on("data",e=>g.push(e)),t.pipe(n)}else t.on("data",e=>{e.Bytes&&r.progress&&r.progress(e.Bytes),g.push(e)}),t.once("end",()=>g.push(null))}),h.on("drain",()=>p.emit("drain")),p.pipe(h),g})},function(e,t){e.exports=!1},function(e,t,r){(function(t){function r(e,r){var n,i,o,s=!0;function a(e){function i(){r&&r(e,n),r=null}s?t.nextTick(i):i()}function u(e,t,r){n[e]=r,(0==--i||t)&&a(t)}Array.isArray(e)?(n=[],i=e.length):(o=Object.keys(e),n={},i=o.length),i?o?o.forEach(function(t){e[t](function(e,r){u(t,e,r)})}):e.forEach(function(e,t){e(function(e,r){u(t,e,r)})}):a(null),s=!1}e.exports=r}).call(this,r(2))},function(e,t,r){var n=r(1697),i=new n,o="undefined"!=typeof window?window:self,s=o.crypto||o.msCrypto||{},a=s.subtle||s.webkitSubtle;function u(e){return i.digest(e)}try{a.digest({name:"sha-1"},new Uint8Array).catch(function(){a=!1})}catch(e){a=!1}function c(e,t){a?("string"==typeof e&&(e=f(e)),a.digest({name:"sha-1"},e).then(function e(r){t(h(new Uint8Array(r)))},function r(n){t(u(e))})):setTimeout(t,0,u(e))}function f(e){for(var t=e.length,r=new Uint8Array(t),n=0;n>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")}e.exports=c,e.exports.sync=u},function(e,t,r){const n=r(93);utils={},utils.consolearr=(e=>e&&e.length>0?[e.length+" items inc:",e[e.length-1]]:e),utils.stringfrom=function(e,t={}){try{return"Url"===e.constructor.name?e.href:"string"==typeof e?e:e.toString()}catch(t){throw new n.CodingError(`Unable to turn ${e} into a string ${t.message}`)}},utils.p_timeout=function(e,t,r){let i=null;return Promise.race([new Promise((e,o)=>{i=setTimeout(o,t,new n.TimeoutError(r||`Timed out in ${t}ms`))}),e.then(e=>(clearTimeout(i),e))])},utils.createElement=function(e,t,r){var n=document.createElement(e);for(let e in t){let r="classname"===e.toLowerCase()?"class":e;if("dangerouslySetInnerHTML"===e&&(n.innerHTML=t[e].__html,delete t.dangerouslySetInnerHTML),t.hasOwnProperty(e)){let i=t[e];if(!0===i)n.setAttribute(r,e);else if("object"!=typeof i||Array.isArray(i))!1!==i&&null!=i&&n.setAttribute(r,i.toString());else if(["style"].includes(r))for(let e in i)n[r][e]=i[e];else n[r]=i}}for(let e=2;en.appendChild(null==e.nodeType?document.createTextNode(e.toString()):e)):n.appendChild(null==t.nodeType?document.createTextNode(t.toString()):t))}return n},t=e.exports=utils},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){var n=(0,i.default)(e)?_:w;n(e,(0,y.default)(t),r)};var n=r(160),i=v(n),o=r(261),s=v(o),a=r(355),u=v(a),c=r(195),f=v(c),h=r(58),l=v(h),d=r(192),p=v(d),g=r(125),m=v(g),b=r(39),y=v(b);function v(e){return e&&e.__esModule?e:{default:e}}function _(e,t,r){r=(0,p.default)(r||l.default);var n=0,i=0,o=e.length;function a(e,t){e?r(e):++i!==o&&t!==s.default||r(null)}for(0===o&&r(null);nthis.root.open(T(e)),t=>this.config.set(B(e),t),t=>this.spec.set(P(e),t),e=>this.version.set(x,e)],t)}open(e){this.closed?(S("opening at: %s",this.path),n([e=>this.root.open(T(e)),e=>this._isInitialized(e),e=>this._openLock(this.path,e),(e,t)=>{S("aquired repo.lock"),this.lockfile=e,t()},e=>{S("creating datastore"),this.datastore=d.create("datastore",c.join(this.path,"datastore"),this.options),S("creating blocks");const t=d.create("blocks",c.join(this.path,"blocks"),this.options);y(t,this.options.storageBackendOptions.blocks,e)},(e,t)=>{this.blocks=e,t()},e=>{S("creating keystore"),this.keys=d.create("keys",c.join(this.path,"keys"),this.options),e()},e=>{this.closed=!1,S("all opened"),e()}],t=>{t&&this.lockfile?this._closeLock(r=>{r?S("error removing lock",r):this.lockfile=null,e(t)}):e(t)})):setImmediate(()=>e(new Error("repo is already open")))}_getLocker(){return"string"==typeof this.options.lock?(u(k[this.options.lock],"Unknown lock type: "+this.options.lock),k[this.options.lock]):(u(this.options.lock,"No lock provided"),this.options.lock)}_openLock(e,t){this._locker.lock(e,(e,r)=>{if(e)return t(e,null);u.strictEqual(typeof r.close,"function","Locks must have a close method"),t(null,r)})}_closeLock(e){if(this.lockfile)return this.lockfile.close(e);e()}_isInitialized(e){S("init check"),o({config:e=>this.config.exists(e),spec:e=>this.spec.exists(e),version:e=>this.version.check(x,e)},(t,r)=>{if(S("init",t,r),t&&!r.config)return e(Object.assign(new Error("repo is not initialized yet"),{code:w.ERR_REPO_NOT_INITIALIZED,path:this.path}));e(t)})}close(e){if(this.closed)return e(new Error("repo is already closed"));S("closing at: %s",this.path),i([e=>this.apiAddr.delete(O(e)),e=>{s([this.blocks,this.keys,this.datastore],(e,t)=>e.close(t),e)},e=>{S("unlocking"),this.closed=!0,this._closeLock(e)},e=>{this.lockfile=null,e()}],t=>e(t))}exists(e){this.version.exists(e)}stat(e,t){"function"==typeof e&&(t=e,e={}),e=Object.assign({},{human:!1},e),o({storageMax:e=>this.config.get("Datastore.StorageMax",(t,r)=>{e(null,new h(t?E:r))}),version:e=>this.version.get(e),blocks:e=>this.blocks.query({},(t,r)=>{r=r||[];const n=new h(r.length);let i=new h(0);r.forEach(e=>{i=i.plus(e.value.byteLength).plus(e.key._buf.byteLength)}),e(t,{count:n,size:i})}),datastore:e=>A(this.datastore,e),keys:e=>A(this.keys,e)},(r,n)=>{if(r)return t(r);let i=n.blocks.size.plus(n.datastore).plus(n.keys);e.human&&(i=i.div(1048576)),t(null,{repoPath:this.path,storageMax:n.storageMax,version:n.version,numObjects:n.blocks.count,repoSize:i})})}}function A(e,t){l(e.query({}),l.reduce((e,t)=>e.plus(t.value.byteLength).plus(t.key._buf.byteLength),new h(0),t))}function I(e,t){return r=>{t(r&&!e(r)?r:null)}}function T(e){return I(e=>"Already open"===e.message,e)}function O(e){return I(e=>e&&(e.code===w.ERR_REPO_NOT_INITIALIZED||e.message.startsWith("ENOENT")),e)}function R(e){const t=Object.assign({},v,e);return t.storageBackends=Object.assign({},v.storageBackends,t.storageBackends),t.storageBackendOptions=Object.assign({},v.storageBackendOptions,t.storageBackendOptions),t}function B(e){return e.datastore=Object.assign({},_,a(e,"datastore",{})),e}function P(e){const t=Object.assign({},_.Spec,a(e,"datastore.Spec",{}));return{type:t.type,mounts:t.mounts.map(e=>({mountpoint:e.mountpoint,type:e.child.type,path:e.child.path,shardFunc:e.child.shardFunc}))}}e.exports=C,e.exports.repoVersion=x,e.exports.errors=w},function(e,t){e.exports=function(){var e,t,r,n,i=function(i,o){e?e(i,o):i?(n=i,r=o):t=o};return i.resolve=function(i){if(e)throw new Error("already resolved");if(e=i,!e)throw new Error("no read cannot resolve!"+e);t&&i(null,t),r&&i(n,r)},i.abort=function(e){i.resolve(function(t,r){r(e||!0)})},i}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var r=(0,s.default)(e);return(0,i.default)(function(e,t){r(e[0],t)},t,1)};var n=r(738),i=a(n),o=r(39),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){"use strict";const n=r(18);class i{constructor(e,t){this.child=e,this.transform=t}open(e){this.child.open(e)}put(e,t,r){this.child.put(this.transform.convert(e),t,r)}get(e,t){this.child.get(this.transform.convert(e),t)}has(e,t){this.child.has(this.transform.convert(e),t)}delete(e,t){this.child.delete(this.transform.convert(e),t)}batch(){const e=this.child.batch();return{put:(t,r)=>{e.put(this.transform.convert(t),r)},delete:t=>{e.delete(this.transform.convert(t))},commit:t=>{e.commit(t)}}}query(e){return n(this.child.query(e),n.map(e=>(e.key=this.transform.invert(e.key),e)))}close(e){this.child.close(e)}}e.exports=i},function(e,t,r){"use strict";e.exports=i;var n=[""," "," "," "," "," "," "," "," "," "];function i(e,t,r){if(e+="",t-=e.length,t<=0)return e;if(r||0===r||(r=" "),r+=""," "===r&&t<10)return n[t]+e;for(var i="";1&t&&(i+=r),t>>=1,t;)r+=r;return i+e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var n=r(58),i=h(n),o=r(94),s=h(o),a=r(125),u=h(a),c=r(39),f=h(c);function h(e){return e&&e.__esModule?e:{default:e}}function l(e,t,r){r=(0,u.default)(r||i.default);var n=(0,f.default)(t);if(!e())return r(null);var o=function(t){if(t)return r(t);if(e())return n(o);var i=(0,s.default)(arguments,1);r.apply(null,[null].concat(i))};n(o)}e.exports=t.default},function(e,t,r){"use strict";(function(t){const n=r(18),i=r(760),o=r(28).utils.asyncFilter,s=r(28).utils.asyncSort,a=r(28).Key,u=r(28).Errors,c=r(773);class f{constructor(e,t){let n;t&&t.db?(n=t.db,delete t.db):n=r(778),this.db=i(c(n(e),{valueEncoding:"binary"}),Object.assign({},t,{compression:!1}),e=>{if(e)throw e})}open(e){this.db.open(t=>{if(t)return e(u.dbOpenFailedError(t));e()})}put(e,t,r){this.db.put(e.toString(),t,e=>{if(e)return r(u.dbWriteFailedError(e));r()})}get(e,t){this.db.get(e.toString(),(e,r)=>{if(e)return t(u.notFoundError(e));t(null,r)})}has(e,t){this.db.get(e.toString(),(e,r)=>{if(e)return e.notFound?void t(null,!1):void t(e);t(null,!0)})}delete(e,t){this.db.del(e.toString(),e=>{if(e)return t(u.dbDeleteFailedError(e));t()})}close(e){this.db.close(e)}batch(){const e=[];return{put:(t,r)=>{e.push({type:"put",key:t.toString(),value:r})},delete:t=>{e.push({type:"del",key:t.toString()})},commit:t=>{this.db.batch(e,t)}}}query(e){let r=!0;null!=e.keysOnly&&(r=!e.keysOnly);const i=this.db.db.iterator({keys:!0,values:r,keyAsBuffer:!0}),u=(e,n)=>{if(e)return i.end(t=>{n(t||e)});i.next((e,o,s)=>{if(e)return n(e);if(null==e&&null==o&&null==s)return i.end(e=>{n(e||!0)});const u={key:new a(o,!1)};r&&(u.value=t.from(s)),n(null,u)})};let c=[u],f=[];if(null!=e.prefix){const t=e.prefix;f.push((e,r)=>r(null,e.key.toString().startsWith(t)))}if(null!=e.filters&&(f=f.concat(e.filters)),c=c.concat(f.map(e=>o(e))),null!=e.orders&&(c=c.concat(e.orders.map(e=>s(e)))),null!=e.offset){let t=0;c.push(n.filter(()=>t++>=e.offset))}return null!=e.limit&&c.push(n.take(e.limit)),n.apply(null,c)}}e.exports=f}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(54);t.MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7},t.TAG={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,REGEXP:35,MIME:36},t.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31},t.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23},t.SYMS={NULL:Symbol("null"),UNDEFINED:Symbol("undef"),PARENT:Symbol("parent"),BREAK:Symbol("break"),STREAM:Symbol("stream")},t.SHIFT32=Math.pow(2,32),t.SHIFT16=Math.pow(2,16),t.MAX_SAFE_HIGH=2097151,t.NEG_ONE=new n(-1),t.TEN=new n(10),t.TWO=new n(2),t.PARENT={ARRAY:0,OBJECT:1,MAP:2,TAG:3,BYTE_STRING:4,UTF8_STRING:5}},function(e,t,r){"use strict";(function(n){const i=r(27),o=r(51);class s{constructor(e,t,r){0!==r&&i(r,"A DAGNode requires it's serialized size"),this._data=e||n.alloc(0),this._links=t||[],this._serializedSize=r}toJSON(){return this._json||(this._json=Object.freeze({data:this.data,links:this.links.map(e=>e.toJSON()),size:this.size})),Object.assign({},this._json)}toString(){return`DAGNode `}get data(){return this._data}set data(e){throw new Error("Can't set property: 'data' is immutable")}get links(){return this._links}set links(e){throw new Error("Can't set property: 'links' is immutable")}get size(){return void 0===this._size&&(this._size=this.links.reduce((e,t)=>e+t.size,this._serializedSize)),this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}}t=e.exports=o(s,{className:"DAGNode",symbolName:"@ipld/js-ipld-dag-pb/dagnode"}),t.create=r(207),t.clone=r(824),t.addLink=r(825),t.rmLink=r(826)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(810),{serialize:i}=r(208),o=r(209),s=o.linkSort,a=r(206),u=r(105);function c(e,r,o){if("function"==typeof e?(o=e,e=void 0):"string"==typeof e&&(e=t.from(e)),"function"==typeof r&&(o=r,r=[]),!t.isBuffer(e))return o(new Error("Passed 'data' is not a buffer or a string!"));r=r.map(e=>u.isDAGLink(e)?e:u.util.createDagLinkFromB58EncodedHash(e)),r=n(r,s),i({data:e,links:r},(t,n)=>{if(t)return o(t);o(null,new a(e,r,n.length))})}e.exports=c}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(9),o=r(60),s=o(r(821)),a=r(422),u=r(105),c=r(206),f=r(48),h=r(11);function l(e,t,r){"function"==typeof t&&(r=t,t={}),t=t||{};const o=t.hashAlg||a.defaultHashAlg;let s=t.version;void 0===s&&(s="sha2-256"===o?0:1),h([t=>{if(n.isBuffer(e))return t(null,e);d(e,t)},(e,t)=>f(e,o,t),(e,t)=>t(null,new i(s,a.multicodec,e))],r)}function d(e,t){let r,{data:n,links:i=[]}=e;!c.isDAGNode(e)&&i&&(i=i.map(e=>u.isDAGLink(e)?e:u.util.createDagLinkFromB58EncodedHash(e)));try{r=s.PBNode.encode(g({data:n,links:i}))}catch(e){return t(e)}t(null,r)}function p(e,t){const r=s.PBNode.decode(e),i=r.Links.map(e=>new u(e.Name,e.Tsize,e.Hash)),o=null==r.Data?n.alloc(0):r.Data;setImmediate(()=>t(null,new c(o,i,e.length)))}function g(e){const t={};return e.data&&e.data.length>0?t.Data=e.data:t.Data=null,e.links&&e.links.length>0?t.Links=e.links.map(e=>({Hash:e.cid.buffer,Name:e.name,Tsize:e.size})):t.Links=null,t}t=e.exports,t.serialize=d,t.deserialize=p,t.cid=l}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(105),{cid:o}=r(208);function s(e){let t;return e.data&&e.data.length>0?(t=n.alloc(e.data.length),e.data.copy(t)):t=n.alloc(0),t}function a(e){return e.links.slice()}function u(e,t){return n.compare(e.nameAsBuffer,t.nameAsBuffer)}function c(e,t,r){"function"==typeof t&&(r=t,t={}),o(e,t,(n,o)=>{if(n)return r(n);r(null,new i(t.name||"",e.size,o))})}t=e.exports,t.cloneData=s,t.cloneLinks=a,t.linkSort=u,t.toDAGLink=c}).call(this,r(0).Buffer)},function(e,t,r){var n=r(16);function i(e,t){var r=function(){return new n.aes.Algorithm(e,t)};n.cipher.registerAlgorithm(e,r)}r(425),r(426),r(29),e.exports=n.aes=n.aes||{},n.aes.startEncrypting=function(e,t,r,n){var i=g({key:e,output:r,decrypt:!1,mode:n});return i.start(t),i},n.aes.createEncryptionCipher=function(e,t){return g({key:e,output:null,decrypt:!1,mode:t})},n.aes.startDecrypting=function(e,t,r,n){var i=g({key:e,output:r,decrypt:!0,mode:n});return i.start(t),i},n.aes.createDecryptionCipher=function(e,t){return g({key:e,output:null,decrypt:!0,mode:t})},n.aes.Algorithm=function(e,t){o||l();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return p(r._w,e,t,!1)},decrypt:function(e,t){return p(r._w,e,t,!0)}}}),r._init=!1},n.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t=e.key,r;if("string"!=typeof t||16!==t.length&&24!==t.length&&32!==t.length){if(n.util.isArray(t)&&(16===t.length||24===t.length||32===t.length)){r=t,t=n.util.createBuffer();for(var i=0;i>>=2;for(var i=0;i>8^255&d^99,a[r]=d,u[d]=r,p=e[d],i=e[r],s=e[i],l=e[s],g=p<<24^d<<16^d<<8^d^p,m=(i^s^l)<<24^(r^l)<<16^(r^s^l)<<8^r^i^l;for(var b=0;b<4;++b)f[b][r]=g,h[b][d]=m,g=g<<24|g>>>8,m=m<<24|m>>>8;0===r?r=n=1:(r=i^e[e[e[i^l]]],n^=e[e[n]])}}function d(e,t){for(var r=e.slice(0),n,i=1,o=r.length,u=o+6+1,f=s*u,l=o;l>>16&255]<<24^a[n>>>8&255]<<16^a[255&n]<<8^a[n>>>24]^c[i]<<24,i++):o>6&&l%o==4&&(n=a[n>>>24]<<24^a[n>>>16&255]<<16^a[n>>>8&255]<<8^a[255&n]),r[l]=r[l-o]^n;if(t){var d,p=h[0],g=h[1],m=h[2],b=h[3],y=r.slice(0);f=r.length;for(var l=0,v=f-s;l>>24]]^g[a[d>>>16&255]]^m[a[d>>>8&255]]^b[a[255&d]];r=y}return r}function p(e,t,r,n){var i=e.length/4-1,o,s,c,l,d,p,g,m,b,y,v,_;n?(o=h[0],s=h[1],c=h[2],l=h[3],d=u):(o=f[0],s=f[1],c=f[2],l=f[3],d=a),p=t[0]^e[0],g=t[n?3:1]^e[1],m=t[2]^e[2],b=t[n?1:3]^e[3];for(var w=3,S=1;S>>24]^s[g>>>16&255]^c[m>>>8&255]^l[255&b]^e[++w],v=o[g>>>24]^s[m>>>16&255]^c[b>>>8&255]^l[255&p]^e[++w],_=o[m>>>24]^s[b>>>16&255]^c[p>>>8&255]^l[255&g]^e[++w],b=o[b>>>24]^s[p>>>16&255]^c[g>>>8&255]^l[255&m]^e[++w],p=y,g=v,m=_;r[0]=d[p>>>24]<<24^d[g>>>16&255]<<16^d[m>>>8&255]<<8^d[255&b]^e[++w],r[n?3:1]=d[g>>>24]<<24^d[m>>>16&255]<<16^d[b>>>8&255]<<8^d[255&p]^e[++w],r[2]=d[m>>>24]<<24^d[b>>>16&255]<<16^d[p>>>8&255]<<8^d[255&g]^e[++w],r[n?1:3]=d[b>>>24]<<24^d[p>>>16&255]<<16^d[g>>>8&255]<<8^d[255&m]^e[++w]}function g(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),r="AES-"+t,i;i=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key);var o=i.start;return i.start=function(e,t){var r=null;t instanceof n.util.ByteBuffer&&(r=t,t={}),t=t||{},t.output=r,t.iv=e,o.call(i,t)},i}},function(e,t,r){"use strict";var n=r(4).Buffer,i=r(869),o;function s(){this.negative=0,this.words=null,this.length=0}s.fromNumber=function(e){var t=new s;return t.words=[67108863&e],t.length=1,t},s.fromBuffer=function(e){var t=new s;return t.words=new Array(10),t.words[0]=(3&e[28])<<24|e[29]<<16|e[30]<<8|e[31],t.words[1]=(15&e[25])<<22|e[26]<<14|e[27]<<6|e[28]>>>2,t.words[2]=(63&e[22])<<20|e[23]<<12|e[24]<<4|e[25]>>>4,t.words[3]=(255&e[19])<<18|e[20]<<10|e[21]<<2|e[22]>>>6,t.words[4]=(3&e[15])<<24|e[16]<<16|e[17]<<8|e[18],t.words[5]=(15&e[12])<<22|e[13]<<14|e[14]<<6|e[15]>>>2,t.words[6]=(63&e[9])<<20|e[10]<<12|e[11]<<4|e[12]>>>4,t.words[7]=(255&e[6])<<18|e[7]<<10|e[8]<<2|e[9]>>>6,t.words[8]=(3&e[2])<<24|e[3]<<16|e[4]<<8|e[5],t.words[9]=e[0]<<14|e[1]<<6|e[2]>>>2,t.length=10,t.strip()},s.prototype.toBuffer=function(){for(var e=this.words,t=this.length;t<10;++t)e[t]=0;return n.from([e[9]>>>14&255,e[9]>>>6&255,(63&e[9])<<2|e[8]>>>24&3,e[8]>>>16&255,e[8]>>>8&255,255&e[8],e[7]>>>18&255,e[7]>>>10&255,e[7]>>>2&255,(3&e[7])<<6|e[6]>>>20&63,e[6]>>>12&255,e[6]>>>4&255,(15&e[6])<<4|e[5]>>>22&15,e[5]>>>14&255,e[5]>>>6&255,(63&e[5])<<2|e[4]>>>24&3,e[4]>>>16&255,e[4]>>>8&255,255&e[4],e[3]>>>18&255,e[3]>>>10&255,e[3]>>>2&255,(3&e[3])<<6|e[2]>>>20&63,e[2]>>>12&255,e[2]>>>4&255,(15&e[2])<<4|e[1]>>>22&15,e[1]>>>14&255,e[1]>>>6&255,(63&e[1])<<2|e[0]>>>24&3,e[0]>>>16&255,e[0]>>>8&255,255&e[0]])},s.prototype.clone=function(){var e=new s;e.words=new Array(this.length);for(var t=0;t1&&0==(0|this.words[this.length-1]);)this.length--;return this},s.prototype.normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.isEven=function(){return 0==(1&this.words[0])},s.prototype.isOdd=function(){return 1==(1&this.words[0])},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.ucmp=function(e){if(this.length!==e.length)return this.length>e.length?1:-1;for(var t=this.length-1;t>=0;--t)if(this.words[t]!==e.words[t])return this.words[t]>e.words[t]?1:-1;return 0},s.prototype.gtOne=function(){return this.length>1||this.words[0]>1},s.prototype.isOverflow=function(){return this.ucmp(s.n)>=0},s.prototype.isHigh=function(){return 1===this.ucmp(s.nh)},s.prototype.bitLengthGT256=function(){return this.length>10||10===this.length&&this.words[9]>4194303},s.prototype.iuaddn=function(e){this.words[0]+=e;for(var t=0;this.words[t]>67108863&&te.length?(t=this,r=e):(t=e,r=this);for(var n=0,i=0;n>>26}for(;0!==i&&n>>26;if(this.length=t.length,0!==i)this.words[this.length++]=i;else if(t!==this)for(;n0?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;i>26,this.words[i]=67108863&s}for(;0!==o&&i>26,this.words[i]=67108863&s;if(0===o&&i>>26,f=67108863&s,h=Math.max(0,a-e.length+1),l=Math.min(a,t.length-1);h<=l;h++){var d=a-h,p=e.words[d],g=t.words[h],m=p*g+f;c+=m/67108864|0,f=67108863&m}r.words[a]=f,s=c}return 0!==s&&(r.words[r.length++]=s),r.strip()},s.umulTo10x10=Math.imul?i.umulTo10x10:s.umulTo,s.umulnTo=function(e,t,r){if(0===t)return r.words=[0],r.length=1,r;for(var n=0,i=0;n0?(r.words[n]=i,r.length=e.length+1):r.length=e.length,r},s.prototype.umul=function(e){var t=new s;return t.words=new Array(this.length+e.length),10===this.length&&10===e.length?s.umulTo10x10(this,e,t):1===this.length?s.umulnTo(e,this.words[0],t):1===e.length?s.umulnTo(this,e.words[0],t):s.umulTo(this,e,t)},s.prototype.isplit=function(e){e.length=Math.min(this.length,9);for(var t=0;t>>22,r=n}return r>>>=22,this.words[t-10]=r,0===r&&this.length>10?this.length-=10:this.length-=9,this},s.prototype.fireduce=function(){return this.isOverflow()&&this.isub(s.n),this},s.prototype.ureduce=function(){var e=this.clone().isplit(s.tmp).umul(s.nc).iadd(s.tmp);return e.bitLengthGT256()&&(e=e.isplit(s.tmp).umul(s.nc).iadd(s.tmp),e.bitLengthGT256()&&(e=e.isplit(s.tmp).umul(s.nc).iadd(s.tmp))),e.fireduce()},s.prototype.ishrn=function(e){for(var t=(1<=0;--n){var o=this.words[n];this.words[n]=i<>>e,i=o&t}return this.length>1&&0===this.words[this.length-1]&&(this.length-=1),this},s.prototype.uinvm=function(){for(var e=this.clone(),t=s.n.clone(),r=s.fromNumber(1),n=s.fromNumber(0),i=s.fromNumber(0),o=s.fromNumber(1);e.isEven()&&t.isEven();){for(var a=1,u=1;0==(e.words[0]&u)&&0==(t.words[0]&u)&&a<26;++a,u<<=1);e.ishrn(a),t.ishrn(a)}for(var c=t.clone(),f=e.clone();!e.isZero();){for(var h=0,l=1;0==(e.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(e.ishrn(h);h-- >0;)(r.isOdd()||n.isOdd())&&(r.iadd(c),n.isub(f)),r.ishrn(1),n.ishrn(1);for(var d=0,p=1;0==(t.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(t.ishrn(d);d-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(c),o.isub(f)),i.ishrn(1),o.ishrn(1);e.ucmp(t)>=0?(e.isub(t),r.isub(i),n.isub(o)):(t.isub(e),i.isub(r),o.isub(n))}if(1===i.negative){i.negative=0;var g=i.ureduce();return g.negative^=1,g.normSign().iadd(s.n)}return i.ureduce()},s.prototype.imulK=function(){this.words[this.length]=0,this.words[this.length+1]=0,this.length+=2;for(var e=0,t=0;e0?this.isub(s.p):this.strip(),this},s.prototype.redNeg=function(){return this.isZero()?s.fromNumber(0):s.p.sub(this)},s.prototype.redAdd=function(e){return this.clone().redIAdd(e)},s.prototype.redIAdd=function(e){return this.iadd(e),this.ucmp(s.p)>=0&&this.isub(s.p),this},s.prototype.redIAdd7=function(){return this.iuaddn(7),this.ucmp(s.p)>=0&&this.isub(s.p),this},s.prototype.redSub=function(e){return this.clone().redISub(e)},s.prototype.redISub=function(e){return this.isub(e),0!==this.negative&&this.iadd(s.p),this},s.prototype.redMul=function(e){return this.umul(e).redIReduce()},s.prototype.redSqr=function(){return this.umul(this).redIReduce()},s.prototype.redSqrt=function(){if(this.isZero())return this.clone();for(var e=this.redSqr(),t=e.redSqr(),r=t.redSqr().redMul(t),n=r.redMul(e),i=n.redMul(this),o=i,s=0;s<54;++s)o=o.redSqr().redSqr().redSqr().redSqr().redMul(i);for(o=o.redSqr().redSqr().redSqr().redSqr().redMul(n),s=0;s<5;++s)o=o.redSqr().redSqr().redSqr().redSqr().redMul(i);return o=o.redSqr().redSqr().redSqr().redSqr().redMul(r),o=o.redSqr().redSqr().redSqr().redSqr().redSqr().redSqr().redMul(r),0===o.redSqr().ucmp(this)?o:null},s.prototype.redInvm=function(){for(var e=this.clone(),t=s.p.clone(),r=s.fromNumber(1),n=s.fromNumber(0),i;e.gtOne()&&t.gtOne();){for(var o=0,a=1;0==(e.words[0]&a)&&o<26;++o,a<<=1);if(o>0)for(e.ishrn(o);o-- >0;)r.isOdd()&&r.iadd(s.p),r.ishrn(1);for(var u=0,c=1;0==(t.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(t.ishrn(u);u-- >0;)n.isOdd()&&n.iadd(s.p),n.ishrn(1);e.ucmp(t)>=0?(e.isub(t),r.isub(n)):(t.isub(e),n.isub(r))}return i=1===e.length&&1===e.words[0]?r:n,0!==i.negative&&i.iadd(s.p),0!==i.negative?(i.negative=0,i.redIReduce().redNeg()):i.redIReduce()},s.prototype.getNAF=function(e){for(var t=[],r=1<>1,o=this.clone();!o.isZero();){for(var s=0,a=1;0==(o.words[0]&a)&&s<26;++s,a<<=1)t.push(0);if(0!==s)o.ishrn(s);else{var u=o.words[0]&n;if(u>=i)t.push(i-u),o.iuaddn(u-i).ishrn(1);else if(t.push(u),o.words[0]-=u,!o.isZero()){for(s=e-1;s>0;--s)t.push(0);o.ishrn(e)}}}return t},s.prototype.inspect=function(){if(this.isZero())return"0";for(var e=this.toBuffer().toString("hex"),t=0;"0"===e[t];++t);return e.slice(t)},s.n=s.fromBuffer(n.from("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","hex")),s.nh=s.n.clone().ishrn(1),s.nc=s.fromBuffer(n.from("000000000000000000000000000000014551231950B75FC4402DA1732FC9BEBF","hex")),s.p=s.fromBuffer(n.from("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","hex")),s.psn=s.p.sub(s.n),s.tmp=new s,s.tmp.words=new Array(10),o=s.fromNumber(1),o.words[3]=0,e.exports=s},function(e,t,r){var n=r(4).Buffer;function i(e){n.isBuffer(e)||(e=n.from(e));for(var t=e.length/4|0,r=new Array(t),i=0;i>>24]^s[f>>>16&255]^a[h>>>8&255]^u[255&l]^t[b++],p=o[f>>>24]^s[h>>>16&255]^a[l>>>8&255]^u[255&c]^t[b++],g=o[h>>>24]^s[l>>>16&255]^a[c>>>8&255]^u[255&f]^t[b++],m=o[l>>>24]^s[c>>>16&255]^a[f>>>8&255]^u[255&h]^t[b++],c=d,f=p,h=g,l=m;return d=(n[c>>>24]<<24|n[f>>>16&255]<<16|n[h>>>8&255]<<8|n[255&l])^t[b++],p=(n[f>>>24]<<24|n[h>>>16&255]<<16|n[l>>>8&255]<<8|n[255&c])^t[b++],g=(n[h>>>24]<<24|n[l>>>16&255]<<16|n[c>>>8&255]<<8|n[255&f])^t[b++],m=(n[l>>>24]<<24|n[c>>>16&255]<<16|n[f>>>8&255]<<8|n[255&h])^t[b++],d>>>=0,p>>>=0,g>>>=0,m>>>=0,[d,p,g,m]}var a=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,u=0;u<256;++u){var c=a^a<<1^a<<2^a<<3^a<<4;c=c>>>8^255&c^99,r[s]=c,n[c]=s;var f=e[s],h=e[f],l=e[h],d=257*e[c]^16843008*c;i[0][s]=d<<24|d>>>8,i[1][s]=d<<16|d>>>16,i[2][s]=d<<8|d>>>24,i[3][s]=d,d=16843009*l^65537*h^257*f^16843008*s,o[0][c]=d<<24|d>>>8,o[1][c]=d<<16|d>>>16,o[2][c]=d<<8|d>>>24,o[3][c]=d,0===s?s=a=1:(s=f^e[e[e[l^f]]],a^=e[e[a]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function c(e){this._key=i(e),this._reset()}c.blockSize=16,c.keySize=32,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,n=4*(r+1),i=[],o=0;o>>24,s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s],s^=a[o/t|0]<<24):t>6&&o%t==4&&(s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s]),i[o]=i[o-t]^s}for(var c=[],f=0;f>>24]]^u.INV_SUB_MIX[1][u.SBOX[l>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[l>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&l]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=c},c.prototype.encryptBlockRaw=function(e){return e=i(e),s(e,this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},c.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=n.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},c.prototype.decryptBlock=function(e){e=i(e);var t=e[1];e[1]=e[3],e[3]=t;var r=s(e,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=n.allocUnsafe(16);return o.writeUInt32BE(r[0],0),o.writeUInt32BE(r[3],4),o.writeUInt32BE(r[2],8),o.writeUInt32BE(r[1],12),o},c.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},e.exports.AES=c},function(e,t){function r(e){return e}e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(58),i=a(n),o=r(261),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){return function(r,n,o,a){a=a||i.default;var u=!1,c;r(n,function(r,n,i){o(r,function(n,o){n?i(n):e(o)&&!c?(u=!0,c=t(!0,r),i(null,s.default)):i()})},function(e){e?a(e):a(null,u?c:t(!1))})}}e.exports=t.default},function(e,t,r){"use strict";const n=r(60),i=r(126),o=r(918),s=r(27),a=r(52),u=r(88),c=r(9),f=r(364),h=r(919),l=r(48),d=n(r(920)),p=r(921);class g{constructor(e){this.full=e,this.wantlist=new Map,this.blocks=new Map}get empty(){return 0===this.blocks.size&&0===this.wantlist.size}addEntry(e,t,r){s(e&&c.isCID(e),"must be a valid cid");const n=e.buffer.toString(),i=this.wantlist.get(n);i?(i.priority=t,i.cancel=Boolean(r)):this.wantlist.set(n,new p(e,t,r))}addBlock(e){s(i.isBlock(e),"must be a valid cid");const t=e.cid.buffer.toString();this.blocks.set(t,e)}cancel(e){s(c.isCID(e),"must be a valid cid");const t=e.buffer.toString();this.wantlist.delete(t),this.addEntry(e,0,!0)}serializeToBitswap100(){const e={wantlist:{entries:Array.from(this.wantlist.values()).map(e=>({block:e.cid.buffer,priority:Number(e.priority),cancel:Boolean(e.cancel)}))},blocks:Array.from(this.blocks.values()).map(e=>e.data)};return this.full&&(e.wantlist.full=!0),d.Message.encode(e)}serializeToBitswap110(){const e={wantlist:{entries:Array.from(this.wantlist.values()).map(e=>({block:e.cid.buffer,priority:Number(e.priority),cancel:Boolean(e.cancel)}))},payload:[]};return this.full&&(e.wantlist.full=!0),this.blocks.forEach(t=>{e.payload.push({prefix:t.cid.prefix,data:t.data})}),d.Message.encode(e)}equals(e){const t=(e,t)=>{if(e.equals&&"function"==typeof e.equals)return e.equals(t)};return!(this.full!==e.full||!o(this.wantlist,e.wantlist,t)||!o(this.blocks,e.blocks,t))}get[Symbol.toStringTag](){const e=Array.from(this.wantlist.keys()),t=Array.from(this.blocks.keys());return`BitswapMessage `}}g.deserialize=((e,t)=>{let r;try{r=d.Message.decode(e)}catch(e){return u(()=>t(e))}const n=r.wantlist&&r.wantlist.full||!1,o=new g(n);return r.wantlist&&r.wantlist.entries.forEach(e=>{let r;try{r=new c(e.block)}catch(e){return t(e)}o.addEntry(r,e.priority,e.cancel)}),r.blocks.length>0?a(r.blocks,(e,r)=>{l(e,"sha2-256",(n,s)=>{if(n)return r(n);let a;try{a=new c(s)}catch(n){return t(n)}o.addBlock(new i(e,a)),r()})},e=>{if(e)return t(e);t(null,o)}):r.payload.length>0?a(r.payload,(e,t)=>{if(!e.prefix||!e.data)return u(t);const r=h(e.prefix),n=r[0],s=r[1],a=r[2];l(e.data,a,(r,a)=>{if(r)return t(r);let u;try{u=new c(n,f[s.toString("16")],a)}catch(r){return t(r)}o.addBlock(new i(e.data,u)),t()})},e=>{if(e)return t(e);t(null,o)}):void t(null,o)}),g.Entry=p,e.exports=g},function(e,t,r){"use strict";const{sortBy:n}=r(108),i=r(922);class o{constructor(e){this.set=new Map,this._stats=e}get length(){return this.set.size}add(e,t){const r=e.buffer.toString(),n=this.set.get(r);n?(n.inc(),n.priority=t):(this.set.set(r,new i(e,t)),this._stats&&this._stats.push(null,"wantListSize",1))}remove(e){const t=e.buffer.toString(),r=this.set.get(t);r&&(r.dec(),r.hasRefs()||(this.set.delete(t),this._stats&&this._stats.push(null,"wantListSize",-1)))}removeForce(e){this.set.has(e)&&this.set.delete(e)}forEach(e){return this.set.forEach(e)}entries(){return this.set.entries()}sortedEntries(){return new Map(n(e=>e[1].key,Array.from(this.set.entries())))}contains(e){const t=e.buffer.toString();return this.set.get(t)}}o.Entry=i,e.exports=o},function(e,t,r){var n=r(460);function i(e,t,r){var i=null==e?void 0:n(e,t);return void 0===i?r:i}e.exports=i},function(e,t,r){var n=r(109),i=n(Object,"create");e.exports=i},function(e,t,r){var n=r(947),i=r(948),o=r(949),s=r(950),a=r(951);function u(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),r){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,n)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function u(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e}function c(){try{return window.localStorage}catch(e){}}t=e.exports=r(998),t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:c(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(u())}).call(this,r(2))},function(e,t){t.encode=function(e){var t="";for(var r in e)e.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t},t.decode=function(e){for(var t={},r=e.split("&"),n=0,i=r.length;n=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),r){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,n)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function u(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e}function c(){try{return window.localStorage}catch(e){}}t=e.exports=r(1015),t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:c(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(u())}).call(this,r(2))},function(e,t,r){(function(t){e.exports=h;var n=r(6)("simple-peer"),i=r(1022),o=r(1),s=r(137),a=r(1023),u=65536,c=5e3,f=5e3;function h(e){var t=this;if(!(t instanceof h))return new h(e);if(t._id=s(4).toString("hex").slice(0,7),t._debug("new peer %o",e),e=Object.assign({allowHalfOpen:!1},e),a.Duplex.call(t,e),t.channelName=e.initiator?e.channelName||s(20).toString("hex"):null,t._isChromium="undefined"!=typeof window&&!!window.webkitRTCPeerConnection,t.initiator=e.initiator||!1,t.channelConfig=e.channelConfig||h.channelConfig,t.config=Object.assign({},h.config,e.config),t.constraints=t._transformConstraints(e.constraints||h.constraints),t.offerConstraints=t._transformConstraints(e.offerConstraints||{}),t.answerConstraints=t._transformConstraints(e.answerConstraints||{}),t.sdpTransform=e.sdpTransform||function(e){return e},t.streams=e.streams||(e.stream?[e.stream]:[]),t.trickle=void 0===e.trickle||e.trickle,t.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,t.iceCompleteTimeout=e.iceCompleteTimeout||c,t.destroyed=!1,t.connected=!1,t.remoteAddress=void 0,t.remoteFamily=void 0,t.remotePort=void 0,t.localAddress=void 0,t.localPort=void 0,t._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:i(),!t._wrtc)throw"undefined"==typeof window?p("No WebRTC support: Specify `opts.wrtc` option in this environment","ERR_WEBRTC_SUPPORT"):p("No WebRTC support: Not a supported browser","ERR_WEBRTC_SUPPORT");t._pcReady=!1,t._channelReady=!1,t._iceComplete=!1,t._iceCompleteTimer=null,t._channel=null,t._pendingCandidates=[],t._isNegotiating=!t.initiator,t._batchedNegotiation=!1,t._queuedNegotiation=!1,t._sendersAwaitingStable=[],t._senderMap=new Map,t._firstStable=!0,t._closingInterval=null,t._remoteTracks=[],t._remoteStreams=[],t._chunk=null,t._cb=null,t._interval=null,t._pc=new t._wrtc.RTCPeerConnection(t.config,t.constraints),(t._isChromium||t._wrtc&&t._wrtc.electronDaemon)&&l(t._wrtc.RTCPeerConnection,t._pc),t._isReactNativeWebrtc="number"==typeof t._pc._peerConnectionId,t._pc.oniceconnectionstatechange=function(){t._onIceStateChange()},t._pc.onicegatheringstatechange=function(){t._onIceStateChange()},t._pc.onsignalingstatechange=function(){t._onSignalingStateChange()},t._pc.onicecandidate=function(e){t._onIceCandidate(e)},t.initiator?t._setupData({channel:t._pc.createDataChannel(t.channelName,t.channelConfig)}):t._pc.ondatachannel=function(e){t._setupData(e)},"addTrack"in t._pc&&(t.streams&&t.streams.forEach(function(e){t.addStream(e)}),t._pc.ontrack=function(e){t._onTrack(e)}),t.initiator&&t._needsNegotiation(),t._onFinishBound=function(){t._onFinish()},t.once("finish",t._onFinishBound)}function l(e,t){t.createOffer=function(t){return new Promise((r,n)=>{e.prototype.createOffer.call(this,r,n,t)})},t.createAnswer=function(t){return new Promise((r,n)=>{e.prototype.createAnswer.call(this,r,n,t)})},t.setLocalDescription=function(t){return new Promise((r,n)=>{e.prototype.setLocalDescription.call(this,t,r,n)})},t.setRemoteDescription=function(t){return new Promise((r,n)=>{e.prototype.setRemoteDescription.call(this,t,r,n)})}}function d(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}function p(e,t){var r=new Error(e);return r.code=t,r}function g(){}o(h,a.Duplex),h.WEBRTC_SUPPORT=!!i(),h.config={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:global.stun.twilio.com:3478?transport=udp"}]},h.constraints={},h.channelConfig={},Object.defineProperty(h.prototype,"bufferSize",{get:function(){var e=this;return this._channel&&this._channel.bufferedAmount||0}}),h.prototype.address=function(){var e=this;return{port:this.localPort,family:"IPv4",address:this.localAddress}},h.prototype.signal=function(e){var t=this;if(t.destroyed)throw p("cannot signal after peer is destroyed","ERR_SIGNALING");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}t._debug("signal()"),e.renegotiate&&t.initiator&&(t._debug("got request to renegotiate"),t._needsNegotiation()),e.candidate&&(t._pc.remoteDescription&&t._pc.remoteDescription.type?t._addIceCandidate(e.candidate):t._pendingCandidates.push(e.candidate)),e.sdp&&t._pc.setRemoteDescription(new t._wrtc.RTCSessionDescription(e)).then(function(){t.destroyed||(t._pendingCandidates.forEach(function(e){t._addIceCandidate(e)}),t._pendingCandidates=[],"offer"===t._pc.remoteDescription.type&&t._createAnswer())}).catch(function(e){t.destroy(p(e,"ERR_SET_REMOTE_DESCRIPTION"))}),e.sdp||e.candidate||e.renegotiate||t.destroy(p("signal() called with invalid signal data","ERR_SIGNALING"))},h.prototype._addIceCandidate=function(e){var t=this;try{t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e),g,function(e){t.destroy(p(e,"ERR_ADD_ICE_CANDIDATE"))})}catch(e){t.destroy(p("error adding candidate: "+e.message,"ERR_ADD_ICE_CANDIDATE"))}},h.prototype.send=function(e){var t=this;this._channel.send(e)},h.prototype.addStream=function(e){var t=this;t._debug("addStream()"),e.getTracks().forEach(function(r){t.addTrack(r,e)})},h.prototype.addTrack=function(e,t){var r=this;this._debug("addTrack()");var n=this._pc.addTrack(e,t),i=this._senderMap.get(e)||new Map;i.set(t,n),this._senderMap.set(e,i),this._needsNegotiation()},h.prototype.replaceTrack=async function(e,t,r){var n=this;this._debug("replaceTrack()");var i=this._senderMap.get(e),o=i?i.get(r):null;o||this.destroy(new Error("Cannot replace track that was never added.")),t&&this._senderMap.set(t,i),null!=o.replaceTrack?await o.replaceTrack(t):this.destroy(p("replaceTrack is not supported in this browser","ERR_UNSUPPORTED_REPLACETRACK"))},h.prototype.removeTrack=function(e,t){var r=this;this._debug("removeSender()");var n=this._senderMap.get(e),i=n?n.get(t):null;i||this.destroy(new Error("Cannot remove track that was never added."));try{this._pc.removeTrack(i)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?this._sendersAwaitingStable.push(i):this.destroy(e)}},h.prototype.removeStream=function(e){var t=this;t._debug("removeSenders()"),e.getTracks().forEach(function(r){t.removeTrack(r,e)})},h.prototype._needsNegotiation=function(){var e=this;e._debug("_needsNegotiation"),e._batchedNegotiation||(e._batchedNegotiation=!0,setTimeout(function(){e._batchedNegotiation=!1,e._debug("starting batched negotiation"),e.negotiate()},0))},h.prototype.negotiate=function(){var e=this;this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),this._createOffer()):this._isNegotiating||(this._debug("requesting negotiation from initiator"),this.emit("signal",{renegotiate:!0})),this._isNegotiating=!0},h.prototype.destroy=function(e){var t=this;this._destroy(e,function(){})},h.prototype._destroy=function(e,t){var r=this;if(!this.destroyed){if(this._debug("destroy (error: %s)",e&&(e.message||e)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this.destroyed=!0,this.connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(e){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(e){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,"addTrack"in this._pc&&(this._pc.ontrack=null),this._pc.ondatachannel=null}this._pc=null,this._channel=null,e&&this.emit("error",e),this.emit("close"),t()}},h.prototype._setupData=function(e){var t=this;if(!e.channel)return t.destroy(p("Data channel event is missing `channel` property","ERR_DATA_CHANNEL"));t._channel=e.channel,t._channel.binaryType="arraybuffer","number"==typeof t._channel.bufferedAmountLowThreshold&&(t._channel.bufferedAmountLowThreshold=65536),t.channelName=t._channel.label,t._channel.onmessage=function(e){t._onChannelMessage(e)},t._channel.onbufferedamountlow=function(){t._onChannelBufferedAmountLow()},t._channel.onopen=function(){t._onChannelOpen()},t._channel.onclose=function(){t._onChannelClose()},t._channel.onerror=function(e){t.destroy(p(e,"ERR_DATA_CHANNEL"))};var r=!1;t._closingInterval=setInterval(function(){t._channel&&"closing"===t._channel.readyState?(r&&t._onChannelClose(),r=!0):r=!1},5e3)},h.prototype._read=function(){},h.prototype._write=function(e,t,r){var n=this;if(this.destroyed)return r(p("cannot write after peer is destroyed","ERR_DATA_CHANNEL"));if(this.connected){try{this.send(e)}catch(e){return this.destroy(p(e,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>65536?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=r):r(null)}else this._debug("write before connect"),this._chunk=e,this._cb=r},h.prototype._onFinish=function(){var e=this;function t(){setTimeout(function(){e.destroy()},1e3)}e.destroyed||(e.connected?t():e.once("connect",t))},h.prototype._startIceCompleteTimeout=function(){n("started iceComplete timeout");var e=this;e.destroyed||e._iceCompleteTimer||(e._iceCompleteTimer=setTimeout(function(){e._iceComplete||(e._iceComplete=!0,e.emit("iceTimeout"),e.emit("_iceComplete"))},this.iceCompleteTimeout))},h.prototype._createOffer=function(){var e=this;e.destroyed||e._pc.createOffer(e.offerConstraints).then(function(t){function r(){e._debug("createOffer success"),e.destroyed||(e.trickle||e._iceComplete?i():e.once("_iceComplete",i))}function n(t){e.destroy(p(t,"ERR_SET_LOCAL_DESCRIPTION"))}function i(){if(!e.destroyed){var r=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:r.type,sdp:r.sdp})}}e.destroyed||(e.trickle||e.allowHalfTrickle||(t.sdp=d(t.sdp)),t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t).then(r).catch(n))}).catch(function(t){e.destroy(p(t,"ERR_CREATE_OFFER"))})},h.prototype._createAnswer=function(){var e=this;e.destroyed||e._pc.createAnswer(e.answerConstraints).then(function(t){function r(){e.destroyed||(e.trickle||e._iceComplete?i():e.once("_iceComplete",i))}function n(t){e.destroy(p(t,"ERR_SET_LOCAL_DESCRIPTION"))}function i(){if(!e.destroyed){var r=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:r.type,sdp:r.sdp})}}e.destroyed||(e.trickle||e.allowHalfTrickle||(t.sdp=d(t.sdp)),t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t).then(r).catch(n))}).catch(function(t){e.destroy(p(t,"ERR_CREATE_ANSWER"))})},h.prototype._onIceStateChange=function(){var e=this;if(!this.destroyed){var t=this._pc.iceConnectionState,r=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",t,r),this.emit("iceStateChange",t,r),"connected"!==t&&"completed"!==t||(this._pcReady=!0,this._maybeReady()),"failed"===t&&this.destroy(p("Ice connection failed.","ERR_ICE_CONNECTION_FAILURE")),"closed"===t&&this.destroy(new Error("Ice connection closed."))}},h.prototype.getStats=function(e){var t=this;0===t._pc.getStats.length?t._pc.getStats().then(function(t){var r=[];t.forEach(function(e){r.push(e)}),e(null,r)},function(t){e(t)}):t._isReactNativeWebrtc?t._pc.getStats(null,function(t){var r=[];t.forEach(function(e){r.push(e)}),e(null,r)},function(t){e(t)}):t._pc.getStats.length>0?t._pc.getStats(function(r){if(!t.destroyed){var n=[];r.result().forEach(function(e){var t={};e.names().forEach(function(r){t[r]=e.stat(r)}),t.id=e.id,t.type=e.type,t.timestamp=e.timestamp,n.push(t)}),e(null,n)}},function(t){e(t)}):e(null,[])},h.prototype._maybeReady=function(){var e=this;function t(){e.destroyed||e.getStats(function(r,n){if(!e.destroyed){r&&(n=[]);var i={},o={},s={},a=!1;if(n.forEach(function(e){"remotecandidate"!==e.type&&"remote-candidate"!==e.type||(i[e.id]=e),"localcandidate"!==e.type&&"local-candidate"!==e.type||(o[e.id]=e),"candidatepair"!==e.type&&"candidate-pair"!==e.type||(s[e.id]=e)}),n.forEach(function(e){"transport"===e.type&&e.selectedCandidatePairId&&c(s[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&c(e)}),a||Object.keys(s).length&&!Object.keys(o).length){if(e._connecting=!1,e.connected=!0,e._chunk){try{e.send(e._chunk)}catch(r){return e.destroy(p(r,"ERR_DATA_CHANNEL"))}e._chunk=null,e._debug('sent chunk from "write before connect"');var u=e._cb;e._cb=null,u(null)}"number"!=typeof e._channel.bufferedAmountLowThreshold&&(e._interval=setInterval(function(){e._onInterval()},150),e._interval.unref&&e._interval.unref()),e._debug("connect"),e.emit("connect")}else setTimeout(t,100)}function c(t){a=!0;var r=o[t.localCandidateId];r&&r.ip?(e.localAddress=r.ip,e.localPort=Number(r.port)):r&&r.ipAddress?(e.localAddress=r.ipAddress,e.localPort=Number(r.portNumber)):"string"==typeof t.googLocalAddress&&(r=t.googLocalAddress.split(":"),e.localAddress=r[0],e.localPort=Number(r[1]));var n=i[t.remoteCandidateId];n&&n.ip?(e.remoteAddress=n.ip,e.remotePort=Number(n.port)):n&&n.ipAddress?(e.remoteAddress=n.ipAddress,e.remotePort=Number(n.portNumber)):"string"==typeof t.googRemoteAddress&&(n=t.googRemoteAddress.split(":"),e.remoteAddress=n[0],e.remotePort=Number(n[1])),e.remoteFamily="IPv4",e._debug("connect local: %s:%s remote: %s:%s",e.localAddress,e.localPort,e.remoteAddress,e.remotePort)}})}e._debug("maybeReady pc %s channel %s",e._pcReady,e._channelReady),!e.connected&&!e._connecting&&e._pcReady&&e._channelReady&&(e._connecting=!0,t())},h.prototype._onInterval=function(){var e=this;!this._cb||!this._channel||this._channel.bufferedAmount>65536||this._onChannelBufferedAmountLow()},h.prototype._onSignalingStateChange=function(){var e=this;e.destroyed||("stable"!==e._pc.signalingState||e._firstStable||(e._isNegotiating=!1,e._debug("flushing sender queue",e._sendersAwaitingStable),e._sendersAwaitingStable.forEach(function(t){e._pc.removeTrack(t),e._queuedNegotiation=!0}),e._sendersAwaitingStable=[],e._queuedNegotiation&&(e._debug("flushing negotiation queue"),e._queuedNegotiation=!1,e._needsNegotiation()),e._debug("negotiate"),e.emit("negotiate")),e._firstStable=!1,e._debug("signalingStateChange %s",e._pc.signalingState),e.emit("signalingStateChange",e._pc.signalingState))},h.prototype._onIceCandidate=function(e){var t=this;this.destroyed||(e.candidate&&this.trickle?this.emit("signal",{candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):e.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),e.candidate&&this._startIceCompleteTimeout())},h.prototype._onChannelMessage=function(e){var r=this;if(!this.destroyed){var n=e.data;n instanceof ArrayBuffer&&(n=t.from(n)),this.push(n)}},h.prototype._onChannelBufferedAmountLow=function(){var e=this;if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);var t=this._cb;this._cb=null,t(null)}},h.prototype._onChannelOpen=function(){var e=this;this.connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())},h.prototype._onChannelClose=function(){var e=this;this.destroyed||(this._debug("on channel close"),this.destroy())},h.prototype._onTrack=function(e){var t=this;t.destroyed||e.streams.forEach(function(r){t._debug("on track"),t.emit("track",e.track,r),t._remoteTracks.push({track:e.track,stream:r}),t._remoteStreams.some(function(e){return e.id===r.id})||(t._remoteStreams.push(r),setTimeout(function(){t.emit("stream",r)},0))})},h.prototype.setConstraints=function(e){var t=this;this.initiator?this.offerConstraints=this._transformConstraints(e):this.answerConstraints=this._transformConstraints(e)},h.prototype._debug=function(){var e=this,t=[].slice.call(arguments);t[0]="["+this._id+"] "+t[0],n.apply(null,t)},h.prototype._transformConstraints=function(e){var t=this;if(0===Object.keys(e).length)return e;if((e.mandatory||e.optional)&&!this._isChromium){var r=Object.assign({},e.optional,e.mandatory);return void 0!==r.OfferToReceiveVideo&&(r.offerToReceiveVideo=r.OfferToReceiveVideo,delete r.OfferToReceiveVideo),void 0!==r.OfferToReceiveAudio&&(r.offerToReceiveAudio=r.OfferToReceiveAudio,delete r.OfferToReceiveAudio),r}return e.mandatory||e.optional||!this._isChromium?e:(void 0!==e.offerToReceiveVideo&&(e.OfferToReceiveVideo=e.offerToReceiveVideo,delete e.offerToReceiveVideo),void 0!==e.offerToReceiveAudio&&(e.OfferToReceiveAudio=e.offerToReceiveAudio,delete e.offerToReceiveAudio),{mandatory:e})}}).call(this,r(0).Buffer)},function(e,t){var r=function(){};function n(e,t,r){var n=e.length;if(!n)return r(t);function i(){--n||r(t)}e.forEach(function(e){e?e(t,i):i()}),n||i()}e.exports=function(e){return function(t,r){!function i(){t?n(e,t,r):e.length?e[0]?e[0](null,function(t,o){t?(e.shift(),!0===t?i():n(e,t,r)):r(null,o)}):(e.shift(),i()):r(!0)}()}}},function(e,t,r){"use strict";e.exports=function(){var e,t;function r(r){if("function"!=typeof r)throw new Error("read must be function");if(e)throw new Error("already piped");if(e=r,t){var n=t;t=null,e.apply(null,n)}}function n(r,n){e?e(r,n):t=[r,n]}return{source:n,sink:r}}},function(e,t,r){"use strict";t.Listener=t.listener=r(1073),t.Dialer=t.dialer=r(1076),t.matchSemver=r(1077),t.matchExact=r(503)},function(e,t,r){"use strict";(function(n){const i=r(12),o=r(40),s=r(31),a=r(62),u=r(6);function c(){return(~~(1e9*Math.random())).toString(36)}function f(e,t){i(o(n.isBuffer(e)?[e]:[n.from(e)]),a.encode(),s((e,r)=>{if(e)return t(e);t(null,r[0])}))}function h(e){const t=c();function r(e){return r=>{Array.isArray(r)&&(r=r.join(" ")),e("(%s) %s",t,r)}}const n=r(u("mss:"+e));return n.error=r(u("mss:"+e+":error")),n}t=e.exports,t.writeEncoded=((e,t,r)=>{f(t,(t,n)=>{if(t)return r(t);e.write(n)})}),t.log={},t.log.dialer=(()=>h("dialer\t")),t.log.listener=(()=>h("listener\t"))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";t.importer=t.Importer=r(523),t.exporter=t.Exporter=r(111)},function(e,t,r){var n=r(1159);function i(e,t){return(e=e||[]).push(t),e}e.exports=function(e,t,r,o){var s,a,u;function c(i){var f=null,h=!1,l=0;if(u=i,s)return i(!!s.abort||s,function(e){o(e),a&&a()});var d=!1,p=n(function(){d||s||(d=!0,i(null,function(e,n){d=!1,function(e,n){s||(s=e,s?h||o(!0===s?null:s):(f=t(f,n),l=f&&f.length||0,null!=f&&g(),l{let c=a.cidVersion||i,f=a.hashAlg||o,h=a.codec||s;if(t.isBuffer(e)&&(c=1,h="raw"),"sha2-256"!==f&&(c=1),a.onlyHash)return n(e,{version:c,hashAlg:f},(t,r)=>{u(t,{cid:r,node:e})});r.put(e,{version:c,hashAlg:f,format:h},(t,r)=>{u(t,{cid:r,node:e})})};e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(202),i=r(203),o=r(11),s=r(32),a=r(44),u=s.DAGLink,c=s.DAGNode,f=r(48),h=r(311),l=r(234),d=r(1174),p=r(12),g=r(366),m=r(80),b=r(1175),y=function(e){return new Promise((r,n)=>{f(e,"murmur3-128",(e,i)=>{if(e)n(e);else{const e=i.slice(2,10),n=e.length,o=t.alloc(n);for(let t=0;t{e(t.key,t.value,r)}),g(t))}flush(e,t,r,n){S(this._options,this._bucket,e,t,r,(e,t)=>{if(e)return n(e);this.multihash=t.cid.buffer,this.size=t.node.size,n(null,t)})}}function w(e,t){return new _(e,t)}function S(e,r,s,f,h,d){const p=r._children;let g=0;const m=[];function y(t,r,i){const o=n(r.toString(16).toUpperCase(),2,"0");if(b.isBucket(t))S(e,t,s,f,null,(e,{cid:t,node:r})=>{e?i(e):(m.push(new u(o,r.size,t)),i())});else{const e=t.value,r=o+t.key;m.push(new u(r,e.size,e.multihash)),i()}}function v(n,i){const u=t.from(p.bitField().reverse()),d=new a("hamt-sharded-directory",u);d.fanout=r.tableSize(),d.hashType=e.hashFn.code,o([e=>c.create(d.marshal(),n,e),(t,r)=>l(t,f,e,r),({cid:e,node:t},r)=>{const n={path:s,size:t.size,multihash:e.buffer};h&&h.push(n),r(null,{cid:e,node:t})}],i)}i(()=>g{const t=p.get(g);t?y(t,g,t=>{g++,e(t)}):(g++,e())},e=>{e?d(e):v(m,d)})}e.exports=w,e.exports.hashFn=y}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(9);function i(e){const t={},r=e.split("-");switch(r.length){case 1:t.avgChunkSize=262144;break;case 2:t.avgChunkSize=o(r[1],"avg");break;case 4:t.minChunkSize=o(r[1],"min"),t.avgChunkSize=o(r[2],"avg"),t.maxChunkSize=o(r[3],"max");break;default:throw new Error('Incorrect chunker format (expected "rabin" "rabin-[avg]" or "rabin-[min]-[avg]-[max]"')}return t}function o(e,t){let r=parseInt(e);if(isNaN(r))throw new Error(`Chunker parameter ${t} must be an integer`);return r}t.normalizePath=(t=>e.isBuffer(t)?new n(t).toString():n.isCID(t)?t.toString():(0===t.indexOf("/ipfs/")&&(t=t.substring("/ipfs/".length)),"/"===t.charAt(t.length-1)&&(t=t.substring(0,t.length-1)),t)),t.parseChunkerString=(e=>{if(e){if(e.startsWith("size-")){const t=e.split("-")[1],r=parseInt(t);if(isNaN(r))throw new Error("Chunker parameter size must be an integer");return{chunker:"fixed",chunkerOptions:{maxChunkSize:r}}}if(e.startsWith("rabin"))return{chunker:"rabin",chunkerOptions:i(e)};throw new Error(`Unrecognized chunker option: ${e}`)}return{chunker:"fixed"}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(28).Key,i={file:0,directory:1,"hamt-sharded-directory":1};e.exports={FILE_SEPARATOR:"/",MFS_ROOT_KEY:new n("/local/filesroot"),MAX_CHUNK_SIZE:262144,MAX_LINKS:174,FILE_TYPES:i}},function(e,t,r){"use strict";var n=r(1213),i="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-",o,s,a;function u(){a=!1}function c(e){if(e){if(e!==o){if(e.length!==i.length)throw new Error("Custom alphabet for shortid must be "+i.length+" unique characters. You submitted "+e.length+" characters: "+e);var t=e.split("").filter(function(e,t,r){return t!==r.lastIndexOf(e)});if(t.length)throw new Error("Custom alphabet for shortid must be "+i.length+" unique characters. These characters were not unique: "+t.join(", "));o=e,u()}}else o!==i&&(o=i,u())}function f(e){return c(e),o}function h(e){n.seed(e),s!==e&&(u(),s=e)}function l(){o||c(i);for(var e=o.split(""),t=[],r=n.nextValue(),s;e.length>0;)r=n.nextValue(),s=Math.floor(r*e.length),t.push(e.splice(s,1)[0]);return t.join("")}function d(){return a||(a=l(),a)}function p(e){var t=d();return t[e]}function g(){return o||i}e.exports={get:g,characters:f,seed:h,lookup:p,shuffled:d}},function(e,t,r){"use strict";const n=r(44).unmarshal,{formatCid:i,toMfsPath:o,loadNode:s}=r(74),a=r(11),u=r(12),c=r(31),f=r(80),h=r(111),l=r(9),d=r(6)("ipfs:mfs:stat"),p={hash:!1,size:!1,withLocal:!1,cidBase:"base58btc"};e.exports=(e=>(function t(r,g,m){"function"==typeof g&&(m=g,g={}),g=Object.assign({},p,g),d(`Fetching stats for ${r}`),a([t=>o(e,r,t),({mfsPath:t,depth:o},a)=>{u(h(t,e.ipld,{maxDepth:o}),f((t,r)=>g.hash?r(null,{hash:i(new l(t.hash),g.cidBase)}):g.size?r(null,{size:t.size}):void s(e,{cid:t.hash},(e,t)=>{if(e)return r(e);const{node:o,cid:s}=t,a=n(o.data);let u=o.links.length;"file"===a.type&&(u=a.blockSizes.length),r(null,{hash:i(s,g.cidBase),size:a.fileSize()||0,cumulativeSize:o.size,blocks:u,type:a.type,local:void 0,sizeLocal:void 0,withLocality:!1})})),c((e,t)=>e?a(e):t.length?(d(`Stats for ${r}`,t[0]),a(null,t[0])):a(new Error(`${r} does not exist`))))}],m)}))},function(e,t,r){"use strict";var n=t;n.base=r(1277),n.short=r(1278),n.mont=r(1279),n.edwards=r(1280)},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(1333),o=r(1339),s=r(27),a=r(178),u=r(55),c=r(132),f=r(4).Buffer;Object.assign(t,r(1341)),t.MAX_INTEGER=new u("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new u("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.SHA3_NULL_S=t.KECCAK256_NULL_S,t.KECCAK256_NULL=f.from(t.KECCAK256_NULL_S,"hex"),t.SHA3_NULL=t.KECCAK256_NULL,t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.SHA3_RLP_ARRAY_S=t.KECCAK256_RLP_ARRAY_S,t.KECCAK256_RLP_ARRAY=f.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.SHA3_RLP_ARRAY=t.KECCAK256_RLP_ARRAY,t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.SHA3_RLP_S=t.KECCAK256_RLP_S,t.KECCAK256_RLP=f.from(t.KECCAK256_RLP_S,"hex"),t.SHA3_RLP=t.KECCAK256_RLP,t.BN=u,t.rlp=a,t.secp256k1=o,t.zeros=function(e){return f.allocUnsafe(e).fill(0)},t.zeroAddress=function(){var e=20,r=t.zeros(20);return t.bufferToHex(r)},t.setLengthLeft=t.setLength=function(e,r,n){var i=t.zeros(r);return e=t.toBuffer(e),n?e.length0&&"0"===r.toString();)e=e.slice(1),r=e[0];return e},t.toBuffer=function(e){if(!f.isBuffer(e))if(Array.isArray(e))e=f.from(e);else if("string"==typeof e)e=t.isHexString(e)?f.from(t.padToEven(t.stripHexPrefix(e)),"hex"):f.from(e);else if("number"==typeof e)e=t.intToBuffer(e);else if(null===e||void 0===e)e=f.allocUnsafe(0);else if(u.isBN(e))e=e.toArrayLike(f);else{if(!e.toArray)throw new Error("invalid type");e=f.from(e.toArray())}return e},t.bufferToInt=function(e){return new u(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return e=t.toBuffer(e),"0x"+e.toString("hex")},t.fromSigned=function(e){return new u(e).fromTwos(256)},t.toUnsigned=function(e){return f.from(e.toTwos(256).toArray())},t.keccak=function(e,r){return e=t.toBuffer(e),r||(r=256),i("keccak"+r).update(e).digest()},t.keccak256=function(e){return t.keccak(e)},t.sha3=t.keccak,t.sha256=function(e){return e=t.toBuffer(e),c("sha256").update(e).digest()},t.ripemd160=function(e,r){e=t.toBuffer(e);var n=c("rmd160").update(e).digest();return!0===r?t.setLength(n,32):n},t.rlphash=function(e){return t.keccak(a.encode(e))},t.isValidPrivate=function(e){return o.privateKeyVerify(e)},t.isValidPublic=function(e,t){return 64===e.length?o.publicKeyVerify(f.concat([f.from([4]),e])):!!t&&o.publicKeyVerify(e)},t.pubToAddress=t.publicToAddress=function(e,r){return e=t.toBuffer(e),r&&64!==e.length&&(e=o.publicKeyConvert(e,!1).slice(1)),s(64===e.length),t.keccak(e).slice(-20)};var h=t.privateToPublic=function(e){return e=t.toBuffer(e),o.publicKeyCreate(e,!1).slice(1)};t.importPublic=function(e){return e=t.toBuffer(e),64!==e.length&&(e=o.publicKeyConvert(e,!1).slice(1)),e},t.ecsign=function(e,t){var r=o.sign(e,t),n={};return n.r=r.signature.slice(0,32),n.s=r.signature.slice(32,64),n.v=r.recovery+27,n},t.hashPersonalMessage=function(e){var r=t.toBuffer("Ethereum Signed Message:\n"+e.length.toString());return t.keccak(f.concat([r,e]))},t.ecrecover=function(e,r,n,i){var s=f.concat([t.setLength(n,32),t.setLength(i,32)],64),a=r-27;if(0!==a&&1!==a)throw new Error("Invalid signature v value");var u=o.recover(e,s,a);return o.publicKeyConvert(u,!1).slice(1)},t.toRpcSig=function(e,r,n){if(27!==e&&28!==e)throw new Error("Invalid recovery id");return t.bufferToHex(f.concat([t.setLengthLeft(r,32),t.setLengthLeft(n,32),t.toBuffer(e-27)]))},t.fromRpcSig=function(e){if(e=t.toBuffer(e),65!==e.length)throw new Error("Invalid signature length");var r=e[64];return r<27&&(r+=27),{v:r,r:e.slice(0,32),s:e.slice(32,64)}},t.privateToAddress=function(e){return t.publicToAddress(h(e))},t.isValidAddress=function(e){return/^0x[0-9a-fA-F]{40}$/.test(e)},t.isZeroAddress=function(e){var r=t.zeroAddress();return r===t.addHexPrefix(e)},t.toChecksumAddress=function(e){e=t.stripHexPrefix(e).toLowerCase();for(var r=t.keccak(e).toString("hex"),n="0x",i=0;i=8?n+=e[i].toUpperCase():n+=e[i];return n},t.isValidChecksumAddress=function(e){return t.isValidAddress(e)&&t.toChecksumAddress(e)===e},t.generateAddress=function(e,r){return e=t.toBuffer(e),r=new u(r),r=r.isZero()?null:f.from(r.toArray()),t.rlphash([e,r]).slice(-20)},t.isPrecompiled=function(e){var r=t.unpad(e);return 1===r.length&&r[0]>=1&&r[0]<=8},t.addHexPrefix=function(e){return"string"!=typeof e?e:t.isHexPrefixed(e)?e:"0x"+e},t.isValidSignature=function(e,t,r,n){var i=new u("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),o=new u("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);return 32===t.length&&32===r.length&&((27===e||28===e)&&(t=new u(t),r=new u(r),!(t.isZero()||t.gt(o)||r.isZero()||r.gt(o))&&(!1!==n||1!==new u(r).cmp(i))))},t.baToJSON=function(e){if(f.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var r=[],n=0;n=i.length,"The field "+r.name+" must not have more "+r.length+" bytes")):r.allowZero&&0===i.length||!r.length||s(r.length===i.length,"The field "+r.name+" must have byte length of "+r.length),e.raw[n]=i}e._fields.push(r.name),Object.defineProperty(e,r.name,{enumerable:!0,configurable:!0,get:i,set:o}),r.default&&(e[r.name]=r.default),r.alias&&Object.defineProperty(e,r.alias,{enumerable:!1,configurable:!0,set:o,get:i})}),i)if("string"==typeof i&&(i=f.from(t.stripHexPrefix(i),"hex")),f.isBuffer(i)&&(i=a.decode(i)),Array.isArray(i)){if(i.length>e._fields.length)throw new Error("wrong number of fields in data");i.forEach(function(r,n){e[e._fields[n]]=t.toBuffer(r)})}else{if("object"!==(void 0===i?"undefined":n(i)))throw new Error("invalid data");var o=Object.keys(i);r.forEach(function(t){-1!==o.indexOf(t.name)&&(e[t.name]=i[t.name]),-1!==o.indexOf(t.alias)&&(e[t.alias]=i[t.alias])})}}},function(e,t,r){"use strict";const n=r(243).SmartBuffer,i=r(362),o=r(1370),s=r(33),a=r(9);t=e.exports,t.SHA1_LENGTH=i.defaultLengths[i.names.sha1],t.find=((e,t)=>{for(let r=0;r{let t=e.match(/^(([^<]+)\s)?\s?<([^>]+)>\s?(\d+\s[+\-\d]+)?$/);return null===t?null:{name:t[2],email:t[3],date:t[4]}}),t.serializePersonLine=(e=>{let t=[];return e.name&&t.push(e.name),t.push("<"+e.email+">"),e.date&&t.push(e.date),t.join(" ")}),t.shaToCid=(e=>{let r=new n;return r.writeUInt8(1),r.writeBuffer(o["git-raw"]),r.writeUInt8(i.names.sha1),r.writeUInt8(t.SHA1_LENGTH),r.writeBuffer(e),r.toBuffer()}),t.cidToSha=(e=>{let t=s.decode(new a(e).multihash);return"sha1"!==t.name?null:t.digest})},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const n=r(1369),i=4096,o="utf8";class s{constructor(t){if(this.length=0,this._encoding=o,this._writeOffset=0,this._readOffset=0,s.isSmartBufferOptions(t))if(t.encoding&&(n.checkEncoding(t.encoding),this._encoding=t.encoding),t.size){if(!(n.isFiniteInteger(t.size)&&t.size>0))throw new Error(n.ERRORS.INVALID_SMARTBUFFER_SIZE);this._buff=e.allocUnsafe(t.size)}else if(t.buff){if(!(t.buff instanceof e))throw new Error(n.ERRORS.INVALID_SMARTBUFFER_BUFFER);this._buff=t.buff,this.length=t.buff.length}else this._buff=e.allocUnsafe(i);else{if(void 0!==t)throw new Error(n.ERRORS.INVALID_SMARTBUFFER_OBJECT);this._buff=e.allocUnsafe(i)}}static fromSize(e,t){return new this({size:e,encoding:t})}static fromBuffer(e,t){return new this({buff:e,encoding:t})}static fromOptions(e){return new this(e)}static isSmartBufferOptions(e){const t=e;return t&&(void 0!==t.encoding||void 0!==t.size||void 0!==t.buff)}readInt8(t){return this._readNumberValue(e.prototype.readInt8,1,t)}readInt16BE(t){return this._readNumberValue(e.prototype.readInt16BE,2,t)}readInt16LE(t){return this._readNumberValue(e.prototype.readInt16LE,2,t)}readInt32BE(t){return this._readNumberValue(e.prototype.readInt32BE,4,t)}readInt32LE(t){return this._readNumberValue(e.prototype.readInt32LE,4,t)}writeInt8(t,r){return this._writeNumberValue(e.prototype.writeInt8,1,t,r),this}insertInt8(t,r){return this._insertNumberValue(e.prototype.writeInt8,1,t,r)}writeInt16BE(t,r){return this._writeNumberValue(e.prototype.writeInt16BE,2,t,r)}insertInt16BE(t,r){return this._insertNumberValue(e.prototype.writeInt16BE,2,t,r)}writeInt16LE(t,r){return this._writeNumberValue(e.prototype.writeInt16LE,2,t,r)}insertInt16LE(t,r){return this._insertNumberValue(e.prototype.writeInt16LE,2,t,r)}writeInt32BE(t,r){return this._writeNumberValue(e.prototype.writeInt32BE,4,t,r)}insertInt32BE(t,r){return this._insertNumberValue(e.prototype.writeInt32BE,4,t,r)}writeInt32LE(t,r){return this._writeNumberValue(e.prototype.writeInt32LE,4,t,r)}insertInt32LE(t,r){return this._insertNumberValue(e.prototype.writeInt32LE,4,t,r)}readUInt8(t){return this._readNumberValue(e.prototype.readUInt8,1,t)}readUInt16BE(t){return this._readNumberValue(e.prototype.readUInt16BE,2,t)}readUInt16LE(t){return this._readNumberValue(e.prototype.readUInt16LE,2,t)}readUInt32BE(t){return this._readNumberValue(e.prototype.readUInt32BE,4,t)}readUInt32LE(t){return this._readNumberValue(e.prototype.readUInt32LE,4,t)}writeUInt8(t,r){return this._writeNumberValue(e.prototype.writeUInt8,1,t,r)}insertUInt8(t,r){return this._insertNumberValue(e.prototype.writeUInt8,1,t,r)}writeUInt16BE(t,r){return this._writeNumberValue(e.prototype.writeUInt16BE,2,t,r)}insertUInt16BE(t,r){return this._insertNumberValue(e.prototype.writeUInt16BE,2,t,r)}writeUInt16LE(t,r){return this._writeNumberValue(e.prototype.writeUInt16LE,2,t,r)}insertUInt16LE(t,r){return this._insertNumberValue(e.prototype.writeUInt16LE,2,t,r)}writeUInt32BE(t,r){return this._writeNumberValue(e.prototype.writeUInt32BE,4,t,r)}insertUInt32BE(t,r){return this._insertNumberValue(e.prototype.writeUInt32BE,4,t,r)}writeUInt32LE(t,r){return this._writeNumberValue(e.prototype.writeUInt32LE,4,t,r)}insertUInt32LE(t,r){return this._insertNumberValue(e.prototype.writeUInt32LE,4,t,r)}readFloatBE(t){return this._readNumberValue(e.prototype.readFloatBE,4,t)}readFloatLE(t){return this._readNumberValue(e.prototype.readFloatLE,4,t)}writeFloatBE(t,r){return this._writeNumberValue(e.prototype.writeFloatBE,4,t,r)}insertFloatBE(t,r){return this._insertNumberValue(e.prototype.writeFloatBE,4,t,r)}writeFloatLE(t,r){return this._writeNumberValue(e.prototype.writeFloatLE,4,t,r)}insertFloatLE(t,r){return this._insertNumberValue(e.prototype.writeFloatLE,4,t,r)}readDoubleBE(t){return this._readNumberValue(e.prototype.readDoubleBE,8,t)}readDoubleLE(t){return this._readNumberValue(e.prototype.readDoubleLE,8,t)}writeDoubleBE(t,r){return this._writeNumberValue(e.prototype.writeDoubleBE,8,t,r)}insertDoubleBE(t,r){return this._insertNumberValue(e.prototype.writeDoubleBE,8,t,r)}writeDoubleLE(t,r){return this._writeNumberValue(e.prototype.writeDoubleLE,8,t,r)}insertDoubleLE(t,r){return this._insertNumberValue(e.prototype.writeDoubleLE,8,t,r)}readString(e,t){let r;"number"==typeof e?(n.checkLengthValue(e),r=Math.min(e,this.length-this._readOffset)):(t=e,r=this.length-this._readOffset),void 0!==t&&n.checkEncoding(t);const i=this._buff.slice(this._readOffset,this._readOffset+r).toString(t||this._encoding);return this._readOffset+=r,i}insertString(e,t,r){return n.checkOffsetValue(t),this._handleString(e,!0,t,r)}writeString(e,t,r){return this._handleString(e,!1,t,r)}readStringNT(e){void 0!==e&&n.checkEncoding(e);let t=this.length;for(let e=this._readOffset;ethis.length)throw new Error(n.ERRORS.INVALID_READ_BEYOND_BOUNDS)}ensureInsertable(e,t){n.checkOffsetValue(t),this._ensureCapacity(this.length+e),tthis.length?this.length=t+e:this.length+=e}_ensureWriteable(e,t){const r="number"==typeof t?t:this._writeOffset;this._ensureCapacity(r+e),r+e>this.length&&(this.length=r+e)}_ensureCapacity(t){const r=this._buff.length;if(t>r){let n=this._buff,i=3*r/2+1;i"},e.exports=d}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(575),o=r(0),s="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".split(""),a=function e(r){if(!(this instanceof e))return new e(r);if(t.isBuffer(r)){var n=r;this.fromBuffer(n)}else if("string"==typeof r){var i=r;this.fromString(i)}else r&&this.set(r)};a.validCharacters=function e(t){return o.Buffer.isBuffer(t)&&(t=t.toString()),n.all(n.map(t,function(e){return n.contains(s,e)}))},a.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this},a.encode=function(e){if(!o.Buffer.isBuffer(e))throw new Error("Input should be a buffer");return i.encode(e)},a.decode=function(e){if("string"!=typeof e)throw new Error("Input should be a string");return new t(i.decode(e))},a.prototype.fromBuffer=function(e){return this.buf=e,this},a.prototype.fromString=function(e){var t=a.decode(e);return this.buf=t,this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toString=function(){return a.encode(this.buf)},e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){e.exports=r(329),e.exports.Input=r(330),e.exports.Output=r(102),e.exports.UnspentOutput=r(577),e.exports.Signature=r(183),e.exports.Sighash=r(101)},function(e,t,r){"use strict";(function(t,n){function i(){}i.getRandomBuffer=function(e){return t.browser?i.getRandomBufferBrowser(e):i.getRandomBufferNode(e)},i.getRandomBufferNode=function(e){var t=r(115);return t.randomBytes(e)},i.getRandomBufferBrowser=function(e){if(!window.crypto&&!window.msCrypto)throw new Error("window.crypto not available");if(window.crypto&&window.crypto.getRandomValues)var t=window.crypto;else{if(!window.msCrypto||!window.msCrypto.getRandomValues)throw new Error("window.crypto.getRandomValues not available");var t=window.msCrypto}var r=new Uint8Array(e);t.getRandomValues(r);var i=new n(r);return i},i.getPseudoRandomBuffer=function(e){for(var t=4294967296,r=new n(e),i,o=0;o<=e;o++){var s=Math.floor(o/4),a=o-4*s;0===a?(i=Math.random()*t,r[o]=255&i):r[o]=255&(i>>>=8)}return r},e.exports=i}).call(this,r(2),r(0).Buffer)},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(45),o=r(26),s=r(100),a=r(69),u=r(50),c=r(36),f=r(22),h=537133055,l=function e(t){if(!(this instanceof e))return new e(t);var r=e._from(t);return this.version=r.version,this.prevHash=r.prevHash,this.merkleRoot=r.merkleRoot,this.reserved=r.reserved,this.time=r.time,this.timestamp=r.time,this.bits=r.bits,this.nonce=r.nonce,this.solution=r.solution,r.hash&&f.checkState(this.hash===r.hash,"Argument object hash property does not match block hash."),this};l._from=function e(t){var r={};if(o.isBuffer(t))r=l._fromBufferReader(s(t));else{if(!n.isObject(t))throw new TypeError("Unrecognized argument for BlockHeader");r=l._fromObject(t)}return r},l._fromObject=function e(r){f.checkArgument(r,"data is required");var i=r.prevHash,s=r.merkleRoot,a=r.reserved,u=r.nonce,c=r.solution;n.isString(r.prevHash)&&(i=o.reverse(new t(r.prevHash,"hex"))),n.isString(r.merkleRoot)&&(s=o.reverse(new t(r.merkleRoot,"hex"))),n.isString(r.reserved)&&(a=o.reverse(new t(r.reserved,"hex"))),n.isString(r.nonce)&&(u=o.reverse(new t(r.nonce,"hex"))),n.isString(r.solution)&&(c=new t(r.solution,"hex"));var h={hash:r.hash,version:r.version,prevHash:i,merkleRoot:s,reserved:a,time:r.time,timestamp:r.time,bits:r.bits,nonce:u,solution:c};return h},l.fromObject=function e(t){var r=l._fromObject(t);return new l(r)},l.fromRawBlock=function e(r){o.isBuffer(r)||(r=new t(r,"binary"));var n=s(r);n.pos=l.Constants.START_OF_HEADER;var i=l._fromBufferReader(n);return new l(i)},l.fromBuffer=function e(t){var r=l._fromBufferReader(s(t));return new l(r)},l.fromString=function e(r){var n=new t(r,"hex");return l.fromBuffer(n)},l._fromBufferReader=function e(t){var r={};r.version=t.readUInt32LE(),r.prevHash=t.read(32),r.merkleRoot=t.read(32),r.reserved=t.read(32),r.time=t.readUInt32LE(),r.bits=t.readUInt32LE(),r.nonce=t.read(32);var n=t.readVarintNum();return r.solution=t.read(n),r},l.fromBufferReader=function e(t){var r=l._fromBufferReader(t);return new l(r)},l.prototype.toObject=l.prototype.toJSON=function e(){return{hash:this.hash,version:this.version,prevHash:o.reverse(this.prevHash).toString("hex"),merkleRoot:o.reverse(this.merkleRoot).toString("hex"),reserved:o.reverse(this.reserved).toString("hex"),time:this.time,bits:this.bits,nonce:o.reverse(this.nonce).toString("hex"),solution:this.solution.toString("hex")}},l.prototype.toBuffer=function e(){return this.toBufferWriter().concat()},l.prototype.toString=function e(){return this.toBuffer().toString("hex")},l.prototype.toBufferWriter=function e(t){return t||(t=new a),t.writeUInt32LE(this.version),t.write(this.prevHash),t.write(this.merkleRoot),t.write(this.reserved),t.writeUInt32LE(this.time),t.writeUInt32LE(this.bits),t.write(this.nonce),t.writeVarintNum(this.solution.length),t.write(this.solution),t},l.prototype.getTargetDifficulty=function e(t){t=t||this.bits;for(var r=new i(16777215&t),n=8*((t>>>24)-3);n-- >0;)r=r.mul(new i(2));return r},l.prototype.getDifficulty=function e(){var t=this.getTargetDifficulty(537133055).mul(new i(Math.pow(10,8))),r=this.getTargetDifficulty(),n=t.div(r).toString(10),o=n.length-8;return n=n.slice(0,o)+"."+n.slice(o),parseFloat(n)},l.prototype._getHash=function e(){var t=this.toBuffer();return u.sha256sha256(t)};var d={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=s(this._getHash()).readReverse().toString("hex")),this._id},set:n.noop};Object.defineProperty(l.prototype,"id",d),Object.defineProperty(l.prototype,"hash",d),l.prototype.validTimestamp=function e(){var t=Math.round((new Date).getTime()/1e3);return!(this.time>t+l.Constants.MAX_TIME_OFFSET)},l.prototype.validProofOfWork=function e(){var t=new i(this.id,"hex"),r=this.getTargetDifficulty();return!(t.cmp(r)>0)},l.prototype.inspect=function e(){return""},l.Constants={START_OF_HEADER:8,MAX_TIME_OFFSET:7200,LARGEST_HASH:new i("10000000000000000000000000000000000000000000000000000000000000000","hex")},e.exports=l}).call(this,r(0).Buffer)},function(e,t,r){(function(t){var r=Object.prototype.toString,n="function"==typeof t.alloc&&"function"==typeof t.allocUnsafe&&"function"==typeof t.from;function i(e){return"ArrayBuffer"===r.call(e).slice(8,-1)}function o(e,r,i){r>>>=0;var o=e.byteLength-r;if(o<0)throw new RangeError("'offset' is out of bounds");if(void 0===i)i=o;else if(i>>>=0,i>o)throw new RangeError("'length' is out of bounds");return n?t.from(e.slice(r,r+i)):new t(new Uint8Array(e.slice(r,r+i)))}function s(e,r){if("string"==typeof r&&""!==r||(r="utf8"),!t.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');return n?t.from(e,r):new t(e,r)}function a(e,r,a){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return i(e)?o(e,r,a):"string"==typeof e?s(e,r):n?t.from(e):new t(e)}e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){t=e.exports=r(595),t.Stream=t,t.Readable=t,t.Writable=r(598),t.Duplex=r(118),t.Transform=r(601),t.PassThrough=r(1441)},function(e,t,r){var n=e.exports;n.encode=r(1673),n.decode=r(1674),n.byteLength=n.encodingLength=function(e){return n.encode(e).length}},function(e,t,r){"use strict";function n(e,t){for(var r=1,n=e.length,i=e[0],o=e[0],s=1;s>3;return e%8!=0&&t++,t}n.prototype.get=function(e){var t=e>>3;return t>e%8)},n.prototype.set=function(e,t){var r=e>>3;t||1===arguments.length?(this.buffer.length>e%8):r>e%8))},n.prototype._grow=function(e){if(this.buffer.length4294967295&&(o=1),t.writeUInt32BE(o,r),t.write(e.type,r+4,4,"ascii");var a=r+8;if(1===o&&(n.encode(e.length,t,a),a+=8),s.fullBoxes[i]&&(t.writeUInt32BE(e.flags||0,a),t.writeUInt8(e.version||0,a),a+=4),c[i]){var f=c[i];f.forEach(function(r){if(5===r.length){var n=e[r]||[];r=r.substr(0,4),n.forEach(function(e){u._encode(e,t,a),a+=u.encode.bytes})}else e[r]&&(u._encode(e[r],t,a),a+=u.encode.bytes)}),e.otherBoxes&&e.otherBoxes.forEach(function(e){u._encode(e,t,a),a+=u.encode.bytes})}else if(s[i]){var h=s[i].encode;h(e,t,a),a+=h.bytes}else{if(!e.buffer)throw new Error("Either `type` must be set to a known type (not'"+i+"') or `buffer` must be set");var l=e.buffer;l.copy(t,a),a+=e.buffer.length}return u.encode.bytes=a-r,t},u.readHeaders=function(e,t,r){if(t=t||0,r=r||e.length,r-t<8)return 8;var i=e.readUInt32BE(t),o=e.toString("ascii",t+4,t+8),a=t+8,u,c;if(1===i){if(r-t<16)return 16;i=n.decode(e,a),a+=8}return s.fullBoxes[o]&&(u=e.readUInt8(a),c=16777215&e.readUInt32BE(a),a+=4),{length:i,headersLen:a-t,contentLen:i-(a-t),type:o,version:u,flags:c}},u.decode=function(e,t,r){t=t||0,r=r||e.length;var n=u.readHeaders(e,t,r);if(!n||n.length>r-t)throw new Error("Data too short");return u.decodeWithoutHeaders(n,e,t+n.headersLen,t+n.length)},u.decodeWithoutHeaders=function(e,t,r,n){r=r||0,n=n||t.length;var i=e.type,a={};if(c[i]){a.otherBoxes=[];for(var f=c[i],h=r;n-h>=8;){var l=u.decode(t,h,n);if(h+=l.length,f.indexOf(l.type)>=0)a[l.type]=l;else if(f.indexOf(l.type+"s")>=0){var d=l.type+"s",p=a[d]=a[d]||[];p.push(l)}else a.otherBoxes.push(l)}}else if(s[i]){var g=s[i].decode;a=g(t,r,n)}else a.buffer=o(t.slice(r,n));return a.length=e.length,a.contentLen=e.contentLen,a.type=e.type,a.version=e.version,a.flags=e.flags,a},u.encodingLength=function(e){var t=e.type,r=8;if(s.fullBoxes[t]&&(r+=4),c[t]){var n=c[t];n.forEach(function(t){if(5===t.length){var n=e[t]||[];t=t.substr(0,4),n.forEach(function(e){e.type=t,r+=u.encodingLength(e)})}else if(e[t]){var i=e[t];i.type=t,r+=u.encodingLength(i)}}),e.otherBoxes&&e.otherBoxes.forEach(function(e){r+=u.encodingLength(e)})}else if(s[t])r+=s[t].encodingLength(e);else{if(!e.buffer)throw new Error("Either `type` must be set to a known type (not'"+t+"') or `buffer` must be set");r+=e.buffer.length}return r>4294967295&&(r+=8),e.length=r,r}},function(e,t,r){"use strict";t.decode=t.parse=r(679),t.encode=t.stringify=r(680)},function(e,t,r){(function(n){const i=r(683),o=r(93),s=r(6)("dweb-transports:httptools");async function a(e,t,r,n){let i,o="undefined"!=typeof window&&window.loopguard;for(;r--&&o===("undefined"!=typeof window&&window.loopguard);)try{return await fetch(e)}catch(e){i=e,s("Delaying %s by %d ms because %s",n,t,e.message),await new Promise(e=>{setTimeout(()=>{e()},t)}),t*=1+Math.random()}throw console.warn("loopfetch of",n,"failed"),o!==("undefined"!=typeof window&&window.loopguard)?(s("Looping exited because of page change %s",n),new Error("Looping exited because of page change "+n)):i}"undefined"==typeof fetch&&(fetch=i,Headers=fetch.Headers,Request=fetch.Request),httptools={},httptools.p_httpfetch=async function(e,t,{wantstream:r=!1}={}){try{s("p_httpfetch: %s %o",e,t.headers.range||"");let i=new Request(e,t),u=await a(i,500,"GET"===t.method?t.count||12:1,"fetching "+e);if(u.ok){let e=u.headers.get("Content-Type");return r?u.body:void 0!==e&&e.startsWith("application/json")?u.json():void 0!==e&&e.startsWith("text")?u.text():new n(await u.arrayBuffer())}throw new o.TransportError(`Transport Error ${u.status}: ${u.statusText}`)}catch(t){throw s("p_httpfetch failed: %s",t.message),t instanceof o.TransportError?t:new o.TransportError(`Transport error thrown by ${e}: ${t.message}`)}},httptools.p_GET=function(e,t={},r){"function"==typeof t&&(r=t,t={});let n=new Headers;(t.start||t.end)&&n.append("range",`bytes=${t.start||0}-${t.end<1/0?t.end:""}`);let i={method:"GET",headers:n,mode:"cors",cache:"default",redirect:"follow",keepalive:!0};const o=httptools.p_httpfetch(e,i,{wantstream:t.wantstream});if(!r)return o;o.then(e=>{try{r(null,e)}catch(e){s("Uncaught error %O",e)}}).catch(e=>r(e))},httptools.p_POST=function(e,t={},r){"function"==typeof t&&(r=t,t={});let n={method:"POST",headers:{},body:t.data,mode:"cors",cache:"default",redirect:"follow",keepalive:!1};t.contenttype&&(n.headers["Content-Type"]=t.contenttype);const i=httptools.p_httpfetch(e,n);if(!r)return i;i.then(e=>r(null,e)).catch(e=>r(e))},t=e.exports=httptools}).call(this,r(0).Buffer)},function(e,t){function r(e){return e<10?"0"+e:e}var n=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,i=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,o,s,a={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},u;function c(e){return i.lastIndex=0,i.test(e)?'"'+e.replace(i,function(e){var t=a[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function f(e,t){var r,n,i,a,h=o,l,d=t[e];switch(d&&"object"==typeof d&&"function"==typeof d.toJSON&&(d=d.toJSON(e)),"function"==typeof u&&(d=u.call(t,e,d)),typeof d){case"string":return c(d);case"number":return isFinite(d)?String(d):"null";case"boolean":case"null":return String(d);case"object":if(!d)return"null";if(o+=s,l=[],"[object Array]"===Object.prototype.toString.apply(d)){for(a=d.length,r=0;r-1&&e%1==0&&e<=r}e.exports=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={},e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=p;var n=r(58),i=d(n),o=r(192),s=d(o),a=r(696),u=d(a),c=r(125),f=d(c),h=r(261),l=d(h);function d(e){return e&&e.__esModule?e:{default:e}}function p(e){return function(t,r,n){if(n=(0,s.default)(n||i.default),e<=0||!t)return n(null);var o=(0,u.default)(t),a=!1,c=0,h=!1;function d(e,t){if(c-=1,e)a=!0,n(e);else{if(t===l.default||a&&c<=0)return a=!0,n(null);h||p()}}function p(){for(h=!0;c{t?r=a:a(s)}:a)):i(null,(i,s)=>{i?a(i):n?a(n):(t=!0,e(s,(e,i)=>{t=!1,n?(a(n),r(n)):e?o(e,a):i?a(null,s):o(null,a)}))})}}},t.asyncSort=function(e){const t=i(),r=n.collect((r,i)=>{if(r)return t.abort(r);e(i,(e,r)=>{if(e)return t.abort(e);t.resolve(n.values(i))})});return function(e){return r(e),t}},t.replaceStartWith=function(e,t){const r=new RegExp("^"+t);return e.replace(r,"")},t.tmpdir=(()=>o.join(s.tmpdir(),a()))},function(e,t){t.endianness=function(){return"LE"},t.hostname=function(){return"undefined"!=typeof location?location.hostname:""},t.loadavg=function(){return[]},t.uptime=function(){return 0},t.freemem=function(){return Number.MAX_VALUE},t.totalmem=function(){return Number.MAX_VALUE},t.cpus=function(){return[]},t.type=function(){return"Browser"},t.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},t.networkInterfaces=t.getNetworkInterfaces=function(){return{}},t.arch=function(){return"javascript"},t.platform=function(){return"browser"},t.tmpdir=t.tmpDir=function(){return"/tmp"},t.EOL="\n",t.homedir=function(){return"/"}},function(e,t){function r(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r-1?setImmediate:i.nextTick,u;_.WritableState=v;var c=r(5);c.inherits=r(1);var f={deprecate:r(38)},h=r(400),l=r(4).Buffer,d=n.Uint8Array||function(){};function p(e){return l.from(e)}function g(e){return l.isBuffer(e)||e instanceof d}var m=r(401),b;function y(){}function v(e,t){u=u||r(104),e=e||{};var n=t instanceof u;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||r(104),!(b.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var r=new Error("write after end");e.emit("error",r),i.nextTick(t,r)}function S(e,t,r,n){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(n,s),o=!1),o}function E(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r)),t}function k(e,t,r,n,i,o){if(!r){var s=E(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||L(this,n,r)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(2),r(8))},function(e,t,r){"use strict";t.util=r(408),t.resolver=r(420)},function(e,t,r){"use strict";(function(e){const n=r(54),i=r(205),o=i.SHIFT32,s=i.SHIFT16,a=2097151;function u(e){return e<16?"0"+e.toString(16):e.toString(16)}t.parseHalf=function e(t){var r,n,i;return i=128&t[0]?-1:1,r=(124&t[0])>>2,n=(3&t[0])<<8|t[1],r?31===r?i*(n?NaN:Infinity):i*Math.pow(2,r-25)*(1024+n):5.960464477539063e-8*i*n},t.arrayBufferToBignumber=function(e){const t=e.byteLength;let r="";for(let n=0;n{const t=new Map,r=Object.keys(e),n=r.length;for(let i=0;ie*s+t),t.buildInt64=((e,r,i,s)=>{const a=t.buildInt32(e,r),u=t.buildInt32(i,s);return a>2097151?new n(a).times(o).plus(u):a*o+u}),t.writeHalf=function t(r,n){const i=e.allocUnsafe(4);i.writeFloatBE(n,0);const o=i.readUInt32BE(0);if(0!=(8191&o))return!1;var s=o>>16&32768;const a=o>>23&255,u=8388607&o;if(a>=113&&a<=142)s+=(a-112<<10)+(u>>13);else{if(!(a>=103&&a<113))return!1;if(u&(1<<126-a)-1)return!1;s+=u+8388608>>126-a}return r.writeUInt16BE(s,0),!0},t.keySorter=function(e,t){var r=e[0].byteLength,n=t[0].byteLength;return r>n?1:n>r?-1:e[0].compare(t[0])},t.isNegativeZero=(e=>0===e&&1/e<0),t.nextPowerOf2=(e=>{let t=0;if(e&&!(e&e-1))return e;for(;0!==e;)e>>=1,t+=1;return 1<=0||!o.gcd(t.n).equals(i.ONE));e=e.multiply(o.modPow(t.e,t.n)).mod(t.n);for(var s=e.mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(a)<0;)s=s.add(t.p);var u=s.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return u=u.multiply(o.modInverse(t.n)).mod(t.n),u};function p(e,t,r){var i=n.util.createBuffer(),o=Math.ceil(t.n.bitLength()/8);if(e.length>o-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=o-11,s}i.putByte(0),i.putByte(r);var a=o-3-e.length,u;if(0===r||1===r){u=0===r?0:255;for(var c=0;c0;){for(var f=0,h=n.random.getBytes(a),c=0;c1;){if(255!==s.getByte()){--s.read;break}++c}else if(2===u)for(c=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++c}var h=s.getByte();if(0!==h||c!==o-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function m(e,t,r){"function"==typeof t&&(r=t,t={}),t=t||{};var o={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function a(){u(e.pBits,function(t,n){return t?r(t):(e.p=n,null!==e.q?c(t,e.q):void u(e.qBits,c))})}function u(e,t){n.prime.generateProbablePrime(e,o,t)}function c(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var o=e.p;e.p=e.q,e.q=o}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void a();if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.q=null,void u(e.qBits,c);if(e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(i.ONE))return e.p=e.q=null,void a();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void u(e.qBits,c);var f=e.e.modInverse(e.phi);e.keys={privateKey:s.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:s.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(o.prng=t.prng),a()}function b(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=n.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function y(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function v(e){return"undefined"!=typeof window&&"object"==typeof window.crypto&&"object"==typeof window.crypto.subtle&&"function"==typeof window.crypto.subtle[e]}function _(e){return"undefined"!=typeof window&&"object"==typeof window.msCrypto&&"object"==typeof window.msCrypto.subtle&&"function"==typeof window.msCrypto.subtle[e]}function w(e){for(var t=n.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),i=0;i0;)h.putByte(0),--l;return h.putBytes(n.util.hexToBytes(f)),h.getBytes()},s.rsa.decrypt=function(e,t,r,o){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=s,a}var u=new i(n.util.createBuffer(e).toHex(),16);if(u.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var c=d(u,t,r),f=c.toString(16),h=n.util.createBuffer(),l=s-Math.ceil(f.length/2);l>0;)h.putByte(0),--l;return h.putBytes(n.util.hexToBytes(f)),!1!==o?g(h.getBytes(),t,r):h.getBytes()},s.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048,r=r||{};var o=r.prng||n.random,s={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},u.e.fromInt(u.eInt),u},s.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new i(null);r.fromInt(30);for(var n=0,o=function(e,t){return e|t},u=+new Date,c,f=0;null===e.keys&&(t<=0||fh?e.pqState=0:e.num.isProbablePrime(y(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(a[n++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var d=e.e.modInverse(e.phi);e.keys={privateKey:s.rsa.setPrivateKey(e.n,e.e,d,e.p,e.q,d.mod(e.p1),d.mod(e.q1),e.q.modInverse(e.p)),publicKey:s.rsa.setPublicKey(e.n,e.e)}}c=+new Date,f+=c-u,u=c}return null!==e.keys},s.rsa.generateKeyPair=function(e,t,r,i){if(1===arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(i=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(i=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,i=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(i=r,r=void 0):(i=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!n.options.usePureJavaScript&&i&&e>=256&&e<=16384&&(65537===t||3===t)){if(v("generateKey")&&v("exportKey"))return window.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:w(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return window.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){i(e)}).then(function(e){if(e){var t=s.privateKeyFromAsn1(o.fromDer(n.util.createBuffer(e)));i(null,{privateKey:t,publicKey:s.setRsaPublicKey(t.n,t.e)})}});if(_("generateKey")&&_("exportKey")){var a=window.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:w(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return a.oncomplete=function(e){var t=e.target.result,r=window.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=s.privateKeyFromAsn1(o.fromDer(n.util.createBuffer(t)));i(null,{privateKey:r,publicKey:s.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){i(e)}},void(a.onerror=function(e){i(e)})}}var u=s.rsa.createKeyPairGenerationState(e,t,r);if(!i)return s.rsa.stepKeyPairGenerationState(u,0),u.keys;m(u,r,i)},s.setRsaPublicKey=s.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,i){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return p(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return n.pkcs1.encode_rsa_oaep(t,e,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var o=t.encode(e,r,!0);return s.rsa.encrypt(o,r,!0)},verify:function(e,t,n){"string"==typeof n?n=n.toUpperCase():void 0===n&&(n="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===n?n={verify:function(e,t){t=g(t,r,!0);var n=o.fromDer(t);return e===n.value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return t=g(t,r,!0),e===t}});var i=s.rsa.decrypt(t,r,!0,!1);return n.verify(e,i,r.n.bitLength())}};return r},s.setRsaPrivateKey=s.rsa.setPrivateKey=function(e,t,r,i,o,a,u,c){var f={n:e,e:t,d:r,p:i,q:o,dP:a,dQ:u,qInv:c,decrypt:function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=s.rsa.decrypt(e,f,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:g};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return n.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(i,f,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:l},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,f.n.bitLength());return s.rsa.encrypt(n,f,r)}};return f},s.wrapRsaPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,o.toDer(e).getBytes())])},s.privateKeyFromAsn1=function(e){var t={},r=[],a,f,h,l,d,p,g,m;if(o.validate(e,u,t,r)&&(e=o.fromDer(n.util.createBuffer(t.privateKey))),t={},r=[],!o.validate(e,c,t,r)){var b=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw b.errors=r,b}return a=n.util.createBuffer(t.privateKeyModulus).toHex(),f=n.util.createBuffer(t.privateKeyPublicExponent).toHex(),h=n.util.createBuffer(t.privateKeyPrivateExponent).toHex(),l=n.util.createBuffer(t.privateKeyPrime1).toHex(),d=n.util.createBuffer(t.privateKeyPrime2).toHex(),p=n.util.createBuffer(t.privateKeyExponent1).toHex(),g=n.util.createBuffer(t.privateKeyExponent2).toHex(),m=n.util.createBuffer(t.privateKeyCoefficient).toHex(),s.setRsaPrivateKey(new i(a,16),new i(f,16),new i(h,16),new i(l,16),new i(d,16),new i(p,16),new i(g,16),new i(m,16))},s.privateKeyToAsn1=s.privateKeyToRSAPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.e)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.d)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.p)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.q)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.dP)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.dQ)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.qInv))])},s.publicKeyFromAsn1=function(e){var t={},r=[];if(o.validate(e,h,t,r)){var a=o.derToOid(t.publicKeyOid);if(a!==s.oids.rsaEncryption){var u=new Error("Cannot read public key. Unknown OID.");throw u.oid=a,u}e=t.rsaPublicKey}if(r=[],!o.validate(e,f,t,r)){var u=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw u.errors=r,u}var c=n.util.createBuffer(t.publicKeyModulus).toHex(),l=n.util.createBuffer(t.publicKeyExponent).toHex();return s.setRsaPublicKey(new i(c,16),new i(l,16))},s.publicKeyToAsn1=s.publicKeyToSubjectPublicKeyInfo=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.BITSTRING,!1,[s.publicKeyToRSAPublicKey(e)])])},s.publicKeyToRSAPublicKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.e))])}},function(e,t,r){var n=r(16);if(r(210),r(129),r(282),r(106),r(164),r(428),r(283),r(130),r(835),r(280),r(29),void 0===i)var i=n.jsbn.BigInteger;var o=n.asn1,s=n.pki=n.pki||{};e.exports=s.pbe=n.pbe=n.pbe||{};var a=s.oids,u={name:"EncryptedPrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},c={name:"PBES2Algorithms",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},f={name:"pkcs-12PbeParams",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"iterations"}]};function h(e,t){return e.start().update(t).digest().getBytes()}function l(e){var t;if(e){if(t=s.oids[o.derToOid(e)],!t){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return d(t)}function d(e){var t=n.md;switch(e){case"hmacWithSHA224":t=n.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!(t&&e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}function p(e,t,r,i){var a=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,t.getBytes())]);return"hmacWithSHA1"!==i&&a.value.push(o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,n.util.hexToBytes(r.toString(16))),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids[i]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")])),a}s.encryptPrivateKeyInfo=function(e,t,r){r=r||{},r.saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var i=n.random.getBytesSync(r.saltSize),u=r.count,c=o.integerToDer(u),f,h,l;if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var g,m,b;switch(r.algorithm){case"aes128":f=16,g=16,m=a["aes128-CBC"],b=n.aes.createEncryptionCipher;break;case"aes192":f=24,g=16,m=a["aes192-CBC"],b=n.aes.createEncryptionCipher;break;case"aes256":f=32,g=16,m=a["aes256-CBC"],b=n.aes.createEncryptionCipher;break;case"des":f=8,g=8,m=a.desCBC,b=n.des.createEncryptionCipher;break;default:var y=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw y.algorithm=r.algorithm,y}var v="hmacWith"+r.prfAlgorithm.toUpperCase(),_=d(v),w=n.pkcs5.pbkdf2(t,i,u,f,_),S=n.random.getBytesSync(g),E=b(w);E.start(S),E.update(o.toDer(e)),E.finish(),l=E.output.getBytes();var k=p(i,c,f,v);h=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBES2).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBKDF2).getBytes()),k]),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(m).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,S)])])])}else{if("3des"!==r.algorithm){var y=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw y.algorithm=r.algorithm,y}f=24;var x=new n.util.ByteBuffer(i),w=s.pbe.generatePkcs12Key(t,x,1,u,f),S=s.pbe.generatePkcs12Key(t,x,2,u,f),E=n.des.createEncryptionCipher(w);E.start(S),E.update(o.toDer(e)),E.finish(),l=E.output.getBytes(),h=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,i),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,c.getBytes())])])}var C=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[h,o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,l)]);return C},s.decryptPrivateKeyInfo=function(e,t){var r=null,i={},a=[];if(!o.validate(e,u,i,a)){var c=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw c.errors=a,c}var f=o.derToOid(i.encryptionOid),h=s.pbe.getCipher(f,i.encryptionParams,t),l=n.util.createBuffer(i.encryptedData);return h.update(l),h.finish()&&(r=o.fromDer(h.output)),r},s.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:o.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})},s.encryptedPrivateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return o.fromDer(t.body)},s.encryptRsaPrivateKey=function(e,t,r){if(r=r||{},!r.legacy){var i=s.wrapRsaPrivateKey(s.privateKeyToAsn1(e));return i=s.encryptPrivateKeyInfo(i,t,r),s.encryptedPrivateKeyToPem(i)}var a,u,c,f;switch(r.algorithm){case"aes128":a="AES-128-CBC",c=16,u=n.random.getBytesSync(16),f=n.aes.createEncryptionCipher;break;case"aes192":a="AES-192-CBC",c=24,u=n.random.getBytesSync(16),f=n.aes.createEncryptionCipher;break;case"aes256":a="AES-256-CBC",c=32,u=n.random.getBytesSync(16),f=n.aes.createEncryptionCipher;break;case"3des":a="DES-EDE3-CBC",c=24,u=n.random.getBytesSync(8),f=n.des.createEncryptionCipher;break;case"des":a="DES-CBC",c=8,u=n.random.getBytesSync(8),f=n.des.createEncryptionCipher;break;default:var h=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw h.algorithm=r.algorithm,h}var l=n.pbe.opensslDeriveBytes(t,u.substr(0,8),c),d=f(l);d.start(u),d.update(o.toDer(s.privateKeyToAsn1(e))),d.finish();var p={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:n.util.bytesToHex(u).toUpperCase()},body:d.output.getBytes()};return n.pem.encode(p)},s.decryptRsaPrivateKey=function(e,t){var r=null,i=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type){var a=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw a.headerType=a,a}if(i.procType&&"ENCRYPTED"===i.procType.type){var u,c;switch(i.dekInfo.algorithm){case"DES-CBC":u=8,c=n.des.createDecryptionCipher;break;case"DES-EDE3-CBC":u=24,c=n.des.createDecryptionCipher;break;case"AES-128-CBC":u=16,c=n.aes.createDecryptionCipher;break;case"AES-192-CBC":u=24,c=n.aes.createDecryptionCipher;break;case"AES-256-CBC":u=32,c=n.aes.createDecryptionCipher;break;case"RC2-40-CBC":u=5,c=function(e){return n.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":u=8,c=function(e){return n.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":u=16,c=function(e){return n.rc2.createDecryptionCipher(e,128)};break;default:var a=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".');throw a.algorithm=i.dekInfo.algorithm,a}var f=n.util.hexToBytes(i.dekInfo.parameters),h=n.pbe.opensslDeriveBytes(t,f.substr(0,8),u),l=c(h);if(l.start(f),l.update(n.util.createBuffer(i.body)),!l.finish())return r;r=l.output.getBytes()}else r=i.body;return r="ENCRYPTED PRIVATE KEY"===i.type?s.decryptPrivateKeyInfo(o.fromDer(r),t):o.fromDer(r),null!==r&&(r=s.privateKeyFromAsn1(r)),r},s.pbe.generatePkcs12Key=function(e,t,r,i,o,s){var a,u;if(void 0===s||null===s){if(!("sha1"in n.md))throw new Error('"sha1" hash algorithm unavailable.');s=n.md.sha1.create()}var c=s.digestLength,f=s.blockLength,h=new n.util.ByteBuffer,l=new n.util.ByteBuffer;if(null!==e&&void 0!==e){for(u=0;u=0;u--)T>>=8,T+=x.at(u)+I.at(u),I.setAt(u,255&T);A.putBuffer(I)}_=A,h.putBuffer(E)}return h.truncate(h.length()-o),h},s.pbe.getCipher=function(e,t,r){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,r);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},s.pbe.getCipherForPBES2=function(e,t,r){var i={},a=[];if(!o.validate(t,c,i,a)){var u=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw u.errors=a,u}if(e=o.derToOid(i.kdfOid),e!==s.oids.pkcs5PBKDF2){var u=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw u.oid=e,u.supportedOids=["pkcs5PBKDF2"],u}if(e=o.derToOid(i.encOid),e!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC){var u=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw u.oid=e,u.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],u}var f=i.kdfSalt,h=n.util.createBuffer(i.kdfIterationCount),d,p;switch(h=h.getInt(h.length()<<3),s.oids[e]){case"aes128-CBC":d=16,p=n.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=n.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=n.des.createDecryptionCipher;break;case"desCBC":d=8,p=n.des.createDecryptionCipher}var g=l(i.prfOid),m=n.pkcs5.pbkdf2(r,f,h,d,g),b=i.encIv,y=p(m);return y.start(b),y},s.pbe.getCipherForPKCS12PBE=function(e,t,r){var i={},a=[];if(!o.validate(t,f,i,a)){var u=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw u.errors=a,u}var c=n.util.createBuffer(i.salt),h=n.util.createBuffer(i.iterations),d,p,g;switch(h=h.getInt(h.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,p=8,g=n.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,p=8,g=function(e,t){var r=n.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var u=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw u.oid=e,u}var m=l(i.prfOid),b=s.pbe.generatePkcs12Key(r,c,1,h,d,m);m.start();var y=s.pbe.generatePkcs12Key(r,c,2,h,p,m);return g(b,y)},s.pbe.opensslDeriveBytes=function(e,t,r,i){if(void 0===i||null===i){if(!("md5"in n.md))throw new Error('"md5" hash algorithm unavailable.');i=n.md.md5.create()}null===t&&(t="");for(var o=[h(i,e+t)],s=16,a=1;s8?3:1,m=[],b=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],y=0,v,_=0;_>>4^S),S^=v,w^=v<<4,v=65535&(S>>>-16^w),w^=v,S^=v<<-16,v=858993459&(w>>>2^S),S^=v,w^=v<<2,v=65535&(S>>>-16^w),w^=v,S^=v<<-16,v=1431655765&(w>>>1^S),S^=v,w^=v<<1,v=16711935&(S>>>8^w),w^=v,S^=v<<8,v=1431655765&(w>>>1^S),S^=v,w^=v<<1,v=w<<8|S>>>20&240,w=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=v;for(var E=0;E>>26,S=S<<2|S>>>26):(w=w<<1|w>>>27,S=S<<1|S>>>27),w&=-15,S&=-15;var k=t[w>>>28]|r[w>>>24&15]|n[w>>>20&15]|i[w>>>16&15]|o[w>>>12&15]|s[w>>>8&15]|a[w>>>4&15],x=u[S>>>28]|c[S>>>24&15]|f[S>>>20&15]|h[S>>>16&15]|l[S>>>12&15]|d[S>>>8&15]|p[S>>>4&15];v=65535&(x>>>16^k),m[y++]=k^v,m[y++]=x^v<<16}}return m}function p(e,t,r,n){var i=32===e.length?3:9,d,p;d=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var g=t[0],m=t[1];p=252645135&(g>>>4^m),m^=p,g^=p<<4,p=65535&(g>>>16^m),m^=p,g^=p<<16,p=858993459&(m>>>2^g),g^=p,m^=p<<2,p=16711935&(m>>>8^g),g^=p,m^=p<<8,p=1431655765&(g>>>1^m),m^=p,g^=p<<1,g=g<<1|g>>>31,m=m<<1|m>>>31;for(var b=0;b>>4|m<<28)^e[_+1];p=g,g=m,m=p^(s[w>>>24&63]|u[w>>>16&63]|f[w>>>8&63]|l[63&w]|o[S>>>24&63]|a[S>>>16&63]|c[S>>>8&63]|h[63&S])}p=g,g=m,m=p}g=g>>>1|g<<31,m=m>>>1|m<<31,p=1431655765&(g>>>1^m),m^=p,g^=p<<1,p=16711935&(m>>>8^g),g^=p,m^=p<<8,p=858993459&(m>>>2^g),g^=p,m^=p<<2,p=65535&(g>>>16^m),m^=p,g^=p<<16,p=252645135&(g>>>4^m),m^=p,g^=p<<4,r[0]=g,r[1]=m}function g(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),r="DES-"+t,i;i=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key);var o=i.start;return i.start=function(e,t){var r=null;t instanceof n.util.ByteBuffer&&(r=t,t={}),t=t||{},t.output=r,t.iv=e,o.call(i,t)},i}},function(e,t,r){var n=r(16);r(29);var i=e.exports=n.pem=n.pem||{};function o(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},i=0;i65&&-1!==s){var a=t[s];","===a?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+a+t.substr(s+1),o=i-s-1,s=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(s=i);return t}function s(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var r="-----BEGIN "+e.type+"-----\r\n",i;if(e.procType&&(i={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},r+=o(i)),e.contentDomain&&(i={name:"Content-Domain",values:[e.contentDomain]},r+=o(i)),e.dekInfo&&(i={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&i.values.push(e.dekInfo.parameters),r+=o(i)),e.headers)for(var s=0;s{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=self.crypto||self.msCrypto},function(e,t,r){"use strict";const n=r(838);e.exports=function(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n(e)}},function(e,t){var r=[].indexOf;e.exports=function(e,t){if(r)return e.indexOf(t);for(var n=0;n72)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-2)return!1;if(2!==e[2])return!1;var t=e[3];if(0===t)return!1;if(5+t>=e.length)return!1;if(2!==e[4+t])return!1;var r=e[5+t];return 0!==r&&(6+t+r===e.length&&(!(128&e[4])&&(!(t>1&&0===e[4]&&!(128&e[5]))&&(!(128&e[t+6])&&!(r>1&&0===e[t+6]&&!(128&e[t+7]))))))}function o(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(48!==e[0])throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(2!==e[2])throw new Error("Expected DER integer");var t=e[3];if(0===t)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(2!==e[4+t])throw new Error("Expected DER integer (2)");var r=e[5+t];if(0===r)throw new Error("S length is zero");if(6+t+r!==e.length)throw new Error("S length is invalid");if(128&e[4])throw new Error("R value is negative");if(t>1&&0===e[4]&&!(128&e[5]))throw new Error("R value excessively padded");if(128&e[t+6])throw new Error("S value is negative");if(r>1&&0===e[t+6]&&!(128&e[t+7]))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}}function s(e,t){var r=e.length,i=t.length;if(0===r)throw new Error("R length is zero");if(0===i)throw new Error("S length is zero");if(r>33)throw new Error("R length is too long");if(i>33)throw new Error("S length is too long");if(128&e[0])throw new Error("R value is negative");if(128&t[0])throw new Error("S value is negative");if(r>1&&0===e[0]&&!(128&e[1]))throw new Error("R value excessively padded");if(i>1&&0===t[0]&&!(128&t[1]))throw new Error("S value excessively padded");var o=n.allocUnsafe(6+r+i);return o[0]=48,o[1]=o.length-2,o[2]=2,o[3]=e.length,e.copy(o,4),o[4+r]=2,o[5+r]=t.length,t.copy(o,6+r),o}e.exports={check:i,decode:o,encode:s}},function(e){e.exports={COMPRESSED_TYPE_INVALID:"compressed should be a boolean",EC_PRIVATE_KEY_TYPE_INVALID:"private key should be a Buffer",EC_PRIVATE_KEY_LENGTH_INVALID:"private key length is invalid",EC_PRIVATE_KEY_RANGE_INVALID:"private key range is invalid",EC_PRIVATE_KEY_TWEAK_ADD_FAIL:"tweak out of range or resulting private key is invalid",EC_PRIVATE_KEY_TWEAK_MUL_FAIL:"tweak out of range",EC_PRIVATE_KEY_EXPORT_DER_FAIL:"couldn't export to DER format",EC_PRIVATE_KEY_IMPORT_DER_FAIL:"couldn't import from DER format",EC_PUBLIC_KEYS_TYPE_INVALID:"public keys should be an Array",EC_PUBLIC_KEYS_LENGTH_INVALID:"public keys Array should have at least 1 element",EC_PUBLIC_KEY_TYPE_INVALID:"public key should be a Buffer",EC_PUBLIC_KEY_LENGTH_INVALID:"public key length is invalid",EC_PUBLIC_KEY_PARSE_FAIL:"the public key could not be parsed or is invalid",EC_PUBLIC_KEY_CREATE_FAIL:"private was invalid, try again",EC_PUBLIC_KEY_TWEAK_ADD_FAIL:"tweak out of range or resulting public key is invalid",EC_PUBLIC_KEY_TWEAK_MUL_FAIL:"tweak out of range",EC_PUBLIC_KEY_COMBINE_FAIL:"the sum of the public keys is not valid",ECDH_FAIL:"scalar was invalid (zero or overflow)",ECDSA_SIGNATURE_TYPE_INVALID:"signature should be a Buffer",ECDSA_SIGNATURE_LENGTH_INVALID:"signature length is invalid",ECDSA_SIGNATURE_PARSE_FAIL:"couldn't parse signature",ECDSA_SIGNATURE_PARSE_DER_FAIL:"couldn't parse DER signature",ECDSA_SIGNATURE_SERIALIZE_DER_FAIL:"couldn't serialize signature to DER format",ECDSA_SIGN_FAIL:"nonce generation function failed or private key is invalid",ECDSA_RECOVER_FAIL:"couldn't recover public key from signature",MSG32_TYPE_INVALID:"message should be a Buffer",MSG32_LENGTH_INVALID:"message length is invalid",OPTIONS_TYPE_INVALID:"options should be an Object",OPTIONS_DATA_TYPE_INVALID:"options.data should be a Buffer",OPTIONS_DATA_LENGTH_INVALID:"options.data length is invalid",OPTIONS_NONCEFN_TYPE_INVALID:"options.noncefn should be a Function",RECOVERY_ID_TYPE_INVALID:"recovery should be a Number",RECOVERY_ID_VALUE_INVALID:"recovery should have value between -1 and 4",TWEAK_TYPE_INVALID:"tweak should be a Buffer",TWEAK_LENGTH_INVALID:"tweak length is invalid"}},function(e,t,r){"use strict";var n=r(1),i=r(435),o=r(4).Buffer,s=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(e,t){return e<>>32-t}function c(e,t,r,n,i,o,s){return u(e+(t&r|~t&n)+i+o|0,s)+t|0}function f(e,t,r,n,i,o,s){return u(e+(t&n|r&~n)+i+o|0,s)+t|0}function h(e,t,r,n,i,o,s){return u(e+(t^r^n)+i+o|0,s)+t|0}function l(e,t,r,n,i,o,s){return u(e+(r^(t|~n))+i+o|0,s)+t|0}n(a,i),a.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,o=this._d;r=c(r,n,i,o,e[0],3614090360,7),o=c(o,r,n,i,e[1],3905402710,12),i=c(i,o,r,n,e[2],606105819,17),n=c(n,i,o,r,e[3],3250441966,22),r=c(r,n,i,o,e[4],4118548399,7),o=c(o,r,n,i,e[5],1200080426,12),i=c(i,o,r,n,e[6],2821735955,17),n=c(n,i,o,r,e[7],4249261313,22),r=c(r,n,i,o,e[8],1770035416,7),o=c(o,r,n,i,e[9],2336552879,12),i=c(i,o,r,n,e[10],4294925233,17),n=c(n,i,o,r,e[11],2304563134,22),r=c(r,n,i,o,e[12],1804603682,7),o=c(o,r,n,i,e[13],4254626195,12),i=c(i,o,r,n,e[14],2792965006,17),n=c(n,i,o,r,e[15],1236535329,22),r=f(r,n,i,o,e[1],4129170786,5),o=f(o,r,n,i,e[6],3225465664,9),i=f(i,o,r,n,e[11],643717713,14),n=f(n,i,o,r,e[0],3921069994,20),r=f(r,n,i,o,e[5],3593408605,5),o=f(o,r,n,i,e[10],38016083,9),i=f(i,o,r,n,e[15],3634488961,14),n=f(n,i,o,r,e[4],3889429448,20),r=f(r,n,i,o,e[9],568446438,5),o=f(o,r,n,i,e[14],3275163606,9),i=f(i,o,r,n,e[3],4107603335,14),n=f(n,i,o,r,e[8],1163531501,20),r=f(r,n,i,o,e[13],2850285829,5),o=f(o,r,n,i,e[2],4243563512,9),i=f(i,o,r,n,e[7],1735328473,14),n=f(n,i,o,r,e[12],2368359562,20),r=h(r,n,i,o,e[5],4294588738,4),o=h(o,r,n,i,e[8],2272392833,11),i=h(i,o,r,n,e[11],1839030562,16),n=h(n,i,o,r,e[14],4259657740,23),r=h(r,n,i,o,e[1],2763975236,4),o=h(o,r,n,i,e[4],1272893353,11),i=h(i,o,r,n,e[7],4139469664,16),n=h(n,i,o,r,e[10],3200236656,23),r=h(r,n,i,o,e[13],681279174,4),o=h(o,r,n,i,e[0],3936430074,11),i=h(i,o,r,n,e[3],3572445317,16),n=h(n,i,o,r,e[6],76029189,23),r=h(r,n,i,o,e[9],3654602809,4),o=h(o,r,n,i,e[12],3873151461,11),i=h(i,o,r,n,e[15],530742520,16),n=h(n,i,o,r,e[2],3299628645,23),r=l(r,n,i,o,e[0],4096336452,6),o=l(o,r,n,i,e[7],1126891415,10),i=l(i,o,r,n,e[14],2878612391,15),n=l(n,i,o,r,e[5],4237533241,21),r=l(r,n,i,o,e[12],1700485571,6),o=l(o,r,n,i,e[3],2399980690,10),i=l(i,o,r,n,e[10],4293915773,15),n=l(n,i,o,r,e[1],2240044497,21),r=l(r,n,i,o,e[8],1873313359,6),o=l(o,r,n,i,e[15],4264355552,10),i=l(i,o,r,n,e[6],2734768916,15),n=l(n,i,o,r,e[13],1309151649,21),r=l(r,n,i,o,e[4],4149444226,6),o=l(o,r,n,i,e[11],3174756917,10),i=l(i,o,r,n,e[2],718787259,15),n=l(n,i,o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=o.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=a},function(e,t,r){"use strict";var n=r(1),i=r(866),o=r(107),s=r(4).Buffer,a=r(867),u=r(436),c=r(437),f=s.alloc(128);function h(e,t){o.call(this,"digest"),"string"==typeof t&&(t=s.from(t));var r="sha512"===e||"sha384"===e?128:64;if(this._alg=e,this._key=t,t.length>r){var n="rmd160"===e?new u:c(e);t=n.update(t).digest()}else t.length{const t=o.apply(null,e);n.codes[t.code]=t,n.names[t.name]=t}),n.object=o,e.exports=n},function(e,t,r){"use strict";const n=1e3;e.exports={maxProvidersPerRequest:3,providerRequestTimeout:1e4,hasBlockTimeout:15e3,provideTimeout:15e3,kMaxPriority:Math.pow(2,31)-1,rebroadcastDelay:1e4,maxListeners:1e3}},function(e,t,r){var n=r(65),i=r(295),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(e,t){if(n(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!i(e))||(s.test(e)||!o.test(e)||null!=t&&e in Object(t))}e.exports=a},function(e,t,r){var n=r(122),i=r(124),o="[object Symbol]";function s(e){return"symbol"==typeof e||i(e)&&n(e)==o}e.exports=s},function(e,t,r){var n=r(936),i=r(952),o=r(954),s=r(955),a=r(956);function u(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t{let n,i;if(e<0)n=r,i=t;else{if(!(e>0))return t[0];n=t,i=r}for(let e of n)for(let t of i)if(e===t)return e;throw new Error("No algorithms in common!")}),t.makeMacAndCipher=((e,t)=>{c([t=>f(e.hashT,e.keys.macKey,t),t=>h(e.cipherT,e.keys.iv,e.keys.cipherKey,t)],(r,n)=>{if(r)return t(r);e.mac=n[0],e.cipher=n[1],t()})}),t.selectBest=((r,n,i)=>{t.digest(e.concat([n.pubKeyBytes,r.nonce]),(o,s)=>{if(o)return i(o);t.digest(e.concat([r.pubKeyBytes,n.nonce]),(o,a)=>{if(o)return i(o);const u=e.compare(s,a);if(0===u)return i(new Error("you are trying to talk to yourself"));i(null,{curveT:t.theBest(u,r.exchanges,n.exchanges),cipherT:t.theBest(u,r.ciphers,n.ciphers),hashT:t.theBest(u,r.hashes,n.hashes),order:u})})})}),t.digest=((e,t)=>{n.digest(e,"sha2-256",e.length,t)}),t.write=function e(t,r,n){n=n||(()=>{}),o(s([r]),i.encode({fixed:!0,bytes:4}),a((e,r)=>{if(e)return n(e);t.shake.write(r[0]),n()}))},t.read=function e(t,r){i.decodeFromReader(t,{fixed:!0,bytes:4},r)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(60),i=r(20),o=r(61),s=r(47),a=r(11),u=r(6),c=u("libp2p:secio");c.error=u("libp2p:secio:error");const f=n(r(1057)),h=r(302),l=16;t.createProposal=(e=>(e.proposal.out={rand:o.randomBytes(16),pubkey:e.key.local.public.bytes,exchanges:h.exchanges.join(","),ciphers:h.ciphers.join(","),hashes:h.hashes.join(",")},e.proposalEncoded.out=f.Propose.encode(e.proposal.out),e.proposalEncoded.out)),t.createExchange=((t,r)=>{o.keys.generateEphemeralKeyPair(t.protocols.local.curveT,(n,i)=>{if(n)return r(n);t.ephemeralKey.local=i.key,t.shared.generate=i.genSharedKey;const o=e.concat([t.proposalEncoded.out,t.proposalEncoded.in,t.ephemeralKey.local]);t.key.local.sign(o,(e,n)=>{if(e)return r(e);t.exchange.out={epubkey:t.ephemeralKey.local,signature:n},r(null,f.Exchange.encode(t.exchange.out))})})}),t.identify=((e,t,r)=>{c("1.1 identify"),e.proposalEncoded.in=t,e.proposal.in=f.Propose.decode(t);const n=e.proposal.in.pubkey;e.key.remote=o.keys.unmarshalPublicKey(n),i.createFromPubKey(n.toString("base64"),(t,n)=>{if(t)return r(t);if(e.id.remote){if(e.id.remote.toB58String()!==n.toB58String())return r(new Error("dialed to the wrong peer, Ids do not match"))}else e.id.remote=n;c("1.1 identify - %s - identified remote peer as %s",e.id.local.toB58String(),e.id.remote.toB58String()),r()})}),t.selectProtocols=((e,t)=>{c("1.2 selection");const r={pubKeyBytes:e.key.local.public.bytes,exchanges:h.exchanges,hashes:h.hashes,ciphers:h.ciphers,nonce:e.proposal.out.rand},n={pubKeyBytes:e.proposal.in.pubkey,exchanges:e.proposal.in.exchanges.split(","),hashes:e.proposal.in.hashes.split(","),ciphers:e.proposal.in.ciphers.split(","),nonce:e.proposal.in.rand};h.selectBest(r,n,(r,n)=>{if(r)return t(r);e.protocols.remote={order:n.order,curveT:n.curveT,cipherT:n.cipherT,hashT:n.hashT},e.protocols.local={order:n.order,curveT:n.curveT,cipherT:n.cipherT,hashT:n.hashT},t()})}),t.verify=((t,r,n)=>{c("2.1. verify"),t.exchange.in=f.Exchange.decode(r),t.ephemeralKey.remote=t.exchange.in.epubkey;const i=e.concat([t.proposalEncoded.in,t.proposalEncoded.out,t.ephemeralKey.remote]);t.key.remote.verify(i,t.exchange.in.signature,(e,t)=>e?n(e):t?(c("2.1. verify - signature verified"),void n()):n(new Error("Bad signature")))}),t.generateKeys=((e,t)=>{c("2.2. keys"),a([t=>e.shared.generate(e.exchange.in.epubkey,t),(t,r)=>{e.shared.secret=t,o.keys.keyStretcher(e.protocols.local.cipherT,e.protocols.local.hashT,e.shared.secret,r)},(t,r)=>{if(e.protocols.local.order>0)e.protocols.local.keys=t.k1,e.protocols.remote.keys=t.k2;else{if(!(e.protocols.local.order<0))return r(new Error("you are trying to talk to yourself"));e.protocols.local.keys=t.k2,e.protocols.remote.keys=t.k1}c("2.3. mac + cipher"),s([t=>h.makeMacAndCipher(e.protocols.local,t),t=>h.makeMacAndCipher(e.protocols.remote,t)],r)}],t)}),t.verifyNonce=((e,t)=>{const r=e.proposal.out.rand;if(!r.equals(t))throw new Error(`Failed to read our encrypted nonce: ${r.toString("hex")} != ${t.toString("hex")}`)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(60),i="\nmessage Identify {\n // protocolVersion determines compatibility between peers\n optional string protocolVersion = 5; // e.g. ipfs/1.0.0\n\n // agentVersion is like a UserAgent string in browsers, or client version in bittorrent\n // includes the client name and client.\n optional string agentVersion = 6; // e.g. go-ipfs/0.1.0\n\n // publicKey is this node's public key (which also gives its node.ID)\n // - may not need to be sent, as secure channel implies it has been sent.\n // - then again, if we change / disable secure channel, may still want it.\n optional bytes publicKey = 1;\n\n // listenAddrs are the multiaddrs the sender node listens for open connections on\n repeated bytes listenAddrs = 2;\n\n // oservedAddr is the multiaddr of the remote endpoint that the sender node perceives\n // this is useful information to convey to the other side, as it helps the remote endpoint\n // determine whether its connection to the local peer goes through NAT.\n optional bytes observedAddr = 4;\n\n repeated string protocols = 3;\n}\n";e.exports=n(i).Identify},function(e,t,r){"use strict";const n=r(40),i=r(31),o=r(96),s=r(12),a=r(62),u=r(110),c=r(6),f=c("libp2p:circuit:stream-handler");f.err=c("libp2p:circuit:error:stream-handler");class h{constructor(e,t,r,n){this.conn=e,this.stream=null,this.shake=null,this.timeout=t||6e4,this.maxLength=n||4096,"function"==typeof t&&(this.timeout=r||6e4),this.stream=u({timeout:this.timeout},t),this.shake=this.stream.handshake,s(this.stream,e,this.stream)}isValid(){return this.conn&&this.shake&&this.stream}read(e){if(!this.isValid())return e(new Error("handler is not in a valid state"));a.decodeFromReader(this.shake,{maxLength:this.maxLength},(t,r)=>t?(f.err(t),e(t)):e(null,r))}write(e,t){if(t=t||(()=>{}),!this.isValid())return t(new Error("handler is not in a valid state"));s(n([e]),a.encode(),i((e,r)=>{if(e)return f.err(e),this.shake.abort(e),t(e);r.forEach(e=>this.shake.write(e)),t()}))}getRawConn(){return this.conn}rest(){const e=this.shake.rest();return this.conn=null,this.stream=null,this.shake=null,e}close(){this.isValid()&&s(o(),this.rest())}}e.exports=h},function(e,t,r){"use strict";e.exports={relay:"/libp2p/circuit/relay/0.1.0"}},function(e,t,r){"use strict";const n=r(57).Connection,i=r(12);e.exports=((e,t,r,o)=>{const s=new Promise((e,t)=>{r.getPeerInfo((t,n)=>{if(!t&&n)return void e(n);const i=r.setPeerInfo;r.setPeerInfo=(t=>{i.call(r,t),e(t)})})}),a={source:i(r,o.incoming(e,t,s)),sink:i(o.outgoing(e,t,s),r)};return new n(a,r)})},function(e,t,r){"use strict";e.exports={PROTOCOL:"/ipfs/ping/1.0.0",PING_LENGTH:32}},function(e,t,r){var n=r(1164);e.exports=function(e,t,r){r=void 0===r||r;var i=!1,o;return function(s){var a=0,u=0,c=0,f=[],h=!1,l=!1,d,p;function g(){if(d){var e=d;if(p)return d=null,e(p);if(Object.hasOwnProperty.call(f,u)){d=null;var r=f[u];delete f[u],u++,e(null,r),t&&m()}else u>=c&&l&&(d=null,e(l))}}var m=n(function(){if(h=!0,l)return g();i||t&&a-t>=u||(i=!0,s(o,function(t,n){if(i=!1,t)c=a,l=t,g();else{var o=a++;e(n,function(e,t){r?f[o]=t:f.push(t),e&&(p=e),g()}),l||m()}}))});return function(e,t){e?s(l=o=e,function(e){if(t)return t(e)}):(d=t,h||m(),g())}}}},function(e,t,r){"use strict";const n=r(175),i=100;e.exports=function e(t){const r=t||100;var i=[];return n(function e(t){for(i=i.concat(t);i.length>=r;){const e=r,t=i.slice(0,e);i=i.slice(e),this.queue(t)}},function e(t){i.length&&(this.queue(i),i=[]),this.queue(null)})}},function(e,t,r){"use strict";e.exports=class e{constructor(e,t){this._options=t||{},Object.assign(this,e)}}},function(e,t,r){"use strict";const n=r(1176),i=r(1177),o={bits:8};class s{constructor(e,t,r){if(this._options=Object.assign({},o,e),this._popCount=0,this._parent=t,this._posAtParent=r,!this._options.hashFn)throw new Error("please define an options.hashFn");this._options.hash||(this._options.hash=i(this._options.hashFn)),this._children=new n}static isBucket(e){return e instanceof s}async put(e,t){const r=await this._findNewBucketAndPos(e);await r.bucket._putAt(r,e,t)}async get(e){const t=await this._findChild(e);if(t)return t.value}async del(e){const t=await this._findPlace(e),r=t.bucket._at(t.pos);r&&r.key===e&&t.bucket._delAt(t.pos)}leafCount(){return this._children.compactArray().reduce((e,t)=>t instanceof s?e+t.leafCount():e+1,0)}childrenCount(){return this._children.length}onlyChild(){return this._children.get(0)}*eachLeafSeries(){const e=this._children.compactArray();for(const t of e)if(t instanceof s)for(const e of t.eachLeafSeries())yield e;else yield t}serialize(e,t){return t(this._children.reduce((r,n,i)=>(n&&(n instanceof s?r.push(n.serialize(e,t)):r.push(e(n,i))),r),[]))}async asyncTransform(e,t){return f(this,e,t)}toJSON(){return this.serialize(u,c)}prettyPrint(){return JSON.stringify(this.toJSON(),null," ")}tableSize(){return Math.pow(2,this._options.bits)}async _findChild(e){const t=await this._findPlace(e),r=t.bucket._at(t.pos);if(r&&r.key===e)return r}async _findPlace(e){const t=this._options.hash(e),r=await t.take(this._options.bits),n=this._children.get(r);return n instanceof s?n._findPlace(t):{bucket:this,pos:r,hash:t}}async _findNewBucketAndPos(e){const t=await this._findPlace(e),r=t.bucket._at(t.pos);if(r&&r.key!==e){const e=new s(this._options,t.bucket,t.pos);t.bucket._putObjectAt(t.pos,e);const n=await e._findPlace(r.hash);return n.bucket._putAt(n,r.key,r.value),e._findNewBucketAndPos(t.hash)}return t}_putAt(e,t,r){this._putObjectAt(e.pos,{key:t,value:r,hash:e.hash})}_putObjectAt(e,t){this._children.get(e)||this._popCount++,this._children.set(e,t)}_delAt(e){this._children.get(e)&&this._popCount--,this._children.unset(e),this._level()}_level(){if(this._parent&&this._popCount<=1)if(1===this._popCount){const e=this._children.find(a);if(!(e instanceof s)){const t=e.hash;t.untake(this._options.bits);const r={pos:this._posAtParent,hash:t};this._parent._putAt(r,e.key,e.value)}}else this._parent._delAt(this._posAtParent)}_at(e){return this._children.get(e)}}function a(e){return Boolean(e)}function u(e,t){return e.key}function c(e){return e}async function f(e,t,r){const n=[];for(const i of e._children.compactArray()){if(i instanceof s)await f(i,t,r);else{const r=await t(i);n.push({bitField:e._children.bitField(),children:r})}return r(n)}}e.exports=s},function(e,t,r){"use strict";const n=(e="")=>(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean);e.exports=n},function(e,t,r){"use strict";const n=r(11),i=r(44),o=r(111),{loadNode:s,formatCid:a,toMfsPath:u,FILE_SEPARATOR:c,FILE_TYPES:f}=r(74),h=r(12),l=r(31),d=r(80),p=r(67),g=r(127),m=r(72),b=r(59),y={long:!1,cidBase:"base58btc"};e.exports=(e=>(function t(r,v={}){"object"==typeof r&&(v=r,r=c),void 0===r&&(r=c),v=Object.assign({},y,v),v.long=v.l||v.long;const _=b.source();return n([t=>u(e,r,t),({mfsPath:t,depth:n},i)=>{h(o(t,e.ipld,{maxDepth:n}),l((s,a)=>{if(s)return i(s);if(a.length>1)return i(new Error(`Path ${r} had ${a.length} roots`));const u=a[0];if(!u)return i(new Error(`${r} does not exist`));if("dir"!==u.type)return i(null,g(u));let c=!0;return i(null,h(o(t,e.ipld,{maxDepth:n+1}),p(()=>!c||(c=!1,!1))))}))},(t,r)=>{r(null,h(t,d((t,r)=>{if(!v.long)return r(null,{name:t.name,type:0,size:0,hash:""});s(e,{cid:t.hash},(e,n)=>{if(e)return r(e);const o=i.unmarshal(n.node.data);r(null,{name:t.name,type:f[o.type],hash:a(t.hash,v.cidBase),size:o.fileSize()||0})})})))}],(e,t)=>{if(e)return _.resolve(m(e));_.resolve(t)}),_}))},function(e,t,r){"use strict";const n=r(11),i=r(86),o=r(6)("ipfs:mfs:mkdir"),s=r(111),a=r(12),u=r(67),c=r(66),f=r(31),h=r(9),{createNode:l,toMfsPath:d,toPathComponents:p,updateMfsRoot:g,updateTree:m,FILE_SEPARATOR:b}=r(74),y={parents:!1,hashAlg:"sha2-256",cidVersion:0,shardSplitThreshold:1e3,format:"dag-pb",flush:!0};e.exports=(e=>(function t(r,v,_){if("function"==typeof v&&(_=v,v={}),v=Object.assign({},y,v),v.parents=v.p||v.parents,v.cidVersion=v.cidVersion||0,!r)return _(new Error("no path given to Mkdir"));if(r=r.trim(),r===b)return _(v.parents?null:new Error(`cannot create directory '${b}': Already exists`));o(`Creating ${r}`);const w=p(r);n([t=>d(e,r,t),({mfsDirectory:t,mfsPath:r,root:n},i)=>{const o=p(r).slice(1);let l=0,d="";a(s(r,e.ipld,{fullPath:!0}),u(e=>e.name===o[l]&&(l++,!0)),c(e=>{const t=`${d}${d?"/":""}${o[e.depth]}`;if("dir"!==e.type)throw new Error(`cannot access ${t}: Not a directory`);return d=t,{cid:new h(e.hash),name:e.name}}),f(i))},(t,r)=>{if(w.unshift("/"),t.length===w.length)return r(new Error("file already exists"));i(w.map((e,t)=>({part:e,index:t})),({part:r,index:i},o)=>t[i]?o(null,{name:r,...t[i]}):i===w.length-1||v.parents?void n([t=>l(e,"directory",v,t),({cid:e,node:t},n)=>{n(null,{cid:e,size:t.size,name:r})}],o):o(new Error("file does not exist")),r)},(t,r)=>m(e,t,v,r),({cid:t},r)=>g(e,t,r)],e=>{e&&e.message.includes("file already exists")&&v.parents&&(e=null),_(e)})}))},function(e,t,r){"use strict";const n=r(111),i=r(12),o=r(127),s=r(80),a=r(197),u=r(67),c=r(59),f=r(31),{toMfsPath:h}=r(74),l=r(6)("ipfs:mfs:read-pull-stream"),d={offset:0,length:void 0};e.exports=(e=>(function t(r,p={}){p=Object.assign({},d,p),p.length=p.length||p.count,l(`Reading ${r}`);const g=c.source();return i(o(r),s((t,r)=>h(e,t,r)),s(({mfsPath:t,root:r},o)=>(l(`Exporting ${t}`),i(n(t,e.ipld,{offset:p.offset,length:p.length}),f(o)))),a(),u(),f((e,t)=>{if(e)return g.abort(e);if(!t||!t.length)return g.abort(new Error(`${r} does not exist`));const n=t[0];return"file"!==n.type?g.abort(new Error(`${r} was not a file`)):n.content?(l(`Got ${r} content`),void g.resolve(t[0].content)):g.abort(new Error(`Could not load content stream from ${r}`))})),g}))},function(e,t,r){"use strict";const n=r(550),i=(e,t,r)=>{"function"==typeof t&&(r=t,t=void 0),n.deserialize(e,(e,n)=>{if(e)return r(e);if(!t)return r(null,{value:n,remainderPath:""});const i=t.split("/"),o=s(n,i[0]);if(null===o)return r(new Error("No such path"),null);let a=i.slice(1).join("/");return void 0!==o["/"]?r(null,{value:o,remainderPath:a}):a.length>0?r(new Error("No such path"),null):r(null,{value:o,remainderPath:""})})},o=(e,t,r)=>{"function"==typeof t&&(r=t,t=void 0),t=t||{},n.deserialize(e,(e,n)=>{if(e)return r(e);const i=["version","timestamp","difficulty","nonce","parent","tx"];if(!0===t.values){const e={};for(let t of i)e[t]=s(n,t);return r(null,e)}return r(null,i)})},s=(e,t)=>{switch(t){case"version":return e.version;case"timestamp":return e.timestamp;case"difficulty":return e.bits;case"nonce":return e.nonce;case"parent":return{"/":n.hashToCid(e.prevHash)};case"tx":return{"/":n.hashToCid(e.merkleRoot)};default:return null}};e.exports={multicodec:"bitcoin-block",defaultHashAlg:"dbl-sha2-256",resolve:i,tree:o}},function(e,t,r){var n=t;n.utils=r(82),n.common=r(176),n.sha=r(1282),n.ripemd=r(1286),n.hmac=r(1287),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},function(e,t){var r={Array:function(e){return null!==e&&void 0!==e&&e.constructor===Array},Boolean:function(e){return"boolean"==typeof e},Function:function(e){return"function"==typeof e},Nil:function(e){return void 0===e||null===e},Number:function(e){return"number"==typeof e},Object:function(e){return"object"==typeof e},String:function(e){return"string"==typeof e},"":function(){return!0}};for(var n in r.Null=r.Nil,r)r[n].toJSON=function(e){return e}.bind(null,n);e.exports=r},function(e,t,r){const n=r(4).Buffer,i=r(99),o=r(25),s=r(1303),a=r(30),u=r(43),c=r(83),f=r(557);function h(e){const t=e.length;return f.encodingLength(t)+t}function l(e){const t=e.length;return f.encodingLength(t)+e.reduce(function(e,t){return e+h(t)},0)}function d(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}d.DEFAULT_SEQUENCE=4294967295,d.SIGHASH_ALL=1,d.SIGHASH_NONE=2,d.SIGHASH_SINGLE=3,d.SIGHASH_ANYONECANPAY=128,d.ADVANCED_TRANSACTION_MARKER=0,d.ADVANCED_TRANSACTION_FLAG=1;const p=n.allocUnsafe(0),g=[],m=n.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),b=n.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),y=n.from("ffffffffffffffff","hex"),v={script:p,valueBuffer:y};d.fromBuffer=function(e,t){let r=0;function n(t){return r+=t,e.slice(r-t,r)}function i(){const t=e.readUInt32LE(r);return r+=4,t}function o(){const t=e.readInt32LE(r);return r+=4,t}function a(){const t=s.readUInt64LE(e,r);return r+=8,t}function u(){const t=f.decode(e,r);return r+=f.decode.bytes,t}function c(){return n(u())}function h(){const e=u(),t=[];for(var r=0;r=this.ins.length)return b;const s=o.compile(o.decompile(t).filter(function(e){return e!==a.OP_CODESEPARATOR})),f=this.clone();if((31&r)===d.SIGHASH_NONE)f.outs=[],f.ins.forEach(function(t,r){r!==e&&(t.sequence=0)});else if((31&r)===d.SIGHASH_SINGLE){if(e>=this.outs.length)return b;f.outs.length=e+1;for(var h=0;h>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function u(e){for(var t=1,r=0;r126)throw new Error("Invalid prefix ("+e+")");t=a(t)^n>>5}for(t=a(t),r=0;rr)throw new TypeError("Exceeds length limit");e=e.toLowerCase();for(var i=u(e),o=e+"1",s=0;s>5!=0)throw new Error("Non 5-bit word");i=a(i)^c,o+=n.charAt(c)}for(s=0;s<6;++s)i=a(i);for(i^=1,s=0;s<6;++s){var f=i>>5*(5-s)&31;o+=n.charAt(f)}return o}function f(e,t){if(t=t||90,e.length<8)throw new TypeError(e+" too short");if(e.length>t)throw new TypeError("Exceeds length limit");var r=e.toLowerCase(),n=e.toUpperCase();if(e!==r&&e!==n)throw new Error("Mixed-case string "+e);e=r;var o=e.lastIndexOf("1");if(-1===o)throw new Error("No separator character for "+e);if(0===o)throw new Error("Missing prefix for "+e);var s=e.slice(0,o),c=e.slice(o+1);if(c.length<6)throw new Error("Data too short");for(var f=u(s),h=[],l=0;l=c.length||h.push(p)}if(1!==f)throw new Error("Invalid checksum for "+e);return{prefix:s,words:h}}function h(e,t,r,n){for(var i=0,o=0,s=(1<=r;)o-=r,a.push(i>>o&s);if(n)o>0&&a.push(i<=t)throw new Error("Excess padding");if(i<{const t=s.decode(e),r=new a(t);return r}),f;function h(e,o,s){l(e,o,(e,a)=>{if(e)return s(e);if(!r)return s(null,a);let u=a.slice();const c=a.filter(e=>t.isBuffer(e.value));n(c,(e,t)=>i([t=>r.util.deserialize(e.value,t),(e,t)=>r.resolver._mapFromEthObject(e,o,t)],(r,n)=>{if(r)return t(r);n.forEach(t=>{u.push({path:e.path+"/"+t.path,value:t.value})}),t()}),e=>{if(e)return s(e);s(null,u)})})}function l(t,r,i){let o=[];"leaf"===t.type&&o.push({path:g(t.getKey()),value:t.getValue()}),n(t.getChildren(),(t,n)=>{const i=g(t[0]),s=t[1];if(a.isRawNode(s)){const e=new a(s);o.push({path:i,value:e}),l(e,r,(e,t)=>{if(e)return n(e);t.forEach(e=>{e.path=i+"/"+e.path}),o=o.concat(t),n()})}else{let t={"/":u(e,s).toBaseEncodedString()};o.push({path:i,value:t}),n()}},e=>{if(e)return i(e);i(null,o)})}}function g(e){return e.map(e=>e.toString(16)).join("/")}e.exports=p}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(573),i=(e,t,r)=>{"function"==typeof t&&(r=t,t=void 0),n.deserialize(e,(e,n)=>{if(e)return r(e);if(!t)return r(null,{value:n,remainderPath:""});const i=t.split("/"),o=s(n,i[0]);if(null===o)return r(new Error("No such path"),null);let a=i.slice(1).join("/");return void 0!==o["/"]?r(null,{value:o,remainderPath:a}):a.length>0?r(new Error("No such path"),null):r(null,{value:o,remainderPath:""})})},o=(e,t,r)=>{"function"==typeof t&&(r=t,t=void 0),t=t||{},n.deserialize(e,(e,n)=>{if(e)return r(e);const i=["version","timestamp","difficulty","nonce","solution","reserved","parent","tx"];if(!0===t.values){const e={};for(let t of i)e[t]=s(n,t);return r(null,e)}return r(null,i)})},s=(e,t)=>{switch(t){case"version":return e.version;case"timestamp":return e.time;case"difficulty":return e.bits;case"nonce":return e.nonce;case"solution":return e.solution;case"reserved":return e.reserved;case"parent":return{"/":n.hashToCid(e.prevHash)};case"tx":return{"/":n.hashToCid(e.merkleRoot)};default:return null}};e.exports={multicodec:"zcash-block",defaultHashAlg:"dbl-sha2-256",resolve:i,tree:o}},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(22),o=r(26),s=r(36);function a(e){if(!(this instanceof a))return new a(e);var t;if(n.isNumber(e))t=e;else{if(!n.isString(e))throw new TypeError('Unrecognized num type: "'+typeof e+'" for Opcode');t=a.map[e]}return s.defineImmutable(this,{num:t}),this}for(var u in a.fromBuffer=function(e){return i.checkArgument(o.isBuffer(e)),new a(Number("0x"+e.toString("hex")))},a.fromNumber=function(e){return i.checkArgument(n.isNumber(e)),new a(e)},a.fromString=function(e){i.checkArgument(n.isString(e));var t=a.map[e];if(void 0===t)throw new TypeError("Invalid opcodestr");return new a(t)},a.prototype.toHex=function(){return this.num.toString(16)},a.prototype.toBuffer=function(){return new t(this.toHex(),"hex")},a.prototype.toNumber=function(){return this.num},a.prototype.toString=function(){var e=a.reverseMap[this.num];if(void 0===e)throw new Error("Opcode does not have a string representation");return e},a.smallInt=function(e){return i.checkArgument(n.isNumber(e),"Invalid Argument: n should be number"),i.checkArgument(e>=0&&e<=16,"Invalid Argument: n must be between 0 and 16"),0===e?a("OP_0"):new a(a.map.OP_1+e-1)},a.map={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP1:176,OP_NOP2:177,OP_NOP3:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255},a.reverseMap=[],a.map)a.reverseMap[a.map[u]]=u;n.extend(a,a.map),a.isSmallIntOp=function(e){return e instanceof a&&(e=e.toNumber()),e===a.map.OP_0||e>=a.map.OP_1&&e<=a.map.OP_16},a.prototype.inspect=function(){return""},e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(22),o=r(0),s=t.compare||r(1397),a=r(76),u=r(26),c=r(36),f=r(100),h=r(69),l=r(50),d=r(77),p=r(101),g=r(117),m=r(577),b=r(330),y=b.PublicKeyHash,v=b.PublicKey,_=b.MultiSigScriptHash,w=b.MultiSig,S=r(102),E=r(78),k=r(245),x=r(45),C=r(1402);function A(e){if(!(this instanceof A))return new A(e);if(this.inputs=[],this.outputs=[],this.joinSplits=[],this._inputAmount=void 0,this._outputAmount=void 0,e){if(e instanceof A)return A.shallowCopy(e);if(c.isHexa(e))this.fromString(e);else if(u.isBuffer(e))this.fromBuffer(e);else{if(!n.isObject(e))throw new a.InvalidArgument("Must provide an object or string to deserialize a transaction");this.fromObject(e)}}else this._newTransaction()}var I=1,T=0,O=1e6;A.DUST_AMOUNT=546,A.FEE_SECURITY_MARGIN=15,A.MAX_MONEY=21e14,A.NLOCKTIME_BLOCKHEIGHT_LIMIT=5e8,A.NLOCKTIME_MAX_VALUE=4294967295,A.FEE_PER_KB=1e4,A.CHANGE_OUTPUT_MAX_SIZE=62,A.MAXIMUM_EXTRA_SIZE=26,A.shallowCopy=function(e){var t=new A(e.toBuffer());return t};var R={configurable:!1,enumerable:!0,get:function(){return new f(this._getHash()).readReverse().toString("hex")}};Object.defineProperty(A.prototype,"hash",R),Object.defineProperty(A.prototype,"id",R);var B={configurable:!1,enumerable:!0,get:function(){return this._getInputAmount()}};Object.defineProperty(A.prototype,"inputAmount",B),B.get=function(){return this._getOutputAmount()},Object.defineProperty(A.prototype,"outputAmount",B),A.prototype._getHash=function(){return l.sha256sha256(this.toBuffer())},A.prototype.serialize=function(e){return!0===e||e&&e.disableAll?this.uncheckedSerialize():this.checkedSerialize(e)},A.prototype.uncheckedSerialize=A.prototype.toString=function(){return this.toBuffer().toString("hex")},A.prototype.checkedSerialize=function(e){var t=this.getSerializationError(e);if(t)throw t.message+=" Use Transaction#uncheckedSerialize if you want to skip security checks. See http://bitcore.io/guide/transaction.html#Serialization for more info.",t;return this.uncheckedSerialize()},A.prototype.invalidSatoshis=function(){for(var e=!1,t=0;tr)return this._missingChange()?new a.Transaction.ChangeAddressMissing("Fee is too large and no change address was provided"):new a.Transaction.FeeError.TooLarge("expected less than "+r+" but got "+t)}if(!e.disableSmallFees){var i=Math.ceil(this._estimateFee()/A.FEE_SECURITY_MARGIN);if(t"},A.prototype.toBuffer=function(){var e=new h;return this.toBufferWriter(e).toBuffer()},A.prototype.toBufferWriter=function(e){return e.writeUInt32LE(this.version),e.writeVarintNum(this.inputs.length),n.each(this.inputs,function(t){t.toBufferWriter(e)}),e.writeVarintNum(this.outputs.length),n.each(this.outputs,function(t){t.toBufferWriter(e)}),e.writeUInt32LE(this.nLockTime),this.version>=2&&(e.writeVarintNum(this.joinSplits.length),n.each(this.joinSplits,function(t){t.toBufferWriter(e)}),this.joinSplits.length>0&&(e.write(this.joinSplitPubKey),e.write(this.joinSplitSig))),e},A.prototype.fromBuffer=function(e){var t=new f(e);return this.fromBufferReader(t)},A.prototype.fromBufferReader=function(e){var t,r,n,o;for(i.checkArgument(!e.finished(),"No transaction data received"),this.version=e.readUInt32LE(),r=e.readVarintNum(),t=0;t=2){for(o=e.readVarintNum(),t=0;t0&&(this.joinSplitPubKey=e.read(32),this.joinSplitSig=e.read(64))}return this},A.prototype.toObject=A.prototype.toJSON=function e(){var t=[];this.inputs.forEach(function(e){t.push(e.toObject())});var r=[];this.outputs.forEach(function(e){r.push(e.toObject())});var i={hash:this.hash,version:this.version,inputs:t,outputs:r,nLockTime:this.nLockTime};if(this.version>=2){var o=[];this.joinSplits.forEach(function(e){o.push(e.toObject())}),i.joinSplits=o,this.joinSplits.length>0&&(i.joinSplitPubKey=u.reverse(this.joinSplitPubKey).toString("hex"),i.joinSplitSig=this.joinSplitSig.toString("hex"))}return this._changeScript&&(i.changeScript=this._changeScript.toString()),n.isUndefined(this._changeIndex)||(i.changeIndex=this._changeIndex),n.isUndefined(this._fee)||(i.fee=this._fee),i},A.prototype.fromObject=function e(r){i.checkArgument(n.isObject(r)||r instanceof A);var o=this,s;return s=r instanceof A?s.toObject():r,n.each(s.inputs,function(e){if(e.output&&e.output.script){var t=new E(e.output.script),r;if(t.isPublicKeyHashOut())r=new b.PublicKeyHash(e);else if(t.isScriptHashOut()&&e.publicKeys&&e.threshold)r=new b.MultiSigScriptHash(e,e.publicKeys,e.threshold,e.signatures);else{if(!t.isPublicKeyOut())throw new a.Transaction.Input.UnsupportedScript(e.output.script);r=new b.PublicKey(e)}o.addInput(r)}else o.uncheckedAddInput(new b(e))}),n.each(s.outputs,function(e){o.addOutput(new S(e))}),s.changeIndex&&(this._changeIndex=s.changeIndex),s.changeScript&&(this._changeScript=new E(s.changeScript)),s.fee&&(this._fee=s.fee),this.nLockTime=s.nLockTime,this.version=s.version,this.version>=2&&(n.each(s.joinSplits,function(e){o.joinSplits.push(new C(e))}),o.joinSplits.length>0&&(o.joinSplitPubKey=u.reverse(new t(s.joinSplitPubKey,"hex")),o.joinSplitSig=new t(s.joinSplitSig,"hex"))),this._checkConsistency(r),this},A.prototype._checkConsistency=function(e){n.isUndefined(this._changeIndex)||(i.checkState(this._changeScript),i.checkState(this.outputs[this._changeIndex]),i.checkState(this.outputs[this._changeIndex].script.toString()===this._changeScript.toString())),e&&e.hash&&i.checkState(e.hash===this.hash,"Hash in object does not match transaction hash")},A.prototype.lockUntilDate=function(e){if(i.checkArgument(e),n.isNumber(e)&&e=A.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new a.Transaction.BlockHeightTooHigh;if(e<0)throw new a.Transaction.NLockTimeOutOfRange;for(var t=0;t0?(this._changeIndex=this.outputs.length,this._addOutput(new S({script:this._changeScript,satoshis:r}))):this._changeIndex=void 0}},A.prototype.getFee=function(){return this.isCoinbase()?0:n.isUndefined(this._fee)?this._changeScript?this._estimateFee():this._getUnspentValue():this._fee},A.prototype._estimateFee=function(){var e=this._estimateSize(),t=this._getUnspentValue();return A._estimateFee(e,t,this._feePerKb)},A.prototype._getUnspentValue=function(){return this._getInputAmount()-this._getOutputAmount()},A.prototype._clearSignatures=function(){n.each(this.inputs,function(e){e.clearSignatures()})},A._estimateFee=function(e,t,r){var n=Math.ceil(e/1e3)*(r||A.FEE_PER_KB);return t>n&&(e+=A.CHANGE_OUTPUT_MAX_SIZE),Math.ceil(e/1e3)*(r||A.FEE_PER_KB)},A.prototype._estimateSize=function(){var e=A.MAXIMUM_EXTRA_SIZE;return n.each(this.inputs,function(t){e+=t._estimateSize()}),n.each(this.outputs,function(t){e+=t.script.toBuffer().length+9}),e},A.prototype._removeOutput=function(e){var t=this.outputs[e];this.outputs=n.without(this.outputs,t),this._outputAmount=void 0},A.prototype.removeOutput=function(e){this._removeOutput(e),this._updateChangeOutput()},A.prototype.sort=function(){return this.sortInputs(function(e){var t=Array.prototype.concat.apply([],e);return t.sort(function(e,t){return s(e.prevTxId,t.prevTxId)||e.outputIndex-t.outputIndex}),t}),this.sortOutputs(function(e){var t=Array.prototype.concat.apply([],e);return t.sort(function(e,t){return e.satoshis-t.satoshis||s(e.script.toBuffer(),t.script.toBuffer())}),t}),this},A.prototype.shuffleOutputs=function(){return this.sortOutputs(n.shuffle)},A.prototype.sortOutputs=function(e){var t=e(this.outputs);return this._newOutputOrder(t)},A.prototype.sortInputs=function(e){return this.inputs=e(this.inputs),this._clearSignatures(),this},A.prototype._newOutputOrder=function(e){var t=this.outputs.length!==e.length||0!==n.difference(this.outputs,e).length;if(t)throw new a.Transaction.InvalidSorting;if(!n.isUndefined(this._changeIndex)){var r=this.outputs[this._changeIndex];this._changeIndex=n.findIndex(e,r)}return this.outputs=e,this},A.prototype.removeInput=function(e,t){var r;if(r=!t&&n.isNumber(e)?e:n.findIndex(this.inputs,function(r){return r.prevTxId.toString("hex")===e&&r.outputIndex===t}),r<0||r>=this.inputs.length)throw new a.Transaction.InvalidIndex(r,this.inputs.length);var i=this.inputs[r];this.inputs=n.without(this.inputs,i),this._inputAmount=void 0,this._updateChangeOutput()},A.prototype.sign=function(e,t){i.checkState(this.hasAllUtxoInfo());var r=this;return n.isArray(e)?(n.each(e,function(e){r.sign(e,t)}),this):(n.each(this.getSignatures(e,t),function(e){r.applySignature(e)}),this)},A.prototype.getSignatures=function(e,t){e=new k(e),t=t||d.SIGHASH_ALL;var r=this,i=[],o=l.sha256ripemd160(e.publicKey.toBuffer());return n.each(this.inputs,function s(a,u){n.each(a.getSignatures(r,e,u,t,o),function(e){i.push(e)})}),i},A.prototype.applySignature=function(e){return this.inputs[e.inputIndex].addSignature(this,e),this},A.prototype.isFullySigned=function(){return n.each(this.inputs,function(e){if(e.isFullySigned===b.prototype.isFullySigned)throw new a.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction")}),n.all(n.map(this.inputs,function(e){return e.isFullySigned()}))},A.prototype.isValidSignature=function(e){var t=this;if(this.inputs[e.inputIndex].isValidSignature===b.prototype.isValidSignature)throw new a.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction");return this.inputs[e.inputIndex].isValidSignature(this,e)},A.prototype.verifySignature=function(e,t,r,n){return p.verify(this,e,t,r,n)},A.prototype.verify=function(){if(0===this.inputs.length)return"transaction txins empty";if(0===this.outputs.length)return"transaction txouts empty";for(var e=new x(0),t=0;t1e6)return"transaction over the maximum block size";var i={};for(t=0;t100)return"coinbase transaction script size invalid"}else for(t=0;t=b.MAXINT-1&&(t.sequenceNumber=b.DEFAULT_RBF_SEQNUMBER)}return this},e.exports=A}).call(this,r(0).Buffer)},function(e,t,r){e.exports=r(182),e.exports.PublicKey=r(1398),e.exports.PublicKeyHash=r(1399),e.exports.MultiSig=r(1400),e.exports.MultiSigScriptHash=r(1401)},function(e,t,r){"use strict";var n=r(15),i=r(76),o=r(22),s={BTC:[1e8,8],mBTC:[1e5,5],uBTC:[100,2],bits:[100,2],satoshis:[1,0]};function a(e,t){if(!(this instanceof a))return new a(e,t);if(n.isNumber(t)){if(t<=0)throw new i.Unit.InvalidRate(t);e/=t,t=a.BTC}this._value=this._from(e,t);var r=this,o=function(e){Object.defineProperty(r,e,{get:function(){return r.to(e)},enumerable:!0})};Object.keys(s).forEach(o)}Object.keys(s).forEach(function(e){a[e]=e}),a.fromObject=function e(t){return o.checkArgument(n.isObject(t),"Argument is expected to be an object"),new a(t.amount,t.code)},a.fromBTC=function(e){return new a(e,a.BTC)},a.fromMillis=a.fromMilis=function(e){return new a(e,a.mBTC)},a.fromMicros=a.fromBits=function(e){return new a(e,a.bits)},a.fromSatoshis=function(e){return new a(e,a.satoshis)},a.fromFiat=function(e,t){return new a(e,t)},a.prototype._from=function(e,t){if(!s[t])throw new i.Unit.UnknownCode(t);return parseInt((e*s[t][0]).toFixed())},a.prototype.to=function(e){if(n.isNumber(e)){if(e<=0)throw new i.Unit.InvalidRate(e);return parseFloat((this.BTC*e).toFixed(2))}if(!s[e])throw new i.Unit.UnknownCode(e);var t=this._value/s[e][0];return parseFloat(t.toFixed(s[e][1]))},a.prototype.toBTC=function(){return this.to(a.BTC)},a.prototype.toMillis=a.prototype.toMilis=function(){return this.to(a.mBTC)},a.prototype.toMicros=a.prototype.toBits=function(){return this.to(a.bits)},a.prototype.toSatoshis=function(){return this.to(a.satoshis)},a.prototype.atRate=function(e){return this.to(e)},a.prototype.toString=function(){return this.satoshis+" satoshis"},a.prototype.toObject=a.prototype.toJSON=function e(){return{amount:this.BTC,code:a.BTC}},a.prototype.inspect=function(){return""},e.exports=a},function(e,t,r){"use strict";e.exports={_cache:{},_count:0,_eraseIndex:0,_usedList:{},_usedIndex:{},_CACHE_SIZE:5e3,get:function(e,t,r){r=!!r;var n=e+"/"+t+"/"+r;if(this._cache[n])return this._cacheHit(n),this._cache[n]},set:function(e,t,r,n){r=!!r;var i=e+"/"+t+"/"+r;this._cache[i]=n,this._cacheHit(i)},_cacheHit:function(e){this._usedIndex[e]&&delete this._usedList[this._usedIndex[e]],this._usedList[this._count]=e,this._usedIndex[e]=this._count,this._count++,this._cacheRemove()},_cacheRemove:function(){for(;this._eraseIndex{const r=o(e,t);return(e,t,o)=>{const s=n(o),a=r(t),u=i(e=>s(null,e));a.once("error",s),a.pipe(u),a.write(e),a.end()}})},function(e,t,r){var n=r(335),i=r(46),o=e.exports;for(var s in n)n.hasOwnProperty(s)&&(o[s]=n[s]);function a(e){if("string"==typeof e&&(e=i.parse(e)),e.protocol||(e.protocol="https:"),"https:"!==e.protocol)throw new Error('Protocol "'+e.protocol+'" not supported. Expected "https:"');return e}o.request=function(e,t){return e=a(e),n.request.call(this,e,t)},o.get=function(e,t){return e=a(e),n.get.call(this,e,t)}},function(e,t,r){(function(e){var n=r(1423),i=r(587),o=r(41),s=r(585),a=r(46),u=t;u.request=function(t,r){t="string"==typeof t?a.parse(t):o(t);var i=-1===e.location.protocol.search(/^https?:$/)?"http:":"",s=t.protocol||i,u=t.hostname||t.host,c=t.port,f=t.path||"/";u&&-1!==u.indexOf(":")&&(u="["+u+"]"),t.url=(u?s+"//"+u:"")+(c?":"+c:"")+f,t.method=(t.method||"GET").toUpperCase(),t.headers=t.headers||{};var h=new n(t);return r&&h.on("response",r),h},u.get=function e(t,r){var n=u.request(t,r);return n.end(),n},u.ClientRequest=n,u.IncomingMessage=i.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,r(8))},function(e,t,r){"use strict";const n=r(49),i=r(1432),o=r(23).Readable;class s extends o{constructor(e){const t=Object.assign(e||{},{objectMode:!0});super(t)}_read(){}}const a=(e,t)=>{let r=new s,o=i.extract();o.on("entry",(e,t,n)=>{t.on("end",n),"directory"!==e.type?r.push({path:e.name,content:t}):(r.push({path:e.name}),t.resume())}).on("finish",()=>r.push(null)),n(e,o),t(null,r)};e.exports=a},function(e,t,r){"use strict";var n=Object.prototype.hasOwnProperty,i=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),o=function e(t){for(;t.length>1;){var r=t.pop(),n=r.obj[r.prop];if(Array.isArray(n)){for(var i=[],o=0;o=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122?s+=o.charAt(a):u<128?s+=i[u]:u<2048?s+=i[192|u>>6]+i[128|63&u]:u<55296||u>=57344?s+=i[224|u>>12]+i[128|u>>6&63]+i[128|63&u]:(a+=1,u=65536+((1023&u)<<10|1023&o.charCodeAt(a)),s+=i[240|u>>18]+i[128|u>>12&63]+i[128|u>>6&63]+i[128|63&u])}return s},h=function e(t){for(var r=[{obj:{o:t},prop:"o"}],n=[],i=0;i1;class g{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");const t=this[i]=e.max||1/0,r=e.length||p;if(this[s]="function"!=typeof r?p:r,this[a]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[u]=e.maxAge||0,this[c]=e.dispose,this[f]=e.noDisposeOnSet||!1,this[d]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[i]=e||1/0,y(this)}get max(){return this[i]}set allowStale(e){this[a]=!!e}get allowStale(){return this[a]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[u]=e,y(this)}get maxAge(){return this[u]}set lengthCalculator(e){"function"!=typeof e&&(e=p),e!==this[s]&&(this[s]=e,this[o]=0,this[h].forEach(e=>{e.length=this[s](e.value,e.key),this[o]+=e.length})),y(this)}get lengthCalculator(){return this[s]}get length(){return this[o]}get itemCount(){return this[h].length}rforEach(e,t){t=t||this;for(let r=this[h].tail;null!==r;){const n=r.prev;w(this,e,r,t),r=n}}forEach(e,t){t=t||this;for(let r=this[h].head;null!==r;){const n=r.next;w(this,e,r,t),r=n}}keys(){return this[h].toArray().map(e=>e.key)}values(){return this[h].toArray().map(e=>e.value)}reset(){this[c]&&this[h]&&this[h].length&&this[h].forEach(e=>this[c](e.key,e.value)),this[l]=new Map,this[h]=new n,this[o]=0}dump(){return this[h].map(e=>!b(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[h]}set(e,t,r){if(r=r||this[u],r&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const n=r?Date.now():0,a=this[s](t,e);if(this[l].has(e)){if(a>this[i])return v(this,this[l].get(e)),!1;const s=this[l].get(e),u=s.value;return this[c]&&(this[f]||this[c](e,u.value)),u.now=n,u.maxAge=r,u.value=t,this[o]+=a-u.length,u.length=a,this.get(e),y(this),!0}const d=new _(e,t,a,n,r);return d.length>this[i]?(this[c]&&this[c](e,t),!1):(this[o]+=d.length,this[h].unshift(d),this[l].set(e,this[h].head),y(this),!0)}has(e){if(!this[l].has(e))return!1;const t=this[l].get(e).value;return!b(this,t)}get(e){return m(this,e,!0)}peek(e){return m(this,e,!1)}pop(){const e=this[h].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[l].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const n=e[r],i=n.e||0;if(0===i)this.set(n.k,n.v);else{const e=i-t;e>0&&this.set(n.k,n.v,e)}}}prune(){this[l].forEach((e,t)=>m(this,t,!1))}}const m=(e,t,r)=>{const n=e[l].get(t);if(n){const t=n.value;if(b(e,t)){if(v(e,n),!e[a])return}else r&&(e[d]&&(n.value.now=Date.now()),e[h].unshiftNode(n));return t.value}},b=(e,t)=>{if(!t||!t.maxAge&&!e[u])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[u]&&r>e[u]},y=e=>{if(e[o]>e[i])for(let t=e[h].tail;e[o]>e[i]&&null!==t;){const r=t.prev;v(e,t),t=r}},v=(e,t)=>{if(t){const r=t.value;e[c]&&e[c](r.key,r.value),e[o]-=r.length,e[l].delete(r.key),e[h].removeNode(t)}};class _{constructor(e,t,r,n,i){this.key=e,this.value=t,this.length=r,this.now=n,this.maxAge=i||0}}const w=(e,t,r,n)=>{let i=r.value;b(e,i)&&(v(e,r),e[a]||(i=void 0)),i&&t.call(n,i.value,i.key,e)};e.exports=g},function(e,t,r){"use strict";const n=r(103);function i(e,t,r){"function"==typeof e.pipe?n(e,(e,n)=>{if(e)return r(e);t(n,r)}):t(e,r)}e.exports=i},function(e,t,r){"use strict";const n=r(23).Transform,i=r(1516);class o extends n{constructor(e){const t=Object.assign(e||{},{objectMode:!0});super(t)}_transform(e,t,r){try{const t=i(e);if(this.push(t),!t.success)throw new Error(t.text)}catch(e){return r(e)}r()}}e.exports=o},function(e,t,r){"use strict";const n=r(54);e.exports=(e=>({totalIn:new n(e.TotalIn),totalOut:new n(e.TotalOut),rateIn:new n(e.RateIn),rateOut:new n(e.RateOut)}))},function(e,t,r){(function(t){e.exports=function(e,r){var n=[];e.on("data",function(e){n.push(e)}),e.once("end",function(){r&&r(null,t.concat(n)),r=null}),e.once("error",function(e){r&&r(e),r=null})}}).call(this,r(0).Buffer)},function(e,t){var r=1,n=65535,i=4,o,s=function(){r=r+1&65535};e.exports=function(e){o||(o=setInterval(s,250),o.unref&&o.unref());var t=4*(e||5),n=[0],i=1,a=r-1&65535;return function(e){var o=r-a&65535;for(o>t&&(o=t),a=r;o--;)i===t&&(i=0),n[i]=n[0===i?t-1:i-1],i++;e&&(n[i-1]+=e);var s=n[i-1],u=n.length=4"},homepage:"https://webtorrent.io",keywords:["bittorrent","bittorrent client","download","mad science","p2p","peer-to-peer","peers","streaming","swarm","torrent","web torrent","webrtc","webrtc data","webtorrent"],license:"MIT",main:"index.js",name:"webtorrent",repository:{type:"git",url:"git://github.com/webtorrent/webtorrent.git"},scripts:{build:"browserify -s WebTorrent -e ./ | minify > webtorrent.min.js","build-debug":"browserify -s WebTorrent -e ./ > webtorrent.debug.js",size:"npm run build && cat webtorrent.min.js | gzip | wc -c",test:"standard && npm run test-node && npm run test-browser","test-browser":"airtap -- test/*.js test/browser/*.js","test-browser-local":"airtap --local -- test/*.js test/browser/*.js","test-node":"tape test/*.js test/node/*.js","update-authors":"./scripts/update-authors.sh"},version:"0.103.0"}},function(e,t){t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<>1,f=-7,h=r?i-1:0,l=r?-1:1,d=e[t+h];for(h+=l,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=256*o+e[t+h],h+=l,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+e[t+h],h+=l,f-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=c}return(d?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,u,c=8*o-i-1,f=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-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+h>=1?l/u:l*Math.pow(2,1-h),t*u>=2&&(s++,u/=2),s+h>=f?(a=0,s=f):s+h>=1?(a=(t*u-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<0;e[r+d]=255&s,d+=p,s/=256,c-=8);e[r+d-p]|=128*g}},function(e,t,r){"use strict";(function(t,n){var i;e.exports=O,O.ReadableState=T;var o=r(7).EventEmitter,s=function e(t,r){return t.listeners(r).length},a=r(348),u=r(0).Buffer,c=t.Uint8Array||function(){};function f(e){return u.from(e)}function h(e){return u.isBuffer(e)||e instanceof c}var l=r(685),d;d=l&&l.debuglog?l.debuglog("stream"):function e(){};var p=r(686),g=r(349),m=r(350),b=m.getHighWaterMark,y=r(158).codes,v=y.ERR_INVALID_ARG_TYPE,_=y.ERR_STREAM_PUSH_AFTER_EOF,w=y.ERR_METHOD_NOT_IMPLEMENTED,S=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,E=r(688),k=E.emitExperimentalWarning,x,C;r(1)(O,a);var A=["error","close","destroy","pause","resume"];function I(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)}function T(e,t,n){i=i||r(121),e=e||{},"boolean"!=typeof n&&(n=t instanceof i),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=b(this,e,"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.emitClose=!1!==e.emitClose,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(x||(x=r(13).StringDecoder),this.decoder=new x(e.encoding),this.encoding=e.encoding)}function O(e){if(i=i||r(121),!(this instanceof O))return new O(e);var t=this instanceof i;this._readableState=new T(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),a.call(this)}function R(e,t,r,n,i){d("readableAddChunk",t);var o=e._readableState,s;if(null===t)o.reading=!1,j(e,o);else if(i||(s=P(o,t)),s)e.emit("error",s);else if(o.objectMode||t&&t.length>0)if("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=f(t)),n)o.endEmitted?e.emit("error",new S):B(e,o,t,!0);else if(o.ended)e.emit("error",new _);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?B(e,o,t,!1):U(e,o)):B(e,o,t,!1)}else n||(o.reading=!1,U(e,o));return!o.ended&&(o.length=M?e=M:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function L(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=N(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function j(e,t){if(!t.ended){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?D(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,F(e)))}}function D(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(F,e))}function F(e){var t=e._readableState;d("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||e.emit("readable"),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,G(e)}function U(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(q,e,t))}function q(e,t){for(var r=t.length;!t.reading&&!t.ended&&t.length0,e.listenerCount("data")>0&&e.resume()}function K(e){d("readable nexttick read 0"),e.read(0)}function W(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(V,e,t))}function V(e,t){d("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),G(e),t.flowing&&!t.reading&&e.read(0)}function G(e){var t=e._readableState;for(d("flow",t.flowing);t.flowing&&null!==e.read(););}function $(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 Y(e){var t=e._readableState;d("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(J,t,e))}function J(e,t){d("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function X(e,t){for(var r=0,n=e.length;r=t.highWaterMark:t.length>0)||t.ended))return d("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Y(this):D(this),null;if(e=L(e,t),0===e&&t.ended)return 0===t.length&&Y(this),null;var n=t.needReadable,i;return d("need readable",n),(0===t.length||t.length-e0?$(e,t):null,null===i?(t.needReadable=!0,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&Y(this)),null!==i&&this.emit("data",i),i},O.prototype._read=function(e){this.emit("error",new w("_read()"))},O.prototype.pipe=function(e,t){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,d("pipe count=%d opts=%j",i.pipesCount,t);var o=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,a=o?c:y;function u(e,t){d("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,l())}function c(){d("onend"),e.end()}i.endEmitted?n.nextTick(a):r.once("end",a),e.on("unpipe",u);var f=z(r);e.on("drain",f);var h=!1;function l(){d("cleanup"),e.removeListener("close",m),e.removeListener("finish",b),e.removeListener("drain",f),e.removeListener("error",g),e.removeListener("unpipe",u),r.removeListener("end",c),r.removeListener("end",y),r.removeListener("data",p),h=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}function p(t){d("ondata");var n=e.write(t);d("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==X(i.pipes,e))&&!h&&(d("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function g(t){d("onerror",t),y(),e.removeListener("error",g),0===s(e,"error")&&e.emit("error",t)}function m(){e.removeListener("finish",b),y()}function b(){d("onfinish"),e.removeListener("close",m),y()}function y(){d("unpipe"),r.unpipe(e)}return r.on("data",p),I(e,"error",g),e.once("close",m),e.once("finish",b),e.emit("pipe",r),i.flowing||(d("pipe resume"),r.resume()),e},O.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?this:(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,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,d("on readable",i.length,i.reading),i.length?D(this):i.reading||n.nextTick(K,this))),r},O.prototype.addListener=O.prototype.on,O.prototype.removeListener=function(e,t){var r=a.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(H,this),r},O.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(H,this),t},O.prototype.resume=function(){var e=this._readableState;return e.flowing||(d("resume"),e.flowing=!e.readableListening,W(this,e)),this},O.prototype.pause=function(){return d("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(d("pause"),this._readableState.flowing=!1,this.emit("pause")),this},O.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",function(){if(d("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){if(d("wrapped data"),r.decoder&&(i=r.decoder.write(i)),(!r.objectMode||null!==i&&void 0!==i)&&(r.objectMode||i&&i.length)){var o=t.push(i);o||(n=!0,e.pause())}}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function t(r){return function t(){return e[r].apply(e,arguments)}}(i));for(var o=0;o-1))throw new k(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(I.prototype,"writableBuffer",{enumerable:!1,get:function e(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(I.prototype,"writableHighWaterMark",{enumerable:!1,get:function e(){return this._writableState.highWaterMark}}),I.prototype._write=function(e,t,r){r(new y("_write()"))},I.prototype._writev=null,I.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||K(this,n,r),this},Object.defineProperty(I.prototype,"writableLength",{enumerable:!1,get:function e(){return this._writableState.length}}),Object.defineProperty(I.prototype,"destroyed",{enumerable:!1,get:function e(){return void 0!==this._writableState&&this._writableState.destroyed},set:function e(t){this._writableState&&(this._writableState.destroyed=t)}}),I.prototype.destroy=d.destroy,I.prototype._undestroy=d.undestroy,I.prototype._destroy=function(e,t){t(e)}}).call(this,r(8),r(2))},function(e,t,r){"use strict";e.exports=f;var n=r(158).codes,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,s=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,u=r(121);function c(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.lengththis._repo.blocks.get(e,t),t):t(new Error("first arg must be an array of cids"))}delete(e,t){this._repo.blocks.delete(e,t)}}e.exports=i},function(e,t,r){(function(t){var r="object"==typeof t&&t&&t.Object===Object&&t;e.exports=r}).call(this,r(8))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(262),i=a(n),o=r(39),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t,r,n){(0,i.default)(t)(e,(0,s.default)(r),n)}e.exports=t.default},function(e,t,r){(function(e){var n=r(87),i=r(701),o=t&&!t.nodeType&&t,s=o&&"object"==typeof e&&e&&!e.nodeType&&e,a=s&&s.exports===o,u=a?n.Buffer:void 0,c=u?u.isBuffer:void 0,f=c||i;e.exports=f}).call(this,r(70)(e))},function(e,t){var r=9007199254740991,n=/^(?:0|[1-9]\d*)$/;function i(e,t){var i=typeof e;return t=null==t?r:t,!!t&&("number"==i||"symbol"!=i&&n.test(e))&&e>-1&&e%1==0&&e0;)r.push(a%i),a=a/i|0}for(var u="",c=0;0===e[c]&&c=0;--f)u+=t[r[f]];return u}function c(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return n.allocUnsafe(0);for(var t=[0],s=0;s>=8;for(;c>0;)t.push(255&c),c>>=8}for(var f=0;e[f]===o&&f2&&(i=(0,u.default)(arguments,1)),n[t]=i,r(e)})},function(e){r(e,n)})}e.exports=t.default},function(e,t,r){"use strict";function n(e){return function(t,r,n){return e(t,n)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t,r){(function(t){var r="Expected a function",n="__lodash_hash_undefined__",i=1/0,o="[object Function]",s="[object GeneratorFunction]",a="[object Symbol]",u=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,c=/^\w*$/,f=/^\./,h=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,l=/[\\^$.*+?()[\]{}|]/g,d=/\\(\\)?/g,p=/^\[object .+?Constructor\]$/,g="object"==typeof t&&t&&t.Object===Object&&t,m="object"==typeof self&&self&&self.Object===Object&&self,b=g||m||Function("return this")();function y(e,t){return null==e?void 0:e[t]}function v(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}var _=Array.prototype,w=Function.prototype,S=Object.prototype,E=b["__core-js_shared__"],k=(x=/[^.]+$/.exec(E&&E.keys&&E.keys.IE_PROTO||""),x?"Symbol(src)_1."+x:""),x,C=w.toString,A=S.hasOwnProperty,I=S.toString,T=RegExp("^"+C.call(A).replace(l,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),O=b.Symbol,R=_.splice,B=se(b,"Map"),P=se(Object,"create"),M=O?O.prototype:void 0,N=M?M.toString:void 0;function L(e){var t=-1,r=e?e.length:0;for(this.clear();++t-1}function G(e,t){var r=this.__data__,n=ee(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function $(e){var t=-1,r=e?e.length:0;for(this.clear();++t1&&this._buf[this._buf.length-1]===a;)this._buf=this._buf.slice(0,-1)}less(e){const t=this.list(),r=e.list();for(let e=0;ei)return!1}return t.length>>((3&t)<<3)&255;return i}}},function(e,t){for(var r=[],n=0;n<256;++n)r[n]=(n+256).toString(16).substr(1);function i(e,t){var n=t||0,i=r;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]]].join("")}e.exports=i},function(e,t,r){"use strict";const n=r(19);e.exports.dbOpenFailedError=(e=>(e=e||new Error("Cannot open database"),n(e,"ERR_DB_OPEN_FAILED"))),e.exports.dbDeleteFailedError=(e=>(e=e||new Error("Delete failed"),n(e,"ERR_DB_DELETE_FAILED"))),e.exports.dbWriteFailedError=(e=>(e=e||new Error("Write failed"),n(e,"ERR_DB_WRITE_FAILED"))),e.exports.notFoundError=(e=>(e=e||new Error("Not Found"),n(e,"ERR_NOT_FOUND")))},function(e,t,r){"use strict";var n=Object.prototype.toString;e.exports=function(e){var t;return"[object Object]"===n.call(e)&&(t=Object.getPrototypeOf(e),null===t||t===Object.getPrototypeOf({}))}},function(e,t,r){"use strict";const n=r(201),i=r(750),o=r(752),s=r(754),a=r(755),u=r(379);t.KeytransformDatastore=n,t.ShardingDatastore=i,t.MountDatastore=o,t.TieredDatastore=s,t.NamespaceDatastore=a,t.shard=u},function(e,t,r){"use strict";const n=r(202),i=r(28).Key,o=r(751),s=t.PREFIX="/repo/flatfs/shard/",a=t.SHARDING_FN="SHARDING";t.README_FN="_README";class u{constructor(e){this.param=e}fun(e){throw new Error("implement me")}toString(){return`${s}v1/${this.name}/${this.param}`}}class c extends u{constructor(e){super(e),this._padding=n("",e,"_"),this.name="prefix"}fun(e){return(e+this._padding).slice(0,this.param)}}class f extends u{constructor(e){super(e),this._padding=n("",e,"_"),this.name="suffix"}fun(e){const t=this._padding+e;return t.slice(t.length-this.param)}}class h extends u{constructor(e){super(e),this._padding=n("",e+1,"_"),this.name="next-to-last"}fun(e){const t=this._padding+e,r=t.length-this.param-1;return t.slice(r,r+this.param)}}function l(e){if(e=e.trim(),0===e.length)throw new Error("empty shard string");if(!e.startsWith(s))throw new Error(`invalid or no path prefix: ${e}`);const t=e.slice(s.length).split("/"),r=t[0];if("v1"!==r)throw new Error(`expect 'v1' version, got '${r}'`);const n=t[1];if(!t[2])throw new Error("missing param");const i=parseInt(t[2],10);switch(n){case"prefix":return new c(i);case"suffix":return new f(i);case"next-to-last":return new h(i);default:throw new Error(`unkown sharding function: ${n}`)}}t.readShardFun=((e,t,r)=>{const n=new i(e).child(new i(a)),o="function"==typeof t.getRaw?t.getRaw.bind(t):t.get.bind(t);o(n,(e,t)=>{if(e)return r(e);let n;try{n=l((t||"").toString().trim())}catch(e){return r(e)}r(null,n)})}),t.readme=o,t.parseShardFun=l,t.Prefix=c,t.Suffix=f,t.NextToLast=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(757),i=a(n),o=r(159),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)(i.default),e.exports=t.default},function(e,t){function r(e){return function(t){return null==t?void 0:t[e]}}e.exports=r},function(e,t,r){t.AbstractLevelDOWN=r(762),t.AbstractIterator=r(383),t.AbstractChainedBatch=r(384)},function(e,t,r){(function(t){function r(e){this.db=e,this._ended=!1,this._nexting=!1}r.prototype.next=function(e){var r=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return r._ended?(t.nextTick(e,new Error("cannot call next() after end()")),r):r._nexting?(t.nextTick(e,new Error("cannot call next() before previous next() has completed")),r):(r._nexting=!0,r._next(function(){r._nexting=!1,e.apply(null,arguments)}),r)},r.prototype._next=function(e){t.nextTick(e)},r.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");if(this._ended)return t.nextTick(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},r.prototype._end=function(e){t.nextTick(e)},e.exports=r}).call(this,r(2))},function(e,t,r){(function(t){function r(e){this._db=e,this._operations=[],this._written=!1}r.prototype._serializeKey=function(e){return this._db._serializeKey(e)},r.prototype._serializeValue=function(e){return this._db._serializeValue(e)},r.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},r.prototype.put=function(e,t){this._checkWritten();var r=this._db._checkKey(e,"key");if(r)throw r;return e=this._serializeKey(e),t=this._serializeValue(t),this._put(e,t),this},r.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},r.prototype.del=function(e){this._checkWritten();var t=this._db._checkKey(e,"key");if(t)throw t;return e=this._serializeKey(e),this._del(e),this},r.prototype._del=function(e){this._operations.push({type:"del",key:e})},r.prototype.clear=function(){return this._checkWritten(),this._operations=[],this._clear(),this},r.prototype._clear=function e(){},r.prototype.write=function(e,r){if(this._checkWritten(),"function"==typeof e&&(r=e),"function"!=typeof r)throw new Error("write() requires a callback argument");return"object"!=typeof e&&(e={}),this._written=!0,"function"==typeof this._write?this._write(r):"function"==typeof this._db._batch?this._db._batch(this._operations,e,r):void t.nextTick(r)},e.exports=r}).call(this,r(2))},function(e,t,r){"use strict";(function(t,n){var i=r(10);e.exports=E;var o=r(37),s;E.ReadableState=S;var a=r(7).EventEmitter,u=function(e,t){return e.listeners(t).length},c=r(386),f=r(4).Buffer,h=t.Uint8Array||function(){};function l(e){return f.from(e)}function d(e){return f.isBuffer(e)||e instanceof h}var p=r(5);p.inherits=r(1);var g=r(766),m=void 0;m=g&&g.debuglog?g.debuglog("stream"):function(){};var b=r(767),y=r(387),v;p.inherits(E,c);var _=["error","close","destroy","pause","resume"];function w(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}function S(e,t){s=s||r(128),e=e||{};var n=t instanceof s;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new b,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=r(13).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function E(e){if(s=s||r(128),!(this instanceof E))return new E(e);this._readableState=new S(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function k(e,t,r,n,i){var o=e._readableState,s;null===t?(o.reading=!1,R(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=l(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):M(e,o)):x(e,o,t,!1))):n||(o.reading=!1));return A(o)}function x(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&B(e)),M(e,t)}function C(e,t){var r;return d(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function O(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(m("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(P,e):P(e))}function P(e){m("emit readable"),e.emit("readable"),U(e)}function M(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=z(e,t.buffer,t.decoder),r);var r}function z(e,t,r){var n;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}function K(e,t){var r=f.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),e-=s,0===e){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}function W(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(V,t,e))}function V(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function G(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return m("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?W(this):B(this),null;if(e=O(e,t),0===e&&t.ended)return 0===t.length&&W(this),null;var n=t.needReadable,i;return m("need readable",n),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&W(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var r=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,m("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,a=s?f:_;function c(e,t){m("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function f(){m("onend"),e.end()}o.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",c);var h=L(r);e.on("drain",h);var l=!1;function d(){m("cleanup"),e.removeListener("close",y),e.removeListener("finish",v),e.removeListener("drain",h),e.removeListener("error",b),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",g),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var p=!1;function g(t){m("ondata"),p=!1;var n=e.write(t);!1!==n||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==G(o.pipes,e))&&!l&&(m("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function b(t){m("onerror",t),_(),e.removeListener("error",b),0===u(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",v),_()}function v(){m("onfinish"),e.removeListener("close",y),_()}function _(){m("unpipe"),r.unpipe(e)}return r.on("data",g),w(e,"error",b),e.once("close",y),e.once("finish",v),e.emit("pipe",r),o.flowing||(m("pipe resume"),r.resume()),e},E.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?this:(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,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var c=r(5);c.inherits=r(1);var f={deprecate:r(38)},h=r(386),l=r(4).Buffer,d=n.Uint8Array||function(){};function p(e){return l.from(e)}function g(e){return l.isBuffer(e)||e instanceof d}var m=r(387),b;function y(){}function v(e,t){u=u||r(128),e=e||{};var n=t instanceof u;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||r(128),!(b.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var r=new Error("write after end");e.emit("error",r),i.nextTick(t,r)}function S(e,t,r,n){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(n,s),o=!1),o}function E(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r)),t}function k(e,t,r,n,i,o){if(!r){var s=E(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||L(this,n,r)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(2),r(8))},function(e,t,r){"use strict";e.exports=s;var n=r(128),i=r(5);function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=l(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):M(e,o)):x(e,o,t,!1))):n||(o.reading=!1));return A(o)}function x(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&B(e)),M(e,t)}function C(e,t){var r;return d(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function O(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(m("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(P,e):P(e))}function P(e){m("emit readable"),e.emit("readable"),U(e)}function M(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=z(e,t.buffer,t.decoder),r);var r}function z(e,t,r){var n;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}function K(e,t){var r=f.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),e-=s,0===e){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}function W(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(V,t,e))}function V(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function G(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return m("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?W(this):B(this),null;if(e=O(e,t),0===e&&t.ended)return 0===t.length&&W(this),null;var n=t.needReadable,i;return m("need readable",n),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&W(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var r=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,m("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,a=s?f:_;function c(e,t){m("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function f(){m("onend"),e.end()}o.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",c);var h=L(r);e.on("drain",h);var l=!1;function d(){m("cleanup"),e.removeListener("close",y),e.removeListener("finish",v),e.removeListener("drain",h),e.removeListener("error",b),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",g),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var p=!1;function g(t){m("ondata"),p=!1;var n=e.write(t);!1!==n||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==G(o.pipes,e))&&!l&&(m("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function b(t){m("onerror",t),_(),e.removeListener("error",b),0===u(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",v),_()}function v(){m("onfinish"),e.removeListener("close",y),_()}function _(){m("unpipe"),r.unpipe(e)}return r.on("data",g),w(e,"error",b),e.once("close",y),e.once("finish",v),e.emit("pipe",r),o.flowing||(m("pipe resume"),r.resume()),e},E.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?this:(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,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o{const r=e+"/"+s;o("locking %s",r),a[r]=!0;const n={close(e){a[r]&&delete a[r],i(e)}};i(()=>{t(null,n)})}),t.locked=((e,t)=>{const r=e+"/"+s;o("checking lock: %s");const n=a[r];i(()=>{t(null,n)})})},function(e,t){e.exports=function(e){var t,r=!1;function n(n){if(!n)throw new Error("must be passed a readable");t=n,r&&e(t)}return n.resolve=n.ready=n.start=function(i){return r=!0,e=i||e,t&&e(t),n},n}},function(e,t,r){var n=r(199),i=r(404);e.exports=function(){var e=n(),t=i();return{source:e,sink:t,resolve:function(r){e.resolve(r.source),t.resolve(r.sink)}}}},function(e,t){var r=t.once=function(e){return function(t,r){if(t)return r(t);if(null!=e){var n=e;e=null,r(null,n)}else r(!0)}},n=t.depthFirst=function(e,t){var n=[],i;return n.unshift(r(e)),function e(r,o){return n.length?i?o(i):void n[0](r,function(r,s){if(r){if(!0!==r){for(i=r,n.shift();n.length;)n.shift()(r,function(){});return o(r)}return n.shift(),e(null,o)}n.unshift(t(s)),o(r,s)}):o(!0)}},i=t.widthFirst=function(e,t){var n=[];return n.push(r(e)),function e(r,i){if(!n.length)return i(!0);n[0](r,function(r,o){if(r)return n.shift(),e(null,i);n.push(t(o)),i(r,o)})}},o=t.leafFirst=function(e,t){var n=[],i=[];return n.push(r(e)),function e(r,o){n[0](r,function(r,s){if(r)return n.shift(),i.length?o(null,i.shift()):o(!0);n.unshift(t(s)),i.unshift(s),e(null,o)})}}},function(e,t,r){"use strict";const n=r(377),i=Object.prototype.hasOwnProperty,o=Object.propertyIsEnumerable,s=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),a=this,u={concatArrays:!1},c=e=>{const t=[];for(const r in e)i.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){const r=Object.getOwnPropertySymbols(e);for(let n=0;n{s(t,r,f(e[r]))}),t}function l(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return c(e).forEach(r=>{s(t,r,f(e[r]))}),t}const d=(e,t,r,n)=>(r.forEach(r=>{r in e&&e[r]!==Object.getPrototypeOf(e)?s(e,r,g(e[r],t[r],n)):s(e,r,f(t[r]))}),e),p=(e,t,r)=>{let n=e.slice(0,0),o=0;return[e,t].forEach(t=>{const a=[];for(let r=0;r-1===a.indexOf(e)),r)}),n};function g(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?p(e,t,r):n(t)&&n(e)?d(e,t,c(t),r):f(t)}e.exports=function(){const e=g(f(u),this!==a&&this||{},u);let t={foobar:{}};for(let r=0;r(e=e.slice(1),new s(e))}});function l(e){let t;try{t=a(e)}catch(e){t=!1}if(t)throw new Error("The object passed has circular references");function r(e){if(!e||n.isBuffer(e)||"string"==typeof e)return e;if(Array.isArray(e))return e.map(r);if(s.isCID(e))return f(e);const t=Object.keys(e);if(1===t.length&&"/"===t[0])return f(e["/"]);if(t.length>0){const n={};return t.forEach(t=>{"object"==typeof e[t]?n[t]=r(e[t]):n[t]=e[t]}),n}return e}return r(e)}t=e.exports,t.serialize=((e,t)=>{let r;try{const n=l(e);r=i.encode(n)}catch(e){return setImmediate(()=>t(e))}setImmediate(()=>t(null,r))}),t.deserialize=((e,t)=>{let r;try{r=h.decodeFirst(e)}catch(e){return setImmediate(()=>t(e))}setImmediate(()=>t(null,r))}),t.cid=((e,r,n)=>{"function"==typeof r&&(n=r,r={}),r=r||{};const i=r.hashAlg||u.defaultHashAlg,a=r.hashLen,c=void 0===r.version?1:r.version;t.serialize(e,(e,t)=>{if(e)return n(e);o(t,i,a,(e,t)=>{if(e)return n(e);n(null,new s(c,u.multicodec,t))})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t,n){const i=r(346),o=r(54),s=r(797),a=r(276),u=r(205),c=r(410),f=r(411),{URL:h}=r(277);class l{constructor(e){e=e||{},!e.size||e.size<65536?e.size=65536:e.size=a.nextPowerOf2(e.size),this._heap=new ArrayBuffer(e.size),this._heap8=new Uint8Array(this._heap),this._buffer=t.from(this._heap),this._reset(),this._knownTags=Object.assign({0:e=>new Date(e),1:e=>new Date(1e3*e),2:e=>a.arrayBufferToBignumber(e),3:e=>u.NEG_ONE.minus(a.arrayBufferToBignumber(e)),4:e=>u.TEN.pow(e[0]).times(e[1]),5:e=>u.TWO.pow(e[0]).times(e[1]),32:e=>new h(e),35:e=>new RegExp(e)},e.tags),this.parser=s(n,{log:console.log.bind(console),pushInt:this.pushInt.bind(this),pushInt32:this.pushInt32.bind(this),pushInt32Neg:this.pushInt32Neg.bind(this),pushInt64:this.pushInt64.bind(this),pushInt64Neg:this.pushInt64Neg.bind(this),pushFloat:this.pushFloat.bind(this),pushFloatSingle:this.pushFloatSingle.bind(this),pushFloatDouble:this.pushFloatDouble.bind(this),pushTrue:this.pushTrue.bind(this),pushFalse:this.pushFalse.bind(this),pushUndefined:this.pushUndefined.bind(this),pushNull:this.pushNull.bind(this),pushInfinity:this.pushInfinity.bind(this),pushInfinityNeg:this.pushInfinityNeg.bind(this),pushNaN:this.pushNaN.bind(this),pushNaNNeg:this.pushNaNNeg.bind(this),pushArrayStart:this.pushArrayStart.bind(this),pushArrayStartFixed:this.pushArrayStartFixed.bind(this),pushArrayStartFixed32:this.pushArrayStartFixed32.bind(this),pushArrayStartFixed64:this.pushArrayStartFixed64.bind(this),pushObjectStart:this.pushObjectStart.bind(this),pushObjectStartFixed:this.pushObjectStartFixed.bind(this),pushObjectStartFixed32:this.pushObjectStartFixed32.bind(this),pushObjectStartFixed64:this.pushObjectStartFixed64.bind(this),pushByteString:this.pushByteString.bind(this),pushByteStringStart:this.pushByteStringStart.bind(this),pushUtf8String:this.pushUtf8String.bind(this),pushUtf8StringStart:this.pushUtf8StringStart.bind(this),pushSimpleUnassigned:this.pushSimpleUnassigned.bind(this),pushTagUnassigned:this.pushTagUnassigned.bind(this),pushTagStart:this.pushTagStart.bind(this),pushTagStart4:this.pushTagStart4.bind(this),pushTagStart8:this.pushTagStart8.bind(this),pushBreak:this.pushBreak.bind(this)},this._heap)}get _depth(){return this._parents.length}get _currentParent(){return this._parents[this._depth-1]}get _ref(){return this._currentParent.ref}_closeParent(){var e=this._parents.pop();if(e.length>0)throw new Error(`Missing ${e.length} elements`);switch(e.type){case u.PARENT.TAG:this._push(this.createTag(e.ref[0],e.ref[1]));break;case u.PARENT.BYTE_STRING:this._push(this.createByteString(e.ref,e.length));break;case u.PARENT.UTF8_STRING:this._push(this.createUtf8String(e.ref,e.length));break;case u.PARENT.MAP:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createMap(e.ref,e.length));break;case u.PARENT.OBJECT:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createObject(e.ref,e.length));break;case u.PARENT.ARRAY:this._push(this.createArray(e.ref,e.length))}this._currentParent&&this._currentParent.type===u.PARENT.TAG&&this._dec()}_dec(){const e=this._currentParent;e.length<0||(e.length--,0===e.length&&this._closeParent())}_push(e,t){const r=this._currentParent;switch(r.values++,r.type){case u.PARENT.ARRAY:case u.PARENT.BYTE_STRING:case u.PARENT.UTF8_STRING:r.length>-1?this._ref[this._ref.length-r.length]=e:this._ref.push(e),this._dec();break;case u.PARENT.OBJECT:null!=r.tmpKey?(this._ref[r.tmpKey]=e,r.tmpKey=null,this._dec()):(r.tmpKey=e,"string"!=typeof r.tmpKey&&(r.type=u.PARENT.MAP,r.ref=a.buildMap(r.ref)));break;case u.PARENT.MAP:null!=r.tmpKey?(this._ref.set(r.tmpKey,e),r.tmpKey=null,this._dec()):r.tmpKey=e;break;case u.PARENT.TAG:this._ref.push(e),t||this._dec();break;default:throw new Error("Unknown parent type")}}_createParent(e,t,r){this._parents[this._depth]={type:t,length:r,ref:e,values:0,tmpKey:null}}_reset(){this._res=[],this._parents=[{type:u.PARENT.ARRAY,length:-1,ref:this._res,values:0,tmpKey:null}]}createTag(e,t){const r=this._knownTags[e];return r?r(t):new f(e,t)}createMap(e,t){return e}createObject(e,t){return e}createArray(e,t){return e}createByteString(e,r){return t.concat(e)}createByteStringFromHeap(e,r){return e===r?t.alloc(0):t.from(this._heap.slice(e,r))}createInt(e){return e}createInt32(e,t){return a.buildInt32(e,t)}createInt64(e,t,r,n){return a.buildInt64(e,t,r,n)}createFloat(e){return e}createFloatSingle(e,t,r,n){return i.read([e,t,r,n],0,!1,23,4)}createFloatDouble(e,t,r,n,o,s,a,u){return i.read([e,t,r,n,o,s,a,u],0,!1,52,8)}createInt32Neg(e,t){return-1-a.buildInt32(e,t)}createInt64Neg(e,t,r,n){const i=a.buildInt32(e,t),s=a.buildInt32(r,n);return i>u.MAX_SAFE_HIGH?u.NEG_ONE.minus(new o(i).times(u.SHIFT32).plus(s)):-1-(i*u.SHIFT32+s)}createTrue(){return!0}createFalse(){return!1}createNull(){return null}createUndefined(){}createInfinity(){return 1/0}createInfinityNeg(){return-1/0}createNaN(){return NaN}createNaNNeg(){return NaN}createUtf8String(e,t){return e.join("")}createUtf8StringFromHeap(e,t){return e===t?"":this._buffer.toString("utf8",e,t)}createSimpleUnassigned(e){return new c(e)}pushInt(e){this._push(this.createInt(e))}pushInt32(e,t){this._push(this.createInt32(e,t))}pushInt64(e,t,r,n){this._push(this.createInt64(e,t,r,n))}pushFloat(e){this._push(this.createFloat(e))}pushFloatSingle(e,t,r,n){this._push(this.createFloatSingle(e,t,r,n))}pushFloatDouble(e,t,r,n,i,o,s,a){this._push(this.createFloatDouble(e,t,r,n,i,o,s,a))}pushInt32Neg(e,t){this._push(this.createInt32Neg(e,t))}pushInt64Neg(e,t,r,n){this._push(this.createInt64Neg(e,t,r,n))}pushTrue(){this._push(this.createTrue())}pushFalse(){this._push(this.createFalse())}pushNull(){this._push(this.createNull())}pushUndefined(){this._push(this.createUndefined())}pushInfinity(){this._push(this.createInfinity())}pushInfinityNeg(){this._push(this.createInfinityNeg())}pushNaN(){this._push(this.createNaN())}pushNaNNeg(){this._push(this.createNaNNeg())}pushArrayStart(){this._createParent([],u.PARENT.ARRAY,-1)}pushArrayStartFixed(e){this._createArrayStartFixed(e)}pushArrayStartFixed32(e,t){const r=a.buildInt32(e,t);this._createArrayStartFixed(r)}pushArrayStartFixed64(e,t,r,n){const i=a.buildInt64(e,t,r,n);this._createArrayStartFixed(i)}pushObjectStart(){this._createObjectStartFixed(-1)}pushObjectStartFixed(e){this._createObjectStartFixed(e)}pushObjectStartFixed32(e,t){const r=a.buildInt32(e,t);this._createObjectStartFixed(r)}pushObjectStartFixed64(e,t,r,n){const i=a.buildInt64(e,t,r,n);this._createObjectStartFixed(i)}pushByteStringStart(){this._parents[this._depth]={type:u.PARENT.BYTE_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushByteString(e,t){this._push(this.createByteStringFromHeap(e,t))}pushUtf8StringStart(){this._parents[this._depth]={type:u.PARENT.UTF8_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushUtf8String(e,t){this._push(this.createUtf8StringFromHeap(e,t))}pushSimpleUnassigned(e){this._push(this.createSimpleUnassigned(e))}pushTagStart(e){this._parents[this._depth]={type:u.PARENT.TAG,length:1,ref:[e]}}pushTagStart4(e,t){this.pushTagStart(a.buildInt32(e,t))}pushTagStart8(e,t,r,n){this.pushTagStart(a.buildInt64(e,t,r,n))}pushTagUnassigned(e){this._push(this.createTag(e))}pushBreak(){if(this._currentParent.length>-1)throw new Error("Unexpected break");this._closeParent()}_createObjectStartFixed(e){0!==e?this._createParent({},u.PARENT.OBJECT,e):this._push(this.createObject({}))}_createArrayStartFixed(e){0!==e?this._createParent(new Array(e),u.PARENT.ARRAY,e):this._push(this.createArray([]))}_decode(e){if(0===e.byteLength)throw new Error("Input too short");this._reset(),this._heap8.set(e);const t=this.parser.parse(e.byteLength);if(this._depth>1){for(;0===this._currentParent.length;)this._closeParent();if(this._depth>1)throw new Error("Undeterminated nesting")}if(t>0)throw new Error("Failed to parse");if(0===this._res.length)throw new Error("No valid result")}decodeFirst(e){return this._decode(e),this._res[0]}decodeAll(e){return this._decode(e),this._res}static decode(e,r){"string"==typeof e&&(e=t.from(e,r||"hex"));const n=new l({size:e.length});return n.decodeFirst(e)}static decodeAll(e,r){"string"==typeof e&&(e=t.from(e,r||"hex"));const n=new l({size:e.length});return n.decodeAll(e)}}l.decodeFirst=l.decode,e.exports=l}).call(this,r(0).Buffer,r(8))},function(e,t,r){"use strict";const n=r(205),i=n.MT,o=n.SIMPLE,s=n.SYMS;class a{constructor(e){if("number"!=typeof e)throw new Error("Invalid Simple type: "+typeof e);if(e<0||e>255||(0|e)!==e)throw new Error("value must be a small positive integer: "+e);this.value=e}toString(){return"simple("+this.value+")"}inspect(){return"simple("+this.value+")"}encodeCBOR(e){return e._pushInt(this.value,i.SIMPLE_FLOAT)}static isSimple(e){return e instanceof a}static decode(e,t){switch(null==t&&(t=!0),e){case o.FALSE:return!1;case o.TRUE:return!0;case o.NULL:return t?null:s.NULL;case o.UNDEFINED:return t?void 0:s.UNDEFINED;case-1:if(!t)throw new Error("Invalid BREAK");return s.BREAK;default:return new a(e)}}}e.exports=a},function(e,t,r){"use strict";class n{constructor(e,t,r){if(this.tag=e,this.value=t,this.err=r,"number"!=typeof this.tag)throw new Error("Invalid tag type ("+typeof this.tag+")");if(this.tag<0||(0|this.tag)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(e){return e._pushTag(this.tag),e.pushAny(this.value)}convert(e){var t,r;if(r=null!=e?e[this.tag]:void 0,"function"!=typeof r&&(r=n["_tag"+this.tag],"function"!=typeof r))return this;try{return r.call(n,this.value)}catch(e){return t=e,this.err=t,this}}}e.exports=n},function(e,t,r){"use strict";const n=self.location?self.location.protocol+"//"+self.location.host:"",i=self.URL;class o{constructor(e,t=n){this.super=new i(e,t),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set origin(e){this.super.origin=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set searchParams(e){this.super.searchParams=e}set username(e){this.super.username=e}createObjectURL(e){return this.super.createObjectURL(e)}revokeObjectURL(e){this.super.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}}function s(e){if("string"==typeof e){const t=new i(e);return t.toString()}if(!(e instanceof i)){const t=e.username&&e.password?`${e.username}:${e.password}@`:"",r=e.auth?e.auth+"@":"",n=e.port?":"+e.port:"",i=e.protocol?e.protocol+"//":"",o=e.host||"",s=e.hostname||"",a=e.search||(e.query?"?"+e.query:""),u=e.hash||"",c=e.pathname||"",f=e.path||c+a;return`${i}${t||r}${o||s+n}${f}${u}`}}e.exports={URLWithLegacySupport:o,URLSearchParams:self.URLSearchParams,defaultBase:n,format:s}},function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t,r){e.exports=r(802)},function(e,t,r){"use strict";(function(e,r){t.toCallback=(t=>(function(r,n){let i;try{i=t(r)}catch(t){return void e.nextTick(n,t)}e.nextTick(n,null,i)})),t.toBuf=((e,t)=>n=>{let i=e(n,t);return r.from(i,"hex")}),t.fromString=((e,t)=>n=>{const i=r.isBuffer(n)?n.toString():n;return e(i,t)}),t.fromNumberTo32BitBuf=((e,t)=>n=>{let i=e(n,t);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return r.from(o)})}).call(this,r(2),r(0).Buffer)},function(e,t,r){(function(t){var n=r(804),i=r(417),o;function s(e,t){return"function"!=typeof t?e:e.then(function(e){o(function(){t(null,e)})},function(e){o(function(){t(e)})})}function a(e){return s(this,e)}function u(e){if(e&&i(e)){e.nodeify=a;var t=e.then;return e.then=function(){return u(t.apply(this,arguments))},e}"function"==typeof e?e.prototype.nodeify=a:n.prototype.nodeify=a}function c(e){if(!(this instanceof c))return new c(e);n.call(this,e),u(this)}o="function"==typeof setImmediate?setImmediate:"object"==typeof t&&t&&t.nextTick?t.nextTick:function(e){setTimeout(e,0)},e.exports=s,s.extend=u,s.Promise=c,c.prototype=Object.create(n.prototype),c.prototype.constructor=c}).call(this,r(2))},function(e,t){function r(e){return e&&"function"==typeof e.then}e.exports=r},function(e,t,r){var n=r(806),i=r(807);e.exports={blake2b:n.blake2b,blake2bHex:n.blake2bHex,blake2bInit:n.blake2bInit,blake2bUpdate:n.blake2bUpdate,blake2bFinal:n.blake2bFinal,blake2s:i.blake2s,blake2sHex:i.blake2sHex,blake2sInit:i.blake2sInit,blake2sUpdate:i.blake2sUpdate,blake2sFinal:i.blake2sFinal}},function(e,t,r){(function(t){var r="Input must be an string, Buffer or Uint8Array";function n(e){var n;if(e instanceof Uint8Array)n=e;else if(e instanceof t)n=new Uint8Array(e);else{if("string"!=typeof e)throw new Error(r);n=new Uint8Array(t.from(e,"utf8"))}return n}function i(e){return Array.prototype.map.call(e,function(e){return(e<16?"0":"")+e.toString(16)}).join("")}function o(e){return(4294967296+e).toString(16).substring(1)}function s(e,t,r){for(var n="\n"+e+" = ",i=0;i{"function"==typeof t&&(r=t,t=void 0),i.deserialize(e,(e,i)=>{if(e)return r(e);if(!t||"/"===t)return r(null,{value:i,remainderPath:""});const s=t.split("/"),a=o(i).get(s);if(void 0!==a)return r(null,{value:a,remainderPath:""});let u;const c=s.length;for(let e=0;e{"function"==typeof t&&(r=t,t=void 0),t=t||{},i.deserialize(e,(e,t)=>{if(e)return r(e);const n=a(t),i=n.map(e=>e.path);r(null,i)})}),t.isLink=((e,r,n)=>{t.resolve(e,r,(e,t)=>e?n(e):t.remainderPath.length>0?n(new Error("path out of scope")):void(s.isCID(t.value)?n(null,t.value):n(null,!1)))})}).call(this,r(0).Buffer)},function(e,t){var r=e.exports=function(e){return new n(e)};function n(e){this.value=e}function i(e,t,r){var n=[],i=[],a=!0;return function e(u){var c=r?o(u):u,f={},h=!0,l={node:c,node_:u,path:[].concat(n),parent:i[i.length-1],parents:i,key:n.slice(-1)[0],isRoot:0===n.length,level:n.length,circular:null,update:function(e,t){l.isRoot||(l.parent.node[l.key]=e),l.node=e,t&&(h=!1)},delete:function(e){delete l.parent.node[l.key],e&&(h=!1)},remove:function(e){p(l.parent.node)?l.parent.node.splice(l.key,1):delete l.parent.node[l.key],e&&(h=!1)},keys:null,before:function(e){f.before=e},after:function(e){f.after=e},pre:function(e){f.pre=e},post:function(e){f.post=e},stop:function(){a=!1},block:function(){h=!1}};if(!a)return l;function d(){if("object"==typeof l.node&&null!==l.node){l.keys&&l.node_===l.node||(l.keys=s(l.node)),l.isLeaf=0==l.keys.length;for(var e=0;e{n([t=>o.deserialize(e,t),(e,n)=>{if(!t)return r(null,{value:e,remainderPath:""});const i=t.split("/");if("Links"===i[0]){let t="";if(!i[1])return n(null,{value:e.links.map(e=>e.toJSON()),remainderPath:""});const r={};e.links.forEach((e,t)=>{const n=e.toJSON();r[t]=r[n.name]={cid:n.cid,name:n.name,size:n.size}});let o=r[i[1]];"Hash"===i[2]?o={"/":o.cid}:"Tsize"===i[2]?o=o.size:"Name"===i[2]&&(o=o.name),t=i.slice(3).join("/"),n(null,{value:o,remainderPath:t})}else if("Data"===i[0])n(null,{value:e.data,remainderPath:""});else{const t={};e.links.forEach((e,r)=>{const n=e.toJSON();t[n.name]={cid:n.cid,name:n.name,size:n.size}});const r=t[i[0]];if(r)return n(null,{value:{"/":r.cid},remainderPath:i.slice(1).join("/")});n(new Error("path not available"))}}],r)}),t.tree=((e,t,r)=>{"function"==typeof t&&(r=t,t={}),t=t||{},o.deserialize(e,(e,t)=>{if(e)return r(e);const n=[];n.push("Links"),t.links.forEach((e,t)=>{n.push(`Links/${t}/Name`),n.push(`Links/${t}/Tsize`),n.push(`Links/${t}/Hash`)}),n.push("Data"),r(null,n)})}),t.isLink=((e,r,n)=>{t.resolve(e,r,(e,t)=>{if(e)return n(e);if(t.remainderPath.length>0)return n(new Error("path out of scope"));if("object"==typeof t.value&&t.value["/"]){let r;try{r=i.isCID(new i(t.value["/"]))}catch(e){r=!1}if(r)return n(null,t.value)}n(null,!1)})})},function(e,t,r){"use strict";(function(n){const i=r(60),o=i(r(279));r(129),r(280),r(281);const s=r(16);t=e.exports;const a={rsa:r(836),ed25519:r(851),secp256k1:r(855)(o,r(286))};function u(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=o,t.keyStretcher=r(871),t.generateEphemeralKeyPair=r(873),t.generateKeyPair=((e,t,r)=>{let n=a[e.toLowerCase()];if(!n)return r(new Error("invalid or unsupported key type"));n.generateKeyPair(t,r)}),t.generateKeyPairFromSeed=((e,t,r,n)=>{let i=a[e.toLowerCase()];return i?"ed25519"!==e.toLowerCase()?n(new Error("Seed key derivation is unimplemented for RSA or secp256k1")):void i.generateKeyPairFromSeed(t,r,n):n(new Error("invalid or unsupported key type"))}),t.unmarshalPublicKey=(e=>{const t=o.PublicKey.decode(e),r=t.Data;switch(t.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPublicKey(r);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PublicKey(r);case o.KeyType.Secp256k1:if(a.secp256k1)return a.secp256k1.unmarshalSecp256k1PublicKey(r);throw new Error("secp256k1 support requires libp2p-crypto-secp256k1 package");default:throw new Error("invalid or unsupported key type")}}),t.marshalPublicKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=o.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPrivateKey(n,t);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PrivateKey(n,t);case o.KeyType.Secp256k1:return a.secp256k1?a.secp256k1.unmarshalSecp256k1PrivateKey(n,t):t(new Error("secp256k1 support requires libp2p-crypto-secp256k1 package"));default:t(new Error("invalid or unsupported key type"))}}),t.marshalPrivateKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=s.pki.decryptRsaPrivateKey(e,t);if(null===i)throw new Error("Cannot read the key, most likely the password is wrong or not a RSA key");let o=s.asn1.toDer(s.pki.privateKeyToAsn1(i));return o=n.from(o.getBytes(),"binary"),a.rsa.unmarshalRsaPrivateKey(o,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){var n=r(16),i;e.exports=n.jsbn=n.jsbn||{};var o=0xdeadbeefcafe,s=!0;function a(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function u(){return new a(null)}function c(e,t,r,n,i,o){for(;--o>=0;){var s=t*this.data[e++]+r.data[n]+i;i=Math.floor(s/67108864),r.data[n++]=67108863&s}return i}function f(e,t,r,n,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var u=32767&this.data[e],c=this.data[e++]>>15,f=a*u+c*s;u=s*u+((32767&f)<<15)+r.data[n]+(1073741823&i),i=(u>>>30)+(f>>>15)+a*c+(i>>>30),r.data[n++]=1073741823&u}return i}function h(e,t,r,n,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var u=16383&this.data[e],c=this.data[e++]>>14,f=a*u+c*s;u=s*u+((16383&f)<<14)+r.data[n]+i,i=(u>>28)+(f>>14)+a*c,r.data[n++]=268435455&u}return i}n.jsbn.BigInteger=a,"undefined"==typeof navigator?(a.prototype.am=h,i=28):"Microsoft Internet Explorer"==navigator.appName?(a.prototype.am=f,i=30):"Netscape"!=navigator.appName?(a.prototype.am=c,i=26):(a.prototype.am=h,i=28),a.prototype.DB=i,a.prototype.DM=(1<=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function _(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function w(e){var t=u();return t.fromInt(e),t}function S(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,i=!1,o=0;--n>=0;){var s=8==r?255&e[n]:y(e,n);s<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==o?this.data[this.t++]=s:o+r>this.DB?(this.data[this.t-1]|=(s&(1<>this.DB-o):this.data[this.t-1]|=s<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function k(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r=(1<0)for(a>a)>0&&(i=!0,o=b(n));s>=0;)a>(a+=this.DB-t)):(n=this.data[s]>>(a-=t)&r,a<=0&&(a+=this.DB,--s)),n>0&&(i=!0),i&&(o+=b(n));return i?o:"0"}function x(){var e=u();return a.ZERO.subTo(this,e),e}function C(){return this.s<0?this.negate():this}function A(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(t=r-e.t,0!=t)return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function I(e){var t=1,r;return 0!=(r=e>>>16)&&(e=r,t+=16),0!=(r=e>>8)&&(e=r,t+=8),0!=(r=e>>4)&&(e=r,t+=4),0!=(r=e>>2)&&(e=r,t+=2),0!=(r=e>>1)&&(e=r,t+=1),t}function T(){return this.t<=0?0:this.DB*(this.t-1)+I(this.data[this.t-1]^this.s&this.DM)}function O(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function R(e,t){for(var r=e;r=0;--a)t.data[a+o+1]=this.data[a]>>n|s,s=(this.data[a]&i)<=0;--a)t.data[a]=0;t.data[o]=s,t.t=this.t+o+1,t.s=this.s,t.clamp()}function P(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,o=(1<>n;for(var s=r+1;s>n;n>0&&(t.data[this.t-r-1]|=(this.s&o)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function N(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function j(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(f,o),i.lShiftTo(f,r)):(n.copyTo(o),i.copyTo(r));var h=o.t,l=o.data[h-1];if(0!=l){var d=l*(1<1?o.data[h-2]>>this.F2:0),p=this.FV/d,g=(1<=0&&(r.data[r.t++]=1,r.subTo(v,r)),a.ONE.dlShiftTo(h,v),v.subTo(o,o);o.t=0;){var _=r.data[--b]==l?this.DM:Math.floor(r.data[b]*p+(r.data[b-1]+m)*g);if((r.data[b]+=o.am(0,_,r,y,0,h))<_)for(o.dlShiftTo(y,v),r.subTo(v,r);r.data[b]<--_;)r.subTo(v,r)}null!=t&&(r.drShiftTo(h,t),s!=c&&a.ZERO.subTo(t,t)),r.t=h,r.clamp(),f>0&&r.rShiftTo(f,r),s<0&&a.ZERO.subTo(r,r)}}}function D(e){var t=u();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(a.ZERO)>0&&e.subTo(t,t),t}function F(e){this.m=e}function U(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function q(e){return e}function z(e){e.divRemTo(this.m,null,e)}function H(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function K(e,t){e.squareTo(t),this.reduce(t)}function W(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function V(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t}function $(e){var t=u();return e.copyTo(t),this.reduce(t),t}function Y(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function J(e,t){e.squareTo(t),this.reduce(t)}function X(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function Z(){return 0==(this.t>0?1&this.data[0]:this.s)}function Q(e,t){if(e>4294967295||e<1)return a.ONE;var r=u(),n=u(),i=t.convert(this),o=I(e)-1;for(i.copyTo(r);--o>=0;)if(t.sqrTo(r,n),(e&1<0)t.mulTo(n,i,r);else{var s=r;r=n,n=s}return t.revert(r)}function ee(e,t){var r;return r=e<256||t.isEven()?new F(t):new V(t),this.exp(e,r)}function te(){var e=u();return this.copyTo(e),e}function re(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<>24}function ie(){return 0==this.t?this.s:this.data[0]<<16>>16}function oe(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function se(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1}function ae(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=w(r),i=u(),o=u(),s="";for(this.divRemTo(n,i,o);i.signum()>0;)s=(r+o.intValue()).toString(e).substr(1)+s,i.divRemTo(n,i,o);return o.intValue().toString(e)+s}function ue(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,o=0,s=0,u=0;u=r&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(s,0)),i&&a.ZERO.subTo(this,this)}function ce(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(a.ONE.shiftLeft(e-1),be,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(a.ONE.shiftLeft(e-1),this);else{var n=new Array,i=7&e;n.length=1+(e>>3),t.nextBytes(n),i>0?n[0]&=(1<0)for(r>r)!=(this.s&this.DM)>>r&&(t[i++]=n|this.s<=0;)r<8?(n=(this.data[e]&(1<>(r+=this.DB-8)):(n=this.data[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),0!=(128&n)&&(n|=-256),0==i&&(128&this.s)!=(128&n)&&++i,(i>0||n!=this.s)&&(t[i++]=n);return t}function he(e){return 0==this.compareTo(e)}function le(e){return this.compareTo(e)<0?this:e}function de(e){return this.compareTo(e)>0?this:e}function pe(e,t,r){var n,i,o=Math.min(e.t,this.t);for(n=0;n>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function Ae(){for(var e=0;e=this.t?0!=this.s:0!=(this.data[t]&1<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()}function Le(e){var t=u();return this.addTo(e,t),t}function je(e){var t=u();return this.subTo(e,t),t}function De(e){var t=u();return this.multiplyTo(e,t),t}function Fe(e){var t=u();return this.divRemTo(e,t,null),t}function Ue(e){var t=u();return this.divRemTo(e,null,t),t}function qe(e){var t=u(),r=u();return this.divRemTo(e,t,r),new Array(t,r)}function ze(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function He(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function Ke(){}function We(e){return e}function Ve(e,t,r){e.multiplyTo(t,r)}function Ge(e,t){e.squareTo(t)}function $e(e){return this.exp(e,new Ke)}function Ye(e,t,r){var n=Math.min(this.t+e.t,t),i;for(r.s=0,r.t=n;n>0;)r.data[--n]=0;for(i=r.t-this.t;n=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=u();return e.copyTo(t),this.reduce(t),t}function Qe(e){return e}function et(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function tt(e,t){e.squareTo(t),this.reduce(t)}function rt(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function nt(e,t){var r=e.bitLength(),n,i=w(1),o;if(r<=0)return i;n=r<18?1:r<48?3:r<144?4:r<768?5:6,o=r<8?new F(t):t.isEven()?new Xe(t):new V(t);var s=new Array,a=3,c=n-1,f=(1<1){var h=u();for(o.sqrTo(s[1],h);a<=f;)s[a]=u(),o.mulTo(h,s[a-2],s[a]),a+=2}var l=e.t-1,d,p=!0,g=u(),m;for(r=I(e.data[l])-1;l>=0;){for(r>=c?d=e.data[l]>>r-c&f:(d=(e.data[l]&(1<0&&(d|=e.data[l-1]>>this.DB+r-c)),a=n;0==(1&d);)d>>=1,--a;if((r-=a)<0&&(r+=this.DB,--l),p)s[d].copyTo(i),p=!1;else{for(;a>1;)o.sqrTo(i,g),o.sqrTo(g,i),a-=2;a>0?o.sqrTo(i,g):(m=i,i=g,g=m),o.mulTo(g,s[d],i)}for(;l>=0&&0==(e.data[l]&1<0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r}function ot(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r}function st(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return a.ZERO;for(var r=e.clone(),n=this.clone(),i=w(1),o=w(0),s=w(0),u=w(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),t?(s.isEven()&&u.isEven()||(s.addTo(this,s),u.subTo(e,u)),s.rShiftTo(1,s)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(s,i),o.subTo(u,o)):(n.subTo(r,n),t&&s.subTo(i,s),u.subTo(o,u))}return 0!=n.compareTo(a.ONE)?a.ZERO:u.compareTo(e)>=0?u.subtract(e):u.signum()<0?(u.addTo(e,u),u.signum()<0?u.add(e):u):u}F.prototype.convert=U,F.prototype.revert=q,F.prototype.reduce=z,F.prototype.mulTo=H,F.prototype.sqrTo=K,V.prototype.convert=G,V.prototype.revert=$,V.prototype.reduce=Y,V.prototype.mulTo=X,V.prototype.sqrTo=J,a.prototype.copyTo=v,a.prototype.fromInt=_,a.prototype.fromString=S,a.prototype.clamp=E,a.prototype.dlShiftTo=O,a.prototype.drShiftTo=R,a.prototype.lShiftTo=B,a.prototype.rShiftTo=P,a.prototype.subTo=M,a.prototype.multiplyTo=N,a.prototype.squareTo=L,a.prototype.divRemTo=j,a.prototype.invDigit=W,a.prototype.isEven=Z,a.prototype.exp=Q,a.prototype.toString=k,a.prototype.negate=x,a.prototype.abs=C,a.prototype.compareTo=A,a.prototype.bitLength=T,a.prototype.mod=D,a.prototype.modPowInt=ee,a.ZERO=w(0),a.ONE=w(1),Ke.prototype.convert=We,Ke.prototype.revert=We,Ke.prototype.mulTo=Ve,Ke.prototype.sqrTo=Ge,Xe.prototype.convert=Ze,Xe.prototype.revert=Qe,Xe.prototype.reduce=et,Xe.prototype.mulTo=rt,Xe.prototype.sqrTo=tt;var at=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],ut=(1<<26)/at[at.length-1];function ct(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=at[at.length-1]){for(t=0;t=0);var u=o.modPow(n,this);if(0!=u.compareTo(a.ONE)&&0!=u.compareTo(t)){for(var c=1;c++4){var t=e;e=n.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0)e.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0)e.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0)e.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}s(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=n.util.createBuffer(e.iv),r;if(this._cipherLength=0,r="additionalData"in e?n.util.createBuffer(e.additionalData):n.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=n.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=t.length();if(12===i)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(8*i)))}this._inBlock=this._j0.slice(0),s(this._inBlock),this._partialBytes=0,r=n.util.createBuffer(r),this._aDataLength=a(8*r.length());var o=r.length()%this.blockSize;for(o&&r.fillWithByte(0,this.blockSize-o),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},i.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),s(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),s(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,i=e[n]>>>4*(7-r%8)&15,o=this._m[r][i];t[0]^=o[0],t[1]^=o[1],t[2]^=o[2],t[3]^=o[3]}return t},i.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},i.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,i=16*r,o=new Array(i),s=0;s>>1,i=new Array(r);i[n]=e.slice(0);for(var o=n>>>1;o>0;)this.pow(i[2*o],i[o]=[]),o>>=1;for(o=2;o4||!a||"sha1"===a))return"string"!=typeof a&&(a="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),u?4===o.pbkdf2Sync.length?o.pbkdf2(e,r,i,s,function(e,t){if(e)return u(e);u(null,t.toString("binary"))}):o.pbkdf2(e,r,i,s,a,function(e,t){if(e)return u(e);u(null,t.toString("binary"))}):4===o.pbkdf2Sync.length?o.pbkdf2Sync(e,r,i,s).toString("binary"):o.pbkdf2Sync(e,r,i,s,a).toString("binary");if(void 0!==a&&null!==a||(a="sha1"),"string"==typeof a){if(!(a in n.md.algorithms))throw new Error("Unknown hash algorithm: "+a);a=n.md[a].create()}var c=a.digestLength;if(s>4294967295*c){var f=new Error("Derived key is too long.");if(u)return u(f);throw f}var h=Math.ceil(s/c),l=s-(h-1)*c,d=n.hmac.create();d.start(a,e);var p="",g,m,b;if(!u){for(var y=1;y<=h;++y){d.start(null,null),d.update(r),d.update(n.util.int32ToBytes(y)),g=b=d.digest().getBytes();for(var v=2;v<=i;++v)d.start(null,null),d.update(b),m=d.digest().getBytes(),g=n.util.xorBytes(g,m,c),b=m;p+=yh)return u(null,p);d.start(null,null),d.update(r),d.update(n.util.int32ToBytes(y)),g=b=d.digest().getBytes(),v=2,w()}function w(){if(v<=i)return d.start(null,null),d.update(b),m=d.digest().getBytes(),g=n.util.xorBytes(g,m,c),b=m,++v,n.util.setImmediate(w);p+=y>6],i=0==(32&r);if(31==(31&r)){let n=r;for(r=0;128==(128&n);){if(n=e.readUInt8(t),e.isError(n))return n;r<<=7,r|=127&n}}else r&=31;const o=a.tag[r];return{cls:n,primitive:i,tag:r,tagStr:o}}function h(e,t,r){let n=e.readUInt8(r);if(e.isError(n))return n;if(!t&&128===n)return null;if(0==(128&n))return n;const i=127&n;if(i>4)return e.error("length octect is too long");n=0;for(let t=0;t=31?n.error("Multi-octet tag encoding unsupported"):(t||(i|=32),i|=a.tagClassByName[r||"universal"]<<6,i)}e.exports=u,u.prototype.encode=function e(t,r){return this.tree._encode(t,r).join()},n(c,s.Node),c.prototype._encodeComposite=function e(t,r,n,o){const s=h(t,r,n,this.reporter);if(o.length<128){const e=new i(2);return e[0]=s,e[1]=o.length,this._createEncoderBuffer([e,o])}let a=1;for(let e=o.length;e>=256;e>>=8)a++;const u=new i(2+a);u[0]=s,u[1]=128|a;for(let e=1+a,t=o.length;t>0;e--,t>>=8)u[e]=255&t;return this._createEncoderBuffer([u,o])},c.prototype._encodeStr=function e(t,r){if("bitstr"===r)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===r){const e=new i(2*t.length);for(let r=0;r=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}let o=0;for(let e=0;e=128;r>>=7)o++}const s=new i(o);let a=s.length-1;for(let e=t.length-1;e>=0;e--){let r=t[e];for(s[a--]=127&r;(r>>=7)>0;)s[a--]=128|127&r}return this._createEncoderBuffer(s)},c.prototype._encodeTime=function e(t,r){let n;const i=new Date(t);return"gentime"===r?n=[f(i.getUTCFullYear()),f(i.getUTCMonth()+1),f(i.getUTCDate()),f(i.getUTCHours()),f(i.getUTCMinutes()),f(i.getUTCSeconds()),"Z"].join(""):"utctime"===r?n=[f(i.getUTCFullYear()%100),f(i.getUTCMonth()+1),f(i.getUTCDate()),f(i.getUTCHours()),f(i.getUTCMinutes()),f(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+r+" time is not supported yet"),this._encodeStr(n,"octstr")},c.prototype._encodeNull=function e(){return this._createEncoderBuffer("")},c.prototype._encodeInt=function e(t,r){if("string"==typeof t){if(!r)return this.reporter.error("String int or enum given, but no values map");if(!r.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=r[t]}if("number"!=typeof t&&!i.isBuffer(t)){const e=t.toArray();!t.sign&&128&e[0]&&e.unshift(0),t=new i(e)}if(i.isBuffer(t)){let e=t.length;0===t.length&&e++;const r=new i(e);return t.copy(r),0===t.length&&(r[0]=0),this._createEncoderBuffer(r)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);let n=1;for(let e=t;e>=256;e>>=8)n++;const o=new Array(n);for(let e=o.length-1;e>=0;e--)o[e]=255&t,t>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new i(o))},c.prototype._encodeBool=function e(t){return this._createEncoderBuffer(t?255:0)},c.prototype._use=function e(t,r){return"function"==typeof t&&(t=t(r)),t._getEncoder("der").tree},c.prototype._skipDefault=function e(t,r,n){const i=this._baseState;let o;if(null===i.default)return!1;const s=t.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,r,n).join()),s.length!==i.defaultBuffer.length)return!1;for(o=0;o=this._blockSize;){for(var o=this._blockOffset;o0;++a)this._length[a]+=u,u=this._length[a]/4294967296|0,u>0&&(this._length[a]-=4294967296*u);return this},a.prototype._update=function(){throw new Error("_update is not implemented")},a.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},a.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=a},function(e,t,r){"use strict";var n=r(0).Buffer,i=r(1),o=r(435),s=new Array(16),a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],u=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],c=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],f=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],h=[0,1518500249,1859775393,2400959708,2840853838],l=[1352829926,1548603684,1836072691,2053994217,0];function d(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(e,t){return e<>>32-t}function g(e,t,r,n,i,o,s,a){return p(e+(t^r^n)+o+s|0,a)+i|0}function m(e,t,r,n,i,o,s,a){return p(e+(t&r|~t&n)+o+s|0,a)+i|0}function b(e,t,r,n,i,o,s,a){return p(e+((t|~r)^n)+o+s|0,a)+i|0}function y(e,t,r,n,i,o,s,a){return p(e+(t&n|r&~n)+o+s|0,a)+i|0}function v(e,t,r,n,i,o,s,a){return p(e+(t^(r|~n))+o+s|0,a)+i|0}i(d,o),d.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,d=0|this._e,_=0|this._a,w=0|this._b,S=0|this._c,E=0|this._d,k=0|this._e,x=0;x<80;x+=1){var C,A;x<16?(C=g(r,n,i,o,d,e[a[x]],h[0],c[x]),A=v(_,w,S,E,k,e[u[x]],l[0],f[x])):x<32?(C=m(r,n,i,o,d,e[a[x]],h[1],c[x]),A=y(_,w,S,E,k,e[u[x]],l[1],f[x])):x<48?(C=b(r,n,i,o,d,e[a[x]],h[2],c[x]),A=b(_,w,S,E,k,e[u[x]],l[2],f[x])):x<64?(C=y(r,n,i,o,d,e[a[x]],h[3],c[x]),A=m(_,w,S,E,k,e[u[x]],l[3],f[x])):(C=v(r,n,i,o,d,e[a[x]],h[4],c[x]),A=g(_,w,S,E,k,e[u[x]],l[4],f[x])),r=d,d=o,o=p(i,10),i=n,n=C,_=k,k=E,E=p(S,10),S=w,w=A}var I=this._b+i+E|0;this._b=this._c+o+k|0,this._c=this._d+d+_|0,this._d=this._e+r+w|0,this._e=this._a+n+S|0,this._a=I},d.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=n.alloc?n.alloc(20):new n(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},e.exports=d},function(e,t,r){var t=e.exports=function e(r){r=r.toLowerCase();var n=t[r];if(!n)throw new Error(r+" is not supported (we accept pull requests)");return new n};t.sha=r(861),t.sha1=r(862),t.sha224=r(863),t.sha256=r(438),t.sha384=r(864),t.sha512=r(439)},function(e,t,r){var n=r(1),i=r(133),o=r(4).Buffer,s=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],a=new Array(64);function u(){this.init(),this._w=a,i.call(this,64,56)}function c(e,t,r){return r^e&(t^r)}function f(e,t,r){return e&t|r&(e|t)}function h(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function l(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function d(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function p(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}n(u,i),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(e){for(var t=this._w,r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,u=0|this._f,g=0|this._g,m=0|this._h,b=0;b<16;++b)t[b]=e.readInt32BE(4*b);for(;b<64;++b)t[b]=p(t[b-2])+t[b-7]+d(t[b-15])+t[b-16]|0;for(var y=0;y<64;++y){var v=m+l(a)+c(a,u,g)+s[y]+t[y]|0,_=h(r)+f(r,n,i)|0;m=g,g=u,u=a,a=o+v|0,o=i,i=n,n=r,r=v+_|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0,this._f=u+this._f|0,this._g=g+this._g|0,this._h=m+this._h|0},u.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=u},function(e,t,r){var n=r(1),i=r(133),o=r(4).Buffer,s=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],a=new Array(160);function u(){this.init(),this._w=a,i.call(this,128,112)}function c(e,t,r){return r^e&(t^r)}function f(e,t,r){return e&t|r&(e|t)}function h(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function l(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function d(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function p(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function g(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function m(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function b(e,t){return e>>>0>>0?1:0}n(u,i),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,u=0|this._fh,y=0|this._gh,v=0|this._hh,_=0|this._al,w=0|this._bl,S=0|this._cl,E=0|this._dl,k=0|this._el,x=0|this._fl,C=0|this._gl,A=0|this._hl,I=0;I<32;I+=2)t[I]=e.readInt32BE(4*I),t[I+1]=e.readInt32BE(4*I+4);for(;I<160;I+=2){var T=t[I-30],O=t[I-30+1],R=d(T,O),B=p(O,T);T=t[I-4],O=t[I-4+1];var P=g(T,O),M=m(O,T),N=t[I-14],L=t[I-14+1],j=t[I-32],D=t[I-32+1],F=B+L|0,U=R+N+b(F,B)|0;F=F+M|0,U=U+P+b(F,M)|0,F=F+D|0,U=U+j+b(F,D)|0,t[I]=U,t[I+1]=F}for(var q=0;q<160;q+=2){U=t[q],F=t[q+1];var z=f(r,n,i),H=f(_,w,S),K=h(r,_),W=h(_,r),V=l(a,k),G=l(k,a),$=s[q],Y=s[q+1],J=c(a,u,y),X=c(k,x,C),Z=A+G|0,Q=v+V+b(Z,A)|0;Z=Z+X|0,Q=Q+J+b(Z,X)|0,Z=Z+Y|0,Q=Q+$+b(Z,Y)|0,Z=Z+F|0,Q=Q+U+b(Z,F)|0;var ee=W+H|0,te=K+z+b(ee,W)|0;v=y,A=C,y=u,C=x,u=a,x=k,k=E+Z|0,a=o+Q+b(k,E)|0,o=i,E=S,i=n,S=w,n=r,w=_,_=Z+ee|0,r=Q+te+b(_,Z)|0}this._al=this._al+_|0,this._bl=this._bl+w|0,this._cl=this._cl+S|0,this._dl=this._dl+E|0,this._el=this._el+k|0,this._fl=this._fl+x|0,this._gl=this._gl+C|0,this._hl=this._hl+A|0,this._ah=this._ah+r+b(this._al,_)|0,this._bh=this._bh+n+b(this._bl,w)|0,this._ch=this._ch+i+b(this._cl,S)|0,this._dh=this._dh+o+b(this._dl,E)|0,this._eh=this._eh+a+b(this._el,k)|0,this._fh=this._fh+u+b(this._fl,x)|0,this._gh=this._gh+y+b(this._gl,C)|0,this._hh=this._hh+v+b(this._hl,A)|0},u.prototype._hash=function(){var e=o.allocUnsafe(64);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},e.exports=u},function(e,t,r){"use strict";var n=r(4).Buffer,i=r(211),o=r(441);function s(e,t){null===e&&null===t?(this.x=this.y=null,this.inf=!0):(this.x=e,this.y=t,this.inf=!1)}s.fromPublicKey=function(e){var t=e[0],r,n;return 33!==e.length||2!==t&&3!==t?65!==e.length||4!==t&&6!==t&&7!==t?null:(r=i.fromBuffer(e.slice(1,33)),n=i.fromBuffer(e.slice(33,65)),r.ucmp(i.p)>=0||n.ucmp(i.p)>=0?null:6!==t&&7!==t||n.isOdd()===(7===t)?0!==r.redSqr().redMul(r).redIAdd7().ucmp(n.redSqr())?null:new s(r,n):null):(r=i.fromBuffer(e.slice(1,33)),r.ucmp(i.p)>=0?null:(n=r.redSqr().redMul(r).redIAdd7().redSqrt(),null===n?null:(3===t!==n.isOdd()&&(n=n.redNeg()),new s(r,n))))},s.prototype.toPublicKey=function(e){var t=this.x,r=this.y,i;return e?(i=n.alloc(33),i[0]=r.isOdd()?3:2,t.toBuffer().copy(i,1)):(i=n.alloc(65),i[0]=4,t.toBuffer().copy(i,1),r.toBuffer().copy(i,33)),i},s.fromECJPoint=function(e){if(e.inf)return new s(null,null);var t=e.z.redInvm(),r=t.redSqr(),n=e.x.redMul(r),i=e.y.redMul(r).redMul(t);return new s(n,i)},s.prototype.toECJPoint=function(){return this.inf?new o(null,null,null):new o(this.x,this.y,o.one)},s.prototype.neg=function(){return this.inf?this:new s(this.x,this.y.redNeg())},s.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(0===this.x.ucmp(e.x))return 0===this.y.ucmp(e.y)?this.dbl():new s(null,null);var t=this.y.redSub(e.y);t.isZero()||(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return new s(r,n)},s.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.isZero())return new s(null,null);var t=this.x.redSqr(),r=t.redAdd(t).redIAdd(t).redMul(e.redInvm()),n=r.redSqr().redISub(this.x.redAdd(this.x)),i=r.redMul(this.x.redSub(n)).redISub(this.y);return new s(n,i)},s.prototype.mul=function(e){for(var t=this._getNAFPoints(4),r=t.points,n=e.getNAF(t.wnd),i=new o(null,null,null),a=n.length-1;a>=0;a--){for(var u=0;a>=0&&0===n[a];a--,++u);if(a>=0&&(u+=1),i=i.dblp(u),a<0)break;var c=n[a];i=c>0?i.mixedAdd(r[c-1>>1]):i.mixedAdd(r[-c-1>>1].neg())}return s.fromECJPoint(i)},s.prototype._getNAFPoints1=function(){return{wnd:1,points:[this]}},s.prototype._getNAFPoints=function(e){var t=new Array((1<{n(i.subtle.sign({name:"HMAC"},t,r).then(t=>e.from(t)),o)};t.create=function(e,t,r){const u=s[e];n(i.subtle.importKey("raw",t,{name:"HMAC",hash:{name:u}},!1,["sign"]).then(t=>({digest(e,r){a(t,e,r)},length:o[e]})),r)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(21);function i(e){return n.isMultiaddr(e)?e:n(e)}e.exports={ensureMultiaddr:i}},function(e,t,r){var n={ECB:r(886),CBC:r(887),CFB:r(888),CFB8:r(889),CFB1:r(890),OFB:r(891),CTR:r(445),GCM:r(445)},i=r(447);for(var o in i)i[o].module=n[i[o].mode];e.exports=i},function(e,t,r){var n=r(166),i=r(4).Buffer,o=r(446);function s(e){var t=e._cipher.encryptBlockRaw(e._prev);return o(e._prev),t}var a=16;t.encrypt=function(e,t){var r=Math.ceil(t.length/16),o=e._cache.length;e._cache=i.concat([e._cache,i.allocUnsafe(16*r)]);for(var a=0;a0||o>0;){var f=new i;f.update(c),f.update(e),t&&f.update(t),c=f.digest();var h=0;if(s>0){var l=a.length-s;h=Math.min(s,c.length),c.copy(a,l,0,h),s-=h}if(h0){var d=u.length-o,p=Math.min(o,c.length-h);c.copy(u,d,h,h+p),o-=p}}return c.fill(0),{key:a,iv:u}}e.exports=o},function(e,t,r){"use strict";(function(t){const n=r(79),i=r(20),o=r(42);function s(e){let r;if("string"==typeof e)r=e;else if(t.isBuffer(e))r=n.encode(e).toString();else if(i.isPeerId(e))r=e.toB58String();else{if(!o.isPeerInfo(e))throw new Error("not valid PeerId or PeerInfo, or B58Str");r=e.id.toB58String()}return r}class a{constructor(){this._peers={}}has(e){const t=s(e);return Boolean(this._peers[t])}put(e,t){const r=this._peers[e.id.toB58String()];if(!r||t)return this._peers[e.id.toB58String()]=e,e;e.multiaddrs.forEach(e=>r.multiaddrs.add(e));const n=e.isConnected();return n&&r.connect(n),e.protocols.forEach(e=>r.protocols.add(e)),!r.id.privKey&&e.id.privKey&&(r.id.privKey=e.id.privKey),!r.id.pubKey&&e.id.pubKey&&(r.id.pubKey=e.id.pubKey),r}get(e){const t=s(e),r=this._peers[t];if(r)return r;throw new Error("PeerInfo not found")}getAll(){return this._peers}getAllArray(){return Object.keys(this._peers).map(e=>this._peers[e])}getMultiaddrs(e){const t=this.get(e);return t.multiaddrs.toArray()}remove(e){const t=s(e);this._peers[t]&&delete this._peers[t]}}e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){!function t(r,n){e.exports=n()}(this,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function t(){return e.default}:function t(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=32)}([function(e,t,r){"use strict";(function(e,n){var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=r(17),s=r(15),a=r(37),u=r(16),c=r(18),f={};t.clone=function(r,n){if("object"!==(void 0===r?"undefined":i(r))||null===r)return r;n=n||new Map;var o=n.get(r);if(o)return o;var s=void 0,a=!1;if(Array.isArray(r))s=[],a=!0;else if(e.isBuffer(r))s=e.from(r);else if(r instanceof Date)s=new Date(r.getTime());else if(r instanceof RegExp)s=new RegExp(r);else{var u=Object.getPrototypeOf(r);u&&u.isImmutable?s=r:(s=Object.create(u),a=!0)}if(n.set(r,s),a)for(var c=Object.getOwnPropertyNames(r),f=0;f1||!n.part&&!h[C])return!1;return(!n.only||!f)&&x},t.flatten=function(e,r){for(var n=r||[],i=0;i1?r-1:0),i=1;i\?@\[\]\^`\{\|\}~\"\\]*$/.test(e),"Bad attribute value ("+e+")"),e.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')},t.escapeHtml=function(e){return c.escapeHtml(e)},t.escapeJavaScript=function(e){return c.escapeJavaScript(e)},t.escapeJson=function(e){return c.escapeJson(e)},t.once=function(e){if(e._hoekOnce)return e;var t=!1,r=function r(){if(!t){t=!0;for(var n=arguments.length,i=Array(n),o=0;o1;)p=l.shift(),g[p]||(g[p]={}),g=g[p];p=l.shift(),g[p]=t.reach(e,d,n)}return u},t.uniqueFilename=function(e,t){t=t?"."!==t[0]?"."+t:t:"",e=a.resolve(e);var r=[Date.now(),n.pid,s.randomBytes(8).toString("hex")].join("-")+t;return a.join(e,r)},t.stringify=function(){try{for(var e=arguments.length,t=Array(e),r=0;r4&&void 0!==arguments[4]?arguments[4]:this._flags;return c.create(t,r,n,i,o)},e.prototype.createOverrideError=function e(t,r,n,i,o,s){return c.create(t,r,n,i,this._flags,o,s)},e.prototype.checkOptions=function e(t){var n=r(21),i=n.options.validate(t);if(i.error)throw new Error(i.error.details[0].message)},e.prototype.clone=function e(){var t=Object.create(Object.getPrototypeOf(this));t.isJoi=!0,t._currentJoi=this._currentJoi,t._type=this._type,t._settings=this._settings,t._baseType=this._baseType,t._valids=this._valids.slice(),t._invalids=this._invalids.slice(),t._tests=this._tests.slice(),t._refs=this._refs.slice(),t._flags=s.clone(this._flags),t._description=this._description,t._unit=this._unit,t._notes=this._notes.slice(),t._tags=this._tags.slice(),t._examples=this._examples.slice(),t._meta=this._meta.slice(),t._inner={};for(var r=Object.keys(this._inner),n=0;n=0?p[g[y]]={key:y,schema:p[g[y]].schema.concat(d[b].schema)}:p.push(d[b])}}else r._inner[h]=r._inner[h].concat(d);else r._inner[h]=d.slice()}}return r},e.prototype._test=function e(t,r,n,i){var o=this.clone();return o._tests.push({func:n,name:t,arg:r,options:i}),o},e.prototype.options=function e(t){s.assert(!t.context,"Cannot override context"),this.checkOptions(t);var r=this.clone();return r._settings=a.concat(r._settings,t),r},e.prototype.strict=function e(t){var r=this.clone(),n=void 0!==t&&!t;return r._settings=a.concat(r._settings,{convert:n}),r},e.prototype.raw=function e(t){var r=void 0===t||t;if(this._flags.raw===r)return this;var n=this.clone();return n._flags.raw=r,n},e.prototype.error=function e(t){s.assert(t&&(t instanceof Error||"function"==typeof t),"Must provide a valid Error object or a function");var r=this.clone();return r._flags.error=t,r},e.prototype.allow=function e(){for(var t=arguments.length,r=Array(t),n=0;n0,"description must be provided when default value is a function"));var n=this.clone();return n._flags.default=t,u.push(n._refs,t),n},e.prototype.empty=function e(t){var r=this.clone();return void 0===t?delete r._flags.empty:r._flags.empty=h.schema(this._currentJoi,t),r},e.prototype.when=function e(t,i){s.assert(i&&"object"===(void 0===i?"undefined":n(i)),"Invalid options"),s.assert(void 0!==i.then||void 0!==i.otherwise,'options must have at least one of "then" or "otherwise"');var o=i.hasOwnProperty("then")?this.concat(h.schema(this._currentJoi,i.then)):void 0,a=i.hasOwnProperty("otherwise")?this.concat(h.schema(this._currentJoi,i.otherwise)):void 0;f=f||r(10);var u={then:o,otherwise:a};Object.prototype.hasOwnProperty.call(i,"is")&&(u.is=i.is);var c=f.when(t,u);return c._flags.presence="ignore",c._baseType=this,c},e.prototype.description=function e(t){s.assert(t&&"string"==typeof t,"Description must be a non-empty string");var r=this.clone();return r._description=t,r},e.prototype.notes=function e(t){s.assert(t&&("string"==typeof t||Array.isArray(t)),"Notes must be a non-empty string or array");var r=this.clone();return r._notes=r._notes.concat(t),r},e.prototype.tags=function e(t){s.assert(t&&("string"==typeof t||Array.isArray(t)),"Tags must be a non-empty string or array");var r=this.clone();return r._tags=r._tags.concat(t),r},e.prototype.meta=function e(t){s.assert(void 0!==t,"Meta cannot be undefined");var r=this.clone();return r._meta=r._meta.concat(t),r},e.prototype.example=function e(){s.assert(1===arguments.length,"Missing example");var t=arguments.length<=0?void 0:arguments[0],r=this.clone();return r._examples.push(t),r},e.prototype.unit=function e(t){s.assert(t&&"string"==typeof t,"Unit name must be a non-empty string");var r=this.clone();return r._unit=t,r},e.prototype._prepareEmptyValue=function e(t){return"string"==typeof t&&this._flags.trim?t.trim():t},e.prototype._validate=function e(t,r,n,i){var o=this,f=t;r=r||{key:"",path:[],parent:null,reference:i},this._settings&&(n=a.concat(n,this._settings));var h=[],d=function e(){var i=void 0;if(void 0!==t)i=o._flags.raw?f:t;else if(n.noDefaults)i=t;else if(u.isRef(o._flags.default))i=o._flags.default(r.parent,n);else if("function"!=typeof o._flags.default||o._flags.func&&!o._flags.default.description)i=s.clone(o._flags.default);else{var a=void 0;null!==r.parent&&o._flags.default.length>0&&(a=[s.clone(r.parent),n]);var c=l._try(o._flags.default,a);i=c.value,c.error&&h.push(o.createError("any.default",{error:c.error},r,n))}if(h.length&&"function"==typeof o._flags.error){var d=o._flags.error.call(o,h);h="string"==typeof d?[o.createOverrideError("override",{reason:h},r,n,d)]:[].concat(d).map(function(e){return e instanceof Error?e:o.createOverrideError(e.type||"override",e.context,r,n,e.message,e.template)})}return{value:o._flags.strip?void 0:i,finalValue:i,errors:h.length?h:null}};if(this._coerce){var p=this._coerce.call(this,t,r,n);if(p.errors)return t=p.value,h=h.concat(p.errors),d();t=p.value}this._flags.empty&&!this._flags.empty._validate(this._prepareEmptyValue(t),null,l.defaults).errors&&(t=void 0);var g=this._flags.presence||n.presence;if("optional"===g){if(void 0===t){var m=this._flags.hasOwnProperty("default")&&void 0===this._flags.default;if(!m||"object"!==this._type)return d();t={}}}else{if("required"===g&&void 0===t)return h.push(this.createError("any.required",null,r,n)),d();if("forbidden"===g)return void 0===t?d():(h.push(this.createError("any.unknown",null,r,n)),d())}if(this._valids.has(t,r,n,this._flags.insensitive))return d();if(this._invalids.has(t,r,n,this._flags.insensitive)&&(h.push(this.createError(""===t?"any.empty":"any.invalid",{value:t,invalids:this._invalids.values({stripUndefined:!0})},r,n)),n.abortEarly||void 0===t))return d();if(this._base){var b=this._base.call(this,t,r,n);if(b.errors)return t=b.value,h=h.concat(b.errors),d();if(b.value!==t){if(t=b.value,this._valids.has(t,r,n,this._flags.insensitive))return d();if(this._invalids.has(t,r,n,this._flags.insensitive)&&(h.push(this.createError(""===t?"any.empty":"any.invalid",{value:t,invalids:this._invalids.values({stripUndefined:!0})},r,n)),n.abortEarly))return d()}}if(this._flags.allowOnly&&(h.push(this.createError("any.allowOnly",{value:t,valids:this._valids.values({stripUndefined:!0})},r,n)),n.abortEarly))return d();for(var y=0;y=0;f--)if(u[f]!==l[f])return!1;for(f=u.length-1;f>=0;f--)if(c=u[f],!v(e[c],t[c],n,r))return!1;return!0}function k(e,t,n){v(e,t,!0)&&y(e,t,n,"notDeepStrictEqual",k)}function S(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function E(e){var t;try{e()}catch(e){t=e}return t}function x(e,t,n,r){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=E(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&y(i,n,"Missing expected exception"+r);var s="string"==typeof r,a=!e&&o.isError(i),u=!e&&i&&!n;if((a&&s&&S(i,n)||u)&&y(i,n,"Got unwanted exception"+r),e&&i&&n&&!S(i,n)||!e&&i)throw i}f.AssertionError=function e(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=g(this),this.generatedMessage=!0);var n=t.stackStartFunction||y;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var i=r.stack,o=p(n),s=i.indexOf("\n"+o);if(s>=0){var a=i.indexOf("\n",s+1);i=i.substring(a+1)}this.stack=i}}},o.inherits(f.AssertionError,Error),f.fail=y,f.ok=b,f.equal=function e(t,n,r){t!=n&&y(t,n,r,"==",f.equal)},f.notEqual=function e(t,n,r){t==n&&y(t,n,r,"!=",f.notEqual)},f.deepEqual=function e(t,n,r){v(t,n,!1)||y(t,n,r,"deepEqual",f.deepEqual)},f.deepStrictEqual=function e(t,n,r){v(t,n,!0)||y(t,n,r,"deepStrictEqual",f.deepStrictEqual)},f.notDeepEqual=function e(t,n,r){v(t,n,!1)&&y(t,n,r,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=k,f.strictEqual=function e(t,n,r){t!==n&&y(t,n,r,"===",f.strictEqual)},f.notStrictEqual=function e(t,n,r){t===n&&y(t,n,r,"!==",f.notStrictEqual)},f.throws=function(e,t,n){x(!0,e,t,n)},f.doesNotThrow=function(e,t,n){x(!1,e,t,n)},f.ifError=function(e){if(e)throw e};var C=Object.keys||function(e){var t=[];for(var n in e)s.call(e,n)&&t.push(n);return t}}).call(this,n(8))},function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,n){"use strict";const r=n(631),i=n(632),o=n(24);e.exports=(e=>{const t=r();if("function"==typeof e)return e;if("object"==typeof e)return i(e);if("string"==typeof e){const n=o(e).nodeAddress();return t.host=n.address,t.port=n.port,i(t)}throw new Error("Argument must be a send function or a config object.")})},function(e,t,n){t=e.exports=n(386),t.Stream=t,t.Readable=t,t.Writable=n(390),t.Duplex=n(132),t.Transform=n(391),t.PassThrough=n(748)},function(e,t,n){"use strict";function r(e,t,n){var r=e instanceof Error?e:new Error(e),i;if("object"==typeof t?n=t:null!=t&&(r.code=t),n)for(i in n)r[i]=n[i];return r}e.exports=r},function(e,t,n){"use strict";(function(r){const i=n(42),o=n(456),s=n(18),a=n(11),u=n(60);class l{constructor(e,t,n){s(r.isBuffer(e),"invalid id provided"),t&&n&&s(t.public.bytes.equals(n.bytes),"inconsistent arguments"),this._id=e,this._idB58String=i.toB58String(this.id),this._privKey=t,this._pubKey=n}get id(){return this._id}set id(e){throw new Error("Id is immutable")}get privKey(){return this._privKey}set privKey(e){this._privKey=e}get pubKey(){return this._pubKey?this._pubKey:this._privKey?this._privKey.public:void 0}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return o.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return o.marshalPrivateKey(this.privKey)}toPrint(){let e=this.toB58String();e.startsWith("Qm")&&(e=e.slice(2));let t=6;return e.length"}toJSON(){return{id:this.toB58String(),privKey:f(this.marshalPrivKey()),pubKey:f(this.marshalPubKey())}}toHexString(){return i.toHexString(this.id)}toBytes(){return this.id}toB58String(){return this._idB58String}isEqual(e){if(r.isBuffer(e))return this.id.equals(e);if(e.id)return this.id.equals(e.id);throw new Error("not valid Id")}isValid(e){this.privKey&&this.privKey.public&&this.privKey.public.bytes&&r.isBuffer(this.pubKey.bytes)&&this.privKey.public.bytes.equals(this.pubKey.bytes)?e():e(new Error("Keys not match"))}}const c=u(l,{className:"PeerId",symbolName:"@libp2p/js-peer-id/PeerId"});function f(e){if(e)return e.toString("base64")}t=e.exports=c,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.generateKeyPair("RSA",e.bits,t),(e,t)=>e.public.hash((n,r)=>{t(n,r,e)})],(e,n,r)=>{if(e)return t(e);t(null,new c(n,r))})},t.createFromHexString=function(e){return new c(i.fromHexString(e))},t.createFromBytes=function(e){return new c(e)},t.createFromB58String=function(e){return new c(i.fromB58String(e))},t.createFromPubKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let n;try{let i=e;if("string"==typeof i&&(i=r.from(e,"base64")),!r.isBuffer(i))throw new Error("Supplied key is neither a base64 string nor a buffer");n=o.unmarshalPublicKey(i)}catch(e){return t(e)}n.hash((e,r)=>{if(e)return t(e);t(null,new c(r,null,n))})},t.createFromPrivKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let n=e;try{if("string"==typeof n&&(n=r.from(e,"base64")),!r.isBuffer(n))throw new Error("Supplied key is neither a base64 string nor a buffer")}catch(e){return t(e)}a([e=>o.unmarshalPrivateKey(n,e),(e,t)=>e.public.hash((n,r)=>{t(n,r,e)})],(e,n,r)=>{if(e)return t(e);t(null,new c(n,r,r.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let n,s,u,l;try{n=i.fromB58String(e.id),s=e.privKey&&r.from(e.privKey,"base64"),u=e.pubKey&&r.from(e.pubKey,"base64"),l=u&&o.unmarshalPublicKey(u)}catch(e){return t(e)}s?a([e=>o.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((n,r)=>{t(n,r,e)}),(e,t,n)=>{l?l.hash((r,i)=>{n(r,e,t,i)}):n(null,e,t)}],(e,r,i,o)=>e?t(e):l&&!r.equals(o)?t(new Error("Public and private key do not match")):n&&!r.equals(n)?t(new Error("Id and private key do not match")):void t(null,new c(n,i,l))):t(null,new c(n,null,l))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(940),o=n(318),s=n(38),a=n(81),u=n(60),l=u.proto(function(e){if(!(this instanceof l))return new l(e);if(null==e&&(e=""),e instanceof r)this.buffer=i.fromBuffer(e);else if("string"==typeof e||e instanceof String){if(e.length>0&&"/"!==e.charAt(0))throw new Error(`multiaddr "${e}" must start with a "/"`);this.buffer=i.fromString(e)}else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=i.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});l.prototype.toString=function e(){return i.bufferToString(this.buffer)},l.prototype.toJSON=l.prototype.toString,l.prototype.toOptions=function e(){const t={},n=this.toString().split("/");return t.family="ip4"===n[1]?"ipv4":"ipv6",t.host=n[2],t.transport=n[3],t.port=n[4],t},l.prototype.inspect=function e(){return""},l.prototype.protos=function e(){return this.protoCodes().map(e=>Object.assign({},o(e)))},l.prototype.protoCodes=function e(){const t=[],n=this.buffer;let r=0;for(;re.name)},l.prototype.tuples=function e(){return i.bufferToTuples(this.buffer)},l.prototype.stringTuples=function e(){const t=i.bufferToTuples(this.buffer);return i.tuplesToStringTuples(t)},l.prototype.encapsulate=function e(t){return t=l(t),l(this.toString()+t.toString())},l.prototype.decapsulate=function e(t){t=t.toString();const n=this.toString(),r=n.lastIndexOf(t);if(r<0)throw new Error("Address "+this+" does not contain subaddress: "+t);return l(n.slice(0,r))},l.prototype.getPeerId=function e(){let t=null;try{t=this.stringTuples().filter(e=>{if(e[0]===o.names.ipfs.code)return!0})[0][1],a.decode(t)}catch(e){t=null}return t},l.prototype.getPath=function e(){let t=null;try{t=this.stringTuples().filter(e=>{const t=o(e[0]);if(t.path)return!0})[0][1]}catch(e){t=null}return t},l.prototype.equals=function e(t){return this.buffer.equals(t.buffer)},l.prototype.nodeAddress=function e(){const t=this.protoCodes(),n=this.protoNames(),r=this.toString().split("/").slice(1);if(r.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(4!==t[0]&&41!==t[0]&&54!==t[0]&&55!==t[0])throw new Error(`no protocol with name: "'${n[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if("tcp"!==r[2]&&"udp"!==r[2])throw new Error(`no protocol with name: "'${n[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:41===t[0]||55===t[0]?6:4,address:r[1],port:r[3]}},l.fromNodeAddress=function e(t,n){if(!t)throw new Error("requires node address object");if(!n)throw new Error("requires transport protocol");const r="IPv6"===t.family?"ip6":"ip4";return l("/"+[r,t.address,n,t.port].join("/"))},l.prototype.isThinWaistAddress=function e(t){const n=(t||this).protos();return 2===n.length&&((4===n[0].code||41===n[0].code)&&(6===n[1].code||273===n[1].code))},l.protocols=o,l.isName=function e(t){return!!l.isMultiaddr(t)&&t.protos().some(e=>e.resolvable)},l.resolve=function e(t,n){return l.isMultiaddr(t)&&l.isName(t)?n(new Error("not implemented yet")):n(new Error("not a valid name"))},t=e.exports=l}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=n(85),i=n(17);e.exports={checkState:function(e,t){if(!e)throw new r.InvalidState(t)},checkArgument:function(e,t,n,i){if(!e)throw new r.InvalidArgument(t,n,i)},checkArgumentType:function(e,t,o){if(o=o||"(unknown name)",i.isString(t)){if("Buffer"===t){var s=n(30);if(!s.isBuffer(e))throw new r.InvalidArgumentType(e,t,o)}else if(typeof e!==t)throw new r.InvalidArgumentType(e,t,o)}else if(!(e instanceof t))throw new r.InvalidArgumentType(e,t.name,o)}}},function(e,t,n){"use strict";var r=n(783),i=n(787),o=n(791);for(var s in t=e.exports=n(12),t.pull=t,r)t[s]=r[s];for(var s in o)t[s]=o[s];for(var s in i)t[s]=i[s]},function(e,t,n){(function(t,r){var i=n(18),o=n(57).Stream,s=n(13),a=/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;function u(e){return e.charAt(0).toUpperCase()+e.slice(1)}function l(e,t,n,r,o){throw new i.AssertionError({message:s.format("%s (%s) is required",e,t),actual:void 0===o?typeof r:o(r),expected:t,operator:n||"===",stackStartFunction:l.caller})}function c(e){return Object.prototype.toString.call(e).slice(8,-1)}function f(){}var h={bool:{check:function(e){return"boolean"==typeof e}},func:{check:function(e){return"function"==typeof e}},string:{check:function(e){return"string"==typeof e}},object:{check:function(e){return"object"==typeof e&&null!==e}},number:{check:function(e){return"number"==typeof e&&!isNaN(e)}},finite:{check:function(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}},buffer:{check:function(e){return t.isBuffer(e)},operator:"Buffer.isBuffer"},array:{check:function(e){return Array.isArray(e)},operator:"Array.isArray"},stream:{check:function(e){return e instanceof o},operator:"instanceof",actual:c},date:{check:function(e){return e instanceof Date},operator:"instanceof",actual:c},regexp:{check:function(e){return e instanceof RegExp},operator:"instanceof",actual:c},uuid:{check:function(e){return"string"==typeof e&&a.test(e)},operator:"isUUID"}};function p(e){var t=Object.keys(h),n;return n=r.env.NODE_NDEBUG?f:function(e,t){e||l(t,"true",e)},t.forEach(function(t){if(e)n[t]=f;else{var r=h[t];n[t]=function(e,n){r.check(e)||l(n,t,r.operator,e,r.actual)}}}),t.forEach(function(t){var r="optional"+u(t);if(e)n[r]=f;else{var i=h[t];n[r]=function(e,n){void 0!==e&&null!==e&&(i.check(e)||l(n,t,i.operator,e,i.actual))}}}),t.forEach(function(t){var r="arrayOf"+u(t);if(e)n[r]=f;else{var i=h[t],o="["+t+"]";n[r]=function(e,t){var n;for(Array.isArray(e)||l(t,o,i.operator,e,i.actual),n=0;n=c.OP_1&&e<=c.OP_16||e===c.OP_1NEGATE)}function d(e){return u.Buffer(e)||p(e)}function m(e){return u.Array(e)&&e.every(d)}function g(e){return 0===e.length?c.OP_0:1===e.length?e[0]>=1&&e[0]<=16?h+e[0]:129===e[0]?c.OP_1NEGATE:void 0:void 0}function y(e){if(r.isBuffer(e))return e;a(u.Array,e);const t=e.reduce(function(e,t){return r.isBuffer(t)?1===t.length&&void 0!==g(t)?e+1:e+s.encodingLength(t.length)+t.length:e+1},0),n=r.allocUnsafe(t);let i=0;if(e.forEach(function(e){if(r.isBuffer(e)){const t=g(e);if(void 0!==t)return n.writeUInt8(t,i),void(i+=1);i+=s.encode(n,e.length,i),e.copy(n,i),i+=e.length}else n.writeUInt8(e,i),i+=1}),i!==n.length)throw new Error("Could not decode chunks");return n}function b(e){if(u.Array(e))return e;a(u.Buffer,e);const t=[];let n=0;for(;nc.OP_0&&r<=c.OP_PUSHDATA4){const r=s.decode(e,n);if(null===r)return null;if(n+=r.size,n+r.number>e.length)return null;const i=e.slice(n,n+r.number);n+=r.number;const o=g(i);void 0!==o?t.push(o):t.push(i)}else t.push(r),n+=1}return t}function v(e){return r.isBuffer(e)&&(e=b(e)),e.map(function(e){if(r.isBuffer(e)){const t=g(e);if(void 0===t)return e.toString("hex");e=t}return f[e]}).join(" ")}function _(e){return a(u.String,e),y(e.split(" ").map(function(e){return void 0!==c[e]?c[e]:(a(u.Hex,e),r.from(e,"hex"))}))}function w(e){return e=b(e),a(m,e),e.map(function(e){return r.isBuffer(e)?e:e===c.OP_0?r.allocUnsafe(0):l.encode(e-h)})}function k(e){return o.isPoint(e)}function S(e){const t=-129&e;return t>0&&t<4}function E(e){return!!r.isBuffer(e)&&(!!S(e[e.length-1])&&i.check(e.slice(0,-1)))}e.exports={compile:y,decompile:b,fromASM:_,toASM:v,toStack:w,number:n(577),signature:n(1350),isCanonicalPubKey:k,isCanonicalScriptSignature:E,isPushOnly:m,isDefinedHashType:S}},function(e,t,n){"use strict";(function(t){var r=n(0),i=n(18),o=n(40),s=n(25);function a(e,t){if(e.length!==t.length)return!1;for(var n=e.length,r=0;r>24&255),r.push(n>>16&255),r.push(n>>8&255),r.push(255&n),new t(r)},integerFromBuffer:function e(t){return s.checkArgumentType(t,"Buffer","buffer"),t[0]<<24|t[1]<<16|t[2]<<8|t[3]},integerFromSingleByteBuffer:function e(t){return s.checkArgumentType(t,"Buffer","buffer"),t[0]},bufferToHex:function e(t){return s.checkArgumentType(t,"Buffer","buffer"),t.toString("hex")},reverse:function e(t){for(var n=new r.Buffer(t.length),i=0;i=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=i(e);return t&&0!==t.length?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r}),!o.kStringMaxLength)try{o.kStringMaxLength=t.binding("buffer").kStringMaxLength}catch(e){}o.constants||(o.constants={MAX_LENGTH:o.kMaxLength},o.kStringMaxLength&&(o.constants.MAX_STRING_LENGTH=o.kStringMaxLength)),e.exports=o}).call(this,n(2))},function(e,t,n){"use strict";var r=n(212),i=n(735);function o(){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}t.parse=w,t.resolve=S,t.resolveObject=E,t.format=k,t.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,l=["<",">",'"',"`"," ","\r","\n","\t"],c=["{","}","|","\\","^","`"].concat(l),f=["'"].concat(c),h=["%","/","?",";","#"].concat(f),p=["/","?","#"],d=255,m=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},b={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_=n(168);function w(e,t,n){if(e&&i.isObject(e)&&e instanceof o)return e;var r=new o;return r.parse(e,t,n),r}function k(e){return i.isString(e)&&(e=w(e)),e instanceof o?e.format():o.prototype.format.call(e)}function S(e,t){return w(e,!1,!0).resolve(t)}function E(e,t){return e?w(e,!1,!0).resolveObject(t):t}o.prototype.parse=function(e,t,n){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o127?R+="x":R+=B[N];if(!R.match(m)){var L=O.slice(0,C),F=O.slice(C+1),D=B.match(g);D&&(L.push(D[1]),F.unshift(D[2])),F.length&&(d="/"+F.join(".")+d),this.hostname=L.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),j||(this.hostname=r.toASCII(this.hostname));var U=this.port?":"+this.port:"",z=this.hostname||"";this.host=z+U,this.href+=this.host,j&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==d[0]&&(d="/"+d))}if(!y[S])for(var C=0,P=f.length;C0)&&n.host.split("@");x&&(n.auth=x.shift(),n.host=n.hostname=x.shift())}return n.search=e.search,n.query=e.query,i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!S.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var C=S.slice(-1)[0],A=(n.host||e.host||S.length>1)&&("."===C||".."===C)||""===C,I=0,T=S.length;T>=0;T--)C=S[T],"."===C?S.splice(T,1):".."===C?(S.splice(T,1),I++):I&&(S.splice(T,1),I--);if(!w&&!k)for(;I--;I)S.unshift("..");!w||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),A&&"/"!==S.join("/").substr(-1)&&S.push("");var j=""===S[0]||S[0]&&"/"===S[0].charAt(0);if(E){n.hostname=n.host=j?"":S.length?S.shift():"";var x=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");x&&(n.auth=x.shift(),n.host=n.hostname=x.shift())}return w=w||n.host&&S.length,w&&!j&&S.unshift(""),S.length?n.pathname=S.join("/"):(n.pathname=null,n.path=null),i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){"use strict";const r=n(410),i=n(798),o=n(296),s=n(413);t.Key=r,t.MemoryDatastore=i,t.utils=o,t.Errors=s},function(e,t,n){(function(t,r){var i=n(19),o=n(893),s=e.exports=i.util=i.util||{};function a(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function u(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(s.isArrayBuffer(e)||s.isArrayBufferView(e))if(void 0!==r&&e instanceof r)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var n=0;n15?(i=Date.now(),u(e)):(n.push(e),1===n.length&&a.setAttribute("a",o=!o))}}s.nextTick=s.setImmediate}(),s.isNodejs=void 0!==t&&t.versions&&t.versions.node,s.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},s.isArrayBufferView=function(e){return e&&s.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},s.ByteBuffer=u,s.ByteStringBuffer=u;var l=4096;function c(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var n=s.isArrayBuffer(e),r=s.isArrayBufferView(e);if(n||r)return this.data=n?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==e&&void 0!==e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)}s.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},s.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},s.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},s.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},s.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var n=this.data;t>0;)1&t&&(n+=e),t>>>=1,t>0&&(e+=e);return this.data=n,this._optimizeConstructedString(t),this},s.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},s.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(s.encodeUtf8(e))},s.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},s.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},s.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},s.ByteStringBuffer.prototype.putInt=function(e,t){a(t);var n="";do{t-=8,n+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(n)},s.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},s.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),n=2<=n&&(t-=n<<1),t},s.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},s.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},s.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},s.ByteStringBuffer.prototype.copy=function(){var e=s.createBuffer(this.data);return e.read=this.read,e},s.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},s.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},s.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},s.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var n=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),r=new Uint8Array(this.length()+t);return r.set(n),this.data=new DataView(r.buffer),this},s.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},s.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var n=0;n>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},s.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},s.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},s.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},s.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},s.DataBuffer.prototype.putInt=function(e,t){a(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},s.DataBuffer.prototype.putSignedInt=function(e,t){return a(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},s.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),n=2<=n&&(t-=n<<1),t},s.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},s.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},s.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},s.DataBuffer.prototype.copy=function(){return new s.DataBuffer(this)},s.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},s.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},s.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},s.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(n+=e),t>>>=1,t>0&&(e+=e);return n},s.xorBytes=function(e,t,n){for(var r="",i="",o="",s=0,a=0;n>0;--n,++s)i=e.charCodeAt(s)^t.charCodeAt(s),a>=10&&(r+=o,o="",a=0),o+=String.fromCharCode(i),++a;return r+=o,r},s.hexToBytes=function(e){var t="",n=0;for(!0&e.length&&(n=1,t+=String.fromCharCode(parseInt(e[0],16)));n>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,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,-1,-1,-1,-1,-1,-1,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],p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";s.encode64=function(e,t){for(var n="",r="",i,o,s,a=0;a>2),n+=f.charAt((3&i)<<4|o>>4),isNaN(o)?n+="==":(n+=f.charAt((15&o)<<2|s>>6),n+=isNaN(s)?"=":f.charAt(63&s)),t&&n.length>t&&(r+=n.substr(0,t)+"\r\n",n=n.substr(t));return r+=n,r},s.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t="",n,r,i,o,s=0;s>4),64!==i&&(t+=String.fromCharCode((15&r)<<4|i>>2),64!==o&&(t+=String.fromCharCode((3&i)<<6|o)));return t},s.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},s.decodeUtf8=function(e){return decodeURIComponent(escape(e))},s.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:o.encode,decode:o.decode}},s.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},s.binary.raw.decode=function(e,t,n){var r=t;r||(r=new Uint8Array(e.length)),n=n||0;for(var i=n,o=0;o>2),n+=f.charAt((3&i)<<4|o>>4),isNaN(o)?n+="==":(n+=f.charAt((15&o)<<2|s>>6),n+=isNaN(s)?"=":f.charAt(63&s)),t&&n.length>t&&(r+=n.substr(0,t)+"\r\n",n=n.substr(t));return r+=n,r},s.binary.base64.decode=function(e,t,n){var r=t,i,o,s,a;r||(r=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),n=n||0;for(var u=0,l=n;u>4,64!==s&&(r[l++]=(15&o)<<4|s>>2,64!==a&&(r[l++]=(3&s)<<6|a));return t?l-n:r.subarray(0,l)},s.binary.base58.encode=function(e,t){return s.binary.baseN.encode(e,p,t)},s.binary.base58.decode=function(e,t){return s.binary.baseN.decode(e,p,t)},s.text={utf8:{},utf16:{}},s.text.utf8.encode=function(e,t,n){e=s.encodeUtf8(e);var r=t;r||(r=new Uint8Array(e.length)),n=n||0;for(var i=n,o=0;o0?(o=n[r].substring(0,i),s=n[r].substring(i+1)):(o=n[r],s=null),o in t||(t[o]=[]),o in Object.prototype||null===s||t[o].push(unescape(s))}return t},n;return void 0===e?(null===w&&(w="undefined"!=typeof window&&window.location&&window.location.search?t(window.location.search.substring(1)):{}),n=w):n=t(e),n},s.parseFragment=function(e){var t=e,n="",r=e.indexOf("?");r>0&&(t=e.substring(0,r),n=e.substring(r+1));var i=t.split("/");i.length>0&&""===i[0]&&i.shift();var o=""===n?{}:s.getQueryVariables(n);return{pathString:t,queryString:n,path:i,query:o}},s.makeRequest=function(e){var t=s.parseFragment(e),n={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,n){var r;return void 0===e?r=t.query:(r=t.query[e],r&&void 0!==n&&(r=r[n])),r},getQueryLast:function(e,t){var r,i=n.getQuery(e);return r=i?i[i.length-1]:t,r}};return n},s.makeLink=function(e,t,n){e=jQuery.isArray(e)?e.join("/"):e;var r=jQuery.param(t||{});return n=n||"",e+(r.length>0?"?"+r:"")+(n.length>0?"#"+n:"")},s.setPath=function(e,t,n){if("object"==typeof e&&null!==e)for(var r=0,i=t.length;r0&&o.push(r),s=t.lastIndex;var a=n[0][1];switch(a){case"s":case"o":i");break;case"%":o.push("%");break;default:o.push("<%"+a+"?>")}}return o.push(e.substring(s)),o.join("")},s.formatNumber=function(e,t,n,r){var i=e,o=isNaN(t=Math.abs(t))?2:t,s=void 0===n?",":n,a=void 0===r?".":r,u=i<0?"-":"",l=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",c=l.length>3?l.length%3:0;return u+(c?l.substr(0,c)+a:"")+l.substr(c).replace(/(\d{3})(?=\d)/g,"$1"+a)+(o?s+Math.abs(i-l).toFixed(o).slice(2):"")},s.formatSize=function(e){return e=e>=1073741824?s.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?s.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?s.formatNumber(e/1024,0)+" KiB":s.formatNumber(e,0)+" bytes",e},s.bytesFromIP=function(e){return-1!==e.indexOf(".")?s.bytesFromIPv4(e):-1!==e.indexOf(":")?s.bytesFromIPv6(e):null},s.bytesFromIPv4=function(e){if(e=e.split("."),4!==e.length)return null;for(var t=s.createBuffer(),n=0;nn[r].end-n[r].start&&(r=n.length-1)):n.push({start:u,end:u})}t.push(o)}if(n.length>0){var l=n[r];l.end-l.start>0&&(t.splice(l.start,l.end-l.start+1,""),0===l.start&&t.unshift(""),7===l.end&&t.push(""))}return t.join(":")},s.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in s&&!e.update)return t(null,s.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return s.cores=navigator.hardwareConcurrency,t(null,s.cores);if("undefined"==typeof Worker)return s.cores=1,t(null,s.cores);if("undefined"==typeof Blob)return s.cores=2,t(null,s.cores);var n=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){for(var t=Date.now(),n=t+4;Date.now()a.st&&i.sti.st&&a.st=0}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isAsync=void 0;var r=n(217),i=o(r);function o(e){return e&&e.__esModule?e:{default:e}}var s="function"==typeof Symbol;function a(e){return s&&"AsyncFunction"===e[Symbol.toStringTag]}function u(e){return a(e)?(0,i.default)(e):e}t.default=u,t.isAsync=a},function(e,t,n){"use strict";(function(e){const r=n(81),i=n(400);t.names=i.names,t.codes=i.codes,t.defaultLengths=i.defaultLengths;const o=n(38);function s(e){t.decode(e)}t.toHexString=function t(n){if(!e.isBuffer(n))throw new Error("must be passed a buffer");return n.toString("hex")},t.fromHexString=function t(n){return e.from(n,"hex")},t.toB58String=function t(n){if(!e.isBuffer(n))throw new Error("must be passed a buffer");return r.encode(n)},t.fromB58String=function t(n){let i=n;return e.isBuffer(n)&&(i=n.toString()),e.from(r.decode(i))},t.decode=function n(r){if(!e.isBuffer(r))throw new Error("multihash must be a Buffer");if(r.length<3)throw new Error("multihash too short. must be > 3 bytes.");let s=o.decode(r);if(!t.isValidCode(s))throw new Error(`multihash unknown function code: 0x${s.toString(16)}`);r=r.slice(o.decode.bytes);let a=o.decode(r);if(a<1)throw new Error(`multihash invalid length: 0x${a.toString(16)}`);if(r=r.slice(o.decode.bytes),r.length!==a)throw new Error(`multihash length inconsistent: 0x${r.toString("hex")}`);return{code:s,name:i.codes[s],length:a,digest:r}},t.encode=function n(r,i,s){if(!r||!i)throw new Error("multihash encode requires at least two args: digest, code");const a=t.coerceCode(i);if(!e.isBuffer(r))throw new Error("digest should be a Buffer");if(null==s&&(s=r.length),s&&r.length!==s)throw new Error("digest length should be equal to specified length.");return e.concat([e.from(o.encode(a)),e.from(o.encode(s)),r])},t.coerceCode=function e(n){let r=n;if("string"==typeof n){if(!i.names[n])throw new Error(`Unrecognized hash function named: ${n}`);r=i.names[n]}if("number"!=typeof r)throw new Error(`Hash function code should be a number. Got: ${r}`);if(!i.codes[r]&&!t.isAppCode(r))throw new Error(`Unrecognized function code: ${r}`);return r},t.isAppCode=function e(t){return t>0&&t<16},t.isValidCode=function e(n){return!!t.isAppCode(n)||!!i.codes[n]},t.validate=s,t.prefix=function e(t){return s(t),t.slice(0,2)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=n(402);e.exports=function e(t,n){if(!t)return function(e,t){return e?r(t,e,n):t(!0)};Array.isArray(t)||(t=Object.keys(t).map(function(e){return t[e]}));var i=0;return function(e,o){if(e)return r(o,e,n);i>=t.length?o(!0):o(null,t[i++])}}},function(e,t,n){"use strict";const r=n(23),{ensureMultiaddr:i}=n(476),o=n(945),s=n(18);class a{constructor(e){s(e,"Missing peerId. Use Peer.create(cb) to create one"),this.id=e,this.multiaddrs=new o,this.protocols=new Set,this._connectedMultiaddr=void 0}connect(e){if(e=i(e),!this.multiaddrs.has(e)&&e.toString()!==`/ipfs/${this.id.toB58String()}`)throw new Error("can't be connected to missing multiaddr from set");this._connectedMultiaddr=e}disconnect(){this._connectedMultiaddr=void 0}isConnected(){return this._connectedMultiaddr}}a.create=((e,t)=>{if("function"==typeof e)return t=e,e=null,void r.create((e,n)=>{if(e)return t(e);t(null,new a(n))});"function"==typeof e.toJSON?t(null,new a(e)):r.createFromJSON(e,(e,n)=>t(e,new a(n)))}),a.isPeerInfo=(e=>Boolean("object"==typeof e&&e.id&&e.multiaddrs)),e.exports=a},function(e,t,n){var r=n(576),i=n(346),o=r.tfJSON,s=r.TfTypeError,a=r.TfPropertyTypeError,u=r.tfSubError,l=r.getValueTypeName,c={arrayOf:function e(t,n){function r(e,r){return!!i.Array(e)&&(!i.Nil(e)&&(!(void 0!==n.minLength&&e.lengthn.maxLength)&&((void 0===n.length||e.length===n.length)&&e.every(function(e,n){try{return h(t,e,r)}catch(e){throw u(e,n)}})))))}return t=f(t),n=n||{},r.toJSON=function(){var e="["+o(t)+"]";return void 0!==n.length?e+="{"+n.length+"}":void 0===n.minLength&&void 0===n.maxLength||(e+="{"+(void 0===n.minLength?0:n.minLength)+","+(void 0===n.maxLength?1/0:n.maxLength)+"}"),e},r},maybe:function e(t){function n(n,r){return i.Nil(n)||t(n,r,e)}return t=f(t),n.toJSON=function(){return"?"+o(t)},n},map:function e(t,n){function r(e,r){if(!i.Object(e))return!1;if(i.Nil(e))return!1;for(var o in e){try{n&&h(n,o,r)}catch(e){throw u(e,o,"key")}try{var s=e[o];h(t,s,r)}catch(e){throw u(e,o)}}return!0}return t=f(t),n&&(n=f(n)),r.toJSON=n?function(){return"{"+o(n)+": "+o(t)+"}"}:function(){return"{"+o(t)+"}"},r},object:function e(t){var n={};for(var r in t)n[r]=f(t[r]);function s(e,t){if(!i.Object(e))return!1;if(i.Nil(e))return!1;var r;try{for(r in n){var o=n[r],s=e[r];h(o,s,t)}}catch(e){throw u(e,r)}if(t)for(r in e)if(!n[r])throw new a(void 0,r);return!0}return s.toJSON=function(){return o(n)},s},anyOf:function e(){var t=[].slice.call(arguments).map(f);function n(e,n){return t.some(function(t){try{return h(t,e,n)}catch(e){return!1}})}return n.toJSON=function(){return t.map(o).join("|")},n},allOf:function e(){var t=[].slice.call(arguments).map(f);function n(e,n){return t.every(function(t){try{return h(t,e,n)}catch(e){return!1}})}return n.toJSON=function(){return t.map(o).join(" & ")},n},quacksLike:function e(t){function n(e){return t===l(e)}return n.toJSON=function(){return t},n},tuple:function e(){var t=[].slice.call(arguments).map(f);function n(e,n){return!i.Nil(e)&&(!i.Nil(e.length)&&((!n||e.length===t.length)&&t.every(function(t,r){try{return h(t,e[r],n)}catch(e){throw u(e,r)}})))}return n.toJSON=function(){return"("+t.map(o).join(", ")+")"},n},value:function e(t){function n(e){return e===t}return n.toJSON=function(){return t},n}};function f(e){if(i.String(e))return"?"===e[0]?c.maybe(e.slice(1)):i[e]||c.quacksLike(e);if(e&&i.Object(e)){if(i.Array(e)){if(1!==e.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return c.arrayOf(e[0])}return c.object(e)}return i.Function(e)?e:c.value(e)}function h(e,t,n,r){if(i.Function(e)){if(e(t,n))return!0;throw new s(r||e,t)}return h(f(e),t,n)}for(var p in c.oneOf=c.anyOf,i)h[p]=i[p];for(p in c)h[p]=c[p];var d=n(1348);for(p in d)h[p]=d[p];h.compile=f,h.TfTypeError=s,h.TfPropertyTypeError=a,e.exports=h},function(e,t,n){(function(t){e.exports=g;var r=n(27),i=n(56),o=n(15),s=n(205),a=n(101),u=n(377).DiffieHellman,l=n(95),c=n(47),f=n(52),h;try{h=n(711)}catch(e){}var p=l.InvalidAlgorithmError,d=l.KeyParseError,m={};function g(e){r.object(e,"options"),r.arrayOfObject(e.parts,"options.parts"),r.string(e.type,"options.type"),r.optionalString(e.comment,"options.comment");var t=i.info[e.type];if("object"!=typeof t)throw new p(e.type);for(var n={},o=0,s;o1024&&(e="sha256"),"ed25519"===this.type&&(e="sha512"),"ecdsa"===this.type&&(e=this.size<=256?"sha256":this.size<=384?"sha384":"sha512"),e},g.prototype.createVerify=function(e){if(void 0===e&&(e=this.defaultHashAlgorithm()),r.string(e,"hash algorithm"),"ed25519"===this.type&&void 0!==h)return new h.Verifier(this,e);if("curve25519"===this.type)throw new Error("Curve25519 keys are not suitable for signing or verification");var n,i,s;try{i=e.toUpperCase(),n=o.createVerify(i)}catch(e){s=e}(void 0===n||s instanceof Error&&s.message.match(/Unknown message digest/))&&(i="RSA-",i+=e.toUpperCase(),n=o.createVerify(i)),r.ok(n,"failed to create verifier");var u=n.verify.bind(n),l=this.toBuffer("pkcs8"),c=this.curve,f=this;return n.verify=function(n,r){if(a.isSignature(n,[2,0]))return n.type===f.type&&((!n.hashAlgorithm||n.hashAlgorithm===e)&&((!n.curve||"ecdsa"!==f.type||n.curve===c)&&u(l,n.toBuffer("asn1"))));if("string"==typeof n||t.isBuffer(n))return u(l,n,r);throw a.isSignature(n,[1,0])?new Error("signature was created by too old a version of sshpk and cannot be verified"):new TypeError("signature must be a string, Buffer, or Signature object")},n},g.prototype.createDiffieHellman=function(){if("rsa"===this.type)throw new Error("RSA keys do not support Diffie-Hellman");return new u(this)},g.prototype.createDH=g.prototype.createDiffieHellman,g.parse=function(e,t,n){"string"!=typeof e&&r.buffer(e,"data"),void 0===t&&(t="auto"),r.string(t,"format"),"string"==typeof n&&(n={filename:n}),r.optionalObject(n,"options"),void 0===n&&(n={}),r.optionalString(n.filename,"options.filename"),void 0===n.filename&&(n.filename="(unnamed)"),r.object(m[t],"formats[format]");try{var i=m[t].read(e,n);return i instanceof f&&(i=i.toPublic()),i.comment||(i.comment=n.filename),i}catch(e){if("KeyEncryptedError"===e.name)throw e;throw new d(n.filename,t,e)}},g.isKey=function(e,t){return c.isCompatible(e,g,t)},g.prototype._sshpkApiVersion=[1,7],g._oldVersionDetect=function(e){return r.func(e.toBuffer),r.func(e.fingerprint),e.createDH?[1,4]:e.defaultHashAlgorithm?[1,3]:e.formats.auto?[1,2]:e.formats.pkcs1?[1,1]:[1,0]}}).call(this,n(0).Buffer)},function(e,t,n){e.exports={bufferSplit:w,addRSAMissing:P,calculateDSAPublic:T,calculateED25519Public:j,calculateX25519Public:O,mpNormalize:x,mpDenormalize:C,ecNormalize:k,countZeros:_,assertCompatible:m,isCompatible:d,opensslKeyDeriv:b,opensshCipherInfo:R,publicFromPrivateECDSA:B,zeroPadToLength:A,writeBitString:E,readBitString:S,pbkdf2:v};var r=n(27),i=n(31).Buffer,o=n(52),s=n(46),a=n(15),u=n(56),l=n(102),c=n(285),f=n(206).BigInteger,h=n(207),p=3;function d(e,t,n){if(null===e||"object"!=typeof e)return!1;if(void 0===n&&(n=t.prototype._sshpkApiVersion),e instanceof t&&t.prototype._sshpkApiVersion[0]==n[0])return!0;for(var r=Object.getPrototypeOf(e),i=0;r.constructor.name!==t.name;)if(r=Object.getPrototypeOf(r),!r||++i>p)return!1;if(r.constructor.name!==t.name)return!1;var o=r._sshpkApiVersion;return void 0===o&&(o=t._oldVersionDetect(e)),!(o[0]!=n[0]||o[1]=n[1],i+" must be compatible with "+t.name+" klass version "+n[0]+"."+n[1])}}var g={"des-ede3-cbc":{key:24,iv:8},"aes-128-cbc":{key:16,iv:16},"aes-256-cbc":{key:32,iv:16}},y=8;function b(e,t,n,o){r.buffer(t,"salt"),r.buffer(n,"passphrase"),r.number(o,"iteration count");var s=g[e],u,l,c;r.object(s,"supported cipher"),t=t.slice(0,y);for(var f=i.alloc(0);f.length=t.length){var a=s+1;n.push(e.slice(i,a-o)),i=a,o=0}return i<=e.length&&n.push(e.slice(i,e.length)),n}function k(e,t){if(r.buffer(e),0===e[0]&&4===e[1])return t?e:e.slice(1);if(4===e[0]){if(!t)return e}else{for(;0===e[0];)e=e.slice(1);if(2===e[0]||3===e[0])throw new Error("Compressed elliptic curve points are not supported");if(4!==e[0])throw new Error("Not a valid elliptic curve point");if(!t)return e}var n=i.alloc(e.length+1);return n[0]=0,e.copy(n,1),n}function S(e,t){void 0===t&&(t=l.Ber.BitString);var n=e.readString(t,!0);return r.strictEqual(n[0],0,"bit strings with unused bits are not supported (0x"+n[0].toString(16)+")"),n.slice(1)}function E(e,t,n){void 0===n&&(n=l.Ber.BitString);var r=i.alloc(t.length+1);r[0]=0,t.copy(r,1),e.writeBuffer(r,n)}function x(e){for(r.buffer(e);e.length>1&&0===e[0]&&0==(128&e[1]);)e=e.slice(1);if(128==(128&e[0])){var t=i.alloc(e.length+1);t[0]=0,e.copy(t,1),e=t}return e}function C(e){for(r.buffer(e);e.length>1&&0===e[0];)e=e.slice(1);return e}function A(e,t){for(r.buffer(e),r.number(t);e.length>t;)r.equal(e[0],0),e=e.slice(1);for(;e.length{this.blockSizes.push(e)}),this.removeBlockSize=(e=>{this.blockSizes.splice(e,1)}),this.fileSize=(()=>{if(a.indexOf(this.type)>=0)return;let e=0;return this.blockSizes.forEach(t=>{e+=t}),t&&(e+=t.length),e}),this.marshal=(()=>{let e;switch(this.type){case"raw":e=o.DataType.Raw;break;case"directory":e=o.DataType.Directory;break;case"file":e=o.DataType.File;break;case"metadata":e=o.DataType.Metadata;break;case"symlink":e=o.DataType.Symlink;break;case"hamt-sharded-directory":e=o.DataType.HAMTShard;break;default:throw new Error(`Unkown type: "${this.type}"`)}let t=this.fileSize(),n=this.data;this.data&&this.data.length||(n=void 0);let r=this.blockSizes;return this.blockSizes&&this.blockSizes.length||(r=void 0),o.encode({Type:e,Data:n,filesize:t,blocksizes:r,hashType:this.hashType,fanout:this.fanout})})}u.unmarshal=(e=>{const t=o.decode(e);t.Data||(t.Data=void 0);const n=new u(s[t.Type],t.Data);return n.blockSizes=t.blocksizes,n}),t=e.exports=u},function(e,t,n){"use strict";(function(t){var r=n(595),i=n(25),o=n(17),s=function(e){for(var n=new t(e.length),r=0;re.size?n=r.trim(n,o):o0&&0==(127&e[e.length-1])&&(e.length<=1||0==(128&e[e.length-2])))throw new Error("non-minimally encoded script number");return r.fromSM(e,{endian:"little"})},r.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})},r.prototype.gt=function(e){return this.cmp(e)>0},r.prototype.gte=function(e){return this.cmp(e)>=0},r.prototype.lt=function(e){return this.cmp(e)<0},r.trim=function(e,t){return e.slice(t-e.length,e.length)},r.pad=function(e,n,r){for(var i=new t(r),o=0;o{if(e)return i(e);i(null,r.encode(o,t,n))})}e.exports=o,o.Buffer=t,o.multihash=r,o.digest=function(e,t,n,r){if("function"==typeof n&&(r=n,n=void 0),!r)throw new Error("Missing callback");let i=r,s;n&&(i=((e,t)=>{if(e)return r(e);r(null,t.slice(0,n))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=r.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions)}).call(this,n(0).Buffer)},function(e,t,n){var r=n(31).Buffer,i={dsa:{parts:["p","q","g","y"],sizePart:"p"},rsa:{parts:["e","n"],sizePart:"n"},ecdsa:{parts:["curve","Q"],sizePart:"Q"},ed25519:{parts:["A"],sizePart:"A"}};i.curve25519=i.ed25519;var o={dsa:{parts:["p","q","g","y","x"]},rsa:{parts:["n","e","d","iqmp","p","q"]},ecdsa:{parts:["curve","Q","d"]},ed25519:{parts:["A","k"]}};o.curve25519=o.ed25519;var s={md5:!0,sha1:!0,sha256:!0,sha384:!0,sha512:!0},a={nistp256:{size:256,pkcs8oid:"1.2.840.10045.3.1.7",p:r.from("00ffffffff 00000001 00000000 0000000000000000 ffffffff ffffffff ffffffff".replace(/ /g,""),"hex"),a:r.from("00FFFFFFFF 00000001 00000000 0000000000000000 FFFFFFFF FFFFFFFF FFFFFFFC".replace(/ /g,""),"hex"),b:r.from("5ac635d8 aa3a93e7 b3ebbd55 769886bc651d06b0 cc53b0f6 3bce3c3e 27d2604b".replace(/ /g,""),"hex"),s:r.from("00c49d3608 86e70493 6a6678e1 139d26b7819f7e90".replace(/ /g,""),"hex"),n:r.from("00ffffffff 00000000 ffffffff ffffffffbce6faad a7179e84 f3b9cac2 fc632551".replace(/ /g,""),"hex"),G:r.from("046b17d1f2 e12c4247 f8bce6e5 63a440f277037d81 2deb33a0 f4a13945 d898c2964fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e162bce3357 6b315ece cbb64068 37bf51f5".replace(/ /g,""),"hex")},nistp384:{size:384,pkcs8oid:"1.3.132.0.34",p:r.from("00ffffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff fffffffeffffffff 00000000 00000000 ffffffff".replace(/ /g,""),"hex"),a:r.from("00FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFEFFFFFFFF 00000000 00000000 FFFFFFFC".replace(/ /g,""),"hex"),b:r.from("b3312fa7 e23ee7e4 988e056b e3f82d19181d9c6e fe814112 0314088f 5013875ac656398d 8a2ed19d 2a85c8ed d3ec2aef".replace(/ /g,""),"hex"),s:r.from("00a335926a a319a27a 1d00896a 6773a4827acdac73".replace(/ /g,""),"hex"),n:r.from("00ffffffff ffffffff ffffffff ffffffffffffffff ffffffff c7634d81 f4372ddf581a0db2 48b0a77a ecec196a ccc52973".replace(/ /g,""),"hex"),G:r.from("04aa87ca22 be8b0537 8eb1c71e f320ad746e1d3b62 8ba79b98 59f741e0 82542a385502f25d bf55296c 3a545e38 72760ab73617de4a 96262c6f 5d9e98bf 9292dc29f8f41dbd 289a147c e9da3113 b5f0b8c00a60b1ce 1d7e819d 7a431d7c 90ea0e5f".replace(/ /g,""),"hex")},nistp521:{size:521,pkcs8oid:"1.3.132.0.35",p:r.from("01ffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff ffffffffffff".replace(/ /g,""),"hex"),a:r.from("01FFFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFC".replace(/ /g,""),"hex"),b:r.from("51953eb961 8e1c9a1f 929a21a0 b68540eea2da725b 99b315f3 b8b48991 8ef109e156193951 ec7e937b 1652c0bd 3bb1bf073573df88 3d2c34f1 ef451fd4 6b503f00".replace(/ /g,""),"hex"),s:r.from("00d09e8800 291cb853 96cc6717 393284aaa0da64ba".replace(/ /g,""),"hex"),n:r.from("01ffffffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff fffffffa51868783 bf2f966b 7fcc0148 f709a5d03bb5c9b8 899c47ae bb6fb71e 91386409".replace(/ /g,""),"hex"),G:r.from("0400c6 858e06b7 0404e9cd 9e3ecb66 2395b4429c648139 053fb521 f828af60 6b4d3dbaa14b5e77 efe75928 fe1dc127 a2ffa8de3348b3c1 856a429b f97e7e31 c2e5bd660118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd998f54449 579b4468 17afbd17 273e662c97ee7299 5ef42640 c550b901 3fad0761353c7086 a272c240 88be9476 9fd16650".replace(/ /g,""),"hex")}};e.exports={info:i,privInfo:o,hashAlgs:s,curves:a}},function(e,t,n){e.exports=o;var r=n(6).EventEmitter,i=n(1);function o(){r.call(this)}i(o,r),o.Readable=n(299),o.Writable=n(848),o.Duplex=n(849),o.Transform=n(850),o.PassThrough=n(851),o.Stream=o,o.prototype.pipe=function(e,t){var n=this;function i(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function o(){n.readable&&n.resume&&n.resume()}n.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(n.on("end",a),n.on("close",u));var s=!1;function a(){s||(s=!0,e.end())}function u(){s||(s=!0,"function"==typeof e.destroy&&e.destroy())}function l(e){if(c(),0===r.listenerCount(this,"error"))throw e}function c(){n.removeListener("data",i),e.removeListener("drain",o),n.removeListener("end",a),n.removeListener("close",u),n.removeListener("error",l),e.removeListener("error",l),n.removeListener("end",c),n.removeListener("close",c),e.removeListener("close",c)}return n.on("error",l),e.on("error",l),n.on("end",c),n.on("close",c),e.on("close",c),e.emit("pipe",n),e}},function(e,t,n){(function(t){var r=n(28),i=n(254),o=n(1107),s=function(){},a=/^v?\.0/.test(t.version),u=function(e){return"function"==typeof e},l=function(e){return!!a&&(!!o&&((e instanceof(o.ReadStream||s)||e instanceof(o.WriteStream||s))&&u(e.close)))},c=function(e){return e.setHeader&&u(e.abort)},f=function(e,t,n,o){o=r(o);var a=!1;e.on("close",function(){a=!0}),i(e,{readable:t,writable:n},function(e){if(e)return o(e);a=!0,o()});var f=!1;return function(t){if(!a&&!f)return f=!0,l(e)?e.close(s):c(e)?e.abort():u(e.destroy)?e.destroy():void o(t||new Error("stream was destroyed"))}},h=function(e){e()},p=function(e,t){return e.pipe(t)},d=function(){var e=Array.prototype.slice.call(arguments),t=u(e[e.length-1]||s)&&e.pop()||s,n;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new Error("pump requires two streams per minimum");var r=e.map(function(i,o){var s=o0;return f(i,s,a,function(e){n||(n=e),e&&r.forEach(h),s||(r.forEach(h),t(n))})});return e.reduce(p)};e.exports=d}).call(this,n(2))},function(e,t,n){"use strict";(function(t){var r=n(15),i=n(30),o=n(25),s=e.exports;s.sha1=function(e){return o.checkArgument(i.isBuffer(e)),r.createHash("sha1").update(e).digest()},s.sha1.blocksize=512,s.sha256=function(e){return o.checkArgument(i.isBuffer(e)),r.createHash("sha256").update(e).digest()},s.sha256.blocksize=512,s.sha256sha256=function(e){return o.checkArgument(i.isBuffer(e)),s.sha256(s.sha256(e))},s.ripemd160=function(e){return o.checkArgument(i.isBuffer(e)),r.createHash("ripemd160").update(e).digest()},s.sha256ripemd160=function(e){return o.checkArgument(i.isBuffer(e)),s.ripemd160(s.sha256(e))},s.sha512=function(e){return o.checkArgument(i.isBuffer(e)),r.createHash("sha512").update(e).digest()},s.sha512.blocksize=1024,s.hmac=function(e,n,r){o.checkArgument(i.isBuffer(n)),o.checkArgument(i.isBuffer(r)),o.checkArgument(e.blocksize);var s=e.blocksize/8;if(r.length>s)r=e(r);else if(r!(!e||!e[r])),i}function i(e,{className:t,symbolName:n,withoutNew:r}){const i=Symbol.for(n),o={[t]:function(...t){if(r&&!(this instanceof o))return new o(...t);const n=e.call(this,...t)||this;return n&&!n[i]&&Object.defineProperty(n,i,{value:!0}),n}}[t];return o.prototype=Object.create(e.prototype),o.prototype.constructor=o,Object.defineProperty(o.prototype,Symbol.toStringTag,{get:()=>t}),o[`is${t}`]=(e=>!(!e||!e[i])),o}e.exports=r,e.exports.proto=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var r=n(214),i=l(r),o=n(408),s=l(o),a=n(41),u=l(a);function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t,n){(0,i.default)(e,(0,s.default)((0,u.default)(t)),n)}e.exports=t.default},function(e,t,n){var r;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,u=Math.ceil,l=Math.floor,c="[BigNumber Error] ",f=c+"Number primitive has more than 15 significant digits: ",h=1e14,p=14,d=9007199254740991,m=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,y=1e9;function b(e){var t,n,r,i=H.prototype={constructor:H,toString:null,valueOf:null},o=new H(1),C=20,A=4,I=-7,T=21,j=-1e7,O=1e7,P=!1,B=1,R=0,N={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},M="0123456789abcdefghijklmnopqrstuvwxyz",L,F,D,U,z,q,K;function H(e,t){var i,o,a,u,c,h,m,g,y=this;if(!(y instanceof H))return new H(e,t);if(null==t){if(e&&!0===e._isBigNumber)return y.s=e.s,void(!e.c||e.e>O?y.c=y.e=null:e.e=10;c/=10,u++);return void(u>O?y.c=y.e=null:(y.e=u,y.c=[e]))}g=String(e)}else{if(!s.test(g=String(e)))return r(y,g,h);y.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(u=g.indexOf("."))>-1&&(g=g.replace(".","")),(c=g.search(/e/i))>0?(u<0&&(u=c),u+=+g.slice(c+1),g=g.substring(0,c)):u<0&&(u=g.length)}else{if(k(t,2,M.length,"Base"),10==t)return y=new H(e),G(y,C+y.e+1,A);if(g=String(e),h="number"==typeof e){if(0*e!=0)return r(y,g,h,t);if(y.s=1/e<0?(g=g.slice(1),-1):1,H.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(f+e)}else y.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(i=M.slice(0,t),u=c=0,m=g.length;cu){u=m;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,c=-1,u=0;continue}return r(y,String(e),h,t)}h=!1,g=n(g,t,10,y.s),(u=g.indexOf("."))>-1?g=g.replace(".",""):u=g.length}for(c=0;48===g.charCodeAt(c);c++);for(m=g.length;48===g.charCodeAt(--m););if(g=g.slice(c,++m)){if(m-=c,h&&H.DEBUG&&m>15&&(e>d||e!==l(e)))throw Error(f+y.s*e);if((u=u-c-1)>O)y.c=y.e=null;else if(u=T)?E(u,s):x(u,s,"0");else if(e=G(new H(e),t,n),o=e.e,u=_(e.c),a=u.length,1==r||2==r&&(t<=o||o<=I)){for(;aa){if(--t>0)for(u+=".";t--;u+="0");}else if(t+=o-a,t>0)for(o+1==a&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function W(e,t){for(var n,r=1,i=new H(e[0]);r=10;i/=10,r++);return(n=r+n*p-1)>O?e.c=e.e=null:n=10;a/=10,i++);if(o=t-i,o<0)o+=p,s=t,c=g[f=0],d=c/y[i-s-1]%10|0;else if(f=u((o+1)/p),f>=g.length){if(!r)break e;for(;g.length<=f;g.push(0));c=d=0,i=1,o%=p,s=o-p+1}else{for(c=a=g[f],i=1;a>=10;a/=10,i++);o%=p,s=o-p+i,d=s<0?0:c/y[i-s-1]%10|0}if(r=r||t<0||null!=g[f+1]||(s<0?c:c%y[i-s-1]),r=n<4?(d||r)&&(0==n||n==(e.s<0?3:2)):d>5||5==d&&(4==n||r||6==n&&(o>0?s>0?c/y[i-s]:0:g[f-1])%10&1||n==(e.s<0?8:7)),t<1||!g[0])return g.length=0,r?(t-=e.e+1,g[0]=y[(p-t%p)%p],e.e=-t||0):g[0]=e.e=0,e;if(0==o?(g.length=f,a=1,f--):(g.length=f+1,a=y[p-o],g[f]=s>0?l(c/y[i-s]%y[s])*a:0),r)for(;;){if(0==f){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=a,a=1;s>=10;s/=10,a++);o!=a&&(e.e++,g[0]==h&&(g[0]=1));break}if(g[f]+=a,g[f]!=h)break;g[f--]=0,a=1}for(o=g.length;0===g[--o];g.pop());}e.e>O?e.c=e.e=null:e.e=T?E(t,n):x(t,n,"0"),e.s<0?"-"+t:t)}return H.clone=b,H.ROUND_UP=0,H.ROUND_DOWN=1,H.ROUND_CEIL=2,H.ROUND_FLOOR=3,H.ROUND_HALF_UP=4,H.ROUND_HALF_DOWN=5,H.ROUND_HALF_EVEN=6,H.ROUND_HALF_CEIL=7,H.ROUND_HALF_FLOOR=8,H.EUCLID=9,H.config=H.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(c+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(n=e[t],k(n,0,y,t),C=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(n=e[t],k(n,0,8,t),A=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&(n=e[t],n&&n.pop?(k(n[0],-y,0,t),k(n[1],0,y,t),I=n[0],T=n[1]):(k(n,-y,y,t),I=-(T=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if(n=e[t],n&&n.pop)k(n[0],-y,-1,t),k(n[1],1,y,t),j=n[0],O=n[1];else{if(k(n,-y,y,t),!n)throw Error(c+t+" cannot be zero: "+n);j=-(O=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if(n=e[t],n!==!!n)throw Error(c+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw P=!n,Error(c+"crypto unavailable");P=n}else P=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(n=e[t],k(n,0,9,t),B=n),e.hasOwnProperty(t="POW_PRECISION")&&(n=e[t],k(n,0,y,t),R=n),e.hasOwnProperty(t="FORMAT")){if(n=e[t],"object"!=typeof n)throw Error(c+t+" not an object: "+n);N=n}if(e.hasOwnProperty(t="ALPHABET")){if(n=e[t],"string"!=typeof n||/^.$|[+-.\s]|(.).*\1/.test(n))throw Error(c+t+" invalid: "+n);M=n}}return{DECIMAL_PLACES:C,ROUNDING_MODE:A,EXPONENTIAL_AT:[I,T],RANGE:[j,O],CRYPTO:P,MODULO_MODE:B,POW_PRECISION:R,FORMAT:N,ALPHABET:M}},H.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!H.DEBUG)return!0;var t,n,r=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===o||-1===o)&&i>=-y&&i<=y&&i===l(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break e}if(t=(i+1)%p,t<1&&(t+=p),String(r[0]).length==t){for(t=0;t=h||n!==l(n))break e;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(c+"Invalid BigNumber: "+e)},H.maximum=H.max=function(){return W(arguments,i.lt)},H.minimum=H.min=function(){return W(arguments,i.gt)},H.random=(L=9007199254740992,F=Math.random()*L&2097151?function(){return l(Math.random()*L)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,r,i,s,a=0,f=[],h=new H(o);if(null==e?e=C:k(e,0,y),i=u(e/p),P)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));a>>11),s>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[a]=n[0],t[a+1]=n[1]):(f.push(s%1e14),a+=2);a=i/2}else{if(!crypto.randomBytes)throw P=!1,Error(c+"crypto unavailable");for(t=crypto.randomBytes(i*=7);a=9e15?crypto.randomBytes(7).copy(t,a):(f.push(s%1e14),a+=7);a=i/7}if(!P)for(;a=10;s/=10,a++);an-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/n|0,o[i]%=n)}return o.reverse()}return function(r,i,o,s,a){var u,l,c,f,h,p,d,m,g=r.indexOf("."),y=C,b=A;for(g>=0&&(f=R,R=0,r=r.replace(".",""),m=new H(i),p=m.pow(r.length-g),R=f,m.c=n(x(_(p.c),p.e,"0"),10,o,e),m.e=m.c.length),d=n(r,i,o,a?(u=M,e):(u=e,M)),c=f=d.length;0==d[--f];d.pop());if(!d[0])return u.charAt(0);if(g<0?--c:(p.c=d,p.e=c,p.s=s,p=t(p,m,y,b,o),d=p.c,h=p.r,c=p.e),l=c+y+1,g=d[l],f=o/2,h=h||l<0||null!=d[l+1],h=b<4?(null!=g||h)&&(0==b||b==(p.s<0?3:2)):g>f||g==f&&(4==b||h||6==b&&1&d[l-1]||b==(p.s<0?8:7)),l<1||!d[0])r=h?x(u.charAt(1),-y,u.charAt(0)):u.charAt(0);else{if(d.length=l,h)for(--o;++d[--l]>o;)d[l]=0,l||(++c,d=[1].concat(d));for(f=d.length;!d[--f];);for(g=0,r="";g<=f;r+=u.charAt(d[g++]));r=x(r,c,u.charAt(0))}return r}}(),t=function(){function e(e,t,n){var r,i,o,s,a=0,u=e.length,l=t%g,c=t/g|0;for(e=e.slice();u--;)o=e[u]%g,s=e[u]/g|0,r=c*o+s*l,i=l*o+r%g*g+a,a=(i/n|0)+(r/g|0)+c*s,e[u]=i%n;return a&&(e=[a].concat(e)),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]1;e.splice(0,1));}return function(r,i,o,s,a){var u,c,f,d,m,g,y,b,_,w,k,S,E,x,C,A,I,T=r.s==i.s?1:-1,j=r.c,O=i.c;if(!(j&&j[0]&&O&&O[0]))return new H(r.s&&i.s&&(j?!O||j[0]!=O[0]:O)?j&&0==j[0]||!O?0*T:T/0:NaN);for(b=new H(T),_=b.c=[],c=r.e-i.e,T=o+c+1,a||(a=h,c=v(r.e/p)-v(i.e/p),T=T/p|0),f=0;O[f]==(j[f]||0);f++);if(O[f]>(j[f]||0)&&c--,T<0)_.push(1),d=!0;else{for(x=j.length,A=O.length,f=0,T+=2,m=l(a/(O[0]+1)),m>1&&(O=e(O,m,a),j=e(j,m,a),A=O.length,x=j.length),E=A,w=j.slice(0,A),k=w.length;k=a/2&&C++;do{if(m=0,u=t(O,w,A,k),u<0){if(S=w[0],A!=k&&(S=S*a+(w[1]||0)),m=l(S/C),m>1)for(m>=a&&(m=a-1),g=e(O,m,a),y=g.length,k=w.length;1==t(g,w,y,k);)m--,n(g,A=10;T/=10,f++);G(b,o+(b.e=f+c*p-1)+1,s,d)}else b.e=c,b.r=+d;return b}}(),D=/^(-?)0([xbo])(?=\w[\w.]*$)/i,U=/^([^.]+)\.$/,z=/^\.([^.]+)$/,q=/^-?(Infinity|NaN)$/,K=/^\s*\+(?=[\w.])|^\s+|\s+$/g,r=function(e,t,n,r){var i,o=n?t:t.replace(K,"");if(q.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(D,function(e,t,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?e:t}),r&&(i=r,o=o.replace(U,"$1").replace(z,"0.$1")),t!=o))return new H(o,i);if(H.DEBUG)throw Error(c+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},i.absoluteValue=i.abs=function(){var e=new H(this);return e.s<0&&(e.s=1),e},i.comparedTo=function(e,t){return w(this,new H(e,t))},i.decimalPlaces=i.dp=function(e,t){var n,r,i,o=this;if(null!=e)return k(e,0,y),null==t?t=A:k(t,0,8),G(new H(o),e+o.e+1,t);if(!(n=o.c))return null;if(r=((i=n.length-1)-v(this.e/p))*p,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},i.dividedBy=i.div=function(e,n){return t(this,new H(e,n),C,A)},i.dividedToIntegerBy=i.idiv=function(e,n){return t(this,new H(e,n),0,1)},i.exponentiatedBy=i.pow=function(e,t){var n,r,i,s,a,f,h,d,m,g=this;if(e=new H(e),e.c&&!e.isInteger())throw Error(c+"Exponent not an integer: "+Y(e));if(null!=t&&(t=new H(t)),f=e.e>14,!g.c||!g.c[0]||1==g.c[0]&&!g.e&&1==g.c.length||!e.c||!e.c[0])return m=new H(Math.pow(+Y(g),f?2-S(e):+Y(e))),t?m.mod(t):m;if(h=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new H(NaN);r=!h&&g.isInteger()&&t.isInteger(),r&&(g=g.mod(t))}else{if(e.e>9&&(g.e>0||g.e<-1||(0==g.e?g.c[0]>1||f&&g.c[1]>=24e7:g.c[0]<8e13||f&&g.c[0]<=9999975e7)))return s=g.s<0&&S(e)?-0:0,g.e>-1&&(s=1/s),new H(h?1/s:s);R&&(s=u(R/p+2))}for(f?(n=new H(.5),h&&(e.s=1),d=S(e)):(i=Math.abs(+Y(e)),d=i%2),m=new H(o);;){if(d){if(m=m.times(g),!m.c)break;s?m.c.length>s&&(m.c.length=s):r&&(m=m.mod(t))}if(i){if(i=l(i/2),0===i)break;d=i%2}else if(e=e.times(n),G(e,e.e+1,1),e.e>14)d=S(e);else{if(i=+Y(e),0===i)break;d=i%2}g=g.times(g),s?g.c&&g.c.length>s&&(g.c.length=s):r&&(g=g.mod(t))}return r?m:(h&&(m=o.div(m)),t?m.mod(t):s?G(m,R,A,a):m)},i.integerValue=function(e){var t=new H(this);return null==e?e=A:k(e,0,8),G(t,t.e+1,e)},i.isEqualTo=i.eq=function(e,t){return 0===w(this,new H(e,t))},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(e,t){return w(this,new H(e,t))>0},i.isGreaterThanOrEqualTo=i.gte=function(e,t){return 1===(t=w(this,new H(e,t)))||0===t},i.isInteger=function(){return!!this.c&&v(this.e/p)>this.c.length-2},i.isLessThan=i.lt=function(e,t){return w(this,new H(e,t))<0},i.isLessThanOrEqualTo=i.lte=function(e,t){return-1===(t=w(this,new H(e,t)))||0===t},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&0==this.c[0]},i.minus=function(e,t){var n,r,i,o,s=this,a=s.s;if(e=new H(e,t),t=e.s,!a||!t)return new H(NaN);if(a!=t)return e.s=-t,s.plus(e);var u=s.e/p,l=e.e/p,c=s.c,f=e.c;if(!u||!l){if(!c||!f)return c?(e.s=-t,e):new H(f?s:NaN);if(!c[0]||!f[0])return f[0]?(e.s=-t,e):new H(c[0]?s:3==A?-0:0)}if(u=v(u),l=v(l),c=c.slice(),a=u-l){for((o=a<0)?(a=-a,i=c):(l=u,i=f),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(r=(o=(a=c.length)<(t=f.length))?a:t,a=t=0;t0)for(;t--;c[n++]=0);for(t=h-1;r>a;){if(c[--r]=0;){for(n=0,d=S[i]%_,m=S[i]/_|0,s=u,o=i+s;o>i;)l=k[--s]%_,c=k[s]/_|0,a=m*l+c*d,l=d*l+a%_*_+y[o]+n,n=(l/b|0)+(a/_|0)+m*c,y[o--]=l%b;y[o]=n}return n?++r:y.splice(0,1),$(e,y,r)},i.negated=function(){var e=new H(this);return e.s=-e.s||null,e},i.plus=function(e,t){var n,r=this,i=r.s;if(e=new H(e,t),t=e.s,!i||!t)return new H(NaN);if(i!=t)return e.s=-t,r.minus(e);var o=r.e/p,s=e.e/p,a=r.c,u=e.c;if(!o||!s){if(!a||!u)return new H(i/0);if(!a[0]||!u[0])return u[0]?e:new H(a[0]?r:0*i)}if(o=v(o),s=v(s),a=a.slice(),i=o-s){for(i>0?(s=o,n=u):(i=-i,n=a),n.reverse();i--;n.push(0));n.reverse()}for(i=a.length,t=u.length,i-t<0&&(n=u,u=a,a=n,t=i),i=0;t;)i=(a[--t]=a[t]+u[t]+i)/h|0,a[t]=h===a[t]?0:a[t]%h;return i&&(a=[i].concat(a),++s),$(e,a,s)},i.precision=i.sd=function(e,t){var n,r,i,o=this;if(null!=e&&e!==!!e)return k(e,1,y),null==t?t=A:k(t,0,8),G(new H(o),e,t);if(!(n=o.c))return null;if(i=n.length-1,r=i*p+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&o.e+1>r&&(r=o.e+1),r},i.shiftedBy=function(e){return k(e,-d,d),this.times("1e"+e)},i.squareRoot=i.sqrt=function(){var e,n,r,i,o,s=this,a=s.c,u=s.s,l=s.e,c=C+4,f=new H("0.5");if(1!==u||!a||!a[0])return new H(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);if(u=Math.sqrt(+Y(s)),0==u||u==1/0?(n=_(a),(n.length+l)%2==0&&(n+="0"),u=Math.sqrt(+n),l=v((l+1)/2)-(l<0||l%2),u==1/0?n="1e"+l:(n=u.toExponential(),n=n.slice(0,n.indexOf("e")+1)+l),r=new H(n)):r=new H(u+""),r.c[0])for(l=r.e,u=l+c,u<3&&(u=0);;)if(o=r,r=f.times(o.plus(t(s,o,c,1))),_(o.c).slice(0,u)===(n=_(r.c)).slice(0,u)){if(r.e0&&m>0){for(o=m%a||a,f=d.substr(0,o);o0&&(f+=l+d.slice(o)),p&&(f="-"+f)}r=h?f+(n.decimalSeparator||"")+((u=+n.fractionGroupSize)?h.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):h):f}return(n.prefix||"")+r+(n.suffix||"")},i.toFraction=function(e){var n,r,i,s,a,u,l,f,h,d,g,y,b=this,v=b.c;if(null!=e&&(l=new H(e),!l.isInteger()&&(l.c||1!==l.s)||l.lt(o)))throw Error(c+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+Y(l));if(!v)return new H(b);for(n=new H(o),h=r=new H(o),i=f=new H(o),y=_(v),a=n.e=y.length-b.e-1,n.c[0]=m[(u=a%p)<0?p+u:u],e=!e||l.comparedTo(n)>0?a>0?n:h:l,u=O,O=1/0,l=new H(y),f.c[0]=0;d=t(l,n,0,1),s=r.plus(d.times(i)),1!=s.comparedTo(e);)r=i,i=s,h=f.plus(d.times(s=h)),f=s,n=l.minus(d.times(s=n)),l=s;return s=t(e.minus(r),i,0,1),f=f.plus(s.times(h)),r=r.plus(s.times(i)),f.s=h.s=b.s,a*=2,g=t(h,i,a,A).minus(b).abs().comparedTo(t(f,r,a,A).minus(b).abs())<1?[h,i]:[f,r],O=u,g},i.toNumber=function(){return+Y(this)},i.toPrecision=function(e,t){return null!=e&&k(e,1,y),V(this,e,t,2)},i.toString=function(e){var t,r=this,i=r.s,o=r.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=I||o>=T?E(_(r.c),o):x(_(r.c),o,"0"):10===e?(r=G(new H(r),C+o+1,A),t=x(_(r.c),r.e,"0")):(k(e,2,M.length,"Base"),t=n(x(_(r.c),o,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},i.valueOf=i.toJSON=function(){return Y(this)},i._isBigNumber=!0,a&&(i[Symbol.toStringTag]="BigNumber",i[Symbol.for("nodejs.util.inspect.custom")]=i.valueOf),null!=e&&H.set(e),H}function v(e){var t=0|e;return e>0||e===t?t:t-1}function _(e){for(var t,n,r=1,i=e.length,o=e[0]+"";rl^n?1:-1;for(a=(u=i.length)<(l=o.length)?u:l,s=0;so[s]^n?1:-1;return u==l?0:u>l^n?1:-1}function k(e,t,n,r){if(en||e!==l(e))throw Error(c+(r||"Argument")+("number"==typeof e?en?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function S(e){var t=e.c.length-1;return v(e.e/p)==t&&e.c[t]%2!=0}function E(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function x(e,t,n){var r,i;if(t<0){for(i=n+".";++t;i+=n);e=i+e}else if(r=e.length,++t>r){for(i=n,t-=r;--t;i+=n);e+=i}else t=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return r}function u(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function e(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function e(t,n){return t.cmp(n)>0?t:n},o.min=function e(t,n){return t.cmp(n)<0?t:n},o.prototype._init=function e(t,n,i){if("number"==typeof t)return this._initNumber(t,n,i);if("object"==typeof t)return this._initArray(t,n,i);"hex"===n&&(n=16),r(n===(0|n)&&n>=2&&n<=36),t=t.toString().replace(/\s+/g,"");var o=0;"-"===t[0]&&o++,16===n?this._parseHex(t,o):this._parseBase(t,n,o),"-"===t[0]&&(this.negative=1),this.strip(),"le"===i&&this._initArray(this.toArray(),n,i)},o.prototype._initNumber=function e(t,n,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),n,i)},o.prototype._initArray=function e(t,n,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var o=0;o=0;o-=3)a=t[o]|t[o-1]<<8|t[o-2]<<16,this.words[s]|=a<>>26-u&67108863,u+=24,u>=26&&(u-=26,s++);else if("le"===i)for(o=0,s=0;o>>26-u&67108863,u+=24,u>=26&&(u-=26,s++);return this.strip()},o.prototype._parseHex=function e(t,n){this.length=Math.ceil((t.length-n)/6),this.words=new Array(this.length);for(var r=0;r=n;r-=6)o=a(t,r,r+6),this.words[i]|=o<>>26-s&4194303,s+=24,s>=26&&(s-=26,i++);r+6!==n&&(o=a(t,n,r+6),this.words[i]|=o<>>26-s&4194303),this.strip()},o.prototype._parseBase=function e(t,n,r){this.words=[0],this.length=1;for(var i=0,o=1;o<=67108863;o*=n)i++;i--,o=o/n|0;for(var s=t.length-r,a=s%i,l=Math.min(s,s-a)+r,c=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function e(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function e(){return(this.red?""};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(e){for(var t=new Array(e.bitLength()),n=0;n>>i}return t}function p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var l=1;l>>26,f=67108863&u,h=Math.min(l,t.length-1),p=Math.max(0,l-e.length+1);p<=h;p++){var d=l-p|0;i=0|e.words[d],o=0|t.words[p],s=i*o+f,c+=s/67108864|0,f=67108863&s}n.words[l]=0|f,u=0|c}return 0!==u?n.words[l]=0|u:n.length--,n.strip()}o.prototype.toString=function e(t,n){var i;if(t=t||10,n=0|n||1,16===t||"hex"===t){i="";for(var o=0,s=0,a=0;a>>24-o&16777215,i=0!==s||a!==this.length-1?l[6-h.length]+h+i:h+i,o+=2,o>=26&&(o-=26,a--)}for(0!==s&&(i=s.toString(16)+i);i.length%n!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var p=c[t],d=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var g=m.modn(d).toString(t);m=m.idivn(d),i=m.isZero()?g+i:l[p-g.length]+g+i}for(this.isZero()&&(i="0"+i);i.length%n!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function e(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function e(){return this.toString(16)},o.prototype.toBuffer=function e(t,n){return r(void 0!==s),this.toArrayLike(s,t,n)},o.prototype.toArray=function e(t,n){return this.toArrayLike(Array,t,n)},o.prototype.toArrayLike=function e(t,n,i){var o=this.byteLength(),s=i||Math.max(1,o);r(o<=s,"byte array longer than desired length"),r(s>0,"Requested array length <= 0"),this.strip();var a="le"===n,u=new t(s),l,c,f=this.clone();if(a){for(c=0;!f.isZero();c++)l=f.andln(255),f.iushrn(8),u[c]=l;for(;c=4096&&(r+=13,n>>>=13),n>=64&&(r+=7,n>>>=7),n>=8&&(r+=4,n>>>=4),n>=2&&(r+=2,n>>>=2),r+n},o.prototype._zeroBits=function e(t){if(0===t)return 26;var n=t,r=0;return 0==(8191&n)&&(r+=13,n>>>=13),0==(127&n)&&(r+=7,n>>>=7),0==(15&n)&&(r+=4,n>>>=4),0==(3&n)&&(r+=2,n>>>=2),0==(1&n)&&r++,r},o.prototype.bitLength=function e(){var t=this.words[this.length-1],n=this._countBits(t);return 26*(this.length-1)+n},o.prototype.zeroBits=function e(){if(this.isZero())return 0;for(var t=0,n=0;nt.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function e(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function e(t){var n;n=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function e(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function e(t){var n,r;this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function e(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function e(t){r("number"==typeof t&&t>=0);var n=0|Math.ceil(t/26),i=t%26;this._expand(n),i>0&&n--;for(var o=0;o0&&(this.words[o]=~this.words[o]&67108863>>26-i),this.strip()},o.prototype.notn=function e(t){return this.clone().inotn(t)},o.prototype.setn=function e(t,n){r("number"==typeof t&&t>=0);var i=t/26|0,o=t%26;return this._expand(i+1),this.words[i]=n?this.words[i]|1<t.length?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>>26;for(;0!==o&&s>>26;if(this.length=r.length,0!==o)this.words[this.length]=o,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function e(t){if(0!==t.negative){t.negative=0;var n=this.iadd(t);return t.negative=1,n._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r=this.cmp(t),i,o;if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;r>0?(i=this,o=t):(i=t,o=this);for(var s=0,a=0;a>26,this.words[a]=67108863&n;for(;0!==s&&a>26,this.words[a]=67108863&n;if(0===s&&a>>13,d=0|i[1],m=8191&d,g=d>>>13,y=0|i[2],b=8191&y,v=y>>>13,_=0|i[3],w=8191&_,k=_>>>13,S=0|i[4],E=8191&S,x=S>>>13,C=0|i[5],A=8191&C,I=C>>>13,T=0|i[6],j=8191&T,O=T>>>13,P=0|i[7],B=8191&P,R=P>>>13,N=0|i[8],M=8191&N,L=N>>>13,F=0|i[9],D=8191&F,U=F>>>13,z=0|o[0],q=8191&z,K=z>>>13,H=0|o[1],V=8191&H,W=H>>>13,$=0|o[2],G=8191&$,Y=$>>>13,J=0|o[3],Z=8191&J,X=J>>>13,Q=0|o[4],ee=8191&Q,te=Q>>>13,ne=0|o[5],re=8191&ne,ie=ne>>>13,oe=0|o[6],se=8191&oe,ae=oe>>>13,ue=0|o[7],le=8191&ue,ce=ue>>>13,fe=0|o[8],he=8191&fe,pe=fe>>>13,de=0|o[9],me=8191&de,ge=de>>>13;r.negative=t.negative^n.negative,r.length=19,u=Math.imul(h,q),l=Math.imul(h,K),l=l+Math.imul(p,q)|0,c=Math.imul(p,K);var ye=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(ye>>>26)|0,ye&=67108863,u=Math.imul(m,q),l=Math.imul(m,K),l=l+Math.imul(g,q)|0,c=Math.imul(g,K),u=u+Math.imul(h,V)|0,l=l+Math.imul(h,W)|0,l=l+Math.imul(p,V)|0,c=c+Math.imul(p,W)|0;var be=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(be>>>26)|0,be&=67108863,u=Math.imul(b,q),l=Math.imul(b,K),l=l+Math.imul(v,q)|0,c=Math.imul(v,K),u=u+Math.imul(m,V)|0,l=l+Math.imul(m,W)|0,l=l+Math.imul(g,V)|0,c=c+Math.imul(g,W)|0,u=u+Math.imul(h,G)|0,l=l+Math.imul(h,Y)|0,l=l+Math.imul(p,G)|0,c=c+Math.imul(p,Y)|0;var ve=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(ve>>>26)|0,ve&=67108863,u=Math.imul(w,q),l=Math.imul(w,K),l=l+Math.imul(k,q)|0,c=Math.imul(k,K),u=u+Math.imul(b,V)|0,l=l+Math.imul(b,W)|0,l=l+Math.imul(v,V)|0,c=c+Math.imul(v,W)|0,u=u+Math.imul(m,G)|0,l=l+Math.imul(m,Y)|0,l=l+Math.imul(g,G)|0,c=c+Math.imul(g,Y)|0,u=u+Math.imul(h,Z)|0,l=l+Math.imul(h,X)|0,l=l+Math.imul(p,Z)|0,c=c+Math.imul(p,X)|0;var _e=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(_e>>>26)|0,_e&=67108863,u=Math.imul(E,q),l=Math.imul(E,K),l=l+Math.imul(x,q)|0,c=Math.imul(x,K),u=u+Math.imul(w,V)|0,l=l+Math.imul(w,W)|0,l=l+Math.imul(k,V)|0,c=c+Math.imul(k,W)|0,u=u+Math.imul(b,G)|0,l=l+Math.imul(b,Y)|0,l=l+Math.imul(v,G)|0,c=c+Math.imul(v,Y)|0,u=u+Math.imul(m,Z)|0,l=l+Math.imul(m,X)|0,l=l+Math.imul(g,Z)|0,c=c+Math.imul(g,X)|0,u=u+Math.imul(h,ee)|0,l=l+Math.imul(h,te)|0,l=l+Math.imul(p,ee)|0,c=c+Math.imul(p,te)|0;var we=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(we>>>26)|0,we&=67108863,u=Math.imul(A,q),l=Math.imul(A,K),l=l+Math.imul(I,q)|0,c=Math.imul(I,K),u=u+Math.imul(E,V)|0,l=l+Math.imul(E,W)|0,l=l+Math.imul(x,V)|0,c=c+Math.imul(x,W)|0,u=u+Math.imul(w,G)|0,l=l+Math.imul(w,Y)|0,l=l+Math.imul(k,G)|0,c=c+Math.imul(k,Y)|0,u=u+Math.imul(b,Z)|0,l=l+Math.imul(b,X)|0,l=l+Math.imul(v,Z)|0,c=c+Math.imul(v,X)|0,u=u+Math.imul(m,ee)|0,l=l+Math.imul(m,te)|0,l=l+Math.imul(g,ee)|0,c=c+Math.imul(g,te)|0,u=u+Math.imul(h,re)|0,l=l+Math.imul(h,ie)|0,l=l+Math.imul(p,re)|0,c=c+Math.imul(p,ie)|0;var ke=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(ke>>>26)|0,ke&=67108863,u=Math.imul(j,q),l=Math.imul(j,K),l=l+Math.imul(O,q)|0,c=Math.imul(O,K),u=u+Math.imul(A,V)|0,l=l+Math.imul(A,W)|0,l=l+Math.imul(I,V)|0,c=c+Math.imul(I,W)|0,u=u+Math.imul(E,G)|0,l=l+Math.imul(E,Y)|0,l=l+Math.imul(x,G)|0,c=c+Math.imul(x,Y)|0,u=u+Math.imul(w,Z)|0,l=l+Math.imul(w,X)|0,l=l+Math.imul(k,Z)|0,c=c+Math.imul(k,X)|0,u=u+Math.imul(b,ee)|0,l=l+Math.imul(b,te)|0,l=l+Math.imul(v,ee)|0,c=c+Math.imul(v,te)|0,u=u+Math.imul(m,re)|0,l=l+Math.imul(m,ie)|0,l=l+Math.imul(g,re)|0,c=c+Math.imul(g,ie)|0,u=u+Math.imul(h,se)|0,l=l+Math.imul(h,ae)|0,l=l+Math.imul(p,se)|0,c=c+Math.imul(p,ae)|0;var Se=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Se>>>26)|0,Se&=67108863,u=Math.imul(B,q),l=Math.imul(B,K),l=l+Math.imul(R,q)|0,c=Math.imul(R,K),u=u+Math.imul(j,V)|0,l=l+Math.imul(j,W)|0,l=l+Math.imul(O,V)|0,c=c+Math.imul(O,W)|0,u=u+Math.imul(A,G)|0,l=l+Math.imul(A,Y)|0,l=l+Math.imul(I,G)|0,c=c+Math.imul(I,Y)|0,u=u+Math.imul(E,Z)|0,l=l+Math.imul(E,X)|0,l=l+Math.imul(x,Z)|0,c=c+Math.imul(x,X)|0,u=u+Math.imul(w,ee)|0,l=l+Math.imul(w,te)|0,l=l+Math.imul(k,ee)|0,c=c+Math.imul(k,te)|0,u=u+Math.imul(b,re)|0,l=l+Math.imul(b,ie)|0,l=l+Math.imul(v,re)|0,c=c+Math.imul(v,ie)|0,u=u+Math.imul(m,se)|0,l=l+Math.imul(m,ae)|0,l=l+Math.imul(g,se)|0,c=c+Math.imul(g,ae)|0,u=u+Math.imul(h,le)|0,l=l+Math.imul(h,ce)|0,l=l+Math.imul(p,le)|0,c=c+Math.imul(p,ce)|0;var Ee=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,u=Math.imul(M,q),l=Math.imul(M,K),l=l+Math.imul(L,q)|0,c=Math.imul(L,K),u=u+Math.imul(B,V)|0,l=l+Math.imul(B,W)|0,l=l+Math.imul(R,V)|0,c=c+Math.imul(R,W)|0,u=u+Math.imul(j,G)|0,l=l+Math.imul(j,Y)|0,l=l+Math.imul(O,G)|0,c=c+Math.imul(O,Y)|0,u=u+Math.imul(A,Z)|0,l=l+Math.imul(A,X)|0,l=l+Math.imul(I,Z)|0,c=c+Math.imul(I,X)|0,u=u+Math.imul(E,ee)|0,l=l+Math.imul(E,te)|0,l=l+Math.imul(x,ee)|0,c=c+Math.imul(x,te)|0,u=u+Math.imul(w,re)|0,l=l+Math.imul(w,ie)|0,l=l+Math.imul(k,re)|0,c=c+Math.imul(k,ie)|0,u=u+Math.imul(b,se)|0,l=l+Math.imul(b,ae)|0,l=l+Math.imul(v,se)|0,c=c+Math.imul(v,ae)|0,u=u+Math.imul(m,le)|0,l=l+Math.imul(m,ce)|0,l=l+Math.imul(g,le)|0,c=c+Math.imul(g,ce)|0,u=u+Math.imul(h,he)|0,l=l+Math.imul(h,pe)|0,l=l+Math.imul(p,he)|0,c=c+Math.imul(p,pe)|0;var xe=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(xe>>>26)|0,xe&=67108863,u=Math.imul(D,q),l=Math.imul(D,K),l=l+Math.imul(U,q)|0,c=Math.imul(U,K),u=u+Math.imul(M,V)|0,l=l+Math.imul(M,W)|0,l=l+Math.imul(L,V)|0,c=c+Math.imul(L,W)|0,u=u+Math.imul(B,G)|0,l=l+Math.imul(B,Y)|0,l=l+Math.imul(R,G)|0,c=c+Math.imul(R,Y)|0,u=u+Math.imul(j,Z)|0,l=l+Math.imul(j,X)|0,l=l+Math.imul(O,Z)|0,c=c+Math.imul(O,X)|0,u=u+Math.imul(A,ee)|0,l=l+Math.imul(A,te)|0,l=l+Math.imul(I,ee)|0,c=c+Math.imul(I,te)|0,u=u+Math.imul(E,re)|0,l=l+Math.imul(E,ie)|0,l=l+Math.imul(x,re)|0,c=c+Math.imul(x,ie)|0,u=u+Math.imul(w,se)|0,l=l+Math.imul(w,ae)|0,l=l+Math.imul(k,se)|0,c=c+Math.imul(k,ae)|0,u=u+Math.imul(b,le)|0,l=l+Math.imul(b,ce)|0,l=l+Math.imul(v,le)|0,c=c+Math.imul(v,ce)|0,u=u+Math.imul(m,he)|0,l=l+Math.imul(m,pe)|0,l=l+Math.imul(g,he)|0,c=c+Math.imul(g,pe)|0,u=u+Math.imul(h,me)|0,l=l+Math.imul(h,ge)|0,l=l+Math.imul(p,me)|0,c=c+Math.imul(p,ge)|0;var Ce=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,u=Math.imul(D,V),l=Math.imul(D,W),l=l+Math.imul(U,V)|0,c=Math.imul(U,W),u=u+Math.imul(M,G)|0,l=l+Math.imul(M,Y)|0,l=l+Math.imul(L,G)|0,c=c+Math.imul(L,Y)|0,u=u+Math.imul(B,Z)|0,l=l+Math.imul(B,X)|0,l=l+Math.imul(R,Z)|0,c=c+Math.imul(R,X)|0,u=u+Math.imul(j,ee)|0,l=l+Math.imul(j,te)|0,l=l+Math.imul(O,ee)|0,c=c+Math.imul(O,te)|0,u=u+Math.imul(A,re)|0,l=l+Math.imul(A,ie)|0,l=l+Math.imul(I,re)|0,c=c+Math.imul(I,ie)|0,u=u+Math.imul(E,se)|0,l=l+Math.imul(E,ae)|0,l=l+Math.imul(x,se)|0,c=c+Math.imul(x,ae)|0,u=u+Math.imul(w,le)|0,l=l+Math.imul(w,ce)|0,l=l+Math.imul(k,le)|0,c=c+Math.imul(k,ce)|0,u=u+Math.imul(b,he)|0,l=l+Math.imul(b,pe)|0,l=l+Math.imul(v,he)|0,c=c+Math.imul(v,pe)|0,u=u+Math.imul(m,me)|0,l=l+Math.imul(m,ge)|0,l=l+Math.imul(g,me)|0,c=c+Math.imul(g,ge)|0;var Ae=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,u=Math.imul(D,G),l=Math.imul(D,Y),l=l+Math.imul(U,G)|0,c=Math.imul(U,Y),u=u+Math.imul(M,Z)|0,l=l+Math.imul(M,X)|0,l=l+Math.imul(L,Z)|0,c=c+Math.imul(L,X)|0,u=u+Math.imul(B,ee)|0,l=l+Math.imul(B,te)|0,l=l+Math.imul(R,ee)|0,c=c+Math.imul(R,te)|0,u=u+Math.imul(j,re)|0,l=l+Math.imul(j,ie)|0,l=l+Math.imul(O,re)|0,c=c+Math.imul(O,ie)|0,u=u+Math.imul(A,se)|0,l=l+Math.imul(A,ae)|0,l=l+Math.imul(I,se)|0,c=c+Math.imul(I,ae)|0,u=u+Math.imul(E,le)|0,l=l+Math.imul(E,ce)|0,l=l+Math.imul(x,le)|0,c=c+Math.imul(x,ce)|0,u=u+Math.imul(w,he)|0,l=l+Math.imul(w,pe)|0,l=l+Math.imul(k,he)|0,c=c+Math.imul(k,pe)|0,u=u+Math.imul(b,me)|0,l=l+Math.imul(b,ge)|0,l=l+Math.imul(v,me)|0,c=c+Math.imul(v,ge)|0;var Ie=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,u=Math.imul(D,Z),l=Math.imul(D,X),l=l+Math.imul(U,Z)|0,c=Math.imul(U,X),u=u+Math.imul(M,ee)|0,l=l+Math.imul(M,te)|0,l=l+Math.imul(L,ee)|0,c=c+Math.imul(L,te)|0,u=u+Math.imul(B,re)|0,l=l+Math.imul(B,ie)|0,l=l+Math.imul(R,re)|0,c=c+Math.imul(R,ie)|0,u=u+Math.imul(j,se)|0,l=l+Math.imul(j,ae)|0,l=l+Math.imul(O,se)|0,c=c+Math.imul(O,ae)|0,u=u+Math.imul(A,le)|0,l=l+Math.imul(A,ce)|0,l=l+Math.imul(I,le)|0,c=c+Math.imul(I,ce)|0,u=u+Math.imul(E,he)|0,l=l+Math.imul(E,pe)|0,l=l+Math.imul(x,he)|0,c=c+Math.imul(x,pe)|0,u=u+Math.imul(w,me)|0,l=l+Math.imul(w,ge)|0,l=l+Math.imul(k,me)|0,c=c+Math.imul(k,ge)|0;var Te=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Te>>>26)|0,Te&=67108863,u=Math.imul(D,ee),l=Math.imul(D,te),l=l+Math.imul(U,ee)|0,c=Math.imul(U,te),u=u+Math.imul(M,re)|0,l=l+Math.imul(M,ie)|0,l=l+Math.imul(L,re)|0,c=c+Math.imul(L,ie)|0,u=u+Math.imul(B,se)|0,l=l+Math.imul(B,ae)|0,l=l+Math.imul(R,se)|0,c=c+Math.imul(R,ae)|0,u=u+Math.imul(j,le)|0,l=l+Math.imul(j,ce)|0,l=l+Math.imul(O,le)|0,c=c+Math.imul(O,ce)|0,u=u+Math.imul(A,he)|0,l=l+Math.imul(A,pe)|0,l=l+Math.imul(I,he)|0,c=c+Math.imul(I,pe)|0,u=u+Math.imul(E,me)|0,l=l+Math.imul(E,ge)|0,l=l+Math.imul(x,me)|0,c=c+Math.imul(x,ge)|0;var je=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(je>>>26)|0,je&=67108863,u=Math.imul(D,re),l=Math.imul(D,ie),l=l+Math.imul(U,re)|0,c=Math.imul(U,ie),u=u+Math.imul(M,se)|0,l=l+Math.imul(M,ae)|0,l=l+Math.imul(L,se)|0,c=c+Math.imul(L,ae)|0,u=u+Math.imul(B,le)|0,l=l+Math.imul(B,ce)|0,l=l+Math.imul(R,le)|0,c=c+Math.imul(R,ce)|0,u=u+Math.imul(j,he)|0,l=l+Math.imul(j,pe)|0,l=l+Math.imul(O,he)|0,c=c+Math.imul(O,pe)|0,u=u+Math.imul(A,me)|0,l=l+Math.imul(A,ge)|0,l=l+Math.imul(I,me)|0,c=c+Math.imul(I,ge)|0;var Oe=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,u=Math.imul(D,se),l=Math.imul(D,ae),l=l+Math.imul(U,se)|0,c=Math.imul(U,ae),u=u+Math.imul(M,le)|0,l=l+Math.imul(M,ce)|0,l=l+Math.imul(L,le)|0,c=c+Math.imul(L,ce)|0,u=u+Math.imul(B,he)|0,l=l+Math.imul(B,pe)|0,l=l+Math.imul(R,he)|0,c=c+Math.imul(R,pe)|0,u=u+Math.imul(j,me)|0,l=l+Math.imul(j,ge)|0,l=l+Math.imul(O,me)|0,c=c+Math.imul(O,ge)|0;var Pe=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,u=Math.imul(D,le),l=Math.imul(D,ce),l=l+Math.imul(U,le)|0,c=Math.imul(U,ce),u=u+Math.imul(M,he)|0,l=l+Math.imul(M,pe)|0,l=l+Math.imul(L,he)|0,c=c+Math.imul(L,pe)|0,u=u+Math.imul(B,me)|0,l=l+Math.imul(B,ge)|0,l=l+Math.imul(R,me)|0,c=c+Math.imul(R,ge)|0;var Be=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Be>>>26)|0,Be&=67108863,u=Math.imul(D,he),l=Math.imul(D,pe),l=l+Math.imul(U,he)|0,c=Math.imul(U,pe),u=u+Math.imul(M,me)|0,l=l+Math.imul(M,ge)|0,l=l+Math.imul(L,me)|0,c=c+Math.imul(L,ge)|0;var Re=(a+u|0)+((8191&l)<<13)|0;a=(c+(l>>>13)|0)+(Re>>>26)|0,Re&=67108863,u=Math.imul(D,me),l=Math.imul(D,ge),l=l+Math.imul(U,me)|0,c=Math.imul(U,ge);var Ne=(a+u|0)+((8191&l)<<13)|0;return a=(c+(l>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,s[0]=ye,s[1]=be,s[2]=ve,s[3]=_e,s[4]=we,s[5]=ke,s[6]=Se,s[7]=Ee,s[8]=xe,s[9]=Ce,s[10]=Ae,s[11]=Ie,s[12]=Te,s[13]=je,s[14]=Oe,s[15]=Pe,s[16]=Be,s[17]=Re,s[18]=Ne,0!==a&&(s[19]=a,r.length++),r};function m(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0,i+=s>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}function g(e,t,n){var r=new y;return r.mulp(e,t,n)}function y(e,t){this.x=e,this.y=t}Math.imul||(d=p),o.prototype.mulTo=function e(t,n){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?d(this,t,n):i<63?p(this,t,n):i<1024?m(this,t,n):g(this,t,n),r},y.prototype.makeRBT=function e(t){for(var n=new Array(t),r=o.prototype._countBits(t)-1,i=0;i>=1;return i},y.prototype.permute=function e(t,n,r,i,o,s){for(var a=0;a>>=1)o++;return 1<>>=13,i[2*a+1]=8191&s,s>>>=13;for(a=2*n;a>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),this},o.prototype.muln=function e(t){return this.clone().imuln(t)},o.prototype.sqr=function e(){return this.mul(this)},o.prototype.isqr=function e(){return this.imul(this.clone())},o.prototype.pow=function e(t){var n=h(t);if(0===n.length)return new o(1);for(var r=this,i=0;i=0);var n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n,s;if(0!==n){var a=0;for(s=0;s>>26-n}a&&(this.words[s]=a,this.length++)}if(0!==i){for(s=this.length-1;s>=0;s--)this.words[s+i]=this.words[s];for(s=0;s=0),o=n?(n-n%26)/26:0;var s=t%26,a=Math.min((t-s)/26,this.length),u=67108863^67108863>>>s<a)for(this.length-=a,c=0;c=0&&(0!==f||c>=o);c--){var h=0|this.words[c];this.words[c]=f<<26-s|h>>>s,f=h&u}return l&&0!==f&&(l.words[l.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function e(t,n,i){return r(0===this.negative),this.iushrn(t,n,i)},o.prototype.shln=function e(t){return this.clone().ishln(t)},o.prototype.ushln=function e(t){return this.clone().iushln(t)},o.prototype.shrn=function e(t){return this.clone().ishrn(t)},o.prototype.ushrn=function e(t){return this.clone().iushrn(t)},o.prototype.testn=function e(t){r("number"==typeof t&&t>=0);var n=t%26,i=(t-n)/26,o=1<=0);var n=t%26,i=(t-n)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==n&&i++,this.length=Math.min(i,this.length),0!==n){var o=67108863^67108863>>>n<=67108864;n++)this.words[n]-=67108864,n===this.length-1?this.words[n+1]=1:this.words[n+1]++;return this.length=Math.max(this.length,n+1),this},o.prototype.isubn=function e(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var n=0;n>26)-(l/67108864|0),this.words[s+i]=67108863&a}for(;s>26,this.words[s+i]=67108863&a;if(0===u)return this.strip();for(r(-1===u),u=0,s=0;s>26,this.words[s]=67108863&a;return this.negative=1,this.strip()},o.prototype._wordDiv=function e(t,n){var r=this.length-t.length,i=this.clone(),s=t,a=0|s.words[s.length-1],u=this._countBits(a);r=26-u,0!==r&&(s=s.ushln(r),i.iushln(r),a=0|s.words[s.length-1]);var l=i.length-s.length,c;if("mod"!==n){c=new o(null),c.length=l+1,c.words=new Array(c.length);for(var f=0;f=0;p--){var d=67108864*(0|i.words[s.length+p])+(0|i.words[s.length+p-1]);for(d=Math.min(d/a|0,67108863),i._ishlnsubmul(s,d,p);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(s,1,p),i.isZero()||(i.negative^=1);c&&(c.words[p]=d)}return c&&c.strip(),i.strip(),"div"!==n&&0!==r&&i.iushrn(r),{div:c||null,mod:i}},o.prototype.divmod=function e(t,n,i){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(u=this.neg().divmod(t,n),"mod"!==n&&(s=u.div.neg()),"div"!==n&&(a=u.mod.neg(),i&&0!==a.negative&&a.iadd(t)),{div:s,mod:a}):0===this.negative&&0!==t.negative?(u=this.divmod(t.neg(),n),"mod"!==n&&(s=u.div.neg()),{div:s,mod:u.mod}):0!=(this.negative&t.negative)?(u=this.neg().divmod(t.neg(),n),"div"!==n&&(a=u.mod.neg(),i&&0!==a.negative&&a.isub(t)),{div:u.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===n?{div:this.divn(t.words[0]),mod:null}:"mod"===n?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,n);var s,a,u},o.prototype.div=function e(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function e(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function e(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function e(t){var n=this.divmod(t);if(n.mod.isZero())return n.div;var r=0!==n.div.negative?n.mod.isub(t):n.mod,i=t.ushrn(1),o=t.andln(1),s=r.cmp(i);return s<0||1===o&&0===s?n.div:0!==n.div.negative?n.div.isubn(1):n.div.iaddn(1)},o.prototype.modn=function e(t){r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return i},o.prototype.idivn=function e(t){r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this.strip()},o.prototype.divn=function e(t){return this.clone().idivn(t)},o.prototype.egcd=function e(t){r(0===t.negative),r(!t.isZero());var n=this,i=t.clone();n=0!==n.negative?n.umod(t):n.clone();for(var s=new o(1),a=new o(0),u=new o(0),l=new o(1),c=0;n.isEven()&&i.isEven();)n.iushrn(1),i.iushrn(1),++c;for(var f=i.clone(),h=n.clone();!n.isZero();){for(var p=0,d=1;0==(n.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||a.isOdd())&&(s.iadd(f),a.isub(h)),s.iushrn(1),a.iushrn(1);for(var m=0,g=1;0==(i.words[0]&g)&&m<26;++m,g<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(u.isOdd()||l.isOdd())&&(u.iadd(f),l.isub(h)),u.iushrn(1),l.iushrn(1);n.cmp(i)>=0?(n.isub(i),s.isub(u),a.isub(l)):(i.isub(n),u.isub(s),l.isub(a))}return{a:u,b:l,gcd:i.iushln(c)}},o.prototype._invmp=function e(t){r(0===t.negative),r(!t.isZero());var n=this,i=t.clone();n=0!==n.negative?n.umod(t):n.clone();for(var s=new o(1),a=new o(0),u=i.clone(),l;n.cmpn(1)>0&&i.cmpn(1)>0;){for(var c=0,f=1;0==(n.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(n.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var h=0,p=1;0==(i.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(i.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);n.cmp(i)>=0?(n.isub(i),s.isub(a)):(i.isub(n),a.isub(s))}return l=0===n.cmpn(1)?s:a,l.cmpn(0)<0&&l.iadd(t),l},o.prototype.gcd=function e(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var n=this.clone(),r=t.clone();n.negative=0,r.negative=0;for(var i=0;n.isEven()&&r.isEven();i++)n.iushrn(1),r.iushrn(1);for(;;){for(;n.isEven();)n.iushrn(1);for(;r.isEven();)r.iushrn(1);var o=n.cmp(r);if(o<0){var s=n;n=r,r=s}else if(0===o||0===r.cmpn(1))break;n.isub(r)}return r.iushln(i)},o.prototype.invm=function e(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function e(){return 0==(1&this.words[0])},o.prototype.isOdd=function e(){return 1==(1&this.words[0])},o.prototype.andln=function e(t){return this.words[0]&t},o.prototype.bincn=function e(t){r("number"==typeof t);var n=t%26,i=(t-n)/26,o=1<>>26,u&=67108863,this.words[a]=u}return 0!==s&&(this.words[a]=s,this.length++),this},o.prototype.isZero=function e(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function e(t){var n=t<0,i;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)i=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var o=0|this.words[0];i=o===t?0:ot.length)return 1;if(this.length=0;r--){var i=0|this.words[r],o=0|t.words[r];if(i!==o){io&&(n=1);break}}return n},o.prototype.gtn=function e(t){return 1===this.cmpn(t)},o.prototype.gt=function e(t){return 1===this.cmp(t)},o.prototype.gten=function e(t){return this.cmpn(t)>=0},o.prototype.gte=function e(t){return this.cmp(t)>=0},o.prototype.ltn=function e(t){return-1===this.cmpn(t)},o.prototype.lt=function e(t){return-1===this.cmp(t)},o.prototype.lten=function e(t){return this.cmpn(t)<=0},o.prototype.lte=function e(t){return this.cmp(t)<=0},o.prototype.eqn=function e(t){return 0===this.cmpn(t)},o.prototype.eq=function e(t){return 0===this.cmp(t)},o.red=function e(t){return new E(t)},o.prototype.toRed=function e(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function e(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function e(t){return this.red=t,this},o.prototype.forceRed=function e(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function e(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function e(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function e(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function e(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function e(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function e(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function e(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function e(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function e(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function e(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function e(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function e(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function e(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function _(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function x(e){E.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function e(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function e(t){var n=t,r;do{this.split(n,this.tmp),n=this.imulK(n),n=n.iadd(this.tmp),r=n.bitLength()}while(r>this.n);var i=r0?n.isub(this.p):n.strip(),n},v.prototype.split=function e(t,n){t.iushrn(this.n,0,n)},v.prototype.imulK=function e(t){return t.imul(this.k)},i(_,v),_.prototype.split=function e(t,n){for(var r=4194303,i=Math.min(t.length,9),o=0;o>>22,s=a}s>>>=22,t.words[o-10]=s,0===s&&t.length>10?t.length-=10:t.length-=9},_.prototype.imulK=function e(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var n=0,r=0;r>>=26,t.words[r]=o,n=i}return 0!==n&&(t.words[t.length++]=n),t},o._prime=function e(t){if(b[t])return b[t];var e;if("k256"===t)e=new _;else if("p224"===t)e=new w;else if("p192"===t)e=new k;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return b[t]=e,e},E.prototype._verify1=function e(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function e(t,n){r(0==(t.negative|n.negative),"red works only with positives"),r(t.red&&t.red===n.red,"red works only with red numbers")},E.prototype.imod=function e(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function e(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function e(t,n){this._verify2(t,n);var r=t.add(n);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function e(t,n){this._verify2(t,n);var r=t.iadd(n);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function e(t,n){this._verify2(t,n);var r=t.sub(n);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function e(t,n){this._verify2(t,n);var r=t.isub(n);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function e(t,n){return this._verify1(t),this.imod(t.ushln(n))},E.prototype.imul=function e(t,n){return this._verify2(t,n),this.imod(t.imul(n))},E.prototype.mul=function e(t,n){return this._verify2(t,n),this.imod(t.mul(n))},E.prototype.isqr=function e(t){return this.imul(t,t.clone())},E.prototype.sqr=function e(t){return this.mul(t,t)},E.prototype.sqrt=function e(t){if(t.isZero())return t.clone();var n=this.m.andln(3);if(r(n%2==1),3===n){var i=this.m.add(new o(1)).iushrn(2);return this.pow(t,i)}for(var s=this.m.subn(1),a=0;!s.isZero()&&0===s.andln(1);)a++,s.iushrn(1);r(!s.isZero());var u=new o(1).toRed(this),l=u.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,c).cmp(l);)f.redIAdd(l);for(var h=this.pow(f,s),p=this.pow(t,s.addn(1).iushrn(1)),d=this.pow(t,s),m=a;0!==d.cmp(u);){for(var g=d,y=0;0!==g.cmp(u);y++)g=g.redSqr();r(y=0;s--){for(var f=n.words[s],h=c-1;h>=0;h--){var p=f>>h&1;a!==i[0]&&(a=this.sqr(a)),0!==p||0!==u?(u<<=1,u|=p,l++,(4===l||0===s&&0===h)&&(a=this.mul(a,i[u]),l=0,u=0)):l=0}c=26}return a},E.prototype.convertTo=function e(t){var n=t.umod(this.m);return n===t?n.clone():n},E.prototype.convertFrom=function e(t){var n=t.clone();return n.red=null,n},o.mont=function e(t){return new x(t)},i(x,E),x.prototype.convertTo=function e(t){return this.imod(t.ushln(this.shift))},x.prototype.convertFrom=function e(t){var n=this.imod(t.mul(this.rinv));return n.red=null,n},x.prototype.imul=function e(t,n){if(t.isZero()||n.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(n),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},x.prototype.mul=function e(t,n){if(t.isZero()||n.isZero())return new o(0)._forceRed(this);var r=t.mul(n),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(i).iushrn(this.shift),a=s;return s.cmp(this.m)>=0?a=s.isub(this.m):s.cmpn(0)<0&&(a=s.iadd(this.m)),a._forceRed(this)},x.prototype.invm=function e(t){var n=this.imod(t._invmp(this.m).mul(this.r2));return n._forceRed(this)}}(e,this)}).call(this,n(75)(e))},function(e,t,n){"use strict";(function(t){const r=n(81),i=n(42),o=n(105),s=n(9),a=/^https?:\/\/[^/]+\/(ip(f|n)s)\/((\w+).*)/,u=/^\/(ip(f|n)s)\/((\w+).*)/,l=1,c=4,f=/^https?:\/\/([^/]+)\.(ip(?:f|n)s)\.[^/]+/,h=1,p=2;function d(e){const n=v(e);try{const e=t.from(r.decode(n));return i.decode(e),!0}catch(e){return!1}}function m(e){try{return o.isEncoded(e)}catch(e){return!1}}function g(e){try{return s.isCID(new s(e))}catch(e){return!1}}function y(e,t,n=l,r=c){const i=v(e);if(!i)return!1;const o=i.match(t);if(!o)return!1;if("ipfs"!==o[n])return!1;let s=o[r];return s&&t===f&&(s=s.toLowerCase()),g(s)}function b(e,t,n=l,r){const i=v(e);if(!i)return!1;const o=i.match(t);if(!o)return!1;if("ipns"!==o[n])return!1;if(r&&t===f){let e=o[r];return e=e.toLowerCase(),g(e)}return!0}function v(e){return t.isBuffer(e)?r.encode(e):"string"==typeof e&&e}const _=e=>y(e,f,2,1),w=e=>b(e,f,2,1);e.exports={multihash:d,cid:g,base32cid:e=>"base32"===m(e)&&g(e),ipfsSubdomain:_,ipnsSubdomain:w,subdomain:e=>_(e)||w(e),subdomainPattern:f,ipfsUrl:e=>y(e,a),ipnsUrl:e=>b(e,a),url:e=>y(e,a)||b(e,a),urlPattern:a,ipfsPath:e=>y(e,u),ipnsPath:e=>b(e,u),path:e=>y(e,u)||b(e,u),pathPattern:u,urlOrPath:e=>y(e,a)||b(e,a)||y(e,u)||b(e,u)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";t.Connection=n(1056)},function(e,t){function n(){}e.exports=n},function(e,t){var n=Array.isArray;e.exports=n},function(e,t,n){(function(e){function n(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(e){return r.exec(e).slice(1)};function o(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!r;i--){var s=i>=0?arguments[i]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,r="/"===s.charAt(0))}return t=n(o(t.split("/"),function(e){return!!e}),!r).join("/"),(r?"/":"")+t||"."},t.normalize=function(e){var r=t.isAbsolute(e),i="/"===s(e,-1);return e=n(o(e.split("/"),function(e){return!!e}),!r).join("/"),e||r||(e="."),e&&i&&(e+="/"),(r?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(o(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,n){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=t.resolve(e).substr(1),n=t.resolve(n).substr(1);for(var i=r(e.split("/")),o=r(n.split("/")),s=Math.min(i.length,o.length),a=s,u=0;u100)){var t=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var u=parseFloat(t[1]),l=(t[2]||"ms").toLowerCase();switch(l){case"years":case"year":case"yrs":case"yr":case"y":return u*a;case"weeks":case"week":case"w":return u*s;case"days":case"day":case"d":return u*o;case"hours":case"hour":case"hrs":case"hr":case"h":return u*i;case"minutes":case"minute":case"mins":case"min":case"m":return u*r;case"seconds":case"second":case"secs":case"sec":case"s":return u*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}}}function l(e){var t=Math.abs(e);return t>=o?Math.round(e/o)+"d":t>=i?Math.round(e/i)+"h":t>=r?Math.round(e/r)+"m":t>=n?Math.round(e/n)+"s":e+"ms"}function c(e){var t=Math.abs(e);return t>=o?f(e,t,o,"day"):t>=i?f(e,t,i,"hour"):t>=r?f(e,t,r,"minute"):t>=n?f(e,t,n,"second"):e+" ms"}function f(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}e.exports=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return u(e);if("number"===n&&!1===isNaN(e))return t.long?c(e):l(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){var r=n(767),i="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";e.exports=r(i)},function(e,t,n){"use strict";e.exports=function e(t){return function(e,n){n(t)}}},function(e,t,n){"use strict";const r=n(264);e.exports={addLink:n(551),countStreamBytes:n(1260),createLock:n(1261),createNode:n(1276),formatCid:n(1277),limitStreamBytes:n(1278),loadNode:n(1279),removeLink:n(1280),toMfsPath:n(556),toPathComponents:n(341),toPullSource:n(1281),toSourcesAndDestination:n(1290),toSources:n(565),toTrail:n(1291),updateMfsRoot:n(1292),updateTree:n(1293),withMfsRoot:n(557),zeros:n(1296),FILE_SEPARATOR:r.FILE_SEPARATOR,MAX_CHUNK_SIZE:r.MAX_CHUNK_SIZE,MAX_LINKS:r.MAX_LINKS,FILE_TYPES:r.FILE_TYPES}},function(e,t){e.exports={bitcoin:{messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},regtest:{messagePrefix:"Bitcoin Signed Message:\n",bech32:"bcrt",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},testnet:{messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239}}},function(e,t,n){"use strict";var r=n(17);function i(e,t){return e.replace("{0}",t[0]).replace("{1}",t[1]).replace("{2}",t[2])}var o=function(e,t){var n=function(){if(r.isString(t.message))this.message=i(t.message,arguments);else{if(!r.isFunction(t.message))throw new Error("Invalid error definition for "+t.name);this.message=t.message.apply(null,arguments)}this.stack=this.message+"\n"+(new Error).stack};return n.prototype=Object.create(e.prototype),n.prototype.name=e.prototype.name+t.name,e[t.name]=n,t.errors&&s(n,t.errors),n},s=function(e,t){r.each(t,function(t){o(e,t)})},a=function(e,t){return s(e,t),e},u={Error:function(){this.message="Internal error",this.stack=this.message+"\n"+(new Error).stack}};u.Error.prototype=Object.create(Error.prototype),u.Error.prototype.name="bitcore.Error";var l=n(1427);a(u.Error,l),e.exports=u.Error,e.exports.extend=function(e){return o(u.Error,e)}},function(e,t,n){"use strict";(function(t){var r=n(51),i=n(17),o=n(25),s=n(30),a=n(40),u=function e(t,n){if(!(this instanceof e))return new e(t,n);if(t instanceof r)this.set({r:t,s:n});else if(t){var i=t;this.set(i)}};u.prototype.set=function(e){return this.r=e.r||this.r||void 0,this.s=e.s||this.s||void 0,this.i=void 0!==e.i?e.i:this.i,this.compressed=void 0!==e.compressed?e.compressed:this.compressed,this.nhashtype=e.nhashtype||this.nhashtype||void 0,this},u.fromCompact=function(e){o.checkArgument(s.isBuffer(e),"Argument is expected to be a Buffer");var t=new u,n=!0,i=e.slice(0,1)[0]-27-4;i<0&&(n=!1,i+=4);var a=e.slice(1,33),l=e.slice(33,65);return o.checkArgument(0===i||1===i||2===i||3===i,new Error("i must be 0, 1, 2, or 3")),o.checkArgument(32===a.length,new Error("r must be 32 bytes")),o.checkArgument(32===l.length,new Error("s must be 32 bytes")),t.compressed=n,t.i=i,t.r=r.fromBuffer(a),t.s=r.fromBuffer(l),t},u.fromDER=u.fromBuffer=function(e,t){var n=u.parseDER(e,t),r=new u;return r.r=n.r,r.s=n.s,r},u.fromTxFormat=function(e){var t=e.readUInt8(e.length-1),n=e.slice(0,e.length-1),r=new u.fromDER(n,!1);return r.nhashtype=t,r},u.fromString=function(e){var n=new t(e,"hex");return u.fromDER(n)},u.parseDER=function(e,t){o.checkArgument(s.isBuffer(e),new Error("DER formatted signature should be a buffer")),i.isUndefined(t)&&(t=!0);var n=e[0];o.checkArgument(48===n,new Error("Header byte should be 0x30"));var a=e[1],u=e.slice(2).length;o.checkArgument(!t||a===u,new Error("Length byte should length of what follows")),a=a73)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-3)return!1;var t=e[3];if(5+t>=e.length)return!1;var n=e[5+t];if(t+n+7!==e.length)return!1;var r=e.slice(4);if(2!==e[2])return!1;if(0===t)return!1;if(128&r[0])return!1;if(t>1&&0===r[0]&&!(128&r[1]))return!1;var i=e.slice(6+t);return 2===e[6+t-2]&&(0!==n&&(!(128&i[0])&&!(n>1&&0===i[0]&&!(128&i[1]))))},u.prototype.hasLowS=function(){return!this.s.lt(new r(1))&&!this.s.gt(new r("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex"))},u.prototype.hasDefinedHashtype=function(){if(!a.isNaturalNumber(this.nhashtype))return!1;var e=this.nhashtype&~u.SIGHASH_ANYONECANPAY;return!(eu.SIGHASH_SINGLE)},u.prototype.toTxFormat=function(){var e=this.toDER(),n=new t(1);return n.writeUInt8(this.nhashtype,0),t.concat([e,n])},u.SIGHASH_ALL=1,u.SIGHASH_NONE=2,u.SIGHASH_SINGLE=3,u.SIGHASH_ANYONECANPAY=128,e.exports=u}).call(this,n(0).Buffer)},function(e,t,n){e.exports=n(598),e.exports.Interpreter=n(1440)},function(e,t,n){"use strict";function r(e){return e}var i=n(176);e.exports=function e(t){if(!t)return r;t=i(t);var n=!1,o,s;return function(e){return function r(i,a){if(s)return a(s);i?(s=i,e(i,n?function(e){n?o=a:a(i)}:function(e){a(i)})):e(null,function(e,i){e?a(e):s?a(s):(n=!0,t(i,function(e,t){n=!1,s?(a(s),o&&o(s)):e?r(e,a):a(null,t)}))})}}}},function(e,t,n){"use strict";(function(r){Object.defineProperty(t,"__esModule",{value:!0});var i=n(218),o;o=i.hasNextTick?r.nextTick:i.hasSetImmediate?setImmediate:i.fallback,t.default=(0,i.wrap)(o),e.exports=t.default}).call(this,n(2))},function(e,t,n){"use strict";const r=n(24),i=T("dns4"),o=T("dns6"),s=I(T("dnsaddr"),i,o),a=I(T("ip4"),T("ip6")),u=I(A(a,T("tcp")),A(s,T("tcp"))),l=A(a,T("udp")),c=A(l,T("utp")),f=I(A(s,T("tcp")),s),h=I(A(u,T("ws")),A(f,T("ws"))),p=I(A(u,T("wss")),A(f,T("wss"))),d=I(A(u,T("http")),A(a,T("http")),A(f,T("http")),A(f)),m=I(A(u,T("https")),A(a,T("https")),A(f,T("https"))),g=I(A(h,T("p2p-webrtc-star"),T("ipfs")),A(p,T("p2p-webrtc-star"),T("ipfs"))),y=I(A(h,T("p2p-websocket-star"),T("ipfs")),A(p,T("p2p-websocket-star"),T("ipfs")),A(h,T("p2p-websocket-star")),A(p,T("p2p-websocket-star"))),b=I(A(d,T("p2p-webrtc-direct")),A(m,T("p2p-webrtc-direct"))),v=I(h,p,d,m,g,b,u,c),_=I(A(v,T("p2p-stardust"),T("ipfs")),A(v,T("p2p-stardust")));let w=I(A(v,T("ipfs")),g,T("ipfs"));const k=I(A(w,T("p2p-circuit"),w),A(w,T("p2p-circuit")),A(T("p2p-circuit"),w),A(v,T("p2p-circuit")),A(T("p2p-circuit"),v),T("p2p-circuit")),S=()=>I(A(k,S),k),E=S(),x=I(A(E,w,E),A(w,E),A(E,w),E,w);function C(e){return function t(n){if(!r.isMultiaddr(n))try{n=r(n)}catch(e){return!1}let i=e(n.protoNames());return null!==i&&0===i.length}}function A(){const e=Array.from(arguments);function t(t){return t.length{if(t="function"==typeof e?e().partialMatch(t):e.partialMatch(t),null===t)return!0}),t)}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:C(t),partialMatch:t}}function I(){const e=Array.from(arguments);function t(t){let n=null;return e.some(e=>{const r="function"==typeof e?e().partialMatch(t):e.partialMatch(t);if(r)return n=r,!0}),n}const n={toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:C(t),partialMatch:t};return n}function T(e){const t=e;function n(e){if("string"==typeof e)try{e=r(e)}catch(e){return!1}const n=e.protoNames();return 1===n.length&&n[0]===t}function i(e){return 0===e.length?null:e[0]===t?e.slice(1):null}return{toString:function(){return t},matches:n,partialMatch:i}}t.DNS=f,t.DNS4=i,t.DNS6=o,t.IP=a,t.TCP=u,t.UDP=l,t.UTP=c,t.HTTP=d,t.HTTPS=m,t.WebSockets=h,t.WebSocketsSecure=p,t.WebSocketStar=y,t.WebRTCStar=g,t.WebRTCDirect=b,t.Reliable=v,t.Stardust=_,t.Circuit=E,t.IPFS=x},function(e,t,n){"use strict";var r=n(107),i=n(1);function o(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function s(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t)for(e=e.replace(/[^a-z0-9]+/gi,""),e.length%2!=0&&(e="0"+e),i=0;i>6|192,n[r++]=63&s|128):o(e,i)?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++i)),n[r++]=s>>18|240,n[r++]=s>>12&63|128,n[r++]=s>>6&63|128,n[r++]=63&s|128):(n[r++]=s>>12|224,n[r++]=s>>6&63|128,n[r++]=63&s|128)}else for(i=0;i>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24;return t>>>0}function l(e,t){for(var n="",r=0;r>>0}return s}function p(e,t){for(var n=new Array(4*e.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n}function d(e,t){return e>>>t|e<<32-t}function m(e,t){return e<>>32-t}function g(e,t){return e+t>>>0}function y(e,t,n){return e+t+n>>>0}function b(e,t,n,r){return e+t+n+r>>>0}function v(e,t,n,r,i){return e+t+n+r+i>>>0}function _(e,t,n,r){var i=e[t],o=e[t+1],s=r+o>>>0,a=(s>>0,e[t+1]=s}function w(e,t,n,r){var i=t+r>>>0,o=(i>>0}function k(e,t,n,r){var i=t+r;return i>>>0}function S(e,t,n,r,i,o,s,a){var u=0,l=t;l=l+r>>>0,u+=l>>0,u+=l>>0,u+=l>>0}function E(e,t,n,r,i,o,s,a){var u=t+r+o+a;return u>>>0}function x(e,t,n,r,i,o,s,a,u,l){var c=0,f=t;f=f+r>>>0,c+=f>>0,c+=f>>0,c+=f>>0,c+=f>>0}function C(e,t,n,r,i,o,s,a,u,l){var c=t+r+o+a+l;return c>>>0}function A(e,t,n){var r=t<<32-n|e>>>n;return r>>>0}function I(e,t,n){var r=e<<32-n|t>>>n;return r>>>0}function T(e,t,n){return e>>>n}function j(e,t,n){var r=e<<32-n|t>>>n;return r>>>0}t.inherits=i,t.toArray=s,t.toHex=a,t.htonl=u,t.toHex32=l,t.zero2=c,t.zero8=f,t.join32=h,t.split32=p,t.rotr32=d,t.rotl32=m,t.sum32=g,t.sum32_3=y,t.sum32_4=b,t.sum32_5=v,t.sum64=_,t.sum64_hi=w,t.sum64_lo=k,t.sum64_4_hi=S,t.sum64_4_lo=E,t.sum64_5_hi=x,t.sum64_5_lo=C,t.rotr64_hi=A,t.rotr64_lo=I,t.shr64_hi=T,t.shr64_lo=j},function(e,t,n){const r=n(45),i=Math.pow(2,31)-1;function o(e){return r.UInt32(e)&&e<=i}function s(e){return r.String(e)&&e.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}s.toJSON=function(){return"BIP32 derivation path"};const a=21e14;function u(e){return r.UInt53(e)&&e<=a}const l=r.quacksLike("Point"),c=r.compile({messagePrefix:r.oneOf(r.Buffer,r.String),bip32:{public:r.UInt32,private:r.UInt32},pubKeyHash:r.UInt8,scriptHash:r.UInt8,wif:r.UInt8}),f={BIP32Path:s,Buffer256bit:r.BufferN(32),ECPoint:l,Hash160bit:r.BufferN(20),Hash256bit:r.BufferN(32),Network:c,Satoshi:u,UInt31:o};for(var h in r)f[h]=r[h];e.exports=f},function(e,t,n){"use strict";var r=t;r.version=n(1428).version,r.utils=n(1429),r.rand=n(572),r.hmacDRBG=n(1430),r.curve=n(271),r.curves=n(1435),r.ec=n(1437)},function(e,t,n){"use strict";(function(t){var r=n(51),i=n(152),o=n(59),s=n(40),a=n(128),u=n(17),l=n(25);function c(e,t){if(!(this instanceof c))return new c(e,t);if(l.checkArgument(e,"First argument is required, please include public key data."),e instanceof c)return e;t=t||{};var n=this._classifyArgs(e,t);return n.point.validate(),s.defineImmutable(this,{point:n.point,compressed:n.compressed,network:n.network||a.defaultNetwork}),this}c.prototype._classifyArgs=function(e,n){var r={compressed:u.isUndefined(n.compressed)||n.compressed};if(e instanceof i)r.point=e;else if(e.x&&e.y)r=c._transformObject(e);else if("string"==typeof e)r=c._transformDER(new t(e,"hex"));else if(c._isBuffer(e))r=c._transformDER(e);else{if(!c._isPrivateKey(e))throw new TypeError("First argument is an unrecognized data format.");r=c._transformPrivateKey(e)}return r.network||(r.network=u.isUndefined(n.network)?void 0:a.get(n.network)),r},c._isPrivateKey=function(e){var t=n(272);return e instanceof t},c._isBuffer=function(e){return e instanceof t||e instanceof Uint8Array},c._transformPrivateKey=function(e){l.checkArgument(c._isPrivateKey(e),"Must be an instance of PrivateKey");var t={};return t.point=i.getG().mul(e.bn),t.compressed=e.compressed,t.network=e.network,t},c._transformDER=function(e,t){l.checkArgument(c._isBuffer(e),"Must be a hex buffer of DER encoded public key");var n={},o,s,a,f;if(t=!!u.isUndefined(t)||t,4!==e[0]&&(t||6!==e[0]&&7!==e[0]))if(3===e[0])a=e.slice(1),o=new r(a),n=c._transformX(!0,o),n.compressed=!0;else{if(2!==e[0])throw new TypeError("Invalid DER format public key");a=e.slice(1),o=new r(a),n=c._transformX(!1,o),n.compressed=!0}else{if(a=e.slice(1,33),f=e.slice(33,65),32!==a.length||32!==f.length||65!==e.length)throw new TypeError("Length of x and y must be 32 bytes");o=new r(a),s=new r(f),n.point=new i(o,s),n.compressed=!1}return n},c._transformX=function(e,t){l.checkArgument("boolean"==typeof e,"Must specify whether y is odd or not (true or false)");var n={};return n.point=i.fromX(e,t),n},c._transformObject=function(e){var t=new r(e.x,"hex"),n=new r(e.y,"hex"),o=new i(t,n);return new c(o,{compressed:e.compressed})},c.fromPrivateKey=function(e){l.checkArgument(c._isPrivateKey(e),"Must be an instance of PrivateKey");var t=c._transformPrivateKey(e);return new c(t.point,{compressed:t.compressed,network:t.network})},c.fromDER=c.fromBuffer=function(e,t){l.checkArgument(c._isBuffer(e),"Must be a hex buffer of DER encoded public key");var n=c._transformDER(e,t);return new c(n.point,{compressed:n.compressed})},c.fromPoint=function(e,t){return l.checkArgument(e instanceof i,"First argument must be an instance of Point."),new c(e,{compressed:t})},c.fromString=function(e,n){var r=new t(e,n||"hex"),i=c._transformDER(r);return new c(i.point,{compressed:i.compressed})},c.fromX=function(e,t){var n=c._transformX(e,t);return new c(n.point,{compressed:n.compressed})},c.getValidationError=function(e){var t;try{new c(e)}catch(e){t=e}return t},c.isValid=function(e){return!c.getValidationError(e)},c.prototype.toObject=c.prototype.toJSON=function e(){return{x:this.point.getX().toString("hex",2),y:this.point.getY().toString("hex",2),compressed:this.compressed}},c.prototype.toBuffer=c.prototype.toDER=function(){var e=this.point.getX(),n=this.point.getY(),r=e.toBuffer({size:32}),i=n.toBuffer({size:32}),o;if(this.compressed){var s=i[i.length-1]%2;return o=new t(s?[3]:[2]),t.concat([o,r])}return o=new t([4]),t.concat([o,r,i])},c.prototype._getID=function e(){return o.sha256ripemd160(this.toBuffer())},c.prototype.toAddress=function(e){var t=n(129);return t.fromPublicKey(this,e||this.network)},c.prototype.toString=function(){return this.toDER().toString("hex")},c.prototype.inspect=function(){return""},e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){var r=n(27),i=n(13);function o(e,t){Error.captureStackTrace&&Error.captureStackTrace(this,o),this.name="FingerprintFormatError",this.fingerprint=e,this.format=t,this.message="Fingerprint format is not supported, or is invalid: ",void 0!==e&&(this.message+=" fingerprint = "+e),void 0!==t&&(this.message+=" format = "+t)}function s(e){Error.captureStackTrace&&Error.captureStackTrace(this,s),this.name="InvalidAlgorithmError",this.algorithm=e,this.message='Algorithm "'+e+'" is not supported'}function a(e,t,n){Error.captureStackTrace&&Error.captureStackTrace(this,a),this.name="KeyParseError",this.format=t,this.keyName=e,this.innerErr=n,this.message="Failed to parse "+e+" as a valid "+t+" format key: "+n.message}function u(e,t,n){Error.captureStackTrace&&Error.captureStackTrace(this,u),this.name="SignatureParseError",this.type=e,this.format=t,this.innerErr=n,this.message="Failed to parse the given data as a "+e+" signature in "+t+" format: "+n.message}function l(e,t,n){Error.captureStackTrace&&Error.captureStackTrace(this,l),this.name="CertificateParseError",this.format=t,this.certName=e,this.innerErr=n,this.message="Failed to parse "+e+" as a valid "+t+" format certificate: "+n.message}function c(e,t){Error.captureStackTrace&&Error.captureStackTrace(this,c),this.name="KeyEncryptedError",this.format=t,this.keyName=e,this.message="The "+t+" format key "+e+" is encrypted (password-protected), and no passphrase was provided in `options`"}i.inherits(o,Error),i.inherits(s,Error),i.inherits(a,Error),i.inherits(u,Error),i.inherits(l,Error),i.inherits(c,Error),e.exports={FingerprintFormatError:o,InvalidAlgorithmError:s,KeyParseError:a,SignatureParseError:u,KeyEncryptedError:c,CertificateParseError:l}},function(e,t){errors={};class n extends Error{constructor(e){super(e||"Coding Error"),this.name="CodingError"}}errors.CodingError=n;class r extends Error{constructor(e){super("To be implemented: "+e),this.name="ToBeImplementedError"}}errors.ToBeImplementedError=r;class i extends Error{constructor(e){super(e||"Transport failure"),this.name="TransportError"}}errors.TransportError=i;class o extends Error{constructor(e){super(e||"Timed out"),this.name="TimeoutError"}}errors.TimeoutError=o;class s extends Error{constructor(e){super(e||"Intentionally Unimplemented Function"),this.name="IntentionallyUnimplementedError"}}errors.IntentionallyUnimplementedError=s,t=e.exports=errors},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(171),i=a(r),o=n(399),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,i.default)(s.default),e.exports=t.default},function(e,t,n){var r=n(393),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();e.exports=o},function(e,t,n){(function(t){var r=n(57);e.exports=o,e.exports.source=function(e){return o(null,e)},e.exports.sink=function(e){return o(e,null)};var i="undefined"==typeof setImmediate?t.nextTick:setImmediate;function o(e,t){e&&"object"==typeof e&&(t=e.source,e=e.sink);var n=[],o=[],s,a,u=new r,l;u.writable=u.readable=!0,u.write=function(e){return n.length?n.shift()(null,e):o.push(e),n.length||(a=!0),!!n.length},u.end=function(){t?o.length?g():t(s=!0,n.length?n.shift():function(){}):n.length&&n.shift()(!0)},u.source=function(e,t){o.length?(t(null,o.shift()),o.length||u.emit("drain")):((s=s||e)?t(s):n.push(t),a&&(a=!1,u.emit("drain")))},e&&(l=e(u.source)),l&&!t&&(t=l);var c=[],f=[],h=!1,p=!1,d=!1;if(u.sink=function(e){t=e,i(g)},t){u.sink(t);var m=u.pipe.bind(u);u.pipe=function(e,t){var n=m(e,t);return u.paused&&u.resume(),n}}function g(){if(p=!1,t&&!d){for(;c.length&&!u.paused;)u.emit("data",c.shift());if(!u.paused){if(h)return u.emit("end");d=!0,t(null,function e(n,r){d=!1,u.paused?(!0===n?h=n:n?u.emit("error",n):c.push(r),p=!0):n&&!0!==(s=n)?u.emit("error",n):(s=s||n)?u.emit("end"):(u.emit("data",r),d=!0,t(null,e))})}}}return u.pause=function(){return u.paused=!0,u},u.resume=function(){return u.paused=!1,g(),u},u.destroy=function(){!s&&t&&t(s=!0,function(){}),s=!0,n.length&&n.shift()(!0),u.emit("close")},u}}).call(this,n(2))},function(e,t,n){"use strict";(function(t){const r=n(9);e.exports=function(e){if(t.isBuffer(e))return new r(e).toString();if(r.isCID(e))return e.toString();if("string"!=typeof e)throw new Error("unexpected cid type: "+typeof e);return new r(e.split("/")[0]),e}}).call(this,n(0).Buffer)},function(e,t,n){e.exports=p;var r=n(27),i=n(31).Buffer,o=n(56),s=n(15),a=n(95),u=n(47),l=n(102),c=n(208),f=a.InvalidAlgorithmError,h=a.SignatureParseError;function p(e){r.object(e,"options"),r.arrayOfObject(e.parts,"options.parts"),r.string(e.type,"options.type");for(var t={},n=0;n20&&0===o[0]&&(o=o.slice(1)),s=this.part.s.data,s.length>20&&0===s[0]&&(s=s.slice(1)),this.hashAlgorithm&&"sha1"!==this.hashAlgorithm||o.length+s.length!==40)throw new Error("OpenSSH only supports DSA signatures with SHA1 hash");return t.writeBuffer(i.concat([o,s])),t.toBuffer()}if("ssh"===e&&"ecdsa"===this.type){var f=new c({}),h;o=this.part.r.data,f.writeBuffer(o),f.writePart(this.part.s),t=new c({}),0===o[0]&&(o=o.slice(1));var p=8*o.length;return 256===p?h="nistp256":384===p?h="nistp384":528===p&&(h="nistp521"),t.writeString("ecdsa-sha2-"+h),t.writeBuffer(f.toBuffer()),t.toBuffer()}throw new Error("Invalid signature format");default:throw new Error("Invalid signature data")}},p.prototype.toString=function(e){return r.optionalString(e,"format"),this.toBuffer(e).toString("base64")},p.parse=function(e,t,n){"string"==typeof e&&(e=i.from(e,"base64")),r.buffer(e,"data"),r.string(n,"format"),r.string(t,"type");var o={};o.type=t.toLowerCase(),o.parts=[];try{switch(r.ok(e.length>0,"signature must not be empty"),o.type){case"rsa":case"ed25519":return d(e,t,n,o);case"dsa":case"ecdsa":return"asn1"===n?m(e,t,n,o):"dsa"===o.type?g(e,t,n,o):y(e,t,n,o);default:throw new f(t)}}catch(e){if(e instanceof f)throw e;throw new h(t,n,e)}},p.isSignature=function(e,t){return u.isCompatible(e,p,t)},p.prototype._sshpkApiVersion=[2,1],p._oldVersionDetect=function(e){return r.func(e.toBuffer),e.hasOwnProperty("hashAlgorithm")?[2,0]:[1,0]}},function(e,t,n){var r=n(1849);e.exports={Ber:r,BerReader:r.Reader,BerWriter:r.Writer}},function(e,t){function n(e){return null!=e&&"object"==typeof e}e.exports=n},function(e,t,n){"use strict";function r(e,t){t|=0;for(var n=Math.max(e.length-t,0),r=Array(n),i=0;i=this.buf.length},a.prototype.finished=a.prototype.eof,a.prototype.read=function(e){i.checkArgument(!r.isUndefined(e),"Must specify a length");var t=this.buf.slice(this.pos,this.pos+e);return this.pos=this.pos+e,t},a.prototype.readAll=function(){var e=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,e},a.prototype.readUInt8=function(){var e=this.buf.readUInt8(this.pos);return this.pos=this.pos+1,e},a.prototype.readUInt16BE=function(){var e=this.buf.readUInt16BE(this.pos);return this.pos=this.pos+2,e},a.prototype.readUInt16LE=function(){var e=this.buf.readUInt16LE(this.pos);return this.pos=this.pos+2,e},a.prototype.readUInt32BE=function(){var e=this.buf.readUInt32BE(this.pos);return this.pos=this.pos+4,e},a.prototype.readUInt32LE=function(){var e=this.buf.readUInt32LE(this.pos);return this.pos=this.pos+4,e},a.prototype.readUInt64BEBN=function(){var e=this.buf.slice(this.pos,this.pos+8),t=s.fromBuffer(e);return this.pos=this.pos+8,t},a.prototype.readUInt64LEBN=function(){var e=this.buf.readUInt32LE(this.pos),t=this.buf.readUInt32LE(this.pos+4),n=4294967296*t+e,r;if(n<=9007199254740991)r=new s(n);else{var i=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);r=new s(i,10,"le")}return this.pos=this.pos+8,r},a.prototype.readVarintNum=function(){var e=this.readUInt8();switch(e){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var t=this.readUInt64LEBN(),n=t.toNumber();if(n<=Math.pow(2,53))return n;throw new Error("number too large to retain precision - use readVarintBN");default:return e}},a.prototype.readVarLengthBuffer=function(){var e=this.readVarintNum(),t=this.read(e);return i.checkState(t.length===e,"Invalid length while reading varlength buffer. Expected to read: "+e+" and read "+t.length),t},a.prototype.readVarintBuf=function(){var e=this.buf.readUInt8(this.pos);switch(e){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}},a.prototype.readVarintBN=function(){var e=this.readUInt8();switch(e){case 253:return new s(this.readUInt16LE());case 254:return new s(this.readUInt32LE());case 255:return this.readUInt64LEBN();default:return new s(e)}},a.prototype.reverse=function(){for(var e=new t(this.buf.length),n=0;n=_.outputs.length)return new t(d,"hex");for(_.outputs.length=p+1,v=0;v9007199254740991?"transaction txout satoshis greater than max safe integer":this._satoshis!==this._satoshisBN.toNumber()?"transaction txout satoshis has corrupted value":this._satoshis<0&&"transaction txout negative"},p.prototype.toObject=p.prototype.toJSON=function e(){var t={satoshis:this.satoshis};return t.script=this._scriptBuffer.toString("hex"),t},p.fromObject=function(e){return new p(e)},p.prototype.setScriptFromBuffer=function(e){this._scriptBuffer=e;try{this._script=l.fromBuffer(this._scriptBuffer),this._script._isOutput=!0}catch(e){if(!(e instanceof f.Script.InvalidBuffer))throw e;this._script=null}},p.prototype.setScript=function(e){if(e instanceof l)this._scriptBuffer=e.toBuffer(),this._script=e,this._script._isOutput=!0;else if(r.isString(e))this._script=l.fromString(e),this._scriptBuffer=this._script.toBuffer(),this._script._isOutput=!0;else{if(!s.isBuffer(e))throw new TypeError("Invalid argument type: script");this.setScriptFromBuffer(e)}return this},p.prototype.inspect=function(){var e;return e=this.script?this.script.inspect():this._scriptBuffer.toString("hex"),""},p.fromBufferReader=function(e){var t={};t.satoshis=e.readUInt64LEBN();var n=e.readVarintNum();return t.script=0!==n?e.read(n):new o.Buffer([]),new p(t)},p.prototype.toBufferWriter=function(e){e||(e=new u),e.writeUInt64LEBN(this._satoshisBN);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e},e.exports=p},function(e,t,n){"use strict";const r=n(58),i=n(198);function o(e,t){r(e,i(e=>t(null,e)),e=>{e&&t(e)})}e.exports=o},function(e,t,n){e.exports={read:k,write:S};var r=n(27),i=n(102),o=n(15),s=n(31).Buffer,a=n(56),u=n(47),l=n(46),c=n(52),f=n(378),h=n(209),p=n(286),d=n(114),m=n(95),g="1.2.840.113549.1.5.13",y="1.2.840.113549.1.5.12",b={"1.2.840.113549.3.7":"3des-cbc","2.16.840.1.101.3.4.1.2":"aes128-cbc","2.16.840.1.101.3.4.1.42":"aes256-cbc"},v={};Object.keys(b).forEach(function(e){v[b[e]]=e});var _={"1.2.840.113549.2.7":"sha1","1.2.840.113549.2.9":"sha256","1.2.840.113549.2.11":"sha512"},w={};function k(e,t,n){var a=e;"string"!=typeof e&&(r.buffer(e,"buf"),e=e.toString("ascii"));for(var l=e.trim().split(/[\r\n]+/g),c,v=-1,w;!c&&v0;)w=l[--k].match(/[-]+[ ]*END ([A-Z0-9][A-Za-z0-9]+ )?(PUBLIC|PRIVATE) KEY[ ]*[-]+/);r.ok(w,"invalid PEM footer"),r.equal(c[2],w[2]);var S=c[2].toLowerCase(),E;c[1]&&(r.equal(c[1],w[1],"PEM header and footer mismatch"),E=c[1].trim()),l=l.slice(v,k+1);for(var x={},C,A,I;l=l.slice(1),c=l[0].match(/^([A-Za-z0-9-]+): (.+)$/),c;)x[c[1].toLowerCase()]=c[2];if(l=l.slice(0,-1).join(""),e=s.from(l,"base64"),x["proc-type"]){var T=x["proc-type"].split(",");if("4"===T[0]&&"ENCRYPTED"===T[1]){if("string"==typeof t.passphrase&&(t.passphrase=s.from(t.passphrase,"utf-8")),!s.isBuffer(t.passphrase))throw new m.KeyEncryptedError(t.filename,"PEM");T=x["dek-info"].split(","),r.ok(2===T.length),C=T[0].toLowerCase(),I=s.from(T[1],"hex"),A=u.opensslKeyDeriv(C,I,t.passphrase,1).key}}if(E&&"encrypted"===E.toLowerCase()){var j=new i.BerReader(e),O;j.readSequence(),j.readSequence(),O=j.offset+j.length;var P=j.readOID();if(P!==g)throw new Error("Unsupported PEM/PKCS8 encryption scheme: "+P);j.readSequence(),j.readSequence();var B=j.offset+j.length,R=j.readOID();if(R!==y)throw new Error("Unsupported PBES2 KDF: "+R);j.readSequence();var N=j.readString(i.Ber.OctetString,!0),M=j.readInt(),L="sha1";if(j.offsetp.length&&(b=p.length),g+=m.write(p.slice(y,b),g),m[g++]=10,y=b}return g+=m.write("-----END "+a+"-----\n",g),m.slice(0,g)}Object.keys(_).forEach(function(e){w[_[e]]=e})},function(e,t,n){e.exports={read:h.bind(void 0,!1,void 0),readType:h.bind(void 0,!1),write:p,readPartial:h.bind(void 0,!0),readInternal:h,keyTypeToAlg:f,algToKeyType:c};var r=n(27),i=n(31).Buffer,o=n(56),s=n(47),a=n(46),u=n(52),l=n(208);function c(e){if(r.string(e),"ssh-dss"===e)return"dsa";if("ssh-rsa"===e)return"rsa";if("ssh-ed25519"===e)return"ed25519";if("ssh-curve25519"===e)return"curve25519";if(e.match(/^ecdsa-sha2-/))return"ecdsa";throw new Error("Unknown algorithm "+e)}function f(e){if(r.object(e),"dsa"===e.type)return"ssh-dss";if("rsa"===e.type)return"ssh-rsa";if("ed25519"===e.type)return"ssh-ed25519";if("curve25519"===e.type)return"ssh-curve25519";if("ecdsa"===e.type)return"ecdsa-sha2-"+e.part.curve.data.toString();throw new Error("Unknown key type "+e.type)}function h(e,t,n,f){"string"==typeof n&&(n=i.from(n)),r.buffer(n,"buf");var h={},p=h.parts=[],d=new l({buffer:n}),m=d.readString();r.ok(!d.atEnd(),"key must have at least one part"),h.type=c(m);var g=o.info[h.type].parts.length;for(t&&"private"===t&&(g=o.privInfo[h.type].parts.length);!d.atEnd()&&p.length=1,"key must have at least one part"),r.ok(e||d.atEnd(),"leftover bytes at end of key");var y=a,b=o.info[h.type];if("private"!==t&&b.parts.length===p.length||(b=o.privInfo[h.type],y=u),r.strictEqual(b.parts.length,p.length),"ecdsa"===h.type){var v=/^ecdsa-sha2-(.+)$/.exec(m);r.ok(null!==v),r.strictEqual(v[1],p[0].data.toString())}for(var _=!0,w=0;w!e.status)}static p_connectedNames(e){const t=this._connected().map(e=>e.name);if(!e)return new Promise((e,n)=>e(t));e(null,t)}static async p_connectedNamesParm(){return(await this.p_connectedNames()).map(e=>"transport="+e).join("&")}static async p_statuses(){return this._transports.map(e=>({name:e.name,status:e.status}))}static validFor(e,t,n){return"string"==typeof e&&(e=[e]),e&&e[0]||["store","newlisturls","newdatabase","newtable"].includes(t)?e&&e.length>0?[].concat(...e.map(e=>"string"==typeof e?r.parse(e):e).map(e=>this._connected().filter(n=>n.supports(e,t)).map(t=>[e,t]))):this._connected().filter(e=>e.supports(void 0,t)).map(e=>[void 0,e]):(console.error("Transports.validFor called with invalid arguments: urls=",e,"func=",t),[])}static async p_urlsValidFor(e,t,n){return this.validFor(e,t,n).map(e=>e[0])}static http(){return u._connected().find(e=>"HTTP"===e.name)}static wolk(){return u._connected().find(e=>"WOLK"===e.name)}static ipfs(){return u._connected().find(e=>"IPFS"===e.name)}static webtorrent(){return u._connected().find(e=>"WEBTORRENT"===e.name)}static gun(){return u._connected().find(e=>"GUN"===e.name)}static async p_resolveNames(e){return this.mirror?Array.isArray(e)?this.gatewayUrls(e):this.gatewayUrl(url):this.namingcb?await this.namingcb(e):e}static resolveNamesWith(e){this.namingcb=e}static async _p_rawstore(e,t){let n=[],r=await Promise.all(e.map(async function(e){try{s("Storing %d bytes to %s",t.length,e.name);let r=await e.p_rawstore(t);return s("Storing %d bytes to %s succeeded: %s",t.length,e.name,r),r}catch(r){return s("Storing %d bytes to %s failed: %s",t.length,e.name,r.message),void n.push(r)}}));if(r=r.filter(e=>!!e),!r.length)throw s("Storing %d bytes failed on all transports",t.length),new i.TransportError(n.map(e=>e.message).join(", "));return r}static async p_rawstore(e){let t=this.validFor(void 0,"store").map(([e,t])=>t);if(!t.length)throw s("Storing %d bytes failed: no transports available",e.length),new i.TransportError("Transports.p_rawstore: Cant find transport for store");return this._p_rawstore(t,e)}static async p_rawlist(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"list");if(!t.length)throw new i.TransportError('Transports.p_rawlist: Cant find transport to "list" urls:'+e.join(","));let n=[],r=await Promise.all(t.map(async function([e,t]){try{s("Listing %s via %s",e,t.name);let r=await t.p_rawlist(e);return s("Listing %s via %s retrieved %d items",e,t.name,r.length),r}catch(r){return s("Listing %s via %s failed: %s",e,t.name,r.message),n.push(r),[]}}));if(n.length>=t.length)throw s("Listing %o failed on all transports",e),new i.TransportError(n.map(e=>e.message).join(", "));let o={};return[].concat(...r).filter(e=>!o[e.signature]&&(o[e.signature]=!0))}static async p_rawfetch(e,t={}){if(!e.length)throw new i.TransportError("Transports.p_rawfetch given an empty list of urls");let n=await this.p_resolveNames(e);if(!n.length)throw new i.TransportError("Transports.p_rawfetch none of the urls resolved: "+e);let r=this.validFor(n,"fetch");if(!r.length)throw new i.TransportError("Transports.p_rawfetch cant find any transport for urls: "+n);let o=[],a=[];for(const[e,n]of r)try{s("Fetching %s via %s",e.href,n.name);let r=await n.p_rawfetch(e,t);return s("Fetching %s via %s succeeded %d bytes",e.href,n.name,r.length),t.relay&&a.length&&(s("Fetching attempting relay of %d bytes from %s to %o",r.length,e.href,a.map(e=>e.name)),this._p_rawstore(a,r).then(e=>s("Fetching relayed %d bytes to %o",r.length,e))),r}catch(t){a.push(n),o.push(t),s("Fetching %s via %s failed: %s",e.href,n.name,t.message)}throw s("Fetching %o failed on all transports",e),new i.TransportError(o.map(e=>e.message).join(", "))}static async p_rawadd(e,t){e=await this.p_resolveNames(e);let n=this.validFor(e,"add");if(!n.length)throw s("Adding to %o failed: no transports available",e),new i.TransportError("Transports.p_rawstore: Cant find transport for urls:"+e.join(","));let r=[];if(await Promise.all(n.map(async function([e,n]){try{return s("Adding to %s via %s",e,n.name),await n.p_rawadd(e,t),void s("Adding to %s via %s succeeded",e,n.name)}catch(t){return s("Adding to %s via %s failed: %s",e,n.name,t.message),void r.push(t)}})),r.length>=n.length)throw s("Adding to %o failed on all transports",e),new i.TransportError(r.map(e=>e.message).join(", "))}static listmonitor(e,t,n={}){this.validFor(e,"listmonitor").map(([e,r])=>{r.listmonitor(e,t,n),s("Monitoring list %s via %s",e,r.name)})}static async p_newlisturls(e){let t=await Promise.all(this.validFor(void 0,"newlisturls").map(([t,n])=>n.p_newlisturls(e)));return[t.map(e=>e[0]),t.map(e=>e[1])]}static async p_f_createReadStream(e,{wanturl:t=!1,preferredTransports:n=[]}={}){let r=this.validFor(e,"createReadStream",{});if(!r.length)throw s("Opening stream to %o failed: no transports available",e),new i.TransportError("Transports.p_createReadStream cant find any transport for urls: "+e);let o=[];r.sort((e,t)=>(n.indexOf(e[1].name)+1||999+Math.random())-(n.indexOf(t[1].name)+1||999+Math.random()));for(const[e,n]of r)try{s("Opening stream to %s via %s",e.href,n.name);let r=await n.p_f_createReadStream(e,{wanturl:t});return s("Opening stream to %s via %s succeeded",e.href,n.name),r}catch(t){o.push(t),s("Opening stream to %s via %s failed: %s",e.href,n.name,t.message)}throw s("Opening stream to %o failed on all transports",e),new i.TransportError(o.map(e=>e.message).join(", "))}static createReadStream(e,t,n){"function"==typeof t&&(n=t,t={start:0}),DwebTransports.p_f_createReadStream(e).then(e=>{let r=e(t);if(!n)return r;n(null,r)}).catch(e=>{e instanceof i.TransportError?console.warn("Transports.createReadStream caught",e.message):console.error("Transports.createReadStream caught",e),n?n(e):reject(e)})}static async p_get(e,t){let n=this.validFor(e,"get"),r=Array.isArray(t)?`${t.length} keys`:t;if(!n.length)throw s("Getting %s from %o failed: no transports available",r,e),new i.TransportError("Transports.p_get cant find any transport to get keys from urls: "+e);let o=[];for(const[e,i]of n)try{s("Getting %s from %s via %s",r,e.href,i.name);let n=await i.p_get(e,t);return s("Getting %s from %s via %s succeeded length=%d",r,e.href,i.name,n.length),n}catch(t){o.push(t),s("Getting %s from %s via %s failed: %s",r,e.href,i.name,t.message)}throw s("Getting %s from %o failed on all transports",r,e),new i.TransportError(o.map(e=>e.message).join(", "))}static async p_set(e,t,n){e=await this.p_resolveNames(e);let r="object"==typeof t?`${t.length} keys`:t,o=this.validFor(e,"set");if(!o.length)throw s("Setting %s on %o failed: no transports available",r,e),new i.TransportError("Transports.p_set cant find any transport for urls: "+e);let a=[],u=!1;if(await Promise.all(o.map(async function([e,i]){try{s("Setting %s on %s via %s",r,e.href,i.name),await i.p_set(e,t,n),s("Setting %s on %s via %s succeeded",r,e.href,i.name),u=!0}catch(t){s("Setting %s on %s via %s failed: %s",r,e.href,i.name,t.message),a.push(t)}})),!u)throw s("Setting %s on %o failed on all transports",r,e),new i.TransportError(a.map(e=>e.message).join(", "))}static async p_delete(e,t){e=await this.p_resolveNames(e);let n=Array.isArray(t)?`${t.length} keys`:t,r=this.validFor(e,"set");if(!r.length)throw s("Deleting %s on %o failed: no transports available",n,e),new i.TransportError("Transports.p_set cant find any transport for urls: "+e);let o=[],a=!1;if(await Promise.all(r.map(async function([e,r]){try{s("Deleting %s on %s via %s",n,e.href,r.name),await r.p_delete(e,t),s("Deleting %s on %s via %s succeeded",n,e.href,r.name),a=!0}catch(t){s("Deleting %s on %s via %s failed: %s",n,e.href,r.name,t.message),o.push(t)}})),!a)throw s("Deleting %s on %o failed on all transports",n,e),new i.TransportError(o.map(e=>e.message).join(", "))}static async p_keys(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"keys");if(!t.length)throw s("Getting all keys on %o failed: no transports available",e),new i.TransportError("Transports.p_keys cant find any transport for urls: "+e);let n=[];for(const[e,r]of t)try{s("Getting all keys on %s via %s",e.href,r.name);let t=await r.p_keys(e);return s("Getting all keys on %s via %s succeeded with %d keys",e.href,r.name,t.length),t}catch(t){n.push(t),s("Getting all keys on %s via %s failed: %s",e.href,r.name,t.message)}throw s("Getting all keys on %o failed on all transports",e),new i.TransportError(n.map(e=>e.message).join(", "))}static async p_getall(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"getall");if(!t.length)throw s("Getting all values on %o failed: no transports available",e),new i.TransportError("Transports.p_getall cant find any transport for urls: "+e);let n=[];for(const[e,r]of t)try{s("Getting all values on %s via %s",e.href,r.name);let t=await r.p_getall(e);return s("Getting all values on %s via %s succeeded with %d values",e.href,r.name,t.length),t}catch(t){n.push(t),s("Getting all values on %s via %s failed: %s",e.href,r.name,t.message)}throw s("Getting all keys on %o failed on all transports",e),new i.TransportError(n.map(e=>e.message).join(", "))}static async p_newdatabase(e){let t=await Promise.all(this.validFor(void 0,"newdatabase").map(([t,n])=>n.p_newdatabase(e)));return{privateurls:t.map(e=>e.privateurl),publicurls:t.map(e=>e.publicurl)}}static async p_newtable(e,t){let n=await Promise.all(this.validFor(void 0,"newtable").map(([n,r])=>r.p_newtable(e,t)));return{privateurls:n.map(e=>e.privateurl),publicurls:n.map(e=>e.publicurl)}}static async p_connection(e){e=await this.p_resolveNames(e),await Promise.all(this.validFor(e,"connection").map(([e,t])=>t.p_connection(e)))}static monitor(e,t,{current:n=!1}={}){this.validFor(e,"monitor").map(([e,r])=>{s("Monitoring table %s via %s",e,r.name),r.monitor(e,t,{current:n})})}static addtransport(e){u._transports.push(e)}static setup0(e,t,n){let r={http:{urlbase:"http://localhost:4244"}};return e.map(e=>{let n=this._transportclasses["LOCAL"===e?"HTTP":e];return n?(s("Setting up connection to %s with options %o",e,t),n.setup0("LOCAL"===e?r:t)):void s("Connection to %s unavailable",e)}).filter(e=>!!e)}static p_setup1(e,t){const n=Promise.all(this._transports.filter(e=>!this._optionspaused.includes(e.name)).map(t=>(s("Connection stage 1 to %s",t.name),t.p_setup1(e))));if(!t)return n;n.catch(e=>t(e)).then(e=>t(null,e))}static p_setup2(e,t){const n=Promise.all(this._transports.filter(e=>!this._optionspaused.includes(e.name)).map(t=>(s("Connection stage 2 to %s",t.name),t.p_setup2(e))));if(!t)return n;n.catch(e=>t(e)).then(e=>t(null,e))}static p_stop(e,t){const n=Promise.all(this._connected().map(t=>(s("Stopping %s",t.name),t.p_stop(e))));if(!t)return n;n.catch(e=>t(e)).then(e=>t(null,e))}static async refreshstatus(e){let t=["transportstatus0","transportstatus1","transportstatus2","transportstatus3","transportstatus4"],n=e.statuselement;n&&(n.classList.remove(...t),n.classList.add(t[e.status])),u.statuscb&&u.statuscb(e)}static connect(e,t){const n=this.p_connect(e);if(!t)return n;n.catch(e=>t(e)).then(e=>t(null,e))}static async p_connect(e){try{e=e||{};let t=e.transports;this._optionspaused=(e.paused||[]).map(e=>e.toUpperCase()),t&&t.length||(t=e.defaulttransports||[]),t.length||(t=["HTTP","YJS","IPFS","WEBTORRENT","GUN","WOLK"]),t=t.map(e=>e.toUpperCase());let n=this.setup0(t,e);if(["statuscb","mirror"].forEach(t=>{e[t]&&(this[t]=e[t])}),e.statuselement){let t=e.statuselement;for(;t.lastChild;)t.removeChild(t.lastChild);t.appendChild(o.createElement("UL",{},n.map(e=>{let t=o.createElement("LI",{onclick:"this.source.togglePaused(DwebTransports.refreshstatus);",source:e,name:e.name},e.name);return e.statuselement=t,t})))}await this.p_setup1(this.refreshstatus),await this.p_setup2(this.refreshstatus),s("Connection completed to %o",this._connected().map(e=>e.name))}catch(e){throw console.error("ERROR in p_connect:",e.message),e}}static async p_urlsFrom(e){if("string"==typeof e&&(e="["===e[0]?JSON.parse(e):e.includes(",")?e.split(","):[e]),!Array.isArray(e))throw new Error(`Unparsable url: ${e}`);return e}static async p_httpfetchurl(e){return u.http()._url(e.find(e=>e.startsWith("contenthash")||e.startsWith("http")),"content/rawfetch")}static canonicalName(e,t={}){"string"!=typeof e&&(e=r.parse(e).href);const n=["dweb.me","ipfs.io"],i=["ipfs","gun","magnet","yjs","wolk","arc","contenthash","http","https"],o=["arc","http","https"],s=[/^http[s]?:[/]+([^/]+)[/](\w+)[/](.*)/i],a=[/^dweb:[/]+(\w+)[/]+(.*)/i,/^\w+:[/]+(\w+)[/](.*)/i,/^(\w+):[/]*(.*)/i,/^[/]*(\w+)[/](.*)/i,/^[/]*dweb[/]*(\w+)[/](.*)/i],u=[/^http[s]?:[/]+[^/]+[/](archive).(org)[/]*(.*)/i,/^http[s]?:[/]+dweb.(\w+)[.]([^/]+)[/]*(.*)/i,/^(http[s])?:[/]+([^/]+)[/]+(.*)/i];for(let t of s){let r=e.match(t);if(r&&n.includes(r[1])&&i.includes(r[2]))return{proto:r[2],internal:r[3]}}for(let t of u){let n=e.match(t);if(n)return i.includes(n[1])?{proto:n[1],internal:o.includes(n[1])?[n[2],n[3]].join("/"):n[3]}:{proto:"arc",internal:[[n[1],n[2]].join("."),n[3]].join("/")}}for(let t of a){let n=e.match(t);if(n&&i.includes(n[1]))return{proto:n[1],internal:n[2]}}}static canonicalUrl(e,t={}){let n=this.canonicalName(e,t);return n.protocol+":/"+n.internal}static _o2url(e){return["http","https"].includes(e.proto)?[e.proto,e.internal].join("://"):e.proto?[this.mirror,e.proto,e.internal].join("/"):e.internal}static gatewayUrl(e){let t=u.canonicalName(e);return t?this._o2url(t):e}static gatewayUrls(e){const t=e.map(e=>u.canonicalName(e)||{proto:void 0,internal:e}),n=t.filter(e=>["arc"].includes(e.proto));return(n.length?n:t).map(e=>this._o2url(e))}}u._transports=[],u.namingcb=void 0,u._transportclasses={},u.httptools=a,t=e.exports=u},function(e,t,n){"use strict";var r=n(10),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=f;var o=n(7);o.inherits=n(1);var s=n(436),a=n(300);o.inherits(f,s);for(var u=i(a.prototype),l=0;l`}toJSON(){return this._json||(this._json=Object.freeze({name:this.name,size:this.size,cid:this._cid.toBaseEncodedString()})),Object.assign({},this._json)}get name(){return this._name}get nameAsBuffer(){return null!==this._nameBuf?this._nameBuf:(this._nameBuf=r.from(this._name),this._nameBuf)}set name(e){throw new Error("Can't set property: 'name' is immutable")}get size(){return this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}get cid(){return this._cid}set cid(e){throw new Error("Can't set property: 'cid' is immutable")}}t=e.exports=s(a,{className:"DAGLink",symbolName:"@ipld/js-ipld-dag-pb/daglink"}),t.create=n(887),t.util=n(888)}).call(this,n(0).Buffer)},function(e,t,n){var r=n(19);e.exports=r.md=r.md||{},r.md.algorithms=r.md.algorithms||{}},function(e,t,n){var r=n(4).Buffer,i=n(57).Transform,o=n(14).StringDecoder,s=n(1);function a(e){i.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}s(a,i),a.prototype.update=function(e,t,n){"string"==typeof e&&(e=r.from(e,t));var i=this._update(e);return this.hashMode?this:(n&&(i=this._toString(i,n)),i)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(e,t,n){var r;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){r=e}finally{n(r)}},a.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},a.prototype._finalOrDigest=function(e){var t=this.__final()||r.alloc(0);return e&&(t=this._toString(t,e,!0)),t},a.prototype._toString=function(e,t,n){if(this._decoder||(this._decoder=new o(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var r=this._decoder.write(e);return n&&(r+=this._decoder.end()),r},e.exports=a},function(e,t,n){"use strict";const r=n(5),i=(e,t)=>{const n=["bitswap"];t&&n.push(t),e&&n.push(`${e.toB58String().slice(0,8)}`);const i=r(n.join(":"));return i.error=r(n.concat(["error"]).join(":")),i},o=(e,t,n)=>{let r=0;const i=n.length;for(;r{let n=0;const r=t.length,i=[];let s;for(;nt.reduce((t,n)=>{const r=e(n);return t[r]?t[r].push(n):t[r]=[n],t},{}),u=(e,t,n)=>t.filter(t=>!o(e,t,n)),l=(e,t)=>Array.prototype.slice.call(t,0).sort((t,n)=>{const r=e(t),i=e(n);return ri?1:0});e.exports={logger:i,includesWith:o,uniqWith:s,groupBy:a,pullAllWith:u,sortBy:l}},function(e,t,n){var r=n(1006),i=n(1009);function o(e,t){var n=i(e,t);return r(n)?n:void 0}e.exports=o},function(e,t,n){var r=n(490),i=n(73),o=n(255),s=n(256);function a(e){var t=0;return function(n,r,i){t++||e(n,r,i)}}function u(e){return"function"==typeof e}e.exports=function(e,t){u(e)&&(t=e,e={}),t=a(t||function e(){});var n=r(e&&e.timeout||5e3),l=i(function(e){e&&t(e)}),c=s();return{handshake:{read:n.read,abort:function(e){l.end(e),n.abort(e,function(e){}),t(e)},write:l.push,rest:function(){return l.end(),{source:n.read(),sink:c.sink}}},sink:n,source:o([l,c.source])}}},function(e,t,n){"use strict";(function(t){const r=n(12),i=n(43),o=n(82),s=n(77),a=n(76),u=n(9),l=n(1241).createResolver;function c(e){let n=e,r="/";if(t.isBuffer(e)&&(n=new u(e).toBaseEncodedString()),"string"==typeof e){0===e.indexOf("/ipfs/")&&(e=n=e.substring(6));const t=e.indexOf("/");t>0&&(n=e.substring(0,t),r=e.substring(t))}else u.isCID(n)&&(n=n.toBaseEncodedString());return n=new u(n).toBaseEncodedString(),{base:n,rest:p(r)}}const f={maxDepth:1/0,offset:void 0,length:void 0,fullPath:!1};function h(e){return e.reduce((e,t)=>(e.length&&(e+="/"),e+t),"")}e.exports=((e,t,n)=>{let p;n=Object.assign({},f,n);try{p=c(e)}catch(e){return o(e)}const d=h([p.base].concat(p.rest.slice(0,p.rest.length-1))).length,m=new u(p.base);return r(i([{multihash:m.buffer,name:p.base,path:p.base,pathRest:p.rest,depth:0}]),l(t,n),s(Boolean),a(e=>({depth:e.depth,name:e.name,path:n.fullPath?e.path:g(e),size:e.size,hash:e.multihash,content:e.content,type:e.type})));function g(e){if(!p.rest.length)return e.path;let t=e.path.substring(d);return"/"===t.charAt(0)&&(t=t.substring(1)),t||(t=p.rest[p.rest.length-1]||p.base),t}});const p=(e="")=>(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean)}).call(this,n(0).Buffer)},function(e,t,n){(function(t){const r=n(63),i=n(74).ec,o=new i("secp256k1"),s=n(1346),a=t.alloc(32,0),u=t.from("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),l=t.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex"),c=o.curve.n,f=c.shrn(1),h=o.curve.g,p="Expected Private",d="Expected Point",m="Expected Tweak",g="Expected Hash",y="Expected Signature";function b(e){return t.isBuffer(e)&&32===e.length}function v(e){return!!b(e)&&e.compare(u)<0}function _(e){if(!t.isBuffer(e))return!1;if(e.length<33)return!1;const n=e[0],r=e.slice(1,33);if(0===r.compare(a))return!1;if(r.compare(l)>=0)return!1;if((2===n||3===n)&&33===e.length)return!0;const i=e.slice(33);return 0!==i.compare(a)&&(!(i.compare(l)>=0)&&(4===n&&65===e.length))}function w(e){return 4!==e[0]}function k(e){return!!_(e)&&w(e)}function S(e){return!!b(e)&&(e.compare(a)>0&&e.compare(u)<0)}function E(e){const n=e.slice(0,32),r=e.slice(32,64);return t.isBuffer(e)&&64===e.length&&n.compare(u)<0&&r.compare(u)<0}function x(e,t){return void 0===e&&void 0!==t?w(t):void 0===e||e}function C(e){return new r(e)}function A(e){return e.toArrayLike(t,"be",32)}function I(e){return o.curve.decodePoint(e)}function T(e,n){return t.from(e._encode(n))}function j(e,t,n){if(!_(e))throw new TypeError(d);if(!_(t))throw new TypeError(d);const r=I(e),i=I(t),o=r.add(i);if(o.isInfinity())return null;const s=x(n,e);return T(o,s)}function O(e,t,n){if(!_(e))throw new TypeError(d);if(!v(t))throw new TypeError(m);const r=x(n,e),i=I(e);if(0===t.compare(a))return T(i,r);const o=C(t),s=h.mul(o),u=i.add(s);return u.isInfinity()?null:T(u,r)}function P(e,t){if(!_(e))throw new TypeError(d);const n=I(e);if(n.isInfinity())throw new TypeError(d);return T(n,t)}function B(e,t){if(!S(e))throw new TypeError(p);const n=C(e),r=h.mul(n);if(r.isInfinity())return null;const i=x(t);return T(r,i)}function R(e,t,n){if(!_(e))throw new TypeError(d);if(!v(t))throw new TypeError(m);const r=x(n,e),i=I(e),o=C(t),s=i.mul(o);return s.isInfinity()?null:T(s,r)}function N(e,t){if(!S(e))throw new TypeError(p);if(!v(t))throw new TypeError(m);const n=C(e),r=C(t),i=A(n.add(r).umod(c));return S(i)?i:null}function M(e,t){if(!S(e))throw new TypeError(p);if(!v(t))throw new TypeError(m);const n=C(e),r=C(t),i=A(n.sub(r).umod(c));return S(i)?i:null}function L(e,n){if(!b(e))throw new TypeError(g);if(!S(n))throw new TypeError(p);const r=C(n),i=C(e);let o,a;s(e,n,function(e){const t=C(e),n=h.mul(t);return!n.isInfinity()&&(o=n.x.umod(c),0!==o.isZero()&&(a=t.invm(c).mul(i.add(r.mul(o))).umod(c),0!==a.isZero()))},S),a.cmp(f)>0&&(a=c.sub(a));const u=t.allocUnsafe(64);return A(o).copy(u,0),A(a).copy(u,32),u}function F(e,t,n){if(!b(e))throw new TypeError(g);if(!_(t))throw new TypeError(d);if(!E(n))throw new TypeError(y);const r=I(t),i=C(n.slice(0,32)),o=C(n.slice(32,64));if(i.gtn(0)<=0)return!1;if(o.gtn(0)<=0)return!1;const s=C(e),a=o.invm(c),u=s.mul(a).umod(c),l=i.mul(a).umod(c),f=h.mulAdd(u,r,l);if(f.isInfinity())return!1;const p=f.x,m=p.umod(c);return m.eq(i)}e.exports={isPoint:_,isPointCompressed:k,isPrivate:S,pointAdd:j,pointAddScalar:O,pointCompress:P,pointFromScalar:B,pointMultiply:R,privateAdd:N,privateSub:M,sign:L,verify:F}}).call(this,n(0).Buffer)},function(e,t){function n(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:function(){let e=n.call(this);return this[t]=e,e},set:function(e){Object.defineProperty(this,t,{configurable:!0,enumerable:!0,value:e,writable:!0})}})}function r(e){let t;return function(){return void 0!==t?t:(t=e(),t)}}e.exports={prop:n,value:r}},function(e,t,n){"use strict";t.ethAccountSnapshot=n(584),t.ethBlock=n(589),t.ethBlockList=n(1410),t.ethStateTrie=n(1411),t.ethStorageTrie=n(1414),t.ethTx=n(591),t.ethTxTrie=n(1417)},function(e,t,n){(function(e){!function(e,t){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(null!==e&&"object"==typeof e&&Array.isArray(e.words))return e;this.sign=!1,this.words=null,this.length=0,this.red=null,"le"!==t&&"be"!==t||(n=t,t=10),null!==e&&this._init(e||0,t||10,n||"be")}function o(e,t,n){for(var r=0,i=Math.min(e.length,n),o=t;o=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return r}function s(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26,i.prototype._init=function e(t,r,i){if("number"==typeof t)return this._initNumber(t,r,i);if("object"==typeof t)return this._initArray(t,r,i);"hex"===r&&(r=16),n(r===(0|r)&&r>=2&&r<=36),t=t.toString().replace(/\s+/g,"");var o=0;"-"===t[0]&&o++,16===r?this._parseHex(t,o):this._parseBase(t,r,o),"-"===t[0]&&(this.sign=!0),this.strip(),"le"===i&&this._initArray(this.toArray(),r,i)},i.prototype._initNumber=function e(t,r,i){t<0&&(this.sign=!0,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),r,i)},i.prototype._initArray=function e(t,r,i){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var o=0;o=0;o-=3){var u=t[o]|t[o-1]<<8|t[o-2]<<16;this.words[a]|=u<>>26-s&67108863,s+=24,s>=26&&(s-=26,a++)}else if("le"===i)for(var o=0,a=0;o>>26-s&67108863,s+=24,s>=26&&(s-=26,a++)}return this.strip()},i.prototype._parseHex=function e(t,n){this.length=Math.ceil((t.length-n)/6),this.words=new Array(this.length);for(var r=0;r=n;r-=6){var a=o(t,r,r+6);this.words[s]|=a<>>26-i&4194303,i+=24,i>=26&&(i-=26,s++)}if(r+6!==n){var a=o(t,n,r+6);this.words[s]|=a<>>26-i&4194303}this.strip()},i.prototype._parseBase=function e(t,n,r){this.words=[0],this.length=1;for(var i=0,o=1;o<=67108863;o*=n)i++;i--,o=o/n|0;for(var a=t.length-r,u=a%i,l=Math.min(a,a-u)+r,c=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function e(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},i.prototype.inspect=function e(){return(this.red?""};var a=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],u=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function e(t,r){if(t=t||10,16===t||"hex"===t){for(var i="",o=0,r=0|r||1,s=0,c=0;c>>24-o&16777215,i=0!==s||c!==this.length-1?a[6-h.length]+h+i:h+i,o+=2,o>=26&&(o-=26,c--)}for(0!==s&&(i=s.toString(16)+i);i.length%r!=0;)i="0"+i;return this.sign&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var p=u[t],d=l[t],i="",m=this.clone();for(m.sign=!1;0!==m.cmpn(0);){var g=m.modn(d).toString(t);m=m.idivn(d),i=0!==m.cmpn(0)?a[p-g.length]+g+i:g+i}return 0===this.cmpn(0)&&(i="0"+i),this.sign&&(i="-"+i),i}n(!1,"Base should be between 2 and 36")},i.prototype.toJSON=function e(){return this.toString(16)},i.prototype.toArray=function e(t){this.strip();var n=new Array(this.byteLength());n[0]=0;var r=this.clone();if("le"!==t)for(var i=0;0!==r.cmpn(0);i++){var o=r.andln(255);r.ishrn(8),n[n.length-i-1]=o}else for(var i=0;0!==r.cmpn(0);i++){var o=r.andln(255);r.ishrn(8),n[i]=o}return n},Math.clz32?i.prototype._countBits=function e(t){return 32-Math.clz32(t)}:i.prototype._countBits=function e(t){var n=t,r=0;return n>=4096&&(r+=13,n>>>=13),n>=64&&(r+=7,n>>>=7),n>=8&&(r+=4,n>>>=4),n>=2&&(r+=2,n>>>=2),r+n},i.prototype._zeroBits=function e(t){if(0===t)return 26;var n=t,r=0;return 0==(8191&n)&&(r+=13,n>>>=13),0==(127&n)&&(r+=7,n>>>=7),0==(15&n)&&(r+=4,n>>>=4),0==(3&n)&&(r+=2,n>>>=2),0==(1&n)&&r++,r},i.prototype.bitLength=function e(){var t=0,n=this.words[this.length-1],t=this._countBits(n);return 26*(this.length-1)+t},i.prototype.zeroBits=function e(){if(0===this.cmpn(0))return 0;for(var t=0,n=0;nt.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.iand=function e(t){var n;this.sign=this.sign&&t.sign,n=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.ixor=function e(t){var n,r;this.sign=this.sign||t.sign,this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.setn=function e(t,r){n("number"==typeof t&&t>=0);for(var i=t/26|0,o=t%26;this.length<=i;)this.words[this.length++]=0;return this.words[i]=r?this.words[i]|1<t.length?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>>26}for(;0!==o&&s>>26}if(this.length=r.length,0!==o)this.words[this.length]=o,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function e(t){if(t.sign){t.sign=!1;var n=this.iadd(t);return t.sign=!0,n._normSign()}if(this.sign)return this.sign=!1,this.iadd(t),this.sign=!0,this._normSign();var r=this.cmp(t),i,o;if(0===r)return this.sign=!1,this.length=1,this.words[0]=0,this;r>0?(i=this,o=t):(i=t,o=this);for(var s=0,a=0;a>26,this.words[a]=67108863&n}for(;0!==s&&a>26,this.words[a]=67108863&n}if(0===s&&a>>26,s=67108863&r,a=Math.min(i,t.length-1),u=Math.max(0,i-this.length+1);u<=a;u++){var l=i-u,c=0|this.words[l],f=0|t.words[u],h=c*f,p=67108863&h;o=o+(h/67108864|0)|0,p=p+s|0,s=67108863&p,o=o+(p>>>26)|0}n.words[i]=s,r=o}return 0!==r?n.words[i]=r:n.length--,n.strip()},i.prototype._bigMulTo=function e(t,n){n.sign=t.sign!==this.sign,n.length=this.length+t.length;for(var r=0,i=0,o=0;o>>26)|0,i+=s>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()},i.prototype.mulTo=function e(t,n){var r;return r=this.length+t.length<63?this._smallMulTo(t,n):this._bigMulTo(t,n),r},i.prototype.mul=function e(t){var n=new i(null);return n.words=new Array(this.length+t.length),this.mulTo(t,n)},i.prototype.imul=function e(t){if(0===this.cmpn(0)||0===t.cmpn(0))return this.words[0]=0,this.length=1,this;var n=this.length,r=t.length;this.sign=t.sign!==this.sign,this.length=this.length+t.length,this.words[this.length-1]=0;for(var i=this.length-2;i>=0;i--){for(var o=0,s=0,a=Math.min(i,r-1),u=Math.max(0,i-n+1);u<=a;u++){var l=i-u,c=this.words[l],f=t.words[u],h=c*f,p=67108863&h;o+=h/67108864|0,p+=s,s=67108863&p,o+=p>>>26}this.words[i]=s,this.words[i+1]+=o,o=0}for(var o=0,l=1;l>>26}return this.strip()},i.prototype.imuln=function e(t){n("number"==typeof t);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),this},i.prototype.muln=function e(t){return this.clone().imuln(t)},i.prototype.sqr=function e(){return this.mul(this)},i.prototype.isqr=function e(){return this.mul(this)},i.prototype.ishln=function e(t){n("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){for(var s=0,a=0;a>>26-r}s&&(this.words[a]=s,this.length++)}if(0!==i){for(var a=this.length-1;a>=0;a--)this.words[a+i]=this.words[a];for(var a=0;a=0),o=r?(r-r%26)/26:0;var s=t%26,a=Math.min((t-s)/26,this.length),u=67108863^67108863>>>s<a){this.length-=a;for(var c=0;c=0&&(0!==f||c>=o);c--){var h=this.words[c];this.words[c]=f<<26-s|h>>>s,f=h&u}return l&&0!==f&&(l.words[l.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},i.prototype.shln=function e(t){return this.clone().ishln(t)},i.prototype.shrn=function e(t){return this.clone().ishrn(t)},i.prototype.testn=function e(t){n("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26,o=1<=0);var r=t%26,i=(t-r)/26;if(n(!this.sign,"imaskn works only with positive numbers"),0!==r&&i++,this.length=Math.min(i,this.length),0!==r){var o=67108863^67108863>>>r<=67108864;n++)this.words[n]-=67108864,n===this.length-1?this.words[n+1]=1:this.words[n+1]++;return this.length=Math.max(this.length,n+1),this},i.prototype.isubn=function e(t){if(n("number"==typeof t),t<0)return this.iaddn(-t);if(this.sign)return this.sign=!1,this.iaddn(t),this.sign=!0,this;this.words[0]-=t;for(var r=0;r>26)-(c/67108864|0),this.words[s+i]=67108863&l}for(;s>26,this.words[s+i]=67108863&l}if(0===u)return this.strip();n(-1===u),u=0;for(var s=0;s>26,this.words[s]=67108863&l}return this.sign=!0,this.strip()},i.prototype._wordDiv=function e(t,n){var r=this.length-t.length,o=this.clone(),s=t,a=s.words[s.length-1],u=this._countBits(a);r=26-u,0!==r&&(s=s.shln(r),o.ishln(r),a=s.words[s.length-1]);var l=o.length-s.length,c;if("mod"!==n){c=new i(null),c.length=l+1,c.words=new Array(c.length);for(var f=0;f=0;p--){var d=67108864*o.words[s.length+p]+o.words[s.length+p-1];for(d=Math.min(d/a|0,67108863),o._ishlnsubmul(s,d,p);o.sign;)d--,o.sign=!1,o._ishlnsubmul(s,1,p),0!==o.cmpn(0)&&(o.sign=!o.sign);c&&(c.words[p]=d)}return c&&c.strip(),o.strip(),"div"!==n&&0!==r&&o.ishrn(r),{div:c||null,mod:o}},i.prototype.divmod=function e(t,r){if(n(0!==t.cmpn(0)),this.sign&&!t.sign){var o=this.neg().divmod(t,r),s,a;return"mod"!==r&&(s=o.div.neg()),"div"!==r&&(a=0===o.mod.cmpn(0)?o.mod:t.sub(o.mod)),{div:s,mod:a}}if(!this.sign&&t.sign){var o=this.divmod(t.neg(),r),s;return"mod"!==r&&(s=o.div.neg()),{div:s,mod:o.mod}}return this.sign&&t.sign?this.neg().divmod(t.neg(),r):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===r?{div:this.divn(t.words[0]),mod:null}:"mod"===r?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,r)},i.prototype.div=function e(t){return this.divmod(t,"div").div},i.prototype.mod=function e(t){return this.divmod(t,"mod").mod},i.prototype.divRound=function e(t){var n=this.divmod(t);if(0===n.mod.cmpn(0))return n.div;var r=n.div.sign?n.mod.isub(t):n.mod,i=t.shrn(1),o=t.andln(1),s=r.cmp(i);return s<0||1===o&&0===s?n.div:n.div.sign?n.div.isubn(1):n.div.iaddn(1)},i.prototype.modn=function e(t){n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+this.words[o])%t;return i},i.prototype.idivn=function e(t){n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=this.words[i]+67108864*r;this.words[i]=o/t|0,r=o%t}return this.strip()},i.prototype.divn=function e(t){return this.clone().idivn(t)},i.prototype.egcd=function e(t){n(!t.sign),n(0!==t.cmpn(0));var r=this,o=t.clone();r=r.sign?r.mod(t):r.clone();for(var s=new i(1),a=new i(0),u=new i(0),l=new i(1),c=0;r.isEven()&&o.isEven();)r.ishrn(1),o.ishrn(1),++c;for(var f=o.clone(),h=r.clone();0!==r.cmpn(0);){for(;r.isEven();)r.ishrn(1),s.isEven()&&a.isEven()?(s.ishrn(1),a.ishrn(1)):(s.iadd(f).ishrn(1),a.isub(h).ishrn(1));for(;o.isEven();)o.ishrn(1),u.isEven()&&l.isEven()?(u.ishrn(1),l.ishrn(1)):(u.iadd(f).ishrn(1),l.isub(h).ishrn(1));r.cmp(o)>=0?(r.isub(o),s.isub(u),a.isub(l)):(o.isub(r),u.isub(s),l.isub(a))}return{a:u,b:l,gcd:o.ishln(c)}},i.prototype._invmp=function e(t){n(!t.sign),n(0!==t.cmpn(0));var r=this,o=t.clone();r=r.sign?r.mod(t):r.clone();for(var s=new i(1),a=new i(0),u=o.clone();r.cmpn(1)>0&&o.cmpn(1)>0;){for(;r.isEven();)r.ishrn(1),s.isEven()?s.ishrn(1):s.iadd(u).ishrn(1);for(;o.isEven();)o.ishrn(1),a.isEven()?a.ishrn(1):a.iadd(u).ishrn(1);r.cmp(o)>=0?(r.isub(o),s.isub(a)):(o.isub(r),a.isub(s))}return 0===r.cmpn(1)?s:a},i.prototype.gcd=function e(t){if(0===this.cmpn(0))return t.clone();if(0===t.cmpn(0))return this.clone();var n=this.clone(),r=t.clone();n.sign=!1,r.sign=!1;for(var i=0;n.isEven()&&r.isEven();i++)n.ishrn(1),r.ishrn(1);for(;;){for(;n.isEven();)n.ishrn(1);for(;r.isEven();)r.ishrn(1);var o=n.cmp(r);if(o<0){var s=n;n=r,r=s}else if(0===o||0===r.cmpn(1))break;n.isub(r)}return r.ishln(i)},i.prototype.invm=function e(t){return this.egcd(t).a.mod(t)},i.prototype.isEven=function e(){return 0==(1&this.words[0])},i.prototype.isOdd=function e(){return 1==(1&this.words[0])},i.prototype.andln=function e(t){return this.words[0]&t},i.prototype.bincn=function e(t){n("number"==typeof t);var r=t%26,i=(t-r)/26,o=1<>>26,u&=67108863,this.words[s]=u}return 0!==a&&(this.words[s]=a,this.length++),this},i.prototype.cmpn=function e(t){var n=t<0,r;if(n&&(t=-t),this.sign&&!n)return-1;if(!this.sign&&n)return 1;if(t&=67108863,this.strip(),this.length>1)r=1;else{var i=this.words[0];r=i===t?0:it.length)return 1;if(this.length=0;r--){var i=this.words[r],o=t.words[r];if(i!==o){io&&(n=1);break}}return n},i.red=function e(t){return new g(t)},i.prototype.toRed=function e(t){return n(!this.red,"Already a number in reduction context"),n(!this.sign,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function e(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function e(t){return this.red=t,this},i.prototype.forceRed=function e(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function e(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function e(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function e(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function e(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function e(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function e(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function e(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function e(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function e(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function e(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function e(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function e(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function e(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var c={k256:null,p224:null,p192:null,p25519:null};function f(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function h(){f.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function p(){f.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function d(){f.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){f.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function g(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else this.m=e,this.prime=null}function y(e){g.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv.sign=!0,this.minv=this.minv.mod(this.r)}f.prototype._tmp=function e(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},f.prototype.ireduce=function e(t){var n=t,r;do{this.split(n,this.tmp),n=this.imulK(n),n=n.iadd(this.tmp),r=n.bitLength()}while(r>this.n);var i=r0?n.isub(this.p):n.strip(),n},f.prototype.split=function e(t,n){t.ishrn(this.n,0,n)},f.prototype.imulK=function e(t){return t.imul(this.k)},r(h,f),h.prototype.split=function e(t,n){for(var r=4194303,i=Math.min(t.length,9),o=0;o>>22,s=a}t.words[o-10]=s>>>22,t.length-=9},h.prototype.imulK=function e(t){var n;t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var r=0,i=0;i>>=26,t.words[r]=o,n=i}return 0!==n&&(t.words[t.length++]=n),t},i._prime=function e(t){if(c[t])return c[t];var e;if("k256"===t)e=new h;else if("p224"===t)e=new p;else if("p192"===t)e=new d;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new m}return c[t]=e,e},g.prototype._verify1=function e(t){n(!t.sign,"red works only with positives"),n(t.red,"red works only with red numbers")},g.prototype._verify2=function e(t,r){n(!t.sign&&!r.sign,"red works only with positives"),n(t.red&&t.red===r.red,"red works only with red numbers")},g.prototype.imod=function e(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.mod(this.m)._forceRed(this)},g.prototype.neg=function e(t){var n=t.clone();return n.sign=!n.sign,n.iadd(this.m)._forceRed(this)},g.prototype.add=function e(t,n){this._verify2(t,n);var r=t.add(n);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},g.prototype.iadd=function e(t,n){this._verify2(t,n);var r=t.iadd(n);return r.cmp(this.m)>=0&&r.isub(this.m),r},g.prototype.sub=function e(t,n){this._verify2(t,n);var r=t.sub(n);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},g.prototype.isub=function e(t,n){this._verify2(t,n);var r=t.isub(n);return r.cmpn(0)<0&&r.iadd(this.m),r},g.prototype.shl=function e(t,n){return this._verify1(t),this.imod(t.shln(n))},g.prototype.imul=function e(t,n){return this._verify2(t,n),this.imod(t.imul(n))},g.prototype.mul=function e(t,n){return this._verify2(t,n),this.imod(t.mul(n))},g.prototype.isqr=function e(t){return this.imul(t,t)},g.prototype.sqr=function e(t){return this.mul(t,t)},g.prototype.sqrt=function e(t){if(0===t.cmpn(0))return t.clone();var r=this.m.andln(3);if(n(r%2==1),3===r){var o=this.m.add(new i(1)).ishrn(2),s=this.pow(t,o);return s}for(var a=this.m.subn(1),u=0;0!==a.cmpn(0)&&0===a.andln(1);)u++,a.ishrn(1);n(0!==a.cmpn(0));var l=new i(1).toRed(this),c=l.redNeg(),f=this.m.subn(1).ishrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,f).cmp(c);)h.redIAdd(c);for(var p=this.pow(h,a),s=this.pow(t,a.addn(1).ishrn(1)),d=this.pow(t,a),m=u;0!==d.cmp(l);){for(var g=d,y=0;0!==g.cmp(l);y++)g=g.redSqr();n(y=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},y.prototype.mul=function e(t,n){if(0===t.cmpn(0)||0===n.cmpn(0))return new i(0)._forceRed(this);var r=t.mul(n),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(o).ishrn(this.shift),a=s;return s.cmp(this.m)>=0?a=s.isub(this.m):s.cmpn(0)<0&&(a=s.iadd(this.m)),a._forceRed(this)},y.prototype.invm=function e(t){var n=this.imod(t._invmp(this.m).mul(this.r2));return n._forceRed(this)}}(e,this)}).call(this,n(75)(e))},function(e,t,n){"use strict";var r=n(17),i=n(30),o=n(40),s=[],a={};function u(){}function l(e,t){if(~s.indexOf(e))return e;if(!t)return a[e];r.isArray(t)||(t=[t]);var n=function(t){return s[i][t]===e};for(var i in s)if(r.any(t,n))return s[i]}function c(e){var t=new u;return o.defineImmutable(t,{name:e.name,alias:e.alias,pubkeyhash:e.pubkeyhash,privatekey:e.privatekey,scripthash:e.scripthash,xpubkey:e.xpubkey,xprivkey:e.xprivkey,zaddr:e.zaddr,zkey:e.zkey}),e.networkMagic&&o.defineImmutable(t,{networkMagic:i.integerAsBuffer(e.networkMagic)}),e.port&&o.defineImmutable(t,{port:e.port}),e.dnsSeeds&&o.defineImmutable(t,{dnsSeeds:e.dnsSeeds}),r.each(t,function(e){r.isUndefined(e)||r.isObject(e)||(a[e]=t)}),s.push(t),t}function f(e){for(var t=0;t"},e.exports=f;var h=n(87)}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var r=n(1491),i=n(1492);e.exports=function e(n,o,s){if("number"!=typeof n)throw new TypeError('"size" argument must be a number');if(n<0)throw new RangeError('"size" argument must not be negative');if(t.alloc)return t.alloc(n,o,s);var a=i(n);return 0===n?a:void 0===o?r(a,0):("string"!=typeof s&&(s=void 0),r(a,o,s))}}).call(this,n(0).Buffer)},function(e,t,n){const r=n(32),i=n(21),o=n(96);function s(e,t){return new Promise(n=>{setTimeout(()=>{n(t)},e)})}class a{constructor(e){}static setup0(e){throw new o.IntentionallyUnimplementedError("Intentionally undefined function Transport.setup0 should have been subclassed")}p_setup1(e){return this}p_setup2(e){return this}static async p_setup(e,t){let n=await this.setup0(e).p_setup1(t);return n.p_setup2(t)}p_stop(e){return new Promise((t,n)=>{this.status=a.STATUS_FAILED,e&&e(this),t()})}togglePaused(e){switch(this.status){case a.STATUS_CONNECTED:this.status=a.STATUS_PAUSED;break;case a.STATUS_PAUSED:this.status=a.STATUS_CONNECTED;break;case a.STATUS_LOADED:this.p_setup1(e).then(t=>t.p_setup2(e))}e&&e(this)}async p_status(){return this.status}supports(e,t){if("string"==typeof e&&(e=r.parse(e)),e&&!e.protocol)throw new Error("URL failed to specific a scheme (before :) "+e.href);return(!e||this.supportURLs.includes(e.protocol.slice(0,-1)))&&(!t||this.supportFunctions.includes(t))}p_rawstore(e,t){throw new o.ToBeImplementedError("Intentionally undefined function Transport.p_rawstore should have been subclassed")}async p_rawstoreCaught(e){try{return await this.p_rawstore(e)}catch(e){}}p_store(){throw new o.ToBeImplementedError("Undefined function Transport.p_store - may define higher level semantics here (see Python)")}p_rawfetch(e,{timeoutMS:t,start:n,end:r,relay:i=!1}={}){return console.assert(!1,"Intentionally undefined function Transport.p_rawfetch should have been subclassed"),"UNIMPLEMENTED"}p_fetch(){throw new o.ToBeImplementedError("Undefined function Transport.p_fetch - may define higher level semantics here (see Python)")}p_rawadd(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_rawadd")}p_rawlist(e){throw new o.ToBeImplementedError("Undefined function Transport.p_rawlist")}p_list(){throw new Error("Undefined function Transport.p_list")}p_newlisturls(e){throw new Error("undefined function Transport.p_newlisturls")}p_rawreverse(e){throw new o.ToBeImplementedError("Undefined function Transport.p_rawreverse")}listmonitor(e,t,{current:n=!1}={}){console.log("Undefined function Transport.listmonitor")}async p_newdatabase(e){throw new o.ToBeImplementedError("Undefined function Transport.p_newdatabase")}async p_newtable(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_newtable")}async p_set(e,t,n){throw new o.ToBeImplementedError("Undefined function Transport.p_set")}async p_get(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_get")}async p_delete(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_delete")}async p_keys(e){throw new o.ToBeImplementedError("Undefined function Transport.p_keys")}async p_getall(e){throw new o.ToBeImplementedError("Undefined function Transport.p_keys")}static async p_f_createReadStream(e,{wanturl:t=!1}){}static mergeoptions(e){let t={};for(let n=0;n",r),console.assert("bar"===r.testkey2.foo&&2===r.testkey3[1]&&!r.testkey),await s(200),console.log(this.name,"p_test_kvt complete")}catch(e){throw console.log("Exception thrown in ",this.name,"p_test_kvt:",e.message),e}}}a.STATUS_CONNECTED=0,a.STATUS_FAILED=1,a.STATUS_STARTING=2,a.STATUS_LOADED=3,a.STATUS_PAUSED=4,a.STATUSTEXT=["Connected","Failed","Starting","Loaded","Paused"],t=e.exports=a},function(e,t,n){"use strict";(function(t){var r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=l;var i=n(386),o=n(390);n(1)(l,i);for(var s=r(o.prototype),a=0;at){var r=new Error("Too few bytes to parse DER.");throw r.available=e.length(),r.remaining=t,r.requested=n,r}}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},i.create=function(e,t,n,o,s){if(r.util.isArray(o)){for(var a=[],u=0;ut){if(r.strict){var m=new Error("Too few bytes to read ASN.1 value.");throw m.available=e.length(),m.remaining=t,m.requested=h,m}h=t}var g=32==(32&l);if(g)if(p=[],void 0===h)for(;;){if(o(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}u=e.length(),p.push(a(e,t,n+1,r)),t-=u-e.length()}else for(;h>0;)u=e.length(),p.push(a(e,h,n+1,r)),t-=u-e.length(),h-=u-e.length();if(void 0===p&&c===i.Class.UNIVERSAL&&f===i.Type.BITSTRING&&(d=e.bytes(h)),void 0===p&&r.decodeBitStrings&&c===i.Class.UNIVERSAL&&f===i.Type.BITSTRING&&h>1){var y=e.read,b=t,v=0;if(f===i.Type.BITSTRING&&(o(e,t,1),v=e.getByte(),t--),0===v)try{u=e.length();var _={verbose:r.verbose,strict:!0,decodeBitStrings:!0},w=a(e,t,n+1,_),k=u-e.length();t-=k,f==i.Type.BITSTRING&&k++;var S=w.tagClass;k!==h||S!==i.Class.UNIVERSAL&&S!==i.Class.CONTEXT_SPECIFIC||(p=[w])}catch(e){}void 0===p&&(e.read=y,t=b)}if(void 0===p){if(void 0===h){if(r.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");h=t}if(f===i.Type.BMPSTRING)for(p="";h>0;h-=2)o(e,t,2),p+=String.fromCharCode(e.getInt16()),t-=2;else p=e.getBytes(h)}var E=void 0===d?null:{bitStringContents:d};return i.create(c,f,g,p,E)}i.fromDer=function(e,t){return void 0===t&&(t={strict:!0,decodeBitStrings:!0}),"boolean"==typeof t&&(t={strict:t,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"==typeof e&&(e=r.util.createBuffer(e)),a(e,e.length(),0,t)},i.toDer=function(e){var t=r.util.createBuffer(),n=e.tagClass|e.type,o=r.util.createBuffer(),s=!1;if("bitStringContents"in e&&(s=!0,e.original&&(s=i.equals(e,e.original))),s)o.putBytes(e.bitStringContents);else if(e.composed){e.constructed?n|=32:o.putByte(0);for(var a=0;a1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?o.putBytes(e.value.substr(1)):o.putBytes(e.value);if(t.putByte(n),o.length()<=127)t.putByte(127&o.length());else{var u=o.length(),l="";do{l+=String.fromCharCode(255&u),u>>>=8}while(u>0);t.putByte(128|l.length);for(var a=l.length-1;a>=0;--a)t.putByte(l.charCodeAt(a))}return t.putBuffer(o),t},i.oidToDer=function(e){var t=e.split("."),n=r.util.createBuffer(),i,o,s,a;n.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var u=2;u>>=7,i||(a|=128),o.push(a),i=!1}while(s>0);for(var l=o.length-1;l>=0;--l)n.putByte(o[l])}return n},i.derToOid=function(e){var t;"string"==typeof e&&(e=r.util.createBuffer(e));var n=e.getByte();t=Math.floor(n/40)+"."+n%40;for(var i=0;e.length()>0;)n=e.getByte(),i<<=7,128&n?i+=127&n:(t+="."+(i+n),i=0);return t},i.utcTimeToDate=function(e){var t=new Date,n=parseInt(e.substr(0,2),10);n=n>=50?1900+n:2e3+n;var r=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),o=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),a=0;if(e.length>11){var u=e.charAt(10),l=10;"+"!==u&&"-"!==u&&(a=parseInt(e.substr(10,2),10),l+=2)}if(t.setUTCFullYear(n,r,i),t.setUTCHours(o,s,a,0),l&&(u=e.charAt(l),"+"===u||"-"===u)){var c=parseInt(e.substr(l+1,2),10),f=parseInt(e.substr(l+4,2),10),h=60*c+f;h*=6e4,"+"===u?t.setTime(+t-h):t.setTime(+t+h)}return t},i.generalizedTimeToDate=function(e){var t=new Date,n=parseInt(e.substr(0,4),10),r=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),u=0,l=0,c=!1;"Z"===e.charAt(e.length-1)&&(c=!0);var f=e.length-5,h=e.charAt(f);if("+"===h||"-"===h){var p=parseInt(e.substr(f+1,2),10),d=parseInt(e.substr(f+4,2),10);l=60*p+d,l*=6e4,"+"===h&&(l*=-1),c=!0}return"."===e.charAt(14)&&(u=1e3*parseFloat(e.substr(14),10)),c?(t.setUTCFullYear(n,r,i),t.setUTCHours(o,s,a,u),t.setTime(+t+l)):(t.setFullYear(n,r,i),t.setHours(o,s,a,u)),t},i.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",n=[];n.push((""+e.getUTCFullYear()).substr(2)),n.push(""+(e.getUTCMonth()+1)),n.push(""+e.getUTCDate()),n.push(""+e.getUTCHours()),n.push(""+e.getUTCMinutes()),n.push(""+e.getUTCSeconds());for(var r=0;r=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var n=new Error("Integer too large; max is 32-bits.");throw n.integer=e,n},i.derToInteger=function(e){"string"==typeof e&&(e=r.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},i.validate=function(e,t,n,o){var s=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)o&&(e.tagClass!==t.tagClass&&o.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&o.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(s=!0,t.value&&r.util.isArray(t.value))for(var a=0,u=0;s&&u0&&(o+="\n");for(var s="",a=0;a1?o+="0x"+r.util.bytesToHex(e.value.slice(1)):o+="(none)",e.value.length>0){var h=e.value.charCodeAt(0);1==h?o+=" (1 unused bit shown)":h>1&&(o+=" ("+h+" unused bits shown)")}}else e.type===i.Type.OCTETSTRING?(u.test(e.value)||(o+="("+e.value+") "),o+="0x"+r.util.bytesToHex(e.value)):e.type===i.Type.UTF8?o+=r.util.decodeUtf8(e.value):e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?o+=e.value:u.test(e.value)?o+="0x"+r.util.bytesToHex(e.value):0===e.value.length?o+="[null]":o+=e.value}return o}},function(e,t,n){var r=n(19);n(236),n(895),n(896),n(34),r.random&&r.random.getBytes?e.exports=r.random:function(t){var n={},i=new Array(4),o=r.util.createBuffer();function s(){var e=r.prng.create(n);return e.getBytes=function(t,n){return e.generate(t,n)},e.getBytesSync=function(t){return e.generate(t)},e}n.formatKey=function(e){var t=r.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),r.aes._expandKey(e,!1)},n.formatSeed=function(e){var t=r.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},n.cipher=function(e,t){return r.aes._updateBlock(e,t,i,!1),o.putInt32(i[0]),o.putInt32(i[1]),o.putInt32(i[2]),o.putInt32(i[3]),o.getBytes()},n.increment=function(e){return++e[3],e},n.md=r.md.sha256;var a=s(),u=null;if("undefined"!=typeof window){var l=window.crypto||window.msCrypto;l&&l.getRandomValues&&(u=function(e){return l.getRandomValues(e)})}if(r.options.usePureJavaScript||!r.util.isNodejs&&!u){if("undefined"==typeof window||window.document,a.collectInt(+new Date,32),"undefined"!=typeof navigator){var c="";for(var f in navigator)try{"string"==typeof navigator[f]&&(c+=navigator[f])}catch(e){}a.collect(c),c=null}t&&(t().mousemove(function(e){a.collectInt(e.clientX,16),a.collectInt(e.clientY,16)}),t().keypress(function(e){a.collectInt(e.charCode,8)}))}if(r.random)for(var f in a)r.random[f]=a[f];else r.random=a;r.random.createInstance=s,e.exports=r.random}("undefined"!=typeof jQuery?jQuery:null)},function(e,t,n){"use strict";const r=t;r.bignum=n(63),r.define=n(906).define,r.base=n(178),r.constants=n(463),r.decoders=n(911),r.encoders=n(913)},function(e,t,n){"use strict";var r=n(1),i=n(316),o=n(469),s=n(470),a=n(119);function u(e){a.call(this,"digest"),this._hash=e}r(u,a),u.prototype._update=function(e){this._hash.update(e)},u.prototype._final=function(){return this._hash.digest()},e.exports=function e(t){return t=t.toLowerCase(),"md5"===t?new i:"rmd160"===t||"ripemd160"===t?new o:new u(s(t))}},function(e,t,n){var r=n(4).Buffer;function i(e,t){this._block=r.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}i.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=r.from(e,t));for(var n=this._block,i=this._blockSize,o=e.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(491),i=a(r),o=n(219),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)(i.default,1),e.exports=t.default},function(e,t,n){function r(e){if(e)return i(e)}function i(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},r.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+e],r;if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i1?{type:p[i],data:e.substring(1)}:{type:p[i]}:d}var s=new Uint8Array(e),i=s[0],a=o(e,1);return m&&"blob"===n&&(a=new m([a])),{type:p[i],data:a}},t.decodeBase64Packet=function(e,t){var n=p[e.charAt(0)];if(!u)return{type:n,data:{base64:!0,data:e.substr(1)}};var r=u.decode(e.substr(1));return"blob"===t&&m&&(r=new m([r])),{type:n,data:r}},t.encodePayload=function(e,n,r){"function"==typeof n&&(r=n,n=null);var o=i(e);if(n&&o)return m&&!f?t.encodePayloadAsBlob(e,r):t.encodePayloadAsArrayBuffer(e,r);if(!e.length)return r("0:");function s(e){return e.length+":"+e}function a(e,r){t.encodePacket(e,!!o&&n,!1,function(e){r(null,s(e))})}w(e,a,function(e,t){return r(t.join(""))})},t.decodePayload=function(e,n,r){if("string"!=typeof e)return t.decodePayloadAsBinary(e,n,r);var i;if("function"==typeof n&&(r=n,n=null),""===e)return r(d,0,1);for(var o="",s,a,u=0,l=e.length;u0;){for(var a=new Uint8Array(i),u=0===a[0],l="",c=1;255!==a[c];c++){if(l.length>310)return r(d,0,1);l+=a[c]}i=o(i,2+l.length),l=parseInt(l);var f=o(i,0,l);if(u)try{f=String.fromCharCode.apply(null,new Uint8Array(f))}catch(e){var h=new Uint8Array(f);f="";for(var c=0;co)throw new RangeError("requested too many random bytes");var n=a.allocUnsafe(e);if(e>0)if(e>i)for(var s=0;s{const n=r(e,t);return(e,t,r)=>{n(e,t,(e,t)=>{if(e)return r(e);r(null,t[0])})}})},function(e,t,n){"use strict";var r=n(10),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=f;var o=n(7);o.inherits=n(1);var s=n(655),a=n(658);o.inherits(f,s);for(var u=i(a.prototype),l=0;l=t)throw new Error("Cannot access property/index "+r+" levels up, current level is "+t);return n[t-r]}if(r>t)throw new Error("Cannot access data "+r+" levels up, current level is "+t);if(o="data"+(t-r||""),!i)return o}for(var a=o,u=i.split("/"),l=0;le&&e.length>0?[e.length+" items inc:",e[e.length-1]]:e),utils.stringfrom=function(e,t={}){try{return"Url"===e.constructor.name?e.href:"string"==typeof e?e:e.toString()}catch(t){throw new r.CodingError(`Unable to turn ${e} into a string ${t.message}`)}},utils.p_timeout=function(e,t,n){let i=null;return Promise.race([new Promise((e,o)=>{i=setTimeout(o,t,new r.TimeoutError(n||`Timed out in ${t}ms`))}),e.then(e=>(clearTimeout(i),e))])},utils.createElement=function(e,t,n){var r=document.createElement(e);for(let e in t){let n="classname"===e.toLowerCase()?"class":e;if("dangerouslySetInnerHTML"===e&&(r.innerHTML=t[e].__html,delete t.dangerouslySetInnerHTML),t.hasOwnProperty(e)){let i=t[e];if(!0===i)r.setAttribute(n,e);else if("object"!=typeof i||Array.isArray(i))!1!==i&&null!=i&&r.setAttribute(n,i.toString());else if(["style"].includes(n))for(let e in i)r[n][e]=i[e];else r[n]=i}}for(let e=2;er.appendChild(null==e.nodeType?document.createTextNode(e.toString()):e)):r.appendChild(null==t.nodeType?document.createTextNode(t.toString()):t))}return r},t=e.exports=utils},function(e,t,n){"use strict";function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var i={};function o(e,t,n){function o(e,n,r){return"string"==typeof t?t:t(e,n,r)}n||(n=Error);var s=function(e){function t(t,n,r){return e.call(this,o(t,n,r))||this}return r(t,e),t}(n);s.prototype.name=n.name,s.prototype.code=e,i[e]=s}function s(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return String(e)}),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}function a(e,t,n){return e.substr(!n||n<0?0:+n,t.length)===t}function u(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}function l(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}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,n){var r,i;if("string"==typeof t&&a(t,"not ")?(r="must not be",t=t.replace(/^not /,"")):r="must be",u(e," argument"))i="The ".concat(e," ").concat(r," ").concat(s(t,"type"));else{var o=l(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(o," ").concat(r," ").concat(s(t,"type"))}return i+=". Received type ".concat(typeof n),i},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"),e.exports.codes=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var r=n(214),i=a(r),o=n(41),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e){return function(t,n,r){return e(i.default,t,(0,s.default)(n),r)}}e.exports=t.default},function(e,t,n){var r=n(173),i=n(289);function o(e){return null!=e&&i(e.length)&&!r(e)}e.exports=o},function(e,t,n){var r=n(133),i=n(215),o="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",u="[object Proxy]";function l(e){if(!i(e))return!1;var t=r(e);return t==s||t==a||t==o||t==u}e.exports=l},function(e,t,n){var r=n(98),i=r.Symbol;e.exports=i},function(e,t,n){"use strict";e.exports=function e(t,n){var r,i;function o(e){if(r=e,i)return o.abort();!function e(){for(var o=!0,s=!1;o;)if(s=!1,r(null,function(a,u){if(s=!0,a=a||i){if(o=!1,n)n(!0===a?null:a);else if(a&&!0!==a)throw a}else t&&!1===t(u)||i?(o=!1,r(i||!0,n||function(){})):o||e()}),!s)return void(o=!1)}()}return o.abort=function(e,t){if("function"==typeof e&&(t=e,e=!0),i=e||!0,r)return r(i,t||function(){})},o}},function(e,t){e.exports=function e(t){return t&&("string"==typeof t?function(e){return e[t]}:"object"==typeof t&&"function"==typeof t.exec?function(e){var n=t.exec(e);return n&&n[0]}:t)}},function(e,t,n){var r=n(19);r.pki=r.pki||{};var i=e.exports=r.pki.oids=r.oids=r.oids||{};function o(e,t){i[e]=t,i[t]=e}function s(e,t){i[e]=t}o("1.2.840.113549.1.1.1","rsaEncryption"),o("1.2.840.113549.1.1.4","md5WithRSAEncryption"),o("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),o("1.2.840.113549.1.1.7","RSAES-OAEP"),o("1.2.840.113549.1.1.8","mgf1"),o("1.2.840.113549.1.1.9","pSpecified"),o("1.2.840.113549.1.1.10","RSASSA-PSS"),o("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),o("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),o("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),o("1.2.840.10040.4.3","dsa-with-sha1"),o("1.3.14.3.2.7","desCBC"),o("1.3.14.3.2.26","sha1"),o("2.16.840.1.101.3.4.2.1","sha256"),o("2.16.840.1.101.3.4.2.2","sha384"),o("2.16.840.1.101.3.4.2.3","sha512"),o("1.2.840.113549.2.5","md5"),o("1.2.840.113549.1.7.1","data"),o("1.2.840.113549.1.7.2","signedData"),o("1.2.840.113549.1.7.3","envelopedData"),o("1.2.840.113549.1.7.4","signedAndEnvelopedData"),o("1.2.840.113549.1.7.5","digestedData"),o("1.2.840.113549.1.7.6","encryptedData"),o("1.2.840.113549.1.9.1","emailAddress"),o("1.2.840.113549.1.9.2","unstructuredName"),o("1.2.840.113549.1.9.3","contentType"),o("1.2.840.113549.1.9.4","messageDigest"),o("1.2.840.113549.1.9.5","signingTime"),o("1.2.840.113549.1.9.6","counterSignature"),o("1.2.840.113549.1.9.7","challengePassword"),o("1.2.840.113549.1.9.8","unstructuredAddress"),o("1.2.840.113549.1.9.14","extensionRequest"),o("1.2.840.113549.1.9.20","friendlyName"),o("1.2.840.113549.1.9.21","localKeyId"),o("1.2.840.113549.1.9.22.1","x509Certificate"),o("1.2.840.113549.1.12.10.1.1","keyBag"),o("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),o("1.2.840.113549.1.12.10.1.3","certBag"),o("1.2.840.113549.1.12.10.1.4","crlBag"),o("1.2.840.113549.1.12.10.1.5","secretBag"),o("1.2.840.113549.1.12.10.1.6","safeContentsBag"),o("1.2.840.113549.1.5.13","pkcs5PBES2"),o("1.2.840.113549.1.5.12","pkcs5PBKDF2"),o("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),o("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),o("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),o("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),o("1.2.840.113549.2.7","hmacWithSHA1"),o("1.2.840.113549.2.8","hmacWithSHA224"),o("1.2.840.113549.2.9","hmacWithSHA256"),o("1.2.840.113549.2.10","hmacWithSHA384"),o("1.2.840.113549.2.11","hmacWithSHA512"),o("1.2.840.113549.3.7","des-EDE3-CBC"),o("2.16.840.1.101.3.4.1.2","aes128-CBC"),o("2.16.840.1.101.3.4.1.22","aes192-CBC"),o("2.16.840.1.101.3.4.1.42","aes256-CBC"),o("2.5.4.3","commonName"),o("2.5.4.5","serialName"),o("2.5.4.6","countryName"),o("2.5.4.7","localityName"),o("2.5.4.8","stateOrProvinceName"),o("2.5.4.10","organizationName"),o("2.5.4.11","organizationalUnitName"),o("2.16.840.1.113730.1.1","nsCertType"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),o("2.5.29.14","subjectKeyIdentifier"),o("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),o("2.5.29.17","subjectAltName"),o("2.5.29.18","issuerAltName"),o("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),o("2.5.29.31","cRLDistributionPoints"),o("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),o("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),o("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),o("1.3.6.1.4.1.11129.2.4.2","timestampList"),o("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),o("1.3.6.1.5.5.7.3.1","serverAuth"),o("1.3.6.1.5.5.7.3.2","clientAuth"),o("1.3.6.1.5.5.7.3.3","codeSigning"),o("1.3.6.1.5.5.7.3.4","emailProtection"),o("1.3.6.1.5.5.7.3.8","timeStamping")},function(e,t,n){"use strict";const r=t;r.Reporter=n(908).Reporter,r.DecoderBuffer=n(462).DecoderBuffer,r.EncoderBuffer=n(462).EncoderBuffer,r.Node=n(909)},function(e,t,n){(function(t){e.exports=function e(n,r){for(var i=Math.min(n.length,r.length),o=new t(i),s=0;s{const s=new i(Date.now()+Number(r)).toString(),a=f.ValidityType.EOL;b(e,t,n,s,a,o)},y=(e,t,n,r,i)=>{const o=f.ValidityType.EOL;b(e,t,n,r,o,i)},b=(e,t,n,r,i,o)=>{x(e,t,i,r,(e,s)=>{if(e)return c.error("record signature creation failed"),o(Object.assign(new Error("record signature verification failed"),{code:p.ERR_SIGNATURE_CREATION}));const a={value:t,signature:s,validityType:i,validity:r,sequence:n};return c(`ipns entry for ${t} created`),o(null,a)})},v=(e,t,n)=>{const{value:r,validityType:i,validity:o}=t,s=A(r,i,o);e.verify(s,t.signature,(e,t)=>{if(e||!t)return c.error("record signature verification failed"),n(Object.assign(new Error("record signature verification failed"),{code:p.ERR_SIGNATURE_VERIFICATION}));if(i===f.ValidityType.EOL){let e;try{e=h(o.toString())}catch(e){return c.error("unrecognized validity format (not an rfc3339 format)"),n(Object.assign(new Error("unrecognized validity format (not an rfc3339 format)"),{code:p.ERR_UNRECOGNIZED_FORMAT}))}if(e{if(!e||!e.bytes||!t){const e="one or more of the provided parameters are not defined";return c.error(e),n(Object.assign(new Error(e),{code:p.ERR_UNDEFINED_PARAMETER}))}a.createFromPubKey(e.bytes,(r,i)=>{if(r)return c.error(r),n(Object.assign(new Error(r),{code:p.ERR_PEER_ID_FROM_PUBLIC_KEY}));let o;try{o=I(i)}catch(r){return c.error(r),n(Object.assign(new Error(r),{code:p.ERR_PUBLIC_KEY_FROM_ID}))}if(o)return n(null,null);try{t.pubKey=s.keys.marshalPublicKey(e)}catch(r){return c.error(r),n(r)}n(null,t)})},w=(e,t,n)=>{if(!t||!e){const e="one or more of the provided parameters are not defined";return c.error(e),n(Object.assign(new Error(e),{code:p.ERR_UNDEFINED_PARAMETER}))}if(t.pubKey){let e;try{e=s.keys.unmarshalPublicKey(t.pubKey)}catch(e){return c.error(e),n(e)}return n(null,e)}n(null,e.pubKey)},k=e=>r(e,"RFC4648",{padding:!1}),S=e=>new o(`/ipns/${k(e)}`),E=e=>{const n=t.from("/pk/"),r=t.from("/ipns/");return{routingPubKey:new o(t.concat([n,e])),pkKey:new o(k(t.concat([n,e]))),routingKey:new o(t.concat([r,e])),ipnsKey:new o(k(t.concat([r,e])))}},x=(e,t,n,r,i)=>{const o=A(t,n,r);e.sign(o,(e,t)=>e?i(e):i(null,t))},C=e=>{if("0"===e.toString())return"EOL";{const t=`unrecognized validity type ${e.toString()}`;throw c.error(t),Object.assign(new Error(t),{code:p.ERR_UNRECOGNIZED_VALIDITY})}},A=(e,n,r)=>{const i=t.from(e),o=t.from(C(n)),s=t.from(r);return t.concat([i,s,o])},I=e=>{const t=u.decode(e.id);return t.code!==d?null:s.keys.unmarshalPublicKey(t.digest)},T=f.encode,j=f.decode,O={validate:(e,t,n)=>{const r=j(e),i=t.slice("/ipns/".length);let o;try{o=a.createFromBytes(i)}catch(e){return n(e)}w(o,r,(e,t)=>{if(e)return n(e);v(t,r,e=>{if(e)return n(e);n(null,!0)})})},select:(e,t,n)=>{const r=j(e),i=j(t),o=r.sequence>i.sequence?0:1;if("function"!=typeof n)return o;n(null,o)}};e.exports={create:g,createWithExpiration:y,validate:v,embedPublicKey:_,extractPublicKey:w,getLocalKey:S,getIdKeys:E,marshal:T,unmarshal:j,validator:O,namespace:"/ipns/",namespaceLength:"/ipns/".length}}).call(this,n(0).Buffer)},function(e,t,n){const r=n(6).EventEmitter,i=n(18),o=n(1118);function s(e,t){"object"==typeof e&&(t=e,e="START"),i.equal(typeof e,"string"),i.equal(typeof t,"object"),i.ok(t[e],"invalid starting state "+e),i.ok(o.validate(t));const n=new r;return u._graph=o.reachable(t),u._emitter=n,u._events=t,u._state=e,u.emit=u,u.on=s,u;function s(e,t){n.on(e,t)}function u(e){const t=u._events[u._state][e];if(!a(u._state,t,u._graph)){const t="invalid transition: "+u._state+" -> "+e;return n.emit("error",t)}const r=u._state+":leave",i=t+":enter";return u._state?o():s();function o(){n._events[r]?n.emit(r,s):s()}function s(){n._events[i]?n.emit(i,l):l()}function l(){u._state=t,n.emit(t),n.emit("done")}}}function a(e,t,n){if(!t)return!1;if(!e)return!0;const r=n[e];return!(!r||!r[t])&&1===r[t].length}e.exports=s},function(e,t,n){"use strict";const r=n(24),i=n(44),o=n(23),s=n(184);e.exports=function(e){function t(e){let t=null;if(r.isMultiaddr(e)){const n=r(e);t=n.getPeerId()}else i.isPeerInfo(e)&&(t=e.id.toB58String());return t}function n(t){let n;if(i.isPeerInfo(t))n=t;else if(r.isMultiaddr(t)){const r=t.getPeerId();try{n=e._peerBook.get(r)}catch(e){n=new i(o.createFromB58String(r))}n.multiaddrs.add(t)}else if(o.isPeerId(t)){const r=t.toB58String();n=e._peerBook.has(r)?e._peerBook.get(r):t}return n}function a(t){return e.muxedConns[t]||e.conns[t]}function u(e,t,n){return n=n||(()=>{}),e.write(s.CircuitRelay.encode({type:s.CircuitRelay.Type.STATUS,code:t})),n()}function l(e,t,n,i){try{e.dstPeer.addrs.forEach(e=>r(e))}catch(e){return u(t,n===s.CircuitRelay.Type.HOP?s.CircuitRelay.Status.HOP_DST_MULTIADDR_INVALID:s.CircuitRelay.Status.STOP_DST_MULTIADDR_INVALID),i(e)}try{e.srcPeer.addrs.forEach(e=>r(e))}catch(e){return u(t,n===s.CircuitRelay.Type.HOP?s.CircuitRelay.Status.HOP_SRC_MULTIADDR_INVALID:s.CircuitRelay.Status.STOP_SRC_MULTIADDR_INVALID),i(e)}return i(null)}function c(e){return"string"==typeof e?o.createFromB58String(e):o.createFromBytes(e)}return{getB58String:t,peerInfoFromMa:n,isPeerConnected:a,validateAddrs:l,writeResponse:u,peerIdFromId:c}}},function(e,t,n){"use strict";const r=n(70);e.exports=r("\nmessage CircuitRelay {\n\n enum Status {\n SUCCESS = 100;\n HOP_SRC_ADDR_TOO_LONG = 220;\n HOP_DST_ADDR_TOO_LONG = 221;\n HOP_SRC_MULTIADDR_INVALID = 250;\n HOP_DST_MULTIADDR_INVALID = 251;\n HOP_NO_CONN_TO_DST = 260;\n HOP_CANT_DIAL_DST = 261;\n HOP_CANT_OPEN_DST_STREAM = 262;\n HOP_CANT_SPEAK_RELAY = 270;\n HOP_CANT_RELAY_TO_SELF = 280;\n STOP_SRC_ADDR_TOO_LONG = 320;\n STOP_DST_ADDR_TOO_LONG = 321;\n STOP_SRC_MULTIADDR_INVALID = 350;\n STOP_DST_MULTIADDR_INVALID = 351;\n STOP_RELAY_REFUSED = 390;\n MALFORMED_MESSAGE = 400;\n }\n\n enum Type { // RPC identifier, either HOP, STOP or STATUS\n HOP = 1;\n STOP = 2;\n STATUS = 3;\n CAN_HOP = 4;\n }\n\n message Peer {\n required bytes id = 1; // peer id\n repeated bytes addrs = 2; // peer's known addresses\n }\n\n optional Type type = 1; // Type of the message\n\n optional Peer srcPeer = 2; // srcPeer and dstPeer are used when Type is HOP or STATUS\n optional Peer dstPeer = 3;\n\n optional Status code = 4; // Status code, used when Type is STATUS\n}\n")},function(e,t,n){"use strict";const r=n(3),i=n(97),o=n(64),s=n(9),a="ERR_BAD_PATH";function u(e){const t=new Error("invalid ipfs ref path");e=e.replace(/^\/ipfs\//,"");const n=e.match(/([^/]+(?:\/[^/]+)*)\/?$/);if(!n)throw t;const[r,...i]=n[1].split("/");if(o.cid(r))return{hash:r,links:i};throw t}t.OFFLINE_ERROR="This command must be run in online mode. Try running 'ipfs daemon' first.";const l=e=>{if(o.cid(e))return`/ipfs/${e}`;if(o.path(e))return e;throw Object.assign(new Error(`invalid ${e} path`),{code:a})},c=r(function(e,n,r){Array.isArray(n)||(n=[n]),i(n,(n,r)=>{if("string"!=typeof n){let e;try{e=new s(n)}catch(e){return r(e)}return r(null,e.buffer)}let i;try{i=t.parseIpfsPath(n)}catch(e){return r(e)}const o=new s(i.hash),a=i.links;if(!a.length)return r(null,o.buffer);function u(t,n,i,o){if(i)return r(i);if(!n.length)return r(null,t.buffer);const s=n[0],a=o.links.find(e=>e.name===s);if(!a)return r(new Error(`no link named "${s}" under ${t.toBaseEncodedString()}`));e.get(a.cid,u.bind(null,a.cid,n.slice(1)))}e.get(o,u.bind(null,o,a))},r)});t.normalizePath=l,t.parseIpfsPath=u,t.resolvePath=c},function(e,t){function n(e){return"function"==typeof e}function r(e){return"object"==typeof e&&i(e.source)&&o(e.sink)}function i(e){return n(e)&&2===e.length}function o(e){return n(e)&&1===e.length}t.isDuplex=r,t.isSource=i,t.isSink=o},function(e,t,n){var r=n(523);e.exports=function(e,t){return function(n){var i=[],o,s;function a(e){i.push(e)}e=e||function(e){this.queue(e)},t=t||function(){this.queue(null)};var u={emit:function(e,t){"data"==e&&a(t),"end"==e&&(o=!0,a(null)),"error"==e&&(s=t)},queue:a},l;return function(a,c){if(o=o||a,a)return n(a,function(){if(l){var e=l;l=null,e(a)}c(a)});l=c,r(function r(a){if(l)if(c=l,s)l=null,c(s);else if(i.length){var f=i.shift();l=null,c(null===f,f)}else n(o,function(i,f){if(i&&!0!==i)return s=i,a();if(o=o||i)t.call(u);else if(null!==f&&(e.call(u,f),s||o))return n(s||o,function(){l=null,c(s||o)});a(r)})})}}}},function(e,t,n){var r=t;r.utils=n(91),r.common=n(189),r.sha=n(1332),r.ripemd=n(1336),r.hmac=n(1337),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},function(e,t,n){"use strict";var r=n(91),i=n(107);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=o,o.prototype.update=function e(t,n){if(t=r.toArray(t,n),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var i=t.length%this._delta8;this.pending=t.slice(t.length-i,t.length),0===this.pending.length&&(this.pending=null),t=r.join32(t,0,t.length-i,this.endian);for(var o=0;o>>24&255,i[o++]=t>>>16&255,i[o++]=t>>>8&255,i[o++]=255&t}else for(i[o++]=255&t,i[o++]=t>>>8&255,i[o++]=t>>>16&255,i[o++]=t>>>24&255,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,s=8;st.length)throw new Error("invalid rlp: total length is larger than the data");if(s=t.slice(r,f),0===s.length)throw new Error("invalid rlp, List has a invalid length");for(;s.length;)a=l(s),u.push(a.data),s=a.remainder;return{data:u,remainder:t.slice(f)}}function c(e){return"0x"===e.slice(0,2)}function f(e){return"string"!=typeof e?e:c(e)?e.slice(2):e}function h(e){if(e<0)throw new Error("Invalid integer as argument, must be unsigned!");var t=e.toString(16);return t.length%2?"0"+t:t}function p(e){return e.length%2?"0"+e:e}function d(t){var n=h(t);return e.from(n,"hex")}function m(t){if(!e.isBuffer(t)){if("string"==typeof t)return c(t)?e.from(p(f(t)),"hex"):e.from(t);if("number"==typeof t)return t?d(t):e.from([]);if(null===t||void 0===t)return e.from([]);if(t instanceof Uint8Array)return e.from(t);if(r.isBN(t))return e.from(t.toArray());throw new Error("invalid type")}return t}t.encode=i,t.decode=a,t.getLength=u}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(9),i=n(42);function o(e,t,n){n=n||{};const o=n.hashAlg||"keccak-256",s=void 0===n.version?1:n.version,a=i.encode(t,o);return new r(s,e,a)}e.exports=o},function(e,t,n){"use strict";const r=n(11),i=n(586),o=n(587);function s(e,t,n){const s=o(e,t),a={multicodec:e,defaultHashAlg:"keccak-256",resolve:c,tree:u,isLink:i(c),_resolveFromEthObject:f,_treeFromEthObject:l,_mapFromEthObject:n};return{resolver:a,util:s};function u(e,t,n){"function"==typeof t&&(n=t,t=void 0),t||(t={}),r([t=>s.deserialize(e,t),(e,n)=>l(e,t,n)],n)}function l(e,t,i){r([r=>n(e,t,r),(e,t)=>t(null,e.map(e=>e.path))],i)}function c(e,t,n){r([t=>s.deserialize(e,t),(e,n)=>f(e,t,n)],n)}function f(e,t,r){if(!t||"/"===t){const t={value:e,remainderPath:""};return r(null,t)}n(e,{},(e,n)=>{if(e)return r(e);const i=t.split("/");let o=n.filter(e=>e.path===t.slice(0,e.path.length));o=o.filter(e=>e.path.split("/").every((e,t)=>e===i[t]));const s=o.sort((e,t)=>t.path.length-e.path.length),a=s[0];if(!a){let e=new Error('Path not found ("'+t+'").');return r(e)}const u=t.slice(a.path.length+1),l={value:a.value,remainderPath:u};return r(null,l)})}}e.exports=s},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(273),o=n(0),s=n(59).sha256sha256,a=function e(n){if(!(this instanceof e))return new e(n);if(t.isBuffer(n)){var r=n;this.fromBuffer(r)}else if("string"==typeof n){var i=n;this.fromString(i)}else n&&this.set(n)};a.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this},a.validChecksum=function e(t,n){return r.isString(t)&&(t=new o.Buffer(i.decode(t))),r.isString(n)&&(n=new o.Buffer(i.decode(n))),n||(n=t.slice(-4),t=t.slice(0,-4)),a.checksum(t).toString("hex")===n.toString("hex")},a.decode=function(e){if("string"!=typeof e)throw new Error("Input must be a string");var n=new t(i.decode(e));if(n.length<4)throw new Error("Input string too short");var r=n.slice(0,-4),o=n.slice(-4),a=s(r),u=a.slice(0,4);if(o.toString("hex")!==u.toString("hex"))throw new Error("Checksum mismatch");return r},a.checksum=function(e){return s(e).slice(0,4)},a.encode=function(e){if(!t.isBuffer(e))throw new Error("Input must be a buffer");var n=new t(e.length+4),r=a.checksum(e);return e.copy(n),r.copy(n,e.length),i.encode(n)},a.prototype.fromBuffer=function(e){return this.buf=e,this},a.prototype.fromString=function(e){var t=a.decode(e);return this.buf=t,this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toString=function(){return a.encode(this.buf)},e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=n(17),i=n(25),o=n(85),s=n(79),a=n(0),u=n(30),l=n(40),c=n(87),f=n(110),h=n(111),p=4294967295,d=p-2,m=p,g=p-1;function y(e){return this instanceof y?e?this._fromObject(e):void 0:new y(e)}y.MAXINT=p,y.DEFAULT_SEQNUMBER=4294967295,y.DEFAULT_LOCKTIME_SEQNUMBER=4294967294,y.DEFAULT_RBF_SEQNUMBER=4294967293,Object.defineProperty(y.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this.isNull()?null:(this._script||(this._script=new c(this._scriptBuffer),this._script._isInput=!0),this._script)}}),y.fromObject=function(e){i.checkArgument(r.isObject(e));var t=new y;return t._fromObject(e)},y.prototype._fromObject=function(e){var t;if(t=r.isString(e.prevTxId)&&l.isHexa(e.prevTxId)?new a.Buffer(e.prevTxId,"hex"):e.prevTxId,this.output=e.output?e.output instanceof h?e.output:new h(e.output):void 0,this.prevTxId=t||e.txidbuf,this.outputIndex=r.isUndefined(e.outputIndex)?e.txoutnum:e.outputIndex,this.sequenceNumber=r.isUndefined(e.sequenceNumber)?r.isUndefined(e.seqnum)?4294967295:e.seqnum:e.sequenceNumber,r.isUndefined(e.script)&&r.isUndefined(e.scriptBuffer))throw new o.Transaction.Input.MissingScript;return this.setScript(e.scriptBuffer||e.script),this},y.prototype.toObject=y.prototype.toJSON=function e(){var t={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(t.scriptString=this.script.toString()),this.output&&(t.output=this.output.toObject()),t},y.fromBufferReader=function(e){var t=new y;return t.prevTxId=e.readReverse(32),t.outputIndex=e.readUInt32LE(),t._scriptBuffer=e.readVarLengthBuffer(),t.sequenceNumber=e.readUInt32LE(),t},y.prototype.toBufferWriter=function(e){e||(e=new s),e.writeReverse(this.prevTxId),e.writeUInt32LE(this.outputIndex);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e.writeUInt32LE(this.sequenceNumber),e},y.prototype.setScript=function(e){if(this._script=null,e instanceof c)this._script=e,this._script._isInput=!0,this._scriptBuffer=e.toBuffer();else if(l.isHexa(e))this._scriptBuffer=new a.Buffer(e,"hex");else if(r.isString(e))this._script=new c(e),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else{if(!u.isBuffer(e))throw new TypeError("Invalid argument type: script");this._scriptBuffer=new a.Buffer(e)}return this},y.prototype.getSignatures=function(){throw new o.AbstractMethodInvoked("Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: "+JSON.stringify(this))},y.prototype.isFullySigned=function(){throw new o.AbstractMethodInvoked("Input#isFullySigned")},y.prototype.isFinal=function(){return 4294967295!==this.sequenceNumber},y.prototype.addSignature=function(){throw new o.AbstractMethodInvoked("Input#addSignature")},y.prototype.clearSignatures=function(){throw new o.AbstractMethodInvoked("Input#clearSignatures")},y.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,f.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script)},y.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},y.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},e.exports=y},function(e,t){"function"==typeof Object.create?e.exports=function e(t,n){t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function e(t,n){t.super_=n;var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(25),o=n(196),s=n(30),a=n(40),u=n(94),l=n(85),c=n(86);function f(e){if(!(this instanceof f))return new f(e);if(e instanceof f)return e;if(r.isObject(e))return this._fromObject(e);throw new l.InvalidArgument("TransactionSignatures must be instantiated from an object")}o(f,c),f.prototype._fromObject=function(e){return this._checkObjectArgs(e),this.publicKey=new u(e.publicKey),this.prevTxId=s.isBuffer(e.prevTxId)?e.prevTxId:new t(e.prevTxId,"hex"),this.outputIndex=e.outputIndex,this.inputIndex=e.inputIndex,this.signature=e.signature instanceof c?e.signature:s.isBuffer(e.signature)?c.fromBuffer(e.signature):c.fromString(e.signature),this.sigtype=e.sigtype,this},f.prototype._checkObjectArgs=function(e){i.checkArgument(u(e.publicKey),"publicKey"),i.checkArgument(!r.isUndefined(e.inputIndex),"inputIndex"),i.checkArgument(!r.isUndefined(e.outputIndex),"outputIndex"),i.checkState(r.isNumber(e.inputIndex),"inputIndex must be a number"),i.checkState(r.isNumber(e.outputIndex),"outputIndex must be a number"),i.checkArgument(e.signature,"signature"),i.checkArgument(e.prevTxId,"prevTxId"),i.checkState(e.signature instanceof c||s.isBuffer(e.signature)||a.isHexa(e.signature),"signature must be a buffer or hexa value"),i.checkState(s.isBuffer(e.prevTxId)||a.isHexa(e.prevTxId),"prevTxId must be a buffer or hexa value"),i.checkArgument(e.sigtype,"sigtype"),i.checkState(r.isNumber(e.sigtype),"sigtype must be a number")},f.prototype.toObject=f.prototype.toJSON=function e(){return{publicKey:this.publicKey.toString(),prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,inputIndex:this.inputIndex,signature:this.signature.toString(),sigtype:this.sigtype}},f.fromObject=function(e){return i.checkArgument(e),new f(e)},e.exports=f}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var r=n(21).Writable,i=n(1),o=n(277);if("undefined"==typeof Uint8Array)var s=n(1455).Uint8Array;else var s=Uint8Array;function a(e,t){if(!(this instanceof a))return new a(e,t);"function"==typeof e&&(t=e,e={}),e||(e={});var n=e.encoding,i=!1;n?(n=String(n).toLowerCase(),"u8"!==n&&"uint8"!==n||(n="uint8array")):i=!0,r.call(this,{objectMode:!0}),this.encoding=n,this.shouldInferEncoding=i,t&&this.on("finish",function(){t(this.getBody())}),this.body=[]}e.exports=a,i(a,r),a.prototype._write=function(e,t,n){this.body.push(e),n()},a.prototype.inferEncoding=function(e){var n=void 0===e?this.body[0]:e;return t.isBuffer(n)?"buffer":"undefined"!=typeof Uint8Array&&n instanceof Uint8Array?"uint8array":Array.isArray(n)?"array":"string"==typeof n?"string":"[object Object]"===Object.prototype.toString.call(n)?"object":"buffer"},a.prototype.getBody=function(){return this.encoding||0!==this.body.length?(this.shouldInferEncoding&&(this.encoding=this.inferEncoding()),"array"===this.encoding?p(this.body):"string"===this.encoding?f(this.body):"buffer"===this.encoding?h(this.body):"uint8array"===this.encoding?d(this.body):this.body):[]};var u=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)};function l(e){return/Array\]$/.test(Object.prototype.toString.call(e))}function c(e){return"string"==typeof e||l(e)||e&&"function"==typeof e.subarray}function f(e){for(var n=[],r=!1,i=0;in=>{let f,h=!1,p=!1;n=n?Object.assign({},n,n.qs):{};const d=new u,m=new r({objectMode:!0});m._read=(e=>{}),m._write=((e,t,r)=>{const o=s(r);try{const r=a(e,n).map(e=>Object.assign({headers:l(e)},e));p=!0,i(r,(e,n)=>d.write(e,t,n),e=>{if(p=!1,e)return o(e);h&&d.end(),o()})}catch(e){o(e)}}),m.once("finish",()=>{h||(h=!0,p||d.end())});const g=n.qs||{};g["cid-version"]=c(n,"cid-version","cidVersion"),g["raw-leaves"]=c(n,"raw-leaves","rawLeaves"),g["only-hash"]=c(n,"only-hash","onlyHash"),g["wrap-with-directory"]=c(n,"wrap-with-directory","wrapWithDirectory"),g.hash=c(n,"hash","hashAlg");const y={path:t,qs:g,args:n.args,multipart:!0,multipartBoundary:d._boundary,stream:!0,recursive:!0,progress:n.progress};return d.on("error",e=>{m.emit("error",e)}),f=e(y,(e,t)=>{if(e)return m.emit("error",e);if(!t)return m.push(null);if(!o(t))return m.push(t),void m.push(null);if(t.on("error",e=>m.emit("error",e)),n.converter){t.on("data",e=>{e.Bytes&&n.progress&&n.progress(e.Bytes)});const e=n.converter,r=new e;r.once("end",()=>m.push(null)),r.on("data",e=>m.push(e)),t.pipe(r)}else t.on("data",e=>{e.Bytes&&n.progress&&n.progress(e.Bytes),m.push(e)}),t.once("end",()=>m.push(null))}),f.on("drain",()=>d.emit("drain")),d.pipe(f),m})},function(e,t){e.exports=!1},function(e,t,n){var r=n(154),i=n(32),o=e.exports;for(var s in r)r.hasOwnProperty(s)&&(o[s]=r[s]);function a(e){if("string"==typeof e&&(e=i.parse(e)),e.protocol||(e.protocol="https:"),"https:"!==e.protocol)throw new Error('Protocol "'+e.protocol+'" not supported. Expected "https:"');return e}o.request=function(e,t){return e=a(e),r.request.call(this,e,t)},o.get=function(e,t){return e=a(e),r.get.call(this,e,t)}},function(e,t,n){"use strict";var r=n(10),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=f;var o=n(7);o.inherits=n(1);var s=n(1486),a=n(1490);o.inherits(f,s);for(var u=i(a.prototype),l=0;l>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")}e.exports=l,e.exports.sync=u},function(e,t,n){e.exports=d;var r=n(27),i=n(31).Buffer,o=n(56),s=n(15),a=n(95),u=n(46),l=n(52),c=n(210),f=n(47),h=a.FingerprintFormatError,p=a.InvalidAlgorithmError;function d(e){if(r.object(e,"options"),r.string(e.type,"options.type"),r.buffer(e.hash,"options.hash"),r.string(e.algorithm,"options.algorithm"),this.algorithm=e.algorithm.toLowerCase(),!0!==o.hashAlgs[this.algorithm])throw new p(this.algorithm);this.hash=e.hash,this.type=e.type,this.hashType=e.hashType}d.prototype.toString=function(e){switch(void 0===e&&(e="md5"===this.algorithm||"spki"===this.hashType?"hex":"base64"),r.string(e),e){case"hex":return"spki"===this.hashType?this.hash.toString("hex"):y(this.hash.toString("hex"));case"base64":return"spki"===this.hashType?this.hash.toString("base64"):v(this.algorithm,this.hash.toString("base64"));default:throw new h(void 0,e)}},d.prototype.matches=function(e){r.object(e,"key or certificate"),"key"===this.type&&"ssh"!==this.hashType?(f.assertCompatible(e,u,[1,7],"key with spki"),l.isPrivateKey(e)&&f.assertCompatible(e,l,[1,6],"privatekey with spki support")):"key"===this.type?f.assertCompatible(e,u,[1,0],"key"):f.assertCompatible(e,c,[1,0],"certificate");var t=e.hash(this.algorithm,this.hashType),n=s.createHash(this.algorithm).update(t).digest("base64");return void 0===this.hash2&&(this.hash2=s.createHash(this.algorithm).update(this.hash).digest("base64")),this.hash2===n};var m=/^[A-Za-z0-9+\/=]+$/,g=/^[a-fA-F0-9]+$/;function y(e){return e.replace(/(.{2})(?=.)/g,"$1:")}function b(e){return e.replace(/=*$/,"")}function v(e,t){return e.toUpperCase()+":"+b(t)}d.parse=function(e,t){var n,s,a;r.string(e,"fingerprint"),Array.isArray(t)&&(a=t,t={}),r.optionalObject(t,"options"),void 0===t&&(t={}),void 0!==t.enAlgs&&(a=t.enAlgs),void 0!==t.algorithms&&(a=t.algorithms),r.optionalArrayOfString(a,"algorithms");var u="ssh";void 0!==t.hashType&&(u=t.hashType),r.string(u,"options.hashType");var l=e.split(":");if(2==l.length){if(n=l[0].toLowerCase(),!m.test(l[1]))throw new h(e);try{s=i.from(l[1],"base64")}catch(t){throw new h(e)}}else if(l.length>2){if(n="md5","md5"===l[0].toLowerCase()&&(l=l.slice(1)),l=l.map(function(t){for(;t.length<2;)t="0"+t;if(t.length>2)throw new h(e);return t}),l=l.join(""),!g.test(l)||l.length%2!=0)throw new h(e);try{s=i.from(l,"hex")}catch(t){throw new h(e)}}else{if(g.test(e))s=i.from(e,"hex");else{if(!m.test(e))throw new h(e);s=i.from(e,"base64")}switch(s.length){case 32:n="sha256";break;case 16:n="md5";break;case 20:n="sha1";break;case 64:n="sha512";break;default:throw new h(e)}void 0===t.hashType&&(u="spki")}if(void 0===n)throw new h(e);if(void 0===o.hashAlgs[n])throw new p(n);if(void 0!==a&&(a=a.map(function(e){return e.toLowerCase()}),-1===a.indexOf(n)))throw new p(n);return new d({algorithm:n,hash:s,type:t.type||"key",hashType:u})},d.isFingerprint=function(e,t){return f.isCompatible(e,d,t)},d.prototype._sshpkApiVersion=[1,2],d._oldVersionDetect=function(e){return r.func(e.toString),r.func(e.matches),[1,0]}},function(e,t,n){(function(){var n,r=0xdeadbeefcafe,i=!0;function o(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new o(null)}function a(e,t,n,r,i,o){for(;--o>=0;){var s=t*this[e++]+n[r]+i;i=Math.floor(s/67108864),n[r++]=67108863&s}return i}function u(e,t,n,r,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var u=32767&this[e],l=this[e++]>>15,c=a*u+l*s;u=s*u+((32767&c)<<15)+n[r]+(1073741823&i),i=(u>>>30)+(c>>>15)+a*l+(i>>>30),n[r++]=1073741823&u}return i}function l(e,t,n,r,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var u=16383&this[e],l=this[e++]>>14,c=a*u+l*s;u=s*u+((16383&c)<<14)+n[r]+i,i=(u>>28)+(c>>14)+a*l,n[r++]=268435455&u}return i}var c="undefined"!=typeof navigator;c&&"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=u,n=30):c&&"Netscape"!=navigator.appName?(o.prototype.am=a,n=26):(o.prototype.am=l,n=28),o.prototype.DB=n,o.prototype.DM=(1<=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function v(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function _(e){var t=s();return t.fromInt(e),t}function w(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void this.fromRadix(e,t);n=2}this.t=0,this.s=0;for(var r=e.length,i=!1,s=0;--r>=0;){var a=8==n?255&e[r]:y(e,r);a<0?"-"==e.charAt(r)&&(i=!0):(i=!1,0==s?this[this.t++]=a:s+n>this.DB?(this[this.t-1]|=(a&(1<>this.DB-s):this[this.t-1]|=a<=this.DB&&(s-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==e;)--this.t}function S(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n=(1<0)for(a>a)>0&&(i=!0,o=g(r));s>=0;)a>(a+=this.DB-t)):(r=this[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=g(r));return i?o:"0"}function E(){var e=s();return o.ZERO.subTo(this,e),e}function x(){return this.s<0?this.negate():this}function C(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(t=n-e.t,0!=t)return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0}function A(e){var t=1,n;return 0!=(n=e>>>16)&&(e=n,t+=16),0!=(n=e>>8)&&(e=n,t+=8),0!=(n=e>>4)&&(e=n,t+=4),0!=(n=e>>2)&&(e=n,t+=2),0!=(n=e>>1)&&(e=n,t+=1),t}function I(){return this.t<=0?0:this.DB*(this.t-1)+A(this[this.t-1]^this.s&this.DM)}function T(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s}function j(e,t){for(var n=e;n=0;--a)t[a+o+1]=this[a]>>r|s,s=(this[a]&i)<=0;--a)t[a]=0;t[o]=s,t.t=this.t+o+1,t.s=this.s,t.clamp()}function P(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<>r;for(var s=n+1;s>r;r>0&&(t[this.t-n-1]|=(this.s&o)<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()}function R(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t[i]=0;for(i=0;i=0;)e[n]=0;for(n=0;n=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()}function M(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t0?(r.lShiftTo(c,a),i.lShiftTo(c,n)):(r.copyTo(a),i.copyTo(n));var f=a.t,h=a[f-1];if(0!=h){var p=h*(1<1?a[f-2]>>this.F2:0),d=this.FV/p,m=(1<=0&&(n[n.t++]=1,n.subTo(v,n)),o.ONE.dlShiftTo(f,v),v.subTo(a,a);a.t=0;){var _=n[--y]==h?this.DM:Math.floor(n[y]*d+(n[y-1]+g)*m);if((n[y]+=a.am(0,_,n,b,0,f))<_)for(a.dlShiftTo(b,v),n.subTo(v,n);n[y]<--_;)n.subTo(v,n)}null!=t&&(n.drShiftTo(f,t),u!=l&&o.ZERO.subTo(t,t)),n.t=f,n.clamp(),c>0&&n.rShiftTo(c,n),u<0&&o.ZERO.subTo(n,n)}}}function L(e){var t=s();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(o.ZERO)>0&&e.subTo(t,t),t}function F(e){this.m=e}function D(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function U(e){return e}function z(e){e.divRemTo(this.m,null,e)}function q(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function K(e,t){e.squareTo(t),this.reduce(t)}function H(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function V(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t}function $(e){var t=s();return e.copyTo(t),this.reduce(t),t}function G(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e[n]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function Y(e,t){e.squareTo(t),this.reduce(t)}function J(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function Z(){return 0==(this.t>0?1&this[0]:this.s)}function X(e,t){if(e>4294967295||e<1)return o.ONE;var n=s(),r=s(),i=t.convert(this),a=A(e)-1;for(i.copyTo(n);--a>=0;)if(t.sqrTo(n,r),(e&1<0)t.mulTo(r,i,n);else{var u=n;n=r,r=u}return t.revert(n)}function Q(e,t){var n;return n=e<256||t.isEven()?new F(t):new V(t),this.exp(e,n)}function ee(){var e=s();return this.copyTo(e),e}function te(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function re(){return 0==this.t?this.s:this[0]<<16>>16}function ie(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function oe(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function se(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),r=_(n),i=s(),o=s(),a="";for(this.divRemTo(r,i,o);i.signum()>0;)a=(n+o.intValue()).toString(e).substr(1)+a,i.divRemTo(r,i,o);return o.intValue().toString(e)+a}function ae(e,t){this.fromInt(0),null==t&&(t=10);for(var n=this.chunkSize(t),r=Math.pow(t,n),i=!1,s=0,a=0,u=0;u=n&&(this.dMultiply(r),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(a,0)),i&&o.ZERO.subTo(this,this)}function ue(e,t,n){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(o.ONE.shiftLeft(e-1),ge,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(o.ONE.shiftLeft(e-1),this);else{var r=new Array,i=7&e;r.length=1+(e>>3),t.nextBytes(r),i>0?r[0]&=(1<0)for(n>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<=0;)n<8?(r=(this[e]&(1<>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t}function ce(e){return 0==this.compareTo(e)}function fe(e){return this.compareTo(e)<0?this:e}function he(e){return this.compareTo(e)>0?this:e}function pe(e,t,n){var r,i,o=Math.min(e.t,this.t);for(r=0;r>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function Ce(){for(var e=0;e=this.t?0!=this.s:0!=(this[t]&1<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()}function Ne(e){var t=s();return this.addTo(e,t),t}function Me(e){var t=s();return this.subTo(e,t),t}function Le(e){var t=s();return this.multiplyTo(e,t),t}function Fe(){var e=s();return this.squareTo(e),e}function De(e){var t=s();return this.divRemTo(e,t,null),t}function Ue(e){var t=s();return this.divRemTo(e,null,t),t}function ze(e){var t=s(),n=s();return this.divRemTo(e,t,n),new Array(t,n)}function qe(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Ke(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function He(){}function Ve(e){return e}function We(e,t,n){e.multiplyTo(t,n)}function $e(e,t){e.squareTo(t)}function Ge(e){return this.exp(e,new He)}function Ye(e,t,n){var r=Math.min(this.t+e.t,t),i;for(n.s=0,n.t=r;r>0;)n[--r]=0;for(i=n.t-this.t;r=0;)n[r]=0;for(r=Math.max(t-this.t,0);r2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=s();return e.copyTo(t),this.reduce(t),t}function Qe(e){return e}function et(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function tt(e,t){e.squareTo(t),this.reduce(t)}function nt(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function rt(e,t){var n=e.bitLength(),r,i=_(1),o;if(n<=0)return i;r=n<18?1:n<48?3:n<144?4:n<768?5:6,o=n<8?new F(t):t.isEven()?new Ze(t):new V(t);var a=new Array,u=3,l=r-1,c=(1<1){var f=s();for(o.sqrTo(a[1],f);u<=c;)a[u]=s(),o.mulTo(f,a[u-2],a[u]),u+=2}var h=e.t-1,p,d=!0,m=s(),g;for(n=A(e[h])-1;h>=0;){for(n>=l?p=e[h]>>n-l&c:(p=(e[h]&(1<0&&(p|=e[h-1]>>this.DB+n-l)),u=r;0==(1&p);)p>>=1,--u;if((n-=u)<0&&(n+=this.DB,--h),d)a[p].copyTo(i),d=!1;else{for(;u>1;)o.sqrTo(i,m),o.sqrTo(m,i),u-=2;u>0?o.sqrTo(i,m):(g=i,i=m,m=g),o.mulTo(m,a[p],i)}for(;h>=0&&0==(e[h]&1<0&&(t.rShiftTo(o,t),n.rShiftTo(o,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n}function ot(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this[r])%e;return n}function st(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return o.ZERO;for(var n=e.clone(),r=this.clone(),i=_(1),s=_(0),a=_(0),u=_(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),t?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(e,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;r.isEven();)r.rShiftTo(1,r),t?(a.isEven()&&u.isEven()||(a.addTo(this,a),u.subTo(e,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);n.compareTo(r)>=0?(n.subTo(r,n),t&&i.subTo(a,i),s.subTo(u,s)):(r.subTo(n,r),t&&a.subTo(i,a),u.subTo(s,u))}return 0!=r.compareTo(o.ONE)?o.ZERO:u.compareTo(e)>=0?u.subtract(e):u.signum()<0?(u.addTo(e,u),u.signum()<0?u.add(e):u):u}F.prototype.convert=D,F.prototype.revert=U,F.prototype.reduce=z,F.prototype.mulTo=q,F.prototype.sqrTo=K,V.prototype.convert=W,V.prototype.revert=$,V.prototype.reduce=G,V.prototype.mulTo=J,V.prototype.sqrTo=Y,o.prototype.copyTo=b,o.prototype.fromInt=v,o.prototype.fromString=w,o.prototype.clamp=k,o.prototype.dlShiftTo=T,o.prototype.drShiftTo=j,o.prototype.lShiftTo=O,o.prototype.rShiftTo=P,o.prototype.subTo=B,o.prototype.multiplyTo=R,o.prototype.squareTo=N,o.prototype.divRemTo=M,o.prototype.invDigit=H,o.prototype.isEven=Z,o.prototype.exp=X,o.prototype.toString=S,o.prototype.negate=E,o.prototype.abs=x,o.prototype.compareTo=C,o.prototype.bitLength=I,o.prototype.mod=L,o.prototype.modPowInt=Q,o.ZERO=_(0),o.ONE=_(1),He.prototype.convert=Ve,He.prototype.revert=Ve,He.prototype.mulTo=We,He.prototype.sqrTo=$e,Ze.prototype.convert=Xe,Ze.prototype.revert=Qe,Ze.prototype.reduce=et,Ze.prototype.mulTo=nt,Ze.prototype.sqrTo=tt;var at=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],ut=(1<<26)/at[at.length-1],lt,ct,ft;function ht(e){var t,n=this.abs();if(1==n.t&&n[0]<=at[at.length-1]){for(t=0;t>1,e>at.length&&(e=at.length);for(var i=s(),a=0;a>8&255,ct[ft++]^=e>>16&255,ct[ft++]^=e>>24&255,ft>=Ct&&(ft-=Ct)}function mt(){dt((new Date).getTime())}if(o.prototype.chunkSize=ie,o.prototype.toRadix=se,o.prototype.fromRadix=ae,o.prototype.fromNumber=ue,o.prototype.bitwiseTo=pe,o.prototype.changeBit=je,o.prototype.addTo=Re,o.prototype.dMultiply=qe,o.prototype.dAddOffset=Ke,o.prototype.multiplyLowerTo=Ye,o.prototype.multiplyUpperTo=Je,o.prototype.modInt=ot,o.prototype.millerRabin=pt,o.prototype.clone=ee,o.prototype.intValue=te,o.prototype.byteValue=ne,o.prototype.shortValue=re,o.prototype.signum=oe,o.prototype.toByteArray=le,o.prototype.equals=ce,o.prototype.min=fe,o.prototype.max=he,o.prototype.and=me,o.prototype.or=ye,o.prototype.xor=ve,o.prototype.andNot=we,o.prototype.not=ke,o.prototype.shiftLeft=Se,o.prototype.shiftRight=Ee,o.prototype.getLowestSetBit=Ce,o.prototype.bitCount=Ie,o.prototype.testBit=Te,o.prototype.setBit=Oe,o.prototype.clearBit=Pe,o.prototype.flipBit=Be,o.prototype.add=Ne,o.prototype.subtract=Me,o.prototype.multiply=Le,o.prototype.divide=De,o.prototype.remainder=Ue,o.prototype.divideAndRemainder=ze,o.prototype.modPow=rt,o.prototype.modInverse=st,o.prototype.pow=Ge,o.prototype.gcd=it,o.prototype.isProbablePrime=ht,o.prototype.square=Fe,o.prototype.Barrett=Ze,null==ct){var gt;if(ct=new Array,ft=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var yt=new Uint8Array(32);for(window.crypto.getRandomValues(yt),gt=0;gt<32;++gt)ct[ft++]=yt[gt]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var bt=window.crypto.random(32);for(gt=0;gt>>8,ct[ft++]=255>ft=0,mt()}function vt(){if(null==lt){for(mt(),lt=xt(),lt.init(ct),ft=0;ft>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n,e[t+4]=r>>24&255,e[t+5]=r>>16&255,e[t+6]=r>>8&255,e[t+7]=255&r}function m(e,t,n,r,i){var o,s=0;for(o=0;o>>8)-1}function g(e,t,n,r){return m(e,t,n,r,16)}function y(e,t,n,r){return m(e,t,n,r,32)}function b(e,t,n,r){for(var i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,u=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,l=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,b=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,v=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,_=i,w=o,k=s,S=a,E=u,x=l,C=c,A=f,I=h,T=p,j=d,O=m,P=g,B=y,R=b,N=v,M,L=0;L<20;L+=2)M=_+P|0,E^=M<<7|M>>>25,M=E+_|0,I^=M<<9|M>>>23,M=I+E|0,P^=M<<13|M>>>19,M=P+I|0,_^=M<<18|M>>>14,M=x+w|0,T^=M<<7|M>>>25,M=T+x|0,B^=M<<9|M>>>23,M=B+T|0,w^=M<<13|M>>>19,M=w+B|0,x^=M<<18|M>>>14,M=j+C|0,R^=M<<7|M>>>25,M=R+j|0,k^=M<<9|M>>>23,M=k+R|0,C^=M<<13|M>>>19,M=C+k|0,j^=M<<18|M>>>14,M=N+O|0,S^=M<<7|M>>>25,M=S+N|0,A^=M<<9|M>>>23,M=A+S|0,O^=M<<13|M>>>19,M=O+A|0,N^=M<<18|M>>>14,M=_+S|0,w^=M<<7|M>>>25,M=w+_|0,k^=M<<9|M>>>23,M=k+w|0,S^=M<<13|M>>>19,M=S+k|0,_^=M<<18|M>>>14,M=x+E|0,C^=M<<7|M>>>25,M=C+x|0,A^=M<<9|M>>>23,M=A+C|0,E^=M<<13|M>>>19,M=E+A|0,x^=M<<18|M>>>14,M=j+T|0,O^=M<<7|M>>>25,M=O+j|0,I^=M<<9|M>>>23,M=I+O|0,T^=M<<13|M>>>19,M=T+I|0,j^=M<<18|M>>>14,M=N+R|0,P^=M<<7|M>>>25,M=P+N|0,B^=M<<9|M>>>23,M=B+P|0,R^=M<<13|M>>>19,M=R+B|0,N^=M<<18|M>>>14;_=_+i|0,w=w+o|0,k=k+s|0,S=S+a|0,E=E+u|0,x=x+l|0,C=C+c|0,A=A+f|0,I=I+h|0,T=T+p|0,j=j+d|0,O=O+m|0,P=P+g|0,B=B+y|0,R=R+b|0,N=N+v|0,e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=w>>>0&255,e[5]=w>>>8&255,e[6]=w>>>16&255,e[7]=w>>>24&255,e[8]=k>>>0&255,e[9]=k>>>8&255,e[10]=k>>>16&255,e[11]=k>>>24&255,e[12]=S>>>0&255,e[13]=S>>>8&255,e[14]=S>>>16&255,e[15]=S>>>24&255,e[16]=E>>>0&255,e[17]=E>>>8&255,e[18]=E>>>16&255,e[19]=E>>>24&255,e[20]=x>>>0&255,e[21]=x>>>8&255,e[22]=x>>>16&255,e[23]=x>>>24&255,e[24]=C>>>0&255,e[25]=C>>>8&255,e[26]=C>>>16&255,e[27]=C>>>24&255,e[28]=A>>>0&255,e[29]=A>>>8&255,e[30]=A>>>16&255,e[31]=A>>>24&255,e[32]=I>>>0&255,e[33]=I>>>8&255,e[34]=I>>>16&255,e[35]=I>>>24&255,e[36]=T>>>0&255,e[37]=T>>>8&255,e[38]=T>>>16&255,e[39]=T>>>24&255,e[40]=j>>>0&255,e[41]=j>>>8&255,e[42]=j>>>16&255,e[43]=j>>>24&255,e[44]=O>>>0&255,e[45]=O>>>8&255,e[46]=O>>>16&255,e[47]=O>>>24&255,e[48]=P>>>0&255,e[49]=P>>>8&255,e[50]=P>>>16&255,e[51]=P>>>24&255,e[52]=B>>>0&255,e[53]=B>>>8&255,e[54]=B>>>16&255,e[55]=B>>>24&255,e[56]=R>>>0&255,e[57]=R>>>8&255,e[58]=R>>>16&255,e[59]=R>>>24&255,e[60]=N>>>0&255,e[61]=N>>>8&255,e[62]=N>>>16&255,e[63]=N>>>24&255}function v(e,t,n,r){for(var i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,u=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,l=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,b=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,v=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,_=i,w=o,k=s,S=a,E=u,x=l,C=c,A=f,I=h,T=p,j=d,O=m,P=g,B=y,R=b,N=v,M,L=0;L<20;L+=2)M=_+P|0,E^=M<<7|M>>>25,M=E+_|0,I^=M<<9|M>>>23,M=I+E|0,P^=M<<13|M>>>19,M=P+I|0,_^=M<<18|M>>>14,M=x+w|0,T^=M<<7|M>>>25,M=T+x|0,B^=M<<9|M>>>23,M=B+T|0,w^=M<<13|M>>>19,M=w+B|0,x^=M<<18|M>>>14,M=j+C|0,R^=M<<7|M>>>25,M=R+j|0,k^=M<<9|M>>>23,M=k+R|0,C^=M<<13|M>>>19,M=C+k|0,j^=M<<18|M>>>14,M=N+O|0,S^=M<<7|M>>>25,M=S+N|0,A^=M<<9|M>>>23,M=A+S|0,O^=M<<13|M>>>19,M=O+A|0,N^=M<<18|M>>>14,M=_+S|0,w^=M<<7|M>>>25,M=w+_|0,k^=M<<9|M>>>23,M=k+w|0,S^=M<<13|M>>>19,M=S+k|0,_^=M<<18|M>>>14,M=x+E|0,C^=M<<7|M>>>25,M=C+x|0,A^=M<<9|M>>>23,M=A+C|0,E^=M<<13|M>>>19,M=E+A|0,x^=M<<18|M>>>14,M=j+T|0,O^=M<<7|M>>>25,M=O+j|0,I^=M<<9|M>>>23,M=I+O|0,T^=M<<13|M>>>19,M=T+I|0,j^=M<<18|M>>>14,M=N+R|0,P^=M<<7|M>>>25,M=P+N|0,B^=M<<9|M>>>23,M=B+P|0,R^=M<<13|M>>>19,M=R+B|0,N^=M<<18|M>>>14;e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=x>>>0&255,e[5]=x>>>8&255,e[6]=x>>>16&255,e[7]=x>>>24&255,e[8]=j>>>0&255,e[9]=j>>>8&255,e[10]=j>>>16&255,e[11]=j>>>24&255,e[12]=N>>>0&255,e[13]=N>>>8&255,e[14]=N>>>16&255,e[15]=N>>>24&255,e[16]=C>>>0&255,e[17]=C>>>8&255,e[18]=C>>>16&255,e[19]=C>>>24&255,e[20]=A>>>0&255,e[21]=A>>>8&255,e[22]=A>>>16&255,e[23]=A>>>24&255,e[24]=I>>>0&255,e[25]=I>>>8&255,e[26]=I>>>16&255,e[27]=I>>>24&255,e[28]=T>>>0&255,e[29]=T>>>8&255,e[30]=T>>>16&255,e[31]=T>>>24&255}function _(e,t,n,r){b(e,t,n,r)}function w(e,t,n,r){v(e,t,n,r)}var k=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function S(e,t,n,r,i,o,s){var a=new Uint8Array(16),u=new Uint8Array(64),l,c;for(c=0;c<16;c++)a[c]=0;for(c=0;c<8;c++)a[c]=o[c];for(;i>=64;){for(_(u,a,s,k),c=0;c<64;c++)e[t+c]=n[r+c]^u[c];for(l=1,c=8;c<16;c++)l=l+(255&a[c])|0,a[c]=255&l,l>>>=8;i-=64,t+=64,r+=64}if(i>0)for(_(u,a,s,k),c=0;c=64;){for(_(s,o,i,k),u=0;u<64;u++)e[t+u]=s[u];for(a=1,u=8;u<16;u++)a=a+(255&o[u])|0,o[u]=255&a,a>>>=8;n-=64,t+=64}if(n>0)for(_(s,o,i,k),u=0;u>>13|n<<3),r=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(n>>>10|r<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(r>>>7|i<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,s=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|s<<2),a=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(s>>>11|a<<5),u=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(a>>>8|u<<8),this.r[9]=u>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function I(e,t,n,r,i,o){var s=new A(o);return s.update(n,r,i),s.finish(e,t),0}function T(e,t,n,r,i,o){var s=new Uint8Array(16);return I(s,0,n,r,i,o),g(e,t,s,0)}function j(e,t,n,r,i){var o;if(n<32)return-1;for(C(e,0,t,0,n,r,i),I(e,16,e,32,n-32,e),o=0;o<16;o++)e[o]=0;return 0}function O(e,t,n,r,i){var o,s=new Uint8Array(32);if(n<32)return-1;if(x(s,0,32,r,i),0!==T(t,16,t,32,n-32,s))return-1;for(C(e,0,t,0,n,r,i),o=0;o<32;o++)e[o]=0;return 0}function P(e,t){var n;for(n=0;n<16;n++)e[n]=0|t[n]}function B(e){var t,n,r=1;for(t=0;t<16;t++)n=e[t]+r+65535,r=Math.floor(n/65536),e[t]=n-65536*r;e[0]+=r-1+37*(r-1)}function R(e,t,n){for(var r,i=~(n-1),o=0;o<16;o++)r=i&(e[o]^t[o]),e[o]^=r,t[o]^=r}function N(e,n){var r,i,o,s=t(),a=t();for(r=0;r<16;r++)a[r]=n[r];for(B(a),B(a),B(a),i=0;i<2;i++){for(s[0]=a[0]-65517,r=1;r<15;r++)s[r]=a[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),o=s[15]>>16&1,s[14]&=65535,R(a,s,1-o)}for(r=0;r<16;r++)e[2*r]=255&a[r],e[2*r+1]=a[r]>>8}function M(e,t){var n=new Uint8Array(32),r=new Uint8Array(32);return N(n,e),N(r,t),y(n,0,r,0)}function L(e){var t=new Uint8Array(32);return N(t,e),1&t[0]}function F(e,t){var n;for(n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function D(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]+n[r]}function U(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]-n[r]}function z(e,t,n){var r,i,o=0,s=0,a=0,u=0,l=0,c=0,f=0,h=0,p=0,d=0,m=0,g=0,y=0,b=0,v=0,_=0,w=0,k=0,S=0,E=0,x=0,C=0,A=0,I=0,T=0,j=0,O=0,P=0,B=0,R=0,N=0,M=n[0],L=n[1],F=n[2],D=n[3],U=n[4],z=n[5],q=n[6],K=n[7],H=n[8],V=n[9],W=n[10],$=n[11],G=n[12],Y=n[13],J=n[14],Z=n[15];r=t[0],o+=r*M,s+=r*L,a+=r*F,u+=r*D,l+=r*U,c+=r*z,f+=r*q,h+=r*K,p+=r*H,d+=r*V,m+=r*W,g+=r*$,y+=r*G,b+=r*Y,v+=r*J,_+=r*Z,r=t[1],s+=r*M,a+=r*L,u+=r*F,l+=r*D,c+=r*U,f+=r*z,h+=r*q,p+=r*K,d+=r*H,m+=r*V,g+=r*W,y+=r*$,b+=r*G,v+=r*Y,_+=r*J,w+=r*Z,r=t[2],a+=r*M,u+=r*L,l+=r*F,c+=r*D,f+=r*U,h+=r*z,p+=r*q,d+=r*K,m+=r*H,g+=r*V,y+=r*W,b+=r*$,v+=r*G,_+=r*Y,w+=r*J,k+=r*Z,r=t[3],u+=r*M,l+=r*L,c+=r*F,f+=r*D,h+=r*U,p+=r*z,d+=r*q,m+=r*K,g+=r*H,y+=r*V,b+=r*W,v+=r*$,_+=r*G,w+=r*Y,k+=r*J,S+=r*Z,r=t[4],l+=r*M,c+=r*L,f+=r*F,h+=r*D,p+=r*U,d+=r*z,m+=r*q,g+=r*K,y+=r*H,b+=r*V,v+=r*W,_+=r*$,w+=r*G,k+=r*Y,S+=r*J,E+=r*Z,r=t[5],c+=r*M,f+=r*L,h+=r*F,p+=r*D,d+=r*U,m+=r*z,g+=r*q,y+=r*K,b+=r*H,v+=r*V,_+=r*W,w+=r*$,k+=r*G,S+=r*Y,E+=r*J,x+=r*Z,r=t[6],f+=r*M,h+=r*L,p+=r*F,d+=r*D,m+=r*U,g+=r*z,y+=r*q,b+=r*K,v+=r*H,_+=r*V,w+=r*W,k+=r*$,S+=r*G,E+=r*Y,x+=r*J,C+=r*Z,r=t[7],h+=r*M,p+=r*L,d+=r*F,m+=r*D,g+=r*U,y+=r*z,b+=r*q,v+=r*K,_+=r*H,w+=r*V,k+=r*W,S+=r*$,E+=r*G,x+=r*Y,C+=r*J,A+=r*Z,r=t[8],p+=r*M,d+=r*L,m+=r*F,g+=r*D,y+=r*U,b+=r*z,v+=r*q,_+=r*K,w+=r*H,k+=r*V,S+=r*W,E+=r*$,x+=r*G,C+=r*Y,A+=r*J,I+=r*Z,r=t[9],d+=r*M,m+=r*L,g+=r*F,y+=r*D,b+=r*U,v+=r*z,_+=r*q,w+=r*K,k+=r*H,S+=r*V,E+=r*W,x+=r*$,C+=r*G,A+=r*Y,I+=r*J,T+=r*Z,r=t[10],m+=r*M,g+=r*L,y+=r*F,b+=r*D,v+=r*U,_+=r*z,w+=r*q,k+=r*K,S+=r*H,E+=r*V,x+=r*W,C+=r*$,A+=r*G,I+=r*Y,T+=r*J,j+=r*Z,r=t[11],g+=r*M,y+=r*L,b+=r*F,v+=r*D,_+=r*U,w+=r*z,k+=r*q,S+=r*K,E+=r*H,x+=r*V,C+=r*W,A+=r*$,I+=r*G,T+=r*Y,j+=r*J,O+=r*Z,r=t[12],y+=r*M,b+=r*L,v+=r*F,_+=r*D,w+=r*U,k+=r*z,S+=r*q,E+=r*K,x+=r*H,C+=r*V,A+=r*W,I+=r*$,T+=r*G,j+=r*Y,O+=r*J,P+=r*Z,r=t[13],b+=r*M,v+=r*L,_+=r*F,w+=r*D,k+=r*U,S+=r*z,E+=r*q,x+=r*K,C+=r*H,A+=r*V,I+=r*W,T+=r*$,j+=r*G,O+=r*Y,P+=r*J,B+=r*Z,r=t[14],v+=r*M,_+=r*L,w+=r*F,k+=r*D,S+=r*U,E+=r*z,x+=r*q,C+=r*K,A+=r*H,I+=r*V,T+=r*W,j+=r*$,O+=r*G,P+=r*Y,B+=r*J,R+=r*Z,r=t[15],_+=r*M,w+=r*L,k+=r*F,S+=r*D,E+=r*U,x+=r*z,C+=r*q,A+=r*K,I+=r*H,T+=r*V,j+=r*W,O+=r*$,P+=r*G,B+=r*Y,R+=r*J,N+=r*Z,o+=38*w,s+=38*k,a+=38*S,u+=38*E,l+=38*x,c+=38*C,f+=38*A,h+=38*I,p+=38*T,d+=38*j,m+=38*O,g+=38*P,y+=38*B,b+=38*R,v+=38*N,i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,o+=i-1+37*(i-1),i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=u,e[4]=l,e[5]=c,e[6]=f,e[7]=h,e[8]=p,e[9]=d,e[10]=m,e[11]=g,e[12]=y,e[13]=b,e[14]=v,e[15]=_}function q(e,t){z(e,t,t)}function K(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=253;i>=0;i--)q(r,r),2!==i&&4!==i&&z(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function H(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=250;i>=0;i--)q(r,r),1!==i&&z(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function V(e,n,r){var i=new Uint8Array(32),o=new Float64Array(80),s,a,l=t(),c=t(),f=t(),h=t(),p=t(),d=t();for(a=0;a<31;a++)i[a]=n[a];for(i[31]=127&n[31]|64,i[0]&=248,F(o,r),a=0;a<16;a++)c[a]=o[a],h[a]=l[a]=f[a]=0;for(l[0]=h[0]=1,a=254;a>=0;--a)s=i[a>>>3]>>>(7&a)&1,R(l,c,s),R(f,h,s),D(p,l,f),U(l,l,f),D(f,c,h),U(c,c,h),q(h,p),q(d,l),z(l,f,l),z(f,c,p),D(p,l,f),U(l,l,f),q(c,l),U(f,h,d),z(l,f,u),D(l,l,h),z(f,f,l),z(l,h,d),z(h,c,o),q(c,p),R(l,c,s),R(f,h,s);for(a=0;a<16;a++)o[a+16]=l[a],o[a+32]=f[a],o[a+48]=c[a],o[a+64]=h[a];var m=o.subarray(32),g=o.subarray(16);return K(m,m),z(g,g,m),N(e,g),0}function W(e,t){return V(e,t,o)}function $(e,t){return r(t,32),W(e,t)}function G(e,t,n){var r=new Uint8Array(32);return V(r,n,t),w(e,i,r,k)}A.prototype.blocks=function(e,t,n){for(var r=this.fin?0:2048,i,o,s,a,u,l,c,f,h,p,d,m,g,y,b,v,_,w,k,S=this.h[0],E=this.h[1],x=this.h[2],C=this.h[3],A=this.h[4],I=this.h[5],T=this.h[6],j=this.h[7],O=this.h[8],P=this.h[9],B=this.r[0],R=this.r[1],N=this.r[2],M=this.r[3],L=this.r[4],F=this.r[5],D=this.r[6],U=this.r[7],z=this.r[8],q=this.r[9];n>=16;)i=255&e[t+0]|(255&e[t+1])<<8,S+=8191&i,o=255&e[t+2]|(255&e[t+3])<<8,E+=8191&(i>>>13|o<<3),s=255&e[t+4]|(255&e[t+5])<<8,x+=8191&(o>>>10|s<<6),a=255&e[t+6]|(255&e[t+7])<<8,C+=8191&(s>>>7|a<<9),u=255&e[t+8]|(255&e[t+9])<<8,A+=8191&(a>>>4|u<<12),I+=u>>>1&8191,l=255&e[t+10]|(255&e[t+11])<<8,T+=8191&(u>>>14|l<<2),c=255&e[t+12]|(255&e[t+13])<<8,j+=8191&(l>>>11|c<<5),f=255&e[t+14]|(255&e[t+15])<<8,O+=8191&(c>>>8|f<<8),P+=f>>>5|r,h=0,p=h,p+=S*B,p+=E*(5*q),p+=x*(5*z),p+=C*(5*U),p+=A*(5*D),h=p>>>13,p&=8191,p+=I*(5*F),p+=T*(5*L),p+=j*(5*M),p+=O*(5*N),p+=P*(5*R),h+=p>>>13,p&=8191,d=h,d+=S*R,d+=E*B,d+=x*(5*q),d+=C*(5*z),d+=A*(5*U),h=d>>>13,d&=8191,d+=I*(5*D),d+=T*(5*F),d+=j*(5*L),d+=O*(5*M),d+=P*(5*N),h+=d>>>13,d&=8191,m=h,m+=S*N,m+=E*R,m+=x*B,m+=C*(5*q),m+=A*(5*z),h=m>>>13,m&=8191,m+=I*(5*U),m+=T*(5*D),m+=j*(5*F),m+=O*(5*L),m+=P*(5*M),h+=m>>>13,m&=8191,g=h,g+=S*M,g+=E*N,g+=x*R,g+=C*B,g+=A*(5*q),h=g>>>13,g&=8191,g+=I*(5*z),g+=T*(5*U),g+=j*(5*D),g+=O*(5*F),g+=P*(5*L),h+=g>>>13,g&=8191,y=h,y+=S*L,y+=E*M,y+=x*N,y+=C*R,y+=A*B,h=y>>>13,y&=8191,y+=I*(5*q),y+=T*(5*z),y+=j*(5*U),y+=O*(5*D),y+=P*(5*F),h+=y>>>13,y&=8191,b=h,b+=S*F,b+=E*L,b+=x*M,b+=C*N,b+=A*R,h=b>>>13,b&=8191,b+=I*B,b+=T*(5*q),b+=j*(5*z),b+=O*(5*U),b+=P*(5*D),h+=b>>>13,b&=8191,v=h,v+=S*D,v+=E*F,v+=x*L,v+=C*M,v+=A*N,h=v>>>13,v&=8191,v+=I*R,v+=T*B,v+=j*(5*q),v+=O*(5*z),v+=P*(5*U),h+=v>>>13,v&=8191,_=h,_+=S*U,_+=E*D,_+=x*F,_+=C*L,_+=A*M,h=_>>>13,_&=8191,_+=I*N,_+=T*R,_+=j*B,_+=O*(5*q),_+=P*(5*z),h+=_>>>13,_&=8191,w=h,w+=S*z,w+=E*U,w+=x*D,w+=C*F,w+=A*L,h=w>>>13,w&=8191,w+=I*M,w+=T*N,w+=j*R,w+=O*B,w+=P*(5*q),h+=w>>>13,w&=8191,k=h,k+=S*q,k+=E*z,k+=x*U,k+=C*D,k+=A*F,h=k>>>13,k&=8191,k+=I*L,k+=T*M,k+=j*N,k+=O*R,k+=P*B,h+=k>>>13,k&=8191,h=(h<<2)+h|0,h=h+p|0,p=8191&h,h>>>=13,d+=h,S=p,E=d,x=m,C=g,A=y,I=b,T=v,j=_,O=w,P=k,t+=16,n-=16;this.h[0]=S,this.h[1]=E,this.h[2]=x,this.h[3]=C,this.h[4]=A,this.h[5]=I,this.h[6]=T,this.h[7]=j,this.h[8]=O,this.h[9]=P},A.prototype.finish=function(e,t){var n=new Uint16Array(10),r,i,o,s;if(this.leftover){for(s=this.leftover,this.buffer[s++]=1;s<16;s++)this.buffer[s]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,s=2;s<10;s++)this.h[s]+=r,r=this.h[s]>>>13,this.h[s]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,n[0]=this.h[0]+5,r=n[0]>>>13,n[0]&=8191,s=1;s<10;s++)n[s]=this.h[s]+r,r=n[s]>>>13,n[s]&=8191;for(n[9]-=8192,i=(1^r)-1,s=0;s<10;s++)n[s]&=i;for(i=~i,s=0;s<10;s++)this.h[s]=this.h[s]&i|n[s];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,s=1;s<8;s++)o=(this.h[s]+this.pad[s]|0)+(o>>>16)|0,this.h[s]=65535&o;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},A.prototype.update=function(e,t,n){var r,i;if(this.leftover){for(i=16-this.leftover,i>n&&(i=n),r=0;r=16&&(i=n-n%16,this.blocks(e,t,i),t+=i,n-=i),n){for(r=0;r=128;){for(E=0;E<16;E++)x=8*E+G,i[E]=n[x+0]<<24|n[x+1]<<16|n[x+2]<<8|n[x+3],o[E]=n[x+4]<<24|n[x+5]<<16|n[x+6]<<8|n[x+7];for(E=0;E<80;E++)if(s=P,a=B,u=R,l=N,c=M,f=L,h=F,p=D,d=U,m=z,g=q,y=K,b=H,v=V,_=W,w=$,C=D,A=$,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=(M>>>14|H<<18)^(M>>>18|H<<14)^(H>>>9|M<<23),A=(H>>>14|M<<18)^(H>>>18|M<<14)^(M>>>9|H<<23),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=M&L^~M&F,A=H&V^~H&W,I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=Q[2*E],A=Q[2*E+1],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=i[E%16],A=o[E%16],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,k=65535&j|O<<16,S=65535&I|T<<16,C=k,A=S,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=(P>>>28|U<<4)^(U>>>2|P<<30)^(U>>>7|P<<25),A=(U>>>28|P<<4)^(P>>>2|U<<30)^(P>>>7|U<<25),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=P&B^P&R^B&R,A=U&z^U&q^z&q,I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,p=65535&j|O<<16,w=65535&I|T<<16,C=l,A=y,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=k,A=S,I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,l=65535&j|O<<16,y=65535&I|T<<16,B=s,R=a,N=u,M=l,L=c,F=f,D=h,P=p,z=d,q=m,K=g,H=y,V=b,W=v,$=_,U=w,E%16==15)for(x=0;x<16;x++)C=i[x],A=o[x],I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=i[(x+9)%16],A=o[(x+9)%16],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,k=i[(x+1)%16],S=o[(x+1)%16],C=(k>>>1|S<<31)^(k>>>8|S<<24)^k>>>7,A=(S>>>1|k<<31)^(S>>>8|k<<24)^(S>>>7|k<<25),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,k=i[(x+14)%16],S=o[(x+14)%16],C=(k>>>19|S<<13)^(S>>>29|k<<3)^k>>>6,A=(S>>>19|k<<13)^(k>>>29|S<<3)^(S>>>6|k<<26),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,i[x]=65535&j|O<<16,o[x]=65535&I|T<<16;C=P,A=U,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[0],A=t[0],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[0]=P=65535&j|O<<16,t[0]=U=65535&I|T<<16,C=B,A=z,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[1],A=t[1],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[1]=B=65535&j|O<<16,t[1]=z=65535&I|T<<16,C=R,A=q,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[2],A=t[2],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[2]=R=65535&j|O<<16,t[2]=q=65535&I|T<<16,C=N,A=K,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[3],A=t[3],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[3]=N=65535&j|O<<16,t[3]=K=65535&I|T<<16,C=M,A=H,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[4],A=t[4],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[4]=M=65535&j|O<<16,t[4]=H=65535&I|T<<16,C=L,A=V,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[5],A=t[5],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[5]=L=65535&j|O<<16,t[5]=V=65535&I|T<<16,C=F,A=W,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[6],A=t[6],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[6]=F=65535&j|O<<16,t[6]=W=65535&I|T<<16,C=D,A=$,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[7],A=t[7],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[7]=D=65535&j|O<<16,t[7]=$=65535&I|T<<16,G+=128,r-=128}return r}function te(e,t,n){var r=new Int32Array(8),i=new Int32Array(8),o=new Uint8Array(256),s,a=n;for(r[0]=1779033703,r[1]=3144134277,r[2]=1013904242,r[3]=2773480762,r[4]=1359893119,r[5]=2600822924,r[6]=528734635,r[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,ee(r,i,t,n),n%=128,s=0;s=0;--i)r=n[i/8|0]>>(7&i)&1,re(e,t,r),ne(t,e),ne(e,e),re(e,t,r)}function se(e,n){var r=[t(),t(),t(),t()];P(r[0],f),P(r[1],h),P(r[2],a),z(r[3],f,h),oe(e,r,n)}function ae(e,n,i){var o=new Uint8Array(64),s=[t(),t(),t(),t()],a;for(i||r(n,32),te(o,n,32),o[0]&=248,o[31]&=127,o[31]|=64,se(s,o),ie(e,s),a=0;a<32;a++)n[a+32]=e[a];return 0}var ue=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function le(e,t){var n,r,i,o;for(r=63;r>=32;--r){for(n=0,i=r-32,o=r-12;i>8,t[i]-=256*n;t[i]+=n,t[r]=0}for(n=0,i=0;i<32;i++)t[i]+=n-(t[31]>>4)*ue[i],n=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=n*ue[i];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=255&t[r]}function ce(e){var t=new Float64Array(64),n;for(n=0;n<64;n++)t[n]=e[n];for(n=0;n<64;n++)e[n]=0;le(e,t)}function fe(e,n,r,i){var o=new Uint8Array(64),s=new Uint8Array(64),a=new Uint8Array(64),u,l,c=new Float64Array(64),f=[t(),t(),t(),t()];te(o,i,32),o[0]&=248,o[31]&=127,o[31]|=64;var h=r+64;for(u=0;u>7&&U(e[0],s,e[0]),z(e[3],e[0],e[1]),0)}function pe(e,n,r,i){var o,s,a=new Uint8Array(32),u=new Uint8Array(64),l=[t(),t(),t(),t()],c=[t(),t(),t(),t()];if(s=-1,r<64)return-1;if(he(c,i))return-1;for(o=0;o=0},e.sign.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(64);return ae(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(Be(e),64!==e.length)throw new Error("bad secret key size");for(var t=new Uint8Array(32),n=0;n=this._buffer.length},o.prototype.remainder=function(){return this._buffer.slice(this._offset)},o.prototype.skip=function(e){this._offset+=e},o.prototype.expand=function(){this._size*=2;var e=i.alloc(this._size);this._buffer.copy(e,0),this._buffer=e},o.prototype.readPart=function(){return{data:this.readBuffer()}},o.prototype.readBuffer=function(){var e=this._buffer.readUInt32BE(this._offset);this._offset+=4,r.ok(this._offset+e<=this._buffer.length,"length out of bounds at +0x"+this._offset.toString(16)+" (data truncated?)");var t=this._buffer.slice(this._offset,this._offset+e);return this._offset+=e,t},o.prototype.readString=function(){return this.readBuffer().toString()},o.prototype.readCString=function(){for(var e=this._offset;ethis._size;)this.expand();this._buffer.writeUInt32BE(e.length,this._offset),this._offset+=4,e.copy(this._buffer,this._offset),this._offset+=e.length},o.prototype.writeString=function(e){this.writeBuffer(i.from(e,"utf8"))},o.prototype.writeCString=function(e){for(;this._offset+1+e.length>this._size;)this.expand();this._buffer.write(e,this._offset),this._offset+=e.length,this._buffer[this._offset++]=0},o.prototype.writeInt=function(e){for(;this._offset+4>this._size;)this.expand();this._buffer.writeUInt32BE(e,this._offset),this._offset+=4},o.prototype.writeInt64=function(e){if(r.buffer(e,"value"),e.length>8){for(var t=e.slice(0,e.length-8),n=0;nthis._size;)this.expand();e.copy(this._buffer,this._offset),this._offset+=8},o.prototype.writeChar=function(e){for(;this._offset+1>this._size;)this.expand();this._buffer[this._offset++]=e},o.prototype.writePart=function(e){this.writeBuffer(e.data)},o.prototype.write=function(e){for(;this._offset+e.length>this._size;)this.expand();e.copy(this._buffer,this._offset),this._offset+=e.length}},function(e,t,n){e.exports={read:f,readPkcs8:d,write:h,writePkcs8:A,pkcs8ToBuffer:C,readECDSACurve:v,writeECDSACurve:P};var r=n(27),i=n(102),o=n(31).Buffer,s=n(56),a=n(47),u=n(46),l=n(52),c=n(113);function f(e,t){return c.read(e,t,"pkcs8")}function h(e,t){return c.write(e,t,"pkcs8")}function p(e,t){return r.strictEqual(e.peek(),i.Ber.Integer,t+" is not an Integer"),a.mpNormalize(e.readString(i.Ber.Integer,!0))}function d(e,t,n){n.peek()===i.Ber.Integer&&(r.strictEqual(t,"private","unexpected Integer at start of public key"),n.readString(i.Ber.Integer,!0)),n.readSequence();var o=n.offset+n.length,s=n.readOID();switch(s){case"1.2.840.113549.1.1.1":return n._offset=o,"public"===t?m(n):g(n);case"1.2.840.10040.4.1":return"public"===t?y(n):b(n);case"1.2.840.10045.2.1":return"public"===t?w(n):_(n);case"1.3.101.112":return"public"===t?k(n):E(n);case"1.3.101.110":return"public"===t?S(n):x(n);default:throw new Error("Unknown key type OID "+s)}}function m(e){e.readSequence(i.Ber.BitString),e.readByte(),e.readSequence();var t=p(e,"modulus"),n=p(e,"exponent"),r={type:"rsa",source:e.originalInput,parts:[{name:"e",data:n},{name:"n",data:t}]};return new u(r)}function g(e){e.readSequence(i.Ber.OctetString),e.readSequence();var t=p(e,"version");r.equal(t[0],0,"unknown RSA private key version");var n=p(e,"modulus"),o=p(e,"public exponent"),s=p(e,"private exponent"),a=p(e,"prime1"),u=p(e,"prime2"),c=p(e,"exponent1"),f=p(e,"exponent2"),h=p(e,"iqmp"),d={type:"rsa",parts:[{name:"n",data:n},{name:"e",data:o},{name:"d",data:s},{name:"iqmp",data:h},{name:"p",data:a},{name:"q",data:u},{name:"dmodp",data:c},{name:"dmodq",data:f}]};return new l(d)}function y(e){e.readSequence();var t=p(e,"p"),n=p(e,"q"),r=p(e,"g");e.readSequence(i.Ber.BitString),e.readByte();var o=p(e,"y"),s={type:"dsa",parts:[{name:"p",data:t},{name:"q",data:n},{name:"g",data:r},{name:"y",data:o}]};return new u(s)}function b(e){e.readSequence();var t=p(e,"p"),n=p(e,"q"),r=p(e,"g");e.readSequence(i.Ber.OctetString);var o=p(e,"x"),s=a.calculateDSAPublic(r,t,o),u={type:"dsa",parts:[{name:"p",data:t},{name:"q",data:n},{name:"g",data:r},{name:"y",data:s},{name:"x",data:o}]};return new l(u)}function v(e){var t,n,u,l,c;if(e.peek()===i.Ber.OID){var f=e.readOID();for(n=Object.keys(s.curves),u=0;u=this.validFrom.getTime()&&e.getTime()0&&-1===this.issuer.purposes.indexOf("ca"))&&this.isSignedByKey(e.subjectKey))},b.prototype.getExtension=function(e){r.string(e,"keyOrOid");var t=this.getExtensions().filter(function(t){return"x509"===t.format?t.oid===e:"openssh"===t.format&&t.name===e})[0];return t},b.prototype.getExtensions=function(){var e=[],t=this.signatures.x509;t&&t.extras&&t.extras.exts&&t.extras.exts.forEach(function(t){t.format="x509",e.push(t)});var n=this.signatures.openssh;return n&&n.exts&&n.exts.forEach(function(t){t.format="openssh",e.push(t)}),e},b.prototype.isSignedByKey=function(e){if(f.assertCompatible(e,h,[1,2],"issuerKey"),void 0!==this.issuerKey)return this.issuerKey.fingerprint("sha512").matches(e);var t=Object.keys(this.signatures)[0],n=m[t].verify(this,e);return n&&(this.issuerKey=e),n},b.prototype.signWith=function(e){f.assertCompatible(e,p,[1,2],"key");for(var t=Object.keys(m),n=!1,r=0;r0&&-1===c.indexOf("serverAuth")&&c.push("serverAuth"),m.length>0&&-1===c.indexOf("clientAuth")&&c.push("clientAuth"),(m.length>0||h.length>0)&&(-1===c.indexOf("keyAgreement")&&c.push("keyAgreement"),"rsa"===t.type&&-1===c.indexOf("encryption")&&c.push("encryption"))}var g=new b({subjects:o,issuer:o[0],subjectKey:t.toPublic(),issuerKey:t.toPublic(),signatures:{},serial:l,validFrom:s,validUntil:a,purposes:c});return g.signWith(t),g},b.create=function(e,t,n,o,s){var a;a=Array.isArray(e)?e:[e],r.arrayOfObject(a),a.forEach(function(e){f.assertCompatible(e,d,[1,0],"subject")}),f.assertCompatible(t,h,[1,0],"key"),p.isPrivateKey(t)&&(t=t.toPublic()),f.assertCompatible(n,d,[1,0],"issuer"),f.assertCompatible(o,p,[1,2],"issuer key"),r.optionalObject(s,"options"),void 0===s&&(s={}),r.optionalObject(s.validFrom,"options.validFrom"),r.optionalObject(s.validUntil,"options.validUntil");var u=s.validFrom,l=s.validUntil;if(void 0===u&&(u=new Date),void 0===l){r.optionalNumber(s.lifetime,"options.lifetime");var c=s.lifetime;void 0===c&&(c=31536e4),l=new Date,l.setTime(l.getTime()+1e3*c)}r.optionalBuffer(s.serial,"options.serial");var m=s.serial;void 0===m&&(m=i.from("0000000000000001","hex"));var g=s.purposes;void 0===g&&(g=[]),-1===g.indexOf("signature")&&g.push("signature"),!0===s.ca&&(-1===g.indexOf("ca")&&g.push("ca"),-1===g.indexOf("crl")&&g.push("crl"));var y=a.filter(function(e){return"host"===e.type}),v=a.filter(function(e){return"user"===e.type});y.length>0&&-1===g.indexOf("serverAuth")&&g.push("serverAuth"),v.length>0&&-1===g.indexOf("clientAuth")&&g.push("clientAuth"),(v.length>0||y.length>0)&&(-1===g.indexOf("keyAgreement")&&g.push("keyAgreement"),"rsa"===t.type&&-1===g.indexOf("encryption")&&g.push("encryption"));var _=new b({subjects:a,issuer:n,subjectKey:t,issuerKey:o.toPublic(),signatures:{},serial:m,validFrom:u,validUntil:l,purposes:g});return _.signWith(o),_},b.parse=function(e,t,n){"string"!=typeof e&&r.buffer(e,"data"),void 0===t&&(t="auto"),r.string(t,"format"),"string"==typeof n&&(n={filename:n}),r.optionalObject(n,"options"),void 0===n&&(n={}),r.optionalString(n.filename,"options.filename"),void 0===n.filename&&(n.filename="(unnamed)"),r.object(m[t],"formats[format]");try{var i=m[t].read(e,n);return i}catch(e){throw new g(n.filename,t,e)}},b.isCertificate=function(e,t){return f.isCompatible(e,b,t)},b.prototype._sshpkApiVersion=[1,1],b._oldVersionDetect=function(e){return[1,0]}},function(e,t,n){e.exports=g;var r=n(27),i=n(56),o=n(15),s=n(205),a=n(101),u=n(95),l=n(13),c=n(47),f=n(102),h=n(31).Buffer,p=/^([*]|[a-z0-9][a-z0-9\-]{0,62})(?:\.([*]|[a-z0-9][a-z0-9\-]{0,62}))*$/i,d={cn:"2.5.4.3",o:"2.5.4.10",ou:"2.5.4.11",l:"2.5.4.7",s:"2.5.4.8",c:"2.5.4.6",sn:"2.5.4.4",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",street:"2.5.4.9",x500UniqueIdentifier:"2.5.4.45",role:"2.5.4.72",telephoneNumber:"2.5.4.20",description:"2.5.4.13",dc:"0.9.2342.19200300.100.1.25",uid:"0.9.2342.19200300.100.1.1",mail:"0.9.2342.19200300.100.1.3",title:"2.5.4.12",gn:"2.5.4.42",initials:"2.5.4.43",pseudonym:"2.5.4.65",emailAddress:"1.2.840.113549.1.9.1"},m={};function g(e){var t=this;if(r.object(e,"options"),r.arrayOfObject(e.components,"options.components"),this.components=e.components,this.componentLookup={},this.components.forEach(function(e){e.name&&!e.oid&&(e.oid=d[e.name]),e.oid&&!e.name&&(e.name=m[e.oid]),void 0===t.componentLookup[e.name]&&(t.componentLookup[e.name]=[]),t.componentLookup[e.name].push(e)}),this.componentLookup.cn&&this.componentLookup.cn.length>0&&(this.cn=this.componentLookup.cn[0].value),r.optionalString(e.type,"options.type"),void 0===e.type)1===this.components.length&&this.componentLookup.cn&&1===this.componentLookup.cn.length&&this.componentLookup.cn[0].value.match(p)?(this.type="host",this.hostname=this.componentLookup.cn[0].value):this.componentLookup.dc&&this.components.length===this.componentLookup.dc.length?(this.type="host",this.hostname=this.componentLookup.dc.map(function(e){return e.value}).join(".")):this.componentLookup.uid&&this.components.length===this.componentLookup.uid.length?(this.type="user",this.uid=this.componentLookup.uid[0].value):this.componentLookup.cn&&1===this.componentLookup.cn.length&&this.componentLookup.cn[0].value.match(p)?(this.type="host",this.hostname=this.componentLookup.cn[0].value):this.componentLookup.uid&&1===this.componentLookup.uid.length?(this.type="user",this.uid=this.componentLookup.uid[0].value):this.componentLookup.mail&&1===this.componentLookup.mail.length?(this.type="email",this.email=this.componentLookup.mail[0].value):this.componentLookup.cn&&1===this.componentLookup.cn.length?(this.type="user",this.uid=this.componentLookup.cn[0].value):this.type="unknown";else if(this.type=e.type,"host"===this.type)this.hostname=e.hostname;else if("user"===this.type)this.uid=e.uid;else{if("email"!==this.type)throw new Error("Unknown type "+this.type);this.email=e.email}}Object.keys(d).forEach(function(e){m[d[e]]=e}),g.prototype.toString=function(){return this.components.map(function(e){var t=e.name.toUpperCase();t=t.replace(/=/g,"\\=");var n=e.value;return n=n.replace(/,/g,"\\,"),t+"="+n}).join(", ")},g.prototype.get=function(e,t){r.string(e,"name");var n=this.componentLookup[e];if(void 0!==n&&0!==n.length){if(!t&&n.length>1)throw new Error("Multiple values for attribute "+e);return t?n.map(function(e){return e.value}):n[0].value}},g.prototype.toArray=function(e){return this.components.map(function(e){return{name:e.name,value:e.value}})};var y=/[^a-zA-Z0-9 '(),+.\/:=?-]/,b=/[^\x00-\x7f]/;function v(e,t){if("**"===e||"**"===t)return!0;var n=e.split("."),r=t.split(".");if(n.length!==r.length)return!1;for(var i=0;i0;){var o;if(null!==(o=/^,/.exec(i)))t[++n]="",i=i.slice(o[0].length);else if(null!==(o=/^\\,/.exec(i)))t[n]+=",",i=i.slice(o[0].length);else if(null!==(o=/^\\./.exec(i)))t[n]+=o[0],i=i.slice(o[0].length);else{if(null===(o=/^[^\\,]+/.exec(i)))throw new Error("Failed to parse DN");t[n]+=o[0],i=i.slice(o[0].length)}}var s=t.map(function(e){e=e.trim();for(var t=e.indexOf("=");t>0&&"\\"===e.charAt(t-1);)t=e.indexOf("=",t+1);if(-1===t)throw new Error("Failed to parse DN");var n=e.slice(0,t).toLowerCase().replace(/\\=/g,"="),r=e.slice(t+1);return{name:n,value:r}});return new g({components:s})},g.fromArray=function(e){return r.arrayOfObject(e,"components"),e.forEach(function(e){if(r.object(e,"component"),r.string(e.name,"component.name"),!h.isBuffer(e.value)&&"string"!=typeof e.value)throw new Error("Invalid component value")}),new g({components:e})},g.parseAsn1=function(e,t){var n=[];e.readSequence(t);for(var r=e.offset+e.length;e.offset= 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=f-h,E=Math.floor,x=String.fromCharCode,C;function A(e){throw new RangeError(k[e])}function I(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function T(e,t){var n=e.split("@"),r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(w,".");var i=e.split("."),o=I(i,t).join(".");return r+o}function j(e){for(var t=[],n=0,r=e.length,i,o;n=55296&&i<=56319&&n65535&&(e-=65536,t+=x(e>>>10&1023|55296),e=56320|1023&e),t+=x(e),t}).join("")}function P(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:f}function B(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function R(e,t,n){var r=0;for(e=n?E(e/m):e>>1,e+=E(e/t);e>S*p>>1;r+=f)e=E(e/S);return E(r+(S+1)*e/(e+d))}function N(e){var t=[],n=e.length,r,i=0,o=y,s=g,a,u,l,d,m,v,_,w,k;for(a=e.lastIndexOf(b),a<0&&(a=0),u=0;u=128&&A("not-basic"),t.push(e.charCodeAt(u));for(l=a>0?a+1:0;l=n&&A("invalid-input"),_=P(e.charCodeAt(l++)),(_>=f||_>E((c-i)/m))&&A("overflow"),i+=_*m,w=v<=s?h:v>=s+p?p:v-s,!(_E(c/k)&&A("overflow"),m*=k;r=t.length+1,s=R(i-d,r,0==d),E(i/r)>c-o&&A("overflow"),o+=E(i/r),i%=r,t.splice(i++,0,o)}return O(t)}function M(e){var t,n,r,i,o,s,a,u,l,d,m,v=[],_,w,k,S;for(e=j(e),_=e.length,t=y,n=0,o=g,s=0;s<_;++s)m=e[s],m<128&&v.push(x(m));for(r=i=v.length,i&&v.push(b);r<_;){for(a=c,s=0;s<_;++s)m=e[s],m>=t&&mE((c-n)/w)&&A("overflow"),n+=(a-t)*w,t=a,s=0;s<_;++s)if(m=e[s],mc&&A("overflow"),m==t){for(u=n,l=f;d=l<=o?h:l>=o+p?p:l-o,!(uthis.root.open(j(e)),t=>this.config.set(B(e),t),t=>this.spec.set(R(e),t),e=>this.version.set(C,e)],t)}open(e){this.closed?(S("opening at: %s",this.path),r([e=>this.root.open(j(e)),e=>this._isInitialized(e),e=>this._openLock(this.path,e),(e,t)=>{S("aquired repo.lock"),this.lockfile=e,t()},e=>{S("creating datastore"),this.datastore=d.create("datastore",l.join(this.path,"datastore"),this.options),S("creating blocks");const t=d.create("blocks",l.join(this.path,"blocks"),this.options);v(t,this.options.storageBackendOptions.blocks,e)},(e,t)=>{this.blocks=e,t()},e=>{S("creating keystore"),this.keys=d.create("keys",l.join(this.path,"keys"),this.options),e()},e=>{this.closed=!1,S("all opened"),e()}],t=>{t&&this.lockfile?this._closeLock(n=>{n?S("error removing lock",n):this.lockfile=null,e(t)}):e(t)})):setImmediate(()=>e(new Error("repo is already open")))}_getLocker(){return"string"==typeof this.options.lock?(u(x[this.options.lock],"Unknown lock type: "+this.options.lock),x[this.options.lock]):(u(this.options.lock,"No lock provided"),this.options.lock)}_openLock(e,t){this._locker.lock(e,(e,n)=>{if(e)return t(e,null);u.strictEqual(typeof n.close,"function","Locks must have a close method"),t(null,n)})}_closeLock(e){if(this.lockfile)return this.lockfile.close(e);e()}_isInitialized(e){S("init check"),o({config:e=>this.config.exists(e),spec:e=>this.spec.exists(e),version:e=>this.version.check(C,e)},(t,n)=>{if(S("init",t,n),t&&!n.config)return e(Object.assign(new Error("repo is not initialized yet"),{code:k.ERR_REPO_NOT_INITIALIZED,path:this.path}));e(t)})}close(e){if(this.closed)return e(new Error("repo is already closed"));S("closing at: %s",this.path),i([e=>this.apiAddr.delete(O(e)),e=>{s([this.blocks,this.keys,this.datastore],(e,t)=>e.close(t),e)},e=>{S("unlocking"),this.closed=!0,this._closeLock(e)},e=>{this.lockfile=null,e()}],t=>e(t))}exists(e){this.version.exists(e)}stat(e,t){"function"==typeof e&&(t=e,e={}),e=Object.assign({},{human:!1},e),o({storageMax:e=>this.config.get("Datastore.StorageMax",(t,n)=>{e(null,new f(t?E:n))}),version:e=>this.version.get(e),blocks:e=>this.blocks.query({},(t,n)=>{n=n||[];const r=new f(n.length);let i=new f(0);n.forEach(e=>{i=i.plus(e.value.byteLength).plus(e.key._buf.byteLength)}),e(t,{count:r,size:i})}),datastore:e=>I(this.datastore,e),keys:e=>I(this.keys,e)},(n,r)=>{if(n)return t(n);let i=r.blocks.size.plus(r.datastore).plus(r.keys);e.human&&(i=i.div(1048576)),t(null,{repoPath:this.path,storageMax:r.storageMax,version:r.version,numObjects:r.blocks.count,repoSize:i})})}}function I(e,t){h(e.query({}),p((e,t)=>e.plus(t.value.byteLength).plus(t.key._buf.byteLength),new f(0),t))}function T(e,t){return n=>{t(n&&!e(n)?n:null)}}function j(e){return T(e=>"Already open"===e.message,e)}function O(e){return T(e=>e&&(e.code===k.ERR_REPO_NOT_INITIALIZED||e.message.startsWith("ENOENT")),e)}function P(e){const t=Object.assign({},_,e);return t.storageBackends=Object.assign({},_.storageBackends,t.storageBackends),t.storageBackendOptions=Object.assign({},_.storageBackendOptions,t.storageBackendOptions),t}function B(e){return e.datastore=Object.assign({},w,a(e,"datastore",{})),e}function R(e){const t=Object.assign({},w.Spec,a(e,"datastore.Spec",{}));return{type:t.type,mounts:t.mounts.map(e=>({mountpoint:e.mountpoint,type:e.child.type,path:e.child.path,shardFunc:e.child.shardFunc}))}}e.exports=A,e.exports.repoVersion=C,e.exports.errors=k},function(e,t){e.exports=function(){var e,t,n,r,i=function(i,o){e?e(i,o):i?(r=i,n=o):t=o};return i.resolve=function(i){if(e)throw new Error("already resolved");if(e=i,!e)throw new Error("no read cannot resolve!"+e);t&&i(null,t),n&&i(r,n)},i.abort=function(e){i.resolve(function(t,n){n(e||!0)})},i}},function(e,t){t.endianness=function(){return"LE"},t.hostname=function(){return"undefined"!=typeof location?location.hostname:""},t.loadavg=function(){return[]},t.uptime=function(){return 0},t.freemem=function(){return Number.MAX_VALUE},t.totalmem=function(){return Number.MAX_VALUE},t.cpus=function(){return[]},t.type=function(){return"Browser"},t.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},t.networkInterfaces=t.getNetworkInterfaces=function(){return{}},t.arch=function(){return"javascript"},t.platform=function(){return"browser"},t.tmpdir=t.tmpDir=function(){return"/tmp"},t.EOL="\n",t.homedir=function(){return"/"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=(0,s.default)(e);return(0,i.default)(function(e,t){n(e[0],t)},t,1)};var r=n(800),i=a(r),o=n(41),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,n){"use strict";const r=n(26);class i{constructor(e,t){this.child=e,this.transform=t}open(e){this.child.open(e)}put(e,t,n){this.child.put(this.transform.convert(e),t,n)}get(e,t){this.child.get(this.transform.convert(e),t)}has(e,t){this.child.has(this.transform.convert(e),t)}delete(e,t){this.child.delete(this.transform.convert(e),t)}batch(){const e=this.child.batch();return{put:(t,n)=>{e.put(this.transform.convert(t),n)},delete:t=>{e.delete(this.transform.convert(t))},commit:t=>{e.commit(t)}}}query(e){return r(this.child.query(e),r.map(e=>(e.key=this.transform.invert(e.key),e)))}close(e){this.child.close(e)}}e.exports=i},function(e,t,n){"use strict";e.exports=i;var r=[""," "," "," "," "," "," "," "," "," "];function i(e,t,n){if(e+="",t-=e.length,t<=0)return e;if(n||0===n||(n=" "),n+=""," "===n&&t<10)return r[t]+e;for(var i="";1&t&&(i+=n),t>>=1,t;)n+=n;return i+e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var r=n(66),i=f(r),o=n(104),s=f(o),a=n(135),u=f(a),l=n(41),c=f(l);function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t,n){n=(0,u.default)(n||i.default);var r=(0,c.default)(t);if(!e())return n(null);var o=function(t){if(t)return n(t);if(e())return r(o);var i=(0,s.default)(arguments,1);n.apply(null,[null].concat(i))};r(o)}e.exports=t.default},function(e,t,n){"use strict";(function(t){const r=n(26),i=n(821),o=n(33).utils.asyncFilter,s=n(33).utils.asyncSort,a=n(33).Key,u=n(33).Errors,l=n(834);class c{constructor(e,t){let r;t&&t.db?(r=t.db,delete t.db):r=n(839),this.db=i(l(r(e),{valueEncoding:"binary"}),Object.assign({},t,{compression:!1}),e=>{if(e)throw e})}open(e){this.db.open(t=>{if(t)return e(u.dbOpenFailedError(t));e()})}put(e,t,n){this.db.put(e.toString(),t,e=>{if(e)return n(u.dbWriteFailedError(e));n()})}get(e,t){this.db.get(e.toString(),(e,n)=>{if(e)return t(u.notFoundError(e));t(null,n)})}has(e,t){this.db.get(e.toString(),(e,n)=>{if(e)return e.notFound?void t(null,!1):void t(e);t(null,!0)})}delete(e,t){this.db.del(e.toString(),e=>{if(e)return t(u.dbDeleteFailedError(e));t()})}close(e){this.db.close(e)}batch(){const e=[];return{put:(t,n)=>{e.push({type:"put",key:t.toString(),value:n})},delete:t=>{e.push({type:"del",key:t.toString()})},commit:t=>{this.db.batch(e,t)}}}query(e){let n=!0;null!=e.keysOnly&&(n=!e.keysOnly);const i=this.db.db.iterator({keys:!0,values:n,keyAsBuffer:!0}),u=(e,r)=>{if(e)return i.end(t=>{r(t||e)});i.next((e,o,s)=>{if(e)return r(e);if(null==e&&null==o&&null==s)return i.end(e=>{r(e||!0)});const u={key:new a(o,!1)};n&&(u.value=t.from(s)),r(null,u)})};let l=[u],c=[];if(null!=e.prefix){const t=e.prefix;c.push((e,n)=>n(null,e.key.toString().startsWith(t)))}if(null!=e.filters&&(c=c.concat(e.filters)),l=l.concat(c.map(e=>o(e))),null!=e.orders&&(l=l.concat(e.orders.map(e=>s(e)))),null!=e.offset){let t=0;l.push(r.filter(()=>t++>=e.offset))}return null!=e.limit&&l.push(r.take(e.limit)),r.apply(null,l)}}e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(62);t.MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7},t.TAG={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,REGEXP:35,MIME:36},t.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31},t.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23},t.SYMS={NULL:Symbol("null"),UNDEFINED:Symbol("undef"),PARENT:Symbol("parent"),BREAK:Symbol("break"),STREAM:Symbol("stream")},t.SHIFT32=Math.pow(2,32),t.SHIFT16=Math.pow(2,16),t.MAX_SAFE_HIGH=2097151,t.NEG_ONE=new r(-1),t.TEN=new r(10),t.TWO=new r(2),t.PARENT={ARRAY:0,OBJECT:1,MAP:2,TAG:3,BYTE_STRING:4,UTF8_STRING:5}},function(e,t,n){"use strict";(function(r){const i=n(18),o=n(60);class s{constructor(e,t,n){0!==n&&i(n,"A DAGNode requires it's serialized size"),this._data=e||r.alloc(0),this._links=t||[],this._serializedSize=n}toJSON(){return this._json||(this._json=Object.freeze({data:this.data,links:this.links.map(e=>e.toJSON()),size:this.size})),Object.assign({},this._json)}toString(){return`DAGNode `}get data(){return this._data}set data(e){throw new Error("Can't set property: 'data' is immutable")}get links(){return this._links}set links(e){throw new Error("Can't set property: 'links' is immutable")}get size(){return void 0===this._size&&(this._size=this.links.reduce((e,t)=>e+t.size,this._serializedSize)),this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}}t=e.exports=o(s,{className:"DAGNode",symbolName:"@ipld/js-ipld-dag-pb/dagnode"}),t.create=n(233),t.clone=n(889),t.addLink=n(890),t.rmLink=n(891)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(875),{serialize:i}=n(234),o=n(235),s=o.linkSort,a=n(232),u=n(117);function l(e,n,o){if("function"==typeof e?(o=e,e=void 0):"string"==typeof e&&(e=t.from(e)),"function"==typeof n&&(o=n,n=[]),!t.isBuffer(e))return o(new Error("Passed 'data' is not a buffer or a string!"));n=n.map(e=>u.isDAGLink(e)?e:u.util.createDagLinkFromB58EncodedHash(e)),n=r(n,s),i({data:e,links:n},(t,r)=>t?o(t):o(null,new a(e,n,r.length)))}e.exports=l}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(9),o=n(70),s=o(n(886)),a=n(455),u=n(117),l=n(232),c=n(55),f=n(11),h=n(16);function p(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};const o=t.hashAlg||a.defaultHashAlg;let s=t.version;void 0===s&&(s="sha2-256"===o?0:1),f([t=>{if(r.isBuffer(e))return t(null,e);d(e,t)},(e,t)=>c(e,o,t),(e,t)=>t(null,new i(s,a.multicodec,e))],n)}function d(e,t){let n,{data:r,links:i=[]}=e;!l.isDAGNode(e)&&i&&(i=i.map(e=>u.isDAGLink(e)?e:u.util.createDagLinkFromB58EncodedHash(e)));try{n=s.PBNode.encode(g({data:r,links:i}))}catch(e){return t(e)}t(null,n)}function m(e,t){const n=s.PBNode.decode(e),i=n.Links.map(e=>new u(e.Name,e.Tsize,e.Hash)),o=null==n.Data?r.alloc(0):n.Data;h(()=>t(null,new l(o,i,e.length)))}function g(e){const t={};return e.data&&e.data.length>0?t.Data=e.data:t.Data=null,e.links&&e.links.length>0?t.Links=e.links.map(e=>({Hash:e.cid.buffer,Name:e.name,Tsize:e.size})):t.Links=null,t}t=e.exports,t.serialize=d,t.deserialize=m,t.cid=p}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(117),{cid:o}=n(234);function s(e){let t;return e.data&&e.data.length>0?(t=r.alloc(e.data.length),e.data.copy(t)):t=r.alloc(0),t}function a(e){return e.links.slice()}function u(e,t){return r.compare(e.nameAsBuffer,t.nameAsBuffer)}function l(e,t,n){"function"==typeof t&&(n=t,t={}),o(e,t,(r,o)=>{if(r)return n(r);n(null,new i(t.name||"",e.size,o))})}t=e.exports,t.cloneData=s,t.cloneLinks=a,t.linkSort=u,t.toDAGLink=l}).call(this,n(0).Buffer)},function(e,t,n){var r=n(19);function i(e,t){var n=function(){return new r.aes.Algorithm(e,t)};r.cipher.registerAlgorithm(e,n)}n(458),n(459),n(34),e.exports=r.aes=r.aes||{},r.aes.startEncrypting=function(e,t,n,r){var i=m({key:e,output:n,decrypt:!1,mode:r});return i.start(t),i},r.aes.createEncryptionCipher=function(e,t){return m({key:e,output:null,decrypt:!1,mode:t})},r.aes.startDecrypting=function(e,t,n,r){var i=m({key:e,output:n,decrypt:!0,mode:r});return i.start(t),i},r.aes.createDecryptionCipher=function(e,t){return m({key:e,output:null,decrypt:!0,mode:t})},r.aes.Algorithm=function(e,t){o||h();var n=this;n.name=e,n.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return d(n._w,e,t,!1)},decrypt:function(e,t){return d(n._w,e,t,!0)}}}),n._init=!1},r.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t=e.key,n;if("string"!=typeof t||16!==t.length&&24!==t.length&&32!==t.length){if(r.util.isArray(t)&&(16===t.length||24===t.length||32===t.length)){n=t,t=r.util.createBuffer();for(var i=0;i>>=2;for(var i=0;i>8^255&p^99,a[n]=p,u[p]=n,d=e[p],i=e[n],s=e[i],h=e[s],m=d<<24^p<<16^p<<8^p^d,g=(i^s^h)<<24^(n^h)<<16^(n^s^h)<<8^n^i^h;for(var y=0;y<4;++y)c[y][n]=m,f[y][p]=g,m=m<<24|m>>>8,g=g<<24|g>>>8;0===n?n=r=1:(n=i^e[e[e[i^h]]],r^=e[e[r]])}}function p(e,t){for(var n=e.slice(0),r,i=1,o=n.length,u=o+6+1,c=s*u,h=o;h>>16&255]<<24^a[r>>>8&255]<<16^a[255&r]<<8^a[r>>>24]^l[i]<<24,i++):o>6&&h%o==4&&(r=a[r>>>24]<<24^a[r>>>16&255]<<16^a[r>>>8&255]<<8^a[255&r]),n[h]=n[h-o]^r;if(t){var p,d=f[0],m=f[1],g=f[2],y=f[3],b=n.slice(0);c=n.length;for(var h=0,v=c-s;h>>24]]^m[a[p>>>16&255]]^g[a[p>>>8&255]]^y[a[255&p]];n=b}return n}function d(e,t,n,r){var i=e.length/4-1,o,s,l,h,p,d,m,g,y,b,v,_;r?(o=f[0],s=f[1],l=f[2],h=f[3],p=u):(o=c[0],s=c[1],l=c[2],h=c[3],p=a),d=t[0]^e[0],m=t[r?3:1]^e[1],g=t[2]^e[2],y=t[r?1:3]^e[3];for(var w=3,k=1;k>>24]^s[m>>>16&255]^l[g>>>8&255]^h[255&y]^e[++w],v=o[m>>>24]^s[g>>>16&255]^l[y>>>8&255]^h[255&d]^e[++w],_=o[g>>>24]^s[y>>>16&255]^l[d>>>8&255]^h[255&m]^e[++w],y=o[y>>>24]^s[d>>>16&255]^l[m>>>8&255]^h[255&g]^e[++w],d=b,m=v,g=_;n[0]=p[d>>>24]<<24^p[m>>>16&255]<<16^p[g>>>8&255]<<8^p[255&y]^e[++w],n[r?3:1]=p[m>>>24]<<24^p[g>>>16&255]<<16^p[y>>>8&255]<<8^p[255&d]^e[++w],n[2]=p[g>>>24]<<24^p[y>>>16&255]<<16^p[d>>>8&255]<<8^p[255&m]^e[++w],n[r?1:3]=p[y>>>24]<<24^p[d>>>16&255]<<16^p[m>>>8&255]<<8^p[255&g]^e[++w]}function m(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),n="AES-"+t,i;i=e.decrypt?r.cipher.createDecipher(n,e.key):r.cipher.createCipher(n,e.key);var o=i.start;return i.start=function(e,t){var n=null;t instanceof r.util.ByteBuffer&&(n=t,t={}),t=t||{},t.output=n,t.iv=e,o.call(i,t)},i}},function(e,t,n){"use strict";var r=n(4).Buffer,i=n(934),o;function s(){this.negative=0,this.words=null,this.length=0}s.fromNumber=function(e){var t=new s;return t.words=[67108863&e],t.length=1,t},s.fromBuffer=function(e){var t=new s;return t.words=new Array(10),t.words[0]=(3&e[28])<<24|e[29]<<16|e[30]<<8|e[31],t.words[1]=(15&e[25])<<22|e[26]<<14|e[27]<<6|e[28]>>>2,t.words[2]=(63&e[22])<<20|e[23]<<12|e[24]<<4|e[25]>>>4,t.words[3]=(255&e[19])<<18|e[20]<<10|e[21]<<2|e[22]>>>6,t.words[4]=(3&e[15])<<24|e[16]<<16|e[17]<<8|e[18],t.words[5]=(15&e[12])<<22|e[13]<<14|e[14]<<6|e[15]>>>2,t.words[6]=(63&e[9])<<20|e[10]<<12|e[11]<<4|e[12]>>>4,t.words[7]=(255&e[6])<<18|e[7]<<10|e[8]<<2|e[9]>>>6,t.words[8]=(3&e[2])<<24|e[3]<<16|e[4]<<8|e[5],t.words[9]=e[0]<<14|e[1]<<6|e[2]>>>2,t.length=10,t.strip()},s.prototype.toBuffer=function(){for(var e=this.words,t=this.length;t<10;++t)e[t]=0;return r.from([e[9]>>>14&255,e[9]>>>6&255,(63&e[9])<<2|e[8]>>>24&3,e[8]>>>16&255,e[8]>>>8&255,255&e[8],e[7]>>>18&255,e[7]>>>10&255,e[7]>>>2&255,(3&e[7])<<6|e[6]>>>20&63,e[6]>>>12&255,e[6]>>>4&255,(15&e[6])<<4|e[5]>>>22&15,e[5]>>>14&255,e[5]>>>6&255,(63&e[5])<<2|e[4]>>>24&3,e[4]>>>16&255,e[4]>>>8&255,255&e[4],e[3]>>>18&255,e[3]>>>10&255,e[3]>>>2&255,(3&e[3])<<6|e[2]>>>20&63,e[2]>>>12&255,e[2]>>>4&255,(15&e[2])<<4|e[1]>>>22&15,e[1]>>>14&255,e[1]>>>6&255,(63&e[1])<<2|e[0]>>>24&3,e[0]>>>16&255,e[0]>>>8&255,255&e[0]])},s.prototype.clone=function(){var e=new s;e.words=new Array(this.length);for(var t=0;t1&&0==(0|this.words[this.length-1]);)this.length--;return this},s.prototype.normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.isEven=function(){return 0==(1&this.words[0])},s.prototype.isOdd=function(){return 1==(1&this.words[0])},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.ucmp=function(e){if(this.length!==e.length)return this.length>e.length?1:-1;for(var t=this.length-1;t>=0;--t)if(this.words[t]!==e.words[t])return this.words[t]>e.words[t]?1:-1;return 0},s.prototype.gtOne=function(){return this.length>1||this.words[0]>1},s.prototype.isOverflow=function(){return this.ucmp(s.n)>=0},s.prototype.isHigh=function(){return 1===this.ucmp(s.nh)},s.prototype.bitLengthGT256=function(){return this.length>10||10===this.length&&this.words[9]>4194303},s.prototype.iuaddn=function(e){this.words[0]+=e;for(var t=0;this.words[t]>67108863&&te.length?(t=this,n=e):(t=e,n=this);for(var r=0,i=0;r>>26}for(;0!==i&&r>>26;if(this.length=t.length,0!==i)this.words[this.length++]=i;else if(t!==this)for(;r0?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;i>26,this.words[i]=67108863&s}for(;0!==o&&i>26,this.words[i]=67108863&s;if(0===o&&i>>26,c=67108863&s,f=Math.max(0,a-e.length+1),h=Math.min(a,t.length-1);f<=h;f++){var p=a-f,d=e.words[p],m=t.words[f],g=d*m+c;l+=g/67108864|0,c=67108863&g}n.words[a]=c,s=l}return 0!==s&&(n.words[n.length++]=s),n.strip()},s.umulTo10x10=Math.imul?i.umulTo10x10:s.umulTo,s.umulnTo=function(e,t,n){if(0===t)return n.words=[0],n.length=1,n;for(var r=0,i=0;r0?(n.words[r]=i,n.length=e.length+1):n.length=e.length,n},s.prototype.umul=function(e){var t=new s;return t.words=new Array(this.length+e.length),10===this.length&&10===e.length?s.umulTo10x10(this,e,t):1===this.length?s.umulnTo(e,this.words[0],t):1===e.length?s.umulnTo(this,e.words[0],t):s.umulTo(this,e,t)},s.prototype.isplit=function(e){e.length=Math.min(this.length,9);for(var t=0;t>>22,n=r}return n>>>=22,this.words[t-10]=n,0===n&&this.length>10?this.length-=10:this.length-=9,this},s.prototype.fireduce=function(){return this.isOverflow()&&this.isub(s.n),this},s.prototype.ureduce=function(){var e=this.clone().isplit(s.tmp).umul(s.nc).iadd(s.tmp);return e.bitLengthGT256()&&(e=e.isplit(s.tmp).umul(s.nc).iadd(s.tmp),e.bitLengthGT256()&&(e=e.isplit(s.tmp).umul(s.nc).iadd(s.tmp))),e.fireduce()},s.prototype.ishrn=function(e){for(var t=(1<=0;--r){var o=this.words[r];this.words[r]=i<>>e,i=o&t}return this.length>1&&0===this.words[this.length-1]&&(this.length-=1),this},s.prototype.uinvm=function(){for(var e=this.clone(),t=s.n.clone(),n=s.fromNumber(1),r=s.fromNumber(0),i=s.fromNumber(0),o=s.fromNumber(1);e.isEven()&&t.isEven();){for(var a=1,u=1;0==(e.words[0]&u)&&0==(t.words[0]&u)&&a<26;++a,u<<=1);e.ishrn(a),t.ishrn(a)}for(var l=t.clone(),c=e.clone();!e.isZero();){for(var f=0,h=1;0==(e.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(e.ishrn(f);f-- >0;)(n.isOdd()||r.isOdd())&&(n.iadd(l),r.isub(c)),n.ishrn(1),r.ishrn(1);for(var p=0,d=1;0==(t.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(t.ishrn(p);p-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(l),o.isub(c)),i.ishrn(1),o.ishrn(1);e.ucmp(t)>=0?(e.isub(t),n.isub(i),r.isub(o)):(t.isub(e),i.isub(n),o.isub(r))}if(1===i.negative){i.negative=0;var m=i.ureduce();return m.negative^=1,m.normSign().iadd(s.n)}return i.ureduce()},s.prototype.imulK=function(){this.words[this.length]=0,this.words[this.length+1]=0,this.length+=2;for(var e=0,t=0;e0?this.isub(s.p):this.strip(),this},s.prototype.redNeg=function(){return this.isZero()?s.fromNumber(0):s.p.sub(this)},s.prototype.redAdd=function(e){return this.clone().redIAdd(e)},s.prototype.redIAdd=function(e){return this.iadd(e),this.ucmp(s.p)>=0&&this.isub(s.p),this},s.prototype.redIAdd7=function(){return this.iuaddn(7),this.ucmp(s.p)>=0&&this.isub(s.p),this},s.prototype.redSub=function(e){return this.clone().redISub(e)},s.prototype.redISub=function(e){return this.isub(e),0!==this.negative&&this.iadd(s.p),this},s.prototype.redMul=function(e){return this.umul(e).redIReduce()},s.prototype.redSqr=function(){return this.umul(this).redIReduce()},s.prototype.redSqrt=function(){if(this.isZero())return this.clone();for(var e=this.redSqr(),t=e.redSqr(),n=t.redSqr().redMul(t),r=n.redMul(e),i=r.redMul(this),o=i,s=0;s<54;++s)o=o.redSqr().redSqr().redSqr().redSqr().redMul(i);for(o=o.redSqr().redSqr().redSqr().redSqr().redMul(r),s=0;s<5;++s)o=o.redSqr().redSqr().redSqr().redSqr().redMul(i);return o=o.redSqr().redSqr().redSqr().redSqr().redMul(n),o=o.redSqr().redSqr().redSqr().redSqr().redSqr().redSqr().redMul(n),0===o.redSqr().ucmp(this)?o:null},s.prototype.redInvm=function(){for(var e=this.clone(),t=s.p.clone(),n=s.fromNumber(1),r=s.fromNumber(0),i;e.gtOne()&&t.gtOne();){for(var o=0,a=1;0==(e.words[0]&a)&&o<26;++o,a<<=1);if(o>0)for(e.ishrn(o);o-- >0;)n.isOdd()&&n.iadd(s.p),n.ishrn(1);for(var u=0,l=1;0==(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.ishrn(u);u-- >0;)r.isOdd()&&r.iadd(s.p),r.ishrn(1);e.ucmp(t)>=0?(e.isub(t),n.isub(r)):(t.isub(e),r.isub(n))}return i=1===e.length&&1===e.words[0]?n:r,0!==i.negative&&i.iadd(s.p),0!==i.negative?(i.negative=0,i.redIReduce().redNeg()):i.redIReduce()},s.prototype.getNAF=function(e){for(var t=[],n=1<>1,o=this.clone();!o.isZero();){for(var s=0,a=1;0==(o.words[0]&a)&&s<26;++s,a<<=1)t.push(0);if(0!==s)o.ishrn(s);else{var u=o.words[0]&r;if(u>=i)t.push(i-u),o.iuaddn(u-i).ishrn(1);else if(t.push(u),o.words[0]-=u,!o.isZero()){for(s=e-1;s>0;--s)t.push(0);o.ishrn(e)}}}return t},s.prototype.inspect=function(){if(this.isZero())return"0";for(var e=this.toBuffer().toString("hex"),t=0;"0"===e[t];++t);return e.slice(t)},s.n=s.fromBuffer(r.from("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","hex")),s.nh=s.n.clone().ishrn(1),s.nc=s.fromBuffer(r.from("000000000000000000000000000000014551231950B75FC4402DA1732FC9BEBF","hex")),s.p=s.fromBuffer(r.from("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","hex")),s.psn=s.p.sub(s.n),s.tmp=new s,s.tmp.words=new Array(10),o=s.fromNumber(1),o.words[3]=0,e.exports=s},function(e,t,n){var r=n(4).Buffer;function i(e){r.isBuffer(e)||(e=r.from(e));for(var t=e.length/4|0,n=new Array(t),i=0;i>>24]^s[c>>>16&255]^a[f>>>8&255]^u[255&h]^t[y++],d=o[c>>>24]^s[f>>>16&255]^a[h>>>8&255]^u[255&l]^t[y++],m=o[f>>>24]^s[h>>>16&255]^a[l>>>8&255]^u[255&c]^t[y++],g=o[h>>>24]^s[l>>>16&255]^a[c>>>8&255]^u[255&f]^t[y++],l=p,c=d,f=m,h=g;return p=(r[l>>>24]<<24|r[c>>>16&255]<<16|r[f>>>8&255]<<8|r[255&h])^t[y++],d=(r[c>>>24]<<24|r[f>>>16&255]<<16|r[h>>>8&255]<<8|r[255&l])^t[y++],m=(r[f>>>24]<<24|r[h>>>16&255]<<16|r[l>>>8&255]<<8|r[255&c])^t[y++],g=(r[h>>>24]<<24|r[l>>>16&255]<<16|r[c>>>8&255]<<8|r[255&f])^t[y++],p>>>=0,d>>>=0,m>>>=0,g>>>=0,[p,d,m,g]}var a=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var n=[],r=[],i=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,u=0;u<256;++u){var l=a^a<<1^a<<2^a<<3^a<<4;l=l>>>8^255&l^99,n[s]=l,r[l]=s;var c=e[s],f=e[c],h=e[f],p=257*e[l]^16843008*l;i[0][s]=p<<24|p>>>8,i[1][s]=p<<16|p>>>16,i[2][s]=p<<8|p>>>24,i[3][s]=p,p=16843009*h^65537*f^257*c^16843008*s,o[0][l]=p<<24|p>>>8,o[1][l]=p<<16|p>>>16,o[2][l]=p<<8|p>>>24,o[3][l]=p,0===s?s=a=1:(s=c^e[e[e[h^c]]],a^=e[e[a]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:i,INV_SUB_MIX:o}}();function l(e){this._key=i(e),this._reset()}l.blockSize=16,l.keySize=32,l.prototype.blockSize=l.blockSize,l.prototype.keySize=l.keySize,l.prototype._reset=function(){for(var e=this._key,t=e.length,n=t+6,r=4*(n+1),i=[],o=0;o>>24,s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s],s^=a[o/t|0]<<24):t>6&&o%t==4&&(s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s]),i[o]=i[o-t]^s}for(var l=[],c=0;c>>24]]^u.INV_SUB_MIX[1][u.SBOX[h>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[h>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&h]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=l},l.prototype.encryptBlockRaw=function(e){return e=i(e),s(e,this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},l.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),n=r.allocUnsafe(16);return n.writeUInt32BE(t[0],0),n.writeUInt32BE(t[1],4),n.writeUInt32BE(t[2],8),n.writeUInt32BE(t[3],12),n},l.prototype.decryptBlock=function(e){e=i(e);var t=e[1];e[1]=e[3],e[3]=t;var n=s(e,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=r.allocUnsafe(16);return o.writeUInt32BE(n[0],0),o.writeUInt32BE(n[3],4),o.writeUInt32BE(n[2],8),o.writeUInt32BE(n[1],12),o},l.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},e.exports.AES=l},function(e,t){function n(e){return e}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var r=n(66),i=a(r),o=n(290),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){return function(n,r,o,a){a=a||i.default;var u=!1,l;n(r,function(n,r,i){o(n,function(r,o){r?i(r):e(o)&&!l?(u=!0,l=t(!0,n),i(null,s.default)):i()})},function(e){e?a(e):a(null,u?l:t(!1))})}}e.exports=t.default},function(e,t,n){"use strict";const r=n(70),i=n(136),o=n(983),s=n(18),a=n(61),u=n(89),l=n(9),c=n(984),f=n(986),h=n(55),p=r(n(987)),d=n(988);class m{constructor(e){this.full=e,this.wantlist=new Map,this.blocks=new Map}get empty(){return 0===this.blocks.size&&0===this.wantlist.size}addEntry(e,t,n){s(e&&l.isCID(e),"must be a valid cid");const r=e.buffer.toString(),i=this.wantlist.get(r);i?(i.priority=t,i.cancel=Boolean(n)):this.wantlist.set(r,new d(e,t,n))}addBlock(e){s(i.isBlock(e),"must be a valid cid");const t=e.cid.buffer.toString();this.blocks.set(t,e)}cancel(e){s(l.isCID(e),"must be a valid cid");const t=e.buffer.toString();this.wantlist.delete(t),this.addEntry(e,0,!0)}serializeToBitswap100(){const e={wantlist:{entries:Array.from(this.wantlist.values()).map(e=>({block:e.cid.buffer,priority:Number(e.priority),cancel:Boolean(e.cancel)}))},blocks:Array.from(this.blocks.values()).map(e=>e.data)};return this.full&&(e.wantlist.full=!0),p.Message.encode(e)}serializeToBitswap110(){const e={wantlist:{entries:Array.from(this.wantlist.values()).map(e=>({block:e.cid.buffer,priority:Number(e.priority),cancel:Boolean(e.cancel)}))},payload:[]};return this.full&&(e.wantlist.full=!0),this.blocks.forEach(t=>{e.payload.push({prefix:t.cid.prefix,data:t.data})}),p.Message.encode(e)}equals(e){const t=(e,t)=>{if(e.equals&&"function"==typeof e.equals)return e.equals(t)};return!(this.full!==e.full||!o(this.wantlist,e.wantlist,t)||!o(this.blocks,e.blocks,t))}get[Symbol.toStringTag](){const e=Array.from(this.wantlist.keys()),t=Array.from(this.blocks.keys());return`BitswapMessage `}}m.deserialize=((e,t)=>{let n;try{n=p.Message.decode(e)}catch(e){return u(()=>t(e))}const r=n.wantlist&&n.wantlist.full||!1,o=new m(r);return n.wantlist&&n.wantlist.entries.forEach(e=>{let n;try{n=new l(e.block)}catch(e){return t(e)}o.addEntry(n,e.priority,e.cancel)}),n.blocks.length>0?a(n.blocks,(e,n)=>{h(e,"sha2-256",(r,s)=>{if(r)return n(r);let a;try{a=new l(s)}catch(r){return t(r)}o.addBlock(new i(e,a)),n()})},e=>{if(e)return t(e);t(null,o)}):n.payload.length>0?a(n.payload,(e,t)=>{if(!e.prefix||!e.data)return u(t);const n=f(e.prefix),r=n[0],s=n[1],a=n[2];h(e.data,a,(n,a)=>{if(n)return t(n);let u;try{u=new l(r,c[s.toString("16")],a)}catch(n){return t(n)}o.addBlock(new i(e.data,u)),t()})},e=>{if(e)return t(e);t(null,o)}):void t(null,o)}),m.Entry=d,e.exports=m},function(e,t,n){"use strict";const{sortBy:r}=n(120),i=n(989);class o{constructor(e){this.set=new Map,this._stats=e}get length(){return this.set.size}add(e,t){const n=e.buffer.toString(),r=this.set.get(n);r?(r.inc(),r.priority=t):(this.set.set(n,new i(e,t)),this._stats&&this._stats.push(null,"wantListSize",1))}remove(e){const t=e.buffer.toString(),n=this.set.get(t);n&&(n.dec(),n.hasRefs()||(this.set.delete(t),this._stats&&this._stats.push(null,"wantListSize",-1)))}removeForce(e){this.set.has(e)&&this.set.delete(e)}forEach(e){return this.set.forEach(e)}entries(){return this.set.entries()}sortedEntries(){return new Map(r(e=>e[1].key,Array.from(this.set.entries())))}contains(e){const t=e.buffer.toString();return this.set.get(t)}}o.Entry=i,e.exports=o},function(e,t,n){var r=n(493);function i(e,t,n){var i=null==e?void 0:r(e,t);return void 0===i?n:i}e.exports=i},function(e,t,n){var r=n(121),i=r(Object,"create");e.exports=i},function(e,t,n){var r=n(1014),i=n(1015),o=n(1016),s=n(1017),a=n(1018);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function u(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function l(){try{return window.localStorage}catch(e){}}t=e.exports=n(1060),t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:l(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(u())}).call(this,n(2))},function(e,t){t.encode=function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t},t.decode=function(e){for(var t={},n=e.split("&"),r=0,i=n.length;r=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function u(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function l(){try{return window.localStorage}catch(e){}}t=e.exports=n(1077),t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:l(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(u())}).call(this,n(2))},function(e,t,n){(function(t){e.exports=f;var r=n(5)("simple-peer"),i=n(1084),o=n(1),s=n(148),a=n(1085),u=65536,l=5e3,c=5e3;function f(e){var t=this;if(!(t instanceof f))return new f(e);if(t._id=s(4).toString("hex").slice(0,7),t._debug("new peer %o",e),e=Object.assign({allowHalfOpen:!1},e),a.Duplex.call(t,e),t.channelName=e.initiator?e.channelName||s(20).toString("hex"):null,t.initiator=e.initiator||!1,t.channelConfig=e.channelConfig||f.channelConfig,t.config=Object.assign({},f.config,e.config),t.offerOptions=e.offerOptions||{},t.answerOptions=e.answerOptions||{},t.sdpTransform=e.sdpTransform||function(e){return e},t.streams=e.streams||(e.stream?[e.stream]:[]),t.trickle=void 0===e.trickle||e.trickle,t.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,t.iceCompleteTimeout=e.iceCompleteTimeout||l,t.destroyed=!1,t.connected=!1,t.remoteAddress=void 0,t.remoteFamily=void 0,t.remotePort=void 0,t.localAddress=void 0,t.localFamily=void 0,t.localPort=void 0,t._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:i(),!t._wrtc)throw"undefined"==typeof window?p("No WebRTC support: Specify `opts.wrtc` option in this environment","ERR_WEBRTC_SUPPORT"):p("No WebRTC support: Not a supported browser","ERR_WEBRTC_SUPPORT");t._pcReady=!1,t._channelReady=!1,t._iceComplete=!1,t._iceCompleteTimer=null,t._channel=null,t._pendingCandidates=[],t._isNegotiating=!t.initiator,t._batchedNegotiation=!1,t._queuedNegotiation=!1,t._sendersAwaitingStable=[],t._senderMap=new Map,t._firstStable=!0,t._closingInterval=null,t._remoteTracks=[],t._remoteStreams=[],t._chunk=null,t._cb=null,t._interval=null;try{t._pc=new t._wrtc.RTCPeerConnection(t.config)}catch(e){t.destroy(e)}t._isReactNativeWebrtc="number"==typeof t._pc._peerConnectionId,t._pc.oniceconnectionstatechange=function(){t._onIceStateChange()},t._pc.onicegatheringstatechange=function(){t._onIceStateChange()},t._pc.onsignalingstatechange=function(){t._onSignalingStateChange()},t._pc.onicecandidate=function(e){t._onIceCandidate(e)},t.initiator?t._setupData({channel:t._pc.createDataChannel(t.channelName,t.channelConfig)}):t._pc.ondatachannel=function(e){t._setupData(e)},t.streams&&t.streams.forEach(function(e){t.addStream(e)}),t._pc.ontrack=function(e){t._onTrack(e)},t.initiator&&t._needsNegotiation(),t._onFinishBound=function(){t._onFinish()},t.once("finish",t._onFinishBound)}function h(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}function p(e,t){var n=new Error(e);return n.code=t,n}o(f,a.Duplex),f.WEBRTC_SUPPORT=!!i(),f.config={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:global.stun.twilio.com:3478?transport=udp"}],sdpSemantics:"unified-plan"},f.channelConfig={},Object.defineProperty(f.prototype,"bufferSize",{get:function(){var e=this;return this._channel&&this._channel.bufferedAmount||0}}),f.prototype.address=function(){var e=this;return{port:this.localPort,family:this.localFamily,address:this.localAddress}},f.prototype.signal=function(e){var t=this;if(t.destroyed)throw p("cannot signal after peer is destroyed","ERR_SIGNALING");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}t._debug("signal()"),e.renegotiate&&t.initiator&&(t._debug("got request to renegotiate"),t._needsNegotiation()),e.transceiverRequest&&t.initiator&&(t._debug("got request for transceiver"),t.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(t._pc.localDescription&&t._pc.localDescription.type&&t._pc.remoteDescription&&t._pc.remoteDescription.type?t._addIceCandidate(e.candidate):t._pendingCandidates.push(e.candidate)),e.sdp&&t._pc.setRemoteDescription(new t._wrtc.RTCSessionDescription(e)).then(function(){t.destroyed||(t._pendingCandidates.forEach(function(e){t._addIceCandidate(e)}),t._pendingCandidates=[],"offer"===t._pc.remoteDescription.type&&t._createAnswer())}).catch(function(e){t.destroy(p(e,"ERR_SET_REMOTE_DESCRIPTION"))}),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||t.destroy(p("signal() called with invalid signal data","ERR_SIGNALING"))},f.prototype._addIceCandidate=function(e){var t=this;t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e)).catch(function(e){if("closed"!==t._pc.signalingState&&"Failed to set ICE candidate; RTCPeerConnection is closed."===e.message)return t._debug("ignoring incorrect wrtc error");t.destroy(p(e,"ERR_ADD_ICE_CANDIDATE"))})},f.prototype.send=function(e){var t=this;this._channel.send(e)},f.prototype.addTransceiver=function(e,t){var n=this;if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(e,t),this._needsNegotiation()}catch(e){this.destroy(e)}else this.emit("signal",{transceiverRequest:{kind:e,init:t}})},f.prototype.addStream=function(e){var t=this;t._debug("addStream()"),e.getTracks().forEach(function(n){t.addTrack(n,e)})},f.prototype.addTrack=function(e,t){var n=this;this._debug("addTrack()");var r=this._senderMap.get(e)||new Map,i=r.get(t);i?i.removed?this.destroy(p("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):this.destroy(p("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED"):(i=this._pc.addTrack(e,t),r.set(t,i),this._senderMap.set(e,r),this._needsNegotiation())},f.prototype.replaceTrack=function(e,t,n){var r=this;this._debug("replaceTrack()");var i=this._senderMap.get(e),o=i?i.get(n):null;o||this.destroy(p("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED"),t&&this._senderMap.set(t,i),null!=o.replaceTrack?o.replaceTrack(t):this.destroy(p("replaceTrack is not supported in this browser","ERR_UNSUPPORTED_REPLACETRACK"))},f.prototype.removeTrack=function(e,t){var n=this;this._debug("removeSender()");var r=this._senderMap.get(e),i=r?r.get(t):null;i||this.destroy(p("Cannot remove track that was never added.","ERR_TRACK_NOT_ADDED"));try{i.removed=!0,this._pc.removeTrack(i)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?this._sendersAwaitingStable.push(i):this.destroy(e)}this._needsNegotiation()},f.prototype.removeStream=function(e){var t=this;t._debug("removeSenders()"),e.getTracks().forEach(function(n){t.removeTrack(n,e)})},f.prototype._needsNegotiation=function(){var e=this;e._debug("_needsNegotiation"),e._batchedNegotiation||(e._batchedNegotiation=!0,setTimeout(function(){e._batchedNegotiation=!1,e._debug("starting batched negotiation"),e.negotiate()},0))},f.prototype.negotiate=function(){var e=this;e.initiator?e._isNegotiating?(e._queuedNegotiation=!0,e._debug("already negotiating, queueing")):(e._debug("start negotiation"),setTimeout(()=>{e._createOffer()},0)):e._isNegotiating||(e._debug("requesting negotiation from initiator"),e.emit("signal",{renegotiate:!0})),e._isNegotiating=!0},f.prototype.destroy=function(e){var t=this;this._destroy(e,function(){})},f.prototype._destroy=function(e,t){var n=this;if(!this.destroyed){if(this._debug("destroy (error: %s)",e&&(e.message||e)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this.destroyed=!0,this.connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(e){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(e){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,e&&this.emit("error",e),this.emit("close"),t()}},f.prototype._setupData=function(e){var t=this;if(!e.channel)return t.destroy(p("Data channel event is missing `channel` property","ERR_DATA_CHANNEL"));t._channel=e.channel,t._channel.binaryType="arraybuffer","number"==typeof t._channel.bufferedAmountLowThreshold&&(t._channel.bufferedAmountLowThreshold=65536),t.channelName=t._channel.label,t._channel.onmessage=function(e){t._onChannelMessage(e)},t._channel.onbufferedamountlow=function(){t._onChannelBufferedAmountLow()},t._channel.onopen=function(){t._onChannelOpen()},t._channel.onclose=function(){t._onChannelClose()},t._channel.onerror=function(e){t.destroy(p(e,"ERR_DATA_CHANNEL"))};var n=!1;t._closingInterval=setInterval(function(){t._channel&&"closing"===t._channel.readyState?(n&&t._onChannelClose(),n=!0):n=!1},5e3)},f.prototype._read=function(){},f.prototype._write=function(e,t,n){var r=this;if(this.destroyed)return n(p("cannot write after peer is destroyed","ERR_DATA_CHANNEL"));if(this.connected){try{this.send(e)}catch(e){return this.destroy(p(e,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>65536?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=e,this._cb=n},f.prototype._onFinish=function(){var e=this;function t(){setTimeout(function(){e.destroy()},1e3)}e.destroyed||(e.connected?t():e.once("connect",t))},f.prototype._startIceCompleteTimeout=function(){var e=this;e.destroyed||e._iceCompleteTimer||(e._debug("started iceComplete timeout"),e._iceCompleteTimer=setTimeout(function(){e._iceComplete||(e._iceComplete=!0,e._debug("iceComplete timeout completed"),e.emit("iceTimeout"),e.emit("_iceComplete"))},e.iceCompleteTimeout))},f.prototype._createOffer=function(){var e=this;e.destroyed||e._pc.createOffer(e.offerOptions).then(function(t){function n(){e._debug("createOffer success"),e.destroyed||(e.trickle||e._iceComplete?i():e.once("_iceComplete",i))}function r(t){e.destroy(p(t,"ERR_SET_LOCAL_DESCRIPTION"))}function i(){if(!e.destroyed){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp})}}e.destroyed||(e.trickle||e.allowHalfTrickle||(t.sdp=h(t.sdp)),t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t).then(n).catch(r))}).catch(function(t){e.destroy(p(t,"ERR_CREATE_OFFER"))})},f.prototype._requestMissingTransceivers=function(){var e=this;e._pc.getTransceivers&&e._pc.getTransceivers().forEach(t=>{!t.mid&&t.sender.track&&e.addTransceiver(t.sender.track.kind)})},f.prototype._createAnswer=function(){var e=this;e.destroyed||e._pc.createAnswer(e.answerOptions).then(function(t){function n(){e.destroyed||(e.trickle||e._iceComplete?i():e.once("_iceComplete",i))}function r(t){e.destroy(p(t,"ERR_SET_LOCAL_DESCRIPTION"))}function i(){if(!e.destroyed){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp}),e.initiator||e._requestMissingTransceivers()}}e.destroyed||(e.trickle||e.allowHalfTrickle||(t.sdp=h(t.sdp)),t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t).then(n).catch(r))}).catch(function(t){e.destroy(p(t,"ERR_CREATE_ANSWER"))})},f.prototype._onIceStateChange=function(){var e=this;if(!this.destroyed){var t=this._pc.iceConnectionState,n=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",t,n),this.emit("iceStateChange",t,n),"connected"!==t&&"completed"!==t||(this._pcReady=!0,this._maybeReady()),"failed"===t&&this.destroy(p("Ice connection failed.","ERR_ICE_CONNECTION_FAILURE")),"closed"===t&&this.destroy(p("Ice connection closed.","ERR_ICE_CONNECTION_CLOSED"))}},f.prototype.getStats=function(e){var t=this;function n(e){return"[object Array]"===Object.prototype.toString.call(e.values)&&e.values.forEach(function(t){Object.assign(e,t)}),e}0===t._pc.getStats.length?t._pc.getStats().then(function(t){var r=[];t.forEach(function(e){r.push(n(e))}),e(null,r)},function(t){e(t)}):t._isReactNativeWebrtc?t._pc.getStats(null,function(t){var r=[];t.forEach(function(e){r.push(n(e))}),e(null,r)},function(t){e(t)}):t._pc.getStats.length>0?t._pc.getStats(function(r){if(!t.destroyed){var i=[];r.result().forEach(function(e){var t={};e.names().forEach(function(n){t[n]=e.stat(n)}),t.id=e.id,t.type=e.type,t.timestamp=e.timestamp,i.push(n(t))}),e(null,i)}},function(t){e(t)}):e(null,[])},f.prototype._maybeReady=function(){var e=this;function t(){e.destroyed||e.getStats(function(n,r){if(!e.destroyed){n&&(r=[]);var i={},o={},s={},a=!1;if(r.forEach(function(e){"remotecandidate"!==e.type&&"remote-candidate"!==e.type||(i[e.id]=e),"localcandidate"!==e.type&&"local-candidate"!==e.type||(o[e.id]=e),"candidatepair"!==e.type&&"candidate-pair"!==e.type||(s[e.id]=e)}),r.forEach(function(e){"transport"===e.type&&e.selectedCandidatePairId&&l(s[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&l(e)}),a||Object.keys(s).length&&!Object.keys(o).length){if(e._connecting=!1,e.connected=!0,e._chunk){try{e.send(e._chunk)}catch(n){return e.destroy(p(n,"ERR_DATA_CHANNEL"))}e._chunk=null,e._debug('sent chunk from "write before connect"');var u=e._cb;e._cb=null,u(null)}"number"!=typeof e._channel.bufferedAmountLowThreshold&&(e._interval=setInterval(function(){e._onInterval()},150),e._interval.unref&&e._interval.unref()),e._debug("connect"),e.emit("connect")}else setTimeout(t,100)}function l(t){a=!0;var n=o[t.localCandidateId];n&&(n.ip||n.address)?(e.localAddress=n.ip||n.address,e.localPort=Number(n.port)):n&&n.ipAddress?(e.localAddress=n.ipAddress,e.localPort=Number(n.portNumber)):"string"==typeof t.googLocalAddress&&(n=t.googLocalAddress.split(":"),e.localAddress=n[0],e.localPort=Number(n[1])),e.localAddress&&(e.localFamily=e.localAddress.includes(":")?"IPv6":"IPv4");var r=i[t.remoteCandidateId];r&&(r.ip||r.address)?(e.remoteAddress=r.ip||r.address,e.remotePort=Number(r.port)):r&&r.ipAddress?(e.remoteAddress=r.ipAddress,e.remotePort=Number(r.portNumber)):"string"==typeof t.googRemoteAddress&&(r=t.googRemoteAddress.split(":"),e.remoteAddress=r[0],e.remotePort=Number(r[1])),e.remoteAddress&&(e.remoteFamily=e.remoteAddress.includes(":")?"IPv6":"IPv4"),e._debug("connect local: %s:%s remote: %s:%s",e.localAddress,e.localPort,e.remoteAddress,e.remotePort)}})}e._debug("maybeReady pc %s channel %s",e._pcReady,e._channelReady),!e.connected&&!e._connecting&&e._pcReady&&e._channelReady&&(e._connecting=!0,t())},f.prototype._onInterval=function(){var e=this;!this._cb||!this._channel||this._channel.bufferedAmount>65536||this._onChannelBufferedAmountLow()},f.prototype._onSignalingStateChange=function(){var e=this;e.destroyed||("stable"!==e._pc.signalingState||e._firstStable||(e._isNegotiating=!1,e._debug("flushing sender queue",e._sendersAwaitingStable),e._sendersAwaitingStable.forEach(function(t){e._pc.removeTrack(t),e._queuedNegotiation=!0}),e._sendersAwaitingStable=[],e._queuedNegotiation&&(e._debug("flushing negotiation queue"),e._queuedNegotiation=!1,e._needsNegotiation()),e._debug("negotiate"),e.emit("negotiate")),e._firstStable=!1,e._debug("signalingStateChange %s",e._pc.signalingState),e.emit("signalingStateChange",e._pc.signalingState))},f.prototype._onIceCandidate=function(e){var t=this;this.destroyed||(e.candidate&&this.trickle?this.emit("signal",{candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):e.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),e.candidate&&this._startIceCompleteTimeout())},f.prototype._onChannelMessage=function(e){var n=this;if(!this.destroyed){var r=e.data;r instanceof ArrayBuffer&&(r=t.from(r)),this.push(r)}},f.prototype._onChannelBufferedAmountLow=function(){var e=this;if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);var t=this._cb;this._cb=null,t(null)}},f.prototype._onChannelOpen=function(){var e=this;this.connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())},f.prototype._onChannelClose=function(){var e=this;this.destroyed||(this._debug("on channel close"),this.destroy())},f.prototype._onTrack=function(e){var t=this;t.destroyed||e.streams.forEach(function(n){t._debug("on track"),t.emit("track",e.track,n),t._remoteTracks.push({track:e.track,stream:n}),t._remoteStreams.some(function(e){return e.id===n.id})||(t._remoteStreams.push(n),setTimeout(function(){t.emit("stream",n)},0))})},f.prototype._debug=function(){var e=this,t=[].slice.call(arguments);t[0]="["+this._id+"] "+t[0],r.apply(null,t)}}).call(this,n(0).Buffer)},function(e,t,n){var r=n(28),i=function(){},o=function(e){return e.setHeader&&"function"==typeof e.abort},s=function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length},a=function(e,t,n){if("function"==typeof t)return a(e,null,t);t||(t={}),n=r(n||i);var u=e._writableState,l=e._readableState,c=t.readable||!1!==t.readable&&e.readable,f=t.writable||!1!==t.writable&&e.writable,h=function(){e.writable||p()},p=function(){f=!1,c||n.call(e)},d=function(){c=!1,f||n.call(e)},m=function(t){n.call(e,t?new Error("exited with error code: "+t):null)},g=function(t){n.call(e,t)},y=function(){return(!c||l&&l.ended)&&(!f||u&&u.ended)?void 0:n.call(e,new Error("premature close"))},b=function(){e.req.on("finish",p)};return o(e)?(e.on("complete",p),e.on("abort",y),e.req?b():e.on("request",b)):f&&!u&&(e.on("end",h),e.on("close",h)),s(e)&&e.on("exit",m),e.on("end",d),e.on("finish",p),!1!==t.error&&e.on("error",g),e.on("close",y),function(){e.removeListener("complete",p),e.removeListener("abort",y),e.removeListener("request",b),e.req&&e.req.removeListener("finish",p),e.removeListener("end",h),e.removeListener("close",h),e.removeListener("finish",p),e.removeListener("exit",m),e.removeListener("end",d),e.removeListener("error",g),e.removeListener("close",y)}};e.exports=a},function(e,t){var n=function(){};function r(e,t,n){var r=e.length;if(!r)return n(t);function i(){--r||n(t)}e.forEach(function(e){e?e(t,i):i()}),r||i()}e.exports=function(e){return function(t,n){!function i(){t?r(e,t,n):e.length?e[0]?e[0](null,function(t,o){t?(e.shift(),!0===t?i():r(e,t,n)):n(null,o)}):(e.shift(),i()):n(!0)}()}}},function(e,t,n){"use strict";e.exports=function(){var e,t;function n(n){if("function"!=typeof n)throw new Error("read must be function");if(e)throw new Error("already piped");if(e=n,t){var r=t;t=null,e.apply(null,r)}}function r(n,r){e?e(n,r):t=[n,r]}return{source:r,sink:n}}},function(e,t,n){"use strict";t.Listener=t.listener=n(1127),t.Dialer=t.dialer=n(1130),t.matchSemver=n(1131),t.matchExact=n(530)},function(e,t,n){"use strict";(function(r){const i=n(12),o=n(43),s=n(36),a=n(72),u=n(5);function l(){return(~~(1e9*Math.random())).toString(36)}function c(e,t){i(o(r.isBuffer(e)?[e]:[r.from(e)]),a.encode(),s((e,n)=>{if(e)return t(e);t(null,n[0])}))}function f(e){const t=l();function n(e){return n=>{Array.isArray(n)&&(n=n.join(" ")),e("(%s) %s",t,n)}}const r=n(u("mss:"+e));return r.error=n(u("mss:"+e+":error")),r}t=e.exports,t.writeEncoded=((e,t,n)=>{c(t,(t,r)=>{if(t)return n(t);e.write(r)})}),t.log={},t.log.dialer=(()=>f("dialer\t")),t.log.listener=(()=>f("listener\t"))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";t.importer=t.Importer=n(548),t.exporter=t.Exporter=n(123)},function(e,t,n){var r=n(1213);function i(e,t){return(e=e||[]).push(t),e}e.exports=function(e,t,n,o){var s,a,u;function l(i){var c=null,f=!1,h=0;if(u=i,s)return i(!!s.abort||s,function(e){o(e),a&&a()});var p=!1,d=r(function(){p||s||(p=!0,i(null,function(e,r){p=!1,function(e,r){s||(s=e,s?f||o(!0===s?null:s):(c=t(c,r),h=c&&c.length||0,null!=c&&m(),h{let l=a.cidVersion||i,c=a.hashAlg||o,f=a.codec||s;if(t.isBuffer(e)&&(l=1,f="raw"),"sha2-256"!==c&&(l=1),a.onlyHash)return r(e,{version:l,hashAlg:c},(t,n)=>{u(t,{cid:n,node:e})});n.put(e,{version:l,hashAlg:c,format:f},(t,n)=>{u(t,{cid:n,node:e})})};e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(228),i=n(229),o=n(11),s=n(37),a=n(50),u=s.DAGLink,l=s.DAGNode,c=n(55),f=n(339),h=n(261),p=n(1228),d=n(12),m=n(403),g=n(88),y=n(1231),b=function(e){return new Promise((n,r)=>{c(e,"murmur3-128",(e,i)=>{if(e)r(e);else{const e=i.slice(2,10),r=e.length,o=t.alloc(r);for(let t=0;t{e(t.key,t.value,n)}),m(t))}flush(e,t,n,r){k(this._options,this._bucket,e,t,n,(e,t)=>{if(e)return r(e);this.multihash=t.cid.buffer,this.size=t.node.size,r(null,t)})}}function w(e,t){return new _(e,t)}function k(e,n,s,c,f,p){const d=n._children;let m=0;const g=[];function b(t,n,i){const o=r(n.toString(16).toUpperCase(),2,"0");if(y.isBucket(t))k(e,t,s,c,null,(e,{cid:t,node:n})=>{e?i(e):(g.push(new u(o,n.size,t)),i())});else{const e=t.value,n=o+t.key;g.push(new u(n,e.size,e.multihash)),i()}}function v(r,i){const u=t.from(d.bitField().reverse()),p=new a("hamt-sharded-directory",u);p.fanout=n.tableSize(),p.hashType=e.hashFn.code,o([e=>l.create(p.marshal(),r,e),(t,n)=>h(t,c,e,n),({cid:e,node:t},n)=>{const r={path:s,size:t.size,multihash:e.buffer};f&&f.push(r),n(null,{cid:e,node:t})}],i)}i(()=>m{const t=d.get(m);t?b(t,m,t=>{m++,e(t)}):(m++,e())},e=>{e?p(e):v(g,p)})}e.exports=w,e.exports.hashFn=b}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(e){const r=n(9);function i(e){const t={},n=e.split("-");switch(n.length){case 1:t.avgChunkSize=262144;break;case 2:t.avgChunkSize=o(n[1],"avg");break;case 4:t.minChunkSize=o(n[1],"min"),t.avgChunkSize=o(n[2],"avg"),t.maxChunkSize=o(n[3],"max");break;default:throw new Error('Incorrect chunker format (expected "rabin" "rabin-[avg]" or "rabin-[min]-[avg]-[max]"')}return t}function o(e,t){let n=parseInt(e);if(isNaN(n))throw new Error(`Chunker parameter ${t} must be an integer`);return n}t.normalizePath=(t=>e.isBuffer(t)?new r(t).toString():r.isCID(t)?t.toString():(0===t.indexOf("/ipfs/")&&(t=t.substring("/ipfs/".length)),"/"===t.charAt(t.length-1)&&(t=t.substring(0,t.length-1)),t)),t.parseChunkerString=(e=>{if(e){if(e.startsWith("size-")){const t=e.split("-")[1],n=parseInt(t);if(isNaN(n))throw new Error("Chunker parameter size must be an integer");return{chunker:"fixed",chunkerOptions:{maxChunkSize:n}}}if(e.startsWith("rabin"))return{chunker:"rabin",chunkerOptions:i(e)};throw new Error(`Unrecognized chunker option: ${e}`)}return{chunker:"fixed"}})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(33).Key,i={file:0,directory:1,"hamt-sharded-directory":1};e.exports={FILE_SEPARATOR:"/",MFS_ROOT_KEY:new r("/local/filesroot"),MAX_CHUNK_SIZE:262144,MAX_LINKS:174,FILE_TYPES:i}},function(e,t,n){"use strict";var r=n(1265),i="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-",o,s,a;function u(){a=!1}function l(e){if(e){if(e!==o){if(e.length!==i.length)throw new Error("Custom alphabet for shortid must be "+i.length+" unique characters. You submitted "+e.length+" characters: "+e);var t=e.split("").filter(function(e,t,n){return t!==n.lastIndexOf(e)});if(t.length)throw new Error("Custom alphabet for shortid must be "+i.length+" unique characters. These characters were not unique: "+t.join(", "));o=e,u()}}else o!==i&&(o=i,u())}function c(e){return l(e),o}function f(e){r.seed(e),s!==e&&(u(),s=e)}function h(){o||l(i);for(var e=o.split(""),t=[],n=r.nextValue(),s;e.length>0;)n=r.nextValue(),s=Math.floor(n*e.length),t.push(e.splice(s,1)[0]);return t.join("")}function p(){return a||(a=h(),a)}function d(e){var t=p();return t[e]}function m(){return o||i}e.exports={get:m,characters:c,seed:f,lookup:d,shuffled:p}},function(e,t,n){"use strict";const r=n(50).unmarshal,{formatCid:i,toMfsPath:o,loadNode:s}=n(83),a=n(11),u=n(12),l=n(36),c=n(88),f=n(123),h=n(9),p=n(5)("ipfs:mfs:stat"),d={hash:!1,size:!1,withLocal:!1,cidBase:"base58btc"};e.exports=(e=>(function t(n,m,g){"function"==typeof m&&(g=m,m={}),m=Object.assign({},d,m),p(`Fetching stats for ${n}`),a([t=>o(e,n,t),({mfsPath:t,depth:o},a)=>{u(f(t,e.ipld,{maxDepth:o}),c((t,n)=>m.hash?n(null,{hash:i(new h(t.hash),m.cidBase)}):m.size?n(null,{size:t.size}):void s(e,{cid:t.hash},(e,t)=>{if(e)return n(e);const{node:o,cid:s}=t,a=r(o.data);let u=o.links.length;"file"===a.type&&(u=a.blockSizes.length),n(null,{hash:i(s,m.cidBase),size:a.fileSize()||0,cumulativeSize:o.size,blocks:u,type:a.type,local:void 0,sizeLocal:void 0,withLocality:!1})})),l((e,t)=>e?a(e):t.length?(p(`Stats for ${n}`,t[0]),a(null,t[0])):a(new Error(`${n} does not exist`))))}],g)}))},function(e,t,n){"use strict";var r=t;r.base=n(1327),r.short=n(1328),r.mont=n(1329),r.edwards=n(1330)},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=n(1383),o=n(1389),s=n(18),a=n(191),u=n(63),l=n(143),c=n(4).Buffer;Object.assign(t,n(1391)),t.MAX_INTEGER=new u("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new u("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.SHA3_NULL_S=t.KECCAK256_NULL_S,t.KECCAK256_NULL=c.from(t.KECCAK256_NULL_S,"hex"),t.SHA3_NULL=t.KECCAK256_NULL,t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.SHA3_RLP_ARRAY_S=t.KECCAK256_RLP_ARRAY_S,t.KECCAK256_RLP_ARRAY=c.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.SHA3_RLP_ARRAY=t.KECCAK256_RLP_ARRAY,t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.SHA3_RLP_S=t.KECCAK256_RLP_S,t.KECCAK256_RLP=c.from(t.KECCAK256_RLP_S,"hex"),t.SHA3_RLP=t.KECCAK256_RLP,t.BN=u,t.rlp=a,t.secp256k1=o,t.zeros=function(e){return c.allocUnsafe(e).fill(0)},t.zeroAddress=function(){var e=20,n=t.zeros(20);return t.bufferToHex(n)},t.setLengthLeft=t.setLength=function(e,n,r){var i=t.zeros(n);return e=t.toBuffer(e),r?e.length0&&"0"===n.toString();)e=e.slice(1),n=e[0];return e},t.toBuffer=function(e){if(!c.isBuffer(e))if(Array.isArray(e))e=c.from(e);else if("string"==typeof e)e=t.isHexString(e)?c.from(t.padToEven(t.stripHexPrefix(e)),"hex"):c.from(e);else if("number"==typeof e)e=t.intToBuffer(e);else if(null===e||void 0===e)e=c.allocUnsafe(0);else if(u.isBN(e))e=e.toArrayLike(c);else{if(!e.toArray)throw new Error("invalid type");e=c.from(e.toArray())}return e},t.bufferToInt=function(e){return new u(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return e=t.toBuffer(e),"0x"+e.toString("hex")},t.fromSigned=function(e){return new u(e).fromTwos(256)},t.toUnsigned=function(e){return c.from(e.toTwos(256).toArray())},t.keccak=function(e,n){return e=t.toBuffer(e),n||(n=256),i("keccak"+n).update(e).digest()},t.keccak256=function(e){return t.keccak(e)},t.sha3=t.keccak,t.sha256=function(e){return e=t.toBuffer(e),l("sha256").update(e).digest()},t.ripemd160=function(e,n){e=t.toBuffer(e);var r=l("rmd160").update(e).digest();return!0===n?t.setLength(r,32):r},t.rlphash=function(e){return t.keccak(a.encode(e))},t.isValidPrivate=function(e){return o.privateKeyVerify(e)},t.isValidPublic=function(e,t){return 64===e.length?o.publicKeyVerify(c.concat([c.from([4]),e])):!!t&&o.publicKeyVerify(e)},t.pubToAddress=t.publicToAddress=function(e,n){return e=t.toBuffer(e),n&&64!==e.length&&(e=o.publicKeyConvert(e,!1).slice(1)),s(64===e.length),t.keccak(e).slice(-20)};var f=t.privateToPublic=function(e){return e=t.toBuffer(e),o.publicKeyCreate(e,!1).slice(1)};t.importPublic=function(e){return e=t.toBuffer(e),64!==e.length&&(e=o.publicKeyConvert(e,!1).slice(1)),e},t.ecsign=function(e,t){var n=o.sign(e,t),r={};return r.r=n.signature.slice(0,32),r.s=n.signature.slice(32,64),r.v=n.recovery+27,r},t.hashPersonalMessage=function(e){var n=t.toBuffer("Ethereum Signed Message:\n"+e.length.toString());return t.keccak(c.concat([n,e]))},t.ecrecover=function(e,n,r,i){var s=c.concat([t.setLength(r,32),t.setLength(i,32)],64),a=n-27;if(0!==a&&1!==a)throw new Error("Invalid signature v value");var u=o.recover(e,s,a);return o.publicKeyConvert(u,!1).slice(1)},t.toRpcSig=function(e,n,r){if(27!==e&&28!==e)throw new Error("Invalid recovery id");return t.bufferToHex(c.concat([t.setLengthLeft(n,32),t.setLengthLeft(r,32),t.toBuffer(e-27)]))},t.fromRpcSig=function(e){if(e=t.toBuffer(e),65!==e.length)throw new Error("Invalid signature length");var n=e[64];return n<27&&(n+=27),{v:n,r:e.slice(0,32),s:e.slice(32,64)}},t.privateToAddress=function(e){return t.publicToAddress(f(e))},t.isValidAddress=function(e){return/^0x[0-9a-fA-F]{40}$/.test(e)},t.isZeroAddress=function(e){var n=t.zeroAddress();return n===t.addHexPrefix(e)},t.toChecksumAddress=function(e){e=t.stripHexPrefix(e).toLowerCase();for(var n=t.keccak(e).toString("hex"),r="0x",i=0;i=8?r+=e[i].toUpperCase():r+=e[i];return r},t.isValidChecksumAddress=function(e){return t.isValidAddress(e)&&t.toChecksumAddress(e)===e},t.generateAddress=function(e,n){return e=t.toBuffer(e),n=new u(n),n=n.isZero()?null:c.from(n.toArray()),t.rlphash([e,n]).slice(-20)},t.isPrecompiled=function(e){var n=t.unpad(e);return 1===n.length&&n[0]>=1&&n[0]<=8},t.addHexPrefix=function(e){return"string"!=typeof e?e:t.isHexPrefixed(e)?e:"0x"+e},t.isValidSignature=function(e,t,n,r){var i=new u("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),o=new u("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);return 32===t.length&&32===n.length&&((27===e||28===e)&&(t=new u(t),n=new u(n),!(t.isZero()||t.gt(o)||n.isZero()||n.gt(o))&&(!1!==r||1!==new u(n).cmp(i))))},t.baToJSON=function(e){if(c.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var n=[],r=0;r=i.length,"The field "+n.name+" must not have more "+n.length+" bytes")):n.allowZero&&0===i.length||!n.length||s(n.length===i.length,"The field "+n.name+" must have byte length of "+n.length),e.raw[r]=i}e._fields.push(n.name),Object.defineProperty(e,n.name,{enumerable:!0,configurable:!0,get:i,set:o}),n.default&&(e[n.name]=n.default),n.alias&&Object.defineProperty(e,n.alias,{enumerable:!1,configurable:!0,set:o,get:i})}),i)if("string"==typeof i&&(i=c.from(t.stripHexPrefix(i),"hex")),c.isBuffer(i)&&(i=a.decode(i)),Array.isArray(i)){if(i.length>e._fields.length)throw new Error("wrong number of fields in data");i.forEach(function(n,r){e[e._fields[r]]=t.toBuffer(n)})}else{if("object"!==(void 0===i?"undefined":r(i)))throw new Error("invalid data");var o=Object.keys(i);n.forEach(function(t){-1!==o.indexOf(t.name)&&(e[t.name]=i[t.name]),-1!==o.indexOf(t.alias)&&(e[t.alias]=i[t.alias])})}}},function(e,t,n){"use strict";const r=n(270).SmartBuffer,i=n(400),o=n(1420),s=n(42),a=n(9);t=e.exports,t.SHA1_LENGTH=i.defaultLengths[i.names.sha1],t.find=((e,t)=>{for(let n=0;n{let t=e.match(/^(([^<]+)\s)?\s?<([^>]+)>\s?(\d+\s[+\-\d]+)?$/);return null===t?null:{name:t[2],email:t[3],date:t[4]}}),t.serializePersonLine=(e=>{let t=[];return e.name&&t.push(e.name),t.push("<"+e.email+">"),e.date&&t.push(e.date),t.join(" ")}),t.shaToCid=(e=>{let n=new r;return n.writeUInt8(1),n.writeBuffer(o["git-raw"]),n.writeUInt8(i.names.sha1),n.writeUInt8(t.SHA1_LENGTH),n.writeBuffer(e),n.toBuffer()}),t.cidToSha=(e=>{let t=s.decode(new a(e).multihash);return"sha1"!==t.name?null:t.digest})},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const r=n(1419),i=4096,o="utf8";class s{constructor(t){if(this.length=0,this._encoding=o,this._writeOffset=0,this._readOffset=0,s.isSmartBufferOptions(t))if(t.encoding&&(r.checkEncoding(t.encoding),this._encoding=t.encoding),t.size){if(!(r.isFiniteInteger(t.size)&&t.size>0))throw new Error(r.ERRORS.INVALID_SMARTBUFFER_SIZE);this._buff=e.allocUnsafe(t.size)}else if(t.buff){if(!(t.buff instanceof e))throw new Error(r.ERRORS.INVALID_SMARTBUFFER_BUFFER);this._buff=t.buff,this.length=t.buff.length}else this._buff=e.allocUnsafe(i);else{if(void 0!==t)throw new Error(r.ERRORS.INVALID_SMARTBUFFER_OBJECT);this._buff=e.allocUnsafe(i)}}static fromSize(e,t){return new this({size:e,encoding:t})}static fromBuffer(e,t){return new this({buff:e,encoding:t})}static fromOptions(e){return new this(e)}static isSmartBufferOptions(e){const t=e;return t&&(void 0!==t.encoding||void 0!==t.size||void 0!==t.buff)}readInt8(t){return this._readNumberValue(e.prototype.readInt8,1,t)}readInt16BE(t){return this._readNumberValue(e.prototype.readInt16BE,2,t)}readInt16LE(t){return this._readNumberValue(e.prototype.readInt16LE,2,t)}readInt32BE(t){return this._readNumberValue(e.prototype.readInt32BE,4,t)}readInt32LE(t){return this._readNumberValue(e.prototype.readInt32LE,4,t)}writeInt8(t,n){return this._writeNumberValue(e.prototype.writeInt8,1,t,n),this}insertInt8(t,n){return this._insertNumberValue(e.prototype.writeInt8,1,t,n)}writeInt16BE(t,n){return this._writeNumberValue(e.prototype.writeInt16BE,2,t,n)}insertInt16BE(t,n){return this._insertNumberValue(e.prototype.writeInt16BE,2,t,n)}writeInt16LE(t,n){return this._writeNumberValue(e.prototype.writeInt16LE,2,t,n)}insertInt16LE(t,n){return this._insertNumberValue(e.prototype.writeInt16LE,2,t,n)}writeInt32BE(t,n){return this._writeNumberValue(e.prototype.writeInt32BE,4,t,n)}insertInt32BE(t,n){return this._insertNumberValue(e.prototype.writeInt32BE,4,t,n)}writeInt32LE(t,n){return this._writeNumberValue(e.prototype.writeInt32LE,4,t,n)}insertInt32LE(t,n){return this._insertNumberValue(e.prototype.writeInt32LE,4,t,n)}readUInt8(t){return this._readNumberValue(e.prototype.readUInt8,1,t)}readUInt16BE(t){return this._readNumberValue(e.prototype.readUInt16BE,2,t)}readUInt16LE(t){return this._readNumberValue(e.prototype.readUInt16LE,2,t)}readUInt32BE(t){return this._readNumberValue(e.prototype.readUInt32BE,4,t)}readUInt32LE(t){return this._readNumberValue(e.prototype.readUInt32LE,4,t)}writeUInt8(t,n){return this._writeNumberValue(e.prototype.writeUInt8,1,t,n)}insertUInt8(t,n){return this._insertNumberValue(e.prototype.writeUInt8,1,t,n)}writeUInt16BE(t,n){return this._writeNumberValue(e.prototype.writeUInt16BE,2,t,n)}insertUInt16BE(t,n){return this._insertNumberValue(e.prototype.writeUInt16BE,2,t,n)}writeUInt16LE(t,n){return this._writeNumberValue(e.prototype.writeUInt16LE,2,t,n)}insertUInt16LE(t,n){return this._insertNumberValue(e.prototype.writeUInt16LE,2,t,n)}writeUInt32BE(t,n){return this._writeNumberValue(e.prototype.writeUInt32BE,4,t,n)}insertUInt32BE(t,n){return this._insertNumberValue(e.prototype.writeUInt32BE,4,t,n)}writeUInt32LE(t,n){return this._writeNumberValue(e.prototype.writeUInt32LE,4,t,n)}insertUInt32LE(t,n){return this._insertNumberValue(e.prototype.writeUInt32LE,4,t,n)}readFloatBE(t){return this._readNumberValue(e.prototype.readFloatBE,4,t)}readFloatLE(t){return this._readNumberValue(e.prototype.readFloatLE,4,t)}writeFloatBE(t,n){return this._writeNumberValue(e.prototype.writeFloatBE,4,t,n)}insertFloatBE(t,n){return this._insertNumberValue(e.prototype.writeFloatBE,4,t,n)}writeFloatLE(t,n){return this._writeNumberValue(e.prototype.writeFloatLE,4,t,n)}insertFloatLE(t,n){return this._insertNumberValue(e.prototype.writeFloatLE,4,t,n)}readDoubleBE(t){return this._readNumberValue(e.prototype.readDoubleBE,8,t)}readDoubleLE(t){return this._readNumberValue(e.prototype.readDoubleLE,8,t)}writeDoubleBE(t,n){return this._writeNumberValue(e.prototype.writeDoubleBE,8,t,n)}insertDoubleBE(t,n){return this._insertNumberValue(e.prototype.writeDoubleBE,8,t,n)}writeDoubleLE(t,n){return this._writeNumberValue(e.prototype.writeDoubleLE,8,t,n)}insertDoubleLE(t,n){return this._insertNumberValue(e.prototype.writeDoubleLE,8,t,n)}readString(e,t){let n;"number"==typeof e?(r.checkLengthValue(e),n=Math.min(e,this.length-this._readOffset)):(t=e,n=this.length-this._readOffset),void 0!==t&&r.checkEncoding(t);const i=this._buff.slice(this._readOffset,this._readOffset+n).toString(t||this._encoding);return this._readOffset+=n,i}insertString(e,t,n){return r.checkOffsetValue(t),this._handleString(e,!0,t,n)}writeString(e,t,n){return this._handleString(e,!1,t,n)}readStringNT(e){void 0!==e&&r.checkEncoding(e);let t=this.length;for(let e=this._readOffset;ethis.length)throw new Error(r.ERRORS.INVALID_READ_BEYOND_BOUNDS)}ensureInsertable(e,t){r.checkOffsetValue(t),this._ensureCapacity(this.length+e),tthis.length?this.length=t+e:this.length+=e}_ensureWriteable(e,t){const n="number"==typeof t?t:this._writeOffset;this._ensureCapacity(n+e),n+e>this.length&&(this.length=n+e)}_ensureCapacity(t){const n=this._buff.length;if(t>n){let r=this._buff,i=3*n/2+1;i"},e.exports=p}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(597),o=n(0),s="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".split(""),a=function e(n){if(!(this instanceof e))return new e(n);if(t.isBuffer(n)){var r=n;this.fromBuffer(r)}else if("string"==typeof n){var i=n;this.fromString(i)}else n&&this.set(n)};a.validCharacters=function e(t){return o.Buffer.isBuffer(t)&&(t=t.toString()),r.all(r.map(t,function(e){return r.contains(s,e)}))},a.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this},a.encode=function(e){if(!o.Buffer.isBuffer(e))throw new Error("Input should be a buffer");return i.encode(e)},a.decode=function(e){if("string"!=typeof e)throw new Error("Input should be a string");return new t(i.decode(e))},a.prototype.fromBuffer=function(e){return this.buf=e,this},a.prototype.fromString=function(e){var t=a.decode(e);return this.buf=t,this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toString=function(){return a.encode(this.buf)},e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){e.exports=n(357),e.exports.Input=n(358),e.exports.Output=n(111),e.exports.UnspentOutput=n(599),e.exports.Signature=n(197),e.exports.Sighash=n(110)},function(e,t,n){"use strict";(function(t,r){function i(){}i.getRandomBuffer=function(e){return t.browser?i.getRandomBufferBrowser(e):i.getRandomBufferNode(e)},i.getRandomBufferNode=function(e){var t=n(15);return t.randomBytes(e)},i.getRandomBufferBrowser=function(e){if(!window.crypto&&!window.msCrypto)throw new Error("window.crypto not available");if(window.crypto&&window.crypto.getRandomValues)var t=window.crypto;else{if(!window.msCrypto||!window.msCrypto.getRandomValues)throw new Error("window.crypto.getRandomValues not available");var t=window.msCrypto}var n=new Uint8Array(e);t.getRandomValues(n);var i=new r(n);return i},i.getPseudoRandomBuffer=function(e){for(var t=4294967296,n=new r(e),i,o=0;o<=e;o++){var s=Math.floor(o/4),a=o-4*s;0===a?(i=Math.random()*t,n[o]=255&i):n[o]=255&(i>>>=8)}return n},e.exports=i}).call(this,n(2),n(0).Buffer)},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(51),o=n(30),s=n(109),a=n(79),u=n(59),l=n(40),c=n(25),f=537133055,h=function e(t){if(!(this instanceof e))return new e(t);var n=e._from(t);return this.version=n.version,this.prevHash=n.prevHash,this.merkleRoot=n.merkleRoot,this.reserved=n.reserved,this.time=n.time,this.timestamp=n.time,this.bits=n.bits,this.nonce=n.nonce,this.solution=n.solution,n.hash&&c.checkState(this.hash===n.hash,"Argument object hash property does not match block hash."),this};h._from=function e(t){var n={};if(o.isBuffer(t))n=h._fromBufferReader(s(t));else{if(!r.isObject(t))throw new TypeError("Unrecognized argument for BlockHeader");n=h._fromObject(t)}return n},h._fromObject=function e(n){c.checkArgument(n,"data is required");var i=n.prevHash,s=n.merkleRoot,a=n.reserved,u=n.nonce,l=n.solution;r.isString(n.prevHash)&&(i=o.reverse(new t(n.prevHash,"hex"))),r.isString(n.merkleRoot)&&(s=o.reverse(new t(n.merkleRoot,"hex"))),r.isString(n.reserved)&&(a=o.reverse(new t(n.reserved,"hex"))),r.isString(n.nonce)&&(u=o.reverse(new t(n.nonce,"hex"))),r.isString(n.solution)&&(l=new t(n.solution,"hex"));var f={hash:n.hash,version:n.version,prevHash:i,merkleRoot:s,reserved:a,time:n.time,timestamp:n.time,bits:n.bits,nonce:u,solution:l};return f},h.fromObject=function e(t){var n=h._fromObject(t);return new h(n)},h.fromRawBlock=function e(n){o.isBuffer(n)||(n=new t(n,"binary"));var r=s(n);r.pos=h.Constants.START_OF_HEADER;var i=h._fromBufferReader(r);return new h(i)},h.fromBuffer=function e(t){var n=h._fromBufferReader(s(t));return new h(n)},h.fromString=function e(n){var r=new t(n,"hex");return h.fromBuffer(r)},h._fromBufferReader=function e(t){var n={};n.version=t.readUInt32LE(),n.prevHash=t.read(32),n.merkleRoot=t.read(32),n.reserved=t.read(32),n.time=t.readUInt32LE(),n.bits=t.readUInt32LE(),n.nonce=t.read(32);var r=t.readVarintNum();return n.solution=t.read(r),n},h.fromBufferReader=function e(t){var n=h._fromBufferReader(t);return new h(n)},h.prototype.toObject=h.prototype.toJSON=function e(){return{hash:this.hash,version:this.version,prevHash:o.reverse(this.prevHash).toString("hex"),merkleRoot:o.reverse(this.merkleRoot).toString("hex"),reserved:o.reverse(this.reserved).toString("hex"),time:this.time,bits:this.bits,nonce:o.reverse(this.nonce).toString("hex"),solution:this.solution.toString("hex")}},h.prototype.toBuffer=function e(){return this.toBufferWriter().concat()},h.prototype.toString=function e(){return this.toBuffer().toString("hex")},h.prototype.toBufferWriter=function e(t){return t||(t=new a),t.writeUInt32LE(this.version),t.write(this.prevHash),t.write(this.merkleRoot),t.write(this.reserved),t.writeUInt32LE(this.time),t.writeUInt32LE(this.bits),t.write(this.nonce),t.writeVarintNum(this.solution.length),t.write(this.solution),t},h.prototype.getTargetDifficulty=function e(t){t=t||this.bits;for(var n=new i(16777215&t),r=8*((t>>>24)-3);r-- >0;)n=n.mul(new i(2));return n},h.prototype.getDifficulty=function e(){var t=this.getTargetDifficulty(537133055).mul(new i(Math.pow(10,8))),n=this.getTargetDifficulty(),r=t.div(n).toString(10),o=r.length-8;return r=r.slice(0,o)+"."+r.slice(o),parseFloat(r)},h.prototype._getHash=function e(){var t=this.toBuffer();return u.sha256sha256(t)};var p={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=s(this._getHash()).readReverse().toString("hex")),this._id},set:r.noop};Object.defineProperty(h.prototype,"id",p),Object.defineProperty(h.prototype,"hash",p),h.prototype.validTimestamp=function e(){var t=Math.round((new Date).getTime()/1e3);return!(this.time>t+h.Constants.MAX_TIME_OFFSET)},h.prototype.validProofOfWork=function e(){var t=new i(this.id,"hex"),n=this.getTargetDifficulty();return!(t.cmp(n)>0)},h.prototype.inspect=function e(){return""},h.Constants={START_OF_HEADER:8,MAX_TIME_OFFSET:7200,LARGEST_HASH:new i("10000000000000000000000000000000000000000000000000000000000000000","hex")},e.exports=h}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var n=Object.prototype.toString,r="function"==typeof t.alloc&&"function"==typeof t.allocUnsafe&&"function"==typeof t.from;function i(e){return"ArrayBuffer"===n.call(e).slice(8,-1)}function o(e,n,i){n>>>=0;var o=e.byteLength-n;if(o<0)throw new RangeError("'offset' is out of bounds");if(void 0===i)i=o;else if(i>>>=0,i>o)throw new RangeError("'length' is out of bounds");return r?t.from(e.slice(n,n+i)):new t(new Uint8Array(e.slice(n,n+i)))}function s(e,n){if("string"==typeof n&&""!==n||(n="utf8"),!t.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');return r?t.from(e,n):new t(e,n)}function a(e,n,a){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return i(e)?o(e,n,a):"string"==typeof e?s(e,n):r?t.from(e):new t(e)}e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){t=e.exports=n(626),t.Stream=t,t.Readable=t,t.Writable=n(629),t.Duplex=n(157),t.Transform=n(630),t.PassThrough=n(1496)},function(e,t,n){var r=e.exports;r.encode=n(1720),r.decode=n(1721),r.byteLength=r.encodingLength=function(e){return r.encode(e).length}},function(e,t,n){"use strict";function r(e,t){for(var n=1,r=e.length,i=e[0],o=e[0],s=1;s>3;return e%8!=0&&t++,t}r.prototype.get=function(e){var t=e>>3;return t>e%8)},r.prototype.set=function(e,t){var n=e>>3;t||1===arguments.length?(this.buffer.length>e%8):n>e%8))},r.prototype._grow=function(e){if(this.buffer.length4294967295&&(o=1),t.writeUInt32BE(o,n),t.write(e.type,n+4,4,"ascii");var a=n+8;if(1===o&&(r.encode(e.length,t,a),a+=8),s.fullBoxes[i]&&(t.writeUInt32BE(e.flags||0,a),t.writeUInt8(e.version||0,a),a+=4),l[i]){var c=l[i];c.forEach(function(n){if(5===n.length){var r=e[n]||[];n=n.substr(0,4),r.forEach(function(e){u._encode(e,t,a),a+=u.encode.bytes})}else e[n]&&(u._encode(e[n],t,a),a+=u.encode.bytes)}),e.otherBoxes&&e.otherBoxes.forEach(function(e){u._encode(e,t,a),a+=u.encode.bytes})}else if(s[i]){var f=s[i].encode;f(e,t,a),a+=f.bytes}else{if(!e.buffer)throw new Error("Either `type` must be set to a known type (not'"+i+"') or `buffer` must be set");var h=e.buffer;h.copy(t,a),a+=e.buffer.length}return u.encode.bytes=a-n,t},u.readHeaders=function(e,t,n){if(t=t||0,n=n||e.length,n-t<8)return 8;var i=e.readUInt32BE(t),o=e.toString("ascii",t+4,t+8),a=t+8,u,l;if(1===i){if(n-t<16)return 16;i=r.decode(e,a),a+=8}return s.fullBoxes[o]&&(u=e.readUInt8(a),l=16777215&e.readUInt32BE(a),a+=4),{length:i,headersLen:a-t,contentLen:i-(a-t),type:o,version:u,flags:l}},u.decode=function(e,t,n){t=t||0,n=n||e.length;var r=u.readHeaders(e,t,n);if(!r||r.length>n-t)throw new Error("Data too short");return u.decodeWithoutHeaders(r,e,t+r.headersLen,t+r.length)},u.decodeWithoutHeaders=function(e,t,n,r){n=n||0,r=r||t.length;var i=e.type,a={};if(l[i]){a.otherBoxes=[];for(var c=l[i],f=n;r-f>=8;){var h=u.decode(t,f,r);if(f+=h.length,c.indexOf(h.type)>=0)a[h.type]=h;else if(c.indexOf(h.type+"s")>=0){var p=h.type+"s",d=a[p]=a[p]||[];d.push(h)}else a.otherBoxes.push(h)}}else if(s[i]){var m=s[i].decode;a=m(t,n,r)}else a.buffer=o(t.slice(n,r));return a.length=e.length,a.contentLen=e.contentLen,a.type=e.type,a.version=e.version,a.flags=e.flags,a},u.encodingLength=function(e){var t=e.type,n=8;if(s.fullBoxes[t]&&(n+=4),l[t]){var r=l[t];r.forEach(function(t){if(5===t.length){var r=e[t]||[];t=t.substr(0,4),r.forEach(function(e){e.type=t,n+=u.encodingLength(e)})}else if(e[t]){var i=e[t];i.type=t,n+=u.encodingLength(i)}}),e.otherBoxes&&e.otherBoxes.forEach(function(e){n+=u.encodingLength(e)})}else if(s[t])n+=s[t].encodingLength(e);else{if(!e.buffer)throw new Error("Either `type` must be set to a known type (not'"+t+"') or `buffer` must be set");n+=e.buffer.length}return n>4294967295&&(n+=8),e.length=n,n}},function(e,t,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)i(n,r)&&(e[r]=n[r])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var o={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var o=0;o0;--s){o=o.twice();var a=n.testBit(s),u=t.testBit(s);a!=u&&(o=o.add(a?this:i))}return o}function S(e,t,n){var r;r=e.bitLength()>n.bitLength()?e.bitLength()-1:n.bitLength()-1;for(var i=this.curve.getInfinity(),o=this.add(t);r>=0;)i=i.twice(),e.testBit(r)?i=n.testBit(r)?i.add(o):i.add(this):n.testBit(r)&&(i=i.add(t)),--r;return i}function E(e,t,n){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(n),this.infinity=new d(this,null,null),this.reducer=new i(this.q)}function x(){return this.q}function C(){return this.a}function A(){return this.b}function I(e){return e==this||this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)}function T(){return this.infinity}function j(e){return new o(this.q,e)}function O(e){this.reducer.reduce(e)}function P(e){switch(parseInt(e.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var t=(e.length-2)/2,n=e.substr(2,t),i=e.substr(t+2,t);return new d(this,this.fromBigInteger(new r(n,16)),this.fromBigInteger(new r(i,16)));default:return null}}function B(e){if(e.isInfinity())return"00";var t=e.getX().toBigInteger().toString(16),n=e.getY().toBigInteger().toString(16),r=this.getQ().toString(16).length;for(r%2!=0&&r++;t.length128){var t=this.q.shiftRight(e-64);-1==t.intValue()&&(this.r=r.ONE.shiftLeft(e).subtract(this.q))}return this.r},o.prototype.modMult=function(e,t){return this.modReduce(e.multiply(t))},o.prototype.modReduce=function(e){if(null!=this.getR()){for(var t=q.bitLength();e.bitLength()>t+1;){var n=e.shiftRight(t),i=e.subtract(n.shiftLeft(t));this.getR().equals(r.ONE)||(n=n.multiply(this.getR())),e=n.add(i)}for(;e.compareTo(q)>=0;)e=e.subtract(q)}else e=e.mod(q);return e},o.prototype.sqrt=function(){if(!this.q.testBit(0))throw"unsupported";if(this.q.testBit(1)){var e=new o(this.q,this.x.modPow(this.q.shiftRight(2).add(r.ONE),this.q));return e.square().equals(this)?e:null}var t=this.q.subtract(r.ONE),n=t.shiftRight(1);if(!this.x.modPow(n,this.q).equals(r.ONE))return null;var i=t.shiftRight(2),s=i.shiftLeft(1).add(r.ONE),a=this.x,u=modDouble(modDouble(a)),l,c;do{var f;do{f=new r(this.q.bitLength(),new SecureRandom)}while(f.compareTo(this.q)>=0||!f.multiply(f).subtract(u).modPow(n,this.q).equals(t));var h=this.lucasSequence(f,a,s);if(l=h[0],c=h[1],this.modMult(c,c).equals(u))return c.testBit(0)&&(c=c.add(q)),c=c.shiftRight(1),new o(q,c)}while(l.equals(r.ONE)||l.equals(t));return null},o.prototype.lucasSequence=function(e,t,n){for(var i=n.bitLength(),o=n.getLowestSetBit(),s=r.ONE,a=r.TWO,u=e,l=r.ONE,c=r.ONE,f=i-1;f>=o+1;--f)l=this.modMult(l,c),n.testBit(f)?(c=this.modMult(l,t),s=this.modMult(s,u),a=this.modReduce(u.multiply(a).subtract(e.multiply(l))),u=this.modReduce(u.multiply(u).subtract(c.shiftLeft(1)))):(c=l,s=this.modReduce(s.multiply(a).subtract(l)),u=this.modReduce(u.multiply(a).subtract(e.multiply(l))),a=this.modReduce(a.multiply(a).subtract(l.shiftLeft(1))));l=this.modMult(l,c),c=this.modMult(l,t),s=this.modReduce(s.multiply(a).subtract(l)),a=this.modReduce(u.multiply(a).subtract(e.multiply(l))),l=this.modMult(l,c);for(var f=1;f<=o;++f)s=this.modMult(s,a),a=this.modReduce(a.multiply(a).subtract(l.shiftLeft(1))),l=this.modMult(l,l);return[s,a]};var t={ECCurveFp:E,ECPointFp:d,ECFieldElementFp:o};e.exports=t},function(e,t,n){e.exports={read:g,readSSHPrivate:b,write:v};var r=n(27),i=n(102),o=n(31).Buffer,s=n(56),a=n(47),u=n(15),l=n(46),c=n(52),f=n(113),h=n(114),p=n(208),d=n(95),m;function g(e,t){return f.read(e,t)}var y="openssh-key-v1";function b(e,t,i){t=new p({buffer:t});var s=t.readCString();r.strictEqual(s,y,"bad magic string");var l=t.readString(),c=t.readString(),f=t.readBuffer(),g=t.readInt();if(1!==g)throw new Error("OpenSSH-format key file contains multiple keys: this is unsupported.");var b=t.readBuffer();if("public"===e)return r.ok(t.atEnd(),"excess bytes left after key"),h.read(b);var v=t.readBuffer();r.ok(t.atEnd(),"excess bytes left after key");var _=new p({buffer:f});switch(c){case"none":if("none"!==l)throw new Error('OpenSSH-format key uses KDF "none" but specifies a cipher other than "none"');break;case"bcrypt":var w=_.readBuffer(),k=_.readInt(),S=a.opensshCipherInfo(l);if(void 0===m&&(m=n(713)),"string"==typeof i.passphrase&&(i.passphrase=o.from(i.passphrase,"utf-8")),!o.isBuffer(i.passphrase))throw new d.KeyEncryptedError(i.filename,"OpenSSH");var E=new Uint8Array(i.passphrase),x=new Uint8Array(w),C=new Uint8Array(S.keySize+S.blockSize),A=m.pbkdf(E,E.length,x,x.length,C,C.length,k);if(0!==A)throw new Error("bcrypt_pbkdf function returned failure, parameters invalid");C=o.from(C);var I=C.slice(0,S.keySize),T=C.slice(S.keySize,S.keySize+S.blockSize),j=u.createDecipheriv(S.opensslName,I,T);j.setAutoPadding(!1);var O,P=[];for(j.once("error",function(e){if(-1!==e.toString().indexOf("bad decrypt"))throw new Error("Incorrect passphrase supplied, could not decrypt key");throw e}),j.write(v),j.end();null!==(O=j.read());)P.push(O);v=o.concat(P);break;default:throw new Error('OpenSSH-format key uses unknown KDF "'+c+'"')}t=new p({buffer:v});var B=t.readInt(),R=t.readInt();if(B!==R)throw new Error("Incorrect passphrase supplied, could not decrypt key");var N={},M=h.readInternal(N,"private",t.remainder());t.skip(N.consumed);var L=t.readString();return M.comment=L,M}function v(e,t){var i;i=c.isPrivateKey(e)?e.toPublic():e;var s="none",l="none",f=o.alloc(0),h={blockSize:8},d,g;if(void 0!==t&&(d=t.passphrase,"string"==typeof d&&(d=o.from(d,"utf-8")),void 0!==d&&(r.buffer(d,"options.passphrase"),r.optionalString(t.cipher,"options.cipher"),s=t.cipher,void 0===s&&(s="aes128-ctr"),h=a.opensshCipherInfo(s),l="bcrypt")),c.isPrivateKey(e)){g=new p({});var b=u.randomBytes(4).readUInt32BE(0);g.writeInt(b),g.writeInt(b),g.write(e.toBuffer("rfc4253")),g.writeString(e.comment||"");for(var v=1;g._offset%h.blockSize!=0;)g.writeChar(v++);g=g.toBuffer()}switch(l){case"none":break;case"bcrypt":var _=u.randomBytes(16),w=16,k=new p({});k.writeBuffer(_),k.writeInt(16),f=k.toBuffer(),void 0===m&&(m=n(713));var S=new Uint8Array(d),E=new Uint8Array(_),x=new Uint8Array(h.keySize+h.blockSize),C=m.pbkdf(S,S.length,E,E.length,x,x.length,16);if(0!==C)throw new Error("bcrypt_pbkdf function returned failure, parameters invalid");x=o.from(x);var A=x.slice(0,h.keySize),I=x.slice(h.keySize,h.keySize+h.blockSize),T=u.createCipheriv(h.opensslName,A,I);T.setAutoPadding(!1);var j,O=[];for(T.once("error",function(e){throw e}),T.write(g),T.end();null!==(j=T.read());)O.push(j);g=o.concat(O);break;default:throw new Error("Unsupported kdf "+l)}var P=new p({}),B;P.writeCString(y),P.writeString(s),P.writeString(l),P.writeBuffer(f),P.writeInt(1),P.writeBuffer(i.toBuffer("rfc4253")),g&&P.writeBuffer(g),P=P.toBuffer(),B=c.isPrivateKey(e)?"OPENSSH PRIVATE KEY":"OPENSSH PUBLIC KEY";var R=P.toString("base64"),N=R.length+R.length/70+18+16+2*B.length+10;P=o.alloc(N);var M=0;M+=P.write("-----BEGIN "+B+"-----\n",M);for(var L=0;LR.length&&(F=R.length),M+=P.write(R.slice(L,F),M),P[M++]=10,L=F}return M+=P.write("-----END "+B+"-----\n",M),P.slice(0,M)}},function(e,t,n){e.exports={DataError:n(1962),InvalidAccessError:n(1963),KeyFormatNotSupportedError:n(1964),CurrentlyNotSupportedError:n(1965),NotSupportedError:n(384),OperationError:n(1966),QuotaExceededError:n(1967),TypeMismatchError:n(1968)}},function(e,t,n){(function(r){const i=n(740),o=n(96),s=n(5)("dweb-transports:httptools");async function a(e,t,n,r){let i,o="undefined"!=typeof window&&window.loopguard;for(;n--&&o===("undefined"!=typeof window&&window.loopguard);)try{return await fetch(e)}catch(e){i=e,s("Delaying %s by %d ms because %s",r,t,e.message),await new Promise(e=>{setTimeout(()=>{e()},t)}),t*=1+Math.random()}throw console.warn("loopfetch of",r,"failed"),o!==("undefined"!=typeof window&&window.loopguard)?(s("Looping exited because of page change %s",r),new Error("Looping exited because of page change "+r)):i}"undefined"==typeof fetch&&(fetch=i,Headers=fetch.Headers,Request=fetch.Request),httptools={},httptools.p_httpfetch=async function(e,t,{wantstream:n=!1,retries:i}={}){try{s("p_httpfetch: %s %o",e,t.headers.range||"");let u=new Request(e,t),l=await a(u,500,i,"fetching "+e);if(l.ok){let e=l.headers.get("Content-Type");return n?l.body:void 0!==e&&e.startsWith("application/json")?l.json():void 0!==e&&e.startsWith("text")?l.text():new r(await l.arrayBuffer())}throw new o.TransportError(`Transport Error ${l.status}: ${l.statusText}`)}catch(t){throw s("p_httpfetch failed: %s",t.message),t instanceof o.TransportError?t:new o.TransportError(`Transport error thrown by ${e}: ${t.message}`)}},httptools.p_GET=function(e,t={},n){"function"==typeof t&&(n=t,t={});let r=new Headers;(t.start||t.end)&&r.append("range",`bytes=${t.start||0}-${t.end<1/0?t.end:""}`);const i=void 0===t.retries?12:t.retries;let o={method:"GET",headers:r,mode:"cors",cache:"default",redirect:"follow",keepalive:!0};const a=httptools.p_httpfetch(e,o,{retries:i,wantstream:t.wantstream});if(!n)return a;a.then(e=>{try{n(null,e)}catch(e){s("Uncaught error %O",e)}}).catch(e=>n(e))},httptools.p_POST=function(e,t={},n){"function"==typeof t&&(n=t,t={});const r=void 0===t.retries?0:t.retries;let i={method:"POST",headers:{},body:t.data,mode:"cors",cache:"default",redirect:"follow",keepalive:!1};t.contenttype&&(i.headers["Content-Type"]=t.contenttype);const o=httptools.p_httpfetch(e,i,{retries:r});if(!n)return o;o.then(e=>n(null,e)).catch(e=>n(e))},t=e.exports=httptools}).call(this,n(0).Buffer)},function(e,t){var n=9007199254740991;function r(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}e.exports=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={},e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=d;var r=n(66),i=p(r),o=n(216),s=p(o),a=n(753),u=p(a),l=n(135),c=p(l),f=n(290),h=p(f);function p(e){return e&&e.__esModule?e:{default:e}}function d(e){return function(t,n,r){if(r=(0,s.default)(r||i.default),e<=0||!t)return r(null);var o=(0,u.default)(t),a=!1,l=0,f=!1;function p(e,t){if(l-=1,e)a=!0,r(e);else{if(t===h.default||a&&l<=0)return a=!0,r(null);f||d()}}function d(){for(f=!0;l{t?n=a:a(s)}:a)):i(null,(i,s)=>{i?a(i):r?a(r):(t=!0,e(s,(e,i)=>{t=!1,r?(a(r),n(r)):e?o(e,a):i?a(null,s):o(null,a)}))})}}},t.asyncSort=function(e){const t=i(),n=r.collect((n,i)=>{if(n)return t.abort(n);e(i,(e,n)=>{if(e)return t.abort(e);t.resolve(r.values(i))})});return function(e){return n(e),t}},t.replaceStartWith=function(e,t){const n=new RegExp("^"+t);return e.replace(n,"")},t.tmpdir=(()=>o.join(s.tmpdir(),a()))},function(e,t){function n(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n-1?setImmediate:i.nextTick,u;_.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(49)},f=n(437),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(438),y;function b(){}function v(e,t){u=u||n(116),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||n(116),!(y.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";t.util=n(445),t.resolver=n(453)},function(e,t,n){"use strict";(function(e){const r=n(62),i=n(231),o=i.SHIFT32,s=i.SHIFT16,a=2097151;function u(e){return e<16?"0"+e.toString(16):e.toString(16)}t.parseHalf=function e(t){var n,r,i;return i=128&t[0]?-1:1,n=(124&t[0])>>2,r=(3&t[0])<<8|t[1],n?31===n?i*(r?NaN:Infinity):i*Math.pow(2,n-25)*(1024+r):5.960464477539063e-8*i*r},t.arrayBufferToBignumber=function(e){const t=e.byteLength;let n="";for(let r=0;r{const t=new Map,n=Object.keys(e),r=n.length;for(let i=0;ie*s+t),t.buildInt64=((e,n,i,s)=>{const a=t.buildInt32(e,n),u=t.buildInt32(i,s);return a>2097151?new r(a).times(o).plus(u):a*o+u}),t.writeHalf=function t(n,r){const i=e.allocUnsafe(4);i.writeFloatBE(r,0);const o=i.readUInt32BE(0);if(0!=(8191&o))return!1;var s=o>>16&32768;const a=o>>23&255,u=8388607&o;if(a>=113&&a<=142)s+=(a-112<<10)+(u>>13);else{if(!(a>=103&&a<113))return!1;if(u&(1<<126-a)-1)return!1;s+=u+8388608>>126-a}return n.writeUInt16BE(s,0),!0},t.keySorter=function(e,t){var n=e[0].byteLength,r=t[0].byteLength;return n>r?1:r>n?-1:e[0].compare(t[0])},t.isNegativeZero=(e=>0===e&&1/e<0),t.nextPowerOf2=(e=>{let t=0;if(e&&!(e&e-1))return e;for(;0!==e;)e>>=1,t+=1;return 1<=0||!o.gcd(t.n).equals(i.ONE));e=e.multiply(o.modPow(t.e,t.n)).mod(t.n);for(var s=e.mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(a)<0;)s=s.add(t.p);var u=s.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return u=u.multiply(o.modInverse(t.n)).mod(t.n),u};function d(e,t,n){var i=r.util.createBuffer(),o=Math.ceil(t.n.bitLength()/8);if(e.length>o-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=o-11,s}i.putByte(0),i.putByte(n);var a=o-3-e.length,u;if(0===n||1===n){u=0===n?0:255;for(var l=0;l0;){for(var c=0,f=r.random.getBytes(a),l=0;l1;){if(255!==s.getByte()){--s.read;break}++l}else if(2===u)for(l=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++l}var f=s.getByte();if(0!==f||l!==o-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function g(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};var o={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function a(){u(e.pBits,function(t,r){return t?n(t):(e.p=r,null!==e.q?l(t,e.q):void u(e.qBits,l))})}function u(e,t){r.prime.generateProbablePrime(e,o,t)}function l(t,r){if(t)return n(t);if(e.q=r,e.p.compareTo(e.q)<0){var o=e.p;e.p=e.q,e.q=o}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void a();if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.q=null,void u(e.qBits,l);if(e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(i.ONE))return e.p=e.q=null,void a();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void u(e.qBits,l);var c=e.e.modInverse(e.phi);e.keys={privateKey:s.rsa.setPrivateKey(e.n,e.e,c,e.p,e.q,c.mod(e.p1),c.mod(e.q1),e.q.modInverse(e.p)),publicKey:s.rsa.setPublicKey(e.n,e.e)},n(null,e.keys)}"prng"in t&&(o.prng=t.prng),a()}function y(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var n=r.util.hexToBytes(t);return n.length>1&&(0===n.charCodeAt(0)&&0==(128&n.charCodeAt(1))||255===n.charCodeAt(0)&&128==(128&n.charCodeAt(1)))?n.substr(1):n}function b(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function v(e){return"undefined"!=typeof window&&"object"==typeof window.crypto&&"object"==typeof window.crypto.subtle&&"function"==typeof window.crypto.subtle[e]}function _(e){return"undefined"!=typeof window&&"object"==typeof window.msCrypto&&"object"==typeof window.msCrypto.subtle&&"function"==typeof window.msCrypto.subtle[e]}function w(e){for(var t=r.util.hexToBytes(e.toString(16)),n=new Uint8Array(t.length),i=0;i0;)f.putByte(0),--h;return f.putBytes(r.util.hexToBytes(c)),f.getBytes()},s.rsa.decrypt=function(e,t,n,o){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=s,a}var u=new i(r.util.createBuffer(e).toHex(),16);if(u.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var l=p(u,t,n),c=l.toString(16),f=r.util.createBuffer(),h=s-Math.ceil(c.length/2);h>0;)f.putByte(0),--h;return f.putBytes(r.util.hexToBytes(c)),!1!==o?m(f.getBytes(),t,n):f.getBytes()},s.rsa.createKeyPairGenerationState=function(e,t,n){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048,n=n||{};var o=n.prng||r.random,s={nextBytes:function(e){for(var t=o.getBytesSync(e.length),n=0;n>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},u.e.fromInt(u.eInt),u},s.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var n=new i(null);n.fromInt(30);for(var r=0,o=function(e,t){return e|t},u=+new Date,l,c=0;null===e.keys&&(t<=0||cf?e.pqState=0:e.num.isProbablePrime(b(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(a[r++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var p=e.e.modInverse(e.phi);e.keys={privateKey:s.rsa.setPrivateKey(e.n,e.e,p,e.p,e.q,p.mod(e.p1),p.mod(e.q1),e.q.modInverse(e.p)),publicKey:s.rsa.setPublicKey(e.n,e.e)}}l=+new Date,c+=l-u,u=l}return null!==e.keys},s.rsa.generateKeyPair=function(e,t,n,i){if(1===arguments.length?"object"==typeof e?(n=e,e=void 0):"function"==typeof e&&(i=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(i=t,t=void 0):"number"!=typeof t&&(n=t,t=void 0):(n=e,i=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof n&&(i=n,n=void 0):(i=n,n=t,t=void 0)),n=n||{},void 0===e&&(e=n.bits||2048),void 0===t&&(t=n.e||65537),!r.options.usePureJavaScript&&i&&e>=256&&e<=16384&&(65537===t||3===t)){if(v("generateKey")&&v("exportKey"))return window.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:w(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return window.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){i(e)}).then(function(e){if(e){var t=s.privateKeyFromAsn1(o.fromDer(r.util.createBuffer(e)));i(null,{privateKey:t,publicKey:s.setRsaPublicKey(t.n,t.e)})}});if(_("generateKey")&&_("exportKey")){var a=window.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:w(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return a.oncomplete=function(e){var t=e.target.result,n=window.msCrypto.subtle.exportKey("pkcs8",t.privateKey);n.oncomplete=function(e){var t=e.target.result,n=s.privateKeyFromAsn1(o.fromDer(r.util.createBuffer(t)));i(null,{privateKey:n,publicKey:s.setRsaPublicKey(n.n,n.e)})},n.onerror=function(e){i(e)}},void(a.onerror=function(e){i(e)})}}var u=s.rsa.createKeyPairGenerationState(e,t,n);if(!i)return s.rsa.stepKeyPairGenerationState(u,0),u.keys;g(u,n,i)},s.setRsaPublicKey=s.rsa.setPublicKey=function(e,t){var n={n:e,e:t,encrypt:function(e,t,i){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,n){return d(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return r.pkcs1.encode_rsa_oaep(t,e,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var o=t.encode(e,n,!0);return s.rsa.encrypt(o,n,!0)},verify:function(e,t,r){"string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===r?r={verify:function(e,t){t=m(t,n,!0);var r=o.fromDer(t);return e===r.value[1].value}}:"NONE"!==r&&"NULL"!==r&&null!==r||(r={verify:function(e,t){return t=m(t,n,!0),e===t}});var i=s.rsa.decrypt(t,n,!0,!1);return r.verify(e,i,n.n.bitLength())}};return n},s.setRsaPrivateKey=s.rsa.setPrivateKey=function(e,t,n,i,o,a,u,l){var c={n:e,e:t,d:n,p:i,q:o,dP:a,dQ:u,qInv:l,decrypt:function(e,t,n){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=s.rsa.decrypt(e,c,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:m};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return r.pkcs1.decode_rsa_oaep(t,e,n)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(i,c,!1)},sign:function(e,t){var n=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:h},n=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},n=1);var r=t.encode(e,c.n.bitLength());return s.rsa.encrypt(r,c,n)}};return c},s.wrapRsaPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,o.toDer(e).getBytes())])},s.privateKeyFromAsn1=function(e){var t={},n=[],a,c,f,h,p,d,m,g;if(o.validate(e,u,t,n)&&(e=o.fromDer(r.util.createBuffer(t.privateKey))),t={},n=[],!o.validate(e,l,t,n)){var y=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw y.errors=n,y}return a=r.util.createBuffer(t.privateKeyModulus).toHex(),c=r.util.createBuffer(t.privateKeyPublicExponent).toHex(),f=r.util.createBuffer(t.privateKeyPrivateExponent).toHex(),h=r.util.createBuffer(t.privateKeyPrime1).toHex(),p=r.util.createBuffer(t.privateKeyPrime2).toHex(),d=r.util.createBuffer(t.privateKeyExponent1).toHex(),m=r.util.createBuffer(t.privateKeyExponent2).toHex(),g=r.util.createBuffer(t.privateKeyCoefficient).toHex(),s.setRsaPrivateKey(new i(a,16),new i(c,16),new i(f,16),new i(h,16),new i(p,16),new i(d,16),new i(m,16),new i(g,16))},s.privateKeyToAsn1=s.privateKeyToRSAPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.e)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.d)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.p)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.q)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.dP)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.dQ)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.qInv))])},s.publicKeyFromAsn1=function(e){var t={},n=[];if(o.validate(e,f,t,n)){var a=o.derToOid(t.publicKeyOid);if(a!==s.oids.rsaEncryption){var u=new Error("Cannot read public key. Unknown OID.");throw u.oid=a,u}e=t.rsaPublicKey}if(n=[],!o.validate(e,c,t,n)){var u=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw u.errors=n,u}var l=r.util.createBuffer(t.publicKeyModulus).toHex(),h=r.util.createBuffer(t.publicKeyExponent).toHex();return s.setRsaPublicKey(new i(l,16),new i(h,16))},s.publicKeyToAsn1=s.publicKeyToSubjectPublicKeyInfo=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.BITSTRING,!1,[s.publicKeyToRSAPublicKey(e)])])},s.publicKeyToRSAPublicKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.e))])}},function(e,t,n){var r=n(19);if(n(236),n(140),n(308),n(118),n(177),n(461),n(309),n(141),n(900),n(306),n(34),void 0===i)var i=r.jsbn.BigInteger;var o=r.asn1,s=r.pki=r.pki||{};e.exports=s.pbe=r.pbe=r.pbe||{};var a=s.oids,u={name:"EncryptedPrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},l={name:"PBES2Algorithms",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},c={name:"pkcs-12PbeParams",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"iterations"}]};function f(e,t){return e.start().update(t).digest().getBytes()}function h(e){var t;if(e){if(t=s.oids[o.derToOid(e)],!t){var n=new Error("Unsupported PRF OID.");throw n.oid=e,n.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],n}}else t="hmacWithSHA1";return p(t)}function p(e){var t=r.md;switch(e){case"hmacWithSHA224":t=r.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var n=new Error("Unsupported PRF algorithm.");throw n.algorithm=e,n.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],n}if(!(t&&e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}function d(e,t,n,i){var a=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,t.getBytes())]);return"hmacWithSHA1"!==i&&a.value.push(o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,r.util.hexToBytes(n.toString(16))),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids[i]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")])),a}s.encryptPrivateKeyInfo=function(e,t,n){n=n||{},n.saltSize=n.saltSize||8,n.count=n.count||2048,n.algorithm=n.algorithm||"aes128",n.prfAlgorithm=n.prfAlgorithm||"sha1";var i=r.random.getBytesSync(n.saltSize),u=n.count,l=o.integerToDer(u),c,f,h;if(0===n.algorithm.indexOf("aes")||"des"===n.algorithm){var m,g,y;switch(n.algorithm){case"aes128":c=16,m=16,g=a["aes128-CBC"],y=r.aes.createEncryptionCipher;break;case"aes192":c=24,m=16,g=a["aes192-CBC"],y=r.aes.createEncryptionCipher;break;case"aes256":c=32,m=16,g=a["aes256-CBC"],y=r.aes.createEncryptionCipher;break;case"des":c=8,m=8,g=a.desCBC,y=r.des.createEncryptionCipher;break;default:var b=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw b.algorithm=n.algorithm,b}var v="hmacWith"+n.prfAlgorithm.toUpperCase(),_=p(v),w=r.pkcs5.pbkdf2(t,i,u,c,_),k=r.random.getBytesSync(m),S=y(w);S.start(k),S.update(o.toDer(e)),S.finish(),h=S.output.getBytes();var E=d(i,l,c,v);f=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBES2).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBKDF2).getBytes()),E]),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(g).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,k)])])])}else{if("3des"!==n.algorithm){var b=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw b.algorithm=n.algorithm,b}c=24;var x=new r.util.ByteBuffer(i),w=s.pbe.generatePkcs12Key(t,x,1,u,c),k=s.pbe.generatePkcs12Key(t,x,2,u,c),S=r.des.createEncryptionCipher(w);S.start(k),S.update(o.toDer(e)),S.finish(),h=S.output.getBytes(),f=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,i),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,l.getBytes())])])}var C=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[f,o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,h)]);return C},s.decryptPrivateKeyInfo=function(e,t){var n=null,i={},a=[];if(!o.validate(e,u,i,a)){var l=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw l.errors=a,l}var c=o.derToOid(i.encryptionOid),f=s.pbe.getCipher(c,i.encryptionParams,t),h=r.util.createBuffer(i.encryptedData);return f.update(h),f.finish()&&(n=o.fromDer(f.output)),n},s.encryptedPrivateKeyToPem=function(e,t){var n={type:"ENCRYPTED PRIVATE KEY",body:o.toDer(e).getBytes()};return r.pem.encode(n,{maxline:t})},s.encryptedPrivateKeyFromPem=function(e){var t=r.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var n=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw n.headerType=t.type,n}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return o.fromDer(t.body)},s.encryptRsaPrivateKey=function(e,t,n){if(n=n||{},!n.legacy){var i=s.wrapRsaPrivateKey(s.privateKeyToAsn1(e));return i=s.encryptPrivateKeyInfo(i,t,n),s.encryptedPrivateKeyToPem(i)}var a,u,l,c;switch(n.algorithm){case"aes128":a="AES-128-CBC",l=16,u=r.random.getBytesSync(16),c=r.aes.createEncryptionCipher;break;case"aes192":a="AES-192-CBC",l=24,u=r.random.getBytesSync(16),c=r.aes.createEncryptionCipher;break;case"aes256":a="AES-256-CBC",l=32,u=r.random.getBytesSync(16),c=r.aes.createEncryptionCipher;break;case"3des":a="DES-EDE3-CBC",l=24,u=r.random.getBytesSync(8),c=r.des.createEncryptionCipher;break;case"des":a="DES-CBC",l=8,u=r.random.getBytesSync(8),c=r.des.createEncryptionCipher;break;default:var f=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+n.algorithm+'".');throw f.algorithm=n.algorithm,f}var h=r.pbe.opensslDeriveBytes(t,u.substr(0,8),l),p=c(h);p.start(u),p.update(o.toDer(s.privateKeyToAsn1(e))),p.finish();var d={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:r.util.bytesToHex(u).toUpperCase()},body:p.output.getBytes()};return r.pem.encode(d)},s.decryptRsaPrivateKey=function(e,t){var n=null,i=r.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type){var a=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw a.headerType=a,a}if(i.procType&&"ENCRYPTED"===i.procType.type){var u,l;switch(i.dekInfo.algorithm){case"DES-CBC":u=8,l=r.des.createDecryptionCipher;break;case"DES-EDE3-CBC":u=24,l=r.des.createDecryptionCipher;break;case"AES-128-CBC":u=16,l=r.aes.createDecryptionCipher;break;case"AES-192-CBC":u=24,l=r.aes.createDecryptionCipher;break;case"AES-256-CBC":u=32,l=r.aes.createDecryptionCipher;break;case"RC2-40-CBC":u=5,l=function(e){return r.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":u=8,l=function(e){return r.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":u=16,l=function(e){return r.rc2.createDecryptionCipher(e,128)};break;default:var a=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".');throw a.algorithm=i.dekInfo.algorithm,a}var c=r.util.hexToBytes(i.dekInfo.parameters),f=r.pbe.opensslDeriveBytes(t,c.substr(0,8),u),h=l(f);if(h.start(c),h.update(r.util.createBuffer(i.body)),!h.finish())return n;n=h.output.getBytes()}else n=i.body;return n="ENCRYPTED PRIVATE KEY"===i.type?s.decryptPrivateKeyInfo(o.fromDer(n),t):o.fromDer(n),null!==n&&(n=s.privateKeyFromAsn1(n)),n},s.pbe.generatePkcs12Key=function(e,t,n,i,o,s){var a,u;if(void 0===s||null===s){if(!("sha1"in r.md))throw new Error('"sha1" hash algorithm unavailable.');s=r.md.sha1.create()}var l=s.digestLength,c=s.blockLength,f=new r.util.ByteBuffer,h=new r.util.ByteBuffer;if(null!==e&&void 0!==e){for(u=0;u=0;u--)T>>=8,T+=x.at(u)+I.at(u),I.setAt(u,255&T);A.putBuffer(I)}_=A,f.putBuffer(S)}return f.truncate(f.length()-o),f},s.pbe.getCipher=function(e,t,n){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,n);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,n);default:var r=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw r.oid=e,r.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],r}},s.pbe.getCipherForPBES2=function(e,t,n){var i={},a=[];if(!o.validate(t,l,i,a)){var u=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw u.errors=a,u}if(e=o.derToOid(i.kdfOid),e!==s.oids.pkcs5PBKDF2){var u=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw u.oid=e,u.supportedOids=["pkcs5PBKDF2"],u}if(e=o.derToOid(i.encOid),e!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC){var u=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw u.oid=e,u.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],u}var c=i.kdfSalt,f=r.util.createBuffer(i.kdfIterationCount),p,d;switch(f=f.getInt(f.length()<<3),s.oids[e]){case"aes128-CBC":p=16,d=r.aes.createDecryptionCipher;break;case"aes192-CBC":p=24,d=r.aes.createDecryptionCipher;break;case"aes256-CBC":p=32,d=r.aes.createDecryptionCipher;break;case"des-EDE3-CBC":p=24,d=r.des.createDecryptionCipher;break;case"desCBC":p=8,d=r.des.createDecryptionCipher}var m=h(i.prfOid),g=r.pkcs5.pbkdf2(n,c,f,p,m),y=i.encIv,b=d(g);return b.start(y),b},s.pbe.getCipherForPKCS12PBE=function(e,t,n){var i={},a=[];if(!o.validate(t,c,i,a)){var u=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw u.errors=a,u}var l=r.util.createBuffer(i.salt),f=r.util.createBuffer(i.iterations),p,d,m;switch(f=f.getInt(f.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:p=24,d=8,m=r.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:p=5,d=8,m=function(e,t){var n=r.rc2.createDecryptionCipher(e,40);return n.start(t,null),n};break;default:var u=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw u.oid=e,u}var g=h(i.prfOid),y=s.pbe.generatePkcs12Key(n,l,1,f,p,g);g.start();var b=s.pbe.generatePkcs12Key(n,l,2,f,d,g);return m(y,b)},s.pbe.opensslDeriveBytes=function(e,t,n,i){if(void 0===i||null===i){if(!("md5"in r.md))throw new Error('"md5" hash algorithm unavailable.');i=r.md.md5.create()}null===t&&(t="");for(var o=[f(i,e+t)],s=16,a=1;s8?3:1,g=[],y=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,v,_=0;_>>4^k),k^=v,w^=v<<4,v=65535&(k>>>-16^w),w^=v,k^=v<<-16,v=858993459&(w>>>2^k),k^=v,w^=v<<2,v=65535&(k>>>-16^w),w^=v,k^=v<<-16,v=1431655765&(w>>>1^k),k^=v,w^=v<<1,v=16711935&(k>>>8^w),w^=v,k^=v<<8,v=1431655765&(w>>>1^k),k^=v,w^=v<<1,v=w<<8|k>>>20&240,w=k<<24|k<<8&16711680|k>>>8&65280|k>>>24&240,k=v;for(var S=0;S>>26,k=k<<2|k>>>26):(w=w<<1|w>>>27,k=k<<1|k>>>27),w&=-15,k&=-15;var E=t[w>>>28]|n[w>>>24&15]|r[w>>>20&15]|i[w>>>16&15]|o[w>>>12&15]|s[w>>>8&15]|a[w>>>4&15],x=u[k>>>28]|l[k>>>24&15]|c[k>>>20&15]|f[k>>>16&15]|h[k>>>12&15]|p[k>>>8&15]|d[k>>>4&15];v=65535&(x>>>16^E),g[b++]=E^v,g[b++]=x^v<<16}}return g}function d(e,t,n,r){var i=32===e.length?3:9,p,d;p=3===i?r?[30,-2,-2]:[0,32,2]:r?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var m=t[0],g=t[1];d=252645135&(m>>>4^g),g^=d,m^=d<<4,d=65535&(m>>>16^g),g^=d,m^=d<<16,d=858993459&(g>>>2^m),m^=d,g^=d<<2,d=16711935&(g>>>8^m),m^=d,g^=d<<8,d=1431655765&(m>>>1^g),g^=d,m^=d<<1,m=m<<1|m>>>31,g=g<<1|g>>>31;for(var y=0;y>>4|g<<28)^e[_+1];d=m,m=g,g=d^(s[w>>>24&63]|u[w>>>16&63]|c[w>>>8&63]|h[63&w]|o[k>>>24&63]|a[k>>>16&63]|l[k>>>8&63]|f[63&k])}d=m,m=g,g=d}m=m>>>1|m<<31,g=g>>>1|g<<31,d=1431655765&(m>>>1^g),g^=d,m^=d<<1,d=16711935&(g>>>8^m),m^=d,g^=d<<8,d=858993459&(g>>>2^m),m^=d,g^=d<<2,d=65535&(m>>>16^g),g^=d,m^=d<<16,d=252645135&(m>>>4^g),g^=d,m^=d<<4,n[0]=m,n[1]=g}function m(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),n="DES-"+t,i;i=e.decrypt?r.cipher.createDecipher(n,e.key):r.cipher.createCipher(n,e.key);var o=i.start;return i.start=function(e,t){var n=null;t instanceof r.util.ByteBuffer&&(n=t,t={}),t=t||{},t.output=n,t.iv=e,o.call(i,t)},i}},function(e,t,n){var r=n(19);n(34);var i=e.exports=r.pem=r.pem||{};function o(e){for(var t=e.name+": ",n=[],r=function(e,t){return" "+t},i=0;i65&&-1!==s){var a=t[s];","===a?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+a+t.substr(s+1),o=i-s-1,s=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(s=i);return t}function s(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var n="-----BEGIN "+e.type+"-----\r\n",i;if(e.procType&&(i={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},n+=o(i)),e.contentDomain&&(i={name:"Content-Domain",values:[e.contentDomain]},n+=o(i)),e.dekInfo&&(i={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&i.values.push(e.dekInfo.parameters),n+=o(i)),e.headers)for(var s=0;s{n(null,e)},e=>{n(e)})}},function(e,t,n){"use strict";e.exports=self.crypto||self.msCrypto},function(e,t,n){"use strict";const r=n(903);e.exports=function(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return r(e)}},function(e,t){var n=[].indexOf;e.exports=function(e,t){if(n)return e.indexOf(t);for(var r=0;r72)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-2)return!1;if(2!==e[2])return!1;var t=e[3];if(0===t)return!1;if(5+t>=e.length)return!1;if(2!==e[4+t])return!1;var n=e[5+t];return 0!==n&&(6+t+n===e.length&&(!(128&e[4])&&(!(t>1&&0===e[4]&&!(128&e[5]))&&(!(128&e[t+6])&&!(n>1&&0===e[t+6]&&!(128&e[t+7]))))))}function o(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(48!==e[0])throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(2!==e[2])throw new Error("Expected DER integer");var t=e[3];if(0===t)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(2!==e[4+t])throw new Error("Expected DER integer (2)");var n=e[5+t];if(0===n)throw new Error("S length is zero");if(6+t+n!==e.length)throw new Error("S length is invalid");if(128&e[4])throw new Error("R value is negative");if(t>1&&0===e[4]&&!(128&e[5]))throw new Error("R value excessively padded");if(128&e[t+6])throw new Error("S value is negative");if(n>1&&0===e[t+6]&&!(128&e[t+7]))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}}function s(e,t){var n=e.length,i=t.length;if(0===n)throw new Error("R length is zero");if(0===i)throw new Error("S length is zero");if(n>33)throw new Error("R length is too long");if(i>33)throw new Error("S length is too long");if(128&e[0])throw new Error("R value is negative");if(128&t[0])throw new Error("S value is negative");if(n>1&&0===e[0]&&!(128&e[1]))throw new Error("R value excessively padded");if(i>1&&0===t[0]&&!(128&t[1]))throw new Error("S value excessively padded");var o=r.allocUnsafe(6+n+i);return o[0]=48,o[1]=o.length-2,o[2]=2,o[3]=e.length,e.copy(o,4),o[4+n]=2,o[5+n]=t.length,t.copy(o,6+n),o}e.exports={check:i,decode:o,encode:s}},function(e){e.exports={COMPRESSED_TYPE_INVALID:"compressed should be a boolean",EC_PRIVATE_KEY_TYPE_INVALID:"private key should be a Buffer",EC_PRIVATE_KEY_LENGTH_INVALID:"private key length is invalid",EC_PRIVATE_KEY_RANGE_INVALID:"private key range is invalid",EC_PRIVATE_KEY_TWEAK_ADD_FAIL:"tweak out of range or resulting private key is invalid",EC_PRIVATE_KEY_TWEAK_MUL_FAIL:"tweak out of range",EC_PRIVATE_KEY_EXPORT_DER_FAIL:"couldn't export to DER format",EC_PRIVATE_KEY_IMPORT_DER_FAIL:"couldn't import from DER format",EC_PUBLIC_KEYS_TYPE_INVALID:"public keys should be an Array",EC_PUBLIC_KEYS_LENGTH_INVALID:"public keys Array should have at least 1 element",EC_PUBLIC_KEY_TYPE_INVALID:"public key should be a Buffer",EC_PUBLIC_KEY_LENGTH_INVALID:"public key length is invalid",EC_PUBLIC_KEY_PARSE_FAIL:"the public key could not be parsed or is invalid",EC_PUBLIC_KEY_CREATE_FAIL:"private was invalid, try again",EC_PUBLIC_KEY_TWEAK_ADD_FAIL:"tweak out of range or resulting public key is invalid",EC_PUBLIC_KEY_TWEAK_MUL_FAIL:"tweak out of range",EC_PUBLIC_KEY_COMBINE_FAIL:"the sum of the public keys is not valid",ECDH_FAIL:"scalar was invalid (zero or overflow)",ECDSA_SIGNATURE_TYPE_INVALID:"signature should be a Buffer",ECDSA_SIGNATURE_LENGTH_INVALID:"signature length is invalid",ECDSA_SIGNATURE_PARSE_FAIL:"couldn't parse signature",ECDSA_SIGNATURE_PARSE_DER_FAIL:"couldn't parse DER signature",ECDSA_SIGNATURE_SERIALIZE_DER_FAIL:"couldn't serialize signature to DER format",ECDSA_SIGN_FAIL:"nonce generation function failed or private key is invalid",ECDSA_RECOVER_FAIL:"couldn't recover public key from signature",MSG32_TYPE_INVALID:"message should be a Buffer",MSG32_LENGTH_INVALID:"message length is invalid",OPTIONS_TYPE_INVALID:"options should be an Object",OPTIONS_DATA_TYPE_INVALID:"options.data should be a Buffer",OPTIONS_DATA_LENGTH_INVALID:"options.data length is invalid",OPTIONS_NONCEFN_TYPE_INVALID:"options.noncefn should be a Function",RECOVERY_ID_TYPE_INVALID:"recovery should be a Number",RECOVERY_ID_VALUE_INVALID:"recovery should have value between -1 and 4",TWEAK_TYPE_INVALID:"tweak should be a Buffer",TWEAK_LENGTH_INVALID:"tweak length is invalid"}},function(e,t,n){"use strict";var r=n(1),i=n(468),o=n(4).Buffer,s=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(e,t){return e<>>32-t}function l(e,t,n,r,i,o,s){return u(e+(t&n|~t&r)+i+o|0,s)+t|0}function c(e,t,n,r,i,o,s){return u(e+(t&r|n&~r)+i+o|0,s)+t|0}function f(e,t,n,r,i,o,s){return u(e+(t^n^r)+i+o|0,s)+t|0}function h(e,t,n,r,i,o,s){return u(e+(n^(t|~r))+i+o|0,s)+t|0}r(a,i),a.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var n=this._a,r=this._b,i=this._c,o=this._d;n=l(n,r,i,o,e[0],3614090360,7),o=l(o,n,r,i,e[1],3905402710,12),i=l(i,o,n,r,e[2],606105819,17),r=l(r,i,o,n,e[3],3250441966,22),n=l(n,r,i,o,e[4],4118548399,7),o=l(o,n,r,i,e[5],1200080426,12),i=l(i,o,n,r,e[6],2821735955,17),r=l(r,i,o,n,e[7],4249261313,22),n=l(n,r,i,o,e[8],1770035416,7),o=l(o,n,r,i,e[9],2336552879,12),i=l(i,o,n,r,e[10],4294925233,17),r=l(r,i,o,n,e[11],2304563134,22),n=l(n,r,i,o,e[12],1804603682,7),o=l(o,n,r,i,e[13],4254626195,12),i=l(i,o,n,r,e[14],2792965006,17),r=l(r,i,o,n,e[15],1236535329,22),n=c(n,r,i,o,e[1],4129170786,5),o=c(o,n,r,i,e[6],3225465664,9),i=c(i,o,n,r,e[11],643717713,14),r=c(r,i,o,n,e[0],3921069994,20),n=c(n,r,i,o,e[5],3593408605,5),o=c(o,n,r,i,e[10],38016083,9),i=c(i,o,n,r,e[15],3634488961,14),r=c(r,i,o,n,e[4],3889429448,20),n=c(n,r,i,o,e[9],568446438,5),o=c(o,n,r,i,e[14],3275163606,9),i=c(i,o,n,r,e[3],4107603335,14),r=c(r,i,o,n,e[8],1163531501,20),n=c(n,r,i,o,e[13],2850285829,5),o=c(o,n,r,i,e[2],4243563512,9),i=c(i,o,n,r,e[7],1735328473,14),r=c(r,i,o,n,e[12],2368359562,20),n=f(n,r,i,o,e[5],4294588738,4),o=f(o,n,r,i,e[8],2272392833,11),i=f(i,o,n,r,e[11],1839030562,16),r=f(r,i,o,n,e[14],4259657740,23),n=f(n,r,i,o,e[1],2763975236,4),o=f(o,n,r,i,e[4],1272893353,11),i=f(i,o,n,r,e[7],4139469664,16),r=f(r,i,o,n,e[10],3200236656,23),n=f(n,r,i,o,e[13],681279174,4),o=f(o,n,r,i,e[0],3936430074,11),i=f(i,o,n,r,e[3],3572445317,16),r=f(r,i,o,n,e[6],76029189,23),n=f(n,r,i,o,e[9],3654602809,4),o=f(o,n,r,i,e[12],3873151461,11),i=f(i,o,n,r,e[15],530742520,16),r=f(r,i,o,n,e[2],3299628645,23),n=h(n,r,i,o,e[0],4096336452,6),o=h(o,n,r,i,e[7],1126891415,10),i=h(i,o,n,r,e[14],2878612391,15),r=h(r,i,o,n,e[5],4237533241,21),n=h(n,r,i,o,e[12],1700485571,6),o=h(o,n,r,i,e[3],2399980690,10),i=h(i,o,n,r,e[10],4293915773,15),r=h(r,i,o,n,e[1],2240044497,21),n=h(n,r,i,o,e[8],1873313359,6),o=h(o,n,r,i,e[15],4264355552,10),i=h(i,o,n,r,e[6],2734768916,15),r=h(r,i,o,n,e[13],1309151649,21),n=h(n,r,i,o,e[4],4149444226,6),o=h(o,n,r,i,e[11],3174756917,10),i=h(i,o,n,r,e[2],718787259,15),r=h(r,i,o,n,e[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+r|0,this._c=this._c+i|0,this._d=this._d+o|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=o.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=a},function(e,t,n){"use strict";var r=n(1),i=n(931),o=n(119),s=n(4).Buffer,a=n(932),u=n(469),l=n(470),c=s.alloc(128);function f(e,t){o.call(this,"digest"),"string"==typeof t&&(t=s.from(t));var n="sha512"===e||"sha384"===e?128:64;if(this._alg=e,this._key=t,t.length>n){var r="rmd160"===e?new u:l(e);t=r.update(t).digest()}else t.length{const t=o.apply(null,e);r.codes[t.code]=t,r.names[t.name]=t}),r.object=o,e.exports=r},function(e,t,n){"use strict";const r=1e3;e.exports={maxProvidersPerRequest:3,providerRequestTimeout:1e4,hasBlockTimeout:15e3,provideTimeout:15e3,kMaxPriority:Math.pow(2,31)-1,rebroadcastDelay:1e4,maxListeners:1e3}},function(e,t,n){var r=n(67),i=n(321),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!i(e))||(s.test(e)||!o.test(e)||null!=t&&e in Object(t))}e.exports=a},function(e,t,n){var r=n(133),i=n(103),o="[object Symbol]";function s(e){return"symbol"==typeof e||i(e)&&r(e)==o}e.exports=s},function(e,t,n){var r=n(1003),i=n(1019),o=n(1021),s=n(1022),a=n(1023);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{let r,i;if(e<0)r=n,i=t;else{if(!(e>0))return t[0];r=t,i=n}for(let e of r)for(let t of i)if(e===t)return e;throw new Error("No algorithms in common!")}),t.makeMacAndCipher=((e,t)=>{l([t=>c(e.hashT,e.keys.macKey,t),t=>f(e.cipherT,e.keys.iv,e.keys.cipherKey,t)],(n,r)=>{if(n)return t(n);e.mac=r[0],e.cipher=r[1],t()})}),t.selectBest=((n,r,i)=>{t.digest(e.concat([r.pubKeyBytes,n.nonce]),(o,s)=>{if(o)return i(o);t.digest(e.concat([n.pubKeyBytes,r.nonce]),(o,a)=>{if(o)return i(o);const u=e.compare(s,a);if(0===u)return i(new Error("you are trying to talk to yourself"));i(null,{curveT:t.theBest(u,n.exchanges,r.exchanges),cipherT:t.theBest(u,n.ciphers,r.ciphers),hashT:t.theBest(u,n.hashes,r.hashes),order:u})})})}),t.digest=((e,t)=>{r.digest(e,"sha2-256",e.length,t)}),t.write=function e(t,n,r){r=r||(()=>{}),o(s([n]),i.encode({fixed:!0,bytes:4}),a((e,n)=>{if(e)return r(e);t.shake.write(n[0]),r()}))},t.read=function e(t,n){i.decodeFromReader(t,{fixed:!0,bytes:4},n)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(e){const r=n(70),i=n(23),o=n(71),s=n(53),a=n(11),u=n(5),l=u("libp2p:secio");l.error=u("libp2p:secio:error");const c=r(n(1111)),f=n(328),h=16;t.createProposal=(e=>(e.proposal.out={rand:o.randomBytes(16),pubkey:e.key.local.public.bytes,exchanges:f.exchanges.join(","),ciphers:f.ciphers.join(","),hashes:f.hashes.join(",")},e.proposalEncoded.out=c.Propose.encode(e.proposal.out),e.proposalEncoded.out)),t.createExchange=((t,n)=>{o.keys.generateEphemeralKeyPair(t.protocols.local.curveT,(r,i)=>{if(r)return n(r);t.ephemeralKey.local=i.key,t.shared.generate=i.genSharedKey;const o=e.concat([t.proposalEncoded.out,t.proposalEncoded.in,t.ephemeralKey.local]);t.key.local.sign(o,(e,r)=>{if(e)return n(e);t.exchange.out={epubkey:t.ephemeralKey.local,signature:r},n(null,c.Exchange.encode(t.exchange.out))})})}),t.identify=((e,t,n)=>{l("1.1 identify"),e.proposalEncoded.in=t,e.proposal.in=c.Propose.decode(t);const r=e.proposal.in.pubkey;e.key.remote=o.keys.unmarshalPublicKey(r),i.createFromPubKey(r.toString("base64"),(t,r)=>{if(t)return n(t);if(e.id.remote){if(e.id.remote.toB58String()!==r.toB58String())return n(new Error("dialed to the wrong peer, Ids do not match"))}else e.id.remote=r;l("1.1 identify - %s - identified remote peer as %s",e.id.local.toB58String(),e.id.remote.toB58String()),n()})}),t.selectProtocols=((e,t)=>{l("1.2 selection");const n={pubKeyBytes:e.key.local.public.bytes,exchanges:f.exchanges,hashes:f.hashes,ciphers:f.ciphers,nonce:e.proposal.out.rand},r={pubKeyBytes:e.proposal.in.pubkey,exchanges:e.proposal.in.exchanges.split(","),hashes:e.proposal.in.hashes.split(","),ciphers:e.proposal.in.ciphers.split(","),nonce:e.proposal.in.rand};f.selectBest(n,r,(n,r)=>{if(n)return t(n);e.protocols.remote={order:r.order,curveT:r.curveT,cipherT:r.cipherT,hashT:r.hashT},e.protocols.local={order:r.order,curveT:r.curveT,cipherT:r.cipherT,hashT:r.hashT},t()})}),t.verify=((t,n,r)=>{l("2.1. verify"),t.exchange.in=c.Exchange.decode(n),t.ephemeralKey.remote=t.exchange.in.epubkey;const i=e.concat([t.proposalEncoded.in,t.proposalEncoded.out,t.ephemeralKey.remote]);t.key.remote.verify(i,t.exchange.in.signature,(e,t)=>e?r(e):t?(l("2.1. verify - signature verified"),void r()):r(new Error("Bad signature")))}),t.generateKeys=((e,t)=>{l("2.2. keys"),a([t=>e.shared.generate(e.exchange.in.epubkey,t),(t,n)=>{e.shared.secret=t,o.keys.keyStretcher(e.protocols.local.cipherT,e.protocols.local.hashT,e.shared.secret,n)},(t,n)=>{if(e.protocols.local.order>0)e.protocols.local.keys=t.k1,e.protocols.remote.keys=t.k2;else{if(!(e.protocols.local.order<0))return n(new Error("you are trying to talk to yourself"));e.protocols.local.keys=t.k2,e.protocols.remote.keys=t.k1}l("2.3. mac + cipher"),s([t=>f.makeMacAndCipher(e.protocols.local,t),t=>f.makeMacAndCipher(e.protocols.remote,t)],n)}],t)}),t.verifyNonce=((e,t)=>{const n=e.proposal.out.rand;if(!n.equals(t))throw new Error(`Failed to read our encrypted nonce: ${n.toString("hex")} != ${t.toString("hex")}`)})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var r=n(66),i=f(r),o=n(145),s=f(o),a=n(41),u=f(a),l=n(104),c=f(l);function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t){var n=null,r;t=t||i.default,(0,s.default)(e,function(e,t){(0,u.default)(e)(function(e,i){r=arguments.length>2?(0,c.default)(arguments,1):i,n=e,t(!e)})},function(){t(n,r)})}e.exports=t.default},function(e,t,n){"use strict";const r=n(70),i="\nmessage Identify {\n // protocolVersion determines compatibility between peers\n optional string protocolVersion = 5; // e.g. ipfs/1.0.0\n\n // agentVersion is like a UserAgent string in browsers, or client version in bittorrent\n // includes the client name and client.\n optional string agentVersion = 6; // e.g. go-ipfs/0.1.0\n\n // publicKey is this node's public key (which also gives its node.ID)\n // - may not need to be sent, as secure channel implies it has been sent.\n // - then again, if we change / disable secure channel, may still want it.\n optional bytes publicKey = 1;\n\n // listenAddrs are the multiaddrs the sender node listens for open connections on\n repeated bytes listenAddrs = 2;\n\n // oservedAddr is the multiaddr of the remote endpoint that the sender node perceives\n // this is useful information to convey to the other side, as it helps the remote endpoint\n // determine whether its connection to the local peer goes through NAT.\n optional bytes observedAddr = 4;\n\n repeated string protocols = 3;\n}\n";e.exports=r(i).Identify},function(e,t,n){"use strict";const r=n(43),i=n(36),o=n(106),s=n(12),a=n(72),u=n(122),l=n(5),c=l("libp2p:circuit:stream-handler");c.err=l("libp2p:circuit:error:stream-handler");class f{constructor(e,t,n,r){this.conn=e,this.stream=null,this.shake=null,this.timeout=t||6e4,this.maxLength=r||4096,"function"==typeof t&&(this.timeout=n||6e4),this.stream=u({timeout:this.timeout},t),this.shake=this.stream.handshake,s(this.stream,e,this.stream)}isValid(){return this.conn&&this.shake&&this.stream}read(e){if(!this.isValid())return e(new Error("handler is not in a valid state"));a.decodeFromReader(this.shake,{maxLength:this.maxLength},(t,n)=>t?(c.err(t),e(t)):e(null,n))}write(e,t){if(t=t||(()=>{}),!this.isValid())return t(new Error("handler is not in a valid state"));s(r([e]),a.encode(),i((e,n)=>{if(e)return c.err(e),this.shake.abort(e),t(e);n.forEach(e=>this.shake.write(e)),t()}))}getRawConn(){return this.conn}rest(){const e=this.shake.rest();return this.conn=null,this.stream=null,this.shake=null,e}close(){this.isValid()&&s(o(),this.rest())}}e.exports=f},function(e,t,n){"use strict";e.exports={relay:"/libp2p/circuit/relay/0.1.0"}},function(e,t,n){"use strict";const r=n(65).Connection,i=n(12);e.exports=((e,t,n,o)=>{const s=new Promise((e,t)=>{n.getPeerInfo((t,r)=>{if(!t&&r)return void e(r);const i=n.setPeerInfo;n.setPeerInfo=(t=>{i.call(n,t),e(t)})})}),a={source:i(n,o.incoming(e,t,s)),sink:i(o.outgoing(e,t,s),n)};return new r(a,n)})},function(e,t,n){"use strict";e.exports={PROTOCOL:"/ipfs/ping/1.0.0",PING_LENGTH:32}},function(e,t,n){var r=n(133),i=n(67),o=n(103),s="[object String]";function a(e){return"string"==typeof e||!i(e)&&o(e)&&r(e)==s}e.exports=a},function(e,t,n){var r=n(1218);e.exports=function(e,t,n){n=void 0===n||n;var i=!1,o;return function(s){var a=0,u=0,l=0,c=[],f=!1,h=!1,p,d;function m(){if(p){var e=p;if(d)return p=null,e(d);if(Object.hasOwnProperty.call(c,u)){p=null;var n=c[u];delete c[u],u++,e(null,n),t&&g()}else u>=l&&h&&(p=null,e(h))}}var g=r(function(){if(f=!0,h)return m();i||t&&a-t>=u||(i=!0,s(o,function(t,r){if(i=!1,t)l=a,h=t,m();else{var o=a++;e(r,function(e,t){n?c[o]=t:c.push(t),e&&(d=e),m()}),h||g()}}))});return function(e,t){e?s(h=o=e,function(e){if(t)return t(e)}):(p=t,f||g(),m())}}}},function(e,t,n){"use strict";const r=n(187),i=100;e.exports=function e(t){const n=t||100;var i=[];return r(function e(t){for(i=i.concat(t);i.length>=n;){const e=n,t=i.slice(0,e);i=i.slice(e),this.queue(t)}},function e(t){i.length&&(this.queue(i),i=[]),this.queue(null)})}},function(e,t,n){"use strict";e.exports=class e{constructor(e,t){this._options=t||{},Object.assign(this,e)}}},function(e,t,n){"use strict";const r=n(1232),i=n(1233),o={bits:8};class s{constructor(e,t,n){if(this._options=Object.assign({},o,e),this._popCount=0,this._parent=t,this._posAtParent=n,!this._options.hashFn)throw new Error("please define an options.hashFn");this._options.hash||(this._options.hash=i(this._options.hashFn)),this._children=new r}static isBucket(e){return e instanceof s}async put(e,t){const n=await this._findNewBucketAndPos(e);await n.bucket._putAt(n,e,t)}async get(e){const t=await this._findChild(e);if(t)return t.value}async del(e){const t=await this._findPlace(e),n=t.bucket._at(t.pos);n&&n.key===e&&t.bucket._delAt(t.pos)}leafCount(){return this._children.compactArray().reduce((e,t)=>t instanceof s?e+t.leafCount():e+1,0)}childrenCount(){return this._children.length}onlyChild(){return this._children.get(0)}*eachLeafSeries(){const e=this._children.compactArray();for(const t of e)if(t instanceof s)for(const e of t.eachLeafSeries())yield e;else yield t}serialize(e,t){return t(this._children.reduce((n,r,i)=>(r&&(r instanceof s?n.push(r.serialize(e,t)):n.push(e(r,i))),n),[]))}async asyncTransform(e,t){return c(this,e,t)}toJSON(){return this.serialize(u,l)}prettyPrint(){return JSON.stringify(this.toJSON(),null," ")}tableSize(){return Math.pow(2,this._options.bits)}async _findChild(e){const t=await this._findPlace(e),n=t.bucket._at(t.pos);if(n&&n.key===e)return n}async _findPlace(e){const t=this._options.hash(e),n=await t.take(this._options.bits),r=this._children.get(n);return r instanceof s?r._findPlace(t):{bucket:this,pos:n,hash:t}}async _findNewBucketAndPos(e){const t=await this._findPlace(e),n=t.bucket._at(t.pos);if(n&&n.key!==e){const e=new s(this._options,t.bucket,t.pos);t.bucket._putObjectAt(t.pos,e);const r=await e._findPlace(n.hash);return r.bucket._putAt(r,n.key,n.value),e._findNewBucketAndPos(t.hash)}return t}_putAt(e,t,n){this._putObjectAt(e.pos,{key:t,value:n,hash:e.hash})}_putObjectAt(e,t){this._children.get(e)||this._popCount++,this._children.set(e,t)}_delAt(e){this._children.get(e)&&this._popCount--,this._children.unset(e),this._level()}_level(){if(this._parent&&this._popCount<=1)if(1===this._popCount){const e=this._children.find(a);if(!(e instanceof s)){const t=e.hash;t.untake(this._options.bits);const n={pos:this._posAtParent,hash:t};this._parent._putAt(n,e.key,e.value)}}else this._parent._delAt(this._posAtParent)}_at(e){return this._children.get(e)}}function a(e){return Boolean(e)}function u(e,t){return e.key}function l(e){return e}async function c(e,t,n){const r=[];for(const i of e._children.compactArray()){if(i instanceof s)await c(i,t,n);else{const n=await t(i);r.push({bitField:e._children.bitField(),children:n})}return n(r)}}e.exports=s},function(e,t,n){"use strict";const r=(e="")=>(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean);e.exports=r},function(e,t,n){"use strict";const r=n(11),i=n(50),o=n(123),{loadNode:s,formatCid:a,toMfsPath:u,FILE_SEPARATOR:l,FILE_TYPES:c}=n(83),f=n(12),h=n(36),p=n(88),d=n(77),m=n(137),g=n(82),y=n(69),b={long:!1,cidBase:"base58btc"};e.exports=(e=>(function t(n,v={}){"object"==typeof n&&(v=n,n=l),void 0===n&&(n=l),v=Object.assign({},b,v),v.long=v.l||v.long;const _=y.source();return r([t=>u(e,n,t),({mfsPath:t,depth:r},i)=>{f(o(t,e.ipld,{maxDepth:r}),h((s,a)=>{if(s)return i(s);if(a.length>1)return i(new Error(`Path ${n} had ${a.length} roots`));const u=a[0];if(!u)return i(new Error(`${n} does not exist`));if("dir"!==u.type)return i(null,m(u));let l=!0;return i(null,f(o(t,e.ipld,{maxDepth:r+1}),d(()=>!l||(l=!1,!1))))}))},(t,n)=>{n(null,f(t,p((t,n)=>{if(!v.long)return n(null,{name:t.name,type:0,size:0,hash:""});s(e,{cid:t.hash},(e,r)=>{if(e)return n(e);const o=i.unmarshal(r.node.data);n(null,{name:t.name,type:c[o.type],hash:a(t.hash,v.cidBase),size:o.fileSize()||0})})})))}],(e,t)=>{if(e)return _.resolve(g(e));_.resolve(t)}),_}))},function(e,t,n){"use strict";const r=n(11),i=n(97),o=n(5)("ipfs:mfs:mkdir"),s=n(123),a=n(12),u=n(77),l=n(76),c=n(36),f=n(9),{createNode:h,toMfsPath:p,toPathComponents:d,updateMfsRoot:m,updateTree:g,FILE_SEPARATOR:y}=n(83),b={parents:!1,hashAlg:"sha2-256",cidVersion:0,shardSplitThreshold:1e3,format:"dag-pb",flush:!0};e.exports=(e=>(function t(n,v,_){if("function"==typeof v&&(_=v,v={}),v=Object.assign({},b,v),v.parents=v.p||v.parents,v.cidVersion=v.cidVersion||0,!n)return _(new Error("no path given to Mkdir"));if(n=n.trim(),n===y)return _(v.parents?null:new Error(`cannot create directory '${y}': Already exists`));o(`Creating ${n}`);const w=d(n);r([t=>p(e,n,t),({mfsDirectory:t,mfsPath:n,root:r},i)=>{const o=d(n).slice(1);let h=0,p="";a(s(n,e.ipld,{fullPath:!0}),u(e=>e.name===o[h]&&(h++,!0)),l(e=>{const t=`${p}${p?"/":""}${o[e.depth]}`;if("dir"!==e.type)throw new Error(`cannot access ${t}: Not a directory`);return p=t,{cid:new f(e.hash),name:e.name}}),c(i))},(t,n)=>{if(w.unshift("/"),t.length===w.length)return n(new Error("file already exists"));i(w.map((e,t)=>({part:e,index:t})),({part:n,index:i},o)=>t[i]?o(null,{name:n,...t[i]}):i===w.length-1||v.parents?void r([t=>h(e,"directory",v,t),({cid:e,node:t},r)=>{r(null,{cid:e,size:t.size,name:n})}],o):o(new Error("file does not exist")),n)},(t,n)=>g(e,t,v,n),({cid:t},n)=>m(e,t,n)],e=>{e&&e.message.includes("file already exists")&&v.parents&&(e=null),_(e)})}))},function(e,t,n){"use strict";const r=n(123),i=n(12),o=n(137),s=n(88),a=n(222),u=n(77),l=n(69),c=n(36),{toMfsPath:f}=n(83),h=n(5)("ipfs:mfs:read-pull-stream"),p={offset:0,length:void 0};e.exports=(e=>(function t(n,d={}){d=Object.assign({},p,d),d.length=d.length||d.count,h(`Reading ${n}`);const m=l.source();return i(o(n),s((t,n)=>f(e,t,n)),s(({mfsPath:t,root:n},o)=>(h(`Exporting ${t}`),i(r(t,e.ipld,{offset:d.offset,length:d.length}),c(o)))),a(),u(),c((e,t)=>{if(e)return m.abort(e);if(!t||!t.length)return m.abort(new Error(`${n} does not exist`));const r=t[0];return"file"!==r.type?m.abort(new Error(`${n} was not a file`)):r.content?(h(`Got ${n} content`),void m.resolve(t[0].content)):m.abort(new Error(`Could not load content stream from ${n}`))})),m}))},function(e,t,n){"use strict";const r=n(570),i=(e,t,n)=>{"function"==typeof t&&(n=t,t=void 0),r.deserialize(e,(e,r)=>{if(e)return n(e);if(!t)return n(null,{value:r,remainderPath:""});const i=t.split("/"),o=s(r,i[0]);if(null===o)return n(new Error("No such path"),null);let a=i.slice(1).join("/");return void 0!==o["/"]?n(null,{value:o,remainderPath:a}):a.length>0?n(new Error("No such path"),null):n(null,{value:o,remainderPath:""})})},o=(e,t,n)=>{"function"==typeof t&&(n=t,t=void 0),t=t||{},r.deserialize(e,(e,r)=>{if(e)return n(e);const i=["version","timestamp","difficulty","nonce","parent","tx"];if(!0===t.values){const e={};for(let t of i)e[t]=s(r,t);return n(null,e)}return n(null,i)})},s=(e,t)=>{switch(t){case"version":return e.version;case"timestamp":return e.timestamp;case"difficulty":return e.bits;case"nonce":return e.nonce;case"parent":return{"/":r.hashToCid(e.prevHash)};case"tx":return{"/":r.hashToCid(e.merkleRoot)};default:return null}};e.exports={multicodec:"bitcoin-block",defaultHashAlg:"dbl-sha2-256",resolve:i,tree:o}},function(e,t){var n={Array:function(e){return null!==e&&void 0!==e&&e.constructor===Array},Boolean:function(e){return"boolean"==typeof e},Function:function(e){return"function"==typeof e},Nil:function(e){return void 0===e||null===e},Number:function(e){return"number"==typeof e},Object:function(e){return"object"==typeof e},String:function(e){return"string"==typeof e},"":function(){return!0}};for(var r in n.Null=n.Nil,n)n[r].toJSON=function(e){return e}.bind(null,r);e.exports=n},function(e,t,n){const r=n(4).Buffer,i=n(108),o=n(29),s=n(1353),a=n(35),u=n(45),l=n(92),c=n(578);function f(e){const t=e.length;return c.encodingLength(t)+t}function h(e){const t=e.length;return c.encodingLength(t)+e.reduce(function(e,t){return e+f(t)},0)}function p(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}p.DEFAULT_SEQUENCE=4294967295,p.SIGHASH_ALL=1,p.SIGHASH_NONE=2,p.SIGHASH_SINGLE=3,p.SIGHASH_ANYONECANPAY=128,p.ADVANCED_TRANSACTION_MARKER=0,p.ADVANCED_TRANSACTION_FLAG=1;const d=r.allocUnsafe(0),m=[],g=r.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),y=r.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),b=r.from("ffffffffffffffff","hex"),v={script:d,valueBuffer:b};p.fromBuffer=function(e,t){let n=0;function r(t){return n+=t,e.slice(n-t,n)}function i(){const t=e.readUInt32LE(n);return n+=4,t}function o(){const t=e.readInt32LE(n);return n+=4,t}function a(){const t=s.readUInt64LE(e,n);return n+=8,t}function u(){const t=c.decode(e,n);return n+=c.decode.bytes,t}function l(){return r(u())}function f(){const e=u(),t=[];for(var n=0;n=this.ins.length)return y;const s=o.compile(o.decompile(t).filter(function(e){return e!==a.OP_CODESEPARATOR})),c=this.clone();if((31&n)===p.SIGHASH_NONE)c.outs=[],c.ins.forEach(function(t,n){n!==e&&(t.sequence=0)});else if((31&n)===p.SIGHASH_SINGLE){if(e>=this.outs.length)return y;c.outs.length=e+1;for(var f=0;f>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function u(e){for(var t=1,n=0;n126)throw new Error("Invalid prefix ("+e+")");t=a(t)^r>>5}for(t=a(t),n=0;nn)throw new TypeError("Exceeds length limit");e=e.toLowerCase();for(var i=u(e),o=e+"1",s=0;s>5!=0)throw new Error("Non 5-bit word");i=a(i)^l,o+=r.charAt(l)}for(s=0;s<6;++s)i=a(i);for(i^=1,s=0;s<6;++s){var c=i>>5*(5-s)&31;o+=r.charAt(c)}return o}function c(e,t){if(t=t||90,e.length<8)throw new TypeError(e+" too short");if(e.length>t)throw new TypeError("Exceeds length limit");var n=e.toLowerCase(),r=e.toUpperCase();if(e!==n&&e!==r)throw new Error("Mixed-case string "+e);e=n;var o=e.lastIndexOf("1");if(-1===o)throw new Error("No separator character for "+e);if(0===o)throw new Error("Missing prefix for "+e);var s=e.slice(0,o),l=e.slice(o+1);if(l.length<6)throw new Error("Data too short");for(var c=u(s),f=[],h=0;h=l.length||f.push(d)}if(1!==c)throw new Error("Invalid checksum for "+e);return{prefix:s,words:f}}function f(e,t,n,r){for(var i=0,o=0,s=(1<=n;)o-=n,a.push(i>>o&s);if(r)o>0&&a.push(i<=t)throw new Error("Excess padding");if(i<{const t=s.decode(e),n=new a(t);return n}),c;function f(e,o,s){h(e,o,(e,a)=>{if(e)return s(e);if(!n)return s(null,a);let u=a.slice();const l=a.filter(e=>t.isBuffer(e.value));r(l,(e,t)=>i([t=>n.util.deserialize(e.value,t),(e,t)=>n.resolver._mapFromEthObject(e,o,t)],(n,r)=>{if(n)return t(n);r.forEach(t=>{u.push({path:e.path+"/"+t.path,value:t.value})}),t()}),e=>{if(e)return s(e);s(null,u)})})}function h(t,n,i){let o=[];"leaf"===t.type&&o.push({path:m(t.getKey()),value:t.getValue()}),r(t.getChildren(),(t,r)=>{const i=m(t[0]),s=t[1];if(a.isRawNode(s)){const e=new a(s);o.push({path:i,value:e}),h(e,n,(e,t)=>{if(e)return r(e);t.forEach(e=>{e.path=i+"/"+e.path}),o=o.concat(t),r()})}else{let t={"/":u(e,s).toBaseEncodedString()};o.push({path:i,value:t}),r()}},e=>{if(e)return i(e);i(null,o)})}}function m(e){return e.map(e=>e.toString(16)).join("/")}e.exports=d}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(594),i=(e,t,n)=>{"function"==typeof t&&(n=t,t=void 0),r.deserialize(e,(e,r)=>{if(e)return n(e);if(!t)return n(null,{value:r,remainderPath:""});const i=t.split("/"),o=s(r,i[0]);if(null===o)return n(new Error("No such path"),null);let a=i.slice(1).join("/");return void 0!==o["/"]?n(null,{value:o,remainderPath:a}):a.length>0?n(new Error("No such path"),null):n(null,{value:o,remainderPath:""})})},o=(e,t,n)=>{"function"==typeof t&&(n=t,t=void 0),t=t||{},r.deserialize(e,(e,r)=>{if(e)return n(e);const i=["version","timestamp","difficulty","nonce","solution","reserved","parent","tx"];if(!0===t.values){const e={};for(let t of i)e[t]=s(r,t);return n(null,e)}return n(null,i)})},s=(e,t)=>{switch(t){case"version":return e.version;case"timestamp":return e.time;case"difficulty":return e.bits;case"nonce":return e.nonce;case"solution":return e.solution;case"reserved":return e.reserved;case"parent":return{"/":r.hashToCid(e.prevHash)};case"tx":return{"/":r.hashToCid(e.merkleRoot)};default:return null}};e.exports={multicodec:"zcash-block",defaultHashAlg:"dbl-sha2-256",resolve:i,tree:o}},function(e,t){"function"==typeof Object.create?e.exports=function e(t,n){t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function e(t,n){t.super_=n;var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(25),o=n(30),s=n(40);function a(e){if(!(this instanceof a))return new a(e);var t;if(r.isNumber(e))t=e;else{if(!r.isString(e))throw new TypeError('Unrecognized num type: "'+typeof e+'" for Opcode');t=a.map[e]}return s.defineImmutable(this,{num:t}),this}for(var u in a.fromBuffer=function(e){return i.checkArgument(o.isBuffer(e)),new a(Number("0x"+e.toString("hex")))},a.fromNumber=function(e){return i.checkArgument(r.isNumber(e)),new a(e)},a.fromString=function(e){i.checkArgument(r.isString(e));var t=a.map[e];if(void 0===t)throw new TypeError("Invalid opcodestr");return new a(t)},a.prototype.toHex=function(){return this.num.toString(16)},a.prototype.toBuffer=function(){return new t(this.toHex(),"hex")},a.prototype.toNumber=function(){return this.num},a.prototype.toString=function(){var e=a.reverseMap[this.num];if(void 0===e)throw new Error("Opcode does not have a string representation");return e},a.smallInt=function(e){return i.checkArgument(r.isNumber(e),"Invalid Argument: n should be number"),i.checkArgument(e>=0&&e<=16,"Invalid Argument: n must be between 0 and 16"),0===e?a("OP_0"):new a(a.map.OP_1+e-1)},a.map={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP1:176,OP_NOP2:177,OP_NOP3:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255},a.reverseMap=[],a.map)a.reverseMap[a.map[u]]=u;r.extend(a,a.map),a.isSmallIntOp=function(e){return e instanceof a&&(e=e.toNumber()),e===a.map.OP_0||e>=a.map.OP_1&&e<=a.map.OP_16},a.prototype.inspect=function(){return""},e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(25),o=n(0),s=t.compare||n(1441),a=n(85),u=n(30),l=n(40),c=n(109),f=n(79),h=n(59),p=n(86),d=n(110),m=n(129),g=n(599),y=n(358),b=y.PublicKeyHash,v=y.PublicKey,_=y.MultiSigScriptHash,w=y.MultiSig,k=n(111),S=n(87),E=n(272),x=n(51),C=n(1446);function A(e){if(!(this instanceof A))return new A(e);if(this.inputs=[],this.outputs=[],this.joinSplits=[],this._inputAmount=void 0,this._outputAmount=void 0,e){if(e instanceof A)return A.shallowCopy(e);if(l.isHexa(e))this.fromString(e);else if(u.isBuffer(e))this.fromBuffer(e);else{if(!r.isObject(e))throw new a.InvalidArgument("Must provide an object or string to deserialize a transaction");this.fromObject(e)}}else this._newTransaction()}var I=1,T=0,j=1e6;A.DUST_AMOUNT=546,A.FEE_SECURITY_MARGIN=15,A.MAX_MONEY=21e14,A.NLOCKTIME_BLOCKHEIGHT_LIMIT=5e8,A.NLOCKTIME_MAX_VALUE=4294967295,A.FEE_PER_KB=1e4,A.CHANGE_OUTPUT_MAX_SIZE=62,A.MAXIMUM_EXTRA_SIZE=26,A.shallowCopy=function(e){var t=new A(e.toBuffer());return t};var O={configurable:!1,enumerable:!0,get:function(){return new c(this._getHash()).readReverse().toString("hex")}};Object.defineProperty(A.prototype,"hash",O),Object.defineProperty(A.prototype,"id",O);var P={configurable:!1,enumerable:!0,get:function(){return this._getInputAmount()}};Object.defineProperty(A.prototype,"inputAmount",P),P.get=function(){return this._getOutputAmount()},Object.defineProperty(A.prototype,"outputAmount",P),A.prototype._getHash=function(){return h.sha256sha256(this.toBuffer())},A.prototype.serialize=function(e){return!0===e||e&&e.disableAll?this.uncheckedSerialize():this.checkedSerialize(e)},A.prototype.uncheckedSerialize=A.prototype.toString=function(){return this.toBuffer().toString("hex")},A.prototype.checkedSerialize=function(e){var t=this.getSerializationError(e);if(t)throw t.message+=" Use Transaction#uncheckedSerialize if you want to skip security checks. See http://bitcore.io/guide/transaction.html#Serialization for more info.",t;return this.uncheckedSerialize()},A.prototype.invalidSatoshis=function(){for(var e=!1,t=0;tn)return this._missingChange()?new a.Transaction.ChangeAddressMissing("Fee is too large and no change address was provided"):new a.Transaction.FeeError.TooLarge("expected less than "+n+" but got "+t)}if(!e.disableSmallFees){var i=Math.ceil(this._estimateFee()/A.FEE_SECURITY_MARGIN);if(t"},A.prototype.toBuffer=function(){var e=new f;return this.toBufferWriter(e).toBuffer()},A.prototype.toBufferWriter=function(e){return e.writeUInt32LE(this.version),e.writeVarintNum(this.inputs.length),r.each(this.inputs,function(t){t.toBufferWriter(e)}),e.writeVarintNum(this.outputs.length),r.each(this.outputs,function(t){t.toBufferWriter(e)}),e.writeUInt32LE(this.nLockTime),this.version>=2&&(e.writeVarintNum(this.joinSplits.length),r.each(this.joinSplits,function(t){t.toBufferWriter(e)}),this.joinSplits.length>0&&(e.write(this.joinSplitPubKey),e.write(this.joinSplitSig))),e},A.prototype.fromBuffer=function(e){var t=new c(e);return this.fromBufferReader(t)},A.prototype.fromBufferReader=function(e){var t,n,r,o;for(i.checkArgument(!e.finished(),"No transaction data received"),this.version=e.readUInt32LE(),n=e.readVarintNum(),t=0;t=2){for(o=e.readVarintNum(),t=0;t0&&(this.joinSplitPubKey=e.read(32),this.joinSplitSig=e.read(64))}return this},A.prototype.toObject=A.prototype.toJSON=function e(){var t=[];this.inputs.forEach(function(e){t.push(e.toObject())});var n=[];this.outputs.forEach(function(e){n.push(e.toObject())});var i={hash:this.hash,version:this.version,inputs:t,outputs:n,nLockTime:this.nLockTime};if(this.version>=2){var o=[];this.joinSplits.forEach(function(e){o.push(e.toObject())}),i.joinSplits=o,this.joinSplits.length>0&&(i.joinSplitPubKey=u.reverse(this.joinSplitPubKey).toString("hex"),i.joinSplitSig=this.joinSplitSig.toString("hex"))}return this._changeScript&&(i.changeScript=this._changeScript.toString()),r.isUndefined(this._changeIndex)||(i.changeIndex=this._changeIndex),r.isUndefined(this._fee)||(i.fee=this._fee),i},A.prototype.fromObject=function e(n){i.checkArgument(r.isObject(n)||n instanceof A);var o=this,s;return s=n instanceof A?s.toObject():n,r.each(s.inputs,function(e){if(e.output&&e.output.script){var t=new S(e.output.script),n;if(t.isPublicKeyHashOut())n=new y.PublicKeyHash(e);else if(t.isScriptHashOut()&&e.publicKeys&&e.threshold)n=new y.MultiSigScriptHash(e,e.publicKeys,e.threshold,e.signatures);else{if(!t.isPublicKeyOut())throw new a.Transaction.Input.UnsupportedScript(e.output.script);n=new y.PublicKey(e)}o.addInput(n)}else o.uncheckedAddInput(new y(e))}),r.each(s.outputs,function(e){o.addOutput(new k(e))}),s.changeIndex&&(this._changeIndex=s.changeIndex),s.changeScript&&(this._changeScript=new S(s.changeScript)),s.fee&&(this._fee=s.fee),this.nLockTime=s.nLockTime,this.version=s.version,this.version>=2&&(r.each(s.joinSplits,function(e){o.joinSplits.push(new C(e))}),o.joinSplits.length>0&&(o.joinSplitPubKey=u.reverse(new t(s.joinSplitPubKey,"hex")),o.joinSplitSig=new t(s.joinSplitSig,"hex"))),this._checkConsistency(n),this},A.prototype._checkConsistency=function(e){r.isUndefined(this._changeIndex)||(i.checkState(this._changeScript),i.checkState(this.outputs[this._changeIndex]),i.checkState(this.outputs[this._changeIndex].script.toString()===this._changeScript.toString())),e&&e.hash&&i.checkState(e.hash===this.hash,"Hash in object does not match transaction hash")},A.prototype.lockUntilDate=function(e){if(i.checkArgument(e),r.isNumber(e)&&e=A.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new a.Transaction.BlockHeightTooHigh;if(e<0)throw new a.Transaction.NLockTimeOutOfRange;for(var t=0;t0?(this._changeIndex=this.outputs.length,this._addOutput(new k({script:this._changeScript,satoshis:n}))):this._changeIndex=void 0}},A.prototype.getFee=function(){return this.isCoinbase()?0:r.isUndefined(this._fee)?this._changeScript?this._estimateFee():this._getUnspentValue():this._fee},A.prototype._estimateFee=function(){var e=this._estimateSize(),t=this._getUnspentValue();return A._estimateFee(e,t,this._feePerKb)},A.prototype._getUnspentValue=function(){return this._getInputAmount()-this._getOutputAmount()},A.prototype._clearSignatures=function(){r.each(this.inputs,function(e){e.clearSignatures()})},A._estimateFee=function(e,t,n){var r=Math.ceil(e/1e3)*(n||A.FEE_PER_KB);return t>r&&(e+=A.CHANGE_OUTPUT_MAX_SIZE),Math.ceil(e/1e3)*(n||A.FEE_PER_KB)},A.prototype._estimateSize=function(){var e=A.MAXIMUM_EXTRA_SIZE;return r.each(this.inputs,function(t){e+=t._estimateSize()}),r.each(this.outputs,function(t){e+=t.script.toBuffer().length+9}),e},A.prototype._removeOutput=function(e){var t=this.outputs[e];this.outputs=r.without(this.outputs,t),this._outputAmount=void 0},A.prototype.removeOutput=function(e){this._removeOutput(e),this._updateChangeOutput()},A.prototype.sort=function(){return this.sortInputs(function(e){var t=Array.prototype.concat.apply([],e);return t.sort(function(e,t){return s(e.prevTxId,t.prevTxId)||e.outputIndex-t.outputIndex}),t}),this.sortOutputs(function(e){var t=Array.prototype.concat.apply([],e);return t.sort(function(e,t){return e.satoshis-t.satoshis||s(e.script.toBuffer(),t.script.toBuffer())}),t}),this},A.prototype.shuffleOutputs=function(){return this.sortOutputs(r.shuffle)},A.prototype.sortOutputs=function(e){var t=e(this.outputs);return this._newOutputOrder(t)},A.prototype.sortInputs=function(e){return this.inputs=e(this.inputs),this._clearSignatures(),this},A.prototype._newOutputOrder=function(e){var t=this.outputs.length!==e.length||0!==r.difference(this.outputs,e).length;if(t)throw new a.Transaction.InvalidSorting;if(!r.isUndefined(this._changeIndex)){var n=this.outputs[this._changeIndex];this._changeIndex=r.findIndex(e,n)}return this.outputs=e,this},A.prototype.removeInput=function(e,t){var n;if(n=!t&&r.isNumber(e)?e:r.findIndex(this.inputs,function(n){return n.prevTxId.toString("hex")===e&&n.outputIndex===t}),n<0||n>=this.inputs.length)throw new a.Transaction.InvalidIndex(n,this.inputs.length);var i=this.inputs[n];this.inputs=r.without(this.inputs,i),this._inputAmount=void 0,this._updateChangeOutput()},A.prototype.sign=function(e,t){i.checkState(this.hasAllUtxoInfo());var n=this;return r.isArray(e)?(r.each(e,function(e){n.sign(e,t)}),this):(r.each(this.getSignatures(e,t),function(e){n.applySignature(e)}),this)},A.prototype.getSignatures=function(e,t){e=new E(e),t=t||p.SIGHASH_ALL;var n=this,i=[],o=h.sha256ripemd160(e.publicKey.toBuffer());return r.each(this.inputs,function s(a,u){r.each(a.getSignatures(n,e,u,t,o),function(e){i.push(e)})}),i},A.prototype.applySignature=function(e){return this.inputs[e.inputIndex].addSignature(this,e),this},A.prototype.isFullySigned=function(){return r.each(this.inputs,function(e){if(e.isFullySigned===y.prototype.isFullySigned)throw new a.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction")}),r.all(r.map(this.inputs,function(e){return e.isFullySigned()}))},A.prototype.isValidSignature=function(e){var t=this;if(this.inputs[e.inputIndex].isValidSignature===y.prototype.isValidSignature)throw new a.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction");return this.inputs[e.inputIndex].isValidSignature(this,e)},A.prototype.verifySignature=function(e,t,n,r){return d.verify(this,e,t,n,r)},A.prototype.verify=function(){if(0===this.inputs.length)return"transaction txins empty";if(0===this.outputs.length)return"transaction txouts empty";for(var e=new x(0),t=0;t1e6)return"transaction over the maximum block size";var i={};for(t=0;t100)return"coinbase transaction script size invalid"}else for(t=0;t=y.MAXINT-1&&(t.sequenceNumber=y.DEFAULT_RBF_SEQNUMBER)}return this},e.exports=A}).call(this,n(0).Buffer)},function(e,t,n){e.exports=n(195),e.exports.PublicKey=n(1442),e.exports.PublicKeyHash=n(1443),e.exports.MultiSig=n(1444),e.exports.MultiSigScriptHash=n(1445)},function(e,t,n){"use strict";var r=n(17),i=n(85),o=n(25),s={BTC:[1e8,8],mBTC:[1e5,5],uBTC:[100,2],bits:[100,2],satoshis:[1,0]};function a(e,t){if(!(this instanceof a))return new a(e,t);if(r.isNumber(t)){if(t<=0)throw new i.Unit.InvalidRate(t);e/=t,t=a.BTC}this._value=this._from(e,t);var n=this,o=function(e){Object.defineProperty(n,e,{get:function(){return n.to(e)},enumerable:!0})};Object.keys(s).forEach(o)}Object.keys(s).forEach(function(e){a[e]=e}),a.fromObject=function e(t){return o.checkArgument(r.isObject(t),"Argument is expected to be an object"),new a(t.amount,t.code)},a.fromBTC=function(e){return new a(e,a.BTC)},a.fromMillis=a.fromMilis=function(e){return new a(e,a.mBTC)},a.fromMicros=a.fromBits=function(e){return new a(e,a.bits)},a.fromSatoshis=function(e){return new a(e,a.satoshis)},a.fromFiat=function(e,t){return new a(e,t)},a.prototype._from=function(e,t){if(!s[t])throw new i.Unit.UnknownCode(t);return parseInt((e*s[t][0]).toFixed())},a.prototype.to=function(e){if(r.isNumber(e)){if(e<=0)throw new i.Unit.InvalidRate(e);return parseFloat((this.BTC*e).toFixed(2))}if(!s[e])throw new i.Unit.UnknownCode(e);var t=this._value/s[e][0];return parseFloat(t.toFixed(s[e][1]))},a.prototype.toBTC=function(){return this.to(a.BTC)},a.prototype.toMillis=a.prototype.toMilis=function(){return this.to(a.mBTC)},a.prototype.toMicros=a.prototype.toBits=function(){return this.to(a.bits)},a.prototype.toSatoshis=function(){return this.to(a.satoshis)},a.prototype.atRate=function(e){return this.to(e)},a.prototype.toString=function(){return this.satoshis+" satoshis"},a.prototype.toObject=a.prototype.toJSON=function e(){return{amount:this.BTC,code:a.BTC}},a.prototype.inspect=function(){return""},e.exports=a},function(e,t,n){"use strict";e.exports={_cache:{},_count:0,_eraseIndex:0,_usedList:{},_usedIndex:{},_CACHE_SIZE:5e3,get:function(e,t,n){n=!!n;var r=e+"/"+t+"/"+n;if(this._cache[r])return this._cacheHit(r),this._cache[r]},set:function(e,t,n,r){n=!!n;var i=e+"/"+t+"/"+n;this._cache[i]=r,this._cacheHit(i)},_cacheHit:function(e){this._usedIndex[e]&&delete this._usedList[this._usedIndex[e]],this._usedList[this._count]=e,this._usedIndex[e]=this._count,this._count++,this._cacheRemove()},_cacheRemove:function(){for(;this._eraseIndex{const n=o(e,t);return(e,t,o)=>{const s=r(o),a=n(t),u=i(e=>s(null,e));a.once("error",s),a.pipe(u),a.write(e),a.end()}})},function(e,t,n){"use strict";const r=n(58),i=n(1482),o=n(21).Readable;class s extends o{constructor(e){const t=Object.assign(e||{},{objectMode:!0});super(t)}_read(){}}const a=(e,t)=>{let n=new s,o=i.extract();o.on("entry",(e,t,r)=>{t.on("end",r),"directory"!==e.type?n.push({path:e.name,content:t}):(n.push({path:e.name}),t.resume())}).on("finish",()=>n.push(null)),r(e,o),t(null,n)};e.exports=a},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,i=Array.isArray,o=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),s=function e(t){for(;t.length>1;){var n=t.pop(),r=n.obj[n.prop];if(i(r)){for(var o=[],s=0;s=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122?s+=i.charAt(a):u<128?s+=o[u]:u<2048?s+=o[192|u>>6]+o[128|63&u]:u<55296||u>=57344?s+=o[224|u>>12]+o[128|u>>6&63]+o[128|63&u]:(a+=1,u=65536+((1023&u)<<10|1023&i.charCodeAt(a)),s+=o[240|u>>18]+o[128|u>>12&63]+o[128|u>>6&63]+o[128|63&u])}return s},h=function e(t){for(var n=[{obj:{o:t},prop:"o"}],r=[],i=0;i1;class m{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");const t=this[i]=e.max||1/0,n=e.length||d;if(this[s]="function"!=typeof n?d:n,this[a]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[u]=e.maxAge||0,this[l]=e.dispose,this[c]=e.noDisposeOnSet||!1,this[p]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[i]=e||1/0,b(this)}get max(){return this[i]}set allowStale(e){this[a]=!!e}get allowStale(){return this[a]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[u]=e,b(this)}get maxAge(){return this[u]}set lengthCalculator(e){"function"!=typeof e&&(e=d),e!==this[s]&&(this[s]=e,this[o]=0,this[f].forEach(e=>{e.length=this[s](e.value,e.key),this[o]+=e.length})),b(this)}get lengthCalculator(){return this[s]}get length(){return this[o]}get itemCount(){return this[f].length}rforEach(e,t){t=t||this;for(let n=this[f].tail;null!==n;){const r=n.prev;w(this,e,n,t),n=r}}forEach(e,t){t=t||this;for(let n=this[f].head;null!==n;){const r=n.next;w(this,e,n,t),n=r}}keys(){return this[f].toArray().map(e=>e.key)}values(){return this[f].toArray().map(e=>e.value)}reset(){this[l]&&this[f]&&this[f].length&&this[f].forEach(e=>this[l](e.key,e.value)),this[h]=new Map,this[f]=new r,this[o]=0}dump(){return this[f].map(e=>!y(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[f]}set(e,t,n){if(n=n||this[u],n&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const r=n?Date.now():0,a=this[s](t,e);if(this[h].has(e)){if(a>this[i])return v(this,this[h].get(e)),!1;const s=this[h].get(e),u=s.value;return this[l]&&(this[c]||this[l](e,u.value)),u.now=r,u.maxAge=n,u.value=t,this[o]+=a-u.length,u.length=a,this.get(e),b(this),!0}const p=new _(e,t,a,r,n);return p.length>this[i]?(this[l]&&this[l](e,t),!1):(this[o]+=p.length,this[f].unshift(p),this[h].set(e,this[f].head),b(this),!0)}has(e){if(!this[h].has(e))return!1;const t=this[h].get(e).value;return!y(this,t)}get(e){return g(this,e,!0)}peek(e){return g(this,e,!1)}pop(){const e=this[f].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[h].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const r=e[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{const e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[h].forEach((e,t)=>g(this,t,!1))}}const g=(e,t,n)=>{const r=e[h].get(t);if(r){const t=r.value;if(y(e,t)){if(v(e,r),!e[a])return}else n&&(e[p]&&(r.value.now=Date.now()),e[f].unshiftNode(r));return t.value}},y=(e,t)=>{if(!t||!t.maxAge&&!e[u])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[u]&&n>e[u]},b=e=>{if(e[o]>e[i])for(let t=e[f].tail;e[o]>e[i]&&null!==t;){const n=t.prev;v(e,t),t=n}},v=(e,t)=>{if(t){const n=t.value;e[l]&&e[l](n.key,n.value),e[o]-=n.length,e[h].delete(n.key),e[f].removeNode(t)}};class _{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}}const w=(e,t,n,r)=>{let i=n.value;y(e,i)&&(v(e,n),e[a]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};e.exports=m},function(e,t,n){"use strict";const r=n(112);function i(e,t,n){"function"==typeof e.pipe?r(e,(e,r)=>{if(e)return n(e);t(r,n)}):t(e,n)}e.exports=i},function(e,t,n){"use strict";const r=n(21).Transform,i=n(1563);class o extends r{constructor(e){const t=Object.assign(e||{},{objectMode:!0});super(t)}_transform(e,t,n){try{const t=i(e);if(this.push(t),!t.success)throw new Error(t.text)}catch(e){return n(e)}n()}}e.exports=o},function(e,t,n){"use strict";const r=n(62);e.exports=(e=>({totalIn:new r(e.TotalIn),totalOut:new r(e.TotalOut),rateIn:new r(e.RateIn),rateOut:new r(e.RateOut)}))},function(e,t,n){(function(t){e.exports=f;const r=n(653),i=n(1748),o=n(154),s=n(201),a=n(28),u=n(168),l=n(32),c=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;function f(e,n){if(e=Object.assign({maxRedirects:10},"string"==typeof e?{url:e}:e),n=a(n),e.url){const{hostname:t,port:n,protocol:r,auth:i,path:o}=l.parse(e.url);delete e.url,t||n||r||i?Object.assign(e,{hostname:t,port:n,protocol:r,auth:i,path:o}):e.path=o}const r={"accept-encoding":"gzip, deflate"};let h;e.headers&&Object.keys(e.headers).forEach(t=>r[t.toLowerCase()]=e.headers[t]),e.headers=r,e.body?h=e.json&&!c(e.body)?JSON.stringify(e.body):e.body:e.form&&(h="string"==typeof e.form?e.form:u.stringify(e.form),e.headers["content-type"]="application/x-www-form-urlencoded"),h&&(e.method||(e.method="POST"),c(h)||(e.headers["content-length"]=t.byteLength(h)),e.json&&!e.form&&(e.headers["content-type"]="application/json")),delete e.body,delete e.form,e.json&&(e.headers.accept="application/json"),e.method&&(e.method=e.method.toUpperCase());const p="https:"===e.protocol?s:o,d=p.request(e,t=>{if(t.statusCode>=300&&t.statusCode<400&&t.headers.location)return e.url=t.headers.location,delete e.headers.host,t.resume(),"POST"===e.method&&[301,302].includes(t.statusCode)&&(e.method="GET",delete e.headers["content-length"],delete e.headers["content-type"]),0==e.maxRedirects--?n(new Error("too many redirects")):f(e,n);const r="function"==typeof i&&"HEAD"!==e.method;n(null,r?i(t):t)});return d.on("timeout",()=>{d.abort(),n(new Error("Request timed out"))}),d.on("error",n),c(h)?h.on("error",n).pipe(d):d.end(h),d}f.concat=((e,t)=>f(e,(n,i)=>{if(n)return t(n);r(i,(n,r)=>{if(n)return t(n);if(e.json)try{r=JSON.parse(r.toString())}catch(n){return t(n,i,r)}t(null,i,r)})})),["get","post","put","patch","head","delete"].forEach(e=>{f[e]=((t,n)=>("string"==typeof t&&(t={url:t}),f(Object.assign({method:e.toUpperCase()},t),n)))})}).call(this,n(0).Buffer)},function(e,t){var n=1,r=65535,i=4,o,s=function(){n=n+1&65535};e.exports=function(e){o||(o=setInterval(s,250),o.unref&&o.unref());var t=4*(e||5),r=[0],i=1,a=n-1&65535;return function(e){var o=n-a&65535;for(o>t&&(o=t),a=n;o--;)i===t&&(i=0),r[i]=r[0===i?t-1:i-1],i++;e&&(r[i-1]+=e);var s=r[i-1],u=r.length=4"},homepage:"https://webtorrent.io",keywords:["bittorrent","bittorrent client","download","mad science","p2p","peer-to-peer","peers","streaming","swarm","torrent","web torrent","webrtc","webrtc data","webtorrent"],license:"MIT",main:"index.js",repository:{type:"git",url:"git://github.com/webtorrent/webtorrent.git"},scripts:{build:"browserify -s WebTorrent -e ./ | minify > webtorrent.min.js","build-debug":"browserify -s WebTorrent -e ./ > webtorrent.debug.js",size:"npm run build && cat webtorrent.min.js | gzip | wc -c",test:"standard && npm run test-node && npm run test-browser","test-browser":"airtap -- test/*.js test/browser/*.js","test-browser-local":"airtap --local -- test/*.js test/browser/*.js","test-node":"tape test/*.js test/node/*.js","update-authors":"./scripts/update-authors.sh"}}},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function e(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===i.call(t)},u=function e(t){if(!t||"[object Object]"!==i.call(t))return!1;var n=r.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&r.call(t.constructor.prototype,"isPrototypeOf"),s;if(t.constructor&&!n&&!o)return!1;for(s in t);return void 0===s||r.call(t,s)},l=function e(t,n){o&&"__proto__"===n.name?o(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},c=function e(t,n){if("__proto__"===n){if(!r.call(t,n))return;if(s)return s(t,n).value}return t[n]};e.exports=function e(){var t,n,r,i,o,s,f=arguments[0],h=1,p=arguments.length,d=!1;for("boolean"==typeof f&&(d=f,f=arguments[1]||{},h=2),(null==f||"object"!=typeof f&&"function"!=typeof f)&&(f={});h32;)t=t.slice(1);var n=this._priv;r.strictEqual(t.length,32),r.strictEqual(n.length,32);var i=u.box.before(new Uint8Array(t),new Uint8Array(n));return o.from(i)}throw new Error("Invalid algorithm: "+this._algo)},m.prototype.generateKey=function(){var e=[],t,n;if("dsa"===this._algo)return this._dh.generateKeys(),e.push({name:"p",data:this._p.data}),e.push({name:"q",data:this._key.part.q.data}),e.push({name:"g",data:this._g.data}),e.push({name:"y",data:this._dh.getPublicKey()}),e.push({name:"x",data:this._dh.getPrivateKey()}),this._key=new c({type:"dsa",parts:e}),this._isPriv=!0,this._key;if("ecdsa"===this._algo){if(f)return this._dh.generateKeys(),e.push({name:"curve",data:o.from(this._curve)}),e.push({name:"Q",data:this._dh.getPublicKey()}),e.push({name:"d",data:this._dh.getPrivateKey()}),this._key=new c({type:"ecdsa",curve:this._curve,parts:e}),this._isPriv=!0,this._key;var s=this._ecParams.getN(),a=new d(i.randomBytes(s.bitLength())),l=s.subtract(d.ONE);return t=a.mod(l).add(d.ONE),n=this._ecParams.getG().multiply(t),t=o.from(t.toByteArray()),n=o.from(this._ecParams.getCurve().encodePointHex(n),"hex"),this._priv=new b(this._ecParams,t),e.push({name:"curve",data:o.from(this._curve)}),e.push({name:"Q",data:n}),e.push({name:"d",data:t}),this._key=new c({type:"ecdsa",curve:this._curve,parts:e}),this._isPriv=!0,this._key}if("curve25519"===this._algo){var h=u.box.keyPair();return t=o.from(h.secretKey),n=o.from(h.publicKey),t=o.concat([t,n]),r.strictEqual(t.length,64),r.strictEqual(n.length,32),e.push({name:"A",data:n}),e.push({name:"k",data:t}),this._key=new c({type:"curve25519",parts:e}),this._isPriv=!0,this._key}throw new Error("Invalid algorithm: "+this._algo)},m.prototype.generateKeys=m.prototype.generateKey,g.prototype.getCurve=function(){return this.curve},g.prototype.getG=function(){return this.g},g.prototype.getN=function(){return this.n},g.prototype.getH=function(){return this.h},b.prototype.deriveSharedSecret=function(e){r.ok(e instanceof y);var t=e._pub.multiply(this._priv);return o.from(t.getX().toBigInteger().toByteArray())}},function(e,t,n){e.exports={read:p,readPkcs1:g,write:d,writePkcs1:E};var r=n(27),i=n(102),o=n(31).Buffer,s=n(56),a=n(47),u=n(46),l=n(52),c=n(113),f=n(209),h=f.readECDSACurve;function p(e,t){return c.read(e,t,"pkcs1")}function d(e,t){return c.write(e,t,"pkcs1")}function m(e,t){return r.strictEqual(e.peek(),i.Ber.Integer,t+" is not an Integer"),a.mpNormalize(e.readString(i.Ber.Integer,!0))}function g(e,t,n){switch(e){case"RSA":if("public"===t)return y(n);if("private"===t)return b(n);throw new Error("Unknown key type: "+t);case"DSA":if("public"===t)return w(n);if("private"===t)return v(n);throw new Error("Unknown key type: "+t);case"EC":case"ECDSA":if("private"===t)return S(n);if("public"===t)return k(n);throw new Error("Unknown key type: "+t);case"EDDSA":case"EdDSA":if("private"===t)return _(n);throw new Error(t+" keys not supported with EdDSA");default:throw new Error("Unknown key algo: "+e)}}function y(e){var t=m(e,"modulus"),n=m(e,"exponent"),r={type:"rsa",parts:[{name:"e",data:n},{name:"n",data:t}]};return new u(r)}function b(e){var t=m(e,"version");r.strictEqual(t[0],0);var n=m(e,"modulus"),i=m(e,"public exponent"),o=m(e,"private exponent"),s=m(e,"prime1"),a=m(e,"prime2"),u=m(e,"exponent1"),c=m(e,"exponent2"),f=m(e,"iqmp"),h={type:"rsa",parts:[{name:"n",data:n},{name:"e",data:i},{name:"d",data:o},{name:"iqmp",data:f},{name:"p",data:s},{name:"q",data:a},{name:"dmodp",data:u},{name:"dmodq",data:c}]};return new l(h)}function v(e){var t=m(e,"version");r.strictEqual(t.readUInt8(0),0);var n=m(e,"p"),i=m(e,"q"),o=m(e,"g"),s=m(e,"y"),a=m(e,"x"),u={type:"dsa",parts:[{name:"p",data:n},{name:"q",data:i},{name:"g",data:o},{name:"y",data:s},{name:"x",data:a}]};return new l(u)}function _(e){var t=m(e,"version");r.strictEqual(t.readUInt8(0),1);var n=e.readString(i.Ber.OctetString,!0);e.readSequence(160);var o=e.readOID();r.strictEqual(o,"1.3.101.112","the ed25519 curve identifier"),e.readSequence(161);var s=a.readBitString(e),u={type:"ed25519",parts:[{name:"A",data:a.zeroPadToLength(s,32)},{name:"k",data:n}]};return new l(u)}function w(e){var t=m(e,"y"),n=m(e,"p"),r=m(e,"q"),i=m(e,"g"),o={type:"dsa",parts:[{name:"y",data:t},{name:"p",data:n},{name:"q",data:r},{name:"g",data:i}]};return new u(o)}function k(e){e.readSequence();var t=e.readOID();r.strictEqual(t,"1.2.840.10045.2.1","must be ecPublicKey");for(var n=e.readOID(),l,c=Object.keys(s.curves),f=0;f>1,c=-7,f=n?i-1:0,h=n?-1:1,p=e[t+f];for(f+=h,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=256*o+e[t+f],f+=h,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=256*s+e[t+f],f+=h,c-=8);if(0===o)o=1-l;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=l}return(p?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,u,l=8*o-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,m=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=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+f>=1?h/u:h*Math.pow(2,1-f),t*u>=2&&(s++,u/=2),s+f>=c?(a=0,s=c):s+f>=1?(a=(t*u-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;e[n+p]=255&s,p+=d,s/=256,l-=8);e[n+p-d]|=128*m}},function(e,t,n){"use strict";(function(t,r){var i;e.exports=j,j.ReadableState=T;var o=n(6).EventEmitter,s=function e(t,n){return t.listeners(n).length},a=n(387),u=n(0).Buffer,l=t.Uint8Array||function(){};function c(e){return u.from(e)}function f(e){return u.isBuffer(e)||e instanceof l}var h=n(742),p;p=h&&h.debuglog?h.debuglog("stream"):function e(){};var d=n(743),m=n(388),g=n(389),y=g.getHighWaterMark,b=n(170).codes,v=b.ERR_INVALID_ARG_TYPE,_=b.ERR_STREAM_PUSH_AFTER_EOF,w=b.ERR_METHOD_NOT_IMPLEMENTED,k=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,S=n(745),E=S.emitExperimentalWarning,x,C;n(1)(j,a);var A=["error","close","destroy","pause","resume"];function I(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function T(e,t,r){i=i||n(132),e=e||{},"boolean"!=typeof r&&(r=t instanceof i),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=y(this,e,"readableHighWaterMark",r),this.buffer=new d,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!==e.emitClose,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(x||(x=n(14).StringDecoder),this.decoder=new x(e.encoding),this.encoding=e.encoding)}function j(e){if(i=i||n(132),!(this instanceof j))return new j(e);var t=this instanceof i;this._readableState=new T(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),a.call(this)}function O(e,t,n,r,i){p("readableAddChunk",t);var o=e._readableState,s;if(null===t)o.reading=!1,L(e,o);else if(i||(s=B(o,t)),s)e.emit("error",s);else if(o.objectMode||t&&t.length>0)if("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=c(t)),r)o.endEmitted?e.emit("error",new k):P(e,o,t,!0);else if(o.ended)e.emit("error",new _);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?P(e,o,t,!1):U(e,o)):P(e,o,t,!1)}else r||(o.reading=!1,U(e,o));return!o.ended&&(o.length=R?e=R:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function M(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=N(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function L(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?F(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,D(e)))}}function F(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(D,e))}function D(e){var t=e._readableState;p("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||e.emit("readable"),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,$(e)}function U(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(z,e,t))}function z(e,t){for(var n=t.length;!t.reading&&!t.ended&&t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function H(e){p("readable nexttick read 0"),e.read(0)}function V(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(W,e,t))}function W(e,t){p("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),$(e),t.flowing&&!t.reading&&e.read(0)}function $(e){var t=e._readableState;for(p("flow",t.flowing);t.flowing&&null!==e.read(););}function G(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function Y(e){var t=e._readableState;p("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(J,t,e))}function J(e,t){p("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function Z(e,t){for(var n=0,r=e.length;n=t.highWaterMark:t.length>0)||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Y(this):F(this),null;if(e=M(e,t),0===e&&t.ended)return 0===t.length&&Y(this),null;var r=t.needReadable,i;return p("need readable",r),(0===t.length||t.length-e0?G(e,t):null,null===i?(t.needReadable=!0,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&Y(this)),null!==i&&this.emit("data",i),i},j.prototype._read=function(e){this.emit("error",new w("_read()"))},j.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,p("pipe count=%d opts=%j",i.pipesCount,t);var o=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=o?l:b;function u(e,t){p("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,h())}function l(){p("onend"),e.end()}i.endEmitted?r.nextTick(a):n.once("end",a),e.on("unpipe",u);var c=q(n);e.on("drain",c);var f=!1;function h(){p("cleanup"),e.removeListener("close",g),e.removeListener("finish",y),e.removeListener("drain",c),e.removeListener("error",m),e.removeListener("unpipe",u),n.removeListener("end",l),n.removeListener("end",b),n.removeListener("data",d),f=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||c()}function d(t){p("ondata");var r=e.write(t);p("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==Z(i.pipes,e))&&!f&&(p("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function m(t){p("onerror",t),b(),e.removeListener("error",m),0===s(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",y),b()}function y(){p("onfinish"),e.removeListener("close",g),b()}function b(){p("unpipe"),n.unpipe(e)}return n.on("data",d),I(e,"error",m),e.once("close",g),e.once("finish",y),e.emit("pipe",n),i.flowing||(p("pipe resume"),n.resume()),e},j.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,p("on readable",i.length,i.reading),i.length?F(this):i.reading||r.nextTick(H,this))),n},j.prototype.addListener=j.prototype.on,j.prototype.removeListener=function(e,t){var n=a.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(K,this),n},j.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(K,this),t},j.prototype.resume=function(){var e=this._readableState;return e.flowing||(p("resume"),e.flowing=!e.readableListening,V(this,e)),e.paused=!1,this},j.prototype.pause=function(){return p("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(p("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},j.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",function(){if(p("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){if(p("wrapped data"),n.decoder&&(i=n.decoder.write(i)),(!n.objectMode||null!==i&&void 0!==i)&&(n.objectMode||i&&i.length)){var o=t.push(i);o||(r=!0,e.pause())}}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function t(n){return function t(){return e[n].apply(e,arguments)}}(i));for(var o=0;o-1))throw new E(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(I.prototype,"writableBuffer",{enumerable:!1,get:function e(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(I.prototype,"writableHighWaterMark",{enumerable:!1,get:function e(){return this._writableState.highWaterMark}}),I.prototype._write=function(e,t,n){n(new b("_write()"))},I.prototype._writev=null,I.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||H(this,r,n),this},Object.defineProperty(I.prototype,"writableLength",{enumerable:!1,get:function e(){return this._writableState.length}}),Object.defineProperty(I.prototype,"destroyed",{enumerable:!1,get:function e(){return void 0!==this._writableState&&this._writableState.destroyed},set:function e(t){this._writableState&&(this._writableState.destroyed=t)}}),I.prototype.destroy=p.destroy,I.prototype._undestroy=p.undestroy,I.prototype._destroy=function(e,t){t(e)}}).call(this,n(8),n(2))},function(e,t,n){"use strict";e.exports=c;var r=n(170).codes,i=r.ERR_METHOD_NOT_IMPLEMENTED,o=r.ERR_MULTIPLE_CALLBACK,s=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=r.ERR_TRANSFORM_WITH_LENGTH_0,u=n(132);function l(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.lengththis._repo.blocks.get(e,t),t):t(new Error("first arg must be an array of cids"))}delete(e,t){this._repo.blocks.delete(e,t)}}e.exports=i},function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,n(8))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var r=n(291),i=a(r),o=n(41),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t,n,r){(0,i.default)(t)(e,(0,s.default)(n),r)}e.exports=t.default},function(e,t,n){(function(e){var r=n(98),i=n(758),o=t&&!t.nodeType&&t,s=o&&"object"==typeof e&&e&&!e.nodeType&&e,a=s&&s.exports===o,u=a?r.Buffer:void 0,l=u?u.isBuffer:void 0,c=l||i;e.exports=c}).call(this,n(75)(e))},function(e,t){var n=9007199254740991,r=/^(?:0|[1-9]\d*)$/;function i(e,t){var i=typeof e;return t=null==t?n:t,!!t&&("number"==i||"symbol"!=i&&r.test(e))&&e>-1&&e%1==0&&e2&&(i=(0,u.default)(arguments,1)),r[t]=i,n(e)})},function(e){n(e,r)})}e.exports=t.default},function(e,t,n){"use strict";function r(e){return function(t,n,r){return e(t,r)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t,n){var r,i;r=this,i=function(){return function(e,t,n,r){for(r=0,t=t.split?t.split("."):t;e&&r1&&this._buf[this._buf.length-1]===a;)this._buf=this._buf.slice(0,-1)}less(e){const t=this.list(),n=e.list();for(let e=0;ei)return!1}return t.length>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);function i(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}e.exports=i},function(e,t,n){"use strict";const r=n(22);e.exports.dbOpenFailedError=(e=>(e=e||new Error("Cannot open database"),r(e,"ERR_DB_OPEN_FAILED"))),e.exports.dbDeleteFailedError=(e=>(e=e||new Error("Delete failed"),r(e,"ERR_DB_DELETE_FAILED"))),e.exports.dbWriteFailedError=(e=>(e=e||new Error("Write failed"),r(e,"ERR_DB_WRITE_FAILED"))),e.exports.notFoundError=(e=>(e=e||new Error("Not Found"),r(e,"ERR_NOT_FOUND")))},function(e,t,n){"use strict";var r=Object.prototype.toString;e.exports=function(e){var t;return"[object Object]"===r.call(e)&&(t=Object.getPrototypeOf(e),null===t||t===Object.getPrototypeOf({}))}},function(e,t,n){"use strict";const r=n(227),i=n(811),o=n(813),s=n(815),a=n(816),u=n(416);t.KeytransformDatastore=r,t.ShardingDatastore=i,t.MountDatastore=o,t.TieredDatastore=s,t.NamespaceDatastore=a,t.shard=u},function(e,t,n){"use strict";const r=n(228),i=n(33).Key,o=n(812),s=t.PREFIX="/repo/flatfs/shard/",a=t.SHARDING_FN="SHARDING";t.README_FN="_README";class u{constructor(e){this.param=e}fun(e){throw new Error("implement me")}toString(){return`${s}v1/${this.name}/${this.param}`}}class l extends u{constructor(e){super(e),this._padding=r("",e,"_"),this.name="prefix"}fun(e){return(e+this._padding).slice(0,this.param)}}class c extends u{constructor(e){super(e),this._padding=r("",e,"_"),this.name="suffix"}fun(e){const t=this._padding+e;return t.slice(t.length-this.param)}}class f extends u{constructor(e){super(e),this._padding=r("",e+1,"_"),this.name="next-to-last"}fun(e){const t=this._padding+e,n=t.length-this.param-1;return t.slice(n,n+this.param)}}function h(e){if(e=e.trim(),0===e.length)throw new Error("empty shard string");if(!e.startsWith(s))throw new Error(`invalid or no path prefix: ${e}`);const t=e.slice(s.length).split("/"),n=t[0];if("v1"!==n)throw new Error(`expect 'v1' version, got '${n}'`);const r=t[1];if(!t[2])throw new Error("missing param");const i=parseInt(t[2],10);switch(r){case"prefix":return new l(i);case"suffix":return new c(i);case"next-to-last":return new f(i);default:throw new Error(`unkown sharding function: ${r}`)}}t.readShardFun=((e,t,n)=>{const r=new i(e).child(new i(a)),o="function"==typeof t.getRaw?t.getRaw.bind(t):t.get.bind(t);o(r,(e,t)=>{if(e)return n(e);let r;try{r=h((t||"").toString().trim())}catch(e){return n(e)}n(null,r)})}),t.readme=o,t.parseShardFun=h,t.Prefix=l,t.Suffix=c,t.NextToLast=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(818),i=a(r),o=n(171),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)(i.default),e.exports=t.default},function(e,t){function n(e){return function(t){return null==t?void 0:t[e]}}e.exports=n},function(e,t,n){t.AbstractLevelDOWN=n(823),t.AbstractIterator=n(420),t.AbstractChainedBatch=n(421)},function(e,t,n){(function(t){function n(e){this.db=e,this._ended=!1,this._nexting=!1}n.prototype.next=function(e){var n=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return n._ended?(t.nextTick(e,new Error("cannot call next() after end()")),n):n._nexting?(t.nextTick(e,new Error("cannot call next() before previous next() has completed")),n):(n._nexting=!0,n._next(function(){n._nexting=!1,e.apply(null,arguments)}),n)},n.prototype._next=function(e){t.nextTick(e)},n.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");if(this._ended)return t.nextTick(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},n.prototype._end=function(e){t.nextTick(e)},e.exports=n}).call(this,n(2))},function(e,t,n){(function(t){function n(e){this._db=e,this._operations=[],this._written=!1}n.prototype._serializeKey=function(e){return this._db._serializeKey(e)},n.prototype._serializeValue=function(e){return this._db._serializeValue(e)},n.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},n.prototype.put=function(e,t){this._checkWritten();var n=this._db._checkKey(e,"key");if(n)throw n;return e=this._serializeKey(e),t=this._serializeValue(t),this._put(e,t),this},n.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},n.prototype.del=function(e){this._checkWritten();var t=this._db._checkKey(e,"key");if(t)throw t;return e=this._serializeKey(e),this._del(e),this},n.prototype._del=function(e){this._operations.push({type:"del",key:e})},n.prototype.clear=function(){return this._checkWritten(),this._operations=[],this._clear(),this},n.prototype._clear=function e(){},n.prototype.write=function(e,n){if(this._checkWritten(),"function"==typeof e&&(n=e),"function"!=typeof n)throw new Error("write() requires a callback argument");return"object"!=typeof e&&(e={}),this._written=!0,"function"==typeof this._write?this._write(n):"function"==typeof this._db._batch?this._db._batch(this._operations,e,n):void t.nextTick(n)},e.exports=n}).call(this,n(2))},function(e,t,n){"use strict";(function(t,r){var i=n(10);e.exports=S;var o=n(48),s;S.ReadableState=k;var a=n(6).EventEmitter,u=function(e,t){return e.listeners(t).length},l=n(423),c=n(4).Buffer,f=t.Uint8Array||function(){};function h(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof f}var d=n(7);d.inherits=n(1);var m=n(827),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(828),b=n(424),v;d.inherits(S,l);var _=["error","close","destroy","pause","resume"];function w(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function k(e,t){s=s||n(139),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=n(14).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function S(e){if(s=s||n(139),!(this instanceof S))return new S(e);this._readableState=new k(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),l.call(this)}function E(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,O(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.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,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),_()}function v(){g("onfinish"),e.removeListener("close",b),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(49)},f=n(423),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(424),y;function b(){}function v(e,t){u=u||n(139),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||n(139),!(y.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(139),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.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,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),_()}function v(){g("onfinish"),e.removeListener("close",b),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o{const n=e+"/"+s;o("locking %s",n),a[n]=!0;const r={close(e){a[n]&&delete a[n],i(e)}};i(()=>{t(null,r)})}),t.locked=((e,t)=>{const n=e+"/"+s;o("checking lock: %s");const r=a[n];i(()=>{t(null,r)})})},function(e,t){e.exports=function(e){var t,n=!1;function r(r){if(!r)throw new Error("must be passed a readable");t=r,n&&e(t)}return r.resolve=r.ready=r.start=function(i){return n=!0,e=i||e,t&&e(t),r},r}},function(e,t,n){var r=n(224),i=n(441);e.exports=function(){var e=r(),t=i();return{source:e,sink:t,resolve:function(n){e.resolve(n.source),t.resolve(n.sink)}}}},function(e,t){var n=t.once=function(e){return function(t,n){if(t)return n(t);if(null!=e){var r=e;e=null,n(null,r)}else n(!0)}},r=t.depthFirst=function(e,t){var r=[],i;return r.unshift(n(e)),function e(n,o){return r.length?i?o(i):void r[0](n,function(n,s){if(n){if(!0!==n){for(i=n,r.shift();r.length;)r.shift()(n,function(){});return o(n)}return r.shift(),e(null,o)}r.unshift(t(s)),o(n,s)}):o(!0)}},i=t.widthFirst=function(e,t){var r=[];return r.push(n(e)),function e(n,i){if(!r.length)return i(!0);r[0](n,function(n,o){if(n)return r.shift(),e(null,i);r.push(t(o)),i(n,o)})}},o=t.leafFirst=function(e,t){var r=[],i=[];return r.push(n(e)),function e(n,o){r[0](n,function(n,s){if(n)return r.shift(),i.length?o(null,i.shift()):o(!0);r.unshift(t(s)),i.unshift(s),e(null,o)})}}},function(e,t,n){"use strict";const r=n(414),i=Object.prototype.hasOwnProperty,o=Object.propertyIsEnumerable,s=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}),a=this,u={concatArrays:!1},l=e=>{const t=[];for(const n in e)i.call(e,n)&&t.push(n);if(Object.getOwnPropertySymbols){const n=Object.getOwnPropertySymbols(e);for(let r=0;r{s(t,n,c(e[n]))}),t}function h(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return l(e).forEach(n=>{s(t,n,c(e[n]))}),t}const p=(e,t,n,r)=>(n.forEach(n=>{n in e&&e[n]!==Object.getPrototypeOf(e)?s(e,n,m(e[n],t[n],r)):s(e,n,c(t[n]))}),e),d=(e,t,n)=>{let r=e.slice(0,0),o=0;return[e,t].forEach(t=>{const a=[];for(let n=0;n-1===a.indexOf(e)),n)}),r};function m(e,t,n){return n.concatArrays&&Array.isArray(e)&&Array.isArray(t)?d(e,t,n):r(t)&&r(e)?p(e,t,l(t),n):c(t)}e.exports=function(){const e=m(c(u),this!==a&&this||{},u);let t={foobar:{}};for(let n=0;n(e=e.slice(1),new s(e))}});function h(e){let t;try{t=a(e)}catch(e){t=!1}if(t)throw new Error("The object passed has circular references");function n(e){if(!e||r.isBuffer(e)||"string"==typeof e)return e;if(Array.isArray(e))return e.map(n);if(s.isCID(e))return c(e);const t=Object.keys(e);if(1===t.length&&"/"===t[0])return c(e["/"]);if(t.length>0){const r={};return t.forEach(t=>{"object"==typeof e[t]?r[t]=n(e[t]):r[t]=e[t]}),r}return e}return n(e)}t=e.exports,t.serialize=((e,t)=>{let n;try{const r=h(e);n=i.encode(r)}catch(e){return setImmediate(()=>t(e))}setImmediate(()=>t(null,n))}),t.deserialize=((e,t)=>{let n;try{n=f.decodeFirst(e)}catch(e){return setImmediate(()=>t(e))}setImmediate(()=>t(null,n))}),t.cid=((e,n,r)=>{"function"==typeof n&&(r=n,n={}),n=n||{};const i=n.hashAlg||u.defaultHashAlg,a=n.hashLen,l=void 0===n.version?1:n.version;t.serialize(e,(e,t)=>{if(e)return r(e);o(t,i,a,(e,t)=>{if(e)return r(e);r(null,new s(l,u.multicodec,t))})})})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t,r){const i=n(385),o=n(62),s=n(858),a=n(302),u=n(231),l=n(447),c=n(448),{URL:f}=n(303);class h{constructor(e){e=e||{},!e.size||e.size<65536?e.size=65536:e.size=a.nextPowerOf2(e.size),this._heap=new ArrayBuffer(e.size),this._heap8=new Uint8Array(this._heap),this._buffer=t.from(this._heap),this._reset(),this._knownTags=Object.assign({0:e=>new Date(e),1:e=>new Date(1e3*e),2:e=>a.arrayBufferToBignumber(e),3:e=>u.NEG_ONE.minus(a.arrayBufferToBignumber(e)),4:e=>u.TEN.pow(e[0]).times(e[1]),5:e=>u.TWO.pow(e[0]).times(e[1]),32:e=>new f(e),35:e=>new RegExp(e)},e.tags),this.parser=s(r,{log:console.log.bind(console),pushInt:this.pushInt.bind(this),pushInt32:this.pushInt32.bind(this),pushInt32Neg:this.pushInt32Neg.bind(this),pushInt64:this.pushInt64.bind(this),pushInt64Neg:this.pushInt64Neg.bind(this),pushFloat:this.pushFloat.bind(this),pushFloatSingle:this.pushFloatSingle.bind(this),pushFloatDouble:this.pushFloatDouble.bind(this),pushTrue:this.pushTrue.bind(this),pushFalse:this.pushFalse.bind(this),pushUndefined:this.pushUndefined.bind(this),pushNull:this.pushNull.bind(this),pushInfinity:this.pushInfinity.bind(this),pushInfinityNeg:this.pushInfinityNeg.bind(this),pushNaN:this.pushNaN.bind(this),pushNaNNeg:this.pushNaNNeg.bind(this),pushArrayStart:this.pushArrayStart.bind(this),pushArrayStartFixed:this.pushArrayStartFixed.bind(this),pushArrayStartFixed32:this.pushArrayStartFixed32.bind(this),pushArrayStartFixed64:this.pushArrayStartFixed64.bind(this),pushObjectStart:this.pushObjectStart.bind(this),pushObjectStartFixed:this.pushObjectStartFixed.bind(this),pushObjectStartFixed32:this.pushObjectStartFixed32.bind(this),pushObjectStartFixed64:this.pushObjectStartFixed64.bind(this),pushByteString:this.pushByteString.bind(this),pushByteStringStart:this.pushByteStringStart.bind(this),pushUtf8String:this.pushUtf8String.bind(this),pushUtf8StringStart:this.pushUtf8StringStart.bind(this),pushSimpleUnassigned:this.pushSimpleUnassigned.bind(this),pushTagUnassigned:this.pushTagUnassigned.bind(this),pushTagStart:this.pushTagStart.bind(this),pushTagStart4:this.pushTagStart4.bind(this),pushTagStart8:this.pushTagStart8.bind(this),pushBreak:this.pushBreak.bind(this)},this._heap)}get _depth(){return this._parents.length}get _currentParent(){return this._parents[this._depth-1]}get _ref(){return this._currentParent.ref}_closeParent(){var e=this._parents.pop();if(e.length>0)throw new Error(`Missing ${e.length} elements`);switch(e.type){case u.PARENT.TAG:this._push(this.createTag(e.ref[0],e.ref[1]));break;case u.PARENT.BYTE_STRING:this._push(this.createByteString(e.ref,e.length));break;case u.PARENT.UTF8_STRING:this._push(this.createUtf8String(e.ref,e.length));break;case u.PARENT.MAP:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createMap(e.ref,e.length));break;case u.PARENT.OBJECT:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createObject(e.ref,e.length));break;case u.PARENT.ARRAY:this._push(this.createArray(e.ref,e.length))}this._currentParent&&this._currentParent.type===u.PARENT.TAG&&this._dec()}_dec(){const e=this._currentParent;e.length<0||(e.length--,0===e.length&&this._closeParent())}_push(e,t){const n=this._currentParent;switch(n.values++,n.type){case u.PARENT.ARRAY:case u.PARENT.BYTE_STRING:case u.PARENT.UTF8_STRING:n.length>-1?this._ref[this._ref.length-n.length]=e:this._ref.push(e),this._dec();break;case u.PARENT.OBJECT:null!=n.tmpKey?(this._ref[n.tmpKey]=e,n.tmpKey=null,this._dec()):(n.tmpKey=e,"string"!=typeof n.tmpKey&&(n.type=u.PARENT.MAP,n.ref=a.buildMap(n.ref)));break;case u.PARENT.MAP:null!=n.tmpKey?(this._ref.set(n.tmpKey,e),n.tmpKey=null,this._dec()):n.tmpKey=e;break;case u.PARENT.TAG:this._ref.push(e),t||this._dec();break;default:throw new Error("Unknown parent type")}}_createParent(e,t,n){this._parents[this._depth]={type:t,length:n,ref:e,values:0,tmpKey:null}}_reset(){this._res=[],this._parents=[{type:u.PARENT.ARRAY,length:-1,ref:this._res,values:0,tmpKey:null}]}createTag(e,t){const n=this._knownTags[e];return n?n(t):new c(e,t)}createMap(e,t){return e}createObject(e,t){return e}createArray(e,t){return e}createByteString(e,n){return t.concat(e)}createByteStringFromHeap(e,n){return e===n?t.alloc(0):t.from(this._heap.slice(e,n))}createInt(e){return e}createInt32(e,t){return a.buildInt32(e,t)}createInt64(e,t,n,r){return a.buildInt64(e,t,n,r)}createFloat(e){return e}createFloatSingle(e,t,n,r){return i.read([e,t,n,r],0,!1,23,4)}createFloatDouble(e,t,n,r,o,s,a,u){return i.read([e,t,n,r,o,s,a,u],0,!1,52,8)}createInt32Neg(e,t){return-1-a.buildInt32(e,t)}createInt64Neg(e,t,n,r){const i=a.buildInt32(e,t),s=a.buildInt32(n,r);return i>u.MAX_SAFE_HIGH?u.NEG_ONE.minus(new o(i).times(u.SHIFT32).plus(s)):-1-(i*u.SHIFT32+s)}createTrue(){return!0}createFalse(){return!1}createNull(){return null}createUndefined(){}createInfinity(){return 1/0}createInfinityNeg(){return-1/0}createNaN(){return NaN}createNaNNeg(){return NaN}createUtf8String(e,t){return e.join("")}createUtf8StringFromHeap(e,t){return e===t?"":this._buffer.toString("utf8",e,t)}createSimpleUnassigned(e){return new l(e)}pushInt(e){this._push(this.createInt(e))}pushInt32(e,t){this._push(this.createInt32(e,t))}pushInt64(e,t,n,r){this._push(this.createInt64(e,t,n,r))}pushFloat(e){this._push(this.createFloat(e))}pushFloatSingle(e,t,n,r){this._push(this.createFloatSingle(e,t,n,r))}pushFloatDouble(e,t,n,r,i,o,s,a){this._push(this.createFloatDouble(e,t,n,r,i,o,s,a))}pushInt32Neg(e,t){this._push(this.createInt32Neg(e,t))}pushInt64Neg(e,t,n,r){this._push(this.createInt64Neg(e,t,n,r))}pushTrue(){this._push(this.createTrue())}pushFalse(){this._push(this.createFalse())}pushNull(){this._push(this.createNull())}pushUndefined(){this._push(this.createUndefined())}pushInfinity(){this._push(this.createInfinity())}pushInfinityNeg(){this._push(this.createInfinityNeg())}pushNaN(){this._push(this.createNaN())}pushNaNNeg(){this._push(this.createNaNNeg())}pushArrayStart(){this._createParent([],u.PARENT.ARRAY,-1)}pushArrayStartFixed(e){this._createArrayStartFixed(e)}pushArrayStartFixed32(e,t){const n=a.buildInt32(e,t);this._createArrayStartFixed(n)}pushArrayStartFixed64(e,t,n,r){const i=a.buildInt64(e,t,n,r);this._createArrayStartFixed(i)}pushObjectStart(){this._createObjectStartFixed(-1)}pushObjectStartFixed(e){this._createObjectStartFixed(e)}pushObjectStartFixed32(e,t){const n=a.buildInt32(e,t);this._createObjectStartFixed(n)}pushObjectStartFixed64(e,t,n,r){const i=a.buildInt64(e,t,n,r);this._createObjectStartFixed(i)}pushByteStringStart(){this._parents[this._depth]={type:u.PARENT.BYTE_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushByteString(e,t){this._push(this.createByteStringFromHeap(e,t))}pushUtf8StringStart(){this._parents[this._depth]={type:u.PARENT.UTF8_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushUtf8String(e,t){this._push(this.createUtf8StringFromHeap(e,t))}pushSimpleUnassigned(e){this._push(this.createSimpleUnassigned(e))}pushTagStart(e){this._parents[this._depth]={type:u.PARENT.TAG,length:1,ref:[e]}}pushTagStart4(e,t){this.pushTagStart(a.buildInt32(e,t))}pushTagStart8(e,t,n,r){this.pushTagStart(a.buildInt64(e,t,n,r))}pushTagUnassigned(e){this._push(this.createTag(e))}pushBreak(){if(this._currentParent.length>-1)throw new Error("Unexpected break");this._closeParent()}_createObjectStartFixed(e){0!==e?this._createParent({},u.PARENT.OBJECT,e):this._push(this.createObject({}))}_createArrayStartFixed(e){0!==e?this._createParent(new Array(e),u.PARENT.ARRAY,e):this._push(this.createArray([]))}_decode(e){if(0===e.byteLength)throw new Error("Input too short");this._reset(),this._heap8.set(e);const t=this.parser.parse(e.byteLength);if(this._depth>1){for(;0===this._currentParent.length;)this._closeParent();if(this._depth>1)throw new Error("Undeterminated nesting")}if(t>0)throw new Error("Failed to parse");if(0===this._res.length)throw new Error("No valid result")}decodeFirst(e){return this._decode(e),this._res[0]}decodeAll(e){return this._decode(e),this._res}static decode(e,n){"string"==typeof e&&(e=t.from(e,n||"hex"));const r=new h({size:e.length});return r.decodeFirst(e)}static decodeAll(e,n){"string"==typeof e&&(e=t.from(e,n||"hex"));const r=new h({size:e.length});return r.decodeAll(e)}}h.decodeFirst=h.decode,e.exports=h}).call(this,n(0).Buffer,n(8))},function(e,t,n){"use strict";const r=n(231),i=r.MT,o=r.SIMPLE,s=r.SYMS;class a{constructor(e){if("number"!=typeof e)throw new Error("Invalid Simple type: "+typeof e);if(e<0||e>255||(0|e)!==e)throw new Error("value must be a small positive integer: "+e);this.value=e}toString(){return"simple("+this.value+")"}inspect(){return"simple("+this.value+")"}encodeCBOR(e){return e._pushInt(this.value,i.SIMPLE_FLOAT)}static isSimple(e){return e instanceof a}static decode(e,t){switch(null==t&&(t=!0),e){case o.FALSE:return!1;case o.TRUE:return!0;case o.NULL:return t?null:s.NULL;case o.UNDEFINED:return t?void 0:s.UNDEFINED;case-1:if(!t)throw new Error("Invalid BREAK");return s.BREAK;default:return new a(e)}}}e.exports=a},function(e,t,n){"use strict";class r{constructor(e,t,n){if(this.tag=e,this.value=t,this.err=n,"number"!=typeof this.tag)throw new Error("Invalid tag type ("+typeof this.tag+")");if(this.tag<0||(0|this.tag)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(e){return e._pushTag(this.tag),e.pushAny(this.value)}convert(e){var t,n;if(n=null!=e?e[this.tag]:void 0,"function"!=typeof n&&(n=r["_tag"+this.tag],"function"!=typeof n))return this;try{return n.call(r,this.value)}catch(e){return t=e,this.err=t,this}}}e.exports=r},function(e,t,n){"use strict";const r=self.location?self.location.protocol+"//"+self.location.host:"",i=self.URL;class o{constructor(e,t=r){this.super=new i(e,t),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set origin(e){this.super.origin=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set searchParams(e){this.super.searchParams=e}set username(e){this.super.username=e}createObjectURL(e){return this.super.createObjectURL(e)}revokeObjectURL(e){this.super.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}}function s(e){if("string"==typeof e){const t=new i(e);return t.toString()}if(!(e instanceof i)){const t=e.username&&e.password?`${e.username}:${e.password}@`:"",n=e.auth?e.auth+"@":"",r=e.port?":"+e.port:"",i=e.protocol?e.protocol+"//":"",o=e.host||"",s=e.hostname||"",a=e.search||(e.query?"?"+e.query:""),u=e.hash||"",l=e.pathname||"",c=e.path||l+a;return`${i}${t||n}${o||s+r}${c}${u}`}}e.exports={URLWithLegacySupport:o,URLSearchParams:self.URLSearchParams,defaultBase:r,format:s}},function(e,t,n){"use strict";(function(e,n){t.toCallback=(t=>(function(n,r){let i;try{i=t(n)}catch(t){return void e.nextTick(r,t)}e.nextTick(r,null,i)})),t.toBuf=((e,t)=>r=>{let i=e(r,t);return n.from(i,"hex")}),t.fromString=((e,t)=>r=>{const i=n.isBuffer(r)?r.toString():r;return e(i,t)}),t.fromNumberTo32BitBuf=((e,t)=>r=>{let i=e(r,t);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return n.from(o)})}).call(this,n(2),n(0).Buffer)},function(e,t){function n(e){return e&&"function"==typeof e.then}e.exports=n},function(e,t,n){(function(t){var n="Input must be an string, Buffer or Uint8Array";function r(e){var r;if(e instanceof Uint8Array)r=e;else if(e instanceof t)r=new Uint8Array(e);else{if("string"!=typeof e)throw new Error(n);r=new Uint8Array(t.from(e,"utf8"))}return r}function i(e){return Array.prototype.map.call(e,function(e){return(e<16?"0":"")+e.toString(16)}).join("")}function o(e){return(4294967296+e).toString(16).substring(1)}function s(e,t,n){for(var r="\n"+e+" = ",i=0;i{"function"==typeof t&&(n=t,t=void 0),i.deserialize(e,(e,i)=>{if(e)return n(e);if(!t||"/"===t)return n(null,{value:i,remainderPath:""});const s=t.split("/"),a=o(i).get(s);if(void 0!==a)return n(null,{value:a,remainderPath:""});let u;const l=s.length;for(let e=0;e{"function"==typeof t&&(n=t,t=void 0),t=t||{},i.deserialize(e,(e,t)=>{if(e)return n(e);const r=a(t),i=r.map(e=>e.path);n(null,i)})}),t.isLink=((e,n,r)=>{t.resolve(e,n,(e,t)=>e?r(e):t.remainderPath.length>0?r(new Error("path out of scope")):void(s.isCID(t.value)?r(null,t.value):r(null,!1)))})}).call(this,n(0).Buffer)},function(e,t){var n=e.exports=function(e){return new r(e)};function r(e){this.value=e}function i(e,t,n){var r=[],i=[],a=!0;return function e(u){var l=n?o(u):u,c={},f=!0,h={node:l,node_:u,path:[].concat(r),parent:i[i.length-1],parents:i,key:r.slice(-1)[0],isRoot:0===r.length,level:r.length,circular:null,update:function(e,t){h.isRoot||(h.parent.node[h.key]=e),h.node=e,t&&(f=!1)},delete:function(e){delete h.parent.node[h.key],e&&(f=!1)},remove:function(e){d(h.parent.node)?h.parent.node.splice(h.key,1):delete h.parent.node[h.key],e&&(f=!1)},keys:null,before:function(e){c.before=e},after:function(e){c.after=e},pre:function(e){c.pre=e},post:function(e){c.post=e},stop:function(){a=!1},block:function(){f=!1}};if(!a)return h;function p(){if("object"==typeof h.node&&null!==h.node){h.keys&&h.node_===h.node||(h.keys=s(h.node)),h.isLeaf=0==h.keys.length;for(var e=0;e{r([t=>o.deserialize(e,t),(e,r)=>{if(!t)return n(null,{value:e,remainderPath:""});const i=t.split("/");if("Links"===i[0]){let t="";if(!i[1])return r(null,{value:e.links.map(e=>e.toJSON()),remainderPath:""});const n={};e.links.forEach((e,t)=>{const r=e.toJSON();n[t]=n[r.name]={cid:r.cid,name:r.name,size:r.size}});let o=n[i[1]];"Hash"===i[2]?o={"/":o.cid}:"Tsize"===i[2]?o=o.size:"Name"===i[2]&&(o=o.name),t=i.slice(3).join("/"),r(null,{value:o,remainderPath:t})}else if("Data"===i[0])r(null,{value:e.data,remainderPath:""});else{const t={};e.links.forEach((e,n)=>{const r=e.toJSON();t[r.name]={cid:r.cid,name:r.name,size:r.size}});const n=t[i[0]];if(n)return r(null,{value:{"/":n.cid},remainderPath:i.slice(1).join("/")});r(new Error("path not available"))}}],n)}),t.tree=((e,t,n)=>{"function"==typeof t&&(n=t,t={}),t=t||{},o.deserialize(e,(e,t)=>{if(e)return n(e);const r=[];r.push("Links"),t.links.forEach((e,t)=>{r.push(`Links/${t}/Name`),r.push(`Links/${t}/Tsize`),r.push(`Links/${t}/Hash`)}),r.push("Data"),n(null,r)})}),t.isLink=((e,n,r)=>{t.resolve(e,n,(e,t)=>{if(e)return r(e);if(t.remainderPath.length>0)return r(new Error("path out of scope"));if("object"==typeof t.value&&t.value["/"]){let n;try{n=i.isCID(new i(t.value["/"]))}catch(e){n=!1}if(n)return r(null,t.value)}r(null,!1)})})},function(e,t,n){"use strict";(function(r){const i=n(70),o=i(n(305));n(140),n(306),n(307);const s=n(19);t=e.exports;const a={rsa:n(901),ed25519:n(916),secp256k1:n(920)(o,n(312))};function u(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=o,t.keyStretcher=n(936),t.generateEphemeralKeyPair=n(938),t.generateKeyPair=((e,t,n)=>{let r=a[e.toLowerCase()];if(!r)return n(new Error("invalid or unsupported key type"));r.generateKeyPair(t,n)}),t.generateKeyPairFromSeed=((e,t,n,r)=>{let i=a[e.toLowerCase()];return i?"ed25519"!==e.toLowerCase()?r(new Error("Seed key derivation is unimplemented for RSA or secp256k1")):void i.generateKeyPairFromSeed(t,n,r):r(new Error("invalid or unsupported key type"))}),t.unmarshalPublicKey=(e=>{const t=o.PublicKey.decode(e),n=t.Data;switch(t.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPublicKey(n);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PublicKey(n);case o.KeyType.Secp256k1:if(a.secp256k1)return a.secp256k1.unmarshalSecp256k1PublicKey(n);throw new Error("secp256k1 support requires libp2p-crypto-secp256k1 package");default:throw new Error("invalid or unsupported key type")}}),t.marshalPublicKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let n;try{n=o.PrivateKey.decode(e)}catch(e){return t(e)}const r=n.Data;switch(n.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPrivateKey(r,t);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PrivateKey(r,t);case o.KeyType.Secp256k1:return a.secp256k1?a.secp256k1.unmarshalSecp256k1PrivateKey(r,t):t(new Error("secp256k1 support requires libp2p-crypto-secp256k1 package"));default:t(new Error("invalid or unsupported key type"))}}),t.marshalPrivateKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,n)=>{try{const i=s.pki.decryptRsaPrivateKey(e,t);if(null===i)throw new Error("Cannot read the key, most likely the password is wrong or not a RSA key");let o=s.asn1.toDer(s.pki.privateKeyToAsn1(i));return o=r.from(o.getBytes(),"binary"),a.rsa.unmarshalRsaPrivateKey(o,n)}catch(e){n(e)}})}).call(this,n(0).Buffer)},function(e,t,n){var r=n(19),i;e.exports=r.jsbn=r.jsbn||{};var o=0xdeadbeefcafe,s=!0;function a(e,t,n){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function u(){return new a(null)}function l(e,t,n,r,i,o){for(;--o>=0;){var s=t*this.data[e++]+n.data[r]+i;i=Math.floor(s/67108864),n.data[r++]=67108863&s}return i}function c(e,t,n,r,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var u=32767&this.data[e],l=this.data[e++]>>15,c=a*u+l*s;u=s*u+((32767&c)<<15)+n.data[r]+(1073741823&i),i=(u>>>30)+(c>>>15)+a*l+(i>>>30),n.data[r++]=1073741823&u}return i}function f(e,t,n,r,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var u=16383&this.data[e],l=this.data[e++]>>14,c=a*u+l*s;u=s*u+((16383&c)<<14)+n.data[r]+i,i=(u>>28)+(c>>14)+a*l,n.data[r++]=268435455&u}return i}r.jsbn.BigInteger=a,"undefined"==typeof navigator?(a.prototype.am=f,i=28):"Microsoft Internet Explorer"==navigator.appName?(a.prototype.am=c,i=30):"Netscape"!=navigator.appName?(a.prototype.am=l,i=26):(a.prototype.am=f,i=28),a.prototype.DB=i,a.prototype.DM=(1<=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function _(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function w(e){var t=u();return t.fromInt(e),t}function k(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void this.fromRadix(e,t);n=2}this.t=0,this.s=0;for(var r=e.length,i=!1,o=0;--r>=0;){var s=8==n?255&e[r]:b(e,r);s<0?"-"==e.charAt(r)&&(i=!0):(i=!1,0==o?this.data[this.t++]=s:o+n>this.DB?(this.data[this.t-1]|=(s&(1<>this.DB-o):this.data[this.t-1]|=s<=this.DB&&(o-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function E(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n=(1<0)for(a>a)>0&&(i=!0,o=y(r));s>=0;)a>(a+=this.DB-t)):(r=this.data[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=y(r));return i?o:"0"}function x(){var e=u();return a.ZERO.subTo(this,e),e}function C(){return this.s<0?this.negate():this}function A(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(t=n-e.t,0!=t)return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this.data[n]-e.data[n]))return t;return 0}function I(e){var t=1,n;return 0!=(n=e>>>16)&&(e=n,t+=16),0!=(n=e>>8)&&(e=n,t+=8),0!=(n=e>>4)&&(e=n,t+=4),0!=(n=e>>2)&&(e=n,t+=2),0!=(n=e>>1)&&(e=n,t+=1),t}function T(){return this.t<=0?0:this.DB*(this.t-1)+I(this.data[this.t-1]^this.s&this.DM)}function j(e,t){var n;for(n=this.t-1;n>=0;--n)t.data[n+e]=this.data[n];for(n=e-1;n>=0;--n)t.data[n]=0;t.t=this.t+e,t.s=this.s}function O(e,t){for(var n=e;n=0;--a)t.data[a+o+1]=this.data[a]>>r|s,s=(this.data[a]&i)<=0;--a)t.data[a]=0;t.data[o]=s,t.t=this.t+o+1,t.s=this.s,t.clamp()}function B(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<>r;for(var s=n+1;s>r;r>0&&(t.data[this.t-n-1]|=(this.s&o)<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t.data[n++]=this.DV+r:r>0&&(t.data[n++]=r),t.t=n,t.clamp()}function N(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[n]=0;for(n=0;n=t.DV&&(e.data[n+t.t]-=t.DV,e.data[n+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(n,t.data[n],e,2*n,0,1)),e.s=0,e.clamp()}function L(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t0?(r.lShiftTo(c,o),i.lShiftTo(c,n)):(r.copyTo(o),i.copyTo(n));var f=o.t,h=o.data[f-1];if(0!=h){var p=h*(1<1?o.data[f-2]>>this.F2:0),d=this.FV/p,m=(1<=0&&(n.data[n.t++]=1,n.subTo(v,n)),a.ONE.dlShiftTo(f,v),v.subTo(o,o);o.t=0;){var _=n.data[--y]==h?this.DM:Math.floor(n.data[y]*d+(n.data[y-1]+g)*m);if((n.data[y]+=o.am(0,_,n,b,0,f))<_)for(o.dlShiftTo(b,v),n.subTo(v,n);n.data[y]<--_;)n.subTo(v,n)}null!=t&&(n.drShiftTo(f,t),s!=l&&a.ZERO.subTo(t,t)),n.t=f,n.clamp(),c>0&&n.rShiftTo(c,n),s<0&&a.ZERO.subTo(n,n)}}}function F(e){var t=u();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(a.ZERO)>0&&e.subTo(t,t),t}function D(e){this.m=e}function U(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function z(e){return e}function q(e){e.divRemTo(this.m,null,e)}function K(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function H(e,t){e.squareTo(t),this.reduce(t)}function V(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function W(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t}function G(e){var t=u();return e.copyTo(t),this.reduce(t),t}function Y(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e.data[n]+=this.m.am(0,r,e,t,0,this.m.t);e.data[n]>=e.DV;)e.data[n]-=e.DV,e.data[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function J(e,t){e.squareTo(t),this.reduce(t)}function Z(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function X(){return 0==(this.t>0?1&this.data[0]:this.s)}function Q(e,t){if(e>4294967295||e<1)return a.ONE;var n=u(),r=u(),i=t.convert(this),o=I(e)-1;for(i.copyTo(n);--o>=0;)if(t.sqrTo(n,r),(e&1<0)t.mulTo(r,i,n);else{var s=n;n=r,r=s}return t.revert(n)}function ee(e,t){var n;return n=e<256||t.isEven()?new D(t):new W(t),this.exp(e,n)}function te(){var e=u();return this.copyTo(e),e}function ne(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<>24}function ie(){return 0==this.t?this.s:this.data[0]<<16>>16}function oe(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function se(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1}function ae(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),r=w(n),i=u(),o=u(),s="";for(this.divRemTo(r,i,o);i.signum()>0;)s=(n+o.intValue()).toString(e).substr(1)+s,i.divRemTo(r,i,o);return o.intValue().toString(e)+s}function ue(e,t){this.fromInt(0),null==t&&(t=10);for(var n=this.chunkSize(t),r=Math.pow(t,n),i=!1,o=0,s=0,u=0;u=n&&(this.dMultiply(r),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(s,0)),i&&a.ZERO.subTo(this,this)}function le(e,t,n){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(a.ONE.shiftLeft(e-1),ye,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(a.ONE.shiftLeft(e-1),this);else{var r=new Array,i=7&e;r.length=1+(e>>3),t.nextBytes(r),i>0?r[0]&=(1<0)for(n>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<=0;)n<8?(r=(this.data[e]&(1<>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t}function fe(e){return 0==this.compareTo(e)}function he(e){return this.compareTo(e)<0?this:e}function pe(e){return this.compareTo(e)>0?this:e}function de(e,t,n){var r,i,o=Math.min(e.t,this.t);for(r=0;r>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function Ae(){for(var e=0;e=this.t?0!=this.s:0!=(this.data[t]&1<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t.data[n++]=r:r<-1&&(t.data[n++]=this.DV+r),t.t=n,t.clamp()}function Me(e){var t=u();return this.addTo(e,t),t}function Le(e){var t=u();return this.subTo(e,t),t}function Fe(e){var t=u();return this.multiplyTo(e,t),t}function De(e){var t=u();return this.divRemTo(e,t,null),t}function Ue(e){var t=u();return this.divRemTo(e,null,t),t}function ze(e){var t=u(),n=u();return this.divRemTo(e,t,n),new Array(t,n)}function qe(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Ke(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function He(){}function Ve(e){return e}function We(e,t,n){e.multiplyTo(t,n)}function $e(e,t){e.squareTo(t)}function Ge(e){return this.exp(e,new He)}function Ye(e,t,n){var r=Math.min(this.t+e.t,t),i;for(n.s=0,n.t=r;r>0;)n.data[--r]=0;for(i=n.t-this.t;r=0;)n.data[r]=0;for(r=Math.max(t-this.t,0);r2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=u();return e.copyTo(t),this.reduce(t),t}function Qe(e){return e}function et(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function tt(e,t){e.squareTo(t),this.reduce(t)}function nt(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function rt(e,t){var n=e.bitLength(),r,i=w(1),o;if(n<=0)return i;r=n<18?1:n<48?3:n<144?4:n<768?5:6,o=n<8?new D(t):t.isEven()?new Ze(t):new W(t);var s=new Array,a=3,l=r-1,c=(1<1){var f=u();for(o.sqrTo(s[1],f);a<=c;)s[a]=u(),o.mulTo(f,s[a-2],s[a]),a+=2}var h=e.t-1,p,d=!0,m=u(),g;for(n=I(e.data[h])-1;h>=0;){for(n>=l?p=e.data[h]>>n-l&c:(p=(e.data[h]&(1<0&&(p|=e.data[h-1]>>this.DB+n-l)),a=r;0==(1&p);)p>>=1,--a;if((n-=a)<0&&(n+=this.DB,--h),d)s[p].copyTo(i),d=!1;else{for(;a>1;)o.sqrTo(i,m),o.sqrTo(m,i),a-=2;a>0?o.sqrTo(i,m):(g=i,i=m,m=g),o.mulTo(m,s[p],i)}for(;h>=0&&0==(e.data[h]&1<0&&(t.rShiftTo(o,t),n.rShiftTo(o,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n}function ot(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this.data[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this.data[r])%e;return n}function st(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return a.ZERO;for(var n=e.clone(),r=this.clone(),i=w(1),o=w(0),s=w(0),u=w(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),t?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;r.isEven();)r.rShiftTo(1,r),t?(s.isEven()&&u.isEven()||(s.addTo(this,s),u.subTo(e,u)),s.rShiftTo(1,s)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);n.compareTo(r)>=0?(n.subTo(r,n),t&&i.subTo(s,i),o.subTo(u,o)):(r.subTo(n,r),t&&s.subTo(i,s),u.subTo(o,u))}return 0!=r.compareTo(a.ONE)?a.ZERO:u.compareTo(e)>=0?u.subtract(e):u.signum()<0?(u.addTo(e,u),u.signum()<0?u.add(e):u):u}D.prototype.convert=U,D.prototype.revert=z,D.prototype.reduce=q,D.prototype.mulTo=K,D.prototype.sqrTo=H,W.prototype.convert=$,W.prototype.revert=G,W.prototype.reduce=Y,W.prototype.mulTo=Z,W.prototype.sqrTo=J,a.prototype.copyTo=v,a.prototype.fromInt=_,a.prototype.fromString=k,a.prototype.clamp=S,a.prototype.dlShiftTo=j,a.prototype.drShiftTo=O,a.prototype.lShiftTo=P,a.prototype.rShiftTo=B,a.prototype.subTo=R,a.prototype.multiplyTo=N,a.prototype.squareTo=M,a.prototype.divRemTo=L,a.prototype.invDigit=V,a.prototype.isEven=X,a.prototype.exp=Q,a.prototype.toString=E,a.prototype.negate=x,a.prototype.abs=C,a.prototype.compareTo=A,a.prototype.bitLength=T,a.prototype.mod=F,a.prototype.modPowInt=ee,a.ZERO=w(0),a.ONE=w(1),He.prototype.convert=Ve,He.prototype.revert=Ve,He.prototype.mulTo=We,He.prototype.sqrTo=$e,Ze.prototype.convert=Xe,Ze.prototype.revert=Qe,Ze.prototype.reduce=et,Ze.prototype.mulTo=nt,Ze.prototype.sqrTo=tt;var at=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],ut=(1<<26)/at[at.length-1];function lt(e){var t,n=this.abs();if(1==n.t&&n.data[0]<=at[at.length-1]){for(t=0;t=0);var u=o.modPow(r,this);if(0!=u.compareTo(a.ONE)&&0!=u.compareTo(t)){for(var l=1;l++4){var t=e;e=r.util.createBuffer();for(var n=0;n0))return!0;for(var r=0;r0))return!0;for(var r=0;r0)return!1;var n=e.length(),r=e.at(n-1);return!(r>this.blockSize<<2)&&(e.truncate(r),!0)},i.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(e,t,n){if(e.length()0))return!0;for(var r=0;r0))return!0;for(var r=0;r0)return!1;var n=e.length(),r=e.at(n-1);return!(r>this.blockSize<<2)&&(e.truncate(r),!0)},i.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(e,t,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0)e.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(e,t,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0)e.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(e,t,n){var r=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0)e.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(e,t,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}s(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=r.util.createBuffer(e.iv),n;if(this._cipherLength=0,n="additionalData"in e?r.util.createBuffer(e.additionalData):r.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=r.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=t.length();if(12===i)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(8*i)))}this._inBlock=this._j0.slice(0),s(this._inBlock),this._partialBytes=0,n=r.util.createBuffer(n),this._aDataLength=a(8*n.length());var o=n.length()%this.blockSize;for(o&&n.fillWithByte(0,this.blockSize-o),this._s=[0,0,0,0];n.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[n.getInt32(),n.getInt32(),n.getInt32(),n.getInt32()])},i.gcm.prototype.encrypt=function(e,t,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),s(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,n){var r=e.length();if(r0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),s(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--r)t[r]=e[r]>>>1|(1&e[r-1])<<31;t[0]=e[0]>>>1,n&&(t[0]^=this._R)},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],n=0;n<32;++n){var r=n/8|0,i=e[r]>>>4*(7-n%8)&15,o=this._m[n][i];t[0]^=o[0],t[1]^=o[1],t[2]^=o[2],t[3]^=o[3]}return t},i.gcm.prototype.ghash=function(e,t,n){return t[0]^=n[0],t[1]^=n[1],t[2]^=n[2],t[3]^=n[3],this.tableMultiply(t)},i.gcm.prototype.generateHashTable=function(e,t){for(var n=8/t,r=4*n,i=16*n,o=new Array(i),s=0;s>>1,i=new Array(n);i[r]=e.slice(0);for(var o=r>>>1;o>0;)this.pow(i[2*o],i[o]=[]),o>>=1;for(o=2;o4||!a||"sha1"===a))return"string"!=typeof a&&(a="sha1"),e=new t(e,"binary"),n=new t(n,"binary"),u?4===o.pbkdf2Sync.length?o.pbkdf2(e,n,i,s,function(e,t){if(e)return u(e);u(null,t.toString("binary"))}):o.pbkdf2(e,n,i,s,a,function(e,t){if(e)return u(e);u(null,t.toString("binary"))}):4===o.pbkdf2Sync.length?o.pbkdf2Sync(e,n,i,s).toString("binary"):o.pbkdf2Sync(e,n,i,s,a).toString("binary");if(void 0!==a&&null!==a||(a="sha1"),"string"==typeof a){if(!(a in r.md.algorithms))throw new Error("Unknown hash algorithm: "+a);a=r.md[a].create()}var l=a.digestLength;if(s>4294967295*l){var c=new Error("Derived key is too long.");if(u)return u(c);throw c}var f=Math.ceil(s/l),h=s-(f-1)*l,p=r.hmac.create();p.start(a,e);var d="",m,g,y;if(!u){for(var b=1;b<=f;++b){p.start(null,null),p.update(n),p.update(r.util.int32ToBytes(b)),m=y=p.digest().getBytes();for(var v=2;v<=i;++v)p.start(null,null),p.update(y),g=p.digest().getBytes(),m=r.util.xorBytes(m,g,l),y=g;d+=bf)return u(null,d);p.start(null,null),p.update(n),p.update(r.util.int32ToBytes(b)),m=y=p.digest().getBytes(),v=2,w()}function w(){if(v<=i)return p.start(null,null),p.update(y),g=p.digest().getBytes(),m=r.util.xorBytes(m,g,l),y=g,++v,r.util.setImmediate(w);d+=b>6],i=0==(32&n);if(31==(31&n)){let r=n;for(n=0;128==(128&r);){if(r=e.readUInt8(t),e.isError(r))return r;n<<=7,n|=127&r}}else n&=31;const o=a.tag[n];return{cls:r,primitive:i,tag:n,tagStr:o}}function f(e,t,n){let r=e.readUInt8(n);if(e.isError(r))return r;if(!t&&128===r)return null;if(0==(128&r))return r;const i=127&r;if(i>4)return e.error("length octect is too long");r=0;for(let t=0;t=31?r.error("Multi-octet tag encoding unsupported"):(t||(i|=32),i|=a.tagClassByName[n||"universal"]<<6,i)}e.exports=u,u.prototype.encode=function e(t,n){return this.tree._encode(t,n).join()},r(l,s.Node),l.prototype._encodeComposite=function e(t,n,r,o){const s=f(t,n,r,this.reporter);if(o.length<128){const e=new i(2);return e[0]=s,e[1]=o.length,this._createEncoderBuffer([e,o])}let a=1;for(let e=o.length;e>=256;e>>=8)a++;const u=new i(2+a);u[0]=s,u[1]=128|a;for(let e=1+a,t=o.length;t>0;e--,t>>=8)u[e]=255&t;return this._createEncoderBuffer([u,o])},l.prototype._encodeStr=function e(t,n){if("bitstr"===n)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===n){const e=new i(2*t.length);for(let n=0;n=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}let o=0;for(let e=0;e=128;n>>=7)o++}const s=new i(o);let a=s.length-1;for(let e=t.length-1;e>=0;e--){let n=t[e];for(s[a--]=127&n;(n>>=7)>0;)s[a--]=128|127&n}return this._createEncoderBuffer(s)},l.prototype._encodeTime=function e(t,n){let r;const i=new Date(t);return"gentime"===n?r=[c(i.getUTCFullYear()),c(i.getUTCMonth()+1),c(i.getUTCDate()),c(i.getUTCHours()),c(i.getUTCMinutes()),c(i.getUTCSeconds()),"Z"].join(""):"utctime"===n?r=[c(i.getUTCFullYear()%100),c(i.getUTCMonth()+1),c(i.getUTCDate()),c(i.getUTCHours()),c(i.getUTCMinutes()),c(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+n+" time is not supported yet"),this._encodeStr(r,"octstr")},l.prototype._encodeNull=function e(){return this._createEncoderBuffer("")},l.prototype._encodeInt=function e(t,n){if("string"==typeof t){if(!n)return this.reporter.error("String int or enum given, but no values map");if(!n.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=n[t]}if("number"!=typeof t&&!i.isBuffer(t)){const e=t.toArray();!t.sign&&128&e[0]&&e.unshift(0),t=new i(e)}if(i.isBuffer(t)){let e=t.length;0===t.length&&e++;const n=new i(e);return t.copy(n),0===t.length&&(n[0]=0),this._createEncoderBuffer(n)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);let r=1;for(let e=t;e>=256;e>>=8)r++;const o=new Array(r);for(let e=o.length-1;e>=0;e--)o[e]=255&t,t>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new i(o))},l.prototype._encodeBool=function e(t){return this._createEncoderBuffer(t?255:0)},l.prototype._use=function e(t,n){return"function"==typeof t&&(t=t(n)),t._getEncoder("der").tree},l.prototype._skipDefault=function e(t,n,r){const i=this._baseState;let o;if(null===i.default)return!1;const s=t.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,n,r).join()),s.length!==i.defaultBuffer.length)return!1;for(o=0;o=this._blockSize;){for(var o=this._blockOffset;o0;++a)this._length[a]+=u,u=this._length[a]/4294967296|0,u>0&&(this._length[a]-=4294967296*u);return this},a.prototype._update=function(){throw new Error("_update is not implemented")},a.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return t},a.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=a},function(e,t,n){"use strict";var r=n(0).Buffer,i=n(1),o=n(468),s=new Array(16),a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],u=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],l=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],c=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],f=[0,1518500249,1859775393,2400959708,2840853838],h=[1352829926,1548603684,1836072691,2053994217,0];function p(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function d(e,t){return e<>>32-t}function m(e,t,n,r,i,o,s,a){return d(e+(t^n^r)+o+s|0,a)+i|0}function g(e,t,n,r,i,o,s,a){return d(e+(t&n|~t&r)+o+s|0,a)+i|0}function y(e,t,n,r,i,o,s,a){return d(e+((t|~n)^r)+o+s|0,a)+i|0}function b(e,t,n,r,i,o,s,a){return d(e+(t&r|n&~r)+o+s|0,a)+i|0}function v(e,t,n,r,i,o,s,a){return d(e+(t^(n|~r))+o+s|0,a)+i|0}i(p,o),p.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,p=0|this._e,_=0|this._a,w=0|this._b,k=0|this._c,S=0|this._d,E=0|this._e,x=0;x<80;x+=1){var C,A;x<16?(C=m(n,r,i,o,p,e[a[x]],f[0],l[x]),A=v(_,w,k,S,E,e[u[x]],h[0],c[x])):x<32?(C=g(n,r,i,o,p,e[a[x]],f[1],l[x]),A=b(_,w,k,S,E,e[u[x]],h[1],c[x])):x<48?(C=y(n,r,i,o,p,e[a[x]],f[2],l[x]),A=y(_,w,k,S,E,e[u[x]],h[2],c[x])):x<64?(C=b(n,r,i,o,p,e[a[x]],f[3],l[x]),A=g(_,w,k,S,E,e[u[x]],h[3],c[x])):(C=v(n,r,i,o,p,e[a[x]],f[4],l[x]),A=m(_,w,k,S,E,e[u[x]],h[4],c[x])),n=p,p=o,o=d(i,10),i=r,r=C,_=E,E=S,S=d(k,10),k=w,w=A}var I=this._b+i+S|0;this._b=this._c+o+E|0,this._c=this._d+p+_|0,this._d=this._e+n+w|0,this._e=this._a+r+k|0,this._a=I},p.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=r.alloc?r.alloc(20):new r(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},e.exports=p},function(e,t,n){var t=e.exports=function e(n){n=n.toLowerCase();var r=t[n];if(!r)throw new Error(n+" is not supported (we accept pull requests)");return new r};t.sha=n(926),t.sha1=n(927),t.sha224=n(928),t.sha256=n(471),t.sha384=n(929),t.sha512=n(472)},function(e,t,n){var r=n(1),i=n(144),o=n(4).Buffer,s=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],a=new Array(64);function u(){this.init(),this._w=a,i.call(this,64,56)}function l(e,t,n){return n^e&(t^n)}function c(e,t,n){return e&t|n&(e|t)}function f(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function h(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function p(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function d(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}r(u,i),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,u=0|this._f,m=0|this._g,g=0|this._h,y=0;y<16;++y)t[y]=e.readInt32BE(4*y);for(;y<64;++y)t[y]=d(t[y-2])+t[y-7]+p(t[y-15])+t[y-16]|0;for(var b=0;b<64;++b){var v=g+h(a)+l(a,u,m)+s[b]+t[b]|0,_=f(n)+c(n,r,i)|0;g=m,m=u,u=a,a=o+v|0,o=i,i=r,r=n,n=v+_|0}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0,this._f=u+this._f|0,this._g=m+this._g|0,this._h=g+this._h|0},u.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=u},function(e,t,n){var r=n(1),i=n(144),o=n(4).Buffer,s=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],a=new Array(160);function u(){this.init(),this._w=a,i.call(this,128,112)}function l(e,t,n){return n^e&(t^n)}function c(e,t,n){return e&t|n&(e|t)}function f(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function h(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function p(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function d(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function m(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function g(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function y(e,t){return e>>>0>>0?1:0}r(u,i),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(e){for(var t=this._w,n=0|this._ah,r=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,u=0|this._fh,b=0|this._gh,v=0|this._hh,_=0|this._al,w=0|this._bl,k=0|this._cl,S=0|this._dl,E=0|this._el,x=0|this._fl,C=0|this._gl,A=0|this._hl,I=0;I<32;I+=2)t[I]=e.readInt32BE(4*I),t[I+1]=e.readInt32BE(4*I+4);for(;I<160;I+=2){var T=t[I-30],j=t[I-30+1],O=p(T,j),P=d(j,T);T=t[I-4],j=t[I-4+1];var B=m(T,j),R=g(j,T),N=t[I-14],M=t[I-14+1],L=t[I-32],F=t[I-32+1],D=P+M|0,U=O+N+y(D,P)|0;D=D+R|0,U=U+B+y(D,R)|0,D=D+F|0,U=U+L+y(D,F)|0,t[I]=U,t[I+1]=D}for(var z=0;z<160;z+=2){U=t[z],D=t[z+1];var q=c(n,r,i),K=c(_,w,k),H=f(n,_),V=f(_,n),W=h(a,E),$=h(E,a),G=s[z],Y=s[z+1],J=l(a,u,b),Z=l(E,x,C),X=A+$|0,Q=v+W+y(X,A)|0;X=X+Z|0,Q=Q+J+y(X,Z)|0,X=X+Y|0,Q=Q+G+y(X,Y)|0,X=X+D|0,Q=Q+U+y(X,D)|0;var ee=V+K|0,te=H+q+y(ee,V)|0;v=b,A=C,b=u,C=x,u=a,x=E,E=S+X|0,a=o+Q+y(E,S)|0,o=i,S=k,i=r,k=w,r=n,w=_,_=X+ee|0,n=Q+te+y(_,X)|0}this._al=this._al+_|0,this._bl=this._bl+w|0,this._cl=this._cl+k|0,this._dl=this._dl+S|0,this._el=this._el+E|0,this._fl=this._fl+x|0,this._gl=this._gl+C|0,this._hl=this._hl+A|0,this._ah=this._ah+n+y(this._al,_)|0,this._bh=this._bh+r+y(this._bl,w)|0,this._ch=this._ch+i+y(this._cl,k)|0,this._dh=this._dh+o+y(this._dl,S)|0,this._eh=this._eh+a+y(this._el,E)|0,this._fh=this._fh+u+y(this._fl,x)|0,this._gh=this._gh+b+y(this._gl,C)|0,this._hh=this._hh+v+y(this._hl,A)|0},u.prototype._hash=function(){var e=o.allocUnsafe(64);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},e.exports=u},function(e,t,n){"use strict";var r=n(4).Buffer,i=n(237),o=n(474);function s(e,t){null===e&&null===t?(this.x=this.y=null,this.inf=!0):(this.x=e,this.y=t,this.inf=!1)}s.fromPublicKey=function(e){var t=e[0],n,r;return 33!==e.length||2!==t&&3!==t?65!==e.length||4!==t&&6!==t&&7!==t?null:(n=i.fromBuffer(e.slice(1,33)),r=i.fromBuffer(e.slice(33,65)),n.ucmp(i.p)>=0||r.ucmp(i.p)>=0?null:6!==t&&7!==t||r.isOdd()===(7===t)?0!==n.redSqr().redMul(n).redIAdd7().ucmp(r.redSqr())?null:new s(n,r):null):(n=i.fromBuffer(e.slice(1,33)),n.ucmp(i.p)>=0?null:(r=n.redSqr().redMul(n).redIAdd7().redSqrt(),null===r?null:(3===t!==r.isOdd()&&(r=r.redNeg()),new s(n,r))))},s.prototype.toPublicKey=function(e){var t=this.x,n=this.y,i;return e?(i=r.alloc(33),i[0]=n.isOdd()?3:2,t.toBuffer().copy(i,1)):(i=r.alloc(65),i[0]=4,t.toBuffer().copy(i,1),n.toBuffer().copy(i,33)),i},s.fromECJPoint=function(e){if(e.inf)return new s(null,null);var t=e.z.redInvm(),n=t.redSqr(),r=e.x.redMul(n),i=e.y.redMul(n).redMul(t);return new s(r,i)},s.prototype.toECJPoint=function(){return this.inf?new o(null,null,null):new o(this.x,this.y,o.one)},s.prototype.neg=function(){return this.inf?this:new s(this.x,this.y.redNeg())},s.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(0===this.x.ucmp(e.x))return 0===this.y.ucmp(e.y)?this.dbl():new s(null,null);var t=this.y.redSub(e.y);t.isZero()||(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return new s(n,r)},s.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.isZero())return new s(null,null);var t=this.x.redSqr(),n=t.redAdd(t).redIAdd(t).redMul(e.redInvm()),r=n.redSqr().redISub(this.x.redAdd(this.x)),i=n.redMul(this.x.redSub(r)).redISub(this.y);return new s(r,i)},s.prototype.mul=function(e){for(var t=this._getNAFPoints(4),n=t.points,r=e.getNAF(t.wnd),i=new o(null,null,null),a=r.length-1;a>=0;a--){for(var u=0;a>=0&&0===r[a];a--,++u);if(a>=0&&(u+=1),i=i.dblp(u),a<0)break;var l=r[a];i=l>0?i.mixedAdd(n[l-1>>1]):i.mixedAdd(n[-l-1>>1].neg())}return s.fromECJPoint(i)},s.prototype._getNAFPoints1=function(){return{wnd:1,points:[this]}},s.prototype._getNAFPoints=function(e){var t=new Array((1<{r(i.subtle.sign({name:"HMAC"},t,n).then(t=>e.from(t)),o)};t.create=function(e,t,n){const u=s[e];r(i.subtle.importKey("raw",t,{name:"HMAC",hash:{name:u}},!1,["sign"]).then(t=>({digest(e,n){a(t,e,n)},length:o[e]})),n)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(24);function i(e){return r.isMultiaddr(e)?e:r(e)}e.exports={ensureMultiaddr:i}},function(e,t,n){var r={ECB:n(951),CBC:n(952),CFB:n(953),CFB8:n(954),CFB1:n(955),OFB:n(956),CTR:n(478),GCM:n(478)},i=n(480);for(var o in i)i[o].module=r[i[o].mode];e.exports=i},function(e,t,n){var r=n(179),i=n(4).Buffer,o=n(479);function s(e){var t=e._cipher.encryptBlockRaw(e._prev);return o(e._prev),t}var a=16;t.encrypt=function(e,t){var n=Math.ceil(t.length/16),o=e._cache.length;e._cache=i.concat([e._cache,i.allocUnsafe(16*n)]);for(var a=0;a0||o>0;){var c=new i;c.update(l),c.update(e),t&&c.update(t),l=c.digest();var f=0;if(s>0){var h=a.length-s;f=Math.min(s,l.length),l.copy(a,h,0,f),s-=f}if(f0){var p=u.length-o,d=Math.min(o,l.length-f);l.copy(u,p,f,f+d),o-=d}}return l.fill(0),{key:a,iv:u}}e.exports=o},function(e,t,n){"use strict";(function(t){const r=n(81),i=n(23),o=n(44);function s(e){let n;if("string"==typeof e)n=e;else if(t.isBuffer(e))n=r.encode(e).toString();else if(i.isPeerId(e))n=e.toB58String();else{if(!o.isPeerInfo(e))throw new Error("not valid PeerId or PeerInfo, or B58Str");n=e.id.toB58String()}return n}class a{constructor(){this._peers={}}has(e){const t=s(e);return Boolean(this._peers[t])}put(e,t){const n=this._peers[e.id.toB58String()];if(!n||t)return this._peers[e.id.toB58String()]=e,e;e.multiaddrs.forEach(e=>n.multiaddrs.add(e));const r=e.isConnected();return r&&n.connect(r),e.protocols.forEach(e=>n.protocols.add(e)),!n.id.privKey&&e.id.privKey&&(n.id.privKey=e.id.privKey),!n.id.pubKey&&e.id.pubKey&&(n.id.pubKey=e.id.pubKey),n}get(e){const t=s(e),n=this._peers[t];if(n)return n;throw new Error("PeerInfo not found")}getAll(){return this._peers}getAllArray(){return Object.keys(this._peers).map(e=>this._peers[e])}getMultiaddrs(e){const t=this.get(e);return t.multiaddrs.toArray()}remove(e){const t=s(e);this._peers[t]&&delete this._peers[t]}}e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){!function t(n,r){e.exports=r()}(this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function t(){return e.default}:function t(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=32)}([function(e,t,n){"use strict";(function(e,r){var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(17),s=n(15),a=n(37),u=n(16),l=n(18),c={};t.clone=function(n,r){if("object"!==(void 0===n?"undefined":i(n))||null===n)return n;r=r||new Map;var o=r.get(n);if(o)return o;var s=void 0,a=!1;if(Array.isArray(n))s=[],a=!0;else if(e.isBuffer(n))s=e.from(n);else if(n instanceof Date)s=new Date(n.getTime());else if(n instanceof RegExp)s=new RegExp(n);else{var u=Object.getPrototypeOf(n);u&&u.isImmutable?s=n:(s=Object.create(u),a=!0)}if(r.set(n,s),a)for(var l=Object.getOwnPropertyNames(n),c=0;c1||!r.part&&!f[C])return!1;return(!r.only||!c)&&x},t.flatten=function(e,n){for(var r=n||[],i=0;i1?n-1:0),i=1;i\?@\[\]\^`\{\|\}~\"\\]*$/.test(e),"Bad attribute value ("+e+")"),e.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')},t.escapeHtml=function(e){return l.escapeHtml(e)},t.escapeJavaScript=function(e){return l.escapeJavaScript(e)},t.escapeJson=function(e){return l.escapeJson(e)},t.once=function(e){if(e._hoekOnce)return e;var t=!1,n=function n(){if(!t){t=!0;for(var r=arguments.length,i=Array(r),o=0;o1;)d=h.shift(),m[d]||(m[d]={}),m=m[d];d=h.shift(),m[d]=t.reach(e,p,r)}return u},t.uniqueFilename=function(e,t){t=t?"."!==t[0]?"."+t:t:"",e=a.resolve(e);var n=[Date.now(),r.pid,s.randomBytes(8).toString("hex")].join("-")+t;return a.join(e,n)},t.stringify=function(){try{for(var e=arguments.length,t=Array(e),n=0;n4&&void 0!==arguments[4]?arguments[4]:this._flags;return l.create(t,n,r,i,o)},e.prototype.createOverrideError=function e(t,n,r,i,o,s){return l.create(t,n,r,i,this._flags,o,s)},e.prototype.checkOptions=function e(t){var r=n(21),i=r.options.validate(t);if(i.error)throw new Error(i.error.details[0].message)},e.prototype.clone=function e(){var t=Object.create(Object.getPrototypeOf(this));t.isJoi=!0,t._currentJoi=this._currentJoi,t._type=this._type,t._settings=this._settings,t._baseType=this._baseType,t._valids=this._valids.slice(),t._invalids=this._invalids.slice(),t._tests=this._tests.slice(),t._refs=this._refs.slice(),t._flags=s.clone(this._flags),t._description=this._description,t._unit=this._unit,t._notes=this._notes.slice(),t._tags=this._tags.slice(),t._examples=this._examples.slice(),t._meta=this._meta.slice(),t._inner={};for(var n=Object.keys(this._inner),r=0;r=0?d[m[b]]={key:b,schema:d[m[b]].schema.concat(p[y].schema)}:d.push(p[y])}}else n._inner[f]=n._inner[f].concat(p);else n._inner[f]=p.slice()}}return n},e.prototype._test=function e(t,n,r,i){var o=this.clone();return o._tests.push({func:r,name:t,arg:n,options:i}),o},e.prototype.options=function e(t){s.assert(!t.context,"Cannot override context"),this.checkOptions(t);var n=this.clone();return n._settings=a.concat(n._settings,t),n},e.prototype.strict=function e(t){var n=this.clone(),r=void 0!==t&&!t;return n._settings=a.concat(n._settings,{convert:r}),n},e.prototype.raw=function e(t){var n=void 0===t||t;if(this._flags.raw===n)return this;var r=this.clone();return r._flags.raw=n,r},e.prototype.error=function e(t){s.assert(t&&(t instanceof Error||"function"==typeof t),"Must provide a valid Error object or a function");var n=this.clone();return n._flags.error=t,n},e.prototype.allow=function e(){for(var t=arguments.length,n=Array(t),r=0;r0,"description must be provided when default value is a function"));var r=this.clone();return r._flags.default=t,u.push(r._refs,t),r},e.prototype.empty=function e(t){var n=this.clone();return void 0===t?delete n._flags.empty:n._flags.empty=f.schema(this._currentJoi,t),n},e.prototype.when=function e(t,i){s.assert(i&&"object"===(void 0===i?"undefined":r(i)),"Invalid options"),s.assert(void 0!==i.then||void 0!==i.otherwise,'options must have at least one of "then" or "otherwise"');var o=i.hasOwnProperty("then")?this.concat(f.schema(this._currentJoi,i.then)):void 0,a=i.hasOwnProperty("otherwise")?this.concat(f.schema(this._currentJoi,i.otherwise)):void 0;c=c||n(10);var u={then:o,otherwise:a};Object.prototype.hasOwnProperty.call(i,"is")&&(u.is=i.is);var l=c.when(t,u);return l._flags.presence="ignore",l._baseType=this,l},e.prototype.description=function e(t){s.assert(t&&"string"==typeof t,"Description must be a non-empty string");var n=this.clone();return n._description=t,n},e.prototype.notes=function e(t){s.assert(t&&("string"==typeof t||Array.isArray(t)),"Notes must be a non-empty string or array");var n=this.clone();return n._notes=n._notes.concat(t),n},e.prototype.tags=function e(t){s.assert(t&&("string"==typeof t||Array.isArray(t)),"Tags must be a non-empty string or array");var n=this.clone();return n._tags=n._tags.concat(t),n},e.prototype.meta=function e(t){s.assert(void 0!==t,"Meta cannot be undefined");var n=this.clone();return n._meta=n._meta.concat(t),n},e.prototype.example=function e(){s.assert(1===arguments.length,"Missing example");var t=arguments.length<=0?void 0:arguments[0],n=this.clone();return n._examples.push(t),n},e.prototype.unit=function e(t){s.assert(t&&"string"==typeof t,"Unit name must be a non-empty string");var n=this.clone();return n._unit=t,n},e.prototype._prepareEmptyValue=function e(t){return"string"==typeof t&&this._flags.trim?t.trim():t},e.prototype._validate=function e(t,n,r,i){var o=this,c=t;n=n||{key:"",path:[],parent:null,reference:i},this._settings&&(r=a.concat(r,this._settings));var f=[],p=function e(){var i=void 0;if(void 0!==t)i=o._flags.raw?c:t;else if(r.noDefaults)i=t;else if(u.isRef(o._flags.default))i=o._flags.default(n.parent,r);else if("function"!=typeof o._flags.default||o._flags.func&&!o._flags.default.description)i=s.clone(o._flags.default);else{var a=void 0;null!==n.parent&&o._flags.default.length>0&&(a=[s.clone(n.parent),r]);var l=h._try(o._flags.default,a);i=l.value,l.error&&f.push(o.createError("any.default",{error:l.error},n,r))}if(f.length&&"function"==typeof o._flags.error){var p=o._flags.error.call(o,f);f="string"==typeof p?[o.createOverrideError("override",{reason:f},n,r,p)]:[].concat(p).map(function(e){return e instanceof Error?e:o.createOverrideError(e.type||"override",e.context,n,r,e.message,e.template)})}return{value:o._flags.strip?void 0:i,finalValue:i,errors:f.length?f:null}};if(this._coerce){var d=this._coerce.call(this,t,n,r);if(d.errors)return t=d.value,f=f.concat(d.errors),p();t=d.value}this._flags.empty&&!this._flags.empty._validate(this._prepareEmptyValue(t),null,h.defaults).errors&&(t=void 0);var m=this._flags.presence||r.presence;if("optional"===m){if(void 0===t){var g=this._flags.hasOwnProperty("default")&&void 0===this._flags.default;if(!g||"object"!==this._type)return p();t={}}}else{if("required"===m&&void 0===t)return f.push(this.createError("any.required",null,n,r)),p();if("forbidden"===m)return void 0===t?p():(f.push(this.createError("any.unknown",null,n,r)),p())}if(this._valids.has(t,n,r,this._flags.insensitive))return p();if(this._invalids.has(t,n,r,this._flags.insensitive)&&(f.push(this.createError(""===t?"any.empty":"any.invalid",{value:t,invalids:this._invalids.values({stripUndefined:!0})},n,r)),r.abortEarly||void 0===t))return p();if(this._base){var y=this._base.call(this,t,n,r);if(y.errors)return t=y.value,f=f.concat(y.errors),p();if(y.value!==t){if(t=y.value,this._valids.has(t,n,r,this._flags.insensitive))return p();if(this._invalids.has(t,n,r,this._flags.insensitive)&&(f.push(this.createError(""===t?"any.empty":"any.invalid",{value:t,invalids:this._invalids.values({stripUndefined:!0})},n,r)),r.abortEarly))return p()}}if(this._flags.allowOnly&&(f.push(this.createError("any.allowOnly",{value:t,valids:this._valids.values({stripUndefined:!0})},n,r)),r.abortEarly))return p();for(var b=0;b * @license MIT */ -var n=r(33),i=r(34),o=r(35);function s(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}function a(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function v(e){return+e!=e&&(e=0),c.alloc(+e)}function _(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Q(e).length;default:if(n)return J(e).length;t=(""+t).toLowerCase(),n=!0}}function w(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,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return j(this,t,r);case"utf8":case"utf-8":return B(this,t,r);case"ascii":return N(this,t,r);case"latin1":case"binary":return L(this,t,r);case"base64":return R(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function S(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function E(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:k(e,t,r,n,i);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):k(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function k(e,t,r,n,i){var o=1,s=e.length,a=t.length,u;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,s/=2,a/=2,r/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var f=-1;for(u=r;us&&(r=s-a),u=r;u>=0;u--){for(var h=!0,l=0;li&&(n=i)):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s239?4:o>223?3:o>191?2:1,u,c,f,h;if(i+a<=r)switch(a){case 1:o<128&&(s=o);break;case 2:u=e[i+1],128==(192&u)&&(h=(31&o)<<6|63&u,h>127&&(s=h));break;case 3:u=e[i+1],c=e[i+2],128==(192&u)&&128==(192&c)&&(h=(15&o)<<12|(63&u)<<6|63&c,h>2047&&(h<55296||h>57343)&&(s=h));break;case 4:u=e[i+1],c=e[i+2],f=e[i+3],128==(192&u)&&128==(192&c)&&128==(192&f)&&(h=(15&o)<<18|(63&u)<<12|(63&c)<<6|63&f,h>65535&&h<1114112&&(s=h))}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return M(n)}t.Buffer=c,t.SlowBuffer=v,t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:s(),t.kMaxLength=a(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,r){return f(null,e,t,r)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,r){return l(null,e,t,r)},c.allocUnsafe=function(e){return d(null,e)},c.allocUnsafeSlow=function(e){return d(null,e)},c.isBuffer=function e(t){return!(null==t||!t._isBuffer)},c.compare=function e(t,r){if(!c.isBuffer(t)||!c.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var n=t.length,i=r.length,o=0,s=Math.min(n,i);o0&&(r=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(r+=" ... ")),""},c.prototype.compare=function e(t,r,n,i,o){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),r<0||n>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var s=o-i,a=n-r,u=Math.min(s,a),f=this.slice(i,o),h=t.slice(r,n),l=0;lo)&&(n=o),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return x(this,t,r,n);case"utf8":case"utf-8":return C(this,t,r,n);case"ascii":return A(this,t,r,n);case"latin1":case"binary":return I(this,t,r,n);case"base64":return T(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},c.prototype.toJSON=function e(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var P=4096;function M(e){var t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,r,n,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function q(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i>>8*(n?i:1-i)}function z(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i>>8*(n?i:3-i)&255}function H(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function K(e,t,r,n,o){return o||H(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),i.write(e,t,r,n,23,4),r+4}function W(e,t,r,n,o){return o||H(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function e(t,r){var n=this.length,i;if(t=~~t,r=void 0===r?n:~~r,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r0&&(o*=256);)i+=this[t+--r]*o;return i},c.prototype.readUInt8=function e(t,r){return r||F(t,1,this.length),this[t]},c.prototype.readUInt16LE=function e(t,r){return r||F(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function e(t,r){return r||F(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function e(t,r){return r||F(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUInt32BE=function e(t,r){return r||F(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function e(t,r,n){t|=0,r|=0,n||F(t,r,this.length);for(var i=this[t],o=1,s=0;++s=o&&(i-=Math.pow(2,8*r)),i},c.prototype.readIntBE=function e(t,r,n){t|=0,r|=0,n||F(t,r,this.length);for(var i=r,o=1,s=this[t+--i];i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*r)),s},c.prototype.readInt8=function e(t,r){return r||F(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function e(t,r){r||F(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function e(t,r){r||F(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function e(t,r){return r||F(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function e(t,r){return r||F(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function e(t,r){return r||F(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function e(t,r){return r||F(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function e(t,r){return r||F(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function e(t,r){return r||F(t,8,this.length),i.read(this,t,!1,52,8)},c.prototype.writeUIntLE=function e(t,r,n,i){if(t=+t,r|=0,n|=0,!i){var o=Math.pow(2,8*n)-1;U(this,t,r,n,o,0)}var s=1,a=0;for(this[r]=255&t;++a=0&&(a*=256);)this[r+s]=t/a&255;return r+n},c.prototype.writeUInt8=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,1,255,0),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},c.prototype.writeUInt16LE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):q(this,t,r,!0),r+2},c.prototype.writeUInt16BE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):q(this,t,r,!1),r+2},c.prototype.writeUInt32LE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):z(this,t,r,!0),r+4},c.prototype.writeUInt32BE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):z(this,t,r,!1),r+4},c.prototype.writeIntLE=function e(t,r,n,i){if(t=+t,r|=0,!i){var o=Math.pow(2,8*n-1);U(this,t,r,n,o-1,-o)}var s=0,a=1,u=0;for(this[r]=255&t;++s>0)-u&255;return r+n},c.prototype.writeIntBE=function e(t,r,n,i){if(t=+t,r|=0,!i){var o=Math.pow(2,8*n-1);U(this,t,r,n,o-1,-o)}var s=n-1,a=1,u=0;for(this[r+s]=255&t;--s>=0&&(a*=256);)t<0&&0===u&&0!==this[r+s+1]&&(u=1),this[r+s]=(t/a>>0)-u&255;return r+n},c.prototype.writeInt8=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,1,127,-128),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},c.prototype.writeInt16LE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):q(this,t,r,!0),r+2},c.prototype.writeInt16BE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):q(this,t,r,!1),r+2},c.prototype.writeInt32LE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):z(this,t,r,!0),r+4},c.prototype.writeInt32BE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),c.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):z(this,t,r,!1),r+4},c.prototype.writeFloatLE=function e(t,r,n){return K(this,t,r,!0,n)},c.prototype.writeFloatBE=function e(t,r,n){return K(this,t,r,!1,n)},c.prototype.writeDoubleLE=function e(t,r,n){return W(this,t,r,!0,n)},c.prototype.writeDoubleBE=function e(t,r,n){return W(this,t,r,!1,n)},c.prototype.copy=function e(t,r,n,i){if(n||(n=0),i||0===i||(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r=0;--s)t[s+r]=this[s+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(s=0;s>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=r;s55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.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;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function X(e){for(var t=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function Q(e){return n.toByteArray(G(e))}function ee(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function te(e){return e!=e}}).call(t,r(5))},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(0),o=r(1);t.schema=function(e,t){return void 0!==t&&null!==t&&"object"===(void 0===t?"undefined":n(t))?t.isJoi?t:Array.isArray(t)?e.alternatives().try(t):t instanceof RegExp?e.string().regex(t):t instanceof Date?e.date().valid(t):e.object().keys(t):"string"==typeof t?e.string().valid(t):"number"==typeof t?e.number().valid(t):"boolean"==typeof t?e.boolean().valid(t):o.isRef(t)?e.valid(t):(i.assert(null===t,"Invalid schema content:",t),e.valid(null))},t.ref=function(e){return o.isRef(e)?e:o.create(e)}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=r(0),s=r(20),a={annotations:Symbol("joi-annotations"),stringify:function(e,r){var i=void 0===e?"undefined":n(e);if(null===e)return"null";if("string"===i)return e;if(e instanceof t.Err||"function"===i||"symbol"===i)return e.toString();if("object"===i){if(Array.isArray(e)){for(var o="",s=0;s2&&"!"===r[0]&&"!"===r[1];if(f&&(r=r.slice(2)),!c&&!f){var h=o.reach(n,"key");r="string"==typeof h?h+r:o.reach(s.errors,"key")+r}return r.replace(/\{\{(\!?)([^}]+)\}\}/g,function(e,r,n){var s=o.reach(t.context,n),u=a.stringify(s,i);return r&&t.options.escapeHtml?o.escapeHtml(u):u})},e}(),t.create=function(e,r,n,i,o,s,a){return new t.Err(e,r,n,i,o,s,a)},t.process=function(e,t){if(!e||!e.length)return null;var r="",n=[],i=function e(t,i){for(var o=0;o0){var s=t.indexOf(this);~s?(t.length=s+1,e.length=s+1,e[s]=i):(t.push(this),e.push(i)),~t.indexOf(o)&&(o=r.call(this,i,o))}else t.push(o);if(o){var u=o[a.annotations];if(u){if(Array.isArray(o)){for(var c=[],f=0;f=0;--u)for(var c=u+1,f=this.details[u],h=f.path,l=s,d=0;;++d){var p=h[d];if(l.isImmutable&&(l=l.clone()),!(d+11)for(var r=1;r0,"You need to provide at least one extension"),this.assert(p,t.extensionsSchema);var y=Object.create(this.any());n(y,this);for(var v=function r(i){var c=p[i];"function"==typeof c&&(c=c(y)),e.assert(c,t.extensionSchema);var v=(c.base||e.any()).clone(),_=v.constructor,w=function(e){function t(){s(this,t);var r=a(this,e.call(this));return c.base&&n(r,v),r._type=c.name,c.language&&(r._settings=m.concat(r._settings,{language:o({},c.name,c.language)})),r}return u(t,e),t}(_);if(c.coerce&&(w.prototype._coerce=function(e,t,r){if(_.prototype._coerce){var n=_.prototype._coerce.call(this,e,t,r);if(n.errors)return n;e=n.value}var i=c.coerce.call(this,e,t,r);return i instanceof d.Err?{value:e,errors:i}:{value:i}}),c.pre&&(w.prototype._base=function(e,t,r){if(_.prototype._base){var n=_.prototype._base.call(this,e,t,r);if(n.errors)return n;e=n.value}var i=c.pre.call(this,e,t,r);return i instanceof d.Err?{value:e,errors:i}:{value:i}}),c.rules)for(var S=function t(r){var n=c.rules[r],i=n.params?n.params instanceof h?n.params._inner.children.map(function(e){return e.key}):Object.keys(n.params):[],o=n.params?l.schema(e,n.params):null;w.prototype[n.name]=function(){for(var e=arguments.length,t=Array(e),r=0;ri.length)throw new Error("Unexpected number of arguments");for(var s=!1,a={},u=0;u0&&void 0!==arguments[0]?arguments[0]:"javascript",r=["javascript","unix"];if(c.assert(r.includes(t),'"type" must be one of "'+r.join('", "')+'"'),this._flags.timestamp===t)return this;var n=this.clone();return n._flags.timestamp=t,n._flags.multiplier="unix"===t?1e3:1,n},t.prototype._isIsoDate=function e(t){return f.isoDate.test(t)},t}(a),f.compare=function(e,t){return function(r){var n="now"===r,i=u.isRef(r);return n||i||(r=f.Date.toDate(r)),c.assert(r,"Invalid date format"),this._test(e,r,function(o,s,a){var u=void 0;if(n)u=Date.now();else if(i){if(u=f.Date.toDate(r(s.reference||s.parent,a)),!u)return this.createError("date.ref",{ref:r.key},s,a);u=u.getTime()}else u=r.getTime();return t(o.getTime(),u)?o:this.createError("date."+e,{limit:new Date(u)},s,a)})}},f.Date.prototype.min=f.compare("min",function(e,t){return e>=t}),f.Date.prototype.max=f.compare("max",function(e,t){return e<=t}),f.Date.prototype.greater=f.compare("greater",function(e,t){return e>t}),f.Date.prototype.less=f.compare("less",function(e,t){return e=0,"limit must be a positive integer"),this._test("length",t,function(e,r,n){return Object.keys(e).length===t?e:this.createError("object.length",{limit:t},r,n)})},t.prototype.min=function e(t){return u.assert(Number.isSafeInteger(t)&&t>=0,"limit must be a positive integer"),this._test("min",t,function(e,r,n){return Object.keys(e).length>=t?e:this.createError("object.min",{limit:t},r,n)})},t.prototype.max=function e(t){return u.assert(Number.isSafeInteger(t)&&t>=0,"limit must be a positive integer"),this._test("max",t,function(e,r,n){return Object.keys(e).length<=t?e:this.createError("object.max",{limit:t},r,n)})},t.prototype.pattern=function e(t,r){var n=t instanceof RegExp;u.assert(n||t instanceof f,"pattern must be a regex or schema"),u.assert(void 0!==r,"Invalid rule"),n&&(t=new RegExp(t.source,t.ignoreCase?"i":void 0));try{r=l.schema(this._currentJoi,r)}catch(e){throw e.hasOwnProperty("path")&&(e.message=e.message+"("+e.path+")"),e}var i=this.clone();return n?i._inner.patterns.push({regex:t,rule:r}):i._inner.patterns.push({schema:t,rule:r}),i},t.prototype.schema=function e(){return this._test("schema",null,function(e,t,r){return e instanceof f?e:this.createError("object.schema",null,t,r)})},t.prototype.with=function e(t,r){return u.assert(2===arguments.length,"Invalid number of arguments, expected 2."),this._dependency("with",t,r)},t.prototype.without=function e(t,r){return u.assert(2===arguments.length,"Invalid number of arguments, expected 2."),this._dependency("without",t,r)},t.prototype.xor=function e(){for(var t=arguments.length,r=Array(t),n=0;n0,"expected at least one children");var o=d.groupChildren(t),s=void 0;if(""in o?(s=this[r].apply(this,n),delete o[""]):s=this.clone(),s._inner.children){i=i?i+".":"";for(var a=0;a0&&(r.renames=u.clone(this._inner.renames)),r},t.prototype.assert=function e(t,r,n){t=l.ref(t),u.assert(t.isContext||t.depth>1,"Cannot use assertions for root level references - use direct key rules instead"),n=n||"pass the assertion test";try{r=l.schema(this._currentJoi,r)}catch(e){throw e.hasOwnProperty("path")&&(e.message=e.message+"("+e.path+")"),e}var i=t.path[t.path.length-1],o=t.path.join(".");return this._test("assert",{schema:r,ref:t},function(e,s,a){var c=r._validate(t(e),null,a,e);if(!c.errors)return e;var f=u.merge({},s);return f.key=i,f.path=t.path,this.createError("object.assert",{ref:o,message:n},f,a)})},t.prototype.type=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.name;u.assert("function"==typeof t,"type must be a constructor function");var n={name:r,ctor:t};return this._test("type",n,function(e,r,i){return e instanceof t?e:this.createError("object.type",{type:n.name},r,i)})},t}(f),d.safeParse=function(e){try{return JSON.parse(e)}catch(e){}return e},d.renameDefaults={alias:!1,multiple:!1,override:!1},d.groupChildren=function(e){e.sort();for(var t={},r=0;r=o)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),u=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),y(r)?n.showHidden=r:r&&t._extend(n,r),k(n.showHidden)&&(n.showHidden=!1),k(n.depth)&&(n.depth=2),k(n.colors)&&(n.colors=!1),k(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),h(n,e,n.depth)}function u(e,t){var r=a.styles[t];return r?"["+a.colors[r][0]+"m"+e+"["+a.colors[r][1]+"m":e}function c(e,t){return e}function f(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}function h(e,r,n){if(e.customInspect&&r&&T(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return S(i)||(i=h(e,i,n)),i}var o=l(e,r);if(o)return o;var s=Object.keys(r),a=f(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),I(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return d(r);if(0===s.length){if(T(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(x(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(A(r))return e.stylize(Date.prototype.toString.call(r),"date");if(I(r))return d(r)}var c="",y=!1,v=["{","}"],_;if(b(r)&&(y=!0,v=["[","]"]),T(r)){var w=r.name?": "+r.name:"";c=" [Function"+w+"]"}return x(r)&&(c=" "+RegExp.prototype.toString.call(r)),A(r)&&(c=" "+Date.prototype.toUTCString.call(r)),I(r)&&(c=" "+d(r)),0!==s.length||y&&0!=r.length?n<0?x(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),_=y?p(e,r,n,a,s):s.map(function(t){return g(e,r,n,a,t,y)}),e.seen.pop(),m(_,c,v)):v[0]+c+v[1]}function l(e,t){if(k(t))return e.stylize("undefined","undefined");if(S(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return w(t)?e.stylize(""+t,"number"):y(t)?e.stylize(""+t,"boolean"):v(t)?e.stylize("null","null"):void 0}function d(e){return"["+Error.prototype.toString.call(e)+"]"}function p(e,t,r,n,i){for(var o=[],s=0,a=t.length;s-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n"))):a=e.stylize("[Circular]","special")),k(s)){if(o&&i.match(/^\d+$/))return a;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function m(e,t,r){var n=0,i=e.reduce(function(e,t){return n++,t.indexOf("\n")>=0&&n++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function b(e){return Array.isArray(e)}function y(e){return"boolean"==typeof e}function v(e){return null===e}function _(e){return null==e}function w(e){return"number"==typeof e}function S(e){return"string"==typeof e}function E(e){return"symbol"==typeof e}function k(e){return void 0===e}function x(e){return C(e)&&"[object RegExp]"===R(e)}function C(e){return"object"==typeof e&&null!==e}function A(e){return C(e)&&"[object Date]"===R(e)}function I(e){return C(e)&&("[object Error]"===R(e)||e instanceof Error)}function T(e){return"function"==typeof e}function O(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function R(e){return Object.prototype.toString.call(e)}function B(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(k(s)&&(s=n.env.NODE_DEBUG||""),e=e.toUpperCase(),!o[e])if(new RegExp("\\b"+e+"\\b","i").test(s)){var r=n.pid;o[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else o[e]=function(){};return o[e]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=b,t.isBoolean=y,t.isNull=v,t.isNullOrUndefined=_,t.isNumber=w,t.isString=S,t.isSymbol=E,t.isUndefined=k,t.isRegExp=x,t.isObject=C,t.isDate=A,t.isError=I,t.isFunction=T,t.isPrimitive=O,t.isBuffer=r(40);var P=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function M(){var e=new Date,t=[B(e.getHours()),B(e.getMinutes()),B(e.getSeconds())].join(":");return[e.getDate(),P[e.getMonth()],t].join(" ")}function N(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",M(),t.format.apply(t,arguments))},t.inherits=r(39),t._extend=function(e,t){if(!t||!C(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}}).call(t,r(5),r(7))},function(e,t,r){"use strict";(function(t){ +var r=n(33),i=n(34),o=n(35);function s(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}function a(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function v(e){return+e!=e&&(e=0),l.alloc(+e)}function _(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Q(e).length;default:if(r)return J(e).length;t=(""+t).toLowerCase(),r=!0}}function w(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return L(this,t,n);case"utf8":case"utf-8":return P(this,t,n);case"ascii":return N(this,t,n);case"latin1":case"binary":return M(this,t,n);case"base64":return O(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function k(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function S(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:E(e,t,n,r,i);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):E(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function E(e,t,n,r,i){var o=1,s=e.length,a=t.length,u;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,a/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(u=n;us&&(n=s-a),u=n;u>=0;u--){for(var f=!0,h=0;hi&&(r=i)):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s239?4:o>223?3:o>191?2:1,u,l,c,f;if(i+a<=n)switch(a){case 1:o<128&&(s=o);break;case 2:u=e[i+1],128==(192&u)&&(f=(31&o)<<6|63&u,f>127&&(s=f));break;case 3:u=e[i+1],l=e[i+2],128==(192&u)&&128==(192&l)&&(f=(15&o)<<12|(63&u)<<6|63&l,f>2047&&(f<55296||f>57343)&&(s=f));break;case 4:u=e[i+1],l=e[i+2],c=e[i+3],128==(192&u)&&128==(192&l)&&128==(192&c)&&(f=(15&o)<<18|(63&u)<<12|(63&l)<<6|63&c,f>65535&&f<1114112&&(s=f))}null===s?(s=65533,a=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s),i+=a}return R(r)}t.Buffer=l,t.SlowBuffer=v,t.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:s(),t.kMaxLength=a(),l.poolSize=8192,l._augment=function(e){return e.__proto__=l.prototype,e},l.from=function(e,t,n){return c(null,e,t,n)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(e,t,n){return h(null,e,t,n)},l.allocUnsafe=function(e){return p(null,e)},l.allocUnsafeSlow=function(e){return p(null,e)},l.isBuffer=function e(t){return!(null==t||!t._isBuffer)},l.compare=function e(t,n){if(!l.isBuffer(t)||!l.isBuffer(n))throw new TypeError("Arguments must be Buffers");if(t===n)return 0;for(var r=t.length,i=n.length,o=0,s=Math.min(r,i);o0&&(n=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(n+=" ... ")),""},l.prototype.compare=function e(t,n,r,i,o){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===n&&(n=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),n<0||r>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&n>=r)return 0;if(i>=o)return-1;if(n>=r)return 1;if(n>>>=0,r>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var s=o-i,a=r-n,u=Math.min(s,a),c=this.slice(i,o),f=t.slice(n,r),h=0;ho)&&(r=o),t.length>0&&(r<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return x(this,t,n,r);case"utf8":case"utf-8":return C(this,t,n,r);case"ascii":return A(this,t,n,r);case"latin1":case"binary":return I(this,t,n,r);case"base64":return T(this,t,n,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,t,n,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},l.prototype.toJSON=function e(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var B=4096;function R(e){var t=e.length;if(t<=B)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,n,r,i,o){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function z(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function q(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function K(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function H(e,t,n,r,o){return o||K(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),i.write(e,t,n,r,23,4),n+4}function V(e,t,n,r,o){return o||K(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),i.write(e,t,n,r,52,8),n+8}l.prototype.slice=function e(t,n){var r=this.length,i;if(t=~~t,n=void 0===n?r:~~n,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),n<0?(n+=r,n<0&&(n=0)):n>r&&(n=r),n0&&(o*=256);)i+=this[t+--n]*o;return i},l.prototype.readUInt8=function e(t,n){return n||D(t,1,this.length),this[t]},l.prototype.readUInt16LE=function e(t,n){return n||D(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUInt16BE=function e(t,n){return n||D(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUInt32LE=function e(t,n){return n||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUInt32BE=function e(t,n){return n||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readIntLE=function e(t,n,r){t|=0,n|=0,r||D(t,n,this.length);for(var i=this[t],o=1,s=0;++s=o&&(i-=Math.pow(2,8*n)),i},l.prototype.readIntBE=function e(t,n,r){t|=0,n|=0,r||D(t,n,this.length);for(var i=n,o=1,s=this[t+--i];i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*n)),s},l.prototype.readInt8=function e(t,n){return n||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function e(t,n){n||D(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function e(t,n){n||D(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function e(t,n){return n||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function e(t,n){return n||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readFloatLE=function e(t,n){return n||D(t,4,this.length),i.read(this,t,!0,23,4)},l.prototype.readFloatBE=function e(t,n){return n||D(t,4,this.length),i.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function e(t,n){return n||D(t,8,this.length),i.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function e(t,n){return n||D(t,8,this.length),i.read(this,t,!1,52,8)},l.prototype.writeUIntLE=function e(t,n,r,i){if(t=+t,n|=0,r|=0,!i){var o=Math.pow(2,8*r)-1;U(this,t,n,r,o,0)}var s=1,a=0;for(this[n]=255&t;++a=0&&(a*=256);)this[n+s]=t/a&255;return n+r},l.prototype.writeUInt8=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,1,255,0),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[n]=255&t,n+1},l.prototype.writeUInt16LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[n]=255&t,this[n+1]=t>>>8):z(this,t,n,!0),n+2},l.prototype.writeUInt16BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[n]=t>>>8,this[n+1]=255&t):z(this,t,n,!1),n+2},l.prototype.writeUInt32LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[n+3]=t>>>24,this[n+2]=t>>>16,this[n+1]=t>>>8,this[n]=255&t):q(this,t,n,!0),n+4},l.prototype.writeUInt32BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=255&t):q(this,t,n,!1),n+4},l.prototype.writeIntLE=function e(t,n,r,i){if(t=+t,n|=0,!i){var o=Math.pow(2,8*r-1);U(this,t,n,r,o-1,-o)}var s=0,a=1,u=0;for(this[n]=255&t;++s>0)-u&255;return n+r},l.prototype.writeIntBE=function e(t,n,r,i){if(t=+t,n|=0,!i){var o=Math.pow(2,8*r-1);U(this,t,n,r,o-1,-o)}var s=r-1,a=1,u=0;for(this[n+s]=255&t;--s>=0&&(a*=256);)t<0&&0===u&&0!==this[n+s+1]&&(u=1),this[n+s]=(t/a>>0)-u&255;return n+r},l.prototype.writeInt8=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,1,127,-128),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[n]=255&t,n+1},l.prototype.writeInt16LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[n]=255&t,this[n+1]=t>>>8):z(this,t,n,!0),n+2},l.prototype.writeInt16BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[n]=t>>>8,this[n+1]=255&t):z(this,t,n,!1),n+2},l.prototype.writeInt32LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[n]=255&t,this[n+1]=t>>>8,this[n+2]=t>>>16,this[n+3]=t>>>24):q(this,t,n,!0),n+4},l.prototype.writeInt32BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),l.TYPED_ARRAY_SUPPORT?(this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=255&t):q(this,t,n,!1),n+4},l.prototype.writeFloatLE=function e(t,n,r){return H(this,t,n,!0,r)},l.prototype.writeFloatBE=function e(t,n,r){return H(this,t,n,!1,r)},l.prototype.writeDoubleLE=function e(t,n,r){return V(this,t,n,!0,r)},l.prototype.writeDoubleBE=function e(t,n,r){return V(this,t,n,!1,r)},l.prototype.copy=function e(t,n,r,i){if(r||(r=0),i||0===i||(i=this.length),n>=t.length&&(n=t.length),n||(n=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-n=0;--s)t[s+n]=this[s+r];else if(o<1e3||!l.TYPED_ARRAY_SUPPORT)for(s=0;s>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(s=n;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Z(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function Q(e){return r.toByteArray($(e))}function ee(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function te(e){return e!=e}}).call(t,n(5))},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=n(0),o=n(1);t.schema=function(e,t){return void 0!==t&&null!==t&&"object"===(void 0===t?"undefined":r(t))?t.isJoi?t:Array.isArray(t)?e.alternatives().try(t):t instanceof RegExp?e.string().regex(t):t instanceof Date?e.date().valid(t):e.object().keys(t):"string"==typeof t?e.string().valid(t):"number"==typeof t?e.number().valid(t):"boolean"==typeof t?e.boolean().valid(t):o.isRef(t)?e.valid(t):(i.assert(null===t,"Invalid schema content:",t),e.valid(null))},t.ref=function(e){return o.isRef(e)?e:o.create(e)}},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=n(0),s=n(20),a={annotations:Symbol("joi-annotations"),stringify:function(e,n){var i=void 0===e?"undefined":r(e);if(null===e)return"null";if("string"===i)return e;if(e instanceof t.Err||"function"===i||"symbol"===i)return e.toString();if("object"===i){if(Array.isArray(e)){for(var o="",s=0;s2&&"!"===n[0]&&"!"===n[1];if(c&&(n=n.slice(2)),!l&&!c){var f=o.reach(r,"key");n="string"==typeof f?f+n:o.reach(s.errors,"key")+n}return n.replace(/\{\{(\!?)([^}]+)\}\}/g,function(e,n,r){var s=o.reach(t.context,r),u=a.stringify(s,i);return n&&t.options.escapeHtml?o.escapeHtml(u):u})},e}(),t.create=function(e,n,r,i,o,s,a){return new t.Err(e,n,r,i,o,s,a)},t.process=function(e,t){if(!e||!e.length)return null;var n="",r=[],i=function e(t,i){for(var o=0;o0){var s=t.indexOf(this);~s?(t.length=s+1,e.length=s+1,e[s]=i):(t.push(this),e.push(i)),~t.indexOf(o)&&(o=n.call(this,i,o))}else t.push(o);if(o){var u=o[a.annotations];if(u){if(Array.isArray(o)){for(var l=[],c=0;c=0;--u)for(var l=u+1,c=this.details[u],f=c.path,h=s,p=0;;++p){var d=f[p];if(h.isImmutable&&(h=h.clone()),!(p+11)for(var n=1;n0,"You need to provide at least one extension"),this.assert(d,t.extensionsSchema);var b=Object.create(this.any());r(b,this);for(var v=function n(i){var l=d[i];"function"==typeof l&&(l=l(b)),e.assert(l,t.extensionSchema);var v=(l.base||e.any()).clone(),_=v.constructor,w=function(e){function t(){s(this,t);var n=a(this,e.call(this));return l.base&&r(n,v),n._type=l.name,l.language&&(n._settings=g.concat(n._settings,{language:o({},l.name,l.language)})),n}return u(t,e),t}(_);if(l.coerce&&(w.prototype._coerce=function(e,t,n){if(_.prototype._coerce){var r=_.prototype._coerce.call(this,e,t,n);if(r.errors)return r;e=r.value}var i=l.coerce.call(this,e,t,n);return i instanceof p.Err?{value:e,errors:i}:{value:i}}),l.pre&&(w.prototype._base=function(e,t,n){if(_.prototype._base){var r=_.prototype._base.call(this,e,t,n);if(r.errors)return r;e=r.value}var i=l.pre.call(this,e,t,n);return i instanceof p.Err?{value:e,errors:i}:{value:i}}),l.rules)for(var k=function t(n){var r=l.rules[n],i=r.params?r.params instanceof f?r.params._inner.children.map(function(e){return e.key}):Object.keys(r.params):[],o=r.params?h.schema(e,r.params):null;w.prototype[r.name]=function(){for(var e=arguments.length,t=Array(e),n=0;ni.length)throw new Error("Unexpected number of arguments");for(var s=!1,a={},u=0;u0&&void 0!==arguments[0]?arguments[0]:"javascript",n=["javascript","unix"];if(l.assert(n.includes(t),'"type" must be one of "'+n.join('", "')+'"'),this._flags.timestamp===t)return this;var r=this.clone();return r._flags.timestamp=t,r._flags.multiplier="unix"===t?1e3:1,r},t.prototype._isIsoDate=function e(t){return c.isoDate.test(t)},t}(a),c.compare=function(e,t){return function(n){var r="now"===n,i=u.isRef(n);return r||i||(n=c.Date.toDate(n)),l.assert(n,"Invalid date format"),this._test(e,n,function(o,s,a){var u=void 0;if(r)u=Date.now();else if(i){if(u=c.Date.toDate(n(s.reference||s.parent,a)),!u)return this.createError("date.ref",{ref:n.key},s,a);u=u.getTime()}else u=n.getTime();return t(o.getTime(),u)?o:this.createError("date."+e,{limit:new Date(u)},s,a)})}},c.Date.prototype.min=c.compare("min",function(e,t){return e>=t}),c.Date.prototype.max=c.compare("max",function(e,t){return e<=t}),c.Date.prototype.greater=c.compare("greater",function(e,t){return e>t}),c.Date.prototype.less=c.compare("less",function(e,t){return e=0,"limit must be a positive integer"),this._test("length",t,function(e,n,r){return Object.keys(e).length===t?e:this.createError("object.length",{limit:t},n,r)})},t.prototype.min=function e(t){return u.assert(Number.isSafeInteger(t)&&t>=0,"limit must be a positive integer"),this._test("min",t,function(e,n,r){return Object.keys(e).length>=t?e:this.createError("object.min",{limit:t},n,r)})},t.prototype.max=function e(t){return u.assert(Number.isSafeInteger(t)&&t>=0,"limit must be a positive integer"),this._test("max",t,function(e,n,r){return Object.keys(e).length<=t?e:this.createError("object.max",{limit:t},n,r)})},t.prototype.pattern=function e(t,n){var r=t instanceof RegExp;u.assert(r||t instanceof c,"pattern must be a regex or schema"),u.assert(void 0!==n,"Invalid rule"),r&&(t=new RegExp(t.source,t.ignoreCase?"i":void 0));try{n=h.schema(this._currentJoi,n)}catch(e){throw e.hasOwnProperty("path")&&(e.message=e.message+"("+e.path+")"),e}var i=this.clone();return r?i._inner.patterns.push({regex:t,rule:n}):i._inner.patterns.push({schema:t,rule:n}),i},t.prototype.schema=function e(){return this._test("schema",null,function(e,t,n){return e instanceof c?e:this.createError("object.schema",null,t,n)})},t.prototype.with=function e(t,n){return u.assert(2===arguments.length,"Invalid number of arguments, expected 2."),this._dependency("with",t,n)},t.prototype.without=function e(t,n){return u.assert(2===arguments.length,"Invalid number of arguments, expected 2."),this._dependency("without",t,n)},t.prototype.xor=function e(){for(var t=arguments.length,n=Array(t),r=0;r0,"expected at least one children");var o=p.groupChildren(t),s=void 0;if(""in o?(s=this[n].apply(this,r),delete o[""]):s=this.clone(),s._inner.children){i=i?i+".":"";for(var a=0;a0&&(n.renames=u.clone(this._inner.renames)),n},t.prototype.assert=function e(t,n,r){t=h.ref(t),u.assert(t.isContext||t.depth>1,"Cannot use assertions for root level references - use direct key rules instead"),r=r||"pass the assertion test";try{n=h.schema(this._currentJoi,n)}catch(e){throw e.hasOwnProperty("path")&&(e.message=e.message+"("+e.path+")"),e}var i=t.path[t.path.length-1],o=t.path.join(".");return this._test("assert",{schema:n,ref:t},function(e,s,a){var l=n._validate(t(e),null,a,e);if(!l.errors)return e;var c=u.merge({},s);return c.key=i,c.path=t.path,this.createError("object.assert",{ref:o,message:r},c,a)})},t.prototype.type=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.name;u.assert("function"==typeof t,"type must be a constructor function");var r={name:n,ctor:t};return this._test("type",r,function(e,n,i){return e instanceof t?e:this.createError("object.type",{type:r.name},n,i)})},t}(c),p.safeParse=function(e){try{return JSON.parse(e)}catch(e){}return e},p.renameDefaults={alias:!1,multiple:!1,override:!1},p.groupChildren=function(e){e.sort();for(var t={},n=0;n=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),u=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),b(n)?r.showHidden=n:n&&t._extend(r,n),E(r.showHidden)&&(r.showHidden=!1),E(r.depth)&&(r.depth=2),E(r.colors)&&(r.colors=!1),E(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),f(r,e,r.depth)}function u(e,t){var n=a.styles[t];return n?"["+a.colors[n][0]+"m"+e+"["+a.colors[n][1]+"m":e}function l(e,t){return e}function c(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function f(e,n,r){if(e.customInspect&&n&&T(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return k(i)||(i=f(e,i,r)),i}var o=h(e,n);if(o)return o;var s=Object.keys(n),a=c(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(n)),I(n)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return p(n);if(0===s.length){if(T(n)){var u=n.name?": "+n.name:"";return e.stylize("[Function"+u+"]","special")}if(x(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(A(n))return e.stylize(Date.prototype.toString.call(n),"date");if(I(n))return p(n)}var l="",b=!1,v=["{","}"],_;if(y(n)&&(b=!0,v=["[","]"]),T(n)){var w=n.name?": "+n.name:"";l=" [Function"+w+"]"}return x(n)&&(l=" "+RegExp.prototype.toString.call(n)),A(n)&&(l=" "+Date.prototype.toUTCString.call(n)),I(n)&&(l=" "+p(n)),0!==s.length||b&&0!=n.length?r<0?x(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),_=b?d(e,n,r,a,s):s.map(function(t){return m(e,n,r,a,t,b)}),e.seen.pop(),g(_,l,v)):v[0]+l+v[1]}function h(e,t){if(E(t))return e.stylize("undefined","undefined");if(k(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return w(t)?e.stylize(""+t,"number"):b(t)?e.stylize(""+t,"boolean"):v(t)?e.stylize("null","null"):void 0}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,n,r,i){for(var o=[],s=0,a=t.length;s-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n"))):a=e.stylize("[Circular]","special")),E(s)){if(o&&i.match(/^\d+$/))return a;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function g(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function y(e){return Array.isArray(e)}function b(e){return"boolean"==typeof e}function v(e){return null===e}function _(e){return null==e}function w(e){return"number"==typeof e}function k(e){return"string"==typeof e}function S(e){return"symbol"==typeof e}function E(e){return void 0===e}function x(e){return C(e)&&"[object RegExp]"===O(e)}function C(e){return"object"==typeof e&&null!==e}function A(e){return C(e)&&"[object Date]"===O(e)}function I(e){return C(e)&&("[object Error]"===O(e)||e instanceof Error)}function T(e){return"function"==typeof e}function j(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function O(e){return Object.prototype.toString.call(e)}function P(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(E(s)&&(s=r.env.NODE_DEBUG||""),e=e.toUpperCase(),!o[e])if(new RegExp("\\b"+e+"\\b","i").test(s)){var n=r.pid;o[e]=function(){var r=t.format.apply(t,arguments);console.error("%s %d: %s",e,n,r)}}else o[e]=function(){};return o[e]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=y,t.isBoolean=b,t.isNull=v,t.isNullOrUndefined=_,t.isNumber=w,t.isString=k,t.isSymbol=S,t.isUndefined=E,t.isRegExp=x,t.isObject=C,t.isDate=A,t.isError=I,t.isFunction=T,t.isPrimitive=j,t.isBuffer=n(40);var B=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function R(){var e=new Date,t=[P(e.getHours()),P(e.getMinutes()),P(e.getSeconds())].join(":");return[e.getDate(),B[e.getMonth()],t].join(" ")}function N(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",R(),t.format.apply(t,arguments))},t.inherits=n(39),t._extend=function(e,t){if(!t||!C(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(t,n(5),n(7))},function(e,t,n){"use strict";(function(t){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -function n(e,t){if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i=0;h--)if(u[h]!==c[h])return!1;for(h=u.length-1;h>=0;h--)if(f=u[h],!v(e[f],t[f],r,n))return!1;return!0}function S(e,t,r){v(e,t,!0)&&b(e,t,r,"notDeepStrictEqual",S)}function E(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function k(e){var t;try{e()}catch(e){t=e}return t}function x(e,t,r,n){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=k(t),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&b(i,r,"Missing expected exception"+n);var s="string"==typeof n,a=!e&&o.isError(i),u=!e&&i&&!r;if((a&&s&&E(i,r)||u)&&b(i,r,"Got unwanted exception"+n),e&&i&&r&&!E(i,r)||!e&&i)throw i}h.AssertionError=function e(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=m(this),this.generatedMessage=!0);var r=t.stackStartFunction||b;if(Error.captureStackTrace)Error.captureStackTrace(this,r);else{var n=new Error;if(n.stack){var i=n.stack,o=d(r),s=i.indexOf("\n"+o);if(s>=0){var a=i.indexOf("\n",s+1);i=i.substring(a+1)}this.stack=i}}},o.inherits(h.AssertionError,Error),h.fail=b,h.ok=y,h.equal=function e(t,r,n){t!=r&&b(t,r,n,"==",h.equal)},h.notEqual=function e(t,r,n){t==r&&b(t,r,n,"!=",h.notEqual)},h.deepEqual=function e(t,r,n){v(t,r,!1)||b(t,r,n,"deepEqual",h.deepEqual)},h.deepStrictEqual=function e(t,r,n){v(t,r,!0)||b(t,r,n,"deepStrictEqual",h.deepStrictEqual)},h.notDeepEqual=function e(t,r,n){v(t,r,!1)&&b(t,r,n,"notDeepEqual",h.notDeepEqual)},h.notDeepStrictEqual=S,h.strictEqual=function e(t,r,n){t!==r&&b(t,r,n,"===",h.strictEqual)},h.notStrictEqual=function e(t,r,n){t===r&&b(t,r,n,"!==",h.notStrictEqual)},h.throws=function(e,t,r){x(!0,e,t,r)},h.doesNotThrow=function(e,t,r){x(!1,e,t,r)},h.ifError=function(e){if(e)throw e};var C=Object.keys||function(e){var t=[];for(var r in e)s.call(e,r)&&t.push(r);return t}}).call(t,r(5))},function(e,t,r){"use strict";(function(e){var r={};t.escapeJavaScript=function(e){if(!e)return"";for(var t="",n=0;n&\u2028\u2029]/g,function(e){return o=e.charCodeAt(0),60===o?"\\u003c":62===o?"\\u003e":38===o?"\\u0026":8232===o?"\\u2028":"\\u2029"})},r.escapeJavaScriptChar=function(t){if(t>=256)return"\\u"+r.padLeft(""+t,4);var n=e.from(String.fromCharCode(t),"ascii").toString("hex");return"\\x"+r.padLeft(n,2)},r.escapeHtmlChar=function(t){var n=r.namedHtml[t];if(void 0!==n)return n;if(t>=256)return"&#"+t+";";var i=e.from(String.fromCharCode(t),"ascii").toString("hex");return"&#x"+r.padLeft(i,2)+";"},r.padLeft=function(e,t){for(;e.length=97||t>=65&&t<=90||t>=48&&t<=57||32===t||46===t||44===t||45===t||58===t||95===t)&&(e[t]=null);return e}()}).call(t,r(3).Buffer)},function(e,t,r){"use strict";(function(e){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(38),o={hasOwn:Object.prototype.hasOwnProperty,indexOf:Array.prototype.indexOf,defaultThreshold:16,maxIPv6Groups:8,categories:{valid:1,dnsWarn:7,rfc5321:15,cfws:31,deprecated:63,rfc5322:127,error:255},diagnoses:{valid:0,rfc5321TLD:9,rfc5321TLDNumeric:10,rfc5321QuotedString:11,rfc5321AddressLiteral:12,cfwsComment:17,cfwsFWS:18,undesiredNonAscii:25,deprecatedLocalPart:33,deprecatedFWS:34,deprecatedQTEXT:35,deprecatedQP:36,deprecatedComment:37,deprecatedCTEXT:38,deprecatedIPv6:39,deprecatedCFWSNearAt:49,rfc5322Domain:65,rfc5322TooLong:66,rfc5322LocalTooLong:67,rfc5322DomainTooLong:68,rfc5322LabelTooLong:69,rfc5322DomainLiteral:70,rfc5322DomainLiteralOBSDText:71,rfc5322IPv6GroupCount:72,rfc5322IPv62x2xColon:73,rfc5322IPv6BadCharacter:74,rfc5322IPv6MaxGroups:75,rfc5322IPv6ColonStart:76,rfc5322IPv6ColonEnd:77,errExpectingDTEXT:129,errNoLocalPart:130,errNoDomain:131,errConsecutiveDots:132,errATEXTAfterCFWS:133,errATEXTAfterQS:134,errATEXTAfterDomainLiteral:135,errExpectingQPair:136,errExpectingATEXT:137,errExpectingQTEXT:138,errExpectingCTEXT:139,errBackslashEnd:140,errDotStart:141,errDotEnd:142,errDomainHyphenStart:143,errDomainHyphenEnd:144,errUnclosedQuotedString:145,errUnclosedComment:146,errUnclosedDomainLiteral:147,errFWSCRLFx2:148,errFWSCRLFEnd:149,errCRNoLF:150,errUnknownTLD:160,errDomainTooShort:161},components:{localpart:0,domain:1,literal:2,contextComment:3,contextFWS:4,contextQuotedString:5,contextQuotedPair:6}};o.specials=function(){var e='()<>[]:;@\\,."',t=new Array(256);t.fill(!1);for(var r=0;r=0?o.nulNormalize(e):e.normalize("NFC")},o.checkIpV6=function(e){return e.every(function(e){return o.regex.ipV6.test(e)})},o.validDomain=function(e,t){return t.tldBlacklist?Array.isArray(t.tldBlacklist)?-1===o.indexOf.call(t.tldBlacklist,e):!o.hasOwn.call(t.tldBlacklist,e):Array.isArray(t.tldWhitelist)?-1!==o.indexOf.call(t.tldWhitelist,e):o.hasOwn.call(t.tldWhitelist,e)},t.validate=o.validate=function(t,r,s){r=r||{},t=o.normalize(t),"function"==typeof r&&(s=r,r={}),"function"!=typeof s&&(s=null);var a=void 0,u=void 0;if("number"==typeof r.errorLevel?(a=!0,u=r.errorLevel):(a=!!r.errorLevel,u=o.diagnoses.valid),r.tldWhitelist)if("string"==typeof r.tldWhitelist)r.tldWhitelist=[r.tldWhitelist];else if("object"!==n(r.tldWhitelist))throw new TypeError("expected array or object tldWhitelist");if(r.tldBlacklist)if("string"==typeof r.tldBlacklist)r.tldBlacklist=[r.tldBlacklist];else if("object"!==n(r.tldBlacklist))throw new TypeError("expected array or object tldBlacklist");if(r.minDomainAtoms&&(r.minDomainAtoms!==(0|+r.minDomainAtoms)||r.minDomainAtoms<0))throw new TypeError("expected positive integer minDomainAtoms");var c=o.diagnoses.valid,f=function e(t){t>c&&(c=t)},h=void 0===r.allowUnicode||!!r.allowUnicode;!h&&/[^\x00-\x7f]/.test(t)&&f(o.diagnoses.undesiredNonAscii);for(var l={now:o.components.localpart,prev:o.components.localpart,stack:[o.components.localpart]},d="",p={local:"",domain:""},g={locals:[""],domains:[""]},m=0,b=0,y=0,v=void 0,_=!1,w=!1,S=t.length,E=void 0,k=0;k64?f(o.diagnoses.rfc5322LocalTooLong):l.prev!==o.components.contextComment&&l.prev!==o.components.contextFWS||f(o.diagnoses.deprecatedCFWSNearAt),l.now=o.components.domain,l.stack[0]=o.components.domain,m=0,b=0,w=!1;break;default:if(w)switch(l.prev){case o.components.contextComment:case o.components.contextFWS:f(o.diagnoses.errATEXTAfterCFWS);break;case o.components.contextQuotedString:f(o.diagnoses.errATEXTAfterQS);break;default:throw new Error("more atext found where none is allowed, but unrecognized prev context: "+l.prev)}else l.prev=l.now,v=E.codePointAt(0),(o.specials(v)||o.c0Controls(v)||o.c1Controls(v))&&f(o.diagnoses.errExpectingATEXT),p.local+=E,g.locals[m]+=E,b+=e.byteLength(E,"utf8")}break;case o.components.domain:switch(E){case"(":0===b?f(0===m?o.diagnoses.deprecatedCFWSNearAt:o.diagnoses.deprecatedComment):(w=!0,f(o.diagnoses.cfwsComment)),l.stack.push(l.now),l.now=o.components.contextComment;break;case".":var x=i.encode(g.domains[m]).length;0===b?f(0===m?o.diagnoses.errDotStart:o.diagnoses.errConsecutiveDots):_?f(o.diagnoses.errDomainHyphenEnd):x>63&&f(o.diagnoses.rfc5322LabelTooLong),w=!1,b=0,++m,g.domains[m]="",p.domain+=E;break;case"[":0===p.domain.length?(w=!0,b+=e.byteLength(E,"utf8"),l.stack.push(l.now),l.now=o.components.literal,p.domain+=E,g.domains[m]+=E,p.literal=""):f(o.diagnoses.errExpectingATEXT);break;case"\r":if(S===++k||"\n"!==t[k]){f(o.diagnoses.errCRNoLF);break}case" ":case"\t":0===b?f(0===m?o.diagnoses.deprecatedCFWSNearAt:o.diagnoses.deprecatedFWS):(f(o.diagnoses.cfwsFWS),w=!0),l.stack.push(l.now),l.now=o.components.contextFWS,d=E;break;default:if(w)switch(l.prev){case o.components.contextComment:case o.components.contextFWS:f(o.diagnoses.errATEXTAfterCFWS);break;case o.components.literal:f(o.diagnoses.errATEXTAfterDomainLiteral);break;default:throw new Error("more atext found where none is allowed, but unrecognized prev context: "+l.prev)}v=E.codePointAt(0),_=!1,o.specials(v)||o.c0Controls(v)||o.c1Controls(v)?f(o.diagnoses.errExpectingATEXT):"-"===E?(0===b&&f(o.diagnoses.errDomainHyphenStart),_=!0):(v<48||v>122&&v<192||v>57&&v<65||v>90&&v<97)&&f(o.diagnoses.rfc5322Domain),p.domain+=E,g.domains[m]+=E,b+=e.byteLength(E,"utf8")}break;case o.components.literal:switch(E){case"]":if(cO?f(o.diagnoses.rfc5322IPv6MaxGroups):R.length===O&&f(o.diagnoses.deprecatedIPv6)):R.length!==O&&f(o.diagnoses.rfc5322IPv6GroupCount),":"===T[0]&&":"!==T[1]?f(o.diagnoses.rfc5322IPv6ColonStart):":"===T[T.length-1]&&":"!==T[T.length-2]?f(o.diagnoses.rfc5322IPv6ColonEnd):o.checkIpV6(R)?f(o.diagnoses.rfc5321AddressLiteral):f(o.diagnoses.rfc5322IPv6BadCharacter)}}else f(o.diagnoses.rfc5322DomainLiteral);p.domain+=E,g.domains[m]+=E,b+=e.byteLength(E,"utf8"),l.prev=l.now,l.now=l.stack.pop();break;case"\\":f(o.diagnoses.rfc5322DomainLiteralOBSDText),l.stack.push(l.now),l.now=o.components.contextQuotedPair;break;case"\r":if(S===++k||"\n"!==t[k]){f(o.diagnoses.errCRNoLF);break}case" ":case"\t":f(o.diagnoses.cfwsFWS),l.stack.push(l.now),l.now=o.components.contextFWS,d=E;break;default:if(v=E.codePointAt(0),127!==v&&o.c1Controls(v)||0===v||"["===E){f(o.diagnoses.errExpectingDTEXT);break}(o.c0Controls(v)||127===v)&&f(o.diagnoses.rfc5322DomainLiteralOBSDText),p.literal+=E,p.domain+=E,g.domains[m]+=E,b+=e.byteLength(E,"utf8")}break;case o.components.contextQuotedString:switch(E){case"\\":l.stack.push(l.now),l.now=o.components.contextQuotedPair;break;case"\r":if(S===++k||"\n"!==t[k]){f(o.diagnoses.errCRNoLF);break}case"\t":p.local+=" ",g.locals[m]+=" ",b+=e.byteLength(E,"utf8"),f(o.diagnoses.cfwsFWS),l.stack.push(l.now),l.now=o.components.contextFWS,d=E;break;case'"':p.local+=E,g.locals[m]+=E,b+=e.byteLength(E,"utf8"),l.prev=l.now,l.now=l.stack.pop();break;default:v=E.codePointAt(0),127!==v&&o.c1Controls(v)||0===v||10===v?f(o.diagnoses.errExpectingQTEXT):(o.c0Controls(v)||127===v)&&f(o.diagnoses.deprecatedQTEXT),p.local+=E,g.locals[m]+=E,b+=e.byteLength(E,"utf8")}break;case o.components.contextQuotedPair:v=E.codePointAt(0),127!==v&&o.c1Controls(v)?f(o.diagnoses.errExpectingQPair):(v<31&&9!==v||127===v)&&f(o.diagnoses.deprecatedQP),l.prev=l.now,l.now=l.stack.pop();var B="\\"+E;switch(l.now){case o.components.contextComment:break;case o.components.contextQuotedString:p.local+=B,g.locals[m]+=B,b+=2;break;case o.components.literal:p.domain+=B,g.domains[m]+=B,b+=2;break;default:throw new Error("quoted pair logic invoked in an invalid context: "+l.now)}break;case o.components.contextComment:switch(E){case"(":l.stack.push(l.now),l.now=o.components.contextComment;break;case")":l.prev=l.now,l.now=l.stack.pop();break;case"\\":l.stack.push(l.now),l.now=o.components.contextQuotedPair;break;case"\r":if(S===++k||"\n"!==t[k]){f(o.diagnoses.errCRNoLF);break}case" ":case"\t":f(o.diagnoses.cfwsFWS),l.stack.push(l.now),l.now=o.components.contextFWS,d=E;break;default:if(v=E.codePointAt(0),0===v||10===v||127!==v&&o.c1Controls(v)){f(o.diagnoses.errExpectingCTEXT);break}(o.c0Controls(v)||127===v)&&f(o.diagnoses.deprecatedCTEXT)}break;case o.components.contextFWS:if("\r"===d){if("\r"===E){f(o.diagnoses.errFWSCRLFx2);break}++y>1?f(o.diagnoses.deprecatedFWS):y=1}switch(E){case"\r":S!==++k&&"\n"===t[k]||f(o.diagnoses.errCRNoLF);break;case" ":case"\t":break;default:"\r"===d&&f(o.diagnoses.errFWSCRLFEnd),y=0,l.prev=l.now,l.now=l.stack.pop(),--k}d=E;break;default:throw new Error("unknown context: "+l.now)}if(c>o.categories.rfc5322)break}if(c255)f(o.diagnoses.rfc5322DomainTooLong);else if(e.byteLength(p.local,"utf8")+P+1>254)f(o.diagnoses.rfc5322TooLong);else if(b>63)f(o.diagnoses.rfc5322LabelTooLong);else if(r.minDomainAtoms&&g.domains.length0){var _=u.shift();if(y=_._validate(d,b,i),y.errors){if(o.push(this.createError("array.ordered",{pos:h,reason:y.errors,value:d},{key:n.key,path:b.path},i)),i.abortEarly)return o}else if(_._flags.strip)l.fastSplice(t,h),--h,--f;else{if(!this._flags.sparse&&void 0===y.value){if(o.push(this.createError("array.sparse",null,{key:n.key,path:b.path,pos:h},i)),i.abortEarly)return o;continue}t[h]=y.value}continue}if(!this._inner.items.length){if(o.push(this.createError("array.orderedLength",{pos:h,limit:this._inner.ordereds.length},{key:n.key,path:b.path},i)),i.abortEarly)return o;continue}}for(var w=[],S=a.length,E=0;E=0||r,"limit must be a positive integer or reference"),this._test("min",t,function(e,n,i){var o=void 0;if(r){if(o=t(n.reference||n.parent,i),!(Number.isSafeInteger(o)&&o>=0))return this.createError("array.ref",{ref:t.key},n,i)}else o=t;return e.length>=o?e:this.createError("array.min",{limit:t,value:e},n,i)})},t.prototype.max=function e(t){var r=f.isRef(t);return h.assert(Number.isSafeInteger(t)&&t>=0||r,"limit must be a positive integer or reference"),this._test("max",t,function(e,n,i){var o=void 0;if(r){if(o=t(n.reference||n.parent,i),!(Number.isSafeInteger(o)&&o>=0))return this.createError("array.ref",{ref:t.key},n,i)}else o=t;return e.length<=o?e:this.createError("array.max",{limit:t,value:e},n,i)})},t.prototype.length=function e(t){var r=f.isRef(t);return h.assert(Number.isSafeInteger(t)&&t>=0||r,"limit must be a positive integer or reference"),this._test("length",t,function(e,n,i){var o=void 0;if(r){if(o=t(n.reference||n.parent,i),!(Number.isSafeInteger(o)&&o>=0))return this.createError("array.ref",{ref:t.key},n,i)}else o=t;return e.length===o?e:this.createError("array.length",{limit:t,value:e},n,i)})},t.prototype.unique=function e(t){h.assert(void 0===t||"function"==typeof t||"string"==typeof t,"comparator must be a function or a string");var r={};return"string"==typeof t?r.path=t:"function"==typeof t&&(r.comparator=t),this._test("unique",r,function(e,t,i){for(var o={string:Object.create(null),number:Object.create(null),undefined:Object.create(null),boolean:Object.create(null),object:new Map,function:new Map,custom:new Map},s=r.comparator||h.deepEqual,a=0;a=0,"limit must be a positive integer"),this._test("min",t,function(e,r,n){return e.length>=t?e:this.createError("binary.min",{limit:t,value:e},r,n)})},r.prototype.max=function e(t){return u.assert(Number.isSafeInteger(t)&&t>=0,"limit must be a positive integer"),this._test("max",t,function(e,r,n){return e.length<=t?e:this.createError("binary.max",{limit:t,value:e},r,n)})},r.prototype.length=function e(t){return u.assert(Number.isSafeInteger(t)&&t>=0,"limit must be a positive integer"),this._test("length",t,function(e,r,n){return e.length===t?e:this.createError("binary.length",{limit:t,value:e},r,n)})},r}(a),e.exports=new c.Binary}).call(t,r(3).Buffer)},function(e,t,r){"use strict";function n(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n=0,"n must be a positive integer"),this._test("arity",t,function(e,r,n){return e.length===t?e:this.createError("function.arity",{n:t},r,n)})},t.prototype.minArity=function e(t){return a.assert(Number.isSafeInteger(t)&&t>0,"n must be a strict positive integer"),this._test("minArity",t,function(e,r,n){return e.length>=t?e:this.createError("function.minArity",{n:t},r,n)})},t.prototype.maxArity=function e(t){return a.assert(Number.isSafeInteger(t)&&t>=0,"n must be a positive integer"),this._test("maxArity",t,function(e,r,n){return e.length<=t?e:this.createError("function.maxArity",{n:t},r,n)})},t.prototype.ref=function e(){return this._test("ref",null,function(e,t,r){return c.isRef(e)?e:this.createError("function.ref",null,t,r)})},t.prototype.class=function e(){return this._test("class",null,function(e,t,r){return/^\s*class\s/.test(e.toString())?e:this.createError("function.class",null,t,r)})},t}(u.constructor),e.exports=new f.Func},function(e,t,r){"use strict";function n(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n0,"multiple must be greater than 0")),this._test("multiple",t,function(e,n,i){var o=r?t(n.reference||n.parent,i):t;return!r||"number"==typeof o&&isFinite(o)?e%o==0?e:this.createError("number.multiple",{multiple:t,value:e},n,i):this.createError("number.ref",{ref:t.key},n,i)})},t.prototype.integer=function e(){return this._test("integer",void 0,function(e,t,r){return Number.isSafeInteger(e)?e:this.createError("number.integer",{value:e},t,r)})},t.prototype.negative=function e(){return this._test("negative",void 0,function(e,t,r){return e<0?e:this.createError("number.negative",{value:e},t,r)})},t.prototype.positive=function e(){return this._test("positive",void 0,function(e,t,r){return e>0?e:this.createError("number.positive",{value:e},t,r)})},t.prototype.precision=function e(t){c.assert(Number.isSafeInteger(t),"limit must be an integer"),c.assert(!("precision"in this._flags),"precision already set");var r=this._test("precision",t,function(e,r,n){var i=e.toString().match(f.precisionRx),o=Math.max((i[1]?i[1].length:0)-(i[2]?parseInt(i[2],10):0),0);return o<=t?e:this.createError("number.precision",{limit:t,value:e},r,n)});return r._flags.precision=t,r},t.prototype.port=function e(){return this._test("port",void 0,function(e,t,r){return!Number.isSafeInteger(e)||e<0||e>65535?this.createError("number.port",{value:e},t,r):e})},t}(a),f.compare=function(e,t){return function(r){var n=u.isRef(r),i="number"==typeof r&&!isNaN(r);return c.assert(i||n,"limit must be a number or reference"),this._test(e,r,function(i,o,s){var a=void 0;if(n){if(a=r(o.reference||o.parent,s),"number"!=typeof a||isNaN(a))return this.createError("number.ref",{ref:r.key},o,s)}else a=r;return t(i,a)?i:this.createError("number."+e,{limit:a,value:i},o,s)})}},f.Number.prototype.min=f.compare("min",function(e,t){return e>=t}),f.Number.prototype.max=f.compare("max",function(e,t){return e<=t}),f.Number.prototype.greater=f.compare("greater",function(e,t){return e>t}),f.Number.prototype.less=f.compare("less",function(e,t){return e9),o^=3}var a=i%10==0&&i>0;return a?e:this.createError("string.creditCard",{value:e},t,r)})},t.prototype.regex=function e(t,r){c.assert(t instanceof RegExp,"pattern must be a RegExp");var i={pattern:new RegExp(t.source,t.ignoreCase?"i":void 0)};"string"==typeof r?i.name=r:"object"===(void 0===r?"undefined":n(r))&&(i.invert=!!r.invert,r.name&&(i.name=r.name));var o=["string.regex",i.invert?".invert":"",i.name?".name":".base"].join("");return this._test("regex",i,function(e,t,r){var n=i.pattern.test(e);return n^i.invert?e:this.createError(o,{name:i.name,pattern:i.pattern,value:e},t,r)})},t.prototype.alphanum=function e(){return this._test("alphanum",void 0,function(e,t,r){return/^[a-zA-Z0-9]+$/.test(e)?e:this.createError("string.alphanum",{value:e},t,r)})},t.prototype.token=function e(){return this._test("token",void 0,function(e,t,r){return/^\w+$/.test(e)?e:this.createError("string.token",{value:e},t,r)})},t.prototype.email=function e(t){return t&&(c.assert("object"===(void 0===t?"undefined":n(t)),"email options must be an object"),c.assert(void 0===t.checkDNS,"checkDNS option is not supported"),c.assert(void 0===t.tldWhitelist||"object"===n(t.tldWhitelist),"tldWhitelist must be an array or object"),c.assert(void 0===t.minDomainAtoms||Number.isSafeInteger(t.minDomainAtoms)&&t.minDomainAtoms>0,"minDomainAtoms must be a positive integer"),c.assert(void 0===t.errorLevel||"boolean"==typeof t.errorLevel||Number.isSafeInteger(t.errorLevel)&&t.errorLevel>=0,"errorLevel must be a non-negative integer or boolean")),this._test("email",t,function(e,n,i){f=f||r(19);try{var o=f.validate(e,t);if(!0===o||0===o)return e}catch(e){}return this.createError("string.email",{value:e},n,i)})},t.prototype.ip=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=m.ipRegex;c.assert("object"===(void 0===t?"undefined":n(t)),"options must be an object"),t.cidr?(c.assert("string"==typeof t.cidr,"cidr must be a string"),t.cidr=t.cidr.toLowerCase(),c.assert(c.contain(m.cidrPresences,t.cidr),"cidr must be one of "+m.cidrPresences.join(", ")),t.version||"optional"===t.cidr||(r=g.createIpRegex(["ipv4","ipv6","ipvfuture"],t.cidr))):t.cidr="optional";var i=void 0;if(t.version){Array.isArray(t.version)||(t.version=[t.version]),c.assert(t.version.length>=1,"version must have at least 1 version specified"),i=[];for(var o=0;o=1,"scheme must have at least 1 scheme specified");for(var a=0;a=1,"version must have at least 1 valid version specified");for(var n=new Set,i=0;i0&&void 0!==arguments[0]?arguments[0]:{};c.assert("object"===(void 0===t?"undefined":n(t)),"hex options must be an object"),c.assert(void 0===t.byteAligned||"boolean"==typeof t.byteAligned,"byteAligned must be boolean");var r=!0===t.byteAligned,i=/^[a-f0-9]+$/i,o=this._test("hex",i,function(e,t,n){return i.test(e)?r&&e.length%2!=0?this.createError("string.hexAlign",{value:e},t,n):e:this.createError("string.hex",{value:e},t,n)});return r&&(o._flags.byteAligned=!0),o},t.prototype.base64=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};c.assert("object"===(void 0===t?"undefined":n(t)),"base64 options must be an object"),c.assert(void 0===t.paddingRequired||"boolean"==typeof t.paddingRequired,"paddingRequired must be boolean");var r=!1===t.paddingRequired?t.paddingRequired:t.paddingRequired||!0,i=r?/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/:/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/;return this._test("base64",i,function(e,t,r){return i.test(e)?e:this.createError("string.base64",{value:e},t,r)})},t.prototype.hostname=function e(){var t=/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/;return this._test("hostname",void 0,function(e,r,n){return e.length<=255&&t.test(e)||u.isIPv6(e)?e:this.createError("string.hostname",{value:e},r,n)})},t.prototype.normalize=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"NFC";c.assert(c.contain(m.normalizationForms,t),"normalization form must be one of "+m.normalizationForms.join(", "));var r=this._test("normalize",t,function(e,r,n){return n.convert||e===e.normalize(t)?e:this.createError("string.normalize",{value:e,form:t},r,n)});return r._flags.normalize=t,r},t.prototype.lowercase=function e(){var t=this._test("lowercase",void 0,function(e,t,r){return r.convert||e===e.toLocaleLowerCase()?e:this.createError("string.lowercase",{value:e},t,r)});return t._flags.case="lower",t},t.prototype.uppercase=function e(){var t=this._test("uppercase",void 0,function(e,t,r){return r.convert||e===e.toLocaleUpperCase()?e:this.createError("string.uppercase",{value:e},t,r)});return t._flags.case="upper",t},t.prototype.trim=function e(){var t=this._test("trim",void 0,function(e,t,r){return r.convert||e===e.trim()?e:this.createError("string.trim",{value:e},t,r)});return t._flags.trim=!0,t},t.prototype.replace=function e(t,r){"string"==typeof t&&(t=new RegExp(c.escapeRegex(t),"g")),c.assert(t instanceof RegExp,"pattern must be a RegExp"),c.assert("string"==typeof r,"replacement must be a String");var n=this.clone();return n._inner.replacements||(n._inner.replacements=[]),n._inner.replacements.push({pattern:t,replacement:r}),n},t.prototype.truncate=function e(t){var r=void 0===t||!!t;if(this._flags.truncate===r)return this;var n=this.clone();return n._flags.truncate=r,n},t}(h),m.compare=function(e,r){return function(n,i){var o=l.isRef(n);return c.assert(Number.isSafeInteger(n)&&n>=0||o,"limit must be a positive integer or reference"),c.assert(!i||t.isEncoding(i),"Invalid encoding:",i),this._test(e,n,function(t,s,a){var u=void 0;if(o){if(u=n(s.reference||s.parent,a),!Number.isSafeInteger(u))return this.createError("string.ref",{ref:n.key},s,a)}else u=n;return r(t,u,i)?t:this.createError("string."+e,{limit:u,value:t,encoding:i},s,a)})}},m.String.prototype.min=m.compare("min",function(e,r,n){var i=n?t.byteLength(e,n):e.length;return i>=r}),m.String.prototype.max=m.compare("max",function(e,r,n){var i=n?t.byteLength(e,n):e.length;return i<=r}),m.String.prototype.length=m.compare("length",function(e,r,n){var i=n?t.byteLength(e,n):e.length;return i===r}),m.String.prototype.uuid=m.String.prototype.guid,e.exports=new m.String}).call(t,r(3).Buffer)},function(e,t,r){"use strict";var n=r(14),i={Ip:{cidrs:{ipv4:{required:"\\/(?:"+n.ipv4Cidr+")",optional:"(?:\\/(?:"+n.ipv4Cidr+"))?",forbidden:""},ipv6:{required:"\\/"+n.ipv6Cidr,optional:"(?:\\/"+n.ipv6Cidr+")?",forbidden:""},ipvfuture:{required:"\\/"+n.ipv6Cidr,optional:"(?:\\/"+n.ipv6Cidr+")?",forbidden:""}},versions:{ipv4:n.IPv4address,ipv6:n.IPv6address,ipvfuture:n.IPvFuture}}};i.Ip.createIpRegex=function(e,t){for(var r=void 0,n=0;n0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function f(e){return 3*e.length/4-c(e)}function h(e){var t,r,n,s,a,u=e.length;s=c(e),a=new o(3*u/4-s),r=s>0?u-4:u;var f=0;for(t=0;t>16&255,a[f++]=n>>8&255,a[f++]=255&n;return 2===s?(n=i[e.charCodeAt(t)]<<2|i[e.charCodeAt(t+1)]>>4,a[f++]=255&n):1===s&&(n=i[e.charCodeAt(t)]<<10|i[e.charCodeAt(t+1)]<<4|i[e.charCodeAt(t+2)]>>2,a[f++]=n>>8&255,a[f++]=255&n),a}function l(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function d(e,t,r){for(var n,i=[],o=t;oc?c:u+16383));return 1===i?(t=e[r-1],o+=n[t>>2],o+=n[t<<4&63],o+="=="):2===i&&(t=(e[r-2]<<8)+e[r-1],o+=n[t>>10],o+=n[t>>4&63],o+=n[t<<2&63],o+="="),s.push(o),s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<>1,f=-7,h=r?i-1:0,l=r?-1:1,d=e[t+h];for(h+=l,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=256*o+e[t+h],h+=l,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+e[t+h],h+=l,f-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=c}return(d?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,u,c=8*o-i-1,f=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-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+h>=1?l/u:l*Math.pow(2,1-h),t*u>=2&&(s++,u/=2),s+h>=f?(a=0,s=f):s+h>=1?(a=(t*u-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<0;e[r+d]=255&s,d+=p,s/=256,c-=8);e[r+d-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t){e.exports={_args:[["joi@13.4.0","/Users/jeff/projects/joi-browser"]],_development:!0,_from:"joi@13.4.0",_id:"joi@13.4.0",_inBundle:!1,_integrity:"sha512-JuK4GjEu6j7zr9FuVe2MAseZ6si/8/HaY0qMAejfDFHp7jcH4OKE937mIHM5VT4xDS0q7lpQbszbxKV9rm0yUg==",_location:"/joi",_phantomChildren:{},_requested:{type:"version",registry:!0,raw:"joi@13.4.0",name:"joi",escapedName:"joi",rawSpec:"13.4.0",saveSpec:null,fetchSpec:"13.4.0"},_requiredBy:["#DEV:/"],_resolved:"https://registry.npmjs.org/joi/-/joi-13.4.0.tgz",_spec:"13.4.0",_where:"/Users/jeff/projects/joi-browser",bugs:{url:"https://github.com/hapijs/joi/issues"},dependencies:{hoek:"5.x.x",isemail:"3.x.x",topo:"3.x.x"},description:"Object schema validation",devDependencies:{code:"5.x.x",hapitoc:"1.x.x",lab:"15.x.x"},engines:{node:">=8.9.0"},homepage:"https://github.com/hapijs/joi",keywords:["hapi","schema","validation"],license:"BSD-3-Clause",main:"lib/index.js",name:"joi",repository:{type:"git",url:"git://github.com/hapijs/joi.git"},scripts:{test:"lab -t 100 -a code -L","test-cov-html":"lab -r html -o coverage.html -a code","test-debug":"lab -a code",toc:"hapitoc",version:"npm run toc && git add API.md README.md"},version:"13.4.0"}},function(e,t,r){(function(e){function r(e,t){for(var r=0,n=e.length-1;n>=0;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}var n=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(e){return n.exec(e).slice(1)};function o(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n=-1&&!n;i--){var s=i>=0?arguments[i]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,n="/"===s.charAt(0))}return t=r(o(t.split("/"),function(e){return!!e}),!n).join("/"),(n?"/":"")+t||"."},t.normalize=function(e){var n=t.isAbsolute(e),i="/"===s(e,-1);return e=r(o(e.split("/"),function(e){return!!e}),!n).join("/"),e||n||(e="."),e&&i&&(e+="/"),(n?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(o(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,r){function n(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=t.resolve(e).substr(1),r=t.resolve(r).substr(1);for(var i=n(e.split("/")),o=n(r.split("/")),s=Math.min(i.length,o.length),a=s,u=0;u= 0x80 (not a basic code point)","invalid-input":"Invalid input"},E=h-l,k=Math.floor,x=String.fromCharCode,C;function A(e){throw new RangeError(S[e])}function I(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function T(e,t){var r=e.split("@"),n="";r.length>1&&(n=r[0]+"@",e=r[1]),e=e.replace(w,".");var i=e.split("."),o=I(i,t).join(".");return n+o}function O(e){for(var t=[],r=0,n=e.length,i,o;r=55296&&i<=56319&&r65535&&(e-=65536,t+=x(e>>>10&1023|55296),e=56320|1023&e),t+=x(e),t}).join("")}function B(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:h}function P(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function M(e,t,r){var n=0;for(e=r?k(e/g):e>>1,e+=k(e/t);e>E*d>>1;n+=h)e=k(e/E);return k(n+(E+1)*e/(e+p))}function N(e){var t=[],r=e.length,n,i=0,o=b,s=m,a,u,c,p,g,v,_,w,S;for(a=e.lastIndexOf(y),a<0&&(a=0),u=0;u=128&&A("not-basic"),t.push(e.charCodeAt(u));for(c=a>0?a+1:0;c=r&&A("invalid-input"),_=B(e.charCodeAt(c++)),(_>=h||_>k((f-i)/g))&&A("overflow"),i+=_*g,w=v<=s?l:v>=s+d?d:v-s,!(_k(f/S)&&A("overflow"),g*=S;n=t.length+1,s=M(i-p,n,0==p),k(i/n)>f-o&&A("overflow"),o+=k(i/n),i%=n,t.splice(i++,0,o)}return R(t)}function L(e){var t,r,n,i,o,s,a,u,c,p,g,v=[],_,w,S,E;for(e=O(e),_=e.length,t=b,r=0,o=m,s=0;s<_;++s)g=e[s],g<128&&v.push(x(g));for(n=i=v.length,i&&v.push(y);n<_;){for(a=f,s=0;s<_;++s)g=e[s],g>=t&&gk((f-r)/w)&&A("overflow"),r+=(a-t)*w,t=a,s=0;s<_;++s)if(g=e[s],gf&&A("overflow"),g==t){for(u=r,c=h;p=c<=o?l:c>=o+d?d:c-o,!(u2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(g.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(h.validity.notBefore=g[0],h.validity.notAfter=g[1],h.tbsCertificate=r.tbsCertificate,t){if(h.md=null,h.signatureOid in s){var f=s[h.signatureOid];switch(f){case"sha1WithRSAEncryption":h.md=n.md.sha1.create();break;case"md5WithRSAEncryption":h.md=n.md.md5.create();break;case"sha256WithRSAEncryption":h.md=n.md.sha256.create();break;case"sha384WithRSAEncryption":h.md=n.md.sha384.create();break;case"sha512WithRSAEncryption":h.md=n.md.sha512.create();break;case"RSASSA-PSS":h.md=n.md.sha256.create()}}if(null===h.md){var u=new Error("Could not compute certificate digest. Unknown signature OID.");throw u.signatureOid=h.signatureOid,u}var m=i.toDer(h.tbsCertificate);h.md.update(m.getBytes())}var y=n.md.sha1.create();h.issuer.getField=function(e){return d(h.issuer,e)},h.issuer.addField=function(e){b([e]),h.issuer.attributes.push(e)},h.issuer.attributes=o.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(h.issuer.uniqueId=r.certIssuerUniqueId),h.issuer.hash=y.digest().toHex();var v=n.md.sha1.create();return h.subject.getField=function(e){return d(h.subject,e)},h.subject.addField=function(e){b([e]),h.subject.attributes.push(e)},h.subject.attributes=o.RDNAttributesAsArray(r.certSubject,v),r.certSubjectUniqueId&&(h.subject.uniqueId=r.certSubjectUniqueId),h.subject.hash=v.digest().toHex(),r.certExtensions?h.extensions=o.certificateExtensionsFromAsn1(r.certExtensions):h.extensions=[],h.publicKey=o.publicKeyFromAsn1(r.subjectPublicKeyInfo),h},o.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(o=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&o),t.nonRepudiation=64==(64&o),t.keyEncipherment=32==(32&o),t.dataEncipherment=16==(16&o),t.keyAgreement=8==(8&o),t.keyCertSign=4==(4&o),t.cRLSign=2==(2&o),t.encipherOnly=1==(1&o),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=i.fromDer(t.value);r.value.length>0&&r.value[0].type===i.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var u=null;r.value.length>0&&r.value[0].type===i.Type.INTEGER?u=r.value[0].value:r.value.length>1&&(u=r.value[1].value),null!==u&&(t.pathLenConstraint=i.derToInteger(u))}else if("extKeyUsage"===t.name)for(var r=i.fromDer(t.value),c=0;c1&&(o=r.value.charCodeAt(1)),t.client=128==(128&o),t.server=64==(64&o),t.email=32==(32&o),t.objsign=16==(16&o),t.reserved=8==(8&o),t.sslCA=4==(4&o),t.emailCA=2==(2&o),t.objCA=1==(1&o)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){var h;t.altNames=[];for(var r=i.fromDer(t.value),l=0;l0&&t.value.push(o.certificateExtensionsToAsn1(e.extensions)),t},o.getCertificationRequestInfo=function(e){var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),g(e.subject),o.publicKeyToAsn1(e.publicKey),_(e)]);return t},o.distinguishedNameToAsn1=function(e){return g(e)},o.certificateToAsn1=function(e){var t=e.tbsCertificate||o.getTBSCertificate(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),v(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},o.certificateExtensionsToAsn1=function(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,3,!0,[]),r=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;nf.validity.notAfter)&&(u={message:"Certificate is not valid yet or has expired.",error:o.certificateError.certificate_expired,notBefore:f.validity.notBefore,notAfter:f.validity.notAfter,now:s}),null===u){if(h=t[0]||e.getIssuer(f),null===h&&f.isIssuer(f)&&(l=!0,h=f),h){var d=h;n.util.isArray(d)||(d=[d]);for(var p=!1;!p&&d.length>0;){h=d.shift();try{p=h.verify(f)}catch(e){}}p||(u={message:"Certificate signature is invalid.",error:o.certificateError.bad_certificate})}null!==u||h&&!l||e.hasCertificate(f)||(u={message:"Certificate is not trusted.",error:o.certificateError.unknown_ca})}if(null===u&&h&&!f.isIssuer(h)&&(u={message:"Certificate issuer is invalid.",error:o.certificateError.bad_certificate}),null===u)for(var g={keyUsage:!0,basicConstraints:!0},m=0;null===u&&my.pathLenConstraint&&(u={message:"Certificate basicConstraints pathLenConstraint violated.",error:o.certificateError.bad_certificate})}}var w=null===u||u.error,S=r?r(w,c,i):w;if(!0!==S)throw!0===w&&(u={message:"The application rejected the certificate.",error:o.certificateError.bad_certificate}),(S||0===S)&&("object"!=typeof S||n.util.isArray(S)?"string"==typeof S&&(u.error=S):(S.message&&(u.message=S.message),S.error&&(u.error=S.error))),u;u=null,a=!1,++c}while(t.length>0);return!0}},function(e,t){function r(e,t,r){var n;return function(){if(!t)return e.apply(this,arguments);var i=this,o=arguments,s=r&&!n;return clearTimeout(n),n=setTimeout(function(){if(n=null,!s)return e.apply(i,o)},t),s?e.apply(this,arguments):void 0}}e.exports=r},function(e,t,r){"use strict";var n=r(927);function i(e){return Number.isFinite(e)}function o(e){return"function"==typeof e}function s(e,t){return t?function(r,n){var i=setTimeout(function(){e(new Error("pull-reader: read exceeded timeout"),n)},t);e(r,function(e,t){clearTimeout(i),n(e,t)})}:e}e.exports=function(e){var t=[],r,a,u=!1,c=n(),f,h,l;function d(){for(;t.length;)if(null==t[0].length&&c.has(1))t.shift().cb(null,c.get());else if(c.has(t[0].length)){var e=t.shift();e.cb(null,c.get(e.length))}else if(1==f&&t[0].length&&c.length 0 to the moving average constructor");let r,i=0,o=0,s=0,a,u={};function c(e,r){return 1-n(-(e-r)/t)}return u.push=function e(t,n){if(a){const e=c(t,a),u=n-r,f=e*u;r=e*n+(1-e)*r,i=(1-e)*(i+u*f),o=Math.sqrt(i),s=r+e*u}else r=n;a=t},u.movingAverage=function e(){return r},u.variance=function e(){return i},u.deviation=function e(){return o},u.forecast=function e(){return s},u}},function(e,t,r){var n=r(461),i=r(222);function o(e,t){t=n(t,e);for(var r=0,o=t.length;null!=e&&rn(e.bytes,t),n=>this.publisher.publishWithEOL(e,t,r,n)],(e,n)=>{if(e)return u.error(e),o(e);u(`IPNS value ${t} was published correctly`);const i=n[0].toB58String(),s=parseFloat(r),a=s{if(t)return u.error(t),r(t);u(`IPNS record from ${e} was resolved correctly`),r(null,{path:n})})}initializeKeyspace(e,t,r){this.publisher.publish(e,t,r)}}t=e.exports=p,t.path=l},function(e,t,r){"use strict";const n=r(56),i=r(6),o=i("jsipfs:ipns:path");o.error=i("jsipfs:ipns:path:error");const s=(e,t,r)=>{if(n.ipnsPath(t))return o(`resolve ipns path ${t}`),e._ipns.resolve(t,r);e.dag.get(t.substring("/ipfs/".length),(e,t)=>e?r(e):r(null,t))};e.exports={resolvePath:s}},function(e,t,r){"use strict";(function(n){const i=r(168),{fromB58String:o,toB58String:s}=r(33),a=r(967),u=r(51),c=r(19),f=r(6),h=f("jsipfs:ipns:pubsub");h.error=f("jsipfs:ipns:pubsub:error");class l{constructor(e,t,r){this._pubsub=e,this._subscriptions={},this._handleSubscriptionKey=this._handleSubscriptionKey.bind(this),this._pubsubDs=new a(e,t,r,i.validator,this._handleSubscriptionKey)}put(e,t,r){this._pubsubDs.put(e,t,r)}get(e,t){this._pubsubDs.get(e,(r,n)=>{const o=e.slice(0,i.namespaceLength);if(o.toString()===i.namespace){const t=e.toString(),r=s(e.slice(i.namespaceLength));this._subscriptions[t]=r,h(`subscribed pubsub ${t}: ${r}`)}if(r)return t(r);t(null,n)})}_handleSubscriptionKey(e,t){const r=this._subscriptions[e];if(!r){const r=`key ${e} does not correspond to a subscription`;return h.error(r),t(c(new Error(r),"ERR_INVALID_KEY"))}let n;try{n=i.getIdKeys(o(r))}catch(e){return h.error(e),t(e)}t(null,n.routingKey.toBuffer())}getSubscriptions(e){const t=Object.values(this._subscriptions).filter(Boolean);return e(null,t.map(e=>`${i.namespace}${e}`))}cancel(e,t){if("string"!=typeof e){const e="received subscription name is not valid";return h.error(e),t(c(new Error(e),"ERR_INVALID_SUBSCRIPTION_NAME"))}e.startsWith(i.namespace)&&(e=e.substring(i.namespaceLength));const r=Object.keys(this._subscriptions).find(t=>this._subscriptions[t]===e);if(!r)return t(null,{canceled:!1});try{const e=n.from(r);this._pubsubDs.unsubscribe(e)}catch(e){return t(e)}this._subscriptions[r]=void 0,h(`unsubscribed pubsub ${r}: ${e}`),t(null,{canceled:!0})}}t=e.exports=u(l,{className:"IpnsPubsubDatastore",symbolName:"@js-ipfs/ipns/IpnsPubsubDatastore"})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const{Key:i}=r(28),{Record:o}=r(969),{encodeBase32:s}=r(470),a=r(19),u=r(6),c=u("jsipfs:ipns:offline-datastore");c.error=u("jsipfs:ipns:offline-datastore:error");class f{constructor(e){this._repo=e}put(e,t,r){if(!n.isBuffer(e)){const e="Offline datastore key must be a buffer";return c.error(e),r(a(new Error(e),"ERR_INVALID_KEY"))}if(!n.isBuffer(t)){const e="Offline datastore value must be a buffer";return c.error(e),r(a(new Error(e),"ERR_INVALID_VALUE"))}let i;try{i=this._routingKey(e)}catch(e){const t="Not possible to generate the routing key";return c.error(t),r(a(new Error(t),"ERR_GENERATING_ROUTING_KEY"))}const s=new o(e,t);this._repo.datastore.put(i,s.serialize(),r)}get(e,t){if(!n.isBuffer(e)){const e="Offline datastore key must be a buffer";return c.error(e),t(a(new Error(e),"ERR_INVALID_KEY"))}let r;try{r=this._routingKey(e)}catch(e){const r="Not possible to generate the routing key";return c.error(r),t(a(new Error(r),"ERR_GENERATING_ROUTING_KEY"))}this._repo.datastore.get(r,(e,r)=>{if(e)return t(e);let n;try{n=o.deserialize(r)}catch(e){return c.error(e),t(e)}t(null,n.value)})}_routingKey(e){return new i("/"+s(e),!1)}}t=e.exports=f}).call(this,r(0).Buffer)},function(e,t,r){var n=r(974);e.exports=function(e,t,r){for(var i=-1,o=[],s=r?t.length:0;(i=n(e,t))>-1;)o.push(e.slice(0,i+s)),e=e.slice(i+t.length,e.length);return o.push(e),o}},function(e,t,r){"use strict";(function(e){const n=r(14);t.toCallback=(e=>(function(t,r){const i=(e,t)=>n(()=>{r(e,t)});let o;try{o=e(t)}catch(e){return void i(e)}i(null,o)})),t.toBuf=((t,r)=>n=>{let i=t(n,r);return e.from(i,"hex")}),t.fromString=((t,r)=>n=>{const i=e.isBuffer(n)?n.toString():n;return t(i,r)}),t.fromNumberTo32BitBuf=((t,r)=>n=>{let i=t(n,r);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return e.from(o)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(95),i=r(168);e.exports={encodeBase32:e=>{const t=n.encode("base32",e).slice(1);return t.toString().toUpperCase()},validator:{func:(e,t,r)=>i.validator.validate(t,e,r)},selector:(e,t)=>i.validator.select(t[0],t[1])}},function(e,t,r){"use strict";const n=r(217),i=r(167),o=r(470);function s({datastore:e,peerInfo:t,peerBook:s,options:a,config:u}){const c={datastore:e,peerInfo:t,peerBook:s,config:{peerDiscovery:{mdns:{enabled:n(a,"config.Discovery.MDNS.Enabled",n(u,"Discovery.MDNS.Enabled",!0))},webRTCStar:{enabled:n(a,"config.Discovery.webRTCStar.Enabled",n(u,"Discovery.webRTCStar.Enabled",!0))},bootstrap:{list:n(a,"config.Bootstrap",n(u,"Bootstrap",[]))}},relay:{enabled:n(a,"relay.enabled",n(u,"relay.enabled",!1)),hop:{enabled:n(a,"relay.hop.enabled",n(u,"relay.hop.enabled",!1)),active:n(a,"relay.hop.active",n(u,"relay.hop.active",!1))}},dht:{validators:{ipns:o.validator},selectors:{ipns:o.selector}},EXPERIMENTAL:{dht:n(a,"EXPERIMENTAL.dht",!1),pubsub:n(a,"EXPERIMENTAL.pubsub",!1)}},connectionManager:n(a,"connectionManager",n(u,"connectionManager",{}))},f=i(n(a,"libp2p",{}),c),h=r(985);return new h(f)}e.exports=function e(t,r){const n=t._options||{};r=r||{};const i="function"==typeof n.libp2p?n.libp2p:s,{datastore:o}=t._repo,a=t._peerInfo,u=t._peerInfoBook,e=i({options:n,config:r,datastore:o,peerInfo:a,peerBook:u});let c=[];const f=t=>{u.put(t),e.dial(t,()=>{})};return e.on("start",()=>{a.multiaddrs.forEach(e=>{t._print("Swarm listening on",e.toString())}),c.forEach(f),c=[]}),e.on("peer:discovery",e=>{t.isOnline()?f(e):c.push(e)}),e.on("peer:connect",e=>u.put(e)),e}},function(e,t,r){"use strict";const n=r(986),i=r(81),o=r(51),s=r(57).Connection,a=r(473),u=r(6),c=u("libp2p:websockets:dialer"),f=r(995);class h{dial(e,t,r){"function"==typeof t&&(r=t,t={}),r=r||function(){};const i=a(e);c("dialing %s",i);const o=n(i,{binary:!0,onConnect:e=>{r(e)}}),u=new s(o);return u.getObservedAddrs=(t=>t(null,[e])),u.close=(e=>o.close(e)),u}createListener(e,t){return"function"==typeof e&&(t=e,e={}),f(e,t)}filter(e){return Array.isArray(e)||(e=[e]),e.filter(e=>!e.protoNames().includes("p2p-circuit")&&(e.protoNames().includes("ipfs")&&(e=e.decapsulate("ipfs")),i.WebSockets.matches(e)||i.WebSocketsSecure.matches(e)))}}e.exports=o(h,{className:"WebSockets",symbolName:"@libp2p/js-libp2p-websockets/websockets"})},function(e,t,r){const n=r(21),i=(e,t)=>t,o={ip4:i,ip6:(e,t,r,n)=>1===n.length&&"ip6"===n[0].protocol?t:`[${t}]`,tcp:(e,t,r,n)=>n.some(e=>["http","https","ws","wss"].includes(e.protocol))?`${e}:${t}`:`tcp://${e}:${t}`,udp:(e,t)=>`udp://${e}:${t}`,dnsaddr:i,dns4:i,dns6:i,ipfs:(e,t)=>`${e}/ipfs/${t}`,p2p:(e,t)=>`${e}/p2p/${t}`,http:e=>`http://${e}`,https:e=>`https://${e}`,ws:e=>`ws://${e}`,wss:e=>`wss://${e}`,"p2p-websocket-star":e=>`${e}/p2p-websocket-star`,"p2p-webrtc-star":e=>`${e}/p2p-webrtc-star`,"p2p-webrtc-direct":e=>`${e}/p2p-webrtc-direct`};e.exports=(e=>n(e).stringTuples().map(e=>({protocol:n.protocols.codes[e[0]].name,content:e[1]})).reduce((e,t,r,n)=>{const i=o[t.protocol];if(!i)throw new Error(`Unsupported protocol ${t.protocol}`);return i(e,t.content,r,n)},""))},function(e,t,r){var n=r(997),i=r(299),o=r(478),s=r(223)("socket.io-client");e.exports=t=u;var a=t.managers={};function u(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var r=n(e),i=r.source,u=r.id,c=r.path,f=a[u]&&c in a[u].nsps,h=t.forceNew||t["force new connection"]||!1===t.multiplex||f,l;return h?(s("ignoring socket cache for %s",i),l=o(i,t)):(a[u]||(s("new io instance for %s",i),a[u]=o(i,t)),l=a[u]),r.query&&!t.query&&(t.query=r.query),l.socket(r.path,t)}t.protocol=i.protocol,t.connect=u,t.Manager=r(478),t.Socket=r(483)},function(e,t){var r=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,n=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function e(t){var i=t,o=t.indexOf("["),s=t.indexOf("]");-1!=o&&-1!=s&&(t=t.substring(0,o)+t.substring(o,s).replace(/:/g,";")+t.substring(s,t.length));for(var a=r.exec(t||""),u={},c=14;c--;)u[n[c]]=a[c]||"";return-1!=o&&-1!=s&&(u.source=i,u.host=u.host.substring(1,u.host.length-1).replace(/;/g,":"),u.authority=u.authority.replace("[","").replace("]","").replace(/;/g,":"),u.ipv6uri=!0),u}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){(function(t){e.exports=o;var r="function"==typeof t&&"function"==typeof t.isBuffer,n="function"==typeof ArrayBuffer,i=function(e){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer};function o(e){return r&&t.isBuffer(e)||n&&(e instanceof ArrayBuffer||i(e))}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(1004),i=r(483),o=r(135),s=r(299),a=r(484),u=r(485),c=r(223)("socket.io-client:manager"),f=r(287),h=r(1021),l=Object.prototype.hasOwnProperty;function d(e,t){if(!(this instanceof d))return new d(e,t);e&&"object"==typeof e&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new h({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var r=t.parser||s;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}e.exports=d,d.prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)l.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},d.prototype.updateSocketIds=function(){for(var e in this.nsps)l.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},d.prototype.generateId=function(e){return("/"===e?"":e+"#")+this.engine.id},o(d.prototype),d.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},d.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},d.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},d.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},d.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},d.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},d.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},d.prototype.open=d.prototype.connect=function(e,t){if(c("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;c("opening %s",this.uri),this.engine=n(this.uri,this.opts);var r=this.engine,i=this;this.readyState="opening",this.skipReconnect=!1;var o=a(r,"open",function(){i.onopen(),e&&e()}),s=a(r,"error",function(t){if(c("connect_error"),i.cleanup(),i.readyState="closed",i.emitAll("connect_error",t),e){var r=new Error("Connection error");r.data=t,e(r)}else i.maybeReconnectOnOpen()});if(!1!==this._timeout){var u=this._timeout;c("connect attempt will timeout after %d",u);var f=setTimeout(function(){c("connect attempt timed out after %d",u),o.destroy(),r.close(),r.emit("error","timeout"),i.emitAll("connect_timeout",u)},u);this.subs.push({destroy:function(){clearTimeout(f)}})}return this.subs.push(o),this.subs.push(s),this},d.prototype.onopen=function(){c("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(a(e,"data",u(this,"ondata"))),this.subs.push(a(e,"ping",u(this,"onping"))),this.subs.push(a(e,"pong",u(this,"onpong"))),this.subs.push(a(e,"error",u(this,"onerror"))),this.subs.push(a(e,"close",u(this,"onclose"))),this.subs.push(a(this.decoder,"decoded",u(this,"ondecoded")))},d.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},d.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},d.prototype.ondata=function(e){this.decoder.add(e)},d.prototype.ondecoded=function(e){this.emit("packet",e)},d.prototype.onerror=function(e){c("error",e),this.emitAll("error",e)},d.prototype.socket=function(e,t){var r=this.nsps[e];if(!r){r=new i(this,e,t),this.nsps[e]=r;var n=this;r.on("connecting",o),r.on("connect",function(){r.id=n.generateId(e)}),this.autoConnect&&o()}function o(){~f(n.connecting,r)||n.connecting.push(r)}return r},d.prototype.destroy=function(e){var t=f(this.connecting,e);~t&&this.connecting.splice(t,1),this.connecting.length||this.close()},d.prototype.packet=function(e){c("writing packet %j",e);var t=this;e.query&&0===e.type&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,function(r){for(var n=0;n0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},d.prototype.cleanup=function(){c("cleanup");for(var e=this.subs.length,t=0;t=this._reconnectionAttempts)c("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();c("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var r=setTimeout(function(){e.skipReconnect||(c("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open(function(t){t?(c("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):(c("reconnect success"),e.onreconnect())}))},t);this.subs.push({destroy:function(){clearTimeout(r)}})}},d.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)}},function(e,t,r){var n=r(300),i=r(1007),o=r(1017),s=r(1018);function a(e){var t,r=!1,s=!1,a=!1!==e.jsonp;if("undefined"!=typeof location){var u="https:"===location.protocol,c=location.port;c||(c=u?443:80),r=e.hostname!==location.hostname||c!==e.port,s=e.secure!==u}if(e.xdomain=r,e.xscheme=s,t=new n(e),"open"in t&&!e.forceJSONP)return new i(e);if(!a)throw new Error("JSONP disabled");return new o(e)}t.polling=a,t.websocket=s},function(e,t,r){var n=r(301),i=r(224),o=r(136),s=r(225),a=r(482),u=r(226)("engine.io-client:polling");e.exports=l;var c=(f=r(300),h=new f({xdomain:!1}),null!=h.responseType),f,h;function l(e){var t=e&&e.forceBase64;c&&!t||(this.supportsBinary=!1),n.call(this,e)}s(l,n),l.prototype.name="polling",l.prototype.doOpen=function(){this.poll()},l.prototype.pause=function(e){var t=this;function r(){u("paused"),t.readyState="paused",e()}if(this.readyState="pausing",this.polling||!this.writable){var n=0;this.polling&&(u("we are currently polling - waiting to pause"),n++,this.once("pollComplete",function(){u("pre-pause polling complete"),--n||r()})),this.writable||(u("we are currently writing - waiting to pause"),n++,this.once("drain",function(){u("pre-pause writing complete"),--n||r()}))}else r()},l.prototype.poll=function(){u("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},l.prototype.onData=function(e){var t=this;u("polling got data %s",e);var r=function(e,r,n){if("opening"===t.readyState&&t.onOpen(),"close"===e.type)return t.onClose(),!1;t.onPacket(e)};o.decodePayload(e,this.socket.binaryType,r),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():u('ignoring poll - transport state "%s"',this.readyState))},l.prototype.doClose=function(){var e=this;function t(){u("writing close packet"),e.write([{type:"close"}])}"open"===this.readyState?(u("transport open - closing"),t()):(u("transport not open - deferring close"),this.once("open",t))},l.prototype.write=function(e){var t=this;this.writable=!1;var r=function(){t.writable=!0,t.emit("drain")};o.encodePayload(e,this.supportsBinary,function(e){t.doWrite(e,r)})},l.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",r="";!1!==this.timestampRequests&&(e[this.timestampParam]=a()),this.supportsBinary||e.sid||(e.b64=1),e=i.encode(e),this.port&&("https"===t&&443!==Number(this.port)||"http"===t&&80!==Number(this.port))&&(r=":"+this.port),e.length&&(e="?"+e);var n=-1!==this.hostname.indexOf(":");return t+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+e}},function(e,t,r){(function(t){var n=r(1009),i=Object.prototype.toString,o="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===i.call(Blob),s="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===i.call(File);function a(e){if(!e||"object"!=typeof e)return!1;if(n(e)){for(var r=0,i=e.length;r0);return t}function f(e){var t=0;for(a=0;a0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=l(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):M(e,o)):x(e,o,t,!1))):n||(o.reading=!1));return A(o)}function x(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&B(e)),M(e,t)}function C(e,t){var r;return d(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function O(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(m("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(P,e):P(e))}function P(e){m("emit readable"),e.emit("readable"),U(e)}function M(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=z(e,t.buffer,t.decoder),r);var r}function z(e,t,r){var n;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}function K(e,t){var r=f.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),e-=s,0===e){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}function W(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(V,t,e))}function V(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function G(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return m("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?W(this):B(this),null;if(e=O(e,t),0===e&&t.ended)return 0===t.length&&W(this),null;var n=t.needReadable,i;return m("need readable",n),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&W(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var r=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,m("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,a=s?f:_;function c(e,t){m("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function f(){m("onend"),e.end()}o.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",c);var h=L(r);e.on("drain",h);var l=!1;function d(){m("cleanup"),e.removeListener("close",y),e.removeListener("finish",v),e.removeListener("drain",h),e.removeListener("error",b),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",g),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var p=!1;function g(t){m("ondata"),p=!1;var n=e.write(t);!1!==n||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==G(o.pipes,e))&&!l&&(m("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function b(t){m("onerror",t),_(),e.removeListener("error",b),0===u(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",v),_()}function v(){m("onfinish"),e.removeListener("close",y),_()}function _(){m("unpipe"),r.unpipe(e)}return r.on("data",g),w(e,"error",b),e.once("close",y),e.once("finish",v),e.emit("pipe",r),o.flowing||(m("pipe resume"),r.resume()),e},E.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?this:(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,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var c=r(5);c.inherits=r(1);var f={deprecate:r(38)},h=r(487),l=r(4).Buffer,d=n.Uint8Array||function(){};function p(e){return l.from(e)}function g(e){return l.isBuffer(e)||e instanceof d}var m=r(488),b;function y(){}function v(e,t){u=u||r(138),e=e||{};var n=t instanceof u;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||r(138),!(b.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var r=new Error("write after end");e.emit("error",r),i.nextTick(t,r)}function S(e,t,r,n){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(n,s),o=!1),o}function E(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r)),t}function k(e,t,r,n,i,o){if(!r){var s=E(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||L(this,n,r)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(2),r(8))},function(e,t,r){"use strict";e.exports=s;var n=r(138),i=r(5);function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length"string"==typeof e,object:e=>"object"==typeof e,multiaddr:e=>{if(c.string(e))try{return i(e),!0}catch(e){return!1}},function:e=>"function"==typeof e};function f(e,t){if(!Array.isArray(t))throw new Error("Data is not an array");e.forEach((e,r)=>{if(!c[e])throw console.error("Type %s does not exist",e),new Error("Type "+e+" does not exist");if(!c[e](t[r]))throw new Error("Data at index "+r+" is invalid for type "+e)})}function h(e){e||(e=(()=>{}));const t=this;t.requests={},t.addRequest=((e,r,n)=>{t.requests[e]={def:r,handle:n}}),t.handleSocket=(r=>{r.r={},Object.keys(t.requests).forEach(n=>{const i=t.requests[n];r.on(n,function(){const t=[...arguments];try{f(i.def,t),t.unshift(r),i.handle.apply(null,t)}catch(i){e(i),e("peer %s has sent invalid data for request %s",r.id||"",n,t)}})})})}function l(e,t,r){o.createFromPubKey(n.from(e,"hex"),(i,o)=>i?r(new Error("Crypto error")):o.toB58String()!==t?r(new Error("Id is not matching")):r(null,s.keys.unmarshalPublicKey(n.from(e,"hex"))))}t=e.exports,t.cleanUrlSIO=u,t.validate=f,t.Protocol=h,t.getIdAndValidate=l,t.validateMa=(e=>a.WebSocketStar.matches(i(e)))}).call(this,r(0).Buffer)},function(e,t,r){var n=r(1037),i=r(268),o=i;o.v1=n,o.v4=i,e.exports=o},function(e,t,r){"use strict";(function(t,n){var i=r(10);e.exports=E;var o=r(37),s;E.ReadableState=S;var a=r(7).EventEmitter,u=function(e,t){return e.listeners(t).length},c=r(495),f=r(4).Buffer,h=t.Uint8Array||function(){};function l(e){return f.from(e)}function d(e){return f.isBuffer(e)||e instanceof h}var p=r(5);p.inherits=r(1);var g=r(1045),m=void 0;m=g&&g.debuglog?g.debuglog("stream"):function(){};var b=r(1046),y=r(496),v;p.inherits(E,c);var _=["error","close","destroy","pause","resume"];function w(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}function S(e,t){s=s||r(139),e=e||{};var n=t instanceof s;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new b,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=r(13).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function E(e){if(s=s||r(139),!(this instanceof E))return new E(e);this._readableState=new S(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function k(e,t,r,n,i){var o=e._readableState,s;null===t?(o.reading=!1,R(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=l(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):M(e,o)):x(e,o,t,!1))):n||(o.reading=!1));return A(o)}function x(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&B(e)),M(e,t)}function C(e,t){var r;return d(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function O(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(m("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(P,e):P(e))}function P(e){m("emit readable"),e.emit("readable"),U(e)}function M(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=z(e,t.buffer,t.decoder),r);var r}function z(e,t,r){var n;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}function K(e,t){var r=f.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),e-=s,0===e){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}function W(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(V,t,e))}function V(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function G(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return m("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?W(this):B(this),null;if(e=O(e,t),0===e&&t.ended)return 0===t.length&&W(this),null;var n=t.needReadable,i;return m("need readable",n),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&W(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var r=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,m("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,a=s?f:_;function c(e,t){m("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function f(){m("onend"),e.end()}o.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",c);var h=L(r);e.on("drain",h);var l=!1;function d(){m("cleanup"),e.removeListener("close",y),e.removeListener("finish",v),e.removeListener("drain",h),e.removeListener("error",b),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",g),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var p=!1;function g(t){m("ondata"),p=!1;var n=e.write(t);!1!==n||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==G(o.pipes,e))&&!l&&(m("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function b(t){m("onerror",t),_(),e.removeListener("error",b),0===u(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",v),_()}function v(){m("onfinish"),e.removeListener("close",y),_()}function _(){m("unpipe"),r.unpipe(e)}return r.on("data",g),w(e,"error",b),e.once("close",y),e.once("finish",v),e.emit("pipe",r),o.flowing||(m("pipe resume"),r.resume()),e},E.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?this:(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,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var c=r(5);c.inherits=r(1);var f={deprecate:r(38)},h=r(495),l=r(4).Buffer,d=n.Uint8Array||function(){};function p(e){return l.from(e)}function g(e){return l.isBuffer(e)||e instanceof d}var m=r(496),b;function y(){}function v(e,t){u=u||r(139),e=e||{};var n=t instanceof u;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||r(139),!(b.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var r=new Error("write after end");e.emit("error",r),i.nextTick(t,r)}function S(e,t,r,n){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(n,s),o=!1),o}function E(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r)),t}function k(e,t,r,n,i,o){if(!r){var s=E(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||L(this,n,r)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(2),r(8))},function(e,t,r){"use strict";e.exports=s;var n=r(139),i=r(5);function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{if(t)return r(t);const i=n.toString().slice(0,-1);if(i!==e)return r(new Error(`"${e}" not supported`),u.rest());o("received ack: "+i),r(null,u.rest())}),a}e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(214),i=c(n),o=r(159),s=c(o),a=r(213),u=c(a);function c(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)((0,i.default)(Boolean,u.default)),e.exports=t.default},function(e,t,r){"use strict";function n(e,t,r){const n=e===t;r(null,n)}e.exports=n},function(e,t,r){"use strict";t=e.exports,t.PROTOCOL_ID="/multistream/1.0.0"},function(e,t,r){"use strict";const n=r(170),i=r(506),o=r(230),s=r(51),a=r(507),u=r(307),c=r(508);class f extends a{constructor({_switch:e,peerInfo:t,muxer:r,conn:i,type:o="out"}){super({_switch:e,name:`${o}:${e._peerInfo.id.toB58String().slice(0,8)}`}),this.theirPeerInfo=t,this.theirB58Id=this.theirPeerInfo.id.toB58String(),this.conn=i,this.muxer=r;let s="DISCONNECTED";this.muxer&&(s="MUXED"),this._state=n(s,{DISCONNECTED:{dial:"DIALING",disconnect:"DISCONNECTED",done:"DISCONNECTED"},DIALING:{abort:"ABORTED",done:"DIALED",error:"ERRORED",disconnect:"DISCONNECTING"},DIALED:{encrypt:"ENCRYPTING",privatize:"PRIVATIZING"},PRIVATIZING:{done:"PRIVATIZED",abort:"ABORTED",disconnect:"DISCONNECTING"},PRIVATIZED:{encrypt:"ENCRYPTING"},ENCRYPTING:{done:"ENCRYPTED",error:"ERRORED",disconnect:"DISCONNECTING"},ENCRYPTED:{upgrade:"UPGRADING",disconnect:"DISCONNECTING"},UPGRADING:{stop:"CONNECTED",done:"MUXED",error:"ERRORED"},MUXED:{disconnect:"DISCONNECTING"},CONNECTED:{disconnect:"DISCONNECTING"},DISCONNECTING:{done:"DISCONNECTED",disconnect:"DISCONNECTING"},ABORTED:{},ERRORED:{disconnect:"DISCONNECTING"}}),this._state.on("DISCONNECTED",()=>this._onDisconnected()),this._state.on("DIALING",()=>this._onDialing()),this._state.on("DIALED",()=>this._onDialed()),this._state.on("PRIVATIZING",()=>this._onPrivatizing()),this._state.on("PRIVATIZED",()=>this._onPrivatized()),this._state.on("ENCRYPTING",()=>this._onEncrypting()),this._state.on("ENCRYPTED",()=>{this.log(`successfully encrypted connection to ${this.theirB58Id}`),this.emit("encrypted",this.conn)}),this._state.on("UPGRADING",()=>this._onUpgrading()),this._state.on("MUXED",()=>{this.log(`successfully muxed connection to ${this.theirB58Id}`),delete this.switch.conns[this.theirB58Id],this.emit("muxed",this.muxer)}),this._state.on("CONNECTED",()=>{this.log(`unmuxed connection opened to ${this.theirB58Id}`),this.emit("unmuxed",this.conn)}),this._state.on("DISCONNECTING",()=>this._onDisconnecting()),this._state.on("ABORTED",()=>this._onAborted()),this._state.on("ERRORED",()=>this._onErrored()),this._state.on("error",e=>this._onStateError(e))}dial(){return this.theirB58Id===this.ourPeerInfo.id.toB58String()?this.emit("error",c.DIAL_SELF()):"DIALING"===this.getState()?this.log("attempted to dial while already dialing, ignoring"):void this._state("dial")}shake(e,t){return e?this.muxer&&this.muxer.newStream?this.muxer.newStream((r,n)=>{if(r)return t(r,null);this.log(`created new stream to ${this.theirB58Id}`),this._protocolHandshake(e,n,t)}):void this._protocolHandshake(e,this.conn,t):t(null,null)}upgrade(){this._state("upgrade")}_onDialing(){if(this.log(`dialing ${this.theirB58Id}`),!this.switch.hasTransports())return this.close(c.NO_TRANSPORTS_REGISTERED());const e=this.switch.availableTransports(this.theirPeerInfo),t=Boolean(this.switch.transports[i.tag]);let r=!1;const n=o=>{let s=o;if(!s){if(!t)return this.close(c.CONNECTION_FAILED(new Error(`Circuit not enabled and all transports failed to dial peer ${this.theirB58Id}!`)));if(r)return this.close(c.CONNECTION_FAILED(new Error(`No available transports to dial peer ${this.theirB58Id}!`)));this.log("Falling back to dialing over circuit"),this.theirPeerInfo.multiaddrs.add(`/p2p-circuit/ipfs/${this.theirB58Id}`),r=!0,s=i.tag}this.log(`dialing transport ${s}`),this.switch.transport.dial(s,this.theirPeerInfo,(t,r)=>{if(t)return this.emit("error:connection_attempt_failed",t.errors||[t]),this.log(t),n(e.shift());this.conn=u(s,null,r,this.switch.observer),this._state("done")})};n(e.shift())}_onDialed(){this.log(`successfully dialed ${this.theirB58Id}`),this.emit("connected",this.conn)}_onDisconnecting(){this.log(`disconnecting from ${this.theirB58Id}`),this.theirPeerInfo&&this.theirPeerInfo.disconnect(),this.muxer&&this.muxer.end(),this.switch.connection.remove(this),delete this.switch.conns[this.theirB58Id],delete this.muxer,this.conn?this.conn.source(!0,()=>{this._state("done"),this.switch.emit("peer-mux-closed",this.theirPeerInfo),delete this.conn}):(this._state("done"),this.switch.emit("peer-mux-closed",this.theirPeerInfo))}_onEncrypting(){const e=new o.Dialer;e.handle(this.conn,t=>{if(t)return this.close(c.maybeUnexpectedEnd(t));this.log("selecting crypto %s to %s",this.switch.crypto.tag,this.theirB58Id),e.select(this.switch.crypto.tag,(e,t)=>{if(e)return this.close(c.maybeUnexpectedEnd(e));const r=u(null,this.switch.crypto.tag,t,this.switch.observer);this.conn=this.switch.crypto.encrypt(this.ourPeerInfo.id,r,this.theirPeerInfo.id,e=>{if(e)return this.close(e);this.conn.setPeerInfo(this.theirPeerInfo),this._state("done")})})})}_onUpgrading(){const e=Object.keys(this.switch.muxers);if(this.log(`upgrading connection to ${this.theirB58Id}`),0===e.length)return this._state("stop");const t=new o.Dialer;t.handle(this.conn,r=>{if(r)return this._didUpgrade(r);const n=r=>{this.log("selecting %s",r),t.select(r,(t,i)=>{if(t)return 0===e.length?this._didUpgrade(t):n(e.shift());const o=u(null,r,i,this.switch.observer);this.muxer=this.switch.muxers[r].dialer(o),this.switch.connection.add(this),this.muxer.once("close",()=>{this.close()}),this.muxer.on("stream",e=>{this.log(`new stream created via muxer to ${this.theirB58Id}`),e.setPeerInfo(this.theirPeerInfo),this.switch.protocolMuxer(null)(e)}),this.switch.emit("peer-mux-established",this.theirPeerInfo),this._didUpgrade(null)})};n(e.shift())})}_didUpgrade(e){if(e)return this.log("Error upgrading connection:",e),this.switch.conns[this.theirB58Id]=this,this.emit("error:upgrade_failed",e),this._state("stop");this._state("done")}_protocolHandshake(e,t,r){const n=new o.Dialer;n.handle(t,t=>{if(t)return r(t,null);n.select(e,(t,n)=>{if(t)return this.log("could not perform protocol handshake: ",t),r(t,null);const i=u(null,e,n,this.switch.observer);this.log(`successfully performed handshake of ${e} to ${this.theirB58Id}`),this.emit("connection",i),r(null,i)})})}_onStateError(e){this.emit("error",c.INVALID_STATE_TRANSITION(e)),this.log(e)}}e.exports=s(f,{className:"ConnectionFSM",symbolName:"libp2p-switch/ConnectionFSM"})},function(e,t,r){"use strict";e.exports=r(1079)},function(e,t,r){"use strict";const n=r(7).EventEmitter,i=r(6),o=r(51);class s extends n{constructor({_switch:e,name:t}){super(),this.switch=e,this.ourPeerInfo=this.switch._peerInfo,this.log=i(`libp2p:conn:${t}`),this.log.error=i(`libp2p:conn:${t}:error`)}close(e){this.log(`closing connection to ${this.theirB58Id}`),e&&this._events.error&&this.emit("error",e),this._state("disconnect")}emit(e,...t){"error"!==e||this._events.error?super.emit(e,...t):this.log.error(...t)}getState(){return this._state._state}encrypt(){this._state("encrypt")}protect(){this._state("privatize")}upgrade(){this._state("upgrade")}_onDisconnected(){this.log(`disconnected from ${this.theirB58Id}`),this.emit("close"),this.removeAllListeners()}_onPrivatized(){this.log("successfully privatized incoming connection"),this.emit("private",this.conn)}_onPrivatizing(){if(!this.switch.protector)return this._state("done");this.conn=this.switch.protector.protect(this.conn,e=>{if(e)return this.close(e);this.log(`successfully privatized conn to ${this.theirB58Id}`),this.conn.setPeerInfo(this.theirPeerInfo),this._state("done")})}}e.exports=o(s,{className:"BaseConnection",symbolName:"libp2p-switch/BaseConnection"})},function(e,t,r){"use strict";const n=r(19);e.exports.PROTECTOR_REQUIRED="No protector provided with private network enforced",e.exports.CONNECTION_FAILED=(e=>n(e,"CONNECTION_FAILED")),e.exports.DIAL_SELF=(()=>n(new Error("A node cannot dial itself"),"DIAL_SELF")),e.exports.NO_TRANSPORTS_REGISTERED=(()=>n(new Error("No transports registered, dial not possible"),"NO_TRANSPORTS_REGISTERED")),e.exports.UNEXPECTED_END=(()=>n(new Error("Unexpected end of input from reader."),"UNEXPECTED_END")),e.exports.INVALID_STATE_TRANSITION=(e=>n(e,"INVALID_STATE_TRANSITION")),e.exports.maybeUnexpectedEnd=(t=>!0===t?e.exports.UNEXPECTED_END():t)},function(e,t,r){"use strict";const n=r(14);e.exports={tag:"/plaintext/1.0.0",encrypt:(e,t,r,i)=>("function"==typeof r&&(i=r,r=void 0),n(()=>i()),t)}},function(e,t,r){"use strict";const n=r(20),i=r(42),o=r(21);function s(e,t){let r;if(i.isPeerInfo(e))return e;if(o.isMultiaddr(e)){const o=e.getPeerId();try{r=t.get(o)}catch(e){r=new i(n.createFromB58String(o))}return r.multiaddrs.add(e),r}if(n.isPeerId(e)){const r=e.toB58String();try{return t.get(r)}catch(e){throw new Error("Couldnt get PeerInfo")}}throw new Error("peer type not recognized")}e.exports=s},function(e,t,r){(function(n){function i(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),r){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,n)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function u(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e}function c(){try{return window.localStorage}catch(e){}}t=e.exports=r(1104),t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:c(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(u())}).call(this,r(2))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var n=r(58),i=h(n),o=r(134),s=h(o),a=r(39),u=h(a),c=r(94),f=h(c);function h(e){return e&&e.__esModule?e:{default:e}}function l(e,t){var r=null,n;t=t||i.default,(0,s.default)(e,function(e,t){(0,u.default)(e)(function(e,i){n=arguments.length>2?(0,f.default)(arguments,1):i,r=e,t(!e)})},function(){t(r,n)})}e.exports=t.default},function(e,t,r){"use strict";const n=r(1114);function i(e){if(!(this instanceof i))return new i(e);e=e||{};const t=e.validity||30,r=new Map,s=n(()=>{r.forEach((e,n)=>{const i=e.validity||t,s=o(e.timestamp);s>i&&r.delete(n)})},200);this.put=((e,t,n)=>{this.has(e)||r.set(e,{value:t,timestamp:new Date,validity:n}),s()}),this.get=(e=>{if(r.has(e))return r.get(e).value;throw new Error("key does not exist")}),this.has=(e=>r.has(e))}function o(e){const t=new Date,r=t.getTime()-e.getTime();return Math.floor(r/1e3)}t=e.exports=i},function(e,t,r){"use strict";const n=r(7),i=r(12),o=r(96),s=r(52),a=r(513),u=r(6),c=r(19),f=r(1115),h=r(515),l=r(88);class d extends n{constructor(e,t,r){super(),this.log=u(e),this.log.err=u(`${e}:error`),this.multicodec=t,this.libp2p=r,this.started=!1,this.topics=new Map,this.seenCache=new a,this.peers=new Map,this._dials=new Set,this._onConnection=this._onConnection.bind(this),this._dialPeer=this._dialPeer.bind(this)}_addPeer(e){const t=e.info.id.toB58String();let r=this.peers.get(t);return r||(this.log("new peer",t),this.peers.set(t,e),r=e,e.once("close",()=>this._removePeer(e))),++r._references,r}_removePeer(e){const t=e.info.id.toB58String();return this.log("remove",t,e._references),0==--e._references&&(this.log("delete peer",t),this.peers.delete(t)),e}_dialPeer(e,t){t=t||function e(){};const r=e.id.toB58String(),n=this.peers.get(r);return n&&n.isConnected?l(()=>t()):this._dials.has(r)?(this.log("already dialing %s, ignoring dial attempt",r),l(()=>t())):(this._dials.add(r),this.log("dialing %s",r),void this.libp2p.dialProtocol(e,this.multicodec,(n,i)=>{this.log("dial to %s complete",r);const o=!this._dials.has(r);return this._dials.delete(r),n?(this.log.err(n),t()):o?(this.log("pubsub was stopped, not processing dial to %s",r),t()):void this._onDial(e,i,t)}))}_onDial(e,t,r){const n=e.id.toB58String();this.log("connected",n);const i=this._addPeer(new f(e));i.attachConnection(t),l(()=>r())}_onConnection(e,t){t.getPeerInfo((e,r)=>{if(e)return this.log.err("Failed to identify incomming conn",e),i(o(),t);const n=r.id.toB58String(),s=this._addPeer(new f(r));this._processConnection(n,t,s)})}_processConnection(e,t,r){throw c("_processConnection must be implemented by the subclass","ERR_NOT_IMPLEMENTED")}_onConnectionEnd(e,t,r){r&&"socket hang up"!==r.message&&this.log.err(r),this.log("connection ended",e,r?r.message:""),this._removePeer(t)}publish(e,t){throw c("publish must be implemented by the subclass","ERR_NOT_IMPLEMENTED")}subscribe(e){throw c("subscribe must be implemented by the subclass","ERR_NOT_IMPLEMENTED")}unsubscribe(e){throw c("unsubscribe must be implemented by the subclass","ERR_NOT_IMPLEMENTED")}start(e){if(this.started)return l(()=>e(new Error("already started")));this.log("starting"),this.libp2p.handle(this.multicodec,this._onConnection),this.libp2p.on("peer:connect",this._dialPeer);const t=Object.values(this.libp2p.peerBook.getAll());s(t,(e,t)=>this._dialPeer(e,t),t=>{l(()=>{this.log("started"),this.started=!0,e(t)})})}stop(e){if(!this.started)return l(()=>e(new Error("not started yet")));this.libp2p.unhandle(this.multicodec),this.libp2p.removeListener("peer:connect",this._dialPeer),this._dials=new Set,this.log("stopping"),s(this.peers.values(),(e,t)=>e.close(t),t=>{if(t)return e(t);this.log("stopped"),this.peers=new Map,this.started=!1,e()})}}e.exports=d,e.exports.message=h},function(e,t,r){"use strict";const n=r(60),i=n(r(1116)),o=n(r(1117));t=e.exports,t.rpc=i,t.td=o},function(e){e.exports={_from:"ipfs@^0.34.4",_id:"ipfs@0.34.4",_inBundle:!1,_integrity:"sha512-BhNVdWRE9lP+D/DfAI4L3rtIFg3trxpkEbCELBA7+mLi5ZkVnNpsOvvlcn3eJdufwqBj0/9x2xbOP1YQzZfEKg==",_location:"/ipfs",_phantomChildren:{},_requested:{type:"range",registry:!0,raw:"ipfs@^0.34.4",name:"ipfs",escapedName:"ipfs",rawSpec:"^0.34.4",saveSpec:null,fetchSpec:"^0.34.4"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/ipfs/-/ipfs-0.34.4.tgz",_shasum:"325705ae17ebb606d7d9cb2223c7606a806c6085",_spec:"ipfs@^0.34.4",_where:"/Users/mitra/git/dweb-transports",bin:{jsipfs:"src/cli/bin.js"},browser:{"./src/core/components/init-assets.js":!1,"./src/core/runtime/add-from-fs-nodejs.js":"./src/core/runtime/add-from-fs-browser.js","./src/core/runtime/config-nodejs.js":"./src/core/runtime/config-browser.js","./src/core/runtime/dns-nodejs.js":"./src/core/runtime/dns-browser.js","./src/core/runtime/fetch-nodejs.js":"./src/core/runtime/fetch-browser.js","./src/core/runtime/libp2p-nodejs.js":"./src/core/runtime/libp2p-browser.js","./src/core/runtime/preload-nodejs.js":"./src/core/runtime/preload-browser.js","./src/core/runtime/repo-nodejs.js":"./src/core/runtime/repo-browser.js","./test/utils/create-repo-nodejs.js":"./test/utils/create-repo-browser.js",stream:"readable-stream",joi:"joi-browser"},bugs:{url:"https://github.com/ipfs/js-ipfs/issues"},bundleDependencies:!1,contributors:[{name:"0xflotus",email:"0xflotus@gmail.com"},{name:"A_A",email:"21040751+Otto-AA@users.noreply.github.com"},{name:"Alan Shaw",email:"alan.shaw@protocol.ai"},{name:"Alan Shaw",email:"alan@tableflip.io"},{name:"Alex North",email:"alex@alexnorth.me"},{name:"Alex Potsides",email:"alex@achingbrain.net"},{name:"Andrew de Andrade",email:"andrew@deandrade.com.br"},{name:"André Cruz",email:"andremiguelcruz@msn.com"},{name:"Arkadiy Kukarkin",email:"parkan@users.noreply.github.com"},{name:"Arpit Agarwal",email:"93arpit@gmail.com"},{name:"Arpit Agarwal",email:"atvanguard@users.noreply.github.com"},{name:"Bernard Mordan",email:"bernard@tableflip.io"},{name:"Brian Vander Schaaf",email:"bvs330@gmail.com"},{name:"Bruno Zell",email:"bruno.zzell@gmail.com"},{name:"CHEVALAY JOSSELIN",email:"josselin54.chevalay@gmail.com"},{name:"Caio Gondim",email:"me@caiogondim.com"},{name:"Chance Hudson",email:"jchancehud@gmail.com"},{name:"Christian Couder",email:"chriscool@tuxfamily.org"},{name:"Dafeng",email:"dfguo.joe@gmail.com"},{name:"Dan Ordille",email:"dordille@gmail.com"},{name:"Daniel J. O'Quinn",email:"danieljoquinn@gmail.com"},{name:"Daniela Borges Matos de Carvalho",email:"alunassertiva@gmail.com"},{name:"David Dias",email:"daviddias.p@gmail.com"},{name:"David Gilbertson",email:"gilbertson.david@gmail.com"},{name:"David da Silva",email:"dasilvacontin@gmail.com"},{name:"Diogo Silva",email:"fsdiogo@gmail.com"},{name:"Dmitriy Ryajov",email:"dryajov@gmail.com"},{name:"Dzmitry Das",email:"dbachko@gmail.com"},{name:"Enrico Marino",email:"enrico.marino@email.com"},{name:"Faheel Ahmad",email:"faheel@live.in"},{name:"Felix Yan",email:"felixonmars@archlinux.org"},{name:"Francisco Baio Dias",email:"xicombd@gmail.com"},{name:"Francisco Baio Dias",email:"francisco@typeform.com"},{name:"Friedel Ziegelmayer",email:"dignifiedquire@gmail.com"},{name:"Gar",email:"gar+gh@danger.computer"},{name:"Georgios Rassias",email:"georassias@gmail.com"},{name:"Gorka Ludlow",email:"gorka@aquigorka.com"},{name:"Greenkeeper",email:"support@greenkeeper.io"},{name:"Haad",email:"haadcode@users.noreply.github.com"},{name:"Haoliang Yu",email:"haoliangyu@users.noreply.github.com"},{name:"Harsh Vakharia",email:"harshjv@users.noreply.github.com"},{name:"Henrique Dias",email:"hacdias@gmail.com"},{name:"Henry Rodrick",email:"moshisushi@gmail.com"},{name:"Heo Sangmin",email:"heo@mapiacompany.com"},{name:"Hugo Dias",email:"mail@hugodias.me"},{name:"Hugo Dias",email:"hugomrdias@gmail.com"},{name:"Jacob Heun",email:"jacobheun@gmail.com"},{name:"Jacob Heun",email:"jake@andyet.net"},{name:"Jade Meskill",email:"jade.meskill@gmail.com"},{name:"Johannes Wikner",email:"johannes.wikner@gmail.com"},{name:"Jon Schlinkert",email:"dev@sellside.com"},{name:"Jonathan",email:"jkrone@vt.edu"},{name:"João Antunes",email:"j.goncalo.antunes@gmail.com"},{name:"João Santos",email:"joaosantos15@users.noreply.github.com"},{name:"Kevin Wang",email:"kevin@fossa.io"},{name:"Lars Gierth",email:"larsg@systemli.org"},{name:"Lukas Drgon",email:"lukas.drgon@gmail.com"},{name:"Maciej Krüger",email:"mkg20001@gmail.com"},{name:"Marcin Rataj",email:"lidel@lidel.org"},{name:"Marius Darila",email:"marius.darila@gmail.com"},{name:"Mat Kelly",email:"machawk1@gmail.com"},{name:"Michelle Lee",email:"michelle@protocol.ai"},{name:"Mikeal Rogers",email:"mikeal.rogers@gmail.com"},{name:"Mithgol",email:"getgit@mithgol.ru"},{name:"Molly",email:"momack2@users.noreply.github.com"},{name:"My9Bot",email:"34904312+My9Bot@users.noreply.github.com"},{name:"Nuno Nogueira",email:"nunofmn@gmail.com"},{name:"Oli Evans",email:"oli@tableflip.io"},{name:"Oskar Nyberg",email:"oskar@oskarnyberg.com"},{name:"Pascal Precht",email:"pascal.precht@googlemail.com"},{name:"Pau Ramon Revilla",email:"masylum@gmail.com"},{name:"Paulo Rodrigues",email:"me@paulogr.com"},{name:"Pedro Teixeira",email:"i@pgte.me"},{name:"Portia Burton",email:"plburton@gmail.com"},{name:"Raoul Millais",email:"raoul@raoulmillais.com"},{name:"RasmusErik Voel Jensen",email:"github@solsort.com"},{name:"Richard Littauer",email:"richard.littauer@gmail.com"},{name:"Richard Schneider",email:"makaretu@gmail.com"},{name:"Rob Brackett",email:"rob@robbrackett.com"},{name:"Rod Keys",email:"rod@zokos.com"},{name:"Sangwon Hong",email:"qpakzk@gmail.com"},{name:"Sid Harder",email:"sideharder@gmail.com"},{name:"SidHarder",email:"softwarenavigator@gmail.com"},{name:"Stephen Whitmore",email:"stephen.whitmore@gmail.com"},{name:"Stephen Whitmore",email:"noffle@users.noreply.github.com"},{name:"Terence Pae",email:"terencepae@gmail.com"},{name:"Uroš Jurglič",email:"jurglic@gmail.com"},{name:"Vasco Santos",email:"vasco.santos@ua.pt"},{name:"Vasco Santos",email:"vasco.santos@moxy.studio"},{name:"Volker Mische",email:"volker.mische@gmail.com"},{name:"Xiao Liang",email:"yxliang01@users.noreply.github.com"},{name:"Yahya",email:"ya7yaz@gmail.com"},{name:"Yole",email:"yole@ultiledger.io"},{name:"bitspill",email:"bitspill+github@bitspill.net"},{name:"datafatmunger",email:"jbg@peerparty.org"},{name:"haad",email:"haad@headbanggames.com"},{name:"jbenet",email:"juan@benet.ai"},{name:"jonahweissman",email:"19804455+jonahweissman@users.noreply.github.com"},{name:"kevingzhang",email:"kevin.zhang.canada@gmail.com"},{name:"kumavis",email:"kumavis@users.noreply.github.com"},{name:"nginnever",email:"ginneversource@gmail.com"},{name:"npmcdn-to-unpkg-bot",email:"npmcdn-to-unpkg-bot@users.noreply.github.com"},{name:"robbsolter",email:"35879806+robbsolter@users.noreply.github.com"},{name:"seungwon-kang",email:"ksw3894@gmail.com"},{name:"tcme",email:"hi@this-connect.me"},{name:"victorbjelkholm",email:"victorbjelkholm@gmail.com"},{name:"Łukasz Magiera",email:"magik6k@users.noreply.github.com"},{name:"Максим Ильин",email:"negamaxi@gmail.com"}],dependencies:{"@nodeutils/defaults-deep":"^1.1.0",async:"^2.6.1","bignumber.js":"^8.0.2","binary-querystring":"~0.1.2",bl:"^2.1.2",boom:"^7.2.0",bs58:"^4.0.1",byteman:"^1.3.5","cid-tool":"~0.2.0",cids:"~0.5.5","class-is":"^1.1.0","datastore-core":"~0.6.0","datastore-pubsub":"~0.1.1",debug:"^4.1.0","err-code":"^1.1.2","file-type":"^10.2.0",fnv1a:"^1.0.1","fsm-event":"^2.1.0","get-folder-size":"^2.0.0",glob:"^7.1.3",hapi:"^16.6.2","hapi-set-header":"^1.0.2",hoek:"^6.1.2","human-to-milliseconds":"^1.0.0","interface-datastore":"~0.6.0","ipfs-bitswap":"~0.22.0","ipfs-block":"~0.8.0","ipfs-block-service":"~0.15.1","ipfs-http-client":"^29.0.0","ipfs-http-response":"~0.2.1","ipfs-mfs":"~0.8.0","ipfs-multipart":"~0.1.0","ipfs-repo":"~0.26.1","ipfs-unixfs":"~0.1.16","ipfs-unixfs-engine":"~0.35.3",ipld:"~0.20.1","ipld-bitcoin":"~0.1.8","ipld-dag-pb":"~0.15.0","ipld-ethereum":"^2.0.1","ipld-git":"~0.2.2","ipld-zcash":"~0.1.6",ipns:"~0.5.0","is-ipfs":"~0.4.8","is-pull-stream":"~0.0.0","is-stream":"^1.1.0",joi:"^14.3.0","joi-browser":"^13.4.0","joi-multiaddr":"^4.0.0",libp2p:"~0.24.1","libp2p-bootstrap":"~0.9.3","libp2p-crypto":"~0.16.0","libp2p-kad-dht":"~0.14.4","libp2p-keychain":"~0.3.3","libp2p-mdns":"~0.12.0","libp2p-mplex":"~0.8.4","libp2p-record":"~0.6.1","libp2p-secio":"~0.11.0","libp2p-tcp":"~0.13.0","libp2p-webrtc-star":"~0.15.5","libp2p-websocket-star-multi":"~0.4.0","libp2p-websockets":"~0.12.0",lodash:"^4.17.11",mafmt:"^6.0.2","mime-types":"^2.1.21",mkdirp:"~0.5.1",multiaddr:"^6.0.0","multiaddr-to-uri":"^4.0.0",multibase:"~0.6.0",multihashes:"~0.4.14","multihashing-async":"~0.5.1","node-fetch":"^2.3.0",once:"^1.4.0","peer-book":"~0.9.0","peer-id":"~0.12.0","peer-info":"~0.15.0",progress:"^2.0.1","prom-client":"^11.1.3","prometheus-gc-stats":"~0.6.0","promisify-es6":"^1.0.3",protons:"^1.0.1","pull-abortable":"^4.1.1","pull-cat":"^1.1.11","pull-defer":"~0.2.3","pull-file":"^1.1.0","pull-ndjson":"~0.1.1","pull-pushable":"^2.2.0","pull-sort":"^1.0.1","pull-stream":"^3.6.9","pull-stream-to-stream":"^1.3.4",pump:"^3.0.0","read-pkg-up":"^4.0.0","readable-stream":"^3.1.1",receptacle:"^1.3.2","stream-to-pull-stream":"^1.7.2","tar-stream":"^1.6.2",temp:"~0.9.0","update-notifier":"^2.5.0",varint:"^5.0.0",yargs:"^12.0.5","yargs-promise":"^1.1.0"},deprecated:!1,description:"JavaScript implementation of the IPFS specification",devDependencies:{aegir:"^18.0.3",chai:"^4.2.0",delay:"^4.1.0","detect-node":"^2.0.4","dir-compare":"^1.4.0","dirty-chai":"^2.0.1",execa:"^1.0.0","form-data":"^2.3.3",hat:"0.0.3","interface-ipfs-core":"~0.96.0","ipfsd-ctl":"~0.40.1",ncp:"^2.0.0",qs:"^6.5.2",rimraf:"^2.6.2",sinon:"^7.1.1","stream-to-promise":"^2.2.0"},engines:{node:">=10.0.0",npm:">=6.0.0"},homepage:"https://github.com/ipfs/js-ipfs#readme",keywords:["IPFS"],leadMaintainer:"Alan Shaw ",license:"MIT",main:"src/core/index.js",name:"ipfs",optionalDependencies:{"prom-client":"^11.1.3","prometheus-gc-stats":"~0.6.0"},repository:{type:"git",url:"git+https://github.com/ipfs/js-ipfs.git"},scripts:{benchmark:'echo "Error: no benchmarks yet" && exit 1',"benchmark:browser":'echo "Error: no benchmarks yet" && exit 1',"benchmark:node":'echo "Error: no benchmarks yet" && exit 1',"benchmark:node:core":'echo "Error: no benchmarks yet" && exit 1',"benchmark:node:http":'echo "Error: no benchmarks yet" && exit 1',build:"aegir build",coverage:"aegir coverage","coverage-publish":"aegir-coverage publish","dep-check":"npx dependency-check package.json './test/**/*.js' './src/**/*.js'",lint:"aegir lint",release:"aegir release -t node -t browser","release-major":"aegir release --type major -t node -t browser","release-minor":"aegir release --type minor -t node -t browser",test:"aegir test -t node -t browser -t webworker --no-cors --timeout=10000","test:bootstrapers":"IPFS_TEST=bootstrapers aegir test -t browser -f test/bootstrapers.js --timeout=10000","test:browser":"aegir test -t browser --no-cors --timeout=10000","test:node":"aegir test -t node --timeout=10000","test:node:cli":"aegir test -t node -f test/cli/index.js --timeout=10000","test:node:core":"aegir test -t node -f test/core/**/*.js --timeout=10000","test:node:gateway":"aegir test -t node -f test/gateway/index.js --timeout=10000","test:node:http":"aegir test -t node -f test/http-api/index.js --timeout=10000","test:node:interface":"aegir test -t node -f test/core/interface.spec.js --timeout=10000","test:webworker":"aegir test -t webworker --no-cors --timeout=10000"},version:"0.34.4"}},function(e,t,r){"use strict";const n=r(3),i=r(198).repoVersion;e.exports=function e(t){return{init:(e,t,r)=>{},version:n(e=>{t._repo._isInitialized(r=>{if(r){const t=[/Key not found in database \[\/version\]/,/ENOENT/,/repo is not initialized yet/].some(e=>e.test(r.message));return t?e(null,i):e(r)}t._repo.version.get(e)})}),gc:n((e,t)=>{"function"==typeof e&&(t=e,e={}),t(new Error("Not implemented"))}),stat:n((e,r)=>{"function"==typeof e&&(r=e,e={}),t._repo.stat(e,(e,t)=>{if(e)return r(e);r(null,{numObjects:t.numObjects,repoSize:t.repoSize,repoPath:t.repoPath,version:t.version.toString(),storageMax:t.storageMax})})}),path:()=>t._repo.path}}},function(e,t,r){"use strict";e.exports=(()=>({Addresses:{Swarm:[],API:"",Gateway:""},Discovery:{MDNS:{Enabled:!1,Interval:10},webRTCStar:{Enabled:!0}},Bootstrap:["/dns4/ams-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd","/dns4/lon-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3","/dns4/sfo-3.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM","/dns4/sgp-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu","/dns4/nyc-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm","/dns4/nyc-2.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64","/dns4/node0.preload.ipfs.io/tcp/443/wss/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic","/dns4/node1.preload.ipfs.io/tcp/443/wss/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6"]}))},function(e,t){function r(e,t){for(var r=-1,n=t.length,i=e.length;++r{"function"==typeof n&&(c=n,n={}),n=n||{};const f=e=>t.isBuffer(e)||s.readable(e)||a(e),h=e=>"object"==typeof e&&(e.content?f(e.content):Boolean(e.path)&&u(e.path)),l=e=>f(e)||h(e),d=l(r)||Array.isArray(r)&&r.every(l);if(!d)return c(new Error("invalid input: expected buffer, readable stream, pull stream, object or array of objects"));i(i.values([r]),e.addPullStream(n),o((e,t)=>e.patht.path?-1:0),i.collect(c))});return function(){const e=Array.from(arguments);return 1===e.length&&a(e[0])&&e.push({}),r.apply(null,e)}}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(122),i=r(65),o=r(124),s="[object String]";function a(e){return"string"==typeof e||!i(e)&&o(e)&&n(e)==s}e.exports=a},function(e,t,r){"use strict";e.exports=r(1158)},function(e,t){e.exports=function(e){var t,r,n;function i(e){return r=e,function(e,i){n?t=[e,i]:r(e,i)}}return i.pause=function(){n||(n=!0,e&&e(n))},i.resume=function(){if(n&&(n=!1,e&&e(n),t)){var i=t;t=null,r(i[0],i[1])}},i}},function(e,t,r){"use strict";var n=r(1182).Duplex,i=r(53),o=r(4).Buffer;function s(e){if(!(this instanceof s))return new s(e);if(this._bufs=[],this.length=0,"function"==typeof e){this._callback=e;var t=function e(t){this._callback&&(this._callback(t),this._callback=null)}.bind(this);this.on("pipe",function e(r){r.on("error",t)}),this.on("unpipe",function e(r){r.removeListener("error",t)})}else this.append(e);n.call(this)}i.inherits(s,n),s.prototype._offset=function e(t){var r=0,n=0,i;if(0===t)return[0,0];for(;nthis.length||t<0)){var r=this._offset(t);return this._bufs[r[0]][r[1]]}},s.prototype.slice=function e(t,r){return"number"==typeof t&&t<0&&(t+=this.length),"number"==typeof r&&r<0&&(r+=this.length),this.copy(null,0,t,r)},s.prototype.copy=function e(t,r,n,i){if(("number"!=typeof n||n<0)&&(n=0),("number"!=typeof i||i>this.length)&&(i=this.length),n>=this.length)return t||o.alloc(0);if(i<=0)return t||o.alloc(0);var e=!!t,s=this._offset(n),a=i-n,u=a,c=e&&r||0,f=s[1],h,l;if(0===n&&i==this.length){if(!e)return 1===this._bufs.length?this._bufs[0]:o.concat(this._bufs,this.length);for(l=0;lh)){this._bufs[l].copy(t,c,f,f+u);break}this._bufs[l].copy(t,c,f),c+=h,u-=h,f&&(f=0)}return t},s.prototype.shallowSlice=function e(t,r){if(t=t||0,r="number"!=typeof r?this.length:r,t<0&&(t+=this.length),r<0&&(r+=this.length),t===r)return new s;var n=this._offset(t),i=this._offset(r),o=this._bufs.slice(n[0],i[0]+1);return 0==i[1]?o.pop():o[o.length-1]=o[o.length-1].slice(0,i[1]),0!=n[1]&&(o[0]=o[0].slice(n[1])),new s(o)},s.prototype.toString=function e(t,r,n){return this.slice(r,n).toString(t)},s.prototype.consume=function e(t){for(;this._bufs.length;){if(!(t>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(t),this.length-=t;break}t-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},s.prototype.duplicate=function e(){for(var t=0,r=new s;tthis.length?this.length:t;for(var n=this._offset(t),i=n[0],a=n[1];i=e.length){var f=u.indexOf(e,a);if(-1!==f)return this._reverseOffset([i,f]);a=u.length-e.length+1}else{var h=this._reverseOffset([i,a]);if(this._match(h,e))return h;a++}}a=0}return-1},s.prototype._match=function(e,t){if(this.length-e0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=l(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):M(e,o)):x(e,o,t,!1))):n||(o.reading=!1));return A(o)}function x(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&B(e)),M(e,t)}function C(e,t){var r;return d(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function O(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(m("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(P,e):P(e))}function P(e){m("emit readable"),e.emit("readable"),U(e)}function M(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=z(e,t.buffer,t.decoder),r);var r}function z(e,t,r){var n;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}function K(e,t){var r=f.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),e-=s,0===e){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}function W(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(V,t,e))}function V(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function G(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return m("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?W(this):B(this),null;if(e=O(e,t),0===e&&t.ended)return 0===t.length&&W(this),null;var n=t.needReadable,i;return m("need readable",n),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&W(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var r=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,m("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,a=s?f:_;function c(e,t){m("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function f(){m("onend"),e.end()}o.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",c);var h=L(r);e.on("drain",h);var l=!1;function d(){m("cleanup"),e.removeListener("close",y),e.removeListener("finish",v),e.removeListener("drain",h),e.removeListener("error",b),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",g),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var p=!1;function g(t){m("ondata"),p=!1;var n=e.write(t);!1!==n||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==G(o.pipes,e))&&!l&&(m("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function b(t){m("onerror",t),_(),e.removeListener("error",b),0===u(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",v),_()}function v(){m("onfinish"),e.removeListener("close",y),_()}function _(){m("unpipe"),r.unpipe(e)}return r.on("data",g),w(e,"error",b),e.once("close",y),e.once("finish",v),e.emit("pipe",r),o.flowing||(m("pipe resume"),r.resume()),e},E.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?this:(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,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var c=r(5);c.inherits=r(1);var f={deprecate:r(38)},h=r(527),l=r(4).Buffer,d=n.Uint8Array||function(){};function p(e){return l.from(e)}function g(e){return l.isBuffer(e)||e instanceof d}var m=r(528),b;function y(){}function v(e,t){u=u||r(141),e=e||{};var n=t instanceof u;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||r(141),!(b.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var r=new Error("write after end");e.emit("error",r),i.nextTick(t,r)}function S(e,t,r,n){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(n,s),o=!1),o}function E(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r)),t}function k(e,t,r,n,i,o){if(!r){var s=E(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||L(this,n,r)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(2),r(8))},function(e,t,r){"use strict";e.exports=s;var n=r(141),i=r(5);function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length=a||o=n&&o=n&&i{if(t=Object.assign({},d,t),!t.parentCid)return r(new Error("No parent CID passed to addLink"));if(!o.isCID(t.parentCid))return r(new Error("Invalid CID passed to addLink"));if(!t.parent)return c("Loading parent node",t.parentCid.toBaseEncodedString()),s([r=>e.ipld.get(t.parentCid,r),(e,t)=>t(null,e.value),(r,n)=>p(e,{...t,parent:r},n)],r);if(!t.cid)return r(new Error("No child cid passed to addLink"));if(!t.name)return r(new Error("No child name passed to addLink"));if(o.isCID(t.cid)||(t.cid=new o(t.cid)),!t.size&&0!==t.size)return r(new Error("No child size passed to addLink"));const n=f.unmarshal(t.parent.data);return"hamt-sharded-directory"===n.type?(c("Adding link to sharded directory"),b(e,t,r)):t.parent.links.length>=t.shardSplitThreshold?(c("Converting directory to sharded directory"),g(e,t,r)):(c(`Adding ${t.name} to regular directory`),void m(e,t,r))},g=(e,t,r)=>{v(e,t.parent.links.map(e=>({name:e.name,size:e.size,multihash:e.cid.buffer})).concat({name:t.name,size:t.size,multihash:t.cid.buffer}),{},(e,t)=>{e||c("Converted directory to sharded directory",t.cid.toBaseEncodedString()),r(e,t)})},m=(e,t,r)=>{s([e=>n.rmLink(t.parent,t.name,e),(e,r)=>n.addLink(e,new i(t.name,t.size,t.cid),r),(r,n)=>{e.ipld.put(r,{version:t.cidVersion,format:t.codec,hashAlg:t.hashAlg,hashOnly:!t.flush},(e,t)=>n(e,{node:r,cid:t}))}],r)},b=(e,t,r)=>s([r=>h(e,t.name,t.parent,r),({rootBucket:r,path:n},i)=>{y(e,n,{name:t.name,cid:t.cid,size:t.size},t,(e,t={})=>i(e,{rootBucket:r,...t}))},({rootBucket:r,node:n},i)=>l(e,n.links,r,t,i)],r),y=(e,t,r,n,i)=>{const{bucket:o,prefix:a,node:u}=t.pop(),f=u.links.find(e=>e.name.substring(0,2)===a&&e.name!==`${a}${r.name}`);return s([i=>f&&f.name.length>2?(c(`Converting existing file ${f.name} into sub-shard for ${r.name}`),s([t=>v(e,[{name:f.name.substring(2),size:f.size,multihash:f.cid.buffer},{name:r.name,size:r.size,multihash:r.cid.buffer}],{},t),({node:{links:[t]}},r)=>e.ipld.get(t.cid,(e,n)=>{r(e,{cid:t.cid,node:n&&n.value})}),(t,r)=>_(e,o,u,f.name,t.node,t.cid,a,n,r)],i)):f&&2===f.name.length?(c(`Descending into sub-shard ${f.name} for ${r.name}`),s([i=>y(e,t,r,n,i),(t,r)=>_(e,o,u,f.name,t.node,t.cid,a,n,r)],i)):(c("Adding or replacing file",a+r.name),void _(e,o,u,a+r.name,r,r.cid,a+r.name,n,i))],i)},v=(e,t,r,n)=>{const i=new a({root:!0,dir:!0,parent:null,parentKey:null,path:"",dirty:!0,flat:!1,...r}),o=t.map(e=>t=>{i.put(e.name,{size:e.size,multihash:e.multihash},t)});return u(o,t=>{if(t)return n(t);i.flush("",e.ipld,null,n)})},_=(e,t,r,o,a,u,c,f,h)=>{s([e=>n.rmLink(r,o,e),(e,t)=>n.addLink(e,new i(c,a.size,u),t),(r,n)=>l(e,r.links,t,f,n)],h)};e.exports=p},function(e,t,r){"use strict";(function(t){const{DAGNode:n}=r(32),i=r(11),o=r(203),s=r(312),a=r(235),u=r(6)("ipfs:mfs:core:utils:hamt-utils"),c=r(44),f=(e,r,o,s,u)=>{i([e=>{const i=t.from(o._children.bitField().reverse()),s=new c("hamt-sharded-directory",i);s.fanout=o.tableSize(),s.hashType=a.hashFn.code,n.create(s.marshal(),r,e)},(t,r)=>{e.ipld.put(t,{version:s.cidVersion,format:s.codec,hashAlg:s.hashAlg,hashOnly:!s.flush},(e,n)=>r(e,{node:t,cid:n}))}],u)},h=(e,t,r,n,i)=>{const o=new s({hashFn:a.hashFn,hash:r?r._options.hash:void 0},r,n);r&&r._putObjectAt(n,o),l(e,o,t,i)},l=(e,t,r,n)=>{Promise.all(e.map(e=>{if(2===e.name.length){const r=parseInt(e.name,16);return t._putObjectAt(r,new s({hashFn:a.hashFn},t,r)),Promise.resolve()}return(r||t).put(e.name.substring(2),!0)})).catch(e=>{n(e),n=null}).then(()=>n&&n(null,t))},d=e=>e.toString("16").toUpperCase().padStart(2,"0").substring(0,2),p=(e,t,r,n)=>{h(r.links,null,null,null,async(i,s)=>{if(i)return n(i);const a=await s._findNewBucketAndPos(t);let c=[{bucket:a.bucket,prefix:d(a.pos)}],f=a.bucket;for(;f!==s;)c.push({bucket:f,prefix:d(f._posAtParent)}),f=f._parent;c[c.length-1].node=r;let p=c.length;o(()=>p>0,r=>{p--;const n=c[p],i=n.node.links.filter(e=>e.name.substring(0,2)===n.prefix).pop();return i?i.name===`${n.prefix}${t}`?(u(`Link ${n.prefix}${t} will be replaced`),r(null,c)):(u(`Found subshard ${n.prefix}`),void e.ipld.get(i.cid,(e,i)=>{if(e)return r(e);if(!c[p-1]){u(`Loaded new subshard ${n.prefix}`);const e=i.value;return h(e.links,s,n.bucket,parseInt(n.prefix,16),async(n,i)=>{if(n)return r(n);const o=await s._findNewBucketAndPos(t);p++,c.unshift({bucket:o.bucket,prefix:d(o.pos),node:e}),r()})}const o=c[p-1];l(i.value.links,o.bucket,s,e=>{o.node=i.value,r(e)})})):(u(`Link ${n.prefix}${t} will be added`),r(null,c))},async(e,r)=>{await s.put(t,!0),n(e,{rootBucket:s,path:r})})})};e.exports={generatePath:p,updateHamtDirectory:f,recreateHamtLevel:h,addLinksToHamtBucket:l,toPrefix:d}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports=r(1212)},function(e,t){e.exports={WORKER_REQUEST_READ_LOCK:"lock:worker:request-read",WORKER_RELEASE_READ_LOCK:"lock:worker:release-read",MASTER_GRANT_READ_LOCK:"lock:master:grant-read",WORKER_REQUEST_WRITE_LOCK:"lock:worker:request-write",WORKER_RELEASE_WRITE_LOCK:"lock:worker:release-write",MASTER_GRANT_WRITE_LOCK:"lock:master:grant-write"}},function(e,t){const r={},n=e=>{e.addEventListener("message",t=>{n.dispatchEvent("message",e,t)}),e.port&&e.port.addEventListener("message",t=>{n.dispatchEvent("message",e,t)})};n.addEventListener=((e,t)=>{r[e]||(r[e]=[]),r[e].push(t)}),n.removeEventListener=((e,t)=>{r[e]&&(r[e]=r[e].filter(e=>e===t))}),n.dispatchEvent=function(){const e=Array.prototype.slice.call(arguments),t=e.shift();r[t]&&r[t].forEach(t=>t.apply(null,e))},e.exports=n},function(e,t,r){"use strict";const{FILE_SEPARATOR:n}=r(237),i=r(538),o=r(11),s=r(47),a=r(313),u="ipfs",c=(e,t,r)=>{let u=Array.isArray(t);const c=Array.isArray(t)?t:[t];o([t=>{s({paths:e=>{let t;try{t=c.map(e=>{if(e=(e||"").trim(),e=e.replace(/(\/\/+)/g,"/"),!e)throw new Error("paths must not be empty");if(e.substring(0,1)!==n)throw new Error(`paths must start with a leading ${n}`);return e.substring(e.length-n.length)===n&&(e=e.substring(0,e.length-n.length)),a(e)})}catch(t){return e(t)}e(null,t)},root:t=>i(e,t)},t)},({paths:e,root:t},r)=>{r(null,e.map(e=>{if("ipfs"===e[0]){let r;return r=2===e.length?`${n}${e.join(n)}`:`${n}${e.slice(0,e.length-1).join(n)}`,{type:"ipfs",depth:e.length-2,mfsPath:`${n}${e.join(n)}`,mfsDirectory:r,root:t,parts:e,path:`${n}${e.join(n)}`,name:e[e.length-1]}}const r=`/ipfs/${t.toBaseEncodedString()}/${e.join(n)}`,i=`/ipfs/${t.toBaseEncodedString()}/${e.slice(0,e.length-1).join(n)}`;return{type:"mfs",depth:e.length,mfsDirectory:i,mfsPath:r,root:t,parts:e,path:`${n}${e.join(n)}`,name:e[e.length-1]}}))},(e,t)=>{if(u)return t(null,e);t(null,e[0])}],r)};e.exports=c},function(e,t,r){"use strict";const n=r(9),i=r(44),{DAGNode:o}=r(32),s=r(6)("ipfs:mfs:utils:with-mfs-root"),a=r(11),{MFS_ROOT_KEY:u}=r(237),c=(e,t)=>{a([t=>e.repo.datastore.open(e=>t(e)),t=>{e.repo.datastore.get(u,(r,c)=>{if(r&&(r.notFound||"ERR_NOT_FOUND"===r.code))return s("Creating new MFS root"),a([e=>o.create(new i("directory").marshal(),e),(t,r)=>e.ipld.put(t,{version:0,hashAlg:"sha2-256",format:"dag-pb"},r),(t,r)=>e.repo.datastore.put(u,t.buffer,e=>r(e,t))],t);t(r,c?new n(c):null)})},(e,t)=>{s(`Fetched MFS root ${e.toBaseEncodedString()}`),t(null,e)}],t)};e.exports=c},function(e,t,r){"use strict";(function(t,n){var i=r(10);e.exports=E;var o=r(37),s;E.ReadableState=S;var a=r(7).EventEmitter,u=function(e,t){return e.listeners(t).length},c=r(540),f=r(4).Buffer,h=t.Uint8Array||function(){};function l(e){return f.from(e)}function d(e){return f.isBuffer(e)||e instanceof h}var p=r(5);p.inherits=r(1);var g=r(1233),m=void 0;m=g&&g.debuglog?g.debuglog("stream"):function(){};var b=r(1234),y=r(541),v;p.inherits(E,c);var _=["error","close","destroy","pause","resume"];function w(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}function S(e,t){s=s||r(142),e=e||{};var n=t instanceof s;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new b,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=r(13).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function E(e){if(s=s||r(142),!(this instanceof E))return new E(e);this._readableState=new S(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function k(e,t,r,n,i){var o=e._readableState,s;null===t?(o.reading=!1,R(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=l(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):M(e,o)):x(e,o,t,!1))):n||(o.reading=!1));return A(o)}function x(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&B(e)),M(e,t)}function C(e,t){var r;return d(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function O(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(m("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(P,e):P(e))}function P(e){m("emit readable"),e.emit("readable"),U(e)}function M(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=z(e,t.buffer,t.decoder),r);var r}function z(e,t,r){var n;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}function K(e,t){var r=f.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),e-=s,0===e){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}function W(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(V,t,e))}function V(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function G(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return m("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?W(this):B(this),null;if(e=O(e,t),0===e&&t.ended)return 0===t.length&&W(this),null;var n=t.needReadable,i;return m("need readable",n),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&W(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var r=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,m("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,a=s?f:_;function c(e,t){m("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function f(){m("onend"),e.end()}o.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",c);var h=L(r);e.on("drain",h);var l=!1;function d(){m("cleanup"),e.removeListener("close",y),e.removeListener("finish",v),e.removeListener("drain",h),e.removeListener("error",b),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",g),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var p=!1;function g(t){m("ondata"),p=!1;var n=e.write(t);!1!==n||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==G(o.pipes,e))&&!l&&(m("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function b(t){m("onerror",t),_(),e.removeListener("error",b),0===u(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",v),_()}function v(){m("onfinish"),e.removeListener("close",y),_()}function _(){m("unpipe"),r.unpipe(e)}return r.on("data",g),w(e,"error",b),e.once("close",y),e.once("finish",v),e.emit("pipe",r),o.flowing||(m("pipe resume"),r.resume()),e},E.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?this:(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,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var c=r(5);c.inherits=r(1);var f={deprecate:r(38)},h=r(540),l=r(4).Buffer,d=n.Uint8Array||function(){};function p(e){return l.from(e)}function g(e){return l.isBuffer(e)||e instanceof d}var m=r(541),b;function y(){}function v(e,t){u=u||r(142),e=e||{};var n=t instanceof u;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||r(142),!(b.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var r=new Error("write after end");e.emit("error",r),i.nextTick(t,r)}function S(e,t,r,n){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(n,s),o=!1),o}function E(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r)),t}function k(e,t,r,n,i,o){if(!r){var s=E(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||L(this,n,r)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(2),r(8))},function(e,t,r){"use strict";e.exports=s;var n=r(142),i=r(5);function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length"object"==typeof e).pop()||{});Array.isArray(t[0])&&(t=t[0]);const s=t.filter(e=>"string"==typeof e).map(e=>e.trim());n(e,s,(e,t)=>{i(e,{sources:t,options:o})})}e.exports=i},function(e,t,r){"use strict";const n=r(11),i=r(47),{addLink:o,updateTree:s,updateMfsRoot:a,toTrail:u,toSourcesAndDestination:c,toMfsPath:f}=r(74),h=r(239),l=r(315),d=r(6)("ipfs:mfs:cp"),p={parents:!1,flush:!0,format:"dag-pb",hashAlg:"sha2-256",shardSplitThreshold:1e3};e.exports=(e=>(function t(){const r=Array.from(arguments),i=r.pop();n([t=>c(e,r,p,t),({sources:e,destination:t,options:r},n)=>e.length?t?(r.parents=r.p||r.parents,void n(null,{sources:e,destination:t,options:r})):n(new Error("Please supply a destination")):n(new Error("Please supply at least one source")),({sources:t,destination:r,options:n},i)=>u(e,r.mfsPath,n,(o,s)=>{if(o)return i(o);if(s.length===r.parts.length)return d("Destination does not exist"),1===t.length?(d("Only one source, copying to a file"),g(e,t.pop(),r,s,n,i)):(d("Multiple sources, copying to a directory"),m(e,t,r,s,n,i));const a=s[s.length-1];if("dir"===a.type)return d("Destination is a directory"),m(e,t,r,s,n,i);i(new Error("directory already has entry by that name"))})],i)}));const g=(e,t,r,i,u,c)=>{n([r=>b(e,t,u,r),(t,s)=>{const a=i[i.length-1],u=t[t.length-1];n([t=>e.ipld.get(a.cid,t),(t,n)=>o(e,{parent:t.value,parentCid:a.cid,size:u.size,cid:u.cid,name:r.parts[r.parts.length-1]},n),({node:e,cid:t},r)=>{a.node=e,a.cid=t,a.size=e.size,r(null,i)}],s)},(t,r)=>s(e,t,u,r),({cid:t},r)=>a(e,t,r)],e=>c(e))},m=(e,t,r,c,p,g)=>{n([t=>{if(c.length!==r.parts.length+1)return d("Making destination directory",r.path),n([t=>l(e)(r.path,p,t),t=>f(e,r.path,t),(t,n)=>{r=t,u(e,r.mfsPath,p,n)}],(e,r)=>{if(e)return t(e);c=r,t()});t()},r=>i(t.map(t=>r=>b(e,t,p,r)),r),(u,f)=>{n([n=>{i(t.map(t=>n=>{h(e)(`${r.path}/${t.name}`,p,e=>{if(e)return e.message.includes("does not exist")?n():n(e);n(new Error("directory already has entry by that name"))})}),e=>n(e))},r=>{const i=c[c.length-1];n([t=>e.ipld.get(i.cid,t),(e,t)=>t(null,{cid:i.cid,node:e.value})].concat(u.map((r,n)=>(i,s)=>{const a=r[r.length-1];d(`Adding ${t[n].name} to ${i.cid.toBaseEncodedString()}`),o(e,{parent:i.node,parentCid:i.cid,size:a.size,cid:a.cid,name:t[n].name},(e,t)=>{if(e)return s(e);d(`New directory hash ${t.cid.toBaseEncodedString()}`),s(e,t)})})),r)},({node:e,cid:t},r)=>{const n=c[c.length-1];n.node=e,n.cid=t,n.size=e.size,r(null,c)},(t,r)=>s(e,t,p,r),({cid:t},r)=>a(e,t,r)],f)}],e=>g(e))},b=(e,t,r,n)=>{u(e,t.mfsPath,r,(e,r)=>e?n(e):"ipfs"===t.type?n(null,r):r.length!==t.parts.length+1?n(new Error(`${t.path} does not exist`)):void n(null,r))}},function(e,t,r){"use strict";const n=r(11),i=r(35),{updateTree:o,updateMfsRoot:s,toSources:a,removeLink:u,toMfsPath:c,toTrail:f,FILE_SEPARATOR:h}=r(74),l={recursive:!1,cidVersion:0,hashAlg:"sha2-256",format:"dag-pb"};e.exports=(e=>(function t(){const r=Array.from(arguments),o=r.pop();n([t=>a(e,r,l,t),({sources:t,options:r},n)=>{if(!t.length)return n(new Error("Please supply at least one path to remove"));i(t.map(t=>n=>d(e,t.path,r,n)),e=>n(e))}],o)}));const d=(e,t,r,i)=>{if(t===h)return i(new Error("Cannot delete root"));n([r=>c(e,t,r),({mfsPath:t,parts:n},i)=>f(e,t,r,(e,r)=>i(e,{mfsPath:t,parts:n,trail:r})),({trail:i},o)=>{const s=i.pop(),a=i[i.length-1];return a?"dir"!==s.type||r.recursive?void n([t=>u(e,{parentCid:a.cid,name:s.name},t),({cid:e},t)=>{a.cid=e,t(null,i)}],o):o(new Error(`${t} is a directory, use -r to remove directories`)):o(new Error(`${t} does not exist`))},(t,n)=>o(e,t,r,n),({cid:t},r)=>s(e,t,r)],i)}},function(e,t,r){"use strict";const n=r(173).OFFLINE_ERROR,i=r(3),o=r(14),s=r(54),a=r(9),u=r(20),c=r(19);function f(e,t){return Array.from(e).map(e=>({"/":e[1].cid.toBaseEncodedString()}))}e.exports=function e(t){return{wantlist:i((e,r)=>{if("function"==typeof e&&(r=e,e=null),!t.isOnline())return o(()=>r(new Error(n)));let i;if(e){try{e=u.createFromB58String(e)}catch(t){e=null}if(!e)return o(()=>r(new Error("Invalid peerId")));i=t._bitswap.wantlistForPeer(e)}else i=t._bitswap.getWantlist();o(()=>r(null,{Keys:f(i)}))}),stat:i(e=>{if(!t.isOnline())return o(()=>e(new Error(n)));const r=t._bitswap.stat().snapshot;o(()=>{e(null,{provideBufLen:parseInt(r.providesBufferLength.toString()),blocksReceived:new s(r.blocksReceived),wantlist:f(t._bitswap.getWantlist()),peers:t._bitswap.peers().map(e=>e.toB58String()),dupBlksReceived:new s(r.dupBlksReceived),dupDataReceived:new s(r.dupDataReceived),dataReceived:new s(r.dataReceived),blocksSent:new s(r.blocksSent),dataSent:new s(r.dataSent)})})}),unwant:i((e,r)=>{if(!t.isOnline())return o(()=>r(new Error(n)));Array.isArray(e)||(e=[e]);try{e=e.map(e=>a.isCID(e)?e:new a(e))}catch(e){return o(()=>r(c(e,"ERR_INVALID_CID")))}o(()=>r(null,t._bitswap.unwant(e)))})}}},function(e,t,r){"use strict";const n=r(3),i=/^((\d+(\.\d+)*)(ns|ms|us|µs|m|s|h))+$/,o=/((\d+(\.\d+)*)(ns|ms|us|µs|m|s|h))/g,s=/(ns|ms|us|µs|m|s|h)/g,a={ns:1e-6,us:.001,"µs":.001,ms:1,s:1e3,m:6e4,h:36e5};function u(e){let t=e.match(s)[0];return e=e.substring(0,e.length-t.length),parseFloat(e)*a[t]}e.exports=n(function(e,t){return"string"!=typeof e?t(new Error("the first argument must be a string")):i.test(e)?void t(null,e.match(o).reduce((e,t)=>e+u(t),0)):t(new Error("invalid time"))})},function(e,t,r){"use strict";const n=r(1272).Block,i=r(9),o=r(33),s=r(48),a=r(11),u=80,c=(e,t)=>{let r=null,n;try{n=e.toBuffer(!0)}catch(e){r=e}finally{t(r,n)}},f=(e,t)=>{if(80!==e.length){const e=new Error("Bitcoin block header needs to be 80 bytes");return t(e)}const r=n.fromBuffer(e);t(null,r)},h=(e,t,n)=>{"function"==typeof t&&(n=t,t={}),t=t||{};const o=t.hashAlg||r(317).defaultHashAlg,u=void 0===t.version?1:t.version;a([t=>{try{s(e.toBuffer(!0),o,t)}catch(e){t(e)}},(e,t)=>t(null,new i(u,"bitcoin-block",e))],n)},l=e=>{const t=r(317).defaultHashAlg,n=o.encode(e,t),s=1,a=new i(1,"bitcoin-block",n);return a};e.exports={hashToCid:l,BITCOIN_BLOCK_HEADER_SIZE:80,cid:h,deserialize:f,serialize:c}},function(e,t,r){"use strict";var n=t;function i(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n>8,s=255&i;o?r.push(o,s):r.push(s)}return r}function o(e){return 1===e.length?"0"+e:e}function s(e){for(var t="",r=0;r>>3}function l(e){return i(e,17)^i(e,19)^e>>>10}t.ft_1=o,t.ch32=s,t.maj32=a,t.p32=u,t.s0_256=c,t.s1_256=f,t.g0_256=h,t.g1_256=l},function(e,t,r){"use strict";var n=r(82),i=r(176),o=r(552),s=r(98),a=n.sum32,u=n.sum32_4,c=n.sum32_5,f=o.ch32,h=o.maj32,l=o.s0_256,d=o.s1_256,p=o.g0_256,g=o.g1_256,m=i.BlockHash,b=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function y(){if(!(this instanceof y))return new y;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=b,this.W=new Array(64)}n.inherits(y,m),e.exports=y,y.blockSize=512,y.outSize=256,y.hmacStrength=192,y.padLength=64,y.prototype._update=function e(t,r){for(var n=this.W,i=0;i<16;i++)n[i]=t[r+i];for(;it)throw new TypeError("Script number overflow");if(r&&0==(127&e[n-1])&&(n<=1||0==(128&e[n-2])))throw new Error("Non-minimally encoded script number");if(5===n){const t=e.readUInt32LE(0),r=e.readUInt8(4);return 128&r?-(4294967296*(-129&r)+t):4294967296*r+t}let i=0;for(var o=0;o2147483647?5:e>8388607?4:e>32767?3:e>127?2:e>0?1:0}function s(e){let t=Math.abs(e);const r=o(t),i=n.allocUnsafe(r),s=e<0;for(var a=0;a>=8;return 128&i[r-1]?i.writeUInt8(s?128:0,r-1):s&&(i[r-1]|=128),i}e.exports={decode:i,encode:s}},function(e,t,r){"use strict";var n=r(4).Buffer,i=9007199254740991;function o(e){if(e<0||e>i||e%1!=0)throw new RangeError("value out of range")}function s(e,t,r){if(o(e),t||(t=n.allocUnsafe(u(e))),!n.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");return r||(r=0),e<253?(t.writeUInt8(e,r),s.bytes=1):e<=65535?(t.writeUInt8(253,r),t.writeUInt16LE(e,r+1),s.bytes=3):e<=4294967295?(t.writeUInt8(254,r),t.writeUInt32LE(e,r+1),s.bytes=5):(t.writeUInt8(255,r),t.writeUInt32LE(e>>>0,r+1),t.writeUInt32LE(e/4294967296|0,r+5),s.bytes=9),t}function a(e,t){if(!n.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");t||(t=0);var r=e.readUInt8(t);if(r<253)return a.bytes=1,r;if(253===r)return a.bytes=3,e.readUInt16LE(t+1);if(254===r)return a.bytes=5,e.readUInt32LE(t+1);a.bytes=9;var i=e.readUInt32LE(t+1),s=e.readUInt32LE(t+5),u=4294967296*s+i;return o(u),u}function u(e){return o(e),e<253?1:e<=65535?3:e<=4294967295?5:9}e.exports={encode:s,decode:a,encodingLength:u}},function(e,t,r){const n=r(112),i=r(137),o=r(43),s=r(83),a=r(559),u=r(75),c=o.maybe(o.compile({compressed:s.maybe(s.Boolean),network:s.maybe(s.Network)}));function f(e,t,r){r=r||{},this.compressed=void 0===r.compressed||r.compressed,this.network=r.network||u.bitcoin,this.__d=e||null,this.__Q=null,t&&(this.__Q=n.pointCompress(t,this.compressed))}function h(e,t){if(o(s.Buffer256bit,e),!n.isPrivate(e))throw new TypeError("Private key not in range [1, n)");return o(c,t),new f(e,null,t)}function l(e,t){return o(n.isPoint,e),o(c,t),new f(null,e,t)}function d(e,t){const r=a.decode(e),n=r.version;if(s.Array(t)){if(t=t.filter(function(e){return n===e.wif}).pop(),!t)throw new Error("Unknown network version")}else if(t=t||u.bitcoin,n!==t.wif)throw new Error("Invalid network version");return h(r.privateKey,{compressed:r.compressed,network:t})}function p(e){o(c,e),e=e||{};const t=e.rng||i;let r;do{r=t(32),o(s.Buffer256bit,r)}while(!n.isPrivate(r));return h(r,e)}Object.defineProperty(f.prototype,"privateKey",{enumerable:!1,get:function(){return this.__d}}),Object.defineProperty(f.prototype,"publicKey",{get:function(){return this.__Q||(this.__Q=n.pointFromScalar(this.__d,this.compressed)),this.__Q}}),f.prototype.toWIF=function(){if(!this.__d)throw new Error("Missing private key");return a.encode(this.network.wif,this.__d,this.compressed)},f.prototype.sign=function(e){if(!this.__d)throw new Error("Missing private key");return n.sign(e,this.__d)},f.prototype.verify=function(e,t){return n.verify(e,this.publicKey,t)},e.exports={makeRandom:p,fromPrivateKey:h,fromPublicKey:l,fromWIF:d}},function(e,t,r){(function(t){var n=r(177);function i(e,t){if(void 0!==t&&e[0]!==t)throw new Error("Invalid network version");if(33===e.length)return{version:e[0],privateKey:e.slice(1,33),compressed:!1};if(34!==e.length)throw new Error("Invalid WIF length");if(1!==e[33])throw new Error("Invalid compression flag");return{version:e[0],privateKey:e.slice(1,33),compressed:!0}}function o(e,r,n){var i=new t(n?34:33);return i.writeUInt8(e,0),r.copy(i,1),n&&(i[33]=1),i}function s(e,t){return i(n.decode(e),t)}function a(e,t,r){return"number"==typeof e?n.encode(o(e,t,r)):n.encode(o(e.version,e.privateKey,e.compressed))}e.exports={decode:s,decodeRaw:i,encode:a,encodeRaw:o}}).call(this,r(0).Buffer)},function(e,t,r){const n=r(4).Buffer,i=r(321),o=r(177),s=r(25),a=r(75),u=r(43),c=r(83),f=r(322);function h(e){const t=o.decode(e);if(t.length<21)throw new TypeError(e+" is too short");if(t.length>21)throw new TypeError(e+" is too long");const r=t.readUInt8(0),n=t.slice(1);return{version:r,hash:n}}function l(e){const t=i.decode(e),r=i.fromWords(t.words.slice(1));return{version:t.words[0],prefix:t.prefix,data:n.from(r)}}function d(e,t){u(c.tuple(c.Hash160bit,c.UInt8),arguments);const r=n.allocUnsafe(21);return r.writeUInt8(t,0),e.copy(r,1),o.encode(r)}function p(e,t,r){const n=i.toWords(e);return n.unshift(t),i.encode(r,n)}function g(e,t){t=t||a.bitcoin;try{return f.p2pkh({output:e,network:t}).address}catch(e){}try{return f.p2sh({output:e,network:t}).address}catch(e){}try{return f.p2wpkh({output:e,network:t}).address}catch(e){}try{return f.p2wsh({output:e,network:t}).address}catch(e){}throw new Error(s.toASM(e)+" has no matching Address")}function m(e,t){let r;t=t||a.bitcoin;try{r=h(e)}catch(e){}if(r){if(r.version===t.pubKeyHash)return f.p2pkh({hash:r.hash}).output;if(r.version===t.scriptHash)return f.p2sh({hash:r.hash}).output}else{try{r=l(e)}catch(e){}if(r){if(r.prefix!==t.bech32)throw new Error(e+" has an invalid prefix");if(0===r.version){if(20===r.data.length)return f.p2wpkh({hash:r.data}).output;if(32===r.data.length)return f.p2wsh({hash:r.data}).output}}}throw new Error(e+" has no matching Script")}e.exports={fromBase58Check:h,fromBech32:l,fromOutputScript:g,toBase58Check:d,toBech32:p,toOutputScript:m}},function(e,t,r){const n=r(25),i=r(30);function o(e){const t=n.compile(e);return 22===t.length&&t[0]===i.OP_0&&20===t[1]}o.toJSON=function(){return"Witness pubKeyHash output"},e.exports={check:o}},function(e,t,r){const n=r(25),i=r(30);function o(e){const t=n.compile(e);return 34===t.length&&t[0]===i.OP_0&&32===t[1]}o.toJSON=function(){return"Witness scriptHash output"},e.exports={check:o}},function(e,t,r){"use strict";(function(t){const n=r(1332),i=r(179),o=r(180),s=r(1343);function a(e,r,n){const o=[];o.push({path:"storage",value:{"/":i("eth-storage-trie",e.stateRoot).toBaseEncodedString()}}),s.equals(e.codeHash)?o.push({path:"code",value:t.from("")}):o.push({path:"code",value:{"/":i("raw",e.codeHash).toBaseEncodedString()}}),o.push({path:"stateRoot",value:e.stateRoot}),o.push({path:"codeHash",value:e.codeHash}),o.push({path:"nonce",value:e.nonce}),o.push({path:"balance",value:e.balance}),o.push({path:"isEmpty",value:e.isEmpty()}),o.push({path:"isContract",value:e.isContract()}),n(null,o)}e.exports=o("eth-account-snapshot",n,a)}).call(this,r(0).Buffer)},function(e,t){e.exports=function e(t){if("string"!=typeof t)throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof t+", while checking isHexPrefixed.");return"0x"===t.slice(0,2)}},function(e,t){function r(e){return function t(r,n,i){e(r,n,(e,t)=>e?i(e):t.remainderPath.length>0?i(new Error("path out of scope")):void("object"==typeof t.value&&t.value["/"]?i(null,t.value):i(null,!1)))}}e.exports=r},function(e,t,r){const n=r(567),i=r(193);function o(e,t){return{deserialize:i(e=>new t(e)),serialize:i(e=>e.serialize()),cid:i((t,r)=>n(e,t,r))}}e.exports=o},function(e,t,r){"use strict";const n=r(179);function i(e,t,r){const i=t.hash(),o=n(e,i,r);return o}e.exports=i},function(e,t,r){"use strict";const n=r(569),i=r(179),o=r(180);function s(e,t,r){const n=[];n.push({path:"parent",value:{"/":i("eth-block",e.parentHash).toBaseEncodedString()}}),n.push({path:"ommers",value:{"/":i("eth-block-list",e.uncleHash).toBaseEncodedString()}}),n.push({path:"transactions",value:{"/":i("eth-tx-trie",e.transactionsTrie).toBaseEncodedString()}}),n.push({path:"transactionReceipts",value:{"/":i("eth-tx-receipt-trie",e.receiptTrie).toBaseEncodedString()}}),n.push({path:"state",value:{"/":i("eth-state-trie",e.stateRoot).toBaseEncodedString()}}),n.push({path:"parentHash",value:e.parentHash}),n.push({path:"ommerHash",value:e.uncleHash}),n.push({path:"transactionTrieRoot",value:e.transactionsTrie}),n.push({path:"transactionReceiptTrieRoot",value:e.receiptTrie}),n.push({path:"stateRoot",value:e.stateRoot}),n.push({path:"authorAddress",value:e.coinbase}),n.push({path:"bloom",value:e.bloom}),n.push({path:"difficulty",value:e.difficulty}),n.push({path:"number",value:e.number}),n.push({path:"gasLimit",value:e.gasLimit}),n.push({path:"gasUsed",value:e.gasUsed}),n.push({path:"timestamp",value:e.timestamp}),n.push({path:"extraData",value:e.extraData}),n.push({path:"mixHash",value:e.mixHash}),n.push({path:"nonce",value:e.nonce}),r(null,n)}e.exports=o("eth-block",n,s)},function(e,t,r){(function(t){const n=r(1344).default,i=r(241),o=i.BN;var s=e.exports=function(e,r){if(r=r||{},r.common){if(r.chain)throw new Error("Instantiation with both opts.common and opts.chain parameter not allowed!");this._common=r.common}else{let e=r.chain?r.chain:"mainnet",t=r.hardfork?r.hardfork:null;this._common=new n(e,t)}var o=[{name:"parentHash",length:32,default:i.zeros(32)},{name:"uncleHash",default:i.SHA3_RLP_ARRAY},{name:"coinbase",length:20,default:i.zeros(20)},{name:"stateRoot",length:32,default:i.zeros(32)},{name:"transactionsTrie",length:32,default:i.SHA3_RLP},{name:"receiptTrie",length:32,default:i.SHA3_RLP},{name:"bloom",default:i.zeros(256)},{name:"difficulty",default:t.from([])},{name:"number",default:i.intToBuffer(115e4)},{name:"gasLimit",default:t.from("ffffffffffffff","hex")},{name:"gasUsed",empty:!0,default:t.from([])},{name:"timestamp",default:t.from([])},{name:"extraData",allowZero:!0,empty:!0,default:t.from([])},{name:"mixHash",default:i.zeros(32)},{name:"nonce",default:i.zeros(8)}];i.defineProperties(this,o,e)};s.prototype.canonicalDifficulty=function(e){const t=this._common.hardfork()||this._common.activeHardfork(i.bufferToInt(this.number)),r=new o(this.timestamp),n=new o(e.header.timestamp),s=new o(e.header.difficulty),a=new o(this._common.param("pow","minimumDifficulty",t));var u=s.div(new o(this._common.param("pow","difficultyBoundDivisor",t))),c=new o(this.number),f,h,l;if(this._common.hardforkGteHardfork(t,"byzantium")){var d=e.header.uncleHash.equals(i.SHA3_RLP_ARRAY)?1:2;f=r.sub(n).idivn(9).ineg().iaddn(d),h=new o(-99),1===h.cmp(f)&&(f=h),l=s.add(u.mul(f))}this._common.hardforkGteHardfork(t,"constantinople")?(c.isubn(5e6),c.ltn(0)&&(c=new o(0))):this._common.hardforkGteHardfork(t,"byzantium")?(c.isubn(3e6),c.ltn(0)&&(c=new o(0))):this._common.hardforkGteHardfork(t,"homestead")?(f=r.sub(n).idivn(10).ineg().iaddn(1),h=new o(-99),1===h.cmp(f)&&(f=h),l=s.add(u.mul(f))):l=1===n.addn(this._common.param("pow","durationLimit",t)).cmp(r)?u.add(s):s.sub(u);var p=c.idivn(1e5).isubn(2);return p.isNeg()||l.iadd(new o(2).pow(p)),-1===l.cmp(a)&&(l=a),l},s.prototype.validateDifficulty=function(e){const t=this.canonicalDifficulty(e);return 0===t.cmp(new o(this.difficulty))},s.prototype.validateGasLimit=function(e){const t=new o(e.header.gasLimit),r=new o(this.gasLimit),n=this._common.hardfork()?this._common.hardfork():this._common.activeHardfork(this.number),i=t.div(new o(this._common.param("gasConfig","gasLimitBoundDivisor",n))),s=t.add(i),a=t.sub(i);return r.lt(s)&&r.gt(a)&&r.gte(this._common.param("gasConfig","minGasLimit",n))},s.prototype.validate=function(e,t,r){var n=this;if(2===arguments.length&&(r=t,t=!1),this.isGenesis())return r();e.getBlock(n.parentHash,function(e,s){if(e)return r("could not find parent block");n.parentBlock=s;var a=new o(n.number);if(0!==a.cmp(new o(s.header.number).iaddn(1)))return r("invalid number");if(t){var u=t.sub(new o(s.header.number));if(-1!==u.cmpn(8)||1!==u.cmpn(1))return r("uncle block has a parent that is too old or to young")}if(!n.validateDifficulty(s))return r("invalid Difficulty");if(!n.validateGasLimit(s))return r("invalid gas limit");if(i.bufferToInt(s.header.number)+1!==i.bufferToInt(n.number))return r("invalid heigth");if(i.bufferToInt(n.timestamp)<=i.bufferToInt(s.header.timestamp))return r("invalid timestamp");const c=n._common.hardfork()?n._common.hardfork():n._common.activeHardfork(t);if(n.extraData.length>n._common.param("vm","maxExtraDataSize",c))return r("invalid amount of extra data");r()})},s.prototype.hash=function(){return i.rlphash(this.raw)},s.prototype.isGenesis=function(){return""===this.number.toString("hex")},s.prototype.setGenesisParams=function(){this.timestamp=this._common.genesis().timestamp,this.gasLimit=this._common.genesis().gasLimit,this.difficulty=this._common.genesis().difficulty,this.extraData=this._common.genesis().extraData,this.nonce=this._common.genesis().nonce,this.stateRoot=this._common.genesis().stateRoot,this.number=t.from([])}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1365),i=r(180);function o(e,t,r){const n=[];n.push({path:"nonce",value:e.nonce}),n.push({path:"gasPrice",value:e.gasPrice}),n.push({path:"gasLimit",value:e.gasLimit}),n.push({path:"toAddress",value:e.to}),n.push({path:"value",value:e.value}),n.push({path:"data",value:e.data}),n.push({path:"v",value:e.v}),n.push({path:"r",value:e.r}),n.push({path:"s",value:e.s}),n.push({path:"fromAddress",value:e.from}),n.push({path:"signature",value:[e.v,e.r,e.s]}),n.push({path:"isContractPublish",value:e.toCreationAddress()}),r(null,n)}e.exports=i("eth-tx",n,o)},function(e,t,r){"use strict";(function(n){const i=r(14),o=r(11),s=r(48),a=r(9),u=r(572),c=r(242),f=r(1371),h=r(1372),l=r(1373);t=e.exports,t.serialize=((e,t)=>{if(null!==e)if(n.isBuffer(e))"blob"===e.slice(0,4).toString()?i(()=>t(null,e)):i(()=>t(new Error("unexpected dagNode passed to serialize"),null));else switch(e.gitType){case"commit":f.serialize(e,t);break;case"tag":h.serialize(e,t);break;default:l.serialize(e,t)}else i(()=>t(new Error("dagNode passed to serialize was null"),null))}),t.deserialize=((e,t)=>{let r=c.find(e,0),n=e.slice(0,r).toString(),o=n.match(/([^ ]+) (\d+)/);if(o)switch(o[1]){case"blob":t(null,e);break;case"commit":f.deserialize(e.slice(r+1),t);break;case"tag":h.deserialize(e.slice(r+1),t);break;case"tree":l.deserialize(e.slice(r+1),t);break;default:i(()=>t(new Error("unknown object type "+o[1]),null))}else i(()=>t(new Error("invalid object header"),null))}),t.cid=((e,r,n)=>{"function"==typeof r&&(n=r,r={}),r=r||{};const i=r.hashAlg||u.defaultHashAlg,c=void 0===r.version?1:r.version;o([r=>t.serialize(e,r),(e,t)=>s(e,i,t),(e,t)=>t(null,new a(c,u.multicodec,e))],n)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(571),o=r(421);t=e.exports,t.multicodec="git-raw",t.defaultHashAlg="sha1";const s=["original","name","email","date"];t.resolve=((e,t,r)=>{"function"==typeof t&&(r=t,t=void 0),i.deserialize(e,(e,i)=>{if(e)return r(e);if(!t||"/"===t)return r(null,{value:i,remainderPath:""});if(n.isBuffer(i))return r(null,{value:i,remainderPath:t});const s=t.split("/"),a=o(i).get(s);if(a)return r(null,{value:a,remainderPath:""});let u,c=s.length;for(let e=0;e{"function"==typeof t&&(r=t,t=void 0),t=t||{},i.deserialize(e,(e,t)=>{if(e)return r(e);if(n.isBuffer(t))return r(null,[]);let i=[];switch(t.gitType){case"commit":i=["message","tree"],i=i.concat(s.map(e=>"author/"+e)),i=i.concat(s.map(e=>"committer/"+e)),i=i.concat(t.parents.map((e,t)=>"parents/"+t)),t.encoding&&i.push("encoding");break;case"tag":i=["object","type","tag","message"],t.tagger&&(i=i.concat(s.map(e=>"tagger/"+e)));break;default:Object.keys(t).forEach(e=>{i.push(e),i.push(e+"/hash"),i.push(e+"/mode")})}r(null,i)})}),t.isLink=((e,r,n)=>{t.resolve(e,r,(e,t)=>e?n(e):t.remainderPath.length>0?n(new Error("path out of scope")):void("object"==typeof t.value&&t.value["/"]?n(null,t.value):n(null,!1)))})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1375).BlockHeader,i=r(9),o=r(33),s=r(48),a=r(11),u=1487,c=(e,t)=>{let r=null,n;try{n=e.toBuffer()}catch(e){r=e}finally{t(r,n)}},f=(e,t)=>{if(1487!==e.length){const e=new Error("Zcash block header needs to be 1487 bytes");return t(e)}const r=n.fromBuffer(e);t(null,r)},h=(e,t,n)=>{"function"==typeof t&&(n=t,t={}),t=t||{};const o=t.hashAlg||r(327).defaultHashAlg,u=void 0===t.version?1:t.version;a([t=>{try{s(e.toBuffer(),o,t)}catch(e){t(e)}},(e,t)=>t(null,new i(u,"zcash-block",e))],n)},l=e=>{const t=r(327).defaultHashAlg,n=o.encode(e,t),s=1,a=new i(1,"zcash-block",n);return a};e.exports={hashToCid:l,ZCASH_BLOCK_HEADER_SIZE:1487,cid:h,deserialize:f,serialize:c}},function(e,t,r){"use strict";(function(t){var n=r(45),i=r(143),o=r(77),s=r(85),a=r(248),u=r(50),c=r(26),f=r(15),h=r(22),l=function e(t){if(!(this instanceof e))return new e(t);t&&this.set(t)};l.prototype.set=function(e){return this.hashbuf=e.hashbuf||this.hashbuf,this.endian=e.endian||this.endian,this.privkey=e.privkey||this.privkey,this.pubkey=e.pubkey||(this.privkey?this.privkey.publicKey:this.pubkey),this.sig=e.sig||this.sig,this.k=e.k||this.k,this.verified=e.verified||this.verified,this},l.prototype.privkey2pubkey=function(){this.pubkey=this.privkey.toPublicKey()},l.prototype.calci=function(){for(var e=0;e<4;e++){var t;this.sig.i=e;try{t=this.toPublicKey()}catch(e){console.error(e);continue}if(t.point.eq(this.pubkey.point))return this.sig.compressed=this.pubkey.compressed,this}throw this.sig.i=void 0,new Error("Unable to find valid recovery factor")},l.fromString=function(e){var t=JSON.parse(e);return new l(t)},l.prototype.randomK=function(){var e=i.getN(),t;do{t=n.fromBuffer(a.getRandomBuffer(32))}while(!t.lt(e)||!t.gt(n.Zero));return this.k=t,this},l.prototype.deterministicK=function(e){f.isUndefined(e)&&(e=0);var r=new t(32);r.fill(1);var o=new t(32);o.fill(0);var s=this.privkey.bn.toBuffer({size:32}),a="little"===this.endian?c.reverse(this.hashbuf):this.hashbuf;o=u.sha256hmac(t.concat([r,new t([0]),s,a]),o),r=u.sha256hmac(r,o),o=u.sha256hmac(t.concat([r,new t([1]),s,a]),o),r=u.sha256hmac(r,o),r=u.sha256hmac(r,o);for(var h=n.fromBuffer(r),l=i.getN(),d=0;d>1,c=i.getN(),f=i.getG(),l=u?r.add(c):r,d=i.fromX(a,l),p=d.mul(c);if(!p.isInfinity())throw new Error("nR is not a valid curve point");var g=t.neg().mod(c),m=r.invm(c),b=d.mul(o).add(f.mul(g)).mul(m),y=s.fromPoint(b,this.sig.compressed);return y},l.prototype.sigError=function(){if(!c.isBuffer(this.hashbuf)||32!==this.hashbuf.length)return"hashbuf must be a 32 byte buffer";var e=this.sig.r,t=this.sig.s;if(!(e.gt(n.Zero)&&e.lt(i.getN())&&t.gt(n.Zero)&&t.lt(i.getN())))return"r and s not in range";var r=n.fromBuffer(this.hashbuf,this.endian?{endian:this.endian}:void 0),o=i.getN(),s=t.invm(o),a=s.mul(r).mod(o),u=s.mul(e).mod(o),f=i.getG().mulAdd(a,this.pubkey.point,u);return f.isInfinity()?"p is infinity":0!==f.getX().mod(o).cmp(e)&&"Invalid signature"},l.toLowS=function(e){return e.gt(n.fromBuffer(new t("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(e=i.getN().sub(e)),e},l.prototype._findSignature=function(e,t){var r=i.getN(),o=i.getG(),s=0,a,u,c,f;do{(!this.k||s>0)&&this.deterministicK(s),s++,a=this.k,u=o.mul(a),c=u.x.mod(r),f=a.invm(r).mul(t.add(e.mul(c))).mod(r)}while(c.cmp(n.Zero)<=0||f.cmp(n.Zero)<=0);return f=l.toLowS(f),{s:f,r:c}},l.prototype.sign=function(){var e=this.hashbuf,t=this.privkey,r=t.bn;h.checkState(e&&t&&r,new Error("invalid parameters")),h.checkState(c.isBuffer(e)&&32===e.length,new Error("hashbuf must be a 32 byte buffer"));var i=n.fromBuffer(e,this.endian?{endian:this.endian}:void 0),s=this._findSignature(r,i);return s.compressed=this.pubkey.compressed,this.sig=new o(s),this},l.prototype.signRandomK=function(){return this.randomK(),this.sign()},l.prototype.toString=function(){var e={};return this.hashbuf&&(e.hashbuf=this.hashbuf.toString("hex")),this.privkey&&(e.privkey=this.privkey.toString()),this.pubkey&&(e.pubkey=this.pubkey.toString()),this.sig&&(e.sig=this.sig.toString()),this.k&&(e.k=this.k.toString()),JSON.stringify(e)},l.prototype.verify=function(){return this.sigError()?this.verified=!1:this.verified=!0,this},l.sign=function(e,t,r){return l().set({hashbuf:e,endian:r,privkey:t}).sign().sig},l.verify=function(e,t,r,n){return l().set({hashbuf:e,endian:n,sig:t,pubkey:r}).verify().verified},e.exports=l}).call(this,r(0).Buffer)},function(e,t){for(var r="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",n={},i=0;i>8,i[r]&=255;for(;a;)i.push(255&a),a>>=8}for(t=0;"1"===e[t]&&t0&&n0&&u0&&(i=n?i+" "+e.buf.toString("hex"):i+" "+e.len+" 0x"+e.buf.toString("hex"));else if(void 0!==a.reverseMap[r])i=i+" "+a(r).toString();else{var o=r.toString(16);o.length%2!=0&&(o="0"+o),i=n?i+" "+o:i+" 0x"+o}return i},b.prototype.toASM=function(){for(var e="",t=0;t"},b.prototype.isPublicKeyHashOut=function(){return!(5!==this.chunks.length||this.chunks[0].opcodenum!==a.OP_DUP||this.chunks[1].opcodenum!==a.OP_HASH160||!this.chunks[2].buf||20!==this.chunks[2].buf.length||this.chunks[3].opcodenum!==a.OP_EQUALVERIFY||this.chunks[4].opcodenum!==a.OP_CHECKSIG)},b.prototype.isPublicKeyHashIn=function(){if(2===this.chunks.length){var e=this.chunks[0].buf,t=this.chunks[1].buf;if(e&&e.length&&48===e[0]&&t&&t.length){var r=t[0];if((4===r||6===r||7===r)&&65===t.length)return!0;if((3===r||2===r)&&33===t.length)return!0}}return!1},b.prototype.getPublicKey=function(){return h.checkState(this.isPublicKeyOut(),"Can't retreive PublicKey from a non-PK output"),this.chunks[0].buf},b.prototype.getPublicKeyHash=function(){return h.checkState(this.isPublicKeyHashOut(),"Can't retrieve PublicKeyHash from a non-PKH output"),this.chunks[2].buf},b.prototype.isPublicKeyOut=function(){if(2===this.chunks.length&&this.chunks[0].buf&&this.chunks[0].buf.length&&this.chunks[1].opcodenum===a.OP_CHECKSIG){var e=this.chunks[0].buf,t=e[0],r=!1;if((4!==t&&6!==t&&7!==t||65!==e.length)&&(3!==t&&2!==t||33!==e.length)||(r=!0),r)return u.isValid(e)}return!1},b.prototype.isPublicKeyIn=function(){if(1===this.chunks.length){var e=this.chunks[0].buf;if(e&&e.length&&48===e[0])return!0}return!1},b.prototype.isScriptHashOut=function(){var e=this.toBuffer();return 23===e.length&&e[0]===a.OP_HASH160&&20===e[1]&&e[e.length-1]===a.OP_EQUAL},b.prototype.isScriptHashIn=function(){if(this.chunks.length<=1)return!1;var e=this.chunks[this.chunks.length-1],t=e.buf,r;if(!t)return!1;try{r=b.fromBuffer(t)}catch(e){if(e instanceof d.Script.InvalidBuffer)return!1;throw e}var n=r.classify();return n!==b.types.UNKNOWN},b.prototype.isMultisigOut=function(){return this.chunks.length>3&&a.isSmallIntOp(this.chunks[0].opcodenum)&&this.chunks.slice(1,this.chunks.length-2).every(function(e){return e.buf&&g.isBuffer(e.buf)})&&a.isSmallIntOp(this.chunks[this.chunks.length-2].opcodenum)&&this.chunks[this.chunks.length-1].opcodenum===a.OP_CHECKMULTISIG},b.prototype.isMultisigIn=function(){return this.chunks.length>=2&&0===this.chunks[0].opcodenum&&this.chunks.slice(1,this.chunks.length).every(function(e){return e.buf&&g.isBuffer(e.buf)&&c.isTxDER(e.buf)})},b.prototype.isDataOut=function(){return this.chunks.length>=1&&this.chunks[0].opcodenum===a.OP_RETURN&&(1===this.chunks.length||2===this.chunks.length&&this.chunks[1].buf&&this.chunks[1].buf.length<=b.OP_RETURN_STANDARD_SIZE&&this.chunks[1].length===this.chunks.len)},b.prototype.getData=function(){if(this.isDataOut()||this.isScriptHashOut())return l.isUndefined(this.chunks[1])?new t(0):new t(this.chunks[1].buf);if(this.isPublicKeyHashOut())return new t(this.chunks[2].buf);throw new Error("Unrecognized script type to get data from")},b.prototype.isPushOnly=function(){return l.every(this.chunks,function(e){return e.opcodenum<=a.OP_16})},b.types={},b.types.UNKNOWN="Unknown",b.types.PUBKEY_OUT="Pay to public key",b.types.PUBKEY_IN="Spend from public key",b.types.PUBKEYHASH_OUT="Pay to public key hash",b.types.PUBKEYHASH_IN="Spend from public key hash",b.types.SCRIPTHASH_OUT="Pay to script hash",b.types.SCRIPTHASH_IN="Spend from script hash",b.types.MULTISIG_OUT="Pay to multisig",b.types.MULTISIG_IN="Spend from multisig",b.types.DATA_OUT="Data push",b.OP_RETURN_STANDARD_SIZE=80,b.prototype.classify=function(){if(this._isInput)return this.classifyInput();if(this._isOutput)return this.classifyOutput();var e=this.classifyOutput();return e!=b.types.UNKNOWN?e:this.classifyInput()},b.outputIdentifiers={},b.outputIdentifiers.PUBKEY_OUT=b.prototype.isPublicKeyOut,b.outputIdentifiers.PUBKEYHASH_OUT=b.prototype.isPublicKeyHashOut,b.outputIdentifiers.MULTISIG_OUT=b.prototype.isMultisigOut,b.outputIdentifiers.SCRIPTHASH_OUT=b.prototype.isScriptHashOut,b.outputIdentifiers.DATA_OUT=b.prototype.isDataOut,b.prototype.classifyOutput=function(){for(var e in b.outputIdentifiers)if(b.outputIdentifiers[e].bind(this)())return b.types[e];return b.types.UNKNOWN},b.inputIdentifiers={},b.inputIdentifiers.PUBKEY_IN=b.prototype.isPublicKeyIn,b.inputIdentifiers.PUBKEYHASH_IN=b.prototype.isPublicKeyHashIn,b.inputIdentifiers.MULTISIG_IN=b.prototype.isMultisigIn,b.inputIdentifiers.SCRIPTHASH_IN=b.prototype.isScriptHashIn,b.prototype.classifyInput=function(){for(var e in b.inputIdentifiers)if(b.inputIdentifiers[e].bind(this)())return b.types[e];return b.types.UNKNOWN},b.prototype.isStandard=function(){return this.classify()!==b.types.UNKNOWN},b.prototype.prepend=function(e){return this._addByType(e,!0),this},b.prototype.equals=function(e){if(h.checkState(e instanceof b,"Must provide another script"),this.chunks.length!==e.chunks.length)return!1;var t;for(t=0;t=0&&n=1&&r[0]<=16?n===a.OP_1+(r[0]-1):1===r.length&&129===r[0]?n===a.OP_1NEGATE:r.length<=75?n===r.length:r.length<=255?n===a.OP_PUSHDATA1:!(r.length<=65535)||n===a.OP_PUSHDATA2)},b.prototype._decodeOP_N=function(e){if(e===a.OP_0)return 0;if(e>=a.OP_1&&e<=a.OP_16)return e-(a.OP_1-1);throw new Error("Invalid opcode: "+JSON.stringify(e))},b.prototype.getSignatureOperationsCount=function(e){e=!!l.isUndefined(e)||e;var t=this,r=0,n=a.OP_INVALIDOPCODE;return l.each(t.chunks,function i(o){var s=o.opcodenum;s==a.OP_CHECKSIG||s==a.OP_CHECKSIGVERIFY?r++:s!=a.OP_CHECKMULTISIG&&s!=a.OP_CHECKMULTISIGVERIFY||(e&&n>=a.OP_1&&n<=a.OP_16?r+=t._decodeOP_N(n):r+=20),n=s}),r},e.exports=b}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(15),i=r(22),o=r(36),s=r(78),a=r(117),u=r(331);function c(e){if(!(this instanceof c))return new c(e);i.checkArgument(n.isObject(e),"Must provide an object from where to extract data");var t=e.address?new a(e.address):void 0,r=e.txid?e.txid:e.txId;if(!r||!o.isHexaString(r)||r.length>64)throw new Error("Invalid TXID in object",e);var f=n.isUndefined(e.vout)?e.outputIndex:e.vout;if(!n.isNumber(f))throw new Error("Invalid outputIndex, received "+f);i.checkArgument(!n.isUndefined(e.scriptPubKey)||!n.isUndefined(e.script),"Must provide the scriptPubKey for that output!");var h=new s(e.scriptPubKey||e.script);i.checkArgument(!n.isUndefined(e.amount)||!n.isUndefined(e.satoshis),"Must provide an amount for the output");var l=n.isUndefined(e.amount)?e.satoshis:new u.fromBTC(e.amount).toSatoshis();i.checkArgument(n.isNumber(l),"Amount must be a number"),o.defineImmutable(this,{address:t,txId:r,outputIndex:f,script:h,satoshis:l})}c.prototype.inspect=function(){return""},c.prototype.toString=function(){return this.txId+":"+this.outputIndex},c.fromObject=function(e){return new c(e)},c.prototype.toObject=c.prototype.toJSON=function e(){return{address:this.address?this.address.toString():void 0,txid:this.txId,vout:this.outputIndex,scriptPubKey:this.script.toBuffer().toString("hex"),amount:u.fromSatoshis(this.satoshis).toBTC()}},e.exports=c},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(249),o=r(26),s=r(100),a=r(69),u=r(50),c=r(36),f=r(247),h=r(22);function l(e){if(!(this instanceof l))return new l(e);var t={};if(o.isBuffer(e))t=l._fromBufferReader(s(e));else{if(!n.isObject(e))throw new TypeError("Unrecognized argument for MerkleBlock");var r;r=e.header instanceof i?e.header:i.fromObject(e.header),t={header:r,numTransactions:e.numTransactions,hashes:e.hashes,flags:e.flags}}return n.extend(this,t),this._flagBitsUsed=0,this._hashesUsed=0,this}l.fromBuffer=function e(t){return l.fromBufferReader(s(t))},l.fromBufferReader=function e(t){return new l(l._fromBufferReader(t))},l.prototype.toBuffer=function e(){return this.toBufferWriter().concat()},l.prototype.toBufferWriter=function e(r){r||(r=new a),r.write(this.header.toBuffer()),r.writeUInt32LE(this.numTransactions),r.writeVarintNum(this.hashes.length);for(var n=0;nthis.numTransactions)return!1;if(8*this.flags.length8*this.flags.length)return null;var o=this.flags[i.flagBitsUsed>>3]>>>(7&i.flagBitsUsed++)&1;if(0!==r&&o){var s=this._traverseMerkleTree(r-1,2*n,i),a=s;return 2*n+1=this.hashes.length)return null;var c=this.hashes[i.hashesUsed++];return 0===r&&o&&i.txs.push(c),new t(c,"hex")},l.prototype._calcTreeWidth=function e(t){return this.numTransactions+(1<>t},l.prototype._calcTreeHeight=function e(){for(var t=0;this._calcTreeWidth(t)>1;)t++;return t},l.prototype.hasTransaction=function e(r){h.checkArgument(!n.isUndefined(r),"tx cannot be undefined"),h.checkArgument(r instanceof f||"string"==typeof r,'Invalid tx given, tx must be a "string" or "Transaction"');var i=r;r instanceof f&&(i=o.reverse(new t(r.id,"hex")).toString("hex"));var s=[],a=this._calcTreeHeight();return this._traverseMerkleTree(a,0,{txs:s}),-1!==s.indexOf(i)},l._fromBufferReader=function e(t){h.checkState(!t.finished(),"No merkleblock data received");var r={};r.header=i.fromBufferReader(t),r.numTransactions=t.readUInt32LE();var n=t.readVarintNum();r.hashes=[];for(var o=0;o=0&&e=E.Hardened||t,e64)throw new b.InvalidEntropyArgument.TooMuchEntropy(e);var n=f.sha512hmac(e,new i.Buffer("Bitcoin seed"));return new E({network:h.get(r)||h.defaultNetwork,depth:0,parentFingerPrint:0,childIndex:0,privateKey:n.slice(0,32),chainCode:n.slice(32,64)})},E.prototype._calcHDPublicKey=function(){if(!this._hdPublicKey){var e=r(580);this._hdPublicKey=new e(this)}},E.prototype._buildFromBuffers=function(e){E._validateBufferArguments(e),v.defineImmutable(this,{_buffers:e});var r=[e.version,e.depth,e.parentFingerPrint,e.childIndex,e.chainCode,y.emptyBuffer(1),e.privateKey],n=i.Buffer.concat(r);if(e.checksum&&e.checksum.length){if(e.checksum.toString()!==c.checksum(n).toString())throw new m.InvalidB58Checksum(n)}else e.checksum=c.checksum(n);var o=h.get(y.integerFromBuffer(e.version)),s;s=c.encode(i.Buffer.concat(r)),e.xprivkey=new t(s);var u=new p(a.fromBuffer(e.privateKey),o),l=u.toPublicKey(),d=E.ParentFingerPrintSize,g=f.sha256ripemd160(l.toBuffer()).slice(0,d);return v.defineImmutable(this,{xprivkey:s,network:o,depth:y.integerFromSingleByteBuffer(e.depth),privateKey:u,publicKey:l,fingerPrint:g}),this._hdPublicKey=null,Object.defineProperty(this,"hdPublicKey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey}}),Object.defineProperty(this,"xpubkey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey.xpubkey}}),this},E._validateBufferArguments=function(e){var t=function(t,r){var i=e[t];n(y.isBuffer(i),t+" argument is not a buffer"),n(i.length===r,t+" has not the expected size: found "+i.length+", expected "+r)};t("version",E.VersionSize),t("depth",E.DepthSize),t("parentFingerPrint",E.ParentFingerPrintSize),t("childIndex",E.ChildIndexSize),t("chainCode",E.ChainCodeSize),t("privateKey",E.PrivateKeySize),e.checksum&&e.checksum.length&&t("checksum",E.CheckSumSize)},E.prototype.toString=function(){return this.xprivkey},E.prototype.inspect=function(){return""},E.prototype.toObject=E.prototype.toJSON=function e(){return{network:h.get(y.integerFromBuffer(this._buffers.version),"xprivkey").name,depth:y.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:y.integerFromBuffer(this.fingerPrint),parentFingerPrint:y.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:y.integerFromBuffer(this._buffers.childIndex),chainCode:y.bufferToHex(this._buffers.chainCode),privateKey:this.privateKey.toBuffer().toString("hex"),checksum:y.integerFromBuffer(this._buffers.checksum),xprivkey:this.xprivkey}},E.fromBuffer=function(e){return new E(e.toString())},E.prototype.toBuffer=function(){return y.copy(this._buffers.xprivkey)},E.DefaultDepth=0,E.DefaultFingerprint=0,E.DefaultChildIndex=0,E.Hardened=2147483648,E.MaxIndex=2*E.Hardened,E.RootElementAlias=["m","M","m'","M'"],E.VersionSize=4,E.DepthSize=1,E.ParentFingerPrintSize=4,E.ChildIndexSize=4,E.ChainCodeSize=32,E.PrivateKeySize=32,E.CheckSumSize=4,E.DataLength=78,E.SerializedByteSize=82,E.VersionStart=0,E.VersionEnd=E.VersionStart+E.VersionSize,E.DepthStart=E.VersionEnd,E.DepthEnd=E.DepthStart+E.DepthSize,E.ParentFingerPrintStart=E.DepthEnd,E.ParentFingerPrintEnd=E.ParentFingerPrintStart+E.ParentFingerPrintSize,E.ChildIndexStart=E.ParentFingerPrintEnd,E.ChildIndexEnd=E.ChildIndexStart+E.ChildIndexSize,E.ChainCodeStart=E.ChildIndexEnd,E.ChainCodeEnd=E.ChainCodeStart+E.ChainCodeSize,E.PrivateKeyStart=E.ChainCodeEnd+1,E.PrivateKeyEnd=E.PrivateKeyStart+E.PrivateKeySize,E.ChecksumStart=E.PrivateKeyEnd,E.ChecksumEnd=E.ChecksumStart+E.CheckSumSize,n(E.ChecksumEnd===E.SerializedByteSize),e.exports=E}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(22),o=r(45),s=r(246),a=r(181),u=r(50),c=r(579),f=r(332),h=r(116),l=r(143),d=r(85),p=r(76),g=p,m=p.HDPublicKey,b=r(27),y=r(36),v=r(26);function _(e){if(e instanceof _)return e;if(!(this instanceof _))return new _(e);if(e){if(n.isString(e)||v.isBuffer(e)){var t=_.getSerializedError(e);if(t){if(v.isBuffer(e)&&!_.getSerializedError(e.toString()))return this._buildFromSerialized(e.toString());if(t instanceof m.ArgumentIsPrivateExtended)return new c(e).hdPublicKey;throw t}return this._buildFromSerialized(e)}if(n.isObject(e))return e instanceof c?this._buildFromPrivate(e):this._buildFromObject(e);throw new m.UnrecognizedArgument(e)}throw new m.MustSupplyArgument}_.isValidPath=function(e){if(n.isString(e)){var t=c._getDerivationIndexes(e);return null!==t&&n.all(t,_.isValidPath)}return!!n.isNumber(e)&&(e>=0&&e<_.Hardened)},_.prototype.derive=function(e,t){if(n.isNumber(e))return this._deriveWithNumber(e,t);if(n.isString(e))return this._deriveFromString(e);throw new m.InvalidDerivationArgument(e)},_.prototype._deriveWithNumber=function(e,t){if(e>=_.Hardened||t)throw new m.InvalidIndexCantDeriveHardened;if(e<0)throw new m.InvalidPath(e);var r=f.get(this.xpubkey,e,!1);if(r)return r;var n=v.integerAsBuffer(e),i=v.concat([this.publicKey.toBuffer(),n]),s=u.sha512hmac(i,this._buffers.chainCode),a=o.fromBuffer(s.slice(0,32),{size:32}),c=s.slice(32,64),h=d.fromPoint(l.getG().mul(a).add(this.publicKey.point)),p=new _({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:e,chainCode:c,publicKey:h});return f.set(this.xpubkey,e,!1,p),p},_.prototype._deriveFromString=function(e){if(n.contains(e,"'"))throw new m.InvalidIndexCantDeriveHardened;if(!_.isValidPath(e))throw new m.InvalidPath(e);var t=c._getDerivationIndexes(e),r=t.reduce(function(e,t){return e._deriveWithNumber(t)},this);return r},_.isValidSerialized=function(e,t){return n.isNull(_.getSerializedError(e,t))},_.getSerializedError=function(e,t){if(!n.isString(e)&&!v.isBuffer(e))return new m.UnrecognizedArgument("expected buffer or string");if(!s.validCharacters(e))return new g.InvalidB58Char("(unknown)",e);try{e=a.decode(e)}catch(t){return new g.InvalidB58Checksum(e)}if(e.length!==_.DataSize)return new m.InvalidLength(e);if(!n.isUndefined(t)){var r=_._validateNetwork(e,t);if(r)return r}var i=v.integerFromBuffer(e.slice(0,4));return i===h.livenet.xprivkey||i===h.testnet.xprivkey?new m.ArgumentIsPrivateExtended:null},_._validateNetwork=function(e,t){var r=h.get(t);if(!r)return new g.InvalidNetworkArgument(t);var n=e.slice(_.VersionStart,_.VersionEnd);return v.integerFromBuffer(n)!==r.xpubkey?new g.InvalidNetwork(n):null},_.prototype._buildFromPrivate=function(e){var t=n.clone(e._buffers),r=l.getG().mul(o.fromBuffer(t.privateKey));return t.publicKey=l.pointToCompressed(r),t.version=v.integerAsBuffer(h.get(v.integerFromBuffer(t.version)).xpubkey),t.privateKey=void 0,t.checksum=void 0,t.xprivkey=void 0,this._buildFromBuffers(t)},_.prototype._buildFromObject=function(e){var t={version:e.network?v.integerAsBuffer(h.get(e.network).xpubkey):e.version,depth:n.isNumber(e.depth)?v.integerAsSingleByteBuffer(e.depth):e.depth,parentFingerPrint:n.isNumber(e.parentFingerPrint)?v.integerAsBuffer(e.parentFingerPrint):e.parentFingerPrint,childIndex:n.isNumber(e.childIndex)?v.integerAsBuffer(e.childIndex):e.childIndex,chainCode:n.isString(e.chainCode)?v.hexToBuffer(e.chainCode):e.chainCode,publicKey:n.isString(e.publicKey)?v.hexToBuffer(e.publicKey):v.isBuffer(e.publicKey)?e.publicKey:e.publicKey.toBuffer(),checksum:n.isNumber(e.checksum)?v.integerAsBuffer(e.checksum):e.checksum};return this._buildFromBuffers(t)},_.prototype._buildFromSerialized=function(e){var t=a.decode(e),r={version:t.slice(_.VersionStart,_.VersionEnd),depth:t.slice(_.DepthStart,_.DepthEnd),parentFingerPrint:t.slice(_.ParentFingerPrintStart,_.ParentFingerPrintEnd),childIndex:t.slice(_.ChildIndexStart,_.ChildIndexEnd),chainCode:t.slice(_.ChainCodeStart,_.ChainCodeEnd),publicKey:t.slice(_.PublicKeyStart,_.PublicKeyEnd),checksum:t.slice(_.ChecksumStart,_.ChecksumEnd),xpubkey:e};return this._buildFromBuffers(r)},_.prototype._buildFromBuffers=function(e){_._validateBufferArguments(e),y.defineImmutable(this,{_buffers:e});var r=[e.version,e.depth,e.parentFingerPrint,e.childIndex,e.chainCode,e.publicKey],n=v.concat(r),i=a.checksum(n);if(e.checksum&&e.checksum.length){if(e.checksum.toString("hex")!==i.toString("hex"))throw new g.InvalidB58Checksum(n,i)}else e.checksum=i;var o=h.get(v.integerFromBuffer(e.version)),s;s=a.encode(v.concat(r)),e.xpubkey=new t(s);var c=new d(e.publicKey,{network:o}),f=_.ParentFingerPrintSize,l=u.sha256ripemd160(c.toBuffer()).slice(0,f);return y.defineImmutable(this,{xpubkey:s,network:o,depth:v.integerFromSingleByteBuffer(e.depth),publicKey:c,fingerPrint:l}),this},_._validateBufferArguments=function(e){var t=function(t,r){var n=e[t];b(v.isBuffer(n),t+" argument is not a buffer, it's "+typeof n),b(n.length===r,t+" has not the expected size: found "+n.length+", expected "+r)};t("version",_.VersionSize),t("depth",_.DepthSize),t("parentFingerPrint",_.ParentFingerPrintSize),t("childIndex",_.ChildIndexSize),t("chainCode",_.ChainCodeSize),t("publicKey",_.PublicKeySize),e.checksum&&e.checksum.length&&t("checksum",_.CheckSumSize)},_.fromString=function(e){return i.checkArgument(n.isString(e),"No valid string was provided"),new _(e)},_.fromObject=function(e){return i.checkArgument(n.isObject(e),"No valid argument was provided"),new _(e)},_.prototype.toString=function(){return this.xpubkey},_.prototype.inspect=function(){return""},_.prototype.toObject=_.prototype.toJSON=function e(){return{network:h.get(v.integerFromBuffer(this._buffers.version)).name,depth:v.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:v.integerFromBuffer(this.fingerPrint),parentFingerPrint:v.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:v.integerFromBuffer(this._buffers.childIndex),chainCode:v.bufferToHex(this._buffers.chainCode),publicKey:this.publicKey.toString(),checksum:v.integerFromBuffer(this._buffers.checksum),xpubkey:this.xpubkey}},_.fromBuffer=function(e){return new _(e)},_.prototype.toBuffer=function(){return v.copy(this._buffers.xpubkey)},_.Hardened=2147483648,_.RootElementAlias=["m","M"],_.VersionSize=4,_.DepthSize=1,_.ParentFingerPrintSize=4,_.ChildIndexSize=4,_.ChainCodeSize=32,_.PublicKeySize=33,_.CheckSumSize=4,_.DataSize=78,_.SerializedByteSize=82,_.VersionStart=0,_.VersionEnd=_.VersionStart+_.VersionSize,_.DepthStart=_.VersionEnd,_.DepthEnd=_.DepthStart+_.DepthSize,_.ParentFingerPrintStart=_.DepthEnd,_.ParentFingerPrintEnd=_.ParentFingerPrintStart+_.ParentFingerPrintSize,_.ChildIndexStart=_.ParentFingerPrintEnd,_.ChildIndexEnd=_.ChildIndexStart+_.ChildIndexSize,_.ChainCodeStart=_.ChildIndexEnd,_.ChainCodeEnd=_.ChainCodeStart+_.ChainCodeSize,_.PublicKeyStart=_.ChainCodeEnd,_.PublicKeyEnd=_.PublicKeyStart+_.PublicKeySize,_.ChecksumStart=_.PublicKeyEnd,_.ChecksumEnd=_.ChecksumStart+_.CheckSumSize,b(_.PublicKeyEnd===_.DataSize),b(_.ChecksumEnd===_.SerializedByteSize),e.exports=_}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(3),i=r(184),o=r(24),s=r(140),a=r(522),u=r(174).isSource,c=r(145),f=r(185);e.exports=(e=>{const r=f(e,"add"),h=n((e,n,f)=>{"function"==typeof n&&(f=n,n=null);const h=o(f);n||(n={}),n.converter=c;const l=e=>t.isBuffer(e)||s.readable(e)||u(e),d=e=>"object"==typeof e&&(e.content?l(e.content):Boolean(e.path)&&a(e.path)),p=e=>l(e)||d(e),g=p(e)||Array.isArray(e)&&e.every(p);if(!g)return h(new Error("invalid input: expected buffer, readable stream, pull stream, object or array of objects"));const m=[].concat(e),b=r({qs:n}),y=i(e=>h(null,e));b.once("error",h),b.pipe(y),m.forEach(e=>b.write(e)),b.end()});return function(){const e=Array.from(arguments);return 1===e.length&&u(e[0])&&e.push({}),h.apply(null,e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1421),i=r(334);e.exports=(e=>0===e.indexOf("https")?i.request:n.request)},function(e,t,r){(function(e){var r;function n(){if(void 0!==r)return r;if(e.XMLHttpRequest){r=new e.XMLHttpRequest;try{r.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){r=null}}else r=null;return r}function i(e){var t=n();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}function o(e){return"function"==typeof e}t.fetch=o(e.fetch)&&o(e.ReadableStream),t.writableStream=o(e.WritableStream),t.abortController=o(e.AbortController),t.arraybuffer=t.fetch||i("arraybuffer"),t.msstream=!t.fetch&&i("ms-stream"),t.mozchunkedarraybuffer=!t.fetch&&i("moz-chunked-arraybuffer"),t.overrideMimeType=t.fetch||!!n()&&o(n().overrideMimeType),r=null}).call(this,r(8))},function(e,t,r){(function(e,n,i){var o=r(583),s=r(1),a=r(23),u=t.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},c=t.IncomingMessage=function(t,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(){e.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)}),o.writableStream){var f=new WritableStream({write:function(e){return new Promise(function(t,r){c._destroyed?r():c.push(n.from(e))?t():c._resumeFetch=t})},close:function(){i.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){i.clearTimeout(u),c._destroyed||c.emit("error",e)})}catch(e){}}var h=r.body.getReader();function l(){h.read().then(function(e){if(!c._destroyed){if(e.done)return i.clearTimeout(u),void c.push(null);c.push(n.from(e.value)),l()}}).catch(function(e){i.clearTimeout(u),c._destroyed||c.emit("error",e)})}l()}else{c._xhr=t,c._pos=0,c.url=t.responseURL,c.statusCode=t.status,c.statusMessage=t.statusText;var d=t.getAllResponseHeaders().split(/\r?\n/);if(d.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",!o.overrideMimeType){var p=c.rawHeaders["mime-type"];if(p){var g=p.match(/;\s*charset=([^;])(;|$)/);g&&(c._charset=g[1].toLowerCase())}c._charset||(c._charset="utf-8")}}};s(c,a.Readable),c.prototype._read=function(){var e=this,t=this._resumeFetch;t&&(this._resumeFetch=null,t())},c.prototype._onXHRProgress=function(){var e=this,t=e._xhr,r=null;switch(e._mode){case"text":if(r=t.responseText,r.length>e._pos){var o=r.substr(e._pos);if("x-user-defined"===e._charset){for(var s=n.alloc(o.length),a=0;ae._pos&&(e.push(n.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,r(2),r(0).Buffer,r(8))},function(e,t){e.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"}},function(e,t,r){(function(e){t.fetch=a(e.fetch)&&a(e.ReadableStream),t.writableStream=a(e.WritableStream),t.abortController=a(e.AbortController),t.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),t.blobConstructor=!0}catch(e){}var r;function n(){if(void 0!==r)return r;if(e.XMLHttpRequest){r=new e.XMLHttpRequest;try{r.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){r=null}}else r=null;return r}function i(e){var t=n();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}var o=void 0!==e.ArrayBuffer,s=o&&a(e.ArrayBuffer.prototype.slice);function a(e){return"function"==typeof e}t.arraybuffer=t.fetch||o&&i("arraybuffer"),t.msstream=!t.fetch&&s&&i("ms-stream"),t.mozchunkedarraybuffer=!t.fetch&&o&&i("moz-chunked-arraybuffer"),t.overrideMimeType=t.fetch||!!n()&&a(n().overrideMimeType),t.vbArray=a(e.VBArray),r=null}).call(this,r(8))},function(e,t,r){(function(e,n,i){var o=r(586),s=r(1),a=r(588),u=t.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},c=t.IncomingMessage=function(t,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(){e.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)}),o.writableStream){var f=new WritableStream({write:function(e){return new Promise(function(t,r){c._destroyed?r():c.push(new n(e))?t():c._resumeFetch=t})},close:function(){i.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){i.clearTimeout(u),c._destroyed||c.emit("error",e)})}catch(e){}}var h=r.body.getReader();function l(){h.read().then(function(e){if(!c._destroyed){if(e.done)return i.clearTimeout(u),void c.push(null);c.push(new n(e.value)),l()}}).catch(function(e){i.clearTimeout(u),c._destroyed||c.emit("error",e)})}l()}else{c._xhr=t,c._pos=0,c.url=t.responseURL,c.statusCode=t.status,c.statusMessage=t.statusText;var d=t.getAllResponseHeaders().split(/\r?\n/);if(d.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",!o.overrideMimeType){var p=c.rawHeaders["mime-type"];if(p){var g=p.match(/;\s*charset=([^;])(;|$)/);g&&(c._charset=g[1].toLowerCase())}c._charset||(c._charset="utf-8")}}};s(c,a.Readable),c.prototype._read=function(){var e=this,t=this._resumeFetch;t&&(this._resumeFetch=null,t())},c.prototype._onXHRProgress=function(){var e=this,t=e._xhr,r=null;switch(e._mode){case"text:vbarray":if(t.readyState!==u.DONE)break;try{r=new i.VBArray(t.responseBody).toArray()}catch(e){}if(null!==r){e.push(new n(r));break}case"text":try{r=t.responseText}catch(t){e._mode="text:vbarray";break}if(r.length>e._pos){var o=r.substr(e._pos);if("x-user-defined"===e._charset){for(var s=new n(o.length),a=0;ae._pos&&(e.push(new n(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,r(2),r(0).Buffer,r(8))},function(e,t,r){t=e.exports=r(589),t.Stream=t,t.Readable=t,t.Writable=r(592),t.Duplex=r(146),t.Transform=r(593),t.PassThrough=r(1427)},function(e,t,r){"use strict";(function(t,n){var i=r(10);e.exports=E;var o=r(37),s;E.ReadableState=S;var a=r(7).EventEmitter,u=function(e,t){return e.listeners(t).length},c=r(590),f=r(4).Buffer,h=t.Uint8Array||function(){};function l(e){return f.from(e)}function d(e){return f.isBuffer(e)||e instanceof h}var p=r(5);p.inherits=r(1);var g=r(1424),m=void 0;m=g&&g.debuglog?g.debuglog("stream"):function(){};var b=r(1425),y=r(591),v;p.inherits(E,c);var _=["error","close","destroy","pause","resume"];function w(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}function S(e,t){s=s||r(146),e=e||{};var n=t instanceof s;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new b,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=r(13).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function E(e){if(s=s||r(146),!(this instanceof E))return new E(e);this._readableState=new S(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function k(e,t,r,n,i){var o=e._readableState,s;null===t?(o.reading=!1,R(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=l(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):M(e,o)):x(e,o,t,!1))):n||(o.reading=!1));return A(o)}function x(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&B(e)),M(e,t)}function C(e,t){var r;return d(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function O(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(m("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(P,e):P(e))}function P(e){m("emit readable"),e.emit("readable"),U(e)}function M(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=z(e,t.buffer,t.decoder),r);var r}function z(e,t,r){var n;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}function K(e,t){var r=f.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),e-=s,0===e){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}function W(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(V,t,e))}function V(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function G(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return m("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?W(this):B(this),null;if(e=O(e,t),0===e&&t.ended)return 0===t.length&&W(this),null;var n=t.needReadable,i;return m("need readable",n),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&W(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var r=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,m("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,a=s?f:_;function c(e,t){m("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function f(){m("onend"),e.end()}o.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",c);var h=L(r);e.on("drain",h);var l=!1;function d(){m("cleanup"),e.removeListener("close",y),e.removeListener("finish",v),e.removeListener("drain",h),e.removeListener("error",b),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",g),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var p=!1;function g(t){m("ondata"),p=!1;var n=e.write(t);!1!==n||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==G(o.pipes,e))&&!l&&(m("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function b(t){m("onerror",t),_(),e.removeListener("error",b),0===u(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",v),_()}function v(){m("onfinish"),e.removeListener("close",y),_()}function _(){m("unpipe"),r.unpipe(e)}return r.on("data",g),w(e,"error",b),e.once("close",y),e.once("finish",v),e.emit("pipe",r),o.flowing||(m("pipe resume"),r.resume()),e},E.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?this:(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,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var c=r(5);c.inherits=r(1);var f={deprecate:r(38)},h=r(590),l=r(4).Buffer,d=n.Uint8Array||function(){};function p(e){return l.from(e)}function g(e){return l.isBuffer(e)||e instanceof d}var m=r(591),b;function y(){}function v(e,t){u=u||r(146),e=e||{};var n=t instanceof u;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||r(146),!(b.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var r=new Error("write after end");e.emit("error",r),i.nextTick(t,r)}function S(e,t,r,n){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(n,s),o=!1),o}function E(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r)),t}function k(e,t,r,n,i,o){if(!r){var s=E(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||L(this,n,r)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(2),r(8))},function(e,t,r){"use strict";e.exports=s;var n=r(146),i=r(5);function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=l(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):M(e,o)):x(e,o,t,!1))):n||(o.reading=!1));return A(o)}function x(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&B(e)),M(e,t)}function C(e,t){var r;return d(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function O(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(m("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(P,e):P(e))}function P(e){m("emit readable"),e.emit("readable"),U(e)}function M(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=z(e,t.buffer,t.decoder),r);var r}function z(e,t,r){var n;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}function K(e,t){var r=f.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),e-=s,0===e){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}function W(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(V,t,e))}function V(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function G(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return m("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?W(this):B(this),null;if(e=O(e,t),0===e&&t.ended)return 0===t.length&&W(this),null;var n=t.needReadable,i;return m("need readable",n),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&W(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var r=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,m("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,a=s?f:_;function c(e,t){m("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function f(){m("onend"),e.end()}o.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",c);var h=L(r);e.on("drain",h);var l=!1;function d(){m("cleanup"),e.removeListener("close",y),e.removeListener("finish",v),e.removeListener("drain",h),e.removeListener("error",b),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",g),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var p=!1;function g(t){m("ondata"),p=!1;var n=e.write(t);!1!==n||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==G(o.pipes,e))&&!l&&(m("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function b(t){m("onerror",t),_(),e.removeListener("error",b),0===u(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",v),_()}function v(){m("onfinish"),e.removeListener("close",y),_()}function _(){m("unpipe"),r.unpipe(e)}return r.on("data",g),w(e,"error",b),e.once("close",y),e.once("finish",v),e.emit("pipe",r),o.flowing||(m("pipe resume"),r.resume()),e},E.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?this:(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,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var c=r(5);c.inherits=r(1);var f={deprecate:r(38)},h=r(596),l=r(4).Buffer,d=n.Uint8Array||function(){};function p(e){return l.from(e)}function g(e){return l.isBuffer(e)||e instanceof d}var m=r(597),b;function y(){}function v(e,t){u=u||r(118),e=e||{};var n=t instanceof u;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||r(118),!(b.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var r=new Error("write after end");e.emit("error",r),i.nextTick(t,r)}function S(e,t,r,n){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(n,s),o=!1),o}function E(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r)),t}function k(e,t,r,n,i,o){if(!r){var s=E(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||L(this,n,r)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(2),r(8))},function(e,t,r){(function(e){var n=r(600),i=r(119),o="0000000000000000000",s="7777777777777777777",a="0".charCodeAt(0),u="ustar\x0000",c=parseInt("7777",8),f=function(e,t,r){return"number"!=typeof e?r:(e=~~e,e>=t?t:e>=0?e:(e+=t,e>=0?e:0))},h=function(e){switch(e){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null},l=function(e){switch(e){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0},d=function(e,t,r,n){for(;rt?s.slice(0,t)+" ":o.slice(0,t-e.length)+e+" "};function m(e){var t;if(128===e[0])t=!0;else{if(255!==e[0])return null;t=!1}for(var r=!1,n=[],i=e.length-1;i>0;i--){var o=e[i];t?n.push(o):r&&0===o?n.push(0):r?(r=!1,n.push(256-o)):n.push(255-o)}var s=0,a=n.length;for(i=0;i=Math.pow(10,n)&&n++,r+n+t};t.decodeLongPath=function(e,t){return y(e,0,e.length,t)},t.encodePax=function(e){var t="";e.name&&(t+=v(" path="+e.name+"\n")),e.linkname&&(t+=v(" linkpath="+e.linkname+"\n"));var r=e.pax;if(r)for(var i in r)t+=v(" "+i+"="+r[i]+"\n");return n(t)},t.decodePax=function(e){for(var t={};e.length;){for(var r=0;r100;){var s=n.indexOf("/");if(-1===s)return null;o+=o?"/"+n.slice(0,s):n.slice(0,s),n=n.slice(s+1)}return e.byteLength(n)>100||e.byteLength(o)>155?null:t.linkname&&e.byteLength(t.linkname)>100?null:(r.write(n),r.write(g(t.mode&c,6),100),r.write(g(t.uid,6),108),r.write(g(t.gid,6),116),r.write(g(t.size,11),124),r.write(g(t.mtime.getTime()/1e3|0,11),136),r[156]=a+l(t.type),t.linkname&&r.write(t.linkname,157),r.write(u,257),t.uname&&r.write(t.uname,265),t.gname&&r.write(t.gname,297),r.write(g(t.devmajor||0,6),329),r.write(g(t.devminor||0,6),337),o&&r.write(o,345),r.write(g(p(r),6),148),r)},t.decode=function(e,t){var r=0===e[156]?0:e[156]-a,n=y(e,0,100,t),i=b(e,100,8),o=b(e,108,8),s=b(e,116,8),u=b(e,124,12),c=b(e,136,12),f=h(r),l=0===e[157]?null:y(e,157,100,t),d=y(e,265,32),g=y(e,297,32),m=b(e,329,8),v=b(e,337,8);e[345]&&(n=y(e,345,155,t)+"/"+n),0===r&&n&&"/"===n[n.length-1]&&(r=5);var _=p(e);if(256===_)return null;if(_!==b(e,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");return{name:n,mode:i,uid:o,gid:s,size:u,mtime:new Date(1e3*c),type:f,linkname:l,uname:d,gname:g,devmajor:m,devminor:v}}}).call(this,r(0).Buffer)},function(e,t,r){(function(t){e.exports=i;var r=t.from&&t.from!==Uint8Array.from?t.from:n;function n(e,r){return new t(e,r)}function i(e,n){if(t.isBuffer(e))return e;if("string"==typeof e)return r(e,n);if(Array.isArray(e))return r(e);throw new Error("Input should be a buffer or a string")}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports=s;var n=r(118),i=r(5);function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length({"api-path":"/api/v0/","user-agent":`/node-${n.name}/${n.version}/`,host:"localhost",port:"5001",protocol:"http"}))},function(e,t,r){"use strict";(function(n){const i=r(1450),o=r(337).encode,s=r(186),a=r(338),u=r(49),c=r(24),f=r(103),h=r(1467),l=r(582),d=r(6)("ipfs-http-client:request");function p(e,t){const r=new Error(`Server responded with ${e.statusCode}`);h(e,(e,n)=>{if(e)return t(e);n&&(r.code=n.Code,r.message=n.Message||n.toString(),r.type=n.Type),t(r)})}function g(e,t){return r=>{const n=Boolean(r.headers["x-stream-output"]),i=Boolean(r.headers["x-chunked-output"]),o=r.headers["content-type"]&&0===r.headers["content-type"].indexOf("application/json");if(r.req?d(r.req.method,`${r.req.getHeaders().host}${r.req.path}`,r.statusCode,r.statusMessage):d(r.url,r.statusCode,r.statusMessage),r.statusCode>=400||!r.statusCode)return p(r,t);if(n&&!e)return t(null,r);if(i&&o){const e=a.parse();return u(r,e),r.on("end",()=>{let t=r.trailers["x-stream-error"];if(t){try{t=JSON.parse(t)}catch(e){t={Message:t}}e.emit("error",new Error(t.Message))}}),t(null,e)}return o?h(r,t):f(r,t)}}function m(e,t,r){r=c(r),t.qs=t.qs||{},Array.isArray(t.path)&&(t.path=t.path.join("/")),t.args&&!Array.isArray(t.args)&&(t.args=[t.args]),t.args&&(t.qs.arg=t.args),t.progress&&(t.qs.progress=!0),t.qs.r&&(t.qs.recursive=t.qs.r,delete t.qs.r),t.qs["stream-channels"]=!0,t.stream&&(t.buffer=!1),delete t.qs.followSymlinks;const a="POST",u=Object.assign({},e.headers);if(s&&(u["User-Agent"]=e["user-agent"]),t.multipart){if(!t.multipartBoundary)return r(new Error("No multipartBoundary"));u["Content-Type"]=`multipart/form-data; boundary=${t.multipartBoundary}`}const f=i.stringify(t.qs,{arrayFormat:"repeat",encoder:e=>{if(n.isBuffer(e)){let t="";for(const r of e)if(r>=65&&r<=90||r>=97&&r<=122||r>=48&&r<=57||45===r||46===r||95===r||126===r)t+=String.fromCharCode(r);else{const e=r.toString(16),n=1===e.length?`0${e}`:e;t+=`%${n}`}return t}return o(e)}}),h={hostname:e.host,path:`${e["api-path"]}${t.path}?${f}`,port:e.port,method:"POST",headers:u,protocol:`${e.protocol}:`},d=l(e.protocol)(h,g(t.buffer,r));return d.on("error",e=>{r(e)}),t.stream||d.end(),d}t=e.exports=(e=>{const t=(t,r)=>"object"!=typeof t?r(new Error("no options were passed")):m(e,t,r);return t.andTransform=((e,r,n)=>t(e,(e,t)=>{if(e)return n(e);r(t,n)})),t})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=String.prototype.replace,i=/%20/g;e.exports={default:"RFC3986",formatters:{RFC1738:function(e){return n.call(e,i,"+")},RFC3986:function(e){return e}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},function(e,t,r){"use strict";(function(t,n){var i=r(10);e.exports=E;var o=r(37),s;E.ReadableState=S;var a=r(7).EventEmitter,u=function(e,t){return e.listeners(t).length},c=r(606),f=r(4).Buffer,h=t.Uint8Array||function(){};function l(e){return f.from(e)}function d(e){return f.isBuffer(e)||e instanceof h}var p=r(5);p.inherits=r(1);var g=r(1455),m=void 0;m=g&&g.debuglog?g.debuglog("stream"):function(){};var b=r(1456),y=r(607),v;p.inherits(E,c);var _=["error","close","destroy","pause","resume"];function w(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}function S(e,t){s=s||r(147),e=e||{};var n=t instanceof s;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new b,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=r(13).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function E(e){if(s=s||r(147),!(this instanceof E))return new E(e);this._readableState=new S(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function k(e,t,r,n,i){var o=e._readableState,s;null===t?(o.reading=!1,R(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=l(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):M(e,o)):x(e,o,t,!1))):n||(o.reading=!1));return A(o)}function x(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&B(e)),M(e,t)}function C(e,t){var r;return d(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function O(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(m("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(P,e):P(e))}function P(e){m("emit readable"),e.emit("readable"),U(e)}function M(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=z(e,t.buffer,t.decoder),r);var r}function z(e,t,r){var n;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}function K(e,t){var r=f.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),e-=s,0===e){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}function W(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(V,t,e))}function V(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function G(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return m("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?W(this):B(this),null;if(e=O(e,t),0===e&&t.ended)return 0===t.length&&W(this),null;var n=t.needReadable,i;return m("need readable",n),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&W(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var r=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,m("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,a=s?f:_;function c(e,t){m("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function f(){m("onend"),e.end()}o.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",c);var h=L(r);e.on("drain",h);var l=!1;function d(){m("cleanup"),e.removeListener("close",y),e.removeListener("finish",v),e.removeListener("drain",h),e.removeListener("error",b),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",g),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var p=!1;function g(t){m("ondata"),p=!1;var n=e.write(t);!1!==n||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==G(o.pipes,e))&&!l&&(m("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function b(t){m("onerror",t),_(),e.removeListener("error",b),0===u(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",v),_()}function v(){m("onfinish"),e.removeListener("close",y),_()}function _(){m("unpipe"),r.unpipe(e)}return r.on("data",g),w(e,"error",b),e.once("close",y),e.once("finish",v),e.emit("pipe",r),o.flowing||(m("pipe resume"),r.resume()),e},E.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?this:(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,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var c=r(5);c.inherits=r(1);var f={deprecate:r(38)},h=r(606),l=r(4).Buffer,d=n.Uint8Array||function(){};function p(e){return l.from(e)}function g(e){return l.isBuffer(e)||e instanceof d}var m=r(607),b;function y(){}function v(e,t){u=u||r(147),e=e||{};var n=t instanceof u;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||r(147),!(b.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var r=new Error("write after end");e.emit("error",r),i.nextTick(t,r)}function S(e,t,r,n){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(n,s),o=!1),o}function E(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r)),t}function k(e,t,r,n,i,o){if(!r){var s=E(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||L(this,n,r)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(2),r(8))},function(e,t,r){"use strict";e.exports=s;var n=r(147),i=r(5);function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=l(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):M(e,o)):x(e,o,t,!1))):n||(o.reading=!1));return A(o)}function x(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&B(e)),M(e,t)}function C(e,t){var r;return d(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function O(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(m("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(P,e):P(e))}function P(e){m("emit readable"),e.emit("readable"),U(e)}function M(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=z(e,t.buffer,t.decoder),r);var r}function z(e,t,r){var n;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}function K(e,t){var r=f.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),e-=s,0===e){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}function W(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(V,t,e))}function V(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function G(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return m("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?W(this):B(this),null;if(e=O(e,t),0===e&&t.ended)return 0===t.length&&W(this),null;var n=t.needReadable,i;return m("need readable",n),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&W(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var r=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,m("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,a=s?f:_;function c(e,t){m("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function f(){m("onend"),e.end()}o.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",c);var h=L(r);e.on("drain",h);var l=!1;function d(){m("cleanup"),e.removeListener("close",y),e.removeListener("finish",v),e.removeListener("drain",h),e.removeListener("error",b),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",g),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var p=!1;function g(t){m("ondata"),p=!1;var n=e.write(t);!1!==n||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==G(o.pipes,e))&&!l&&(m("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function b(t){m("onerror",t),_(),e.removeListener("error",b),0===u(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",v),_()}function v(){m("onfinish"),e.removeListener("close",y),_()}function _(){m("unpipe"),r.unpipe(e)}return r.on("data",g),w(e,"error",b),e.once("close",y),e.once("finish",v),e.emit("pipe",r),o.flowing||(m("pipe resume"),r.resume()),e},E.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?this:(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,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var c=r(5);c.inherits=r(1);var f={deprecate:r(38)},h=r(611),l=r(4).Buffer,d=n.Uint8Array||function(){};function p(e){return l.from(e)}function g(e){return l.isBuffer(e)||e instanceof d}var m=r(612),b;function y(){}function v(e,t){u=u||r(148),e=e||{};var n=t instanceof u;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||r(148),!(b.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var r=new Error("write after end");e.emit("error",r),i.nextTick(t,r)}function S(e,t,r,n){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(n,s),o=!1),o}function E(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r)),t}function k(e,t,r,n,i,o){if(!r){var s=E(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||L(this,n,r)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(2),r(8))},function(e,t,r){"use strict";e.exports=s;var n=r(148),i=r(5);function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{const t=n(e);return{get:r(1470)(t),stat:r(1471)(t),put:r(1472)(t)}})},function(e,t,r){"use strict";e.exports=(e=>{const t=e.pop();let r={},n=[];return Array.isArray(e[e.length-1])||"object"!=typeof e[e.length-1]||(r=e.pop()),n=1===e.length&&Array.isArray(e[0])?e[0]:e,{callback:t,sources:n,opts:r}})},function(e,t,r){var n=r(219),i=r(1583),o=r(1584),s=r(1585),a=r(1586),u=r(1587);function c(e){var t=this.__data__=new n(e);this.size=t.size}c.prototype.clear=i,c.prototype.delete=o,c.prototype.get=s,c.prototype.has=a,c.prototype.set=u,e.exports=c},function(e,t,r){var n=r(1588),i=r(124);function o(e,t,r,s,a){return e===t||(null==e||null==t||!i(e)&&!i(t)?e!=e&&t!=t:n(e,t,r,s,o,a))}e.exports=o},function(e,t,r){var n=r(1589),i=r(1592),o=r(1593),s=1,a=2;function u(e,t,r,u,c,f){var h=r&s,l=e.length,d=t.length;if(l!=d&&!(h&&d>l))return!1;var p=f.get(e);if(p&&f.get(t))return p==t;var g=-1,m=!0,b=r&a?new n:void 0;for(f.set(e,t),f.set(t,e);++g({name:e.Name,type:e.Type,size:e.Size,hash:e.Hash});e.exports=(e=>(t,r)=>{r=r||{};const c=new n({objectMode:!0,transform(e,t,r){r(null,u(e))}}),f=new i({objectMode:!0});return e({path:"files/ls",args:t,qs:Object.assign({},r,{stream:!0})},(e,t)=>{if(e)return f.destroy(e);if(a(t)){const e=s.parse();o(t,e,c,f)}else{const e=t.Entries||[];e.forEach(e=>{f.write(u(e))}),f.end()}}),f})},function(e,t,r){(function(e,r){var n=200,i="__lodash_hash_undefined__",o=9007199254740991,s="[object Arguments]",a="[object Array]",u="[object Boolean]",c="[object Date]",f="[object Error]",h="[object Function]",l="[object GeneratorFunction]",d="[object Map]",p="[object Number]",g="[object Object]",m="[object Promise]",b="[object RegExp]",y="[object Set]",v="[object String]",_="[object Symbol]",w="[object WeakMap]",S="[object ArrayBuffer]",E="[object DataView]",k="[object Float32Array]",x="[object Float64Array]",C="[object Int8Array]",A="[object Int16Array]",I="[object Int32Array]",T="[object Uint8Array]",O="[object Uint8ClampedArray]",R="[object Uint16Array]",B="[object Uint32Array]",P=/[\\^$.*+?()[\]{}|]/g,M=/\w*$/,N=/^\[object .+?Constructor\]$/,L=/^(?:0|[1-9]\d*)$/,j={};j[s]=j[a]=j[S]=j[E]=j[u]=j[c]=j[k]=j[x]=j[C]=j[A]=j[I]=j[d]=j[p]=j[g]=j[b]=j[y]=j[v]=j[_]=j[T]=j[O]=j[R]=j[B]=!0,j[f]=j[h]=j[w]=!1;var D="object"==typeof e&&e&&e.Object===Object&&e,F="object"==typeof self&&self&&self.Object===Object&&self,U=D||F||Function("return this")(),q=t&&!t.nodeType&&t,z=q&&"object"==typeof r&&r&&!r.nodeType&&r,H=z&&z.exports===q;function K(e,t){return e.set(t[0],t[1]),e}function W(e,t){return e.add(t),e}function V(e,t){for(var r=-1,n=e?e.length:0;++r-1}function We(e,t){var r=this.__data__,n=st(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function Ve(e){var t=-1,r=e?e.length:0;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=o}function Gt(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function $t(e){return!!e&&"object"==typeof e}function Yt(e){return zt(e)?it(e):dt(e)}function Jt(){return[]}function Xt(){return!1}r.exports=Dt}).call(this,r(8),r(70)(e))},function(e,t,r){"use strict";e.exports="ipfs-pubsub-room/v2"},function(e,t,r){"use strict";(function(t){e.exports=(e=>{let r=e;return t.isBuffer(r)||(r=t.from(r)),r})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports=(e=>e._libp2pNode||e.libp2p)},function(e,t,r){(function(t){var n=r(1),i=r(1675).Transform,o=r(1680);function s(e,t){if(!(this instanceof s))return new s(e,t);i.call(this),t||(t={}),"object"==typeof e&&(t=e,e=t.size),this.size=e||512,t.nopad?this._zeroPadding=!1:this._zeroPadding=o(t.zeroPadding,!0),this._buffered=[],this._bufferedBytes=0}e.exports=s,n(s,i),s.prototype._transform=function(e,r,n){for(this._bufferedBytes+=e.length,this._buffered.push(e);this._bufferedBytes>=this.size;){var i=t.concat(this._buffered);this._bufferedBytes-=this.size,this.push(i.slice(0,this.size)),this._buffered=[i.slice(this.size,i.length)]}n()},s.prototype._flush=function(){if(this._bufferedBytes&&this._zeroPadding){var e=new t(this.size-this._bufferedBytes);e.fill(0),this._buffered.push(e),this.push(t.concat(this._buffered)),this._buffered=null}else this._bufferedBytes&&(this.push(t.concat(this._buffered)),this._buffered=null);this.push(null)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t,n){var i=r(10);e.exports=E;var o=r(37),s;E.ReadableState=S;var a=r(7).EventEmitter,u=function(e,t){return e.listeners(t).length},c=r(629),f=r(4).Buffer,h=t.Uint8Array||function(){};function l(e){return f.from(e)}function d(e){return f.isBuffer(e)||e instanceof h}var p=r(5);p.inherits=r(1);var g=r(1676),m=void 0;m=g&&g.debuglog?g.debuglog("stream"):function(){};var b=r(1677),y=r(630),v;p.inherits(E,c);var _=["error","close","destroy","pause","resume"];function w(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}function S(e,t){s=s||r(150),e=e||{};var n=t instanceof s;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new b,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=r(13).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function E(e){if(s=s||r(150),!(this instanceof E))return new E(e);this._readableState=new S(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function k(e,t,r,n,i){var o=e._readableState,s;null===t?(o.reading=!1,R(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=l(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):M(e,o)):x(e,o,t,!1))):n||(o.reading=!1));return A(o)}function x(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&B(e)),M(e,t)}function C(e,t){var r;return d(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function O(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(m("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(P,e):P(e))}function P(e){m("emit readable"),e.emit("readable"),U(e)}function M(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=z(e,t.buffer,t.decoder),r);var r}function z(e,t,r){var n;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}function K(e,t){var r=f.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),e-=s,0===e){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}function W(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(V,t,e))}function V(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function G(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return m("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?W(this):B(this),null;if(e=O(e,t),0===e&&t.ended)return 0===t.length&&W(this),null;var n=t.needReadable,i;return m("need readable",n),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&W(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var r=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,m("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,a=s?f:_;function c(e,t){m("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function f(){m("onend"),e.end()}o.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",c);var h=L(r);e.on("drain",h);var l=!1;function d(){m("cleanup"),e.removeListener("close",y),e.removeListener("finish",v),e.removeListener("drain",h),e.removeListener("error",b),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",g),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var p=!1;function g(t){m("ondata"),p=!1;var n=e.write(t);!1!==n||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==G(o.pipes,e))&&!l&&(m("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function b(t){m("onerror",t),_(),e.removeListener("error",b),0===u(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",v),_()}function v(){m("onfinish"),e.removeListener("close",y),_()}function _(){m("unpipe"),r.unpipe(e)}return r.on("data",g),w(e,"error",b),e.once("close",y),e.once("finish",v),e.emit("pipe",r),o.flowing||(m("pipe resume"),r.resume()),e},E.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?this:(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,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var c=r(5);c.inherits=r(1);var f={deprecate:r(38)},h=r(629),l=r(4).Buffer,d=n.Uint8Array||function(){};function p(e){return l.from(e)}function g(e){return l.isBuffer(e)||e instanceof d}var m=r(630),b;function y(){}function v(e,t){u=u||r(150),e=e||{};var n=t instanceof u;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||r(150),!(b.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var r=new Error("write after end");e.emit("error",r),i.nextTick(t,r)}function S(e,t,r,n){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(n,s),o=!1),o}function E(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r)),t}function k(e,t,r,n,i,o){if(!r){var s=E(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||L(this,n,r)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(2),r(8))},function(e,t,r){"use strict";e.exports=s;var n=r(150),i=r(5);function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=l(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):M(e,o)):x(e,o,t,!1))):n||(o.reading=!1));return A(o)}function x(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&B(e)),M(e,t)}function C(e,t){var r;return d(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function O(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(m("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(P,e):P(e))}function P(e){m("emit readable"),e.emit("readable"),U(e)}function M(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=z(e,t.buffer,t.decoder),r);var r}function z(e,t,r){var n;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}function K(e,t){var r=f.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),e-=s,0===e){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}function W(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(V,t,e))}function V(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function G(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return m("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?W(this):B(this),null;if(e=O(e,t),0===e&&t.ended)return 0===t.length&&W(this),null;var n=t.needReadable,i;return m("need readable",n),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&W(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var r=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,m("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,a=s?f:_;function c(e,t){m("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function f(){m("onend"),e.end()}o.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",c);var h=L(r);e.on("drain",h);var l=!1;function d(){m("cleanup"),e.removeListener("close",y),e.removeListener("finish",v),e.removeListener("drain",h),e.removeListener("error",b),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",g),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var p=!1;function g(t){m("ondata"),p=!1;var n=e.write(t);!1!==n||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==G(o.pipes,e))&&!l&&(m("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function b(t){m("onerror",t),_(),e.removeListener("error",b),0===u(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",v),_()}function v(){m("onfinish"),e.removeListener("close",y),_()}function _(){m("unpipe"),r.unpipe(e)}return r.on("data",g),w(e,"error",b),e.once("close",y),e.once("finish",v),e.emit("pipe",r),o.flowing||(m("pipe resume"),r.resume()),e},E.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?this:(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,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var c=r(5);c.inherits=r(1);var f={deprecate:r(38)},h=r(634),l=r(4).Buffer,d=n.Uint8Array||function(){};function p(e){return l.from(e)}function g(e){return l.isBuffer(e)||e instanceof d}var m=r(635),b;function y(){}function v(e,t){u=u||r(151),e=e||{};var n=t instanceof u;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||r(151),!(b.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var r=new Error("write after end");e.emit("error",r),i.nextTick(t,r)}function S(e,t,r,n){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(n,s),o=!1),o}function E(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r)),t}function k(e,t,r,n,i,o){if(!r){var s=E(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||L(this,n,r)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(2),r(8))},function(e,t,r){"use strict";e.exports=s;var n=r(151),i=r(5);function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=l(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):M(e,o)):x(e,o,t,!1))):n||(o.reading=!1));return A(o)}function x(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&B(e)),M(e,t)}function C(e,t){var r;return d(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function O(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(m("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(P,e):P(e))}function P(e){m("emit readable"),e.emit("readable"),U(e)}function M(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=z(e,t.buffer,t.decoder),r);var r}function z(e,t,r){var n;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}function K(e,t){var r=f.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),e-=s,0===e){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}function W(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(V,t,e))}function V(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function G(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return m("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?W(this):B(this),null;if(e=O(e,t),0===e&&t.ended)return 0===t.length&&W(this),null;var n=t.needReadable,i;return m("need readable",n),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&W(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var r=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,m("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,a=s?f:_;function c(e,t){m("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function f(){m("onend"),e.end()}o.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",c);var h=L(r);e.on("drain",h);var l=!1;function d(){m("cleanup"),e.removeListener("close",y),e.removeListener("finish",v),e.removeListener("drain",h),e.removeListener("error",b),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",g),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var p=!1;function g(t){m("ondata"),p=!1;var n=e.write(t);!1!==n||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==G(o.pipes,e))&&!l&&(m("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function b(t){m("onerror",t),_(),e.removeListener("error",b),0===u(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",v),_()}function v(){m("onfinish"),e.removeListener("close",y),_()}function _(){m("unpipe"),r.unpipe(e)}return r.on("data",g),w(e,"error",b),e.once("close",y),e.once("finish",v),e.emit("pipe",r),o.flowing||(m("pipe resume"),r.resume()),e},E.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?this:(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,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var c=r(5);c.inherits=r(1);var f={deprecate:r(38)},h=r(640),l=r(4).Buffer,d=n.Uint8Array||function(){};function p(e){return l.from(e)}function g(e){return l.isBuffer(e)||e instanceof d}var m=r(641),b;function y(){}function v(e,t){u=u||r(152),e=e||{};var n=t instanceof u;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||r(152),!(b.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var r=new Error("write after end");e.emit("error",r),i.nextTick(t,r)}function S(e,t,r,n){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(n,s),o=!1),o}function E(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r)),t}function k(e,t,r,n,i,o){if(!r){var s=E(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||L(this,n,r)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(2),r(8))},function(e,t,r){"use strict";e.exports=s;var n=r(152),i=r(5);function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{t(null,r)}):m(e)?o(e,(e,r)=>{if(e)return t(new Error(`Error converting Blob: ${e.message}`));i(r)}):"function"==typeof a&&/^https?:/.test(e)?a.concat({url:e,timeout:3e4,headers:{"user-agent":"WebTorrent (https://webtorrent.io)"}},(e,r,n)=>{if(e)return t(new Error(`Error downloading torrent: ${e.message}`));i(n)}):"function"==typeof s.readFile&&"string"==typeof e?s.readFile(e,(e,r)=>{if(e)return t(new Error("Invalid torrent identifier"));i(r)}):n.nextTick(()=>{t(new Error("Invalid torrent identifier"))})}function p(e){t.isBuffer(e)&&(e=i.decode(e)),v(e.info,"info"),v(e.info["name.utf-8"]||e.info.name,"info.name"),v(e.info["piece length"],"info['piece length']"),v(e.info.pieces,"info.pieces"),e.info.files?e.info.files.forEach(e=>{v("number"==typeof e.length,"info.files[0].length"),v(e["path.utf-8"]||e.path,"info.files[0].path")}):v("number"==typeof e.info.length,"info.length");const r={info:e.info,infoBuffer:i.encode(e.info),name:(e.info["name.utf-8"]||e.info.name).toString(),announce:[]};r.infoHash=f.sync(r.infoBuffer),r.infoHashBuffer=t.from(r.infoHash,"hex"),void 0!==e.info.private&&(r.private=!!e.info.private),e["creation date"]&&(r.created=new Date(1e3*e["creation date"])),e["created by"]&&(r.createdBy=e["created by"].toString()),t.isBuffer(e.comment)&&(r.comment=e.comment.toString()),Array.isArray(e["announce-list"])&&e["announce-list"].length>0?e["announce-list"].forEach(e=>{e.forEach(e=>{r.announce.push(e.toString())})}):e.announce&&r.announce.push(e.announce.toString()),t.isBuffer(e["url-list"])&&(e["url-list"]=e["url-list"].length>0?[e["url-list"]]:[]),r.urlList=(e["url-list"]||[]).map(e=>e.toString()),h(r.announce),h(r.urlList);const n=e.info.files||[e.info];r.files=n.map((e,t)=>{const i=[].concat(r.name,e["path.utf-8"]||e.path||[]).map(e=>e.toString());return{path:c.join.apply(null,[c.sep].concat(i)).slice(1),name:i[i.length-1],length:e.length,offset:n.slice(0,t).reduce(b,0)}}),r.length=n.reduce(b,0);const o=r.files[r.files.length-1];return r.pieceLength=e.info["piece length"],r.lastPieceLength=(o.offset+o.length)%r.pieceLength||r.pieceLength,r.pieces=y(e.info.pieces),r}function g(e){const r={info:e.info};return r["announce-list"]=(e.announce||[]).map(e=>(r.announce||(r.announce=e),e=t.from(e,"utf8"),[e])),r["url-list"]=e.urlList||[],void 0!==e.private&&(r.private=Number(e.private)),e.created&&(r["creation date"]=e.created.getTime()/1e3|0),e.createdBy&&(r["created by"]=e.createdBy),e.comment&&(r.comment=e.comment),i.encode(r)}function m(e){return"undefined"!=typeof Blob&&e instanceof Blob}function b(e,t){return e+t.length}function y(e){const t=[];for(let r=0;r0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=l(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):M(e,o)):x(e,o,t,!1))):n||(o.reading=!1));return A(o)}function x(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&B(e)),M(e,t)}function C(e,t){var r;return d(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function O(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(m("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(P,e):P(e))}function P(e){m("emit readable"),e.emit("readable"),U(e)}function M(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=z(e,t.buffer,t.decoder),r);var r}function z(e,t,r){var n;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}function K(e,t){var r=f.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),e-=s,0===e){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}function W(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(V,t,e))}function V(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function G(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return m("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?W(this):B(this),null;if(e=O(e,t),0===e&&t.ended)return 0===t.length&&W(this),null;var n=t.needReadable,i;return m("need readable",n),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&W(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var r=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,m("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,a=s?f:_;function c(e,t){m("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function f(){m("onend"),e.end()}o.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",c);var h=L(r);e.on("drain",h);var l=!1;function d(){m("cleanup"),e.removeListener("close",y),e.removeListener("finish",v),e.removeListener("drain",h),e.removeListener("error",b),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",g),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var p=!1;function g(t){m("ondata"),p=!1;var n=e.write(t);!1!==n||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==G(o.pipes,e))&&!l&&(m("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function b(t){m("onerror",t),_(),e.removeListener("error",b),0===u(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",v),_()}function v(){m("onfinish"),e.removeListener("close",y),_()}function _(){m("unpipe"),r.unpipe(e)}return r.on("data",g),w(e,"error",b),e.once("close",y),e.once("finish",v),e.emit("pipe",r),o.flowing||(m("pipe resume"),r.resume()),e},E.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?this:(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,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var c=r(5);c.inherits=r(1);var f={deprecate:r(38)},h=r(646),l=r(4).Buffer,d=n.Uint8Array||function(){};function p(e){return l.from(e)}function g(e){return l.isBuffer(e)||e instanceof d}var m=r(647),b;function y(){}function v(e,t){u=u||r(153),e=e||{};var n=t instanceof u;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||r(153),!(b.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var r=new Error("write after end");e.emit("error",r),i.nextTick(t,r)}function S(e,t,r,n){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(n,s),o=!1),o}function E(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r)),t}function k(e,t,r,n,i,o){if(!r){var s=E(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||L(this,n,r)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(2),r(8))},function(e,t,r){"use strict";e.exports=s;var n=r(153),i=r(5);function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function s(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),this.useColors){var r="color: "+this.color;t.splice(1,0,r,"color: inherit");var n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(n++,"%c"===e&&(i=n))}),t.splice(i,0,r)}}function a(){var e;return"object"===("undefined"==typeof console?"undefined":i(console))&&console.log&&(e=console).log.apply(e,arguments)}function u(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}}function c(){var e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e}function f(){try{return localStorage}catch(e){}}t.log=a,t.formatArgs=s,t.save=u,t.load=c,t.useColors=o,t.storage=f(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=r(1720)(t);var h=e.exports.formatters;h.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,r(2))},function(e,t,r){var n=r(4).Buffer,i=r(1721);t.DEFAULT_ANNOUNCE_PEERS=50,t.MAX_ANNOUNCE_PEERS=82,t.binaryToHex=function(e){return"string"!=typeof e&&(e=String(e)),n.from(e,"binary").toString("hex")},t.hexToBinary=function(e){return"string"!=typeof e&&(e=String(e)),n.from(e,"hex").toString("binary")};var o=r(1722);i(t,o)},function(e,t,r){"use strict";(function(t,n){var i=r(10);e.exports=E;var o=r(37),s;E.ReadableState=S;var a=r(7).EventEmitter,u=function(e,t){return e.listeners(t).length},c=r(653),f=r(4).Buffer,h=t.Uint8Array||function(){};function l(e){return f.from(e)}function d(e){return f.isBuffer(e)||e instanceof h}var p=r(5);p.inherits=r(1);var g=r(1730),m=void 0;m=g&&g.debuglog?g.debuglog("stream"):function(){};var b=r(1731),y=r(654),v;p.inherits(E,c);var _=["error","close","destroy","pause","resume"];function w(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}function S(e,t){s=s||r(154),e=e||{};var n=t instanceof s;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new b,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=r(13).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function E(e){if(s=s||r(154),!(this instanceof E))return new E(e);this._readableState=new S(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function k(e,t,r,n,i){var o=e._readableState,s;null===t?(o.reading=!1,R(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=l(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):M(e,o)):x(e,o,t,!1))):n||(o.reading=!1));return A(o)}function x(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&B(e)),M(e,t)}function C(e,t){var r;return d(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function O(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(m("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(P,e):P(e))}function P(e){m("emit readable"),e.emit("readable"),U(e)}function M(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=z(e,t.buffer,t.decoder),r);var r}function z(e,t,r){var n;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}function K(e,t){var r=f.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),e-=s,0===e){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}function W(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(V,t,e))}function V(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function G(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return m("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?W(this):B(this),null;if(e=O(e,t),0===e&&t.ended)return 0===t.length&&W(this),null;var n=t.needReadable,i;return m("need readable",n),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&W(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var r=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,m("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,a=s?f:_;function c(e,t){m("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function f(){m("onend"),e.end()}o.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",c);var h=L(r);e.on("drain",h);var l=!1;function d(){m("cleanup"),e.removeListener("close",y),e.removeListener("finish",v),e.removeListener("drain",h),e.removeListener("error",b),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",g),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var p=!1;function g(t){m("ondata"),p=!1;var n=e.write(t);!1!==n||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==G(o.pipes,e))&&!l&&(m("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function b(t){m("onerror",t),_(),e.removeListener("error",b),0===u(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",v),_()}function v(){m("onfinish"),e.removeListener("close",y),_()}function _(){m("unpipe"),r.unpipe(e)}return r.on("data",g),w(e,"error",b),e.once("close",y),e.once("finish",v),e.emit("pipe",r),o.flowing||(m("pipe resume"),r.resume()),e},E.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?this:(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,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var c=r(5);c.inherits=r(1);var f={deprecate:r(38)},h=r(653),l=r(4).Buffer,d=n.Uint8Array||function(){};function p(e){return l.from(e)}function g(e){return l.isBuffer(e)||e instanceof d}var m=r(654),b;function y(){}function v(e,t){u=u||r(154),e=e||{};var n=t instanceof u;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||r(154),!(b.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var r=new Error("write after end");e.emit("error",r),i.nextTick(t,r)}function S(e,t,r,n){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(n,s),o=!1),o}function E(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r)),t}function k(e,t,r,n,i,o){if(!r){var s=E(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||L(this,n,r)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(2),r(8))},function(e,t,r){"use strict";e.exports=s;var n=r(154),i=r(5);function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.lengthnull!==e&&"object"==typeof e&&"function"==typeof e.pipe;function h(e,r){if(e=Object.assign({maxRedirects:10},"string"==typeof e?{url:e}:e),r=a(r),e.url){const{hostname:t,port:r,protocol:n,auth:i,path:o}=c.parse(e.url);delete e.url,t||r||n||i?Object.assign(e,{hostname:t,port:r,protocol:n,auth:i,path:o}):e.path=o}const n={"accept-encoding":"gzip, deflate"};let l;e.headers&&Object.keys(e.headers).forEach(t=>n[t.toLowerCase()]=e.headers[t]),e.headers=n,e.body?l=e.json&&!f(e.body)?JSON.stringify(e.body):e.body:e.form&&(l="string"==typeof e.form?e.form:u.stringify(e.form),e.headers["content-type"]="application/x-www-form-urlencoded"),l&&(e.method||(e.method="POST"),f(l)||(e.headers["content-length"]=t.byteLength(l)),e.json&&!e.form&&(e.headers["content-type"]="application/json")),delete e.body,delete e.form,e.json&&(e.headers.accept="application/json"),e.method&&(e.method=e.method.toUpperCase());const d="https:"===e.protocol?s:o,p=d.request(e,t=>{if(t.statusCode>=300&&t.statusCode<400&&t.headers.location)return e.url=t.headers.location,delete e.headers.host,t.resume(),"POST"===e.method&&[301,302].includes(t.statusCode)&&(e.method="GET",delete e.headers["content-length"],delete e.headers["content-type"]),0==e.maxRedirects--?r(new Error("too many redirects")):h(e,r);const n="function"==typeof i&&"HEAD"!==e.method;r(null,n?i(t):t)});return p.on("timeout",()=>{p.abort(),r(new Error("Request timed out"))}),p.on("error",r),f(l)?l.on("error",r).pipe(p):p.end(l),p}h.concat=((e,t)=>h(e,(r,i)=>{if(r)return t(r);n(i,(r,n)=>{if(r)return t(r);if(e.json)try{n=JSON.parse(n.toString())}catch(r){return t(r,i,n)}t(null,i,n)})})),["get","post","put","patch","head","delete"].forEach(e=>{h[e]=((t,r)=>("string"==typeof t&&(t={url:t}),h(Object.assign({method:e.toUpperCase()},t),r)))})}).call(this,r(0).Buffer)},function(e,t,r){e.exports=u;var n=r(1),i=r(23),o=r(594),s="undefined"!=typeof window&&window.MediaSource,a=60;function u(e,t){var r=this;if(!(r instanceof u))return new u(e,t);if(!s)throw new Error("web browser lacks MediaSource support");t||(t={}),r._debug=t.debug,r._bufferDuration=t.bufferDuration||a,r._elem=e,r._mediaSource=new s,r._streams=[],r.detailedError=null,r._errorHandler=function(){r._elem.removeEventListener("error",r._errorHandler);var e=r._streams.slice();e.forEach(function(e){e.destroy(r._elem.error)})},r._elem.addEventListener("error",r._errorHandler),r._elem.src=window.URL.createObjectURL(r._mediaSource)}function c(e,t){var r=this;if(i.Writable.call(r),r._wrapper=e,r._elem=e._elem,r._mediaSource=e._mediaSource,r._allStreams=e._streams,r._allStreams.push(r),r._bufferDuration=e._bufferDuration,r._sourceBuffer=null,r._debugBuffers=[],r._openHandler=function(){r._onSourceOpen()},r._flowHandler=function(){r._flow()},r._errorHandler=function(e){r.destroyed||r.emit("error",e)},"string"==typeof t)r._type=t,"open"===r._mediaSource.readyState?r._createSourceBuffer():r._mediaSource.addEventListener("sourceopen",r._openHandler);else if(null===t._sourceBuffer)t.destroy(),r._type=t._type,r._mediaSource.addEventListener("sourceopen",r._openHandler);else{if(!t._sourceBuffer)throw new Error("The argument to MediaElementWrapper.createWriteStream must be a string or a previous stream returned from that function");t.destroy(),r._type=t._type,r._sourceBuffer=t._sourceBuffer,r._debugBuffers=t._debugBuffers,r._sourceBuffer.addEventListener("updateend",r._flowHandler),r._sourceBuffer.addEventListener("error",r._errorHandler)}r._elem.addEventListener("timeupdate",r._flowHandler),r.on("error",function(e){r._wrapper.error(e)}),r.on("finish",function(){if(!r.destroyed&&(r._finished=!0,r._allStreams.every(function(e){return e._finished}))){r._wrapper._dumpDebugData();try{r._mediaSource.endOfStream()}catch(e){}}})}u.prototype.createWriteStream=function(e){var t=this;return new c(this,e)},u.prototype.error=function(e){var t=this;this.detailedError||(this.detailedError=e),this._dumpDebugData();try{this._mediaSource.endOfStream("decode")}catch(e){}try{window.URL.revokeObjectURL(this._elem.src)}catch(e){}},u.prototype._dumpDebugData=function(){var e=this;this._debug&&(this._debug=!1,this._streams.forEach(function(e,t){h(e._debugBuffers,"mediasource-stream-"+t)}))},n(c,i.Writable),c.prototype._onSourceOpen=function(){var e=this;this.destroyed||(this._mediaSource.removeEventListener("sourceopen",this._openHandler),this._createSourceBuffer())},c.prototype.destroy=function(e){var t=this;this.destroyed||(this.destroyed=!0,this._allStreams.splice(this._allStreams.indexOf(this),1),this._mediaSource.removeEventListener("sourceopen",this._openHandler),this._elem.removeEventListener("timeupdate",this._flowHandler),this._sourceBuffer&&(this._sourceBuffer.removeEventListener("updateend",this._flowHandler),this._sourceBuffer.removeEventListener("error",this._errorHandler),"open"===this._mediaSource.readyState&&this._sourceBuffer.abort()),e&&this.emit("error",e),this.emit("close"))},c.prototype._createSourceBuffer=function(){var e=this;if(!this.destroyed)if(s.isTypeSupported(this._type)){if(this._sourceBuffer=this._mediaSource.addSourceBuffer(this._type),this._sourceBuffer.addEventListener("updateend",this._flowHandler),this._sourceBuffer.addEventListener("error",this._errorHandler),this._cb){var t=this._cb;this._cb=null,t()}}else this.destroy(new Error("The provided type is not supported"))},c.prototype._write=function(e,t,r){var n=this;if(!n.destroyed)if(n._sourceBuffer){if(n._sourceBuffer.updating)return r(new Error("Cannot append buffer while source buffer updating"));var i=o(e);n._wrapper._debug&&n._debugBuffers.push(i);try{n._sourceBuffer.appendBuffer(i)}catch(e){return void n.destroy(e)}n._cb=r}else n._cb=function(i){if(i)return r(i);n._write(e,t,r)}},c.prototype._flow=function(){var e=this;if(!this.destroyed&&this._sourceBuffer&&!this._sourceBuffer.updating&&!("open"===this._mediaSource.readyState&&this._getBufferDuration()>this._bufferDuration)&&this._cb){var t=this._cb;this._cb=null,t()}};var f=0;function h(e,t){var r=document.createElement("a");r.href=window.URL.createObjectURL(new window.Blob(e)),r.download=t,r.click()}c.prototype._getBufferDuration=function(){for(var e=this,t=this._sourceBuffer.buffered,r=this._elem.currentTime,n=-1,i=0;ir)break;(n>=0||r<=s)&&(n=s)}var a=n-r;return a<0&&(a=0),a}},function(e,t,r){var n=r(660);e.exports=function e(t,r,i){if("function"==typeof r)return e(t,null,r);n(t,r,function(e,t){if(e)return i(e);var r=URL.createObjectURL(t);i(null,r)})}},function(e,t,r){var n=r(24);e.exports=function e(t,r,i){if("function"==typeof r)return e(t,null,r);i=n(i);var o=[];t.on("data",function(e){o.push(e)}).on("end",function(){var e=r?new Blob(o,{type:r}):new Blob(o);i(null,e)}).on("error",i)}},function(e,t,r){t=e.exports=r(662),t.Stream=t,t.Readable=t,t.Writable=r(665),t.Duplex=r(155),t.Transform=r(666),t.PassThrough=r(1763)},function(e,t,r){"use strict";(function(t,n){var i=r(10);e.exports=E;var o=r(37),s;E.ReadableState=S;var a=r(7).EventEmitter,u=function(e,t){return e.listeners(t).length},c=r(663),f=r(4).Buffer,h=t.Uint8Array||function(){};function l(e){return f.from(e)}function d(e){return f.isBuffer(e)||e instanceof h}var p=r(5);p.inherits=r(1);var g=r(1760),m=void 0;m=g&&g.debuglog?g.debuglog("stream"):function(){};var b=r(1761),y=r(664),v;p.inherits(E,c);var _=["error","close","destroy","pause","resume"];function w(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}function S(e,t){s=s||r(155),e=e||{};var n=t instanceof s;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new b,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=r(13).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function E(e){if(s=s||r(155),!(this instanceof E))return new E(e);this._readableState=new S(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function k(e,t,r,n,i){var o=e._readableState,s;null===t?(o.reading=!1,R(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=l(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):M(e,o)):x(e,o,t,!1))):n||(o.reading=!1));return A(o)}function x(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&B(e)),M(e,t)}function C(e,t){var r;return d(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function O(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(m("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(P,e):P(e))}function P(e){m("emit readable"),e.emit("readable"),U(e)}function M(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=z(e,t.buffer,t.decoder),r);var r}function z(e,t,r){var n;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}function K(e,t){var r=f.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),e-=s,0===e){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}function W(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(V,t,e))}function V(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function G(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return m("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?W(this):B(this),null;if(e=O(e,t),0===e&&t.ended)return 0===t.length&&W(this),null;var n=t.needReadable,i;return m("need readable",n),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&W(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var r=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,m("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,a=s?f:_;function c(e,t){m("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function f(){m("onend"),e.end()}o.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",c);var h=L(r);e.on("drain",h);var l=!1;function d(){m("cleanup"),e.removeListener("close",y),e.removeListener("finish",v),e.removeListener("drain",h),e.removeListener("error",b),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",g),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var p=!1;function g(t){m("ondata"),p=!1;var n=e.write(t);!1!==n||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==G(o.pipes,e))&&!l&&(m("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function b(t){m("onerror",t),_(),e.removeListener("error",b),0===u(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",v),_()}function v(){m("onfinish"),e.removeListener("close",y),_()}function _(){m("unpipe"),r.unpipe(e)}return r.on("data",g),w(e,"error",b),e.once("close",y),e.once("finish",v),e.emit("pipe",r),o.flowing||(m("pipe resume"),r.resume()),e},E.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?this:(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,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var c=r(5);c.inherits=r(1);var f={deprecate:r(38)},h=r(663),l=r(4).Buffer,d=n.Uint8Array||function(){};function p(e){return l.from(e)}function g(e){return l.isBuffer(e)||e instanceof d}var m=r(664),b;function y(){}function v(e,t){u=u||r(155),e=e||{};var n=t instanceof u;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||r(155),!(b.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var r=new Error("write after end");e.emit("error",r),i.nextTick(t,r)}function S(e,t,r,n){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(n,s),o=!1),o}function E(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r)),t}function k(e,t,r,n,i,o){if(!r){var s=E(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||L(this,n,r)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(2),r(8))},function(e,t,r){"use strict";e.exports=s;var n=r(155),i=r(5);function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length=e.length||t<0)){var r=e.pop();if(t{this.keepAlive()},l))}setTimeout(e,t){this._debug("setTimeout ms=%d unref=%s",e,t),this._clearTimeout(),this._timeoutMs=e,this._timeoutUnref=!!t,this._updateTimeout()}destroy(){this.destroyed||(this.destroyed=!0,this._debug("destroy"),this.emit("close"),this.end())}end(...e){this._debug("end"),this._onUninterested(),this._onChoke(),super.end(...e)}use(e){const t=e.prototype.name;if(!t)throw new Error('Extension class requires a "name" property on the prototype');this._debug("use extension.name=%s",t);const r=this._nextExt,n=new e(this);function i(){}"function"!=typeof n.onHandshake&&(n.onHandshake=i),"function"!=typeof n.onExtendedHandshake&&(n.onExtendedHandshake=i),"function"!=typeof n.onMessage&&(n.onMessage=i),this.extendedMapping[r]=t,this._ext[t]=n,this[t]=n,this._nextExt+=1}keepAlive(){this._debug("keep-alive"),this._push(p)}handshake(e,r,n){let i,o;if("string"==typeof e?(e=e.toLowerCase(),i=t.from(e,"hex")):(i=e,e=i.toString("hex")),"string"==typeof r?o=t.from(r,"hex"):(o=r,r=o.toString("hex")),20!==i.length||20!==o.length)throw new Error("infoHash and peerId MUST have length 20");this._debug("handshake i=%s p=%s exts=%o",e,r,n);const s=t.from(v);s[5]|=16,n&&n.dht&&(s[7]|=1),this._push(t.concat([d,s,i,o])),this._handshakeSent=!0,this.peerExtensions.extended&&!this._extendedHandshakeSent&&this._sendExtendedHandshake()}_sendExtendedHandshake(){const e=a(this.extendedHandshake);e.m={};for(const t in this.extendedMapping){const r=this.extendedMapping[t];e.m[r]=Number(t)}this.extended(0,i.encode(e)),this._extendedHandshakeSent=!0}choke(){if(!this.amChoking){for(this.amChoking=!0,this._debug("choke");this.peerRequests.length;)this.peerRequests.pop();this._push(g)}}unchoke(){this.amChoking&&(this.amChoking=!1,this._debug("unchoke"),this._push(m))}interested(){this.amInterested||(this.amInterested=!0,this._debug("interested"),this._push(b))}uninterested(){this.amInterested&&(this.amInterested=!1,this._debug("uninterested"),this._push(y))}have(e){this._debug("have %d",e),this._message(4,[e],null)}bitfield(e){this._debug("bitfield"),t.isBuffer(e)||(e=e.buffer),this._message(5,[],e)}request(e,t,r,n){return n||(n=(()=>{})),this._finished?n(new Error("wire is closed")):this.peerChoking?n(new Error("peer is choking")):(this._debug("request index=%d offset=%d length=%d",e,t,r),this.requests.push(new w(e,t,r,n)),this._updateTimeout(),void this._message(6,[e,t,r],null))}piece(e,t,r){this._debug("piece index=%d offset=%d",e,t),this.uploaded+=r.length,this.uploadSpeed(r.length),this.emit("upload",r.length),this._message(7,[e,t],r)}cancel(e,t,r){this._debug("cancel index=%d offset=%d length=%d",e,t,r),this._callback(this._pull(this.requests,e,t,r),new Error("request was cancelled"),null),this._message(8,[e,t,r],null)}port(e){this._debug("port %d",e);const r=t.from(_);r.writeUInt16BE(e,5),this._push(r)}extended(e,r){if(this._debug("extended ext=%s",e),"string"==typeof e&&this.peerExtendedMapping[e]&&(e=this.peerExtendedMapping[e]),"number"!=typeof e)throw new Error(`Unrecognized extension: ${e}`);{const n=t.from([e]),o=t.isBuffer(r)?r:i.encode(r);this._message(20,[],t.concat([n,o]))}}_read(){}_message(e,r,n){const i=n?n.length:0,o=t.allocUnsafe(5+4*r.length);o.writeUInt32BE(o.length+i-4,0),o[4]=e;for(let e=0;e{if(i===this._pull(this.peerRequests,e,t,r))return n?this._debug("error satisfying request index=%d offset=%d length=%d (%s)",e,t,r,n.message):void this.piece(e,t,o)};var i=new w(e,t,r,n);this.peerRequests.push(i),this.emit("request",e,t,r,n)}_onPiece(e,t,r){this._debug("got piece index=%d offset=%d",e,t),this._callback(this._pull(this.requests,e,t,r.length),null,r),this.downloaded+=r.length,this.downloadSpeed(r.length),this.emit("download",r.length),this.emit("piece",e,t,r)}_onCancel(e,t,r){this._debug("got cancel index=%d offset=%d length=%d",e,t,r),this._pull(this.peerRequests,e,t,r),this.emit("cancel",e,t,r)}_onPort(e){this._debug("got port %d",e),this.emit("port",e)}_onExtended(e,t){if(0===e){let e,r;try{e=i.decode(t)}catch(e){this._debug("ignoring invalid extended handshake: %s",e.message||e)}if(!e)return;if(this.peerExtendedHandshake=e,"object"==typeof e.m)for(r in e.m)this.peerExtendedMapping[r]=Number(e.m[r].toString());for(r in this._ext)this.peerExtendedMapping[r]&&this._ext[r].onExtendedHandshake(this.peerExtendedHandshake);this._debug("got extended handshake"),this.emit("extended","handshake",this.peerExtendedHandshake)}else this.extendedMapping[e]&&(e=this.extendedMapping[e],this._ext[e]&&this._ext[e].onMessage(t)),this._debug("got extended message ext=%s",e),this.emit("extended",e,t)}_onTimeout(){this._debug("request timed out"),this._callback(this.requests.shift(),new Error("request has timed out"),null),this.emit("timeout")}_write(e,r,n){for(this._bufferSize+=e.length,this._buffer.push(e);this._bufferSize>=this._parserSize;){const e=1===this._buffer.length?this._buffer[0]:t.concat(this._buffer);this._bufferSize-=this._parserSize,this._buffer=this._bufferSize?[e.slice(this._parserSize)]:[],this._parser(e.slice(0,this._parserSize))}n(null)}_callback(e,t,r){e&&(this._clearTimeout(),this.peerChoking||this._finished||this._updateTimeout(),e.callback(t,r))}_clearTimeout(){this._timeout&&(clearTimeout(this._timeout),this._timeout=null)}_updateTimeout(){this._timeoutMs&&this.requests.length&&!this._timeout&&(this._timeout=setTimeout(()=>this._onTimeout(),this._timeoutMs),this._timeoutUnref&&this._timeout.unref&&this._timeout.unref())}_parse(e,t){this._parserSize=e,this._parser=t}_onMessageLength(e){const t=e.readUInt32BE(0);t>0?this._parse(t,this._onMessage):(this._onKeepAlive(),this._parse(4,this._onMessageLength))}_onMessage(e){switch(this._parse(4,this._onMessageLength),e[0]){case 0:return this._onChoke();case 1:return this._onUnchoke();case 2:return this._onInterested();case 3:return this._onUninterested();case 4:return this._onHave(e.readUInt32BE(1));case 5:return this._onBitField(e.slice(1));case 6:return this._onRequest(e.readUInt32BE(1),e.readUInt32BE(5),e.readUInt32BE(9));case 7:return this._onPiece(e.readUInt32BE(1),e.readUInt32BE(5),e.slice(9));case 8:return this._onCancel(e.readUInt32BE(1),e.readUInt32BE(5),e.readUInt32BE(9));case 9:return this._onPort(e.readUInt16BE(1));case 20:return this._onExtended(e.readUInt8(1),e.slice(2));default:return this._debug("got unknown message"),this.emit("unknownmessage",e)}}_parseHandshake(){this._parse(1,e=>{const t=e.readUInt8(0);this._parse(t+48,e=>{const r=e.slice(0,t);if("BitTorrent protocol"!==r.toString())return this._debug("Error: wire not speaking BitTorrent protocol (%s)",r.toString()),void this.end();e=e.slice(t),this._onHandshake(e.slice(8,28),e.slice(28,48),{dht:!!(1&e[7]),extended:!!(16&e[5])}),this._parse(4,this._onMessageLength)})})}_onFinish(){for(this._finished=!0,this.push(null);this.read(););for(clearInterval(this._keepAliveInterval),this._parse(Number.MAX_VALUE,()=>{});this.peerRequests.length;)this.peerRequests.pop();for(;this.requests.length;)this._callback(this.requests.pop(),new Error("wire was closed"),null)}_debug(...e){e[0]=`[${this._debugId}] ${e[0]}`,s(...e)}_pull(e,t,r,i){for(let o=0;o0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=l(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):M(e,o)):x(e,o,t,!1))):n||(o.reading=!1));return A(o)}function x(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&B(e)),M(e,t)}function C(e,t){var r;return d(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function O(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(m("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(P,e):P(e))}function P(e){m("emit readable"),e.emit("readable"),U(e)}function M(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=z(e,t.buffer,t.decoder),r);var r}function z(e,t,r){var n;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}function K(e,t){var r=f.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),e-=s,0===e){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}function W(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(V,t,e))}function V(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function G(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return m("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?W(this):B(this),null;if(e=O(e,t),0===e&&t.ended)return 0===t.length&&W(this),null;var n=t.needReadable,i;return m("need readable",n),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&W(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var r=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,m("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,a=s?f:_;function c(e,t){m("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function f(){m("onend"),e.end()}o.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",c);var h=L(r);e.on("drain",h);var l=!1;function d(){m("cleanup"),e.removeListener("close",y),e.removeListener("finish",v),e.removeListener("drain",h),e.removeListener("error",b),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",g),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var p=!1;function g(t){m("ondata"),p=!1;var n=e.write(t);!1!==n||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==G(o.pipes,e))&&!l&&(m("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function b(t){m("onerror",t),_(),e.removeListener("error",b),0===u(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",v),_()}function v(){m("onfinish"),e.removeListener("close",y),_()}function _(){m("unpipe"),r.unpipe(e)}return r.on("data",g),w(e,"error",b),e.once("close",y),e.once("finish",v),e.emit("pipe",r),o.flowing||(m("pipe resume"),r.resume()),e},E.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?this:(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,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var c=r(5);c.inherits=r(1);var f={deprecate:r(38)},h=r(671),l=r(4).Buffer,d=n.Uint8Array||function(){};function p(e){return l.from(e)}function g(e){return l.isBuffer(e)||e instanceof d}var m=r(672),b;function y(){}function v(e,t){u=u||r(156),e=e||{};var n=t instanceof u;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||r(156),!(b.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(e,t){var r=new Error("write after end");e.emit("error",r),i.nextTick(t,r)}function S(e,t,r,n){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(n,s),o=!1),o}function E(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r)),t}function k(e,t,r,n,i,o){if(!r){var s=E(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||L(this,n,r)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(2),r(8))},function(e,t,r){"use strict";e.exports=s;var n=r(156),i=r(5);function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length=0||1/0===e||-1/0===e)}},t.text={is:function(e){return"string"==typeof e}},t.text.ify=function(e){return t.text.is(e)?e:"undefined"!=typeof JSON?JSON.stringify(e):e&&e.toString?e.toString():e},t.text.random=function(e,t){var r="";for(e=e||24,t=t||"0123456789ABCDEFGHIJKLMNOPQRSTUVWXZabcdefghijklmnopqrstuvwxyz";e>0;)r+=t.charAt(Math.floor(Math.random()*t.length)),e--;return r},t.text.match=function(e,r){var n=!1;if(e=e||"",r=t.text.is(r)?{"=":r}:r||{},t.obj.has(r,"~")&&(e=e.toLowerCase(),r["="]=(r["="]||r["~"]).toLowerCase()),t.obj.has(r,"="))return e===r["="];if(t.obj.has(r,"*")){if(e.slice(0,r["*"].length)!==r["*"])return!1;n=!0,e=e.slice(r["*"].length)}if(t.obj.has(r,"!")){if(e.slice(-r["!"].length)!==r["!"])return!1;n=!0}if(t.obj.has(r,"+")&&t.list.map(t.list.is(r["+"])?r["+"]:[r["+"]],function(t){if(!(e.indexOf(t)>=0))return!0;n=!0}))return!1;if(t.obj.has(r,"-")&&t.list.map(t.list.is(r["-"])?r["-"]:[r["-"]],function(t){if(!(e.indexOf(t)<0))return!0;n=!0}))return!1;if(t.obj.has(r,">")){if(!(e>r[">"]))return!1;n=!0}if(t.obj.has(r,"<")){if(!(er?1:0):0}},t.list.map=function(e,t,r){return a(e,t,r)},t.list.index=1,t.obj={is:function(e){return!!e&&(e instanceof Object&&e.constructor===Object||"Object"===Object.prototype.toString.call(e).match(/^\[object (\w+)\]$/)[1])}},t.obj.put=function(e,t,r){return(e||{})[t]=r,e},t.obj.has=function(e,t){return e&&Object.prototype.hasOwnProperty.call(e,t)},t.obj.del=function(e,t){if(e)return e[t]=null,delete e[t],e},t.obj.as=function(e,t,r,n){return e[t]=e[t]||(n===r?{}:r)},t.obj.ify=function(e){if(o(e))return e;try{e=JSON.parse(e)}catch(t){e={}}return e},function(){var e;function r(t,r){s(this,r)&&e!==this[r]||(this[r]=t)}t.obj.to=function(e,t){return t=t||{},a(e,r,t),t}}(),t.obj.copy=function(e){return e?JSON.parse(JSON.stringify(e)):e},function(){function e(e,t){var r=this.n;if(!r||!(t===r||o(r)&&s(r,t)))return!!t||void 0}t.obj.empty=function(t,r){return!t||!a(t,e,{n:r})}}(),function(){function e(t,r){if(2===arguments.length)return e.r=e.r||{},void(e.r[t]=r);e.r=e.r||[],e.r.push(t)}var i=Object.keys;t.obj.map=function(a,u,c){var f,h=0,l,d,p,g,m=r(u);if(e.r=null,i&&o(a)&&(p=i(a),g=!0),n(a)||p)for(l=(p||a).length;h",n.drift=0,n.is=function(e,t,r){var i=t&&e&&e[w]&&e[w][n._]||r;if(i)return y(i=i[t])?i:-1/0},n.lex=function(){return n().toString(36).replace(".","")},n.ify=function(e,t,i,o,s){if(!e||!e[w]){if(!s)return;e=r.soul.ify(e,s)}var a=l(e[w],n._);return S!==t&&t!==w&&(y(i)&&(a[t]=i),S!==o&&(e[t]=o)),e},n.to=function(e,t,i){var o=(e||{})[t];return p(o)&&(o=m(o)),n.ify(i,t,n.is(e,t),o,r.soul(e))},function(){function e(e,t){w!==t&&n.ify(this.o,t,this.s)}n.map=function(t,r,i){var o,s=p(s=t||r)?s:null;return t=_(t=t||r)?t:null,s&&!t?(r=y(r)?r:n(),s[w]=s[w]||{},g(s,e,{o:s,s:r}),s):(i=i||p(r)?r:o,r=y(r)?r:n(),function(n,s,a,u){if(!t)return e.call({o:a,s:r},n,s),n;t.call(i||this||{},n,s,a,u),d(a,s)&&o===a[s]||e.call({o:a,s:r},n,s)})}}();var h=t.obj,l=h.as,d=h.has,p=h.is,g=h.map,m=h.copy,b=t.num,y=b.is,v=t.fn,_=v.is,w=r._,S;e.exports=n})(o,"./state"),o(function(e){var t=o("./type"),r=o("./val"),n=o("./node"),i={};!function(){function e(e,r){if(!e||r!==n.soul(e)||!n.is(e,this.fn,this.as))return!0;this.cb&&(t.n=e,t.as=this.as,this.cb.call(t.as,e,r,t))}function t(e){e&&n.is(t.n,e,t.as)}i.is=function(t,r,n,i){return!(!t||!u(t)||h(t))&&!d(t,e,{cb:r,fn:n,as:i})}}(),function(){function e(e,t){var i;return(i=h(e,t))?i:(t.env=e,t.soul=s,n.ify(t.obj,o,t)&&(t.rel=t.rel||r.rel.ify(n.soul(t.node)),t.obj!==e.shell&&(e.graph[r.rel.is(t.rel)]=t.node)),t)}function o(t,i,o){var s=this,u=s.env,h,l;if(n._===i&&f(t,r.rel._))return o._;if(h=a(t,i,o,s,u)){if(i||(s.node=s.node||o||{},f(t,n._)&&n.soul(t)&&(s.node._=p(t._)),s.node=n.soul.ify(s.node,r.rel.is(s.rel)),s.rel=s.rel||r.rel.ify(n.soul(s.node))),(l=u.map)&&(l.call(u.as||{},t,i,o,s),f(o,i))){if(t=o[i],g===t)return void c(o,i);if(!(h=a(t,i,o,s,u)))return}if(!i)return s.node;if(!0===h)return t;if(l=e(u,{obj:t,path:s.path.concat(i)}),l.node)return l.rel}}function s(e){var t=this,i=r.link.is(t.rel),o=t.env.graph;t.rel=t.rel||r.rel.ify(e),t.rel[r.rel._]=e,t.node&&t.node[n._]&&(t.node[n._][r.rel._]=e),f(o,i)&&(o[e]=o[i],c(o,i))}function a(e,n,i,o,s){var c;return!!r.is(e)||(u(e)?1:(c=s.invalid)?(e=c.call(s.as||{},e,n,i),a(e,n,i,o,s)):(s.err="Invalid value at '"+o.path.concat(n).join(".")+"'!",void(t.list.is(e)&&(s.err+=" Use `.set(item)` instead of an Array."))))}function h(e,t){for(var r=e.seen,n=r.length,i;n--;)if(i=r[n],t.obj===i.obj)return i;r.push(t)}i.ify=function(t,n,i){var o={path:[],obj:t};return n?"string"==typeof n?n={soul:n}:n instanceof Function&&(n.map=n):n={},n.soul&&(o.rel=r.rel.ify(n.soul)),n.shell=(i||{}).shell,n.graph=n.graph||{},n.seen=n.seen||[],n.as=n.as||i,e(n,o),n.root=o.node,n.graph}}(),i.node=function(e){var t=n.soul(e);if(t)return l({},t,e)},function(){function e(e,t){var o,s;if(n._!==t)(o=r.rel.is(e))?(s=this.opt.seen[o])?this.obj[t]=s:this.obj[t]=this.opt.seen[o]=i.to(this.graph,o,this.opt):this.obj[t]=e;else{if(h(e,r.rel._))return;this.obj[t]=p(e)}}i.to=function(t,r,n){if(t){var i={};return n=n||{seen:{}},d(t[r],e,{obj:i,graph:t,opt:n}),i}}}();var s=t.fn.is,a=t.obj,u=a.is,c=a.del,f=a.has,h=a.empty,l=a.put,d=a.map,p=a.copy,g;e.exports=i})(o,"./graph"),o(function(e){o("./onto"),e.exports=function e(t,r){if(this.on){if(!(t instanceof Function)){if(!t||!r)return;var n=t["#"]||t,i=(this.tag||empty)[n];if(!i)return;return i=this.on(n,r),clearTimeout(i.err),!0}var n=r&&r["#"]||Math.random().toString(36).slice(2);if(!t)return n;var o=this.on(n,t,r);return o.err=o.err||setTimeout(function(){o.next({err:"Error: No ACK received yet.",lack:!0}),o.off()},(this.opt||{}).lack||9e3),n}}})(o,"./ask"),o(function(e){var t=o("./type");function r(e){var r={s:{}};return e=e||{max:1e3,age:9e3},r.check=function(e){var t;return!!(t=r.s[e])&&(t.pass?t.pass=!1:r.track(e))},r.track=function(i,o){var s=r.s[i]||(r.s[i]={});return s.was=n(),o&&(s.pass=!0),r.to||(r.to=setTimeout(function(){var i=n();t.obj.map(r.s,function(n,o){n&&e.age>i-n.was||t.obj.del(r.s,o)}),r.to=null},e.age+9)),s},r}var n=t.time.is;e.exports=r})(o,"./dup"),o(function(e){function t(e){return e instanceof t?(this._={gun:this,$:this}).$:this instanceof t?t.create(this._={gun:this,$:this,opt:e}):new t(e)}t.is=function(e){return e instanceof t||e&&e._&&e===e._.$||!1},t.version=.9,t.chain=t.prototype,t.chain.toJSON=function(){};var r=o("./type");r.obj.to(r,t),t.HAM=o("./HAM"),t.val=o("./val"),t.node=o("./node"),t.state=o("./state"),t.graph=o("./graph"),t.on=o("./onto"),t.ask=o("./ask"),t.dup=o("./dup"),function(){function e(r){var n=this,i=n.as,o=i.at||i,s=o.$,a,u;(u=r["#"])||(u=r["#"]=c(9)),(a=o.dup).check(u)?i.out===r.out&&(r.out=S,n.to.next(r)):(a.track(u),o.ask(r["@"],r)||(r.get&&t.on.get(r,s),r.put&&t.on.put(r,s)),n.to.next(r),i.out||(r.out=e,o.on("out",r)))}t.create=function(r){r.root=r.root||r,r.graph=r.graph||{},r.on=r.on||t.on,r.ask=r.ask||t.ask,r.dup=r.dup||t.dup();var n=r.$.opt(r.opt);return r.once||(r.on("in",e,r),r.on("out",e,{at:r,out:e}),t.on("create",r),r.on("create",r)),r.once=1,n}}(),function(){function e(e,r,n,i){var o=this,s=t.state.is(n,r),a;if(!s)return o.err="Error: No state on '"+r+"' in node '"+i+"'!";var u=o.graph[i]||w,c=t.state.is(u,r,!0),f=u[r],h=t.HAM(o.machine,s,c,e,f);h.incoming?(o.put[i]=t.state.to(n,r,o.put[i]),(o.diff||(o.diff={}))[i]=t.state.to(n,r,o.diff[i]),o.souls[i]=!0):h.defer&&(o.defer=s<(o.defer||1/0)?s:o.defer)}function r(e,t){var r=this,s=r.$._,a=(s.next||w)[t];if(!a){if(!(s.opt||w).super)return void(r.souls[t]=!1);a=r.$.get(t)._}var u=r.map[t]={put:e,get:t,$:a.$},c={ctx:r,msg:u};r.async=!!s.tag.node,r.ack&&(u["@"]=r.ack),p(e,n,c),r.async&&(r.and||s.on("node",function(e){this.to.next(e),e===r.map[e.get]&&(r.souls[e.get]=!1,p(e.put,i,e),p(r.souls,function(e){if(e)return e})||r.c||(r.c=1,this.off(),p(r.map,o,r)))}),r.and=!0,s.on("node",u))}function n(e,r){var n=this.ctx,i=n.graph,o=this.msg,s=o.get,a=o.put,u=o.$._,c;i[s]=t.state.to(a,r,i[s]),n.async||(u.put=t.state.to(a,r,u.put))}function i(e,r){var n=this,i=n.put,o=n.$._;o.put=t.state.to(i,r,o.put)}function o(e,t){e.$&&(this.cat.stop=this.stop,e.$._.on("in",e),this.cat.stop=null)}t.on.put=function(n,i){var s=i._,a={$:i,graph:s.graph,put:{},map:{},souls:{},machine:t.state(),ack:n["@"],cat:s,stop:{}};if(t.graph.is(n.put,null,e,a)||(a.err="Error: Invalid graph!"),a.err)return s.on("in",{"@":n["#"],err:t.log(a.err)});p(a.put,r,a),a.async||p(a.map,o,a),S!==a.defer&&setTimeout(function(){t.on.put(n,i)},a.defer-a.machine),a.diff&&s.on("put",d(n,{put:a.diff}))},t.on.get=function(e,r){var n=r._,i=e.get,o=i[b],s=n.graph[o],a=i[y],u,c=n.next||(n.next={}),f=c[o];if(l(o,"*")){var h={};t.obj.map(n.graph,function(e,r){t.text.match(r,o)&&(h[r]=t.obj.copy(e))}),t.obj.empty(h)||n.on("in",{"@":e["#"],how:"*",put:h,$:r})}if(!s)return n.on("get",e);if(a){if(!l(s,a))return n.on("get",e);s=t.state.to(s,a)}else s=t.obj.copy(s);s=t.graph.node(s),u=(f||w).ack,n.on("in",{"@":e["#"],how:"mem",put:s,$:r}),n.on("get",e)}}(),t.chain.opt=function(e){e=e||{};var r=this,i=r._,o=e.peers||e;return h(e)||(e={}),h(i.opt)||(i.opt=e),u(o)&&(o=[o]),n(o)&&(o=p(o,function(e,t,r){r(e,{url:e})}),h(i.opt.peers)||(i.opt.peers={}),i.opt.peers=d(o,i.opt.peers)),i.opt.peers=i.opt.peers||{},d(e,i.opt),t.on("opt",i),i.opt.uuid=i.opt.uuid||function(){return m()+c(12)},r};var n=t.list.is,a=t.text,u=a.is,c=a.random,f=t.obj,h=f.is,l=f.has,d=f.to,p=f.map,g=f.copy,m=t.state.lex,b=t.val.rel._,y=".",v=t.node._,_=t.val.link.is,w={},S;i.debug=function(e,t){return i.debug.i&&e===i.debug.i&&i.debug.i++&&(i.log.apply(i,arguments)||t)},t.log=function(){return!t.log.off&&i.log.apply(i,arguments),[].slice.call(arguments).join(" ")},t.log.once=function(e,r,n){return(n=t.log.once)[e]=n[e]||0,n[e]++||t.log(r)},t.log.once("welcome","Hello wonderful person! :) Thanks for using GUN, feel free to ask for help on https://gitter.im/amark/gun and ask StackOverflow questions tagged with 'gun'!"),"undefined"!=typeof window&&((window.GUN=window.Gun=t).window=window);try{void 0!==s&&(s.exports=t)}catch(e){}e.exports=t})(o,"./root"),o(function(e){var t=o("./root");t.chain.back=function(e,i){var o;if(e=e||1,-1===e||1/0===e)return this._.root.$;if(1===e)return(this._.back||this._).$;var s=this,a=s._;if("string"==typeof e&&(e=e.split(".")),e instanceof Array){for(var u=0,c=e.length,o=a;u .once, apologies unexpected."),this.once(e,r)},t.chain.once=function(e,r){var i=this,o=i._,s=o.put;if(0=(t.batch||1e3))return h();s||(s=setTimeout(h,t.wait||1))}),e.on("get",function(r){this.to.next(r);var n=r.get,i,o,s;function u(){if(n&&(i=n["#"])){var u=n["."];o=a[i]||s,o&&u&&(o=Gun.state.to(o,u)),(o||Gun.obj.empty(t.peers))&&e.on("in",{"@":r["#"],put:Gun.graph.node(o),how:"lS",lS:r.$||e.$})}}Gun.debug?setTimeout(u,1):u()});var f=function(e,t,r,n){a[n]=Gun.state.to(r,t,a[n])},h=function(r){var u;o=0,clearTimeout(s),s=!1;var c=i;i={},r&&(a=r);try{n.setItem(t.prefix,JSON.stringify(a))}catch(r){Gun.log(u=(r||"localStorage failure")+" Consider using GUN's IndexedDB plugin for RAD for more storage space, temporary example at https://github.com/amark/gun/blob/master/test/tmp/indexedDB.html ."),e.on("localStorage:error",{err:u,file:t.prefix,flush:a,retry:h})}(u||Gun.obj.empty(t.peers))&&Gun.obj.map(c,function(t,r){e.on("in",{"@":r,err:u,ok:0})})}}})}})(o,"./adapters/localStorage"),o(function(e){var t=o("../type");function r(e){var o=function(){},a=e.opt||{};return a.log=a.log||i.log,a.gap=a.gap||a.wait||1,a.pack=a.pack||.3*(a.memory?1e3*a.memory*1e3:1399e6),o.out=function(t){var r;if(this.to&&this.to.next(t),(r=t["@"])&&(r=e.dup.s[r])&&(r=r.it)&&r._)return o.say(t,r._.via,1),void(r["##"]=t["##"]);o.say(t)},e.on("create",function(r){r.opt.pid=r.opt.pid||t.text.random(9),this.to.next(r),e.on("out",o.out)}),o.hear=function(r,n){if(r){var i=e.dup,s,u,c,f=r[0];if(a.pack<=r.length)return o.say({dam:"!",err:"Message too big!"},n);try{c=JSON.parse(r)}catch(e){a.log("DAM JSON parse error",e)}if("{"===f){if(!c)return;if(i.check(s=c["#"]))return;if(i.track(s,!0).it=c,(f=c["@"])&&c.put&&(u=c["##"]||(c["##"]=o.hash(c)),(f+=u)!=s)){if(i.check(f))return;(f=i.s)[u]=f[s]}return(c._=function(){}).via=n,(f=c["><"])&&(c._.to=t.obj.map(f.split(","),function(e,t,r){r(e,!0)})),c.dam?void((f=o.hear[c.dam])&&f(c,n,e)):void e.on("in",c)}if("["!==f);else{if(!c)return;for(var h=0,l;l=c[h++];)o.hear(l,n)}}},function(){function r(e){var t=e.batch;if(t&&(e.batch=e.tail=null,t.length))try{i(JSON.stringify(t),e)}catch(e){a.log("DAM JSON stringify error",e)}}function i(e,t){var r=t.wire;try{r.send?r.send(e):t.say&&t.say(e)}catch(r){(t.queue=t.queue||[]).push(e)}}o.say=function(s,u,c){if(u){var f,h=u.wire||a.wire&&a.wire(u),l,d;if(h&&(l=s._||n,u!==l.via&&((d=l.raw)||(d=o.raw(s)),!((f=s["@"])&&(f=e.dup.s[f])&&(f=f.it)&&f.get&&f["##"]&&f["##"]===s["##"])&&(!(f=l.to)||!f[u.url]&&!f[u.id]||c)))){if(u.batch){if(u.tail=(u.tail||0)+d.length,u.tail<=a.pack)return void u.batch.push(d);r(u)}u.batch=[],setTimeout(function(){r(u)},a.gap),i(d,u)}}else t.obj.map(a.peers,function(e){o.say(s,e)})}}(),function(){function n(e,r){var n;return r instanceof Object?(t.obj.map(Object.keys(r).sort(),i,{to:n={},on:r}),n):r}function i(e){this.to[e]=this.on[e]}o.raw=function(r){if(!r)return"";var i=e.dup,f=r._||{},h,l,d;if(d=f.raw)return d;if("string"==typeof r)return r;r["@"]&&(d=r.put)&&((l=r["##"])||(h=u(d,n)||"",l=o.hash(r,h),r["##"]=l),(d=i.s)[l=r["@"]+l]=d[r["#"]],r["#"]=l||r["#"],h&&((r=t.obj.to(r)).put=c));var p=0,g=[];t.obj.map(a.peers,function(e){if(g.push(e.url||e.id),++p>9)return!0}),r["><"]=g.join();var m=u(r);return s!==h&&(d=m.indexOf(c,m.indexOf("put")),m=m.slice(0,d-1)+h+m.slice(d+c.length+1)),f&&(f.raw=m),m},o.hash=function(e,i){return r.hash(i||u(e.put,n)||"")||e["#"]||t.text.random(9)};var u=JSON.stringify,c=":])([:"}(),o.hi=function(r){var n=r.wire||{};r.id||r.url?(a.peers[r.url||r.id]=r,t.obj.del(a.peers,n.id)):(n=n.id=n.id||t.text.random(9),o.say({dam:"?"},a.peers[n]=r)),n.hied||e.on(n.hied="hi",r),n=r.queue,r.queue=[],t.obj.map(n,function(e){o.say(e,r)})},o.bye=function(r){t.obj.del(a.peers,r.id),e.on("bye",r)},o.hear["!"]=function(e,t){a.log("Error:",e.err)},o.hear["?"]=function(e,t){if(!e.pid)return o.say({dam:"?",pid:a.pid,"@":e["#"]},t);t.id=t.id||e.pid,o.hi(t)},o}r.hash=function(e){if("string"!=typeof e)return{err:1};var t=0;if(!e.length)return t;for(var r=0,n=e.length,i;r= 0x80 (not a basic code point)","invalid-input":"Invalid input"},E=h-l,k=Math.floor,x=String.fromCharCode,C;function A(e){throw new RangeError(S[e])}function I(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function T(e,t){var r=e.split("@"),n="";r.length>1&&(n=r[0]+"@",e=r[1]),e=e.replace(w,".");var i=e.split("."),o=I(i,t).join(".");return n+o}function O(e){for(var t=[],r=0,n=e.length,i,o;r=55296&&i<=56319&&r65535&&(e-=65536,t+=x(e>>>10&1023|55296),e=56320|1023&e),t+=x(e),t}).join("")}function B(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:h}function P(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function M(e,t,r){var n=0;for(e=r?k(e/g):e>>1,e+=k(e/t);e>E*d>>1;n+=h)e=k(e/E);return k(n+(E+1)*e/(e+p))}function N(e){var t=[],r=e.length,n,i=0,o=b,s=m,a,u,c,p,g,v,_,w,S;for(a=e.lastIndexOf(y),a<0&&(a=0),u=0;u=128&&A("not-basic"),t.push(e.charCodeAt(u));for(c=a>0?a+1:0;c=r&&A("invalid-input"),_=B(e.charCodeAt(c++)),(_>=h||_>k((f-i)/g))&&A("overflow"),i+=_*g,w=v<=s?l:v>=s+d?d:v-s,!(_k(f/S)&&A("overflow"),g*=S;n=t.length+1,s=M(i-p,n,0==p),k(i/n)>f-o&&A("overflow"),o+=k(i/n),i%=n,t.splice(i++,0,o)}return R(t)}function L(e){var t,r,n,i,o,s,a,u,c,p,g,v=[],_,w,S,E;for(e=O(e),_=e.length,t=b,r=0,o=m,s=0;s<_;++s)g=e[s],g<128&&v.push(x(g));for(n=i=v.length,i&&v.push(y);n<_;){for(a=f,s=0;s<_;++s)g=e[s],g>=t&&gk((f-r)/w)&&A("overflow"),r+=(a-t)*w,t=a,s=0;s<_;++s)if(g=e[s],gf&&A("overflow"),g==t){for(u=r,c=h;p=c<=o?l:c>=o+d?d:c-o,!(u0&&c>u&&(c=u);for(var f=0;f=0?(d=h.substr(0,l),p=h.substr(l+1)):(d=h,p=""),g=decodeURIComponent(d),m=decodeURIComponent(p),n(s,g)?i(s[g])?s[g].push(m):s[g]=[s[g],m]:s[g]=m}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},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""}};e.exports=function(e,t,r,a){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),function(s){var a=encodeURIComponent(n(s))+r;return i(e[s])?o(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 i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n{if("%%"===r)return r;a++;const o=n.formatters[i];if("function"==typeof o){const n=e[a];r=o.call(t,n),e.splice(a,1),a--}return r}),n.formatArgs.call(t,e);const u=t.log||n.log;u.apply(t,e)}return s.namespace=e,s.enabled=n.enabled(e),s.useColors=n.useColors(),s.color=t(e),s.destroy=i,s.extend=o,"function"==typeof n.init&&n.init(s),n.instances.push(s),s}function i(){const e=n.instances.indexOf(this);return-1!==e&&(n.instances.splice(e,1),!0)}function o(e,t){const r=n(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function s(e){let t;n.save(e),n.names=[],n.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(t=0;t"-"+e)].join(",");return n.enable(""),e}function u(e){if("*"===e[e.length-1])return!0;let t,r;for(t=0,r=n.skips.length;t{n[t]=e[t]}),n.instances=[],n.names=[],n.skips=[],n.formatters={},n.selectColor=t,n.enable(n.load()),n}e.exports=n},function(e,t,r){"use strict";t.byteLength=f,t.toByteArray=l,t.fromByteArray=g;for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function f(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n}function h(e,t,r){return 3*(t+r)/4-r}function l(e){for(var t,r=c(e),n=r[0],s=r[1],a=new o(h(e,n,s)),u=0,f=s>0?n-4:n,l=0;l>16&255,a[u++]=t>>8&255,a[u++]=255&t;return 2===s&&(t=i[e.charCodeAt(l)]<<2|i[e.charCodeAt(l+1)]>>4,a[u++]=255&t),1===s&&(t=i[e.charCodeAt(l)]<<10|i[e.charCodeAt(l+1)]<<4|i[e.charCodeAt(l+2)]>>2,a[u++]=t>>8&255,a[u++]=255&t),a}function d(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function p(e,t,r){for(var n,i=[],o=t;ou?u:a+16383));return 1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){},function(e,t,r){const n=r(157),i=r(120),o=r(257),s=r(46),a=r(23),u=r(6)("dweb-transports:http"),c=r(258);defaulthttpoptions={urlbase:"https://dweb.me:443"},servercommands={rawfetch:"contenthash",rawstore:"contenturl/rawstore",rawadd:"void/rawadd",rawlist:"metadata/rawlist",get:"get/table",set:"set/table",delete:"delete/table",keys:"keys/table",getall:"getall/table"};class f extends n{constructor(e){super(e),this.options=e,this.urlbase=e.urlbase,this.supportURLs=["contenthash","http","https"],this.supportFunctions=["fetch","store","add","list","reverse","newlisturls","get","set","keys","getall","delete","newtable","newdatabase"],this.supportFeatures=["fetch.range"],this.name="HTTP",this.status=n.STATUS_LOADED}static setup0(e){let t=n.mergeoptions(defaulthttpoptions,e.http);try{let e=new f(t);return i.addtransport(e),e}catch(e){throw console.error("HTTP unable to setup0",e.message),e}}async p_setup1(e){return this.status=n.STATUS_STARTING,e&&e(this),await this.p_status(),e&&e(this),this}async p_status(){try{this.info=await this.p_info(),this.status=n.STATUS_CONNECTED}catch(e){console.error(this.name,": Error in p_status.info",e.message),this.status=n.STATUS_FAILED}return super.p_status()}_cmdurl(e){return`${this.urlbase}/${e}`}_url(e,t,r){if(!e)throw new errors.CodingError(`${t}: requires url`);return"string"!=typeof e&&(e=e.href),e=e.replace("contenthash:/contenthash",this._cmdurl(t)),e=e.replace("getall/table",t),e+=r?"?"+r:"",e}async p_rawfetch(e,t={}){if(("string"==typeof e?e:e.href).includes("/getall/table"))throw new Error("Probably dont want to be calling p_rawfetch on a KeyValueTable, especially since dont know if its keyvaluetable or subclass");return await o.p_GET(this._url(e,servercommands.rawfetch),t)}p_rawlist(e){if(!e)throw new errors.CodingError("TransportHTTP.p_rawlist: requires url");return o.p_GET(this._url(e,servercommands.rawlist))}rawreverse(){throw new errors.ToBeImplementedError("Undefined function TransportHTTP.rawreverse")}async p_rawstore(e){console.assert(e,"TransportHttp.p_rawstore: requires data");const t=await o.p_POST(this._cmdurl(servercommands.rawstore),{data:e,contenttype:"application/octet-stream"});let r=s.parse(t),n=r.pathname.split("/");return`contenthash:/contenthash/${n.slice(-1)}`}p_rawadd(e,t){if(!e||!t)throw new errors.CodingError("TransportHTTP.p_rawadd: invalid parms",e,t);const r=c(t.preflight(Object.assign({},t)))+"\n";return o.p_POST(this._url(e,servercommands.rawadd),{data:r,contenttype:"application/json"})}p_newlisturls(e){let t=e._publicurls.map(e=>s.parse(e)).find(e=>"https:"===e.protocol&&["gateway.dweb.me","dweb.me"].includes(e.host)&&(e.pathname.includes("/content/rawfetch")||e.pathname.includes("/contenthash/"))||"contenthash:"===e.protocol&&"contenthash"===e.pathname.split("/")[1]);return t||(t=`contenthash:/contenthash/${e.keypair.verifyexportmultihashsha256_58()}`),[t,t]}async p_f_createReadStream(e,{wanturl:t=!1}={}){try{let r=this;return t?e:function(t){return r.createReadStream(e,t)}}catch(e){throw e}}createReadStream(e,t){let r;return u("createreadstream %s %o",s.parse(e).href,t),r=new a.PassThrough,o.p_GET(this._url(e,servercommands.rawfetch),Object.assign({wantstream:!0},t)).then(e=>e.pipe(r)).catch(e=>{console.warn(this.name,"createReadStream caught error",e.message),"function"==typeof r.destroy?r.destroy(e):r.emit("error",e)}),r}async p_createReadStream(e,t){u("createreadstream %s %o",s.parse(e).href,t);try{return await o.p_GET(this._url(e,servercommands.rawfetch),Object.assign({wantstream:!0},t))}catch(e){throw console.warn(this.name,"caught error",e),e}}async p_newdatabase(e){e.hasOwnProperty("keypair")&&(e=e.keypair.signingexport());let t=`${this.urlbase}/getall/table/${encodeURIComponent(e)}`;return{publicurl:t,privateurl:t}}async p_newtable(e,t){if(!e)throw new errors.CodingError("p_newtable currently requires a pubkey");let r=await this.p_newdatabase(e);return{privateurl:`${r.privateurl}/${t}`,publicurl:`${r.publicurl}/${t}`}}async p_set(e,t,r){if(!e||!t)throw new errors.CodingError("TransportHTTP.p_set: invalid parms",e,keyvalyes);if("string"==typeof t){let n=c([{key:t,value:r}]);await o.p_POST(this._url(e,servercommands.set),{data:n,contenttype:"application/json"})}else{let r=c(Object.keys(t).map(e=>({key:e,value:t[e]})));await o.p_POST(this._url(e,servercommands.set),{data:r,contenttype:"application/json"})}}_keyparm(e){return`key=${encodeURIComponent(e)}`}async p_get(e,t){if(!e&&t)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");let r=Array.isArray(t)?t.map(e=>this._keyparm(e)).join("&"):this._keyparm(t);const n=await o.p_GET(this._url(e,servercommands.get,r));return Array.isArray(t)?n:n[t]}async p_delete(e,t){if(!e&&t)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");let r=t.map(e=>this._keyparm(e)).join("&");await o.p_GET(this._url(e,servercommands.delete,r))}async p_keys(e){if(!e&&keys)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");return await o.p_GET(this._url(e,servercommands.keys))}async p_getall(e){if(!e&&keys)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");return await o.p_GET(this._url(e,servercommands.getall))}p_info(){return o.p_GET(`${this.urlbase}/info`)}static async p_test(e={}){console.log("TransportHTTP.test");try{let t=await this.p_setup(e);console.log("HTTP connected");let r=await t.p_info();console.log("TransportHTTP info=",r),r=await t.p_status(),console.assert(r===n.STATUS_CONNECTED),await t.p_test_kvt("NACL%20VERIFY")}catch(e){throw console.log("Exception thrown in TransportHTTP.test:",e.message),e}}static async test(){return this}}i._transportclasses.HTTP=f,t=e.exports=f},function(e,t){},function(e,t,r){"use strict";function n(e){for(var t=1;t0?this.tail.next=r:this.head=r,this.tail=r,++this.length},t.unshift=function e(t){var r={data:t,next:this.head};0===this.length&&(this.tail=r),this.head=r,++this.length},t.shift=function e(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.clear=function e(){this.head=this.tail=null,this.length=0},t.join=function e(t){if(0===this.length)return"";for(var r=this.head,n=""+r.data;r=r.next;)n+=t+r.data;return n},t.concat=function e(t){if(0===this.length)return s.alloc(0);for(var r=s.allocUnsafe(t>>>0),n=this.head,i=0;n;)f(n.data,r,i),i+=n.data.length,n=n.next;return r},t.consume=function e(t,r){var n;return to.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),t-=s,0===t){s===o.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=o.slice(s));break}++n}return this.length-=n,i},t._getBuffer=function e(t){var r=s.allocUnsafe(t),n=this.head,i=1;for(n.data.copy(r),t-=n.data.length;n=n.next;){var o=n.data,a=t>o.length?o.length:t;if(o.copy(r,r.length-t,0,a),t-=a,0===t){a===o.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(a));break}++i}return this.length-=i,r},t[c]=function(e,t){return u(this,n({},t,{depth:0,customInspect:!1}))},e}()},function(e,t){},function(e,t,r){"use strict";(function(t){var r=new Set;function n(e){if(!r.has(e)){var n=e+" is an experimental feature. This feature could change at any time";r.add(e),t.emitWarning(n,"ExperimentalWarning")}}function i(){}e.exports.emitExperimentalWarning=t.emitWarning?n:i}).call(this,r(2))},function(e,t,r){"use strict";(function(t){var n;function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o=r(690),s=Symbol("lastResolve"),a=Symbol("lastReject"),u=Symbol("error"),c=Symbol("ended"),f=Symbol("lastPromise"),h=Symbol("handlePromise"),l=Symbol("stream");function d(e,t){return{value:e,done:t}}function p(e){var t=e[s];if(null!==t){var r=e[l].read();null!==r&&(e[f]=null,e[s]=null,e[a]=null,t(d(r,!1)))}}function g(e){t.nextTick(p,e)}function m(e,t){return function(r,n){e.then(function(){t[h](r,n)},n)}}var b=Object.getPrototypeOf(function(){}),y=Object.setPrototypeOf((n={get stream(){return this[l]},next:function e(){var r=this,n=this[u];if(null!==n)return Promise.reject(n);if(this[c])return Promise.resolve(d(null,!0));if(this[l].destroyed)return new Promise(function(e,n){t.nextTick(function(){r[u]?n(r[u]):e(d(null,!0))})});var i=this[f],o;if(i)o=new Promise(m(i,this));else{var s=this[l].read();if(null!==s)return Promise.resolve(d(s,!1));o=new Promise(this[h])}return this[f]=o,o}},i(n,Symbol.asyncIterator,function(){return this}),i(n,"return",function e(){var t=this;return new Promise(function(e,r){t[l].destroy(null,function(t){t?r(t):e(d(null,!0))})})}),n),b),v=function e(t){var r,n=Object.create(y,(r={},i(r,l,{value:t,writable:!0}),i(r,s,{value:null,writable:!0}),i(r,a,{value:null,writable:!0}),i(r,u,{value:null,writable:!0}),i(r,c,{value:t._readableState.endEmitted,writable:!0}),i(r,f,{value:null,writable:!0}),i(r,h,{value:function e(t,r){var i=n[l].read();i?(n[f]=null,n[s]=null,n[a]=null,t(d(i,!1))):(n[s]=t,n[a]=r)},writable:!0}),r));return o(t,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=n[a];return null!==t&&(n[f]=null,n[s]=null,n[a]=null,t(e)),void(n[u]=e)}var r=n[s];null!==r&&(n[f]=null,n[s]=null,n[a]=null,r(d(null,!0))),n[c]=!0}),t.on("readable",g.bind(null,n)),n};e.exports=v}).call(this,r(2))},function(e,t,r){"use strict";var n=r(158).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}function o(e){return e.setHeader&&"function"==typeof e.abort}function s(e){var t=!1;return function(r){t||(t=!0,e.call(this,r))}}function a(e,t,r){if("function"==typeof t)return a(e,null,t);t||(t={}),r=s(r||i);var u=e._writableState,c=e._readableState,f=t.readable||!1!==t.readable&&e.readable,h=t.writable||!1!==t.writable&&e.writable,l=function t(){e.writable||d()},d=function t(){h=!1,f||r.call(e)},p=function t(){f=!1,h||r.call(e)},g=function t(n){r.call(e,n)},m=function t(){return(!f||c&&c.ended)&&(!h||u&&u.ended)?void 0:r.call(e,new n)},b=function t(){e.req.on("finish",d)};return o(e)?(e.on("complete",d),e.on("abort",m),e.req?b():e.on("request",b)):h&&!u&&(e.on("end",l),e.on("close",l)),e.on("end",p),e.on("finish",d),!1!==t.error&&e.on("error",g),e.on("close",m),function(){e.removeListener("complete",d),e.removeListener("abort",m),e.removeListener("request",b),e.req&&e.req.removeListener("finish",d),e.removeListener("end",l),e.removeListener("close",l),e.removeListener("finish",d),e.removeListener("end",p),e.removeListener("error",g),e.removeListener("close",m)}}e.exports=a},function(e,t,r){"use strict";e.exports=i;var n=r(352);function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}r(1)(i,n),i.prototype._transform=function(e,t,r){r(null,e)}},function(e,t,r){(function(n,i){const o=r(257),s=r(6)("dweb-transports:ipfs"),a=r(693),u=r(1409),c=r(9),f=r(44),h=r(46),l=r(23),d=r(93),p=r(157),g=r(120),m=r(189),b={repo:"/tmp/dweb_ipfsv3107",config:{Bootstrap:["/dns4/dweb.me/tcp/4245/wss/ipfs/QmQ921MRjsbP12fHSEDcdFeuHFg6qKDFurm2rXgA5K3RQD"]},EXPERIMENTAL:{pubsub:!0},preload:{enabled:!1}};class y extends p{constructor(e){super(e),this.ipfs=void 0,this.options=e,this.name="IPFS",this.supportURLs=["ipfs"],this.supportFunctions=["fetch","store","createReadStream"],this.status=p.STATUS_LOADED}_ipfsversion(e,t,r){e.version((n,i)=>{n?(s("IPFS via %s present but unresponsive: %o",t,i),this.ipfstype="FAILED",r(n)):(s("IPFS available via %s: %o",t,i),this.ipfstype=t,r(null,e))})}IPFSAutoConnect(e){if(n.ipfs)this._ipfsversion(n.ipfs,"global.ipfs",e);else if("undefined"!=typeof window&&window.ipfs)this._ipfsversion(window.ipfs,"window.ipfs",e);else{var t=u("localhost","5001",{protocol:"http"});t.version((r,n)=>{r?(s("IPFS via API failed %s, trying running own IPFS client",r.message),t=new a(this.options),t.on("ready",()=>{this._ipfsversion(t,"client",e)}),t.on("error",t=>{s("IPFS via client error %s",t.message),e(t)})):this._ipfsversion(t,"API",e)})}}static setup0(e){const t=p.mergeoptions(b,e.ipfs);s("setup options=%o",t);const r=new y(t);return g.addtransport(r),r}p_setup1(e,t){if(!t)return new Promise((e,t)=>{try{r.call(this,(r,n)=>{r?t(r):e(n)})}catch(e){t(e)}});try{r.call(this,t)}catch(e){t(e)}function r(t){this.status=p.STATUS_STARTING,e&&e(this),this.IPFSAutoConnect((r,n)=>{r?(s("Failed to connect %s",r.message),this.status=p.STATUS_FAILED):(this.ipfs=n,this.status=p.STATUS_CONNECTED),e&&e(this),t(null,this)})}}p_setup2(e){return this.status===p.STATUS_FAILED&&s("Stage 1 failed, skipping"),this}p_stop(e){return new Promise((t,r)=>{"client"===this.ipfstype?this.ipfs.stop((n,i)=>{this.status=p.STATUS_FAILED,e&&e(this),n?r(n):t(i)}):(this.status=p.STATUS_FAILED,e&&e(this),t(this))})}async p_status(){return this.status=await this.ipfs.isOnline()?p.STATUS_CONNECTED:p.STATUS_FAILED,super.p_status()}static urlFrom(e){if(e instanceof c)return"ipfs:/ipfs/"+e.toBaseEncodedString();if("object"==typeof e&&e.hash)return"ipfs:/ipfs/"+e.hash;if("string"==typeof e)return"ipfs:/ipfs/"+e;throw new d.CodingError("TransportIPFS.urlFrom: Cant convert to url from",e)}static cidFrom(e){if(e instanceof c)return e;if("string"==typeof e&&(e=h.parse(e)),e&&e.pathname){const t=e.pathname.split("/");if(!["ipfs:","dweb:"].includes(e.protocol)||"ipfs"!==t[1]||t.length<3)throw new d.TransportError("TransportIPFS.cidFrom bad format for url should be dweb: or ipfs:/ipfs/...: "+e.href);if(t.length>3)throw new d.TransportError("TransportIPFS.cidFrom not supporting paths in url yet, should be dweb: or ipfs:/ipfs/...: "+e.href);return new c(t[2])}throw new d.CodingError("TransportIPFS.cidFrom: Cant convert url",e)}static _stringFrom(e){return e instanceof c?"/ipfs/"+e.toBaseEncodedString():"object"==typeof e&&e.path?e.path:void 0}static ipfsFrom(e){if(e=this._stringFrom(e),e.indexOf("/ipfs/")>-1)return e.slice(e.indexOf("/ipfs/"));throw new d.CodingError(`TransportIPFS.ipfsFrom: Cant convert url ${e} into a path starting /ipfs/`)}static ipfsGatewayFrom(e){if(e=this._stringFrom(e),e.indexOf("/ipfs/")>-1)return"https://ipfs.io"+e.slice(e.indexOf("/ipfs/"));throw new d.CodingError(`TransportIPFS.ipfsGatewayFrom: Cant convert url ${e} into a path starting /ipfs/`)}static multihashFrom(e){if(e instanceof c)return e.toBaseEncodedString();if("object"==typeof e&&e.path&&(e=e.path),"string"==typeof e){const t=e.indexOf("/ipfs/");if(t>-1)return e.slice(t+6)}throw new d.CodingError(`Cant turn ${e} into a multihash`)}async p_rawfetch(e,{timeoutMS:t=6e4,relay:r=!1}={}){if(!e)throw new d.CodingError("TransportIPFS.p_rawfetch: requires url");const n=y.cidFrom(e),i=y.ipfsFrom(e);try{const r=await m.p_timeout(this.ipfs.dag.get(n),t,"Timed out IPFS fetch of "+y._stringFrom(n));if(r.remainderPath.length)throw new d.TransportError("Not yet supporting paths in p_rawfetch");let a;return"DAGNode"===r.value.constructor.name?a=await this.ipfs.cat(i):(s("Found a raw IPFS block (unusual) - not a DAGNode - handling as such"),a=r.value),a}catch(r){s("Caught error '%s' fetching via IPFS, trying IPFS HTTP gateway",r.message);try{let r=y.ipfsGatewayFrom(e);return await m.p_timeout(o.p_GET(r),t,"Timed out IPFS fetch of "+r)}catch(e){throw e}}}async p_rawstore(e){console.assert(e,"TransportIPFS.p_rawstore: requires data");const t=e instanceof i?e:new i(e),r=(await this.ipfs.add(t,{"cid-version":1,hashAlg:"sha2-256"}))[0];return y.urlFrom(r)}async p_f_createReadStream(e,{wanturl:t=!1}={}){let r;try{let n=e.pathname.split("/ipfs/")[1];if(n.includes("/"))throw new CodingError("Should not be seeing URLS with a path here:"+e);let i=this;return t?e:function e(t){s("reading from stream %o %o",n,t||"");const o=t?t.start:0,a=t&&t.end?o+t.end+1:void 0;return r&&r.destroy&&r.destroy(),r=i.ipfs.catReadableStream(n,{offset:o,length:a&&a-o}),r.on("error",e=>console.error(e)),r}}catch(e){throw r&&r.destroy&&r.destroy(),e}}static async p_test(e){console.log("TransportIPFS.test");try{const t=await this.p_setup(e);console.log(t.name,"setup");const r=await t.p_status();let n;console.assert(r===p.STATUS_CONNECTED);const i="The quick brown fox",o="ipfs:/ipfs/zdpuAscRnisRkYnEyJAp1LydQ3po25rCEDPPEDMymYRfN1yPK",s="1114",a=await t.p_rawstore(i);console.log("rawstore returned",a);const u=y.cidFrom(a);console.assert(a===o,"url should match url from rawstore");const c=a.split("/")[2],f=y.urlFrom(u);console.assert(a===f,"Should round trip"),n=a;const h=await t.p_rawfetch(n);return console.assert(h.toString()===i,"Should fetch block stored above"),t}catch(e){throw console.log("Exception thrown in TransportIPFS.test:",e.message),e}}}g._transportclasses.IPFS=y,t=e.exports=y}).call(this,r(8),r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(353),o=r(709),s=r(20),a=r(42),u=r(61),c=r(56),f=r(21),h=r(33),l=r(451),d=r(95),p=r(9),g=r(6),m=r(167),b=r(7),y=r(896),v=r(898),_=r(899),w=r(1265),S=r(1266),E=r(1270),k={get"bitcoin-block"(){return r(1271)},get"eth-account-snapshot"(){return r(114).ethAccountSnapshot},get"eth-block"(){return r(114).ethBlock},get"eth-block-list"(){return r(114).ethBlockList},get"eth-state-trie"(){return r(114).ethStateTrie},get"eth-storage-trie"(){return r(114).ethStorageTrie},get"eth-tx"(){return r(114).ethTx},get"eth-tx-trie"(){return r(114).ethTxTrie},get"git-raw"(){return r(1368)},get"zcash-block"(){return r(1374)}};class x extends b{constructor(e){super();const t={init:!0,start:!0,EXPERIMENTAL:{},preload:{enabled:!0,addresses:["/dnsaddr/node0.preload.ipfs.io/https","/dnsaddr/node1.preload.ipfs.io/https"]}};e=y.validate(e||{}),this._options=m(e,t),!1===e.init&&(this._options.init=!1),!1!==e.start&&(this._options.start=!0),"string"==typeof e.repo||void 0===e.repo?this._repo=w(e.repo):this._repo=e.repo,this.log=g("jsipfs"),this.log.err=g("jsipfs:err"),this.types={Buffer:n,PeerId:s,PeerInfo:a,multiaddr:f,multibase:d,multihash:h,CID:p},this._peerInfoBook=new l,this._peerInfo=void 0,this._bitswap=void 0,this._blockService=new i(this._repo),this._ipld=new o({blockService:this._blockService,loadFormat:(e,t)=>{if(this.log("Loading IPLD format",e),k[e])return t(null,k[e]);t(new Error(`Missing IPLD format "${e}"`))}}),this._preload=S(this),this._mfsPreload=E(this),this._ipns=void 0,this._print=this._options.silent?this.log:console.log,this.init=_.init(this),this.preStart=_.preStart(this),this.start=_.start(this),this.stop=_.stop(this),this.shutdown=this.stop,this.isOnline=_.isOnline(this),Object.assign(this,_.filesRegular(this)),this.version=_.version(this),this.id=_.id(this),this.repo=_.repo(this),this.bootstrap=_.bootstrap(this),this.config=_.config(this),this.block=_.block(this),this.object=_.object(this),this.dag=_.dag(this),this.files=_.filesMFS(this),this.libp2p=null,this.swarm=_.swarm(this),this.name=_.name(this),this.bitswap=_.bitswap(this),this.pin=_.pin(this),this.ping=_.ping(this),this.pingPullStream=_.pingPullStream(this),this.pingReadableStream=_.pingReadableStream(this),this.pubsub=_.pubsub(this),this.dht=_.dht(this),this.dns=_.dns(this),this.key=_.key(this),this.stats=_.stats(this),this.resolve=_.resolve(this),this._options.EXPERIMENTAL.pubsub&&this.log("EXPERIMENTAL pubsub is enabled"),this._options.EXPERIMENTAL.ipnsPubsub&&(this._options.EXPERIMENTAL.pubsub||(this.log("EXPERIMENTAL pubsub is enabled to use IPNS pubsub"),this._options.EXPERIMENTAL.pubsub=!0),this.log("EXPERIMENTAL IPNS pubsub is enabled")),this._options.EXPERIMENTAL.sharding&&this.log("EXPERIMENTAL sharding is enabled"),this._options.EXPERIMENTAL.dht&&this.log("EXPERIMENTAL Kademlia DHT is enabled"),this.state=r(1408)(this),this.util={crypto:u,isIPFS:c},v(this)}}t=e.exports=x,t.createNode=(e=>new x(e))}).call(this,r(0).Buffer)},function(e,t,r){var n=r(161),i=Object.prototype,o=i.hasOwnProperty,s=i.toString,a=n?n.toStringTag:void 0;function u(e){var t=o.call(e,a),r=e[a];try{e[a]=void 0;var n=!0}catch(e){}var i=s.call(e);return n&&(t?e[a]=r:delete e[a]),i}e.exports=u},function(e,t){var r=Object.prototype,n=r.toString;function i(e){return n.call(e)}e.exports=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=d;var n=r(160),i=c(n),o=r(697),s=c(o),a=r(123),u=c(a);function c(e){return e&&e.__esModule?e:{default:e}}function f(e){var t=-1,r=e.length;return function n(){return++t{if(this.resolvers[e])throw new Error('Resolver already exists for codec "'+e+'"');this.resolvers[e]={resolver:t,util:r}}),this.support.load=t.loadFormat||((e,t)=>{t(new Error(`No resolver found for codec "${e}"`))}),this.support.rm=(e=>{this.resolvers[e]&&delete this.resolvers[e]});for(const e of t.formats){const{resolver:t,util:r}=e,n=t.multicodec;this.support.add(n,t,r)}}get(e,t,r,n){if("function"==typeof t&&(n=t,t=void 0),"function"==typeof r&&(n=r,r={}),"string"==typeof t&&(t=c("/",t).substr(1).split(f).join("/")),""===t||!t)return this._get(e,(t,r)=>{if(t)return n(t);n(null,{value:r,remainderPath:"",cid:e})});let i;s(r=>{this._getFormat(e.codec,(n,o)=>{if(n)return r(n);this.bs.get(e,(e,n)=>{if(e)return r(e);o.resolver.resolve(n.data,t,(e,n)=>{if(e)return r(e);i=n.value,t=n.remainderPath,r()})})})},()=>{const n=!t||""===t||"/"===t,o=i&&!S._maybeCID(i);return n&&o||r.localResolve?(e=S._maybeCID(i)||e,!0):(i=S._maybeCID(i),i&&(e=i),!1)},(r,o)=>r?n(r):n(null,{value:i,remainderPath:t,cid:e}))}getStream(e,t,r){const n=h();return this.get(e,t,r,(e,t)=>{if(e)return n.resolve(i.error(e));n.resolve(i.values([t]))}),n}getMany(e,t){if(!Array.isArray(e))return t(new Error("Argument must be an array of CIDs"));this.bs.getMany(e,(e,r)=>{if(e)return t(e);d(r,(e,t)=>{this._getFormat(e.cid.codec,(r,n)=>{if(r)return t(r);n.util.deserialize(e.data,t)})},t)})}put(e,t,r){return"function"==typeof t?(r=t,setImmediate(()=>r(new Error("IPLDResolver.put requires options")))):(r=r||w,t.cid&&o.isCID(t.cid)?t.onlyHash?setImmediate(()=>r(null,t.cid)):this._put(t.cid,e,r):void this._getFormat(t.format,(n,i)=>{if(n)return r(n);i.util.cid(e,t,(n,i)=>n?r(n):t.onlyHash?r(null,i):void this._put(i,e,r))}))}treeStream(e,t,r){let n;return"object"==typeof t&&(r=t,t=void 0),r=r||{},r.recursive||(n=h(),g([t=>this._getFormat(e.codec,t),(t,r)=>this.bs.get(e,(e,n)=>{if(e)return r(e);r(null,t,n)}),(e,t,r)=>e.resolver.tree(t.data,r)],(e,t)=>{if(e)return n.abort(e),n;n.resolve(i.values(t))})),r.recursive&&(n=i(l.widthFirst({basePath:null,cid:e},e=>{if("string"==typeof e)return i.empty();const t=h(),r=e.cid;return g([e=>this._getFormat(r.codec,e),(e,t)=>this.bs.get(r,(r,n)=>{if(r)return t(r);t(null,e,n)}),(e,t,r)=>e.resolver.tree(t.data,(n,i)=>{if(n)return r(n);d(i,(r,n)=>{e.resolver.isLink(t.data,r,(e,t)=>{if(e)return n(e);n(null,{path:r,link:t})})},r)})],(r,n)=>{if(r)return t.abort(r),t;t.resolve(i.values(n.map(t=>{const r=e.basePath?e.basePath+"/"+t.path:t.path;return t.link?{basePath:r,cid:S._maybeCID(t.link)}:r})))}),t}),i.map(e=>"string"==typeof e?e:e.basePath),i.filter(Boolean))),t?i(n,i.map(e=>{if(0===e.indexOf(t))return e=e.slice(t.length+1),e}),i.filter(Boolean)):n}remove(e,t){this.bs.delete(e,t)}_get(e,t){g([t=>this._getFormat(e.codec,t),(t,r)=>this.bs.get(e,(e,n)=>{if(e)return r(e);r(null,t,n)}),(e,t,r)=>{e.util.deserialize(t.data,(e,t)=>{if(e)return r(e);r(null,t)})}],t)}_getFormat(e,t){if(this.resolvers[e])return t(null,this.resolvers[e]);this.support.load(e,(r,n)=>{if(r)return t(r);this.resolvers[e]=n,t(null,n)})}_put(e,t,r){r=r||w,g([t=>this._getFormat(e.codec,t),(e,r)=>e.util.serialize(t,r),(t,r)=>this.bs.put(new n(t,e),r)],t=>{if(t)return r(t);r(null,e)})}static _maybeCID(e){return o.isCID(e)?e:e&&void 0!==e["/"]?new o(e["/"]):null}}S.defaultOptions={formats:[y,v,_]},S.inMemory=function(e){const t=new a("in-memory",{storageBackends:{root:m,blocks:m,datastore:m},lock:"memory"}),r=new u(t);p([e=>t.init({},e),e=>t.open(e)],t=>{if(t)return e(t);e(null,new S({blockService:r}))})},e.exports=S},function(e,t){e.exports=s;var r=128,n=127,i=-128,o=Math.pow(2,31);function s(e,t,n){t=t||[],n=n||0;for(var a=n;e>=o;)t[n++]=255&e|r,e/=128;for(;e&i;)t[n++]=255&e|r,e>>>=7;return t[n]=0|e,s.bytes=n-a+1,t}},function(e,t){e.exports=i;var r=128,n=127;function i(e,t){var o=0,t=t||0,s=0,a=t,u,c=e.length;do{if(a>=c)throw i.bytes=0,new RangeError("Could not decode varint");u=e[a++],o+=s<28?(u&n)<=r);return i.bytes=a-t,o}},function(e,t){var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),s=Math.pow(2,35),a=Math.pow(2,42),u=Math.pow(2,49),c=Math.pow(2,56),f=Math.pow(2,63);e.exports=function(e){return e(e[t[0]]=new n(t[0],t[1],t[2],t[3]),e),{}),f=u.reduce((e,t)=>(e[t[1]]=c[t[0]],e),{});e.exports={names:c,codes:f}},function(e,t,r){"use strict";class n{constructor(e,t,r,n){this.name=e,this.code=t,this.alphabet=n,r&&n&&(this.engine=r(n))}encode(e){return this.engine.encode(e)}decode(e){return this.engine.decode(e)}isImplemented(){return this.engine}}e.exports=n},function(e,t,r){"use strict";(function(t){e.exports=function e(r){return{encode:e=>"string"==typeof e?t.from(e).toString("hex"):e.toString("hex"),decode(e){for(let t of e)if(r.indexOf(t)<0)throw new Error("invalid base16 character");return t.from(e,"hex")}}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){function r(e,t){e=e.replace(new RegExp("=","g"),"");let r=e.length,n=0,i=0,o=0,s=new Uint8Array(5*r/8|0);for(let a=0;a=8&&(s[o++]=i>>>n-8&255,n-=8);return s.buffer}function n(e,t){let r=e.byteLength,n=new Uint8Array(e),i=t.indexOf("=")===t.length-1;i&&(t=t.substring(0,t.length-2));let o=0,s=0,a="";for(let e=0;e=5;)a+=t[s>>>o-5&31],o-=5;if(o>0&&(a+=t[s<<5-o&31]),i)for(;a.length%8!=0;)a+="=";return a}e.exports=function e(i){return{encode:e=>n("string"==typeof e?t.from(e):e,i),decode(e){for(let t of e)if(i.indexOf(t)<0)throw new Error("invalid base32 character");return r(e,i)}}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){e.exports=function e(r){const n=r.indexOf("=")>-1,i=r.indexOf("-")>-1&&r.indexOf("_")>-1;return{encode(e){let r="";r="string"==typeof e?t.from(e).toString("base64"):e.toString("base64"),i&&(r=r.replace(/\+/g,"-").replace(/\//g,"_"));const o=r.indexOf("=");return o>0&&!n&&(r=r.substring(0,o)),r},decode(e){for(let t of e)if(r.indexOf(t)<0)throw new Error("invalid base64 character");return t.from(e,"base64")}}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(34),o=r(719),s=r(364),a=r(363);t=e.exports,t.addPrefix=((e,t)=>{let r;if(n.isBuffer(e))r=a.varintBufferEncode(e);else{if(!o[e])throw new Error("multicodec not recognized");r=o[e]}return n.concat([r,t])}),t.rmPrefix=(e=>(i.decode(e),e.slice(i.decode.bytes))),t.getCodec=(e=>{const t=a.varintBufferDecode(e),r=s[t.toString("hex")];if(void 0===r)throw new Error("Code `0x"+t.toString("hex")+"` not found");return r}),t.getCodeVarint=(e=>{const t=o[e];if(void 0===t)throw new Error("Codec `"+e+"` not found");return t}),t.addCodec=((e,t)=>{o[e]=a.varintBufferEncode(t),s[t.toString("hex")]=e})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(264),i=r(363).varintBufferEncode,o={};e.exports=o;for(let e in n){let t=n[e];o[e]=i(t)}},function(e,t,r){"use strict";(function(t){const n=r(33);var i={checkCIDComponents:function(e){if(null==e)return"null values are not valid CIDs";if(0!==e.version&&1!==e.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof e.codec)return"codec must be string";if(!t.isBuffer(e.multihash))return"multihash must be a Buffer";try{n.validate(e.multihash)}catch(e){let t=e.message;return t||(t="Multihash validation failed"),t}}};e.exports=i}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports={keys:r(722),once:r(127),values:r(40),count:r(723),infinite:r(724),empty:r(96),error:r(72)}},function(e,t,r){"use strict";var n=r(40);e.exports=function(e){return n(Object.keys(e))}},function(e,t,r){"use strict";e.exports=function e(t){var r=0;return t=t||1/0,function(e,n){return e?n&&n(e):r>t?n(!0):void n(null,r++)}}},function(e,t,r){"use strict";e.exports=function e(t){return t=t||Math.random,function(e,r){return e?r&&r(e):r(null,t())}}},function(e,t,r){"use strict";e.exports={drain:r(162),onEnd:r(366),log:r(726),find:r(727),reduce:r(265),collect:r(31),concat:r(728)}},function(e,t,r){"use strict";var n=r(162);e.exports=function e(t){return n(function(e){console.log(e)},t)}},function(e,t,r){"use strict";function n(e){return e}var i=r(163),o=r(162);e.exports=function e(t,r){var s=!1;return r?t=i(t)||n:(r=t,t=n),o(function(e){if(t(e))return s=!0,r(null,e),!1},function(e){s||r(!0===e?null:e,null)})}},function(e,t,r){"use strict";var n=r(265);e.exports=function e(t){return n(function(e,t){return e+t},"",t)}},function(e,t,r){"use strict";e.exports={map:r(66),asyncMap:r(80),filter:r(67),filterNot:r(730),through:r(196),take:r(266),unique:r(368),nonUnique:r(731),flatten:r(197)}},function(e,t,r){"use strict";var n=r(367),i=r(67);e.exports=function e(t){return t=n(t),i(function(e){return!t(e)})}},function(e,t,r){"use strict";var n=r(368);e.exports=function e(t){return n(t,!0)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var n=r(58),i=h(n),o=r(94),s=h(o),a=r(125),u=h(a),c=r(39),f=h(c);function h(e){return e&&e.__esModule?e:{default:e}}function l(e,t,r){r=(0,u.default)(r||i.default);var n=(0,f.default)(e),o=function(e){if(e)return r(e);var i=(0,s.default)(arguments,1);if(t.apply(this,i))return n(o);r.apply(null,[null].concat(i))};n(o)}e.exports=t.default},function(e,t){e.exports=function e(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},function(e,t,r){"use strict";t.create=function e(t,r,n){const i=n.storageBackends[t],o=Object.assign({},n.storageBackendOptions[t]||{});return new i(r,o)}},function(e,t,r){"use strict";(function(t){const n=r(28).Key,i=r(6),o=i("repo:version"),s=new n("version");e.exports=(e=>({exists(t){e.has(s,t)},get(t){e.get(s,(e,r)=>{if(e)return t(e);t(null,parseInt(r.toString().trim(),10))})},set(r,n){e.put(s,t.from(String(r)),n)},check(e,t){this.get((r,n)=>{if(r)return t(r);o("comparing version: %s and %s",n,e);const i=6===n&&7===e||6===e&&7===n;if(n!==e&&!i)return t(new Error(`ipfs repo needs migration: expected version v${e}, found version v${n}`));t()})}}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(18),i=r(14),o=r(269).asyncFilter,s=r(269).asyncSort,a=r(373),u=r(376);class c{constructor(){this.data={}}open(e){i(e)}put(e,t,r){this.data[e.toString()]=t,i(r)}get(e,t){this.has(e,(r,n)=>r?t(r):n?void t(null,this.data[e.toString()]):t(u.notFoundError()))}has(e,t){i(()=>{t(null,void 0!==this.data[e.toString()])})}delete(e,t){delete this.data[e.toString()],i(()=>{t()})}batch(){let e=[],t=[];return{put(t,r){e.push([t,r])},delete(e){t.push(e)},commit:r=>{e.forEach(e=>{this.data[e[0].toString()]=e[1]}),e=[],t.forEach(e=>{delete this.data[e.toString()]}),t=[],i(r)}}}query(e){let t=[n.keys(this.data),n.map(e=>({key:new a(e),value:this.data[e]}))],r=[];if(null!=e.prefix){const t=e.prefix;r.push((e,r)=>r(null,e.key.toString().startsWith(t)))}if(null!=e.filters&&(r=r.concat(e.filters)),t=t.concat(r.map(e=>o(e))),null!=e.orders&&(t=t.concat(e.orders.map(e=>s(e)))),null!=e.offset){let r=0;t.push(n.filter(()=>r++>=e.offset))}return null!=e.limit&&t.push(n.take(e.limit)),!0===e.keysOnly&&t.push(n.map(e=>({key:e.key}))),n.apply(null,t)}close(e){i(e)}}e.exports=c},function(e,t,r){"use strict";const n=r(28).Key,i=r(200),o=r(11),s=r(372),a=r(744),u=r(745),c=r(4).Buffer,f=new n("config");e.exports=(e=>{const t=i(n,1),r={get(t,r){"function"==typeof t&&(r=t,t=void 0),t||(t=void 0),e.get(f,(e,n)=>{if(e)return r(e);let i;try{i=JSON.parse(n.toString())}catch(e){return r(e)}if(void 0!==t&&!u(i,t))return r(new Error("Key "+t+" does not exist in config"));const o=void 0!==t?s(i,t):i;r(null,o)})},set(e,r,n){if("function"==typeof r)n=r,r=e,e=void 0;else if(!e||"string"!=typeof e)return n(new Error("Invalid key type"));if(void 0===r||c.isBuffer(r))return n(new Error("Invalid value type"));t.push({key:e,value:r},n)},exists(t){e.has(f,t)}};return r;function n(e,t){const n=e.key,i=e.value;n?o([e=>r.get(e),(e,t)=>t(null,a(e,n,i)),h],t):h(i,t)}function h(t,r){const n=c.from(JSON.stringify(t,null,2));e.put(f,n,r)}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=y;var n=r(739),i=b(n),o=r(65),s=b(o),a=r(58),u=b(a),c=r(125),f=b(c),h=r(194),l=b(h),d=r(743),p=b(d),g=r(39),m=b(g);function b(e){return e&&e.__esModule?e:{default:e}}function y(e,t,r){if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var n=(0,m.default)(e),o=0,a=[],c=!1;function h(e,t,r){if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");if(b.started=!0,(0,s.default)(e)||(e=[e]),0===e.length&&b.idle())return(0,l.default)(function(){b.drain()});for(var n=0,i=e.length;n0&&a.splice(u,1),s.callback.apply(s,arguments),null!=t&&b.error(t,s.data)}o<=b.concurrency-b.buffer&&b.unsaturated(),b.idle()&&b.drain(),b.process()}}var g=!1,b={_tasks:new p.default,concurrency:t,payload:r,saturated:u.default,unsaturated:u.default,buffer:t/4,empty:u.default,drain:u.default,error:u.default,started:!1,paused:!1,push:function(e,t){h(e,!1,t)},kill:function(){b.drain=u.default,b._tasks.empty()},unshift:function(e,t){h(e,!0,t)},remove:function(e){b._tasks.remove(e)},process:function(){if(!g){for(g=!0;!b.paused&&o-1}function Y(e,t){var r=this.__data__,n=ne(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function J(e){var t=-1,r=e?e.length:0;for(this.clear();++t-1&&e%1==0&&e-1}function X(e,t){var r=this.__data__,n=ie(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function Z(e){var t=-1,r=e?e.length:0;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=o}function Ae(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ie(e){return!!e&&"object"==typeof e}function Te(e){return"symbol"==typeof e||Ie(e)&&R.call(e)==c}function Oe(e){return null==e?"":ae(e)}function Re(e,t){return null!=e&&he(e,t,oe)}e.exports=Re}).call(this,r(8))},function(e,t,r){"use strict";(function(t){const n=r(28).Key,i=r(747),o=new n("datastore_spec");e.exports=(e=>({exists(t){e.has(o,t)},get(t){e.get(o,(e,r)=>{if(e)return t(e);t(null,JSON.parse(r.toString()))})},set(r,n){e.put(o,t.from(JSON.stringify(i(r,{deep:!0}))),n)}}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(377);e.exports=((e,t)=>{if(!n(e))throw new TypeError("Expected a plain object");if(t=t||{},"function"==typeof t)throw new TypeError("Specify the compare function as an option instead");const r=t.deep,i=[],o=[],s=e=>{const a=i.indexOf(e);if(-1!==a)return o[a];const u={},c=Object.keys(e).sort(t.compare);i.push(e),o.push(u);for(let t=0;t({get(t){e.get(o,(e,r)=>t(e,r&&r.toString()))},set(t,r){e.put(o,i.from(t.toString()),r)},delete(t){e.delete(o,t)}}))},function(e,t,r){"use strict";const n=r(378),i=n.ShardingDatastore,o=r(28).Key,s=r(756),a=r(126),u=r(14),c=r(380),f=r(9),h=r(18),l=e=>{const t=new s.Encoder;return new o("/"+t.write(e).finalize(),!1)},d=e=>l(e.buffer);function p(e,t,r){if(t.sharding){const t=new n.shard.NextToLast(2);i.createOrOpen(e,t,r)}else u(()=>r(null,e))}function g(e){return{query(t,r){h(e.query(t),h.collect(r))},get(t,r){if(!f.isCID(t))return u(()=>{r(new Error("Not a valid cid"))});const n=d(t);e.get(n,(i,o)=>{if(i){if("ERR_NOT_FOUND"===i.code){const o=m(t);if(!o)return r(i);const s=d(o);return e.get(s,(i,o)=>{if(i)return r(i);e.put(n,o,e=>{if(e)return r(e);r(null,new a(o,t))})})}return r(i)}r(null,new a(o,t))})},put(t,r){if(!a.isBlock(t))return u(()=>{r(new Error("invalid block"))});const n=d(t.cid);e.has(n,(i,o)=>i?r(i):o?r():void e.put(n,t.data,r))},putMany(t,r){const n=t.map(e=>({key:d(e.cid),block:e})),i=e.batch();c(n,(t,r)=>e.has(t.key,r),(e,t)=>{if(e)return r(e);t.forEach(e=>{i.put(e.key,e.block.data)}),i.commit(r)})},has(t,r){if(!f.isCID(t))return u(()=>{r(new Error("Not a valid cid"))});e.has(d(t),(n,i)=>{if(n)return r(n);if(i)return r(null,!0);const o=m(t);if(!o)return r(null,!1);e.has(d(o),r)})},delete(t,r){if(!f.isCID(t))return u(()=>{r(new Error("Not a valid cid"))});e.delete(d(t),r)},close(t){e.close(t)}}}function m(e){try{return 0===e.version?e.toV1():e.toV0()}catch(e){return null}}e.exports=((e,t,r)=>{p(e,t,(e,t)=>{if(e)return r(e);r(null,g(t))})})},function(e,t,r){"use strict";(function(t){const n=r(11),i=r(47),o=r(28).Key,s=r(379),a=r(201),u=new o(s.SHARDING_FN),c=new o(s.README_FN);class f{constructor(e,t){this.child=new a(e,{convert:this._convertKey.bind(this),invert:this._invertKey.bind(this)}),this.shard=t}open(e){this.child.open(e)}_convertKey(e){const t=e.toString();if(t===u.toString()||t===c.toString())return e;const r=new o(this.shard.fun(t));return r.child(e)}_invertKey(e){const t=e.toString();return t===u.toString()||t===c.toString()?e:o.withNamespaces(e.list().slice(1))}static createOrOpen(e,t,r){f.create(e,t,t=>{if(t&&"datastore exists"!==t.message)return r(t);f.open(e,r)})}static open(e,t){n([t=>s.readShardFun("/",e,t),(t,r)=>{r(null,new f(e,t))}],t)}static create(e,r,n){e.has(u,(o,a)=>{if(o)return n(o);if(!a){const o="function"==typeof e.putRaw?e.putRaw.bind(e):e.put.bind(e);return i([e=>o(u,t.from(r.toString()+"\n"),e),e=>o(c,t.from(s.readme),e)],e=>n(e))}s.readShardFun("/",e,(e,t)=>{if(e)return n(e);const i=(t||"").toString(),o=r.toString();if(i!==o)return n(new Error(`specified fun ${o} does not match repo shard fun ${i}`));n(new Error("datastore exists"))})})}put(e,t,r){this.child.put(e,t,r)}get(e,t){this.child.get(e,t)}has(e,t){this.child.has(e,t)}delete(e,t){this.child.delete(e,t)}batch(){return this.child.batch()}query(e){const t={keysOnly:e.keysOnly,offset:e.offset,limit:e.limit,filters:[(e,t)=>t(null,e.key.toString()!==u.toString()),(e,t)=>t(null,e.key.toString()!==c.toString())]};if(null!=e.prefix&&t.filters.push((t,r)=>{r(null,this._invertKey(t.key).toString().startsWith(e.prefix))}),null!=e.filters){const r=e.filters.map(e=>(t,r)=>{e(Object.assign({},t,{key:this._invertKey(t.key)}),r)});t.filters=t.filters.concat(r)}return null!=e.orders&&(t.orders=e.orders.map(e=>(t,r)=>{t.forEach(e=>{e.key=this._invertKey(e.key)}),e(t,(e,t)=>{if(e)return r(e);t.forEach(e=>{e.key=this._convertKey(e.key)}),r(null,t)})})),this.child.query(t)}close(e){this.child.close(e)}}e.exports=f}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports="This is a repository of IPLD objects. Each IPLD object is in a single file,\nnamed .data. Where is the\n\"base32\" encoding of the CID (as specified in\nhttps://github.com/multiformats/multibase) without the 'B' prefix.\nAll the object files are placed in a tree of directories, based on a\nfunction of the CID. This is a form of sharding similar to\nthe objects directory in git repositories. Previously, we used\nprefixes, we now use the next-to-last two charters.\n func NextToLast(base32cid string) {\n nextToLastLen := 2\n offset := len(base32cid) - nextToLastLen - 1\n return str[offset : offset+nextToLastLen]\n }\nFor example, an object with a base58 CIDv1 of\n zb2rhYSxw4ZjuzgCnWSt19Q94ERaeFhu9uSqRgjSdx9bsgM6f\nhas a base32 CIDv1 of\n BAFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA\nand will be placed at\n SC/AFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA.data\nwith 'SC' being the last-to-next two characters and the 'B' at the\nbeginning of the CIDv1 string is the multibase prefix that is not\nstored in the filename.\n"},function(e,t,r){"use strict";const n=r(52),i=r(753),o=r(18),s=r(28).Key,a=r(28).Errors,u=r(28).utils,c=u.asyncFilter,f=u.asyncSort,h=u.replaceStartWith,l=r(201);class d{constructor(e){this.mounts=e.slice()}open(e){n(this.mounts,(e,t)=>{e.datastore.open(t)},e)}_lookup(e){for(let t of this.mounts)if(t.prefix.toString()===e.toString()||t.prefix.isAncestorOf(e)){const r=h(e.toString(),t.prefix.toString());return{datastore:t.datastore,mountpoint:t.prefix,rest:new s(r)}}}put(e,t,r){const n=this._lookup(e);if(null==n)return r(a.dbWriteFailedError(new Error("No datastore mounted for this key")));n.datastore.put(n.rest,t,r)}get(e,t){const r=this._lookup(e);if(null==r)return t(a.notFoundError(new Error("No datastore mounted for this key")));r.datastore.get(r.rest,t)}has(e,t){const r=this._lookup(e);null!=r?r.datastore.has(r.rest,t):t(null,!1)}delete(e,t){const r=this._lookup(e);if(null==r)return t(a.dbDeleteFailedError(new Error("No datastore mounted for this key")));r.datastore.delete(r.rest,t)}close(e){n(this.mounts,(e,t)=>{e.datastore.close(t)},e)}batch(){const e={},t=t=>{const r=this._lookup(t);if(null==r)throw new Error("No datastore mounted for this key");const n=r.mountpoint.toString();return null==e[n]&&(e[n]=r.datastore.batch()),{batch:e[n],rest:r.rest}};return{put:(e,r)=>{const n=t(e);n.batch.put(n.rest,r)},delete:e=>{const r=t(e);r.batch.delete(r.rest)},commit:t=>{n(Object.keys(e),(t,r)=>{e[t].commit(r)},t)}}}query(e){const t=this.mounts.map(t=>{const r=new l(t.datastore,{convert:e=>{throw new Error("should never be called")},invert:e=>t.prefix.child(e)});let n;return null!=e.prefix&&(n=h(e.prefix,t.prefix.toString())),r.query({prefix:n,filters:e.filters,keysOnly:e.keysOnly})});let r=[i(t)];if(null!=e.filters&&(r=r.concat(e.filters.map(e=>c(e)))),null!=e.orders&&(r=r.concat(e.orders.map(e=>f(e)))),null!=e.offset){let t=0;r.push(o.filter(()=>t++>=e.offset))}return null!=e.limit&&r.push(o.take(e.limit)),o.apply(null,r)}}e.exports=d},function(e,t){e.exports=function(e){var t=!!e,r=(e||[]).map(s),n=0,i,o;function s(e){return{ready:!1,reading:!1,ended:!1,read:e,data:null}}function a(){if(o){u();var e=r.length,s=o;if(0===e&&(i||t))return o=null,void s(i||!0);for(var a=0;ar.length)throw new Error("this should never happen");if(!(t.reading||t.ended||t.ready)){t.reading=!0;var n=!0;t.read(i,function e(r,o){t.data=o,t.ready=!0,t.reading=!1,!0===r||i?t.ended=!0:r&&(i=t.ended=r),i&&!r&&t.read(i,e),n||a()}),n=!1}}(r[e]);a()}function f(e,t){i=i||e,o=t,c()}return f.add=function(e){if(!e)return t=!0,c();r.push(s(e)),c()},f.cap=function(e){f.add(null)},f}},function(e,t,r){"use strict";const n=r(52),i=r(203),o=r(28).Errors;class s{constructor(e){this.stores=e.slice()}open(e){n(this.stores,(e,t)=>{e.open(t)},t=>{if(t)return e(o.dbOpenFailedError());e()})}put(e,t,r){n(this.stores,(r,n)=>{r.put(e,t,n)},e=>{if(e)return r(o.dbWriteFailedError());r()})}get(e,t){const r=this.stores.length;let n=!1,s=0;i(()=>!n&&s{const r=this.stores[s++];r.get(e,(e,r)=>{if(null==e)return n=!0,t(null,r);t()})},(e,r)=>{if(e||!r)return t(o.notFoundError());t(null,r)})}has(e,t){const r=this.stores.length;let n=!1,o=0;i(()=>!n&&o{const r=this.stores[o++];r.has(e,(e,r)=>{if(null==e)return n=!0,t(null,r);t()})},t)}delete(e,t){n(this.stores,(t,r)=>{t.delete(e,r)},e=>{if(e)return t(o.dbDeleteFailedError());t()})}close(e){n(this.stores,(e,t)=>{e.close(t)},e)}batch(){const e=this.stores.map(e=>e.batch());return{put:(t,r)=>{e.forEach(e=>e.put(t,r))},delete:t=>{e.forEach(e=>e.delete(t))},commit:t=>{n(e,(e,t)=>{e.commit(t)},t)}}}query(e){return this.stores[this.stores.length-1].query(e)}}e.exports=s},function(e,t,r){"use strict";const n=r(28).Key,i=r(201);class o extends i{constructor(e,t){super(e,{convert:e=>t.child(e),invert(e){if("/"===t.toString())return e;if(!t.isAncestorOf(e))throw new Error(`Expected prefix: (${t.toString()}) in key: ${e.toString()}`);return new n(e.toString().slice(t.toString().length),!1)}}),this.prefix=t}query(e){return e.prefix&&"/"!==this.prefix.toString()?super.query(Object.assign({},e,{prefix:this.prefix.child(new n(e.prefix)).toString()})):super.query(e)}}e.exports=o},function(e,t,r){"use strict";var n=function(e,t){return t||(t={}),e.split("").forEach(function(e,r){e in t||(t[e]=r)}),t},i={alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",charmap:{0:14,1:8}};i.charmap=n(i.alphabet,i.charmap);var o={alphabet:"0123456789ABCDEFGHJKMNPQRSTVWXYZ",charmap:{O:0,I:1,L:1}};o.charmap=n(o.alphabet,o.charmap);var s={alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",charmap:{}};function a(e){if(this.buf=[],this.shift=8,this.carry=0,e){switch(e.type){case"rfc4648":this.charmap=t.rfc4648.charmap;break;case"crockford":this.charmap=t.crockford.charmap;break;case"base32hex":this.charmap=t.base32hex.charmap;break;default:throw new Error("invalid type")}e.charmap&&(this.charmap=e.charmap)}}function u(e){if(this.buf="",this.shift=3,this.carry=0,e){switch(e.type){case"rfc4648":this.alphabet=t.rfc4648.alphabet;break;case"crockford":this.alphabet=t.crockford.alphabet;break;case"base32hex":this.alphabet=t.base32hex.alphabet;break;default:throw new Error("invalid type")}e.alphabet?this.alphabet=e.alphabet:e.lc&&(this.alphabet=this.alphabet.toLowerCase())}}s.charmap=n(s.alphabet,s.charmap),a.prototype.charmap=i.charmap,a.prototype.write=function(e){var t=this.charmap,r=this.buf,n=this.shift,i=this.carry;return e.toUpperCase().split("").forEach(function(e){if("="!=e){var o=255&t[e];n-=5,n>0?i|=o<>-n),n+=8,i=o<>t,this.buf+=this.alphabet[31&n],t>5&&(t-=5,n=i>>t,this.buf+=this.alphabet[31&n]),t=5-t,r=i<0?this.tail.next=r:this.head=r,this.tail=r,++this.length},e.prototype.unshift=function e(t){var r={data:t,next:this.head};0===this.length&&(this.tail=r),this.head=r,++this.length},e.prototype.shift=function e(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},e.prototype.clear=function e(){this.head=this.tail=null,this.length=0},e.prototype.join=function e(t){if(0===this.length)return"";for(var r=this.head,n=""+r.data;r=r.next;)n+=t+r.data;return n},e.prototype.concat=function e(t){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var r=i.allocUnsafe(t>>>0),n=this.head,o=0;n;)s(n.data,r,o),o+=n.data.length,n=n.next;return r},e}(),o&&o.inspect&&o.inspect.custom&&(e.exports.prototype[o.inspect.custom]=function(){var e=o.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,r){"use strict";e.exports=o;var n=r(389),i=r(5);function o(e){if(!(this instanceof o))return new o(e);n.call(this,e)}i.inherits=r(1),i.inherits(o,n),o.prototype._transform=function(e,t,r){r(null,e)}},function(e,t,r){var n=r(390).WriteError,i=r(392);function o(e){this._levelup=e,this.batch=e.db.batch(),this.ops=[],this.length=0}o.prototype.put=function(e,t){try{this.batch.put(e,t)}catch(e){throw new n(e)}return this.ops.push({type:"put",key:e,value:t}),this.length++,this},o.prototype.del=function(e){try{this.batch.del(e)}catch(e){throw new n(e)}return this.ops.push({type:"del",key:e}),this.length++,this},o.prototype.clear=function(){try{this.batch.clear()}catch(e){throw new n(e)}return this.ops=[],this.length=0,this},o.prototype.write=function(e){var t=this._levelup,r=this.ops,o;e||(e=i(),o=e.promise);try{this.batch.write(function(i){if(i)return e(new n(i));t.emit("batch",r),e()})}catch(e){throw new n(e)}return o},e.exports=o},function(e,t,r){var n=r(772);function i(e,t,r){t&&"string"!=typeof t&&(t=t.message||t.name),n(this,{type:e,name:e,cause:"string"!=typeof t?t:r,message:t},"ewr")}function o(e,t){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),i.call(this,"CustomError",e,t)}function s(e,t,r){var n=function(r,o){i.call(this,t,r,o),"FilesystemError"==t&&(this.code=this.cause.code,this.path=this.cause.path,this.errno=this.cause.errno,this.message=(e.errno[this.cause.errno]?e.errno[this.cause.errno].description:this.cause.message)+(this.cause.path?" ["+this.cause.path+"]":"")),Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,n)};return n.prototype=r?new r:new o,n}o.prototype=new Error,e.exports=function(e){var t=function(t,r){return s(e,t,r)};return{CustomError:o,FilesystemError:t("FilesystemError"),createError:t}}},function(e,t,r){ +function r(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i=0;f--)if(u[f]!==l[f])return!1;for(f=u.length-1;f>=0;f--)if(c=u[f],!v(e[c],t[c],n,r))return!1;return!0}function k(e,t,n){v(e,t,!0)&&y(e,t,n,"notDeepStrictEqual",k)}function S(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function E(e){var t;try{e()}catch(e){t=e}return t}function x(e,t,n,r){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=E(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&y(i,n,"Missing expected exception"+r);var s="string"==typeof r,a=!e&&o.isError(i),u=!e&&i&&!n;if((a&&s&&S(i,n)||u)&&y(i,n,"Got unwanted exception"+r),e&&i&&n&&!S(i,n)||!e&&i)throw i}f.AssertionError=function e(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=g(this),this.generatedMessage=!0);var n=t.stackStartFunction||y;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var i=r.stack,o=p(n),s=i.indexOf("\n"+o);if(s>=0){var a=i.indexOf("\n",s+1);i=i.substring(a+1)}this.stack=i}}},o.inherits(f.AssertionError,Error),f.fail=y,f.ok=b,f.equal=function e(t,n,r){t!=n&&y(t,n,r,"==",f.equal)},f.notEqual=function e(t,n,r){t==n&&y(t,n,r,"!=",f.notEqual)},f.deepEqual=function e(t,n,r){v(t,n,!1)||y(t,n,r,"deepEqual",f.deepEqual)},f.deepStrictEqual=function e(t,n,r){v(t,n,!0)||y(t,n,r,"deepStrictEqual",f.deepStrictEqual)},f.notDeepEqual=function e(t,n,r){v(t,n,!1)&&y(t,n,r,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=k,f.strictEqual=function e(t,n,r){t!==n&&y(t,n,r,"===",f.strictEqual)},f.notStrictEqual=function e(t,n,r){t===n&&y(t,n,r,"!==",f.notStrictEqual)},f.throws=function(e,t,n){x(!0,e,t,n)},f.doesNotThrow=function(e,t,n){x(!1,e,t,n)},f.ifError=function(e){if(e)throw e};var C=Object.keys||function(e){var t=[];for(var n in e)s.call(e,n)&&t.push(n);return t}}).call(t,n(5))},function(e,t,n){"use strict";(function(e){var n={};t.escapeJavaScript=function(e){if(!e)return"";for(var t="",r=0;r&\u2028\u2029]/g,function(e){return o=e.charCodeAt(0),60===o?"\\u003c":62===o?"\\u003e":38===o?"\\u0026":8232===o?"\\u2028":"\\u2029"})},n.escapeJavaScriptChar=function(t){if(t>=256)return"\\u"+n.padLeft(""+t,4);var r=e.from(String.fromCharCode(t),"ascii").toString("hex");return"\\x"+n.padLeft(r,2)},n.escapeHtmlChar=function(t){var r=n.namedHtml[t];if(void 0!==r)return r;if(t>=256)return"&#"+t+";";var i=e.from(String.fromCharCode(t),"ascii").toString("hex");return"&#x"+n.padLeft(i,2)+";"},n.padLeft=function(e,t){for(;e.length=97||t>=65&&t<=90||t>=48&&t<=57||32===t||46===t||44===t||45===t||58===t||95===t)&&(e[t]=null);return e}()}).call(t,n(3).Buffer)},function(e,t,n){"use strict";(function(e){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=n(38),o={hasOwn:Object.prototype.hasOwnProperty,indexOf:Array.prototype.indexOf,defaultThreshold:16,maxIPv6Groups:8,categories:{valid:1,dnsWarn:7,rfc5321:15,cfws:31,deprecated:63,rfc5322:127,error:255},diagnoses:{valid:0,rfc5321TLD:9,rfc5321TLDNumeric:10,rfc5321QuotedString:11,rfc5321AddressLiteral:12,cfwsComment:17,cfwsFWS:18,undesiredNonAscii:25,deprecatedLocalPart:33,deprecatedFWS:34,deprecatedQTEXT:35,deprecatedQP:36,deprecatedComment:37,deprecatedCTEXT:38,deprecatedIPv6:39,deprecatedCFWSNearAt:49,rfc5322Domain:65,rfc5322TooLong:66,rfc5322LocalTooLong:67,rfc5322DomainTooLong:68,rfc5322LabelTooLong:69,rfc5322DomainLiteral:70,rfc5322DomainLiteralOBSDText:71,rfc5322IPv6GroupCount:72,rfc5322IPv62x2xColon:73,rfc5322IPv6BadCharacter:74,rfc5322IPv6MaxGroups:75,rfc5322IPv6ColonStart:76,rfc5322IPv6ColonEnd:77,errExpectingDTEXT:129,errNoLocalPart:130,errNoDomain:131,errConsecutiveDots:132,errATEXTAfterCFWS:133,errATEXTAfterQS:134,errATEXTAfterDomainLiteral:135,errExpectingQPair:136,errExpectingATEXT:137,errExpectingQTEXT:138,errExpectingCTEXT:139,errBackslashEnd:140,errDotStart:141,errDotEnd:142,errDomainHyphenStart:143,errDomainHyphenEnd:144,errUnclosedQuotedString:145,errUnclosedComment:146,errUnclosedDomainLiteral:147,errFWSCRLFx2:148,errFWSCRLFEnd:149,errCRNoLF:150,errUnknownTLD:160,errDomainTooShort:161},components:{localpart:0,domain:1,literal:2,contextComment:3,contextFWS:4,contextQuotedString:5,contextQuotedPair:6}};o.specials=function(){var e='()<>[]:;@\\,."',t=new Array(256);t.fill(!1);for(var n=0;n=0?o.nulNormalize(e):e.normalize("NFC")},o.checkIpV6=function(e){return e.every(function(e){return o.regex.ipV6.test(e)})},o.validDomain=function(e,t){return t.tldBlacklist?Array.isArray(t.tldBlacklist)?-1===o.indexOf.call(t.tldBlacklist,e):!o.hasOwn.call(t.tldBlacklist,e):Array.isArray(t.tldWhitelist)?-1!==o.indexOf.call(t.tldWhitelist,e):o.hasOwn.call(t.tldWhitelist,e)},t.validate=o.validate=function(t,n,s){n=n||{},t=o.normalize(t),"function"==typeof n&&(s=n,n={}),"function"!=typeof s&&(s=null);var a=void 0,u=void 0;if("number"==typeof n.errorLevel?(a=!0,u=n.errorLevel):(a=!!n.errorLevel,u=o.diagnoses.valid),n.tldWhitelist)if("string"==typeof n.tldWhitelist)n.tldWhitelist=[n.tldWhitelist];else if("object"!==r(n.tldWhitelist))throw new TypeError("expected array or object tldWhitelist");if(n.tldBlacklist)if("string"==typeof n.tldBlacklist)n.tldBlacklist=[n.tldBlacklist];else if("object"!==r(n.tldBlacklist))throw new TypeError("expected array or object tldBlacklist");if(n.minDomainAtoms&&(n.minDomainAtoms!==(0|+n.minDomainAtoms)||n.minDomainAtoms<0))throw new TypeError("expected positive integer minDomainAtoms");var l=o.diagnoses.valid,c=function e(t){t>l&&(l=t)},f=void 0===n.allowUnicode||!!n.allowUnicode;!f&&/[^\x00-\x7f]/.test(t)&&c(o.diagnoses.undesiredNonAscii);for(var h={now:o.components.localpart,prev:o.components.localpart,stack:[o.components.localpart]},p="",d={local:"",domain:""},m={locals:[""],domains:[""]},g=0,y=0,b=0,v=void 0,_=!1,w=!1,k=t.length,S=void 0,E=0;E64?c(o.diagnoses.rfc5322LocalTooLong):h.prev!==o.components.contextComment&&h.prev!==o.components.contextFWS||c(o.diagnoses.deprecatedCFWSNearAt),h.now=o.components.domain,h.stack[0]=o.components.domain,g=0,y=0,w=!1;break;default:if(w)switch(h.prev){case o.components.contextComment:case o.components.contextFWS:c(o.diagnoses.errATEXTAfterCFWS);break;case o.components.contextQuotedString:c(o.diagnoses.errATEXTAfterQS);break;default:throw new Error("more atext found where none is allowed, but unrecognized prev context: "+h.prev)}else h.prev=h.now,v=S.codePointAt(0),(o.specials(v)||o.c0Controls(v)||o.c1Controls(v))&&c(o.diagnoses.errExpectingATEXT),d.local+=S,m.locals[g]+=S,y+=e.byteLength(S,"utf8")}break;case o.components.domain:switch(S){case"(":0===y?c(0===g?o.diagnoses.deprecatedCFWSNearAt:o.diagnoses.deprecatedComment):(w=!0,c(o.diagnoses.cfwsComment)),h.stack.push(h.now),h.now=o.components.contextComment;break;case".":var x=i.encode(m.domains[g]).length;0===y?c(0===g?o.diagnoses.errDotStart:o.diagnoses.errConsecutiveDots):_?c(o.diagnoses.errDomainHyphenEnd):x>63&&c(o.diagnoses.rfc5322LabelTooLong),w=!1,y=0,++g,m.domains[g]="",d.domain+=S;break;case"[":0===d.domain.length?(w=!0,y+=e.byteLength(S,"utf8"),h.stack.push(h.now),h.now=o.components.literal,d.domain+=S,m.domains[g]+=S,d.literal=""):c(o.diagnoses.errExpectingATEXT);break;case"\r":if(k===++E||"\n"!==t[E]){c(o.diagnoses.errCRNoLF);break}case" ":case"\t":0===y?c(0===g?o.diagnoses.deprecatedCFWSNearAt:o.diagnoses.deprecatedFWS):(c(o.diagnoses.cfwsFWS),w=!0),h.stack.push(h.now),h.now=o.components.contextFWS,p=S;break;default:if(w)switch(h.prev){case o.components.contextComment:case o.components.contextFWS:c(o.diagnoses.errATEXTAfterCFWS);break;case o.components.literal:c(o.diagnoses.errATEXTAfterDomainLiteral);break;default:throw new Error("more atext found where none is allowed, but unrecognized prev context: "+h.prev)}v=S.codePointAt(0),_=!1,o.specials(v)||o.c0Controls(v)||o.c1Controls(v)?c(o.diagnoses.errExpectingATEXT):"-"===S?(0===y&&c(o.diagnoses.errDomainHyphenStart),_=!0):(v<48||v>122&&v<192||v>57&&v<65||v>90&&v<97)&&c(o.diagnoses.rfc5322Domain),d.domain+=S,m.domains[g]+=S,y+=e.byteLength(S,"utf8")}break;case o.components.literal:switch(S){case"]":if(lj?c(o.diagnoses.rfc5322IPv6MaxGroups):O.length===j&&c(o.diagnoses.deprecatedIPv6)):O.length!==j&&c(o.diagnoses.rfc5322IPv6GroupCount),":"===T[0]&&":"!==T[1]?c(o.diagnoses.rfc5322IPv6ColonStart):":"===T[T.length-1]&&":"!==T[T.length-2]?c(o.diagnoses.rfc5322IPv6ColonEnd):o.checkIpV6(O)?c(o.diagnoses.rfc5321AddressLiteral):c(o.diagnoses.rfc5322IPv6BadCharacter)}}else c(o.diagnoses.rfc5322DomainLiteral);d.domain+=S,m.domains[g]+=S,y+=e.byteLength(S,"utf8"),h.prev=h.now,h.now=h.stack.pop();break;case"\\":c(o.diagnoses.rfc5322DomainLiteralOBSDText),h.stack.push(h.now),h.now=o.components.contextQuotedPair;break;case"\r":if(k===++E||"\n"!==t[E]){c(o.diagnoses.errCRNoLF);break}case" ":case"\t":c(o.diagnoses.cfwsFWS),h.stack.push(h.now),h.now=o.components.contextFWS,p=S;break;default:if(v=S.codePointAt(0),127!==v&&o.c1Controls(v)||0===v||"["===S){c(o.diagnoses.errExpectingDTEXT);break}(o.c0Controls(v)||127===v)&&c(o.diagnoses.rfc5322DomainLiteralOBSDText),d.literal+=S,d.domain+=S,m.domains[g]+=S,y+=e.byteLength(S,"utf8")}break;case o.components.contextQuotedString:switch(S){case"\\":h.stack.push(h.now),h.now=o.components.contextQuotedPair;break;case"\r":if(k===++E||"\n"!==t[E]){c(o.diagnoses.errCRNoLF);break}case"\t":d.local+=" ",m.locals[g]+=" ",y+=e.byteLength(S,"utf8"),c(o.diagnoses.cfwsFWS),h.stack.push(h.now),h.now=o.components.contextFWS,p=S;break;case'"':d.local+=S,m.locals[g]+=S,y+=e.byteLength(S,"utf8"),h.prev=h.now,h.now=h.stack.pop();break;default:v=S.codePointAt(0),127!==v&&o.c1Controls(v)||0===v||10===v?c(o.diagnoses.errExpectingQTEXT):(o.c0Controls(v)||127===v)&&c(o.diagnoses.deprecatedQTEXT),d.local+=S,m.locals[g]+=S,y+=e.byteLength(S,"utf8")}break;case o.components.contextQuotedPair:v=S.codePointAt(0),127!==v&&o.c1Controls(v)?c(o.diagnoses.errExpectingQPair):(v<31&&9!==v||127===v)&&c(o.diagnoses.deprecatedQP),h.prev=h.now,h.now=h.stack.pop();var P="\\"+S;switch(h.now){case o.components.contextComment:break;case o.components.contextQuotedString:d.local+=P,m.locals[g]+=P,y+=2;break;case o.components.literal:d.domain+=P,m.domains[g]+=P,y+=2;break;default:throw new Error("quoted pair logic invoked in an invalid context: "+h.now)}break;case o.components.contextComment:switch(S){case"(":h.stack.push(h.now),h.now=o.components.contextComment;break;case")":h.prev=h.now,h.now=h.stack.pop();break;case"\\":h.stack.push(h.now),h.now=o.components.contextQuotedPair;break;case"\r":if(k===++E||"\n"!==t[E]){c(o.diagnoses.errCRNoLF);break}case" ":case"\t":c(o.diagnoses.cfwsFWS),h.stack.push(h.now),h.now=o.components.contextFWS,p=S;break;default:if(v=S.codePointAt(0),0===v||10===v||127!==v&&o.c1Controls(v)){c(o.diagnoses.errExpectingCTEXT);break}(o.c0Controls(v)||127===v)&&c(o.diagnoses.deprecatedCTEXT)}break;case o.components.contextFWS:if("\r"===p){if("\r"===S){c(o.diagnoses.errFWSCRLFx2);break}++b>1?c(o.diagnoses.deprecatedFWS):b=1}switch(S){case"\r":k!==++E&&"\n"===t[E]||c(o.diagnoses.errCRNoLF);break;case" ":case"\t":break;default:"\r"===p&&c(o.diagnoses.errFWSCRLFEnd),b=0,h.prev=h.now,h.now=h.stack.pop(),--E}p=S;break;default:throw new Error("unknown context: "+h.now)}if(l>o.categories.rfc5322)break}if(l255)c(o.diagnoses.rfc5322DomainTooLong);else if(e.byteLength(d.local,"utf8")+B+1>254)c(o.diagnoses.rfc5322TooLong);else if(y>63)c(o.diagnoses.rfc5322LabelTooLong);else if(n.minDomainAtoms&&m.domains.length0){var _=u.shift();if(b=_._validate(p,y,i),b.errors){if(o.push(this.createError("array.ordered",{pos:f,reason:b.errors,value:p},{key:r.key,path:y.path},i)),i.abortEarly)return o}else if(_._flags.strip)h.fastSplice(t,f),--f,--c;else{if(!this._flags.sparse&&void 0===b.value){if(o.push(this.createError("array.sparse",null,{key:r.key,path:y.path,pos:f},i)),i.abortEarly)return o;continue}t[f]=b.value}continue}if(!this._inner.items.length){if(o.push(this.createError("array.orderedLength",{pos:f,limit:this._inner.ordereds.length},{key:r.key,path:y.path},i)),i.abortEarly)return o;continue}}for(var w=[],k=a.length,S=0;S=0||n,"limit must be a positive integer or reference"),this._test("min",t,function(e,r,i){var o=void 0;if(n){if(o=t(r.reference||r.parent,i),!(Number.isSafeInteger(o)&&o>=0))return this.createError("array.ref",{ref:t.key},r,i)}else o=t;return e.length>=o?e:this.createError("array.min",{limit:t,value:e},r,i)})},t.prototype.max=function e(t){var n=c.isRef(t);return f.assert(Number.isSafeInteger(t)&&t>=0||n,"limit must be a positive integer or reference"),this._test("max",t,function(e,r,i){var o=void 0;if(n){if(o=t(r.reference||r.parent,i),!(Number.isSafeInteger(o)&&o>=0))return this.createError("array.ref",{ref:t.key},r,i)}else o=t;return e.length<=o?e:this.createError("array.max",{limit:t,value:e},r,i)})},t.prototype.length=function e(t){var n=c.isRef(t);return f.assert(Number.isSafeInteger(t)&&t>=0||n,"limit must be a positive integer or reference"),this._test("length",t,function(e,r,i){var o=void 0;if(n){if(o=t(r.reference||r.parent,i),!(Number.isSafeInteger(o)&&o>=0))return this.createError("array.ref",{ref:t.key},r,i)}else o=t;return e.length===o?e:this.createError("array.length",{limit:t,value:e},r,i)})},t.prototype.unique=function e(t){f.assert(void 0===t||"function"==typeof t||"string"==typeof t,"comparator must be a function or a string");var n={};return"string"==typeof t?n.path=t:"function"==typeof t&&(n.comparator=t),this._test("unique",n,function(e,t,i){for(var o={string:Object.create(null),number:Object.create(null),undefined:Object.create(null),boolean:Object.create(null),object:new Map,function:new Map,custom:new Map},s=n.comparator||f.deepEqual,a=0;a=0,"limit must be a positive integer"),this._test("min",t,function(e,n,r){return e.length>=t?e:this.createError("binary.min",{limit:t,value:e},n,r)})},n.prototype.max=function e(t){return u.assert(Number.isSafeInteger(t)&&t>=0,"limit must be a positive integer"),this._test("max",t,function(e,n,r){return e.length<=t?e:this.createError("binary.max",{limit:t,value:e},n,r)})},n.prototype.length=function e(t){return u.assert(Number.isSafeInteger(t)&&t>=0,"limit must be a positive integer"),this._test("length",t,function(e,n,r){return e.length===t?e:this.createError("binary.length",{limit:t,value:e},n,r)})},n}(a),e.exports=new l.Binary}).call(t,n(3).Buffer)},function(e,t,n){"use strict";function r(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r=0,"n must be a positive integer"),this._test("arity",t,function(e,n,r){return e.length===t?e:this.createError("function.arity",{n:t},n,r)})},t.prototype.minArity=function e(t){return a.assert(Number.isSafeInteger(t)&&t>0,"n must be a strict positive integer"),this._test("minArity",t,function(e,n,r){return e.length>=t?e:this.createError("function.minArity",{n:t},n,r)})},t.prototype.maxArity=function e(t){return a.assert(Number.isSafeInteger(t)&&t>=0,"n must be a positive integer"),this._test("maxArity",t,function(e,n,r){return e.length<=t?e:this.createError("function.maxArity",{n:t},n,r)})},t.prototype.ref=function e(){return this._test("ref",null,function(e,t,n){return l.isRef(e)?e:this.createError("function.ref",null,t,n)})},t.prototype.class=function e(){return this._test("class",null,function(e,t,n){return/^\s*class\s/.test(e.toString())?e:this.createError("function.class",null,t,n)})},t}(u.constructor),e.exports=new c.Func},function(e,t,n){"use strict";function r(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r0,"multiple must be greater than 0")),this._test("multiple",t,function(e,r,i){var o=n?t(r.reference||r.parent,i):t;return!n||"number"==typeof o&&isFinite(o)?e%o==0?e:this.createError("number.multiple",{multiple:t,value:e},r,i):this.createError("number.ref",{ref:t.key},r,i)})},t.prototype.integer=function e(){return this._test("integer",void 0,function(e,t,n){return Number.isSafeInteger(e)?e:this.createError("number.integer",{value:e},t,n)})},t.prototype.negative=function e(){return this._test("negative",void 0,function(e,t,n){return e<0?e:this.createError("number.negative",{value:e},t,n)})},t.prototype.positive=function e(){return this._test("positive",void 0,function(e,t,n){return e>0?e:this.createError("number.positive",{value:e},t,n)})},t.prototype.precision=function e(t){l.assert(Number.isSafeInteger(t),"limit must be an integer"),l.assert(!("precision"in this._flags),"precision already set");var n=this._test("precision",t,function(e,n,r){var i=e.toString().match(c.precisionRx),o=Math.max((i[1]?i[1].length:0)-(i[2]?parseInt(i[2],10):0),0);return o<=t?e:this.createError("number.precision",{limit:t,value:e},n,r)});return n._flags.precision=t,n},t.prototype.port=function e(){return this._test("port",void 0,function(e,t,n){return!Number.isSafeInteger(e)||e<0||e>65535?this.createError("number.port",{value:e},t,n):e})},t}(a),c.compare=function(e,t){return function(n){var r=u.isRef(n),i="number"==typeof n&&!isNaN(n);return l.assert(i||r,"limit must be a number or reference"),this._test(e,n,function(i,o,s){var a=void 0;if(r){if(a=n(o.reference||o.parent,s),"number"!=typeof a||isNaN(a))return this.createError("number.ref",{ref:n.key},o,s)}else a=n;return t(i,a)?i:this.createError("number."+e,{limit:a,value:i},o,s)})}},c.Number.prototype.min=c.compare("min",function(e,t){return e>=t}),c.Number.prototype.max=c.compare("max",function(e,t){return e<=t}),c.Number.prototype.greater=c.compare("greater",function(e,t){return e>t}),c.Number.prototype.less=c.compare("less",function(e,t){return e9),o^=3}var a=i%10==0&&i>0;return a?e:this.createError("string.creditCard",{value:e},t,n)})},t.prototype.regex=function e(t,n){l.assert(t instanceof RegExp,"pattern must be a RegExp");var i={pattern:new RegExp(t.source,t.ignoreCase?"i":void 0)};"string"==typeof n?i.name=n:"object"===(void 0===n?"undefined":r(n))&&(i.invert=!!n.invert,n.name&&(i.name=n.name));var o=["string.regex",i.invert?".invert":"",i.name?".name":".base"].join("");return this._test("regex",i,function(e,t,n){var r=i.pattern.test(e);return r^i.invert?e:this.createError(o,{name:i.name,pattern:i.pattern,value:e},t,n)})},t.prototype.alphanum=function e(){return this._test("alphanum",void 0,function(e,t,n){return/^[a-zA-Z0-9]+$/.test(e)?e:this.createError("string.alphanum",{value:e},t,n)})},t.prototype.token=function e(){return this._test("token",void 0,function(e,t,n){return/^\w+$/.test(e)?e:this.createError("string.token",{value:e},t,n)})},t.prototype.email=function e(t){return t&&(l.assert("object"===(void 0===t?"undefined":r(t)),"email options must be an object"),l.assert(void 0===t.checkDNS,"checkDNS option is not supported"),l.assert(void 0===t.tldWhitelist||"object"===r(t.tldWhitelist),"tldWhitelist must be an array or object"),l.assert(void 0===t.minDomainAtoms||Number.isSafeInteger(t.minDomainAtoms)&&t.minDomainAtoms>0,"minDomainAtoms must be a positive integer"),l.assert(void 0===t.errorLevel||"boolean"==typeof t.errorLevel||Number.isSafeInteger(t.errorLevel)&&t.errorLevel>=0,"errorLevel must be a non-negative integer or boolean")),this._test("email",t,function(e,r,i){c=c||n(19);try{var o=c.validate(e,t);if(!0===o||0===o)return e}catch(e){}return this.createError("string.email",{value:e},r,i)})},t.prototype.ip=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=g.ipRegex;l.assert("object"===(void 0===t?"undefined":r(t)),"options must be an object"),t.cidr?(l.assert("string"==typeof t.cidr,"cidr must be a string"),t.cidr=t.cidr.toLowerCase(),l.assert(l.contain(g.cidrPresences,t.cidr),"cidr must be one of "+g.cidrPresences.join(", ")),t.version||"optional"===t.cidr||(n=m.createIpRegex(["ipv4","ipv6","ipvfuture"],t.cidr))):t.cidr="optional";var i=void 0;if(t.version){Array.isArray(t.version)||(t.version=[t.version]),l.assert(t.version.length>=1,"version must have at least 1 version specified"),i=[];for(var o=0;o=1,"scheme must have at least 1 scheme specified");for(var a=0;a=1,"version must have at least 1 valid version specified");for(var r=new Set,i=0;i0&&void 0!==arguments[0]?arguments[0]:{};l.assert("object"===(void 0===t?"undefined":r(t)),"hex options must be an object"),l.assert(void 0===t.byteAligned||"boolean"==typeof t.byteAligned,"byteAligned must be boolean");var n=!0===t.byteAligned,i=/^[a-f0-9]+$/i,o=this._test("hex",i,function(e,t,r){return i.test(e)?n&&e.length%2!=0?this.createError("string.hexAlign",{value:e},t,r):e:this.createError("string.hex",{value:e},t,r)});return n&&(o._flags.byteAligned=!0),o},t.prototype.base64=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};l.assert("object"===(void 0===t?"undefined":r(t)),"base64 options must be an object"),l.assert(void 0===t.paddingRequired||"boolean"==typeof t.paddingRequired,"paddingRequired must be boolean");var n=!1===t.paddingRequired?t.paddingRequired:t.paddingRequired||!0,i=n?/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/:/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/;return this._test("base64",i,function(e,t,n){return i.test(e)?e:this.createError("string.base64",{value:e},t,n)})},t.prototype.hostname=function e(){var t=/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/;return this._test("hostname",void 0,function(e,n,r){return e.length<=255&&t.test(e)||u.isIPv6(e)?e:this.createError("string.hostname",{value:e},n,r)})},t.prototype.normalize=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"NFC";l.assert(l.contain(g.normalizationForms,t),"normalization form must be one of "+g.normalizationForms.join(", "));var n=this._test("normalize",t,function(e,n,r){return r.convert||e===e.normalize(t)?e:this.createError("string.normalize",{value:e,form:t},n,r)});return n._flags.normalize=t,n},t.prototype.lowercase=function e(){var t=this._test("lowercase",void 0,function(e,t,n){return n.convert||e===e.toLocaleLowerCase()?e:this.createError("string.lowercase",{value:e},t,n)});return t._flags.case="lower",t},t.prototype.uppercase=function e(){var t=this._test("uppercase",void 0,function(e,t,n){return n.convert||e===e.toLocaleUpperCase()?e:this.createError("string.uppercase",{value:e},t,n)});return t._flags.case="upper",t},t.prototype.trim=function e(){var t=this._test("trim",void 0,function(e,t,n){return n.convert||e===e.trim()?e:this.createError("string.trim",{value:e},t,n)});return t._flags.trim=!0,t},t.prototype.replace=function e(t,n){"string"==typeof t&&(t=new RegExp(l.escapeRegex(t),"g")),l.assert(t instanceof RegExp,"pattern must be a RegExp"),l.assert("string"==typeof n,"replacement must be a String");var r=this.clone();return r._inner.replacements||(r._inner.replacements=[]),r._inner.replacements.push({pattern:t,replacement:n}),r},t.prototype.truncate=function e(t){var n=void 0===t||!!t;if(this._flags.truncate===n)return this;var r=this.clone();return r._flags.truncate=n,r},t}(f),g.compare=function(e,n){return function(r,i){var o=h.isRef(r);return l.assert(Number.isSafeInteger(r)&&r>=0||o,"limit must be a positive integer or reference"),l.assert(!i||t.isEncoding(i),"Invalid encoding:",i),this._test(e,r,function(t,s,a){var u=void 0;if(o){if(u=r(s.reference||s.parent,a),!Number.isSafeInteger(u))return this.createError("string.ref",{ref:r.key},s,a)}else u=r;return n(t,u,i)?t:this.createError("string."+e,{limit:u,value:t,encoding:i},s,a)})}},g.String.prototype.min=g.compare("min",function(e,n,r){var i=r?t.byteLength(e,r):e.length;return i>=n}),g.String.prototype.max=g.compare("max",function(e,n,r){var i=r?t.byteLength(e,r):e.length;return i<=n}),g.String.prototype.length=g.compare("length",function(e,n,r){var i=r?t.byteLength(e,r):e.length;return i===n}),g.String.prototype.uuid=g.String.prototype.guid,e.exports=new g.String}).call(t,n(3).Buffer)},function(e,t,n){"use strict";var r=n(14),i={Ip:{cidrs:{ipv4:{required:"\\/(?:"+r.ipv4Cidr+")",optional:"(?:\\/(?:"+r.ipv4Cidr+"))?",forbidden:""},ipv6:{required:"\\/"+r.ipv6Cidr,optional:"(?:\\/"+r.ipv6Cidr+")?",forbidden:""},ipvfuture:{required:"\\/"+r.ipv6Cidr,optional:"(?:\\/"+r.ipv6Cidr+")?",forbidden:""}},versions:{ipv4:r.IPv4address,ipv6:r.IPv6address,ipvfuture:r.IPvFuture}}};i.Ip.createIpRegex=function(e,t){for(var n=void 0,r=0;r0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function c(e){return 3*e.length/4-l(e)}function f(e){var t,n,r,s,a,u=e.length;s=l(e),a=new o(3*u/4-s),n=s>0?u-4:u;var c=0;for(t=0;t>16&255,a[c++]=r>>8&255,a[c++]=255&r;return 2===s?(r=i[e.charCodeAt(t)]<<2|i[e.charCodeAt(t+1)]>>4,a[c++]=255&r):1===s&&(r=i[e.charCodeAt(t)]<<10|i[e.charCodeAt(t+1)]<<4|i[e.charCodeAt(t+2)]>>2,a[c++]=r>>8&255,a[c++]=255&r),a}function h(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[63&e]}function p(e,t,n){for(var r,i=[],o=t;ol?l:u+16383));return 1===i?(t=e[n-1],o+=r[t>>2],o+=r[t<<4&63],o+="=="):2===i&&(t=(e[n-2]<<8)+e[n-1],o+=r[t>>10],o+=r[t>>4&63],o+=r[t<<2&63],o+="="),s.push(o),s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<>1,c=-7,f=n?i-1:0,h=n?-1:1,p=e[t+f];for(f+=h,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=256*o+e[t+f],f+=h,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=256*s+e[t+f],f+=h,c-=8);if(0===o)o=1-l;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=l}return(p?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,u,l=8*o-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,m=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=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+f>=1?h/u:h*Math.pow(2,1-f),t*u>=2&&(s++,u/=2),s+f>=c?(a=0,s=c):s+f>=1?(a=(t*u-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;e[n+p]=255&s,p+=d,s/=256,l-=8);e[n+p-d]|=128*m}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){e.exports={_args:[["joi@13.4.0","/Users/jeff/projects/joi-browser"]],_development:!0,_from:"joi@13.4.0",_id:"joi@13.4.0",_inBundle:!1,_integrity:"sha512-JuK4GjEu6j7zr9FuVe2MAseZ6si/8/HaY0qMAejfDFHp7jcH4OKE937mIHM5VT4xDS0q7lpQbszbxKV9rm0yUg==",_location:"/joi",_phantomChildren:{},_requested:{type:"version",registry:!0,raw:"joi@13.4.0",name:"joi",escapedName:"joi",rawSpec:"13.4.0",saveSpec:null,fetchSpec:"13.4.0"},_requiredBy:["#DEV:/"],_resolved:"https://registry.npmjs.org/joi/-/joi-13.4.0.tgz",_spec:"13.4.0",_where:"/Users/jeff/projects/joi-browser",bugs:{url:"https://github.com/hapijs/joi/issues"},dependencies:{hoek:"5.x.x",isemail:"3.x.x",topo:"3.x.x"},description:"Object schema validation",devDependencies:{code:"5.x.x",hapitoc:"1.x.x",lab:"15.x.x"},engines:{node:">=8.9.0"},homepage:"https://github.com/hapijs/joi",keywords:["hapi","schema","validation"],license:"BSD-3-Clause",main:"lib/index.js",name:"joi",repository:{type:"git",url:"git://github.com/hapijs/joi.git"},scripts:{test:"lab -t 100 -a code -L","test-cov-html":"lab -r html -o coverage.html -a code","test-debug":"lab -a code",toc:"hapitoc",version:"npm run toc && git add API.md README.md"},version:"13.4.0"}},function(e,t,n){(function(e){function n(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(e){return r.exec(e).slice(1)};function o(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!r;i--){var s=i>=0?arguments[i]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,r="/"===s.charAt(0))}return t=n(o(t.split("/"),function(e){return!!e}),!r).join("/"),(r?"/":"")+t||"."},t.normalize=function(e){var r=t.isAbsolute(e),i="/"===s(e,-1);return e=n(o(e.split("/"),function(e){return!!e}),!r).join("/"),e||r||(e="."),e&&i&&(e+="/"),(r?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(o(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,n){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=t.resolve(e).substr(1),n=t.resolve(n).substr(1);for(var i=r(e.split("/")),o=r(n.split("/")),s=Math.min(i.length,o.length),a=s,u=0;u= 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=f-h,E=Math.floor,x=String.fromCharCode,C;function A(e){throw new RangeError(k[e])}function I(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function T(e,t){var n=e.split("@"),r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(w,".");var i=e.split("."),o=I(i,t).join(".");return r+o}function j(e){for(var t=[],n=0,r=e.length,i,o;n=55296&&i<=56319&&n65535&&(e-=65536,t+=x(e>>>10&1023|55296),e=56320|1023&e),t+=x(e),t}).join("")}function P(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:f}function B(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function R(e,t,n){var r=0;for(e=n?E(e/m):e>>1,e+=E(e/t);e>S*p>>1;r+=f)e=E(e/S);return E(r+(S+1)*e/(e+d))}function N(e){var t=[],n=e.length,r,i=0,o=y,s=g,a,u,l,d,m,v,_,w,k;for(a=e.lastIndexOf(b),a<0&&(a=0),u=0;u=128&&A("not-basic"),t.push(e.charCodeAt(u));for(l=a>0?a+1:0;l=n&&A("invalid-input"),_=P(e.charCodeAt(l++)),(_>=f||_>E((c-i)/m))&&A("overflow"),i+=_*m,w=v<=s?h:v>=s+p?p:v-s,!(_E(c/k)&&A("overflow"),m*=k;r=t.length+1,s=R(i-d,r,0==d),E(i/r)>c-o&&A("overflow"),o+=E(i/r),i%=r,t.splice(i++,0,o)}return O(t)}function M(e){var t,n,r,i,o,s,a,u,l,d,m,v=[],_,w,k,S;for(e=j(e),_=e.length,t=y,n=0,o=g,s=0;s<_;++s)m=e[s],m<128&&v.push(x(m));for(r=i=v.length,i&&v.push(b);r<_;){for(a=c,s=0;s<_;++s)m=e[s],m>=t&&mE((c-n)/w)&&A("overflow"),n+=(a-t)*w,t=a,s=0;s<_;++s)if(m=e[s],mc&&A("overflow"),m==t){for(u=n,l=f;d=l<=o?h:l>=o+p?p:l-o,!(u2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(m.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(f.validity.notBefore=m[0],f.validity.notAfter=m[1],f.tbsCertificate=n.tbsCertificate,t){if(f.md=null,f.signatureOid in s){var c=s[f.signatureOid];switch(c){case"sha1WithRSAEncryption":f.md=r.md.sha1.create();break;case"md5WithRSAEncryption":f.md=r.md.md5.create();break;case"sha256WithRSAEncryption":f.md=r.md.sha256.create();break;case"sha384WithRSAEncryption":f.md=r.md.sha384.create();break;case"sha512WithRSAEncryption":f.md=r.md.sha512.create();break;case"RSASSA-PSS":f.md=r.md.sha256.create()}}if(null===f.md){var u=new Error("Could not compute certificate digest. Unknown signature OID.");throw u.signatureOid=f.signatureOid,u}var g=i.toDer(f.tbsCertificate);f.md.update(g.getBytes())}var b=r.md.sha1.create();f.issuer.getField=function(e){return p(f.issuer,e)},f.issuer.addField=function(e){y([e]),f.issuer.attributes.push(e)},f.issuer.attributes=o.RDNAttributesAsArray(n.certIssuer,b),n.certIssuerUniqueId&&(f.issuer.uniqueId=n.certIssuerUniqueId),f.issuer.hash=b.digest().toHex();var v=r.md.sha1.create();return f.subject.getField=function(e){return p(f.subject,e)},f.subject.addField=function(e){y([e]),f.subject.attributes.push(e)},f.subject.attributes=o.RDNAttributesAsArray(n.certSubject,v),n.certSubjectUniqueId&&(f.subject.uniqueId=n.certSubjectUniqueId),f.subject.hash=v.digest().toHex(),n.certExtensions?f.extensions=o.certificateExtensionsFromAsn1(n.certExtensions):f.extensions=[],f.publicKey=o.publicKeyFromAsn1(n.subjectPublicKeyInfo),f},o.certificateExtensionsFromAsn1=function(e){for(var t=[],n=0;n1&&(o=n.value.charCodeAt(1),a=n.value.length>2?n.value.charCodeAt(2):0),t.digitalSignature=128==(128&o),t.nonRepudiation=64==(64&o),t.keyEncipherment=32==(32&o),t.dataEncipherment=16==(16&o),t.keyAgreement=8==(8&o),t.keyCertSign=4==(4&o),t.cRLSign=2==(2&o),t.encipherOnly=1==(1&o),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var n=i.fromDer(t.value);n.value.length>0&&n.value[0].type===i.Type.BOOLEAN?t.cA=0!==n.value[0].value.charCodeAt(0):t.cA=!1;var u=null;n.value.length>0&&n.value[0].type===i.Type.INTEGER?u=n.value[0].value:n.value.length>1&&(u=n.value[1].value),null!==u&&(t.pathLenConstraint=i.derToInteger(u))}else if("extKeyUsage"===t.name)for(var n=i.fromDer(t.value),l=0;l1&&(o=n.value.charCodeAt(1)),t.client=128==(128&o),t.server=64==(64&o),t.email=32==(32&o),t.objsign=16==(16&o),t.reserved=8==(8&o),t.sslCA=4==(4&o),t.emailCA=2==(2&o),t.objCA=1==(1&o)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){var f;t.altNames=[];for(var n=i.fromDer(t.value),h=0;h0&&t.value.push(o.certificateExtensionsToAsn1(e.extensions)),t},o.getCertificationRequestInfo=function(e){var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),m(e.subject),o.publicKeyToAsn1(e.publicKey),_(e)]);return t},o.distinguishedNameToAsn1=function(e){return m(e)},o.certificateToAsn1=function(e){var t=e.tbsCertificate||o.getTBSCertificate(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),v(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},o.certificateExtensionsToAsn1=function(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,3,!0,[]),n=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(n);for(var r=0;rc.validity.notAfter)&&(u={message:"Certificate is not valid yet or has expired.",error:o.certificateError.certificate_expired,notBefore:c.validity.notBefore,notAfter:c.validity.notAfter,now:s}),null===u){if(f=t[0]||e.getIssuer(c),null===f&&c.isIssuer(c)&&(h=!0,f=c),f){var p=f;r.util.isArray(p)||(p=[p]);for(var d=!1;!d&&p.length>0;){f=p.shift();try{d=f.verify(c)}catch(e){}}d||(u={message:"Certificate signature is invalid.",error:o.certificateError.bad_certificate})}null!==u||f&&!h||e.hasCertificate(c)||(u={message:"Certificate is not trusted.",error:o.certificateError.unknown_ca})}if(null===u&&f&&!c.isIssuer(f)&&(u={message:"Certificate issuer is invalid.",error:o.certificateError.bad_certificate}),null===u)for(var m={keyUsage:!0,basicConstraints:!0},g=0;null===u&&gb.pathLenConstraint&&(u={message:"Certificate basicConstraints pathLenConstraint violated.",error:o.certificateError.bad_certificate})}}var w=null===u||u.error,k=n?n(w,l,i):w;if(!0!==k)throw!0===w&&(u={message:"The application rejected the certificate.",error:o.certificateError.bad_certificate}),(k||0===k)&&("object"!=typeof k||r.util.isArray(k)?"string"==typeof k&&(u.error=k):(k.message&&(u.message=k.message),k.error&&(u.error=k.error))),u;u=null,a=!1,++l}while(t.length>0);return!0}},function(e,t){function n(e,t,n){var r;return function(){if(!t)return e.apply(this,arguments);var i=this,o=arguments,s=n&&!r;return clearTimeout(r),r=setTimeout(function(){if(r=null,!s)return e.apply(i,o)},t),s?e.apply(this,arguments):void 0}}e.exports=n},function(e,t,n){"use strict";var r=n(994);function i(e){return Number.isFinite(e)}function o(e){return"function"==typeof e}function s(e,t){return t?function(n,r){var i=setTimeout(function(){e(new Error("pull-reader: read exceeded timeout"),r)},t);e(n,function(e,t){clearTimeout(i),r(e,t)})}:e}e.exports=function(e){var t=[],n,a,u=!1,l=r(),c,f,h;function p(){for(;t.length;)if(null==t[0].length&&l.has(1))t.shift().cb(null,l.get());else if(l.has(t[0].length)){var e=t.shift();e.cb(null,l.get(e.length))}else if(1==c&&t[0].length&&l.length 0 to the moving average constructor");let n,i=0,o=0,s=0,a,u={};function l(e,n){return 1-r(-(e-n)/t)}return u.push=function e(t,r){if(a){const e=l(t,a),u=r-n,c=e*u;n=e*r+(1-e)*n,i=(1-e)*(i+u*c),o=Math.sqrt(i),s=n+e*u}else n=r;a=t},u.movingAverage=function e(){return n},u.variance=function e(){return i},u.deviation=function e(){return o},u.forecast=function e(){return s},u}},function(e,t,n){var r=n(494),i=n(248);function o(e,t){t=r(t,e);for(var n=0,o=t.length;null!=e&&nr(e.bytes,t),r=>this.publisher.publishWithEOL(e,t,n,r)],(e,r)=>{if(e)return u.error(e),o(e);u(`IPNS value ${t} was published correctly`);const i=r[0].toB58String(),s=parseFloat(n),a=s{if(t)return u.error(t),n(t);u(`IPNS record from ${e} was resolved correctly`),n(null,{path:r})})}initializeKeyspace(e,t,n){this.publisher.publish(e,t,n)}}t=e.exports=d,t.path=h},function(e,t,n){"use strict";const r=n(64),i=n(5),o=i("jsipfs:ipns:path");o.error=i("jsipfs:ipns:path:error");const s=(e,t,n)=>{if(r.ipnsPath(t))return o(`resolve ipns path ${t}`),e._ipns.resolve(t,n);e.dag.get(t.substring("/ipfs/".length),(e,t)=>e?n(e):n(null,t))};e.exports={resolvePath:s}},function(e,t,n){"use strict";(function(r){const i=n(181),{fromB58String:o,toB58String:s}=n(42),a=n(1034),u=n(60),l=n(22),c=n(5),f=c("jsipfs:ipns:pubsub");f.error=c("jsipfs:ipns:pubsub:error");class h{constructor(e,t,n){this._pubsub=e,this._subscriptions={},this._handleSubscriptionKey=this._handleSubscriptionKey.bind(this),this._pubsubDs=new a(e,t,n,i.validator,this._handleSubscriptionKey)}put(e,t,n){this._pubsubDs.put(e,t,n)}get(e,t){this._pubsubDs.get(e,(n,r)=>{const o=e.slice(0,i.namespaceLength);if(o.toString()===i.namespace){const t=e.toString(),n=s(e.slice(i.namespaceLength));this._subscriptions[t]=n,f(`subscribed pubsub ${t}: ${n}`)}if(n)return t(n);t(null,r)})}_handleSubscriptionKey(e,t){const n=this._subscriptions[e];if(!n){const n=`key ${e} does not correspond to a subscription`;return f.error(n),t(l(new Error(n),"ERR_INVALID_KEY"))}let r;try{r=i.getIdKeys(o(n))}catch(e){return f.error(e),t(e)}t(null,r.routingKey.toBuffer())}getSubscriptions(e){const t=Object.values(this._subscriptions).filter(Boolean);return e(null,t.map(e=>`${i.namespace}${e}`))}cancel(e,t){if("string"!=typeof e){const e="received subscription name is not valid";return f.error(e),t(l(new Error(e),"ERR_INVALID_SUBSCRIPTION_NAME"))}e.startsWith(i.namespace)&&(e=e.substring(i.namespaceLength));const n=Object.keys(this._subscriptions).find(t=>this._subscriptions[t]===e);if(!n)return t(null,{canceled:!1});try{const e=r.from(n);this._pubsubDs.unsubscribe(e)}catch(e){return t(e)}this._subscriptions[n]=void 0,f(`unsubscribed pubsub ${n}: ${e}`),t(null,{canceled:!0})}}t=e.exports=u(h,{className:"IpnsPubsubDatastore",symbolName:"@js-ipfs/ipns/IpnsPubsubDatastore"})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const{Key:i}=n(33),{Record:o}=n(1036),{encodeBase32:s}=n(502),a=n(22),u=n(5),l=u("jsipfs:ipns:offline-datastore");l.error=u("jsipfs:ipns:offline-datastore:error");class c{constructor(e){this._repo=e}put(e,t,n){if(!r.isBuffer(e)){const e="Offline datastore key must be a buffer";return l.error(e),n(a(new Error(e),"ERR_INVALID_KEY"))}if(!r.isBuffer(t)){const e="Offline datastore value must be a buffer";return l.error(e),n(a(new Error(e),"ERR_INVALID_VALUE"))}let i;try{i=this._routingKey(e)}catch(e){const t="Not possible to generate the routing key";return l.error(t),n(a(new Error(t),"ERR_GENERATING_ROUTING_KEY"))}const s=new o(e,t);this._repo.datastore.put(i,s.serialize(),n)}get(e,t){if(!r.isBuffer(e)){const e="Offline datastore key must be a buffer";return l.error(e),t(a(new Error(e),"ERR_INVALID_KEY"))}let n;try{n=this._routingKey(e)}catch(e){const n="Not possible to generate the routing key";return l.error(n),t(a(new Error(n),"ERR_GENERATING_ROUTING_KEY"))}this._repo.datastore.get(n,(e,n)=>{if(e)return t(e);let r;try{r=o.deserialize(n)}catch(e){return l.error(e),t(e)}t(null,r.value)})}_routingKey(e){return new i("/"+s(e),!1)}}t=e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){var r=n(1041);e.exports=function(e,t,n){for(var i=-1,o=[],s=n?t.length:0;(i=r(e,t))>-1;)o.push(e.slice(0,i+s)),e=e.slice(i+t.length,e.length);return o.push(e),o}},function(e,t,n){"use strict";const r=n(105),i=n(181);e.exports={encodeBase32:e=>{const t=r.encode("base32",e).slice(1);return t.toString().toUpperCase()},validator:{func:(e,t,n)=>i.validator.validate(t,e,n)},selector:(e,t)=>i.validator.select(t[0],t[1])}},function(e,t,n){"use strict";const r=n(243),i=n(180),o=n(502);function s({datastore:e,peerInfo:t,peerBook:s,options:a,config:u}){const l={datastore:e,peerInfo:t,peerBook:s,config:{peerDiscovery:{mdns:{enabled:r(a,"config.Discovery.MDNS.Enabled",r(u,"Discovery.MDNS.Enabled",!0))},webRTCStar:{enabled:r(a,"config.Discovery.webRTCStar.Enabled",r(u,"Discovery.webRTCStar.Enabled",!0))},bootstrap:{list:r(a,"config.Bootstrap",r(u,"Bootstrap",[]))}},relay:{enabled:r(a,"relay.enabled",r(u,"relay.enabled",!1)),hop:{enabled:r(a,"relay.hop.enabled",r(u,"relay.hop.enabled",!1)),active:r(a,"relay.hop.active",r(u,"relay.hop.active",!1))}},dht:{validators:{ipns:o.validator},selectors:{ipns:o.selector}},EXPERIMENTAL:{dht:r(a,"EXPERIMENTAL.dht",!1),pubsub:r(a,"EXPERIMENTAL.pubsub",!1)}},connectionManager:r(a,"connectionManager",r(u,"connectionManager",{}))},c=i(r(a,"libp2p",{}),l),f=n(1047);return new f(c)}e.exports=function e(t,n){const r=t._options||{};n=n||{};const i="function"==typeof r.libp2p?r.libp2p:s,{datastore:o}=t._repo,a=t._peerInfo,u=t._peerInfoBook,e=i({options:r,config:n,datastore:o,peerInfo:a,peerBook:u});let l=[];const c=t=>{u.put(t),e.dial(t,()=>{})};return e.on("start",()=>{a.multiaddrs.forEach(e=>{t._print("Swarm listening on",e.toString())}),l.forEach(c),l=[]}),e.on("peer:discovery",e=>{t.isOnline()?c(e):l.push(e)}),e.on("peer:connect",e=>u.put(e)),e}},function(e,t,n){"use strict";const r=n(1048),i=n(90),o=n(60),s=n(65).Connection,a=n(505),u=n(5),l=u("libp2p:websockets:dialer"),c=n(1057);class f{dial(e,t,n){"function"==typeof t&&(n=t,t={}),n=n||function(){};const i=a(e);l("dialing %s",i);const o=r(i,{binary:!0,onConnect:e=>{n(e)}}),u=new s(o);return u.getObservedAddrs=(t=>t(null,[e])),u.close=(e=>o.close(e)),u}createListener(e,t){return"function"==typeof e&&(t=e,e={}),c(e,t)}filter(e){return Array.isArray(e)||(e=[e]),e.filter(e=>!e.protoNames().includes("p2p-circuit")&&(e.protoNames().includes("ipfs")&&(e=e.decapsulate("ipfs")),i.WebSockets.matches(e)||i.WebSocketsSecure.matches(e)))}}e.exports=o(f,{className:"WebSockets",symbolName:"@libp2p/js-libp2p-websockets/websockets"})},function(e,t,n){const r=n(24),i=(e,t)=>t,o={ip4:i,ip6:(e,t,n,r)=>1===r.length&&"ip6"===r[0].protocol?t:`[${t}]`,tcp:(e,t,n,r)=>r.some(e=>["http","https","ws","wss"].includes(e.protocol))?`${e}:${t}`:`tcp://${e}:${t}`,udp:(e,t)=>`udp://${e}:${t}`,dnsaddr:i,dns4:i,dns6:i,ipfs:(e,t)=>`${e}/ipfs/${t}`,p2p:(e,t)=>`${e}/p2p/${t}`,http:e=>`http://${e}`,https:e=>`https://${e}`,ws:e=>`ws://${e}`,wss:e=>`wss://${e}`,"p2p-websocket-star":e=>`${e}/p2p-websocket-star`,"p2p-webrtc-star":e=>`${e}/p2p-webrtc-star`,"p2p-webrtc-direct":e=>`${e}/p2p-webrtc-direct`};e.exports=(e=>r(e).stringTuples().map(e=>({protocol:r.protocols.codes[e[0]].name,content:e[1]})).reduce((e,t,n,r)=>{const i=o[t.protocol];if(!i)throw new Error(`Unsupported protocol ${t.protocol}`);return i(e,t.content,n,r)},""))},function(e,t,n){var r=n(1059),i=n(325),o=n(510),s=n(249)("socket.io-client");e.exports=t=u;var a=t.managers={};function u(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var n=r(e),i=n.source,u=n.id,l=n.path,c=a[u]&&l in a[u].nsps,f=t.forceNew||t["force new connection"]||!1===t.multiplex||c,h;return f?(s("ignoring socket cache for %s",i),h=o(i,t)):(a[u]||(s("new io instance for %s",i),a[u]=o(i,t)),h=a[u]),n.query&&!t.query&&(t.query=n.query),h.socket(n.path,t)}t.protocol=i.protocol,t.connect=u,t.Manager=n(510),t.Socket=n(515)},function(e,t){var n=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,r=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function e(t){var i=t,o=t.indexOf("["),s=t.indexOf("]");-1!=o&&-1!=s&&(t=t.substring(0,o)+t.substring(o,s).replace(/:/g,";")+t.substring(s,t.length));for(var a=n.exec(t||""),u={},l=14;l--;)u[r[l]]=a[l]||"";return-1!=o&&-1!=s&&(u.source=i,u.host=u.host.substring(1,u.host.length-1).replace(/;/g,":"),u.authority=u.authority.replace("[","").replace("]","").replace(/;/g,":"),u.ipv6uri=!0),u}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){(function(t){e.exports=o;var n="function"==typeof t&&"function"==typeof t.isBuffer,r="function"==typeof ArrayBuffer,i=function(e){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer};function o(e){return n&&t.isBuffer(e)||r&&(e instanceof ArrayBuffer||i(e))}}).call(this,n(0).Buffer)},function(e,t,n){var r=n(1066),i=n(515),o=n(146),s=n(325),a=n(516),u=n(517),l=n(249)("socket.io-client:manager"),c=n(313),f=n(1083),h=Object.prototype.hasOwnProperty;function p(e,t){if(!(this instanceof p))return new p(e,t);e&&"object"==typeof e&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new f({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=t.parser||s;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}e.exports=p,p.prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)h.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},p.prototype.updateSocketIds=function(){for(var e in this.nsps)h.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},p.prototype.generateId=function(e){return("/"===e?"":e+"#")+this.engine.id},o(p.prototype),p.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},p.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},p.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},p.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},p.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},p.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},p.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},p.prototype.open=p.prototype.connect=function(e,t){if(l("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;l("opening %s",this.uri),this.engine=r(this.uri,this.opts);var n=this.engine,i=this;this.readyState="opening",this.skipReconnect=!1;var o=a(n,"open",function(){i.onopen(),e&&e()}),s=a(n,"error",function(t){if(l("connect_error"),i.cleanup(),i.readyState="closed",i.emitAll("connect_error",t),e){var n=new Error("Connection error");n.data=t,e(n)}else i.maybeReconnectOnOpen()});if(!1!==this._timeout){var u=this._timeout;l("connect attempt will timeout after %d",u);var c=setTimeout(function(){l("connect attempt timed out after %d",u),o.destroy(),n.close(),n.emit("error","timeout"),i.emitAll("connect_timeout",u)},u);this.subs.push({destroy:function(){clearTimeout(c)}})}return this.subs.push(o),this.subs.push(s),this},p.prototype.onopen=function(){l("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(a(e,"data",u(this,"ondata"))),this.subs.push(a(e,"ping",u(this,"onping"))),this.subs.push(a(e,"pong",u(this,"onpong"))),this.subs.push(a(e,"error",u(this,"onerror"))),this.subs.push(a(e,"close",u(this,"onclose"))),this.subs.push(a(this.decoder,"decoded",u(this,"ondecoded")))},p.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},p.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},p.prototype.ondata=function(e){this.decoder.add(e)},p.prototype.ondecoded=function(e){this.emit("packet",e)},p.prototype.onerror=function(e){l("error",e),this.emitAll("error",e)},p.prototype.socket=function(e,t){var n=this.nsps[e];if(!n){n=new i(this,e,t),this.nsps[e]=n;var r=this;n.on("connecting",o),n.on("connect",function(){n.id=r.generateId(e)}),this.autoConnect&&o()}function o(){~c(r.connecting,n)||r.connecting.push(n)}return n},p.prototype.destroy=function(e){var t=c(this.connecting,e);~t&&this.connecting.splice(t,1),this.connecting.length||this.close()},p.prototype.packet=function(e){l("writing packet %j",e);var t=this;e.query&&0===e.type&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,function(n){for(var r=0;r0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},p.prototype.cleanup=function(){l("cleanup");for(var e=this.subs.length,t=0;t=this._reconnectionAttempts)l("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();l("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var n=setTimeout(function(){e.skipReconnect||(l("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open(function(t){t?(l("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):(l("reconnect success"),e.onreconnect())}))},t);this.subs.push({destroy:function(){clearTimeout(n)}})}},p.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)}},function(e,t,n){var r=n(326),i=n(1069),o=n(1079),s=n(1080);function a(e){var t,n=!1,s=!1,a=!1!==e.jsonp;if("undefined"!=typeof location){var u="https:"===location.protocol,l=location.port;l||(l=u?443:80),n=e.hostname!==location.hostname||l!==e.port,s=e.secure!==u}if(e.xdomain=n,e.xscheme=s,t=new r(e),"open"in t&&!e.forceJSONP)return new i(e);if(!a)throw new Error("JSONP disabled");return new o(e)}t.polling=a,t.websocket=s},function(e,t,n){var r=n(327),i=n(250),o=n(147),s=n(251),a=n(514),u=n(252)("engine.io-client:polling");e.exports=h;var l=(c=n(326),f=new c({xdomain:!1}),null!=f.responseType),c,f;function h(e){var t=e&&e.forceBase64;l&&!t||(this.supportsBinary=!1),r.call(this,e)}s(h,r),h.prototype.name="polling",h.prototype.doOpen=function(){this.poll()},h.prototype.pause=function(e){var t=this;function n(){u("paused"),t.readyState="paused",e()}if(this.readyState="pausing",this.polling||!this.writable){var r=0;this.polling&&(u("we are currently polling - waiting to pause"),r++,this.once("pollComplete",function(){u("pre-pause polling complete"),--r||n()})),this.writable||(u("we are currently writing - waiting to pause"),r++,this.once("drain",function(){u("pre-pause writing complete"),--r||n()}))}else n()},h.prototype.poll=function(){u("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},h.prototype.onData=function(e){var t=this;u("polling got data %s",e);var n=function(e,n,r){if("opening"===t.readyState&&t.onOpen(),"close"===e.type)return t.onClose(),!1;t.onPacket(e)};o.decodePayload(e,this.socket.binaryType,n),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():u('ignoring poll - transport state "%s"',this.readyState))},h.prototype.doClose=function(){var e=this;function t(){u("writing close packet"),e.write([{type:"close"}])}"open"===this.readyState?(u("transport open - closing"),t()):(u("transport not open - deferring close"),this.once("open",t))},h.prototype.write=function(e){var t=this;this.writable=!1;var n=function(){t.writable=!0,t.emit("drain")};o.encodePayload(e,this.supportsBinary,function(e){t.doWrite(e,n)})},h.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",n="";!1!==this.timestampRequests&&(e[this.timestampParam]=a()),this.supportsBinary||e.sid||(e.b64=1),e=i.encode(e),this.port&&("https"===t&&443!==Number(this.port)||"http"===t&&80!==Number(this.port))&&(n=":"+this.port),e.length&&(e="?"+e);var r=-1!==this.hostname.indexOf(":");return t+"://"+(r?"["+this.hostname+"]":this.hostname)+n+this.path+e}},function(e,t,n){(function(t){var r=n(1071),i=Object.prototype.toString,o="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===i.call(Blob),s="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===i.call(File);function a(e){if(!e||"object"!=typeof e)return!1;if(r(e)){for(var n=0,i=e.length;n0);return t}function c(e){var t=0;for(a=0;a0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.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,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),_()}function v(){g("onfinish"),e.removeListener("close",b),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(49)},f=n(519),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(520),y;function b(){}function v(e,t){u=u||n(149),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||n(149),!(y.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(149),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length"string"==typeof e,object:e=>"object"==typeof e,multiaddr:e=>{if(l.string(e))try{return i(e),!0}catch(e){return!1}},function:e=>"function"==typeof e};function c(e,t){if(!Array.isArray(t))throw new Error("Data is not an array");e.forEach((e,n)=>{if(!l[e])throw console.error("Type %s does not exist",e),new Error("Type "+e+" does not exist");if(!l[e](t[n]))throw new Error("Data at index "+n+" is invalid for type "+e)})}function f(e){e||(e=(()=>{}));const t=this;t.requests={},t.addRequest=((e,n,r)=>{t.requests[e]={def:n,handle:r}}),t.handleSocket=(n=>{n.r={},Object.keys(t.requests).forEach(r=>{const i=t.requests[r];n.on(r,function(){const t=[...arguments];try{c(i.def,t),t.unshift(n),i.handle.apply(null,t)}catch(i){e(i),e("peer %s has sent invalid data for request %s",n.id||"",r,t)}})})})}function h(e,t,n){o.createFromPubKey(r.from(e,"hex"),(i,o)=>i?n(new Error("Crypto error")):o.toB58String()!==t?n(new Error("Id is not matching")):n(null,s.keys.unmarshalPublicKey(r.from(e,"hex"))))}t=e.exports,t.cleanUrlSIO=u,t.validate=c,t.Protocol=f,t.getIdAndValidate=h,t.validateMa=(e=>a.WebSocketStar.matches(i(e)))}).call(this,n(0).Buffer)},function(e,t,n){var r=n(1098),i=n(138),o=i;o.v1=r,o.v4=i,e.exports=o},function(e,t,n){"use strict";e.exports="/mplex/6.7.0"},function(e,t,n){"use strict";t=e.exports,t.multicodec="/ipfs/id/1.0.0",t.listener=n(1125),t.dialer=n(1126),t.message=n(331)},function(e,t,n){"use strict";(function(t){const r=n(122),i=n(72),o=n(258),s=o.writeEncoded;function a(e,n,o){const a=r({timeout:6e4},n),u=a.handshake;return o("writing multicodec: "+e),s(u,t.from(e+"\n"),n),i.decodeFromReader(u,(t,r)=>{if(t)return n(t);const i=r.toString().slice(0,-1);if(i!==e)return n(new Error(`"${e}" not supported`),u.rest());o("received ack: "+i),n(null,u.rest())}),a}e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(240),i=l(r),o=n(171),s=l(o),a=n(239),u=l(a);function l(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)((0,i.default)(Boolean,u.default)),e.exports=t.default},function(e,t,n){"use strict";function r(e,t,n){const r=e===t;n(null,r)}e.exports=r},function(e,t,n){"use strict";t=e.exports,t.PROTOCOL_ID="/multistream/1.0.0"},function(e,t,n){"use strict";const r=n(182),i=n(533),o=n(257),s=n(60),a=n(534),u=n(334),{CONNECTION_FAILED:l,DIAL_SELF:c,INVALID_STATE_TRANSITION:f,NO_TRANSPORTS_REGISTERED:h,maybeUnexpectedEnd:p}=n(535);class d extends a{constructor({_switch:e,peerInfo:t,muxer:n,conn:i,type:o="out"}){super({_switch:e,name:`${o}:${e._peerInfo.id.toB58String().slice(0,8)}`}),this.theirPeerInfo=t,this.theirB58Id=this.theirPeerInfo.id.toB58String(),this.conn=i,this.muxer=n;let s="DISCONNECTED";this.muxer&&(s="MUXED"),this._state=r(s,{DISCONNECTED:{dial:"DIALING",disconnect:"DISCONNECTED",done:"DISCONNECTED"},DIALING:{abort:"ABORTED",done:"DIALED",error:"ERRORED",disconnect:"DISCONNECTING"},DIALED:{encrypt:"ENCRYPTING",privatize:"PRIVATIZING"},PRIVATIZING:{done:"PRIVATIZED",abort:"ABORTED",disconnect:"DISCONNECTING"},PRIVATIZED:{encrypt:"ENCRYPTING"},ENCRYPTING:{done:"ENCRYPTED",error:"ERRORED",disconnect:"DISCONNECTING"},ENCRYPTED:{upgrade:"UPGRADING",disconnect:"DISCONNECTING"},UPGRADING:{stop:"CONNECTED",done:"MUXED",error:"ERRORED"},MUXED:{disconnect:"DISCONNECTING"},CONNECTED:{disconnect:"DISCONNECTING"},DISCONNECTING:{done:"DISCONNECTED",disconnect:"DISCONNECTING"},ABORTED:{},ERRORED:{disconnect:"DISCONNECTING"}}),this._state.on("DISCONNECTED",()=>this._onDisconnected()),this._state.on("DIALING",()=>this._onDialing()),this._state.on("DIALED",()=>this._onDialed()),this._state.on("PRIVATIZING",()=>this._onPrivatizing()),this._state.on("PRIVATIZED",()=>this._onPrivatized()),this._state.on("ENCRYPTING",()=>this._onEncrypting()),this._state.on("ENCRYPTED",()=>{this.log("successfully encrypted connection to %s",this.theirB58Id),this.emit("encrypted",this.conn)}),this._state.on("UPGRADING",()=>this._onUpgrading()),this._state.on("MUXED",()=>{this.log("successfully muxed connection to %s",this.theirB58Id),delete this.switch.conns[this.theirB58Id],this.emit("muxed",this.muxer)}),this._state.on("CONNECTED",()=>{this.log("unmuxed connection opened to %s",this.theirB58Id),this.emit("unmuxed",this.conn)}),this._state.on("DISCONNECTING",()=>this._onDisconnecting()),this._state.on("ABORTED",()=>this._onAborted()),this._state.on("ERRORED",()=>this._onErrored()),this._state.on("error",e=>this._onStateError(e))}dial(){return this.theirB58Id===this.ourPeerInfo.id.toB58String()?this.emit("error",c()):"DIALING"===this.getState()?this.log("attempted to dial while already dialing, ignoring"):void this._state("dial")}shake(e,t){return e?this.muxer&&this.muxer.newStream?this.muxer.newStream((n,r)=>{if(n)return t(n,null);this.log("created new stream to %s",this.theirB58Id),this._protocolHandshake(e,r,t)}):void this._protocolHandshake(e,this.conn,t):t(null,null)}upgrade(){this._state("upgrade")}_onDialing(){if(this.log("dialing %s",this.theirB58Id),!this.switch.hasTransports())return this.close(h());const e=this.switch.availableTransports(this.theirPeerInfo),t=Boolean(this.switch.transports[i.tag]);t&&!e.includes(i.tag)&&e.push(i.tag);const n=r=>{let o=r;if(!o)return t?this.close(l(`No available transports to dial peer ${this.theirB58Id}!`)):this.close(l(`Circuit not enabled and all transports failed to dial peer ${this.theirB58Id}!`));o===i.tag&&this.theirPeerInfo.multiaddrs.add(`/p2p-circuit/p2p/${this.theirB58Id}`),this.log("dialing transport %s",o),this.switch.transport.dial(o,this.theirPeerInfo,(t,r)=>{if(t)return this.emit("error:connection_attempt_failed",t),this.log(t),n(e.shift());this.conn=u(o,null,r,this.switch.observer),this._state("done")})};n(e.shift())}_onDialed(){this.log("successfully dialed %s",this.theirB58Id),this.emit("connected",this.conn)}_onDisconnecting(){this.log("disconnecting from %s",this.theirB58Id),this.theirPeerInfo&&this.theirPeerInfo.disconnect(),this.switch.connection.remove(this),delete this.switch.conns[this.theirB58Id],this.muxer&&(this.muxer.end(),delete this.muxer,this.switch.emit("peer-mux-closed",this.theirPeerInfo)),this.conn?this.conn.source(!0,()=>{this._state("done"),delete this.conn}):this._state("done")}_onEncrypting(){const e=new o.Dialer;e.handle(this.conn,t=>{if(t)return this.close(p(t));this.log("selecting crypto %s to %s",this.switch.crypto.tag,this.theirB58Id),e.select(this.switch.crypto.tag,(e,t)=>{if(e)return this.close(p(e));const n=u(null,this.switch.crypto.tag,t,this.switch.observer);this.conn=this.switch.crypto.encrypt(this.ourPeerInfo.id,n,this.theirPeerInfo.id,e=>{if(e)return this.close(e);this.conn.setPeerInfo(this.theirPeerInfo),this._state("done")})})})}_onUpgrading(){const e=Object.keys(this.switch.muxers);if(this.log("upgrading connection to %s",this.theirB58Id),0===e.length)return this._state("stop");const t=new o.Dialer;t.handle(this.conn,n=>{if(n)return this._didUpgrade(n);const r=n=>{this.log("selecting %s",n),t.select(n,(t,i)=>{if(t)return 0===e.length?this._didUpgrade(t):r(e.shift());const o=u(null,n,i,this.switch.observer);this.muxer=this.switch.muxers[n].dialer(o),this.switch.connection.add(this),this.muxer.once("close",()=>{this.close()}),this.muxer.on("stream",e=>{this.log("new stream created via muxer to %s",this.theirB58Id),e.setPeerInfo(this.theirPeerInfo),this.switch.protocolMuxer(null)(e)}),this.switch.emit("peer-mux-established",this.theirPeerInfo),this._didUpgrade(null)})};r(e.shift())})}_didUpgrade(e){if(e)return this.log("Error upgrading connection:",e),this.switch.conns[this.theirB58Id]=this,this.emit("error:upgrade_failed",e),this._state("stop");this._state("done")}_protocolHandshake(e,t,n){const r=new o.Dialer;r.handle(t,t=>{if(t)return n(t,null);r.select(e,(t,r)=>{if(t)return this.log("could not perform protocol handshake:",t),n(t,null);const i=u(null,e,r,this.switch.observer);this.log("successfully performed handshake of %s to %s",e,this.theirB58Id),this.emit("connection",i),n(null,i)})})}_onStateError(e){this.emit("error",f(e)),this.log(e)}}e.exports=s(d,{className:"ConnectionFSM",symbolName:"libp2p-switch/ConnectionFSM"})},function(e,t,n){"use strict";e.exports=n(1133)},function(e,t,n){"use strict";const r=n(6).EventEmitter,i=n(5),o=n(60);class s extends r{constructor({_switch:e,name:t}){super(),this.switch=e,this.ourPeerInfo=this.switch._peerInfo,this.log=i(`libp2p:conn:${t}`),this.log.error=i(`libp2p:conn:${t}:error`)}close(e){"DISCONNECTING"!==this._state._state&&(this.log("closing connection to %s",this.theirB58Id),e&&this._events.error&&this.emit("error",e),this._state("disconnect"))}emit(e,...t){"error"!==e||this._events.error?super.emit(e,...t):this.log.error(...t)}getState(){return this._state._state}encrypt(){this._state("encrypt")}protect(){this._state("privatize")}upgrade(){this._state("upgrade")}_onDisconnected(){this.log("disconnected from %s",this.theirB58Id),this.emit("close"),this.removeAllListeners()}_onPrivatized(){this.log("successfully privatized incoming connection"),this.emit("private",this.conn)}_onPrivatizing(){if(!this.switch.protector)return this._state("done");this.conn=this.switch.protector.protect(this.conn,e=>{if(e)return this.close(e);this.log("successfully privatized conn to %s",this.theirB58Id),this.conn.setPeerInfo(this.theirPeerInfo),this._state("done")})}}e.exports=o(s,{className:"BaseConnection",symbolName:"libp2p-switch/BaseConnection"})},function(e,t,n){"use strict";const r=n(22);e.exports.PROTECTOR_REQUIRED="No protector provided with private network enforced",e.exports.CONNECTION_FAILED=(e=>r(e,"CONNECTION_FAILED")),e.exports.DIAL_SELF=(()=>r(new Error("A node cannot dial itself"),"DIAL_SELF")),e.exports.NO_TRANSPORTS_REGISTERED=(()=>r(new Error("No transports registered, dial not possible"),"NO_TRANSPORTS_REGISTERED")),e.exports.UNEXPECTED_END=(()=>r(new Error("Unexpected end of input from reader."),"UNEXPECTED_END")),e.exports.INVALID_STATE_TRANSITION=(e=>r(e,"INVALID_STATE_TRANSITION")),e.exports.maybeUnexpectedEnd=(t=>!0===t?e.exports.UNEXPECTED_END():t)},function(e,t,n){"use strict";const r=n(16);e.exports={tag:"/plaintext/1.0.0",encrypt:(e,t,n,i)=>("function"==typeof n&&(i=n,n=void 0),r(()=>i()),t)}},function(e,t,n){"use strict";const r=n(23),i=n(44),o=n(24);function s(e,t){let n;if(i.isPeerInfo(e))return e;if(o.isMultiaddr(e)){const o=e.getPeerId();try{n=t.get(o)}catch(e){n=new i(r.createFromB58String(o))}return n.multiaddrs.add(e),n}if(r.isPeerId(e)){const n=e.toB58String();try{return t.get(n)}catch(e){throw new Error("Couldnt get PeerInfo")}}throw new Error("peer type not recognized")}e.exports=s},function(e,t,n){(function(r){function i(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function u(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function l(){try{return window.localStorage}catch(e){}}t=e.exports=n(1158),t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:l(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(u())}).call(this,n(2))},function(e,t,n){"use strict";const r=n(1168);function i(e){if(!(this instanceof i))return new i(e);e=e||{};const t=e.validity||30,n=new Map,s=r(()=>{n.forEach((e,r)=>{const i=e.validity||t,s=o(e.timestamp);s>i&&n.delete(r)})},200);this.put=((e,t,r)=>{this.has(e)||n.set(e,{value:t,timestamp:new Date,validity:r}),s()}),this.get=(e=>{if(n.has(e))return n.get(e).value;throw new Error("key does not exist")}),this.has=(e=>n.has(e))}function o(e){const t=new Date,n=t.getTime()-e.getTime();return Math.floor(n/1e3)}t=e.exports=i},function(e,t,n){"use strict";const r=n(6),i=n(12),o=n(106),s=n(61),a=n(539),u=n(5),l=n(22),c=n(1169),f=n(541),h=n(89);class p extends r{constructor(e,t,n){super(),this.log=u(e),this.log.err=u(`${e}:error`),this.multicodec=t,this.libp2p=n,this.started=!1,this.topics=new Map,this.seenCache=new a,this.peers=new Map,this._dials=new Set,this._onConnection=this._onConnection.bind(this),this._dialPeer=this._dialPeer.bind(this)}_addPeer(e){const t=e.info.id.toB58String();let n=this.peers.get(t);return n||(this.log("new peer",t),this.peers.set(t,e),n=e,e.once("close",()=>this._removePeer(e))),++n._references,n}_removePeer(e){const t=e.info.id.toB58String();return this.log("remove",t,e._references),0==--e._references&&(this.log("delete peer",t),this.peers.delete(t)),e}_dialPeer(e,t){t=t||function e(){};const n=e.id.toB58String(),r=this.peers.get(n);return r&&r.isConnected?h(()=>t()):this._dials.has(n)?(this.log("already dialing %s, ignoring dial attempt",n),h(()=>t())):(this._dials.add(n),this.log("dialing %s",n),void this.libp2p.dialProtocol(e,this.multicodec,(r,i)=>{this.log("dial to %s complete",n);const o=!this._dials.has(n);return this._dials.delete(n),r?(this.log.err(r),t()):o?(this.log("pubsub was stopped, not processing dial to %s",n),t()):void this._onDial(e,i,t)}))}_onDial(e,t,n){const r=e.id.toB58String();this.log("connected",r);const i=this._addPeer(new c(e));i.attachConnection(t),h(()=>n())}_onConnection(e,t){t.getPeerInfo((e,n)=>{if(e)return this.log.err("Failed to identify incomming conn",e),i(o(),t);const r=n.id.toB58String(),s=this._addPeer(new c(n));this._processConnection(r,t,s)})}_processConnection(e,t,n){throw l("_processConnection must be implemented by the subclass","ERR_NOT_IMPLEMENTED")}_onConnectionEnd(e,t,n){n&&"socket hang up"!==n.message&&this.log.err(n),this.log("connection ended",e,n?n.message:""),this._removePeer(t)}publish(e,t){throw l("publish must be implemented by the subclass","ERR_NOT_IMPLEMENTED")}subscribe(e){throw l("subscribe must be implemented by the subclass","ERR_NOT_IMPLEMENTED")}unsubscribe(e){throw l("unsubscribe must be implemented by the subclass","ERR_NOT_IMPLEMENTED")}start(e){if(this.started)return h(()=>e(new Error("already started")));this.log("starting"),this.libp2p.handle(this.multicodec,this._onConnection),this.libp2p.on("peer:connect",this._dialPeer);const t=Object.values(this.libp2p.peerBook.getAll());s(t,(e,t)=>this._dialPeer(e,t),t=>{h(()=>{this.log("started"),this.started=!0,e(t)})})}stop(e){if(!this.started)return h(()=>e(new Error("not started yet")));this.libp2p.unhandle(this.multicodec),this.libp2p.removeListener("peer:connect",this._dialPeer),this._dials=new Set,this.log("stopping"),s(this.peers.values(),(e,t)=>e.close(t),t=>{if(t)return e(t);this.log("stopped"),this.peers=new Map,this.started=!1,e()})}}e.exports=p,e.exports.message=f},function(e,t,n){"use strict";const r=n(70),i=r(n(1170)),o=r(n(1171));t=e.exports,t.rpc=i,t.td=o},function(e){e.exports={name:"ipfs",version:"0.34.4",description:"JavaScript implementation of the IPFS specification",leadMaintainer:"Alan Shaw ",bin:{jsipfs:"src/cli/bin.js"},main:"src/core/index.js",browser:{"./src/core/components/init-assets.js":!1,"./src/core/runtime/add-from-fs-nodejs.js":"./src/core/runtime/add-from-fs-browser.js","./src/core/runtime/config-nodejs.js":"./src/core/runtime/config-browser.js","./src/core/runtime/dns-nodejs.js":"./src/core/runtime/dns-browser.js","./src/core/runtime/fetch-nodejs.js":"./src/core/runtime/fetch-browser.js","./src/core/runtime/libp2p-nodejs.js":"./src/core/runtime/libp2p-browser.js","./src/core/runtime/preload-nodejs.js":"./src/core/runtime/preload-browser.js","./src/core/runtime/repo-nodejs.js":"./src/core/runtime/repo-browser.js","./test/utils/create-repo-nodejs.js":"./test/utils/create-repo-browser.js",stream:"readable-stream",joi:"joi-browser"},engines:{node:">=10.0.0",npm:">=6.0.0"},scripts:{lint:"aegir lint",build:"aegir build",test:"aegir test -t node -t browser -t webworker --no-cors --timeout=10000","test:node":"aegir test -t node --timeout=10000","test:browser":"aegir test -t browser --no-cors --timeout=10000","test:webworker":"aegir test -t webworker --no-cors --timeout=10000","test:node:core":"aegir test -t node -f test/core/**/*.js --timeout=10000","test:node:http":"aegir test -t node -f test/http-api/index.js --timeout=10000","test:node:gateway":"aegir test -t node -f test/gateway/index.js --timeout=10000","test:node:cli":"aegir test -t node -f test/cli/index.js --timeout=10000","test:node:interface":"aegir test -t node -f test/core/interface.spec.js --timeout=10000","test:bootstrapers":"IPFS_TEST=bootstrapers aegir test -t browser -f test/bootstrapers.js --timeout=10000",benchmark:'echo "Error: no benchmarks yet" && exit 1',"benchmark:node":'echo "Error: no benchmarks yet" && exit 1',"benchmark:node:core":'echo "Error: no benchmarks yet" && exit 1',"benchmark:node:http":'echo "Error: no benchmarks yet" && exit 1',"benchmark:browser":'echo "Error: no benchmarks yet" && exit 1',release:"aegir release -t node -t browser","release-minor":"aegir release --type minor -t node -t browser","release-major":"aegir release --type major -t node -t browser",coverage:"aegir coverage","coverage-publish":"aegir-coverage publish","dep-check":"npx dependency-check package.json './test/**/*.js' './src/**/*.js'"},repository:{type:"git",url:"git+https://github.com/ipfs/js-ipfs.git"},keywords:["IPFS"],license:"MIT",bugs:{url:"https://github.com/ipfs/js-ipfs/issues"},homepage:"https://github.com/ipfs/js-ipfs#readme",devDependencies:{aegir:"^18.0.3",chai:"^4.2.0",delay:"^4.1.0","detect-node":"^2.0.4","dir-compare":"^1.4.0","dirty-chai":"^2.0.1",execa:"^1.0.0","form-data":"^2.3.3",hat:"0.0.3","interface-ipfs-core":"~0.96.0","ipfsd-ctl":"~0.40.1",ncp:"^2.0.0",qs:"^6.5.2",rimraf:"^2.6.2",sinon:"^7.1.1","stream-to-promise":"^2.2.0"},dependencies:{"@nodeutils/defaults-deep":"^1.1.0",async:"^2.6.1","bignumber.js":"^8.0.2","binary-querystring":"~0.1.2",bl:"^2.1.2",boom:"^7.2.0",bs58:"^4.0.1",byteman:"^1.3.5","cid-tool":"~0.2.0",cids:"~0.5.5","class-is":"^1.1.0","datastore-core":"~0.6.0","datastore-pubsub":"~0.1.1",debug:"^4.1.0","err-code":"^1.1.2","file-type":"^10.2.0",fnv1a:"^1.0.1","fsm-event":"^2.1.0","get-folder-size":"^2.0.0",glob:"^7.1.3",hapi:"^16.6.2","hapi-set-header":"^1.0.2",hoek:"^6.1.2","human-to-milliseconds":"^1.0.0","interface-datastore":"~0.6.0","ipfs-bitswap":"~0.22.0","ipfs-block":"~0.8.0","ipfs-block-service":"~0.15.1","ipfs-http-client":"^29.0.0","ipfs-http-response":"~0.2.1","ipfs-mfs":"~0.8.0","ipfs-multipart":"~0.1.0","ipfs-repo":"~0.26.1","ipfs-unixfs":"~0.1.16","ipfs-unixfs-engine":"~0.35.3",ipld:"~0.20.1","ipld-bitcoin":"~0.1.8","ipld-dag-pb":"~0.15.0","ipld-ethereum":"^2.0.1","ipld-git":"~0.2.2","ipld-zcash":"~0.1.6",ipns:"~0.5.0","is-ipfs":"~0.4.8","is-pull-stream":"~0.0.0","is-stream":"^1.1.0",joi:"^14.3.0","joi-browser":"^13.4.0","joi-multiaddr":"^4.0.0",libp2p:"~0.24.1","libp2p-bootstrap":"~0.9.3","libp2p-crypto":"~0.16.0","libp2p-kad-dht":"~0.14.4","libp2p-keychain":"~0.3.3","libp2p-mdns":"~0.12.0","libp2p-mplex":"~0.8.4","libp2p-record":"~0.6.1","libp2p-secio":"~0.11.0","libp2p-tcp":"~0.13.0","libp2p-webrtc-star":"~0.15.5","libp2p-websocket-star-multi":"~0.4.0","libp2p-websockets":"~0.12.0",lodash:"^4.17.11",mafmt:"^6.0.2","mime-types":"^2.1.21",mkdirp:"~0.5.1",multiaddr:"^6.0.0","multiaddr-to-uri":"^4.0.0",multibase:"~0.6.0",multihashes:"~0.4.14","multihashing-async":"~0.5.1","node-fetch":"^2.3.0",once:"^1.4.0","peer-book":"~0.9.0","peer-id":"~0.12.0","peer-info":"~0.15.0",progress:"^2.0.1","promisify-es6":"^1.0.3",protons:"^1.0.1","pull-abortable":"^4.1.1","pull-cat":"^1.1.11","pull-defer":"~0.2.3","pull-file":"^1.1.0","pull-ndjson":"~0.1.1","pull-pushable":"^2.2.0","pull-sort":"^1.0.1","pull-stream":"^3.6.9","pull-stream-to-stream":"^1.3.4",pump:"^3.0.0","read-pkg-up":"^4.0.0","readable-stream":"^3.1.1",receptacle:"^1.3.2","stream-to-pull-stream":"^1.7.2","tar-stream":"^1.6.2",temp:"~0.9.0","update-notifier":"^2.5.0",varint:"^5.0.0",yargs:"^12.0.5","yargs-promise":"^1.1.0"},optionalDependencies:{"prom-client":"^11.1.3","prometheus-gc-stats":"~0.6.0"},contributors:["0xflotus <0xflotus@gmail.com>","A_A <21040751+Otto-AA@users.noreply.github.com>","Alan Shaw ","Alan Shaw ","Alex North ","Alex Potsides ","Andrew de Andrade ","André Cruz ","Arkadiy Kukarkin ","Arpit Agarwal <93arpit@gmail.com>","Arpit Agarwal ","Bernard Mordan ","Brian Vander Schaaf ","Bruno Zell ","CHEVALAY JOSSELIN ","Caio Gondim ","Chance Hudson ","Christian Couder ","Dafeng ","Dan Ordille ","Daniel J. O'Quinn ","Daniela Borges Matos de Carvalho ","David Dias ","David Gilbertson ","David da Silva ","Diogo Silva ","Dmitriy Ryajov ","Dzmitry Das ","Enrico Marino ","Faheel Ahmad ","Felix Yan ","Francisco Baio Dias ","Francisco Baio Dias ","Friedel Ziegelmayer ","Gar ","Georgios Rassias ","Gorka Ludlow ","Greenkeeper ","Haad ","Haoliang Yu ","Harsh Vakharia ","Henrique Dias ","Henry Rodrick ","Heo Sangmin ","Hugo Dias ","Hugo Dias ","Jacob Heun ","Jacob Heun ","Jade Meskill ","Johannes Wikner ","Jon Schlinkert ","Jonathan ","João Antunes ","João Santos ","Kevin Wang ","Lars Gierth ","Lukas Drgon ","Maciej Krüger ","Marcin Rataj ","Marius Darila ","Mat Kelly ","Michelle Lee ","Mikeal Rogers ","Mithgol ","Molly ","My9Bot <34904312+My9Bot@users.noreply.github.com>","Nuno Nogueira ","Oli Evans ","Oskar Nyberg ","Pascal Precht ","Pau Ramon Revilla ","Paulo Rodrigues ","Pedro Teixeira ","Portia Burton ","Raoul Millais ","RasmusErik Voel Jensen ","Richard Littauer ","Richard Schneider ","Rob Brackett ","Rod Keys ","Sangwon Hong ","Sid Harder ","SidHarder ","Stephen Whitmore ","Stephen Whitmore ","Terence Pae ","Uroš Jurglič ","Vasco Santos ","Vasco Santos ","Volker Mische ","Xiao Liang ","Yahya ","Yole ","bitspill ","datafatmunger ","haad ","jbenet ","jonahweissman <19804455+jonahweissman@users.noreply.github.com>","kevingzhang ","kumavis ","nginnever ","npmcdn-to-unpkg-bot ","robbsolter <35879806+robbsolter@users.noreply.github.com>","seungwon-kang ","tcme ","victorbjelkholm ","Łukasz Magiera ","Максим Ильин "]}},function(e,t,n){"use strict";const r=n(3),i=n(223).repoVersion;e.exports=function e(t){return{init:(e,t,n)=>{},version:r(e=>{t._repo._isInitialized(n=>{if(n){const t=[/Key not found in database \[\/version\]/,/ENOENT/,/repo is not initialized yet/].some(e=>e.test(n.message));return t?e(null,i):e(n)}t._repo.version.get(e)})}),gc:r((e,t)=>{"function"==typeof e&&(t=e,e={}),t(new Error("Not implemented"))}),stat:r((e,n)=>{"function"==typeof e&&(n=e,e={}),t._repo.stat(e,(e,t)=>{if(e)return n(e);n(null,{numObjects:t.numObjects,repoSize:t.repoSize,repoPath:t.repoPath,version:t.version.toString(),storageMax:t.storageMax})})}),path:()=>t._repo.path}}},function(e,t,n){"use strict";e.exports=(()=>({Addresses:{Swarm:[],API:"",Gateway:""},Discovery:{MDNS:{Enabled:!1,Interval:10},webRTCStar:{Enabled:!0}},Bootstrap:["/dns4/ams-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd","/dns4/lon-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3","/dns4/sfo-3.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM","/dns4/sgp-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu","/dns4/nyc-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm","/dns4/nyc-2.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64","/dns4/node0.preload.ipfs.io/tcp/443/wss/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic","/dns4/node1.preload.ipfs.io/tcp/443/wss/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6"]}))},function(e,t){function n(e,t){for(var n=-1,r=t.length,i=e.length;++n{"function"==typeof r&&(l=r,r={}),r=r||{};const c=e=>t.isBuffer(e)||s.readable(e)||a(e),f=e=>"object"==typeof e&&(e.content?c(e.content):Boolean(e.path)&&u(e.path)),h=e=>c(e)||f(e),p=h(n)||Array.isArray(n)&&n.every(h);if(!p)return l(new Error("invalid input: expected buffer, readable stream, pull stream, object or array of objects"));i(i.values([n]),e.addPullStream(r),o((e,t)=>e.patht.path?-1:0),i.collect(l))});return function(){const e=Array.from(arguments);return 1===e.length&&a(e[0])&&e.push({}),n.apply(null,e)}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=n(1212)},function(e,t){e.exports=function(e){var t,n,r;function i(e){return n=e,function(e,i){r?t=[e,i]:n(e,i)}}return i.pause=function(){r||(r=!0,e&&e(r))},i.resume=function(){if(r&&(r=!1,e&&e(r),t)){var i=t;t=null,n(i[0],i[1])}},i}},function(e,t,n){"use strict";(function(t){e.exports=function e(n,r,i,o){const s=n.length,a=r+s;return i>=a||o=r&&o=r&&i{if(t=Object.assign({},p,t),!t.parentCid)return n(new Error("No parent CID passed to addLink"));if(!o.isCID(t.parentCid))return n(new Error("Invalid CID passed to addLink"));if(!t.parent)return l("Loading parent node",t.parentCid.toBaseEncodedString()),s([n=>e.ipld.get(t.parentCid,n),(e,t)=>t(null,e.value),(n,r)=>d(e,{...t,parent:n},r)],n);if(!t.cid)return n(new Error("No child cid passed to addLink"));if(!t.name)return n(new Error("No child name passed to addLink"));if(o.isCID(t.cid)||(t.cid=new o(t.cid)),!t.size&&0!==t.size)return n(new Error("No child size passed to addLink"));const r=c.unmarshal(t.parent.data);return"hamt-sharded-directory"===r.type?(l("Adding link to sharded directory"),y(e,t,n)):t.parent.links.length>=t.shardSplitThreshold?(l("Converting directory to sharded directory"),m(e,t,n)):(l(`Adding ${t.name} to regular directory`),void g(e,t,n))},m=(e,t,n)=>{v(e,t.parent.links.map(e=>({name:e.name,size:e.size,multihash:e.cid.buffer})).concat({name:t.name,size:t.size,multihash:t.cid.buffer}),{},(e,t)=>{e||l("Converted directory to sharded directory",t.cid.toBaseEncodedString()),n(e,t)})},g=(e,t,n)=>{s([e=>r.rmLink(t.parent,t.name,e),(e,n)=>r.addLink(e,new i(t.name,t.size,t.cid),n),(n,r)=>{e.ipld.put(n,{version:t.cidVersion,format:t.codec,hashAlg:t.hashAlg,hashOnly:!t.flush},(e,t)=>r(e,{node:n,cid:t}))}],n)},y=(e,t,n)=>s([n=>f(e,t.name,t.parent,n),({rootBucket:n,path:r},i)=>{b(e,r,{name:t.name,cid:t.cid,size:t.size},t,(e,t={})=>i(e,{rootBucket:n,...t}))},({rootBucket:n,node:r},i)=>h(e,r.links,n,t,i)],n),b=(e,t,n,r,i)=>{const{bucket:o,prefix:a,node:u}=t.pop(),c=u.links.find(e=>e.name.substring(0,2)===a&&e.name!==`${a}${n.name}`);return s([i=>c&&c.name.length>2?(l(`Converting existing file ${c.name} into sub-shard for ${n.name}`),s([t=>v(e,[{name:c.name.substring(2),size:c.size,multihash:c.cid.buffer},{name:n.name,size:n.size,multihash:n.cid.buffer}],{},t),({node:{links:[t]}},n)=>e.ipld.get(t.cid,(e,r)=>{n(e,{cid:t.cid,node:r&&r.value})}),(t,n)=>_(e,o,u,c.name,t.node,t.cid,a,r,n)],i)):c&&2===c.name.length?(l(`Descending into sub-shard ${c.name} for ${n.name}`),s([i=>b(e,t,n,r,i),(t,n)=>_(e,o,u,c.name,t.node,t.cid,a,r,n)],i)):(l("Adding or replacing file",a+n.name),void _(e,o,u,a+n.name,n,n.cid,a+n.name,r,i))],i)},v=(e,t,n,r)=>{const i=new a({root:!0,dir:!0,parent:null,parentKey:null,path:"",dirty:!0,flat:!1,...n}),o=t.map(e=>t=>{i.put(e.name,{size:e.size,multihash:e.multihash},t)});return u(o,t=>{if(t)return r(t);i.flush("",e.ipld,null,r)})},_=(e,t,n,o,a,u,l,c,f)=>{s([e=>r.rmLink(n,o,e),(e,t)=>r.addLink(e,new i(l,a.size,u),t),(n,r)=>h(e,n.links,t,c,r)],f)};e.exports=d},function(e,t,n){"use strict";(function(t){const{DAGNode:r}=n(37),i=n(11),o=n(229),s=n(340),a=n(262),u=n(5)("ipfs:mfs:core:utils:hamt-utils"),l=n(50),c=(e,n,o,s,u)=>{i([e=>{const i=t.from(o._children.bitField().reverse()),s=new l("hamt-sharded-directory",i);s.fanout=o.tableSize(),s.hashType=a.hashFn.code,r.create(s.marshal(),n,e)},(t,n)=>{e.ipld.put(t,{version:s.cidVersion,format:s.codec,hashAlg:s.hashAlg,hashOnly:!s.flush},(e,r)=>n(e,{node:t,cid:r}))}],u)},f=(e,t,n,r,i)=>{const o=new s({hashFn:a.hashFn,hash:n?n._options.hash:void 0},n,r);n&&n._putObjectAt(r,o),h(e,o,t,i)},h=(e,t,n,r)=>{Promise.all(e.map(e=>{if(2===e.name.length){const n=parseInt(e.name,16);return t._putObjectAt(n,new s({hashFn:a.hashFn},t,n)),Promise.resolve()}return(n||t).put(e.name.substring(2),!0)})).catch(e=>{r(e),r=null}).then(()=>r&&r(null,t))},p=e=>e.toString("16").toUpperCase().padStart(2,"0").substring(0,2),d=(e,t,n,r)=>{f(n.links,null,null,null,async(i,s)=>{if(i)return r(i);const a=await s._findNewBucketAndPos(t);let l=[{bucket:a.bucket,prefix:p(a.pos)}],c=a.bucket;for(;c!==s;)l.push({bucket:c,prefix:p(c._posAtParent)}),c=c._parent;l[l.length-1].node=n;let d=l.length;o(()=>d>0,n=>{d--;const r=l[d],i=r.node.links.filter(e=>e.name.substring(0,2)===r.prefix).pop();return i?i.name===`${r.prefix}${t}`?(u(`Link ${r.prefix}${t} will be replaced`),n(null,l)):(u(`Found subshard ${r.prefix}`),void e.ipld.get(i.cid,(e,i)=>{if(e)return n(e);if(!l[d-1]){u(`Loaded new subshard ${r.prefix}`);const e=i.value;return f(e.links,s,r.bucket,parseInt(r.prefix,16),async(r,i)=>{if(r)return n(r);const o=await s._findNewBucketAndPos(t);d++,l.unshift({bucket:o.bucket,prefix:p(o.pos),node:e}),n()})}const o=l[d-1];h(i.value.links,o.bucket,s,e=>{o.node=i.value,n(e)})})):(u(`Link ${r.prefix}${t} will be added`),n(null,l))},async(e,n)=>{await s.put(t,!0),r(e,{rootBucket:s,path:n})})})};e.exports={generatePath:d,updateHamtDirectory:c,recreateHamtLevel:f,addLinksToHamtBucket:h,toPrefix:p}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=n(1264)},function(e,t){e.exports={WORKER_REQUEST_READ_LOCK:"lock:worker:request-read",WORKER_RELEASE_READ_LOCK:"lock:worker:release-read",MASTER_GRANT_READ_LOCK:"lock:master:grant-read",WORKER_REQUEST_WRITE_LOCK:"lock:worker:request-write",WORKER_RELEASE_WRITE_LOCK:"lock:worker:release-write",MASTER_GRANT_WRITE_LOCK:"lock:master:grant-write"}},function(e,t){const n={},r=e=>{e.addEventListener("message",t=>{r.dispatchEvent("message",e,t)}),e.port&&e.port.addEventListener("message",t=>{r.dispatchEvent("message",e,t)})};r.addEventListener=((e,t)=>{n[e]||(n[e]=[]),n[e].push(t)}),r.removeEventListener=((e,t)=>{n[e]&&(n[e]=n[e].filter(e=>e===t))}),r.dispatchEvent=function(){const e=Array.prototype.slice.call(arguments),t=e.shift();n[t]&&n[t].forEach(t=>t.apply(null,e))},e.exports=r},function(e,t,n){"use strict";const{FILE_SEPARATOR:r}=n(264),i=n(557),o=n(11),s=n(53),a=n(341),u="ipfs",l=(e,t,n)=>{let u=Array.isArray(t);const l=Array.isArray(t)?t:[t];o([t=>{s({paths:e=>{let t;try{t=l.map(e=>{if(e=(e||"").trim(),e=e.replace(/(\/\/+)/g,"/"),!e)throw new Error("paths must not be empty");if(e.substring(0,1)!==r)throw new Error(`paths must start with a leading ${r}`);return e.substring(e.length-r.length)===r&&(e=e.substring(0,e.length-r.length)),a(e)})}catch(t){return e(t)}e(null,t)},root:t=>i(e,t)},t)},({paths:e,root:t},n)=>{n(null,e.map(e=>{if("ipfs"===e[0]){let n;return n=2===e.length?`${r}${e.join(r)}`:`${r}${e.slice(0,e.length-1).join(r)}`,{type:"ipfs",depth:e.length-2,mfsPath:`${r}${e.join(r)}`,mfsDirectory:n,root:t,parts:e,path:`${r}${e.join(r)}`,name:e[e.length-1]}}const n=`/ipfs/${t.toBaseEncodedString()}/${e.join(r)}`,i=`/ipfs/${t.toBaseEncodedString()}/${e.slice(0,e.length-1).join(r)}`;return{type:"mfs",depth:e.length,mfsDirectory:i,mfsPath:n,root:t,parts:e,path:`${r}${e.join(r)}`,name:e[e.length-1]}}))},(e,t)=>{if(u)return t(null,e);t(null,e[0])}],n)};e.exports=l},function(e,t,n){"use strict";const r=n(9),i=n(50),{DAGNode:o}=n(37),s=n(5)("ipfs:mfs:utils:with-mfs-root"),a=n(11),{MFS_ROOT_KEY:u}=n(264),l=(e,t)=>{a([t=>e.repo.datastore.open(e=>t(e)),t=>{e.repo.datastore.get(u,(n,l)=>{if(n&&(n.notFound||"ERR_NOT_FOUND"===n.code))return s("Creating new MFS root"),a([e=>o.create(new i("directory").marshal(),e),(t,n)=>e.ipld.put(t,{version:0,hashAlg:"sha2-256",format:"dag-pb"},n),(t,n)=>e.repo.datastore.put(u,t.buffer,e=>n(e,t))],t);t(n,l?new r(l):null)})},(e,t)=>{s(`Fetched MFS root ${e.toBaseEncodedString()}`),t(null,e)}],t)};e.exports=l},function(e,t,n){"use strict";(function(t,r){var i=n(10);e.exports=S;var o=n(48),s;S.ReadableState=k;var a=n(6).EventEmitter,u=function(e,t){return e.listeners(t).length},l=n(559),c=n(4).Buffer,f=t.Uint8Array||function(){};function h(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof f}var d=n(7);d.inherits=n(1);var m=n(1285),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(1286),b=n(560),v;d.inherits(S,l);var _=["error","close","destroy","pause","resume"];function w(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function k(e,t){s=s||n(151),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=n(14).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function S(e){if(s=s||n(151),!(this instanceof S))return new S(e);this._readableState=new k(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),l.call(this)}function E(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,O(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.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,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),_()}function v(){g("onfinish"),e.removeListener("close",b),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(49)},f=n(559),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(560),y;function b(){}function v(e,t){u=u||n(151),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||n(151),!(y.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(151),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length"object"==typeof e).pop()||{});Array.isArray(t[0])&&(t=t[0]);const s=t.filter(e=>"string"==typeof e).map(e=>e.trim());r(e,s,(e,t)=>{i(e,{sources:t,options:o})})}e.exports=i},function(e,t,n){"use strict";const r=n(11),i=n(53),{addLink:o,updateTree:s,updateMfsRoot:a,toTrail:u,toSourcesAndDestination:l,toMfsPath:c}=n(83),f=n(266),h=n(343),p=n(5)("ipfs:mfs:cp"),d={parents:!1,flush:!0,format:"dag-pb",hashAlg:"sha2-256",shardSplitThreshold:1e3};e.exports=(e=>(function t(){const n=Array.from(arguments),i=n.pop();r([t=>l(e,n,d,t),({sources:e,destination:t,options:n},r)=>e.length?t?(n.parents=n.p||n.parents,void r(null,{sources:e,destination:t,options:n})):r(new Error("Please supply a destination")):r(new Error("Please supply at least one source")),({sources:t,destination:n,options:r},i)=>u(e,n.mfsPath,r,(o,s)=>{if(o)return i(o);if(s.length===n.parts.length)return p("Destination does not exist"),1===t.length?(p("Only one source, copying to a file"),m(e,t.pop(),n,s,r,i)):(p("Multiple sources, copying to a directory"),g(e,t,n,s,r,i));const a=s[s.length-1];if("dir"===a.type)return p("Destination is a directory"),g(e,t,n,s,r,i);i(new Error("directory already has entry by that name"))})],i)}));const m=(e,t,n,i,u,l)=>{r([n=>y(e,t,u,n),(t,s)=>{const a=i[i.length-1],u=t[t.length-1];r([t=>e.ipld.get(a.cid,t),(t,r)=>o(e,{parent:t.value,parentCid:a.cid,size:u.size,cid:u.cid,name:n.parts[n.parts.length-1]},r),({node:e,cid:t},n)=>{a.node=e,a.cid=t,a.size=e.size,n(null,i)}],s)},(t,n)=>s(e,t,u,n),({cid:t},n)=>a(e,t,n)],e=>l(e))},g=(e,t,n,l,d,m)=>{r([t=>{if(l.length!==n.parts.length+1)return p("Making destination directory",n.path),r([t=>h(e)(n.path,d,t),t=>c(e,n.path,t),(t,r)=>{n=t,u(e,n.mfsPath,d,r)}],(e,n)=>{if(e)return t(e);l=n,t()});t()},n=>i(t.map(t=>n=>y(e,t,d,n)),n),(u,c)=>{r([r=>{i(t.map(t=>r=>{f(e)(`${n.path}/${t.name}`,d,e=>{if(e)return e.message.includes("does not exist")?r():r(e);r(new Error("directory already has entry by that name"))})}),e=>r(e))},n=>{const i=l[l.length-1];r([t=>e.ipld.get(i.cid,t),(e,t)=>t(null,{cid:i.cid,node:e.value})].concat(u.map((n,r)=>(i,s)=>{const a=n[n.length-1];p(`Adding ${t[r].name} to ${i.cid.toBaseEncodedString()}`),o(e,{parent:i.node,parentCid:i.cid,size:a.size,cid:a.cid,name:t[r].name},(e,t)=>{if(e)return s(e);p(`New directory hash ${t.cid.toBaseEncodedString()}`),s(e,t)})})),n)},({node:e,cid:t},n)=>{const r=l[l.length-1];r.node=e,r.cid=t,r.size=e.size,n(null,l)},(t,n)=>s(e,t,d,n),({cid:t},n)=>a(e,t,n)],c)}],e=>m(e))},y=(e,t,n,r)=>{u(e,t.mfsPath,n,(e,n)=>e?r(e):"ipfs"===t.type?r(null,n):n.length!==t.parts.length+1?r(new Error(`${t.path} does not exist`)):void r(null,n))}},function(e,t,n){"use strict";const r=n(11),i=n(39),{updateTree:o,updateMfsRoot:s,toSources:a,removeLink:u,toMfsPath:l,toTrail:c,FILE_SEPARATOR:f}=n(83),h={recursive:!1,cidVersion:0,hashAlg:"sha2-256",format:"dag-pb"};e.exports=(e=>(function t(){const n=Array.from(arguments),o=n.pop();r([t=>a(e,n,h,t),({sources:t,options:n},r)=>{if(!t.length)return r(new Error("Please supply at least one path to remove"));i(t.map(t=>r=>p(e,t.path,n,r)),e=>r(e))}],o)}));const p=(e,t,n,i)=>{if(t===f)return i(new Error("Cannot delete root"));r([n=>l(e,t,n),({mfsPath:t,parts:r},i)=>c(e,t,n,(e,n)=>i(e,{mfsPath:t,parts:r,trail:n})),({trail:i},o)=>{const s=i.pop(),a=i[i.length-1];return a?"dir"!==s.type||n.recursive?void r([t=>u(e,{parentCid:a.cid,name:s.name},t),({cid:e},t)=>{a.cid=e,t(null,i)}],o):o(new Error(`${t} is a directory, use -r to remove directories`)):o(new Error(`${t} does not exist`))},(t,r)=>o(e,t,n,r),({cid:t},n)=>s(e,t,n)],i)}},function(e,t,n){"use strict";const r=n(185).OFFLINE_ERROR,i=n(3),o=n(16),s=n(62),a=n(9),u=n(23),l=n(22);function c(e,t){return Array.from(e).map(e=>({"/":e[1].cid.toBaseEncodedString()}))}e.exports=function e(t){return{wantlist:i((e,n)=>{if("function"==typeof e&&(n=e,e=null),!t.isOnline())return o(()=>n(new Error(r)));let i;if(e){try{e=u.createFromB58String(e)}catch(t){e=null}if(!e)return o(()=>n(new Error("Invalid peerId")));i=t._bitswap.wantlistForPeer(e)}else i=t._bitswap.getWantlist();o(()=>n(null,{Keys:c(i)}))}),stat:i(e=>{if(!t.isOnline())return o(()=>e(new Error(r)));const n=t._bitswap.stat().snapshot;o(()=>{e(null,{provideBufLen:parseInt(n.providesBufferLength.toString()),blocksReceived:new s(n.blocksReceived),wantlist:c(t._bitswap.getWantlist()),peers:t._bitswap.peers().map(e=>e.toB58String()),dupBlksReceived:new s(n.dupBlksReceived),dupDataReceived:new s(n.dupDataReceived),dataReceived:new s(n.dataReceived),blocksSent:new s(n.blocksSent),dataSent:new s(n.dataSent)})})}),unwant:i((e,n)=>{if(!t.isOnline())return o(()=>n(new Error(r)));Array.isArray(e)||(e=[e]);try{e=e.map(e=>a.isCID(e)?e:new a(e))}catch(e){return o(()=>n(l(e,"ERR_INVALID_CID")))}o(()=>n(null,t._bitswap.unwant(e)))})}}},function(e,t,n){"use strict";const r=n(3),i=/^((\d+(\.\d+)*)(ns|ms|us|µs|m|s|h))+$/,o=/((\d+(\.\d+)*)(ns|ms|us|µs|m|s|h))/g,s=/(ns|ms|us|µs|m|s|h)/g,a={ns:1e-6,us:.001,"µs":.001,ms:1,s:1e3,m:6e4,h:36e5};function u(e){let t=e.match(s)[0];return e=e.substring(0,e.length-t.length),parseFloat(e)*a[t]}e.exports=r(function(e,t){return"string"!=typeof e?t(new Error("the first argument must be a string")):i.test(e)?void t(null,e.match(o).reduce((e,t)=>e+u(t),0)):t(new Error("invalid time"))})},function(e,t,n){"use strict";const r=n(1323).Block,i=n(9),o=n(42),s=n(55),a=n(11),u=80,l=(e,t)=>{let n=null,r;try{r=e.toBuffer(!0)}catch(e){n=e}finally{t(n,r)}},c=(e,t)=>{if(80!==e.length){const e=new Error("Bitcoin block header needs to be 80 bytes");return t(e)}const n=r.fromBuffer(e);t(null,n)},f=(e,t,r)=>{"function"==typeof t&&(r=t,t={}),t=t||{};const o=t.hashAlg||n(345).defaultHashAlg,u=void 0===t.version?1:t.version;a([t=>{try{s(e.toBuffer(!0),o,t)}catch(e){t(e)}},(e,t)=>t(null,new i(u,"bitcoin-block",e))],r)},h=e=>{const t=n(345).defaultHashAlg,r=o.encode(e,t),s=1,a=new i(1,"bitcoin-block",r);return a};e.exports={hashToCid:h,BITCOIN_BLOCK_HEADER_SIZE:80,cid:f,deserialize:c,serialize:l}},function(e,t,n){"use strict";var r=t;function i(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"!=typeof e){for(var r=0;r>8,s=255&i;o?n.push(o,s):n.push(s)}return n}function o(e){return 1===e.length?"0"+e:e}function s(e){for(var t="",n=0;n>>3}function h(e){return i(e,17)^i(e,19)^e>>>10}t.ft_1=o,t.ch32=s,t.maj32=a,t.p32=u,t.s0_256=l,t.s1_256=c,t.g0_256=f,t.g1_256=h},function(e,t,n){"use strict";var r=n(91),i=n(189),o=n(573),s=n(107),a=r.sum32,u=r.sum32_4,l=r.sum32_5,c=o.ch32,f=o.maj32,h=o.s0_256,p=o.s1_256,d=o.g0_256,m=o.g1_256,g=i.BlockHash,y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function b(){if(!(this instanceof b))return new b;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=y,this.W=new Array(64)}r.inherits(b,g),e.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=function e(t,n){for(var r=this.W,i=0;i<16;i++)r[i]=t[n+i];for(;it)throw new TypeError("Script number overflow");if(n&&0==(127&e[r-1])&&(r<=1||0==(128&e[r-2])))throw new Error("Non-minimally encoded script number");if(5===r){const t=e.readUInt32LE(0),n=e.readUInt8(4);return 128&n?-(4294967296*(-129&n)+t):4294967296*n+t}let i=0;for(var o=0;o2147483647?5:e>8388607?4:e>32767?3:e>127?2:e>0?1:0}function s(e){let t=Math.abs(e);const n=o(t),i=r.allocUnsafe(n),s=e<0;for(var a=0;a>=8;return 128&i[n-1]?i.writeUInt8(s?128:0,n-1):s&&(i[n-1]|=128),i}e.exports={decode:i,encode:s}},function(e,t,n){"use strict";var r=n(4).Buffer,i=9007199254740991;function o(e){if(e<0||e>i||e%1!=0)throw new RangeError("value out of range")}function s(e,t,n){if(o(e),t||(t=r.allocUnsafe(u(e))),!r.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");return n||(n=0),e<253?(t.writeUInt8(e,n),s.bytes=1):e<=65535?(t.writeUInt8(253,n),t.writeUInt16LE(e,n+1),s.bytes=3):e<=4294967295?(t.writeUInt8(254,n),t.writeUInt32LE(e,n+1),s.bytes=5):(t.writeUInt8(255,n),t.writeUInt32LE(e>>>0,n+1),t.writeUInt32LE(e/4294967296|0,n+5),s.bytes=9),t}function a(e,t){if(!r.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");t||(t=0);var n=e.readUInt8(t);if(n<253)return a.bytes=1,n;if(253===n)return a.bytes=3,e.readUInt16LE(t+1);if(254===n)return a.bytes=5,e.readUInt32LE(t+1);a.bytes=9;var i=e.readUInt32LE(t+1),s=e.readUInt32LE(t+5),u=4294967296*s+i;return o(u),u}function u(e){return o(e),e<253?1:e<=65535?3:e<=4294967295?5:9}e.exports={encode:s,decode:a,encodingLength:u}},function(e,t,n){const r=n(124),i=n(148),o=n(45),s=n(92),a=n(580),u=n(84),l=o.maybe(o.compile({compressed:s.maybe(s.Boolean),network:s.maybe(s.Network)}));function c(e,t,n){n=n||{},this.compressed=void 0===n.compressed||n.compressed,this.network=n.network||u.bitcoin,this.__d=e||null,this.__Q=null,t&&(this.__Q=r.pointCompress(t,this.compressed))}function f(e,t){if(o(s.Buffer256bit,e),!r.isPrivate(e))throw new TypeError("Private key not in range [1, n)");return o(l,t),new c(e,null,t)}function h(e,t){return o(r.isPoint,e),o(l,t),new c(null,e,t)}function p(e,t){const n=a.decode(e),r=n.version;if(s.Array(t)){if(t=t.filter(function(e){return r===e.wif}).pop(),!t)throw new Error("Unknown network version")}else if(t=t||u.bitcoin,r!==t.wif)throw new Error("Invalid network version");return f(n.privateKey,{compressed:n.compressed,network:t})}function d(e){o(l,e),e=e||{};const t=e.rng||i;let n;do{n=t(32),o(s.Buffer256bit,n)}while(!r.isPrivate(n));return f(n,e)}Object.defineProperty(c.prototype,"privateKey",{enumerable:!1,get:function(){return this.__d}}),Object.defineProperty(c.prototype,"publicKey",{get:function(){return this.__Q||(this.__Q=r.pointFromScalar(this.__d,this.compressed)),this.__Q}}),c.prototype.toWIF=function(){if(!this.__d)throw new Error("Missing private key");return a.encode(this.network.wif,this.__d,this.compressed)},c.prototype.sign=function(e){if(!this.__d)throw new Error("Missing private key");return r.sign(e,this.__d)},c.prototype.verify=function(e,t){return r.verify(e,this.publicKey,t)},e.exports={makeRandom:d,fromPrivateKey:f,fromPublicKey:h,fromWIF:p}},function(e,t,n){(function(t){var r=n(190);function i(e,t){if(void 0!==t&&e[0]!==t)throw new Error("Invalid network version");if(33===e.length)return{version:e[0],privateKey:e.slice(1,33),compressed:!1};if(34!==e.length)throw new Error("Invalid WIF length");if(1!==e[33])throw new Error("Invalid compression flag");return{version:e[0],privateKey:e.slice(1,33),compressed:!0}}function o(e,n,r){var i=new t(r?34:33);return i.writeUInt8(e,0),n.copy(i,1),r&&(i[33]=1),i}function s(e,t){return i(r.decode(e),t)}function a(e,t,n){return"number"==typeof e?r.encode(o(e,t,n)):r.encode(o(e.version,e.privateKey,e.compressed))}e.exports={decode:s,decodeRaw:i,encode:a,encodeRaw:o}}).call(this,n(0).Buffer)},function(e,t,n){const r=n(4).Buffer,i=n(348),o=n(190),s=n(29),a=n(84),u=n(45),l=n(92),c=n(349);function f(e){const t=o.decode(e);if(t.length<21)throw new TypeError(e+" is too short");if(t.length>21)throw new TypeError(e+" is too long");const n=t.readUInt8(0),r=t.slice(1);return{version:n,hash:r}}function h(e){const t=i.decode(e),n=i.fromWords(t.words.slice(1));return{version:t.words[0],prefix:t.prefix,data:r.from(n)}}function p(e,t){u(l.tuple(l.Hash160bit,l.UInt8),arguments);const n=r.allocUnsafe(21);return n.writeUInt8(t,0),e.copy(n,1),o.encode(n)}function d(e,t,n){const r=i.toWords(e);return r.unshift(t),i.encode(n,r)}function m(e,t){t=t||a.bitcoin;try{return c.p2pkh({output:e,network:t}).address}catch(e){}try{return c.p2sh({output:e,network:t}).address}catch(e){}try{return c.p2wpkh({output:e,network:t}).address}catch(e){}try{return c.p2wsh({output:e,network:t}).address}catch(e){}throw new Error(s.toASM(e)+" has no matching Address")}function g(e,t){let n;t=t||a.bitcoin;try{n=f(e)}catch(e){}if(n){if(n.version===t.pubKeyHash)return c.p2pkh({hash:n.hash}).output;if(n.version===t.scriptHash)return c.p2sh({hash:n.hash}).output}else{try{n=h(e)}catch(e){}if(n){if(n.prefix!==t.bech32)throw new Error(e+" has an invalid prefix");if(0===n.version){if(20===n.data.length)return c.p2wpkh({hash:n.data}).output;if(32===n.data.length)return c.p2wsh({hash:n.data}).output}}}throw new Error(e+" has no matching Script")}e.exports={fromBase58Check:f,fromBech32:h,fromOutputScript:m,toBase58Check:p,toBech32:d,toOutputScript:g}},function(e,t,n){const r=n(29),i=n(35);function o(e){const t=r.compile(e);return 22===t.length&&t[0]===i.OP_0&&20===t[1]}o.toJSON=function(){return"Witness pubKeyHash output"},e.exports={check:o}},function(e,t,n){const r=n(29),i=n(35);function o(e){const t=r.compile(e);return 34===t.length&&t[0]===i.OP_0&&32===t[1]}o.toJSON=function(){return"Witness scriptHash output"},e.exports={check:o}},function(e,t,n){"use strict";(function(t){const r=n(1382),i=n(192),o=n(193),s=n(1393);function a(e,n,r){const o=[];o.push({path:"storage",value:{"/":i("eth-storage-trie",e.stateRoot).toBaseEncodedString()}}),s.equals(e.codeHash)?o.push({path:"code",value:t.from("")}):o.push({path:"code",value:{"/":i("raw",e.codeHash).toBaseEncodedString()}}),o.push({path:"stateRoot",value:e.stateRoot}),o.push({path:"codeHash",value:e.codeHash}),o.push({path:"nonce",value:e.nonce}),o.push({path:"balance",value:e.balance}),o.push({path:"isEmpty",value:e.isEmpty()}),o.push({path:"isContract",value:e.isContract()}),r(null,o)}e.exports=o("eth-account-snapshot",r,a)}).call(this,n(0).Buffer)},function(e,t){e.exports=function e(t){if("string"!=typeof t)throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof t+", while checking isHexPrefixed.");return"0x"===t.slice(0,2)}},function(e,t){function n(e){return function t(n,r,i){e(n,r,(e,t)=>e?i(e):t.remainderPath.length>0?i(new Error("path out of scope")):void("object"==typeof t.value&&t.value["/"]?i(null,t.value):i(null,!1)))}}e.exports=n},function(e,t,n){const r=n(588),i=n(217);function o(e,t){return{deserialize:i(e=>new t(e)),serialize:i(e=>e.serialize()),cid:i((t,n)=>r(e,t,n))}}e.exports=o},function(e,t,n){"use strict";const r=n(192);function i(e,t,n){const i=t.hash(),o=r(e,i,n);return o}e.exports=i},function(e,t,n){"use strict";const r=n(590),i=n(192),o=n(193);function s(e,t,n){const r=[];r.push({path:"parent",value:{"/":i("eth-block",e.parentHash).toBaseEncodedString()}}),r.push({path:"ommers",value:{"/":i("eth-block-list",e.uncleHash).toBaseEncodedString()}}),r.push({path:"transactions",value:{"/":i("eth-tx-trie",e.transactionsTrie).toBaseEncodedString()}}),r.push({path:"transactionReceipts",value:{"/":i("eth-tx-receipt-trie",e.receiptTrie).toBaseEncodedString()}}),r.push({path:"state",value:{"/":i("eth-state-trie",e.stateRoot).toBaseEncodedString()}}),r.push({path:"parentHash",value:e.parentHash}),r.push({path:"ommerHash",value:e.uncleHash}),r.push({path:"transactionTrieRoot",value:e.transactionsTrie}),r.push({path:"transactionReceiptTrieRoot",value:e.receiptTrie}),r.push({path:"stateRoot",value:e.stateRoot}),r.push({path:"authorAddress",value:e.coinbase}),r.push({path:"bloom",value:e.bloom}),r.push({path:"difficulty",value:e.difficulty}),r.push({path:"number",value:e.number}),r.push({path:"gasLimit",value:e.gasLimit}),r.push({path:"gasUsed",value:e.gasUsed}),r.push({path:"timestamp",value:e.timestamp}),r.push({path:"extraData",value:e.extraData}),r.push({path:"mixHash",value:e.mixHash}),r.push({path:"nonce",value:e.nonce}),n(null,r)}e.exports=o("eth-block",r,s)},function(e,t,n){(function(t){const r=n(1394).default,i=n(268),o=i.BN;var s=e.exports=function(e,n){if(n=n||{},n.common){if(n.chain)throw new Error("Instantiation with both opts.common and opts.chain parameter not allowed!");this._common=n.common}else{let e=n.chain?n.chain:"mainnet",t=n.hardfork?n.hardfork:null;this._common=new r(e,t)}var o=[{name:"parentHash",length:32,default:i.zeros(32)},{name:"uncleHash",default:i.SHA3_RLP_ARRAY},{name:"coinbase",length:20,default:i.zeros(20)},{name:"stateRoot",length:32,default:i.zeros(32)},{name:"transactionsTrie",length:32,default:i.SHA3_RLP},{name:"receiptTrie",length:32,default:i.SHA3_RLP},{name:"bloom",default:i.zeros(256)},{name:"difficulty",default:t.from([])},{name:"number",default:i.intToBuffer(115e4)},{name:"gasLimit",default:t.from("ffffffffffffff","hex")},{name:"gasUsed",empty:!0,default:t.from([])},{name:"timestamp",default:t.from([])},{name:"extraData",allowZero:!0,empty:!0,default:t.from([])},{name:"mixHash",default:i.zeros(32)},{name:"nonce",default:i.zeros(8)}];i.defineProperties(this,o,e)};s.prototype.canonicalDifficulty=function(e){const t=this._common.hardfork()||this._common.activeHardfork(i.bufferToInt(this.number)),n=new o(this.timestamp),r=new o(e.header.timestamp),s=new o(e.header.difficulty),a=new o(this._common.param("pow","minimumDifficulty",t));var u=s.div(new o(this._common.param("pow","difficultyBoundDivisor",t))),l=new o(this.number),c,f,h;if(this._common.hardforkGteHardfork(t,"byzantium")){var p=e.header.uncleHash.equals(i.SHA3_RLP_ARRAY)?1:2;c=n.sub(r).idivn(9).ineg().iaddn(p),f=new o(-99),1===f.cmp(c)&&(c=f),h=s.add(u.mul(c))}this._common.hardforkGteHardfork(t,"constantinople")?(l.isubn(5e6),l.ltn(0)&&(l=new o(0))):this._common.hardforkGteHardfork(t,"byzantium")?(l.isubn(3e6),l.ltn(0)&&(l=new o(0))):this._common.hardforkGteHardfork(t,"homestead")?(c=n.sub(r).idivn(10).ineg().iaddn(1),f=new o(-99),1===f.cmp(c)&&(c=f),h=s.add(u.mul(c))):h=1===r.addn(this._common.param("pow","durationLimit",t)).cmp(n)?u.add(s):s.sub(u);var d=l.idivn(1e5).isubn(2);return d.isNeg()||h.iadd(new o(2).pow(d)),-1===h.cmp(a)&&(h=a),h},s.prototype.validateDifficulty=function(e){const t=this.canonicalDifficulty(e);return 0===t.cmp(new o(this.difficulty))},s.prototype.validateGasLimit=function(e){const t=new o(e.header.gasLimit),n=new o(this.gasLimit),r=this._common.hardfork()?this._common.hardfork():this._common.activeHardfork(this.number),i=t.div(new o(this._common.param("gasConfig","gasLimitBoundDivisor",r))),s=t.add(i),a=t.sub(i);return n.lt(s)&&n.gt(a)&&n.gte(this._common.param("gasConfig","minGasLimit",r))},s.prototype.validate=function(e,t,n){var r=this;if(2===arguments.length&&(n=t,t=!1),this.isGenesis())return n();e.getBlock(r.parentHash,function(e,s){if(e)return n("could not find parent block");r.parentBlock=s;var a=new o(r.number);if(0!==a.cmp(new o(s.header.number).iaddn(1)))return n("invalid number");if(t){var u=t.sub(new o(s.header.number));if(-1!==u.cmpn(8)||1!==u.cmpn(1))return n("uncle block has a parent that is too old or to young")}if(!r.validateDifficulty(s))return n("invalid Difficulty");if(!r.validateGasLimit(s))return n("invalid gas limit");if(i.bufferToInt(s.header.number)+1!==i.bufferToInt(r.number))return n("invalid heigth");if(i.bufferToInt(r.timestamp)<=i.bufferToInt(s.header.timestamp))return n("invalid timestamp");const l=r._common.hardfork()?r._common.hardfork():r._common.activeHardfork(t);if(r.extraData.length>r._common.param("vm","maxExtraDataSize",l))return n("invalid amount of extra data");n()})},s.prototype.hash=function(){return i.rlphash(this.raw)},s.prototype.isGenesis=function(){return""===this.number.toString("hex")},s.prototype.setGenesisParams=function(){this.timestamp=this._common.genesis().timestamp,this.gasLimit=this._common.genesis().gasLimit,this.difficulty=this._common.genesis().difficulty,this.extraData=this._common.genesis().extraData,this.nonce=this._common.genesis().nonce,this.stateRoot=this._common.genesis().stateRoot,this.number=t.from([])}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(1415),i=n(193);function o(e,t,n){const r=[];r.push({path:"nonce",value:e.nonce}),r.push({path:"gasPrice",value:e.gasPrice}),r.push({path:"gasLimit",value:e.gasLimit}),r.push({path:"toAddress",value:e.to}),r.push({path:"value",value:e.value}),r.push({path:"data",value:e.data}),r.push({path:"v",value:e.v}),r.push({path:"r",value:e.r}),r.push({path:"s",value:e.s}),r.push({path:"fromAddress",value:e.from}),r.push({path:"signature",value:[e.v,e.r,e.s]}),r.push({path:"isContractPublish",value:e.toCreationAddress()}),n(null,r)}e.exports=i("eth-tx",r,o)},function(e,t,n){"use strict";(function(r){const i=n(16),o=n(11),s=n(55),a=n(9),u=n(593),l=n(269),c=n(1421),f=n(1422),h=n(1423);t=e.exports,t.serialize=((e,t)=>{if(null!==e)if(r.isBuffer(e))"blob"===e.slice(0,4).toString()?i(()=>t(null,e)):i(()=>t(new Error("unexpected dagNode passed to serialize"),null));else switch(e.gitType){case"commit":c.serialize(e,t);break;case"tag":f.serialize(e,t);break;default:h.serialize(e,t)}else i(()=>t(new Error("dagNode passed to serialize was null"),null))}),t.deserialize=((e,t)=>{let n=l.find(e,0),r=e.slice(0,n).toString(),o=r.match(/([^ ]+) (\d+)/);if(o)switch(o[1]){case"blob":t(null,e);break;case"commit":c.deserialize(e.slice(n+1),t);break;case"tag":f.deserialize(e.slice(n+1),t);break;case"tree":h.deserialize(e.slice(n+1),t);break;default:i(()=>t(new Error("unknown object type "+o[1]),null))}else i(()=>t(new Error("invalid object header"),null))}),t.cid=((e,n,r)=>{"function"==typeof n&&(r=n,n={}),n=n||{};const i=n.hashAlg||u.defaultHashAlg,l=void 0===n.version?1:n.version;o([n=>t.serialize(e,n),(e,t)=>s(e,i,t),(e,t)=>t(null,new a(l,u.multicodec,e))],r)})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(592),o=n(454);t=e.exports,t.multicodec="git-raw",t.defaultHashAlg="sha1";const s=["original","name","email","date"];t.resolve=((e,t,n)=>{"function"==typeof t&&(n=t,t=void 0),i.deserialize(e,(e,i)=>{if(e)return n(e);if(!t||"/"===t)return n(null,{value:i,remainderPath:""});if(r.isBuffer(i))return n(null,{value:i,remainderPath:t});const s=t.split("/"),a=o(i).get(s);if(a)return n(null,{value:a,remainderPath:""});let u,l=s.length;for(let e=0;e{"function"==typeof t&&(n=t,t=void 0),t=t||{},i.deserialize(e,(e,t)=>{if(e)return n(e);if(r.isBuffer(t))return n(null,[]);let i=[];switch(t.gitType){case"commit":i=["message","tree"],i=i.concat(s.map(e=>"author/"+e)),i=i.concat(s.map(e=>"committer/"+e)),i=i.concat(t.parents.map((e,t)=>"parents/"+t)),t.encoding&&i.push("encoding");break;case"tag":i=["object","type","tag","message"],t.tagger&&(i=i.concat(s.map(e=>"tagger/"+e)));break;default:Object.keys(t).forEach(e=>{i.push(e),i.push(e+"/hash"),i.push(e+"/mode")})}n(null,i)})}),t.isLink=((e,n,r)=>{t.resolve(e,n,(e,t)=>e?r(e):t.remainderPath.length>0?r(new Error("path out of scope")):void("object"==typeof t.value&&t.value["/"]?r(null,t.value):r(null,!1)))})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(1425).BlockHeader,i=n(9),o=n(42),s=n(55),a=n(11),u=1487,l=(e,t)=>{let n=null,r;try{r=e.toBuffer()}catch(e){n=e}finally{t(n,r)}},c=(e,t)=>{if(1487!==e.length){const e=new Error("Zcash block header needs to be 1487 bytes");return t(e)}const n=r.fromBuffer(e);t(null,n)},f=(e,t,r)=>{"function"==typeof t&&(r=t,t={}),t=t||{};const o=t.hashAlg||n(354).defaultHashAlg,u=void 0===t.version?1:t.version;a([t=>{try{s(e.toBuffer(),o,t)}catch(e){t(e)}},(e,t)=>t(null,new i(u,"zcash-block",e))],r)},h=e=>{const t=n(354).defaultHashAlg,r=o.encode(e,t),s=1,a=new i(1,"zcash-block",r);return a};e.exports={hashToCid:h,ZCASH_BLOCK_HEADER_SIZE:1487,cid:f,deserialize:c,serialize:l}},function(e,t,n){(function(e){!function(e,t){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(null!==e&&"object"==typeof e&&Array.isArray(e.words))return e;this.sign=!1,this.words=null,this.length=0,this.red=null,"le"!==t&&"be"!==t||(n=t,t=10),null!==e&&this._init(e||0,t||10,n||"be")}function o(e,t,n){for(var r=0,i=Math.min(e.length,n),o=t;o=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return r}function s(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26,i.prototype._init=function e(t,r,i){if("number"==typeof t)return t<0&&(this.sign=!0,t=-t),void(t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3));if("object"==typeof t)return this._initArray(t,r,i);"hex"===r&&(r=16),n(r===(0|r)&&r>=2&&r<=36),t=t.toString().replace(/\s+/g,"");var o=0;"-"===t[0]&&o++,16===r?this._parseHex(t,o):this._parseBase(t,r,o),"-"===t[0]&&(this.sign=!0),this.strip()},i.prototype._initArray=function e(t,r,i){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var o=0;o=0;o-=3){var u=t[o]|t[o-1]<<8|t[o-2]<<16;this.words[a]|=u<>>26-s&67108863,s+=24,s>=26&&(s-=26,a++)}else if("le"===i)for(var o=0,a=0;o>>26-s&67108863,s+=24,s>=26&&(s-=26,a++)}return this.strip()},i.prototype._parseHex=function e(t,n){this.length=Math.ceil((t.length-n)/6),this.words=new Array(this.length);for(var r=0;r=n;r-=6){var a=o(t,r,r+6);this.words[s]|=a<>>26-i&4194303,i+=24,i>=26&&(i-=26,s++)}if(r+6!==n){var a=o(t,n,r+6);this.words[s]|=a<>>26-i&4194303}this.strip()},i.prototype._parseBase=function e(t,n,r){this.words=[0],this.length=1;for(var i=0,o=1;o<=67108863;o*=n)i++;i--,o=o/n|0;for(var a=t.length-r,u=a%i,l=Math.min(a,a-u)+r,c=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function e(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},i.prototype.inspect=function e(){return(this.red?""};var a=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],u=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function e(t,r){if(t=t||10,16===t||"hex"===t){for(var i="",o=0,r=0|r||1,s=0,c=0;c>>24-o&16777215,i=0!==s||c!==this.length-1?a[6-h.length]+h+i:h+i,o+=2,o>=26&&(o-=26,c--)}for(0!==s&&(i=s.toString(16)+i);i.length%r!=0;)i="0"+i;return this.sign&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var p=u[t],d=l[t],i="",m=this.clone();for(m.sign=!1;0!==m.cmpn(0);){var g=m.modn(d).toString(t);m=m.idivn(d),i=0!==m.cmpn(0)?a[p-g.length]+g+i:g+i}return 0===this.cmpn(0)&&(i="0"+i),this.sign&&(i="-"+i),i}n(!1,"Base should be between 2 and 36")},i.prototype.toJSON=function e(){return this.toString(16)},i.prototype.toArray=function e(){this.strip();var t=new Array(this.byteLength());t[0]=0;for(var n=this.clone(),r=0;0!==n.cmpn(0);r++){var i=n.andln(255);n.ishrn(8),t[t.length-r-1]=i}return t},Math.clz32?i.prototype._countBits=function e(t){return 32-Math.clz32(t)}:i.prototype._countBits=function e(t){var n=t,r=0;return n>=4096&&(r+=13,n>>>=13),n>=64&&(r+=7,n>>>=7),n>=8&&(r+=4,n>>>=4),n>=2&&(r+=2,n>>>=2),r+n},i.prototype._zeroBits=function e(t){if(0===t)return 26;var n=t,r=0;return 0==(8191&n)&&(r+=13,n>>>=13),0==(127&n)&&(r+=7,n>>>=7),0==(15&n)&&(r+=4,n>>>=4),0==(3&n)&&(r+=2,n>>>=2),0==(1&n)&&r++,r},i.prototype.bitLength=function e(){var t=0,n=this.words[this.length-1],t=this._countBits(n);return 26*(this.length-1)+t},i.prototype.zeroBits=function e(){if(0===this.cmpn(0))return 0;for(var t=0,n=0;nt.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.iand=function e(t){var n;this.sign=this.sign&&t.sign,n=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.ixor=function e(t){var n,r;this.sign=this.sign||t.sign,this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.setn=function e(t,r){n("number"==typeof t&&t>=0);for(var i=t/26|0,o=t%26;this.length<=i;)this.words[this.length++]=0;return this.words[i]=r?this.words[i]|1<t.length?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>>26}for(;0!==o&&s>>26}if(this.length=r.length,0!==o)this.words[this.length]=o,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function e(t){if(t.sign){t.sign=!1;var n=this.iadd(t);return t.sign=!0,n._normSign()}if(this.sign)return this.sign=!1,this.iadd(t),this.sign=!0,this._normSign();var r=this.cmp(t),i,o;if(0===r)return this.sign=!1,this.length=1,this.words[0]=0,this;r>0?(i=this,o=t):(i=t,o=this);for(var s=0,a=0;a>26,this.words[a]=67108863&n}for(;0!==s&&a>26,this.words[a]=67108863&n}if(0===s&&a>>26,s=67108863&r,a=Math.min(i,t.length-1),u=Math.max(0,i-this.length+1);u<=a;u++){var l=i-u,c=0|this.words[l],f=0|t.words[u],h=c*f,p=67108863&h;o=o+(h/67108864|0)|0,p=p+s|0,s=67108863&p,o=o+(p>>>26)|0}n.words[i]=s,r=o}return 0!==r?n.words[i]=r:n.length--,n.strip()},i.prototype._bigMulTo=function e(t,n){n.sign=t.sign!==this.sign,n.length=this.length+t.length;for(var r=0,i=0,o=0;o>>26)|0,i+=s>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()},i.prototype.mulTo=function e(t,n){var r;return r=this.length+t.length<63?this._smallMulTo(t,n):this._bigMulTo(t,n),r},i.prototype.mul=function e(t){var n=new i(null);return n.words=new Array(this.length+t.length),this.mulTo(t,n)},i.prototype.imul=function e(t){if(0===this.cmpn(0)||0===t.cmpn(0))return this.words[0]=0,this.length=1,this;var n=this.length,r=t.length;this.sign=t.sign!==this.sign,this.length=this.length+t.length,this.words[this.length-1]=0;for(var i=this.length-2;i>=0;i--){for(var o=0,s=0,a=Math.min(i,r-1),u=Math.max(0,i-n+1);u<=a;u++){var l=i-u,c=this.words[l],f=t.words[u],h=c*f,p=67108863&h;o+=h/67108864|0,p+=s,s=67108863&p,o+=p>>>26}this.words[i]=s,this.words[i+1]+=o,o=0}for(var o=0,l=1;l>>26}return this.strip()},i.prototype.imuln=function e(t){n("number"==typeof t);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),this},i.prototype.sqr=function e(){return this.mul(this)},i.prototype.isqr=function e(){return this.mul(this)},i.prototype.ishln=function e(t){n("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){for(var s=0,a=0;a>>26-r}s&&(this.words[a]=s,this.length++)}if(0!==i){for(var a=this.length-1;a>=0;a--)this.words[a+i]=this.words[a];for(var a=0;a=0),o=r?(r-r%26)/26:0;var s=t%26,a=Math.min((t-s)/26,this.length),u=67108863^67108863>>>s<a){this.length-=a;for(var c=0;c=0&&(0!==f||c>=o);c--){var h=this.words[c];this.words[c]=f<<26-s|h>>>s,f=h&u}return l&&0!==f&&(l.words[l.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},i.prototype.shln=function e(t){return this.clone().ishln(t)},i.prototype.shrn=function e(t){return this.clone().ishrn(t)},i.prototype.testn=function e(t){n("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26,o=1<=0);var r=t%26,i=(t-r)/26;if(n(!this.sign,"imaskn works only with positive numbers"),0!==r&&i++,this.length=Math.min(i,this.length),0!==r){var o=67108863^67108863>>>r<=67108864;n++)this.words[n]-=67108864,n===this.length-1?this.words[n+1]=1:this.words[n+1]++;return this.length=Math.max(this.length,n+1),this},i.prototype.isubn=function e(t){if(n("number"==typeof t),t<0)return this.iaddn(-t);if(this.sign)return this.sign=!1,this.iaddn(t),this.sign=!0,this;this.words[0]-=t;for(var r=0;r>26)-(c/67108864|0),this.words[s+i]=67108863&l}for(;s>26,this.words[s+i]=67108863&l}if(0===u)return this.strip();n(-1===u),u=0;for(var s=0;s>26,this.words[s]=67108863&l}return this.sign=!0,this.strip()},i.prototype._wordDiv=function e(t,n){var r=this.length-t.length,o=this.clone(),s=t,a=s.words[s.length-1],u=this._countBits(a);r=26-u,0!==r&&(s=s.shln(r),o.ishln(r),a=s.words[s.length-1]);var l=o.length-s.length,c;if("mod"!==n){c=new i(null),c.length=l+1,c.words=new Array(c.length);for(var f=0;f=0;p--){var d=67108864*o.words[s.length+p]+o.words[s.length+p-1];for(d=Math.min(d/a|0,67108863),o._ishlnsubmul(s,d,p);o.sign;)d--,o.sign=!1,o._ishlnsubmul(s,1,p),0!==o.cmpn(0)&&(o.sign=!o.sign);c&&(c.words[p]=d)}return c&&c.strip(),o.strip(),"div"!==n&&0!==r&&o.ishrn(r),{div:c||null,mod:o}},i.prototype.divmod=function e(t,r){if(n(0!==t.cmpn(0)),this.sign&&!t.sign){var o=this.neg().divmod(t,r),s,a;return"mod"!==r&&(s=o.div.neg()),"div"!==r&&(a=0===o.mod.cmpn(0)?o.mod:t.sub(o.mod)),{div:s,mod:a}}if(!this.sign&&t.sign){var o=this.divmod(t.neg(),r),s;return"mod"!==r&&(s=o.div.neg()),{div:s,mod:o.mod}}return this.sign&&t.sign?this.neg().divmod(t.neg(),r):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===r?{div:this.divn(t.words[0]),mod:null}:"mod"===r?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,r)},i.prototype.div=function e(t){return this.divmod(t,"div").div},i.prototype.mod=function e(t){return this.divmod(t,"mod").mod},i.prototype.divRound=function e(t){var n=this.divmod(t);if(0===n.mod.cmpn(0))return n.div;var r=n.div.sign?n.mod.isub(t):n.mod,i=t.shrn(1),o=t.andln(1),s=r.cmp(i);return s<0||1===o&&0===s?n.div:n.div.sign?n.div.isubn(1):n.div.iaddn(1)},i.prototype.modn=function e(t){n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+this.words[o])%t;return i},i.prototype.idivn=function e(t){n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=this.words[i]+67108864*r;this.words[i]=o/t|0,r=o%t}return this.strip()},i.prototype.divn=function e(t){return this.clone().idivn(t)},i.prototype.egcd=function e(t){n(!t.sign),n(0!==t.cmpn(0));var r=this,o=t.clone();r=r.sign?r.mod(t):r.clone();for(var s=new i(1),a=new i(0),u=new i(0),l=new i(1),c=0;r.isEven()&&o.isEven();)r.ishrn(1),o.ishrn(1),++c;for(var f=o.clone(),h=r.clone();0!==r.cmpn(0);){for(;r.isEven();)r.ishrn(1),s.isEven()&&a.isEven()?(s.ishrn(1),a.ishrn(1)):(s.iadd(f).ishrn(1),a.isub(h).ishrn(1));for(;o.isEven();)o.ishrn(1),u.isEven()&&l.isEven()?(u.ishrn(1),l.ishrn(1)):(u.iadd(f).ishrn(1),l.isub(h).ishrn(1));r.cmp(o)>=0?(r.isub(o),s.isub(u),a.isub(l)):(o.isub(r),u.isub(s),l.isub(a))}return{a:u,b:l,gcd:o.ishln(c)}},i.prototype._invmp=function e(t){n(!t.sign),n(0!==t.cmpn(0));var r=this,o=t.clone();r=r.sign?r.mod(t):r.clone();for(var s=new i(1),a=new i(0),u=o.clone();r.cmpn(1)>0&&o.cmpn(1)>0;){for(;r.isEven();)r.ishrn(1),s.isEven()?s.ishrn(1):s.iadd(u).ishrn(1);for(;o.isEven();)o.ishrn(1),a.isEven()?a.ishrn(1):a.iadd(u).ishrn(1);r.cmp(o)>=0?(r.isub(o),s.isub(a)):(o.isub(r),a.isub(s))}return 0===r.cmpn(1)?s:a},i.prototype.gcd=function e(t){if(0===this.cmpn(0))return t.clone();if(0===t.cmpn(0))return this.clone();var n=this.clone(),r=t.clone();n.sign=!1,r.sign=!1;for(var i=0;n.isEven()&&r.isEven();i++)n.ishrn(1),r.ishrn(1);for(;;){for(;n.isEven();)n.ishrn(1);for(;r.isEven();)r.ishrn(1);var o=n.cmp(r);if(o<0){var s=n;n=r,r=s}else if(0===o||0===r.cmpn(1))break;n.isub(r)}return r.ishln(i)},i.prototype.invm=function e(t){return this.egcd(t).a.mod(t)},i.prototype.isEven=function e(){return 0==(1&this.words[0])},i.prototype.isOdd=function e(){return 1==(1&this.words[0])},i.prototype.andln=function e(t){return this.words[0]&t},i.prototype.bincn=function e(t){n("number"==typeof t);var r=t%26,i=(t-r)/26,o=1<>>26,u&=67108863,this.words[s]=u}return 0!==a&&(this.words[s]=a,this.length++),this},i.prototype.cmpn=function e(t){var n=t<0,r;if(n&&(t=-t),this.sign&&!n)return-1;if(!this.sign&&n)return 1;if(t&=67108863,this.strip(),this.length>1)r=1;else{var i=this.words[0];r=i===t?0:it.length)return 1;if(this.length=0;r--){var i=this.words[r],o=t.words[r];if(i!==o){io&&(n=1);break}}return n},i.red=function e(t){return new g(t)},i.prototype.toRed=function e(t){return n(!this.red,"Already a number in reduction context"),n(!this.sign,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function e(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function e(t){return this.red=t,this},i.prototype.forceRed=function e(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function e(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function e(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function e(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function e(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function e(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function e(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function e(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function e(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function e(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function e(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function e(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function e(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function e(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var c={k256:null,p224:null,p192:null,p25519:null};function f(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function h(){f.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function p(){f.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function d(){f.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){f.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function g(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else this.m=e,this.prime=null}function y(e){g.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv.sign=!0,this.minv=this.minv.mod(this.r)}f.prototype._tmp=function e(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},f.prototype.ireduce=function e(t){var n=t,r;do{this.split(n,this.tmp),n=this.imulK(n),n=n.iadd(this.tmp),r=n.bitLength()}while(r>this.n);var i=r0?n.isub(this.p):n.strip(),n},f.prototype.split=function e(t,n){t.ishrn(this.n,0,n)},f.prototype.imulK=function e(t){return t.imul(this.k)},r(h,f),h.prototype.split=function e(t,n){for(var r=4194303,i=Math.min(t.length,9),o=0;o>>22,s=a}t.words[o-10]=s>>>22,t.length-=9},h.prototype.imulK=function e(t){var n;t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var r=0,i=0;i>>=26,t.words[r]=o,n=i}return 0!==n&&(t.words[t.length++]=n),t},i._prime=function e(t){if(c[t])return c[t];var e;if("k256"===t)e=new h;else if("p224"===t)e=new p;else if("p192"===t)e=new d;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new m}return c[t]=e,e},g.prototype._verify1=function e(t){n(!t.sign,"red works only with positives"),n(t.red,"red works only with red numbers")},g.prototype._verify2=function e(t,r){n(!t.sign&&!r.sign,"red works only with positives"),n(t.red&&t.red===r.red,"red works only with red numbers")},g.prototype.imod=function e(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.mod(this.m)._forceRed(this)},g.prototype.neg=function e(t){var n=t.clone();return n.sign=!n.sign,n.iadd(this.m)._forceRed(this)},g.prototype.add=function e(t,n){this._verify2(t,n);var r=t.add(n);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},g.prototype.iadd=function e(t,n){this._verify2(t,n);var r=t.iadd(n);return r.cmp(this.m)>=0&&r.isub(this.m),r},g.prototype.sub=function e(t,n){this._verify2(t,n);var r=t.sub(n);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},g.prototype.isub=function e(t,n){this._verify2(t,n);var r=t.isub(n);return r.cmpn(0)<0&&r.iadd(this.m),r},g.prototype.shl=function e(t,n){return this._verify1(t),this.imod(t.shln(n))},g.prototype.imul=function e(t,n){return this._verify2(t,n),this.imod(t.imul(n))},g.prototype.mul=function e(t,n){return this._verify2(t,n),this.imod(t.mul(n))},g.prototype.isqr=function e(t){return this.imul(t,t)},g.prototype.sqr=function e(t){return this.mul(t,t)},g.prototype.sqrt=function e(t){if(0===t.cmpn(0))return t.clone();var r=this.m.andln(3);if(n(r%2==1),3===r){var o=this.m.add(new i(1)).ishrn(2),s=this.pow(t,o);return s}for(var a=this.m.subn(1),u=0;0!==a.cmpn(0)&&0===a.andln(1);)u++,a.ishrn(1);n(0!==a.cmpn(0));var l=new i(1).toRed(this),c=l.redNeg(),f=this.m.subn(1).ishrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,f).cmp(c);)h.redIAdd(c);for(var p=this.pow(h,a),s=this.pow(t,a.addn(1).ishrn(1)),d=this.pow(t,a),m=u;0!==d.cmp(l);){for(var g=d,y=0;0!==g.cmp(l);y++)g=g.redSqr();n(y=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},y.prototype.mul=function e(t,n){if(0===t.cmpn(0)||0===n.cmpn(0))return new i(0)._forceRed(this);var r=t.mul(n),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(o).ishrn(this.shift),a=s;return s.cmp(this.m)>=0?a=s.isub(this.m):s.cmpn(0)<0&&(a=s.iadd(this.m)),a._forceRed(this)},y.prototype.invm=function e(t){var n=this.imod(t._invmp(this.m).mul(this.r2));return n._forceRed(this)}}(e,this)}).call(this,n(75)(e))},function(e,t,n){"use strict";(function(t){var r=n(51),i=n(152),o=n(86),s=n(94),a=n(275),u=n(59),l=n(30),c=n(17),f=n(25),h=function e(t){if(!(this instanceof e))return new e(t);t&&this.set(t)};h.prototype.set=function(e){return this.hashbuf=e.hashbuf||this.hashbuf,this.endian=e.endian||this.endian,this.privkey=e.privkey||this.privkey,this.pubkey=e.pubkey||(this.privkey?this.privkey.publicKey:this.pubkey),this.sig=e.sig||this.sig,this.k=e.k||this.k,this.verified=e.verified||this.verified,this},h.prototype.privkey2pubkey=function(){this.pubkey=this.privkey.toPublicKey()},h.prototype.calci=function(){for(var e=0;e<4;e++){var t;this.sig.i=e;try{t=this.toPublicKey()}catch(e){console.error(e);continue}if(t.point.eq(this.pubkey.point))return this.sig.compressed=this.pubkey.compressed,this}throw this.sig.i=void 0,new Error("Unable to find valid recovery factor")},h.fromString=function(e){var t=JSON.parse(e);return new h(t)},h.prototype.randomK=function(){var e=i.getN(),t;do{t=r.fromBuffer(a.getRandomBuffer(32))}while(!t.lt(e)||!t.gt(r.Zero));return this.k=t,this},h.prototype.deterministicK=function(e){c.isUndefined(e)&&(e=0);var n=new t(32);n.fill(1);var o=new t(32);o.fill(0);var s=this.privkey.bn.toBuffer({size:32}),a="little"===this.endian?l.reverse(this.hashbuf):this.hashbuf;o=u.sha256hmac(t.concat([n,new t([0]),s,a]),o),n=u.sha256hmac(n,o),o=u.sha256hmac(t.concat([n,new t([1]),s,a]),o),n=u.sha256hmac(n,o),n=u.sha256hmac(n,o);for(var f=r.fromBuffer(n),h=i.getN(),p=0;p>1,l=i.getN(),c=i.getG(),h=u?n.add(l):n,p=i.fromX(a,h),d=p.mul(l);if(!d.isInfinity())throw new Error("nR is not a valid curve point");var m=t.neg().mod(l),g=n.invm(l),y=p.mul(o).add(c.mul(m)).mul(g),b=s.fromPoint(y,this.sig.compressed);return b},h.prototype.sigError=function(){if(!l.isBuffer(this.hashbuf)||32!==this.hashbuf.length)return"hashbuf must be a 32 byte buffer";var e=this.sig.r,t=this.sig.s;if(!(e.gt(r.Zero)&&e.lt(i.getN())&&t.gt(r.Zero)&&t.lt(i.getN())))return"r and s not in range";var n=r.fromBuffer(this.hashbuf,this.endian?{endian:this.endian}:void 0),o=i.getN(),s=t.invm(o),a=s.mul(n).mod(o),u=s.mul(e).mod(o),c=i.getG().mulAdd(a,this.pubkey.point,u);return c.isInfinity()?"p is infinity":0!==c.getX().mod(o).cmp(e)&&"Invalid signature"},h.toLowS=function(e){return e.gt(r.fromBuffer(new t("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(e=i.getN().sub(e)),e},h.prototype._findSignature=function(e,t){var n=i.getN(),o=i.getG(),s=0,a,u,l,c;do{(!this.k||s>0)&&this.deterministicK(s),s++,a=this.k,u=o.mul(a),l=u.x.mod(n),c=a.invm(n).mul(t.add(e.mul(l))).mod(n)}while(l.cmp(r.Zero)<=0||c.cmp(r.Zero)<=0);return c=h.toLowS(c),{s:c,r:l}},h.prototype.sign=function(){var e=this.hashbuf,t=this.privkey,n=t.bn;f.checkState(e&&t&&n,new Error("invalid parameters")),f.checkState(l.isBuffer(e)&&32===e.length,new Error("hashbuf must be a 32 byte buffer"));var i=r.fromBuffer(e,this.endian?{endian:this.endian}:void 0),s=this._findSignature(n,i);return s.compressed=this.pubkey.compressed,this.sig=new o(s),this},h.prototype.signRandomK=function(){return this.randomK(),this.sign()},h.prototype.toString=function(){var e={};return this.hashbuf&&(e.hashbuf=this.hashbuf.toString("hex")),this.privkey&&(e.privkey=this.privkey.toString()),this.pubkey&&(e.pubkey=this.pubkey.toString()),this.sig&&(e.sig=this.sig.toString()),this.k&&(e.k=this.k.toString()),JSON.stringify(e)},h.prototype.verify=function(){return this.sigError()?this.verified=!1:this.verified=!0,this},h.sign=function(e,t,n){return h().set({hashbuf:e,endian:n,privkey:t}).sign().sig},h.verify=function(e,t,n,r){return h().set({hashbuf:e,endian:r,sig:t,pubkey:n}).verify().verified},e.exports=h}).call(this,n(0).Buffer)},function(e,t){for(var n="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",r={},i=0;i>8,i[n]&=255;for(;a;)i.push(255&a),a>>=8}for(t=0;"1"===e[t]&&t0&&r0&&u0&&(i=r?i+" "+e.buf.toString("hex"):i+" "+e.len+" 0x"+e.buf.toString("hex"));else if(void 0!==a.reverseMap[n])i=i+" "+a(n).toString();else{var o=n.toString(16);o.length%2!=0&&(o="0"+o),i=r?i+" "+o:i+" 0x"+o}return i},y.prototype.toASM=function(){for(var e="",t=0;t"},y.prototype.isPublicKeyHashOut=function(){return!(5!==this.chunks.length||this.chunks[0].opcodenum!==a.OP_DUP||this.chunks[1].opcodenum!==a.OP_HASH160||!this.chunks[2].buf||20!==this.chunks[2].buf.length||this.chunks[3].opcodenum!==a.OP_EQUALVERIFY||this.chunks[4].opcodenum!==a.OP_CHECKSIG)},y.prototype.isPublicKeyHashIn=function(){if(2===this.chunks.length){var e=this.chunks[0].buf,t=this.chunks[1].buf;if(e&&e.length&&48===e[0]&&t&&t.length){var n=t[0];if((4===n||6===n||7===n)&&65===t.length)return!0;if((3===n||2===n)&&33===t.length)return!0}}return!1},y.prototype.getPublicKey=function(){return f.checkState(this.isPublicKeyOut(),"Can't retreive PublicKey from a non-PK output"),this.chunks[0].buf},y.prototype.getPublicKeyHash=function(){return f.checkState(this.isPublicKeyHashOut(),"Can't retrieve PublicKeyHash from a non-PKH output"),this.chunks[2].buf},y.prototype.isPublicKeyOut=function(){if(2===this.chunks.length&&this.chunks[0].buf&&this.chunks[0].buf.length&&this.chunks[1].opcodenum===a.OP_CHECKSIG){var e=this.chunks[0].buf,t=e[0],n=!1;if((4!==t&&6!==t&&7!==t||65!==e.length)&&(3!==t&&2!==t||33!==e.length)||(n=!0),n)return u.isValid(e)}return!1},y.prototype.isPublicKeyIn=function(){if(1===this.chunks.length){var e=this.chunks[0].buf;if(e&&e.length&&48===e[0])return!0}return!1},y.prototype.isScriptHashOut=function(){var e=this.toBuffer();return 23===e.length&&e[0]===a.OP_HASH160&&20===e[1]&&e[e.length-1]===a.OP_EQUAL},y.prototype.isScriptHashIn=function(){if(this.chunks.length<=1)return!1;var e=this.chunks[this.chunks.length-1],t=e.buf,n;if(!t)return!1;try{n=y.fromBuffer(t)}catch(e){if(e instanceof p.Script.InvalidBuffer)return!1;throw e}var r=n.classify();return r!==y.types.UNKNOWN},y.prototype.isMultisigOut=function(){return this.chunks.length>3&&a.isSmallIntOp(this.chunks[0].opcodenum)&&this.chunks.slice(1,this.chunks.length-2).every(function(e){return e.buf&&m.isBuffer(e.buf)})&&a.isSmallIntOp(this.chunks[this.chunks.length-2].opcodenum)&&this.chunks[this.chunks.length-1].opcodenum===a.OP_CHECKMULTISIG},y.prototype.isMultisigIn=function(){return this.chunks.length>=2&&0===this.chunks[0].opcodenum&&this.chunks.slice(1,this.chunks.length).every(function(e){return e.buf&&m.isBuffer(e.buf)&&l.isTxDER(e.buf)})},y.prototype.isDataOut=function(){return this.chunks.length>=1&&this.chunks[0].opcodenum===a.OP_RETURN&&(1===this.chunks.length||2===this.chunks.length&&this.chunks[1].buf&&this.chunks[1].buf.length<=y.OP_RETURN_STANDARD_SIZE&&this.chunks[1].length===this.chunks.len)},y.prototype.getData=function(){if(this.isDataOut()||this.isScriptHashOut())return h.isUndefined(this.chunks[1])?new t(0):new t(this.chunks[1].buf);if(this.isPublicKeyHashOut())return new t(this.chunks[2].buf);throw new Error("Unrecognized script type to get data from")},y.prototype.isPushOnly=function(){return h.every(this.chunks,function(e){return e.opcodenum<=a.OP_16})},y.types={},y.types.UNKNOWN="Unknown",y.types.PUBKEY_OUT="Pay to public key",y.types.PUBKEY_IN="Spend from public key",y.types.PUBKEYHASH_OUT="Pay to public key hash",y.types.PUBKEYHASH_IN="Spend from public key hash",y.types.SCRIPTHASH_OUT="Pay to script hash",y.types.SCRIPTHASH_IN="Spend from script hash",y.types.MULTISIG_OUT="Pay to multisig",y.types.MULTISIG_IN="Spend from multisig",y.types.DATA_OUT="Data push",y.OP_RETURN_STANDARD_SIZE=80,y.prototype.classify=function(){if(this._isInput)return this.classifyInput();if(this._isOutput)return this.classifyOutput();var e=this.classifyOutput();return e!=y.types.UNKNOWN?e:this.classifyInput()},y.outputIdentifiers={},y.outputIdentifiers.PUBKEY_OUT=y.prototype.isPublicKeyOut,y.outputIdentifiers.PUBKEYHASH_OUT=y.prototype.isPublicKeyHashOut,y.outputIdentifiers.MULTISIG_OUT=y.prototype.isMultisigOut,y.outputIdentifiers.SCRIPTHASH_OUT=y.prototype.isScriptHashOut,y.outputIdentifiers.DATA_OUT=y.prototype.isDataOut,y.prototype.classifyOutput=function(){for(var e in y.outputIdentifiers)if(y.outputIdentifiers[e].bind(this)())return y.types[e];return y.types.UNKNOWN},y.inputIdentifiers={},y.inputIdentifiers.PUBKEY_IN=y.prototype.isPublicKeyIn,y.inputIdentifiers.PUBKEYHASH_IN=y.prototype.isPublicKeyHashIn,y.inputIdentifiers.MULTISIG_IN=y.prototype.isMultisigIn,y.inputIdentifiers.SCRIPTHASH_IN=y.prototype.isScriptHashIn,y.prototype.classifyInput=function(){for(var e in y.inputIdentifiers)if(y.inputIdentifiers[e].bind(this)())return y.types[e];return y.types.UNKNOWN},y.prototype.isStandard=function(){return this.classify()!==y.types.UNKNOWN},y.prototype.prepend=function(e){return this._addByType(e,!0),this},y.prototype.equals=function(e){if(f.checkState(e instanceof y,"Must provide another script"),this.chunks.length!==e.chunks.length)return!1;var t;for(t=0;t=0&&r=1&&n[0]<=16?r===a.OP_1+(n[0]-1):1===n.length&&129===n[0]?r===a.OP_1NEGATE:n.length<=75?r===n.length:n.length<=255?r===a.OP_PUSHDATA1:!(n.length<=65535)||r===a.OP_PUSHDATA2)},y.prototype._decodeOP_N=function(e){if(e===a.OP_0)return 0;if(e>=a.OP_1&&e<=a.OP_16)return e-(a.OP_1-1);throw new Error("Invalid opcode: "+JSON.stringify(e))},y.prototype.getSignatureOperationsCount=function(e){e=!!h.isUndefined(e)||e;var t=this,n=0,r=a.OP_INVALIDOPCODE;return h.each(t.chunks,function i(o){var s=o.opcodenum;s==a.OP_CHECKSIG||s==a.OP_CHECKSIGVERIFY?n++:s!=a.OP_CHECKMULTISIG&&s!=a.OP_CHECKMULTISIGVERIFY||(e&&r>=a.OP_1&&r<=a.OP_16?n+=t._decodeOP_N(r):n+=20),r=s}),n},e.exports=y}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=n(17),i=n(25),o=n(40),s=n(87),a=n(129),u=n(359);function l(e){if(!(this instanceof l))return new l(e);i.checkArgument(r.isObject(e),"Must provide an object from where to extract data");var t=e.address?new a(e.address):void 0,n=e.txid?e.txid:e.txId;if(!n||!o.isHexaString(n)||n.length>64)throw new Error("Invalid TXID in object",e);var c=r.isUndefined(e.vout)?e.outputIndex:e.vout;if(!r.isNumber(c))throw new Error("Invalid outputIndex, received "+c);i.checkArgument(!r.isUndefined(e.scriptPubKey)||!r.isUndefined(e.script),"Must provide the scriptPubKey for that output!");var f=new s(e.scriptPubKey||e.script);i.checkArgument(!r.isUndefined(e.amount)||!r.isUndefined(e.satoshis),"Must provide an amount for the output");var h=r.isUndefined(e.amount)?e.satoshis:new u.fromBTC(e.amount).toSatoshis();i.checkArgument(r.isNumber(h),"Amount must be a number"),o.defineImmutable(this,{address:t,txId:n,outputIndex:c,script:f,satoshis:h})}l.prototype.inspect=function(){return""},l.prototype.toString=function(){return this.txId+":"+this.outputIndex},l.fromObject=function(e){return new l(e)},l.prototype.toObject=l.prototype.toJSON=function e(){return{address:this.address?this.address.toString():void 0,txid:this.txId,vout:this.outputIndex,scriptPubKey:this.script.toBuffer().toString("hex"),amount:u.fromSatoshis(this.satoshis).toBTC()}},e.exports=l},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(276),o=n(30),s=n(109),a=n(79),u=n(59),l=n(40),c=n(274),f=n(25);function h(e){if(!(this instanceof h))return new h(e);var t={};if(o.isBuffer(e))t=h._fromBufferReader(s(e));else{if(!r.isObject(e))throw new TypeError("Unrecognized argument for MerkleBlock");var n;n=e.header instanceof i?e.header:i.fromObject(e.header),t={header:n,numTransactions:e.numTransactions,hashes:e.hashes,flags:e.flags}}return r.extend(this,t),this._flagBitsUsed=0,this._hashesUsed=0,this}h.fromBuffer=function e(t){return h.fromBufferReader(s(t))},h.fromBufferReader=function e(t){return new h(h._fromBufferReader(t))},h.prototype.toBuffer=function e(){return this.toBufferWriter().concat()},h.prototype.toBufferWriter=function e(n){n||(n=new a),n.write(this.header.toBuffer()),n.writeUInt32LE(this.numTransactions),n.writeVarintNum(this.hashes.length);for(var r=0;rthis.numTransactions)return!1;if(8*this.flags.length8*this.flags.length)return null;var o=this.flags[i.flagBitsUsed>>3]>>>(7&i.flagBitsUsed++)&1;if(0!==n&&o){var s=this._traverseMerkleTree(n-1,2*r,i),a=s;return 2*r+1=this.hashes.length)return null;var l=this.hashes[i.hashesUsed++];return 0===n&&o&&i.txs.push(l),new t(l,"hex")},h.prototype._calcTreeWidth=function e(t){return this.numTransactions+(1<>t},h.prototype._calcTreeHeight=function e(){for(var t=0;this._calcTreeWidth(t)>1;)t++;return t},h.prototype.hasTransaction=function e(n){f.checkArgument(!r.isUndefined(n),"tx cannot be undefined"),f.checkArgument(n instanceof c||"string"==typeof n,'Invalid tx given, tx must be a "string" or "Transaction"');var i=n;n instanceof c&&(i=o.reverse(new t(n.id,"hex")).toString("hex"));var s=[],a=this._calcTreeHeight();return this._traverseMerkleTree(a,0,{txs:s}),-1!==s.indexOf(i)},h._fromBufferReader=function e(t){f.checkState(!t.finished(),"No merkleblock data received");var n={};n.header=i.fromBufferReader(t),n.numTransactions=t.readUInt32LE();var r=t.readVarintNum();n.hashes=[];for(var o=0;o=0&&e=S.Hardened||t,e64)throw new y.InvalidEntropyArgument.TooMuchEntropy(e);var r=c.sha512hmac(e,new i.Buffer("Bitcoin seed"));return new S({network:f.get(n)||f.defaultNetwork,depth:0,parentFingerPrint:0,childIndex:0,privateKey:r.slice(0,32),chainCode:r.slice(32,64)})},S.prototype._calcHDPublicKey=function(){if(!this._hdPublicKey){var e=n(602);this._hdPublicKey=new e(this)}},S.prototype._buildFromBuffers=function(e){S._validateBufferArguments(e),v.defineImmutable(this,{_buffers:e});var n=[e.version,e.depth,e.parentFingerPrint,e.childIndex,e.chainCode,b.emptyBuffer(1),e.privateKey],r=i.Buffer.concat(n);if(e.checksum&&e.checksum.length){if(e.checksum.toString()!==l.checksum(r).toString())throw new g.InvalidB58Checksum(r)}else e.checksum=l.checksum(r);var o=f.get(b.integerFromBuffer(e.version)),s;s=l.encode(i.Buffer.concat(n)),e.xprivkey=new t(s);var u=new d(a.fromBuffer(e.privateKey),o),h=u.toPublicKey(),p=S.ParentFingerPrintSize,m=c.sha256ripemd160(h.toBuffer()).slice(0,p);return v.defineImmutable(this,{xprivkey:s,network:o,depth:b.integerFromSingleByteBuffer(e.depth),privateKey:u,publicKey:h,fingerPrint:m}),this._hdPublicKey=null,Object.defineProperty(this,"hdPublicKey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey}}),Object.defineProperty(this,"xpubkey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey.xpubkey}}),this},S._validateBufferArguments=function(e){var t=function(t,n){var i=e[t];r(b.isBuffer(i),t+" argument is not a buffer"),r(i.length===n,t+" has not the expected size: found "+i.length+", expected "+n)};t("version",S.VersionSize),t("depth",S.DepthSize),t("parentFingerPrint",S.ParentFingerPrintSize),t("childIndex",S.ChildIndexSize),t("chainCode",S.ChainCodeSize),t("privateKey",S.PrivateKeySize),e.checksum&&e.checksum.length&&t("checksum",S.CheckSumSize)},S.prototype.toString=function(){return this.xprivkey},S.prototype.inspect=function(){return""},S.prototype.toObject=S.prototype.toJSON=function e(){return{network:f.get(b.integerFromBuffer(this._buffers.version),"xprivkey").name,depth:b.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:b.integerFromBuffer(this.fingerPrint),parentFingerPrint:b.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:b.integerFromBuffer(this._buffers.childIndex),chainCode:b.bufferToHex(this._buffers.chainCode),privateKey:this.privateKey.toBuffer().toString("hex"),checksum:b.integerFromBuffer(this._buffers.checksum),xprivkey:this.xprivkey}},S.fromBuffer=function(e){return new S(e.toString())},S.prototype.toBuffer=function(){return b.copy(this._buffers.xprivkey)},S.DefaultDepth=0,S.DefaultFingerprint=0,S.DefaultChildIndex=0,S.Hardened=2147483648,S.MaxIndex=2*S.Hardened,S.RootElementAlias=["m","M","m'","M'"],S.VersionSize=4,S.DepthSize=1,S.ParentFingerPrintSize=4,S.ChildIndexSize=4,S.ChainCodeSize=32,S.PrivateKeySize=32,S.CheckSumSize=4,S.DataLength=78,S.SerializedByteSize=82,S.VersionStart=0,S.VersionEnd=S.VersionStart+S.VersionSize,S.DepthStart=S.VersionEnd,S.DepthEnd=S.DepthStart+S.DepthSize,S.ParentFingerPrintStart=S.DepthEnd,S.ParentFingerPrintEnd=S.ParentFingerPrintStart+S.ParentFingerPrintSize,S.ChildIndexStart=S.ParentFingerPrintEnd,S.ChildIndexEnd=S.ChildIndexStart+S.ChildIndexSize,S.ChainCodeStart=S.ChildIndexEnd,S.ChainCodeEnd=S.ChainCodeStart+S.ChainCodeSize,S.PrivateKeyStart=S.ChainCodeEnd+1,S.PrivateKeyEnd=S.PrivateKeyStart+S.PrivateKeySize,S.ChecksumStart=S.PrivateKeyEnd,S.ChecksumEnd=S.ChecksumStart+S.CheckSumSize,r(S.ChecksumEnd===S.SerializedByteSize),e.exports=S}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){var r=n(17),i=n(25),o=n(51),s=n(273),a=n(194),u=n(59),l=n(601),c=n(360),f=n(128),h=n(152),p=n(94),d=n(85),m=d,g=d.HDPublicKey,y=n(18),b=n(40),v=n(30);function _(e){if(e instanceof _)return e;if(!(this instanceof _))return new _(e);if(e){if(r.isString(e)||v.isBuffer(e)){var t=_.getSerializedError(e);if(t){if(v.isBuffer(e)&&!_.getSerializedError(e.toString()))return this._buildFromSerialized(e.toString());if(t instanceof g.ArgumentIsPrivateExtended)return new l(e).hdPublicKey;throw t}return this._buildFromSerialized(e)}if(r.isObject(e))return e instanceof l?this._buildFromPrivate(e):this._buildFromObject(e);throw new g.UnrecognizedArgument(e)}throw new g.MustSupplyArgument}_.isValidPath=function(e){if(r.isString(e)){var t=l._getDerivationIndexes(e);return null!==t&&r.all(t,_.isValidPath)}return!!r.isNumber(e)&&(e>=0&&e<_.Hardened)},_.prototype.derive=function(e,t){if(r.isNumber(e))return this._deriveWithNumber(e,t);if(r.isString(e))return this._deriveFromString(e);throw new g.InvalidDerivationArgument(e)},_.prototype._deriveWithNumber=function(e,t){if(e>=_.Hardened||t)throw new g.InvalidIndexCantDeriveHardened;if(e<0)throw new g.InvalidPath(e);var n=c.get(this.xpubkey,e,!1);if(n)return n;var r=v.integerAsBuffer(e),i=v.concat([this.publicKey.toBuffer(),r]),s=u.sha512hmac(i,this._buffers.chainCode),a=o.fromBuffer(s.slice(0,32),{size:32}),l=s.slice(32,64),f=p.fromPoint(h.getG().mul(a).add(this.publicKey.point)),d=new _({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:e,chainCode:l,publicKey:f});return c.set(this.xpubkey,e,!1,d),d},_.prototype._deriveFromString=function(e){if(r.contains(e,"'"))throw new g.InvalidIndexCantDeriveHardened;if(!_.isValidPath(e))throw new g.InvalidPath(e);var t=l._getDerivationIndexes(e),n=t.reduce(function(e,t){return e._deriveWithNumber(t)},this);return n},_.isValidSerialized=function(e,t){return r.isNull(_.getSerializedError(e,t))},_.getSerializedError=function(e,t){if(!r.isString(e)&&!v.isBuffer(e))return new g.UnrecognizedArgument("expected buffer or string");if(!s.validCharacters(e))return new m.InvalidB58Char("(unknown)",e);try{e=a.decode(e)}catch(t){return new m.InvalidB58Checksum(e)}if(e.length!==_.DataSize)return new g.InvalidLength(e);if(!r.isUndefined(t)){var n=_._validateNetwork(e,t);if(n)return n}var i=v.integerFromBuffer(e.slice(0,4));return i===f.livenet.xprivkey||i===f.testnet.xprivkey?new g.ArgumentIsPrivateExtended:null},_._validateNetwork=function(e,t){var n=f.get(t);if(!n)return new m.InvalidNetworkArgument(t);var r=e.slice(_.VersionStart,_.VersionEnd);return v.integerFromBuffer(r)!==n.xpubkey?new m.InvalidNetwork(r):null},_.prototype._buildFromPrivate=function(e){var t=r.clone(e._buffers),n=h.getG().mul(o.fromBuffer(t.privateKey));return t.publicKey=h.pointToCompressed(n),t.version=v.integerAsBuffer(f.get(v.integerFromBuffer(t.version)).xpubkey),t.privateKey=void 0,t.checksum=void 0,t.xprivkey=void 0,this._buildFromBuffers(t)},_.prototype._buildFromObject=function(e){var t={version:e.network?v.integerAsBuffer(f.get(e.network).xpubkey):e.version,depth:r.isNumber(e.depth)?v.integerAsSingleByteBuffer(e.depth):e.depth,parentFingerPrint:r.isNumber(e.parentFingerPrint)?v.integerAsBuffer(e.parentFingerPrint):e.parentFingerPrint,childIndex:r.isNumber(e.childIndex)?v.integerAsBuffer(e.childIndex):e.childIndex,chainCode:r.isString(e.chainCode)?v.hexToBuffer(e.chainCode):e.chainCode,publicKey:r.isString(e.publicKey)?v.hexToBuffer(e.publicKey):v.isBuffer(e.publicKey)?e.publicKey:e.publicKey.toBuffer(),checksum:r.isNumber(e.checksum)?v.integerAsBuffer(e.checksum):e.checksum};return this._buildFromBuffers(t)},_.prototype._buildFromSerialized=function(e){var t=a.decode(e),n={version:t.slice(_.VersionStart,_.VersionEnd),depth:t.slice(_.DepthStart,_.DepthEnd),parentFingerPrint:t.slice(_.ParentFingerPrintStart,_.ParentFingerPrintEnd),childIndex:t.slice(_.ChildIndexStart,_.ChildIndexEnd),chainCode:t.slice(_.ChainCodeStart,_.ChainCodeEnd),publicKey:t.slice(_.PublicKeyStart,_.PublicKeyEnd),checksum:t.slice(_.ChecksumStart,_.ChecksumEnd),xpubkey:e};return this._buildFromBuffers(n)},_.prototype._buildFromBuffers=function(e){_._validateBufferArguments(e),b.defineImmutable(this,{_buffers:e});var n=[e.version,e.depth,e.parentFingerPrint,e.childIndex,e.chainCode,e.publicKey],r=v.concat(n),i=a.checksum(r);if(e.checksum&&e.checksum.length){if(e.checksum.toString("hex")!==i.toString("hex"))throw new m.InvalidB58Checksum(r,i)}else e.checksum=i;var o=f.get(v.integerFromBuffer(e.version)),s;s=a.encode(v.concat(n)),e.xpubkey=new t(s);var l=new p(e.publicKey,{network:o}),c=_.ParentFingerPrintSize,h=u.sha256ripemd160(l.toBuffer()).slice(0,c);return b.defineImmutable(this,{xpubkey:s,network:o,depth:v.integerFromSingleByteBuffer(e.depth),publicKey:l,fingerPrint:h}),this},_._validateBufferArguments=function(e){var t=function(t,n){var r=e[t];y(v.isBuffer(r),t+" argument is not a buffer, it's "+typeof r),y(r.length===n,t+" has not the expected size: found "+r.length+", expected "+n)};t("version",_.VersionSize),t("depth",_.DepthSize),t("parentFingerPrint",_.ParentFingerPrintSize),t("childIndex",_.ChildIndexSize),t("chainCode",_.ChainCodeSize),t("publicKey",_.PublicKeySize),e.checksum&&e.checksum.length&&t("checksum",_.CheckSumSize)},_.fromString=function(e){return i.checkArgument(r.isString(e),"No valid string was provided"),new _(e)},_.fromObject=function(e){return i.checkArgument(r.isObject(e),"No valid argument was provided"),new _(e)},_.prototype.toString=function(){return this.xpubkey},_.prototype.inspect=function(){return""},_.prototype.toObject=_.prototype.toJSON=function e(){return{network:f.get(v.integerFromBuffer(this._buffers.version)).name,depth:v.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:v.integerFromBuffer(this.fingerPrint),parentFingerPrint:v.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:v.integerFromBuffer(this._buffers.childIndex),chainCode:v.bufferToHex(this._buffers.chainCode),publicKey:this.publicKey.toString(),checksum:v.integerFromBuffer(this._buffers.checksum),xpubkey:this.xpubkey}},_.fromBuffer=function(e){return new _(e)},_.prototype.toBuffer=function(){return v.copy(this._buffers.xpubkey)},_.Hardened=2147483648,_.RootElementAlias=["m","M"],_.VersionSize=4,_.DepthSize=1,_.ParentFingerPrintSize=4,_.ChildIndexSize=4,_.ChainCodeSize=32,_.PublicKeySize=33,_.CheckSumSize=4,_.DataSize=78,_.SerializedByteSize=82,_.VersionStart=0,_.VersionEnd=_.VersionStart+_.VersionSize,_.DepthStart=_.VersionEnd,_.DepthEnd=_.DepthStart+_.DepthSize,_.ParentFingerPrintStart=_.DepthEnd,_.ParentFingerPrintEnd=_.ParentFingerPrintStart+_.ParentFingerPrintSize,_.ChildIndexStart=_.ParentFingerPrintEnd,_.ChildIndexEnd=_.ChildIndexStart+_.ChildIndexSize,_.ChainCodeStart=_.ChildIndexEnd,_.ChainCodeEnd=_.ChainCodeStart+_.ChainCodeSize,_.PublicKeyStart=_.ChainCodeEnd,_.PublicKeyEnd=_.PublicKeyStart+_.PublicKeySize,_.ChecksumStart=_.PublicKeyEnd,_.ChecksumEnd=_.ChecksumStart+_.CheckSumSize,y(_.PublicKeyEnd===_.DataSize),y(_.ChecksumEnd===_.SerializedByteSize),e.exports=_}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(3),i=n(198),o=n(28),s=n(150),a=n(336),u=n(186).isSource,l=n(153),c=n(199);e.exports=(e=>{const n=c(e,"add"),f=r((e,r,c)=>{"function"==typeof r&&(c=r,r=null);const f=o(c);r||(r={}),r.converter=l;const h=e=>t.isBuffer(e)||s.readable(e)||u(e),p=e=>"object"==typeof e&&(e.content?h(e.content):Boolean(e.path)&&a(e.path)),d=e=>h(e)||p(e),m=d(e)||Array.isArray(e)&&e.every(d);if(!m)return f(new Error("invalid input: expected buffer, readable stream, pull stream, object or array of objects"));const g=[].concat(e),y=n({qs:r}),b=i(e=>f(null,e));y.once("error",f),y.pipe(b),g.forEach(e=>y.write(e)),y.end()});return function(){const e=Array.from(arguments);return 1===e.length&&u(e[0])&&e.push({}),f.apply(null,e)}})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(1465),i=n(201);e.exports=(e=>0===e.indexOf("https")?i.request:r.request)},function(e,t,n){(function(e){var n;function r(){if(void 0!==n)return n;if(e.XMLHttpRequest){n=new e.XMLHttpRequest;try{n.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){n=null}}else n=null;return n}function i(e){var t=r();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}function o(e){return"function"==typeof e}t.fetch=o(e.fetch)&&o(e.ReadableStream),t.writableStream=o(e.WritableStream),t.abortController=o(e.AbortController),t.arraybuffer=t.fetch||i("arraybuffer"),t.msstream=!t.fetch&&i("ms-stream"),t.mozchunkedarraybuffer=!t.fetch&&i("moz-chunked-arraybuffer"),t.overrideMimeType=t.fetch||!!r()&&o(r().overrideMimeType),n=null}).call(this,n(8))},function(e,t,n){(function(e,r,i){var o=n(605),s=n(1),a=n(21),u=t.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},l=t.IncomingMessage=function(t,n,s,u){var l=this;if(a.Readable.call(l),l._mode=s,l.headers={},l.rawHeaders=[],l.trailers={},l.rawTrailers=[],l.on("end",function(){e.nextTick(function(){l.emit("close")})}),"fetch"===s){if(l._fetchResponse=n,l.url=n.url,l.statusCode=n.status,l.statusMessage=n.statusText,n.headers.forEach(function(e,t){l.headers[t.toLowerCase()]=e,l.rawHeaders.push(t,e)}),o.writableStream){var c=new WritableStream({write:function(e){return new Promise(function(t,n){l._destroyed?n():l.push(r.from(e))?t():l._resumeFetch=t})},close:function(){i.clearTimeout(u),l._destroyed||l.push(null)},abort:function(e){l._destroyed||l.emit("error",e)}});try{return void n.body.pipeTo(c).catch(function(e){i.clearTimeout(u),l._destroyed||l.emit("error",e)})}catch(e){}}var f=n.body.getReader();function h(){f.read().then(function(e){if(!l._destroyed){if(e.done)return i.clearTimeout(u),void l.push(null);l.push(r.from(e.value)),h()}}).catch(function(e){i.clearTimeout(u),l._destroyed||l.emit("error",e)})}h()}else{l._xhr=t,l._pos=0,l.url=t.responseURL,l.statusCode=t.status,l.statusMessage=t.statusText;var p=t.getAllResponseHeaders().split(/\r?\n/);if(p.forEach(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var n=t[1].toLowerCase();"set-cookie"===n?(void 0===l.headers[n]&&(l.headers[n]=[]),l.headers[n].push(t[2])):void 0!==l.headers[n]?l.headers[n]+=", "+t[2]:l.headers[n]=t[2],l.rawHeaders.push(t[1],t[2])}}),l._charset="x-user-defined",!o.overrideMimeType){var d=l.rawHeaders["mime-type"];if(d){var m=d.match(/;\s*charset=([^;])(;|$)/);m&&(l._charset=m[1].toLowerCase())}l._charset||(l._charset="utf-8")}}};s(l,a.Readable),l.prototype._read=function(){var e=this,t=this._resumeFetch;t&&(this._resumeFetch=null,t())},l.prototype._onXHRProgress=function(){var e=this,t=e._xhr,n=null;switch(e._mode){case"text":if(n=t.responseText,n.length>e._pos){var o=n.substr(e._pos);if("x-user-defined"===e._charset){for(var s=r.alloc(o.length),a=0;ae._pos&&(e.push(r.from(new Uint8Array(l.result.slice(e._pos)))),e._pos=l.result.byteLength)},l.onload=function(){e.push(null)},l.readAsArrayBuffer(n)}e._xhr.readyState===u.DONE&&"ms-stream"!==e._mode&&e.push(null)}}).call(this,n(2),n(0).Buffer,n(8))},function(e,t){e.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"}},function(e,t,n){(function(e){t.fetch=a(e.fetch)&&a(e.ReadableStream),t.writableStream=a(e.WritableStream),t.abortController=a(e.AbortController),t.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),t.blobConstructor=!0}catch(e){}var n;function r(){if(void 0!==n)return n;if(e.XMLHttpRequest){n=new e.XMLHttpRequest;try{n.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){n=null}}else n=null;return n}function i(e){var t=r();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}var o=void 0!==e.ArrayBuffer,s=o&&a(e.ArrayBuffer.prototype.slice);function a(e){return"function"==typeof e}t.arraybuffer=t.fetch||o&&i("arraybuffer"),t.msstream=!t.fetch&&s&&i("ms-stream"),t.mozchunkedarraybuffer=!t.fetch&&o&&i("moz-chunked-arraybuffer"),t.overrideMimeType=t.fetch||!!r()&&a(r().overrideMimeType),t.vbArray=a(e.VBArray),n=null}).call(this,n(8))},function(e,t,n){(function(e,r,i){var o=n(608),s=n(1),a=n(610),u=t.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},l=t.IncomingMessage=function(t,n,s,u){var l=this;if(a.Readable.call(l),l._mode=s,l.headers={},l.rawHeaders=[],l.trailers={},l.rawTrailers=[],l.on("end",function(){e.nextTick(function(){l.emit("close")})}),"fetch"===s){if(l._fetchResponse=n,l.url=n.url,l.statusCode=n.status,l.statusMessage=n.statusText,n.headers.forEach(function(e,t){l.headers[t.toLowerCase()]=e,l.rawHeaders.push(t,e)}),o.writableStream){var c=new WritableStream({write:function(e){return new Promise(function(t,n){l._destroyed?n():l.push(new r(e))?t():l._resumeFetch=t})},close:function(){i.clearTimeout(u),l._destroyed||l.push(null)},abort:function(e){l._destroyed||l.emit("error",e)}});try{return void n.body.pipeTo(c).catch(function(e){i.clearTimeout(u),l._destroyed||l.emit("error",e)})}catch(e){}}var f=n.body.getReader();function h(){f.read().then(function(e){if(!l._destroyed){if(e.done)return i.clearTimeout(u),void l.push(null);l.push(new r(e.value)),h()}}).catch(function(e){i.clearTimeout(u),l._destroyed||l.emit("error",e)})}h()}else{l._xhr=t,l._pos=0,l.url=t.responseURL,l.statusCode=t.status,l.statusMessage=t.statusText;var p=t.getAllResponseHeaders().split(/\r?\n/);if(p.forEach(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var n=t[1].toLowerCase();"set-cookie"===n?(void 0===l.headers[n]&&(l.headers[n]=[]),l.headers[n].push(t[2])):void 0!==l.headers[n]?l.headers[n]+=", "+t[2]:l.headers[n]=t[2],l.rawHeaders.push(t[1],t[2])}}),l._charset="x-user-defined",!o.overrideMimeType){var d=l.rawHeaders["mime-type"];if(d){var m=d.match(/;\s*charset=([^;])(;|$)/);m&&(l._charset=m[1].toLowerCase())}l._charset||(l._charset="utf-8")}}};s(l,a.Readable),l.prototype._read=function(){var e=this,t=this._resumeFetch;t&&(this._resumeFetch=null,t())},l.prototype._onXHRProgress=function(){var e=this,t=e._xhr,n=null;switch(e._mode){case"text:vbarray":if(t.readyState!==u.DONE)break;try{n=new i.VBArray(t.responseBody).toArray()}catch(e){}if(null!==n){e.push(new r(n));break}case"text":try{n=t.responseText}catch(t){e._mode="text:vbarray";break}if(n.length>e._pos){var o=n.substr(e._pos);if("x-user-defined"===e._charset){for(var s=new r(o.length),a=0;ae._pos&&(e.push(new r(new Uint8Array(l.result.slice(e._pos)))),e._pos=l.result.byteLength)},l.onload=function(){e.push(null)},l.readAsArrayBuffer(n)}e._xhr.readyState===u.DONE&&"ms-stream"!==e._mode&&e.push(null)}}).call(this,n(2),n(0).Buffer,n(8))},function(e,t,n){t=e.exports=n(611),t.Stream=t,t.Readable=t,t.Writable=n(614),t.Duplex=n(155),t.Transform=n(615),t.PassThrough=n(1471)},function(e,t,n){"use strict";(function(t,r){var i=n(10);e.exports=S;var o=n(48),s;S.ReadableState=k;var a=n(6).EventEmitter,u=function(e,t){return e.listeners(t).length},l=n(612),c=n(4).Buffer,f=t.Uint8Array||function(){};function h(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof f}var d=n(7);d.inherits=n(1);var m=n(1468),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(1469),b=n(613),v;d.inherits(S,l);var _=["error","close","destroy","pause","resume"];function w(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function k(e,t){s=s||n(155),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=n(14).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function S(e){if(s=s||n(155),!(this instanceof S))return new S(e);this._readableState=new k(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),l.call(this)}function E(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,O(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.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,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),_()}function v(){g("onfinish"),e.removeListener("close",b),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(49)},f=n(612),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(613),y;function b(){}function v(e,t){u=u||n(155),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||n(155),!(y.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(155),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.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,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),_()}function v(){g("onfinish"),e.removeListener("close",b),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(49)},f=n(618),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(619),y;function b(){}function v(e,t){u=u||n(156),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||n(156),!(y.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(156),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length=t?t:e>=0?e:(e+=t,e>=0?e:0))},f=function(e){switch(e){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null},h=function(e){switch(e){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0},p=function(e,t,n,r){for(;nt?s.slice(0,t)+" ":o.slice(0,t-e.length)+e+" "};function g(e){var t;if(128===e[0])t=!0;else{if(255!==e[0])return null;t=!1}for(var n=!1,r=[],i=e.length-1;i>0;i--){var o=e[i];t?r.push(o):n&&0===o?r.push(0):n?(n=!1,r.push(256-o)):r.push(255-o)}var s=0,a=r.length;for(i=0;i=Math.pow(10,r)&&r++,n+r+t};t.decodeLongPath=function(e,t){return b(e,0,e.length,t)},t.encodePax=function(e){var t="";e.name&&(t+=v(" path="+e.name+"\n")),e.linkname&&(t+=v(" linkpath="+e.linkname+"\n"));var n=e.pax;if(n)for(var i in n)t+=v(" "+i+"="+n[i]+"\n");return r(t)},t.decodePax=function(e){for(var t={};e.length;){for(var n=0;n100;){var s=r.indexOf("/");if(-1===s)return null;o+=o?"/"+r.slice(0,s):r.slice(0,s),r=r.slice(s+1)}return e.byteLength(r)>100||e.byteLength(o)>155?null:t.linkname&&e.byteLength(t.linkname)>100?null:(n.write(r),n.write(m(t.mode&l,6),100),n.write(m(t.uid,6),108),n.write(m(t.gid,6),116),n.write(m(t.size,11),124),n.write(m(t.mtime.getTime()/1e3|0,11),136),n[156]=a+h(t.type),t.linkname&&n.write(t.linkname,157),n.write(u,257),t.uname&&n.write(t.uname,265),t.gname&&n.write(t.gname,297),n.write(m(t.devmajor||0,6),329),n.write(m(t.devminor||0,6),337),o&&n.write(o,345),n.write(m(d(n),6),148),n)},t.decode=function(e,t){var n=0===e[156]?0:e[156]-a,r=b(e,0,100,t),i=y(e,100,8),o=y(e,108,8),s=y(e,116,8),u=y(e,124,12),l=y(e,136,12),c=f(n),h=0===e[157]?null:b(e,157,100,t),p=b(e,265,32),m=b(e,297,32),g=y(e,329,8),v=y(e,337,8);e[345]&&(r=b(e,345,155,t)+"/"+r),0===n&&r&&"/"===r[r.length-1]&&(n=5);var _=d(e);if(256===_)return null;if(_!==y(e,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");return{name:r,mode:i,uid:o,gid:s,size:u,mtime:new Date(1e3*l),type:c,linkname:h,uname:p,gname:m,devmajor:g,devminor:v}}}).call(this,n(0).Buffer)},function(e,t,n){(function(t){e.exports=i;var n=t.from&&t.from!==Uint8Array.from?t.from:r;function r(e,n){return new t(e,n)}function i(e,r){if(t.isBuffer(e))return e;if("string"==typeof e)return n(e,r);if(Array.isArray(e))return n(e);throw new Error("Input should be a buffer or a string")}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t,r){var i=n(10);e.exports=S;var o=n(48),s;S.ReadableState=k;var a=n(6).EventEmitter,u=function(e,t){return e.listeners(t).length},l=n(627),c=n(4).Buffer,f=t.Uint8Array||function(){};function h(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof f}var d=n(7);d.inherits=n(1);var m=n(1493),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(1494),b=n(628),v;d.inherits(S,l);var _=["error","close","destroy","pause","resume"];function w(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function k(e,t){s=s||n(157),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=n(14).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function S(e){if(s=s||n(157),!(this instanceof S))return new S(e);this._readableState=new k(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),l.call(this)}function E(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,O(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.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,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),_()}function v(){g("onfinish"),e.removeListener("close",b),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(49)},f=n(627),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(628),y;function b(){}function v(e,t){u=u||n(157),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||n(157),!(y.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(157),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length({"api-path":"/api/v0/","user-agent":`/node-${r.name}/${r.version}/`,host:"localhost",port:"5001",protocol:"http"}))},function(e,t,n){"use strict";(function(r){const i=n(1505),o=n(363).encode,s=n(200),a=n(364),u=n(58),l=n(28),c=n(112),f=n(1514),h=n(604),p=n(5)("ipfs-http-client:request");function d(e,t){const n=new Error(`Server responded with ${e.statusCode}`);f(e,(e,r)=>{if(e)return t(e);r&&(n.code=r.Code,n.message=r.Message||r.toString(),n.type=r.Type),t(n)})}function m(e,t){return n=>{const r=Boolean(n.headers["x-stream-output"]),i=Boolean(n.headers["x-chunked-output"]),o=n.headers["content-type"]&&0===n.headers["content-type"].indexOf("application/json");if(n.req?p(n.req.method,`${n.req.getHeaders().host}${n.req.path}`,n.statusCode,n.statusMessage):p(n.url,n.statusCode,n.statusMessage),n.statusCode>=400||!n.statusCode)return d(n,t);if(r&&!e)return t(null,n);if(i&&o){const e=a.parse();return u(n,e),n.on("end",()=>{let t=n.trailers["x-stream-error"];if(t){try{t=JSON.parse(t)}catch(e){t={Message:t}}e.emit("error",new Error(t.Message))}}),t(null,e)}return o?f(n,t):c(n,t)}}function g(e,t,n){n=l(n),t.qs=t.qs||{},Array.isArray(t.path)&&(t.path=t.path.join("/")),t.args&&!Array.isArray(t.args)&&(t.args=[t.args]),t.args&&(t.qs.arg=t.args),t.progress&&(t.qs.progress=!0),t.qs.r&&(t.qs.recursive=t.qs.r,delete t.qs.r),t.qs["stream-channels"]=!0,t.stream&&(t.buffer=!1),delete t.qs.followSymlinks;const a="POST",u=Object.assign({},e.headers);if(s&&(u["User-Agent"]=e["user-agent"]),t.multipart){if(!t.multipartBoundary)return n(new Error("No multipartBoundary"));u["Content-Type"]=`multipart/form-data; boundary=${t.multipartBoundary}`}const c=i.stringify(t.qs,{arrayFormat:"repeat",encoder:e=>{if(r.isBuffer(e)){let t="";for(const n of e)if(n>=65&&n<=90||n>=97&&n<=122||n>=48&&n<=57||45===n||46===n||95===n||126===n)t+=String.fromCharCode(n);else{const e=n.toString(16),r=1===e.length?`0${e}`:e;t+=`%${r}`}return t}return o(e)}}),f={hostname:e.host,path:`${e["api-path"]}${t.path}?${c}`,port:e.port,method:"POST",headers:u,protocol:`${e.protocol}:`},p=h(e.protocol)(f,m(t.buffer,n));return p.on("error",e=>{n(e)}),t.stream||p.end(),p}t=e.exports=(e=>{const t=(t,n)=>"object"!=typeof t?n(new Error("no options were passed")):g(e,t,n);return t.andTransform=((e,n,r)=>t(e,(e,t)=>{if(e)return r(e);n(t,r)})),t})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=String.prototype.replace,i=/%20/g;e.exports={default:"RFC3986",formatters:{RFC1738:function(e){return r.call(e,i,"+")},RFC3986:function(e){return e}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},function(e,t,n){(function(t){var r=n(1508).Transform,i=n(13).inherits,o=n(54);function s(e){r.call(this,e),this._destroyed=!1}function a(e,t,n){n(null,e)}function u(e){return function(t,n,r){return"function"==typeof t&&(r=n,n=t,t={}),"function"!=typeof n&&(n=a),"function"!=typeof r&&(r=null),e(t,n,r)}}i(s,r),s.prototype.destroy=function(e){if(!this._destroyed){this._destroyed=!0;var n=this;t.nextTick(function(){e&&n.emit("error",e),n.emit("close")})}},e.exports=u(function(e,t,n){var r=new s(e);return r._transform=t,n&&(r._flush=n),r}),e.exports.ctor=u(function(e,t,n){function r(t){if(!(this instanceof r))return new r(t);this.options=o(e,t),s.call(this,this.options)}return i(r,s),r.prototype._transform=t,n&&(r.prototype._flush=n),r}),e.exports.obj=u(function(e,t,n){var r=new s(o({objectMode:!0,highWaterMark:16},e));return r._transform=t,n&&(r._flush=n),r})}).call(this,n(2))},function(e,t,n){"use strict";(function(t,r){var i=n(10);e.exports=S;var o=n(48),s;S.ReadableState=k;var a=n(6).EventEmitter,u=function(e,t){return e.listeners(t).length},l=n(636),c=n(4).Buffer,f=t.Uint8Array||function(){};function h(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof f}var d=n(7);d.inherits=n(1);var m=n(1509),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(1510),b=n(637),v;d.inherits(S,l);var _=["error","close","destroy","pause","resume"];function w(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function k(e,t){s=s||n(158),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=n(14).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function S(e){if(s=s||n(158),!(this instanceof S))return new S(e);this._readableState=new k(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),l.call(this)}function E(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,O(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.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,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),_()}function v(){g("onfinish"),e.removeListener("close",b),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(49)},f=n(636),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(637),y;function b(){}function v(e,t){u=u||n(158),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||n(158),!(y.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(158),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?r.splice(s,1/0,i):r.push(i),~n.indexOf(o)&&(o=t.call(this,i,o))}else n.push(o);return null==e?o:e.call(this,i,o)}}t=e.exports=n,t.getSerialize=r},function(e,t,n){"use strict";const r=n(20);e.exports=(e=>{const t=r(e);return{get:n(1517)(t),stat:n(1518)(t),put:n(1519)(t)}})},function(e,t,n){"use strict";e.exports=(e=>{const t=e.pop();let n={},r=[];return Array.isArray(e[e.length-1])||"object"!=typeof e[e.length-1]||(n=e.pop()),r=1===e.length&&Array.isArray(e[0])?e[0]:e,{callback:t,sources:r,opts:n}})},function(e,t,n){var r=n(245),i=n(1630),o=n(1631),s=n(1632),a=n(1633),u=n(1634);function l(e){var t=this.__data__=new r(e);this.size=t.size}l.prototype.clear=i,l.prototype.delete=o,l.prototype.get=s,l.prototype.has=a,l.prototype.set=u,e.exports=l},function(e,t,n){var r=n(1635),i=n(103);function o(e,t,n,s,a){return e===t||(null==e||null==t||!i(e)&&!i(t)?e!=e&&t!=t:r(e,t,n,s,o,a))}e.exports=o},function(e,t,n){var r=n(1636),i=n(1639),o=n(1640),s=1,a=2;function u(e,t,n,u,l,c){var f=n&s,h=e.length,p=t.length;if(h!=p&&!(f&&p>h))return!1;var d=c.get(e);if(d&&c.get(t))return d==t;var m=-1,g=!0,y=n&a?new r:void 0;for(c.set(e,t),c.set(t,e);++m({name:e.Name,type:e.Type,size:e.Size,hash:e.Hash});e.exports=(e=>(t,n)=>{n=n||{};const l=new r({objectMode:!0,transform(e,t,n){n(null,u(e))}}),c=new i({objectMode:!0});return e({path:"files/ls",args:t,qs:Object.assign({},n,{stream:!0})},(e,t)=>{if(e)return c.destroy(e);if(a(t)){const e=s.parse();o(t,e,l,c)}else{const e=t.Entries||[];e.forEach(e=>{c.write(u(e))}),c.end()}}),c})},function(e,t,n){(function(e,n){var r=200,i="__lodash_hash_undefined__",o=9007199254740991,s="[object Arguments]",a="[object Array]",u="[object Boolean]",l="[object Date]",c="[object Error]",f="[object Function]",h="[object GeneratorFunction]",p="[object Map]",d="[object Number]",m="[object Object]",g="[object Promise]",y="[object RegExp]",b="[object Set]",v="[object String]",_="[object Symbol]",w="[object WeakMap]",k="[object ArrayBuffer]",S="[object DataView]",E="[object Float32Array]",x="[object Float64Array]",C="[object Int8Array]",A="[object Int16Array]",I="[object Int32Array]",T="[object Uint8Array]",j="[object Uint8ClampedArray]",O="[object Uint16Array]",P="[object Uint32Array]",B=/[\\^$.*+?()[\]{}|]/g,R=/\w*$/,N=/^\[object .+?Constructor\]$/,M=/^(?:0|[1-9]\d*)$/,L={};L[s]=L[a]=L[k]=L[S]=L[u]=L[l]=L[E]=L[x]=L[C]=L[A]=L[I]=L[p]=L[d]=L[m]=L[y]=L[b]=L[v]=L[_]=L[T]=L[j]=L[O]=L[P]=!0,L[c]=L[f]=L[w]=!1;var F="object"==typeof e&&e&&e.Object===Object&&e,D="object"==typeof self&&self&&self.Object===Object&&self,U=F||D||Function("return this")(),z=t&&!t.nodeType&&t,q=z&&"object"==typeof n&&n&&!n.nodeType&&n,K=q&&q.exports===z;function H(e,t){return e.set(t[0],t[1]),e}function V(e,t){return e.add(t),e}function W(e,t){for(var n=-1,r=e?e.length:0;++n-1}function Ve(e,t){var n=this.__data__,r=st(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}function We(e){var t=-1,n=e?e.length:0;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=o}function $t(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Gt(e){return!!e&&"object"==typeof e}function Yt(e){return qt(e)?it(e):pt(e)}function Jt(){return[]}function Zt(){return!1}n.exports=Ft}).call(this,n(8),n(75)(e))},function(e,t,n){"use strict";e.exports="ipfs-pubsub-room/v2"},function(e,t,n){"use strict";(function(t){e.exports=(e=>{let n=e;return t.isBuffer(n)||(n=t.from(n)),n})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=(e=>e._libp2pNode||e.libp2p)},function(e,t,n){(function(t){e.exports=function(e,n){var r=[];e.on("data",function(e){r.push(e)}),e.once("end",function(){n&&n(null,t.concat(r)),n=null}),e.once("error",function(e){n&&n(e),n=null})}}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var r=n(1),i=n(1722).Transform,o=n(1727);function s(e,t){if(!(this instanceof s))return new s(e,t);i.call(this),t||(t={}),"object"==typeof e&&(t=e,e=t.size),this.size=e||512,t.nopad?this._zeroPadding=!1:this._zeroPadding=o(t.zeroPadding,!0),this._buffered=[],this._bufferedBytes=0}e.exports=s,r(s,i),s.prototype._transform=function(e,n,r){for(this._bufferedBytes+=e.length,this._buffered.push(e);this._bufferedBytes>=this.size;){var i=t.concat(this._buffered);this._bufferedBytes-=this.size,this.push(i.slice(0,this.size)),this._buffered=[i.slice(this.size,i.length)]}r()},s.prototype._flush=function(){if(this._bufferedBytes&&this._zeroPadding){var e=new t(this.size-this._bufferedBytes);e.fill(0),this._buffered.push(e),this.push(t.concat(this._buffered)),this._buffered=null}else this._bufferedBytes&&(this.push(t.concat(this._buffered)),this._buffered=null);this.push(null)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t,r){var i=n(10);e.exports=S;var o=n(48),s;S.ReadableState=k;var a=n(6).EventEmitter,u=function(e,t){return e.listeners(t).length},l=n(656),c=n(4).Buffer,f=t.Uint8Array||function(){};function h(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof f}var d=n(7);d.inherits=n(1);var m=n(1723),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(1724),b=n(657),v;d.inherits(S,l);var _=["error","close","destroy","pause","resume"];function w(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function k(e,t){s=s||n(160),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=n(14).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function S(e){if(s=s||n(160),!(this instanceof S))return new S(e);this._readableState=new k(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),l.call(this)}function E(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,O(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.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,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),_()}function v(){g("onfinish"),e.removeListener("close",b),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(49)},f=n(656),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(657),y;function b(){}function v(e,t){u=u||n(160),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||n(160),!(y.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(160),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.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,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),_()}function v(){g("onfinish"),e.removeListener("close",b),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(49)},f=n(661),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(662),y;function b(){}function v(e,t){u=u||n(161),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||n(161),!(y.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(161),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.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,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),_()}function v(){g("onfinish"),e.removeListener("close",b),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(49)},f=n(667),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(668),y;function b(){}function v(e,t){u=u||n(162),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||n(162),!(y.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(162),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{t(null,n)}):g(e)?o(e,(e,n)=>{if(e)return t(new Error(`Error converting Blob: ${e.message}`));i(n)}):"function"==typeof a&&/^https?:/.test(e)?a.concat({url:e,timeout:3e4,headers:{"user-agent":"WebTorrent (https://webtorrent.io)"}},(e,n,r)=>{if(e)return t(new Error(`Error downloading torrent: ${e.message}`));i(r)}):"function"==typeof s.readFile&&"string"==typeof e?s.readFile(e,(e,n)=>{if(e)return t(new Error("Invalid torrent identifier"));i(n)}):r.nextTick(()=>{t(new Error("Invalid torrent identifier"))})}function d(e){t.isBuffer(e)&&(e=i.decode(e)),v(e.info,"info"),v(e.info["name.utf-8"]||e.info.name,"info.name"),v(e.info["piece length"],"info['piece length']"),v(e.info.pieces,"info.pieces"),e.info.files?e.info.files.forEach(e=>{v("number"==typeof e.length,"info.files[0].length"),v(e["path.utf-8"]||e.path,"info.files[0].path")}):v("number"==typeof e.info.length,"info.length");const n={info:e.info,infoBuffer:i.encode(e.info),name:(e.info["name.utf-8"]||e.info.name).toString(),announce:[]};n.infoHash=c.sync(n.infoBuffer),n.infoHashBuffer=t.from(n.infoHash,"hex"),void 0!==e.info.private&&(n.private=!!e.info.private),e["creation date"]&&(n.created=new Date(1e3*e["creation date"])),e["created by"]&&(n.createdBy=e["created by"].toString()),t.isBuffer(e.comment)&&(n.comment=e.comment.toString()),Array.isArray(e["announce-list"])&&e["announce-list"].length>0?e["announce-list"].forEach(e=>{e.forEach(e=>{n.announce.push(e.toString())})}):e.announce&&n.announce.push(e.announce.toString()),t.isBuffer(e["url-list"])&&(e["url-list"]=e["url-list"].length>0?[e["url-list"]]:[]),n.urlList=(e["url-list"]||[]).map(e=>e.toString()),f(n.announce),f(n.urlList);const r=e.info.files||[e.info];n.files=r.map((e,t)=>{const i=[].concat(n.name,e["path.utf-8"]||e.path||[]).map(e=>e.toString());return{path:l.join.apply(null,[l.sep].concat(i)).slice(1),name:i[i.length-1],length:e.length,offset:r.slice(0,t).reduce(y,0)}}),n.length=r.reduce(y,0);const o=n.files[n.files.length-1];return n.pieceLength=e.info["piece length"],n.lastPieceLength=(o.offset+o.length)%n.pieceLength||n.pieceLength,n.pieces=b(e.info.pieces),n}function m(e){const n={info:e.info};return n["announce-list"]=(e.announce||[]).map(e=>(n.announce||(n.announce=e),e=t.from(e,"utf8"),[e])),n["url-list"]=e.urlList||[],void 0!==e.private&&(n.private=Number(e.private)),e.created&&(n["creation date"]=e.created.getTime()/1e3|0),e.createdBy&&(n["created by"]=e.createdBy),e.comment&&(n.comment=e.comment),i.encode(n)}function g(e){return"undefined"!=typeof Blob&&e instanceof Blob}function y(e,t){return e+t.length}function b(e){const t=[];for(let n=0;n0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.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,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),_()}function v(){g("onfinish"),e.removeListener("close",b),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(49)},f=n(673),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(674),y;function b(){}function v(e,t){u=u||n(163),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||n(163),!(y.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(163),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function s(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),this.useColors){var n="color: "+this.color;t.splice(1,0,n,"color: inherit");var r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(r++,"%c"===e&&(i=r))}),t.splice(i,0,n)}}function a(){var e;return"object"===("undefined"==typeof console?"undefined":i(console))&&console.log&&(e=console).log.apply(e,arguments)}function u(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}}function l(){var e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function c(){try{return localStorage}catch(e){}}t.log=a,t.formatArgs=s,t.save=u,t.load=l,t.useColors=o,t.storage=c(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=n(1766)(t);var f=e.exports.formatters;f.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,n(2))},function(e,t,n){var r=n(4).Buffer,i=n(1767);t.DEFAULT_ANNOUNCE_PEERS=50,t.MAX_ANNOUNCE_PEERS=82,t.binaryToHex=function(e){return"string"!=typeof e&&(e=String(e)),r.from(e,"binary").toString("hex")},t.hexToBinary=function(e){return"string"!=typeof e&&(e=String(e)),r.from(e,"hex").toString("binary")};var o=n(1768);i(t,o)},function(e,t,n){"use strict";(function(t,r){var i=n(10);e.exports=S;var o=n(48),s;S.ReadableState=k;var a=n(6).EventEmitter,u=function(e,t){return e.listeners(t).length},l=n(680),c=n(4).Buffer,f=t.Uint8Array||function(){};function h(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof f}var d=n(7);d.inherits=n(1);var m=n(1776),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(1777),b=n(681),v;d.inherits(S,l);var _=["error","close","destroy","pause","resume"];function w(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function k(e,t){s=s||n(164),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=n(14).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function S(e){if(s=s||n(164),!(this instanceof S))return new S(e);this._readableState=new k(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),l.call(this)}function E(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,O(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.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,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),_()}function v(){g("onfinish"),e.removeListener("close",b),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(49)},f=n(680),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(681),y;function b(){}function v(e,t){u=u||n(164),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||n(164),!(y.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(164),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.lengththis._bufferDuration)&&this._cb){var t=this._cb;this._cb=null,t()}};var c=0;function f(e,t){var n=document.createElement("a");n.href=window.URL.createObjectURL(new window.Blob(e)),n.download=t,n.click()}l.prototype._getBufferDuration=function(){for(var e=this,t=this._sourceBuffer.buffered,n=this._elem.currentTime,r=-1,i=0;in)break;(r>=0||n<=s)&&(r=s)}var a=r-n;return a<0&&(a=0),a}},function(e,t,n){var r=n(686);e.exports=function e(t,n,i){if("function"==typeof n)return e(t,null,n);r(t,n,function(e,t){if(e)return i(e);var n=URL.createObjectURL(t);i(null,n)})}},function(e,t,n){var r=n(28);e.exports=function e(t,n,i){if("function"==typeof n)return e(t,null,n);i=r(i);var o=[];t.on("data",function(e){o.push(e)}).on("end",function(){var e=n?new Blob(o,{type:n}):new Blob(o);i(null,e)}).on("error",i)}},function(e,t,n){t=e.exports=n(688),t.Stream=t,t.Readable=t,t.Writable=n(691),t.Duplex=n(165),t.Transform=n(692),t.PassThrough=n(1808)},function(e,t,n){"use strict";(function(t,r){var i=n(10);e.exports=S;var o=n(48),s;S.ReadableState=k;var a=n(6).EventEmitter,u=function(e,t){return e.listeners(t).length},l=n(689),c=n(4).Buffer,f=t.Uint8Array||function(){};function h(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof f}var d=n(7);d.inherits=n(1);var m=n(1805),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(1806),b=n(690),v;d.inherits(S,l);var _=["error","close","destroy","pause","resume"];function w(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function k(e,t){s=s||n(165),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=n(14).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function S(e){if(s=s||n(165),!(this instanceof S))return new S(e);this._readableState=new k(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),l.call(this)}function E(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,O(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.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,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),_()}function v(){g("onfinish"),e.removeListener("close",b),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(49)},f=n(689),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(690),y;function b(){}function v(e,t){u=u||n(165),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||n(165),!(y.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(165),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length=e.length||t<0)){var n=e.pop();if(t{this.keepAlive()},h))}setTimeout(e,t){this._debug("setTimeout ms=%d unref=%s",e,t),this._clearTimeout(),this._timeoutMs=e,this._timeoutUnref=!!t,this._updateTimeout()}destroy(){this.destroyed||(this.destroyed=!0,this._debug("destroy"),this.emit("close"),this.end())}end(...e){this._debug("end"),this._onUninterested(),this._onChoke(),super.end(...e)}use(e){const t=e.prototype.name;if(!t)throw new Error('Extension class requires a "name" property on the prototype');this._debug("use extension.name=%s",t);const n=this._nextExt,r=new e(this);function i(){}"function"!=typeof r.onHandshake&&(r.onHandshake=i),"function"!=typeof r.onExtendedHandshake&&(r.onExtendedHandshake=i),"function"!=typeof r.onMessage&&(r.onMessage=i),this.extendedMapping[n]=t,this._ext[t]=r,this[t]=r,this._nextExt+=1}keepAlive(){this._debug("keep-alive"),this._push(d)}handshake(e,n,r){let i,o;if("string"==typeof e?(e=e.toLowerCase(),i=t.from(e,"hex")):(i=e,e=i.toString("hex")),"string"==typeof n?o=t.from(n,"hex"):(o=n,n=o.toString("hex")),20!==i.length||20!==o.length)throw new Error("infoHash and peerId MUST have length 20");this._debug("handshake i=%s p=%s exts=%o",e,n,r);const s=t.from(v);s[5]|=16,r&&r.dht&&(s[7]|=1),this._push(t.concat([p,s,i,o])),this._handshakeSent=!0,this.peerExtensions.extended&&!this._extendedHandshakeSent&&this._sendExtendedHandshake()}_sendExtendedHandshake(){const e=a(this.extendedHandshake);e.m={};for(const t in this.extendedMapping){const n=this.extendedMapping[t];e.m[n]=Number(t)}this.extended(0,i.encode(e)),this._extendedHandshakeSent=!0}choke(){if(!this.amChoking){for(this.amChoking=!0,this._debug("choke");this.peerRequests.length;)this.peerRequests.pop();this._push(m)}}unchoke(){this.amChoking&&(this.amChoking=!1,this._debug("unchoke"),this._push(g))}interested(){this.amInterested||(this.amInterested=!0,this._debug("interested"),this._push(y))}uninterested(){this.amInterested&&(this.amInterested=!1,this._debug("uninterested"),this._push(b))}have(e){this._debug("have %d",e),this._message(4,[e],null)}bitfield(e){this._debug("bitfield"),t.isBuffer(e)||(e=e.buffer),this._message(5,[],e)}request(e,t,n,r){return r||(r=(()=>{})),this._finished?r(new Error("wire is closed")):this.peerChoking?r(new Error("peer is choking")):(this._debug("request index=%d offset=%d length=%d",e,t,n),this.requests.push(new w(e,t,n,r)),this._updateTimeout(),void this._message(6,[e,t,n],null))}piece(e,t,n){this._debug("piece index=%d offset=%d",e,t),this.uploaded+=n.length,this.uploadSpeed(n.length),this.emit("upload",n.length),this._message(7,[e,t],n)}cancel(e,t,n){this._debug("cancel index=%d offset=%d length=%d",e,t,n),this._callback(this._pull(this.requests,e,t,n),new Error("request was cancelled"),null),this._message(8,[e,t,n],null)}port(e){this._debug("port %d",e);const n=t.from(_);n.writeUInt16BE(e,5),this._push(n)}extended(e,n){if(this._debug("extended ext=%s",e),"string"==typeof e&&this.peerExtendedMapping[e]&&(e=this.peerExtendedMapping[e]),"number"!=typeof e)throw new Error(`Unrecognized extension: ${e}`);{const r=t.from([e]),o=t.isBuffer(n)?n:i.encode(n);this._message(20,[],t.concat([r,o]))}}_read(){}_message(e,n,r){const i=r?r.length:0,o=t.allocUnsafe(5+4*n.length);o.writeUInt32BE(o.length+i-4,0),o[4]=e;for(let e=0;e{if(i===this._pull(this.peerRequests,e,t,n))return r?this._debug("error satisfying request index=%d offset=%d length=%d (%s)",e,t,n,r.message):void this.piece(e,t,o)};var i=new w(e,t,n,r);this.peerRequests.push(i),this.emit("request",e,t,n,r)}_onPiece(e,t,n){this._debug("got piece index=%d offset=%d",e,t),this._callback(this._pull(this.requests,e,t,n.length),null,n),this.downloaded+=n.length,this.downloadSpeed(n.length),this.emit("download",n.length),this.emit("piece",e,t,n)}_onCancel(e,t,n){this._debug("got cancel index=%d offset=%d length=%d",e,t,n),this._pull(this.peerRequests,e,t,n),this.emit("cancel",e,t,n)}_onPort(e){this._debug("got port %d",e),this.emit("port",e)}_onExtended(e,t){if(0===e){let e,n;try{e=i.decode(t)}catch(e){this._debug("ignoring invalid extended handshake: %s",e.message||e)}if(!e)return;if(this.peerExtendedHandshake=e,"object"==typeof e.m)for(n in e.m)this.peerExtendedMapping[n]=Number(e.m[n].toString());for(n in this._ext)this.peerExtendedMapping[n]&&this._ext[n].onExtendedHandshake(this.peerExtendedHandshake);this._debug("got extended handshake"),this.emit("extended","handshake",this.peerExtendedHandshake)}else this.extendedMapping[e]&&(e=this.extendedMapping[e],this._ext[e]&&this._ext[e].onMessage(t)),this._debug("got extended message ext=%s",e),this.emit("extended",e,t)}_onTimeout(){this._debug("request timed out"),this._callback(this.requests.shift(),new Error("request has timed out"),null),this.emit("timeout")}_write(e,n,r){for(this._bufferSize+=e.length,this._buffer.push(e);this._bufferSize>=this._parserSize;){const e=1===this._buffer.length?this._buffer[0]:t.concat(this._buffer);this._bufferSize-=this._parserSize,this._buffer=this._bufferSize?[e.slice(this._parserSize)]:[],this._parser(e.slice(0,this._parserSize))}r(null)}_callback(e,t,n){e&&(this._clearTimeout(),this.peerChoking||this._finished||this._updateTimeout(),e.callback(t,n))}_clearTimeout(){this._timeout&&(clearTimeout(this._timeout),this._timeout=null)}_updateTimeout(){this._timeoutMs&&this.requests.length&&!this._timeout&&(this._timeout=setTimeout(()=>this._onTimeout(),this._timeoutMs),this._timeoutUnref&&this._timeout.unref&&this._timeout.unref())}_parse(e,t){this._parserSize=e,this._parser=t}_onMessageLength(e){const t=e.readUInt32BE(0);t>0?this._parse(t,this._onMessage):(this._onKeepAlive(),this._parse(4,this._onMessageLength))}_onMessage(e){switch(this._parse(4,this._onMessageLength),e[0]){case 0:return this._onChoke();case 1:return this._onUnchoke();case 2:return this._onInterested();case 3:return this._onUninterested();case 4:return this._onHave(e.readUInt32BE(1));case 5:return this._onBitField(e.slice(1));case 6:return this._onRequest(e.readUInt32BE(1),e.readUInt32BE(5),e.readUInt32BE(9));case 7:return this._onPiece(e.readUInt32BE(1),e.readUInt32BE(5),e.slice(9));case 8:return this._onCancel(e.readUInt32BE(1),e.readUInt32BE(5),e.readUInt32BE(9));case 9:return this._onPort(e.readUInt16BE(1));case 20:return this._onExtended(e.readUInt8(1),e.slice(2));default:return this._debug("got unknown message"),this.emit("unknownmessage",e)}}_parseHandshake(){this._parse(1,e=>{const t=e.readUInt8(0);this._parse(t+48,e=>{const n=e.slice(0,t);if("BitTorrent protocol"!==n.toString())return this._debug("Error: wire not speaking BitTorrent protocol (%s)",n.toString()),void this.end();e=e.slice(t),this._onHandshake(e.slice(8,28),e.slice(28,48),{dht:!!(1&e[7]),extended:!!(16&e[5])}),this._parse(4,this._onMessageLength)})})}_onFinish(){for(this._finished=!0,this.push(null);this.read(););for(clearInterval(this._keepAliveInterval),this._parse(Number.MAX_VALUE,()=>{});this.peerRequests.length;)this.peerRequests.pop();for(;this.requests.length;)this._callback(this.requests.pop(),new Error("wire was closed"),null)}_debug(...e){e[0]=`[${this._debugId}] ${e[0]}`,s(...e)}_pull(e,t,n,i){for(let o=0;o0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=h(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):R(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&P(e)),R(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(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=T(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,P(e)}}function P(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(B,e):B(e))}function B(e){g("emit readable"),e.emit("readable"),U(e)}function R(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=q(e,t.buffer,t.decoder),n);var n}function q(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(W,t,e))}function W(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?z(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},S.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,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function l(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",l);var f=M(n);e.on("drain",f);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==$(o.pipes,e))&&!h&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),_()}function v(){g("onfinish"),e.removeListener("close",b),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",b),e.once("finish",v),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:i.nextTick,u;_.WritableState=v;var l=n(7);l.inherits=n(1);var c={deprecate:n(49)},f=n(697),h=n(4).Buffer,p=r.Uint8Array||function(){};function d(e){return h.from(e)}function m(e){return h.isBuffer(e)||e instanceof p}var g=n(698),y;function b(){}function v(e,t){u=u||n(166),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){I(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||n(166),!(y.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function S(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n)),t}function E(e,t,n,r,i,o){if(!n){var s=S(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(8))},function(e,t,n){"use strict";e.exports=s;var r=n(166),i=n(7);function o(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length255)return"DOMAIN_TOO_LONG";for(var n=t.split("."),i,o=0;o63)return"LABEL_TOO_LONG";if("-"===i.charAt(0))return"LABEL_STARTS_WITH_DASH";if("-"===i.charAt(i.length-1))return"LABEL_ENDS_WITH_DASH";if(!/^[a-z0-9\-]+$/.test(i))return"LABEL_INVALID_CHARS"}},t.parse=function(e){if("string"!=typeof e)throw new TypeError("Domain name must be a string.");var n=e.slice(0).toLowerCase();"."===n.charAt(n.length-1)&&(n=n.slice(0,n.length-1));var o=i.validate(n);if(o)return{input:e,error:{message:t.errorCodes[o],code:o}};var s={input:e,tld:null,sld:null,domain:null,subdomain:null,listed:!1},a=n.split(".");if("local"===a[a.length-1])return s;var u=function(){return/xn--/.test(n)?(s.domain&&(s.domain=r.toASCII(s.domain)),s.subdomain&&(s.subdomain=r.toASCII(s.subdomain)),s):s},l=i.findRule(n);if(!l)return a.length<2?s:(s.tld=a.pop(),s.sld=a.pop(),s.domain=[s.sld,s.tld].join("."),a.length&&(s.subdomain=a.pop()),u());s.listed=!0;var c=l.suffix.split("."),f=a.slice(0,a.length-c.length);return l.exception&&f.push(c.shift()),s.tld=c.join("."),f.length?(l.wildcard&&(c.unshift(f.pop()),s.tld=c.join(".")),f.length?(s.sld=f.pop(),s.domain=[s.sld,s.tld].join("."),f.length&&(s.subdomain=f.join(".")),u()):u()):u()},t.get=function(e){return e&&t.parse(e).domain||null},t.isValid=function(e){var n=t.parse(e);return Boolean(n.domain&&n.listed)}},function(e,t,n){"use strict"; +/*! + * Copyright (c) 2015, Salesforce.com, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Salesforce.com nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */function r(){}t.Store=r,r.prototype.synchronous=!1,r.prototype.findCookie=function(e,t,n,r){throw new Error("findCookie is not implemented")},r.prototype.findCookies=function(e,t,n){throw new Error("findCookies is not implemented")},r.prototype.putCookie=function(e,t){throw new Error("putCookie is not implemented")},r.prototype.updateCookie=function(e,t,n){throw new Error("updateCookie is not implemented")},r.prototype.removeCookie=function(e,t,n,r){throw new Error("removeCookie is not implemented")},r.prototype.removeCookies=function(e,t,n){throw new Error("removeCookies is not implemented")},r.prototype.getAllCookies=function(e){throw new Error("getAllCookies is not implemented (therefore jar cannot be serialized)")}},function(e,t,n){"use strict"; +/*! + * Copyright (c) 2015, Salesforce.com, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Salesforce.com nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */var r=n(704);function i(e){var t=r.getPublicSuffix(e);if(!t)return null;if(t==e)return[e];for(var n=e.slice(0,-(t.length+1)),i=n.split(".").reverse(),o=t,s=[o];i.length;)o=i.shift()+"."+o,s.push(o);return s}t.permuteDomain=i},function(e,t,n){"use strict"; +/*! + * Copyright (c) 2015, Salesforce.com, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Salesforce.com nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */function r(e,t){if(t===e)return!0;var n=e.indexOf(t);if(0===n){if("/"===t.substr(-1))return!0;if("/"===e.substr(t.length,1))return!0}return!1}t.pathMatch=r},function(e,t,n){"use strict";function r(e,t,n,r){for(var i=65535&e|0,o=e>>>16&65535|0,s=0;0!==n;){s=n>2e3?2e3:n,n-=s;do{i=i+t[r++]|0,o=o+i|0}while(--s);i%=65521,o%=65521}return i|o<<16|0}e.exports=r},function(e,t,n){"use strict";function r(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}var i=r();function o(e,t,n,r){var o=i,s=r+n;e^=-1;for(var a=r;a>>8^o[255&(e^t[a])];return-1^e}e.exports=o},function(e,t,n){e.exports={Verifier:l,Signer:c};var r=n(207),i=n(57),o=n(13),s=n(27),a=n(31).Buffer,u=n(101);function l(e,t){if("sha512"!==t.toLowerCase())throw new Error("ED25519 only supports the use of SHA-512 hashes");this.key=e,this.chunks=[],i.Writable.call(this,{})}function c(e,t){if("sha512"!==t.toLowerCase())throw new Error("ED25519 only supports the use of SHA-512 hashes");this.key=e,this.chunks=[],i.Writable.call(this,{})}o.inherits(l,i.Writable),l.prototype._write=function(e,t,n){this.chunks.push(e),n()},l.prototype.update=function(e){"string"==typeof e&&(e=a.from(e,"binary")),this.chunks.push(e)},l.prototype.verify=function(e,t){var n;if(u.isSignature(e,[2,0])){if("ed25519"!==e.type)return!1;n=e.toBuffer("raw")}else if("string"==typeof e)n=a.from(e,"base64");else if(u.isSignature(e,[1,0]))throw new Error("signature was created by too old a version of sshpk and cannot be verified");return s.buffer(n),r.sign.detached.verify(new Uint8Array(a.concat(this.chunks)),new Uint8Array(n),new Uint8Array(this.key.part.A.data))},o.inherits(c,i.Writable),c.prototype._write=function(e,t,n){this.chunks.push(e),n()},c.prototype.update=function(e){"string"==typeof e&&(e=a.from(e,"binary")),this.chunks.push(e)},c.prototype.sign=function(){var e=r.sign.detached(new Uint8Array(a.concat(this.chunks)),new Uint8Array(a.concat([this.key.part.k.data,this.key.part.A.data]))),t=a.from(e),n=u.parse(t,"ed25519","raw");return n.hashAlgorithm="sha512",n}},function(e,t,n){e.exports={read:d,write:v};var r=n(27),i=n(31).Buffer,o=n(47),s=n(46),a=n(52),u=n(113),l=n(714),c=n(114),f=n(379),h=n(715),p="Private-key-format: v1";function d(e,t){if("string"==typeof e){if(e.trim().match(/^[-]+[ ]*BEGIN/))return u.read(e,t);if(e.match(/^\s*ssh-[a-z]/))return l.read(e,t);if(e.match(/^\s*ecdsa-/))return l.read(e,t);if(e.match(/^putty-user-key-file-2:/i))return h.read(e,t);if(b(e))return f.read(e,t);e=i.from(e,"binary")}else{if(r.buffer(e),y(e))return u.read(e,t);if(g(e))return l.read(e,t);if(m(e))return h.read(e,t);if(b(e))return f.read(e,t)}if(e.readUInt32BE(0)e.length||"BEGIN"!==e.slice(t,t+5).toString("ascii"))}function b(e){if(e.length<=p.length)return!1;var t=e.slice(0,p.length);if(t.toString("ascii")===p)return!0;"string"!=typeof e&&(e=e.toString("ascii"));for(var n=e.split("\n"),r=0;n[r].match(/^\;/);)r++;return!!n[r].toString("ascii").match(/\. IN KEY /)||!!n[r].toString("ascii").match(/\. IN DNSKEY /)}function v(e,t){throw new Error('"auto" format cannot be used for writing')}},function(e,t,n){"use strict";var r=n(207).lowlevel.crypto_hash,i=0,o=function(){this.S=[new Uint32Array([3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946]),new Uint32Array([1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055]),new Uint32Array([3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504]),new Uint32Array([976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462])],this.P=new Uint32Array([608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731])};function s(e,t,n){return(e[0][t[n+3]]+e[1][t[n+2]]^e[2][t[n+1]])+e[3][t[n]]}function a(e,t){var n,r=0;for(n=0;n<4;n++,i++)i>=t&&(i=0),r=r<<8|e[i];return r}o.prototype.encipher=function(e,t){void 0===t&&(t=new Uint8Array(e.buffer),0!==e.byteOffset&&(t=t.subarray(e.byteOffset))),e[0]^=this.P[0];for(var n=1;n<16;n+=2)e[1]^=s(this.S,t,0)^this.P[n],e[0]^=s(this.S,t,4)^this.P[n+1];var r=e[0];e[0]=e[1]^this.P[17],e[1]=r},o.prototype.decipher=function(e){var t=new Uint8Array(e.buffer);0!==e.byteOffset&&(t=t.subarray(e.byteOffset)),e[0]^=this.P[17];for(var n=16;n>0;n-=2)e[1]^=s(this.S,t,0)^this.P[n],e[0]^=s(this.S,t,4)^this.P[n-1];var r=e[0];e[0]=e[1]^this.P[0],e[1]=r},o.prototype.expand0state=function(e,t){var n=new Uint32Array(2),r,o,s=new Uint8Array(n.buffer);for(r=0,i=0;r<18;r++)this.P[r]^=a(e,t);for(i=0,r=0;r<18;r+=2)this.encipher(n,s),this.P[r]=n[0],this.P[r+1]=n[1];for(r=0;r<4;r++)for(o=0;o<256;o+=2)this.encipher(n,s),this.S[r][o]=n[0],this.S[r][o+1]=n[1]},o.prototype.expandstate=function(e,t,n,r){var o=new Uint32Array(2),s,u;for(s=0,i=0;s<18;s++)this.P[s]^=a(n,r);for(s=0,i=0;s<18;s+=2)o[0]^=a(e,t),o[1]^=a(e,t),this.encipher(o),this.P[s]=o[0],this.P[s+1]=o[1];for(s=0;s<4;s++)for(u=0;u<256;u+=2)o[0]^=a(e,t),o[1]^=a(e,t),this.encipher(o),this.S[s][u]=o[0],this.S[s][u+1]=o[1];i=0},o.prototype.enc=function(e,t){for(var n=0;n>>24,n[4*s+2]=i[s]>>>16,n[4*s+1]=i[s]>>>8,n[4*s+0]=i[s]}function f(e,t,n,i,o,s,a){var u=new Uint8Array(64),f=new Uint8Array(64),h=new Uint8Array(l),p=new Uint8Array(l),d=new Uint8Array(i+4),m,g,y,b,v,_,w=s;if(a<1)return-1;if(0===t||0===i||0===s||s>h.byteLength*h.byteLength||i>1<<20)return-1;for(b=Math.floor((s+h.byteLength-1)/h.byteLength),y=Math.floor((s+b-1)/b),m=0;m0;_++){for(d[i+0]=_>>>24,d[i+1]=_>>>16,d[i+2]=_>>>8,d[i+3]=_,r(f,d,i+4),c(u,f,p),m=h.byteLength;m--;)h[m]=p[m];for(m=1;m=w));m++)o[v]=h[m];s-=m}return 0}e.exports={BLOCKS:u,HASHSIZE:l,hash:c,pbkdf:f}},function(e,t,n){e.exports={read:h,write:p};var r=n(27),i=n(31).Buffer,o=n(114),s=n(47),a=n(46),u=n(52),l=n(286),c=/^([a-z0-9-]+)[ \t]+([a-zA-Z0-9+\/]+[=]*)([ \t]+([^ \t][^\n]*[\n]*)?)?$/,f=/^([a-z0-9-]+)[ \t\n]+([a-zA-Z0-9+\/][a-zA-Z0-9+\/ \t\n=]*)([^a-zA-Z0-9+\/ \t\n=].*)?$/;function h(e,t){"string"!=typeof e&&(r.buffer(e,"buf"),e=e.toString("ascii"));var n=e.trim().replace(/[\\\r]/g,""),s=n.match(c);s||(s=n.match(f)),r.ok(s,"key must match regex");var a=o.algToKeyType(s[1]),u=i.from(s[2],"base64"),l,h={};if(s[4])try{l=o.read(u)}catch(e){s=n.match(f),r.ok(s,"key must match regex"),u=i.from(s[2],"base64"),l=o.readInternal(h,"public",u)}else l=o.readInternal(h,"public",u);if(r.strictEqual(a,l.type),s[4]&&s[4].length>0)l.comment=s[4];else if(h.consumed){var p=s[2]+(s[3]?s[3]:""),d=4*Math.ceil(h.consumed/3);p=p.slice(0,d-2).replace(/[^a-zA-Z0-9+\/=]/g,"")+p.slice(d-2);var m=h.consumed%3;for(m>0&&"="!==p.slice(d-1,d)&&d--;"="===p.slice(d,d+1);)d++;var g=p.slice(d);g=g.replace(/[\r\n]/g," ").replace(/^\s+/,""),g.match(/^[a-zA-Z0-9]/)&&(l.comment=g)}return l}function p(e,t){if(r.object(e),!a.isKey(e))throw new Error("Must be a public key");var n=[],s=o.keyTypeToAlg(e);n.push(s);var u=o.write(e);return n.push(u.toString("base64")),e.comment&&n.push(e.comment),i.from(n.join(" "))}},function(e,t,n){e.exports={read:u,write:c};var r=n(27),i=n(31).Buffer,o=n(114),s=n(46),a=n(95);function u(e,t){for(var n=e.toString("ascii").split(/[\r\n]+/),s=!1,a,u=0;un.length)throw new Error("Invalid public-lines count");var p=i.from(n.slice(u,u+h).join(""),"base64"),d=o.algToKeyType(c),m=o.read(p);if(m.type!==d)throw new Error("Outer key algorithm mismatch");return m.comment=f,m}function l(e){var t=e.indexOf(":");if(-1===t)return null;var n=e.slice(0,t);for(++t;" "===e[t];)++t;var r=e.slice(t);return[n,r]}function c(e,t){if(r.object(e),!s.isKey(e))throw new Error("Must be a public key");var n=o.keyTypeToAlg(e),a=o.write(e),u=e.comment||"",l=a.toString("base64"),c=f(l,64);return c.unshift("Public-Lines: "+c.length),c.unshift("Comment: "+u),c.unshift("Encryption: none"),c.unshift("PuTTY-User-Key-File-2: "+n),i.from(c.join("\n")+"\n")}function f(e,t){for(var n=[],r=0;r1)throw new Error("DER sequence does not contain whole byte stream");var s=n.offset;n.readSequence();var a=n.offset+n.length,u=a;if(n.peek()===y(0)){n.readSequence(y(0));var l=n.readInt();r.ok(l<=3,"only x.509 versions up to v3 supported")}var c={signatures:{}},g=c.signatures.x509={};g.extras={},c.serial=m(n,"serial"),n.readSequence();var b=n.offset+n.length,_=n.readOID(),w=v[_];if(void 0===w)throw new Error("unknown signature algorithm "+_);if(n._offset=b,c.issuer=f.parseAsn1(n),n.readSequence(),c.validFrom=k(n),c.validUntil=k(n),c.subjects=[f.parseAsn1(n)],n.readSequence(),b=n.offset+n.length,c.subjectKey=d.readPkcs8(void 0,"public",n),n._offset=b,n.peek()===y(1)&&(n.readSequence(y(1)),g.extras.issuerUniqueID=e.slice(n.offset,n.offset+n.length),n._offset+=n.length),n.peek()===y(2)&&(n.readSequence(y(2)),g.extras.subjectUniqueID=e.slice(n.offset,n.offset+n.length),n._offset+=n.length),n.peek()===y(3)){n.readSequence(y(3));var S=n.offset+n.length;for(n.readSequence();n.offset=2050||t.getUTCFullYear()<1950?e.writeString(N(t),i.Ber.GeneralizedTime):e.writeString(R(t),i.Ber.UTCTime)}var E={OtherName:y(0),RFC822Name:b(1),DNSName:b(2),X400Address:y(3),DirectoryName:y(4),EDIPartyName:y(5),URI:b(6),IPAddress:b(7),OID:b(8)},x={serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",joyentDocker:"1.3.6.1.4.1.38678.1.4.1",joyentCmon:"1.3.6.1.4.1.38678.1.4.2"},C={};Object.keys(x).forEach(function(e){C[x[e]]=e});var A=["signature","identity","keyEncryption","encryption","keyAgreement","ca","crl"];function I(e,t,n){n.readSequence();var r=n.offset+n.length,o=n.readOID(),s,a=e.signatures.x509,u;switch(a.extras.exts||(a.extras.exts=[]),n.peek()===i.Ber.Boolean&&(u=n.readBoolean()),o){case _.basicConstraints:n.readSequence(i.Ber.OctetString),n.readSequence();var l=n.offset+n.length,c=!1;n.peek()===i.Ber.Boolean&&(c=n.readBoolean()),void 0===e.purposes&&(e.purposes=[]),!0===c&&e.purposes.push("ca");var h={oid:o,critical:u};n.offset=60?o-1:o,n.setUTCFullYear(s,parseInt(t[2],10)-1,parseInt(t[3],10)),n.setUTCHours(parseInt(t[4],10),parseInt(t[5],10)),t[6]&&t[6].length>0&&n.setUTCSeconds(parseInt(t[6],10)),n}var O=/^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})?Z$/;function P(e){var t=e.match(O);r.ok(t);var n=new Date;return n.setUTCFullYear(parseInt(t[1],10),parseInt(t[2],10)-1,parseInt(t[3],10)),n.setUTCHours(parseInt(t[4],10),parseInt(t[5],10)),t[6]&&t[6].length>0&&n.setUTCSeconds(parseInt(t[6],10)),n}function B(e,t){void 0===t&&(t=2);for(var n=""+e;n.length0||"host"===o.type||void 0!==e.purposes&&e.purposes.length>0||n.extras&&n.extras.exts){t.startSequence(y(3)),t.startSequence();var u=[];void 0!==e.purposes&&e.purposes.length>0&&(u.push({oid:_.basicConstraints,critical:!0}),u.push({oid:_.keyUsage,critical:!0}),u.push({oid:_.extKeyUsage,critical:!0})),u.push({oid:_.altName}),n.extras&&n.extras.exts&&(u=n.extras.exts);for(var l=0;l=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122?r+=n.charAt(o):s<128?r+=i[s]:s<2048?r+=i[192|s>>6]+i[128|63&s]:s<55296||s>=57344?r+=i[224|s>>12]+i[128|s>>6&63]+i[128|63&s]:(o+=1,s=65536+((1023&s)<<10|1023&n.charCodeAt(o)),r+=i[240|s>>18]+i[128|s>>12&63]+i[128|s>>6&63]+i[128|63&s])}return r},f=function e(t){for(var n=[{obj:{o:t},prop:"o"}],r=[],i=0;i",_=m?">":"<",f=void 0;if(b){var w=t.util.getData(y.$data,s,t.dataPathArr),k="exclusive"+o,S="exclType"+o,E="exclIsNumber"+o,x="op"+o,C="' + "+x+" + '";i+=" var schemaExcl"+o+" = "+w+"; ",w="schemaExcl"+o,i+=" var "+k+"; var "+S+" = typeof "+w+"; if ("+S+" != 'boolean' && "+S+" != 'undefined' && "+S+" != 'number') { ";var f=g,A=A||[];A.push(i),i="",!1!==t.createErrors?(i+=" { keyword: '"+(f||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(l)+" , params: {} ",!1!==t.opts.messages&&(i+=" , message: '"+g+" should be boolean' "),t.opts.verbose&&(i+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+h+" "),i+=" } "):i+=" {} ";var I=i;i=A.pop(),!t.compositeRule&&c?t.async?i+=" throw new ValidationError(["+I+"]); ":i+=" validate.errors = ["+I+"]; return false; ":i+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),i+=" "+S+" == 'number' ? ( ("+k+" = "+d+" === undefined || "+w+" "+v+"= "+d+") ? "+h+" "+_+"= "+w+" : "+h+" "+_+" "+d+" ) : ( ("+k+" = "+w+" === true) ? "+h+" "+_+"= "+d+" : "+h+" "+_+" "+d+" ) || "+h+" !== "+h+") { var op"+o+" = "+k+" ? '"+v+"' : '"+v+"='; ",void 0===a&&(f=g,l=t.errSchemaPath+"/"+g,d=w,p=b)}else{var E="number"==typeof y,C=v;if(E&&p){var x="'"+C+"'";i+=" if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),i+=" ( "+d+" === undefined || "+y+" "+v+"= "+d+" ? "+h+" "+_+"= "+y+" : "+h+" "+_+" "+d+" ) || "+h+" !== "+h+") { "}else{E&&void 0===a?(k=!0,f=g,l=t.errSchemaPath+"/"+g,d=y,_+="="):(E&&(d=Math[m?"min":"max"](y,a)),y===(!E||d)?(k=!0,f=g,l=t.errSchemaPath+"/"+g,_+="="):(k=!1,C+="="));var x="'"+C+"'";i+=" if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),i+=" "+h+" "+_+" "+d+" || "+h+" !== "+h+") { "}}f=f||n;var A=A||[];A.push(i),i="",!1!==t.createErrors?(i+=" { keyword: '"+(f||"_limit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(l)+" , params: { comparison: "+x+", limit: "+d+", exclusive: "+k+" } ",!1!==t.opts.messages&&(i+=" , message: 'should be "+C+" ",i+=p?"' + "+d:d+"'"),t.opts.verbose&&(i+=" , schema: ",i+=p?"validate.schema"+u:""+a,i+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+h+" "),i+=" } "):i+=" {} ";var I=i;return i=A.pop(),!t.compositeRule&&c?t.async?i+=" throw new ValidationError(["+I+"]); ":i+=" validate.errors = ["+I+"]; return false; ":i+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",c&&(i+=" else { "),i}},function(e,t,n){"use strict";e.exports=function e(t,n,r){var i=" ",o=t.level,s=t.dataLevel,a=t.schema[n],u=t.schemaPath+t.util.getProperty(n),l=t.errSchemaPath+"/"+n,c=!t.opts.allErrors,f,h="data"+(s||""),p=t.opts.$data&&a&&a.$data,d;p?(i+=" var schema"+o+" = "+t.util.getData(a.$data,s,t.dataPathArr)+"; ",d="schema"+o):d=a;var m="maxItems"==n?">":"<";i+="if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),i+=" "+h+".length "+m+" "+d+") { ";var f=n,g=g||[];g.push(i),i="",!1!==t.createErrors?(i+=" { keyword: '"+(f||"_limitItems")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(l)+" , params: { limit: "+d+" } ",!1!==t.opts.messages&&(i+=" , message: 'should NOT have ",i+="maxItems"==n?"more":"fewer",i+=" than ",i+=p?"' + "+d+" + '":""+a,i+=" items' "),t.opts.verbose&&(i+=" , schema: ",i+=p?"validate.schema"+u:""+a,i+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+h+" "),i+=" } "):i+=" {} ";var y=i;return i=g.pop(),!t.compositeRule&&c?t.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}},function(e,t,n){"use strict";e.exports=function e(t,n,r){var i=" ",o=t.level,s=t.dataLevel,a=t.schema[n],u=t.schemaPath+t.util.getProperty(n),l=t.errSchemaPath+"/"+n,c=!t.opts.allErrors,f,h="data"+(s||""),p=t.opts.$data&&a&&a.$data,d;p?(i+=" var schema"+o+" = "+t.util.getData(a.$data,s,t.dataPathArr)+"; ",d="schema"+o):d=a;var m="maxLength"==n?">":"<";i+="if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),!1===t.opts.unicode?i+=" "+h+".length ":i+=" ucs2length("+h+") ",i+=" "+m+" "+d+") { ";var f=n,g=g||[];g.push(i),i="",!1!==t.createErrors?(i+=" { keyword: '"+(f||"_limitLength")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(l)+" , params: { limit: "+d+" } ",!1!==t.opts.messages&&(i+=" , message: 'should NOT be ",i+="maxLength"==n?"longer":"shorter",i+=" than ",i+=p?"' + "+d+" + '":""+a,i+=" characters' "),t.opts.verbose&&(i+=" , schema: ",i+=p?"validate.schema"+u:""+a,i+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+h+" "),i+=" } "):i+=" {} ";var y=i;return i=g.pop(),!t.compositeRule&&c?t.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}},function(e,t,n){"use strict";e.exports=function e(t,n,r){var i=" ",o=t.level,s=t.dataLevel,a=t.schema[n],u=t.schemaPath+t.util.getProperty(n),l=t.errSchemaPath+"/"+n,c=!t.opts.allErrors,f,h="data"+(s||""),p=t.opts.$data&&a&&a.$data,d;p?(i+=" var schema"+o+" = "+t.util.getData(a.$data,s,t.dataPathArr)+"; ",d="schema"+o):d=a;var m="maxProperties"==n?">":"<";i+="if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),i+=" Object.keys("+h+").length "+m+" "+d+") { ";var f=n,g=g||[];g.push(i),i="",!1!==t.createErrors?(i+=" { keyword: '"+(f||"_limitProperties")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(l)+" , params: { limit: "+d+" } ",!1!==t.opts.messages&&(i+=" , message: 'should NOT have ",i+="maxProperties"==n?"more":"fewer",i+=" than ",i+=p?"' + "+d+" + '":""+a,i+=" properties' "),t.opts.verbose&&(i+=" , schema: ",i+=p?"validate.schema"+u:""+a,i+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+h+" "),i+=" } "):i+=" {} ";var y=i;return i=g.pop(),!t.compositeRule&&c?t.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}},function(e){e.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}},function(e,t,n){"use strict"; +/*! + * Copyright (c) 2018, Salesforce.com, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Salesforce.com nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */var r=n(705);function i(e){return r.get(e)}t.getPublicSuffix=i},function(e,t,n){"use strict"; +/*! + * Copyright (c) 2015, Salesforce.com, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Salesforce.com nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */function r(){}t.Store=r,r.prototype.synchronous=!1,r.prototype.findCookie=function(e,t,n,r){throw new Error("findCookie is not implemented")},r.prototype.findCookies=function(e,t,n){throw new Error("findCookies is not implemented")},r.prototype.putCookie=function(e,t){throw new Error("putCookie is not implemented")},r.prototype.updateCookie=function(e,t,n){throw new Error("updateCookie is not implemented")},r.prototype.removeCookie=function(e,t,n,r){throw new Error("removeCookie is not implemented")},r.prototype.removeCookies=function(e,t,n){throw new Error("removeCookies is not implemented")},r.prototype.removeAllCookies=function(e){throw new Error("removeAllCookies is not implemented")},r.prototype.getAllCookies=function(e){throw new Error("getAllCookies is not implemented (therefore jar cannot be serialized)")}},function(e,t,n){"use strict"; +/*! + * Copyright (c) 2015, Salesforce.com, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Salesforce.com nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */var r=n(729);function i(e){var t=r.getPublicSuffix(e);if(!t)return null;if(t==e)return[e];for(var n=e.slice(0,-(t.length+1)),i=n.split(".").reverse(),o=t,s=[o];i.length;)o=i.shift()+"."+o,s.push(o);return s}t.permuteDomain=i},function(e,t,n){"use strict"; +/*! + * Copyright (c) 2015, Salesforce.com, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Salesforce.com nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */function r(e,t){if(t===e)return!0;var n=e.indexOf(t);if(0===n){if("/"===t.substr(-1))return!0;if("/"===e.substr(t.length,1))return!0}return!1}t.pathMatch=r},function(e,t,n){(function(e,t){!function(){var r;"undefined"!=typeof window&&(r=window),void 0!==e&&(r=e),r=r||{};var i=r.console||{log:function(){}};function o(e,t){return t?n(1980)(e):e.slice?o[r(e)]:function(t,n){e(t={exports:{}}),o[r(n)]=t.exports};function r(e){return e.split("/").slice(-1).toString().replace(".js","")}}var s=t;o(function(e){var t={fn:{is:function(e){return!!e&&"function"==typeof e}}};t.bi={is:function(e){return e instanceof Boolean||"boolean"==typeof e}},t.num={is:function(e){return!r(e)&&(e-parseFloat(e)+1>=0||1/0===e||-1/0===e)}},t.text={is:function(e){return"string"==typeof e}},t.text.ify=function(e){return t.text.is(e)?e:"undefined"!=typeof JSON?JSON.stringify(e):e&&e.toString?e.toString():e},t.text.random=function(e,t){var n="";for(e=e||24,t=t||"0123456789ABCDEFGHIJKLMNOPQRSTUVWXZabcdefghijklmnopqrstuvwxyz";e>0;)n+=t.charAt(Math.floor(Math.random()*t.length)),e--;return n},t.text.match=function(e,n){var r=!1;if(e=e||"",n=t.text.is(n)?{"=":n}:n||{},t.obj.has(n,"~")&&(e=e.toLowerCase(),n["="]=(n["="]||n["~"]).toLowerCase()),t.obj.has(n,"="))return e===n["="];if(t.obj.has(n,"*")){if(e.slice(0,n["*"].length)!==n["*"])return!1;r=!0,e=e.slice(n["*"].length)}if(t.obj.has(n,"!")){if(e.slice(-n["!"].length)!==n["!"])return!1;r=!0}if(t.obj.has(n,"+")&&t.list.map(t.list.is(n["+"])?n["+"]:[n["+"]],function(t){if(!(e.indexOf(t)>=0))return!0;r=!0}))return!1;if(t.obj.has(n,"-")&&t.list.map(t.list.is(n["-"])?n["-"]:[n["-"]],function(t){if(!(e.indexOf(t)<0))return!0;r=!0}))return!1;if(t.obj.has(n,">")){if(!(e>n[">"]))return!1;r=!0}if(t.obj.has(n,"<")){if(!(en?1:0):0}},t.list.map=function(e,t,n){return a(e,t,n)},t.list.index=1,t.obj={is:function(e){return!!e&&(e instanceof Object&&e.constructor===Object||"Object"===Object.prototype.toString.call(e).match(/^\[object (\w+)\]$/)[1])}},t.obj.put=function(e,t,n){return(e||{})[t]=n,e},t.obj.has=function(e,t){return e&&Object.prototype.hasOwnProperty.call(e,t)},t.obj.del=function(e,t){if(e)return e[t]=null,delete e[t],e},t.obj.as=function(e,t,n,r){return e[t]=e[t]||(r===n?{}:n)},t.obj.ify=function(e){if(o(e))return e;try{e=JSON.parse(e)}catch(t){e={}}return e},function(){var e;function n(t,n){s(this,n)&&e!==this[n]||(this[n]=t)}t.obj.to=function(e,t){return t=t||{},a(e,n,t),t}}(),t.obj.copy=function(e){return e?JSON.parse(JSON.stringify(e)):e},function(){function e(e,t){var n=this.n;if(!n||!(t===n||o(n)&&s(n,t)))return!!t||void 0}t.obj.empty=function(t,n){return!t||!a(t,e,{n:n})}}(),function(){function e(t,n){if(2===arguments.length)return e.r=e.r||{},void(e.r[t]=n);e.r=e.r||[],e.r.push(t)}var i=Object.keys;t.obj.map=function(a,u,l){var c,f=0,h,p,d,m,g=n(u);if(e.r=null,i&&o(a)&&(d=i(a),m=!0),r(a)||d)for(h=(d||a).length;f",r.drift=0,r.is=function(e,t,n){var i=t&&e&&e[w]&&e[w][r._]||n;if(i)return b(i=i[t])?i:-1/0},r.lex=function(){return r().toString(36).replace(".","")},r.ify=function(e,t,i,o,s){if(!e||!e[w]){if(!s)return;e=n.soul.ify(e,s)}var a=h(e[w],r._);return k!==t&&t!==w&&(b(i)&&(a[t]=i),k!==o&&(e[t]=o)),e},r.to=function(e,t,i){var o=(e||{})[t];return d(o)&&(o=g(o)),r.ify(i,t,r.is(e,t),o,n.soul(e))},function(){function e(e,t){w!==t&&r.ify(this.o,t,this.s)}r.map=function(t,n,i){var o,s=d(s=t||n)?s:null;return t=_(t=t||n)?t:null,s&&!t?(n=b(n)?n:r(),s[w]=s[w]||{},m(s,e,{o:s,s:n}),s):(i=i||d(n)?n:o,n=b(n)?n:r(),function(r,s,a,u){if(!t)return e.call({o:a,s:n},r,s),r;t.call(i||this||{},r,s,a,u),p(a,s)&&o===a[s]||e.call({o:a,s:n},r,s)})}}();var f=t.obj,h=f.as,p=f.has,d=f.is,m=f.map,g=f.copy,y=t.num,b=y.is,v=t.fn,_=v.is,w=n._,k;e.exports=r})(o,"./state"),o(function(e){var t=o("./type"),n=o("./val"),r=o("./node"),i={};!function(){function e(e,n){if(!e||n!==r.soul(e)||!r.is(e,this.fn,this.as))return!0;this.cb&&(t.n=e,t.as=this.as,this.cb.call(t.as,e,n,t))}function t(e){e&&r.is(t.n,e,t.as)}i.is=function(t,n,r,i){return!(!t||!u(t)||f(t))&&!p(t,e,{cb:n,fn:r,as:i})}}(),function(){function e(e,t){var i;return(i=f(e,t))?i:(t.env=e,t.soul=s,r.ify(t.obj,o,t)&&(t.rel=t.rel||n.rel.ify(r.soul(t.node)),t.obj!==e.shell&&(e.graph[n.rel.is(t.rel)]=t.node)),t)}function o(t,i,o){var s=this,u=s.env,f,h;if(r._===i&&c(t,n.rel._))return o._;if(f=a(t,i,o,s,u)){if(i||(s.node=s.node||o||{},c(t,r._)&&r.soul(t)&&(s.node._=d(t._)),s.node=r.soul.ify(s.node,n.rel.is(s.rel)),s.rel=s.rel||n.rel.ify(r.soul(s.node))),(h=u.map)&&(h.call(u.as||{},t,i,o,s),c(o,i))){if(t=o[i],m===t)return void l(o,i);if(!(f=a(t,i,o,s,u)))return}if(!i)return s.node;if(!0===f)return t;if(h=e(u,{obj:t,path:s.path.concat(i)}),h.node)return h.rel}}function s(e){var t=this,i=n.link.is(t.rel),o=t.env.graph;t.rel=t.rel||n.rel.ify(e),t.rel[n.rel._]=e,t.node&&t.node[r._]&&(t.node[r._][n.rel._]=e),c(o,i)&&(o[e]=o[i],l(o,i))}function a(e,r,i,o,s){var l;return!!n.is(e)||(u(e)?1:(l=s.invalid)?(e=l.call(s.as||{},e,r,i),a(e,r,i,o,s)):(s.err="Invalid value at '"+o.path.concat(r).join(".")+"'!",void(t.list.is(e)&&(s.err+=" Use `.set(item)` instead of an Array."))))}function f(e,t){for(var n=e.seen,r=n.length,i;r--;)if(i=n[r],t.obj===i.obj)return i;n.push(t)}i.ify=function(t,r,i){var o={path:[],obj:t};return r?"string"==typeof r?r={soul:r}:r instanceof Function&&(r.map=r):r={},r.soul&&(o.rel=n.rel.ify(r.soul)),r.shell=(i||{}).shell,r.graph=r.graph||{},r.seen=r.seen||[],r.as=r.as||i,e(r,o),r.root=o.node,r.graph}}(),i.node=function(e){var t=r.soul(e);if(t)return h({},t,e)},function(){function e(e,t){var o,s;if(r._!==t)(o=n.rel.is(e))?(s=this.opt.seen[o])?this.obj[t]=s:this.obj[t]=this.opt.seen[o]=i.to(this.graph,o,this.opt):this.obj[t]=e;else{if(f(e,n.rel._))return;this.obj[t]=d(e)}}i.to=function(t,n,r){if(t){var i={};return r=r||{seen:{}},p(t[n],e,{obj:i,graph:t,opt:r}),i}}}();var s=t.fn.is,a=t.obj,u=a.is,l=a.del,c=a.has,f=a.empty,h=a.put,p=a.map,d=a.copy,m;e.exports=i})(o,"./graph"),o(function(e){o("./onto"),e.exports=function e(t,n){if(this.on){if(!(t instanceof Function)){if(!t||!n)return;var r=t["#"]||t,i=(this.tag||empty)[r];if(!i)return;return i=this.on(r,n),clearTimeout(i.err),!0}var r=n&&n["#"]||Math.random().toString(36).slice(2);if(!t)return r;var o=this.on(r,t,n);return o.err=o.err||setTimeout(function(){o.next({err:"Error: No ACK received yet.",lack:!0}),o.off()},(this.opt||{}).lack||9e3),r}}})(o,"./ask"),o(function(e){var t=o("./type");function n(e){var n={s:{}};return e=e||{max:1e3,age:9e3},n.check=function(e){var t;return!!(t=n.s[e])&&(t.pass?t.pass=!1:n.track(e))},n.track=function(i,o){var s=n.s[i]||(n.s[i]={});return s.was=r(),o&&(s.pass=!0),n.to||(n.to=setTimeout(function(){var i=r();t.obj.map(n.s,function(r,o){r&&e.age>i-r.was||t.obj.del(n.s,o)}),n.to=null},e.age+9)),s},n}var r=t.time.is;e.exports=n})(o,"./dup"),o(function(e){function t(e){return e instanceof t?(this._={gun:this,$:this}).$:this instanceof t?t.create(this._={gun:this,$:this,opt:e}):new t(e)}t.is=function(e){return e instanceof t||e&&e._&&e===e._.$||!1},t.version=.9,t.chain=t.prototype,t.chain.toJSON=function(){};var n=o("./type");n.obj.to(n,t),t.HAM=o("./HAM"),t.val=o("./val"),t.node=o("./node"),t.state=o("./state"),t.graph=o("./graph"),t.on=o("./onto"),t.ask=o("./ask"),t.dup=o("./dup"),function(){function e(n){var r=this,i=r.as,o=i.at||i,s=o.$,a,u;(u=n["#"])||(u=n["#"]=l(9)),(a=o.dup).check(u)?i.out===n.out&&(n.out=k,r.to.next(n)):(a.track(u),o.ask(n["@"],n)||(n.get&&t.on.get(n,s),n.put&&t.on.put(n,s)),r.to.next(n),i.out||(n.out=e,o.on("out",n)))}t.create=function(n){n.root=n.root||n,n.graph=n.graph||{},n.on=n.on||t.on,n.ask=n.ask||t.ask,n.dup=n.dup||t.dup();var r=n.$.opt(n.opt);return n.once||(n.on("in",e,n),n.on("out",e,{at:n,out:e}),t.on("create",n),n.on("create",n)),n.once=1,r}}(),function(){function e(e,n,r,i){var o=this,s=t.state.is(r,n),a;if(!s)return o.err="Error: No state on '"+n+"' in node '"+i+"'!";var u=o.graph[i]||w,l=t.state.is(u,n,!0),c=u[n],f=t.HAM(o.machine,s,l,e,c);f.incoming?(o.put[i]=t.state.to(r,n,o.put[i]),(o.diff||(o.diff={}))[i]=t.state.to(r,n,o.diff[i]),o.souls[i]=!0):f.defer&&(o.defer=s<(o.defer||1/0)?s:o.defer)}function n(e,t){var n=this,s=n.$._,a=(s.next||w)[t];if(!a){if(!(s.opt||w).super)return void(n.souls[t]=!1);a=n.$.get(t)._}var u=n.map[t]={put:e,get:t,$:a.$},l={ctx:n,msg:u};n.async=!!s.tag.node,n.ack&&(u["@"]=n.ack),d(e,r,l),n.async&&(n.and||s.on("node",function(e){this.to.next(e),e===n.map[e.get]&&(n.souls[e.get]=!1,d(e.put,i,e),d(n.souls,function(e){if(e)return e})||n.c||(n.c=1,this.off(),d(n.map,o,n)))}),n.and=!0,s.on("node",u))}function r(e,n){var r=this.ctx,i=r.graph,o=this.msg,s=o.get,a=o.put,u=o.$._,l;i[s]=t.state.to(a,n,i[s]),r.async||(u.put=t.state.to(a,n,u.put))}function i(e,n){var r=this,i=r.put,o=r.$._;o.put=t.state.to(i,n,o.put)}function o(e,t){e.$&&(this.cat.stop=this.stop,e.$._.on("in",e),this.cat.stop=null)}t.on.put=function(r,i){var s=i._,a={$:i,graph:s.graph,put:{},map:{},souls:{},machine:t.state(),ack:r["@"],cat:s,stop:{}};if(t.graph.is(r.put,null,e,a)||(a.err="Error: Invalid graph!"),a.err)return s.on("in",{"@":r["#"],err:t.log(a.err)});d(a.put,n,a),a.async||d(a.map,o,a),k!==a.defer&&setTimeout(function(){t.on.put(r,i)},a.defer-a.machine),a.diff&&s.on("put",p(r,{put:a.diff}))},t.on.get=function(e,n){var r=n._,i=e.get,o=i[y],s=r.graph[o],a=i[b],u,l=r.next||(r.next={}),c=l[o];if(h(o,"*")){var f={};t.obj.map(r.graph,function(e,n){t.text.match(n,o)&&(f[n]=t.obj.copy(e))}),t.obj.empty(f)||r.on("in",{"@":e["#"],how:"*",put:f,$:n})}if(!s)return r.on("get",e);if(a){if(!h(s,a))return r.on("get",e);s=t.state.to(s,a)}else s=t.obj.copy(s);s=t.graph.node(s),u=(c||w).ack,r.on("in",{"@":e["#"],how:"mem",put:s,$:n}),r.on("get",e)}}(),t.chain.opt=function(e){e=e||{};var n=this,i=n._,o=e.peers||e;return f(e)||(e={}),f(i.opt)||(i.opt=e),u(o)&&(o=[o]),r(o)&&(o=d(o,function(e,t,n){n(e,{url:e})}),f(i.opt.peers)||(i.opt.peers={}),i.opt.peers=p(o,i.opt.peers)),i.opt.peers=i.opt.peers||{},p(e,i.opt),t.on("opt",i),i.opt.uuid=i.opt.uuid||function(){return g()+l(12)},n};var r=t.list.is,a=t.text,u=a.is,l=a.random,c=t.obj,f=c.is,h=c.has,p=c.to,d=c.map,m=c.copy,g=t.state.lex,y=t.val.rel._,b=".",v=t.node._,_=t.val.link.is,w={},k;i.debug=function(e,t){return i.debug.i&&e===i.debug.i&&i.debug.i++&&(i.log.apply(i,arguments)||t)},t.log=function(){return!t.log.off&&i.log.apply(i,arguments),[].slice.call(arguments).join(" ")},t.log.once=function(e,n,r){return(r=t.log.once)[e]=r[e]||0,r[e]++||t.log(n)},t.log.once("welcome","Hello wonderful person! :) Thanks for using GUN, feel free to ask for help on https://gitter.im/amark/gun and ask StackOverflow questions tagged with 'gun'!"),"undefined"!=typeof window&&((window.GUN=window.Gun=t).window=window);try{void 0!==s&&(s.exports=t)}catch(e){}e.exports=t})(o,"./root"),o(function(e){var t=o("./root");t.chain.back=function(e,i){var o;if(e=e||1,-1===e||1/0===e)return this._.root.$;if(1===e)return(this._.back||this._).$;var s=this,a=s._;if("string"==typeof e&&(e=e.split(".")),e instanceof Array){for(var u=0,l=e.length,o=a;u .once, apologies unexpected."),this.once(e,n)},t.chain.once=function(e,n){var i=this,o=i._,s=o.put;if(0=(t.batch||1e3))return f();s||(s=setTimeout(f,t.wait||1))}),e.on("get",function(n){this.to.next(n);var r=n.get,i,o,s;function u(){if(r&&(i=r["#"])){var u=r["."];o=a[i]||s,o&&u&&(o=Gun.state.to(o,u)),(o||Gun.obj.empty(t.peers))&&e.on("in",{"@":n["#"],put:Gun.graph.node(o),how:"lS",lS:n.$||e.$})}}Gun.debug?setTimeout(u,1):u()});var c=function(e,t,n,r){a[r]=Gun.state.to(n,t,a[r])},f=function(n){var u;o=0,clearTimeout(s),s=!1;var l=i;i={},n&&(a=n);try{r.setItem(t.prefix,JSON.stringify(a))}catch(n){Gun.log(u=(n||"localStorage failure")+" Consider using GUN's IndexedDB plugin for RAD for more storage space, temporary example at https://github.com/amark/gun/blob/master/test/tmp/indexedDB.html ."),e.on("localStorage:error",{err:u,file:t.prefix,flush:a,retry:f})}(u||Gun.obj.empty(t.peers))&&Gun.obj.map(l,function(t,n){e.on("in",{"@":n,err:u,ok:0})})}}})}})(o,"./adapters/localStorage"),o(function(e){var t=o("../type");function n(e){var o=function(){},a=e.opt||{};return a.log=a.log||i.log,a.gap=a.gap||a.wait||1,a.pack=a.pack||.3*(a.memory?1e3*a.memory*1e3:1399e6),o.out=function(t){var n;if(this.to&&this.to.next(t),(n=t["@"])&&(n=e.dup.s[n])&&(n=n.it)&&n._)return o.say(t,n._.via,1),void(n["##"]=t["##"]);o.say(t)},e.on("create",function(n){n.opt.pid=n.opt.pid||t.text.random(9),this.to.next(n),e.on("out",o.out)}),o.hear=function(n,r){if(n){var i=e.dup,s,u,l,c=n[0];if(a.pack<=n.length)return o.say({dam:"!",err:"Message too big!"},r);try{l=JSON.parse(n)}catch(e){a.log("DAM JSON parse error",e)}if("{"===c){if(!l)return;if(i.check(s=l["#"]))return;if(i.track(s,!0).it=l,(c=l["@"])&&l.put&&(u=l["##"]||(l["##"]=o.hash(l)),(c+=u)!=s)){if(i.check(c))return;(c=i.s)[u]=c[s]}return(l._=function(){}).via=r,(c=l["><"])&&(l._.to=t.obj.map(c.split(","),function(e,t,n){n(e,!0)})),l.dam?void((c=o.hear[l.dam])&&c(l,r,e)):void e.on("in",l)}if("["!==c);else{if(!l)return;for(var f=0,h;h=l[f++];)o.hear(h,r)}}},function(){function n(e){var t=e.batch;if(t&&(e.batch=e.tail=null,t.length))try{i(JSON.stringify(t),e)}catch(e){a.log("DAM JSON stringify error",e)}}function i(e,t){var n=t.wire;try{n.send?n.send(e):t.say&&t.say(e)}catch(n){(t.queue=t.queue||[]).push(e)}}o.say=function(s,u,l){if(u){var c,f=u.wire||a.wire&&a.wire(u),h,p;if(f&&(h=s._||r,u!==h.via&&((p=h.raw)||(p=o.raw(s)),!((c=s["@"])&&(c=e.dup.s[c])&&(c=c.it)&&c.get&&c["##"]&&c["##"]===s["##"])&&(!(c=h.to)||!c[u.url]&&!c[u.id]||l)))){if(u.batch){if(u.tail=(u.tail||0)+p.length,u.tail<=a.pack)return void u.batch.push(p);n(u)}u.batch=[],setTimeout(function(){n(u)},a.gap),i(p,u)}}else t.obj.map(a.peers,function(e){o.say(s,e)})}}(),function(){function r(e,n){var r;return n instanceof Object?(t.obj.map(Object.keys(n).sort(),i,{to:r={},on:n}),r):n}function i(e){this.to[e]=this.on[e]}o.raw=function(n){if(!n)return"";var i=e.dup,c=n._||{},f,h,p;if(p=c.raw)return p;if("string"==typeof n)return n;n["@"]&&(p=n.put)&&((h=n["##"])||(f=u(p,r)||"",h=o.hash(n,f),n["##"]=h),(p=i.s)[h=n["@"]+h]=p[n["#"]],n["#"]=h||n["#"],f&&((n=t.obj.to(n)).put=l));var d=0,m=[];t.obj.map(a.peers,function(e){if(m.push(e.url||e.id),++d>9)return!0}),n["><"]=m.join();var g=u(n);return s!==f&&(p=g.indexOf(l,g.indexOf("put")),g=g.slice(0,p-1)+f+g.slice(p+l.length+1)),c&&(c.raw=g),g},o.hash=function(e,i){return n.hash(i||u(e.put,r)||"")||e["#"]||t.text.random(9)};var u=JSON.stringify,l=":])([:"}(),o.hi=function(n){var r=n.wire||{};n.id||n.url?(a.peers[n.url||n.id]=n,t.obj.del(a.peers,r.id)):(r=r.id=r.id||t.text.random(9),o.say({dam:"?"},a.peers[r]=n)),r.hied||e.on(r.hied="hi",n),r=n.queue,n.queue=[],t.obj.map(r,function(e){o.say(e,n)})},o.bye=function(n){t.obj.del(a.peers,n.id),e.on("bye",n)},o.hear["!"]=function(e,t){a.log("Error:",e.err)},o.hear["?"]=function(e,t){if(!e.pid)return o.say({dam:"?",pid:a.pid,"@":e["#"]},t);t.id=t.id||e.pid,o.hi(t)},o}n.hash=function(e){if("string"!=typeof e)return{err:1};var t=0;if(!e.length)return t;for(var n=0,r=e.length,i;n0&&l>u&&(l=u);for(var c=0;c=0?(p=f.substr(0,h),d=f.substr(h+1)):(p=f,d=""),m=decodeURIComponent(p),g=decodeURIComponent(d),r(s,m)?i(s[m])?s[m].push(g):s[m]=[s[m],g]:s[m]=g}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,a){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),function(s){var a=encodeURIComponent(r(s))+n;return i(e[s])?o(e[s],function(e){return a+encodeURIComponent(r(e))}).join(t):a+encodeURIComponent(r(e[s]))}).join(t):a?encodeURIComponent(r(a))+n+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r{if("%%"===n)return n;a++;const o=r.formatters[i];if("function"==typeof o){const r=e[a];n=o.call(t,r),e.splice(a,1),a--}return n}),r.formatArgs.call(t,e);const u=t.log||r.log;u.apply(t,e)}return s.namespace=e,s.enabled=r.enabled(e),s.useColors=r.useColors(),s.color=t(e),s.destroy=i,s.extend=o,"function"==typeof r.init&&r.init(s),r.instances.push(s),s}function i(){const e=r.instances.indexOf(this);return-1!==e&&(r.instances.splice(e,1),!0)}function o(e,t){const n=r(this.namespace+(void 0===t?":":t)+e);return n.log=this.log,n}function s(e){let t;r.save(e),r.names=[],r.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(t=0;t"-"+e)].join(",");return r.enable(""),e}function u(e){if("*"===e[e.length-1])return!0;let t,n;for(t=0,n=r.skips.length;t{r[t]=e[t]}),r.instances=[],r.names=[],r.skips=[],r.formatters={},r.selectColor=t,r.enable(r.load()),r}e.exports=r},function(e,t,n){"use strict";t.byteLength=c,t.toByteArray=h,t.fromByteArray=m;for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");-1===n&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=l(e),n=t[0],r=t[1];return 3*(n+r)/4-r}function f(e,t,n){return 3*(t+n)/4-n}function h(e){for(var t,n=l(e),r=n[0],s=n[1],a=new o(f(e,r,s)),u=0,c=s>0?r-4:r,h=0;h>16&255,a[u++]=t>>8&255,a[u++]=255&t;return 2===s&&(t=i[e.charCodeAt(h)]<<2|i[e.charCodeAt(h+1)]>>4,a[u++]=255&t),1===s&&(t=i[e.charCodeAt(h)]<<10|i[e.charCodeAt(h+1)]<<4|i[e.charCodeAt(h+2)]>>2,a[u++]=t>>8&255,a[u++]=255&t),a}function p(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[63&e]}function d(e,t,n){for(var r,i=[],o=t;ou?u:a+16383));return 1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){},function(e,t,n){const r=n(131),i=n(115),o=n(288),s=n(32),a=n(21),u=n(5)("dweb-transports:http"),l=n(213);defaulthttpoptions={urlbase:"https://dweb.me:443"},servercommands={rawfetch:"contenthash",rawstore:"contenturl/rawstore",rawadd:"void/rawadd",rawlist:"metadata/rawlist",get:"get/table",set:"set/table",delete:"delete/table",keys:"keys/table",getall:"getall/table"};class c extends r{constructor(e){super(e),this.options=e,this.urlbase=e.urlbase,this.supportURLs=["contenthash","http","https"],this.supportFunctions=["fetch","store","add","list","reverse","newlisturls","get","set","keys","getall","delete","newtable","newdatabase"],this.supportFeatures=["fetch.range"],this.name="HTTP",this.status=r.STATUS_LOADED}static setup0(e){let t=r.mergeoptions(defaulthttpoptions,e.http);try{let e=new c(t);return i.addtransport(e),e}catch(e){throw console.error("HTTP unable to setup0",e.message),e}}async p_setup1(e){return this.status=r.STATUS_STARTING,e&&e(this),await this.p_status(),e&&e(this),this}async p_status(){try{this.info=await this.p_info(),this.status=r.STATUS_CONNECTED}catch(e){console.error(this.name,": Error in p_status.info",e.message),this.status=r.STATUS_FAILED}return super.p_status()}_cmdurl(e){return`${this.urlbase}/${e}`}_url(e,t,n){if(!e)throw new errors.CodingError(`${t}: requires url`);return"string"!=typeof e&&(e=e.href),e=e.replace("contenthash:/contenthash",this._cmdurl(t)),e=e.replace("getall/table",t),e+=n?"?"+n:"",e}async p_rawfetch(e,t={}){if(("string"==typeof e?e:e.href).includes("/getall/table"))throw new Error("Probably dont want to be calling p_rawfetch on a KeyValueTable, especially since dont know if its keyvaluetable or subclass");return await o.p_GET(this._url(e,servercommands.rawfetch),t)}p_rawlist(e){if(!e)throw new errors.CodingError("TransportHTTP.p_rawlist: requires url");return o.p_GET(this._url(e,servercommands.rawlist))}rawreverse(){throw new errors.ToBeImplementedError("Undefined function TransportHTTP.rawreverse")}async p_rawstore(e){console.assert(e,"TransportHttp.p_rawstore: requires data");const t=await o.p_POST(this._cmdurl(servercommands.rawstore),{data:e,contenttype:"application/octet-stream"});let n=s.parse(t),r=n.pathname.split("/");return`contenthash:/contenthash/${r.slice(-1)}`}p_rawadd(e,t){if(!e||!t)throw new errors.CodingError("TransportHTTP.p_rawadd: invalid parms",e,t);const n=l(t.preflight(Object.assign({},t)))+"\n";return o.p_POST(this._url(e,servercommands.rawadd),{data:n,contenttype:"application/json"})}p_newlisturls(e){let t=e._publicurls.map(e=>s.parse(e)).find(e=>"https:"===e.protocol&&["gateway.dweb.me","dweb.me"].includes(e.host)&&(e.pathname.includes("/content/rawfetch")||e.pathname.includes("/contenthash/"))||"contenthash:"===e.protocol&&"contenthash"===e.pathname.split("/")[1]);return t||(t=`contenthash:/contenthash/${e.keypair.verifyexportmultihashsha256_58()}`),[t,t]}async p_f_createReadStream(e,{wanturl:t=!1}={}){try{let n=this;return t?e:function(t){return n.createReadStream(e,t)}}catch(e){throw e}}createReadStream(e,t){let n;return u("createreadstream %s %o",s.parse(e).href,t),n=new a.PassThrough,o.p_GET(this._url(e,servercommands.rawfetch),Object.assign({wantstream:!0},t)).then(e=>e.pipe(n)).catch(e=>{console.warn(this.name,"createReadStream caught error",e.message),"function"==typeof n.destroy?n.destroy(e):n.emit("error",e)}),n}async p_createReadStream(e,t){u("createreadstream %s %o",s.parse(e).href,t);try{return await o.p_GET(this._url(e,servercommands.rawfetch),Object.assign({wantstream:!0},t))}catch(e){throw console.warn(this.name,"caught error",e),e}}async p_newdatabase(e){e.hasOwnProperty("keypair")&&(e=e.keypair.signingexport());let t=`${this.urlbase}/getall/table/${encodeURIComponent(e)}`;return{publicurl:t,privateurl:t}}async p_newtable(e,t){if(!e)throw new errors.CodingError("p_newtable currently requires a pubkey");let n=await this.p_newdatabase(e);return{privateurl:`${n.privateurl}/${t}`,publicurl:`${n.publicurl}/${t}`}}async p_set(e,t,n){if(!e||!t)throw new errors.CodingError("TransportHTTP.p_set: invalid parms",e,keyvalyes);if("string"==typeof t){let r=l([{key:t,value:n}]);await o.p_POST(this._url(e,servercommands.set),{data:r,contenttype:"application/json"})}else{let n=l(Object.keys(t).map(e=>({key:e,value:t[e]})));await o.p_POST(this._url(e,servercommands.set),{data:n,contenttype:"application/json"})}}_keyparm(e){return`key=${encodeURIComponent(e)}`}async p_get(e,t){if(!e&&t)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");let n=Array.isArray(t)?t.map(e=>this._keyparm(e)).join("&"):this._keyparm(t);const r=await o.p_GET(this._url(e,servercommands.get,n));return Array.isArray(t)?r:r[t]}async p_delete(e,t){if(!e&&t)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");let n=t.map(e=>this._keyparm(e)).join("&");await o.p_GET(this._url(e,servercommands.delete,n))}async p_keys(e){if(!e&&keys)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");return await o.p_GET(this._url(e,servercommands.keys))}async p_getall(e){if(!e&&keys)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");return await o.p_GET(this._url(e,servercommands.getall))}p_info(){return o.p_GET(`${this.urlbase}/info`)}static async p_test(e={}){console.log("TransportHTTP.test");try{let t=await this.p_setup(e);console.log("HTTP connected");let n=await t.p_info();console.log("TransportHTTP info=",n),n=await t.p_status(),console.assert(n===r.STATUS_CONNECTED),await t.p_test_kvt("NACL%20VERIFY")}catch(e){throw console.log("Exception thrown in TransportHTTP.test:",e.message),e}}static async test(){return this}}i._transportclasses.HTTP=c,t=e.exports=c},function(e,t){},function(e,t,n){"use strict";function r(e){for(var t=1;t0?this.tail.next=n:this.head=n,this.tail=n,++this.length},t.unshift=function e(t){var n={data:t,next:this.head};0===this.length&&(this.tail=n),this.head=n,++this.length},t.shift=function e(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.clear=function e(){this.head=this.tail=null,this.length=0},t.join=function e(t){if(0===this.length)return"";for(var n=this.head,r=""+n.data;n=n.next;)r+=t+n.data;return r},t.concat=function e(t){if(0===this.length)return s.alloc(0);for(var n=s.allocUnsafe(t>>>0),r=this.head,i=0;r;)c(r.data,n,i),i+=r.data.length,r=r.next;return n},t.consume=function e(t,n){var r;return to.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),t-=s,0===t){s===o.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(s));break}++r}return this.length-=r,i},t._getBuffer=function e(t){var n=s.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(n),t-=r.data.length;r=r.next;){var o=r.data,a=t>o.length?o.length:t;if(o.copy(n,n.length-t,0,a),t-=a,0===t){a===o.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=o.slice(a));break}++i}return this.length-=i,n},t[l]=function(e,t){return u(this,r({},t,{depth:0,customInspect:!1}))},e}()},function(e,t){},function(e,t,n){"use strict";(function(t){var n=new Set;function r(e){if(!n.has(e)){var r=e+" is an experimental feature. This feature could change at any time";n.add(e),t.emitWarning(r,"ExperimentalWarning")}}function i(){}e.exports.emitExperimentalWarning=t.emitWarning?r:i}).call(this,n(2))},function(e,t,n){"use strict";(function(t){var r;function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var o=n(747),s=Symbol("lastResolve"),a=Symbol("lastReject"),u=Symbol("error"),l=Symbol("ended"),c=Symbol("lastPromise"),f=Symbol("handlePromise"),h=Symbol("stream");function p(e,t){return{value:e,done:t}}function d(e){var t=e[s];if(null!==t){var n=e[h].read();null!==n&&(e[c]=null,e[s]=null,e[a]=null,t(p(n,!1)))}}function m(e){t.nextTick(d,e)}function g(e,t){return function(n,r){e.then(function(){t[f](n,r)},r)}}var y=Object.getPrototypeOf(function(){}),b=Object.setPrototypeOf((r={get stream(){return this[h]},next:function e(){var n=this,r=this[u];if(null!==r)return Promise.reject(r);if(this[l])return Promise.resolve(p(null,!0));if(this[h].destroyed)return new Promise(function(e,r){t.nextTick(function(){n[u]?r(n[u]):e(p(null,!0))})});var i=this[c],o;if(i)o=new Promise(g(i,this));else{var s=this[h].read();if(null!==s)return Promise.resolve(p(s,!1));o=new Promise(this[f])}return this[c]=o,o}},i(r,Symbol.asyncIterator,function(){return this}),i(r,"return",function e(){var t=this;return new Promise(function(e,n){t[h].destroy(null,function(t){t?n(t):e(p(null,!0))})})}),r),y),v=function e(t){var n,r=Object.create(b,(n={},i(n,h,{value:t,writable:!0}),i(n,s,{value:null,writable:!0}),i(n,a,{value:null,writable:!0}),i(n,u,{value:null,writable:!0}),i(n,l,{value:t._readableState.endEmitted,writable:!0}),i(n,c,{value:null,writable:!0}),i(n,f,{value:function e(t,n){var i=r[h].read();i?(r[c]=null,r[s]=null,r[a]=null,t(p(i,!1))):(r[s]=t,r[a]=n)},writable:!0}),n));return o(t,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[a];return null!==t&&(r[c]=null,r[s]=null,r[a]=null,t(e)),void(r[u]=e)}var n=r[s];null!==n&&(r[c]=null,r[s]=null,r[a]=null,n(p(null,!0))),r[l]=!0}),t.on("readable",m.bind(null,r)),r};e.exports=v}).call(this,n(2))},function(e,t,n){"use strict";var r=n(170).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}function o(e){return e.setHeader&&"function"==typeof e.abort}function s(e){var t=!1;return function(n){t||(t=!0,e.call(this,n))}}function a(e,t,n){if("function"==typeof t)return a(e,null,t);t||(t={}),n=s(n||i);var u=e._writableState,l=e._readableState,c=t.readable||!1!==t.readable&&e.readable,f=t.writable||!1!==t.writable&&e.writable,h=function t(){e.writable||p()},p=function t(){f=!1,c||n.call(e)},d=function t(){c=!1,f||n.call(e)},m=function t(r){n.call(e,r)},g=function t(){return(!c||l&&l.ended)&&(!f||u&&u.ended)?void 0:n.call(e,new r)},y=function t(){e.req.on("finish",p)};return o(e)?(e.on("complete",p),e.on("abort",g),e.req?y():e.on("request",y)):f&&!u&&(e.on("end",h),e.on("close",h)),e.on("end",d),e.on("finish",p),!1!==t.error&&e.on("error",m),e.on("close",g),function(){e.removeListener("complete",p),e.removeListener("abort",g),e.removeListener("request",y),e.req&&e.req.removeListener("finish",p),e.removeListener("end",h),e.removeListener("close",h),e.removeListener("finish",p),e.removeListener("end",d),e.removeListener("error",m),e.removeListener("close",g)}}e.exports=a},function(e,t,n){"use strict";e.exports=i;var r=n(391);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}n(1)(i,r),i.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){(function(r,i){const o=n(288),s=n(5)("dweb-transports:ipfs"),a=n(750),u=n(1453),l=n(9),c=n(50),f=n(32),h=n(21),p=n(96),d=n(131),m=n(115),g=n(169),y={repo:"/tmp/dweb_ipfsv3107",config:{Bootstrap:["/dns4/dweb.me/tcp/4245/wss/ipfs/QmQ921MRjsbP12fHSEDcdFeuHFg6qKDFurm2rXgA5K3RQD"]},EXPERIMENTAL:{pubsub:!0},preload:{enabled:!1}};class b extends d{constructor(e){super(e),this.ipfs=void 0,this.options=e,this.name="IPFS",this.supportURLs=["ipfs"],this.supportFunctions=["fetch","store","createReadStream"],this.status=d.STATUS_LOADED}_ipfsversion(e,t,n){e.version((r,i)=>{r?(s("IPFS via %s present but unresponsive: %o",t,i),this.ipfstype="FAILED",n(r)):(s("IPFS available via %s: %o",t,i),this.ipfstype=t,n(null,e))})}IPFSAutoConnect(e){if(r.ipfs)this._ipfsversion(r.ipfs,"global.ipfs",e);else if("undefined"!=typeof window&&window.ipfs)this._ipfsversion(window.ipfs,"window.ipfs",e);else{var t=u("localhost","5001",{protocol:"http"});t.version((n,r)=>{n?(s("IPFS via API failed %s, trying running own IPFS client",n.message),t=new a(this.options),t.on("ready",()=>{this._ipfsversion(t,"client",e)}),t.on("error",t=>{s("IPFS via client error %s",t.message),e(t)})):this._ipfsversion(t,"API",e)})}}static setup0(e){const t=d.mergeoptions(y,e.ipfs);s("setup options=%o",t);const n=new b(t);return m.addtransport(n),n}p_setup1(e,t){if(!t)return new Promise((e,t)=>{try{n.call(this,(n,r)=>{n?t(n):e(r)})}catch(e){t(e)}});try{n.call(this,t)}catch(e){t(e)}function n(t){this.status=d.STATUS_STARTING,e&&e(this),this.IPFSAutoConnect((n,r)=>{n?(s("Failed to connect %s",n.message),this.status=d.STATUS_FAILED):(this.ipfs=r,this.status=d.STATUS_CONNECTED),e&&e(this),t(null,this)})}}p_setup2(e){return this.status===d.STATUS_FAILED&&s("Stage 1 failed, skipping"),this}p_stop(e){return new Promise((t,n)=>{"client"===this.ipfstype?this.ipfs.stop((r,i)=>{this.status=d.STATUS_FAILED,e&&e(this),r?n(r):t(i)}):(this.status=d.STATUS_FAILED,e&&e(this),t(this))})}async p_status(){return this.status=await this.ipfs.isOnline()?d.STATUS_CONNECTED:d.STATUS_FAILED,super.p_status()}static urlFrom(e){if(e instanceof l)return"ipfs:/ipfs/"+e.toBaseEncodedString();if("object"==typeof e&&e.hash)return"ipfs:/ipfs/"+e.hash;if("string"==typeof e)return"ipfs:/ipfs/"+e;throw new p.CodingError("TransportIPFS.urlFrom: Cant convert to url from",e)}static cidFrom(e){if(e instanceof l)return e;if("string"==typeof e&&(e=f.parse(e)),e&&e.pathname){const t=e.pathname.split("/");if(!["ipfs:","dweb:"].includes(e.protocol)||"ipfs"!==t[1]||t.length<3)throw new p.TransportError("TransportIPFS.cidFrom bad format for url should be dweb: or ipfs:/ipfs/...: "+e.href);if(t.length>3)throw new p.TransportError("TransportIPFS.cidFrom not supporting paths in url yet, should be dweb: or ipfs:/ipfs/...: "+e.href);return new l(t[2])}throw new p.CodingError("TransportIPFS.cidFrom: Cant convert url",e)}static _stringFrom(e){return e instanceof l?"/ipfs/"+e.toBaseEncodedString():"object"==typeof e&&e.path?e.path:void 0}static ipfsFrom(e){if(e=this._stringFrom(e),e.indexOf("/ipfs/")>-1)return e.slice(e.indexOf("/ipfs/"));throw new p.CodingError(`TransportIPFS.ipfsFrom: Cant convert url ${e} into a path starting /ipfs/`)}static ipfsGatewayFrom(e){if(e=this._stringFrom(e),e.indexOf("/ipfs/")>-1)return"https://ipfs.io"+e.slice(e.indexOf("/ipfs/"));throw new p.CodingError(`TransportIPFS.ipfsGatewayFrom: Cant convert url ${e} into a path starting /ipfs/`)}static multihashFrom(e){if(e instanceof l)return e.toBaseEncodedString();if("object"==typeof e&&e.path&&(e=e.path),"string"==typeof e){const t=e.indexOf("/ipfs/");if(t>-1)return e.slice(t+6)}throw new p.CodingError(`Cant turn ${e} into a multihash`)}async p_rawfetch(e,{timeoutMS:t=6e4,relay:n=!1}={}){if(!e)throw new p.CodingError("TransportIPFS.p_rawfetch: requires url");const r=b.cidFrom(e),i=b.ipfsFrom(e);try{const n=await g.p_timeout(this.ipfs.dag.get(r),t,"Timed out IPFS fetch of "+b._stringFrom(r));if(n.remainderPath.length)throw new p.TransportError("Not yet supporting paths in p_rawfetch");let a;return"DAGNode"===n.value.constructor.name?a=await this.ipfs.cat(i):(s("Found a raw IPFS block (unusual) - not a DAGNode - handling as such"),a=n.value),a}catch(n){s("Caught error '%s' fetching via IPFS, trying IPFS HTTP gateway",n.message);try{let n=b.ipfsGatewayFrom(e);return await g.p_timeout(o.p_GET(n),t,"Timed out IPFS fetch of "+n)}catch(e){throw e}}}async p_rawstore(e){console.assert(e,"TransportIPFS.p_rawstore: requires data");const t=e instanceof i?e:new i(e),n=(await this.ipfs.add(t,{"cid-version":1,hashAlg:"sha2-256"}))[0];return b.urlFrom(n)}async p_f_createReadStream(e,{wanturl:t=!1}={}){let n;try{let r=e.pathname.split("/ipfs/")[1];if(r.includes("/"))throw new CodingError("Should not be seeing URLS with a path here:"+e);let i=this;return t?e:function e(t){s("reading from stream %o %o",r,t||"");const o=t?t.start:0,a=t&&t.end?o+t.end+1:void 0;return n&&n.destroy&&n.destroy(),n=i.ipfs.catReadableStream(r,{offset:o,length:a&&a-o}),n.on("error",e=>console.error(e)),n}}catch(e){throw n&&n.destroy&&n.destroy(),e}}static async p_test(e){console.log("TransportIPFS.test");try{const t=await this.p_setup(e);console.log(t.name,"setup");const n=await t.p_status();let r;console.assert(n===d.STATUS_CONNECTED);const i="The quick brown fox",o="ipfs:/ipfs/zdpuAscRnisRkYnEyJAp1LydQ3po25rCEDPPEDMymYRfN1yPK",s="1114",a=await t.p_rawstore(i);console.log("rawstore returned",a);const u=b.cidFrom(a);console.assert(a===o,"url should match url from rawstore");const l=a.split("/")[2],c=b.urlFrom(u);console.assert(a===c,"Should round trip"),r=a;const f=await t.p_rawfetch(r);return console.assert(f.toString()===i,"Should fetch block stored above"),t}catch(e){throw console.log("Exception thrown in TransportIPFS.test:",e.message),e}}}m._transportclasses.IPFS=b,t=e.exports=b}).call(this,n(8),n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(392),o=n(766),s=n(23),a=n(44),u=n(71),l=n(64),c=n(24),f=n(42),h=n(484),p=n(105),d=n(9),m=n(5),g=n(180),y=n(6),b=n(961),v=n(963),_=n(964),w=n(1316),k=n(1317),S=n(1321),E={get"bitcoin-block"(){return n(1322)},get"eth-account-snapshot"(){return n(126).ethAccountSnapshot},get"eth-block"(){return n(126).ethBlock},get"eth-block-list"(){return n(126).ethBlockList},get"eth-state-trie"(){return n(126).ethStateTrie},get"eth-storage-trie"(){return n(126).ethStorageTrie},get"eth-tx"(){return n(126).ethTx},get"eth-tx-trie"(){return n(126).ethTxTrie},get"git-raw"(){return n(1418)},get"zcash-block"(){return n(1424)}};class x extends y{constructor(e){super();const t={init:!0,start:!0,EXPERIMENTAL:{},preload:{enabled:!0,addresses:["/dnsaddr/node0.preload.ipfs.io/https","/dnsaddr/node1.preload.ipfs.io/https"]}};e=b.validate(e||{}),this._options=g(e,t),!1===e.init&&(this._options.init=!1),!1!==e.start&&(this._options.start=!0),"string"==typeof e.repo||void 0===e.repo?this._repo=w(e.repo):this._repo=e.repo,this.log=m("jsipfs"),this.log.err=m("jsipfs:err"),this.types={Buffer:r,PeerId:s,PeerInfo:a,multiaddr:c,multibase:p,multihash:f,CID:d},this._peerInfoBook=new h,this._peerInfo=void 0,this._bitswap=void 0,this._blockService=new i(this._repo),this._ipld=new o({blockService:this._blockService,loadFormat:(e,t)=>{if(this.log("Loading IPLD format",e),E[e])return t(null,E[e]);t(new Error(`Missing IPLD format "${e}"`))}}),this._preload=k(this),this._mfsPreload=S(this),this._ipns=void 0,this._print=this._options.silent?this.log:console.log,this.init=_.init(this),this.preStart=_.preStart(this),this.start=_.start(this),this.stop=_.stop(this),this.shutdown=this.stop,this.isOnline=_.isOnline(this),Object.assign(this,_.filesRegular(this)),this.version=_.version(this),this.id=_.id(this),this.repo=_.repo(this),this.bootstrap=_.bootstrap(this),this.config=_.config(this),this.block=_.block(this),this.object=_.object(this),this.dag=_.dag(this),this.files=_.filesMFS(this),this.libp2p=null,this.swarm=_.swarm(this),this.name=_.name(this),this.bitswap=_.bitswap(this),this.pin=_.pin(this),this.ping=_.ping(this),this.pingPullStream=_.pingPullStream(this),this.pingReadableStream=_.pingReadableStream(this),this.pubsub=_.pubsub(this),this.dht=_.dht(this),this.dns=_.dns(this),this.key=_.key(this),this.stats=_.stats(this),this.resolve=_.resolve(this),this._options.EXPERIMENTAL.pubsub&&this.log("EXPERIMENTAL pubsub is enabled"),this._options.EXPERIMENTAL.ipnsPubsub&&(this._options.EXPERIMENTAL.pubsub||(this.log("EXPERIMENTAL pubsub is enabled to use IPNS pubsub"),this._options.EXPERIMENTAL.pubsub=!0),this.log("EXPERIMENTAL IPNS pubsub is enabled")),this._options.EXPERIMENTAL.sharding&&this.log("EXPERIMENTAL sharding is enabled"),this._options.EXPERIMENTAL.dht&&this.log("EXPERIMENTAL Kademlia DHT is enabled"),this.state=n(1452)(this),this.util={crypto:u,isIPFS:l},v(this)}}t=e.exports=x,t.createNode=(e=>new x(e))}).call(this,n(0).Buffer)},function(e,t,n){var r=n(174),i=Object.prototype,o=i.hasOwnProperty,s=i.toString,a=r?r.toStringTag:void 0;function u(e){var t=o.call(e,a),n=e[a];try{e[a]=void 0;var r=!0}catch(e){}var i=s.call(e);return r&&(t?e[a]=n:delete e[a]),i}e.exports=u},function(e,t){var n=Object.prototype,r=n.toString;function i(e){return r.call(e)}e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=p;var r=n(172),i=l(r),o=n(754),s=l(o),a=n(134),u=l(a);function l(e){return e&&e.__esModule?e:{default:e}}function c(e){var t=-1,n=e.length;return function r(){return++t{if(this.resolvers[e])throw new Error('Resolver already exists for codec "'+e+'"');this.resolvers[e]={resolver:t,util:n}}),this.support.load=t.loadFormat||((e,t)=>{t(new Error(`No resolver found for codec "${e}"`))}),this.support.rm=(e=>{this.resolvers[e]&&delete this.resolvers[e]});for(const e of t.formats){const{resolver:t,util:n}=e,r=t.multicodec;this.support.add(r,t,n)}}get(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n={}),"string"==typeof t&&(t=l("/",t).substr(1).split(c).join("/")),""===t||!t)return this._get(e,(t,n)=>{if(t)return r(t);r(null,{value:n,remainderPath:"",cid:e})});let i;s(n=>{this._getFormat(e.codec,(r,o)=>{if(r)return n(r);this.bs.get(e,(e,r)=>{if(e)return n(e);o.resolver.resolve(r.data,t,(e,r)=>{if(e)return n(e);i=r.value,t=r.remainderPath,n()})})})},()=>{const r=!t||""===t||"/"===t,o=i&&!k._maybeCID(i);return r&&o||n.localResolve?(e=k._maybeCID(i)||e,!0):(i=k._maybeCID(i),i&&(e=i),!1)},(n,o)=>n?r(n):r(null,{value:i,remainderPath:t,cid:e}))}getStream(e,t,n){const r=f();return this.get(e,t,n,(e,t)=>{if(e)return r.resolve(i.error(e));r.resolve(i.values([t]))}),r}getMany(e,t){if(!Array.isArray(e))return t(new Error("Argument must be an array of CIDs"));this.bs.getMany(e,(e,n)=>{if(e)return t(e);p(n,(e,t)=>{this._getFormat(e.cid.codec,(n,r)=>{if(n)return t(n);r.util.deserialize(e.data,t)})},t)})}put(e,t,n){return"function"==typeof t?(n=t,setImmediate(()=>n(new Error("IPLDResolver.put requires options")))):(n=n||w,t.cid&&o.isCID(t.cid)?t.onlyHash?setImmediate(()=>n(null,t.cid)):this._put(t.cid,e,n):void this._getFormat(t.format,(r,i)=>{if(r)return n(r);i.util.cid(e,t,(r,i)=>r?n(r):t.onlyHash?n(null,i):void this._put(i,e,n))}))}treeStream(e,t,n){let r;return"object"==typeof t&&(n=t,t=void 0),n=n||{},n.recursive||(r=f(),m([t=>this._getFormat(e.codec,t),(t,n)=>this.bs.get(e,(e,r)=>{if(e)return n(e);n(null,t,r)}),(e,t,n)=>e.resolver.tree(t.data,n)],(e,t)=>{if(e)return r.abort(e),r;r.resolve(i.values(t))})),n.recursive&&(r=i(h.widthFirst({basePath:null,cid:e},e=>{if("string"==typeof e)return i.empty();const t=f(),n=e.cid;return m([e=>this._getFormat(n.codec,e),(e,t)=>this.bs.get(n,(n,r)=>{if(n)return t(n);t(null,e,r)}),(e,t,n)=>e.resolver.tree(t.data,(r,i)=>{if(r)return n(r);p(i,(n,r)=>{e.resolver.isLink(t.data,n,(e,t)=>{if(e)return r(e);r(null,{path:n,link:t})})},n)})],(n,r)=>{if(n)return t.abort(n),t;t.resolve(i.values(r.map(t=>{const n=e.basePath?e.basePath+"/"+t.path:t.path;return t.link?{basePath:n,cid:k._maybeCID(t.link)}:n})))}),t}),i.map(e=>"string"==typeof e?e:e.basePath),i.filter(Boolean))),t?i(r,i.map(e=>{if(0===e.indexOf(t))return e=e.slice(t.length+1),e}),i.filter(Boolean)):r}remove(e,t){this.bs.delete(e,t)}_get(e,t){m([t=>this._getFormat(e.codec,t),(t,n)=>this.bs.get(e,(e,r)=>{if(e)return n(e);n(null,t,r)}),(e,t,n)=>{e.util.deserialize(t.data,(e,t)=>{if(e)return n(e);n(null,t)})}],t)}_getFormat(e,t){if(this.resolvers[e])return t(null,this.resolvers[e]);this.support.load(e,(n,r)=>{if(n)return t(n);this.resolvers[e]=r,t(null,r)})}_put(e,t,n){n=n||w,m([t=>this._getFormat(e.codec,t),(e,n)=>e.util.serialize(t,n),(t,n)=>this.bs.put(new r(t,e),n)],t=>{if(t)return n(t);n(null,e)})}static _maybeCID(e){return o.isCID(e)?e:e&&void 0!==e["/"]?new o(e["/"]):null}}k.defaultOptions={formats:[b,v,_]},k.inMemory=function(e){const t=new a("in-memory",{storageBackends:{root:g,blocks:g,datastore:g},lock:"memory"}),n=new u(t);d([e=>t.init({},e),e=>t.open(e)],t=>{if(t)return e(t);e(null,new k({blockService:n}))})},e.exports=k},function(e,t,n){const r=n(4).Buffer;e.exports=function e(t){if(t.length>=255)throw new TypeError("Alphabet too long");const n=new Uint8Array(256);n.fill(255);for(let e=0;e>>0,f=new Uint8Array(c);for(;u!==l;){let t=e[u],n=0;for(let e=c-1;(0!==t||n>>0,f[e]=t%i>>>0,t=t/i>>>0;if(0!==t)throw new Error("Non-zero carry");s=n,u++}let h=c-s;for(;h!==c&&0===f[h];)h++;let p=o.repeat(n);for(;h>>0,c=new Uint8Array(l);for(;e[t];){let r=n[e.charCodeAt(t)];if(255===r)return;let o=0;for(let e=l-1;(0!==r||o>>0,c[e]=r%256>>>0,r=r/256>>>0;if(0!==r)throw new Error("Non-zero carry");u=o,t++}if(" "===e[t])return;let f=l-u;for(;f!==l&&0===c[f];)f++;const h=r.allocUnsafe(a+(l-f));h.fill(0,0,a);let p=a;for(;f!==l;)h[p++]=c[f++];return h}function c(e){const t=l(e);if(t)return t;throw new Error("Non-base"+i+" character")}return{encode:u,decodeUnsafe:l,decode:c}}},function(e,t){e.exports=s;var n=128,r=127,i=-128,o=Math.pow(2,31);function s(e,t,r){t=t||[],r=r||0;for(var a=r;e>=o;)t[r++]=255&e|n,e/=128;for(;e&i;)t[r++]=255&e|n,e>>>=7;return t[r]=0|e,s.bytes=r-a+1,t}},function(e,t){e.exports=i;var n=128,r=127;function i(e,t){var o=0,t=t||0,s=0,a=t,u,l=e.length;do{if(a>=l)throw i.bytes=0,new RangeError("Could not decode varint");u=e[a++],o+=s<28?(u&r)<=n);return i.bytes=a-t,o}},function(e,t){var n=Math.pow(2,7),r=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),s=Math.pow(2,35),a=Math.pow(2,42),u=Math.pow(2,49),l=Math.pow(2,56),c=Math.pow(2,63);e.exports=function(e){return e(e[t[0]]=new r(t[0],t[1],t[2],t[3]),e),{}),c=u.reduce((e,t)=>(e[t[1]]=l[t[0]],e),{});e.exports={names:l,codes:c}},function(e,t,n){"use strict";class r{constructor(e,t,n,r){this.name=e,this.code=t,this.alphabet=r,n&&r&&(this.engine=n(r))}encode(e){return this.engine.encode(e)}decode(e){return this.engine.decode(e)}isImplemented(){return this.engine}}e.exports=r},function(e,t,n){var r=n(4).Buffer;e.exports=function e(t){for(var n={},i=t.length,o=t.charAt(0),s=0;s0;)n.push(a%i),a=a/i|0}for(var u="",l=0;0===e[l]&&l=0;--c)u+=t[n[c]];return u}function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return r.allocUnsafe(0);for(var t=[0],s=0;s>=8;for(;l>0;)t.push(255&l),l>>=8}for(var c=0;e[c]===o&&c"string"==typeof e?t.from(e).toString("hex"):e.toString("hex"),decode(e){for(let t of e)if(n.indexOf(t)<0)throw new Error("invalid base16 character");return t.from(e,"hex")}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){function n(e,t){e=e.replace(new RegExp("=","g"),"");let n=e.length,r=0,i=0,o=0,s=new Uint8Array(5*n/8|0);for(let a=0;a=8&&(s[o++]=i>>>r-8&255,r-=8);return s.buffer}function r(e,t){let n=e.byteLength,r=new Uint8Array(e),i=t.indexOf("=")===t.length-1;i&&(t=t.substring(0,t.length-2));let o=0,s=0,a="";for(let e=0;e=5;)a+=t[s>>>o-5&31],o-=5;if(o>0&&(a+=t[s<<5-o&31]),i)for(;a.length%8!=0;)a+="=";return a}e.exports=function e(i){return{encode:e=>r("string"==typeof e?t.from(e):e,i),decode(e){for(let t of e)if(i.indexOf(t)<0)throw new Error("invalid base32 character");return n(e,i)}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){e.exports=function e(n){const r=n.indexOf("=")>-1,i=n.indexOf("-")>-1&&n.indexOf("_")>-1;return{encode(e){let n="";n="string"==typeof e?t.from(e).toString("base64"):e.toString("base64"),i&&(n=n.replace(/\+/g,"-").replace(/\//g,"_"));const o=n.indexOf("=");return o>0&&!r&&(n=n.substring(0,o)),n},decode(e){for(let t of e)if(n.indexOf(t)<0)throw new Error("invalid base64 character");return t.from(e,"base64")}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(38),o=n(778),s=n(779),a=n(401);t=e.exports,t.addPrefix=((e,t)=>{let n;if(r.isBuffer(e))n=a.varintBufferEncode(e);else{if(!o[e])throw new Error("multicodec not recognized");n=o[e]}return r.concat([n,t])}),t.rmPrefix=(e=>(i.decode(e),e.slice(i.decode.bytes))),t.getCodec=(e=>{const t=a.varintBufferDecode(e),n=s[t.toString("hex")];if(void 0===n)throw new Error("Code `0x"+t.toString("hex")+"` not found");return n}),t.getCode=(e=>i.decode(e)),t.getCodeVarint=(e=>{const t=o[e];if(void 0===t)throw new Error("Codec `"+e+"` not found");return t}),t.getVarint=(e=>i.encode(e));const u=n(780);Object.assign(t,u),t.print=n(781)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(293),i=n(401).varintBufferEncode,o={};e.exports=o;for(let e in r){let t=r[e];o[e]=i(t)}},function(e,t,n){"use strict";const r=n(293),i={};e.exports=i;for(let e in r){let t=r[e];i[t.toString("hex")]=e}},function(e,t,n){"use strict";e.exports=Object.freeze({RAW:85,CBOR:81,PROTOBUF:80,RLP:96,BENCODE:99,MULTICODEC:48,MULTIHASH:49,MULTIADDR:50,MULTIBASE:51,IDENTITY:0,MD4:212,MD5:213,SHA1:17,SHA2_256:18,SHA2_512:19,DBL_SHA2_256:86,SHA3_224:23,SHA3_256:22,SHA3_384:21,SHA3_512:20,SHAKE_128:24,SHAKE_256:25,KECCAK_224:26,KECCAK_256:27,KECCAK_384:28,KECCAK_512:29,MURMUR3_128:34,MURMUR3_32:35,X11:4352,BLAKE2B_8:45569,BLAKE2B_16:45570,BLAKE2B_24:45571,BLAKE2B_32:45572,BLAKE2B_40:45573,BLAKE2B_48:45574,BLAKE2B_56:45575,BLAKE2B_64:45576,BLAKE2B_72:45577,BLAKE2B_80:45578,BLAKE2B_88:45579,BLAKE2B_96:45580,BLAKE2B_104:45581,BLAKE2B_112:45582,BLAKE2B_120:45583,BLAKE2B_128:45584,BLAKE2B_136:45585,BLAKE2B_144:45586,BLAKE2B_152:45587,BLAKE2B_160:45588,BLAKE2B_168:45589,BLAKE2B_176:45590,BLAKE2B_184:45591,BLAKE2B_192:45592,BLAKE2B_200:45593,BLAKE2B_208:45594,BLAKE2B_216:45595,BLAKE2B_224:45596,BLAKE2B_232:45597,BLAKE2B_240:45598,BLAKE2B_248:45599,BLAKE2B_256:45600,BLAKE2B_264:45601,BLAKE2B_272:45602,BLAKE2B_280:45603,BLAKE2B_288:45604,BLAKE2B_296:45605,BLAKE2B_304:45606,BLAKE2B_312:45607,BLAKE2B_320:45608,BLAKE2B_328:45609,BLAKE2B_336:45610,BLAKE2B_344:45611,BLAKE2B_352:45612,BLAKE2B_360:45613,BLAKE2B_368:45614,BLAKE2B_376:45615,BLAKE2B_384:45616,BLAKE2B_392:45617,BLAKE2B_400:45618,BLAKE2B_408:45619,BLAKE2B_416:45620,BLAKE2B_424:45621,BLAKE2B_432:45622,BLAKE2B_440:45623,BLAKE2B_448:45624,BLAKE2B_456:45625,BLAKE2B_464:45626,BLAKE2B_472:45627,BLAKE2B_480:45628,BLAKE2B_488:45629,BLAKE2B_496:45630,BLAKE2B_504:45631,BLAKE2B_512:45632,BLAKE2S_8:45633,BLAKE2S_16:45634,BLAKE2S_24:45635,BLAKE2S_32:45636,BLAKE2S_40:45637,BLAKE2S_48:45638,BLAKE2S_56:45639,BLAKE2S_64:45640,BLAKE2S_72:45641,BLAKE2S_80:45642,BLAKE2S_88:45643,BLAKE2S_96:45644,BLAKE2S_104:45645,BLAKE2S_112:45646,BLAKE2S_120:45647,BLAKE2S_128:45648,BLAKE2S_136:45649,BLAKE2S_144:45650,BLAKE2S_152:45651,BLAKE2S_160:45652,BLAKE2S_168:45653,BLAKE2S_176:45654,BLAKE2S_184:45655,BLAKE2S_192:45656,BLAKE2S_200:45657,BLAKE2S_208:45658,BLAKE2S_216:45659,BLAKE2S_224:45660,BLAKE2S_232:45661,BLAKE2S_240:45662,BLAKE2S_248:45663,BLAKE2S_256:45664,SKEIN256_8:45825,SKEIN256_16:45826,SKEIN256_24:45827,SKEIN256_32:45828,SKEIN256_40:45829,SKEIN256_48:45830,SKEIN256_56:45831,SKEIN256_64:45832,SKEIN256_72:45833,SKEIN256_80:45834,SKEIN256_88:45835,SKEIN256_96:45836,SKEIN256_104:45837,SKEIN256_112:45838,SKEIN256_120:45839,SKEIN256_128:45840,SKEIN256_136:45841,SKEIN256_144:45842,SKEIN256_152:45843,SKEIN256_160:45844,SKEIN256_168:45845,SKEIN256_176:45846,SKEIN256_184:45847,SKEIN256_192:45848,SKEIN256_200:45849,SKEIN256_208:45850,SKEIN256_216:45851,SKEIN256_224:45852,SKEIN256_232:45853,SKEIN256_240:45854,SKEIN256_248:45855,SKEIN256_256:45856,SKEIN512_8:45857,SKEIN512_16:45858,SKEIN512_24:45859,SKEIN512_32:45860,SKEIN512_40:45861,SKEIN512_48:45862,SKEIN512_56:45863,SKEIN512_64:45864,SKEIN512_72:45865,SKEIN512_80:45866,SKEIN512_88:45867,SKEIN512_96:45868,SKEIN512_104:45869,SKEIN512_112:45870,SKEIN512_120:45871,SKEIN512_128:45872,SKEIN512_136:45873,SKEIN512_144:45874,SKEIN512_152:45875,SKEIN512_160:45876,SKEIN512_168:45877,SKEIN512_176:45878,SKEIN512_184:45879,SKEIN512_192:45880,SKEIN512_200:45881,SKEIN512_208:45882,SKEIN512_216:45883,SKEIN512_224:45884,SKEIN512_232:45885,SKEIN512_240:45886,SKEIN512_248:45887,SKEIN512_256:45888,SKEIN512_264:45889,SKEIN512_272:45890,SKEIN512_280:45891,SKEIN512_288:45892,SKEIN512_296:45893,SKEIN512_304:45894,SKEIN512_312:45895,SKEIN512_320:45896,SKEIN512_328:45897,SKEIN512_336:45898,SKEIN512_344:45899,SKEIN512_352:45900,SKEIN512_360:45901,SKEIN512_368:45902,SKEIN512_376:45903,SKEIN512_384:45904,SKEIN512_392:45905,SKEIN512_400:45906,SKEIN512_408:45907,SKEIN512_416:45908,SKEIN512_424:45909,SKEIN512_432:45910,SKEIN512_440:45911,SKEIN512_448:45912,SKEIN512_456:45913,SKEIN512_464:45914,SKEIN512_472:45915,SKEIN512_480:45916,SKEIN512_488:45917,SKEIN512_496:45918,SKEIN512_504:45919,SKEIN512_512:45920,SKEIN1024_8:45921,SKEIN1024_16:45922,SKEIN1024_24:45923,SKEIN1024_32:45924,SKEIN1024_40:45925,SKEIN1024_48:45926,SKEIN1024_56:45927,SKEIN1024_64:45928,SKEIN1024_72:45929,SKEIN1024_80:45930,SKEIN1024_88:45931,SKEIN1024_96:45932,SKEIN1024_104:45933,SKEIN1024_112:45934,SKEIN1024_120:45935,SKEIN1024_128:45936,SKEIN1024_136:45937,SKEIN1024_144:45938,SKEIN1024_152:45939,SKEIN1024_160:45940,SKEIN1024_168:45941,SKEIN1024_176:45942,SKEIN1024_184:45943,SKEIN1024_192:45944,SKEIN1024_200:45945,SKEIN1024_208:45946,SKEIN1024_216:45947,SKEIN1024_224:45948,SKEIN1024_232:45949,SKEIN1024_240:45950,SKEIN1024_248:45951,SKEIN1024_256:45952,SKEIN1024_264:45953,SKEIN1024_272:45954,SKEIN1024_280:45955,SKEIN1024_288:45956,SKEIN1024_296:45957,SKEIN1024_304:45958,SKEIN1024_312:45959,SKEIN1024_320:45960,SKEIN1024_328:45961,SKEIN1024_336:45962,SKEIN1024_344:45963,SKEIN1024_352:45964,SKEIN1024_360:45965,SKEIN1024_368:45966,SKEIN1024_376:45967,SKEIN1024_384:45968,SKEIN1024_392:45969,SKEIN1024_400:45970,SKEIN1024_408:45971,SKEIN1024_416:45972,SKEIN1024_424:45973,SKEIN1024_432:45974,SKEIN1024_440:45975,SKEIN1024_448:45976,SKEIN1024_456:45977,SKEIN1024_464:45978,SKEIN1024_472:45979,SKEIN1024_480:45980,SKEIN1024_488:45981,SKEIN1024_496:45982,SKEIN1024_504:45983,SKEIN1024_512:45984,SKEIN1024_520:45985,SKEIN1024_528:45986,SKEIN1024_536:45987,SKEIN1024_544:45988,SKEIN1024_552:45989,SKEIN1024_560:45990,SKEIN1024_568:45991,SKEIN1024_576:45992,SKEIN1024_584:45993,SKEIN1024_592:45994,SKEIN1024_600:45995,SKEIN1024_608:45996,SKEIN1024_616:45997,SKEIN1024_624:45998,SKEIN1024_632:45999,SKEIN1024_640:46e3,SKEIN1024_648:46001,SKEIN1024_656:46002,SKEIN1024_664:46003,SKEIN1024_672:46004,SKEIN1024_680:46005,SKEIN1024_688:46006,SKEIN1024_696:46007,SKEIN1024_704:46008,SKEIN1024_712:46009,SKEIN1024_720:46010,SKEIN1024_728:46011,SKEIN1024_736:46012,SKEIN1024_744:46013,SKEIN1024_752:46014,SKEIN1024_760:46015,SKEIN1024_768:46016,SKEIN1024_776:46017,SKEIN1024_784:46018,SKEIN1024_792:46019,SKEIN1024_800:46020,SKEIN1024_808:46021,SKEIN1024_816:46022,SKEIN1024_824:46023,SKEIN1024_832:46024,SKEIN1024_840:46025,SKEIN1024_848:46026,SKEIN1024_856:46027,SKEIN1024_864:46028,SKEIN1024_872:46029,SKEIN1024_880:46030,SKEIN1024_888:46031,SKEIN1024_896:46032,SKEIN1024_904:46033,SKEIN1024_912:46034,SKEIN1024_920:46035,SKEIN1024_928:46036,SKEIN1024_936:46037,SKEIN1024_944:46038,SKEIN1024_952:46039,SKEIN1024_960:46040,SKEIN1024_968:46041,SKEIN1024_976:46042,SKEIN1024_984:46043,SKEIN1024_992:46044,SKEIN1024_1000:46045,SKEIN1024_1008:46046,SKEIN1024_1016:46047,SKEIN1024_1024:46048,IP4:4,IP6:41,IP6ZONE:42,TCP:6,UDP:273,DCCP:33,SCTP:132,UDT:301,UTP:302,P2P:421,IPFS:421,HTTP:480,HTTPS:443,QUIC:460,WS:477,WSS:478,ONION:444,ONION3:445,GARLIC64:446,P2P_CIRCUIT:290,DNS:53,DNS4:54,DNS6:55,DNSADDR:56,P2P_WEBSOCKET_STAR:479,P2P_STARDUST:277,P2P_WEBRTC_STAR:275,P2P_WEBRTC_DIRECT:276,UNIX:400,DAG_PB:112,DAG_CBOR:113,DAG_JSON:297,GIT_RAW:120,ETH_BLOCK:144,ETH_BLOCK_LIST:145,ETH_TX_TRIE:146,ETH_TX:147,ETH_TX_RECEIPT_TRIE:148,ETH_TX_RECEIPT:149,ETH_STATE_TRIE:150,ETH_ACCOUNT_SNAPSHOT:151,ETH_STORAGE_TRIE:152,BITCOIN_BLOCK:176,BITCOIN_TX:177,ZCASH_BLOCK:192,ZCASH_TX:193,STELLAR_BLOCK:208,STELLAR_TX:209,DECRED_BLOCK:224,DECRED_TX:225,DASH_BLOCK:240,DASH_TX:241,LEOFCOIN_BLOCK:129,LEOFCOIN_TX:130,LEOFCOIN_PR:131,TORRENT_INFO:123,TORRENT_FILE:124,ED25519_PUB:237,IPLD_NS:226,IPFS_NS:227,SWARM_NS:228})},function(e,t,n){"use strict";e.exports=Object.freeze({85:"raw",81:"cbor",80:"protobuf",96:"rlp",99:"bencode",48:"multicodec",49:"multihash",50:"multiaddr",51:"multibase",0:"identity",212:"md4",213:"md5",17:"sha1",18:"sha2-256",19:"sha2-512",86:"dbl-sha2-256",23:"sha3-224",22:"sha3-256",21:"sha3-384",20:"sha3-512",24:"shake-128",25:"shake-256",26:"keccak-224",27:"keccak-256",28:"keccak-384",29:"keccak-512",34:"murmur3-128",35:"murmur3-32",4352:"x11",45569:"blake2b-8",45570:"blake2b-16",45571:"blake2b-24",45572:"blake2b-32",45573:"blake2b-40",45574:"blake2b-48",45575:"blake2b-56",45576:"blake2b-64",45577:"blake2b-72",45578:"blake2b-80",45579:"blake2b-88",45580:"blake2b-96",45581:"blake2b-104",45582:"blake2b-112",45583:"blake2b-120",45584:"blake2b-128",45585:"blake2b-136",45586:"blake2b-144",45587:"blake2b-152",45588:"blake2b-160",45589:"blake2b-168",45590:"blake2b-176",45591:"blake2b-184",45592:"blake2b-192",45593:"blake2b-200",45594:"blake2b-208",45595:"blake2b-216",45596:"blake2b-224",45597:"blake2b-232",45598:"blake2b-240",45599:"blake2b-248",45600:"blake2b-256",45601:"blake2b-264",45602:"blake2b-272",45603:"blake2b-280",45604:"blake2b-288",45605:"blake2b-296",45606:"blake2b-304",45607:"blake2b-312",45608:"blake2b-320",45609:"blake2b-328",45610:"blake2b-336",45611:"blake2b-344",45612:"blake2b-352",45613:"blake2b-360",45614:"blake2b-368",45615:"blake2b-376",45616:"blake2b-384",45617:"blake2b-392",45618:"blake2b-400",45619:"blake2b-408",45620:"blake2b-416",45621:"blake2b-424",45622:"blake2b-432",45623:"blake2b-440",45624:"blake2b-448",45625:"blake2b-456",45626:"blake2b-464",45627:"blake2b-472",45628:"blake2b-480",45629:"blake2b-488",45630:"blake2b-496",45631:"blake2b-504",45632:"blake2b-512",45633:"blake2s-8",45634:"blake2s-16",45635:"blake2s-24",45636:"blake2s-32",45637:"blake2s-40",45638:"blake2s-48",45639:"blake2s-56",45640:"blake2s-64",45641:"blake2s-72",45642:"blake2s-80",45643:"blake2s-88",45644:"blake2s-96",45645:"blake2s-104",45646:"blake2s-112",45647:"blake2s-120",45648:"blake2s-128",45649:"blake2s-136",45650:"blake2s-144",45651:"blake2s-152",45652:"blake2s-160",45653:"blake2s-168",45654:"blake2s-176",45655:"blake2s-184",45656:"blake2s-192",45657:"blake2s-200",45658:"blake2s-208",45659:"blake2s-216",45660:"blake2s-224",45661:"blake2s-232",45662:"blake2s-240",45663:"blake2s-248",45664:"blake2s-256",45825:"skein256-8",45826:"skein256-16",45827:"skein256-24",45828:"skein256-32",45829:"skein256-40",45830:"skein256-48",45831:"skein256-56",45832:"skein256-64",45833:"skein256-72",45834:"skein256-80",45835:"skein256-88",45836:"skein256-96",45837:"skein256-104",45838:"skein256-112",45839:"skein256-120",45840:"skein256-128",45841:"skein256-136",45842:"skein256-144",45843:"skein256-152",45844:"skein256-160",45845:"skein256-168",45846:"skein256-176",45847:"skein256-184",45848:"skein256-192",45849:"skein256-200",45850:"skein256-208",45851:"skein256-216",45852:"skein256-224",45853:"skein256-232",45854:"skein256-240",45855:"skein256-248",45856:"skein256-256",45857:"skein512-8",45858:"skein512-16",45859:"skein512-24",45860:"skein512-32",45861:"skein512-40",45862:"skein512-48",45863:"skein512-56",45864:"skein512-64",45865:"skein512-72",45866:"skein512-80",45867:"skein512-88",45868:"skein512-96",45869:"skein512-104",45870:"skein512-112",45871:"skein512-120",45872:"skein512-128",45873:"skein512-136",45874:"skein512-144",45875:"skein512-152",45876:"skein512-160",45877:"skein512-168",45878:"skein512-176",45879:"skein512-184",45880:"skein512-192",45881:"skein512-200",45882:"skein512-208",45883:"skein512-216",45884:"skein512-224",45885:"skein512-232",45886:"skein512-240",45887:"skein512-248",45888:"skein512-256",45889:"skein512-264",45890:"skein512-272",45891:"skein512-280",45892:"skein512-288",45893:"skein512-296",45894:"skein512-304",45895:"skein512-312",45896:"skein512-320",45897:"skein512-328",45898:"skein512-336",45899:"skein512-344",45900:"skein512-352",45901:"skein512-360",45902:"skein512-368",45903:"skein512-376",45904:"skein512-384",45905:"skein512-392",45906:"skein512-400",45907:"skein512-408",45908:"skein512-416",45909:"skein512-424",45910:"skein512-432",45911:"skein512-440",45912:"skein512-448",45913:"skein512-456",45914:"skein512-464",45915:"skein512-472",45916:"skein512-480",45917:"skein512-488",45918:"skein512-496",45919:"skein512-504",45920:"skein512-512",45921:"skein1024-8",45922:"skein1024-16",45923:"skein1024-24",45924:"skein1024-32",45925:"skein1024-40",45926:"skein1024-48",45927:"skein1024-56",45928:"skein1024-64",45929:"skein1024-72",45930:"skein1024-80",45931:"skein1024-88",45932:"skein1024-96",45933:"skein1024-104",45934:"skein1024-112",45935:"skein1024-120",45936:"skein1024-128",45937:"skein1024-136",45938:"skein1024-144",45939:"skein1024-152",45940:"skein1024-160",45941:"skein1024-168",45942:"skein1024-176",45943:"skein1024-184",45944:"skein1024-192",45945:"skein1024-200",45946:"skein1024-208",45947:"skein1024-216",45948:"skein1024-224",45949:"skein1024-232",45950:"skein1024-240",45951:"skein1024-248",45952:"skein1024-256",45953:"skein1024-264",45954:"skein1024-272",45955:"skein1024-280",45956:"skein1024-288",45957:"skein1024-296",45958:"skein1024-304",45959:"skein1024-312",45960:"skein1024-320",45961:"skein1024-328",45962:"skein1024-336",45963:"skein1024-344",45964:"skein1024-352",45965:"skein1024-360",45966:"skein1024-368",45967:"skein1024-376",45968:"skein1024-384",45969:"skein1024-392",45970:"skein1024-400",45971:"skein1024-408",45972:"skein1024-416",45973:"skein1024-424",45974:"skein1024-432",45975:"skein1024-440",45976:"skein1024-448",45977:"skein1024-456",45978:"skein1024-464",45979:"skein1024-472",45980:"skein1024-480",45981:"skein1024-488",45982:"skein1024-496",45983:"skein1024-504",45984:"skein1024-512",45985:"skein1024-520",45986:"skein1024-528",45987:"skein1024-536",45988:"skein1024-544",45989:"skein1024-552",45990:"skein1024-560",45991:"skein1024-568",45992:"skein1024-576",45993:"skein1024-584",45994:"skein1024-592",45995:"skein1024-600",45996:"skein1024-608",45997:"skein1024-616",45998:"skein1024-624",45999:"skein1024-632",46000:"skein1024-640",46001:"skein1024-648",46002:"skein1024-656",46003:"skein1024-664",46004:"skein1024-672",46005:"skein1024-680",46006:"skein1024-688",46007:"skein1024-696",46008:"skein1024-704",46009:"skein1024-712",46010:"skein1024-720",46011:"skein1024-728",46012:"skein1024-736",46013:"skein1024-744",46014:"skein1024-752",46015:"skein1024-760",46016:"skein1024-768",46017:"skein1024-776",46018:"skein1024-784",46019:"skein1024-792",46020:"skein1024-800",46021:"skein1024-808",46022:"skein1024-816",46023:"skein1024-824",46024:"skein1024-832",46025:"skein1024-840",46026:"skein1024-848",46027:"skein1024-856",46028:"skein1024-864",46029:"skein1024-872",46030:"skein1024-880",46031:"skein1024-888",46032:"skein1024-896",46033:"skein1024-904",46034:"skein1024-912",46035:"skein1024-920",46036:"skein1024-928",46037:"skein1024-936",46038:"skein1024-944",46039:"skein1024-952",46040:"skein1024-960",46041:"skein1024-968",46042:"skein1024-976",46043:"skein1024-984",46044:"skein1024-992",46045:"skein1024-1000",46046:"skein1024-1008",46047:"skein1024-1016",46048:"skein1024-1024",4:"ip4",41:"ip6",42:"ip6zone",6:"tcp",273:"udp",33:"dccp",132:"sctp",301:"udt",302:"utp",421:"p2p",480:"http",443:"https",460:"quic",477:"ws",478:"wss",444:"onion",445:"onion3",446:"garlic64",290:"p2p-circuit",53:"dns",54:"dns4",55:"dns6",56:"dnsaddr",479:"p2p-websocket-star",277:"p2p-stardust",275:"p2p-webrtc-star",276:"p2p-webrtc-direct",400:"unix",112:"dag-pb",113:"dag-cbor",297:"dag-json",120:"git-raw",144:"eth-block",145:"eth-block-list",146:"eth-tx-trie",147:"eth-tx",148:"eth-tx-receipt-trie",149:"eth-tx-receipt",150:"eth-state-trie",151:"eth-account-snapshot",152:"eth-storage-trie",176:"bitcoin-block",177:"bitcoin-tx",192:"zcash-block",193:"zcash-tx",208:"stellar-block",209:"stellar-tx",224:"decred-block",225:"decred-tx",240:"dash-block",241:"dash-tx",129:"leofcoin-block",130:"leofcoin-tx",131:"leofcoin-pr",123:"torrent-info",124:"torrent-file",237:"ed25519-pub",226:"ipld-ns",227:"ipfs-ns",228:"swarm-ns"})},function(e,t,n){"use strict";(function(t){const r=n(42);var i={checkCIDComponents:function(e){if(null==e)return"null values are not valid CIDs";if(0!==e.version&&1!==e.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof e.codec)return"codec must be string";if(!t.isBuffer(e.multihash))return"multihash must be a Buffer";try{r.validate(e.multihash)}catch(e){let t=e.message;return t||(t="Multihash validation failed"),t}}};e.exports=i}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports={keys:n(784),once:n(137),values:n(43),count:n(785),infinite:n(786),empty:n(106),error:n(82)}},function(e,t,n){"use strict";var r=n(43);e.exports=function(e){return r(Object.keys(e))}},function(e,t,n){"use strict";e.exports=function e(t){var n=0;return t=t||1/0,function(e,r){return e?r&&r(e):n>t?r(!0):void r(null,n++)}}},function(e,t,n){"use strict";e.exports=function e(t){return t=t||Math.random,function(e,n){return e?n&&n(e):n(null,t())}}},function(e,t,n){"use strict";e.exports={drain:n(175),onEnd:n(403),log:n(788),find:n(789),reduce:n(220),collect:n(36),concat:n(790)}},function(e,t,n){"use strict";var r=n(175);e.exports=function e(t){return r(function(e){console.log(e)},t)}},function(e,t,n){"use strict";function r(e){return e}var i=n(176),o=n(175);e.exports=function e(t,n){var s=!1;return n?t=i(t)||r:(n=t,t=r),o(function(e){if(t(e))return s=!0,n(null,e),!1},function(e){s||n(!0===e?null:e,null)})}},function(e,t,n){"use strict";var r=n(220);e.exports=function e(t){return r(function(e,t){return e+t},"",t)}},function(e,t,n){"use strict";e.exports={map:n(76),asyncMap:n(88),filter:n(77),filterNot:n(792),through:n(221),take:n(294),unique:n(405),nonUnique:n(793),flatten:n(222)}},function(e,t,n){"use strict";var r=n(404),i=n(77);e.exports=function e(t){return t=r(t),i(function(e){return!t(e)})}},function(e,t,n){"use strict";var r=n(405);e.exports=function e(t){return r(t,!0)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var r=n(66),i=f(r),o=n(104),s=f(o),a=n(135),u=f(a),l=n(41),c=f(l);function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t,n){n=(0,u.default)(n||i.default);var r=(0,c.default)(e),o=function(e){if(e)return n(e);var i=(0,s.default)(arguments,1);if(t.apply(this,i))return r(o);n.apply(null,[null].concat(i))};r(o)}e.exports=t.default},function(e,t){e.exports=function e(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},function(e,t,n){"use strict";t.create=function e(t,n,r){const i=r.storageBackends[t],o=Object.assign({},r.storageBackendOptions[t]||{});return new i(n,o)}},function(e,t,n){"use strict";(function(t){const r=n(33).Key,i=n(5),o=i("repo:version"),s=new r("version");e.exports=(e=>({exists(t){e.has(s,t)},get(t){e.get(s,(e,n)=>{if(e)return t(e);t(null,parseInt(n.toString().trim(),10))})},set(n,r){e.put(s,t.from(String(n)),r)},check(e,t){this.get((n,r)=>{if(n)return t(n);o("comparing version: %s and %s",r,e);const i=6===r&&7===e||6===e&&7===r;if(r!==e&&!i)return t(new Error(`ipfs repo needs migration: expected version v${e}, found version v${r}`));t()})}}))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(26),i=n(16),o=n(296).asyncFilter,s=n(296).asyncSort,a=n(410),u=n(413);class l{constructor(){this.data={}}open(e){i(e)}put(e,t,n){this.data[e.toString()]=t,i(n)}get(e,t){this.has(e,(n,r)=>n?t(n):r?void t(null,this.data[e.toString()]):t(u.notFoundError()))}has(e,t){i(()=>{t(null,void 0!==this.data[e.toString()])})}delete(e,t){delete this.data[e.toString()],i(()=>{t()})}batch(){let e=[],t=[];return{put(t,n){e.push([t,n])},delete(e){t.push(e)},commit:n=>{e.forEach(e=>{this.data[e[0].toString()]=e[1]}),e=[],t.forEach(e=>{delete this.data[e.toString()]}),t=[],i(n)}}}query(e){let t=[r.keys(this.data),r.map(e=>({key:new a(e),value:this.data[e]}))],n=[];if(null!=e.prefix){const t=e.prefix;n.push((e,n)=>n(null,e.key.toString().startsWith(t)))}if(null!=e.filters&&(n=n.concat(e.filters)),t=t.concat(n.map(e=>o(e))),null!=e.orders&&(t=t.concat(e.orders.map(e=>s(e)))),null!=e.offset){let n=0;t.push(r.filter(()=>n++>=e.offset))}return null!=e.limit&&t.push(r.take(e.limit)),!0===e.keysOnly&&t.push(r.map(e=>({key:e.key}))),r.apply(null,t)}close(e){i(e)}}e.exports=l},function(e,t,n){"use strict";const r=n(33).Key,i=n(226),o=n(11),s=n(409),a=n(806),u=n(0).Buffer,l=new r("config");e.exports=(e=>{const t=i(r,1),n={get(t,n){"function"==typeof t&&(n=t,t=void 0),t||(t=void 0),e.get(l,(e,r)=>{if(e)return n(e);let i;try{i=JSON.parse(r.toString())}catch(e){return n(e)}if(void 0===t)return n(null,i);if("string"!=typeof t)return n(new Error("Key "+t+" must be a string."));const o=s(i,t,null);if(null===o)return n(new Error("Key "+t+" does not exist in config."));n(null,o)})},set(e,n,r){if("function"==typeof n)r=n,n=e,e=void 0;else if(!e||"string"!=typeof e)return r(new Error("Invalid key type"));if(void 0===n||u.isBuffer(n))return r(new Error("Invalid value type"));t.push({key:e,value:n},r)},exists(t){e.has(l,t)}};return n;function r(e,t){const r=e.key,i=e.value;r?o([e=>n.get(e),(e,t)=>{a(e,r,i),t(null,e)},c],t):c(i,t)}function c(t,n){const r=u.from(JSON.stringify(t,null,2));e.put(l,r,n)}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=b;var r=n(801),i=y(r),o=n(67),s=y(o),a=n(66),u=y(a),l=n(135),c=y(l),f=n(218),h=y(f),p=n(805),d=y(p),m=n(41),g=y(m);function y(e){return e&&e.__esModule?e:{default:e}}function b(e,t,n){if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var r=(0,g.default)(e),o=0,a=[],l=!1;function f(e,t,n){if(null!=n&&"function"!=typeof n)throw new Error("task callback must be a function");if(y.started=!0,(0,s.default)(e)||(e=[e]),0===e.length&&y.idle())return(0,h.default)(function(){y.drain()});for(var r=0,i=e.length;r0&&a.splice(u,1),s.callback.apply(s,arguments),null!=t&&y.error(t,s.data)}o<=y.concurrency-y.buffer&&y.unsaturated(),y.idle()&&y.drain(),y.process()}}var m=!1,y={_tasks:new d.default,concurrency:t,payload:n,saturated:u.default,unsaturated:u.default,buffer:t/4,empty:u.default,drain:u.default,error:u.default,started:!1,paused:!1,push:function(e,t){f(e,!1,t)},kill:function(){y.drain=u.default,y._tasks.empty()},unshift:function(e,t){f(e,!0,t)},remove:function(e){y._tasks.remove(e)},process:function(){if(!m){for(m=!0;!y.paused&&o({exists(t){e.has(o,t)},get(t){e.get(o,(e,n)=>{if(e)return t(e);t(null,JSON.parse(n.toString()))})},set(n,r){e.put(o,t.from(JSON.stringify(i(n,{deep:!0}))),r)}}))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(414);e.exports=((e,t)=>{if(!r(e))throw new TypeError("Expected a plain object");if(t=t||{},"function"==typeof t)throw new TypeError("Specify the compare function as an option instead");const n=t.deep,i=[],o=[],s=e=>{const a=i.indexOf(e);if(-1!==a)return o[a];const u={},l=Object.keys(e).sort(t.compare);i.push(e),o.push(u);for(let t=0;t({get(t){e.get(i,(e,n)=>t(e,n&&n.toString()))},set(n,r){e.put(i,t.from(n.toString()),r)},delete(t){e.delete(i,t)}}))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(415),i=r.ShardingDatastore,o=n(33).Key,s=n(817),a=n(136),u=n(16),l=n(417),c=n(9),f=n(12),h=n(36),p=e=>{const t=new s.Encoder;return new o("/"+t.write(e).finalize(),!1)},d=e=>p(e.buffer);function m(e,t,n){if(t.sharding){const t=new r.shard.NextToLast(2);i.createOrOpen(e,t,n)}else u(()=>n(null,e))}function g(e){return{query(t,n){f(e.query(t),h(n))},get(t,n){if(!c.isCID(t))return u(()=>{n(new Error("Not a valid cid"))});const r=d(t);e.get(r,(i,o)=>{if(i){if("ERR_NOT_FOUND"===i.code){const o=y(t);if(!o)return n(i);const s=d(o);return e.get(s,(i,o)=>{if(i)return n(i);e.put(r,o,e=>{if(e)return n(e);n(null,new a(o,t))})})}return n(i)}n(null,new a(o,t))})},put(t,n){if(!a.isBlock(t))return u(()=>{n(new Error("invalid block"))});const r=d(t.cid);e.has(r,(i,o)=>i?n(i):o?n():void e.put(r,t.data,n))},putMany(t,n){const r=t.map(e=>({key:d(e.cid),block:e})),i=e.batch();l(r,(t,n)=>e.has(t.key,n),(e,t)=>{if(e)return n(e);t.forEach(e=>{i.put(e.key,e.block.data)}),i.commit(n)})},has(t,n){if(!c.isCID(t))return u(()=>{n(new Error("Not a valid cid"))});e.has(d(t),(r,i)=>{if(r)return n(r);if(i)return n(null,!0);const o=y(t);if(!o)return n(null,!1);e.has(d(o),n)})},delete(t,n){if(!c.isCID(t))return u(()=>{n(new Error("Not a valid cid"))});e.delete(d(t),n)},close(t){e.close(t)}}}function y(e){try{return 0===e.version?e.toV1():e.toV0()}catch(e){return null}}e.exports=((e,t,n)=>{m(e,t,(e,t)=>{if(e)return n(e);n(null,g(t))})})},function(e,t,n){"use strict";(function(t){const r=n(11),i=n(53),o=n(33).Key,s=n(416),a=n(227),u=new o(s.SHARDING_FN),l=new o(s.README_FN);class c{constructor(e,t){this.child=new a(e,{convert:this._convertKey.bind(this),invert:this._invertKey.bind(this)}),this.shard=t}open(e){this.child.open(e)}_convertKey(e){const t=e.toString();if(t===u.toString()||t===l.toString())return e;const n=new o(this.shard.fun(t));return n.child(e)}_invertKey(e){const t=e.toString();return t===u.toString()||t===l.toString()?e:o.withNamespaces(e.list().slice(1))}static createOrOpen(e,t,n){c.create(e,t,t=>{if(t&&"datastore exists"!==t.message)return n(t);c.open(e,n)})}static open(e,t){r([t=>s.readShardFun("/",e,t),(t,n)=>{n(null,new c(e,t))}],t)}static create(e,n,r){e.has(u,(o,a)=>{if(o)return r(o);if(!a){const o="function"==typeof e.putRaw?e.putRaw.bind(e):e.put.bind(e);return i([e=>o(u,t.from(n.toString()+"\n"),e),e=>o(l,t.from(s.readme),e)],e=>r(e))}s.readShardFun("/",e,(e,t)=>{if(e)return r(e);const i=(t||"").toString(),o=n.toString();if(i!==o)return r(new Error(`specified fun ${o} does not match repo shard fun ${i}`));r(new Error("datastore exists"))})})}put(e,t,n){this.child.put(e,t,n)}get(e,t){this.child.get(e,t)}has(e,t){this.child.has(e,t)}delete(e,t){this.child.delete(e,t)}batch(){return this.child.batch()}query(e){const t={keysOnly:e.keysOnly,offset:e.offset,limit:e.limit,filters:[(e,t)=>t(null,e.key.toString()!==u.toString()),(e,t)=>t(null,e.key.toString()!==l.toString())]};if(null!=e.prefix&&t.filters.push((t,n)=>{n(null,this._invertKey(t.key).toString().startsWith(e.prefix))}),null!=e.filters){const n=e.filters.map(e=>(t,n)=>{e(Object.assign({},t,{key:this._invertKey(t.key)}),n)});t.filters=t.filters.concat(n)}return null!=e.orders&&(t.orders=e.orders.map(e=>(t,n)=>{t.forEach(e=>{e.key=this._invertKey(e.key)}),e(t,(e,t)=>{if(e)return n(e);t.forEach(e=>{e.key=this._convertKey(e.key)}),n(null,t)})})),this.child.query(t)}close(e){this.child.close(e)}}e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports="This is a repository of IPLD objects. Each IPLD object is in a single file,\nnamed .data. Where is the\n\"base32\" encoding of the CID (as specified in\nhttps://github.com/multiformats/multibase) without the 'B' prefix.\nAll the object files are placed in a tree of directories, based on a\nfunction of the CID. This is a form of sharding similar to\nthe objects directory in git repositories. Previously, we used\nprefixes, we now use the next-to-last two charters.\n func NextToLast(base32cid string) {\n nextToLastLen := 2\n offset := len(base32cid) - nextToLastLen - 1\n return str[offset : offset+nextToLastLen]\n }\nFor example, an object with a base58 CIDv1 of\n zb2rhYSxw4ZjuzgCnWSt19Q94ERaeFhu9uSqRgjSdx9bsgM6f\nhas a base32 CIDv1 of\n BAFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA\nand will be placed at\n SC/AFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA.data\nwith 'SC' being the last-to-next two characters and the 'B' at the\nbeginning of the CIDv1 string is the multibase prefix that is not\nstored in the filename.\n"},function(e,t,n){"use strict";const r=n(61),i=n(814),o=n(26),s=n(33).Key,a=n(33).Errors,u=n(33).utils,l=u.asyncFilter,c=u.asyncSort,f=u.replaceStartWith,h=n(227);class p{constructor(e){this.mounts=e.slice()}open(e){r(this.mounts,(e,t)=>{e.datastore.open(t)},e)}_lookup(e){for(let t of this.mounts)if(t.prefix.toString()===e.toString()||t.prefix.isAncestorOf(e)){const n=f(e.toString(),t.prefix.toString());return{datastore:t.datastore,mountpoint:t.prefix,rest:new s(n)}}}put(e,t,n){const r=this._lookup(e);if(null==r)return n(a.dbWriteFailedError(new Error("No datastore mounted for this key")));r.datastore.put(r.rest,t,n)}get(e,t){const n=this._lookup(e);if(null==n)return t(a.notFoundError(new Error("No datastore mounted for this key")));n.datastore.get(n.rest,t)}has(e,t){const n=this._lookup(e);null!=n?n.datastore.has(n.rest,t):t(null,!1)}delete(e,t){const n=this._lookup(e);if(null==n)return t(a.dbDeleteFailedError(new Error("No datastore mounted for this key")));n.datastore.delete(n.rest,t)}close(e){r(this.mounts,(e,t)=>{e.datastore.close(t)},e)}batch(){const e={},t=t=>{const n=this._lookup(t);if(null==n)throw new Error("No datastore mounted for this key");const r=n.mountpoint.toString();return null==e[r]&&(e[r]=n.datastore.batch()),{batch:e[r],rest:n.rest}};return{put:(e,n)=>{const r=t(e);r.batch.put(r.rest,n)},delete:e=>{const n=t(e);n.batch.delete(n.rest)},commit:t=>{r(Object.keys(e),(t,n)=>{e[t].commit(n)},t)}}}query(e){const t=this.mounts.map(t=>{const n=new h(t.datastore,{convert:e=>{throw new Error("should never be called")},invert:e=>t.prefix.child(e)});let r;return null!=e.prefix&&(r=f(e.prefix,t.prefix.toString())),n.query({prefix:r,filters:e.filters,keysOnly:e.keysOnly})});let n=[i(t)];if(null!=e.filters&&(n=n.concat(e.filters.map(e=>l(e)))),null!=e.orders&&(n=n.concat(e.orders.map(e=>c(e)))),null!=e.offset){let t=0;n.push(o.filter(()=>t++>=e.offset))}return null!=e.limit&&n.push(o.take(e.limit)),o.apply(null,n)}}e.exports=p},function(e,t){e.exports=function(e){var t=!!e,n=(e||[]).map(s),r=0,i,o;function s(e){return{ready:!1,reading:!1,ended:!1,read:e,data:null}}function a(){if(o){u();var e=n.length,s=o;if(0===e&&(i||t))return o=null,void s(i||!0);for(var a=0;an.length)throw new Error("this should never happen");if(!(t.reading||t.ended||t.ready)){t.reading=!0;var r=!0;t.read(i,function e(n,o){t.data=o,t.ready=!0,t.reading=!1,!0===n||i?t.ended=!0:n&&(i=t.ended=n),i&&!n&&t.read(i,e),r||a()}),r=!1}}(n[e]);a()}function c(e,t){i=i||e,o=t,l()}return c.add=function(e){if(!e)return t=!0,l();n.push(s(e)),l()},c.cap=function(e){c.add(null)},c}},function(e,t,n){"use strict";const r=n(61),i=n(229),o=n(33).Errors;class s{constructor(e){this.stores=e.slice()}open(e){r(this.stores,(e,t)=>{e.open(t)},t=>{if(t)return e(o.dbOpenFailedError());e()})}put(e,t,n){r(this.stores,(n,r)=>{n.put(e,t,r)},e=>{if(e)return n(o.dbWriteFailedError());n()})}get(e,t){const n=this.stores.length;let r=!1,s=0;i(()=>!r&&s{const n=this.stores[s++];n.get(e,(e,n)=>{if(null==e)return r=!0,t(null,n);t()})},(e,n)=>{if(e||!n)return t(o.notFoundError());t(null,n)})}has(e,t){const n=this.stores.length;let r=!1,o=0;i(()=>!r&&o{const n=this.stores[o++];n.has(e,(e,n)=>{if(null==e)return r=!0,t(null,n);t()})},t)}delete(e,t){r(this.stores,(t,n)=>{t.delete(e,n)},e=>{if(e)return t(o.dbDeleteFailedError());t()})}close(e){r(this.stores,(e,t)=>{e.close(t)},e)}batch(){const e=this.stores.map(e=>e.batch());return{put:(t,n)=>{e.forEach(e=>e.put(t,n))},delete:t=>{e.forEach(e=>e.delete(t))},commit:t=>{r(e,(e,t)=>{e.commit(t)},t)}}}query(e){return this.stores[this.stores.length-1].query(e)}}e.exports=s},function(e,t,n){"use strict";const r=n(33).Key,i=n(227);class o extends i{constructor(e,t){super(e,{convert:e=>t.child(e),invert(e){if("/"===t.toString())return e;if(!t.isAncestorOf(e))throw new Error(`Expected prefix: (${t.toString()}) in key: ${e.toString()}`);return new r(e.toString().slice(t.toString().length),!1)}}),this.prefix=t}query(e){return e.prefix&&"/"!==this.prefix.toString()?super.query(Object.assign({},e,{prefix:this.prefix.child(new r(e.prefix)).toString()})):super.query(e)}}e.exports=o},function(e,t,n){"use strict";var r=function(e,t){return t||(t={}),e.split("").forEach(function(e,n){e in t||(t[e]=n)}),t},i={alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",charmap:{0:14,1:8}};i.charmap=r(i.alphabet,i.charmap);var o={alphabet:"0123456789ABCDEFGHJKMNPQRSTVWXYZ",charmap:{O:0,I:1,L:1}};o.charmap=r(o.alphabet,o.charmap);var s={alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",charmap:{}};function a(e){if(this.buf=[],this.shift=8,this.carry=0,e){switch(e.type){case"rfc4648":this.charmap=t.rfc4648.charmap;break;case"crockford":this.charmap=t.crockford.charmap;break;case"base32hex":this.charmap=t.base32hex.charmap;break;default:throw new Error("invalid type")}e.charmap&&(this.charmap=e.charmap)}}function u(e){if(this.buf="",this.shift=3,this.carry=0,e){switch(e.type){case"rfc4648":this.alphabet=t.rfc4648.alphabet;break;case"crockford":this.alphabet=t.crockford.alphabet;break;case"base32hex":this.alphabet=t.base32hex.alphabet;break;default:throw new Error("invalid type")}e.alphabet?this.alphabet=e.alphabet:e.lc&&(this.alphabet=this.alphabet.toLowerCase())}}s.charmap=r(s.alphabet,s.charmap),a.prototype.charmap=i.charmap,a.prototype.write=function(e){var t=this.charmap,n=this.buf,r=this.shift,i=this.carry;return e.toUpperCase().split("").forEach(function(e){if("="!=e){var o=255&t[e];r-=5,r>0?i|=o<>-r),r+=8,i=o<>t,this.buf+=this.alphabet[31&r],t>5&&(t-=5,r=i>>t,this.buf+=this.alphabet[31&r]),t=5-t,n=i<0?this.tail.next=n:this.head=n,this.tail=n,++this.length},e.prototype.unshift=function e(t){var n={data:t,next:this.head};0===this.length&&(this.tail=n),this.head=n,++this.length},e.prototype.shift=function e(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},e.prototype.clear=function e(){this.head=this.tail=null,this.length=0},e.prototype.join=function e(t){if(0===this.length)return"";for(var n=this.head,r=""+n.data;n=n.next;)r+=t+n.data;return r},e.prototype.concat=function e(t){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var n=i.allocUnsafe(t>>>0),r=this.head,o=0;r;)s(r.data,n,o),o+=r.data.length,r=r.next;return n},e}(),o&&o.inspect&&o.inspect.custom&&(e.exports.prototype[o.inspect.custom]=function(){var e=o.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,n){"use strict";e.exports=o;var r=n(426),i=n(7);function o(e){if(!(this instanceof o))return new o(e);r.call(this,e)}i.inherits=n(1),i.inherits(o,r),o.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){var r=n(427).WriteError,i=n(429);function o(e){this._levelup=e,this.batch=e.db.batch(),this.ops=[],this.length=0}o.prototype.put=function(e,t){try{this.batch.put(e,t)}catch(e){throw new r(e)}return this.ops.push({type:"put",key:e,value:t}),this.length++,this},o.prototype.del=function(e){try{this.batch.del(e)}catch(e){throw new r(e)}return this.ops.push({type:"del",key:e}),this.length++,this},o.prototype.clear=function(){try{this.batch.clear()}catch(e){throw new r(e)}return this.ops=[],this.length=0,this},o.prototype.write=function(e){var t=this._levelup,n=this.ops,o;e||(e=i(),o=e.promise);try{this.batch.write(function(i){if(i)return e(new r(i));t.emit("batch",n),e()})}catch(e){throw new r(e)}return o},e.exports=o},function(e,t,n){var r=n(833);function i(e,t,n){t&&"string"!=typeof t&&(t=t.message||t.name),r(this,{type:e,name:e,cause:"string"!=typeof t?t:n,message:t},"ewr")}function o(e,t){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),i.call(this,"CustomError",e,t)}function s(e,t,n){var r=function(n,o){i.call(this,t,n,o),"FilesystemError"==t&&(this.code=this.cause.code,this.path=this.cause.path,this.errno=this.cause.errno,this.message=(e.errno[this.cause.errno]?e.errno[this.cause.errno].description:this.cause.message)+(this.cause.path?" ["+this.cause.path+"]":"")),Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,r)};return r.prototype=n?new n:new o,r}o.prototype=new Error,e.exports=function(e){var t=function(t,n){return s(e,t,n)};return{CustomError:o,FilesystemError:t("FilesystemError"),createError:t}}},function(e,t,n){ /*! * prr * (c) 2013 Rod Vagg * https://github.com/rvagg/prr * License: MIT */ -var n,i,o;n="prr",i=this,o=function(){var e="function"==typeof Object.defineProperty?function(e,t,r){return Object.defineProperty(e,t,r),e}:function(e,t,r){return e[t]=r.value,e},t=function(e,t){var r="object"==typeof t,n=!r&&"string"==typeof t,i=function(e){return r?!!t[e]:!!n&&t.indexOf(e[0])>-1};return{enumerable:i("enumerable"),configurable:i("configurable"),writable:i("writable"),value:e}},r=function(r,n,i,o){var s;if(o=t(i,o),"object"==typeof n){for(s in n)Object.hasOwnProperty.call(n,s)&&(o.value=n[s],e(r,s,o));return r}return e(r,n,o)};return r},e.exports?e.exports=o():i.prr=o()},function(e,t,r){"use strict";var n=r(272).AbstractLevelDOWN,i=r(272).AbstractChainedBatch,o=r(272).AbstractIterator,s=r(1),a=r(41),u=r(775),c=r(777).EncodingError;function f(e,t){if(!(this instanceof f))return new f(e,t);n.call(this,""),t=t||{},void 0===t.keyEncoding&&(t.keyEncoding="utf8"),void 0===t.valueEncoding&&(t.valueEncoding="utf8"),this.db=e,this.codec=new u(t)}function h(e,t){o.call(this,e),this.codec=e.codec,this.keys=t.keys,this.values=t.values,this.opts=this.codec.encodeLtgt(t),this.it=e.db.iterator(this.opts)}function l(e,t){i.call(this,e),this.codec=e.codec,this.batch=e.db.batch()}e.exports=f.default=f,s(f,n),f.prototype._serializeKey=f.prototype._serializeValue=function(e){return e},f.prototype._open=function(e,t){this.db.open(e,t)},f.prototype._close=function(e){this.db.close(e)},f.prototype._put=function(e,t,r,n){e=this.codec.encodeKey(e,r),t=this.codec.encodeValue(t,r),this.db.put(e,t,r,n)},f.prototype._get=function(e,t,r){var n=this;e=this.codec.encodeKey(e,t),t.asBuffer=this.codec.valueAsBuffer(t),this.db.get(e,t,function(e,i){if(e)return r(e);try{i=n.codec.decodeValue(i,t)}catch(e){return r(new c(e))}r(null,i)})},f.prototype._del=function(e,t,r){e=this.codec.encodeKey(e,t),this.db.del(e,t,r)},f.prototype._chainedBatch=function(){return new l(this)},f.prototype._batch=function(e,t,r){e=this.codec.encodeBatch(e,t),this.db.batch(e,t,r)},f.prototype._iterator=function(e){return e.keyAsBuffer=this.codec.keyAsBuffer(e),e.valueAsBuffer=this.codec.valueAsBuffer(e),new h(this,e)},f.prototype._setupIteratorOptions=function(e){return e=a(e),e.reverse=!!e.reverse,e.keys=!1!==e.keys,e.values=!1!==e.values,e.limit="limit"in e?e.limit:-1,e.keyAsBuffer=!1!==e.keyAsBuffer,e.valueAsBuffer=!1!==e.valueAsBuffer,e},f.prototype.approximateSize=function(e,t,r,n){return this.db.approximateSize(e,t,r,n)},s(h,o),h.prototype._next=function(e){var t=this;this.it.next(function(r,n,i){if(r)return e(r);try{n=t.keys&&void 0!==n?t.codec.decodeKey(n,t.opts):void 0,i=t.values&&void 0!==i?t.codec.decodeValue(i,t.opts):void 0}catch(r){return e(new c(r))}e(null,n,i)})},h.prototype._end=function(e){this.it.end(e)},s(l,i),l.prototype._put=function(e,t){e=this.codec.encodeKey(e),t=this.codec.encodeValue(t),this.batch.put(e,t)},l.prototype._del=function(e){e=this.codec.encodeKey(e),this.batch.del(e)},l.prototype._clear=function(){this.batch.clear()},l.prototype._write=function(e,t){this.batch.write(e,t)}},function(e,t,r){(function(t,n){var i=r(41),o=r(393),s=r(394),a=Object.prototype.hasOwnProperty,u="start end gt gte lt lte".split(" ");function c(e){if(!arguments.length||void 0===e)throw new Error("constructor requires at least a location argument");if("string"!=typeof e)throw new Error("constructor requires a location string argument");this.location=e,this.status="new"}function f(e){var t={};for(var r in e)a.call(e,r)&&(h(r)&&l(e[r])||(t[r]=e[r]));return t}function h(e){return-1!==u.indexOf(e)}function l(e){return""===e||null==e||d(e)}function d(e){return n.isBuffer(e)&&0===e.length}c.prototype.open=function(e,t){var r=this,n=this.status;if("function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("open() requires a callback argument");"object"!=typeof e&&(e={}),e.createIfMissing=!1!==e.createIfMissing,e.errorIfExists=!!e.errorIfExists,this.status="opening",this._open(e,function(e){if(e)return r.status=n,t(e);r.status="open",t()})},c.prototype._open=function(e,r){t.nextTick(r)},c.prototype.close=function(e){var t=this,r=this.status;if("function"!=typeof e)throw new Error("close() requires a callback argument");this.status="closing",this._close(function(n){if(n)return t.status=r,e(n);t.status="closed",e()})},c.prototype._close=function(e){t.nextTick(e)},c.prototype.get=function(e,r,n){if("function"==typeof r&&(n=r),"function"!=typeof n)throw new Error("get() requires a callback argument");var i=this._checkKey(e,"key");if(i)return t.nextTick(n,i);e=this._serializeKey(e),"object"!=typeof r&&(r={}),r.asBuffer=!1!==r.asBuffer,this._get(e,r,n)},c.prototype._get=function(e,r,n){t.nextTick(function(){n(new Error("NotFound"))})},c.prototype.put=function(e,r,n,i){if("function"==typeof n&&(i=n),"function"!=typeof i)throw new Error("put() requires a callback argument");var o=this._checkKey(e,"key");if(o)return t.nextTick(i,o);e=this._serializeKey(e),r=this._serializeValue(r),"object"!=typeof n&&(n={}),this._put(e,r,n,i)},c.prototype._put=function(e,r,n,i){t.nextTick(i)},c.prototype.del=function(e,r,n){if("function"==typeof r&&(n=r),"function"!=typeof n)throw new Error("del() requires a callback argument");var i=this._checkKey(e,"key");if(i)return t.nextTick(n,i);e=this._serializeKey(e),"object"!=typeof r&&(r={}),this._del(e,r,n)},c.prototype._del=function(e,r,n){t.nextTick(n)},c.prototype.batch=function(e,r,n){if(!arguments.length)return this._chainedBatch();if("function"==typeof r&&(n=r),"function"==typeof e&&(n=e),"function"!=typeof n)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return t.nextTick(n,new Error("batch(array) requires an array argument"));r&&"object"==typeof r||(r={});for(var o=new Array(e.length),s=0;s-1?t.encodeKey(e[n],e):e[n]}),r},i.prototype.createStreamDecoder=function(e){var t=this;return e.keys&&e.values?function(r,n){return{key:t.decodeKey(r,e),value:t.decodeValue(n,e)}}:e.keys?function(r){return t.decodeKey(r,e)}:e.values?function(r,n){return t.decodeValue(n,e)}:function(){}},i.prototype.keyAsBuffer=function(e){return this._keyEncoding(e).buffer},i.prototype.valueAsBuffer=function(e){return this._valueEncoding(e).buffer}},function(e,t,r){(function(e){t.utf8=t["utf-8"]={encode:function(e){return i(e)?e:String(e)},decode:n,buffer:!1,type:"utf8"},t.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},t.binary={encode:function(t){return i(t)?t:e.from(t)},decode:n,buffer:!0,type:"binary"},t.none={encode:n,decode:n,buffer:!1,type:"id"},t.id=t.none;var r=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];function n(e){return e}function i(t){return void 0===t||null===t||e.isBuffer(t)}r.forEach(function(r){t[r]={encode:function(t){return i(t)?t:e.from(t,r)},decode:function(e){return e.toString(r)},buffer:!0,type:r}})}).call(this,r(0).Buffer)},function(e,t,r){var n=r(391).create,i=n("LevelUPError"),o=n("NotFoundError",i);o.prototype.notFound=!0,o.prototype.status=404,e.exports={LevelUPError:i,InitializationError:n("InitializationError",i),OpenError:n("OpenError",i),ReadError:n("ReadError",i),WriteError:n("WriteError",i),NotFoundError:o,EncodingError:n("EncodingError",i)}},function(e,t,r){(function(t,n){e.exports=u;var i=r(395).AbstractLevelDOWN,o=r(53),s=r(780),a=r(41);function u(e){if(!(this instanceof u))return new u(e);i.call(this,e)}o.inherits(u,i),u.prototype._open=function(e,t){var r=this;if(this._idbOpts=a({storeName:this.location,keyEncoding:"none",valueEncoding:"none"},e),this._idbOpts.idb)o(this._idbOpts.idb);else{var n=indexedDB.open(this.location);n.onerror=i,n.onsuccess=function(){o(n.result)}}function i(e){t(e.target.error)}function o(n){r._db=n;var i=r._db.objectStoreNames.contains(r._idbOpts.storeName);if(e.errorIfExists&&i)return r._db.close(),void t(new Error("store already exists"));if(!e.createIfMissing&&!i)return r._db.close(),void t(new Error("store does not exist"));if(e.createIfMissing&&!i){r._db.close();var o=indexedDB.open(r.location,r._db.version+1);return o.onerror=function(e){t(e.target.error)},o.onupgradeneeded=function(){var e=o.result;e.createObjectStore(r._idbOpts.storeName,r._idbOpts)},void(o.onsuccess=function(){r._db=o.result,t(null,r)})}t(null,r)}},u.prototype._get=function(e,r,n){r=a(this._idbOpts,r);var i=e;"binary"!==r.keyEncoding||Array.isArray(e)||(e=Array.prototype.slice.call(e));var o=this._db.transaction(this._idbOpts.storeName),s=o.objectStore(this._idbOpts.storeName).openCursor(IDBKeyRange.only(e));o.onabort=function(){n(o.error)},s.onsuccess=function(){var e=s.result;if(e){var o=e.value;if(o instanceof Uint8Array&&(o=new t(o)),"binary"!==r.valueEncoding||t.isBuffer(o)||(o=new t(o)),r.asBuffer&&!t.isBuffer(o))if(null==o)o=new t(0);else if("string"==typeof o)o=new t(o);else if("boolean"==typeof o)o=new t(String(o));else if("number"==typeof o)o=new t(String(o));else if(Array.isArray(o))o=new t(String(o));else{if(!(o instanceof Uint8Array))return void n(new TypeError("can't coerce `"+o.constructor.name+"` into a Buffer"));o=new t(o)}n(null,o,i)}else n(new Error("NotFound"))}},u.prototype._del=function(e,t,r){t=a(this._idbOpts,t),"binary"!==t.keyEncoding||Array.isArray(e)||(e=Array.prototype.slice.call(e));var n="readwrite";!0===t.sync&&(n="readwriteflush");var i=this._db.transaction(this._idbOpts.storeName,n),o=i.objectStore(this._idbOpts.storeName).delete(e);i.onabort=function(){r(i.error)},i.oncomplete=function(){r()}},u.prototype._put=function(e,t,r,n){r=a(this._idbOpts,r),"binary"!==r.keyEncoding||Array.isArray(e)||(e=Array.prototype.slice.call(e));var i="readwrite";!0===r.sync&&(i="readwriteflush");var o=this._db.transaction(this._idbOpts.storeName,i),s=o.objectStore(this._idbOpts.storeName).put(t,e);o.onabort=function(){n(o.error)},o.oncomplete=function(){n()}},u.prototype._iterator=function(e){return new s(this,e)},u.prototype._batch=function(e,t,r){if(0===e.length)return n.nextTick(r);var i="readwrite";!0===t.sync&&(i="readwriteflush");var o=this._db.transaction(this._idbOpts.storeName,i),s=o.objectStore(this._idbOpts.storeName);o.onabort=function(){r(o.error)},o.oncomplete=function(){r()},e.forEach(function(e){var r=a(t,e);"binary"!==r.keyEncoding||Array.isArray(e.key)||(e.key=Array.prototype.slice.call(e.key)),"del"===e.type?s.delete(e.key):s.put(e.value,e.key)})},u.prototype._close=function(e){this._db.close(),n.nextTick(e)},u.prototype._approximateSize=function(e,t,r){var i=new Error("Not implemented");if(!r)throw i;n.nextTick(function(){r(i)})},u.destroy=function(e,t){var r;if(null!=e&&"object"==typeof e)r=a({location:e.location,storeName:e.location},e._idbOpts);else{if("string"!=typeof e)throw new TypeError("location must be a string or an object");r={location:e,storeName:e}}if("string"!=typeof r.location)throw new TypeError("location must be a string");if("string"!=typeof r.storeName)throw new TypeError("db.storeName must be a string");var n=indexedDB.open(r.location);n.onerror=function(e){t(e.target.error)},n.onsuccess=function(){var e=n.result;function i(e){var r=indexedDB.deleteDatabase(e);r.onerror=function(e){t(e.target.error)},r.onsuccess=function(){t()}}if(e.close(),0!==e.objectStoreNames.length)if(e.objectStoreNames.contains(r.storeName)){var o=indexedDB.open(r.location,e.version+1);o.onerror=function(e){t(e.target.error)},o.onupgradeneeded=function(){e=o.result,e.deleteObjectStore(r.storeName)},o.onsuccess=function(){e=o.result,e.close(),0===e.objectStoreNames.length?i(r.location):t()}}else t();else i(r.location)}}}).call(this,r(0).Buffer,r(2))},function(e,t,r){var n=r(396);function i(e){return!(!e||"object"!=typeof e)&&Object.keys(n.prototype).filter(function(e){return"_"!=e[0]&&"approximateSize"!=e}).every(function(t){return"function"==typeof e[t]})}e.exports=i},function(e,t,r){(function(t,n){var i=r(53),o=r(395).AbstractIterator,s=r(781),a=r(782),u=r(97),c=r(41),f=u.Writable;function h(e,t){if(this._db=e._db,this._idbOpts=e._idbOpts,o.call(this,e),this._options=c({snapshot:!0},this._idbOpts,t),this._limit=this._options.limit,null!=this._limit&&-1!==this._limit||(this._limit=1/0),"number"!=typeof this._limit)throw new TypeError("options.limit must be a number");0!==this._limit&&(this._count=0,this._startCursor(this._options))}e.exports=h,i.inherits(h,o),h.prototype._startCursor=function(e){e=c(this._options,e);var t=this,r=null,n=s.lowerBound(e),i=s.upperBound(e),o=s.lowerBoundExclusive(e),u=s.upperBoundExclusive(e),h=e.reverse?"prev":"next";if(n&&("binary"!==e.keyEncoding||Array.isArray(n)||(n=Array.prototype.slice.call(n))),i&&("binary"!==e.keyEncoding||Array.isArray(i)||(i=Array.prototype.slice.call(i))),n&&i)try{r=IDBKeyRange.bound(n,i,o,u)}catch(e){return void(this._keyRangeError=!0)}else n?r=IDBKeyRange.lowerBound(n,o):i&&(r=IDBKeyRange.upperBound(i,u));this._reader=a(this._db,this._idbOpts.storeName,c(e,{range:r,direction:h})),this._reader.on("error",function(e){var r=t._callback;t._callback=!1,r?r(e):t._readNext=function(t){t(e)}}),this._reader.pipe(new f({objectMode:!0,write:function(e,r,n){if(t._count++>=t._limit)return t._reader.pause(),t._reader.unpipe(this),n(),void this.end();var i=t._callback;t._callback=!1,i?t._processItem(e,function(e,t,r){n(e),i(e,t,r)}):t._readNext=function(r){t._processItem(e,function(e,t,i){n(e),r(e,t,i)})}}})).on("finish",function(){var e=t._callback;t._callback=!1,e?e():t._readNext=function(e){e()}})},h.prototype._processItem=function(e,r){if("function"!=typeof r)throw new TypeError("cb must be a function");var n=e.key,i=e.value;if(i instanceof Uint8Array&&(i=new t(i)),"binary"===this._options.keyEncoding&&Array.isArray(n)&&(n=new t(n)),"binary"!==this._options.valueEncoding||t.isBuffer(i)||(i=new t(i)),this._options.keyAsBuffer&&!t.isBuffer(n))if(null==n)n=new t(0);else if("string"==typeof n)n=new t(n);else if("boolean"==typeof n)n=new t(String(n));else if("number"==typeof n)n=new t(String(n));else if(Array.isArray(n))n=new t(String(n));else{if(!(n instanceof Uint8Array))throw new TypeError("can't coerce `"+n.constructor.name+"` into a Buffer");n=new t(n)}if(this._options.valueAsBuffer&&!t.isBuffer(i))if(null==i)i=new t(0);else if("string"==typeof i)i=new t(i);else if("boolean"==typeof i)i=new t(String(i));else if("number"==typeof i)i=new t(String(i));else if(Array.isArray(i))i=new t(String(i));else{if(!(i instanceof Uint8Array))throw new TypeError("can't coerce `"+i.constructor.name+"` into a Buffer");i=new t(i)}r(null,n,i)},h.prototype._next=function(e){if(this._callback)throw new Error("callback already exists");if(this._keyRangeError||0===this._limit)e();else{var t=this._readNext;this._readNext=!1,t?n.nextTick(function(){t(e)}):this._callback=e}}}).call(this,r(0).Buffer,r(2))},function(e,t,r){(function(e){function r(e){return void 0!==e&&""!==e}function n(e,t){return Object.hasOwnProperty.call(e,t)}function i(e,t){return Object.hasOwnProperty.call(e,t)&&t}t.compare=function(t,r){if(e.isBuffer(t)){for(var n=Math.min(t.length,r.length),i=0;ir?1:0};var o=t.lowerBoundKey=function(e){return i(e,"gt")||i(e,"gte")||i(e,"min")||(e.reverse?i(e,"end"):i(e,"start"))||void 0},s=t.lowerBound=function(e,t){var r=o(e);return r?e[r]:t},a=t.lowerBoundInclusive=function(e){return!n(e,"gt")},u=t.upperBoundInclusive=function(e){return!n(e,"lt")},c=t.lowerBoundExclusive=function(e){return!a(e)},f=t.upperBoundExclusive=function(e){return!u(e)},h=t.upperBoundKey=function(e){return i(e,"lt")||i(e,"lte")||i(e,"max")||(e.reverse?i(e,"start"):i(e,"end"))||void 0},l=t.upperBound=function(e,t){var r=h(e);return r?e[r]:t};function d(e){return e}t.start=function(e,t){return e.reverse?l(e,t):s(e,t)},t.end=function(e,t){return e.reverse?s(e,t):l(e,t)},t.startInclusive=function(e){return e.reverse?u(e):a(e)},t.endInclusive=function(e){return e.reverse?a(e):u(e)},t.toLtgt=function(e,r,i,o,s){r=r||{},i=i||d;var a=arguments.length>3,u=t.lowerBoundKey(e),c=t.upperBoundKey(e);return u?"gt"===u?r.gt=i(e.gt,!1):r.gte=i(e[u],!1):a&&(r.gte=i(o,!1)),c?"lt"===c?r.lt=i(e.lt,!0):r.lte=i(e[c],!0):a&&(r.lte=i(s,!0)),null!=e.reverse&&(r.reverse=!!e.reverse),n(r,"max")&&delete r.max,n(r,"min")&&delete r.min,n(r,"start")&&delete r.start,n(r,"end")&&delete r.end,r},t.contains=function(e,n,i){i=i||t.compare;var o=s(e);if(r(o)){var a=i(n,o);if(a<0||0===a&&c(e))return!1}var u=l(e);if(r(u)){var a=i(n,u);if(a>0||0===a&&f(e))return!1}return!0},t.filter=function(e,r){return function(n){return t.contains(e,n,r)}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(97),i=r(41);function o(e,t,r){if("object"!=typeof e)throw new TypeError("db must be an object");if("string"!=typeof t)throw new TypeError("storeName must be a string");if(null==r&&(r={}),"object"!=typeof r)throw new TypeError("opts must be an object");var o=new n.Transform(i(r,{objectMode:!0,transform:function(e,t,r){r(null,e)}}));r=i({snapshot:!1},r);var s=null;function a(){var n,i,u,c,f=r.direction||"next",h=r.range||{},l;n=h.lower,i=h.upper,u=!!h.lowerOpen,c=!!h.upperOpen,s&&("next"===f?(u=!0,n=s):(c=!0,i=s)),n&&i?l=IDBKeyRange.bound(n,i,u,c):n?l=IDBKeyRange.lowerBound(n,u):i&&(l=IDBKeyRange.upperBound(i,c));var d=e.transaction(t,"readonly"),p=d.objectStore(t);o._cursorsOpened++;var g=p.openCursor(l,r.direction);function m(e){try{e.continue()}catch(e){"TransactionInactiveError"!==e.name||r.snapshot?o.emit("error",e):a()}}g.onsuccess=function(){var e=g.result;if(e){s=e.key;var t=o.write({key:e.key,value:e.value});r.snapshot||t?m(e):o.once("drain",function(){m(e)})}else o.end()},d.onabort=function(){o.emit("error",d.error)},d.onerror=function(){o.emit("error",d.error)}}return o._cursorsOpened=0,a(),o}e.exports=o},function(e,t){},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=r(4).Buffer,o=r(785);function s(e,t,r){e.copy(t,r)}e.exports=function(){function e(){n(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function e(t){var r={data:t,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length},e.prototype.unshift=function e(t){var r={data:t,next:this.head};0===this.length&&(this.tail=r),this.head=r,++this.length},e.prototype.shift=function e(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},e.prototype.clear=function e(){this.head=this.tail=null,this.length=0},e.prototype.join=function e(t){if(0===this.length)return"";for(var r=this.head,n=""+r.data;r=r.next;)n+=t+r.data;return n},e.prototype.concat=function e(t){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var r=i.allocUnsafe(t>>>0),n=this.head,o=0;n;)s(n.data,r,o),o+=n.data.length,n=n.next;return r},e}(),o&&o.inspect&&o.inspect.custom&&(e.exports.prototype[o.inspect.custom]=function(){var e=o.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,r){"use strict";e.exports=o;var n=r(402),i=r(5);function o(e){if(!(this instanceof o))return new o(e);n.call(this,e)}i.inherits=r(1),i.inherits(o,n),o.prototype._transform=function(e,t,r){r(null,e)}},function(e,t,r){e.exports=r(274)},function(e,t,r){e.exports=r(104)},function(e,t,r){e.exports=r(273).Transform},function(e,t,r){e.exports=r(273).PassThrough},function(e,t,r){"use strict";e.exports={Spec:{type:"mount",mounts:[{mountpoint:"/blocks",type:"measure",prefix:"flatfs.datastore",child:{type:"flatfs",path:"blocks",sync:!0,shardFunc:"/repo/flatfs/shard/v1/next-to-last/2"}},{mountpoint:"/",type:"measure",prefix:"leveldb.datastore",child:{type:"levelds",path:"datastore",compression:"none"}}]}}},function(e,t,r){"use strict";t.ERR_REPO_NOT_INITIALIZED="ERR_REPO_NOT_INITIALIZED"},function(e,t,r){"use strict";e.exports={repoVersion:7}},function(e,t){e.exports=function(){var e,t,r,n,i;function o(o){return i?i(o):(e=o,function(e,i){t?t(e,i):(n=e,r=i)})}return o.resolve=function(o){if(i)throw new Error("already resolved");if(i=o,!i)throw new Error("resolve *must* be passed a transform stream");e&&(t=i(e),r&&t(n,r))},o}},function(e,t,r){"use strict";t.Diagnose=r(796),t.Decoder=r(409),t.Encoder=r(799),t.Simple=r(410),t.Tagged=r(411),t.decodeAll=t.Decoder.decodeAll,t.decodeFirst=t.Decoder.decodeFirst,t.diagnose=t.Diagnose.diagnose,t.encode=t.Encoder.encode,t.decode=t.Decoder.decode,t.leveldb={decode:t.Decoder.decodeAll,encode:t.Encoder.encode,buffer:!0,name:"cbor"}},function(e,t,r){"use strict";(function(t){const n=r(409),i=r(276);class o extends n{createTag(e,t){return`${e}(${t})`}createInt(e){return super.createInt(e).toString()}createInt32(e,t){return super.createInt32(e,t).toString()}createInt64(e,t,r,n){return super.createInt64(e,t,r,n).toString()}createInt32Neg(e,t){return super.createInt32Neg(e,t).toString()}createInt64Neg(e,t,r,n){return super.createInt64Neg(e,t,r,n).toString()}createTrue(){return"true"}createFalse(){return"false"}createFloat(e){const t=super.createFloat(e);return i.isNegativeZero(e)?"-0_1":`${t}_1`}createFloatSingle(e,t,r,n){const i=super.createFloatSingle(e,t,r,n);return`${i}_2`}createFloatDouble(e,t,r,n,i,o,s,a){const u=super.createFloatDouble(e,t,r,n,i,o,s,a);return`${u}_3`}createByteString(e,t){const r=e.join(", ");return-1===t?`(_ ${r})`:`h'${r}`}createByteStringFromHeap(e,r){const n=t.from(super.createByteStringFromHeap(e,r)).toString("hex");return`h'${n}'`}createInfinity(){return"Infinity_1"}createInfinityNeg(){return"-Infinity_1"}createNaN(){return"NaN_1"}createNaNNeg(){return"-NaN_1"}createNull(){return"null"}createUndefined(){return"undefined"}createSimpleUnassigned(e){return`simple(${e})`}createArray(e,t){const r=super.createArray(e,t);return-1===t?`[_ ${r.join(", ")}]`:`[${r.join(", ")}]`}createMap(e,t){const r=super.createMap(e),n=Array.from(r.keys()).reduce(s(r),"");return-1===t?`{_ ${n}}`:`{${n}}`}createObject(e,t){const r=super.createObject(e),n=Object.keys(r).reduce(s(r),"");return-1===t?`{_ ${n}}`:`{${n}}`}createUtf8String(e,t){const r=e.join(", ");return-1===t?`(_ ${r})`:`"${r}"`}createUtf8StringFromHeap(e,r){const n=t.from(super.createUtf8StringFromHeap(e,r)).toString("utf8");return`"${n}"`}static diagnose(e,r){"string"==typeof e&&(e=t.from(e,r||"hex"));const n=new o;return n.decodeFirst(e)}}function s(e){return(t,r)=>t?`${t}, ${r}: ${e[r]}`:`${r}: ${e[r]}`}e.exports=o}).call(this,r(0).Buffer)},function(e,t){e.exports=function e(t,r,n){"use asm";var i=new t.Uint8Array(n);var o=r.pushInt;var s=r.pushInt32;var a=r.pushInt32Neg;var u=r.pushInt64;var c=r.pushInt64Neg;var f=r.pushFloat;var h=r.pushFloatSingle;var l=r.pushFloatDouble;var d=r.pushTrue;var p=r.pushFalse;var g=r.pushUndefined;var m=r.pushNull;var b=r.pushInfinity;var y=r.pushInfinityNeg;var v=r.pushNaN;var _=r.pushNaNNeg;var w=r.pushArrayStart;var S=r.pushArrayStartFixed;var E=r.pushArrayStartFixed32;var k=r.pushArrayStartFixed64;var x=r.pushObjectStart;var C=r.pushObjectStartFixed;var A=r.pushObjectStartFixed32;var I=r.pushObjectStartFixed64;var T=r.pushByteString;var O=r.pushByteStringStart;var R=r.pushUtf8String;var B=r.pushUtf8StringStart;var P=r.pushSimpleUnassigned;var M=r.pushTagStart;var N=r.pushTagStart4;var L=r.pushTagStart8;var j=r.pushTagUnassigned;var D=r.pushBreak;var F=t.Math.pow;var U=0;var q=0;var z=0;function H(e){e=e|0;U=0;q=e;while((U|0)<(q|0)){z=Xe[i[U]&255](i[U]|0)|0;if((z|0)>0){break}}return z|0}function K(e){e=e|0;if(((U|0)+(e|0)|0)<(q|0)){return 0}return 1}function W(e){e=e|0;return i[e|0]<<8|i[e+1|0]|0}function V(e){e=e|0;return i[e|0]<<24|i[e+1|0]<<16|i[e+2|0]<<8|i[e+3|0]|0}function G(e){e=e|0;o(e|0);U=U+1|0;return 0}function $(e){e=e|0;if(K(1)|0){return 1}o(i[U+1|0]|0);U=U+2|0;return 0}function Y(e){e=e|0;if(K(2)|0){return 1}o(W(U+1|0)|0);U=U+3|0;return 0}function J(e){e=e|0;if(K(4)|0){return 1}s(W(U+1|0)|0,W(U+3|0)|0);U=U+5|0;return 0}function X(e){e=e|0;if(K(8)|0){return 1}u(W(U+1|0)|0,W(U+3|0)|0,W(U+5|0)|0,W(U+7|0)|0);U=U+9|0;return 0}function Z(e){e=e|0;o(-1-(e-32|0)|0);U=U+1|0;return 0}function Q(e){e=e|0;if(K(1)|0){return 1}o(-1-(i[U+1|0]|0)|0);U=U+2|0;return 0}function ee(e){e=e|0;var t=0;if(K(2)|0){return 1}t=W(U+1|0)|0;o(-1-(t|0)|0);U=U+3|0;return 0}function te(e){e=e|0;if(K(4)|0){return 1}a(W(U+1|0)|0,W(U+3|0)|0);U=U+5|0;return 0}function re(e){e=e|0;if(K(8)|0){return 1}c(W(U+1|0)|0,W(U+3|0)|0,W(U+5|0)|0,W(U+7|0)|0);U=U+9|0;return 0}function ne(e){e=e|0;var t=0;var r=0;var n=0;n=e-64|0;if(K(n|0)|0){return 1}t=U+1|0;r=(U+1|0)+(n|0)|0;T(t|0,r|0);U=r|0;return 0}function ie(e){e=e|0;var t=0;var r=0;var n=0;if(K(1)|0){return 1}n=i[U+1|0]|0;t=U+2|0;r=(U+2|0)+(n|0)|0;if(K(n+1|0)|0){return 1}T(t|0,r|0);U=r|0;return 0}function oe(e){e=e|0;var t=0;var r=0;var n=0;if(K(2)|0){return 1}n=W(U+1|0)|0;t=U+3|0;r=(U+3|0)+(n|0)|0;if(K(n+2|0)|0){return 1}T(t|0,r|0);U=r|0;return 0}function se(e){e=e|0;var t=0;var r=0;var n=0;if(K(4)|0){return 1}n=V(U+1|0)|0;t=U+5|0;r=(U+5|0)+(n|0)|0;if(K(n+4|0)|0){return 1}T(t|0,r|0);U=r|0;return 0}function ae(e){e=e|0;return 1}function ue(e){e=e|0;O();U=U+1|0;return 0}function ce(e){e=e|0;var t=0;var r=0;var n=0;n=e-96|0;if(K(n|0)|0){return 1}t=U+1|0;r=(U+1|0)+(n|0)|0;R(t|0,r|0);U=r|0;return 0}function fe(e){e=e|0;var t=0;var r=0;var n=0;if(K(1)|0){return 1}n=i[U+1|0]|0;t=U+2|0;r=(U+2|0)+(n|0)|0;if(K(n+1|0)|0){return 1}R(t|0,r|0);U=r|0;return 0}function he(e){e=e|0;var t=0;var r=0;var n=0;if(K(2)|0){return 1}n=W(U+1|0)|0;t=U+3|0;r=(U+3|0)+(n|0)|0;if(K(n+2|0)|0){return 1}R(t|0,r|0);U=r|0;return 0}function le(e){e=e|0;var t=0;var r=0;var n=0;if(K(4)|0){return 1}n=V(U+1|0)|0;t=U+5|0;r=(U+5|0)+(n|0)|0;if(K(n+4|0)|0){return 1}R(t|0,r|0);U=r|0;return 0}function de(e){e=e|0;return 1}function pe(e){e=e|0;B();U=U+1|0;return 0}function ge(e){e=e|0;S(e-128|0);U=U+1|0;return 0}function me(e){e=e|0;if(K(1)|0){return 1}S(i[U+1|0]|0);U=U+2|0;return 0}function be(e){e=e|0;if(K(2)|0){return 1}S(W(U+1|0)|0);U=U+3|0;return 0}function ye(e){e=e|0;if(K(4)|0){return 1}E(W(U+1|0)|0,W(U+3|0)|0);U=U+5|0;return 0}function ve(e){e=e|0;if(K(8)|0){return 1}k(W(U+1|0)|0,W(U+3|0)|0,W(U+5|0)|0,W(U+7|0)|0);U=U+9|0;return 0}function _e(e){e=e|0;w();U=U+1|0;return 0}function we(e){e=e|0;var t=0;t=e-160|0;if(K(t|0)|0){return 1}C(t|0);U=U+1|0;return 0}function Se(e){e=e|0;if(K(1)|0){return 1}C(i[U+1|0]|0);U=U+2|0;return 0}function Ee(e){e=e|0;if(K(2)|0){return 1}C(W(U+1|0)|0);U=U+3|0;return 0}function ke(e){e=e|0;if(K(4)|0){return 1}A(W(U+1|0)|0,W(U+3|0)|0);U=U+5|0;return 0}function xe(e){e=e|0;if(K(8)|0){return 1}I(W(U+1|0)|0,W(U+3|0)|0,W(U+5|0)|0,W(U+7|0)|0);U=U+9|0;return 0}function Ce(e){e=e|0;x();U=U+1|0;return 0}function Ae(e){e=e|0;M(e-192|0|0);U=U+1|0;return 0}function Ie(e){e=e|0;M(e|0);U=U+1|0;return 0}function Te(e){e=e|0;M(e|0);U=U+1|0;return 0}function Oe(e){e=e|0;M(e|0);U=U+1|0;return 0}function Re(e){e=e|0;M(e|0);U=U+1|0;return 0}function Be(e){e=e|0;M(e-192|0|0);U=U+1|0;return 0}function Pe(e){e=e|0;M(e|0);U=U+1|0;return 0}function Me(e){e=e|0;M(e|0);U=U+1|0;return 0}function Ne(e){e=e|0;M(e|0);U=U+1|0;return 0}function Le(e){e=e|0;if(K(1)|0){return 1}M(i[U+1|0]|0);U=U+2|0;return 0}function je(e){e=e|0;if(K(2)|0){return 1}M(W(U+1|0)|0);U=U+3|0;return 0}function De(e){e=e|0;if(K(4)|0){return 1}N(W(U+1|0)|0,W(U+3|0)|0);U=U+5|0;return 0}function Fe(e){e=e|0;if(K(8)|0){return 1}L(W(U+1|0)|0,W(U+3|0)|0,W(U+5|0)|0,W(U+7|0)|0);U=U+9|0;return 0}function Ue(e){e=e|0;P((e|0)-224|0);U=U+1|0;return 0}function qe(e){e=e|0;p();U=U+1|0;return 0}function ze(e){e=e|0;d();U=U+1|0;return 0}function He(e){e=e|0;m();U=U+1|0;return 0}function Ke(e){e=e|0;g();U=U+1|0;return 0}function We(e){e=e|0;if(K(1)|0){return 1}P(i[U+1|0]|0);U=U+2|0;return 0}function Ve(e){e=e|0;var t=0;var r=0;var n=1.0;var o=0.0;var s=0.0;var a=0.0;if(K(2)|0){return 1}t=i[U+1|0]|0;r=i[U+2|0]|0;if((t|0)&0x80){n=-1.0}o=+(((t|0)&0x7C)>>2);s=+(((t|0)&0x03)<<8|r);if(+o==0.0){f(+(+n*+5.9604644775390625e-8*+s))}else if(+o==31.0){if(+n==1.0){if(+s>0.0){v()}else{b()}}else{if(+s>0.0){_()}else{y()}}}else{f(+(+n*F(+2,+(+o-25.0))*+(1024.0+s)))}U=U+3|0;return 0}function Ge(e){e=e|0;if(K(4)|0){return 1}h(i[U+1|0]|0,i[U+2|0]|0,i[U+3|0]|0,i[U+4|0]|0);U=U+5|0;return 0}function $e(e){e=e|0;if(K(8)|0){return 1}l(i[U+1|0]|0,i[U+2|0]|0,i[U+3|0]|0,i[U+4|0]|0,i[U+5|0]|0,i[U+6|0]|0,i[U+7|0]|0,i[U+8|0]|0);U=U+9|0;return 0}function Ye(e){e=e|0;return 1}function Je(e){e=e|0;D();U=U+1|0;return 0}var Xe=[G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,$,Y,J,X,Ye,Ye,Ye,Ye,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Q,ee,te,re,Ye,Ye,Ye,Ye,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ie,oe,se,ae,Ye,Ye,Ye,ue,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,fe,he,le,de,Ye,Ye,Ye,pe,ge,ge,ge,ge,ge,ge,ge,ge,ge,ge,ge,ge,ge,ge,ge,ge,ge,ge,ge,ge,ge,ge,ge,ge,me,be,ye,ve,Ye,Ye,Ye,_e,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,Se,Ee,ke,xe,Ye,Ye,Ye,Ce,Ae,Ae,Ae,Ae,Ae,Ae,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Le,je,De,Fe,Ye,Ye,Ye,Ye,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,qe,ze,He,Ke,We,Ve,Ge,$e,Ye,Ye,Ye,Je];return{parse:H}}},function(e,t,r){"use strict";const{URLWithLegacySupport:n,format:i}=r(412);e.exports=((e,t={},r={},o)=>{let s=t.protocol?t.protocol.replace(":",""):"http",a;s=(r[s]||o||s)+":";try{a=new n(e)}catch(e){a={}}const u=Object.assign({},t,{protocol:s||a.protocol,host:t.host||a.host});return new n(e,i(u)).toString()})},function(e,t,r){"use strict";(function(t){const{URL:n}=r(277),i=r(54),o=r(276),s=r(205),a=s.MT,u=s.NUMBYTES,c=s.SHIFT32,f=s.SYMS,h=s.TAG,l=s.MT.SIMPLE_FLOAT<<5|s.NUMBYTES.TWO,d=s.MT.SIMPLE_FLOAT<<5|s.NUMBYTES.FOUR,p=s.MT.SIMPLE_FLOAT<<5|s.NUMBYTES.EIGHT,g=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.TRUE,m=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.FALSE,b=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.UNDEFINED,y=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.NULL,v=new i("0x20000000000000"),_=t.from("f97e00","hex"),w=t.from("f9fc00","hex"),S=t.from("f97c00","hex");function E(e){return{}.toString.call(e).slice(8,-1)}class k{constructor(e){e=e||{},this.streaming="function"==typeof e.stream,this.onData=e.stream,this.semanticTypes=[[n,this._pushUrl],[i,this._pushBigNumber]];const t=e.genTypes||[],r=t.length;for(let e=0;e[t,e[t]]))}_pushRawMap(e,t){t=t.map(function(e){return e[0]=k.encode(e[0]),e}).sort(o.keySorter);for(var r=0;r{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(u(n.sha3_512)),sha3384:a(u(n.sha3_384)),sha3256:a(u(n.sha3_256)),sha3224:a(u(n.sha3_224)),shake128:a(u(n.shake_128,128)),shake256:a(u(n.shake_256,256)),keccak224:a(u(n.keccak_224)),keccak256:a(u(n.keccak_256)),keccak384:a(u(n.keccak_384)),keccak512:a(u(n.keccak_512)),murmur3128:a(u(c(i.x64.hash128))),murmur332:a(f(c(i.x86.hash32))),addBlake:r(805),dblSha2256:h}}).call(this,r(0).Buffer)},function(e,t,r){(function(n,i){var o; +var r,i,o;r="prr",i=this,o=function(){var e="function"==typeof Object.defineProperty?function(e,t,n){return Object.defineProperty(e,t,n),e}:function(e,t,n){return e[t]=n.value,e},t=function(e,t){var n="object"==typeof t,r=!n&&"string"==typeof t,i=function(e){return n?!!t[e]:!!r&&t.indexOf(e[0])>-1};return{enumerable:i("enumerable"),configurable:i("configurable"),writable:i("writable"),value:e}},n=function(n,r,i,o){var s;if(o=t(i,o),"object"==typeof r){for(s in r)Object.hasOwnProperty.call(r,s)&&(o.value=r[s],e(n,s,o));return n}return e(n,r,o)};return n},e.exports?e.exports=o():i.prr=o()},function(e,t,n){"use strict";var r=n(298).AbstractLevelDOWN,i=n(298).AbstractChainedBatch,o=n(298).AbstractIterator,s=n(1),a=n(54),u=n(836),l=n(838).EncodingError;function c(e,t){if(!(this instanceof c))return new c(e,t);r.call(this,""),t=t||{},void 0===t.keyEncoding&&(t.keyEncoding="utf8"),void 0===t.valueEncoding&&(t.valueEncoding="utf8"),this.db=e,this.codec=new u(t)}function f(e,t){o.call(this,e),this.codec=e.codec,this.keys=t.keys,this.values=t.values,this.opts=this.codec.encodeLtgt(t),this.it=e.db.iterator(this.opts)}function h(e,t){i.call(this,e),this.codec=e.codec,this.batch=e.db.batch()}e.exports=c.default=c,s(c,r),c.prototype._serializeKey=c.prototype._serializeValue=function(e){return e},c.prototype._open=function(e,t){this.db.open(e,t)},c.prototype._close=function(e){this.db.close(e)},c.prototype._put=function(e,t,n,r){e=this.codec.encodeKey(e,n),t=this.codec.encodeValue(t,n),this.db.put(e,t,n,r)},c.prototype._get=function(e,t,n){var r=this;e=this.codec.encodeKey(e,t),t.asBuffer=this.codec.valueAsBuffer(t),this.db.get(e,t,function(e,i){if(e)return n(e);try{i=r.codec.decodeValue(i,t)}catch(e){return n(new l(e))}n(null,i)})},c.prototype._del=function(e,t,n){e=this.codec.encodeKey(e,t),this.db.del(e,t,n)},c.prototype._chainedBatch=function(){return new h(this)},c.prototype._batch=function(e,t,n){e=this.codec.encodeBatch(e,t),this.db.batch(e,t,n)},c.prototype._iterator=function(e){return e.keyAsBuffer=this.codec.keyAsBuffer(e),e.valueAsBuffer=this.codec.valueAsBuffer(e),new f(this,e)},c.prototype._setupIteratorOptions=function(e){return e=a(e),e.reverse=!!e.reverse,e.keys=!1!==e.keys,e.values=!1!==e.values,e.limit="limit"in e?e.limit:-1,e.keyAsBuffer=!1!==e.keyAsBuffer,e.valueAsBuffer=!1!==e.valueAsBuffer,e},c.prototype.approximateSize=function(e,t,n,r){return this.db.approximateSize(e,t,n,r)},s(f,o),f.prototype._next=function(e){var t=this;this.it.next(function(n,r,i){if(n)return e(n);try{r=t.keys&&void 0!==r?t.codec.decodeKey(r,t.opts):void 0,i=t.values&&void 0!==i?t.codec.decodeValue(i,t.opts):void 0}catch(n){return e(new l(n))}e(null,r,i)})},f.prototype._end=function(e){this.it.end(e)},s(h,i),h.prototype._put=function(e,t){e=this.codec.encodeKey(e),t=this.codec.encodeValue(t),this.batch.put(e,t)},h.prototype._del=function(e){e=this.codec.encodeKey(e),this.batch.del(e)},h.prototype._clear=function(){this.batch.clear()},h.prototype._write=function(e,t){this.batch.write(e,t)}},function(e,t,n){(function(t,r){var i=n(54),o=n(430),s=n(431),a=Object.prototype.hasOwnProperty,u="start end gt gte lt lte".split(" ");function l(e){if(!arguments.length||void 0===e)throw new Error("constructor requires at least a location argument");if("string"!=typeof e)throw new Error("constructor requires a location string argument");this.location=e,this.status="new"}function c(e){var t={};for(var n in e)a.call(e,n)&&(f(n)&&h(e[n])||(t[n]=e[n]));return t}function f(e){return-1!==u.indexOf(e)}function h(e){return""===e||null==e||p(e)}function p(e){return r.isBuffer(e)&&0===e.length}l.prototype.open=function(e,t){var n=this,r=this.status;if("function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("open() requires a callback argument");"object"!=typeof e&&(e={}),e.createIfMissing=!1!==e.createIfMissing,e.errorIfExists=!!e.errorIfExists,this.status="opening",this._open(e,function(e){if(e)return n.status=r,t(e);n.status="open",t()})},l.prototype._open=function(e,n){t.nextTick(n)},l.prototype.close=function(e){var t=this,n=this.status;if("function"!=typeof e)throw new Error("close() requires a callback argument");this.status="closing",this._close(function(r){if(r)return t.status=n,e(r);t.status="closed",e()})},l.prototype._close=function(e){t.nextTick(e)},l.prototype.get=function(e,n,r){if("function"==typeof n&&(r=n),"function"!=typeof r)throw new Error("get() requires a callback argument");var i=this._checkKey(e,"key");if(i)return t.nextTick(r,i);e=this._serializeKey(e),"object"!=typeof n&&(n={}),n.asBuffer=!1!==n.asBuffer,this._get(e,n,r)},l.prototype._get=function(e,n,r){t.nextTick(function(){r(new Error("NotFound"))})},l.prototype.put=function(e,n,r,i){if("function"==typeof r&&(i=r),"function"!=typeof i)throw new Error("put() requires a callback argument");var o=this._checkKey(e,"key");if(o)return t.nextTick(i,o);e=this._serializeKey(e),n=this._serializeValue(n),"object"!=typeof r&&(r={}),this._put(e,n,r,i)},l.prototype._put=function(e,n,r,i){t.nextTick(i)},l.prototype.del=function(e,n,r){if("function"==typeof n&&(r=n),"function"!=typeof r)throw new Error("del() requires a callback argument");var i=this._checkKey(e,"key");if(i)return t.nextTick(r,i);e=this._serializeKey(e),"object"!=typeof n&&(n={}),this._del(e,n,r)},l.prototype._del=function(e,n,r){t.nextTick(r)},l.prototype.batch=function(e,n,r){if(!arguments.length)return this._chainedBatch();if("function"==typeof n&&(r=n),"function"==typeof e&&(r=e),"function"!=typeof r)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return t.nextTick(r,new Error("batch(array) requires an array argument"));n&&"object"==typeof n||(n={});for(var o=new Array(e.length),s=0;s-1?t.encodeKey(e[r],e):e[r]}),n},i.prototype.createStreamDecoder=function(e){var t=this;return e.keys&&e.values?function(n,r){return{key:t.decodeKey(n,e),value:t.decodeValue(r,e)}}:e.keys?function(n){return t.decodeKey(n,e)}:e.values?function(n,r){return t.decodeValue(r,e)}:function(){}},i.prototype.keyAsBuffer=function(e){return this._keyEncoding(e).buffer},i.prototype.valueAsBuffer=function(e){return this._valueEncoding(e).buffer}},function(e,t,n){(function(e){t.utf8=t["utf-8"]={encode:function(e){return i(e)?e:String(e)},decode:r,buffer:!1,type:"utf8"},t.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},t.binary={encode:function(t){return i(t)?t:e.from(t)},decode:r,buffer:!0,type:"binary"},t.none={encode:r,decode:r,buffer:!1,type:"id"},t.id=t.none;var n=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];function r(e){return e}function i(t){return void 0===t||null===t||e.isBuffer(t)}n.forEach(function(n){t[n]={encode:function(t){return i(t)?t:e.from(t,n)},decode:function(e){return e.toString(n)},buffer:!0,type:n}})}).call(this,n(0).Buffer)},function(e,t,n){var r=n(428).create,i=r("LevelUPError"),o=r("NotFoundError",i);o.prototype.notFound=!0,o.prototype.status=404,e.exports={LevelUPError:i,InitializationError:r("InitializationError",i),OpenError:r("OpenError",i),ReadError:r("ReadError",i),WriteError:r("WriteError",i),NotFoundError:o,EncodingError:r("EncodingError",i)}},function(e,t,n){(function(t,r){e.exports=u;var i=n(432).AbstractLevelDOWN,o=n(13),s=n(841),a=n(54);function u(e){if(!(this instanceof u))return new u(e);i.call(this,e)}o.inherits(u,i),u.prototype._open=function(e,t){var n=this;if(this._idbOpts=a({storeName:this.location,keyEncoding:"none",valueEncoding:"none"},e),this._idbOpts.idb)o(this._idbOpts.idb);else{var r=indexedDB.open(this.location);r.onerror=i,r.onsuccess=function(){o(r.result)}}function i(e){t(e.target.error)}function o(r){n._db=r;var i=n._db.objectStoreNames.contains(n._idbOpts.storeName);if(e.errorIfExists&&i)return n._db.close(),void t(new Error("store already exists"));if(!e.createIfMissing&&!i)return n._db.close(),void t(new Error("store does not exist"));if(e.createIfMissing&&!i){n._db.close();var o=indexedDB.open(n.location,n._db.version+1);return o.onerror=function(e){t(e.target.error)},o.onupgradeneeded=function(){var e=o.result;e.createObjectStore(n._idbOpts.storeName,n._idbOpts)},void(o.onsuccess=function(){n._db=o.result,t(null,n)})}t(null,n)}},u.prototype._get=function(e,n,r){n=a(this._idbOpts,n);var i=e;"binary"!==n.keyEncoding||Array.isArray(e)||(e=Array.prototype.slice.call(e));var o=this._db.transaction(this._idbOpts.storeName),s=o.objectStore(this._idbOpts.storeName).openCursor(IDBKeyRange.only(e));o.onabort=function(){r(o.error)},s.onsuccess=function(){var e=s.result;if(e){var o=e.value;if(o instanceof Uint8Array&&(o=new t(o)),"binary"!==n.valueEncoding||t.isBuffer(o)||(o=new t(o)),n.asBuffer&&!t.isBuffer(o))if(null==o)o=new t(0);else if("string"==typeof o)o=new t(o);else if("boolean"==typeof o)o=new t(String(o));else if("number"==typeof o)o=new t(String(o));else if(Array.isArray(o))o=new t(String(o));else{if(!(o instanceof Uint8Array))return void r(new TypeError("can't coerce `"+o.constructor.name+"` into a Buffer"));o=new t(o)}r(null,o,i)}else r(new Error("NotFound"))}},u.prototype._del=function(e,t,n){t=a(this._idbOpts,t),"binary"!==t.keyEncoding||Array.isArray(e)||(e=Array.prototype.slice.call(e));var r="readwrite";!0===t.sync&&(r="readwriteflush");var i=this._db.transaction(this._idbOpts.storeName,r),o=i.objectStore(this._idbOpts.storeName).delete(e);i.onabort=function(){n(i.error)},i.oncomplete=function(){n()}},u.prototype._put=function(e,t,n,r){n=a(this._idbOpts,n),"binary"!==n.keyEncoding||Array.isArray(e)||(e=Array.prototype.slice.call(e));var i="readwrite";!0===n.sync&&(i="readwriteflush");var o=this._db.transaction(this._idbOpts.storeName,i),s=o.objectStore(this._idbOpts.storeName).put(t,e);o.onabort=function(){r(o.error)},o.oncomplete=function(){r()}},u.prototype._iterator=function(e){return new s(this,e)},u.prototype._batch=function(e,t,n){if(0===e.length)return r.nextTick(n);var i="readwrite";!0===t.sync&&(i="readwriteflush");var o=this._db.transaction(this._idbOpts.storeName,i),s=o.objectStore(this._idbOpts.storeName);o.onabort=function(){n(o.error)},o.oncomplete=function(){n()},e.forEach(function(e){var n=a(t,e);"binary"!==n.keyEncoding||Array.isArray(e.key)||(e.key=Array.prototype.slice.call(e.key)),"del"===e.type?s.delete(e.key):s.put(e.value,e.key)})},u.prototype._close=function(e){this._db.close(),r.nextTick(e)},u.prototype._approximateSize=function(e,t,n){var i=new Error("Not implemented");if(!n)throw i;r.nextTick(function(){n(i)})},u.destroy=function(e,t){var n;if(null!=e&&"object"==typeof e)n=a({location:e.location,storeName:e.location},e._idbOpts);else{if("string"!=typeof e)throw new TypeError("location must be a string or an object");n={location:e,storeName:e}}if("string"!=typeof n.location)throw new TypeError("location must be a string");if("string"!=typeof n.storeName)throw new TypeError("db.storeName must be a string");var r=indexedDB.open(n.location);r.onerror=function(e){t(e.target.error)},r.onsuccess=function(){var e=r.result;function i(e){var n=indexedDB.deleteDatabase(e);n.onerror=function(e){t(e.target.error)},n.onsuccess=function(){t()}}if(e.close(),0!==e.objectStoreNames.length)if(e.objectStoreNames.contains(n.storeName)){var o=indexedDB.open(n.location,e.version+1);o.onerror=function(e){t(e.target.error)},o.onupgradeneeded=function(){e=o.result,e.deleteObjectStore(n.storeName)},o.onsuccess=function(){e=o.result,e.close(),0===e.objectStoreNames.length?i(n.location):t()}}else t();else i(n.location)}}}).call(this,n(0).Buffer,n(2))},function(e,t,n){var r=n(433);function i(e){return!(!e||"object"!=typeof e)&&Object.keys(r.prototype).filter(function(e){return"_"!=e[0]&&"approximateSize"!=e}).every(function(t){return"function"==typeof e[t]})}e.exports=i},function(e,t,n){(function(t,r){var i=n(13),o=n(432).AbstractIterator,s=n(842),a=n(843),u=n(57),l=n(54),c=u.Writable;function f(e,t){if(this._db=e._db,this._idbOpts=e._idbOpts,o.call(this,e),this._options=l({snapshot:!0},this._idbOpts,t),this._limit=this._options.limit,null!=this._limit&&-1!==this._limit||(this._limit=1/0),"number"!=typeof this._limit)throw new TypeError("options.limit must be a number");0!==this._limit&&(this._count=0,this._startCursor(this._options))}e.exports=f,i.inherits(f,o),f.prototype._startCursor=function(e){e=l(this._options,e);var t=this,n=null,r=s.lowerBound(e),i=s.upperBound(e),o=s.lowerBoundExclusive(e),u=s.upperBoundExclusive(e),f=e.reverse?"prev":"next";if(r&&("binary"!==e.keyEncoding||Array.isArray(r)||(r=Array.prototype.slice.call(r))),i&&("binary"!==e.keyEncoding||Array.isArray(i)||(i=Array.prototype.slice.call(i))),r&&i)try{n=IDBKeyRange.bound(r,i,o,u)}catch(e){return void(this._keyRangeError=!0)}else r?n=IDBKeyRange.lowerBound(r,o):i&&(n=IDBKeyRange.upperBound(i,u));this._reader=a(this._db,this._idbOpts.storeName,l(e,{range:n,direction:f})),this._reader.on("error",function(e){var n=t._callback;t._callback=!1,n?n(e):t._readNext=function(t){t(e)}}),this._reader.pipe(new c({objectMode:!0,write:function(e,n,r){if(t._count++>=t._limit)return t._reader.pause(),t._reader.unpipe(this),r(),void this.end();var i=t._callback;t._callback=!1,i?t._processItem(e,function(e,t,n){r(e),i(e,t,n)}):t._readNext=function(n){t._processItem(e,function(e,t,i){r(e),n(e,t,i)})}}})).on("finish",function(){var e=t._callback;t._callback=!1,e?e():t._readNext=function(e){e()}})},f.prototype._processItem=function(e,n){if("function"!=typeof n)throw new TypeError("cb must be a function");var r=e.key,i=e.value;if(i instanceof Uint8Array&&(i=new t(i)),"binary"===this._options.keyEncoding&&Array.isArray(r)&&(r=new t(r)),"binary"!==this._options.valueEncoding||t.isBuffer(i)||(i=new t(i)),this._options.keyAsBuffer&&!t.isBuffer(r))if(null==r)r=new t(0);else if("string"==typeof r)r=new t(r);else if("boolean"==typeof r)r=new t(String(r));else if("number"==typeof r)r=new t(String(r));else if(Array.isArray(r))r=new t(String(r));else{if(!(r instanceof Uint8Array))throw new TypeError("can't coerce `"+r.constructor.name+"` into a Buffer");r=new t(r)}if(this._options.valueAsBuffer&&!t.isBuffer(i))if(null==i)i=new t(0);else if("string"==typeof i)i=new t(i);else if("boolean"==typeof i)i=new t(String(i));else if("number"==typeof i)i=new t(String(i));else if(Array.isArray(i))i=new t(String(i));else{if(!(i instanceof Uint8Array))throw new TypeError("can't coerce `"+i.constructor.name+"` into a Buffer");i=new t(i)}n(null,r,i)},f.prototype._next=function(e){if(this._callback)throw new Error("callback already exists");if(this._keyRangeError||0===this._limit)e();else{var t=this._readNext;this._readNext=!1,t?r.nextTick(function(){t(e)}):this._callback=e}}}).call(this,n(0).Buffer,n(2))},function(e,t,n){(function(e){function n(e){return void 0!==e&&""!==e}function r(e,t){return Object.hasOwnProperty.call(e,t)}function i(e,t){return Object.hasOwnProperty.call(e,t)&&t}t.compare=function(t,n){if(e.isBuffer(t)){for(var r=Math.min(t.length,n.length),i=0;in?1:0};var o=t.lowerBoundKey=function(e){return i(e,"gt")||i(e,"gte")||i(e,"min")||(e.reverse?i(e,"end"):i(e,"start"))||void 0},s=t.lowerBound=function(e,t){var n=o(e);return n?e[n]:t},a=t.lowerBoundInclusive=function(e){return!r(e,"gt")},u=t.upperBoundInclusive=function(e){return!r(e,"lt")},l=t.lowerBoundExclusive=function(e){return!a(e)},c=t.upperBoundExclusive=function(e){return!u(e)},f=t.upperBoundKey=function(e){return i(e,"lt")||i(e,"lte")||i(e,"max")||(e.reverse?i(e,"start"):i(e,"end"))||void 0},h=t.upperBound=function(e,t){var n=f(e);return n?e[n]:t};function p(e){return e}t.start=function(e,t){return e.reverse?h(e,t):s(e,t)},t.end=function(e,t){return e.reverse?s(e,t):h(e,t)},t.startInclusive=function(e){return e.reverse?u(e):a(e)},t.endInclusive=function(e){return e.reverse?a(e):u(e)},t.toLtgt=function(e,n,i,o,s){n=n||{},i=i||p;var a=arguments.length>3,u=t.lowerBoundKey(e),l=t.upperBoundKey(e);return u?"gt"===u?n.gt=i(e.gt,!1):n.gte=i(e[u],!1):a&&(n.gte=i(o,!1)),l?"lt"===l?n.lt=i(e.lt,!0):n.lte=i(e[l],!0):a&&(n.lte=i(s,!0)),null!=e.reverse&&(n.reverse=!!e.reverse),r(n,"max")&&delete n.max,r(n,"min")&&delete n.min,r(n,"start")&&delete n.start,r(n,"end")&&delete n.end,n},t.contains=function(e,r,i){i=i||t.compare;var o=s(e);if(n(o)){var a=i(r,o);if(a<0||0===a&&l(e))return!1}var u=h(e);if(n(u)){var a=i(r,u);if(a>0||0===a&&c(e))return!1}return!0},t.filter=function(e,n){return function(r){return t.contains(e,r,n)}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=n(57),i=n(54);function o(e,t,n){if("object"!=typeof e)throw new TypeError("db must be an object");if("string"!=typeof t)throw new TypeError("storeName must be a string");if(null==n&&(n={}),"object"!=typeof n)throw new TypeError("opts must be an object");var o=new r.Transform(i(n,{objectMode:!0,transform:function(e,t,n){n(null,e)}}));n=i({snapshot:!1},n);var s=null;function a(){var r,i,u,l,c=n.direction||"next",f=n.range||{},h;r=f.lower,i=f.upper,u=!!f.lowerOpen,l=!!f.upperOpen,s&&("next"===c?(u=!0,r=s):(l=!0,i=s)),r&&i?h=IDBKeyRange.bound(r,i,u,l):r?h=IDBKeyRange.lowerBound(r,u):i&&(h=IDBKeyRange.upperBound(i,l));var p=e.transaction(t,"readonly"),d=p.objectStore(t);o._cursorsOpened++;var m=d.openCursor(h,n.direction);function g(e){try{e.continue()}catch(e){"TransactionInactiveError"!==e.name||n.snapshot?o.emit("error",e):a()}}m.onsuccess=function(){var e=m.result;if(e){s=e.key;var t=o.write({key:e.key,value:e.value});n.snapshot||t?g(e):o.once("drain",function(){g(e)})}else o.end()},p.onabort=function(){o.emit("error",p.error)},p.onerror=function(){o.emit("error",p.error)}}return o._cursorsOpened=0,a(),o}e.exports=o},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=n(4).Buffer,o=n(846);function s(e,t,n){e.copy(t,n)}e.exports=function(){function e(){r(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function e(t){var n={data:t,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length},e.prototype.unshift=function e(t){var n={data:t,next:this.head};0===this.length&&(this.tail=n),this.head=n,++this.length},e.prototype.shift=function e(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},e.prototype.clear=function e(){this.head=this.tail=null,this.length=0},e.prototype.join=function e(t){if(0===this.length)return"";for(var n=this.head,r=""+n.data;n=n.next;)r+=t+n.data;return r},e.prototype.concat=function e(t){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var n=i.allocUnsafe(t>>>0),r=this.head,o=0;r;)s(r.data,n,o),o+=r.data.length,r=r.next;return n},e}(),o&&o.inspect&&o.inspect.custom&&(e.exports.prototype[o.inspect.custom]=function(){var e=o.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,n){"use strict";e.exports=o;var r=n(439),i=n(7);function o(e){if(!(this instanceof o))return new o(e);r.call(this,e)}i.inherits=n(1),i.inherits(o,r),o.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){e.exports=n(300)},function(e,t,n){e.exports=n(116)},function(e,t,n){e.exports=n(299).Transform},function(e,t,n){e.exports=n(299).PassThrough},function(e,t,n){"use strict";e.exports={Spec:{type:"mount",mounts:[{mountpoint:"/blocks",type:"measure",prefix:"flatfs.datastore",child:{type:"flatfs",path:"blocks",sync:!0,shardFunc:"/repo/flatfs/shard/v1/next-to-last/2"}},{mountpoint:"/",type:"measure",prefix:"leveldb.datastore",child:{type:"levelds",path:"datastore",compression:"none"}}]}}},function(e,t,n){"use strict";t.ERR_REPO_NOT_INITIALIZED="ERR_REPO_NOT_INITIALIZED"},function(e,t,n){"use strict";e.exports={repoVersion:7}},function(e,t){e.exports=function(){var e,t,n,r,i;function o(o){return i?i(o):(e=o,function(e,i){t?t(e,i):(r=e,n=i)})}return o.resolve=function(o){if(i)throw new Error("already resolved");if(i=o,!i)throw new Error("resolve *must* be passed a transform stream");e&&(t=i(e),n&&t(r,n))},o}},function(e,t,n){"use strict";t.Diagnose=n(857),t.Decoder=n(446),t.Encoder=n(860),t.Simple=n(447),t.Tagged=n(448),t.decodeAll=t.Decoder.decodeAll,t.decodeFirst=t.Decoder.decodeFirst,t.diagnose=t.Diagnose.diagnose,t.encode=t.Encoder.encode,t.decode=t.Decoder.decode,t.leveldb={decode:t.Decoder.decodeAll,encode:t.Encoder.encode,buffer:!0,name:"cbor"}},function(e,t,n){"use strict";(function(t){const r=n(446),i=n(302);class o extends r{createTag(e,t){return`${e}(${t})`}createInt(e){return super.createInt(e).toString()}createInt32(e,t){return super.createInt32(e,t).toString()}createInt64(e,t,n,r){return super.createInt64(e,t,n,r).toString()}createInt32Neg(e,t){return super.createInt32Neg(e,t).toString()}createInt64Neg(e,t,n,r){return super.createInt64Neg(e,t,n,r).toString()}createTrue(){return"true"}createFalse(){return"false"}createFloat(e){const t=super.createFloat(e);return i.isNegativeZero(e)?"-0_1":`${t}_1`}createFloatSingle(e,t,n,r){const i=super.createFloatSingle(e,t,n,r);return`${i}_2`}createFloatDouble(e,t,n,r,i,o,s,a){const u=super.createFloatDouble(e,t,n,r,i,o,s,a);return`${u}_3`}createByteString(e,t){const n=e.join(", ");return-1===t?`(_ ${n})`:`h'${n}`}createByteStringFromHeap(e,n){const r=t.from(super.createByteStringFromHeap(e,n)).toString("hex");return`h'${r}'`}createInfinity(){return"Infinity_1"}createInfinityNeg(){return"-Infinity_1"}createNaN(){return"NaN_1"}createNaNNeg(){return"-NaN_1"}createNull(){return"null"}createUndefined(){return"undefined"}createSimpleUnassigned(e){return`simple(${e})`}createArray(e,t){const n=super.createArray(e,t);return-1===t?`[_ ${n.join(", ")}]`:`[${n.join(", ")}]`}createMap(e,t){const n=super.createMap(e),r=Array.from(n.keys()).reduce(s(n),"");return-1===t?`{_ ${r}}`:`{${r}}`}createObject(e,t){const n=super.createObject(e),r=Object.keys(n).reduce(s(n),"");return-1===t?`{_ ${r}}`:`{${r}}`}createUtf8String(e,t){const n=e.join(", ");return-1===t?`(_ ${n})`:`"${n}"`}createUtf8StringFromHeap(e,n){const r=t.from(super.createUtf8StringFromHeap(e,n)).toString("utf8");return`"${r}"`}static diagnose(e,n){"string"==typeof e&&(e=t.from(e,n||"hex"));const r=new o;return r.decodeFirst(e)}}function s(e){return(t,n)=>t?`${t}, ${n}: ${e[n]}`:`${n}: ${e[n]}`}e.exports=o}).call(this,n(0).Buffer)},function(e,t){e.exports=function e(t,n,r){"use asm";var i=new t.Uint8Array(r);var o=n.pushInt;var s=n.pushInt32;var a=n.pushInt32Neg;var u=n.pushInt64;var l=n.pushInt64Neg;var c=n.pushFloat;var f=n.pushFloatSingle;var h=n.pushFloatDouble;var p=n.pushTrue;var d=n.pushFalse;var m=n.pushUndefined;var g=n.pushNull;var y=n.pushInfinity;var b=n.pushInfinityNeg;var v=n.pushNaN;var _=n.pushNaNNeg;var w=n.pushArrayStart;var k=n.pushArrayStartFixed;var S=n.pushArrayStartFixed32;var E=n.pushArrayStartFixed64;var x=n.pushObjectStart;var C=n.pushObjectStartFixed;var A=n.pushObjectStartFixed32;var I=n.pushObjectStartFixed64;var T=n.pushByteString;var j=n.pushByteStringStart;var O=n.pushUtf8String;var P=n.pushUtf8StringStart;var B=n.pushSimpleUnassigned;var R=n.pushTagStart;var N=n.pushTagStart4;var M=n.pushTagStart8;var L=n.pushTagUnassigned;var F=n.pushBreak;var D=t.Math.pow;var U=0;var z=0;var q=0;function K(e){e=e|0;U=0;z=e;while((U|0)<(z|0)){q=Ze[i[U]&255](i[U]|0)|0;if((q|0)>0){break}}return q|0}function H(e){e=e|0;if(((U|0)+(e|0)|0)<(z|0)){return 0}return 1}function V(e){e=e|0;return i[e|0]<<8|i[e+1|0]|0}function W(e){e=e|0;return i[e|0]<<24|i[e+1|0]<<16|i[e+2|0]<<8|i[e+3|0]|0}function $(e){e=e|0;o(e|0);U=U+1|0;return 0}function G(e){e=e|0;if(H(1)|0){return 1}o(i[U+1|0]|0);U=U+2|0;return 0}function Y(e){e=e|0;if(H(2)|0){return 1}o(V(U+1|0)|0);U=U+3|0;return 0}function J(e){e=e|0;if(H(4)|0){return 1}s(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function Z(e){e=e|0;if(H(8)|0){return 1}u(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function X(e){e=e|0;o(-1-(e-32|0)|0);U=U+1|0;return 0}function Q(e){e=e|0;if(H(1)|0){return 1}o(-1-(i[U+1|0]|0)|0);U=U+2|0;return 0}function ee(e){e=e|0;var t=0;if(H(2)|0){return 1}t=V(U+1|0)|0;o(-1-(t|0)|0);U=U+3|0;return 0}function te(e){e=e|0;if(H(4)|0){return 1}a(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function ne(e){e=e|0;if(H(8)|0){return 1}l(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function re(e){e=e|0;var t=0;var n=0;var r=0;r=e-64|0;if(H(r|0)|0){return 1}t=U+1|0;n=(U+1|0)+(r|0)|0;T(t|0,n|0);U=n|0;return 0}function ie(e){e=e|0;var t=0;var n=0;var r=0;if(H(1)|0){return 1}r=i[U+1|0]|0;t=U+2|0;n=(U+2|0)+(r|0)|0;if(H(r+1|0)|0){return 1}T(t|0,n|0);U=n|0;return 0}function oe(e){e=e|0;var t=0;var n=0;var r=0;if(H(2)|0){return 1}r=V(U+1|0)|0;t=U+3|0;n=(U+3|0)+(r|0)|0;if(H(r+2|0)|0){return 1}T(t|0,n|0);U=n|0;return 0}function se(e){e=e|0;var t=0;var n=0;var r=0;if(H(4)|0){return 1}r=W(U+1|0)|0;t=U+5|0;n=(U+5|0)+(r|0)|0;if(H(r+4|0)|0){return 1}T(t|0,n|0);U=n|0;return 0}function ae(e){e=e|0;return 1}function ue(e){e=e|0;j();U=U+1|0;return 0}function le(e){e=e|0;var t=0;var n=0;var r=0;r=e-96|0;if(H(r|0)|0){return 1}t=U+1|0;n=(U+1|0)+(r|0)|0;O(t|0,n|0);U=n|0;return 0}function ce(e){e=e|0;var t=0;var n=0;var r=0;if(H(1)|0){return 1}r=i[U+1|0]|0;t=U+2|0;n=(U+2|0)+(r|0)|0;if(H(r+1|0)|0){return 1}O(t|0,n|0);U=n|0;return 0}function fe(e){e=e|0;var t=0;var n=0;var r=0;if(H(2)|0){return 1}r=V(U+1|0)|0;t=U+3|0;n=(U+3|0)+(r|0)|0;if(H(r+2|0)|0){return 1}O(t|0,n|0);U=n|0;return 0}function he(e){e=e|0;var t=0;var n=0;var r=0;if(H(4)|0){return 1}r=W(U+1|0)|0;t=U+5|0;n=(U+5|0)+(r|0)|0;if(H(r+4|0)|0){return 1}O(t|0,n|0);U=n|0;return 0}function pe(e){e=e|0;return 1}function de(e){e=e|0;P();U=U+1|0;return 0}function me(e){e=e|0;k(e-128|0);U=U+1|0;return 0}function ge(e){e=e|0;if(H(1)|0){return 1}k(i[U+1|0]|0);U=U+2|0;return 0}function ye(e){e=e|0;if(H(2)|0){return 1}k(V(U+1|0)|0);U=U+3|0;return 0}function be(e){e=e|0;if(H(4)|0){return 1}S(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function ve(e){e=e|0;if(H(8)|0){return 1}E(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function _e(e){e=e|0;w();U=U+1|0;return 0}function we(e){e=e|0;var t=0;t=e-160|0;if(H(t|0)|0){return 1}C(t|0);U=U+1|0;return 0}function ke(e){e=e|0;if(H(1)|0){return 1}C(i[U+1|0]|0);U=U+2|0;return 0}function Se(e){e=e|0;if(H(2)|0){return 1}C(V(U+1|0)|0);U=U+3|0;return 0}function Ee(e){e=e|0;if(H(4)|0){return 1}A(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function xe(e){e=e|0;if(H(8)|0){return 1}I(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function Ce(e){e=e|0;x();U=U+1|0;return 0}function Ae(e){e=e|0;R(e-192|0|0);U=U+1|0;return 0}function Ie(e){e=e|0;R(e|0);U=U+1|0;return 0}function Te(e){e=e|0;R(e|0);U=U+1|0;return 0}function je(e){e=e|0;R(e|0);U=U+1|0;return 0}function Oe(e){e=e|0;R(e|0);U=U+1|0;return 0}function Pe(e){e=e|0;R(e-192|0|0);U=U+1|0;return 0}function Be(e){e=e|0;R(e|0);U=U+1|0;return 0}function Re(e){e=e|0;R(e|0);U=U+1|0;return 0}function Ne(e){e=e|0;R(e|0);U=U+1|0;return 0}function Me(e){e=e|0;if(H(1)|0){return 1}R(i[U+1|0]|0);U=U+2|0;return 0}function Le(e){e=e|0;if(H(2)|0){return 1}R(V(U+1|0)|0);U=U+3|0;return 0}function Fe(e){e=e|0;if(H(4)|0){return 1}N(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function De(e){e=e|0;if(H(8)|0){return 1}M(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function Ue(e){e=e|0;B((e|0)-224|0);U=U+1|0;return 0}function ze(e){e=e|0;d();U=U+1|0;return 0}function qe(e){e=e|0;p();U=U+1|0;return 0}function Ke(e){e=e|0;g();U=U+1|0;return 0}function He(e){e=e|0;m();U=U+1|0;return 0}function Ve(e){e=e|0;if(H(1)|0){return 1}B(i[U+1|0]|0);U=U+2|0;return 0}function We(e){e=e|0;var t=0;var n=0;var r=1.0;var o=0.0;var s=0.0;var a=0.0;if(H(2)|0){return 1}t=i[U+1|0]|0;n=i[U+2|0]|0;if((t|0)&0x80){r=-1.0}o=+(((t|0)&0x7C)>>2);s=+(((t|0)&0x03)<<8|n);if(+o==0.0){c(+(+r*+5.9604644775390625e-8*+s))}else if(+o==31.0){if(+r==1.0){if(+s>0.0){v()}else{y()}}else{if(+s>0.0){_()}else{b()}}}else{c(+(+r*D(+2,+(+o-25.0))*+(1024.0+s)))}U=U+3|0;return 0}function $e(e){e=e|0;if(H(4)|0){return 1}f(i[U+1|0]|0,i[U+2|0]|0,i[U+3|0]|0,i[U+4|0]|0);U=U+5|0;return 0}function Ge(e){e=e|0;if(H(8)|0){return 1}h(i[U+1|0]|0,i[U+2|0]|0,i[U+3|0]|0,i[U+4|0]|0,i[U+5|0]|0,i[U+6|0]|0,i[U+7|0]|0,i[U+8|0]|0);U=U+9|0;return 0}function Ye(e){e=e|0;return 1}function Je(e){e=e|0;F();U=U+1|0;return 0}var Ze=[$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,G,Y,J,Z,Ye,Ye,Ye,Ye,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,Q,ee,te,ne,Ye,Ye,Ye,Ye,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,ie,oe,se,ae,Ye,Ye,Ye,ue,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,ce,fe,he,pe,Ye,Ye,Ye,de,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,ge,ye,be,ve,Ye,Ye,Ye,_e,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,ke,Se,Ee,xe,Ye,Ye,Ye,Ce,Ae,Ae,Ae,Ae,Ae,Ae,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Me,Le,Fe,De,Ye,Ye,Ye,Ye,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,ze,qe,Ke,He,Ve,We,$e,Ge,Ye,Ye,Ye,Je];return{parse:K}}},function(e,t,n){"use strict";const{URLWithLegacySupport:r,format:i}=n(449);e.exports=((e,t={},n={},o)=>{let s=t.protocol?t.protocol.replace(":",""):"http",a;s=(n[s]||o||s)+":";try{a=new r(e)}catch(e){a={}}const u=Object.assign({},t,{protocol:s||a.protocol,host:t.host||a.host});return new r(e,i(u)).toString()})},function(e,t,n){"use strict";(function(t){const{URL:r}=n(303),i=n(62),o=n(302),s=n(231),a=s.MT,u=s.NUMBYTES,l=s.SHIFT32,c=s.SYMS,f=s.TAG,h=s.MT.SIMPLE_FLOAT<<5|s.NUMBYTES.TWO,p=s.MT.SIMPLE_FLOAT<<5|s.NUMBYTES.FOUR,d=s.MT.SIMPLE_FLOAT<<5|s.NUMBYTES.EIGHT,m=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.TRUE,g=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.FALSE,y=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.UNDEFINED,b=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.NULL,v=new i("0x20000000000000"),_=t.from("f97e00","hex"),w=t.from("f9fc00","hex"),k=t.from("f97c00","hex");function S(e){return{}.toString.call(e).slice(8,-1)}class E{constructor(e){e=e||{},this.streaming="function"==typeof e.stream,this.onData=e.stream,this.semanticTypes=[[r,this._pushUrl],[i,this._pushBigNumber]];const t=e.genTypes||[],n=t.length;for(let e=0;e[t,e[t]]))}_pushRawMap(e,t){t=t.map(function(e){return e[0]=E.encode(e[0]),e}).sort(o.keySorter);for(var n=0;n{s.sha2256(e,(e,r)=>{e&&n(e),s.sha2256(t.from(r),n)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(u(r.sha3_512)),sha3384:a(u(r.sha3_384)),sha3256:a(u(r.sha3_256)),sha3224:a(u(r.sha3_224)),shake128:a(u(r.shake_128,128)),shake256:a(u(r.shake_256,256)),keccak224:a(u(r.keccak_224)),keccak256:a(u(r.keccak_256)),keccak384:a(u(r.keccak_384)),keccak512:a(u(r.keccak_512)),murmur3128:a(u(l(i.x64.hash128))),murmur332:a(c(l(i.x86.hash32))),addBlake:n(869),dblSha2256:f}}).call(this,n(0).Buffer)},function(e,t,n){(function(r,i){var o; /** * [js-sha3]{@link https://github.com/emn178/js-sha3} * @@ -82,10 +322,10 @@ var n,i,o;n="prr",i=this,o=function(){var e="function"==typeof Object.defineProp * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT */ -!function(){"use strict";var s="input is invalid type",a="finalize already called",u="object"==typeof window,c=u?window:{};c.JS_SHA3_NO_WINDOW&&(u=!1);var f=!u&&"object"==typeof self,h=!c.JS_SHA3_NO_NODE_JS&&"object"==typeof n&&n.versions&&n.versions.node;h?c=i:f&&(c=self);var l=!c.JS_SHA3_NO_COMMON_JS&&"object"==typeof e&&e.exports,d=r(413),p=!c.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,g="0123456789abcdef".split(""),m=[31,7936,2031616,520093696],b=[4,1024,262144,67108864],y=[1,256,65536,16777216],v=[6,1536,393216,100663296],_=[0,8,16,24],w=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],S=[224,256,384,512],E=[128,256],k=["hex","buffer","arrayBuffer","array","digest"],x={128:168,256:136};!c.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!p||!c.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var C=function(e,t,r){return function(n){return new K(e,t,e).update(n)[r]()}},A=function(e,t,r){return function(n,i){return new K(e,t,i).update(n)[r]()}},I=function(e,t,r){return function(t,n,i,o){return L["cshake"+e].update(t,n,i,o)[r]()}},T=function(e,t,r){return function(t,n,i,o){return L["kmac"+e].update(t,n,i,o)[r]()}},O=function(e,t,r,n){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function W(e,t,r){K.call(this,e,t,r)}K.prototype.update=function(e){if(this.finalized)throw new Error(a);var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(s);if(null===e)throw new Error(s);if(p&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||p&&ArrayBuffer.isView(e)))throw new Error(s);t=!0}for(var n=this.blocks,i=this.byteCount,o=e.length,u=this.blockCount,c=0,f=this.s,h,l;c>2]|=e[c]<<_[3&h++];else for(h=this.start;c>2]|=l<<_[3&h++]:l<2048?(n[h>>2]|=(192|l>>6)<<_[3&h++],n[h>>2]|=(128|63&l)<<_[3&h++]):l<55296||l>=57344?(n[h>>2]|=(224|l>>12)<<_[3&h++],n[h>>2]|=(128|l>>6&63)<<_[3&h++],n[h>>2]|=(128|63&l)<<_[3&h++]):(l=65536+((1023&l)<<10|1023&e.charCodeAt(++c)),n[h>>2]|=(240|l>>18)<<_[3&h++],n[h>>2]|=(128|l>>12&63)<<_[3&h++],n[h>>2]|=(128|l>>6&63)<<_[3&h++],n[h>>2]|=(128|63&l)<<_[3&h++]);if(this.lastByteIndex=h,h>=i){for(this.start=h-i,this.block=n[u],h=0;h>=8,r=255&e;r>0;)i.unshift(r),e>>=8,r=255&e,++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},K.prototype.encodeString=function(e){var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(s);if(null===e)throw new Error(s);if(p&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||p&&ArrayBuffer.isView(e)))throw new Error(s);t=!0}var n=0,i=e.length;if(t)n=i;else for(var o=0;o=57344?n+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++o)),n+=4)}return n+=this.encode(8*n),this.update(e),n},K.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4&15]+g[15&a]+g[a>>12&15]+g[a>>8&15]+g[a>>20&15]+g[a>>16&15]+g[a>>28&15]+g[a>>24&15];o%e==0&&(V(t),i=0)}return n&&(a=t[i],s+=g[a>>4&15]+g[15&a],n>1&&(s+=g[a>>12&15]+g[a>>8&15]),n>2&&(s+=g[a>>20&15]+g[a>>16&15])),s},K.prototype.arrayBuffer=function(){this.finalize();var e=this.blockCount,t=this.s,r=this.outputBlocks,n=this.extraBytes,i=0,o=0,s=this.outputBits>>3,a;a=n?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(a);o>8&255,s[a+2]=u>>16&255,s[a+3]=u>>24&255;o%e==0&&V(t)}return n&&(a=o<<2,u=t[i],s[a]=255&u,n>1&&(s[a+1]=u>>8&255),n>2&&(s[a+2]=u>>16&255)),s},W.prototype=new K,W.prototype.finalize=function(){return this.encode(this.outputBits,!0),K.prototype.finalize.call(this)};var V=function(e){var t,r,n,i,o,s,a,u,c,f,h,l,d,p,g,m,b,y,v,_,S,E,k,x,C,A,I,T,O,R,B,P,M,N,L,j,D,F,U,q,z,H,K,W,V,G,$,Y,J,X,Z,Q,ee,te,re,ne,ie,oe,se,ae,ue,ce,fe;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],l=e[8]^e[18]^e[28]^e[38]^e[48],d=e[9]^e[19]^e[29]^e[39]^e[49],t=l^(s<<1|a>>>31),r=d^(a<<1|s>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(u<<1|c>>>31),r=o^(c<<1|u>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=s^(f<<1|h>>>31),r=a^(h<<1|f>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=u^(l<<1|d>>>31),r=c^(d<<1|l>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=f^(i<<1|o>>>31),r=h^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,p=e[0],g=e[1],G=e[11]<<4|e[10]>>>28,$=e[10]<<4|e[11]>>>28,T=e[20]<<3|e[21]>>>29,O=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ue=e[30]<<9|e[31]>>>23,H=e[40]<<18|e[41]>>>14,K=e[41]<<18|e[40]>>>14,N=e[2]<<1|e[3]>>>31,L=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,b=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,R=e[33]<<13|e[32]>>>19,B=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,fe=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,j=e[14]<<6|e[15]>>>26,D=e[15]<<6|e[14]>>>26,y=e[25]<<11|e[24]>>>21,v=e[24]<<11|e[25]>>>21,X=e[34]<<15|e[35]>>>17,Z=e[35]<<15|e[34]>>>17,P=e[45]<<29|e[44]>>>3,M=e[44]<<29|e[45]>>>3,x=e[6]<<28|e[7]>>>4,C=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,F=e[26]<<25|e[27]>>>7,U=e[27]<<25|e[26]>>>7,_=e[36]<<21|e[37]>>>11,S=e[37]<<21|e[36]>>>11,Q=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,W=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,A=e[18]<<20|e[19]>>>12,I=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,se=e[28]<<7|e[29]>>>25,q=e[38]<<8|e[39]>>>24,z=e[39]<<8|e[38]>>>24,E=e[48]<<14|e[49]>>>18,k=e[49]<<14|e[48]>>>18,e[0]=p^~m&y,e[1]=g^~b&v,e[10]=x^~A&T,e[11]=C^~I&O,e[20]=N^~j&F,e[21]=L^~D&U,e[30]=W^~G&Y,e[31]=V^~$&J,e[40]=te^~ne&oe,e[41]=re^~ie&se,e[2]=m^~y&_,e[3]=b^~v&S,e[12]=A^~T&R,e[13]=I^~O&B,e[22]=j^~F&q,e[23]=D^~U&z,e[32]=G^~Y&X,e[33]=$^~J&Z,e[42]=ne^~oe&ae,e[43]=ie^~se&ue,e[4]=y^~_&E,e[5]=v^~S&k,e[14]=T^~R&P,e[15]=O^~B&M,e[24]=F^~q&H,e[25]=U^~z&K,e[34]=Y^~X&Q,e[35]=J^~Z&ee,e[44]=oe^~ae&ce,e[45]=se^~ue&fe,e[6]=_^~E&p,e[7]=S^~k&g,e[16]=R^~P&x,e[17]=B^~M&C,e[26]=q^~H&N,e[27]=z^~K&L,e[36]=X^~Q&W,e[37]=Z^~ee&V,e[46]=ae^~ce&te,e[47]=ue^~fe&re,e[8]=E^~p&m,e[9]=k^~g&b,e[18]=P^~x&A,e[19]=M^~C&I,e[28]=H^~N&j,e[29]=K^~L&D,e[38]=Q^~W&G,e[39]=ee^~V&$,e[48]=ce^~te&ne,e[49]=fe^~re&ie,e[0]^=w[n],e[1]^=w[n+1]};if(l)e.exports=L;else{for(D=0;D>>16)*t&65535)<<16)}function s(e,t){return e<>>32-t}function a(e){return e^=e>>>16,e=o(e,2246822507),e^=e>>>13,e=o(e,3266489909),e^=e>>>16,e}function u(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var r=[0,0,0,0];return r[3]+=e[3]+t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]+t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]+t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]+t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]}function c(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var r=[0,0,0,0];return r[3]+=e[3]*t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]*t[3],r[1]+=r[2]>>>16,r[2]&=65535,r[2]+=e[3]*t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]*t[3],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[2]*t[2],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[3]*t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]}function f(e,t){return t%=64,32===t?[e[1],e[0]]:t<32?[e[0]<>>32-t,e[1]<>>32-t]:(t-=32,[e[1]<>>32-t,e[0]<>>32-t])}function h(e,t){return t%=64,0===t?e:t<32?[e[0]<>>32-t,e[1]<>>1]),e=c(e,[4283543511,3981806797]),e=l(e,[0,e[0]>>>1]),e=c(e,[3301882366,444984403]),e=l(e,[0,e[0]>>>1]),e}i.x86.hash32=function(e,t){e=e||"",t=t||0;for(var r=e.length%4,n=e.length-r,i=t,u=0,c=3432918353,f=461845907,h=0;h>>0},i.x86.hash128=function(e,t){e=e||"",t=t||0;for(var r=e.length%16,n=e.length-r,i=t,u=t,c=t,f=t,h=0,l=0,d=0,p=0,g=597399067,m=2869860233,b=951274213,y=2716044179,v=0;v>>0).toString(16)).slice(-8)+("00000000"+(u>>>0).toString(16)).slice(-8)+("00000000"+(c>>>0).toString(16)).slice(-8)+("00000000"+(f>>>0).toString(16)).slice(-8)},i.x64.hash128=function(e,t){e=e||"",t=t||0;for(var r=e.length%16,n=e.length-r,i=[0,t],o=[0,t],s=[0,0],a=[0,0],p=[2277735313,289559509],g=[1291169091,658871167],m=0;m>>0).toString(16)).slice(-8)+("00000000"+(i[1]>>>0).toString(16)).slice(-8)+("00000000"+(o[0]>>>0).toString(16)).slice(-8)+("00000000"+(o[1]>>>0).toString(16)).slice(-8)},e.exports&&(t=e.exports=i),t.murmurHash3=i}(this)},function(e,t,r){"use strict";(function(t){const n=r(416),i=o();function o(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function s(e){if(!i)throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");return(r,o)=>{const s=i.digest({name:e},r);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));n(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function u(e,t){s("SHA-256")(e,t)}function c(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:u,sha2512:c}}).call(this,r(0).Buffer)},function(e,t,r){(function(t){var n=r(417),i;i="function"==typeof setImediate?setImediate:"object"==typeof t&&t&&t.nextTick?t.nextTick:function(e){setTimeout(e,0)};var o=[];function s(e){if(!(this instanceof s))return"function"==typeof e?new s(e):a();var t=!1,r=!1,u,c=[],f=!1;function h(e){c.length?(f=!0,c.shift()(e||!1)):f=!1}function l(e,n){return new s(function(o){function s(t){var s=r?e:n;if("function"==typeof s){function a(){var e;try{e=s(u)}catch(e){return o.reject(e),h()}o.fulfill(e),h(!0)}t?a():i(a)}else r?(o.fulfill(u),h(t)):(o.reject(u),h(t))}c.push(s),t&&!f&&h()})}this.then=l,function(){function i(e){t||(n(e)?e.then(i,s):(t=r=!0,u=e,h()))}function s(e){t||(t=!0,r=!1,u=e,h())}for(var a={fulfill:i,reject:s},c=0;ci(n=>{const i=r.init(e,null);return r.update(i,n),t.from(r.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=c(t+1,a);for(let t=0;t<32;t++)e[s+t]=c(t+1,u)})}).call(this,r(0).Buffer)},function(e,t,r){var n=r(419);function i(e,t,r){var n=e[t]+e[r],i=e[t+1]+e[r+1];n>=4294967296&&i++,e[t]=n,e[t+1]=i}function o(e,t,r,n){var i=e[t]+r;r<0&&(i+=4294967296);var o=e[t+1]+n;i>=4294967296&&o++,e[t]=i,e[t+1]=o}function s(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function a(e,t,r,n,s,a){var u=l[s],c=l[s+1],f=l[a],d=l[a+1];i(h,e,t),o(h,e,u,c);var p=h[n]^h[e],g=h[n+1]^h[e+1];h[n]=g,h[n+1]=p,i(h,r,n),p=h[t]^h[r],g=h[t+1]^h[r+1],h[t]=p>>>24^g<<8,h[t+1]=g>>>24^p<<8,i(h,e,t),o(h,e,f,d),p=h[n]^h[e],g=h[n+1]^h[e+1],h[n]=p>>>16^g<<16,h[n+1]=g>>>16^p<<16,i(h,r,n),p=h[t]^h[r],g=h[t+1]^h[r+1],h[t]=g>>>31^p<<1,h[t+1]=p>>>31^g<<1}var u=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),c=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],f=new Uint8Array(c.map(function(e){return 2*e})),h=new Uint32Array(32),l=new Uint32Array(32);function d(e,t){var r=0;for(r=0;r<16;r++)h[r]=e.h[r],h[r+16]=u[r];for(h[24]=h[24]^e.t,h[25]=h[25]^e.t/4294967296,t&&(h[28]=~h[28],h[29]=~h[29]),r=0;r<32;r++)l[r]=s(e.b,4*r);for(r=0;r<12;r++)a(0,8,16,24,f[16*r+0],f[16*r+1]),a(2,10,18,26,f[16*r+2],f[16*r+3]),a(4,12,20,28,f[16*r+4],f[16*r+5]),a(6,14,22,30,f[16*r+6],f[16*r+7]),a(0,10,20,30,f[16*r+8],f[16*r+9]),a(2,12,22,24,f[16*r+10],f[16*r+11]),a(4,14,16,26,f[16*r+12],f[16*r+13]),a(6,8,18,28,f[16*r+14],f[16*r+15]);for(r=0;r<16;r++)e.h[r]=e.h[r]^h[r]^h[r+16]}function p(e,t){if(0===e||e>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");for(var r={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e},n=0;n<16;n++)r.h[n]=u[n];var i=t?t.length:0;return r.h[0]^=16842752^i<<8^e,t&&(g(r,t),r.c=128),r}function g(e,t){for(var r=0;r>2]>>8*(3&r);return t}function b(e,t,r){r=r||64,e=n.normalizeInput(e);var i=p(r,t);return g(i,e),m(i)}function y(e,t,r){var i=b(e,t,r);return n.toHex(i)}e.exports={blake2b:b,blake2bHex:y,blake2bInit:p,blake2bUpdate:g,blake2bFinal:m}},function(e,t,r){var n=r(419);function i(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function o(e,t,r,n,i,o){c[e]=c[e]+c[t]+i,c[n]=s(c[n]^c[e],16),c[r]=c[r]+c[n],c[t]=s(c[t]^c[r],12),c[e]=c[e]+c[t]+o,c[n]=s(c[n]^c[e],8),c[r]=c[r]+c[n],c[t]=s(c[t]^c[r],7)}function s(e,t){return e>>>t^e<<32-t}var a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),c=new Uint32Array(16),f=new Uint32Array(16);function h(e,t){var r=0;for(r=0;r<8;r++)c[r]=e.h[r],c[r+8]=a[r];for(c[12]^=e.t,c[13]^=e.t/4294967296,t&&(c[14]=~c[14]),r=0;r<16;r++)f[r]=i(e.b,4*r);for(r=0;r<10;r++)o(0,4,8,12,f[u[16*r+0]],f[u[16*r+1]]),o(1,5,9,13,f[u[16*r+2]],f[u[16*r+3]]),o(2,6,10,14,f[u[16*r+4]],f[u[16*r+5]]),o(3,7,11,15,f[u[16*r+6]],f[u[16*r+7]]),o(0,5,10,15,f[u[16*r+8]],f[u[16*r+9]]),o(1,6,11,12,f[u[16*r+10]],f[u[16*r+11]]),o(2,7,8,13,f[u[16*r+12]],f[u[16*r+13]]),o(3,4,9,14,f[u[16*r+14]],f[u[16*r+15]]);for(r=0;r<8;r++)e.h[r]^=c[r]^c[r+8]}function l(e,t){if(!(e>0&&e<=32))throw new Error("Incorrect output length, should be in [1, 32]");var r=t?t.length:0;if(t&&!(r>0&&r<=32))throw new Error("Incorrect key length, should be in [1, 32]");var n={h:new Uint32Array(a),b:new Uint32Array(64),c:0,t:0,outlen:e};return n.h[0]^=16842752^r<<8^e,r>0&&(d(n,t),n.c=64),n}function d(e,t){for(var r=0;r>2]>>8*(3&r)&255;return t}function g(e,t,r){r=r||32,e=n.normalizeInput(e);var i=l(r,t);return d(i,e),p(i)}function m(e,t,r){var i=g(e,t,r);return n.toHex(i)}e.exports={blake2s:g,blake2sHex:m,blake2sInit:l,blake2sUpdate:d,blake2sFinal:p}},function(e,t,r){var n=r(809);function i(e){if(!(e instanceof Object))throw new TypeError('"obj" must be an object (or inherit from it)');return o(e)}function o(e,t){for(var r in t=new n(e,t),e){var i=e[r];if(i instanceof Object&&(t.contains(i)||o(i,t)))return!0}return!1}e.exports=i},function(e,t){function r(e,t){this.value=e,this.next=t}e.exports=r,r.prototype.contains=function(e){for(var t=this;t;){if(t.value===e)return!0;t=t.next}return!1}},function(e,t,r){ +!function(){"use strict";var s="input is invalid type",a="finalize already called",u="object"==typeof window,l=u?window:{};l.JS_SHA3_NO_WINDOW&&(u=!1);var c=!u&&"object"==typeof self,f=!l.JS_SHA3_NO_NODE_JS&&"object"==typeof r&&r.versions&&r.versions.node;f?l=i:c&&(l=self);var h=!l.JS_SHA3_NO_COMMON_JS&&"object"==typeof e&&e.exports,p=n(863),d=!l.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,m="0123456789abcdef".split(""),g=[31,7936,2031616,520093696],y=[4,1024,262144,67108864],b=[1,256,65536,16777216],v=[6,1536,393216,100663296],_=[0,8,16,24],w=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],k=[224,256,384,512],S=[128,256],E=["hex","buffer","arrayBuffer","array","digest"],x={128:168,256:136};!l.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!d||!l.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var C=function(e,t,n){return function(r){return new H(e,t,e).update(r)[n]()}},A=function(e,t,n){return function(r,i){return new H(e,t,i).update(r)[n]()}},I=function(e,t,n){return function(t,r,i,o){return M["cshake"+e].update(t,r,i,o)[n]()}},T=function(e,t,n){return function(t,r,i,o){return M["kmac"+e].update(t,r,i,o)[n]()}},j=function(e,t,n,r){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function V(e,t,n){H.call(this,e,t,n)}H.prototype.update=function(e){if(this.finalized)throw new Error(a);var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(s);if(null===e)throw new Error(s);if(d&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||d&&ArrayBuffer.isView(e)))throw new Error(s);t=!0}for(var r=this.blocks,i=this.byteCount,o=e.length,u=this.blockCount,l=0,c=this.s,f,h;l>2]|=e[l]<<_[3&f++];else for(f=this.start;l>2]|=h<<_[3&f++]:h<2048?(r[f>>2]|=(192|h>>6)<<_[3&f++],r[f>>2]|=(128|63&h)<<_[3&f++]):h<55296||h>=57344?(r[f>>2]|=(224|h>>12)<<_[3&f++],r[f>>2]|=(128|h>>6&63)<<_[3&f++],r[f>>2]|=(128|63&h)<<_[3&f++]):(h=65536+((1023&h)<<10|1023&e.charCodeAt(++l)),r[f>>2]|=(240|h>>18)<<_[3&f++],r[f>>2]|=(128|h>>12&63)<<_[3&f++],r[f>>2]|=(128|h>>6&63)<<_[3&f++],r[f>>2]|=(128|63&h)<<_[3&f++]);if(this.lastByteIndex=f,f>=i){for(this.start=f-i,this.block=r[u],f=0;f>=8,n=255&e;n>0;)i.unshift(n),e>>=8,n=255&e,++r;return t?i.push(r):i.unshift(r),this.update(i),i.length},H.prototype.encodeString=function(e){var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(s);if(null===e)throw new Error(s);if(d&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||d&&ArrayBuffer.isView(e)))throw new Error(s);t=!0}var r=0,i=e.length;if(t)r=i;else for(var o=0;o=57344?r+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++o)),r+=4)}return r+=this.encode(8*r),this.update(e),r},H.prototype.bytepad=function(e,t){for(var n=this.encode(t),r=0;r>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[n],t=1;t>4&15]+m[15&a]+m[a>>12&15]+m[a>>8&15]+m[a>>20&15]+m[a>>16&15]+m[a>>28&15]+m[a>>24&15];o%e==0&&(W(t),i=0)}return r&&(a=t[i],s+=m[a>>4&15]+m[15&a],r>1&&(s+=m[a>>12&15]+m[a>>8&15]),r>2&&(s+=m[a>>20&15]+m[a>>16&15])),s},H.prototype.arrayBuffer=function(){this.finalize();var e=this.blockCount,t=this.s,n=this.outputBlocks,r=this.extraBytes,i=0,o=0,s=this.outputBits>>3,a;a=r?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(a);o>8&255,s[a+2]=u>>16&255,s[a+3]=u>>24&255;o%e==0&&W(t)}return r&&(a=o<<2,u=t[i],s[a]=255&u,r>1&&(s[a+1]=u>>8&255),r>2&&(s[a+2]=u>>16&255)),s},V.prototype=new H,V.prototype.finalize=function(){return this.encode(this.outputBits,!0),H.prototype.finalize.call(this)};var W=function(e){var t,n,r,i,o,s,a,u,l,c,f,h,p,d,m,g,y,b,v,_,k,S,E,x,C,A,I,T,j,O,P,B,R,N,M,L,F,D,U,z,q,K,H,V,W,$,G,Y,J,Z,X,Q,ee,te,ne,re,ie,oe,se,ae,ue,le,ce;for(r=0;r<48;r+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],l=e[5]^e[15]^e[25]^e[35]^e[45],c=e[6]^e[16]^e[26]^e[36]^e[46],f=e[7]^e[17]^e[27]^e[37]^e[47],h=e[8]^e[18]^e[28]^e[38]^e[48],p=e[9]^e[19]^e[29]^e[39]^e[49],t=h^(s<<1|a>>>31),n=p^(a<<1|s>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=i^(u<<1|l>>>31),n=o^(l<<1|u>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=s^(c<<1|f>>>31),n=a^(f<<1|c>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=u^(h<<1|p>>>31),n=l^(p<<1|h>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=c^(i<<1|o>>>31),n=f^(o<<1|i>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,d=e[0],m=e[1],$=e[11]<<4|e[10]>>>28,G=e[10]<<4|e[11]>>>28,T=e[20]<<3|e[21]>>>29,j=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ue=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,H=e[41]<<18|e[40]>>>14,N=e[2]<<1|e[3]>>>31,M=e[3]<<1|e[2]>>>31,g=e[13]<<12|e[12]>>>20,y=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,O=e[33]<<13|e[32]>>>19,P=e[32]<<13|e[33]>>>19,le=e[42]<<2|e[43]>>>30,ce=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,L=e[14]<<6|e[15]>>>26,F=e[15]<<6|e[14]>>>26,b=e[25]<<11|e[24]>>>21,v=e[24]<<11|e[25]>>>21,Z=e[34]<<15|e[35]>>>17,X=e[35]<<15|e[34]>>>17,B=e[45]<<29|e[44]>>>3,R=e[44]<<29|e[45]>>>3,x=e[6]<<28|e[7]>>>4,C=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,D=e[26]<<25|e[27]>>>7,U=e[27]<<25|e[26]>>>7,_=e[36]<<21|e[37]>>>11,k=e[37]<<21|e[36]>>>11,Q=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,V=e[8]<<27|e[9]>>>5,W=e[9]<<27|e[8]>>>5,A=e[18]<<20|e[19]>>>12,I=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,se=e[28]<<7|e[29]>>>25,z=e[38]<<8|e[39]>>>24,q=e[39]<<8|e[38]>>>24,S=e[48]<<14|e[49]>>>18,E=e[49]<<14|e[48]>>>18,e[0]=d^~g&b,e[1]=m^~y&v,e[10]=x^~A&T,e[11]=C^~I&j,e[20]=N^~L&D,e[21]=M^~F&U,e[30]=V^~$&Y,e[31]=W^~G&J,e[40]=te^~re&oe,e[41]=ne^~ie&se,e[2]=g^~b&_,e[3]=y^~v&k,e[12]=A^~T&O,e[13]=I^~j&P,e[22]=L^~D&z,e[23]=F^~U&q,e[32]=$^~Y&Z,e[33]=G^~J&X,e[42]=re^~oe&ae,e[43]=ie^~se&ue,e[4]=b^~_&S,e[5]=v^~k&E,e[14]=T^~O&B,e[15]=j^~P&R,e[24]=D^~z&K,e[25]=U^~q&H,e[34]=Y^~Z&Q,e[35]=J^~X&ee,e[44]=oe^~ae&le,e[45]=se^~ue&ce,e[6]=_^~S&d,e[7]=k^~E&m,e[16]=O^~B&x,e[17]=P^~R&C,e[26]=z^~K&N,e[27]=q^~H&M,e[36]=Z^~Q&V,e[37]=X^~ee&W,e[46]=ae^~le&te,e[47]=ue^~ce&ne,e[8]=S^~d&g,e[9]=E^~m&y,e[18]=B^~x&A,e[19]=R^~C&I,e[28]=K^~N&L,e[29]=H^~M&F,e[38]=Q^~V&$,e[39]=ee^~W&G,e[48]=le^~te&re,e[49]=ce^~ne&ie,e[0]^=w[r],e[1]^=w[r+1]};if(h)e.exports=M;else{for(F=0;F>>16)*t&65535)<<16)}function s(e,t){return e<>>32-t}function a(e){return e^=e>>>16,e=o(e,2246822507),e^=e>>>13,e=o(e,3266489909),e^=e>>>16,e}function u(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]+t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]+t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]+t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]+t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function l(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]*t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]*t[3],n[1]+=n[2]>>>16,n[2]&=65535,n[2]+=e[3]*t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]*t[3],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[2]*t[2],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[3]*t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function c(e,t){return t%=64,32===t?[e[1],e[0]]:t<32?[e[0]<>>32-t,e[1]<>>32-t]:(t-=32,[e[1]<>>32-t,e[0]<>>32-t])}function f(e,t){return t%=64,0===t?e:t<32?[e[0]<>>32-t,e[1]<>>1]),e=l(e,[4283543511,3981806797]),e=h(e,[0,e[0]>>>1]),e=l(e,[3301882366,444984403]),e=h(e,[0,e[0]>>>1]),e}i.x86.hash32=function(e,t){e=e||"",t=t||0;for(var n=e.length%4,r=e.length-n,i=t,u=0,l=3432918353,c=461845907,f=0;f>>0},i.x86.hash128=function(e,t){e=e||"",t=t||0;for(var n=e.length%16,r=e.length-n,i=t,u=t,l=t,c=t,f=0,h=0,p=0,d=0,m=597399067,g=2869860233,y=951274213,b=2716044179,v=0;v>>0).toString(16)).slice(-8)+("00000000"+(u>>>0).toString(16)).slice(-8)+("00000000"+(l>>>0).toString(16)).slice(-8)+("00000000"+(c>>>0).toString(16)).slice(-8)},i.x64.hash128=function(e,t){e=e||"",t=t||0;for(var n=e.length%16,r=e.length-n,i=[0,t],o=[0,t],s=[0,0],a=[0,0],d=[2277735313,289559509],m=[1291169091,658871167],g=0;g>>0).toString(16)).slice(-8)+("00000000"+(i[1]>>>0).toString(16)).slice(-8)+("00000000"+(o[0]>>>0).toString(16)).slice(-8)+("00000000"+(o[1]>>>0).toString(16)).slice(-8)},e.exports&&(t=e.exports=i),t.murmurHash3=i}(this)},function(e,t,n){"use strict";(function(t){const r=n(867),i=o();function o(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function s(e){if(!i)throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");return(n,o)=>{const s=i.digest({name:e},n);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));r(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function u(e,t){s("SHA-256")(e,t)}function l(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:u,sha2512:l}}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var r=n(868),i=n(451),o;function s(e,t){return"function"!=typeof t?e:e.then(function(e){o(function(){t(null,e)})},function(e){o(function(){t(e)})})}function a(e){return s(this,e)}function u(e){if(e&&i(e)){e.nodeify=a;var t=e.then;return e.then=function(){return u(t.apply(this,arguments))},e}"function"==typeof e?e.prototype.nodeify=a:r.prototype.nodeify=a}function l(e){if(!(this instanceof l))return new l(e);r.call(this,e),u(this)}o="function"==typeof setImmediate?setImmediate:"object"==typeof t&&t&&t.nextTick?t.nextTick:function(e){setTimeout(e,0)},e.exports=s,s.extend=u,s.Promise=l,l.prototype=Object.create(r.prototype),l.prototype.constructor=l}).call(this,n(2))},function(e,t,n){(function(t){var r=n(451),i;i="function"==typeof setImediate?setImediate:"object"==typeof t&&t&&t.nextTick?t.nextTick:function(e){setTimeout(e,0)};var o=[];function s(e){if(!(this instanceof s))return"function"==typeof e?new s(e):a();var t=!1,n=!1,u,l=[],c=!1;function f(e){l.length?(c=!0,l.shift()(e||!1)):c=!1}function h(e,r){return new s(function(o){function s(t){var s=n?e:r;if("function"==typeof s){function a(){var e;try{e=s(u)}catch(e){return o.reject(e),f()}o.fulfill(e),f(!0)}t?a():i(a)}else n?(o.fulfill(u),f(t)):(o.reject(u),f(t))}l.push(s),t&&!c&&f()})}this.then=h,function(){function i(e){t||(r(e)?e.then(i,s):(t=n=!0,u=e,f()))}function s(e){t||(t=!0,n=!1,u=e,f())}for(var a={fulfill:i,reject:s},l=0;li(r=>{const i=n.init(e,null);return n.update(i,r),t.from(n.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=l(t+1,a);for(let t=0;t<32;t++)e[s+t]=l(t+1,u)})}).call(this,n(0).Buffer)},function(e,t,n){var r=n(871),i=n(872);e.exports={blake2b:r.blake2b,blake2bHex:r.blake2bHex,blake2bInit:r.blake2bInit,blake2bUpdate:r.blake2bUpdate,blake2bFinal:r.blake2bFinal,blake2s:i.blake2s,blake2sHex:i.blake2sHex,blake2sInit:i.blake2sInit,blake2sUpdate:i.blake2sUpdate,blake2sFinal:i.blake2sFinal}},function(e,t,n){var r=n(452);function i(e,t,n){var r=e[t]+e[n],i=e[t+1]+e[n+1];r>=4294967296&&i++,e[t]=r,e[t+1]=i}function o(e,t,n,r){var i=e[t]+n;n<0&&(i+=4294967296);var o=e[t+1]+r;i>=4294967296&&o++,e[t]=i,e[t+1]=o}function s(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function a(e,t,n,r,s,a){var u=h[s],l=h[s+1],c=h[a],p=h[a+1];i(f,e,t),o(f,e,u,l);var d=f[r]^f[e],m=f[r+1]^f[e+1];f[r]=m,f[r+1]=d,i(f,n,r),d=f[t]^f[n],m=f[t+1]^f[n+1],f[t]=d>>>24^m<<8,f[t+1]=m>>>24^d<<8,i(f,e,t),o(f,e,c,p),d=f[r]^f[e],m=f[r+1]^f[e+1],f[r]=d>>>16^m<<16,f[r+1]=m>>>16^d<<16,i(f,n,r),d=f[t]^f[n],m=f[t+1]^f[n+1],f[t]=m>>>31^d<<1,f[t+1]=d>>>31^m<<1}var u=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),l=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],c=new Uint8Array(l.map(function(e){return 2*e})),f=new Uint32Array(32),h=new Uint32Array(32);function p(e,t){var n=0;for(n=0;n<16;n++)f[n]=e.h[n],f[n+16]=u[n];for(f[24]=f[24]^e.t,f[25]=f[25]^e.t/4294967296,t&&(f[28]=~f[28],f[29]=~f[29]),n=0;n<32;n++)h[n]=s(e.b,4*n);for(n=0;n<12;n++)a(0,8,16,24,c[16*n+0],c[16*n+1]),a(2,10,18,26,c[16*n+2],c[16*n+3]),a(4,12,20,28,c[16*n+4],c[16*n+5]),a(6,14,22,30,c[16*n+6],c[16*n+7]),a(0,10,20,30,c[16*n+8],c[16*n+9]),a(2,12,22,24,c[16*n+10],c[16*n+11]),a(4,14,16,26,c[16*n+12],c[16*n+13]),a(6,8,18,28,c[16*n+14],c[16*n+15]);for(n=0;n<16;n++)e.h[n]=e.h[n]^f[n]^f[n+16]}function d(e,t){if(0===e||e>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");for(var n={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e},r=0;r<16;r++)n.h[r]=u[r];var i=t?t.length:0;return n.h[0]^=16842752^i<<8^e,t&&(m(n,t),n.c=128),n}function m(e,t){for(var n=0;n>2]>>8*(3&n);return t}function y(e,t,n){n=n||64,e=r.normalizeInput(e);var i=d(n,t);return m(i,e),g(i)}function b(e,t,n){var i=y(e,t,n);return r.toHex(i)}e.exports={blake2b:y,blake2bHex:b,blake2bInit:d,blake2bUpdate:m,blake2bFinal:g}},function(e,t,n){var r=n(452);function i(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function o(e,t,n,r,i,o){l[e]=l[e]+l[t]+i,l[r]=s(l[r]^l[e],16),l[n]=l[n]+l[r],l[t]=s(l[t]^l[n],12),l[e]=l[e]+l[t]+o,l[r]=s(l[r]^l[e],8),l[n]=l[n]+l[r],l[t]=s(l[t]^l[n],7)}function s(e,t){return e>>>t^e<<32-t}var a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),l=new Uint32Array(16),c=new Uint32Array(16);function f(e,t){var n=0;for(n=0;n<8;n++)l[n]=e.h[n],l[n+8]=a[n];for(l[12]^=e.t,l[13]^=e.t/4294967296,t&&(l[14]=~l[14]),n=0;n<16;n++)c[n]=i(e.b,4*n);for(n=0;n<10;n++)o(0,4,8,12,c[u[16*n+0]],c[u[16*n+1]]),o(1,5,9,13,c[u[16*n+2]],c[u[16*n+3]]),o(2,6,10,14,c[u[16*n+4]],c[u[16*n+5]]),o(3,7,11,15,c[u[16*n+6]],c[u[16*n+7]]),o(0,5,10,15,c[u[16*n+8]],c[u[16*n+9]]),o(1,6,11,12,c[u[16*n+10]],c[u[16*n+11]]),o(2,7,8,13,c[u[16*n+12]],c[u[16*n+13]]),o(3,4,9,14,c[u[16*n+14]],c[u[16*n+15]]);for(n=0;n<8;n++)e.h[n]^=l[n]^l[n+8]}function h(e,t){if(!(e>0&&e<=32))throw new Error("Incorrect output length, should be in [1, 32]");var n=t?t.length:0;if(t&&!(n>0&&n<=32))throw new Error("Incorrect key length, should be in [1, 32]");var r={h:new Uint32Array(a),b:new Uint32Array(64),c:0,t:0,outlen:e};return r.h[0]^=16842752^n<<8^e,n>0&&(p(r,t),r.c=64),r}function p(e,t){for(var n=0;n>2]>>8*(3&n)&255;return t}function m(e,t,n){n=n||32,e=r.normalizeInput(e);var i=h(n,t);return p(i,e),d(i)}function g(e,t,n){var i=m(e,t,n);return r.toHex(i)}e.exports={blake2s:m,blake2sHex:g,blake2sInit:h,blake2sUpdate:p,blake2sFinal:d}},function(e,t,n){var r=n(874);function i(e){if(!(e instanceof Object))throw new TypeError('"obj" must be an object (or inherit from it)');return o(e)}function o(e,t){for(var n in t=new r(e,t),e){var i=e[n];if(i instanceof Object&&(t.contains(i)||o(i,t)))return!0}return!1}e.exports=i},function(e,t){function n(e,t){this.value=e,this.next=t}e.exports=n,n.prototype.contains=function(e){for(var t=this;t;){if(t.value===e)return!0;t=t.next}return!1}},function(e,t,n){ //! stable.js 0.1.8, https://github.com/Two-Screen/stable //! © 2018 Angry Bytes and contributors. MIT licensed. -var n,i;n=this,i=function(){"use strict";var e=function(e,r){return t(e.slice(),r)};function t(e,t){"function"!=typeof t&&(t=function(e,t){return String(e).localeCompare(t)});var n=e.length;if(n<=1)return e;for(var i=new Array(n),o=1;oi&&(u=i),c>i&&(c=i),f=a,h=u;;)if(f"!==e[0])throw new Error("Unexpected token in map type: "+e[0]);e.shift(),t.name=e.shift();break;case"repeated":case"required":case"optional":var r=e.shift();t.required="required"===r,t.repeated="repeated"===r,t.type=e.shift(),t.name=e.shift();break;case"[":t.options=s(e);break;case";":if(null===t.name)throw new Error("Missing field name");if(null===t.type)throw new Error("Missing type in message field: "+t.name);if(-1===t.tag)throw new Error("Missing tag number in message field: "+t.name);return e.shift(),t;default:throw new Error("Unexpected token in message field: "+e[0])}throw new Error("No ; found for message field")},u=function(e){for(var t={enums:[],messages:[],fields:[],extends:[],extensions:null};e.length;)switch(e[0]){case"map":case"repeated":case"optional":case"required":t.fields.push(a(e));break;case"enum":t.enums.push(g(e));break;case"message":t.messages.push(h(e));break;case"extensions":t.extensions=f(e);break;case"oneof":e.shift();var r=e.shift();if("{"!==e[0])throw new Error("Unexpected token in oneof: "+e[0]);for(e.shift();"}"!==e[0];){e.unshift("optional");var n=a(e);n.oneof=r,t.fields.push(n)}e.shift();break;case"extend":t.extends.push(c(e));break;case";":e.shift();break;case"reserved":case"option":for(e.shift();";"!==e[0];)e.shift();break;default:e.unshift("optional"),t.fields.push(a(e))}return t},c=function(e){var t={name:e[1],message:h(e)};return t},f=function(e){e.shift();var t=Number(e.shift());if(isNaN(t))throw new Error("Invalid from in extensions definition");if("to"!==e.shift())throw new Error("Expected keyword 'to' in extensions definition");var r=e.shift();if("max"===r&&(r=536870911),r=Number(r),isNaN(r))throw new Error("Invalid to in extensions definition");if(";"!==e.shift())throw new Error("Missing ; in extensions definition");return{from:t,to:r}},h=function(e){e.shift();var t=1,r=[],n={name:e.shift(),enums:[],extends:[],messages:[],fields:[]};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("{"===e[0]?t++:"}"===e[0]&&t--,!t)return e.shift(),r=u(r),n.enums=r.enums,n.messages=r.messages,n.fields=r.fields,n.extends=r.extends,n.extensions=r.extensions,n;r.push(e.shift())}if(t)throw new Error("No closing tag for message")},l=function(e){e.shift();var t=e.shift();if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},d=function(e){if(e.shift(),"="!==e[0])throw new Error("Expected = but found "+e[0]);e.shift();var t=e.shift();switch(t){case'"proto2"':t=2;break;case'"proto3"':t=3;break;default:throw new Error("Expected protobuf syntax version but found "+t)}if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},p=function(e){if(e.length<4)throw new Error("Invalid enum value: "+e.slice(0,3).join(" "));if("="!==e[1])throw new Error("Expected = but found "+e[1]);if(";"!==e[3]&&"["!==e[3])throw new Error("Expected ; or [ but found "+e[1]);var t=e.shift();e.shift();var r={value:null,options:{}};return r.value=Number(e.shift()),"["===e[0]&&(r.options=s(e)),e.shift(),{name:t,val:r}},g=function(e){e.shift();var t={},r={name:e.shift(),values:{},options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),r;if("option"!==e[0]){var n=p(e);r.values[n.name]=n.val}else t=m(e),r.options[t.name]=t.value}throw new Error("No closing tag for enum")},m=function(e){for(var t=null,r=null,n=function(e){return"true"===e||"false"!==e&&e.replace(/^"+|"+$/gm,"")};e.length;){if(";"===e[0])return e.shift(),{name:t,value:r};switch(e[0]){case"option":e.shift();var i="("===e[0];if(i&&e.shift(),t=e.shift(),i){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}"."===e[0][0]&&(t+=e.shift());break;case"=":if(e.shift(),null===t)throw new Error("Expected key for option with value: "+e[0]);if(r=n(e.shift()),"optimize_for"===t&&!/^(SPEED|CODE_SIZE|LITE_RUNTIME)$/.test(r))throw new Error("Unexpected value for option optimize_for: "+r);"{"===r&&(r=b(e));break;default:throw new Error("Unexpected token in option: "+e[0])}}},b=function(e){for(var t=function(e){return"true"===e||"false"!==e&&e.replace(/^"+|"+$/gm,"")},r={};e.length;){if("}"===e[0])return e.shift(),r;var n="("===e[0];n&&e.shift();var i=e.shift();if(n){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}var o=null;switch(e[0]){case":":if(void 0!==r[i])throw new Error("Duplicate option map key "+i);e.shift(),o=t(e.shift()),"{"===o&&(o=b(e)),r[i]=o,";"===e[0]&&e.shift();break;case"{":if(e.shift(),o=b(e),void 0===r[i]&&(r[i]=[]),!Array.isArray(r[i]))throw new Error("Duplicate option map key "+i);r[i].push(o);break;default:throw new Error("Unexpected token in option map: "+e[0])}}throw new Error("No closing tag for option map")},y=function(e){e.shift();var t=e.shift().replace(/^"+|"+$/gm,"");if(";"!==e[0])throw new Error("Unexpected token: "+e[0]+'. Expected ";"');return e.shift(),t},v=function(e){e.shift();var t={name:e.shift(),methods:[],options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;switch(e[0]){case"option":var r=m(e);if(void 0!==t.options[r.name])throw new Error("Duplicate option "+r.name);t.options[r.name]=r.value;break;case"rpc":t.methods.push(_(e));break;default:throw new Error("Unexpected token in service: "+e[0])}}throw new Error("No closing tag for service")},_=function(e){e.shift();var t={name:e.shift(),input_type:null,output_type:null,client_streaming:!1,server_streaming:!1,options:{}};if("("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.client_streaming=!0),t.input_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),"returns"!==e[0])throw new Error("Expected returns but found "+e[0]);if(e.shift(),"("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.server_streaming=!0),t.output_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),";"===e[0])return e.shift(),t;if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;if("option"!==e[0])throw new Error("Unexpected token in rpc options: "+e[0]);var r=m(e);if(void 0!==t.options[r.name])throw new Error("Duplicate option "+r.name);t.options[r.name]=r.value}throw new Error("No closing tag for rpc")},w=function(e){for(var t=n(e.toString()),r=0;rt.extensions.to)throw new Error(t.name+" does not declare "+e.tag+" as an extension number");t.fields.push(e)})})}),s.messages.forEach(function(e){e.fields.forEach(function(t){var r,n,i,a;function u(e){return e.name===t.type}function c(e){return e.name===i}if(t.options&&"true"===t.options.packed&&-1===o.indexOf(t.type)){if(-1===t.type.indexOf(".")){if(e.enums&&e.enums.some(u))return}else{if(r=t.type.split("."),r.length>2)throw new Error("what is this?");if(n=r[0],i=r[1],s.messages.some(function(e){if(e.name===n)return a=e,e}),a&&a.enums&&a.enums.some(c))return}throw new Error("Fields of type "+t.type+' cannot be declared [packed=true]. Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire types) can be declared "packed". See https://developers.google.com/protocol-buffers/docs/encoding#optional')}})}),s};e.exports=w},function(e,t){e.exports=function(e){var t=function(e){var t=e.indexOf("//");return t>-1?e.slice(0,t):e},r=function(){var e=!1;return function(t){return"/*"===t?(e=!0,!1):"*/"===t?(e=!1,!1):!e}},n=function(e){return e.trim()};return e.replace(/([;,{}()=:[\]<>]|\/\*|\*\/)/g," $1 ").split(/\n/).map(n).filter(Boolean).map(t).map(n).filter(Boolean).join("\n").split(/\s+|\n+/gm).filter(r())}},function(e,t){var r=function(e,t){var r=e.repeated?"repeated":e.required?"required":"optional";"map"===e.type&&(r="map<"+e.map.from+","+e.map.to+">"),e.oneof&&(r="");var n=Object.keys(e.options||{}).map(function(t){return t+" = "+e.options[t]}).join(",");return n&&(n=" ["+n+"]"),t.push((r?r+" ":"")+("map"===e.map?"":e.type+" ")+e.name+" = "+e.tag+n+";"),t},n=function(e,t){t.push("message "+e.name+" {"),e.enums||(e.enums=[]),e.enums.forEach(function(e){t.push(i(e,[]))}),e.messages||(e.messages=[]),e.messages.forEach(function(e){t.push(n(e,[]))});var o={};return e.fields||(e.fields=[]),e.fields.forEach(function(e){e.oneof?(o[e.oneof]||(o[e.oneof]=[]),o[e.oneof].push(r(e,[]))):t.push(r(e,[]))}),Object.keys(o).forEach(function(e){o[e].unshift("oneof "+e+" {"),o[e].push("}"),t.push(o[e])}),t.push("}",""),t},i=function(e,t){t.push("enum "+e.name+" {"),e.options||(e.options={});var r=s(e.options,[]);return r.length>1&&t.push(r.slice(0,-1)),Object.keys(e.values).map(function(r){var n=o(e.values[r]);t.push([r+" = "+n+";"])}),t.push("}",""),t},o=function(e,t){var r=Object.keys(e.options||{}).map(function(t){return t+" = "+e.options[t]}).join(",");r&&(r=" ["+r+"]");var n=e.value+r;return n},s=function(e,t){var r=Object.keys(e);return r.forEach(function(r){var n=e[r];~r.indexOf(".")&&(r="("+r+")");var i=typeof n;"object"===i?(n=a(n,[]),n.length&&t.push("option "+r+" = {",n,"};")):("string"===i&&"optimize_for"!==r&&(n='"'+n+'"'),t.push("option "+r+" = "+n+";"))}),r.length>0&&t.push(""),t},a=function(e,t){var r=Object.keys(e);return r.forEach(function(r){var n=e[r],i=typeof n;"object"===i?Array.isArray(n)?n.forEach(function(e){e=a(e,[]),e.length&&t.push(r+" {",e,"}")}):(n=a(n,[]),n.length&&t.push(r+" {",n,"}")):("string"===i&&(n='"'+n+'"'),t.push(r+": "+n))}),t},u=function(e,t){return t.push("service "+e.name+" {"),e.options||(e.options={}),s(e.options,t),e.methods||(e.methods=[]),e.methods.forEach(function(e){t.push(c(e,[]))}),t.push("}",""),t},c=function(e,t){var r="rpc "+e.name+"(";e.client_streaming&&(r+="stream "),r+=e.input_type+") returns (",e.server_streaming&&(r+="stream "),r+=e.output_type+")",e.options||(e.options={});var n=s(e.options,[]);return n.length>1?t.push(r+" {",n.slice(0,-1),"}"):t.push(r+";"),t},f=function(e){return function(t){return Array.isArray(t)?t.map(f(e+" ")).join("\n"):e+t}};e.exports=function(e){var t=[];return t.push('syntax = "proto'+e.syntax+'";',""),e.package&&t.push("package "+e.package+";",""),e.options||(e.options={}),s(e.options,t),e.enums||(e.enums=[]),e.enums.forEach(function(e){i(e,t)}),e.messages||(e.messages=[]),e.messages.forEach(function(e){n(e,t)}),e.services&&e.services.forEach(function(e){u(e,t)}),t.map(f("")).join("\n")}},function(e,t,r){"use strict";var n=r(816),i=r(818),o=r(819),s=r(820),a=r(34),u=function(e){if(!e)return null;var t={};return Object.keys(e).forEach(function(r){t[r]=e[r].value}),t};e.exports=function(e,t){var r={},c={},f={},h=function(e,t){e.enums&&e.enums.forEach(function(e){e.id=t+(t?".":"")+e.name,c[e.id]=e,h(e,e.id)}),e.messages&&e.messages.forEach(function(n){n.id=t+(t?".":"")+n.name,r[n.id]=n,n.fields.forEach(function(n){if(n.map){var i="Map_"+n.map.from+"_"+n.map.to,o={name:i,enums:[],messages:[],fields:[{name:"key",type:n.map.from,tag:1,repeated:!1,required:!0},{name:"value",type:n.map.to,tag:2,repeated:!1,required:!1}],extensions:null,id:t+(t?".":"")+i};r[o.id]||(r[o.id]=o,e.messages.push(o)),n.type=i,n.repeated=!0}}),h(n,n.id)})};h(e,"");var l=function(e){var t=Object.keys(e.values||[]).map(function(t){return parseInt(e.values[t].value,10)}),r=function e(r,n,i){if(!t.length||-1===t.indexOf(r))throw new Error("Invalid enum value: "+r);return a.encode(r,n,i),e.bytes=a.encode.bytes,n},i=function e(r,n){var i=a.decode(r,n);if(!t.length||-1===t.indexOf(i))throw new Error("Invalid enum value: "+i);return e.bytes=a.decode.bytes,i};return n.make(0,r,i,a.encodingLength)},d=function(e,t){e.messages.forEach(function(r){t[r.name]=p(r.name,e.id)}),e.enums.forEach(function(e){t[e.name]=u(e.values)}),t.type=2,t.message=!0,t.name=e.name;var r={};e.fields.forEach(function(e){e.oneof&&(r[e.oneof]||(r[e.oneof]=[]),r[e.oneof].push(e.name))});var n=e.fields.map(function(t){return p(t.type,e.id)}),a=s(e,n,r),c=o(e,p,n,r,a),f=i(e,p,n);return c.bytes=f.bytes=0,t.buffer=!0,t.encode=c,t.decode=f,t.encodingLength=a,t},p=function(e,i,o){if(t&&t[e])return t[e];if(n[e])return n[e];var s=(i?i+"."+e:e).split(".").map(function(t,r,n){return n.slice(0,r).concat(e).join(".")}).reverse().reduce(function(e,t){return e||r[t]||c[t]},null);if(!1===o)return s;if(!s)throw new Error("Could not resolve "+e);if(s.values)return l(s);var a=f[s.id]||d(s,f[s.id]={});return a};return(e.enums||[]).concat((e.messages||[]).map(function(e){return p(e.id)}))}},function(e,t,r){"use strict";var n=r(34),i=r(817),o=r(4).Buffer,s=function(e,t,r,n){return t.bytes=r.bytes=0,{type:e,encode:t,decode:r,encodingLength:n}},a,u,c,f,h;t.make=s,t.bytes=(u=function(e){return o.isBuffer(e)?e.length:o.byteLength(e)},c=function(e){var t=u(e);return n.encodingLength(t)+t},f=function(e,t,r){var i=r,s=u(e);return n.encode(s,t,r),r+=n.encode.bytes,o.isBuffer(e)?e.copy(t,r):t.write(e,r,s),r+=s,f.bytes=r-i,t},h=function(e,t){var r=t,i=n.decode(e,t);t+=n.decode.bytes;var o=e.slice(t,t+i);return t+=o.length,h.bytes=t-r,o},s(2,f,h,c)),t.string=function(){var e=function(e){var t=o.byteLength(e);return n.encodingLength(t)+t},t=function(e,r,i){var s=i,a=o.byteLength(e);return n.encode(a,r,i,"utf-8"),i+=n.encode.bytes,r.write(e,i,a),i+=a,t.bytes=i-s,r},r=function(e,t){var i=t,o=n.decode(e,t);t+=n.decode.bytes;var s=e.toString("utf-8",t,t+o);return t+=o,r.bytes=t-i,s};return s(2,t,r,e)}(),t.bool=function(){var e=function(e){return 1},t=function(e,r,n){return r[n]=e?1:0,t.bytes=1,r},r=function(e,t){var n=e[t]>0;return r.bytes=1,n};return s(0,t,r,e)}(),t.int32=function(){var e=function(t,r){var i=n.decode(t,r);return e.bytes=n.decode.bytes,i>2147483647?i-4294967296:i},t=function(e,r,i){return n.encode(e<0?e+4294967296:e,r,i),t.bytes=n.encode.bytes,r},r=function(e){return n.encodingLength(e<0?e+4294967296:e)};return s(0,n.encode,e,r)}(),t.int64=function(){var e=function(t,r){var i=n.decode(t,r);if(i>=Math.pow(2,63)){for(var s=9;255===t[r+s-1];)s--;s=s||9;var a=o.allocUnsafe(s);t.copy(a,0,r,r+s),a[s-1]=127&a[s-1],i=-1*n.decode(a,0),e.bytes=10}else e.bytes=n.decode.bytes;return i},t=function(e,r,i){if(e<0){var o=i+9;for(n.encode(-1*e,r,i),i+=n.encode.bytes-1,r[i]=128|r[i];i=0?2*t:-2*t-1;var o=n.encode(t,r,i);return e.bytes=n.encode.bytes,o},t.decode=function e(t,r){var i=n.decode(t,r);return e.bytes=n.decode.bytes,1&i?(i+1)/-2:i/2},t.encodingLength=function(e){return n.encodingLength(e>=0?2*e:-2*e-1)}},function(e,t,r){"use strict";var n=r(34),i=r(278).defined;function o(e,t,r){for(var o=[],u={},c=[],f=[],h=0;h-1&&delete r[u[f]];if(e.message){var h=n.decode(i,o);o+=n.decode.bytes;var l=e.decode(i,o,o+h);t.map?(r[a]=r[a]||{},r[a][l.key]=l.value):t.repeated?(r[a]=r[a]||[],r[a].push(l)):r[a]=l}else t.repeated?(r[a]=r[a]||[],r[a].push(e.decode(i,o))):r[a]=e.decode(i,o);return o+=e.decode.bytes,o}return function t(h,l,d){if(null==l&&(l=0),null==d&&(d=h.length),!(d<=h.length&&l<=h.length))throw new Error("Decoded message is not valid");for(var p=l,m={},b;;){if(d<=l){var y="",v=0,_,w;for(v=0;v-1){S=!0;break}S||(_?b.repeated?m[y]=[]:(w=w&&_[w]?_[w].value:_[Object.keys(_)[0]].value,m[y]=parseInt(w||0,10)):m[y]=a(b,w))}return t.bytes=l-p,m}var x=n.decode(h,l);l+=n.decode.bytes;var C=x>>3,A=u[C];if(null!=A){var I=r[A];if(b=e.fields[A],b.packed){var T=n.decode(h,l);for(l+=n.decode.bytes,T+=l;l-1){if(y)throw new Error("only one of the properties defined in oneof "+v+" can be set");y=!0}}for(b=0;b{if(e)return r(e);n.push(t),c(s,n,r)})}e.exports=h},function(e,t,r){"use strict";(function(t){const n=r(209),i=n.cloneLinks,o=n.cloneData,s=r(207),a=r(9);function u(e,r,n){const u=o(e);let c=i(e);if("string"==typeof r)c=c.filter(e=>e.name!==r);else{if(!t.isBuffer(r)&&!a.isCID(r))return n(new Error("second arg needs to be a name or CID"),null);c=c.filter(e=>!e.cid.equals(r))}s(u,c,n)}e.exports=u}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(9),i=r(48);e.exports={resolver:{multicodec:"raw",defaultHashAlg:"sha2-256",resolve:(e,t,r)=>{r(null,{value:e,remainderPath:""})},tree:(e,t,r)=>{"function"==typeof t&&(r=t),r(null,[])}},util:{deserialize:(e,t)=>{t(null,e)},serialize:(e,t)=>{t(null,e)},cid:(e,t,r)=>{"function"==typeof t&&(r=t,t={}),t=t||{};const o=t.hashAlg||"sha2-256",s=void 0===t.version?1:t.version;i(e,o,(e,t)=>{if(e)return r(e);r(null,new n(s,"raw",t))})}}}},function(e,t,r){(function(t){var r={};e.exports=r;var n={};function i(e,t){var r=0,n=t.length,i=t.charAt(0),o=[0];for(r=0;r0;)o.push(a%n),a=a/n|0}var u="";for(r=0;0===e.at(r)&&r=0;--r)u+=t[o[r]];return u}r.encode=function(e,t,r){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(e instanceof Uint8Array){var o=0,s=t.length,a=t.charAt(0),u=[0];for(o=0;o0;)u.push(f%s),f=f/s|0}for(o=0;0===e[o]&&o=0;--o)n+=t[u[o]]}else n=i(e,t);if(r){var h=new RegExp(".{1,"+r+"}","g");n=n.match(h).join("\r\n")}return n},r.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var i=n[r];if(!i){i=n[r]=[];for(var o=0;o>=8;for(;h>0;)u.push(255&h),h>>=8}for(var l=0;e[l]===a&&l>24&255,s>>16&255,s>>8&255,255&s);r.start(),r.update(e+a),i+=r.digest().getBytes()}return i.substring(0,t)}i.encode_rsa_oaep=function(e,t,r){var i,s,a,u;"string"==typeof r?(i=r,s=arguments[3]||void 0,a=arguments[4]||void 0):r&&(i=r.label||void 0,s=r.seed||void 0,a=r.md||void 0,r.mgf1&&r.mgf1.md&&(u=r.mgf1.md)),a?a.start():a=n.md.sha1.create(),u||(u=a);var c=Math.ceil(e.n.bitLength()/8),f=c-2*a.digestLength-2;if(t.length>f){var h=new Error("RSAES-OAEP input message length is too long.");throw h.length=t.length,h.maxLength=f,h}i||(i=""),a.update(i,"raw");for(var l=a.digest(),d="",p=f-t.length,g=0;g>>0,a>>>0];for(var u=i.fullMessageLength.length-1;u>=0;--u)i.fullMessageLength[u]+=a[1],a[1]=a[0]+(i.fullMessageLength[u]/4294967296>>>0),i.fullMessageLength[u]=i.fullMessageLength[u]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(o),c(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var a=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize,u=a&i.blockLength-1,f,h;s.putBytes(o.substr(0,i.blockLength-u));for(var l=8*i.fullMessageLength[0],d=0;d>>0,l+=h,s.putInt32(l>>>0),l=f>>>0;s.putInt32(l);var p={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};c(p,r,s);var g=n.util.createBuffer();return g.putInt32(p.h0),g.putInt32(p.h1),g.putInt32(p.h2),g.putInt32(p.h3),g.putInt32(p.h4),g.putInt32(p.h5),g.putInt32(p.h6),g.putInt32(p.h7),g},i};var o=null,s=!1,a=null;function u(){o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),64),a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=!0}function c(e,t,r){for(var n,i,o,s,u,c,f,h,l,d,p,g,m,b,y,v=r.length();v>=64;){for(f=0;f<16;++f)t[f]=r.getInt32();for(;f<64;++f)n=t[f-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=t[f-15],i=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[f]=n+t[f-7]+i+t[f-16]|0;for(h=e.h0,l=e.h1,d=e.h2,p=e.h3,g=e.h4,m=e.h5,b=e.h6,y=e.h7,f=0;f<64;++f)s=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),u=b^g&(m^b),o=(h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),c=h&l|d&(h^l),n=y+s+u+a[f]+t[f],i=o+c,y=b,b=m,m=g,g=p+n>>>0,p=d,d=l,l=h,h=n+i>>>0;e.h0=e.h0+h|0,e.h1=e.h1+l|0,e.h2=e.h2+d|0,e.h3=e.h3+p|0,e.h4=e.h4+g|0,e.h5=e.h5+m|0,e.h6=e.h6+b|0,e.h7=e.h7+y|0,v-=64}}},function(e,t,r){(function(t){var n=r(16);r(29);var i=null;!n.util.isNodejs||n.options.usePureJavaScript||t.versions["node-webkit"]||(i=r(427));var o=e.exports=n.prng=n.prng||{};o.create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,o=new Array(32),s=0;s<32;++s)o[s]=r.create();function a(e){if(t.pools[0].messageLength>=32)return c(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,function(r,n){if(r)return e(r);t.collect(n),c(),e()})}function u(){if(t.pools[0].messageLength>=32)return c();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),c()}function c(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,n=0;n<32;++n)t.reseeds%r==0&&(e.update(t.pools[n].digest().getBytes()),t.pools[n].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0}function f(e){var t=null;if("undefined"!=typeof window){var r=window.crypto||window.msCrypto;r&&r.getRandomValues&&(t=function(e){return r.getRandomValues(e)})}var i=n.util.createBuffer();if(t)for(;i.length()>16),c+=(32767&u)<<16,c+=u>>15,c=(2147483647&c)+(c>>31),h=4294967295&c;for(var a=0;a<3;++a)f=h>>>(a<<3),f^=Math.floor(256*Math.random()),i.putByte(String.fromCharCode(255&f))}return i.getBytes(e)}return t.pools=o,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var i=t.plugin.cipher,o=t.plugin.increment,s=t.plugin.formatKey,u=t.plugin.formatSeed,c=n.util.createBuffer();function f(h){if(h)return r(h);if(c.length()>=e)return r(null,c.getBytes(e));if(t.generated>1048575&&(t.key=null),null===t.key)return n.util.nextTick(function(){a(f)});var l=i(t.key,t.seed);t.generated+=l.length,c.putBytes(l),t.key=s(i(t.key,o(t.seed))),t.seed=u(i(t.key,t.seed)),n.util.setImmediate(f)}t.key=null,f()},t.generateSync=function(e){var r=t.plugin.cipher,i=t.plugin.increment,o=t.plugin.formatKey,s=t.plugin.formatSeed;t.key=null;for(var a=n.util.createBuffer();a.length()1048575&&(t.key=null),null===t.key&&u();var c=r(t.key,t.seed);t.generated+=c.length,a.putBytes(c),t.key=o(r(t.key,i(t.seed))),t.seed=s(r(t.key,t.seed))}return a.getBytes(e)},i?(t.seedFile=function(e,t){i.randomBytes(e,function(e,r){if(e)return t(e);t(null,r.toString())})},t.seedFileSync=function(e){return i.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,f(e))}catch(e){t(e)}},t.seedFileSync=f),t.collect=function(e){for(var r=e.length,n=0;n>i&255);t.collect(n)},t.registerWorker=function(e){if(e===self)t.seedFile=function(e,t){function r(e){var n=e.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",r),t(n.forge.prng.err,n.forge.prng.bytes))}self.addEventListener("message",r),self.postMessage({forge:{prng:{needed:e}}})};else{var r=function(r){var n=r.data;n.forge&&n.forge.prng&&t.seedFile(n.forge.prng.needed,function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})})};e.addEventListener("message",r)}},t}}).call(this,r(2))},function(e,t,r){var n=r(16);r(106),r(29);var i=e.exports=n.sha1=n.sha1||{};n.md.sha1=n.md.algorithms.sha1=i,i.create=function(){s||a();var e=null,t=n.util.createBuffer(),r=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,o=0;o>>0,a>>>0];for(var c=i.fullMessageLength.length-1;c>=0;--c)i.fullMessageLength[c]+=a[1],a[1]=a[0]+(i.fullMessageLength[c]/4294967296>>>0),i.fullMessageLength[c]=i.fullMessageLength[c]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(o),u(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var a=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize,c=a&i.blockLength-1,f,h;s.putBytes(o.substr(0,i.blockLength-c));for(var l=8*i.fullMessageLength[0],d=0;d>>0,l+=h,s.putInt32(l>>>0),l=f>>>0;s.putInt32(l);var p={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};u(p,r,s);var g=n.util.createBuffer();return g.putInt32(p.h0),g.putInt32(p.h1),g.putInt32(p.h2),g.putInt32(p.h3),g.putInt32(p.h4),g},i};var o=null,s=!1;function a(){o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),64),s=!0}function u(e,t,r){for(var n,i,o,s,a,u,c,f,h=r.length();h>=64;){for(i=e.h0,o=e.h1,s=e.h2,a=e.h3,u=e.h4,f=0;f<16;++f)n=r.getInt32(),t[f]=n,c=a^o&(s^a),n=(i<<5|i>>>27)+c+u+1518500249+n,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;f<20;++f)n=t[f-3]^t[f-8]^t[f-14]^t[f-16],n=n<<1|n>>>31,t[f]=n,c=a^o&(s^a),n=(i<<5|i>>>27)+c+u+1518500249+n,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;f<32;++f)n=t[f-3]^t[f-8]^t[f-14]^t[f-16],n=n<<1|n>>>31,t[f]=n,c=o^s^a,n=(i<<5|i>>>27)+c+u+1859775393+n,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;f<40;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=o^s^a,n=(i<<5|i>>>27)+c+u+1859775393+n,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;f<60;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=o&s|a&(o^s),n=(i<<5|i>>>27)+c+u+2400959708+n,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;f<80;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=o^s^a,n=(i<<5|i>>>27)+c+u+3395469782+n,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+o|0,e.h2=e.h2+s|0,e.h3=e.h3+a|0,e.h4=e.h4+u|0,h-=64}}},function(e,t,r){var n=r(16);r(29),r(424),r(130),function(){if(n.prime)e.exports=n.prime;else{var t=e.exports=n.prime=n.prime||{},r=n.jsbn.BigInteger,i=[6,4,2,4,2,4,6,2],o=new r(null);o.fromInt(30);var s=function(e,t){return e|t};t.generateProbablePrime=function(e,t,r){"function"==typeof t&&(r=t,t={}),t=t||{};var i=t.algorithm||"PRIMEINC";"string"==typeof i&&(i={name:i}),i.options=i.options||{};var o=t.prng||n.random,s={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;rt&&(e=h(t,r)),e.isProbablePrime(s))return u(null,e);e.dAddOffset(i[o++%8],0)}while(a<0||+new Date-fe&&(s=h(e,t));var p=s.toString(16);i.target.postMessage({hex:p,workLoad:c}),s.dAddOffset(f,0)}}}d()}function h(e,t){var n=new r(e,t),i=e-1;return n.testBit(i)||n.bitwiseTo(r.ONE.shiftLeft(i),s,n),n.dAddOffset(31-n.mod(o).byteValue(),0),n}function l(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}}()},function(e,t,r){var n=r(16);r(106),r(29);var i=e.exports=n.hmac=n.hmac||{};i.create=function(){var e=null,t=null,r=null,i=null,o={start:function(o,s){if(null!==o)if("string"==typeof o){if(o=o.toLowerCase(),!(o in n.md.algorithms))throw new Error('Unknown hash algorithm "'+o+'"');t=n.md.algorithms[o].create()}else t=o;if(null===s)s=e;else{if("string"==typeof s)s=n.util.createBuffer(s);else if(n.util.isArray(s)){var a=s;s=n.util.createBuffer();for(var u=0;ut.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),r=n.util.createBuffer(),i=n.util.createBuffer(),c=s.length();for(var u=0;u>16-t},a=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"==typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r=e,o=e.length(),s=t,a=Math.ceil(s/8),u=255>>(7&s),c;for(c=o;c<128;c++)r.putByte(i[r.at(c-1)+r.at(c-o)&255]);for(r.setAt(128-a,i[r.at(128-a)&u]),c=127-a;c>=0;c--)r.setAt(c,i[r.at(c+1)^r.at(c+a)]);return r};var u=function(e,t,r){var i=!1,u=null,c=null,f=null,h,l,d,p,g=[];for(e=n.rc2.expandKey(e,t),d=0;d<64;d++)g.push(e.getInt16Le());r?(h=function(e){for(d=0;d<4;d++)e[d]+=g[p]+(e[(d+3)%4]&e[(d+2)%4])+(~e[(d+3)%4]&e[(d+1)%4]),e[d]=s(e[d],o[d]),p++},l=function(e){for(d=0;d<4;d++)e[d]+=g[63&e[(d+3)%4]]}):(h=function(e){for(d=3;d>=0;d--)e[d]=a(e[d],o[d]),e[d]-=g[p]+(e[(d+3)%4]&e[(d+2)%4])+(~e[(d+3)%4]&e[(d+1)%4]),p--},l=function(e){for(d=3;d>=0;d--)e[d]-=g[63&e[(d+3)%4]]});var m=function(e){var t=[];for(d=0;d<4;d++){var n=u.getInt16Le();null!==f&&(r?n^=f.getInt16Le():f.putInt16Le(n)),t.push(65535&n)}p=r?0:63;for(var i=0;i=8;)m([[5,h],[1,l],[6,h],[1,l],[5,h]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,u,!r);else{var n=8===u.length()?8:8-u.length();u.fillWithByte(n,n)}if(t&&(i=!0,b.update()),!r&&(t=0===u.length(),t))if(e)t=e(8,c,!r);else{var o=c.length(),s=c.at(o-1);s>o?t=!1:c.truncate(s)}return t}},b};n.rc2.startEncrypting=function(e,t,r){var i=n.rc2.createEncryptionCipher(e,128);return i.start(t,r),i},n.rc2.createEncryptionCipher=function(e,t){return u(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var i=n.rc2.createDecryptionCipher(e,128);return i.start(t,r),i},n.rc2.createDecryptionCipher=function(e,t){return u(e,t,!1)}},function(e,t,r){"use strict";const n=r(48),i=r(60),o=r(79),s=r(88),a=r(837),u=i(r(279));r(850),r(281);const c=r(16);class f{constructor(e){this._key=e}verify(e,t,r){m(r),a.hashAndVerify(this._key,t,e,r)}marshal(){return a.utils.jwkToPkix(this._key)}get bytes(){return u.PublicKey.encode({Type:u.KeyType.RSA,Data:this.marshal()})}encrypt(e){return this._key.encrypt(e,"RSAES-PKCS1-V1_5")}equals(e){return this.bytes.equals(e.bytes)}hash(e){m(e),n(this.bytes,"sha2-256",e)}}class h{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return a.getRandomValues(16)}sign(e,t){m(t),a.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new f(this._publicKey)}decrypt(e,t){a.decrypt(this._key,e,t)}marshal(){return a.utils.jwkToPkcs1(this._key)}get bytes(){return u.PrivateKey.encode({Type:u.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){m(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}export(e,t,r){"function"==typeof t&&(r=t,t=e,e="pkcs-8"),m(r),s(()=>{let n=null,i=null;try{const r=new c.util.ByteBuffer(this.marshal()),o=c.asn1.fromDer(r),s=c.pki.privateKeyFromAsn1(o);if("pkcs-8"===e){const e={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};i=c.pki.encryptRsaPrivateKey(s,t,e)}else n=new Error(`Unknown export format '${e}'`)}catch(e){n=e}r(n,i)})}}function l(e,t){const r=a.utils.pkcs1ToJwk(e);a.unmarshalPrivateKey(r,(e,r)=>{if(e)return t(e);t(null,new h(r.privateKey,r.publicKey))})}function d(e){const t=a.utils.pkixToJwk(e);return new f(t)}function p(e,t){a.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new h(r.privateKey,r.publicKey))})}function g(e,t){a.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new h(r.privateKey,r.publicKey))})}function m(e){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:h,unmarshalRsaPublicKey:d,unmarshalRsaPrivateKey:l,generateKeyPair:g,fromJwk:p}},function(e,t,r){"use strict";(function(e){const n=r(284),i=r(285),o=r(286);function s(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function a(e){return i.subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}t.utils=r(839),t.generateKey=function(e,t){n(i.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(s).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.unmarshalPrivateKey=function(e,t){const r=i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]);n(Promise.all([r,a(e)]).then(e=>s({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=o,t.hashAndSign=function(t,r,o){n(i.subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]).then(e=>i.subtle.sign({name:"RSASSA-PKCS1-v1_5"},e,Uint8Array.from(r))).then(t=>e.from(t)),o)},t.hashAndVerify=function(e,t,r,o){n(i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]).then(e=>i.subtle.verify({name:"RSASSA-PKCS1-v1_5"},e,t,r)),o)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t,r){const n=t.crypto||t.msCrypto,i=65536;function o(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}function s(e){const t=new Uint8Array(e);let o=0;if(e>0)if(e>i)for(;ot?n.getRandomValues(t.subarray(o,t-o)):(n.getRandomValues(t.subarray(o,o+i)),o+=i);else n.getRandomValues(t);return r.from(t)}n&&n.getRandomValues?e.exports=s:e.exports=o}).call(this,r(8),r(0).Buffer)},function(e,t,r){"use strict";const n=r(131),i=r(433),o=i.toBase64,s=i.toBn,a=n.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}),u=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid({"1.2.840.113549.1.1.1":"rsa"}),this.key("none").optional().null_(),this.key("curve").optional().objid(),this.key("params").optional().seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()))}),c=n.define("RSAPublicKey",function(){this.seq().obj(this.key("algorithm").use(u),this.key("subjectPublicKey").bitstr())}),f=n.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});t.pkcs1ToJwk=function(e){const t=a.decode(e,"der");return{kty:"RSA",n:o(t.modulus),e:o(t.publicExponent),d:o(t.privateExponent),p:o(t.prime1),q:o(t.prime2),dp:o(t.exponent1),dq:o(t.exponent2),qi:o(t.coefficient),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){return a.encode({version:0,modulus:s(e.n),publicExponent:s(e.e),privateExponent:s(e.d),prime1:s(e.p),prime2:s(e.q),exponent1:s(e.dp),exponent2:s(e.dq),coefficient:s(e.qi)},"der")},t.pkixToJwk=function(e){const t=c.decode(e,"der"),r=f.decode(t.subjectPublicKey.data,"der");return{kty:"RSA",n:o(r.modulus),e:o(r.publicExponent),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){return c.encode({algorithm:{algorithm:"rsa",none:null},subjectPublicKey:{data:f.encode({modulus:s(e.n),publicExponent:s(e.e)},"der")}},"der")}},function(e,t){},function(e,t,r){"use strict";const n=r(131),i=r(1),o=t;function s(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}o.define=function e(t,r){return new s(t,r)},s.prototype._createNamed=function e(t){let n;try{n=r(842).runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(e){n=function(e){this._initNamed(e)}}return i(n,t),n.prototype._initNamed=function e(r){t.call(this,r)},new n(this)},s.prototype._getDecoder=function e(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(n.decoders[t])),this.decoders[t]},s.prototype.decode=function e(t,r,n){return this._getDecoder(r).decode(t,n)},s.prototype._getEncoder=function e(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(n.encoders[t])),this.encoders[t]},s.prototype.encode=function e(t,r,n){return this._getEncoder(r).encode(t,n)}},function(module,exports,__webpack_require__){var indexOf=__webpack_require__(287),Object_keys=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var r in e)t.push(r);return t},forEach=function(e,t){if(e.forEach)return e.forEach(t);for(var r=0;r>>0,s>>>0];for(var a=d.fullMessageLength.length-1;a>=0;--a)d.fullMessageLength[a]+=s[1],s[1]=s[0]+(d.fullMessageLength[a]/4294967296>>>0),d.fullMessageLength[a]=d.fullMessageLength[a]>>>0,s[0]=s[1]/4294967296>>>0;return i.putBytes(e),h(r,o,i),(i.read>2048||0===i.length())&&i.compact(),d},d.digest=function(){var t=n.util.createBuffer();t.putBytes(i.bytes());var a=d.fullMessageLength[d.fullMessageLength.length-1]+d.messageLengthSize,u=a&d.blockLength-1,c,f;t.putBytes(s.substr(0,d.blockLength-u));for(var l=8*d.fullMessageLength[0],p=0;p>>0,l+=f,t.putInt32(l>>>0),l=c>>>0;t.putInt32(l);for(var g=new Array(r.length),p=0;p=128;){for(B=0;B<16;++B)t[B][0]=r.getInt32()>>>0,t[B][1]=r.getInt32()>>>0;for(;B<80;++B)N=t[B-2],P=N[0],M=N[1],n=((P>>>19|M<<13)^(M>>>29|P<<3)^P>>>6)>>>0,i=((P<<13|M>>>19)^(M<<3|P>>>29)^(P<<26|M>>>6))>>>0,j=t[B-15],P=j[0],M=j[1],o=((P>>>1|M<<31)^(P>>>8|M<<24)^P>>>7)>>>0,s=((P<<31|M>>>1)^(P<<24|M>>>8)^(P<<25|M>>>7))>>>0,L=t[B-7],D=t[B-16],M=i+L[1]+s+D[1],t[B][0]=n+L[0]+o+D[0]+(M/4294967296>>>0)>>>0,t[B][1]=M>>>0;for(m=e[0][0],b=e[0][1],y=e[1][0],v=e[1][1],_=e[2][0],w=e[2][1],S=e[3][0],E=e[3][1],k=e[4][0],x=e[4][1],C=e[5][0],A=e[5][1],I=e[6][0],T=e[6][1],O=e[7][0],R=e[7][1],B=0;B<80;++B)f=((k>>>14|x<<18)^(k>>>18|x<<14)^(x>>>9|k<<23))>>>0,h=((k<<18|x>>>14)^(k<<14|x>>>18)^(x<<23|k>>>9))>>>0,l=(I^k&(C^I))>>>0,d=(T^x&(A^T))>>>0,a=((m>>>28|b<<4)^(b>>>2|m<<30)^(b>>>7|m<<25))>>>0,c=((m<<4|b>>>28)^(b<<30|m>>>2)^(b<<25|m>>>7))>>>0,p=(m&y|_&(m^y))>>>0,g=(b&v|w&(b^v))>>>0,M=R+h+d+u[B][1]+t[B][1],n=O+f+l+u[B][0]+t[B][0]+(M/4294967296>>>0)>>>0,i=M>>>0,M=c+g,o=a+p+(M/4294967296>>>0)>>>0,s=M>>>0,O=I,R=T,I=C,T=A,C=k,A=x,M=E+i,k=S+n+(M/4294967296>>>0)>>>0,x=M>>>0,S=_,E=w,_=y,w=v,y=m,v=b,M=i+s,m=n+o+(M/4294967296>>>0)>>>0,b=M>>>0;M=e[0][1]+b,e[0][0]=e[0][0]+m+(M/4294967296>>>0)>>>0,e[0][1]=M>>>0,M=e[1][1]+v,e[1][0]=e[1][0]+y+(M/4294967296>>>0)>>>0,e[1][1]=M>>>0,M=e[2][1]+w,e[2][0]=e[2][0]+_+(M/4294967296>>>0)>>>0,e[2][1]=M>>>0,M=e[3][1]+E,e[3][0]=e[3][0]+S+(M/4294967296>>>0)>>>0,e[3][1]=M>>>0,M=e[4][1]+x,e[4][0]=e[4][0]+k+(M/4294967296>>>0)>>>0,e[4][1]=M>>>0,M=e[5][1]+A,e[5][0]=e[5][0]+C+(M/4294967296>>>0)>>>0,e[5][1]=M>>>0,M=e[6][1]+T,e[6][0]=e[6][0]+I+(M/4294967296>>>0)>>>0,e[6][1]=M>>>0,M=e[7][1]+R,e[7][0]=e[7][0]+O+(M/4294967296>>>0)>>>0,e[7][1]=M>>>0,F-=128}}},function(e,t,r){"use strict";(function(t){const n=r(48),i=r(60),o=r(79),s=r(852),a=i(r(279));class u{constructor(e){this._key=g(e,s.publicKeyLength)}verify(e,t,r){p(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return t.from(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){p(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=g(e,s.privateKeyLength),this._publicKey=g(t,s.publicKeyLength)}sign(e,t){p(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new u(this._publicKey)}marshal(){return t.concat([t.from(this._key),t.from(this._publicKey)])}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){p(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}}function f(e,t){try{e=g(e,s.privateKeyLength+s.publicKeyLength)}catch(e){return t(e)}const r=e.slice(0,s.privateKeyLength),n=e.slice(s.privateKeyLength,e.length);t(null,new c(r,n))}function h(e){return e=g(e,s.publicKeyLength),new u(e)}function l(e,t){void 0===t&&"function"==typeof e&&(t=e),s.generateKey((e,r)=>{if(e)return t(e);let n;try{n=new c(r.secretKey,r.publicKey)}catch(e){return void t(e)}t(null,n)})}function d(e,t,r){void 0===r&&"function"==typeof t&&(r=t),s.generateKeyFromSeed(e,(e,t)=>{if(e)return r(e);let n;try{n=new c(t.secretKey,t.publicKey)}catch(e){return void r(e)}r(null,n)})}function p(e){if("function"!=typeof e)throw new Error("callback is required")}function g(e,r){if(t.isBuffer(e)&&(e=new Uint8Array(e)),!(e instanceof Uint8Array)||e.length!==r)throw new Error("Key must be a Uint8Array or Buffer of length "+r);return e}e.exports={Ed25519PublicKey:u,Ed25519PrivateKey:c,unmarshalEd25519PrivateKey:f,unmarshalEd25519PublicKey:h,generateKeyPair:l,generateKeyPairFromSeed:d}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(853),i=r(88);t.publicKeyLength=n.sign.publicKeyLength,t.privateKeyLength=n.sign.secretKeyLength,t.generateKey=function(e){i(()=>{let t;try{t=n.sign.keyPair()}catch(t){return e(t)}e(null,t)})},t.generateKeyFromSeed=function(e,t){i(()=>{let r;try{r=n.sign.keyPair.fromSeed(e)}catch(e){return t(e)}t(null,r)})},t.hashAndSign=function(t,r,o){i(()=>{o(null,e.from(n.sign.detached(r,t)))})},t.hashAndVerify=function(e,t,r,o){i(()=>{let i;try{i=n.sign.detached.verify(r,t,e)}catch(e){return o(e)}o(null,i)})}}).call(this,r(0).Buffer)},function(e,t,r){!function(e){"use strict";var t=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r,e[t+4]=n>>24&255,e[t+5]=n>>16&255,e[t+6]=n>>8&255,e[t+7]=255&n}function g(e,t,r,n,i){var o,s=0;for(o=0;o>>8)-1}function m(e,t,r,n){return g(e,t,r,n,16)}function b(e,t,r,n){return g(e,t,r,n,32)}function y(e,t,r,n){for(var i=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,o=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,a=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,c=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,h=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,l=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,d=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,p=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,m=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,b=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,y=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,v=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=i,w=o,S=s,E=a,k=u,x=c,C=f,A=h,I=l,T=d,O=p,R=g,B=m,P=b,M=y,N=v,L,j=0;j<20;j+=2)L=_+B|0,k^=L<<7|L>>>25,L=k+_|0,I^=L<<9|L>>>23,L=I+k|0,B^=L<<13|L>>>19,L=B+I|0,_^=L<<18|L>>>14,L=x+w|0,T^=L<<7|L>>>25,L=T+x|0,P^=L<<9|L>>>23,L=P+T|0,w^=L<<13|L>>>19,L=w+P|0,x^=L<<18|L>>>14,L=O+C|0,M^=L<<7|L>>>25,L=M+O|0,S^=L<<9|L>>>23,L=S+M|0,C^=L<<13|L>>>19,L=C+S|0,O^=L<<18|L>>>14,L=N+R|0,E^=L<<7|L>>>25,L=E+N|0,A^=L<<9|L>>>23,L=A+E|0,R^=L<<13|L>>>19,L=R+A|0,N^=L<<18|L>>>14,L=_+E|0,w^=L<<7|L>>>25,L=w+_|0,S^=L<<9|L>>>23,L=S+w|0,E^=L<<13|L>>>19,L=E+S|0,_^=L<<18|L>>>14,L=x+k|0,C^=L<<7|L>>>25,L=C+x|0,A^=L<<9|L>>>23,L=A+C|0,k^=L<<13|L>>>19,L=k+A|0,x^=L<<18|L>>>14,L=O+T|0,R^=L<<7|L>>>25,L=R+O|0,I^=L<<9|L>>>23,L=I+R|0,T^=L<<13|L>>>19,L=T+I|0,O^=L<<18|L>>>14,L=N+M|0,B^=L<<7|L>>>25,L=B+N|0,P^=L<<9|L>>>23,L=P+B|0,M^=L<<13|L>>>19,L=M+P|0,N^=L<<18|L>>>14;_=_+i|0,w=w+o|0,S=S+s|0,E=E+a|0,k=k+u|0,x=x+c|0,C=C+f|0,A=A+h|0,I=I+l|0,T=T+d|0,O=O+p|0,R=R+g|0,B=B+m|0,P=P+b|0,M=M+y|0,N=N+v|0,e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=w>>>0&255,e[5]=w>>>8&255,e[6]=w>>>16&255,e[7]=w>>>24&255,e[8]=S>>>0&255,e[9]=S>>>8&255,e[10]=S>>>16&255,e[11]=S>>>24&255,e[12]=E>>>0&255,e[13]=E>>>8&255,e[14]=E>>>16&255,e[15]=E>>>24&255,e[16]=k>>>0&255,e[17]=k>>>8&255,e[18]=k>>>16&255,e[19]=k>>>24&255,e[20]=x>>>0&255,e[21]=x>>>8&255,e[22]=x>>>16&255,e[23]=x>>>24&255,e[24]=C>>>0&255,e[25]=C>>>8&255,e[26]=C>>>16&255,e[27]=C>>>24&255,e[28]=A>>>0&255,e[29]=A>>>8&255,e[30]=A>>>16&255,e[31]=A>>>24&255,e[32]=I>>>0&255,e[33]=I>>>8&255,e[34]=I>>>16&255,e[35]=I>>>24&255,e[36]=T>>>0&255,e[37]=T>>>8&255,e[38]=T>>>16&255,e[39]=T>>>24&255,e[40]=O>>>0&255,e[41]=O>>>8&255,e[42]=O>>>16&255,e[43]=O>>>24&255,e[44]=R>>>0&255,e[45]=R>>>8&255,e[46]=R>>>16&255,e[47]=R>>>24&255,e[48]=B>>>0&255,e[49]=B>>>8&255,e[50]=B>>>16&255,e[51]=B>>>24&255,e[52]=P>>>0&255,e[53]=P>>>8&255,e[54]=P>>>16&255,e[55]=P>>>24&255,e[56]=M>>>0&255,e[57]=M>>>8&255,e[58]=M>>>16&255,e[59]=M>>>24&255,e[60]=N>>>0&255,e[61]=N>>>8&255,e[62]=N>>>16&255,e[63]=N>>>24&255}function v(e,t,r,n){for(var i=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,o=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,a=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,c=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,h=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,l=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,d=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,p=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,m=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,b=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,y=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,v=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=i,w=o,S=s,E=a,k=u,x=c,C=f,A=h,I=l,T=d,O=p,R=g,B=m,P=b,M=y,N=v,L,j=0;j<20;j+=2)L=_+B|0,k^=L<<7|L>>>25,L=k+_|0,I^=L<<9|L>>>23,L=I+k|0,B^=L<<13|L>>>19,L=B+I|0,_^=L<<18|L>>>14,L=x+w|0,T^=L<<7|L>>>25,L=T+x|0,P^=L<<9|L>>>23,L=P+T|0,w^=L<<13|L>>>19,L=w+P|0,x^=L<<18|L>>>14,L=O+C|0,M^=L<<7|L>>>25,L=M+O|0,S^=L<<9|L>>>23,L=S+M|0,C^=L<<13|L>>>19,L=C+S|0,O^=L<<18|L>>>14,L=N+R|0,E^=L<<7|L>>>25,L=E+N|0,A^=L<<9|L>>>23,L=A+E|0,R^=L<<13|L>>>19,L=R+A|0,N^=L<<18|L>>>14,L=_+E|0,w^=L<<7|L>>>25,L=w+_|0,S^=L<<9|L>>>23,L=S+w|0,E^=L<<13|L>>>19,L=E+S|0,_^=L<<18|L>>>14,L=x+k|0,C^=L<<7|L>>>25,L=C+x|0,A^=L<<9|L>>>23,L=A+C|0,k^=L<<13|L>>>19,L=k+A|0,x^=L<<18|L>>>14,L=O+T|0,R^=L<<7|L>>>25,L=R+O|0,I^=L<<9|L>>>23,L=I+R|0,T^=L<<13|L>>>19,L=T+I|0,O^=L<<18|L>>>14,L=N+M|0,B^=L<<7|L>>>25,L=B+N|0,P^=L<<9|L>>>23,L=P+B|0,M^=L<<13|L>>>19,L=M+P|0,N^=L<<18|L>>>14;e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=x>>>0&255,e[5]=x>>>8&255,e[6]=x>>>16&255,e[7]=x>>>24&255,e[8]=O>>>0&255,e[9]=O>>>8&255,e[10]=O>>>16&255,e[11]=O>>>24&255,e[12]=N>>>0&255,e[13]=N>>>8&255,e[14]=N>>>16&255,e[15]=N>>>24&255,e[16]=C>>>0&255,e[17]=C>>>8&255,e[18]=C>>>16&255,e[19]=C>>>24&255,e[20]=A>>>0&255,e[21]=A>>>8&255,e[22]=A>>>16&255,e[23]=A>>>24&255,e[24]=I>>>0&255,e[25]=I>>>8&255,e[26]=I>>>16&255,e[27]=I>>>24&255,e[28]=T>>>0&255,e[29]=T>>>8&255,e[30]=T>>>16&255,e[31]=T>>>24&255}function _(e,t,r,n){y(e,t,r,n)}function w(e,t,r,n){v(e,t,r,n)}var S=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function E(e,t,r,n,i,o,s){var a=new Uint8Array(16),u=new Uint8Array(64),c,f;for(f=0;f<16;f++)a[f]=0;for(f=0;f<8;f++)a[f]=o[f];for(;i>=64;){for(_(u,a,s,S),f=0;f<64;f++)e[t+f]=r[n+f]^u[f];for(c=1,f=8;f<16;f++)c=c+(255&a[f])|0,a[f]=255&c,c>>>=8;i-=64,t+=64,n+=64}if(i>0)for(_(u,a,s,S),f=0;f=64;){for(_(s,o,i,S),u=0;u<64;u++)e[t+u]=s[u];for(a=1,u=8;u<16;u++)a=a+(255&o[u])|0,o[u]=255&a,a>>>=8;r-=64,t+=64}if(r>0)for(_(s,o,i,S),u=0;u>>13|r<<3),n=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(r>>>10|n<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(n>>>7|i<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,s=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|s<<2),a=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(s>>>11|a<<5),u=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(a>>>8|u<<8),this.r[9]=u>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function I(e,t,r,n,i,o){var s=new A(o);return s.update(r,n,i),s.finish(e,t),0}function T(e,t,r,n,i,o){var s=new Uint8Array(16);return I(s,0,r,n,i,o),m(e,t,s,0)}function O(e,t,r,n,i){var o;if(r<32)return-1;for(C(e,0,t,0,r,n,i),I(e,16,e,32,r-32,e),o=0;o<16;o++)e[o]=0;return 0}function R(e,t,r,n,i){var o,s=new Uint8Array(32);if(r<32)return-1;if(x(s,0,32,n,i),0!==T(t,16,t,32,r-32,s))return-1;for(C(e,0,t,0,r,n,i),o=0;o<32;o++)e[o]=0;return 0}function B(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function P(e){var t,r,n=1;for(t=0;t<16;t++)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function M(e,t,r){for(var n,i=~(r-1),o=0;o<16;o++)n=i&(e[o]^t[o]),e[o]^=n,t[o]^=n}function N(e,r){var n,i,o,s=t(),a=t();for(n=0;n<16;n++)a[n]=r[n];for(P(a),P(a),P(a),i=0;i<2;i++){for(s[0]=a[0]-65517,n=1;n<15;n++)s[n]=a[n]-65535-(s[n-1]>>16&1),s[n-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),o=s[15]>>16&1,s[14]&=65535,M(a,s,1-o)}for(n=0;n<16;n++)e[2*n]=255&a[n],e[2*n+1]=a[n]>>8}function L(e,t){var r=new Uint8Array(32),n=new Uint8Array(32);return N(r,e),N(n,t),b(r,0,n,0)}function j(e){var t=new Uint8Array(32);return N(t,e),1&t[0]}function D(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function F(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function U(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function q(e,t,r){var n,i,o=0,s=0,a=0,u=0,c=0,f=0,h=0,l=0,d=0,p=0,g=0,m=0,b=0,y=0,v=0,_=0,w=0,S=0,E=0,k=0,x=0,C=0,A=0,I=0,T=0,O=0,R=0,B=0,P=0,M=0,N=0,L=r[0],j=r[1],D=r[2],F=r[3],U=r[4],q=r[5],z=r[6],H=r[7],K=r[8],W=r[9],V=r[10],G=r[11],$=r[12],Y=r[13],J=r[14],X=r[15];n=t[0],o+=n*L,s+=n*j,a+=n*D,u+=n*F,c+=n*U,f+=n*q,h+=n*z,l+=n*H,d+=n*K,p+=n*W,g+=n*V,m+=n*G,b+=n*$,y+=n*Y,v+=n*J,_+=n*X,n=t[1],s+=n*L,a+=n*j,u+=n*D,c+=n*F,f+=n*U,h+=n*q,l+=n*z,d+=n*H,p+=n*K,g+=n*W,m+=n*V,b+=n*G,y+=n*$,v+=n*Y,_+=n*J,w+=n*X,n=t[2],a+=n*L,u+=n*j,c+=n*D,f+=n*F,h+=n*U,l+=n*q,d+=n*z,p+=n*H,g+=n*K,m+=n*W,b+=n*V,y+=n*G,v+=n*$,_+=n*Y,w+=n*J,S+=n*X,n=t[3],u+=n*L,c+=n*j,f+=n*D,h+=n*F,l+=n*U,d+=n*q,p+=n*z,g+=n*H,m+=n*K,b+=n*W,y+=n*V,v+=n*G,_+=n*$,w+=n*Y,S+=n*J,E+=n*X,n=t[4],c+=n*L,f+=n*j,h+=n*D,l+=n*F,d+=n*U,p+=n*q,g+=n*z,m+=n*H,b+=n*K,y+=n*W,v+=n*V,_+=n*G,w+=n*$,S+=n*Y,E+=n*J,k+=n*X,n=t[5],f+=n*L,h+=n*j,l+=n*D,d+=n*F,p+=n*U,g+=n*q,m+=n*z,b+=n*H,y+=n*K,v+=n*W,_+=n*V,w+=n*G,S+=n*$,E+=n*Y,k+=n*J,x+=n*X,n=t[6],h+=n*L,l+=n*j,d+=n*D,p+=n*F,g+=n*U,m+=n*q,b+=n*z,y+=n*H,v+=n*K,_+=n*W,w+=n*V,S+=n*G,E+=n*$,k+=n*Y,x+=n*J,C+=n*X,n=t[7],l+=n*L,d+=n*j,p+=n*D,g+=n*F,m+=n*U,b+=n*q,y+=n*z,v+=n*H,_+=n*K,w+=n*W,S+=n*V,E+=n*G,k+=n*$,x+=n*Y,C+=n*J,A+=n*X,n=t[8],d+=n*L,p+=n*j,g+=n*D,m+=n*F,b+=n*U,y+=n*q,v+=n*z,_+=n*H,w+=n*K,S+=n*W,E+=n*V,k+=n*G,x+=n*$,C+=n*Y,A+=n*J,I+=n*X,n=t[9],p+=n*L,g+=n*j,m+=n*D,b+=n*F,y+=n*U,v+=n*q,_+=n*z,w+=n*H,S+=n*K,E+=n*W,k+=n*V,x+=n*G,C+=n*$,A+=n*Y,I+=n*J,T+=n*X,n=t[10],g+=n*L,m+=n*j,b+=n*D,y+=n*F,v+=n*U,_+=n*q,w+=n*z,S+=n*H,E+=n*K,k+=n*W,x+=n*V,C+=n*G,A+=n*$,I+=n*Y,T+=n*J,O+=n*X,n=t[11],m+=n*L,b+=n*j,y+=n*D,v+=n*F,_+=n*U,w+=n*q,S+=n*z,E+=n*H,k+=n*K,x+=n*W,C+=n*V,A+=n*G,I+=n*$,T+=n*Y,O+=n*J,R+=n*X,n=t[12],b+=n*L,y+=n*j,v+=n*D,_+=n*F,w+=n*U,S+=n*q,E+=n*z,k+=n*H,x+=n*K,C+=n*W,A+=n*V,I+=n*G,T+=n*$,O+=n*Y,R+=n*J,B+=n*X,n=t[13],y+=n*L,v+=n*j,_+=n*D,w+=n*F,S+=n*U,E+=n*q,k+=n*z,x+=n*H,C+=n*K,A+=n*W,I+=n*V,T+=n*G,O+=n*$,R+=n*Y,B+=n*J,P+=n*X,n=t[14],v+=n*L,_+=n*j,w+=n*D,S+=n*F,E+=n*U,k+=n*q,x+=n*z,C+=n*H,A+=n*K,I+=n*W,T+=n*V,O+=n*G,R+=n*$,B+=n*Y,P+=n*J,M+=n*X,n=t[15],_+=n*L,w+=n*j,S+=n*D,E+=n*F,k+=n*U,x+=n*q,C+=n*z,A+=n*H,I+=n*K,T+=n*W,O+=n*V,R+=n*G,B+=n*$,P+=n*Y,M+=n*J,N+=n*X,o+=38*w,s+=38*S,a+=38*E,u+=38*k,c+=38*x,f+=38*C,h+=38*A,l+=38*I,d+=38*T,p+=38*O,g+=38*R,m+=38*B,b+=38*P,y+=38*M,v+=38*N,i=1,n=o+i+65535,i=Math.floor(n/65536),o=n-65536*i,n=s+i+65535,i=Math.floor(n/65536),s=n-65536*i,n=a+i+65535,i=Math.floor(n/65536),a=n-65536*i,n=u+i+65535,i=Math.floor(n/65536),u=n-65536*i,n=c+i+65535,i=Math.floor(n/65536),c=n-65536*i,n=f+i+65535,i=Math.floor(n/65536),f=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=n-65536*i,n=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=d+i+65535,i=Math.floor(n/65536),d=n-65536*i,n=p+i+65535,i=Math.floor(n/65536),p=n-65536*i,n=g+i+65535,i=Math.floor(n/65536),g=n-65536*i,n=m+i+65535,i=Math.floor(n/65536),m=n-65536*i,n=b+i+65535,i=Math.floor(n/65536),b=n-65536*i,n=y+i+65535,i=Math.floor(n/65536),y=n-65536*i,n=v+i+65535,i=Math.floor(n/65536),v=n-65536*i,n=_+i+65535,i=Math.floor(n/65536),_=n-65536*i,o+=i-1+37*(i-1),i=1,n=o+i+65535,i=Math.floor(n/65536),o=n-65536*i,n=s+i+65535,i=Math.floor(n/65536),s=n-65536*i,n=a+i+65535,i=Math.floor(n/65536),a=n-65536*i,n=u+i+65535,i=Math.floor(n/65536),u=n-65536*i,n=c+i+65535,i=Math.floor(n/65536),c=n-65536*i,n=f+i+65535,i=Math.floor(n/65536),f=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=n-65536*i,n=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=d+i+65535,i=Math.floor(n/65536),d=n-65536*i,n=p+i+65535,i=Math.floor(n/65536),p=n-65536*i,n=g+i+65535,i=Math.floor(n/65536),g=n-65536*i,n=m+i+65535,i=Math.floor(n/65536),m=n-65536*i,n=b+i+65535,i=Math.floor(n/65536),b=n-65536*i,n=y+i+65535,i=Math.floor(n/65536),y=n-65536*i,n=v+i+65535,i=Math.floor(n/65536),v=n-65536*i,n=_+i+65535,i=Math.floor(n/65536),_=n-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=u,e[4]=c,e[5]=f,e[6]=h,e[7]=l,e[8]=d,e[9]=p,e[10]=g,e[11]=m,e[12]=b,e[13]=y,e[14]=v,e[15]=_}function z(e,t){q(e,t,t)}function H(e,r){var n=t(),i;for(i=0;i<16;i++)n[i]=r[i];for(i=253;i>=0;i--)z(n,n),2!==i&&4!==i&&q(n,n,r);for(i=0;i<16;i++)e[i]=n[i]}function K(e,r){var n=t(),i;for(i=0;i<16;i++)n[i]=r[i];for(i=250;i>=0;i--)z(n,n),1!==i&&q(n,n,r);for(i=0;i<16;i++)e[i]=n[i]}function W(e,r,n){var i=new Uint8Array(32),o=new Float64Array(80),s,a,c=t(),f=t(),h=t(),l=t(),d=t(),p=t();for(a=0;a<31;a++)i[a]=r[a];for(i[31]=127&r[31]|64,i[0]&=248,D(o,n),a=0;a<16;a++)f[a]=o[a],l[a]=c[a]=h[a]=0;for(c[0]=l[0]=1,a=254;a>=0;--a)s=i[a>>>3]>>>(7&a)&1,M(c,f,s),M(h,l,s),F(d,c,h),U(c,c,h),F(h,f,l),U(f,f,l),z(l,d),z(p,c),q(c,h,c),q(h,f,d),F(d,c,h),U(c,c,h),z(f,c),U(h,l,p),q(c,h,u),F(c,c,l),q(h,h,c),q(c,l,p),q(l,f,o),z(f,d),M(c,f,s),M(h,l,s);for(a=0;a<16;a++)o[a+16]=c[a],o[a+32]=h[a],o[a+48]=f[a],o[a+64]=l[a];var g=o.subarray(32),m=o.subarray(16);return H(g,g),q(m,m,g),N(e,m),0}function V(e,t){return W(e,t,o)}function G(e,t){return n(t,32),V(e,t)}function $(e,t,r){var n=new Uint8Array(32);return W(n,r,t),w(e,i,n,S)}A.prototype.blocks=function(e,t,r){for(var n=this.fin?0:2048,i,o,s,a,u,c,f,h,l,d,p,g,m,b,y,v,_,w,S,E=this.h[0],k=this.h[1],x=this.h[2],C=this.h[3],A=this.h[4],I=this.h[5],T=this.h[6],O=this.h[7],R=this.h[8],B=this.h[9],P=this.r[0],M=this.r[1],N=this.r[2],L=this.r[3],j=this.r[4],D=this.r[5],F=this.r[6],U=this.r[7],q=this.r[8],z=this.r[9];r>=16;)i=255&e[t+0]|(255&e[t+1])<<8,E+=8191&i,o=255&e[t+2]|(255&e[t+3])<<8,k+=8191&(i>>>13|o<<3),s=255&e[t+4]|(255&e[t+5])<<8,x+=8191&(o>>>10|s<<6),a=255&e[t+6]|(255&e[t+7])<<8,C+=8191&(s>>>7|a<<9),u=255&e[t+8]|(255&e[t+9])<<8,A+=8191&(a>>>4|u<<12),I+=u>>>1&8191,c=255&e[t+10]|(255&e[t+11])<<8,T+=8191&(u>>>14|c<<2),f=255&e[t+12]|(255&e[t+13])<<8,O+=8191&(c>>>11|f<<5),h=255&e[t+14]|(255&e[t+15])<<8,R+=8191&(f>>>8|h<<8),B+=h>>>5|n,l=0,d=l,d+=E*P,d+=k*(5*z),d+=x*(5*q),d+=C*(5*U),d+=A*(5*F),l=d>>>13,d&=8191,d+=I*(5*D),d+=T*(5*j),d+=O*(5*L),d+=R*(5*N),d+=B*(5*M),l+=d>>>13,d&=8191,p=l,p+=E*M,p+=k*P,p+=x*(5*z),p+=C*(5*q),p+=A*(5*U),l=p>>>13,p&=8191,p+=I*(5*F),p+=T*(5*D),p+=O*(5*j),p+=R*(5*L),p+=B*(5*N),l+=p>>>13,p&=8191,g=l,g+=E*N,g+=k*M,g+=x*P,g+=C*(5*z),g+=A*(5*q),l=g>>>13,g&=8191,g+=I*(5*U),g+=T*(5*F),g+=O*(5*D),g+=R*(5*j),g+=B*(5*L),l+=g>>>13,g&=8191,m=l,m+=E*L,m+=k*N,m+=x*M,m+=C*P,m+=A*(5*z),l=m>>>13,m&=8191,m+=I*(5*q),m+=T*(5*U),m+=O*(5*F),m+=R*(5*D),m+=B*(5*j),l+=m>>>13,m&=8191,b=l,b+=E*j,b+=k*L,b+=x*N,b+=C*M,b+=A*P,l=b>>>13,b&=8191,b+=I*(5*z),b+=T*(5*q),b+=O*(5*U),b+=R*(5*F),b+=B*(5*D),l+=b>>>13,b&=8191,y=l,y+=E*D,y+=k*j,y+=x*L,y+=C*N,y+=A*M,l=y>>>13,y&=8191,y+=I*P,y+=T*(5*z),y+=O*(5*q),y+=R*(5*U),y+=B*(5*F),l+=y>>>13,y&=8191,v=l,v+=E*F,v+=k*D,v+=x*j,v+=C*L,v+=A*N,l=v>>>13,v&=8191,v+=I*M,v+=T*P,v+=O*(5*z),v+=R*(5*q),v+=B*(5*U),l+=v>>>13,v&=8191,_=l,_+=E*U,_+=k*F,_+=x*D,_+=C*j,_+=A*L,l=_>>>13,_&=8191,_+=I*N,_+=T*M,_+=O*P,_+=R*(5*z),_+=B*(5*q),l+=_>>>13,_&=8191,w=l,w+=E*q,w+=k*U,w+=x*F,w+=C*D,w+=A*j,l=w>>>13,w&=8191,w+=I*L,w+=T*N,w+=O*M,w+=R*P,w+=B*(5*z),l+=w>>>13,w&=8191,S=l,S+=E*z,S+=k*q,S+=x*U,S+=C*F,S+=A*D,l=S>>>13,S&=8191,S+=I*j,S+=T*L,S+=O*N,S+=R*M,S+=B*P,l+=S>>>13,S&=8191,l=(l<<2)+l|0,l=l+d|0,d=8191&l,l>>>=13,p+=l,E=d,k=p,x=g,C=m,A=b,I=y,T=v,O=_,R=w,B=S,t+=16,r-=16;this.h[0]=E,this.h[1]=k,this.h[2]=x,this.h[3]=C,this.h[4]=A,this.h[5]=I,this.h[6]=T,this.h[7]=O,this.h[8]=R,this.h[9]=B},A.prototype.finish=function(e,t){var r=new Uint16Array(10),n,i,o,s;if(this.leftover){for(s=this.leftover,this.buffer[s++]=1;s<16;s++)this.buffer[s]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(n=this.h[1]>>>13,this.h[1]&=8191,s=2;s<10;s++)this.h[s]+=n,n=this.h[s]>>>13,this.h[s]&=8191;for(this.h[0]+=5*n,n=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=n,n=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=n,r[0]=this.h[0]+5,n=r[0]>>>13,r[0]&=8191,s=1;s<10;s++)r[s]=this.h[s]+n,n=r[s]>>>13,r[s]&=8191;for(r[9]-=8192,i=(1^n)-1,s=0;s<10;s++)r[s]&=i;for(i=~i,s=0;s<10;s++)this.h[s]=this.h[s]&i|r[s];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,s=1;s<8;s++)o=(this.h[s]+this.pad[s]|0)+(o>>>16)|0,this.h[s]=65535&o;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},A.prototype.update=function(e,t,r){var n,i;if(this.leftover){for(i=16-this.leftover,i>r&&(i=r),n=0;n=16&&(i=r-r%16,this.blocks(e,t,i),t+=i,r-=i),r){for(n=0;n=128;){for(k=0;k<16;k++)x=8*k+$,i[k]=r[x+0]<<24|r[x+1]<<16|r[x+2]<<8|r[x+3],o[k]=r[x+4]<<24|r[x+5]<<16|r[x+6]<<8|r[x+7];for(k=0;k<80;k++)if(s=B,a=P,u=M,c=N,f=L,h=j,l=D,d=F,p=U,g=q,m=z,b=H,y=K,v=W,_=V,w=G,C=F,A=G,I=65535&A,T=A>>>16,O=65535&C,R=C>>>16,C=(L>>>14|K<<18)^(L>>>18|K<<14)^(K>>>9|L<<23),A=(K>>>14|L<<18)^(K>>>18|L<<14)^(L>>>9|K<<23),I+=65535&A,T+=A>>>16,O+=65535&C,R+=C>>>16,C=L&j^~L&D,A=K&W^~K&V,I+=65535&A,T+=A>>>16,O+=65535&C,R+=C>>>16,C=Q[2*k],A=Q[2*k+1],I+=65535&A,T+=A>>>16,O+=65535&C,R+=C>>>16,C=i[k%16],A=o[k%16],I+=65535&A,T+=A>>>16,O+=65535&C,R+=C>>>16,T+=I>>>16,O+=T>>>16,R+=O>>>16,S=65535&O|R<<16,E=65535&I|T<<16,C=S,A=E,I=65535&A,T=A>>>16,O=65535&C,R=C>>>16,C=(B>>>28|U<<4)^(U>>>2|B<<30)^(U>>>7|B<<25),A=(U>>>28|B<<4)^(B>>>2|U<<30)^(B>>>7|U<<25),I+=65535&A,T+=A>>>16,O+=65535&C,R+=C>>>16,C=B&P^B&M^P&M,A=U&q^U&z^q&z,I+=65535&A,T+=A>>>16,O+=65535&C,R+=C>>>16,T+=I>>>16,O+=T>>>16,R+=O>>>16,d=65535&O|R<<16,w=65535&I|T<<16,C=c,A=b,I=65535&A,T=A>>>16,O=65535&C,R=C>>>16,C=S,A=E,I+=65535&A,T+=A>>>16,O+=65535&C,R+=C>>>16,T+=I>>>16,O+=T>>>16,R+=O>>>16,c=65535&O|R<<16,b=65535&I|T<<16,P=s,M=a,N=u,L=c,j=f,D=h,F=l,B=d,q=p,z=g,H=m,K=b,W=y,V=v,G=_,U=w,k%16==15)for(x=0;x<16;x++)C=i[x],A=o[x],I=65535&A,T=A>>>16,O=65535&C,R=C>>>16,C=i[(x+9)%16],A=o[(x+9)%16],I+=65535&A,T+=A>>>16,O+=65535&C,R+=C>>>16,S=i[(x+1)%16],E=o[(x+1)%16],C=(S>>>1|E<<31)^(S>>>8|E<<24)^S>>>7,A=(E>>>1|S<<31)^(E>>>8|S<<24)^(E>>>7|S<<25),I+=65535&A,T+=A>>>16,O+=65535&C,R+=C>>>16,S=i[(x+14)%16],E=o[(x+14)%16],C=(S>>>19|E<<13)^(E>>>29|S<<3)^S>>>6,A=(E>>>19|S<<13)^(S>>>29|E<<3)^(E>>>6|S<<26),I+=65535&A,T+=A>>>16,O+=65535&C,R+=C>>>16,T+=I>>>16,O+=T>>>16,R+=O>>>16,i[x]=65535&O|R<<16,o[x]=65535&I|T<<16;C=B,A=U,I=65535&A,T=A>>>16,O=65535&C,R=C>>>16,C=e[0],A=t[0],I+=65535&A,T+=A>>>16,O+=65535&C,R+=C>>>16,T+=I>>>16,O+=T>>>16,R+=O>>>16,e[0]=B=65535&O|R<<16,t[0]=U=65535&I|T<<16,C=P,A=q,I=65535&A,T=A>>>16,O=65535&C,R=C>>>16,C=e[1],A=t[1],I+=65535&A,T+=A>>>16,O+=65535&C,R+=C>>>16,T+=I>>>16,O+=T>>>16,R+=O>>>16,e[1]=P=65535&O|R<<16,t[1]=q=65535&I|T<<16,C=M,A=z,I=65535&A,T=A>>>16,O=65535&C,R=C>>>16,C=e[2],A=t[2],I+=65535&A,T+=A>>>16,O+=65535&C,R+=C>>>16,T+=I>>>16,O+=T>>>16,R+=O>>>16,e[2]=M=65535&O|R<<16,t[2]=z=65535&I|T<<16,C=N,A=H,I=65535&A,T=A>>>16,O=65535&C,R=C>>>16,C=e[3],A=t[3],I+=65535&A,T+=A>>>16,O+=65535&C,R+=C>>>16,T+=I>>>16,O+=T>>>16,R+=O>>>16,e[3]=N=65535&O|R<<16,t[3]=H=65535&I|T<<16,C=L,A=K,I=65535&A,T=A>>>16,O=65535&C,R=C>>>16,C=e[4],A=t[4],I+=65535&A,T+=A>>>16,O+=65535&C,R+=C>>>16,T+=I>>>16,O+=T>>>16,R+=O>>>16,e[4]=L=65535&O|R<<16,t[4]=K=65535&I|T<<16,C=j,A=W,I=65535&A,T=A>>>16,O=65535&C,R=C>>>16,C=e[5],A=t[5],I+=65535&A,T+=A>>>16,O+=65535&C,R+=C>>>16,T+=I>>>16,O+=T>>>16,R+=O>>>16,e[5]=j=65535&O|R<<16,t[5]=W=65535&I|T<<16,C=D,A=V,I=65535&A,T=A>>>16,O=65535&C,R=C>>>16,C=e[6],A=t[6],I+=65535&A,T+=A>>>16,O+=65535&C,R+=C>>>16,T+=I>>>16,O+=T>>>16,R+=O>>>16,e[6]=D=65535&O|R<<16,t[6]=V=65535&I|T<<16,C=F,A=G,I=65535&A,T=A>>>16,O=65535&C,R=C>>>16,C=e[7],A=t[7],I+=65535&A,T+=A>>>16,O+=65535&C,R+=C>>>16,T+=I>>>16,O+=T>>>16,R+=O>>>16,e[7]=F=65535&O|R<<16,t[7]=G=65535&I|T<<16,$+=128,n-=128}return n}function te(e,t,r){var n=new Int32Array(8),i=new Int32Array(8),o=new Uint8Array(256),s,a=r;for(n[0]=1779033703,n[1]=3144134277,n[2]=1013904242,n[3]=2773480762,n[4]=1359893119,n[5]=2600822924,n[6]=528734635,n[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,ee(n,i,t,r),r%=128,s=0;s=0;--i)n=r[i/8|0]>>(7&i)&1,ne(e,t,n),re(t,e),re(e,e),ne(e,t,n)}function se(e,r){var n=[t(),t(),t(),t()];B(n[0],h),B(n[1],l),B(n[2],a),q(n[3],h,l),oe(e,n,r)}function ae(e,r,i){var o=new Uint8Array(64),s=[t(),t(),t(),t()],a;for(i||n(r,32),te(o,r,32),o[0]&=248,o[31]&=127,o[31]|=64,se(s,o),ie(e,s),a=0;a<32;a++)r[a+32]=e[a];return 0}var ue=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ce(e,t){var r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i>8,t[i]-=256*r;t[i]+=r,t[n]=0}for(r=0,i=0;i<32;i++)t[i]+=r-(t[31]>>4)*ue[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=r*ue[i];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function fe(e){var t=new Float64Array(64),r;for(r=0;r<64;r++)t[r]=e[r];for(r=0;r<64;r++)e[r]=0;ce(e,t)}function he(e,r,n,i){var o=new Uint8Array(64),s=new Uint8Array(64),a=new Uint8Array(64),u,c,f=new Float64Array(64),h=[t(),t(),t(),t()];te(o,i,32),o[0]&=248,o[31]&=127,o[31]|=64;var l=n+64;for(u=0;u>7&&U(e[0],s,e[0]),q(e[3],e[0],e[1]),0)}function de(e,r,n,i){var o,s,a=new Uint8Array(32),u=new Uint8Array(64),c=[t(),t(),t(),t()],f=[t(),t(),t(),t()];if(s=-1,n<64)return-1;if(le(f,i))return-1;for(o=0;o=0},e.sign.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(64);return ae(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(Pe(e),64!==e.length)throw new Error("bad secret key size");for(var t=new Uint8Array(32),r=0;r{i=i||r(856)(t);class o{constructor(e){i.validatePublicKey(e),this._key=e}verify(e,t,r){f(r),i.hashAndVerify(this._key,t,e,r)}marshal(){return i.compressPublicKey(this._key)}get bytes(){return e.PublicKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){f(e),n(this.bytes,"sha2-256",e)}}class s{constructor(e,t){this._key=e,this._publicKey=t||i.computePublicKey(e),i.validatePrivateKey(this._key),i.validatePublicKey(this._publicKey)}sign(e,t){f(t),i.hashAndSign(this._key,e,t)}get public(){return new o(this._publicKey)}marshal(){return this._key}get bytes(){return e.PrivateKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){f(e),n(this.bytes,"sha2-256",e)}}function a(e,t){t(null,new s(e),null)}function u(e){return new o(e)}function c(e,t){void 0===t&&"function"==typeof e&&(t=e),f(t),i.generateKey((e,r)=>{if(e)return t(e);let n;try{n=new s(r)}catch(e){return t(e)}t(null,n)})}function f(e){if("function"!=typeof e)throw new Error("callback is required")}return{Secp256k1PublicKey:o,Secp256k1PrivateKey:s,unmarshalSecp256k1PrivateKey:a,unmarshalSecp256k1PublicKey:u,generateKeyPair:c}})},function(e,t,r){"use strict";const n=r(857),i=r(48),o=r(14),s="sha2-256";e.exports=(e=>{const t=32;function r(t){const r=(e,r)=>o(()=>t(e,r));let i;do{i=e(32)}while(!n.privateKeyVerify(i));r(null,i)}function a(e,t,r){const a=(e,t)=>o(()=>r(e,t));i.digest(t,s,(t,r)=>{if(t)return a(t);try{const i=n.sign(r,e),o=n.signatureExport(i.signature);return a(null,o)}catch(t){a(t)}})}function u(e,t,r,a){const u=(e,t)=>o(()=>a(e,t));i.digest(r,s,(r,i)=>{if(r)return u(r);try{t=n.signatureImport(t);const o=n.verify(i,t,e);return u(null,o)}catch(r){u(r)}})}function c(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key");return n.publicKeyConvert(e,!0)}function f(e){return n.publicKeyConvert(e,!1)}function h(e){if(!n.privateKeyVerify(e))throw new Error("Invalid private key")}function l(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key")}function d(e){return h(e),n.publicKeyCreate(e)}return{generateKey:r,privateKeyLength:32,hashAndSign:a,hashAndVerify:u,compressPublicKey:c,decompressPublicKey:f,validatePrivateKey:h,validatePublicKey:l,computePublicKey:d}})},function(e,t,r){"use strict";e.exports=r(434)(r(860))},function(e,t,r){"use strict";(function(e){var r=Object.prototype.toString;t.isArray=function(e,t){if(!Array.isArray(e))throw TypeError(t)},t.isBoolean=function(e,t){if("[object Boolean]"!==r.call(e))throw TypeError(t)},t.isBuffer=function(t,r){if(!e.isBuffer(t))throw TypeError(r)},t.isFunction=function(e,t){if("[object Function]"!==r.call(e))throw TypeError(t)},t.isNumber=function(e,t){if("[object Number]"!==r.call(e))throw TypeError(t)},t.isObject=function(e,t){if("[object Object]"!==r.call(e))throw TypeError(t)},t.isBufferLength=function(e,t,r){if(e.length!==t)throw RangeError(r)},t.isBufferLength2=function(e,t,r,n){if(e.length!==t&&e.length!==r)throw RangeError(n)},t.isLengthGTZero=function(e,t){if(0===e.length)throw RangeError(t)},t.isNumberInInterval=function(e,t,r,n){if(e<=t||e>=r)throw RangeError(n)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(4).Buffer,i=r(288),o=n.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),s=n.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);t.privateKeyExport=function(e,t,r){var i=n.from(r?o:s);return e.copy(i,r?8:9),t.copy(i,r?181:214),i},t.privateKeyImport=function(e){var t=e.length,r=0;if(!(t2||t1?e[r+n-2]<<8:0);if(r+=n,!(t32||t1&&0===t[o]&&!(128&t[o+1]);--r,++o);for(var s=n.concat([n.from([0]),e.s]),a=33,u=0;a>1&&0===s[u]&&!(128&s[u+1]);--a,++u);return i.encode(t.slice(o),s.slice(u))},t.signatureImport=function(e){var t=n.alloc(32,0),r=n.alloc(32,0);try{var o=i.decode(e);if(33===o.r.length&&0===o.r[0]&&(o.r=o.r.slice(1)),o.r.length>32)throw new Error("R length is too long");if(33===o.s.length&&0===o.s[0]&&(o.s=o.s.slice(1)),o.s.length>32)throw new Error("S length is too long")}catch(e){return}return o.r.copy(t,32-o.r.length),o.s.copy(r,32-o.s.length),{r:t,s:r}},t.signatureImportLax=function(e){var t=n.alloc(32,0),r=n.alloc(32,0),i=e.length,o=0;if(48===e[o++]){var s=e[o++];if(!(128&s&&(o+=s-128,o>i))&&2===e[o++]){var a=e[o++];if(128&a){if(s=a-128,o+s>i)return;for(;s>0&&0===e[o];o+=1,s-=1);for(a=0;s>0;o+=1,s-=1)a=(a<<8)+e[o]}if(!(a>i-o)){var u=o;if(o+=a,2===e[o++]){var c=e[o++];if(128&c){if(s=c-128,o+s>i)return;for(;s>0&&0===e[o];o+=1,s-=1);for(c=0;s>0;o+=1,s-=1)c=(c<<8)+e[o]}if(!(c>i-o)){var f=o;for(o+=c;a>0&&0===e[u];a-=1,u+=1);if(!(a>32)){var h=e.slice(u,u+a);for(h.copy(t,32-h.length);c>0&&0===e[f];c-=1,f+=1);if(!(c>32)){var l=e.slice(f,f+c);return l.copy(r,32-l.length),{r:t,s:r}}}}}}}}}},function(e,t,r){"use strict";var n=r(4).Buffer,i=r(132),o=r(865),s=r(289),a=r(211),u=r(440),c=r(870);t.privateKeyVerify=function(e){var t=a.fromBuffer(e);return!(t.isOverflow()||t.isZero())},t.privateKeyExport=function(e,t){var r=a.fromBuffer(e);if(r.isOverflow()||r.isZero())throw new Error(s.EC_PRIVATE_KEY_EXPORT_DER_FAIL);return c.mul(r).toPublicKey(t)},t.privateKeyNegate=function(e){var t=a.fromBuffer(e);return t.isZero()?n.alloc(32):(t.ucmp(a.n)>0&&t.isub(a.n),a.n.sub(t).toBuffer())},t.privateKeyModInverse=function(e){var t=a.fromBuffer(e);if(t.isOverflow()||t.isZero())throw new Error(s.EC_PRIVATE_KEY_RANGE_INVALID);return t.uinvm().toBuffer()},t.privateKeyTweakAdd=function(e,t){var r=a.fromBuffer(t);if(r.isOverflow())throw new Error(s.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);if(r.iadd(a.fromBuffer(e)),r.isOverflow()&&r.isub(a.n),r.isZero())throw new Error(s.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);return r.toBuffer()},t.privateKeyTweakMul=function(e,t){var r=a.fromBuffer(t);if(r.isOverflow()||r.isZero())throw new Error(s.EC_PRIVATE_KEY_TWEAK_MUL_FAIL);var n=a.fromBuffer(e);return r.umul(n).ureduce().toBuffer()},t.publicKeyCreate=function(e,t){var r=a.fromBuffer(e);if(r.isOverflow()||r.isZero())throw new Error(s.EC_PUBLIC_KEY_CREATE_FAIL);return c.mul(r).toPublicKey(t)},t.publicKeyConvert=function(e,t){var r=u.fromPublicKey(e);if(null===r)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);return r.toPublicKey(t)},t.publicKeyVerify=function(e){return null!==u.fromPublicKey(e)},t.publicKeyTweakAdd=function(e,t,r){var n=u.fromPublicKey(e);if(null===n)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);if(t=a.fromBuffer(t),t.isOverflow())throw new Error(s.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);var i=c.mul(t).add(n);if(i.inf)throw new Error(s.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);return i.toPublicKey(r)},t.publicKeyTweakMul=function(e,t,r){var n=u.fromPublicKey(e);if(null===n)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);if(t=a.fromBuffer(t),t.isOverflow()||t.isZero())throw new Error(s.EC_PUBLIC_KEY_TWEAK_MUL_FAIL);return n.mul(t).toPublicKey(r)},t.publicKeyCombine=function(e,t){for(var r=new Array(e.length),n=0;n=0)&&0===n.iadd(a.psn).redMul(p).ucmp(d.x)},t.recover=function(e,t,r,i){var o=a.fromBuffer(t.slice(0,32)),f=a.fromBuffer(t.slice(32,64));if(o.isOverflow()||f.isOverflow())throw new Error(s.ECDSA_SIGNATURE_PARSE_FAIL);do{if(o.isZero()||f.isZero())break;var h=o;if(r>>1){if(h.ucmp(a.psn)>=0)break;h=o.add(a.n)}var l=n.concat([n.from([2+(1&r)]),h.toBuffer()]),d=u.fromPublicKey(l);if(null===d)break;var p=o.uinvm(),g=a.n.sub(a.fromBuffer(e)).umul(p).ureduce(),m=f.umul(p).ureduce(),b=u.fromECJPoint(c.mulAdd(g,d,m));return b.toPublicKey(i)}while(0);throw new Error(s.ECDSA_RECOVER_FAIL)},t.ecdh=function(e,r){var n=t.ecdhUnsafe(e,r,!0);return i("sha256").update(n).digest()},t.ecdhUnsafe=function(e,t,r){var n=u.fromPublicKey(e);if(null===n)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);var i=a.fromBuffer(t);if(i.isOverflow()||i.isZero())throw new Error(s.ECDH_FAIL);return n.mul(i).toPublicKey(r)}},function(e,t,r){var n=r(1),i=r(133),o=r(4).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function c(e){return e<<5|e>>>27}function f(e){return e<<30|e>>>2}function h(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t=this._w,r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,u=0;u<16;++u)t[u]=e.readInt32BE(4*u);for(;u<80;++u)t[u]=t[u-3]^t[u-8]^t[u-14]^t[u-16];for(var l=0;l<80;++l){var d=~~(l/20),p=c(r)+h(d,n,i,o)+a+t[l]+s[d]|0;a=o,o=i,i=f(n),n=r,r=p}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0},u.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},function(e,t,r){var n=r(1),i=r(133),o=r(4).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function c(e){return e<<1|e>>>31}function f(e){return e<<5|e>>>27}function h(e){return e<<30|e>>>2}function l(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t=this._w,r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,u=0;u<16;++u)t[u]=e.readInt32BE(4*u);for(;u<80;++u)t[u]=c(t[u-3]^t[u-8]^t[u-14]^t[u-16]);for(var d=0;d<80;++d){var p=~~(d/20),g=f(r)+l(p,n,i,o)+a+t[d]+s[p]|0;a=o,o=i,i=h(n),n=r,r=g}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0},u.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},function(e,t,r){var n=r(1),i=r(438),o=r(133),s=r(4).Buffer,a=new Array(64);function u(){this.init(),this._w=a,o.call(this,64,56)}n(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var e=s.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=u},function(e,t,r){var n=r(1),i=r(439),o=r(133),s=r(4).Buffer,a=new Array(160);function u(){this.init(),this._w=a,o.call(this,128,112)}n(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var e=s.allocUnsafe(48);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},e.exports=u},function(e,t,r){"use strict";(function(t){var n=r(291),i=r(868),o=new t(0),s=new t([0]),a=new t([1]);function u(e,t,r,n){var o=i[e];if(void 0===o)throw new Error("hash "+e+" is not supported");this._algo=e,this._securityStrength=o.securityStrength/8,this._outlen=o.outlen/8,this._reseedInterval=281474976710656,this._init(t,r,n)}u.prototype._update=function(e){var t=n(this._algo,this._K).update(this._V).update(s);e&&t.update(e),this._K=t.digest(),this._V=n(this._algo,this._K).update(this._V).digest(),e&&(this._K=n(this._algo,this._K).update(this._V).update(a).update(e).digest(),this._V=n(this._algo,this._K).update(this._V).digest())},u.prototype._init=function(e,r,n){if(e.lengththis._reseedInterval)throw new Error("Reseed is required");r&&0===r.length&&(r=void 0),r&&this._update(r);for(var i=new t(0);i.lengtha?t=e(t):t.length>>13,d=0|n[1],p=8191&d,g=d>>>13,m=0|n[2],b=8191&m,y=m>>>13,v=0|n[3],_=8191&v,w=v>>>13,S=0|n[4],E=8191&S,k=S>>>13,x=0|n[5],C=8191&x,A=x>>>13,I=0|n[6],T=8191&I,O=I>>>13,R=0|n[7],B=8191&R,P=R>>>13,M=0|n[8],N=8191&M,L=M>>>13,j=0|n[9],D=8191&j,F=j>>>13,U=0|i[0],q=8191&U,z=U>>>13,H=0|i[1],K=8191&H,W=H>>>13,V=0|i[2],G=8191&V,$=V>>>13,Y=0|i[3],J=8191&Y,X=Y>>>13,Z=0|i[4],Q=8191&Z,ee=Z>>>13,te=0|i[5],re=8191&te,ne=te>>>13,ie=0|i[6],oe=8191&ie,se=ie>>>13,ae=0|i[7],ue=8191&ae,ce=ae>>>13,fe=0|i[8],he=8191&fe,le=fe>>>13,de=0|i[9],pe=8191&de,ge=de>>>13;r.length=19,a=Math.imul(h,q),u=Math.imul(h,z),u+=Math.imul(l,q),c=Math.imul(l,z);var me=s+a+((8191&u)<<13);s=c+(u>>>13)+(me>>>26),me&=67108863,a=Math.imul(p,q),u=Math.imul(p,z),u+=Math.imul(g,q),c=Math.imul(g,z),a+=Math.imul(h,K),u+=Math.imul(h,W),u+=Math.imul(l,K),c+=Math.imul(l,W);var be=s+a+((8191&u)<<13);s=c+(u>>>13)+(be>>>26),be&=67108863,a=Math.imul(b,q),u=Math.imul(b,z),u+=Math.imul(y,q),c=Math.imul(y,z),a+=Math.imul(p,K),u+=Math.imul(p,W),u+=Math.imul(g,K),c+=Math.imul(g,W),a+=Math.imul(h,G),u+=Math.imul(h,$),u+=Math.imul(l,G),c+=Math.imul(l,$);var ye=s+a+((8191&u)<<13);s=c+(u>>>13)+(ye>>>26),ye&=67108863,a=Math.imul(_,q),u=Math.imul(_,z),u+=Math.imul(w,q),c=Math.imul(w,z),a+=Math.imul(b,K),u+=Math.imul(b,W),u+=Math.imul(y,K),c+=Math.imul(y,W),a+=Math.imul(p,G),u+=Math.imul(p,$),u+=Math.imul(g,G),c+=Math.imul(g,$),a+=Math.imul(h,J),u+=Math.imul(h,X),u+=Math.imul(l,J),c+=Math.imul(l,X);var ve=s+a+((8191&u)<<13);s=c+(u>>>13)+(ve>>>26),ve&=67108863,a=Math.imul(E,q),u=Math.imul(E,z),u+=Math.imul(k,q),c=Math.imul(k,z),a+=Math.imul(_,K),u+=Math.imul(_,W),u+=Math.imul(w,K),c+=Math.imul(w,W),a+=Math.imul(b,G),u+=Math.imul(b,$),u+=Math.imul(y,G),c+=Math.imul(y,$),a+=Math.imul(p,J),u+=Math.imul(p,X),u+=Math.imul(g,J),c+=Math.imul(g,X),a+=Math.imul(h,Q),u+=Math.imul(h,ee),u+=Math.imul(l,Q),c+=Math.imul(l,ee);var _e=s+a+((8191&u)<<13);s=c+(u>>>13)+(_e>>>26),_e&=67108863,a=Math.imul(C,q),u=Math.imul(C,z),u+=Math.imul(A,q),c=Math.imul(A,z),a+=Math.imul(E,K),u+=Math.imul(E,W),u+=Math.imul(k,K),c+=Math.imul(k,W),a+=Math.imul(_,G),u+=Math.imul(_,$),u+=Math.imul(w,G),c+=Math.imul(w,$),a+=Math.imul(b,J),u+=Math.imul(b,X),u+=Math.imul(y,J),c+=Math.imul(y,X),a+=Math.imul(p,Q),u+=Math.imul(p,ee),u+=Math.imul(g,Q),c+=Math.imul(g,ee),a+=Math.imul(h,re),u+=Math.imul(h,ne),u+=Math.imul(l,re),c+=Math.imul(l,ne);var we=s+a+((8191&u)<<13);s=c+(u>>>13)+(we>>>26),we&=67108863,a=Math.imul(T,q),u=Math.imul(T,z),u+=Math.imul(O,q),c=Math.imul(O,z),a+=Math.imul(C,K),u+=Math.imul(C,W),u+=Math.imul(A,K),c+=Math.imul(A,W),a+=Math.imul(E,G),u+=Math.imul(E,$),u+=Math.imul(k,G),c+=Math.imul(k,$),a+=Math.imul(_,J),u+=Math.imul(_,X),u+=Math.imul(w,J),c+=Math.imul(w,X),a+=Math.imul(b,Q),u+=Math.imul(b,ee),u+=Math.imul(y,Q),c+=Math.imul(y,ee),a+=Math.imul(p,re),u+=Math.imul(p,ne),u+=Math.imul(g,re),c+=Math.imul(g,ne),a+=Math.imul(h,oe),u+=Math.imul(h,se),u+=Math.imul(l,oe),c+=Math.imul(l,se);var Se=s+a+((8191&u)<<13);s=c+(u>>>13)+(Se>>>26),Se&=67108863,a=Math.imul(B,q),u=Math.imul(B,z),u+=Math.imul(P,q),c=Math.imul(P,z),a+=Math.imul(T,K),u+=Math.imul(T,W),u+=Math.imul(O,K),c+=Math.imul(O,W),a+=Math.imul(C,G),u+=Math.imul(C,$),u+=Math.imul(A,G),c+=Math.imul(A,$),a+=Math.imul(E,J),u+=Math.imul(E,X),u+=Math.imul(k,J),c+=Math.imul(k,X),a+=Math.imul(_,Q),u+=Math.imul(_,ee),u+=Math.imul(w,Q),c+=Math.imul(w,ee),a+=Math.imul(b,re),u+=Math.imul(b,ne),u+=Math.imul(y,re),c+=Math.imul(y,ne),a+=Math.imul(p,oe),u+=Math.imul(p,se),u+=Math.imul(g,oe),c+=Math.imul(g,se),a+=Math.imul(h,ue),u+=Math.imul(h,ce),u+=Math.imul(l,ue),c+=Math.imul(l,ce);var Ee=s+a+((8191&u)<<13);s=c+(u>>>13)+(Ee>>>26),Ee&=67108863,a=Math.imul(N,q),u=Math.imul(N,z),u+=Math.imul(L,q),c=Math.imul(L,z),a+=Math.imul(B,K),u+=Math.imul(B,W),u+=Math.imul(P,K),c+=Math.imul(P,W),a+=Math.imul(T,G),u+=Math.imul(T,$),u+=Math.imul(O,G),c+=Math.imul(O,$),a+=Math.imul(C,J),u+=Math.imul(C,X),u+=Math.imul(A,J),c+=Math.imul(A,X),a+=Math.imul(E,Q),u+=Math.imul(E,ee),u+=Math.imul(k,Q),c+=Math.imul(k,ee),a+=Math.imul(_,re),u+=Math.imul(_,ne),u+=Math.imul(w,re),c+=Math.imul(w,ne),a+=Math.imul(b,oe),u+=Math.imul(b,se),u+=Math.imul(y,oe),c+=Math.imul(y,se),a+=Math.imul(p,ue),u+=Math.imul(p,ce),u+=Math.imul(g,ue),c+=Math.imul(g,ce),a+=Math.imul(h,he),u+=Math.imul(h,le),u+=Math.imul(l,he),c+=Math.imul(l,le);var ke=s+a+((8191&u)<<13);s=c+(u>>>13)+(ke>>>26),ke&=67108863,a=Math.imul(D,q),u=Math.imul(D,z),u+=Math.imul(F,q),c=Math.imul(F,z),a+=Math.imul(N,K),u+=Math.imul(N,W),u+=Math.imul(L,K),c+=Math.imul(L,W),a+=Math.imul(B,G),u+=Math.imul(B,$),u+=Math.imul(P,G),c+=Math.imul(P,$),a+=Math.imul(T,J),u+=Math.imul(T,X),u+=Math.imul(O,J),c+=Math.imul(O,X),a+=Math.imul(C,Q),u+=Math.imul(C,ee),u+=Math.imul(A,Q),c+=Math.imul(A,ee),a+=Math.imul(E,re),u+=Math.imul(E,ne),u+=Math.imul(k,re),c+=Math.imul(k,ne),a+=Math.imul(_,oe),u+=Math.imul(_,se),u+=Math.imul(w,oe),c+=Math.imul(w,se),a+=Math.imul(b,ue),u+=Math.imul(b,ce),u+=Math.imul(y,ue),c+=Math.imul(y,ce),a+=Math.imul(p,he),u+=Math.imul(p,le),u+=Math.imul(g,he),c+=Math.imul(g,le),a+=Math.imul(h,pe),u+=Math.imul(h,ge),u+=Math.imul(l,pe),c+=Math.imul(l,ge);var xe=s+a+((8191&u)<<13);s=c+(u>>>13)+(xe>>>26),xe&=67108863,a=Math.imul(D,K),u=Math.imul(D,W),u+=Math.imul(F,K),c=Math.imul(F,W),a+=Math.imul(N,G),u+=Math.imul(N,$),u+=Math.imul(L,G),c+=Math.imul(L,$),a+=Math.imul(B,J),u+=Math.imul(B,X),u+=Math.imul(P,J),c+=Math.imul(P,X),a+=Math.imul(T,Q),u+=Math.imul(T,ee),u+=Math.imul(O,Q),c+=Math.imul(O,ee),a+=Math.imul(C,re),u+=Math.imul(C,ne),u+=Math.imul(A,re),c+=Math.imul(A,ne),a+=Math.imul(E,oe),u+=Math.imul(E,se),u+=Math.imul(k,oe),c+=Math.imul(k,se),a+=Math.imul(_,ue),u+=Math.imul(_,ce),u+=Math.imul(w,ue),c+=Math.imul(w,ce),a+=Math.imul(b,he),u+=Math.imul(b,le),u+=Math.imul(y,he),c+=Math.imul(y,le),a+=Math.imul(p,pe),u+=Math.imul(p,ge),u+=Math.imul(g,pe),c+=Math.imul(g,ge);var Ce=s+a+((8191&u)<<13);s=c+(u>>>13)+(Ce>>>26),Ce&=67108863,a=Math.imul(D,G),u=Math.imul(D,$),u+=Math.imul(F,G),c=Math.imul(F,$),a+=Math.imul(N,J),u+=Math.imul(N,X),u+=Math.imul(L,J),c+=Math.imul(L,X),a+=Math.imul(B,Q),u+=Math.imul(B,ee),u+=Math.imul(P,Q),c+=Math.imul(P,ee),a+=Math.imul(T,re),u+=Math.imul(T,ne),u+=Math.imul(O,re),c+=Math.imul(O,ne),a+=Math.imul(C,oe),u+=Math.imul(C,se),u+=Math.imul(A,oe),c+=Math.imul(A,se),a+=Math.imul(E,ue),u+=Math.imul(E,ce),u+=Math.imul(k,ue),c+=Math.imul(k,ce),a+=Math.imul(_,he),u+=Math.imul(_,le),u+=Math.imul(w,he),c+=Math.imul(w,le),a+=Math.imul(b,pe),u+=Math.imul(b,ge),u+=Math.imul(y,pe),c+=Math.imul(y,ge);var Ae=s+a+((8191&u)<<13);s=c+(u>>>13)+(Ae>>>26),Ae&=67108863,a=Math.imul(D,J),u=Math.imul(D,X),u+=Math.imul(F,J),c=Math.imul(F,X),a+=Math.imul(N,Q),u+=Math.imul(N,ee),u+=Math.imul(L,Q),c+=Math.imul(L,ee),a+=Math.imul(B,re),u+=Math.imul(B,ne),u+=Math.imul(P,re),c+=Math.imul(P,ne),a+=Math.imul(T,oe),u+=Math.imul(T,se),u+=Math.imul(O,oe),c+=Math.imul(O,se),a+=Math.imul(C,ue),u+=Math.imul(C,ce),u+=Math.imul(A,ue),c+=Math.imul(A,ce),a+=Math.imul(E,he),u+=Math.imul(E,le),u+=Math.imul(k,he),c+=Math.imul(k,le),a+=Math.imul(_,pe),u+=Math.imul(_,ge),u+=Math.imul(w,pe),c+=Math.imul(w,ge);var Ie=s+a+((8191&u)<<13);s=c+(u>>>13)+(Ie>>>26),Ie&=67108863,a=Math.imul(D,Q),u=Math.imul(D,ee),u+=Math.imul(F,Q),c=Math.imul(F,ee),a+=Math.imul(N,re),u+=Math.imul(N,ne),u+=Math.imul(L,re),c+=Math.imul(L,ne),a+=Math.imul(B,oe),u+=Math.imul(B,se),u+=Math.imul(P,oe),c+=Math.imul(P,se),a+=Math.imul(T,ue),u+=Math.imul(T,ce),u+=Math.imul(O,ue),c+=Math.imul(O,ce),a+=Math.imul(C,he),u+=Math.imul(C,le),u+=Math.imul(A,he),c+=Math.imul(A,le),a+=Math.imul(E,pe),u+=Math.imul(E,ge),u+=Math.imul(k,pe),c+=Math.imul(k,ge);var Te=s+a+((8191&u)<<13);s=c+(u>>>13)+(Te>>>26),Te&=67108863,a=Math.imul(D,re),u=Math.imul(D,ne),u+=Math.imul(F,re),c=Math.imul(F,ne),a+=Math.imul(N,oe),u+=Math.imul(N,se),u+=Math.imul(L,oe),c+=Math.imul(L,se),a+=Math.imul(B,ue),u+=Math.imul(B,ce),u+=Math.imul(P,ue),c+=Math.imul(P,ce),a+=Math.imul(T,he),u+=Math.imul(T,le),u+=Math.imul(O,he),c+=Math.imul(O,le),a+=Math.imul(C,pe),u+=Math.imul(C,ge),u+=Math.imul(A,pe),c+=Math.imul(A,ge);var Oe=s+a+((8191&u)<<13);s=c+(u>>>13)+(Oe>>>26),Oe&=67108863,a=Math.imul(D,oe),u=Math.imul(D,se),u+=Math.imul(F,oe),c=Math.imul(F,se),a+=Math.imul(N,ue),u+=Math.imul(N,ce),u+=Math.imul(L,ue),c+=Math.imul(L,ce),a+=Math.imul(B,he),u+=Math.imul(B,le),u+=Math.imul(P,he),c+=Math.imul(P,le),a+=Math.imul(T,pe),u+=Math.imul(T,ge),u+=Math.imul(O,pe),c+=Math.imul(O,ge);var Re=s+a+((8191&u)<<13);s=c+(u>>>13)+(Re>>>26),Re&=67108863,a=Math.imul(D,ue),u=Math.imul(D,ce),u+=Math.imul(F,ue),c=Math.imul(F,ce),a+=Math.imul(N,he),u+=Math.imul(N,le),u+=Math.imul(L,he),c+=Math.imul(L,le),a+=Math.imul(B,pe),u+=Math.imul(B,ge),u+=Math.imul(P,pe),c+=Math.imul(P,ge);var Be=s+a+((8191&u)<<13);s=c+(u>>>13)+(Be>>>26),Be&=67108863,a=Math.imul(D,he),u=Math.imul(D,le),u+=Math.imul(F,he),c=Math.imul(F,le),a+=Math.imul(N,pe),u+=Math.imul(N,ge),u+=Math.imul(L,pe),c+=Math.imul(L,ge);var Pe=s+a+((8191&u)<<13);s=c+(u>>>13)+(Pe>>>26),Pe&=67108863,a=Math.imul(D,pe),u=Math.imul(D,ge),u+=Math.imul(F,pe),c=Math.imul(F,ge);var Me=s+a+((8191&u)<<13);return s=c+(u>>>13)+(Me>>>26),Me&=67108863,o[0]=me,o[1]=be,o[2]=ye,o[3]=ve,o[4]=_e,o[5]=we,o[6]=Se,o[7]=Ee,o[8]=ke,o[9]=xe,o[10]=Ce,o[11]=Ae,o[12]=Ie,o[13]=Te,o[14]=Oe,o[15]=Re,o[16]=Be,o[17]=Pe,o[18]=Me,0!==s&&(o[19]=s,r.length++),r}},function(e,t,r){"use strict";var n=r(4).Buffer,i=r(211),o=r(440),s=r(441);function a(){this.x=i.fromBuffer(n.from("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","hex")),this.y=i.fromBuffer(n.from("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8","hex")),this.inf=!1,this._precompute()}a.prototype._precompute=function(){for(var e=new o(this.x,this.y),t=4,r=new Array(1+Math.ceil(64.25)),n=r[0]=e,i=1;i=c;h--)f=(f<<1)+i[h];u.push(f)}for(var l=new s(null,null,null),d=new s(null,null,null),p=a;p>0;p--){for(var g=0;g=0;f--){for(var h=0;f>=0&&(c[0]=0|a[0][f],c[1]=0|a[1][f],0===c[0]&&0===c[1]);++h,--f);if(f>=0&&(h+=1),u=u.dblp(h),f<0)break;for(var l=0;l<2;l++){var d=c[l],p;0!==d&&(d>0?p=o[l][d>>1]:d<0&&(p=o[l][-d>>1].neg()),u=void 0===p.z?u.mixedAdd(p):u.add(p))}}return u},e.exports=new a},function(e,t,r){"use strict";(function(t){const n=r(203),i=r(442),o={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=((e,r,s,a)=>{const u=o[e];if(!u)return a(new Error("unkown cipherType passed"));if(!r)return a(new Error("unkown hashType passed"));const c=u.keySize,f=u.ivSize,h=20,l=t.from("key expansion"),d=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(l,(e,i)=>{if(e)return a(e);let o=[],s=0;function u(e){r.digest(t.concat([i,l]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>d&&(a=d-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})}function h(e){if(e)return a(e);const r=d/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,d),u=e=>({iv:e.slice(0,f),cipherKey:e.slice(f,f+c),macKey:e.slice(f+c)});a(null,{k1:u(i),k2:u(s)})}n(()=>s{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(285),i=r(284),o=r(131).bignum,s=r(433),a=s.toBase64,u=s.toBn,c={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=function(t,r){i(n.subtle.generateKey({name:"ECDH",namedCurve:t},!0,["deriveBits"]).then(r=>{const o=(o,s,a)=>{let u;"function"==typeof s&&(a=s,s=void 0),u=s?n.subtle.importKey("jwk",d(t,s),{name:"ECDH",namedCurve:t},!1,["deriveBits"]):Promise.resolve(r.privateKey);const f=Promise.all([n.subtle.importKey("jwk",l(t,o),{name:"ECDH",namedCurve:t},!1,[]),u]);i(f.then(e=>n.subtle.deriveBits({name:"ECDH",namedCurve:t,public:e[0]},e[1],c[t])).then(t=>e.from(t)),a)};return n.subtle.exportKey("jwk",r.publicKey).then(e=>({key:h(e),genSharedKey:o}))}),r)};const f={"P-256":32,"P-384":48,"P-521":66};function h(t){const r=f[t.crv];return e.concat([e.from([4]),u(t.x).toArrayLike(e,"be",r),u(t.y).toArrayLike(e,"be",r)],1+2*r)}function l(t,r){const n=f[t];if(!r.slice(0,1).equals(e.from([4])))throw new Error("Invalid key format");const i=new o(r.slice(1,n+1)),s=new o(r.slice(1+n));return{kty:"EC",crv:t,x:a(i,n),y:a(s,n),ext:!0}}function d(e,t){const r=l(e,t.public);return r.d=a(new o(t.private)),r}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(876),i=r(292),o=r(34);function s(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n=r.length)throw _("invalid address: "+e);t.push([o,r[n]])}else t.push([o])}return t}function a(e){const t=[];return e.map(e=>{const r=w(e);t.push(r.name),e.length>1&&t.push(e[1])}),"/"+t.join("/")}function u(e){return e.map(e=>{Array.isArray(e)||(e=[e]);const t=w(e);return e.length>1?[t.code,n.toBuffer(t.code,e[1])]:[t.code]})}function c(e){return e.map(e=>{const t=w(e);return e.length>1?[t.code,n.toString(t.code,e[1])]:[t.code]})}function f(e){return m(t.concat(e.map(e=>{const r=w(e);let n=t.from(o.encode(r.code));return e.length>1&&(n=t.concat([n,e[1]])),n})))}function h(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;{const e=o.decode(t);return e+o.decode.bytes}}function l(e){const t=[];let r=0;for(;re.length)throw _("Invalid address buffer: "+e.toString("hex"));t.push([n,c])}return t}function d(e){const t=l(e),r=c(t);return a(r)}function p(e){e=v(e);const t=s(e),r=u(t);return f(r)}function g(e){return p(e)}function m(e){const r=b(e);if(r)throw r;return t.from(e)}function b(e){try{l(e)}catch(e){return e}}function y(e){return void 0===b(e)}function v(e){return"/"+e.trim().split("/").filter(e=>e).join("/")}function _(e){return new Error("Error parsing address: "+e)}function w(e){const t=i(e[0]);return t}e.exports={stringToStringTuples:s,stringTuplesToString:a,tuplesToStringTuples:c,stringTuplesToTuples:u,bufferToTuples:l,tuplesToBuffer:f,bufferToString:d,stringToBuffer:p,fromString:g,fromBuffer:m,validateBuffer:b,isValidBuffer:y,cleanPath:v,ParseError:_,protoFromTuple:w,sizeForAddr:h}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(877),i=r(878),o=r(292),s=r(79),a=r(34);function u(e,r){return r instanceof t?u.toString(e,r):u.toBuffer(e,r)}function c(e){if(!i(e))throw new Error("invalid ip address");return n.toBuffer(e)}function f(e){const t=n.toString(e);if(!i(t))throw new Error("invalid ip address");return t}function h(e){const r=t.alloc(2);return r.writeUInt16BE(e,0),r}function l(e){return e.readUInt16BE(0)}function d(e){const r=t.from(e),n=t.from(a.encode(r.length));return t.concat([n,r])}function p(e){const t=a.decode(e);if(e=e.slice(a.decode.bytes),e.length!==t)throw new Error("inconsistent lengths");return e.toString()}function g(e){const r=t.from(s.decode(e)),n=t.from(a.encode(r.length));return t.concat([n,r])}function m(e){const t=a.decode(e),r=e.slice(a.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return s.encode(r)}e.exports=u,u.toString=function e(t,r){switch(t=o(t),t.code){case 4:case 41:return f(r);case 6:case 273:case 33:case 132:return l(r);case 54:case 55:case 56:return p(r);case 421:return m(r);default:return r.toString("hex")}},u.toBuffer=function e(r,n){switch(r=o(r),r.code){case 4:case 41:return c(n);case 6:case 273:case 33:case 132:return h(parseInt(n,10));case 54:case 55:case 56:return d(n);case 421:return g(n);default:return t.from(n,"hex")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=t,i=r(0).Buffer,o=r(270);n.toBuffer=function(e,t,r){var n;if(r=~~r,this.isV4Format(e))n=t||new i(r+4),e.split(/\./g).map(function(e){n[r++]=255&parseInt(e,10)});else if(this.isV6Format(e)){var o=e.split(":",8),s;for(s=0;s0;s--)c.push("0");o.splice.apply(o,c)}for(n=t||new i(r+16),s=0;s>8&255,n[r++]=255&f}}if(!n)throw Error("Invalid ip address: "+e);return n},n.toString=function(e,t,r){t=~~t,r=r||e.length-t;var n=[];if(4===r){for(var i=0;i32?"ipv6":u(t);var r=4;"ipv6"===t&&(r=16);for(var o=new i(r),s=0,a=o.length;s>c)}return n.toString(o)},n.mask=function(e,t){e=n.toBuffer(e),t=n.toBuffer(t);var r=new i(Math.max(e.length,t.length)),o=0;if(e.length===t.length)for(o=0;oe.length&&(i=t,o=e);for(var s=i.length-o.length,r=s;r>>0},n.fromLong=function(e){return(e>>>24)+"."+(e>>16&255)+"."+(e>>8&255)+"."+(255&e)}},function(e,t,r){"use strict";const n=r(879),i=e.exports=(e=>n({exact:!0}).test(e));i.v4=(e=>n.v4({exact:!0}).test(e)),i.v6=(e=>n.v6({exact:!0}).test(e))},function(e,t,r){"use strict";const n="(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(?:\\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){3}",i="[0-9a-fA-F]{1,4}",o=`\n(\n(?:${i}:){7}(?:${i}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${i}:){6}(?:${n}|:${i}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${i}:){5}(?::${n}|(:${i}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${i}:){4}(?:(:${i}){0,1}:${n}|(:${i}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${i}:){3}(?:(:${i}){0,2}:${n}|(:${i}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${i}:){2}(?:(:${i}){0,3}:${n}|(:${i}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${i}:){1}(?:(:${i}){0,4}:${n}|(:${i}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::((?::${i}){0,5}:${n}|(?::${i}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),s=e.exports=(e=>e&&e.exact?new RegExp(`(?:^${n}$)|(?:^${o}$)`):new RegExp(`(?:${n})|(?:${o})`,"g"));s.v4=(e=>e&&e.exact?new RegExp(`^${n}$`):new RegExp(n,"g")),s.v6=(e=>e&&e.exact?new RegExp(`^${o}$`):new RegExp(o,"g"))},function(e,t,r){"use strict";const{ensureMultiaddr:n}=r(443),i=r(881);class o{constructor(e){this._multiaddrs=e||[],this._observedMultiaddrs=[]}add(e){e=n(e),this.has(e)||this._multiaddrs.push(e)}addSafe(e){e=n(e);const t=this._observedMultiaddrs.some((t,r)=>{if(t.equals(e))return this.add(e),this._observedMultiaddrs.splice(r,1),!0});t||this._observedMultiaddrs.push(e)}toArray(){return this._multiaddrs.slice()}get size(){return this._multiaddrs.length}forEach(e){return this._multiaddrs.forEach(e)}filterBy(e){return"object"!=typeof e||"function"!=typeof e.matches||"function"!=typeof e.partialMatch||"function"!=typeof e.toString?[]:this._multiaddrs.filter(t=>e.matches(t))}has(e){return e=n(e),this._multiaddrs.some(t=>t.equals(e))}delete(e){e=n(e),this._multiaddrs.some((t,r)=>{if(t.equals(e))return this._multiaddrs.splice(r,1),!0})}replace(e,t){Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]),e.forEach(e=>this.delete(e)),t.forEach(e=>this.add(e))}clear(){this._multiaddrs=[]}distinct(){return i(this._multiaddrs,e=>[e.toOptions().port,e.toOptions().transport].join())}}e.exports=o},function(e,t,r){"use strict";function n(e,t){var r=[],n={};if("function"!=typeof t){var i=t;t=function e(t){return t[i]}}return e.forEach(function e(i){var o=t(i);n[o]||(n[o]=!0,r.push(i))}),r}e.exports=n},function(e,t,r){"use strict";const n=r(883),i={16:"aes-128-ctr",32:"aes-256-ctr"};t.create=function(e,t,r){const o=i[e.length];if(!o)return r(new Error("Invalid key length"));const s=n.createCipheriv(o,e,t),a=n.createDecipheriv(o,e,t),u={encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}};r(null,u)}},function(e,t,r){"use strict";const n=r(884);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){var n=r(885),i=r(893),o=r(447);function s(){return Object.keys(o)}t.createCipher=t.Cipher=n.createCipher,t.createCipheriv=t.Cipheriv=n.createCipheriv,t.createDecipher=t.Decipher=i.createDecipher,t.createDecipheriv=t.Decipheriv=i.createDecipheriv,t.listCiphers=t.getCiphers=s},function(e,t,r){var n=r(444),i=r(448),o=r(4).Buffer,s=r(449),a=r(107),u=r(212),c=r(450),f=r(1);function h(e,t,r){a.call(this),this._cache=new d,this._cipher=new u.AES(t),this._prev=o.from(r),this._mode=e,this._autopadding=!0}f(h,a),h.prototype._update=function(e){var t,r;this._cache.add(e);for(var n=[];t=this._cache.get();)r=this._mode.encrypt(this,t),n.push(r);return o.concat(n)};var l=o.alloc(16,16);function d(){this.cache=o.allocUnsafe(0)}function p(e,t,r){var a=n[e.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=o.from(t)),t.length!==a.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof r&&(r=o.from(r)),"GCM"!==a.mode&&r.length!==a.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===a.type?new s(a.module,t,r):"auth"===a.type?new i(a.module,t,r):new h(a.module,t,r)}function g(e,t){var r=n[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=c(t,!1,r.key,r.iv);return p(e,i.key,i.iv)}h.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(l))throw this._cipher.scrub(),new Error("data not multiple of block length")},h.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},d.prototype.add=function(e){this.cache=o.concat([this.cache,e])},d.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},d.prototype.flush=function(){for(var e=16-this.cache.length,t=o.allocUnsafe(e),r=-1;++r>i%8,e._prev=o(e._prev,r?u:c);return a}function o(e,t){var r=e.length,i=-1,o=n.allocUnsafe(e.length);for(e=n.concat([e,n.from([t])]);++i>7;return o}t.encrypt=function(e,t,r){for(var o=t.length,s=n.allocUnsafe(o),a=-1;++a>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function a(e){this.h=e,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}a.prototype.ghash=function(e){for(var t=-1;++t0;r--)e[r]=e[r]>>>1|(1&e[r-1])<<31;e[0]=e[0]>>>1,i&&(e[0]=e[0]^225<<24)}this.state=s(t)},a.prototype.update=function(e){var t;for(this.cache=n.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},a.prototype.final=function(e,t){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(s([0,e,0,t])),this.state},e.exports=a},function(e,t,r){var n=r(448),i=r(4).Buffer,o=r(444),s=r(449),a=r(107),u=r(212),c=r(450),f=r(1);function h(e,t,r){a.call(this),this._cache=new l,this._last=void 0,this._cipher=new u.AES(t),this._prev=i.from(r),this._mode=e,this._autopadding=!0}function l(){this.cache=i.allocUnsafe(0)}function d(e){var t=e[15];if(t<1||t>16)throw new Error("unable to decrypt data");for(var r=-1;++r16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},l.prototype.flush=function(){if(this.cache.length)return this.cache},t.createDecipher=g,t.createDecipheriv=p},function(e,t,r){"use strict";const n=r(428),i=r(29),o={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function s(e,t,r,s,a){const u=o[a];if(!u)throw new Error(`Hash '${a}' is unknown or not supported`);const c=n(e,t,r,s,u);return i.encode64(c)}e.exports=s},function(e,t,r){(function(e,n){var i; +var r,i;r=this,i=function(){"use strict";var e=function(e,n){return t(e.slice(),n)};function t(e,t){"function"!=typeof t&&(t=function(e,t){return String(e).localeCompare(t)});var r=e.length;if(r<=1)return e;for(var i=new Array(r),o=1;oi&&(u=i),l>i&&(l=i),c=a,f=u;;)if(c"!==e[0])throw new Error("Unexpected token in map type: "+e[0]);e.shift(),t.name=e.shift();break;case"repeated":case"required":case"optional":var n=e.shift();t.required="required"===n,t.repeated="repeated"===n,t.type=e.shift(),t.name=e.shift();break;case"[":t.options=s(e);break;case";":if(null===t.name)throw new Error("Missing field name");if(null===t.type)throw new Error("Missing type in message field: "+t.name);if(-1===t.tag)throw new Error("Missing tag number in message field: "+t.name);return e.shift(),t;default:throw new Error("Unexpected token in message field: "+e[0])}throw new Error("No ; found for message field")},u=function(e){for(var t={enums:[],messages:[],fields:[],extends:[],extensions:null};e.length;)switch(e[0]){case"map":case"repeated":case"optional":case"required":t.fields.push(a(e));break;case"enum":t.enums.push(m(e));break;case"message":t.messages.push(f(e));break;case"extensions":t.extensions=c(e);break;case"oneof":e.shift();var n=e.shift();if("{"!==e[0])throw new Error("Unexpected token in oneof: "+e[0]);for(e.shift();"}"!==e[0];){e.unshift("optional");var r=a(e);r.oneof=n,t.fields.push(r)}e.shift();break;case"extend":t.extends.push(l(e));break;case";":e.shift();break;case"reserved":case"option":for(e.shift();";"!==e[0];)e.shift();break;default:e.unshift("optional"),t.fields.push(a(e))}return t},l=function(e){var t={name:e[1],message:f(e)};return t},c=function(e){e.shift();var t=Number(e.shift());if(isNaN(t))throw new Error("Invalid from in extensions definition");if("to"!==e.shift())throw new Error("Expected keyword 'to' in extensions definition");var n=e.shift();if("max"===n&&(n=536870911),n=Number(n),isNaN(n))throw new Error("Invalid to in extensions definition");if(";"!==e.shift())throw new Error("Missing ; in extensions definition");return{from:t,to:n}},f=function(e){e.shift();var t=1,n=[],r={name:e.shift(),enums:[],extends:[],messages:[],fields:[]};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("{"===e[0]?t++:"}"===e[0]&&t--,!t)return e.shift(),n=u(n),r.enums=n.enums,r.messages=n.messages,r.fields=n.fields,r.extends=n.extends,r.extensions=n.extensions,r;n.push(e.shift())}if(t)throw new Error("No closing tag for message")},h=function(e){e.shift();var t=e.shift();if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},p=function(e){if(e.shift(),"="!==e[0])throw new Error("Expected = but found "+e[0]);e.shift();var t=e.shift();switch(t){case'"proto2"':t=2;break;case'"proto3"':t=3;break;default:throw new Error("Expected protobuf syntax version but found "+t)}if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},d=function(e){if(e.length<4)throw new Error("Invalid enum value: "+e.slice(0,3).join(" "));if("="!==e[1])throw new Error("Expected = but found "+e[1]);if(";"!==e[3]&&"["!==e[3])throw new Error("Expected ; or [ but found "+e[1]);var t=e.shift();e.shift();var n={value:null,options:{}};return n.value=Number(e.shift()),"["===e[0]&&(n.options=s(e)),e.shift(),{name:t,val:n}},m=function(e){e.shift();var t={},n={name:e.shift(),values:{},options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),n;if("option"!==e[0]){var r=d(e);n.values[r.name]=r.val}else t=g(e),n.options[t.name]=t.value}throw new Error("No closing tag for enum")},g=function(e){for(var t=null,n=null,r=function(e){return"true"===e||"false"!==e&&e.replace(/^"+|"+$/gm,"")};e.length;){if(";"===e[0])return e.shift(),{name:t,value:n};switch(e[0]){case"option":e.shift();var i="("===e[0];if(i&&e.shift(),t=e.shift(),i){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}"."===e[0][0]&&(t+=e.shift());break;case"=":if(e.shift(),null===t)throw new Error("Expected key for option with value: "+e[0]);if(n=r(e.shift()),"optimize_for"===t&&!/^(SPEED|CODE_SIZE|LITE_RUNTIME)$/.test(n))throw new Error("Unexpected value for option optimize_for: "+n);"{"===n&&(n=y(e));break;default:throw new Error("Unexpected token in option: "+e[0])}}},y=function(e){for(var t=function(e){return"true"===e||"false"!==e&&e.replace(/^"+|"+$/gm,"")},n={};e.length;){if("}"===e[0])return e.shift(),n;var r="("===e[0];r&&e.shift();var i=e.shift();if(r){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}var o=null;switch(e[0]){case":":if(void 0!==n[i])throw new Error("Duplicate option map key "+i);e.shift(),o=t(e.shift()),"{"===o&&(o=y(e)),n[i]=o,";"===e[0]&&e.shift();break;case"{":if(e.shift(),o=y(e),void 0===n[i]&&(n[i]=[]),!Array.isArray(n[i]))throw new Error("Duplicate option map key "+i);n[i].push(o);break;default:throw new Error("Unexpected token in option map: "+e[0])}}throw new Error("No closing tag for option map")},b=function(e){e.shift();var t=e.shift().replace(/^"+|"+$/gm,"");if(";"!==e[0])throw new Error("Unexpected token: "+e[0]+'. Expected ";"');return e.shift(),t},v=function(e){e.shift();var t={name:e.shift(),methods:[],options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;switch(e[0]){case"option":var n=g(e);if(void 0!==t.options[n.name])throw new Error("Duplicate option "+n.name);t.options[n.name]=n.value;break;case"rpc":t.methods.push(_(e));break;default:throw new Error("Unexpected token in service: "+e[0])}}throw new Error("No closing tag for service")},_=function(e){e.shift();var t={name:e.shift(),input_type:null,output_type:null,client_streaming:!1,server_streaming:!1,options:{}};if("("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.client_streaming=!0),t.input_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),"returns"!==e[0])throw new Error("Expected returns but found "+e[0]);if(e.shift(),"("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.server_streaming=!0),t.output_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),";"===e[0])return e.shift(),t;if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;if("option"!==e[0])throw new Error("Unexpected token in rpc options: "+e[0]);var n=g(e);if(void 0!==t.options[n.name])throw new Error("Duplicate option "+n.name);t.options[n.name]=n.value}throw new Error("No closing tag for rpc")},w=function(e){for(var t=r(e.toString()),n=0;nt.extensions.to)throw new Error(t.name+" does not declare "+e.tag+" as an extension number");t.fields.push(e)})})}),s.messages.forEach(function(e){e.fields.forEach(function(t){var n,r,i,a;function u(e){return e.name===t.type}function l(e){return e.name===i}if(t.options&&"true"===t.options.packed&&-1===o.indexOf(t.type)){if(-1===t.type.indexOf(".")){if(e.enums&&e.enums.some(u))return}else{if(n=t.type.split("."),n.length>2)throw new Error("what is this?");if(r=n[0],i=n[1],s.messages.some(function(e){if(e.name===r)return a=e,e}),a&&a.enums&&a.enums.some(l))return}throw new Error("Fields of type "+t.type+' cannot be declared [packed=true]. Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire types) can be declared "packed". See https://developers.google.com/protocol-buffers/docs/encoding#optional')}})}),s};e.exports=w},function(e,t){e.exports=function(e){var t=function(e){var t=e.indexOf("//");return t>-1?e.slice(0,t):e},n=function(){var e=!1;return function(t){return"/*"===t?(e=!0,!1):"*/"===t?(e=!1,!1):!e}},r=function(e){return e.trim()};return e.replace(/([;,{}()=:[\]<>]|\/\*|\*\/)/g," $1 ").split(/\n/).map(r).filter(Boolean).map(t).map(r).filter(Boolean).join("\n").split(/\s+|\n+/gm).filter(n())}},function(e,t){var n=function(e,t){var n=e.repeated?"repeated":e.required?"required":"optional";"map"===e.type&&(n="map<"+e.map.from+","+e.map.to+">"),e.oneof&&(n="");var r=Object.keys(e.options||{}).map(function(t){return t+" = "+e.options[t]}).join(",");return r&&(r=" ["+r+"]"),t.push((n?n+" ":"")+("map"===e.map?"":e.type+" ")+e.name+" = "+e.tag+r+";"),t},r=function(e,t){t.push("message "+e.name+" {"),e.enums||(e.enums=[]),e.enums.forEach(function(e){t.push(i(e,[]))}),e.messages||(e.messages=[]),e.messages.forEach(function(e){t.push(r(e,[]))});var o={};return e.fields||(e.fields=[]),e.fields.forEach(function(e){e.oneof?(o[e.oneof]||(o[e.oneof]=[]),o[e.oneof].push(n(e,[]))):t.push(n(e,[]))}),Object.keys(o).forEach(function(e){o[e].unshift("oneof "+e+" {"),o[e].push("}"),t.push(o[e])}),t.push("}",""),t},i=function(e,t){t.push("enum "+e.name+" {"),e.options||(e.options={});var n=s(e.options,[]);return n.length>1&&t.push(n.slice(0,-1)),Object.keys(e.values).map(function(n){var r=o(e.values[n]);t.push([n+" = "+r+";"])}),t.push("}",""),t},o=function(e,t){var n=Object.keys(e.options||{}).map(function(t){return t+" = "+e.options[t]}).join(",");n&&(n=" ["+n+"]");var r=e.value+n;return r},s=function(e,t){var n=Object.keys(e);return n.forEach(function(n){var r=e[n];~n.indexOf(".")&&(n="("+n+")");var i=typeof r;"object"===i?(r=a(r,[]),r.length&&t.push("option "+n+" = {",r,"};")):("string"===i&&"optimize_for"!==n&&(r='"'+r+'"'),t.push("option "+n+" = "+r+";"))}),n.length>0&&t.push(""),t},a=function(e,t){var n=Object.keys(e);return n.forEach(function(n){var r=e[n],i=typeof r;"object"===i?Array.isArray(r)?r.forEach(function(e){e=a(e,[]),e.length&&t.push(n+" {",e,"}")}):(r=a(r,[]),r.length&&t.push(n+" {",r,"}")):("string"===i&&(r='"'+r+'"'),t.push(n+": "+r))}),t},u=function(e,t){return t.push("service "+e.name+" {"),e.options||(e.options={}),s(e.options,t),e.methods||(e.methods=[]),e.methods.forEach(function(e){t.push(l(e,[]))}),t.push("}",""),t},l=function(e,t){var n="rpc "+e.name+"(";e.client_streaming&&(n+="stream "),n+=e.input_type+") returns (",e.server_streaming&&(n+="stream "),n+=e.output_type+")",e.options||(e.options={});var r=s(e.options,[]);return r.length>1?t.push(n+" {",r.slice(0,-1),"}"):t.push(n+";"),t},c=function(e){return function(t){return Array.isArray(t)?t.map(c(e+" ")).join("\n"):e+t}};e.exports=function(e){var t=[];return t.push('syntax = "proto'+e.syntax+'";',""),e.package&&t.push("package "+e.package+";",""),e.options||(e.options={}),s(e.options,t),e.enums||(e.enums=[]),e.enums.forEach(function(e){i(e,t)}),e.messages||(e.messages=[]),e.messages.forEach(function(e){r(e,t)}),e.services&&e.services.forEach(function(e){u(e,t)}),t.map(c("")).join("\n")}},function(e,t,n){"use strict";var r=n(881),i=n(883),o=n(884),s=n(885),a=n(38),u=function(e){if(!e)return null;var t={};return Object.keys(e).forEach(function(n){t[n]=e[n].value}),t};e.exports=function(e,t){var n={},l={},c={},f=function(e,t){e.enums&&e.enums.forEach(function(e){e.id=t+(t?".":"")+e.name,l[e.id]=e,f(e,e.id)}),e.messages&&e.messages.forEach(function(r){r.id=t+(t?".":"")+r.name,n[r.id]=r,r.fields.forEach(function(r){if(r.map){var i="Map_"+r.map.from+"_"+r.map.to,o={name:i,enums:[],messages:[],fields:[{name:"key",type:r.map.from,tag:1,repeated:!1,required:!0},{name:"value",type:r.map.to,tag:2,repeated:!1,required:!1}],extensions:null,id:t+(t?".":"")+i};n[o.id]||(n[o.id]=o,e.messages.push(o)),r.type=i,r.repeated=!0}}),f(r,r.id)})};f(e,"");var h=function(e){var t=Object.keys(e.values||[]).map(function(t){return parseInt(e.values[t].value,10)}),n=function e(n,r,i){if(!t.length||-1===t.indexOf(n))throw new Error("Invalid enum value: "+n);return a.encode(n,r,i),e.bytes=a.encode.bytes,r},i=function e(n,r){var i=a.decode(n,r);if(!t.length||-1===t.indexOf(i))throw new Error("Invalid enum value: "+i);return e.bytes=a.decode.bytes,i};return r.make(0,n,i,a.encodingLength)},p=function(e,t){e.messages.forEach(function(n){t[n.name]=d(n.name,e.id)}),e.enums.forEach(function(e){t[e.name]=u(e.values)}),t.type=2,t.message=!0,t.name=e.name;var n={};e.fields.forEach(function(e){e.oneof&&(n[e.oneof]||(n[e.oneof]=[]),n[e.oneof].push(e.name))});var r=e.fields.map(function(t){return d(t.type,e.id)}),a=s(e,r,n),l=o(e,d,r,n,a),c=i(e,d,r);return l.bytes=c.bytes=0,t.buffer=!0,t.encode=l,t.decode=c,t.encodingLength=a,t},d=function(e,i,o){if(t&&t[e])return t[e];if(r[e])return r[e];var s=(i?i+"."+e:e).split(".").map(function(t,n,r){return r.slice(0,n).concat(e).join(".")}).reverse().reduce(function(e,t){return e||n[t]||l[t]},null);if(!1===o)return s;if(!s)throw new Error("Could not resolve "+e);if(s.values)return h(s);var a=c[s.id]||p(s,c[s.id]={});return a};return(e.enums||[]).concat((e.messages||[]).map(function(e){return d(e.id)}))}},function(e,t,n){"use strict";var r=n(38),i=n(882),o=n(4).Buffer,s=function(e,t,n,r){return t.bytes=n.bytes=0,{type:e,encode:t,decode:n,encodingLength:r}},a,u,l,c,f;t.make=s,t.bytes=(u=function(e){return o.isBuffer(e)?e.length:o.byteLength(e)},l=function(e){var t=u(e);return r.encodingLength(t)+t},c=function(e,t,n){var i=n,s=u(e);return r.encode(s,t,n),n+=r.encode.bytes,o.isBuffer(e)?e.copy(t,n):t.write(e,n,s),n+=s,c.bytes=n-i,t},f=function(e,t){var n=t,i=r.decode(e,t);t+=r.decode.bytes;var o=e.slice(t,t+i);return t+=o.length,f.bytes=t-n,o},s(2,c,f,l)),t.string=function(){var e=function(e){var t=o.byteLength(e);return r.encodingLength(t)+t},t=function(e,n,i){var s=i,a=o.byteLength(e);return r.encode(a,n,i,"utf-8"),i+=r.encode.bytes,n.write(e,i,a),i+=a,t.bytes=i-s,n},n=function(e,t){var i=t,o=r.decode(e,t);t+=r.decode.bytes;var s=e.toString("utf-8",t,t+o);return t+=o,n.bytes=t-i,s};return s(2,t,n,e)}(),t.bool=function(){var e=function(e){return 1},t=function(e,n,r){return n[r]=e?1:0,t.bytes=1,n},n=function(e,t){var r=e[t]>0;return n.bytes=1,r};return s(0,t,n,e)}(),t.int32=function(){var e=function(t,n){var i=r.decode(t,n);return e.bytes=r.decode.bytes,i>2147483647?i-4294967296:i},t=function(e,n,i){return r.encode(e<0?e+4294967296:e,n,i),t.bytes=r.encode.bytes,n},n=function(e){return r.encodingLength(e<0?e+4294967296:e)};return s(0,r.encode,e,n)}(),t.int64=function(){var e=function(t,n){var i=r.decode(t,n);if(i>=Math.pow(2,63)){for(var s=9;255===t[n+s-1];)s--;s=s||9;var a=o.allocUnsafe(s);t.copy(a,0,n,n+s),a[s-1]=127&a[s-1],i=-1*r.decode(a,0),e.bytes=10}else e.bytes=r.decode.bytes;return i},t=function(e,n,i){if(e<0){var o=i+9;for(r.encode(-1*e,n,i),i+=r.encode.bytes-1,n[i]=128|n[i];i=0?2*t:-2*t-1;var o=r.encode(t,n,i);return e.bytes=r.encode.bytes,o},t.decode=function e(t,n){var i=r.decode(t,n);return e.bytes=r.decode.bytes,1&i?(i+1)/-2:i/2},t.encodingLength=function(e){return r.encodingLength(e>=0?2*e:-2*e-1)}},function(e,t,n){"use strict";var r=n(38),i=n(304).defined;function o(e,t,n){for(var o=[],u={},l=[],c=[],f=0;f-1&&delete n[u[c]];if(e.message){var f=r.decode(i,o);o+=r.decode.bytes;var h=e.decode(i,o,o+f);t.map?(n[a]=n[a]||{},n[a][h.key]=h.value):t.repeated?(n[a]=n[a]||[],n[a].push(h)):n[a]=h}else t.repeated?(n[a]=n[a]||[],n[a].push(e.decode(i,o))):n[a]=e.decode(i,o);return o+=e.decode.bytes,o}return function t(f,h,p){if(null==h&&(h=0),null==p&&(p=f.length),!(p<=f.length&&h<=f.length))throw new Error("Decoded message is not valid");for(var d=h,g={},y;;){if(p<=h){var b="",v=0,_,w;for(v=0;v-1){k=!0;break}k||(_?y.repeated?g[b]=[]:(w=w&&_[w]?_[w].value:_[Object.keys(_)[0]].value,g[b]=parseInt(w||0,10)):g[b]=a(y,w))}return t.bytes=h-d,g}var x=r.decode(f,h);h+=r.decode.bytes;var C=x>>3,A=u[C];if(null!=A){var I=n[A];if(y=e.fields[A],y.packed){var T=r.decode(f,h);for(h+=r.decode.bytes,T+=h;h-1){if(b)throw new Error("only one of the properties defined in oneof "+v+" can be set");b=!0}}for(y=0;y{if(e)return n(e);r.push(t),l(s,r,n)})}e.exports=f},function(e,t,n){"use strict";(function(t){const r=n(235),i=r.cloneLinks,o=r.cloneData,s=n(233),a=n(9);function u(e,n,r){const u=o(e);let l=i(e);if("string"==typeof n)l=l.filter(e=>e.name!==n);else{if(!t.isBuffer(n)&&!a.isCID(n))return r(new Error("second arg needs to be a name or CID"),null);l=l.filter(e=>!e.cid.equals(n))}s(u,l,r)}e.exports=u}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(9),i=n(55);e.exports={resolver:{multicodec:"raw",defaultHashAlg:"sha2-256",resolve:(e,t,n)=>{n(null,{value:e,remainderPath:""})},tree:(e,t,n)=>{"function"==typeof t&&(n=t),n(null,[])}},util:{deserialize:(e,t)=>{t(null,e)},serialize:(e,t)=>{t(null,e)},cid:(e,t,n)=>{"function"==typeof t&&(n=t,t={}),t=t||{};const o=t.hashAlg||"sha2-256",s=void 0===t.version?1:t.version;i(e,o,(e,t)=>{if(e)return n(e);n(null,new r(s,"raw",t))})}}}},function(e,t,n){(function(t){var n={};e.exports=n;var r={};function i(e,t){var n=0,r=t.length,i=t.charAt(0),o=[0];for(n=0;n0;)o.push(a%r),a=a/r|0}var u="";for(n=0;0===e.at(n)&&n=0;--n)u+=t[o[n]];return u}n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var r="";if(e instanceof Uint8Array){var o=0,s=t.length,a=t.charAt(0),u=[0];for(o=0;o0;)u.push(c%s),c=c/s|0}for(o=0;0===e[o]&&o=0;--o)r+=t[u[o]]}else r=i(e,t);if(n){var f=new RegExp(".{1,"+n+"}","g");r=r.match(f).join("\r\n")}return r},n.decode=function(e,n){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof n)throw new TypeError('"alphabet" must be a string.');var i=r[n];if(!i){i=r[n]=[];for(var o=0;o>=8;for(;f>0;)u.push(255&f),f>>=8}for(var h=0;e[h]===a&&h>24&255,s>>16&255,s>>8&255,255&s);n.start(),n.update(e+a),i+=n.digest().getBytes()}return i.substring(0,t)}i.encode_rsa_oaep=function(e,t,n){var i,s,a,u;"string"==typeof n?(i=n,s=arguments[3]||void 0,a=arguments[4]||void 0):n&&(i=n.label||void 0,s=n.seed||void 0,a=n.md||void 0,n.mgf1&&n.mgf1.md&&(u=n.mgf1.md)),a?a.start():a=r.md.sha1.create(),u||(u=a);var l=Math.ceil(e.n.bitLength()/8),c=l-2*a.digestLength-2;if(t.length>c){var f=new Error("RSAES-OAEP input message length is too long.");throw f.length=t.length,f.maxLength=c,f}i||(i=""),a.update(i,"raw");for(var h=a.digest(),p="",d=c-t.length,m=0;m>>0,a>>>0];for(var u=i.fullMessageLength.length-1;u>=0;--u)i.fullMessageLength[u]+=a[1],a[1]=a[0]+(i.fullMessageLength[u]/4294967296>>>0),i.fullMessageLength[u]=i.fullMessageLength[u]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(o),l(e,n,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=r.util.createBuffer();s.putBytes(t.bytes());var a=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize,u=a&i.blockLength-1,c,f;s.putBytes(o.substr(0,i.blockLength-u));for(var h=8*i.fullMessageLength[0],p=0;p>>0,h+=f,s.putInt32(h>>>0),h=c>>>0;s.putInt32(h);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};l(d,n,s);var m=r.util.createBuffer();return m.putInt32(d.h0),m.putInt32(d.h1),m.putInt32(d.h2),m.putInt32(d.h3),m.putInt32(d.h4),m.putInt32(d.h5),m.putInt32(d.h6),m.putInt32(d.h7),m},i};var o=null,s=!1,a=null;function u(){o=String.fromCharCode(128),o+=r.util.fillString(String.fromCharCode(0),64),a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=!0}function l(e,t,n){for(var r,i,o,s,u,l,c,f,h,p,d,m,g,y,b,v=n.length();v>=64;){for(c=0;c<16;++c)t[c]=n.getInt32();for(;c<64;++c)r=t[c-2],r=(r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10,i=t[c-15],i=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[c]=r+t[c-7]+i+t[c-16]|0;for(f=e.h0,h=e.h1,p=e.h2,d=e.h3,m=e.h4,g=e.h5,y=e.h6,b=e.h7,c=0;c<64;++c)s=(m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7),u=y^m&(g^y),o=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),l=f&h|p&(f^h),r=b+s+u+a[c]+t[c],i=o+l,b=y,y=g,g=m,m=d+r>>>0,d=p,p=h,h=f,f=r+i>>>0;e.h0=e.h0+f|0,e.h1=e.h1+h|0,e.h2=e.h2+p|0,e.h3=e.h3+d|0,e.h4=e.h4+m|0,e.h5=e.h5+g|0,e.h6=e.h6+y|0,e.h7=e.h7+b|0,v-=64}}},function(e,t,n){(function(t){var r=n(19);n(34);var i=null;!r.util.isNodejs||r.options.usePureJavaScript||t.versions["node-webkit"]||(i=n(460));var o=e.exports=r.prng=r.prng||{};o.create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},n=e.md,o=new Array(32),s=0;s<32;++s)o[s]=n.create();function a(e){if(t.pools[0].messageLength>=32)return l(),e();var n=32-t.pools[0].messageLength<<5;t.seedFile(n,function(n,r){if(n)return e(n);t.collect(r),l(),e()})}function u(){if(t.pools[0].messageLength>=32)return l();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),l()}function l(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var n=1,r=0;r<32;++r)t.reseeds%n==0&&(e.update(t.pools[r].digest().getBytes()),t.pools[r].start()),n<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0}function c(e){var t=null;if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;n&&n.getRandomValues&&(t=function(e){return n.getRandomValues(e)})}var i=r.util.createBuffer();if(t)for(;i.length()>16),l+=(32767&u)<<16,l+=u>>15,l=(2147483647&l)+(l>>31),f=4294967295&l;for(var a=0;a<3;++a)c=f>>>(a<<3),c^=Math.floor(256*Math.random()),i.putByte(String.fromCharCode(255&c))}return i.getBytes(e)}return t.pools=o,t.pool=0,t.generate=function(e,n){if(!n)return t.generateSync(e);var i=t.plugin.cipher,o=t.plugin.increment,s=t.plugin.formatKey,u=t.plugin.formatSeed,l=r.util.createBuffer();function c(f){if(f)return n(f);if(l.length()>=e)return n(null,l.getBytes(e));if(t.generated>1048575&&(t.key=null),null===t.key)return r.util.nextTick(function(){a(c)});var h=i(t.key,t.seed);t.generated+=h.length,l.putBytes(h),t.key=s(i(t.key,o(t.seed))),t.seed=u(i(t.key,t.seed)),r.util.setImmediate(c)}t.key=null,c()},t.generateSync=function(e){var n=t.plugin.cipher,i=t.plugin.increment,o=t.plugin.formatKey,s=t.plugin.formatSeed;t.key=null;for(var a=r.util.createBuffer();a.length()1048575&&(t.key=null),null===t.key&&u();var l=n(t.key,t.seed);t.generated+=l.length,a.putBytes(l),t.key=o(n(t.key,i(t.seed))),t.seed=s(n(t.key,t.seed))}return a.getBytes(e)},i?(t.seedFile=function(e,t){i.randomBytes(e,function(e,n){if(e)return t(e);t(null,n.toString())})},t.seedFileSync=function(e){return i.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,c(e))}catch(e){t(e)}},t.seedFileSync=c),t.collect=function(e){for(var n=e.length,r=0;r>i&255);t.collect(r)},t.registerWorker=function(e){if(e===self)t.seedFile=function(e,t){function n(e){var r=e.data;r.forge&&r.forge.prng&&(self.removeEventListener("message",n),t(r.forge.prng.err,r.forge.prng.bytes))}self.addEventListener("message",n),self.postMessage({forge:{prng:{needed:e}}})};else{var n=function(n){var r=n.data;r.forge&&r.forge.prng&&t.seedFile(r.forge.prng.needed,function(t,n){e.postMessage({forge:{prng:{err:t,bytes:n}}})})};e.addEventListener("message",n)}},t}}).call(this,n(2))},function(e,t,n){var r=n(19);n(118),n(34);var i=e.exports=r.sha1=r.sha1||{};r.md.sha1=r.md.algorithms.sha1=i,i.create=function(){s||a();var e=null,t=r.util.createBuffer(),n=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var n=i.messageLengthSize/4,o=0;o>>0,a>>>0];for(var l=i.fullMessageLength.length-1;l>=0;--l)i.fullMessageLength[l]+=a[1],a[1]=a[0]+(i.fullMessageLength[l]/4294967296>>>0),i.fullMessageLength[l]=i.fullMessageLength[l]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(o),u(e,n,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=r.util.createBuffer();s.putBytes(t.bytes());var a=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize,l=a&i.blockLength-1,c,f;s.putBytes(o.substr(0,i.blockLength-l));for(var h=8*i.fullMessageLength[0],p=0;p>>0,h+=f,s.putInt32(h>>>0),h=c>>>0;s.putInt32(h);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};u(d,n,s);var m=r.util.createBuffer();return m.putInt32(d.h0),m.putInt32(d.h1),m.putInt32(d.h2),m.putInt32(d.h3),m.putInt32(d.h4),m},i};var o=null,s=!1;function a(){o=String.fromCharCode(128),o+=r.util.fillString(String.fromCharCode(0),64),s=!0}function u(e,t,n){for(var r,i,o,s,a,u,l,c,f=n.length();f>=64;){for(i=e.h0,o=e.h1,s=e.h2,a=e.h3,u=e.h4,c=0;c<16;++c)r=n.getInt32(),t[c]=r,l=a^o&(s^a),r=(i<<5|i>>>27)+l+u+1518500249+r,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;c<20;++c)r=t[c-3]^t[c-8]^t[c-14]^t[c-16],r=r<<1|r>>>31,t[c]=r,l=a^o&(s^a),r=(i<<5|i>>>27)+l+u+1518500249+r,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;c<32;++c)r=t[c-3]^t[c-8]^t[c-14]^t[c-16],r=r<<1|r>>>31,t[c]=r,l=o^s^a,r=(i<<5|i>>>27)+l+u+1859775393+r,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;c<40;++c)r=t[c-6]^t[c-16]^t[c-28]^t[c-32],r=r<<2|r>>>30,t[c]=r,l=o^s^a,r=(i<<5|i>>>27)+l+u+1859775393+r,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;c<60;++c)r=t[c-6]^t[c-16]^t[c-28]^t[c-32],r=r<<2|r>>>30,t[c]=r,l=o&s|a&(o^s),r=(i<<5|i>>>27)+l+u+2400959708+r,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;c<80;++c)r=t[c-6]^t[c-16]^t[c-28]^t[c-32],r=r<<2|r>>>30,t[c]=r,l=o^s^a,r=(i<<5|i>>>27)+l+u+3395469782+r,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;e.h0=e.h0+i|0,e.h1=e.h1+o|0,e.h2=e.h2+s|0,e.h3=e.h3+a|0,e.h4=e.h4+u|0,f-=64}}},function(e,t,n){var r=n(19);n(34),n(457),n(141),function(){if(r.prime)e.exports=r.prime;else{var t=e.exports=r.prime=r.prime||{},n=r.jsbn.BigInteger,i=[6,4,2,4,2,4,6,2],o=new n(null);o.fromInt(30);var s=function(e,t){return e|t};t.generateProbablePrime=function(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};var i=t.algorithm||"PRIMEINC";"string"==typeof i&&(i={name:i}),i.options=i.options||{};var o=t.prng||r.random,s={nextBytes:function(e){for(var t=o.getBytesSync(e.length),n=0;nt&&(e=f(t,n)),e.isProbablePrime(s))return u(null,e);e.dAddOffset(i[o++%8],0)}while(a<0||+new Date-ce&&(s=f(e,t));var d=s.toString(16);i.target.postMessage({hex:d,workLoad:l}),s.dAddOffset(c,0)}}}p()}function f(e,t){var r=new n(e,t),i=e-1;return r.testBit(i)||r.bitwiseTo(n.ONE.shiftLeft(i),s,r),r.dAddOffset(31-r.mod(o).byteValue(),0),r}function h(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}}()},function(e,t,n){var r=n(19);n(118),n(34);var i=e.exports=r.hmac=r.hmac||{};i.create=function(){var e=null,t=null,n=null,i=null,o={start:function(o,s){if(null!==o)if("string"==typeof o){if(o=o.toLowerCase(),!(o in r.md.algorithms))throw new Error('Unknown hash algorithm "'+o+'"');t=r.md.algorithms[o].create()}else t=o;if(null===s)s=e;else{if("string"==typeof s)s=r.util.createBuffer(s);else if(r.util.isArray(s)){var a=s;s=r.util.createBuffer();for(var u=0;ut.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),n=r.util.createBuffer(),i=r.util.createBuffer(),l=s.length();for(var u=0;u>16-t},a=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=r.rc2=r.rc2||{},r.rc2.expandKey=function(e,t){"string"==typeof e&&(e=r.util.createBuffer(e)),t=t||128;var n=e,o=e.length(),s=t,a=Math.ceil(s/8),u=255>>(7&s),l;for(l=o;l<128;l++)n.putByte(i[n.at(l-1)+n.at(l-o)&255]);for(n.setAt(128-a,i[n.at(128-a)&u]),l=127-a;l>=0;l--)n.setAt(l,i[n.at(l+1)^n.at(l+a)]);return n};var u=function(e,t,n){var i=!1,u=null,l=null,c=null,f,h,p,d,m=[];for(e=r.rc2.expandKey(e,t),p=0;p<64;p++)m.push(e.getInt16Le());n?(f=function(e){for(p=0;p<4;p++)e[p]+=m[d]+(e[(p+3)%4]&e[(p+2)%4])+(~e[(p+3)%4]&e[(p+1)%4]),e[p]=s(e[p],o[p]),d++},h=function(e){for(p=0;p<4;p++)e[p]+=m[63&e[(p+3)%4]]}):(f=function(e){for(p=3;p>=0;p--)e[p]=a(e[p],o[p]),e[p]-=m[d]+(e[(p+3)%4]&e[(p+2)%4])+(~e[(p+3)%4]&e[(p+1)%4]),d--},h=function(e){for(p=3;p>=0;p--)e[p]-=m[63&e[(p+3)%4]]});var g=function(e){var t=[];for(p=0;p<4;p++){var r=u.getInt16Le();null!==c&&(n?r^=c.getInt16Le():c.putInt16Le(r)),t.push(65535&r)}d=n?0:63;for(var i=0;i=8;)g([[5,f],[1,h],[6,f],[1,h],[5,f]])},finish:function(e){var t=!0;if(n)if(e)t=e(8,u,!n);else{var r=8===u.length()?8:8-u.length();u.fillWithByte(r,r)}if(t&&(i=!0,y.update()),!n&&(t=0===u.length(),t))if(e)t=e(8,l,!n);else{var o=l.length(),s=l.at(o-1);s>o?t=!1:l.truncate(s)}return t}},y};r.rc2.startEncrypting=function(e,t,n){var i=r.rc2.createEncryptionCipher(e,128);return i.start(t,n),i},r.rc2.createEncryptionCipher=function(e,t){return u(e,t,!0)},r.rc2.startDecrypting=function(e,t,n){var i=r.rc2.createDecryptionCipher(e,128);return i.start(t,n),i},r.rc2.createDecryptionCipher=function(e,t){return u(e,t,!1)}},function(e,t,n){"use strict";const r=n(55),i=n(70),o=n(81),s=n(89),a=n(902),u=i(n(305));n(915),n(307);const l=n(19);class c{constructor(e){this._key=e}verify(e,t,n){g(n),a.hashAndVerify(this._key,t,e,n)}marshal(){return a.utils.jwkToPkix(this._key)}get bytes(){return u.PublicKey.encode({Type:u.KeyType.RSA,Data:this.marshal()})}encrypt(e){return this._key.encrypt(e,"RSAES-PKCS1-V1_5")}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),r(this.bytes,"sha2-256",e)}}class f{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return a.getRandomValues(16)}sign(e,t){g(t),a.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new c(this._publicKey)}decrypt(e,t){a.decrypt(this._key,e,t)}marshal(){return a.utils.jwkToPkcs1(this._key)}get bytes(){return u.PrivateKey.encode({Type:u.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),r(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,n)=>{if(t)return e(t);e(null,o.encode(n))})}export(e,t,n){"function"==typeof t&&(n=t,t=e,e="pkcs-8"),g(n),s(()=>{let r=null,i=null;try{const n=new l.util.ByteBuffer(this.marshal()),o=l.asn1.fromDer(n),s=l.pki.privateKeyFromAsn1(o);if("pkcs-8"===e){const e={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};i=l.pki.encryptRsaPrivateKey(s,t,e)}else r=new Error(`Unknown export format '${e}'`)}catch(e){r=e}n(r,i)})}}function h(e,t){const n=a.utils.pkcs1ToJwk(e);a.unmarshalPrivateKey(n,(e,n)=>{if(e)return t(e);t(null,new f(n.privateKey,n.publicKey))})}function p(e){const t=a.utils.pkixToJwk(e);return new c(t)}function d(e,t){a.unmarshalPrivateKey(e,(e,n)=>{if(e)return t(e);t(null,new f(n.privateKey,n.publicKey))})}function m(e,t){a.generateKey(e,(e,n)=>{if(e)return t(e);t(null,new f(n.privateKey,n.publicKey))})}function g(e){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:c,RsaPrivateKey:f,unmarshalRsaPublicKey:p,unmarshalRsaPrivateKey:h,generateKeyPair:m,fromJwk:d}},function(e,t,n){"use strict";(function(e){const r=n(310),i=n(311),o=n(312);function s(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function a(e){return i.subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}t.utils=n(904),t.generateKey=function(e,t){r(i.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(s).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.unmarshalPrivateKey=function(e,t){const n=i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]);r(Promise.all([n,a(e)]).then(e=>s({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=o,t.hashAndSign=function(t,n,o){r(i.subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]).then(e=>i.subtle.sign({name:"RSASSA-PKCS1-v1_5"},e,Uint8Array.from(n))).then(t=>e.from(t)),o)},t.hashAndVerify=function(e,t,n,o){r(i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]).then(e=>i.subtle.verify({name:"RSASSA-PKCS1-v1_5"},e,t,n)),o)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t,n){const r=t.crypto||t.msCrypto,i=65536;function o(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}function s(e){const t=new Uint8Array(e);let o=0;if(e>0)if(e>i)for(;ot?r.getRandomValues(t.subarray(o,t-o)):(r.getRandomValues(t.subarray(o,o+i)),o+=i);else r.getRandomValues(t);return n.from(t)}r&&r.getRandomValues?e.exports=s:e.exports=o}).call(this,n(8),n(0).Buffer)},function(e,t,n){"use strict";const r=n(142),i=n(466),o=i.toBase64,s=i.toBn,a=r.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}),u=r.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid({"1.2.840.113549.1.1.1":"rsa"}),this.key("none").optional().null_(),this.key("curve").optional().objid(),this.key("params").optional().seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()))}),l=r.define("RSAPublicKey",function(){this.seq().obj(this.key("algorithm").use(u),this.key("subjectPublicKey").bitstr())}),c=r.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});t.pkcs1ToJwk=function(e){const t=a.decode(e,"der");return{kty:"RSA",n:o(t.modulus),e:o(t.publicExponent),d:o(t.privateExponent),p:o(t.prime1),q:o(t.prime2),dp:o(t.exponent1),dq:o(t.exponent2),qi:o(t.coefficient),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){return a.encode({version:0,modulus:s(e.n),publicExponent:s(e.e),privateExponent:s(e.d),prime1:s(e.p),prime2:s(e.q),exponent1:s(e.dp),exponent2:s(e.dq),coefficient:s(e.qi)},"der")},t.pkixToJwk=function(e){const t=l.decode(e,"der"),n=c.decode(t.subjectPublicKey.data,"der");return{kty:"RSA",n:o(n.modulus),e:o(n.publicExponent),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){return l.encode({algorithm:{algorithm:"rsa",none:null},subjectPublicKey:{data:c.encode({modulus:s(e.n),publicExponent:s(e.e)},"der")}},"der")}},function(e,t){},function(e,t,n){"use strict";const r=n(142),i=n(1),o=t;function s(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}o.define=function e(t,n){return new s(t,n)},s.prototype._createNamed=function e(t){let r;try{r=n(907).runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(e){r=function(e){this._initNamed(e)}}return i(r,t),r.prototype._initNamed=function e(n){t.call(this,n)},new r(this)},s.prototype._getDecoder=function e(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(r.decoders[t])),this.decoders[t]},s.prototype.decode=function e(t,n,r){return this._getDecoder(n).decode(t,r)},s.prototype._getEncoder=function e(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(r.encoders[t])),this.encoders[t]},s.prototype.encode=function e(t,n,r){return this._getEncoder(n).encode(t,r)}},function(module,exports,__webpack_require__){var indexOf=__webpack_require__(313),Object_keys=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var n in e)t.push(n);return t},forEach=function(e,t){if(e.forEach)return e.forEach(t);for(var n=0;n>>0,s>>>0];for(var a=p.fullMessageLength.length-1;a>=0;--a)p.fullMessageLength[a]+=s[1],s[1]=s[0]+(p.fullMessageLength[a]/4294967296>>>0),p.fullMessageLength[a]=p.fullMessageLength[a]>>>0,s[0]=s[1]/4294967296>>>0;return i.putBytes(e),f(n,o,i),(i.read>2048||0===i.length())&&i.compact(),p},p.digest=function(){var t=r.util.createBuffer();t.putBytes(i.bytes());var a=p.fullMessageLength[p.fullMessageLength.length-1]+p.messageLengthSize,u=a&p.blockLength-1,l,c;t.putBytes(s.substr(0,p.blockLength-u));for(var h=8*p.fullMessageLength[0],d=0;d>>0,h+=c,t.putInt32(h>>>0),h=l>>>0;t.putInt32(h);for(var m=new Array(n.length),d=0;d=128;){for(P=0;P<16;++P)t[P][0]=n.getInt32()>>>0,t[P][1]=n.getInt32()>>>0;for(;P<80;++P)N=t[P-2],B=N[0],R=N[1],r=((B>>>19|R<<13)^(R>>>29|B<<3)^B>>>6)>>>0,i=((B<<13|R>>>19)^(R<<3|B>>>29)^(B<<26|R>>>6))>>>0,L=t[P-15],B=L[0],R=L[1],o=((B>>>1|R<<31)^(B>>>8|R<<24)^B>>>7)>>>0,s=((B<<31|R>>>1)^(B<<24|R>>>8)^(B<<25|R>>>7))>>>0,M=t[P-7],F=t[P-16],R=i+M[1]+s+F[1],t[P][0]=r+M[0]+o+F[0]+(R/4294967296>>>0)>>>0,t[P][1]=R>>>0;for(g=e[0][0],y=e[0][1],b=e[1][0],v=e[1][1],_=e[2][0],w=e[2][1],k=e[3][0],S=e[3][1],E=e[4][0],x=e[4][1],C=e[5][0],A=e[5][1],I=e[6][0],T=e[6][1],j=e[7][0],O=e[7][1],P=0;P<80;++P)c=((E>>>14|x<<18)^(E>>>18|x<<14)^(x>>>9|E<<23))>>>0,f=((E<<18|x>>>14)^(E<<14|x>>>18)^(x<<23|E>>>9))>>>0,h=(I^E&(C^I))>>>0,p=(T^x&(A^T))>>>0,a=((g>>>28|y<<4)^(y>>>2|g<<30)^(y>>>7|g<<25))>>>0,l=((g<<4|y>>>28)^(y<<30|g>>>2)^(y<<25|g>>>7))>>>0,d=(g&b|_&(g^b))>>>0,m=(y&v|w&(y^v))>>>0,R=O+f+p+u[P][1]+t[P][1],r=j+c+h+u[P][0]+t[P][0]+(R/4294967296>>>0)>>>0,i=R>>>0,R=l+m,o=a+d+(R/4294967296>>>0)>>>0,s=R>>>0,j=I,O=T,I=C,T=A,C=E,A=x,R=S+i,E=k+r+(R/4294967296>>>0)>>>0,x=R>>>0,k=_,S=w,_=b,w=v,b=g,v=y,R=i+s,g=r+o+(R/4294967296>>>0)>>>0,y=R>>>0;R=e[0][1]+y,e[0][0]=e[0][0]+g+(R/4294967296>>>0)>>>0,e[0][1]=R>>>0,R=e[1][1]+v,e[1][0]=e[1][0]+b+(R/4294967296>>>0)>>>0,e[1][1]=R>>>0,R=e[2][1]+w,e[2][0]=e[2][0]+_+(R/4294967296>>>0)>>>0,e[2][1]=R>>>0,R=e[3][1]+S,e[3][0]=e[3][0]+k+(R/4294967296>>>0)>>>0,e[3][1]=R>>>0,R=e[4][1]+x,e[4][0]=e[4][0]+E+(R/4294967296>>>0)>>>0,e[4][1]=R>>>0,R=e[5][1]+A,e[5][0]=e[5][0]+C+(R/4294967296>>>0)>>>0,e[5][1]=R>>>0,R=e[6][1]+T,e[6][0]=e[6][0]+I+(R/4294967296>>>0)>>>0,e[6][1]=R>>>0,R=e[7][1]+O,e[7][0]=e[7][0]+j+(R/4294967296>>>0)>>>0,e[7][1]=R>>>0,D-=128}}},function(e,t,n){"use strict";(function(t){const r=n(55),i=n(70),o=n(81),s=n(917),a=i(n(305));class u{constructor(e){this._key=m(e,s.publicKeyLength)}verify(e,t,n){d(n),s.hashAndVerify(this._key,t,e,n)}marshal(){return t.from(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),r(this.bytes,"sha2-256",e)}}class l{constructor(e,t){this._key=m(e,s.privateKeyLength),this._publicKey=m(t,s.publicKeyLength)}sign(e,t){d(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new u(this._publicKey)}marshal(){return t.concat([t.from(this._key),t.from(this._publicKey)])}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),r(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,n)=>{if(t)return e(t);e(null,o.encode(n))})}}function c(e,t){try{e=m(e,s.privateKeyLength+s.publicKeyLength)}catch(e){return t(e)}const n=e.slice(0,s.privateKeyLength),r=e.slice(s.privateKeyLength,e.length);t(null,new l(n,r))}function f(e){return e=m(e,s.publicKeyLength),new u(e)}function h(e,t){void 0===t&&"function"==typeof e&&(t=e),s.generateKey((e,n)=>{if(e)return t(e);let r;try{r=new l(n.secretKey,n.publicKey)}catch(e){return void t(e)}t(null,r)})}function p(e,t,n){void 0===n&&"function"==typeof t&&(n=t),s.generateKeyFromSeed(e,(e,t)=>{if(e)return n(e);let r;try{r=new l(t.secretKey,t.publicKey)}catch(e){return void n(e)}n(null,r)})}function d(e){if("function"!=typeof e)throw new Error("callback is required")}function m(e,n){if(t.isBuffer(e)&&(e=new Uint8Array(e)),!(e instanceof Uint8Array)||e.length!==n)throw new Error("Key must be a Uint8Array or Buffer of length "+n);return e}e.exports={Ed25519PublicKey:u,Ed25519PrivateKey:l,unmarshalEd25519PrivateKey:c,unmarshalEd25519PublicKey:f,generateKeyPair:h,generateKeyPairFromSeed:p}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(e){const r=n(918),i=n(89);t.publicKeyLength=r.sign.publicKeyLength,t.privateKeyLength=r.sign.secretKeyLength,t.generateKey=function(e){i(()=>{let t;try{t=r.sign.keyPair()}catch(t){return e(t)}e(null,t)})},t.generateKeyFromSeed=function(e,t){i(()=>{let n;try{n=r.sign.keyPair.fromSeed(e)}catch(e){return t(e)}t(null,n)})},t.hashAndSign=function(t,n,o){i(()=>{o(null,e.from(r.sign.detached(n,t)))})},t.hashAndVerify=function(e,t,n,o){i(()=>{let i;try{i=r.sign.detached.verify(n,t,e)}catch(e){return o(e)}o(null,i)})}}).call(this,n(0).Buffer)},function(e,t,n){!function(e){"use strict";var t=function(e){var t,n=new Float64Array(16);if(e)for(t=0;t>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n,e[t+4]=r>>24&255,e[t+5]=r>>16&255,e[t+6]=r>>8&255,e[t+7]=255&r}function m(e,t,n,r,i){var o,s=0;for(o=0;o>>8)-1}function g(e,t,n,r){return m(e,t,n,r,16)}function y(e,t,n,r){return m(e,t,n,r,32)}function b(e,t,n,r){for(var i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,u=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,l=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,b=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,v=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,_=i,w=o,k=s,S=a,E=u,x=l,C=c,A=f,I=h,T=p,j=d,O=m,P=g,B=y,R=b,N=v,M,L=0;L<20;L+=2)M=_+P|0,E^=M<<7|M>>>25,M=E+_|0,I^=M<<9|M>>>23,M=I+E|0,P^=M<<13|M>>>19,M=P+I|0,_^=M<<18|M>>>14,M=x+w|0,T^=M<<7|M>>>25,M=T+x|0,B^=M<<9|M>>>23,M=B+T|0,w^=M<<13|M>>>19,M=w+B|0,x^=M<<18|M>>>14,M=j+C|0,R^=M<<7|M>>>25,M=R+j|0,k^=M<<9|M>>>23,M=k+R|0,C^=M<<13|M>>>19,M=C+k|0,j^=M<<18|M>>>14,M=N+O|0,S^=M<<7|M>>>25,M=S+N|0,A^=M<<9|M>>>23,M=A+S|0,O^=M<<13|M>>>19,M=O+A|0,N^=M<<18|M>>>14,M=_+S|0,w^=M<<7|M>>>25,M=w+_|0,k^=M<<9|M>>>23,M=k+w|0,S^=M<<13|M>>>19,M=S+k|0,_^=M<<18|M>>>14,M=x+E|0,C^=M<<7|M>>>25,M=C+x|0,A^=M<<9|M>>>23,M=A+C|0,E^=M<<13|M>>>19,M=E+A|0,x^=M<<18|M>>>14,M=j+T|0,O^=M<<7|M>>>25,M=O+j|0,I^=M<<9|M>>>23,M=I+O|0,T^=M<<13|M>>>19,M=T+I|0,j^=M<<18|M>>>14,M=N+R|0,P^=M<<7|M>>>25,M=P+N|0,B^=M<<9|M>>>23,M=B+P|0,R^=M<<13|M>>>19,M=R+B|0,N^=M<<18|M>>>14;_=_+i|0,w=w+o|0,k=k+s|0,S=S+a|0,E=E+u|0,x=x+l|0,C=C+c|0,A=A+f|0,I=I+h|0,T=T+p|0,j=j+d|0,O=O+m|0,P=P+g|0,B=B+y|0,R=R+b|0,N=N+v|0,e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=w>>>0&255,e[5]=w>>>8&255,e[6]=w>>>16&255,e[7]=w>>>24&255,e[8]=k>>>0&255,e[9]=k>>>8&255,e[10]=k>>>16&255,e[11]=k>>>24&255,e[12]=S>>>0&255,e[13]=S>>>8&255,e[14]=S>>>16&255,e[15]=S>>>24&255,e[16]=E>>>0&255,e[17]=E>>>8&255,e[18]=E>>>16&255,e[19]=E>>>24&255,e[20]=x>>>0&255,e[21]=x>>>8&255,e[22]=x>>>16&255,e[23]=x>>>24&255,e[24]=C>>>0&255,e[25]=C>>>8&255,e[26]=C>>>16&255,e[27]=C>>>24&255,e[28]=A>>>0&255,e[29]=A>>>8&255,e[30]=A>>>16&255,e[31]=A>>>24&255,e[32]=I>>>0&255,e[33]=I>>>8&255,e[34]=I>>>16&255,e[35]=I>>>24&255,e[36]=T>>>0&255,e[37]=T>>>8&255,e[38]=T>>>16&255,e[39]=T>>>24&255,e[40]=j>>>0&255,e[41]=j>>>8&255,e[42]=j>>>16&255,e[43]=j>>>24&255,e[44]=O>>>0&255,e[45]=O>>>8&255,e[46]=O>>>16&255,e[47]=O>>>24&255,e[48]=P>>>0&255,e[49]=P>>>8&255,e[50]=P>>>16&255,e[51]=P>>>24&255,e[52]=B>>>0&255,e[53]=B>>>8&255,e[54]=B>>>16&255,e[55]=B>>>24&255,e[56]=R>>>0&255,e[57]=R>>>8&255,e[58]=R>>>16&255,e[59]=R>>>24&255,e[60]=N>>>0&255,e[61]=N>>>8&255,e[62]=N>>>16&255,e[63]=N>>>24&255}function v(e,t,n,r){for(var i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,u=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,l=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,b=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,v=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,_=i,w=o,k=s,S=a,E=u,x=l,C=c,A=f,I=h,T=p,j=d,O=m,P=g,B=y,R=b,N=v,M,L=0;L<20;L+=2)M=_+P|0,E^=M<<7|M>>>25,M=E+_|0,I^=M<<9|M>>>23,M=I+E|0,P^=M<<13|M>>>19,M=P+I|0,_^=M<<18|M>>>14,M=x+w|0,T^=M<<7|M>>>25,M=T+x|0,B^=M<<9|M>>>23,M=B+T|0,w^=M<<13|M>>>19,M=w+B|0,x^=M<<18|M>>>14,M=j+C|0,R^=M<<7|M>>>25,M=R+j|0,k^=M<<9|M>>>23,M=k+R|0,C^=M<<13|M>>>19,M=C+k|0,j^=M<<18|M>>>14,M=N+O|0,S^=M<<7|M>>>25,M=S+N|0,A^=M<<9|M>>>23,M=A+S|0,O^=M<<13|M>>>19,M=O+A|0,N^=M<<18|M>>>14,M=_+S|0,w^=M<<7|M>>>25,M=w+_|0,k^=M<<9|M>>>23,M=k+w|0,S^=M<<13|M>>>19,M=S+k|0,_^=M<<18|M>>>14,M=x+E|0,C^=M<<7|M>>>25,M=C+x|0,A^=M<<9|M>>>23,M=A+C|0,E^=M<<13|M>>>19,M=E+A|0,x^=M<<18|M>>>14,M=j+T|0,O^=M<<7|M>>>25,M=O+j|0,I^=M<<9|M>>>23,M=I+O|0,T^=M<<13|M>>>19,M=T+I|0,j^=M<<18|M>>>14,M=N+R|0,P^=M<<7|M>>>25,M=P+N|0,B^=M<<9|M>>>23,M=B+P|0,R^=M<<13|M>>>19,M=R+B|0,N^=M<<18|M>>>14;e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=x>>>0&255,e[5]=x>>>8&255,e[6]=x>>>16&255,e[7]=x>>>24&255,e[8]=j>>>0&255,e[9]=j>>>8&255,e[10]=j>>>16&255,e[11]=j>>>24&255,e[12]=N>>>0&255,e[13]=N>>>8&255,e[14]=N>>>16&255,e[15]=N>>>24&255,e[16]=C>>>0&255,e[17]=C>>>8&255,e[18]=C>>>16&255,e[19]=C>>>24&255,e[20]=A>>>0&255,e[21]=A>>>8&255,e[22]=A>>>16&255,e[23]=A>>>24&255,e[24]=I>>>0&255,e[25]=I>>>8&255,e[26]=I>>>16&255,e[27]=I>>>24&255,e[28]=T>>>0&255,e[29]=T>>>8&255,e[30]=T>>>16&255,e[31]=T>>>24&255}function _(e,t,n,r){b(e,t,n,r)}function w(e,t,n,r){v(e,t,n,r)}var k=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function S(e,t,n,r,i,o,s){var a=new Uint8Array(16),u=new Uint8Array(64),l,c;for(c=0;c<16;c++)a[c]=0;for(c=0;c<8;c++)a[c]=o[c];for(;i>=64;){for(_(u,a,s,k),c=0;c<64;c++)e[t+c]=n[r+c]^u[c];for(l=1,c=8;c<16;c++)l=l+(255&a[c])|0,a[c]=255&l,l>>>=8;i-=64,t+=64,r+=64}if(i>0)for(_(u,a,s,k),c=0;c=64;){for(_(s,o,i,k),u=0;u<64;u++)e[t+u]=s[u];for(a=1,u=8;u<16;u++)a=a+(255&o[u])|0,o[u]=255&a,a>>>=8;n-=64,t+=64}if(n>0)for(_(s,o,i,k),u=0;u>>13|n<<3),r=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(n>>>10|r<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(r>>>7|i<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,s=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|s<<2),a=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(s>>>11|a<<5),u=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(a>>>8|u<<8),this.r[9]=u>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function I(e,t,n,r,i,o){var s=new A(o);return s.update(n,r,i),s.finish(e,t),0}function T(e,t,n,r,i,o){var s=new Uint8Array(16);return I(s,0,n,r,i,o),g(e,t,s,0)}function j(e,t,n,r,i){var o;if(n<32)return-1;for(C(e,0,t,0,n,r,i),I(e,16,e,32,n-32,e),o=0;o<16;o++)e[o]=0;return 0}function O(e,t,n,r,i){var o,s=new Uint8Array(32);if(n<32)return-1;if(x(s,0,32,r,i),0!==T(t,16,t,32,n-32,s))return-1;for(C(e,0,t,0,n,r,i),o=0;o<32;o++)e[o]=0;return 0}function P(e,t){var n;for(n=0;n<16;n++)e[n]=0|t[n]}function B(e){var t,n,r=1;for(t=0;t<16;t++)n=e[t]+r+65535,r=Math.floor(n/65536),e[t]=n-65536*r;e[0]+=r-1+37*(r-1)}function R(e,t,n){for(var r,i=~(n-1),o=0;o<16;o++)r=i&(e[o]^t[o]),e[o]^=r,t[o]^=r}function N(e,n){var r,i,o,s=t(),a=t();for(r=0;r<16;r++)a[r]=n[r];for(B(a),B(a),B(a),i=0;i<2;i++){for(s[0]=a[0]-65517,r=1;r<15;r++)s[r]=a[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),o=s[15]>>16&1,s[14]&=65535,R(a,s,1-o)}for(r=0;r<16;r++)e[2*r]=255&a[r],e[2*r+1]=a[r]>>8}function M(e,t){var n=new Uint8Array(32),r=new Uint8Array(32);return N(n,e),N(r,t),y(n,0,r,0)}function L(e){var t=new Uint8Array(32);return N(t,e),1&t[0]}function F(e,t){var n;for(n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function D(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]+n[r]}function U(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]-n[r]}function z(e,t,n){var r,i,o=0,s=0,a=0,u=0,l=0,c=0,f=0,h=0,p=0,d=0,m=0,g=0,y=0,b=0,v=0,_=0,w=0,k=0,S=0,E=0,x=0,C=0,A=0,I=0,T=0,j=0,O=0,P=0,B=0,R=0,N=0,M=n[0],L=n[1],F=n[2],D=n[3],U=n[4],z=n[5],q=n[6],K=n[7],H=n[8],V=n[9],W=n[10],$=n[11],G=n[12],Y=n[13],J=n[14],Z=n[15];r=t[0],o+=r*M,s+=r*L,a+=r*F,u+=r*D,l+=r*U,c+=r*z,f+=r*q,h+=r*K,p+=r*H,d+=r*V,m+=r*W,g+=r*$,y+=r*G,b+=r*Y,v+=r*J,_+=r*Z,r=t[1],s+=r*M,a+=r*L,u+=r*F,l+=r*D,c+=r*U,f+=r*z,h+=r*q,p+=r*K,d+=r*H,m+=r*V,g+=r*W,y+=r*$,b+=r*G,v+=r*Y,_+=r*J,w+=r*Z,r=t[2],a+=r*M,u+=r*L,l+=r*F,c+=r*D,f+=r*U,h+=r*z,p+=r*q,d+=r*K,m+=r*H,g+=r*V,y+=r*W,b+=r*$,v+=r*G,_+=r*Y,w+=r*J,k+=r*Z,r=t[3],u+=r*M,l+=r*L,c+=r*F,f+=r*D,h+=r*U,p+=r*z,d+=r*q,m+=r*K,g+=r*H,y+=r*V,b+=r*W,v+=r*$,_+=r*G,w+=r*Y,k+=r*J,S+=r*Z,r=t[4],l+=r*M,c+=r*L,f+=r*F,h+=r*D,p+=r*U,d+=r*z,m+=r*q,g+=r*K,y+=r*H,b+=r*V,v+=r*W,_+=r*$,w+=r*G,k+=r*Y,S+=r*J,E+=r*Z,r=t[5],c+=r*M,f+=r*L,h+=r*F,p+=r*D,d+=r*U,m+=r*z,g+=r*q,y+=r*K,b+=r*H,v+=r*V,_+=r*W,w+=r*$,k+=r*G,S+=r*Y,E+=r*J,x+=r*Z,r=t[6],f+=r*M,h+=r*L,p+=r*F,d+=r*D,m+=r*U,g+=r*z,y+=r*q,b+=r*K,v+=r*H,_+=r*V,w+=r*W,k+=r*$,S+=r*G,E+=r*Y,x+=r*J,C+=r*Z,r=t[7],h+=r*M,p+=r*L,d+=r*F,m+=r*D,g+=r*U,y+=r*z,b+=r*q,v+=r*K,_+=r*H,w+=r*V,k+=r*W,S+=r*$,E+=r*G,x+=r*Y,C+=r*J,A+=r*Z,r=t[8],p+=r*M,d+=r*L,m+=r*F,g+=r*D,y+=r*U,b+=r*z,v+=r*q,_+=r*K,w+=r*H,k+=r*V,S+=r*W,E+=r*$,x+=r*G,C+=r*Y,A+=r*J,I+=r*Z,r=t[9],d+=r*M,m+=r*L,g+=r*F,y+=r*D,b+=r*U,v+=r*z,_+=r*q,w+=r*K,k+=r*H,S+=r*V,E+=r*W,x+=r*$,C+=r*G,A+=r*Y,I+=r*J,T+=r*Z,r=t[10],m+=r*M,g+=r*L,y+=r*F,b+=r*D,v+=r*U,_+=r*z,w+=r*q,k+=r*K,S+=r*H,E+=r*V,x+=r*W,C+=r*$,A+=r*G,I+=r*Y,T+=r*J,j+=r*Z,r=t[11],g+=r*M,y+=r*L,b+=r*F,v+=r*D,_+=r*U,w+=r*z,k+=r*q,S+=r*K,E+=r*H,x+=r*V,C+=r*W,A+=r*$,I+=r*G,T+=r*Y,j+=r*J,O+=r*Z,r=t[12],y+=r*M,b+=r*L,v+=r*F,_+=r*D,w+=r*U,k+=r*z,S+=r*q,E+=r*K,x+=r*H,C+=r*V,A+=r*W,I+=r*$,T+=r*G,j+=r*Y,O+=r*J,P+=r*Z,r=t[13],b+=r*M,v+=r*L,_+=r*F,w+=r*D,k+=r*U,S+=r*z,E+=r*q,x+=r*K,C+=r*H,A+=r*V,I+=r*W,T+=r*$,j+=r*G,O+=r*Y,P+=r*J,B+=r*Z,r=t[14],v+=r*M,_+=r*L,w+=r*F,k+=r*D,S+=r*U,E+=r*z,x+=r*q,C+=r*K,A+=r*H,I+=r*V,T+=r*W,j+=r*$,O+=r*G,P+=r*Y,B+=r*J,R+=r*Z,r=t[15],_+=r*M,w+=r*L,k+=r*F,S+=r*D,E+=r*U,x+=r*z,C+=r*q,A+=r*K,I+=r*H,T+=r*V,j+=r*W,O+=r*$,P+=r*G,B+=r*Y,R+=r*J,N+=r*Z,o+=38*w,s+=38*k,a+=38*S,u+=38*E,l+=38*x,c+=38*C,f+=38*A,h+=38*I,p+=38*T,d+=38*j,m+=38*O,g+=38*P,y+=38*B,b+=38*R,v+=38*N,i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,o+=i-1+37*(i-1),i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=u,e[4]=l,e[5]=c,e[6]=f,e[7]=h,e[8]=p,e[9]=d,e[10]=m,e[11]=g,e[12]=y,e[13]=b,e[14]=v,e[15]=_}function q(e,t){z(e,t,t)}function K(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=253;i>=0;i--)q(r,r),2!==i&&4!==i&&z(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function H(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=250;i>=0;i--)q(r,r),1!==i&&z(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function V(e,n,r){var i=new Uint8Array(32),o=new Float64Array(80),s,a,l=t(),c=t(),f=t(),h=t(),p=t(),d=t();for(a=0;a<31;a++)i[a]=n[a];for(i[31]=127&n[31]|64,i[0]&=248,F(o,r),a=0;a<16;a++)c[a]=o[a],h[a]=l[a]=f[a]=0;for(l[0]=h[0]=1,a=254;a>=0;--a)s=i[a>>>3]>>>(7&a)&1,R(l,c,s),R(f,h,s),D(p,l,f),U(l,l,f),D(f,c,h),U(c,c,h),q(h,p),q(d,l),z(l,f,l),z(f,c,p),D(p,l,f),U(l,l,f),q(c,l),U(f,h,d),z(l,f,u),D(l,l,h),z(f,f,l),z(l,h,d),z(h,c,o),q(c,p),R(l,c,s),R(f,h,s);for(a=0;a<16;a++)o[a+16]=l[a],o[a+32]=f[a],o[a+48]=c[a],o[a+64]=h[a];var m=o.subarray(32),g=o.subarray(16);return K(m,m),z(g,g,m),N(e,g),0}function W(e,t){return V(e,t,o)}function $(e,t){return r(t,32),W(e,t)}function G(e,t,n){var r=new Uint8Array(32);return V(r,n,t),w(e,i,r,k)}A.prototype.blocks=function(e,t,n){for(var r=this.fin?0:2048,i,o,s,a,u,l,c,f,h,p,d,m,g,y,b,v,_,w,k,S=this.h[0],E=this.h[1],x=this.h[2],C=this.h[3],A=this.h[4],I=this.h[5],T=this.h[6],j=this.h[7],O=this.h[8],P=this.h[9],B=this.r[0],R=this.r[1],N=this.r[2],M=this.r[3],L=this.r[4],F=this.r[5],D=this.r[6],U=this.r[7],z=this.r[8],q=this.r[9];n>=16;)i=255&e[t+0]|(255&e[t+1])<<8,S+=8191&i,o=255&e[t+2]|(255&e[t+3])<<8,E+=8191&(i>>>13|o<<3),s=255&e[t+4]|(255&e[t+5])<<8,x+=8191&(o>>>10|s<<6),a=255&e[t+6]|(255&e[t+7])<<8,C+=8191&(s>>>7|a<<9),u=255&e[t+8]|(255&e[t+9])<<8,A+=8191&(a>>>4|u<<12),I+=u>>>1&8191,l=255&e[t+10]|(255&e[t+11])<<8,T+=8191&(u>>>14|l<<2),c=255&e[t+12]|(255&e[t+13])<<8,j+=8191&(l>>>11|c<<5),f=255&e[t+14]|(255&e[t+15])<<8,O+=8191&(c>>>8|f<<8),P+=f>>>5|r,h=0,p=h,p+=S*B,p+=E*(5*q),p+=x*(5*z),p+=C*(5*U),p+=A*(5*D),h=p>>>13,p&=8191,p+=I*(5*F),p+=T*(5*L),p+=j*(5*M),p+=O*(5*N),p+=P*(5*R),h+=p>>>13,p&=8191,d=h,d+=S*R,d+=E*B,d+=x*(5*q),d+=C*(5*z),d+=A*(5*U),h=d>>>13,d&=8191,d+=I*(5*D),d+=T*(5*F),d+=j*(5*L),d+=O*(5*M),d+=P*(5*N),h+=d>>>13,d&=8191,m=h,m+=S*N,m+=E*R,m+=x*B,m+=C*(5*q),m+=A*(5*z),h=m>>>13,m&=8191,m+=I*(5*U),m+=T*(5*D),m+=j*(5*F),m+=O*(5*L),m+=P*(5*M),h+=m>>>13,m&=8191,g=h,g+=S*M,g+=E*N,g+=x*R,g+=C*B,g+=A*(5*q),h=g>>>13,g&=8191,g+=I*(5*z),g+=T*(5*U),g+=j*(5*D),g+=O*(5*F),g+=P*(5*L),h+=g>>>13,g&=8191,y=h,y+=S*L,y+=E*M,y+=x*N,y+=C*R,y+=A*B,h=y>>>13,y&=8191,y+=I*(5*q),y+=T*(5*z),y+=j*(5*U),y+=O*(5*D),y+=P*(5*F),h+=y>>>13,y&=8191,b=h,b+=S*F,b+=E*L,b+=x*M,b+=C*N,b+=A*R,h=b>>>13,b&=8191,b+=I*B,b+=T*(5*q),b+=j*(5*z),b+=O*(5*U),b+=P*(5*D),h+=b>>>13,b&=8191,v=h,v+=S*D,v+=E*F,v+=x*L,v+=C*M,v+=A*N,h=v>>>13,v&=8191,v+=I*R,v+=T*B,v+=j*(5*q),v+=O*(5*z),v+=P*(5*U),h+=v>>>13,v&=8191,_=h,_+=S*U,_+=E*D,_+=x*F,_+=C*L,_+=A*M,h=_>>>13,_&=8191,_+=I*N,_+=T*R,_+=j*B,_+=O*(5*q),_+=P*(5*z),h+=_>>>13,_&=8191,w=h,w+=S*z,w+=E*U,w+=x*D,w+=C*F,w+=A*L,h=w>>>13,w&=8191,w+=I*M,w+=T*N,w+=j*R,w+=O*B,w+=P*(5*q),h+=w>>>13,w&=8191,k=h,k+=S*q,k+=E*z,k+=x*U,k+=C*D,k+=A*F,h=k>>>13,k&=8191,k+=I*L,k+=T*M,k+=j*N,k+=O*R,k+=P*B,h+=k>>>13,k&=8191,h=(h<<2)+h|0,h=h+p|0,p=8191&h,h>>>=13,d+=h,S=p,E=d,x=m,C=g,A=y,I=b,T=v,j=_,O=w,P=k,t+=16,n-=16;this.h[0]=S,this.h[1]=E,this.h[2]=x,this.h[3]=C,this.h[4]=A,this.h[5]=I,this.h[6]=T,this.h[7]=j,this.h[8]=O,this.h[9]=P},A.prototype.finish=function(e,t){var n=new Uint16Array(10),r,i,o,s;if(this.leftover){for(s=this.leftover,this.buffer[s++]=1;s<16;s++)this.buffer[s]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,s=2;s<10;s++)this.h[s]+=r,r=this.h[s]>>>13,this.h[s]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,n[0]=this.h[0]+5,r=n[0]>>>13,n[0]&=8191,s=1;s<10;s++)n[s]=this.h[s]+r,r=n[s]>>>13,n[s]&=8191;for(n[9]-=8192,i=(1^r)-1,s=0;s<10;s++)n[s]&=i;for(i=~i,s=0;s<10;s++)this.h[s]=this.h[s]&i|n[s];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,s=1;s<8;s++)o=(this.h[s]+this.pad[s]|0)+(o>>>16)|0,this.h[s]=65535&o;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},A.prototype.update=function(e,t,n){var r,i;if(this.leftover){for(i=16-this.leftover,i>n&&(i=n),r=0;r=16&&(i=n-n%16,this.blocks(e,t,i),t+=i,n-=i),n){for(r=0;r=128;){for(E=0;E<16;E++)x=8*E+G,i[E]=n[x+0]<<24|n[x+1]<<16|n[x+2]<<8|n[x+3],o[E]=n[x+4]<<24|n[x+5]<<16|n[x+6]<<8|n[x+7];for(E=0;E<80;E++)if(s=P,a=B,u=R,l=N,c=M,f=L,h=F,p=D,d=U,m=z,g=q,y=K,b=H,v=V,_=W,w=$,C=D,A=$,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=(M>>>14|H<<18)^(M>>>18|H<<14)^(H>>>9|M<<23),A=(H>>>14|M<<18)^(H>>>18|M<<14)^(M>>>9|H<<23),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=M&L^~M&F,A=H&V^~H&W,I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=Q[2*E],A=Q[2*E+1],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=i[E%16],A=o[E%16],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,k=65535&j|O<<16,S=65535&I|T<<16,C=k,A=S,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=(P>>>28|U<<4)^(U>>>2|P<<30)^(U>>>7|P<<25),A=(U>>>28|P<<4)^(P>>>2|U<<30)^(P>>>7|U<<25),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,C=P&B^P&R^B&R,A=U&z^U&q^z&q,I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,p=65535&j|O<<16,w=65535&I|T<<16,C=l,A=y,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=k,A=S,I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,l=65535&j|O<<16,y=65535&I|T<<16,B=s,R=a,N=u,M=l,L=c,F=f,D=h,P=p,z=d,q=m,K=g,H=y,V=b,W=v,$=_,U=w,E%16==15)for(x=0;x<16;x++)C=i[x],A=o[x],I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=i[(x+9)%16],A=o[(x+9)%16],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,k=i[(x+1)%16],S=o[(x+1)%16],C=(k>>>1|S<<31)^(k>>>8|S<<24)^k>>>7,A=(S>>>1|k<<31)^(S>>>8|k<<24)^(S>>>7|k<<25),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,k=i[(x+14)%16],S=o[(x+14)%16],C=(k>>>19|S<<13)^(S>>>29|k<<3)^k>>>6,A=(S>>>19|k<<13)^(k>>>29|S<<3)^(S>>>6|k<<26),I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,i[x]=65535&j|O<<16,o[x]=65535&I|T<<16;C=P,A=U,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[0],A=t[0],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[0]=P=65535&j|O<<16,t[0]=U=65535&I|T<<16,C=B,A=z,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[1],A=t[1],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[1]=B=65535&j|O<<16,t[1]=z=65535&I|T<<16,C=R,A=q,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[2],A=t[2],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[2]=R=65535&j|O<<16,t[2]=q=65535&I|T<<16,C=N,A=K,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[3],A=t[3],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[3]=N=65535&j|O<<16,t[3]=K=65535&I|T<<16,C=M,A=H,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[4],A=t[4],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[4]=M=65535&j|O<<16,t[4]=H=65535&I|T<<16,C=L,A=V,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[5],A=t[5],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[5]=L=65535&j|O<<16,t[5]=V=65535&I|T<<16,C=F,A=W,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[6],A=t[6],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[6]=F=65535&j|O<<16,t[6]=W=65535&I|T<<16,C=D,A=$,I=65535&A,T=A>>>16,j=65535&C,O=C>>>16,C=e[7],A=t[7],I+=65535&A,T+=A>>>16,j+=65535&C,O+=C>>>16,T+=I>>>16,j+=T>>>16,O+=j>>>16,e[7]=D=65535&j|O<<16,t[7]=$=65535&I|T<<16,G+=128,r-=128}return r}function te(e,t,n){var r=new Int32Array(8),i=new Int32Array(8),o=new Uint8Array(256),s,a=n;for(r[0]=1779033703,r[1]=3144134277,r[2]=1013904242,r[3]=2773480762,r[4]=1359893119,r[5]=2600822924,r[6]=528734635,r[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,ee(r,i,t,n),n%=128,s=0;s=0;--i)r=n[i/8|0]>>(7&i)&1,re(e,t,r),ne(t,e),ne(e,e),re(e,t,r)}function se(e,n){var r=[t(),t(),t(),t()];P(r[0],f),P(r[1],h),P(r[2],a),z(r[3],f,h),oe(e,r,n)}function ae(e,n,i){var o=new Uint8Array(64),s=[t(),t(),t(),t()],a;for(i||r(n,32),te(o,n,32),o[0]&=248,o[31]&=127,o[31]|=64,se(s,o),ie(e,s),a=0;a<32;a++)n[a+32]=e[a];return 0}var ue=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function le(e,t){var n,r,i,o;for(r=63;r>=32;--r){for(n=0,i=r-32,o=r-12;i>8,t[i]-=256*n;t[i]+=n,t[r]=0}for(n=0,i=0;i<32;i++)t[i]+=n-(t[31]>>4)*ue[i],n=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=n*ue[i];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=255&t[r]}function ce(e){var t=new Float64Array(64),n;for(n=0;n<64;n++)t[n]=e[n];for(n=0;n<64;n++)e[n]=0;le(e,t)}function fe(e,n,r,i){var o=new Uint8Array(64),s=new Uint8Array(64),a=new Uint8Array(64),u,l,c=new Float64Array(64),f=[t(),t(),t(),t()];te(o,i,32),o[0]&=248,o[31]&=127,o[31]|=64;var h=r+64;for(u=0;u>7&&U(e[0],s,e[0]),z(e[3],e[0],e[1]),0)}function pe(e,n,r,i){var o,s,a=new Uint8Array(32),u=new Uint8Array(64),l=[t(),t(),t(),t()],c=[t(),t(),t(),t()];if(s=-1,r<64)return-1;if(he(c,i))return-1;for(o=0;o=0},e.sign.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(64);return ae(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(Be(e),64!==e.length)throw new Error("bad secret key size");for(var t=new Uint8Array(32),n=0;n{o=o||n(921)(t);class s{constructor(e){o.validatePublicKey(e),this._key=e}verify(e,t,n){f(n),o.hashAndVerify(this._key,t,e,n)}marshal(){return o.compressPublicKey(this._key)}get bytes(){return e.PublicKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){f(e),i(this.bytes,"sha2-256",e)}}class a{constructor(e,t){this._key=e,this._publicKey=t||o.computePublicKey(e),o.validatePrivateKey(this._key),o.validatePublicKey(this._publicKey)}sign(e,t){f(t),o.hashAndSign(this._key,e,t)}get public(){return new s(this._publicKey)}marshal(){return this._key}get bytes(){return e.PrivateKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){f(e),i(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,n)=>{if(t)return e(t);e(null,r.encode(n))})}}function u(e,t){t(null,new a(e),null)}function l(e){return new s(e)}function c(e,t){void 0===t&&"function"==typeof e&&(t=e),f(t),o.generateKey((e,n)=>{if(e)return t(e);let r;try{r=new a(n)}catch(e){return t(e)}t(null,r)})}function f(e){if("function"!=typeof e)throw new Error("callback is required")}return{Secp256k1PublicKey:s,Secp256k1PrivateKey:a,unmarshalSecp256k1PrivateKey:u,unmarshalSecp256k1PublicKey:l,generateKeyPair:c}})},function(e,t,n){"use strict";const r=n(922),i=n(55),o=n(16),s="sha2-256";e.exports=(e=>{const t=32;function n(t){const n=(e,n)=>o(()=>t(e,n));let i;do{i=e(32)}while(!r.privateKeyVerify(i));n(null,i)}function a(e,t,n){const a=(e,t)=>o(()=>n(e,t));i.digest(t,s,(t,n)=>{if(t)return a(t);try{const i=r.sign(n,e),o=r.signatureExport(i.signature);return a(null,o)}catch(t){a(t)}})}function u(e,t,n,a){const u=(e,t)=>o(()=>a(e,t));i.digest(n,s,(n,i)=>{if(n)return u(n);try{t=r.signatureImport(t);const o=r.verify(i,t,e);return u(null,o)}catch(n){u(n)}})}function l(e){if(!r.publicKeyVerify(e))throw new Error("Invalid public key");return r.publicKeyConvert(e,!0)}function c(e){return r.publicKeyConvert(e,!1)}function f(e){if(!r.privateKeyVerify(e))throw new Error("Invalid private key")}function h(e){if(!r.publicKeyVerify(e))throw new Error("Invalid public key")}function p(e){return f(e),r.publicKeyCreate(e)}return{generateKey:n,privateKeyLength:32,hashAndSign:a,hashAndVerify:u,compressPublicKey:l,decompressPublicKey:c,validatePrivateKey:f,validatePublicKey:h,computePublicKey:p}})},function(e,t,n){"use strict";e.exports=n(467)(n(925))},function(e,t,n){"use strict";(function(e){var n=Object.prototype.toString;t.isArray=function(e,t){if(!Array.isArray(e))throw TypeError(t)},t.isBoolean=function(e,t){if("[object Boolean]"!==n.call(e))throw TypeError(t)},t.isBuffer=function(t,n){if(!e.isBuffer(t))throw TypeError(n)},t.isFunction=function(e,t){if("[object Function]"!==n.call(e))throw TypeError(t)},t.isNumber=function(e,t){if("[object Number]"!==n.call(e))throw TypeError(t)},t.isObject=function(e,t){if("[object Object]"!==n.call(e))throw TypeError(t)},t.isBufferLength=function(e,t,n){if(e.length!==t)throw RangeError(n)},t.isBufferLength2=function(e,t,n,r){if(e.length!==t&&e.length!==n)throw RangeError(r)},t.isLengthGTZero=function(e,t){if(0===e.length)throw RangeError(t)},t.isNumberInInterval=function(e,t,n,r){if(e<=t||e>=n)throw RangeError(r)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=n(4).Buffer,i=n(314),o=r.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),s=r.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);t.privateKeyExport=function(e,t,n){var i=r.from(n?o:s);return e.copy(i,n?8:9),t.copy(i,n?181:214),i},t.privateKeyImport=function(e){var t=e.length,n=0;if(!(t2||t1?e[n+r-2]<<8:0);if(n+=r,!(t32||t1&&0===t[o]&&!(128&t[o+1]);--n,++o);for(var s=r.concat([r.from([0]),e.s]),a=33,u=0;a>1&&0===s[u]&&!(128&s[u+1]);--a,++u);return i.encode(t.slice(o),s.slice(u))},t.signatureImport=function(e){var t=r.alloc(32,0),n=r.alloc(32,0);try{var o=i.decode(e);if(33===o.r.length&&0===o.r[0]&&(o.r=o.r.slice(1)),o.r.length>32)throw new Error("R length is too long");if(33===o.s.length&&0===o.s[0]&&(o.s=o.s.slice(1)),o.s.length>32)throw new Error("S length is too long")}catch(e){return}return o.r.copy(t,32-o.r.length),o.s.copy(n,32-o.s.length),{r:t,s:n}},t.signatureImportLax=function(e){var t=r.alloc(32,0),n=r.alloc(32,0),i=e.length,o=0;if(48===e[o++]){var s=e[o++];if(!(128&s&&(o+=s-128,o>i))&&2===e[o++]){var a=e[o++];if(128&a){if(s=a-128,o+s>i)return;for(;s>0&&0===e[o];o+=1,s-=1);for(a=0;s>0;o+=1,s-=1)a=(a<<8)+e[o]}if(!(a>i-o)){var u=o;if(o+=a,2===e[o++]){var l=e[o++];if(128&l){if(s=l-128,o+s>i)return;for(;s>0&&0===e[o];o+=1,s-=1);for(l=0;s>0;o+=1,s-=1)l=(l<<8)+e[o]}if(!(l>i-o)){var c=o;for(o+=l;a>0&&0===e[u];a-=1,u+=1);if(!(a>32)){var f=e.slice(u,u+a);for(f.copy(t,32-f.length);l>0&&0===e[c];l-=1,c+=1);if(!(l>32)){var h=e.slice(c,c+l);return h.copy(n,32-h.length),{r:t,s:n}}}}}}}}}},function(e,t,n){"use strict";var r=n(4).Buffer,i=n(143),o=n(930),s=n(315),a=n(237),u=n(473),l=n(935);t.privateKeyVerify=function(e){var t=a.fromBuffer(e);return!(t.isOverflow()||t.isZero())},t.privateKeyExport=function(e,t){var n=a.fromBuffer(e);if(n.isOverflow()||n.isZero())throw new Error(s.EC_PRIVATE_KEY_EXPORT_DER_FAIL);return l.mul(n).toPublicKey(t)},t.privateKeyNegate=function(e){var t=a.fromBuffer(e);return t.isZero()?r.alloc(32):(t.ucmp(a.n)>0&&t.isub(a.n),a.n.sub(t).toBuffer())},t.privateKeyModInverse=function(e){var t=a.fromBuffer(e);if(t.isOverflow()||t.isZero())throw new Error(s.EC_PRIVATE_KEY_RANGE_INVALID);return t.uinvm().toBuffer()},t.privateKeyTweakAdd=function(e,t){var n=a.fromBuffer(t);if(n.isOverflow())throw new Error(s.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);if(n.iadd(a.fromBuffer(e)),n.isOverflow()&&n.isub(a.n),n.isZero())throw new Error(s.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);return n.toBuffer()},t.privateKeyTweakMul=function(e,t){var n=a.fromBuffer(t);if(n.isOverflow()||n.isZero())throw new Error(s.EC_PRIVATE_KEY_TWEAK_MUL_FAIL);var r=a.fromBuffer(e);return n.umul(r).ureduce().toBuffer()},t.publicKeyCreate=function(e,t){var n=a.fromBuffer(e);if(n.isOverflow()||n.isZero())throw new Error(s.EC_PUBLIC_KEY_CREATE_FAIL);return l.mul(n).toPublicKey(t)},t.publicKeyConvert=function(e,t){var n=u.fromPublicKey(e);if(null===n)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);return n.toPublicKey(t)},t.publicKeyVerify=function(e){return null!==u.fromPublicKey(e)},t.publicKeyTweakAdd=function(e,t,n){var r=u.fromPublicKey(e);if(null===r)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);if(t=a.fromBuffer(t),t.isOverflow())throw new Error(s.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);var i=l.mul(t).add(r);if(i.inf)throw new Error(s.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);return i.toPublicKey(n)},t.publicKeyTweakMul=function(e,t,n){var r=u.fromPublicKey(e);if(null===r)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);if(t=a.fromBuffer(t),t.isOverflow()||t.isZero())throw new Error(s.EC_PUBLIC_KEY_TWEAK_MUL_FAIL);return r.mul(t).toPublicKey(n)},t.publicKeyCombine=function(e,t){for(var n=new Array(e.length),r=0;r=0)&&0===r.iadd(a.psn).redMul(d).ucmp(p.x)},t.recover=function(e,t,n,i){var o=a.fromBuffer(t.slice(0,32)),c=a.fromBuffer(t.slice(32,64));if(o.isOverflow()||c.isOverflow())throw new Error(s.ECDSA_SIGNATURE_PARSE_FAIL);do{if(o.isZero()||c.isZero())break;var f=o;if(n>>1){if(f.ucmp(a.psn)>=0)break;f=o.add(a.n)}var h=r.concat([r.from([2+(1&n)]),f.toBuffer()]),p=u.fromPublicKey(h);if(null===p)break;var d=o.uinvm(),m=a.n.sub(a.fromBuffer(e)).umul(d).ureduce(),g=c.umul(d).ureduce(),y=u.fromECJPoint(l.mulAdd(m,p,g));return y.toPublicKey(i)}while(0);throw new Error(s.ECDSA_RECOVER_FAIL)},t.ecdh=function(e,n){var r=t.ecdhUnsafe(e,n,!0);return i("sha256").update(r).digest()},t.ecdhUnsafe=function(e,t,n){var r=u.fromPublicKey(e);if(null===r)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);var i=a.fromBuffer(t);if(i.isOverflow()||i.isZero())throw new Error(s.ECDH_FAIL);return r.mul(i).toPublicKey(n)}},function(e,t,n){var r=n(1),i=n(144),o=n(4).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function l(e){return e<<5|e>>>27}function c(e){return e<<30|e>>>2}function f(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}r(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,u=0;u<16;++u)t[u]=e.readInt32BE(4*u);for(;u<80;++u)t[u]=t[u-3]^t[u-8]^t[u-14]^t[u-16];for(var h=0;h<80;++h){var p=~~(h/20),d=l(n)+f(p,r,i,o)+a+t[h]+s[p]|0;a=o,o=i,i=c(r),r=n,n=d}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0},u.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},function(e,t,n){var r=n(1),i=n(144),o=n(4).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function l(e){return e<<1|e>>>31}function c(e){return e<<5|e>>>27}function f(e){return e<<30|e>>>2}function h(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}r(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,u=0;u<16;++u)t[u]=e.readInt32BE(4*u);for(;u<80;++u)t[u]=l(t[u-3]^t[u-8]^t[u-14]^t[u-16]);for(var p=0;p<80;++p){var d=~~(p/20),m=c(n)+h(d,r,i,o)+a+t[p]+s[d]|0;a=o,o=i,i=f(r),r=n,n=m}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0},u.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},function(e,t,n){var r=n(1),i=n(471),o=n(144),s=n(4).Buffer,a=new Array(64);function u(){this.init(),this._w=a,o.call(this,64,56)}r(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var e=s.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=u},function(e,t,n){var r=n(1),i=n(472),o=n(144),s=n(4).Buffer,a=new Array(160);function u(){this.init(),this._w=a,o.call(this,128,112)}r(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var e=s.allocUnsafe(48);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},e.exports=u},function(e,t,n){"use strict";(function(t){var r=n(317),i=n(933),o=new t(0),s=new t([0]),a=new t([1]);function u(e,t,n,r){var o=i[e];if(void 0===o)throw new Error("hash "+e+" is not supported");this._algo=e,this._securityStrength=o.securityStrength/8,this._outlen=o.outlen/8,this._reseedInterval=281474976710656,this._init(t,n,r)}u.prototype._update=function(e){var t=r(this._algo,this._K).update(this._V).update(s);e&&t.update(e),this._K=t.digest(),this._V=r(this._algo,this._K).update(this._V).digest(),e&&(this._K=r(this._algo,this._K).update(this._V).update(a).update(e).digest(),this._V=r(this._algo,this._K).update(this._V).digest())},u.prototype._init=function(e,n,r){if(e.lengththis._reseedInterval)throw new Error("Reseed is required");n&&0===n.length&&(n=void 0),n&&this._update(n);for(var i=new t(0);i.lengtha?t=e(t):t.length>>13,p=0|r[1],d=8191&p,m=p>>>13,g=0|r[2],y=8191&g,b=g>>>13,v=0|r[3],_=8191&v,w=v>>>13,k=0|r[4],S=8191&k,E=k>>>13,x=0|r[5],C=8191&x,A=x>>>13,I=0|r[6],T=8191&I,j=I>>>13,O=0|r[7],P=8191&O,B=O>>>13,R=0|r[8],N=8191&R,M=R>>>13,L=0|r[9],F=8191&L,D=L>>>13,U=0|i[0],z=8191&U,q=U>>>13,K=0|i[1],H=8191&K,V=K>>>13,W=0|i[2],$=8191&W,G=W>>>13,Y=0|i[3],J=8191&Y,Z=Y>>>13,X=0|i[4],Q=8191&X,ee=X>>>13,te=0|i[5],ne=8191&te,re=te>>>13,ie=0|i[6],oe=8191&ie,se=ie>>>13,ae=0|i[7],ue=8191&ae,le=ae>>>13,ce=0|i[8],fe=8191&ce,he=ce>>>13,pe=0|i[9],de=8191&pe,me=pe>>>13;n.length=19,a=Math.imul(f,z),u=Math.imul(f,q),u+=Math.imul(h,z),l=Math.imul(h,q);var ge=s+a+((8191&u)<<13);s=l+(u>>>13)+(ge>>>26),ge&=67108863,a=Math.imul(d,z),u=Math.imul(d,q),u+=Math.imul(m,z),l=Math.imul(m,q),a+=Math.imul(f,H),u+=Math.imul(f,V),u+=Math.imul(h,H),l+=Math.imul(h,V);var ye=s+a+((8191&u)<<13);s=l+(u>>>13)+(ye>>>26),ye&=67108863,a=Math.imul(y,z),u=Math.imul(y,q),u+=Math.imul(b,z),l=Math.imul(b,q),a+=Math.imul(d,H),u+=Math.imul(d,V),u+=Math.imul(m,H),l+=Math.imul(m,V),a+=Math.imul(f,$),u+=Math.imul(f,G),u+=Math.imul(h,$),l+=Math.imul(h,G);var be=s+a+((8191&u)<<13);s=l+(u>>>13)+(be>>>26),be&=67108863,a=Math.imul(_,z),u=Math.imul(_,q),u+=Math.imul(w,z),l=Math.imul(w,q),a+=Math.imul(y,H),u+=Math.imul(y,V),u+=Math.imul(b,H),l+=Math.imul(b,V),a+=Math.imul(d,$),u+=Math.imul(d,G),u+=Math.imul(m,$),l+=Math.imul(m,G),a+=Math.imul(f,J),u+=Math.imul(f,Z),u+=Math.imul(h,J),l+=Math.imul(h,Z);var ve=s+a+((8191&u)<<13);s=l+(u>>>13)+(ve>>>26),ve&=67108863,a=Math.imul(S,z),u=Math.imul(S,q),u+=Math.imul(E,z),l=Math.imul(E,q),a+=Math.imul(_,H),u+=Math.imul(_,V),u+=Math.imul(w,H),l+=Math.imul(w,V),a+=Math.imul(y,$),u+=Math.imul(y,G),u+=Math.imul(b,$),l+=Math.imul(b,G),a+=Math.imul(d,J),u+=Math.imul(d,Z),u+=Math.imul(m,J),l+=Math.imul(m,Z),a+=Math.imul(f,Q),u+=Math.imul(f,ee),u+=Math.imul(h,Q),l+=Math.imul(h,ee);var _e=s+a+((8191&u)<<13);s=l+(u>>>13)+(_e>>>26),_e&=67108863,a=Math.imul(C,z),u=Math.imul(C,q),u+=Math.imul(A,z),l=Math.imul(A,q),a+=Math.imul(S,H),u+=Math.imul(S,V),u+=Math.imul(E,H),l+=Math.imul(E,V),a+=Math.imul(_,$),u+=Math.imul(_,G),u+=Math.imul(w,$),l+=Math.imul(w,G),a+=Math.imul(y,J),u+=Math.imul(y,Z),u+=Math.imul(b,J),l+=Math.imul(b,Z),a+=Math.imul(d,Q),u+=Math.imul(d,ee),u+=Math.imul(m,Q),l+=Math.imul(m,ee),a+=Math.imul(f,ne),u+=Math.imul(f,re),u+=Math.imul(h,ne),l+=Math.imul(h,re);var we=s+a+((8191&u)<<13);s=l+(u>>>13)+(we>>>26),we&=67108863,a=Math.imul(T,z),u=Math.imul(T,q),u+=Math.imul(j,z),l=Math.imul(j,q),a+=Math.imul(C,H),u+=Math.imul(C,V),u+=Math.imul(A,H),l+=Math.imul(A,V),a+=Math.imul(S,$),u+=Math.imul(S,G),u+=Math.imul(E,$),l+=Math.imul(E,G),a+=Math.imul(_,J),u+=Math.imul(_,Z),u+=Math.imul(w,J),l+=Math.imul(w,Z),a+=Math.imul(y,Q),u+=Math.imul(y,ee),u+=Math.imul(b,Q),l+=Math.imul(b,ee),a+=Math.imul(d,ne),u+=Math.imul(d,re),u+=Math.imul(m,ne),l+=Math.imul(m,re),a+=Math.imul(f,oe),u+=Math.imul(f,se),u+=Math.imul(h,oe),l+=Math.imul(h,se);var ke=s+a+((8191&u)<<13);s=l+(u>>>13)+(ke>>>26),ke&=67108863,a=Math.imul(P,z),u=Math.imul(P,q),u+=Math.imul(B,z),l=Math.imul(B,q),a+=Math.imul(T,H),u+=Math.imul(T,V),u+=Math.imul(j,H),l+=Math.imul(j,V),a+=Math.imul(C,$),u+=Math.imul(C,G),u+=Math.imul(A,$),l+=Math.imul(A,G),a+=Math.imul(S,J),u+=Math.imul(S,Z),u+=Math.imul(E,J),l+=Math.imul(E,Z),a+=Math.imul(_,Q),u+=Math.imul(_,ee),u+=Math.imul(w,Q),l+=Math.imul(w,ee),a+=Math.imul(y,ne),u+=Math.imul(y,re),u+=Math.imul(b,ne),l+=Math.imul(b,re),a+=Math.imul(d,oe),u+=Math.imul(d,se),u+=Math.imul(m,oe),l+=Math.imul(m,se),a+=Math.imul(f,ue),u+=Math.imul(f,le),u+=Math.imul(h,ue),l+=Math.imul(h,le);var Se=s+a+((8191&u)<<13);s=l+(u>>>13)+(Se>>>26),Se&=67108863,a=Math.imul(N,z),u=Math.imul(N,q),u+=Math.imul(M,z),l=Math.imul(M,q),a+=Math.imul(P,H),u+=Math.imul(P,V),u+=Math.imul(B,H),l+=Math.imul(B,V),a+=Math.imul(T,$),u+=Math.imul(T,G),u+=Math.imul(j,$),l+=Math.imul(j,G),a+=Math.imul(C,J),u+=Math.imul(C,Z),u+=Math.imul(A,J),l+=Math.imul(A,Z),a+=Math.imul(S,Q),u+=Math.imul(S,ee),u+=Math.imul(E,Q),l+=Math.imul(E,ee),a+=Math.imul(_,ne),u+=Math.imul(_,re),u+=Math.imul(w,ne),l+=Math.imul(w,re),a+=Math.imul(y,oe),u+=Math.imul(y,se),u+=Math.imul(b,oe),l+=Math.imul(b,se),a+=Math.imul(d,ue),u+=Math.imul(d,le),u+=Math.imul(m,ue),l+=Math.imul(m,le),a+=Math.imul(f,fe),u+=Math.imul(f,he),u+=Math.imul(h,fe),l+=Math.imul(h,he);var Ee=s+a+((8191&u)<<13);s=l+(u>>>13)+(Ee>>>26),Ee&=67108863,a=Math.imul(F,z),u=Math.imul(F,q),u+=Math.imul(D,z),l=Math.imul(D,q),a+=Math.imul(N,H),u+=Math.imul(N,V),u+=Math.imul(M,H),l+=Math.imul(M,V),a+=Math.imul(P,$),u+=Math.imul(P,G),u+=Math.imul(B,$),l+=Math.imul(B,G),a+=Math.imul(T,J),u+=Math.imul(T,Z),u+=Math.imul(j,J),l+=Math.imul(j,Z),a+=Math.imul(C,Q),u+=Math.imul(C,ee),u+=Math.imul(A,Q),l+=Math.imul(A,ee),a+=Math.imul(S,ne),u+=Math.imul(S,re),u+=Math.imul(E,ne),l+=Math.imul(E,re),a+=Math.imul(_,oe),u+=Math.imul(_,se),u+=Math.imul(w,oe),l+=Math.imul(w,se),a+=Math.imul(y,ue),u+=Math.imul(y,le),u+=Math.imul(b,ue),l+=Math.imul(b,le),a+=Math.imul(d,fe),u+=Math.imul(d,he),u+=Math.imul(m,fe),l+=Math.imul(m,he),a+=Math.imul(f,de),u+=Math.imul(f,me),u+=Math.imul(h,de),l+=Math.imul(h,me);var xe=s+a+((8191&u)<<13);s=l+(u>>>13)+(xe>>>26),xe&=67108863,a=Math.imul(F,H),u=Math.imul(F,V),u+=Math.imul(D,H),l=Math.imul(D,V),a+=Math.imul(N,$),u+=Math.imul(N,G),u+=Math.imul(M,$),l+=Math.imul(M,G),a+=Math.imul(P,J),u+=Math.imul(P,Z),u+=Math.imul(B,J),l+=Math.imul(B,Z),a+=Math.imul(T,Q),u+=Math.imul(T,ee),u+=Math.imul(j,Q),l+=Math.imul(j,ee),a+=Math.imul(C,ne),u+=Math.imul(C,re),u+=Math.imul(A,ne),l+=Math.imul(A,re),a+=Math.imul(S,oe),u+=Math.imul(S,se),u+=Math.imul(E,oe),l+=Math.imul(E,se),a+=Math.imul(_,ue),u+=Math.imul(_,le),u+=Math.imul(w,ue),l+=Math.imul(w,le),a+=Math.imul(y,fe),u+=Math.imul(y,he),u+=Math.imul(b,fe),l+=Math.imul(b,he),a+=Math.imul(d,de),u+=Math.imul(d,me),u+=Math.imul(m,de),l+=Math.imul(m,me);var Ce=s+a+((8191&u)<<13);s=l+(u>>>13)+(Ce>>>26),Ce&=67108863,a=Math.imul(F,$),u=Math.imul(F,G),u+=Math.imul(D,$),l=Math.imul(D,G),a+=Math.imul(N,J),u+=Math.imul(N,Z),u+=Math.imul(M,J),l+=Math.imul(M,Z),a+=Math.imul(P,Q),u+=Math.imul(P,ee),u+=Math.imul(B,Q),l+=Math.imul(B,ee),a+=Math.imul(T,ne),u+=Math.imul(T,re),u+=Math.imul(j,ne),l+=Math.imul(j,re),a+=Math.imul(C,oe),u+=Math.imul(C,se),u+=Math.imul(A,oe),l+=Math.imul(A,se),a+=Math.imul(S,ue),u+=Math.imul(S,le),u+=Math.imul(E,ue),l+=Math.imul(E,le),a+=Math.imul(_,fe),u+=Math.imul(_,he),u+=Math.imul(w,fe),l+=Math.imul(w,he),a+=Math.imul(y,de),u+=Math.imul(y,me),u+=Math.imul(b,de),l+=Math.imul(b,me);var Ae=s+a+((8191&u)<<13);s=l+(u>>>13)+(Ae>>>26),Ae&=67108863,a=Math.imul(F,J),u=Math.imul(F,Z),u+=Math.imul(D,J),l=Math.imul(D,Z),a+=Math.imul(N,Q),u+=Math.imul(N,ee),u+=Math.imul(M,Q),l+=Math.imul(M,ee),a+=Math.imul(P,ne),u+=Math.imul(P,re),u+=Math.imul(B,ne),l+=Math.imul(B,re),a+=Math.imul(T,oe),u+=Math.imul(T,se),u+=Math.imul(j,oe),l+=Math.imul(j,se),a+=Math.imul(C,ue),u+=Math.imul(C,le),u+=Math.imul(A,ue),l+=Math.imul(A,le),a+=Math.imul(S,fe),u+=Math.imul(S,he),u+=Math.imul(E,fe),l+=Math.imul(E,he),a+=Math.imul(_,de),u+=Math.imul(_,me),u+=Math.imul(w,de),l+=Math.imul(w,me);var Ie=s+a+((8191&u)<<13);s=l+(u>>>13)+(Ie>>>26),Ie&=67108863,a=Math.imul(F,Q),u=Math.imul(F,ee),u+=Math.imul(D,Q),l=Math.imul(D,ee),a+=Math.imul(N,ne),u+=Math.imul(N,re),u+=Math.imul(M,ne),l+=Math.imul(M,re),a+=Math.imul(P,oe),u+=Math.imul(P,se),u+=Math.imul(B,oe),l+=Math.imul(B,se),a+=Math.imul(T,ue),u+=Math.imul(T,le),u+=Math.imul(j,ue),l+=Math.imul(j,le),a+=Math.imul(C,fe),u+=Math.imul(C,he),u+=Math.imul(A,fe),l+=Math.imul(A,he),a+=Math.imul(S,de),u+=Math.imul(S,me),u+=Math.imul(E,de),l+=Math.imul(E,me);var Te=s+a+((8191&u)<<13);s=l+(u>>>13)+(Te>>>26),Te&=67108863,a=Math.imul(F,ne),u=Math.imul(F,re),u+=Math.imul(D,ne),l=Math.imul(D,re),a+=Math.imul(N,oe),u+=Math.imul(N,se),u+=Math.imul(M,oe),l+=Math.imul(M,se),a+=Math.imul(P,ue),u+=Math.imul(P,le),u+=Math.imul(B,ue),l+=Math.imul(B,le),a+=Math.imul(T,fe),u+=Math.imul(T,he),u+=Math.imul(j,fe),l+=Math.imul(j,he),a+=Math.imul(C,de),u+=Math.imul(C,me),u+=Math.imul(A,de),l+=Math.imul(A,me);var je=s+a+((8191&u)<<13);s=l+(u>>>13)+(je>>>26),je&=67108863,a=Math.imul(F,oe),u=Math.imul(F,se),u+=Math.imul(D,oe),l=Math.imul(D,se),a+=Math.imul(N,ue),u+=Math.imul(N,le),u+=Math.imul(M,ue),l+=Math.imul(M,le),a+=Math.imul(P,fe),u+=Math.imul(P,he),u+=Math.imul(B,fe),l+=Math.imul(B,he),a+=Math.imul(T,de),u+=Math.imul(T,me),u+=Math.imul(j,de),l+=Math.imul(j,me);var Oe=s+a+((8191&u)<<13);s=l+(u>>>13)+(Oe>>>26),Oe&=67108863,a=Math.imul(F,ue),u=Math.imul(F,le),u+=Math.imul(D,ue),l=Math.imul(D,le),a+=Math.imul(N,fe),u+=Math.imul(N,he),u+=Math.imul(M,fe),l+=Math.imul(M,he),a+=Math.imul(P,de),u+=Math.imul(P,me),u+=Math.imul(B,de),l+=Math.imul(B,me);var Pe=s+a+((8191&u)<<13);s=l+(u>>>13)+(Pe>>>26),Pe&=67108863,a=Math.imul(F,fe),u=Math.imul(F,he),u+=Math.imul(D,fe),l=Math.imul(D,he),a+=Math.imul(N,de),u+=Math.imul(N,me),u+=Math.imul(M,de),l+=Math.imul(M,me);var Be=s+a+((8191&u)<<13);s=l+(u>>>13)+(Be>>>26),Be&=67108863,a=Math.imul(F,de),u=Math.imul(F,me),u+=Math.imul(D,de),l=Math.imul(D,me);var Re=s+a+((8191&u)<<13);return s=l+(u>>>13)+(Re>>>26),Re&=67108863,o[0]=ge,o[1]=ye,o[2]=be,o[3]=ve,o[4]=_e,o[5]=we,o[6]=ke,o[7]=Se,o[8]=Ee,o[9]=xe,o[10]=Ce,o[11]=Ae,o[12]=Ie,o[13]=Te,o[14]=je,o[15]=Oe,o[16]=Pe,o[17]=Be,o[18]=Re,0!==s&&(o[19]=s,n.length++),n}},function(e,t,n){"use strict";var r=n(4).Buffer,i=n(237),o=n(473),s=n(474);function a(){this.x=i.fromBuffer(r.from("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","hex")),this.y=i.fromBuffer(r.from("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8","hex")),this.inf=!1,this._precompute()}a.prototype._precompute=function(){for(var e=new o(this.x,this.y),t=4,n=new Array(1+Math.ceil(64.25)),r=n[0]=e,i=1;i=l;f--)c=(c<<1)+i[f];u.push(c)}for(var h=new s(null,null,null),p=new s(null,null,null),d=a;d>0;d--){for(var m=0;m=0;c--){for(var f=0;c>=0&&(l[0]=0|a[0][c],l[1]=0|a[1][c],0===l[0]&&0===l[1]);++f,--c);if(c>=0&&(f+=1),u=u.dblp(f),c<0)break;for(var h=0;h<2;h++){var p=l[h],d;0!==p&&(p>0?d=o[h][p>>1]:p<0&&(d=o[h][-p>>1].neg()),u=void 0===d.z?u.mixedAdd(d):u.add(d))}}return u},e.exports=new a},function(e,t,n){"use strict";(function(t){const r=n(229),i=n(475),o={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=((e,n,s,a)=>{const u=o[e];if(!u)return a(new Error("unkown cipherType passed"));if(!n)return a(new Error("unkown hashType passed"));const l=u.keySize,c=u.ivSize,f=20,h=t.from("key expansion"),p=2*(c+l+20);i.create(n,s,(e,n)=>{if(e)return a(e);n.digest(h,(e,i)=>{if(e)return a(e);let o=[],s=0;function u(e){n.digest(t.concat([i,h]),(t,r)=>{if(t)return e(t);let a=r.length;s+a>p&&(a=p-s),o.push(r),s+=a,n.digest(i,(t,n)=>{if(t)return e(t);i=n,e()})})}function f(e){if(e)return a(e);const n=p/2,r=t.concat(o),i=r.slice(0,n),s=r.slice(n,p),u=e=>({iv:e.slice(0,c),cipherKey:e.slice(c,c+l),macKey:e.slice(c+l)});a(null,{k1:u(i),k2:u(s)})}r(()=>s{r.generateEphmeralKeyPair(e,t)})},function(e,t,n){"use strict";(function(e){const r=n(311),i=n(310),o=n(142).bignum,s=n(466),a=s.toBase64,u=s.toBn,l={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=function(t,n){i(r.subtle.generateKey({name:"ECDH",namedCurve:t},!0,["deriveBits"]).then(n=>{const o=(o,s,a)=>{let u;"function"==typeof s&&(a=s,s=void 0),u=s?r.subtle.importKey("jwk",p(t,s),{name:"ECDH",namedCurve:t},!1,["deriveBits"]):Promise.resolve(n.privateKey);const c=Promise.all([r.subtle.importKey("jwk",h(t,o),{name:"ECDH",namedCurve:t},!1,[]),u]);i(c.then(e=>r.subtle.deriveBits({name:"ECDH",namedCurve:t,public:e[0]},e[1],l[t])).then(t=>e.from(t)),a)};return r.subtle.exportKey("jwk",n.publicKey).then(e=>({key:f(e),genSharedKey:o}))}),n)};const c={"P-256":32,"P-384":48,"P-521":66};function f(t){const n=c[t.crv];return e.concat([e.from([4]),u(t.x).toArrayLike(e,"be",n),u(t.y).toArrayLike(e,"be",n)],1+2*n)}function h(t,n){const r=c[t];if(!n.slice(0,1).equals(e.from([4])))throw new Error("Invalid key format");const i=new o(n.slice(1,r+1)),s=new o(n.slice(1+r));return{kty:"EC",crv:t,x:a(i,r),y:a(s,r),ext:!0}}function p(e,t){const n=h(e,t.public);return n.d=a(new o(t.private)),n}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(941),i=n(318),o=n(38);function s(e){const t=[],n=e.split("/").slice(1);if(1===n.length&&""===n[0])return[];for(let r=0;r=n.length)throw _("invalid address: "+e);if(s.path){t.push([o,v(n.slice(r).join("/"))]);break}t.push([o,n[r]])}else t.push([o])}return t}function a(e){const t=[];return e.map(e=>{const n=w(e);t.push(n.name),e.length>1&&t.push(e[1])}),v(t.join("/"))}function u(e){return e.map(e=>{Array.isArray(e)||(e=[e]);const t=w(e);return e.length>1?[t.code,r.toBuffer(t.code,e[1])]:[t.code]})}function l(e){return e.map(e=>{const t=w(e);return e.length>1?[t.code,r.toString(t.code,e[1])]:[t.code]})}function c(e){return g(t.concat(e.map(e=>{const n=w(e);let r=t.from(o.encode(n.code));return e.length>1&&(r=t.concat([r,e[1]])),r})))}function f(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;{const e=o.decode(t);return e+o.decode.bytes}}function h(e){const t=[];let n=0;for(;ne.length)throw _("Invalid address buffer: "+e.toString("hex"));t.push([r,l])}return t}function p(e){const t=h(e),n=l(t);return a(n)}function d(e){e=v(e);const t=s(e),n=u(t);return c(n)}function m(e){return d(e)}function g(e){const n=y(e);if(n)throw n;return t.from(e)}function y(e){try{h(e)}catch(e){return e}}function b(e){return void 0===y(e)}function v(e){return"/"+e.trim().split("/").filter(e=>e).join("/")}function _(e){return new Error("Error parsing address: "+e)}function w(e){const t=i(e[0]);return t}e.exports={stringToStringTuples:s,stringTuplesToString:a,tuplesToStringTuples:l,stringTuplesToTuples:u,bufferToTuples:h,tuplesToBuffer:c,bufferToString:p,stringToBuffer:d,fromString:m,fromBuffer:g,validateBuffer:y,isValidBuffer:b,cleanPath:v,ParseError:_,protoFromTuple:w,sizeForAddr:f}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(942),i=n(943),o=n(318),s=n(81),a=n(38);function u(e,n){return n instanceof t?u.toString(e,n):u.toBuffer(e,n)}function l(e){if(!i(e))throw new Error("invalid ip address");return r.toBuffer(e)}function c(e){const t=r.toString(e);if(!i(t))throw new Error("invalid ip address");return t}function f(e){const n=t.alloc(2);return n.writeUInt16BE(e,0),n}function h(e){return e.readUInt16BE(0)}function p(e){const n=t.from(e),r=t.from(a.encode(n.length));return t.concat([r,n])}function d(e){const t=a.decode(e);if(e=e.slice(a.decode.bytes),e.length!==t)throw new Error("inconsistent lengths");return e.toString()}function m(e){const n=t.from(s.decode(e)),r=t.from(a.encode(n.length));return t.concat([r,n])}function g(e){const t=a.decode(e),n=e.slice(a.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return s.encode(n)}e.exports=u,u.toString=function e(t,n){switch(t=o(t),t.code){case 4:case 41:return c(n);case 6:case 273:case 33:case 132:return h(n);case 53:case 54:case 55:case 56:case 400:return d(n);case 421:return g(n);default:return n.toString("hex")}},u.toBuffer=function e(n,r){switch(n=o(n),n.code){case 4:case 41:return l(r);case 6:case 273:case 33:case 132:return f(parseInt(r,10));case 53:case 54:case 55:case 56:case 400:return p(r);case 421:return m(r);default:return t.from(r,"hex")}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=t,i=n(0).Buffer,o=n(225);r.toBuffer=function(e,t,n){var r;if(n=~~n,this.isV4Format(e))r=t||new i(n+4),e.split(/\./g).map(function(e){r[n++]=255&parseInt(e,10)});else if(this.isV6Format(e)){var o=e.split(":",8),s;for(s=0;s0;s--)l.push("0");o.splice.apply(o,l)}for(r=t||new i(n+16),s=0;s>8&255,r[n++]=255&c}}if(!r)throw Error("Invalid ip address: "+e);return r},r.toString=function(e,t,n){t=~~t,n=n||e.length-t;var r=[];if(4===n){for(var i=0;i32?"ipv6":u(t);var n=4;"ipv6"===t&&(n=16);for(var o=new i(n),s=0,a=o.length;s>l)}return r.toString(o)},r.mask=function(e,t){e=r.toBuffer(e),t=r.toBuffer(t);var n=new i(Math.max(e.length,t.length)),o=0;if(e.length===t.length)for(o=0;oe.length&&(i=t,o=e);for(var s=i.length-o.length,n=s;n>>0},r.fromLong=function(e){return(e>>>24)+"."+(e>>16&255)+"."+(e>>8&255)+"."+(255&e)}},function(e,t,n){"use strict";const r=n(944),i=e.exports=(e=>r({exact:!0}).test(e));i.v4=(e=>r.v4({exact:!0}).test(e)),i.v6=(e=>r.v6({exact:!0}).test(e))},function(e,t,n){"use strict";const r="(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(?:\\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){3}",i="[0-9a-fA-F]{1,4}",o=`\n(\n(?:${i}:){7}(?:${i}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${i}:){6}(?:${r}|:${i}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${i}:){5}(?::${r}|(:${i}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${i}:){4}(?:(:${i}){0,1}:${r}|(:${i}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${i}:){3}(?:(:${i}){0,2}:${r}|(:${i}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${i}:){2}(?:(:${i}){0,3}:${r}|(:${i}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${i}:){1}(?:(:${i}){0,4}:${r}|(:${i}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::((?::${i}){0,5}:${r}|(?::${i}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),s=e.exports=(e=>e&&e.exact?new RegExp(`(?:^${r}$)|(?:^${o}$)`):new RegExp(`(?:${r})|(?:${o})`,"g"));s.v4=(e=>e&&e.exact?new RegExp(`^${r}$`):new RegExp(r,"g")),s.v6=(e=>e&&e.exact?new RegExp(`^${o}$`):new RegExp(o,"g"))},function(e,t,n){"use strict";const{ensureMultiaddr:r}=n(476),i=n(946);class o{constructor(e){this._multiaddrs=e||[],this._observedMultiaddrs=[]}add(e){e=r(e),this.has(e)||this._multiaddrs.push(e)}addSafe(e){e=r(e);const t=this._observedMultiaddrs.some((t,n)=>{if(t.equals(e))return this.add(e),this._observedMultiaddrs.splice(n,1),!0});t||this._observedMultiaddrs.push(e)}toArray(){return this._multiaddrs.slice()}get size(){return this._multiaddrs.length}forEach(e){return this._multiaddrs.forEach(e)}filterBy(e){return"object"!=typeof e||"function"!=typeof e.matches||"function"!=typeof e.partialMatch||"function"!=typeof e.toString?[]:this._multiaddrs.filter(t=>e.matches(t))}has(e){return e=r(e),this._multiaddrs.some(t=>t.equals(e))}delete(e){e=r(e),this._multiaddrs.some((t,n)=>{if(t.equals(e))return this._multiaddrs.splice(n,1),!0})}replace(e,t){Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]),e.forEach(e=>this.delete(e)),t.forEach(e=>this.add(e))}clear(){this._multiaddrs=[]}distinct(){return i(this._multiaddrs,e=>[e.toOptions().port,e.toOptions().transport].join())}}e.exports=o},function(e,t,n){"use strict";function r(e,t){var n=[],r={};if("function"!=typeof t){var i=t;t=function e(t){return t[i]}}return e.forEach(function e(i){var o=t(i);r[o]||(r[o]=!0,n.push(i))}),n}e.exports=r},function(e,t,n){"use strict";const r=n(948),i={16:"aes-128-ctr",32:"aes-256-ctr"};t.create=function(e,t,n){const o=i[e.length];if(!o)return n(new Error("Invalid key length"));const s=r.createCipheriv(o,e,t),a=r.createDecipheriv(o,e,t),u={encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}};n(null,u)}},function(e,t,n){"use strict";const r=n(949);e.exports={createCipheriv:r.createCipheriv,createDecipheriv:r.createDecipheriv}},function(e,t,n){var r=n(950),i=n(958),o=n(480);function s(){return Object.keys(o)}t.createCipher=t.Cipher=r.createCipher,t.createCipheriv=t.Cipheriv=r.createCipheriv,t.createDecipher=t.Decipher=i.createDecipher,t.createDecipheriv=t.Decipheriv=i.createDecipheriv,t.listCiphers=t.getCiphers=s},function(e,t,n){var r=n(477),i=n(481),o=n(4).Buffer,s=n(482),a=n(119),u=n(238),l=n(483),c=n(1);function f(e,t,n){a.call(this),this._cache=new p,this._cipher=new u.AES(t),this._prev=o.from(n),this._mode=e,this._autopadding=!0}c(f,a),f.prototype._update=function(e){var t,n;this._cache.add(e);for(var r=[];t=this._cache.get();)n=this._mode.encrypt(this,t),r.push(n);return o.concat(r)};var h=o.alloc(16,16);function p(){this.cache=o.allocUnsafe(0)}function d(e,t,n){var a=r[e.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=o.from(t)),t.length!==a.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof n&&(n=o.from(n)),"GCM"!==a.mode&&n.length!==a.iv)throw new TypeError("invalid iv length "+n.length);return"stream"===a.type?new s(a.module,t,n):"auth"===a.type?new i(a.module,t,n):new f(a.module,t,n)}function m(e,t){var n=r[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var i=l(t,!1,n.key,n.iv);return d(e,i.key,i.iv)}f.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(h))throw this._cipher.scrub(),new Error("data not multiple of block length")},f.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},p.prototype.add=function(e){this.cache=o.concat([this.cache,e])},p.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},p.prototype.flush=function(){for(var e=16-this.cache.length,t=o.allocUnsafe(e),n=-1;++n>i%8,e._prev=o(e._prev,n?u:l);return a}function o(e,t){var n=e.length,i=-1,o=r.allocUnsafe(e.length);for(e=r.concat([e,r.from([t])]);++i>7;return o}t.encrypt=function(e,t,n){for(var o=t.length,s=r.allocUnsafe(o),a=-1;++a>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function a(e){this.h=e,this.state=r.alloc(16,0),this.cache=r.allocUnsafe(0)}a.prototype.ghash=function(e){for(var t=-1;++t0;n--)e[n]=e[n]>>>1|(1&e[n-1])<<31;e[0]=e[0]>>>1,i&&(e[0]=e[0]^225<<24)}this.state=s(t)},a.prototype.update=function(e){var t;for(this.cache=r.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},a.prototype.final=function(e,t){return this.cache.length&&this.ghash(r.concat([this.cache,i],16)),this.ghash(s([0,e,0,t])),this.state},e.exports=a},function(e,t,n){var r=n(481),i=n(4).Buffer,o=n(477),s=n(482),a=n(119),u=n(238),l=n(483),c=n(1);function f(e,t,n){a.call(this),this._cache=new h,this._last=void 0,this._cipher=new u.AES(t),this._prev=i.from(n),this._mode=e,this._autopadding=!0}function h(){this.cache=i.allocUnsafe(0)}function p(e){var t=e[15];if(t<1||t>16)throw new Error("unable to decrypt data");for(var n=-1;++n16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},h.prototype.flush=function(){if(this.cache.length)return this.cache},t.createDecipher=m,t.createDecipheriv=d},function(e,t,n){"use strict";const r=n(461),i=n(34),o={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function s(e,t,n,s,a){const u=o[a];if(!u)throw new Error(`Hash '${a}' is unknown or not supported`);const l=r(e,t,n,s,u);return i.encode64(l)}e.exports=s},function(e,t,n){(function(e,r){var i; /** * @license * Lodash @@ -93,7 +333,7 @@ var n,i;n=this,i=function(){"use strict";var e=function(e,r){return t(e.slice(), * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */(function(){var o,s="4.17.11",a=200,u="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",f="__lodash_hash_undefined__",h=500,l="__lodash_placeholder__",d=1,p=2,g=4,m=1,b=2,y=1,v=2,_=4,w=8,S=16,E=32,k=64,x=128,C=256,A=512,I=30,T="...",O=800,R=16,B=1,P=2,M=3,N=1/0,L=9007199254740991,j=1.7976931348623157e308,D=NaN,F=4294967295,U=F-1,q=F>>>1,z=[["ary",x],["bind",y],["bindKey",v],["curry",w],["curryRight",S],["flip",A],["partial",E],["partialRight",k],["rearg",C]],H="[object Arguments]",K="[object Array]",W="[object AsyncFunction]",V="[object Boolean]",G="[object Date]",$="[object DOMException]",Y="[object Error]",J="[object Function]",X="[object GeneratorFunction]",Z="[object Map]",Q="[object Number]",ee="[object Null]",te="[object Object]",re="[object Promise]",ne="[object Proxy]",ie="[object RegExp]",oe="[object Set]",se="[object String]",ae="[object Symbol]",ue="[object Undefined]",ce="[object WeakMap]",fe="[object WeakSet]",he="[object ArrayBuffer]",le="[object DataView]",de="[object Float32Array]",pe="[object Float64Array]",ge="[object Int8Array]",me="[object Int16Array]",be="[object Int32Array]",ye="[object Uint8Array]",ve="[object Uint8ClampedArray]",_e="[object Uint16Array]",we="[object Uint32Array]",Se=/\b__p \+= '';/g,Ee=/\b(__p \+=) '' \+/g,ke=/(__e\(.*?\)|\b__t\)) \+\n'';/g,xe=/&(?:amp|lt|gt|quot|#39);/g,Ce=/[&<>"']/g,Ae=RegExp(xe.source),Ie=RegExp(Ce.source),Te=/<%-([\s\S]+?)%>/g,Oe=/<%([\s\S]+?)%>/g,Re=/<%=([\s\S]+?)%>/g,Be=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Pe=/^\w*$/,Me=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ne=/[\\^$.*+?()[\]{}|]/g,Le=RegExp(Ne.source),je=/^\s+|\s+$/g,De=/^\s+/,Fe=/\s+$/,Ue=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,qe=/\{\n\/\* \[wrapped with (.+)\] \*/,ze=/,? & /,He=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Ke=/\\(\\)?/g,We=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ve=/\w*$/,Ge=/^[-+]0x[0-9a-f]+$/i,$e=/^0b[01]+$/i,Ye=/^\[object .+?Constructor\]$/,Je=/^0o[0-7]+$/i,Xe=/^(?:0|[1-9]\d*)$/,Ze=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Qe=/($^)/,et=/['\n\r\u2028\u2029\\]/g,tt="\\ud800-\\udfff",rt="\\u0300-\\u036f",nt="\\ufe20-\\ufe2f",it="\\u20d0-\\u20ff",ot="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",st="\\u2700-\\u27bf",at="a-z\\xdf-\\xf6\\xf8-\\xff",ut="\\xac\\xb1\\xd7\\xf7",ct="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ft="\\u2000-\\u206f",ht=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",lt="A-Z\\xc0-\\xd6\\xd8-\\xde",dt="\\ufe0e\\ufe0f",pt=ut+ct+"\\u2000-\\u206f"+ht,gt="['’]",mt="[\\ud800-\\udfff]",bt="["+pt+"]",yt="["+ot+"]",vt="\\d+",_t="[\\u2700-\\u27bf]",wt="["+at+"]",St="[^"+tt+pt+vt+st+at+lt+"]",Et="\\ud83c[\\udffb-\\udfff]",kt="(?:"+yt+"|"+Et+")",xt="[^\\ud800-\\udfff]",Ct="(?:\\ud83c[\\udde6-\\uddff]){2}",At="[\\ud800-\\udbff][\\udc00-\\udfff]",It="["+lt+"]",Tt="\\u200d",Ot="(?:"+wt+"|"+St+")",Rt="(?:"+It+"|"+St+")",Bt="(?:['’](?:d|ll|m|re|s|t|ve))?",Pt="(?:['’](?:D|LL|M|RE|S|T|VE))?",Mt=kt+"?",Nt="[\\ufe0e\\ufe0f]?",Lt="(?:\\u200d(?:"+[xt,Ct,At].join("|")+")"+Nt+Mt+")*",jt="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Dt="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ft=Nt+Mt+Lt,Ut="(?:"+[_t,Ct,At].join("|")+")"+Ft,qt="(?:"+[xt+yt+"?",yt,Ct,At,mt].join("|")+")",zt=RegExp("['’]","g"),Ht=RegExp(yt,"g"),Kt=RegExp(Et+"(?="+Et+")|"+qt+Ft,"g"),Wt=RegExp([It+"?"+wt+"+"+Bt+"(?="+[bt,It,"$"].join("|")+")",Rt+"+"+Pt+"(?="+[bt,It+Ot,"$"].join("|")+")",It+"?"+Ot+"+"+Bt,It+"+"+Pt,Dt,jt,vt,Ut].join("|"),"g"),Vt=RegExp("["+Tt+tt+ot+dt+"]"),Gt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,$t=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Yt=-1,Jt={};Jt[de]=Jt[pe]=Jt[ge]=Jt[me]=Jt[be]=Jt[ye]=Jt[ve]=Jt[_e]=Jt[we]=!0,Jt[H]=Jt[K]=Jt[he]=Jt[V]=Jt[le]=Jt[G]=Jt[Y]=Jt[J]=Jt[Z]=Jt[Q]=Jt[te]=Jt[ie]=Jt[oe]=Jt[se]=Jt[ce]=!1;var Xt={};Xt[H]=Xt[K]=Xt[he]=Xt[le]=Xt[V]=Xt[G]=Xt[de]=Xt[pe]=Xt[ge]=Xt[me]=Xt[be]=Xt[Z]=Xt[Q]=Xt[te]=Xt[ie]=Xt[oe]=Xt[se]=Xt[ae]=Xt[ye]=Xt[ve]=Xt[_e]=Xt[we]=!0,Xt[Y]=Xt[J]=Xt[ce]=!1;var Zt={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},Qt={"&":"&","<":"<",">":">",'"':""","'":"'"},er={"&":"&","<":"<",">":">",""":'"',"'":"'"},tr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},rr=parseFloat,nr=parseInt,ir="object"==typeof e&&e&&e.Object===Object&&e,or="object"==typeof self&&self&&self.Object===Object&&self,sr=ir||or||Function("return this")(),ar=t&&!t.nodeType&&t,ur=ar&&"object"==typeof n&&n&&!n.nodeType&&n,cr=ur&&ur.exports===ar,fr=cr&&ir.process,hr=function(){try{var e=ur&&ur.require&&ur.require("util").types;return e||fr&&fr.binding&&fr.binding("util")}catch(e){}}(),lr=hr&&hr.isArrayBuffer,dr=hr&&hr.isDate,pr=hr&&hr.isMap,gr=hr&&hr.isRegExp,mr=hr&&hr.isSet,br=hr&&hr.isTypedArray;function yr(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function vr(e,t,r,n){for(var i=-1,o=null==e?0:e.length;++i-1}function xr(e,t,r){for(var n=-1,i=null==e?0:e.length;++n-1;);return r}function Xr(e,t){for(var r=e.length;r--&&Lr(t,e[r],0)>-1;);return r}function Zr(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}var Qr=qr(Zt),en=qr(Qt);function tn(e){return"\\"+tr[e]}function rn(e,t){return null==e?o:e[t]}function nn(e){return Vt.test(e)}function on(e){return Gt.test(e)}function sn(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}function an(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function un(e,t){return function(r){return e(t(r))}}function cn(e,t){for(var r=-1,n=e.length,i=0,o=[];++r-1}function Un(e,t){var r=this.__data__,n=ui(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function qn(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function gi(e,t,r,n,i,s){var a,u=t&d,c=t&p,f=t&g;if(r&&(a=i?r(e,n,i,s):r(e)),a!==o)return a;if(!Ef(e))return e;var h=af(e);if(h){if(a=Qs(e),!u)return rs(e,a)}else{var l=Ys(e),m=l==J||l==X;if(lf(e))return Vo(e,u);if(l==te||l==H||m&&!i){if(a=c||m?{}:ea(e),!u)return c?os(e,hi(a,e)):is(e,fi(a,e))}else{if(!Xt[l])return i?e:{};a=ta(e,l,u)}}s||(s=new Jn);var b=s.get(e);if(b)return b;if(s.set(e,a),Lf(e))return e.forEach(function(n){a.add(gi(n,t,r,n,e,s))}),a;if(xf(e))return e.forEach(function(n,i){a.set(i,gi(n,t,r,i,e,s))}),a;var y=f?c?Ds:js:c?Sh:wh,v=h?o:y(e);return _r(v||e,function(n,i){v&&(i=n,n=e[i]),ai(a,i,gi(n,t,r,i,e,s))}),a}function mi(e){var t=wh(e);return function(r){return bi(r,e,t)}}function bi(e,t,r){var n=r.length;if(null==e)return!n;for(e=tt(e);n--;){var i=r[n],s=t[i],a=e[i];if(a===o&&!(i in e)||!s(a))return!1}return!0}function yi(e,t,r){if("function"!=typeof e)throw new it(c);return Ea(function(){e.apply(o,r)},t)}function vi(e,t,r,n){var i=-1,o=kr,s=!0,u=e.length,c=[],f=t.length;if(!u)return c;r&&(t=Cr(t,Gr(r))),n?(o=xr,s=!1):t.length>=a&&(o=Yr,s=!1,t=new Gn(t));e:for(;++ii?0:i+r),n=n===o||n>i?i:Gf(n),n<0&&(n+=i),n=r>n?0:$f(n);r0&&r(a)?t>1?Ci(a,t-1,r,n,i):Ar(i,a):n||(i[i.length]=a)}return i}var Ai=cs(),Ii=cs(!0);function Ti(e,t){return e&&Ai(e,t,wh)}function Oi(e,t){return e&&Ii(e,t,wh)}function Ri(e,t){return Er(t,function(t){return _f(e[t])})}function Bi(e,t){t=zo(t,e);for(var r=0,n=t.length;null!=e&&rt}function Li(e,t){return null!=e&&ft.call(e,t)}function ji(e,t){return null!=e&&t in tt(e)}function Di(e,t,r){return e>=qt(t,r)&&e=120&&l.length>=120)?new Gn(u&&l):o}l=e[0];var d=-1,p=c[0];e:for(;++d-1;)a!==e&&xt.call(a,u,1),xt.call(e,u,1);return e}function go(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==o){var o=i;ia(i)?xt.call(e,i,1):Mo(e,i)}}return e}function mo(e,t){return e+Mt(Vt()*(t-e+1))}function bo(e,t,n,i){for(var o=-1,s=Ut(Pt((t-e)/(n||1)),0),a=r(s);s--;)a[i?s:++o]=e,e+=n;return a}function yo(e,t){var r="";if(!e||t<1||t>L)return r;do{t%2&&(r+=e),t=Mt(t/2),t&&(e+=e)}while(t);return r}function vo(e,t){return ka(ya(e,t,Tl),e+"")}function _o(e){return ni(Uh(e))}function wo(e,t){var r=Uh(e);return Aa(r,pi(t,0,r.length))}function So(e,t,r,n){if(!Ef(e))return e;t=zo(t,e);for(var i=-1,s=t.length,a=s-1,u=e;null!=u&&++io?0:o+t),n=n>o?o:n,n<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var s=r(o);++i>>1,s=e[o];null!==s&&!Df(s)&&(r?s<=t:s=a){var f=t?null:As(e);if(f)return fn(f);s=!1,i=Yr,c=new Gn}else c=t?[]:u;e:for(;++n=n?e:Co(e,t,r)}var Wo=Ot||function(e){return sr.clearTimeout(e)};function Vo(e,t){if(t)return e.slice();var r=e.length,n=wt?wt(r):new e.constructor(r);return e.copy(n),n}function Go(e){var t=new e.constructor(e.byteLength);return new _t(t).set(new _t(e)),t}function $o(e,t){var r=t?Go(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function Yo(e){var t=new e.constructor(e.source,Ve.exec(e));return t.lastIndex=e.lastIndex,t}function Jo(e){return bn?tt(bn.call(e)):{}}function Xo(e,t){var r=t?Go(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Zo(e,t){if(e!==t){var r=e!==o,n=null===e,i=e==e,s=Df(e),a=t!==o,u=null===t,c=t==t,f=Df(t);if(!u&&!f&&!s&&e>t||s&&a&&c&&!u&&!f||n&&a&&c||!r&&c||!i)return 1;if(!n&&!s&&!f&&e=a)return u;var c=r[n];return u*("desc"==c?-1:1)}}return e.index-t.index}function es(e,t,n,i){for(var o=-1,s=e.length,a=n.length,u=-1,c=t.length,f=Ut(s-a,0),h=r(c+f),l=!i;++u1?r[i-1]:o,a=i>2?r[2]:o;for(s=e.length>3&&"function"==typeof s?(i--,s):o,a&&oa(r[0],r[1],a)&&(s=i<3?o:s,i=1),t=tt(t);++n-1?i[s?t[a]:a]:o}}function ms(e){return Ls(function(t){var r=t.length,n=r,i=kn.prototype.thru;for(e&&t.reverse();n--;){var s=t[n];if("function"!=typeof s)throw new it(c);if(i&&!a&&"wrapper"==Us(s))var a=new kn([],!0)}for(n=a?n:r;++n1&&y.reverse(),l&&fu))return!1;var f=s.get(e);if(f&&s.get(t))return f==t;var h=-1,l=!0,d=r&b?new Gn:o;for(s.set(e,t),s.set(t,e);++h1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(Ue,"{\n/* [wrapped with "+t+"] */\n")}function na(e){return af(e)||sf(e)||!!(Ct&&e&&e[Ct])}function ia(e,t){var r=typeof e;return t=null==t?L:t,!!t&&("number"==r||"symbol"!=r&&Xe.test(e))&&e>-1&&e%1==0&&e0){if(++t>=O)return arguments[0]}else t=0;return e.apply(o,arguments)}}function Aa(e,t){var r=-1,n=e.length,i=n-1;for(t=t===o?n:t;++r1?e[t-1]:o;return r="function"==typeof r?(e.pop(),r):o,Mu(e,r)});function Hu(e){var t=_n(e);return t.__chain__=!0,t}function Ku(e,t){return t(e),e}function Wu(e,t){return t(e)}var Vu=Ls(function(e){var t=e.length,r=t?e[0]:0,n=this.__wrapped__,i=function(t){return di(t,e)};return!(t>1||this.__actions__.length)&&n instanceof xn&&ia(r)?(n=n.slice(r,+r+(t?1:0)),n.__actions__.push({func:Wu,args:[i],thisArg:o}),new kn(n,this.__chain__).thru(function(e){return t&&!e.length&&e.push(o),e})):this.thru(i)});function Gu(){return Hu(this)}function $u(){return new kn(this.value(),this.__chain__)}function Yu(){this.__values__===o&&(this.__values__=Wf(this.value()));var e=this.__index__>=this.__values__.length,t=e?o:this.__values__[this.__index__++];return{done:e,value:t}}function Ju(){return this}function Xu(e){for(var t,r=this;r instanceof En;){var n=Ba(r);n.__index__=0,n.__values__=o,t?i.__wrapped__=n:t=n;var i=n;r=r.__wrapped__}return i.__wrapped__=e,t}function Zu(){var e=this.__wrapped__;if(e instanceof xn){var t=e;return this.__actions__.length&&(t=new xn(this)),t=t.reverse(),t.__actions__.push({func:Wu,args:[lu],thisArg:o}),new kn(t,this.__chain__)}return this.thru(lu)}function Qu(){return jo(this.__wrapped__,this.__actions__)}var ec=ss(function(e,t,r){ft.call(e,r)?++e[r]:li(e,r,1)});function tc(e,t,r){var n=af(e)?Sr:Si;return r&&oa(e,t,r)&&(t=o),n(e,zs(t,3))}function rc(e,t){var r=af(e)?Er:xi;return r(e,zs(t,3))}var nc=gs(Ka),ic=gs(Wa);function oc(e,t){return Ci(pc(e,t),1)}function sc(e,t){return Ci(pc(e,t),N)}function ac(e,t,r){return r=r===o?1:Gf(r),Ci(pc(e,t),r)}function uc(e,t){var r=af(e)?_r:_i;return r(e,zs(t,3))}function cc(e,t){var r=af(e)?wr:wi;return r(e,zs(t,3))}var fc=ss(function(e,t,r){ft.call(e,r)?e[r].push(t):li(e,r,[t])});function hc(e,t,r,n){e=cf(e)?e:Uh(e),r=r&&!n?Gf(r):0;var i=e.length;return r<0&&(r=Ut(i+r,0)),jf(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&Lr(e,t,r)>-1}var lc=vo(function(e,t,n){var i=-1,o="function"==typeof t,s=cf(e)?r(e.length):[];return _i(e,function(e){s[++i]=o?yr(t,e,n):qi(e,t,n)}),s}),dc=ss(function(e,t,r){li(e,r,t)});function pc(e,t){var r=af(e)?Cr:no;return r(e,zs(t,3))}function gc(e,t,r,n){return null==e?[]:(af(t)||(t=null==t?[]:[t]),r=n?o:r,af(r)||(r=null==r?[]:[r]),co(e,t,r))}var mc=ss(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]});function bc(e,t,r){var n=af(e)?Ir:zr,i=arguments.length<3;return n(e,zs(t,4),r,i,_i)}function yc(e,t,r){var n=af(e)?Tr:zr,i=arguments.length<3;return n(e,zs(t,4),r,i,wi)}function vc(e,t){var r=af(e)?Er:xi;return r(e,Fc(zs(t,3)))}function _c(e){var t=af(e)?ni:_o;return t(e)}function wc(e,t,r){t=(r?oa(e,t,r):t===o)?1:Gf(t);var n=af(e)?ii:wo;return n(e,t)}function Sc(e){var t=af(e)?oi:xo;return t(e)}function Ec(e){if(null==e)return 0;if(cf(e))return jf(e)?pn(e):e.length;var t=Ys(e);return t==Z||t==oe?e.size:eo(e).length}function kc(e,t,r){var n=af(e)?Or:Ao;return r&&oa(e,t,r)&&(t=o),n(e,zs(t,3))}var xc=vo(function(e,t){if(null==e)return[];var r=t.length;return r>1&&oa(e,t[0],t[1])?t=[]:r>2&&oa(t[0],t[1],t[2])&&(t=[t[0]]),co(e,Ci(t,1),[])}),Cc=Rt||function(){return sr.Date.now()};function Ac(e,t){if("function"!=typeof t)throw new it(c);return e=Gf(e),function(){if(--e<1)return t.apply(this,arguments)}}function Ic(e,t,r){return t=r?o:t,t=e&&null==t?e.length:t,Ts(e,x,o,o,o,o,t)}function Tc(e,t){var r;if("function"!=typeof t)throw new it(c);return e=Gf(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=o),r}}var Oc=vo(function(e,t,r){var n=y;if(r.length){var i=cn(r,qs(Oc));n|=E}return Ts(e,n,t,r,i)}),Rc=vo(function(e,t,r){var n=y|v;if(r.length){var i=cn(r,qs(Rc));n|=E}return Ts(t,n,e,r,i)});function Bc(e,t,r){t=r?o:t;var n=Ts(e,w,o,o,o,o,o,t);return n.placeholder=Bc.placeholder,n}function Pc(e,t,r){t=r?o:t;var n=Ts(e,S,o,o,o,o,o,t);return n.placeholder=Pc.placeholder,n}function Mc(e,t,r){var n,i,s,a,u,f,h=0,l=!1,d=!1,p=!0;if("function"!=typeof e)throw new it(c);function g(t){var r=n,s=i;return n=i=o,h=t,a=e.apply(s,r),a}function m(e){return h=e,u=Ea(v,t),l?g(e):a}function b(e){var r=e-f,n=e-h,i=t-r;return d?qt(i,s-n):i}function y(e){var r=e-f,n=e-h;return f===o||r>=t||r<0||d&&n>=s}function v(){var e=Cc();if(y(e))return _(e);u=Ea(v,b(e))}function _(e){return u=o,p&&n?g(e):(n=i=o,a)}function w(){u!==o&&Wo(u),h=0,n=f=i=u=o}function S(){return u===o?a:_(Cc())}function E(){var e=Cc(),r=y(e);if(n=arguments,i=this,f=e,r){if(u===o)return m(f);if(d)return u=Ea(v,t),g(f)}return u===o&&(u=Ea(v,t)),a}return t=Yf(t)||0,Ef(r)&&(l=!!r.leading,d="maxWait"in r,s=d?Ut(Yf(r.maxWait)||0,t):s,p="trailing"in r?!!r.trailing:p),E.cancel=w,E.flush=S,E}var Nc=vo(function(e,t){return yi(e,1,t)}),Lc=vo(function(e,t,r){return yi(e,Yf(t)||0,r)});function jc(e){return Ts(e,A)}function Dc(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new it(c);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(Dc.Cache||qn),r}function Fc(e){if("function"!=typeof e)throw new it(c);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function Uc(e){return Tc(2,e)}Dc.Cache=qn;var qc=Ho(function(e,t){t=1==t.length&&af(t[0])?Cr(t[0],Gr(zs())):Cr(Ci(t,1),Gr(zs()));var r=t.length;return vo(function(n){for(var i=-1,o=qt(n.length,r);++i=t}),sf=zi(function(){return arguments}())?zi:function(e){return kf(e)&&ft.call(e,"callee")&&!kt.call(e,"callee")},af=r.isArray,uf=lr?Gr(lr):Hi;function cf(e){return null!=e&&Sf(e.length)&&!_f(e)}function ff(e){return kf(e)&&cf(e)}function hf(e){return!0===e||!1===e||kf(e)&&Mi(e)==V}var lf=Lt||Gl,df=dr?Gr(dr):Ki;function pf(e){return kf(e)&&1===e.nodeType&&!Pf(e)}function gf(e){if(null==e)return!0;if(cf(e)&&(af(e)||"string"==typeof e||"function"==typeof e.splice||lf(e)||Ff(e)||sf(e)))return!e.length;var t=Ys(e);if(t==Z||t==oe)return!e.size;if(ha(e))return!eo(e).length;for(var r in e)if(ft.call(e,r))return!1;return!0}function mf(e,t){return Wi(e,t)}function bf(e,t,r){r="function"==typeof r?r:o;var n=r?r(e,t):o;return n===o?Wi(e,t,o,r):!!n}function yf(e){if(!kf(e))return!1;var t=Mi(e);return t==Y||t==$||"string"==typeof e.message&&"string"==typeof e.name&&!Pf(e)}function vf(e){return"number"==typeof e&&jt(e)}function _f(e){if(!Ef(e))return!1;var t=Mi(e);return t==J||t==X||t==W||t==ne}function wf(e){return"number"==typeof e&&e==Gf(e)}function Sf(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=L}function Ef(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function kf(e){return null!=e&&"object"==typeof e}var xf=pr?Gr(pr):Gi;function Cf(e,t){return e===t||$i(e,t,Ks(t))}function Af(e,t,r){return r="function"==typeof r?r:o,$i(e,t,Ks(t),r)}function If(e){return Bf(e)&&e!=+e}function Tf(e){if(fa(e))throw new i(u);return Yi(e)}function Of(e){return null===e}function Rf(e){return null==e}function Bf(e){return"number"==typeof e||kf(e)&&Mi(e)==Q}function Pf(e){if(!kf(e)||Mi(e)!=te)return!1;var t=St(e);if(null===t)return!0;var r=ft.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&ct.call(r)==gt}var Mf=gr?Gr(gr):Ji;function Nf(e){return wf(e)&&e>=-L&&e<=L}var Lf=mr?Gr(mr):Xi;function jf(e){return"string"==typeof e||!af(e)&&kf(e)&&Mi(e)==se}function Df(e){return"symbol"==typeof e||kf(e)&&Mi(e)==ae}var Ff=br?Gr(br):Zi;function Uf(e){return e===o}function qf(e){return kf(e)&&Ys(e)==ce}function zf(e){return kf(e)&&Mi(e)==fe}var Hf=ks(ro),Kf=ks(function(e,t){return e<=t});function Wf(e){if(!e)return[];if(cf(e))return jf(e)?gn(e):rs(e);if(At&&e[At])return sn(e[At]());var t=Ys(e),r=t==Z?an:t==oe?fn:Uh;return r(e)}function Vf(e){if(!e)return 0===e?e:0;if(e=Yf(e),e===N||e===-N){var t=e<0?-1:1;return t*j}return e==e?e:0}function Gf(e){var t=Vf(e),r=t%1;return t==t?r?t-r:t:0}function $f(e){return e?pi(Gf(e),0,F):0}function Yf(e){if("number"==typeof e)return e;if(Df(e))return D;if(Ef(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ef(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(je,"");var r=$e.test(e);return r||Je.test(e)?nr(e.slice(2),r?2:8):Ge.test(e)?D:+e}function Jf(e){return ns(e,Sh(e))}function Xf(e){return e?pi(Gf(e),-L,L):0===e?e:0}function Zf(e){return null==e?"":Bo(e)}var Qf=as(function(e,t){if(ha(t)||cf(t))ns(t,wh(t),e);else for(var r in t)ft.call(t,r)&&ai(e,r,t[r])}),eh=as(function(e,t){ns(t,Sh(t),e)}),th=as(function(e,t,r,n){ns(t,Sh(t),e,n)}),rh=as(function(e,t,r,n){ns(t,wh(t),e,n)}),nh=Ls(di);function ih(e,t){var r=Sn(e);return null==t?r:fi(r,t)}var oh=vo(function(e,t){e=tt(e);var r=-1,n=t.length,i=n>2?t[2]:o;for(i&&oa(t[0],t[1],i)&&(n=1);++r1),t}),ns(e,Ds(e),r),n&&(r=gi(r,d|p|g,Bs));for(var i=t.length;i--;)Mo(r,t[i]);return r});function Ih(e,t){return Oh(e,Fc(zs(t)))}var Th=Ls(function(e,t){return null==e?{}:fo(e,t)});function Oh(e,t){if(null==e)return{};var r=Cr(Ds(e),function(e){return[e]});return t=zs(t),ho(e,r,function(e,r){return t(e,r[0])})}function Rh(e,t,r){t=zo(t,e);var n=-1,i=t.length;for(i||(i=1,e=o);++nt){var n=e;e=t,t=n}if(r||e%1||t%1){var i=Vt();return qt(e+i*(t-e+rr("1e-"+((i+"").length-1))),t)}return mo(e,t)}var Wh=ls(function(e,t,r){return t=t.toLowerCase(),e+(r?Vh(t):t)});function Vh(e){return vl(Zf(e).toLowerCase())}function Gh(e){return e=Zf(e),e&&e.replace(Ze,Qr).replace(Ht,"")}function $h(e,t,r){e=Zf(e),t=Bo(t);var n=e.length;r=r===o?n:pi(Gf(r),0,n);var i=r;return r-=t.length,r>=0&&e.slice(r,i)==t}function Yh(e){return e=Zf(e),e&&Ie.test(e)?e.replace(Ce,en):e}function Jh(e){return e=Zf(e),e&&Le.test(e)?e.replace(Ne,"\\$&"):e}var Xh=ls(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),Zh=ls(function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}),Qh=hs("toLowerCase");function el(e,t,r){e=Zf(e),t=Gf(t);var n=t?pn(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return ws(Mt(i),r)+e+ws(Pt(i),r)}function tl(e,t,r){e=Zf(e),t=Gf(t);var n=t?pn(e):0;return t&&n>>0,r?(e=Zf(e),e&&("string"==typeof t||null!=t&&!Mf(t))&&(t=Bo(t),!t&&nn(e))?Ko(gn(e),0,r):e.split(t,r)):[]}var ul=ls(function(e,t,r){return e+(r?" ":"")+vl(t)});function cl(e,t,r){return e=Zf(e),r=null==r?0:pi(Gf(r),0,e.length),t=Bo(t),e.slice(r,r+t.length)==t}function fl(e,t,r){var n=_n.templateSettings;r&&oa(e,t,r)&&(t=o),e=Zf(e),t=th({},t,n,Os);var i=th({},t.imports,n.imports,Os),s=wh(i),a=$r(i,s),u,c,f=0,h=t.interpolate||Qe,l="__p += '",d=rt((t.escape||Qe).source+"|"+h.source+"|"+(h===Re?We:Qe).source+"|"+(t.evaluate||Qe).source+"|$","g"),p="//# sourceURL="+("sourceURL"in t?t.sourceURL:"lodash.templateSources["+ ++Yt+"]")+"\n";e.replace(d,function(t,r,n,i,o,s){return n||(n=i),l+=e.slice(f,s).replace(et,tn),r&&(u=!0,l+="' +\n__e("+r+") +\n'"),o&&(c=!0,l+="';\n"+o+";\n__p += '"),n&&(l+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),f=s+t.length,t}),l+="';\n";var g=t.variable;g||(l="with (obj) {\n"+l+"\n}\n"),l=(c?l.replace(Se,""):l).replace(Ee,"$1").replace(ke,"$1;"),l="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(u?", __e = _.escape":"")+(c?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+l+"return __p\n}";var m=wl(function(){return M(s,p+"return "+l).apply(o,a)});if(m.source=l,yf(m))throw m;return m}function hl(e){return Zf(e).toLowerCase()}function ll(e){return Zf(e).toUpperCase()}function dl(e,t,r){if(e=Zf(e),e&&(r||t===o))return e.replace(je,"");if(!e||!(t=Bo(t)))return e;var n=gn(e),i=gn(t),s=Jr(n,i),a=Xr(n,i)+1;return Ko(n,s,a).join("")}function pl(e,t,r){if(e=Zf(e),e&&(r||t===o))return e.replace(Fe,"");if(!e||!(t=Bo(t)))return e;var n=gn(e),i=Xr(n,gn(t))+1;return Ko(n,0,i).join("")}function gl(e,t,r){if(e=Zf(e),e&&(r||t===o))return e.replace(De,"");if(!e||!(t=Bo(t)))return e;var n=gn(e),i=Jr(n,gn(t));return Ko(n,i).join("")}function ml(e,t){var r=I,n=T;if(Ef(t)){var i="separator"in t?t.separator:i;r="length"in t?Gf(t.length):r,n="omission"in t?Bo(t.omission):n}e=Zf(e);var s=e.length;if(nn(e)){var a=gn(e);s=a.length}if(r>=s)return e;var u=r-pn(n);if(u<1)return n;var c=a?Ko(a,0,u).join(""):e.slice(0,u);if(i===o)return c+n;if(a&&(u+=c.length-u),Mf(i)){if(e.slice(u).search(i)){var f,h=c;for(i.global||(i=rt(i.source,Zf(Ve.exec(i))+"g")),i.lastIndex=0;f=i.exec(h);)var l=f.index;c=c.slice(0,l===o?u:l)}}else if(e.indexOf(Bo(i),u)!=u){var d=c.lastIndexOf(i);d>-1&&(c=c.slice(0,d))}return c+n}function bl(e){return e=Zf(e),e&&Ae.test(e)?e.replace(xe,mn):e}var yl=ls(function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}),vl=hs("toUpperCase");function _l(e,t,r){return e=Zf(e),t=r?o:t,t===o?on(e)?vn(e):Pr(e):e.match(t)||[]}var wl=vo(function(e,t){try{return yr(e,o,t)}catch(e){return yf(e)?e:new i(e)}}),Sl=Ls(function(e,t){return _r(t,function(t){t=Ta(t),li(e,t,Oc(e[t],e))}),e});function El(e){var t=null==e?0:e.length,r=zs();return e=t?Cr(e,function(e){if("function"!=typeof e[1])throw new it(c);return[r(e[0]),e[1]]}):[],vo(function(r){for(var n=-1;++nL)return[];var r=F,n=qt(e,F);t=zs(t),e-=F;for(var i=Wr(n,t);++r0||t<0)?new xn(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==o&&(t=Gf(t),r=t<0?r.dropRight(-t):r.take(t-e)),r)},xn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},xn.prototype.toArray=function(){return this.take(F)},Ti(xn.prototype,function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),n=/^(?:head|last)$/.test(t),i=_n[n?"take"+("last"==t?"Right":""):t],s=n||/^find/.test(t);i&&(_n.prototype[t]=function(){var t=this.__wrapped__,a=n?[1]:arguments,u=t instanceof xn,c=a[0],f=u||af(t),h=function(e){var t=i.apply(_n,Ar([e],a));return n&&l?t[0]:t};f&&r&&"function"==typeof c&&1!=c.length&&(u=f=!1);var l=this.__chain__,d=!!this.__actions__.length,p=s&&!l,g=u&&!d;if(!s&&f){t=g?t:new xn(this);var m=e.apply(t,a);return m.__actions__.push({func:Wu,args:[h],thisArg:o}),new kn(m,l)}return p&&g?e.apply(this,a):(m=this.thru(h),p?n?m.value()[0]:m.value():m)})}),_r(["pop","push","shift","sort","splice","unshift"],function(e){var t=ot[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);_n.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(af(i)?i:[],e)}return this[r](function(r){return t.apply(af(r)?r:[],e)})}}),Ti(xn.prototype,function(e,t){var r=_n[t];if(r){var n=r.name+"",i=ur[n]||(ur[n]=[]);i.push({name:t,func:r})}}),ur[bs(o,v).name]=[{name:"wrapper",func:o}],xn.prototype.clone=Cn,xn.prototype.reverse=An,xn.prototype.value=In,_n.prototype.at=Vu,_n.prototype.chain=Gu,_n.prototype.commit=$u,_n.prototype.next=Yu,_n.prototype.plant=Xu,_n.prototype.reverse=Zu,_n.prototype.toJSON=_n.prototype.valueOf=_n.prototype.value=Qu,_n.prototype.first=_n.prototype.head,At&&(_n.prototype[At]=Ju),_n},wn=_n();sr._=wn,i=function(){return wn}.call(t,r,t,n),i===o||(n.exports=i)}).call(this)}).call(this,r(8),r(70)(e))},function(e,t,r){"use strict";const n=r(452).extend(r(897)),i=n.object().keys({repo:n.alternatives().try(n.object(),n.string()).allow(null),repoOwner:n.boolean().default(!0),preload:n.object().keys({enabled:n.boolean().default(!0),addresses:n.array().items(n.multiaddr().options({convert:!1})),interval:n.number().integer().default(3e4)}).allow(null),init:n.alternatives().try(n.boolean(),n.object().keys({bits:n.number().integer()})).allow(null),start:n.boolean(),local:n.boolean(),pass:n.string().allow(""),relay:n.object().keys({enabled:n.boolean(),hop:n.object().keys({enabled:n.boolean(),active:n.boolean()}).allow(null)}).allow(null),EXPERIMENTAL:n.object().keys({pubsub:n.boolean(),ipnsPubsub:n.boolean(),sharding:n.boolean(),dht:n.boolean()}).allow(null),connectionManager:n.object().allow(null),config:n.object().keys({Addresses:n.object().keys({Swarm:n.array().items(n.multiaddr().options({convert:!1})),API:n.multiaddr().options({convert:!1}),Gateway:n.multiaddr().options({convert:!1})}).allow(null),Discovery:n.object().keys({MDNS:n.object().keys({Enabled:n.boolean(),Interval:n.number().integer()}).allow(null),webRTCStar:n.object().keys({Enabled:n.boolean()}).allow(null)}).allow(null),Bootstrap:n.array().items(n.multiaddr().IPFS().options({convert:!1}))}).allow(null),libp2p:n.alternatives().try(n.func(),n.object().keys({modules:n.object().allow(null)})).allow(null)}).options({allowUnknown:!0});e.exports.validate=(e=>n.attempt(e,i))},function(e,t,r){const n=r(21),i=r(81);e.exports={name:"multiaddr",language:{invalid:"{{message}}",fmt:"must be in {{fmt}} format"},pre(e,t,r){if(null==e)return this.createError("multiaddr.invalid",{v:e,message:"addr must be a string, Buffer, or another Multiaddr"},t,r);let i;try{i=n(e)}catch(n){return this.createError("multiaddr.invalid",{v:e,message:n.message},t,r)}return r.convert?i:e},rules:Object.keys(i).map(e=>({name:e,validate(t,r,n,o){return i[e].matches(r)?r:this.createError("multiaddr.fmt",{v:r,fmt:e},n,o)}}))}},function(e,t,r){"use strict";const n=r(11),i=r(198).errors;function o(e){return!!e&&(e.code===i.ERR_REPO_NOT_INITIALIZED||!!(e.message.match(/not found/)||e.message.match(/ENOENT/)||e.message.match(/No value/)))}e.exports=(e=>{e.log("booting");const t=e._options,r=t.init,i=t.start;n([t=>{if(!e._repo.closed)return t(null,!0);e._repo.open((e,r)=>o(e)?t(null,!1):e?t(e):void t(null,!0))},(n,i)=>{if(n)return e.init({repo:e._repo},e=>{if(e)return i(Object.assign(e,{emitted:!0}));i()});if(r){const r=Object.assign({bits:2048,pass:e._options.pass},"object"==typeof t.init?t.init:{});return e.init(r,e=>{if(e)return i(Object.assign(e,{emitted:!0}));i()})}i()},t=>{if(!i)return t();e.start(e=>{if(e)return t(Object.assign(e,{emitted:!0}));t()})}],t=>{t?t.emitted||e.emit("error",t):(e.log("booted"),e.emit("ready"))})})},function(e,t,r){"use strict";t.preStart=r(900),t.start=r(915),t.stop=r(1122),t.isOnline=r(1123),t.version=r(1124),t.id=r(1125),t.repo=r(517),t.init=r(1126),t.bootstrap=r(1129),t.config=r(1130),t.block=r(1131),t.object=r(1132),t.dag=r(1133),t.libp2p=r(471),t.swarm=r(1137),t.ping=r(1140),t.pingPullStream=r(1141),t.pingReadableStream=r(1142),t.pin=r(1143),t.filesRegular=r(1150),t.filesMFS=r(1205),t.bitswap=r(548),t.pubsub=r(1253),t.dht=r(1254),t.dns=r(1257),t.key=r(1259),t.stats=r(1260),t.resolve=r(1261),t.name=r(1263)},function(e,t,r){"use strict";const n=r(20),i=r(42),o=r(21),s=r(11),a=r(453),u=r(167),c=r(914);e.exports=function e(t){return e=>{t.log("pre-start");const r=t._options.pass;s([e=>t._repo.config.get(e),(e,r)=>{if(!t._options.config)return r(null,e);e=u(t._options.config,e),t.config.replace(e,t=>{if(t)return r(t);r(null,e)})},(e,r)=>{if(e.Keychain)return r(null,e);e.Keychain=a.generateOptions(),t.config.set("Keychain",e.Keychain,n=>{t.log("using default keychain options"),r(n,e)})},(e,n)=>{if(t._keychain);else if(r){const n=Object.assign({passPhrase:r},e.Keychain);t._keychain=new a(t._repo.keys,n),t.log("keychain constructed")}else t._keychain=new c,t.log("no keychain, use --pass");n(null,e)},(e,t)=>{const r=e.Identity.PrivKey;n.createFromPrivKey(r,(r,n)=>{t(r,e,n)})},(e,n,i)=>{if(!r)return i(null,e,n);t._keychain.findKeyByName("self",r=>{if(r)return t.log('Creating "self" key'),t._keychain.importPeer("self",n,t=>i(t,e,n));i(null,e,n)})},(e,r,n)=>{t.log("peer created"),t._peerInfo=new i(r),e.Addresses&&e.Addresses.Swarm&&e.Addresses.Swarm.forEach(e=>{let r=o(e);r.getPeerId()&&(r=r.encapsulate("/ipfs/"+t._peerInfo.id.toB58String())),t._peerInfo.multiaddrs.add(r)}),n()},e=>t.pin._load(e)],e)}}},function(e,t,r){"use strict";const n=r(902),i=r(407),o=r(61),s=r(28),a=r(31),u=r(12),c=r(906),f="/pkcs8/",h="/info/",l={minKeyLength:14,minSaltLength:16,minIterationCount:1e3},d={dek:{keyLength:64,iterationCount:1e4,salt:"you should override this value with a crypto secure random number",hash:"sha2-512"}};function p(e){return!!e&&("string"==typeof e&&e===n(e.trim()))}function g(e,t){const r=200,n=1e3,i=800*Math.random()+200;"string"==typeof t&&(t=new Error(t)),setTimeout(e,i,t,null)}function m(e){return new s.Key(f+e)}function b(e){return new s.Key(h+e)}class y{constructor(e,t){if(!e)throw new Error("store is required");this.store=e;const r=i(d,t);if(!r.passPhrase||r.passPhrase.length<20)throw new Error("passPhrase must be least 20 characters");if(r.dek.keyLengthn})}get cms(){return new c(this)}static generateOptions(){const e=Object.assign({},d),t=3*Math.ceil(l.minSaltLength/3);return e.dek.salt=o.randomBytes(t).toString("base64"),e}static get options(){return d}createKey(e,t,r,n){const i=this;if(!p(e)||"self"===e)return g(n,`Invalid key name '${e}'`);if("string"!=typeof t)return g(n,`Invalid key type '${t}'`);if(!Number.isSafeInteger(r))return g(n,`Invalid key size '${r}'`);const s=m(e);i.store.has(s,(a,u)=>{if(a)return g(n,a);if(u)return g(n,`Key '${e}' already exists`);switch(t.toLowerCase()){case"rsa":if(r<2048)return g(n,`Invalid RSA key size ${r}`)}o.keys.generateKeyPair(t,r,(t,r)=>{if(t)return g(n,t);r.id((t,o)=>{if(t)return g(n,t);r.export(this._(),(t,r)=>{if(t)return g(n,t);const a={name:e,id:o},u=i.store.batch();u.put(s,r),u.put(b(e),JSON.stringify(a)),u.commit(e=>{if(e)return g(n,e);n(null,a)})})})})})}listKeys(e){const t=this,r={prefix:h};u(this.store.query(r),a((t,r)=>{if(t)return g(e,t);const n=r.map(e=>JSON.parse(e.value));e(null,n)}))}findKeyById(e,t){this.listKeys((r,n)=>{if(r)return g(t,r);const i=n.find(t=>t.id===e);t(null,i)})}findKeyByName(e,t){if(!p(e))return g(t,`Invalid key name '${e}'`);const r=b(e);this.store.get(r,(r,n)=>{if(r)return g(t,`Key '${e}' does not exist. ${r.message}`);t(null,JSON.parse(n.toString()))})}removeKey(e,t){const r=this;if(!p(e)||"self"===e)return g(t,`Invalid key name '${e}'`);const n=m(e);r.findKeyByName(e,(i,o)=>{if(i)return g(t,i);const s=r.store.batch();s.delete(n),s.delete(b(e)),s.commit(e=>{if(e)return g(t,e);t(null,o)})})}renameKey(e,t,r){const n=this;if(!p(e)||"self"===e)return g(r,`Invalid old key name '${e}'`);if(!p(t)||"self"===t)return g(r,`Invalid new key name '${t}'`);const i=m(e),o=m(t),s=b(e),a=b(t);this.store.get(i,(u,c)=>{if(u)return g(r,`Key '${e}' does not exist. ${u.message}`);const f=c.toString();n.store.has(o,(e,u)=>e?g(r,e):u?g(r,`Key '${t}' already exists`):void n.store.get(s,(e,u)=>{if(e)return g(r,e);const c=JSON.parse(u.toString());c.name=t;const h=n.store.batch();h.put(o,f),h.put(a,JSON.stringify(c)),h.delete(i),h.delete(s),h.commit(e=>{if(e)return g(r,e);r(null,c)})}))})}exportKey(e,t,r){if(!p(e))return g(r,`Invalid key name '${e}'`);if(!t)return g(r,"Password is required");const n=m(e);this.store.get(n,(n,i)=>{if(n)return g(r,`Key '${e}' does not exist. ${n.message}`);const s=i.toString();o.keys.import(s,this._(),(e,n)=>{if(e)return g(r,e);n.export(t,r)})})}importKey(e,t,r,n){const i=this;if(!p(e)||"self"===e)return g(n,`Invalid key name '${e}'`);if(!t)return g(n,"PEM encoded key is required");const s=m(e);i.store.has(s,(a,u)=>a?g(n,a):u?g(n,`Key '${e}' already exists`):void o.keys.import(t,r,(t,r)=>{if(t)return g(n,"Cannot read the key, most likely the password is wrong");r.id((t,o)=>{if(t)return g(n,t);r.export(this._(),(t,r)=>{if(t)return g(n,t);const a={name:e,id:o},u=i.store.batch();u.put(s,r),u.put(b(e),JSON.stringify(a)),u.commit(e=>{if(e)return g(n,e);n(null,a)})})})}))}importPeer(e,t,r){const n=this;if(!p(e))return g(r,`Invalid key name '${e}'`);if(!t||!t.privKey)return g(r,"Peer.privKey is required");const i=t.privKey,o=m(e);n.store.has(o,(t,s)=>t?g(r,t):s?g(r,`Key '${e}' already exists`):void i.id((t,s)=>{if(t)return g(r,t);i.export(this._(),(t,i)=>{if(t)return g(r,t);const a={name:e,id:s},u=n.store.batch();u.put(o,i),u.put(b(e),JSON.stringify(a)),u.commit(e=>{if(e)return g(r,e);r(null,a)})})}))}_getPrivateKey(e,t){if(!p(e))return g(t,`Invalid key name '${e}'`);this.store.get(m(e),(r,n)=>{if(r)return g(t,`Key '${e}' does not exist. ${r.message}`);t(null,n.toString())})}}e.exports=y},function(e,t,r){"use strict";var n=r(903),i=/[\/\?<>\\:\*\|":]/g,o=/[\x00-\x1f\x80-\x9f]/g,s=/^\.+$/,a=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,u=/[\. ]+$/;function c(e,t){var r=e.replace(i,t).replace(o,t).replace(s,t).replace(a,t).replace(u,t);return n(r,255)}e.exports=function(e,t){var r=t&&t.replacement||"",n=c(e,r);return""===r?n:c(n,"")}},function(e,t,r){"use strict";var n=r(904),i=r(905);e.exports=n.bind(null,i)},function(e,t,r){"use strict";function n(e){return e>=55296&&e<=56319}function i(e){return e>=56320&&e<=57343}e.exports=function e(t,r,o){if("string"!=typeof r)throw new Error("Input must be string");for(var s=r.length,a=0,u,c,f=0;fo)return r.slice(0,f-c.length+1)}return r}},function(e,t,r){"use strict";function n(e){return e>=55296&&e<=56319}function i(e){return e>=56320&&e<=57343}e.exports=function e(t){if("string"!=typeof t)throw new Error("Input must be string");for(var r=t.length,o=0,s=null,a=null,u=0;u=128&&s<=2047?o+=2:s>=2048&&s<=65535&&(o+=3),a=s;return o}},function(e,t,r){"use strict";(function(t){const n=r(14),i=r(35),o=r(907),s=r(11);r(908),r(281);const a=r(16),u=r(913);class c{constructor(e){if(!e)throw new Error("keychain is required");this.keychain=e}encrypt(e,r,o){const s=this,c=(e,t)=>n(()=>o(e,t));if(!t.isBuffer(r))return c(new Error("Plain data must be a Buffer"));i([t=>s.keychain.findKeyByName(e,t),t=>s.keychain._getPrivateKey(e,t)],(e,n)=>{if(e)return c(e);let i=n[0],f=n[1];try{const n=a.pki.decryptRsaPrivateKey(f,s.keychain._());u.certificateForKey(i,n,(e,n)=>{if(e)return o(e);const i=a.pkcs7.createEnvelopedData();i.addRecipient(n),i.content=a.util.createBuffer(r),i.encrypt();const s=a.asn1.toDer(i.toAsn1()).getBytes();c(null,t.from(s,"binary"))})}catch(e){c(e)}})}decrypt(e,r){const i=(e,t)=>n(()=>r(e,t));if(!t.isBuffer(e))return i(new Error("CMS data is required"));const u=this;let c;try{const t=a.util.createBuffer(e.toString("binary")),r=a.asn1.fromDer(t);c=a.pkcs7.messageFromAsn1(r)}catch(e){return i(new Error("Invalid CMS: "+e.message))}const f=c.recipients.filter(e=>e.issuer.find(e=>"O"===e.shortName&&"ipfs"===e.value)).filter(e=>e.issuer.find(e=>"CN"===e.shortName)).map(e=>({recipient:e,keyId:e.issuer.find(e=>"CN"===e.shortName).value}));o(f,(e,t)=>u.keychain.findKeyById(e.keyId,(e,r)=>t(null,!e&&r)),(e,r)=>{if(e)return i(e);if(!r){const t=f.map(e=>e.keyId);return e=new Error("Decryption needs one of the key(s): "+t.join(", ")),e.missingKeys=t,i(e)}s([e=>u.keychain.findKeyById(r.keyId,e),(e,t)=>u.keychain._getPrivateKey(e.name,t)],(e,n)=>{if(e)return i(e);const o=a.pki.decryptRsaPrivateKey(n,u.keychain._());c.decrypt(r.recipient,o),i(null,t.from(c.content.getBytes(),"binary"))})})}}e.exports=c}).call(this,r(0).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(213),i=h(n),o=r(214),s=h(o),a=r(159),u=h(a),c=r(454),f=h(c);function h(e){return e&&e.__esModule?e:{default:e}}t.default=(0,u.default)((0,s.default)(i.default,f.default)),e.exports=t.default},function(e,t,r){var n=r(16);r(210),r(129),r(282),r(164),r(283),r(909),r(130),r(29),r(455);var i=n.asn1,o=e.exports=n.pkcs7=n.pkcs7||{};function s(e){var t={},r=[];if(!i.validate(e,o.asn1.recipientInfoValidator,t,r)){var s=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw s.errors=r,s}return{version:t.version.charCodeAt(0),issuer:n.pki.RDNAttributesAsArray(t.issuer),serialNumber:n.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:i.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function a(e){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[n.pki.distinguishedNameToAsn1({attributes:e.issuer}),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(e.serialNumber))]),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.encryptedContent.algorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function u(e){for(var t=[],r=0;r0){for(var r=i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[]),o=0;o=r&&s0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,t)),o.length>0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,o)),s.value[0].value.push(i.create(i.Class.UNIVERSAL,i.Type.SET,!0,e.signerInfos)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),s])},addSigner:function(t){var r=t.issuer,i=t.serialNumber;if(t.certificate){var o=t.certificate;"string"==typeof o&&(o=n.pki.certificateFromPem(o)),r=o.issuer.attributes,i=o.serialNumber}var s=t.key;if(!s)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof s&&(s=n.pki.privateKeyFromPem(s));var a=t.digestAlgorithm||n.pki.oids.sha1;switch(a){case n.pki.oids.sha1:case n.pki.oids.sha256:case n.pki.oids.sha384:case n.pki.oids.sha512:case n.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+a)}var u=t.authenticatedAttributes||[];if(u.length>0){for(var c=!1,f=!1,h=0;h>8*h-f&255;return _=String.fromCharCode(_.charCodeAt(0)&~w)+_.substr(1),_+g+String.fromCharCode(188)},verify:function(e,o,a){var u,c=a-1,f=Math.ceil(c/8);if(o=o.substr(-f),f>8*f-c&255;if(0!=(l.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(d,h),m="";for(u=0;u{const n=i.setRsaPublicKey(t.n,t.e),o=i.createCertificate();o.publicKey=n,o.serialNumber="01",o.validity.notBefore=new Date,o.validity.notAfter=new Date,o.validity.notAfter.setFullYear(o.validity.notBefore.getFullYear()+10);const s=[{name:"organizationName",value:"ipfs"},{shortName:"OU",value:"keystore"},{name:"commonName",value:e.id}];return o.setSubject(s),o.setIssuer(s),o.setExtensions([{name:"basicConstraints",cA:!0},{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0,codeSigning:!0,emailProtection:!0,timeStamping:!0},{name:"nsCertType",client:!0,server:!0,email:!0,objsign:!0,sslCA:!0,emailCA:!0,objCA:!0}]),o.sign(t),r(null,o)})},function(e,t,r){"use strict";function n(){throw new Error("Key management requires '--pass ...' option")}class i{static get options(){n()}static generateOptions(){n()}createKey(){n()}listKeys(){n()}findKeyById(){n()}findKeyByName(){n()}renameKey(){n()}removeKey(){n()}exportKey(){n()}importKey(){n()}importPeer(){n()}get cms(){n()}}e.exports=i},function(e,t,r){"use strict";const n=r(35),i=r(916),o=r(217),s=r(14),a=r(3),{TieredDatastore:u}=r(378),c=r(464),f=r(466),h=r(467),l=r(471);e.exports=(e=>a(t=>{const r=r=>{if(r)return s(()=>e.emit("error",r)),t(r);e.state.started(),s(()=>e.emit("start")),t()};if("stopped"!==e.state.state())return r(new Error(`Not able to start from state: ${e.state.state()}`));e.log("starting"),e.state.start(),n([t=>{e._repo.closed?e._repo.open(t):t()},t=>{e._repo.config.get((r,n)=>{if(r)return t(r);const i=l(e,n);i.start(r=>{if(r)return t(r);e.libp2p=i,t()})})},t=>{const r=[];let n;if(o(e._options,"EXPERIMENTAL.ipnsPubsub",!1)){const t=e.libp2p.pubsub,i=e._repo.datastore,o=e._peerInfo.id;n=new f(t,i,o),r.push(n)}if(o(e._options,"EXPERIMENTAL.dht",!1)&&!e._options.local)r.push(e.libp2p.dht);else{const t=new h(e._repo);r.push(t)}const s=new u(r);e._ipns=new c(s,e._repo.datastore,e._peerInfo,e._keychain,e._options),e._bitswap=new i(e.libp2p,e._repo.blocks,{statsEnabled:!0}),e._bitswap.start(),e._blockService.setExchange(e._bitswap),e._preload.start(),e._ipns.republisher.start(),e._mfsPreload.start(t)}],r)}))},function(e,t,r){"use strict";const n=r(11),i=r(380),o=r(52),s=r(35),a=r(86),u=r(88),c=r(917),f=r(924),h=r(928),l=r(930),d=r(108).logger,p=r(931),g={statsEnabled:!1,statsComputeThrottleTimeout:1e3,statsComputeThrottleMaxQueueSize:1e3},m=["blocksReceived","dataReceived","dupBlksReceived","dupDataReceived","blocksSent","dataSent","providesBufferLength","wantListLength","peerCount"];class b{constructor(e,t,r){this._libp2p=e,this._log=d(this.peerInfo.id),this._options=Object.assign({},g,r),this._stats=new p(m,{enabled:this._options.statsEnabled,computeThrottleTimeout:this._options.statsComputeThrottleTimeout,computeThrottleMaxQueueSize:this._options.statsComputeThrottleMaxQueueSize}),this.network=new f(e,this,{},this._stats),this.blockstore=t,this.engine=new h(this.peerInfo.id,t,this.network,this._stats),this.wm=new c(this.peerInfo.id,this.network,this._stats),this.notifications=new l(this.peerInfo.id)}get peerInfo(){return this._libp2p.peerInfo}_receiveMessage(e,t,r){this.engine.messageReceived(e,t,n=>{if(n&&this._log("failed to receive message",t),0===t.blocks.size)return r();const i=Array.from(t.blocks.values()),s=i.filter(e=>this.wm.wantlist.contains(e.cid)).map(e=>e.cid);this.wm.cancelWants(s),o(i,(t,r)=>this._handleReceivedBlock(e,t,r),r)})}_handleReceivedBlock(e,t,r){this._log("received block"),n([e=>this.blockstore.has(t.cid,e),(r,n)=>{if(this._updateReceiveCounters(e.toB58String(),t,r),r)return u(n);this._putBlock(t,n)}],r)}_updateReceiveCounters(e,t,r){this._stats.push(e,"blocksReceived",1),this._stats.push(e,"dataReceived",t.data.length),r&&(this._stats.push(e,"dupBlksReceived",1),this._stats.push(e,"dupDataReceived",t.data.length))}_receiveError(e){this._log.error("ReceiveError: %s",e.message)}_onPeerConnected(e){this.wm.connected(e)}_onPeerDisconnected(e){this.wm.disconnected(e),this.engine.peerDisconnected(e),this._stats.disconnected(e)}_putBlock(e,t){this.blockstore.put(e,r=>{if(r)return t(r);this.notifications.hasBlock(e),this.network.provide(e.cid,e=>{e&&this._log.error("Failed to provide: %s",e.message)}),this.engine.receivedBlocks([e.cid]),t()})}enableStats(){this._stats.enable()}disableStats(){this._stats.disable()}wantlistForPeer(e){return this.engine.wantlistForPeer(e)}ledgerForPeer(e){return this.engine.ledgerForPeer(e)}get(e,t){this.getMany([e],(e,r)=>{if(e)return t(e);r&&r.length>0?t(null,r[0]):t()})}getMany(e,t){let r=e.length;const i=[];let o=!1;const s=(e,t)=>{i.push(e),this.notifications.wantBlock(e,r=>{this.wm.cancelWants([e]),t(null,r)},()=>{this.wm.cancelWants([e]),t(null,void 0)}),r||this.wm.wantBlocks(i)};a(e,(t,a)=>{n([e=>this.blockstore.has(t,e),(n,a)=>{if(r--,n)return r||this.wm.wantBlocks(i),this.blockstore.get(t,a);o||(o=!0,this.network.findAndConnect(e[0],e=>{e&&this._log.error(e)})),s(t,a)}],a)},t)}unwant(e){Array.isArray(e)||(e=[e]),this.wm.unwantBlocks(e),e.forEach(e=>this.notifications.unwantBlock(e))}cancelWants(e){Array.isArray(e)||(e=[e]),this.wm.cancelWants(e)}put(e,t){this._log("putting block"),n([t=>this.blockstore.has(e.cid,t),(t,r)=>{if(t)return u(r);this._putBlock(e,r)}],t)}putMany(e,t){n([t=>i(e,(e,t)=>{this.blockstore.has(e.cid,t)},t),(e,t)=>this.blockstore.putMany(e,r=>{if(r)return t(r);e.forEach(e=>{this.notifications.hasBlock(e),this.engine.receivedBlocks([e.cid]),this.network.provide(e.cid,e=>{e&&this._log.error("Failed to provide: %s",e.message)})}),t()})],t)}getWantlist(){return this.wm.wantlist.entries()}peers(){return this.engine.peers()}stat(){return this._stats}start(e){s([e=>this.wm.start(e),e=>this.network.start(e),e=>this.engine.start(e)],e)}stop(e){this._stats.stop(),s([e=>this.wm.stop(e),e=>this.network.stop(e),e=>this.engine.stop(e)],e)}}e.exports=b},function(e,t,r){"use strict";const n=r(88),i=r(215),o=r(216),s=r(293),a=r(923),u=r(108).logger;e.exports=class e{constructor(e,t,r){this.peers=new Map,this.wantlist=new o(r),this.network=t,this._stats=r,this._peerId=e,this._log=u(e,"want")}_addEntries(e,t,r){const n=e.map((e,r)=>new i.Entry(e,s.kMaxPriority-r,t));n.forEach(e=>{e.cancel?r?this.wantlist.removeForce(e.cid):this.wantlist.remove(e.cid):(this._log("adding to wl"),this.wantlist.add(e.cid,e.priority))});for(let e of this.peers.values())e.addEntries(n)}_startPeerHandler(e){let t=this.peers.get(e.toB58String());if(t)return void t.refcnt++;t=new a(this._peerId,e,this.network);const r=new i(!0);for(let e of this.wantlist.entries())r.addEntry(e[1].cid,e[1].priority);return t.addMessage(r),this.peers.set(e.toB58String(),t),t}_stopPeerHandler(e){const t=this.peers.get(e.toB58String());t&&(t.refcnt--,t.refcnt>0||this.peers.delete(e.toB58String()))}wantBlocks(e){this._addEntries(e,!1)}unwantBlocks(e){this._log("unwant blocks: %s",e.length),this._addEntries(e,!0,!0)}cancelWants(e){this._log("cancel wants: %s",e.length),this._addEntries(e,!0)}connectedPeers(){return Array.from(this.peers.keys())}connected(e){this._startPeerHandler(e)}disconnected(e){this._stopPeerHandler(e)}start(e){this.timer=setInterval(()=>{this._log("resend full-wantlist");const e=new i(!0);this.wantlist.forEach(t=>{e.addEntry(t.cid,t.priority)}),this.peers.forEach(t=>t.addMessage(e))},6e4),n(()=>e())}stop(e){this.peers.forEach(e=>this.disconnected(e.peerId)),clearInterval(this.timer),n(()=>e())}}},function(e,t,r){(function(e,r){var n=200,i="__lodash_hash_undefined__",o=1,s=2,a=9007199254740991,u="[object Arguments]",c="[object Array]",f="[object Boolean]",h="[object Date]",l="[object Error]",d="[object Function]",p="[object GeneratorFunction]",g="[object Map]",m="[object Number]",b="[object Object]",y="[object Promise]",v="[object RegExp]",_="[object Set]",w="[object String]",S="[object Symbol]",E="[object WeakMap]",k="[object ArrayBuffer]",x="[object DataView]",C="[object Float32Array]",A="[object Float64Array]",I="[object Int8Array]",T="[object Int16Array]",O="[object Int32Array]",R="[object Uint8Array]",B="[object Uint8ClampedArray]",P="[object Uint16Array]",M="[object Uint32Array]",N=/[\\^$.*+?()[\]{}|]/g,L=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,D={};D[C]=D[A]=D[I]=D[T]=D[O]=D[R]=D[B]=D[P]=D[M]=!0,D[u]=D[c]=D[k]=D[f]=D[x]=D[h]=D[l]=D[d]=D[g]=D[m]=D[b]=D[v]=D[_]=D[w]=D[E]=!1;var F="object"==typeof e&&e&&e.Object===Object&&e,U="object"==typeof self&&self&&self.Object===Object&&self,q=F||U||Function("return this")(),z=t&&!t.nodeType&&t,H=z&&"object"==typeof r&&r&&!r.nodeType&&r,K=H&&H.exports===z,W=K&&F.process,V=function(){try{return W&&W.binding("util")}catch(e){}}(),G=V&&V.isTypedArray;function $(e,t){for(var r=-1,n=e?e.length:0;++r-1}function qe(e,t){var r=this.__data__,n=it(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function ze(e){var t=-1,r=e?e.length:0;for(this.clear();++tc))return!1;var h=a.get(e);if(h&&a.get(t))return h==t;var l=-1,d=!0,p=i&o?new $e:void 0;for(a.set(e,t),a.set(t,e);++l-1&&e%1==0&&e-1&&e%1==0&&e<=a}function Ot(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Rt(e){return!!e&&"object"==typeof e}var Bt=G?J(G):ct;function Pt(e){return xt(e)?nt(e):ft(e)}r.exports=At}).call(this,r(8),r(70)(e))},function(e,t,r){"use strict";(function(t){const n=r(34);e.exports=(e=>{if(!t.isBuffer(e))throw new Error("arg needs to be a buffer");let r=[];for(;e.length>0;){const t=n.decode(e);r.push(t),e=e.slice(n.decode.bytes)}return r})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports="\n message Message {\n message Wantlist {\n message Entry {\n // changed from string to bytes, it makes a difference in JavaScript\n optional bytes block = 1; // the block cid (cidV0 in bitswap 1.0.0, cidV1 in bitswap 1.1.0)\n optional int32 priority = 2; // the priority (normalized). default to 1\n optional bool cancel = 3; // whether this revokes an entry\n }\n\n repeated Entry entries = 1; // a list of wantlist entries\n optional bool full = 2; // whether this is the full wantlist. default to false\n }\n\n message Block {\n optional bytes prefix = 1; // CID prefix (cid version, multicodec and multihash prefix (type + length)\n optional bytes data = 2;\n }\n\n optional Wantlist wantlist = 1;\n repeated bytes blocks = 2; // used to send Blocks in bitswap 1.0.0\n repeated Block payload = 3; // used to send Blocks in bitswap 1.1.0\n }\n"},function(e,t,r){"use strict";const n=r(216).Entry,i=r(9),o=r(27);e.exports=class e{constructor(e,t,r){o(i.isCID(e),"needs valid cid"),this.entry=new n(e,t),this.cancel=Boolean(r)}get cid(){return this.entry.cid}set cid(e){this.entry.cid=e}get priority(){return this.entry.priority}set priority(e){this.entry.priority=e}get[Symbol.toStringTag](){const e=this.cid.toBaseEncodedString();return`BitswapMessageEntry ${e} `}equals(e){return this.cancel===e.cancel&&this.entry.equals(e.entry)}}},function(e,t,r){"use strict";const n=r(27),i=r(9);class o{constructor(e,t){n(i.isCID(e),"must be valid CID"),this._refCounter=1,this.cid=e,this.priority=t||1}inc(){this._refCounter+=1}dec(){this._refCounter=Math.max(0,this._refCounter-1)}hasRefs(){return this._refCounter>0}get[Symbol.toStringTag](){const e=this.cid.toBaseEncodedString();return`WantlistEntry `}equals(e){return this._refCounter===e._refCounter&&this.cid.equals(e.cid)&&this.priority===e.priority}}e.exports=o},function(e,t,r){"use strict";const n=r(456),i=r(215),o=r(108).logger;e.exports=class e{constructor(e,t,r){this.peerId=t,this.network=r,this.refcnt=1,this._entries=[],this._log=o(e,"msgqueue",t.toB58String().slice(0,8)),this.sendEntries=n(this._sendEntries.bind(this),200)}addMessage(e){e.empty||this.send(e)}addEntries(e){this._entries=this._entries.concat(e),this.sendEntries()}_sendEntries(){if(!this._entries.length)return;const e=new i(!1);this._entries.forEach(t=>{t.cancel?e.cancel(t.cid):e.addEntry(t.cid,t.priority)}),this._entries=[],this.addMessage(e)}send(e){this.network.connectTo(this.peerId,t=>{t?this._log.error("cant connect to peer %s: %s",this.peerId.toB58String(),t.message):(this._log("sending message"),this.network.sendMessage(this.peerId,e,e=>{e&&this._log.error("send error: %s",e.message)}))})}}},function(e,t,r){"use strict";const n=r(62),i=r(18),o=r(11),s=r(52),a=r(88),u=r(215),c=r(293),f=r(108).logger,h="/ipfs/bitswap/1.0.0",l="/ipfs/bitswap/1.1.0";class d{constructor(e,t,r,n){this._log=f(e.peerInfo.id,"network"),r=r||{},this.libp2p=e,this.bitswap=t,this.b100Only=r.b100Only||!1,this._stats=n,this._running=!1}start(e){this._running=!0,this._onPeerConnect=this._onPeerConnect.bind(this),this._onPeerDisconnect=this._onPeerDisconnect.bind(this),this._onConnection=this._onConnection.bind(this),this.libp2p.handle(h,this._onConnection),this.b100Only||this.libp2p.handle(l,this._onConnection),this.libp2p.on("peer:connect",this._onPeerConnect),this.libp2p.on("peer:disconnect",this._onPeerDisconnect),this.libp2p.peerBook.getAllArray().filter(e=>e.isConnected()).forEach(e=>this._onPeerConnect(e)),a(()=>e())}stop(e){this._running=!1,this.libp2p.unhandle(h),this.b100Only||this.libp2p.unhandle(l),this.libp2p.removeListener("peer:connect",this._onPeerConnect),this.libp2p.removeListener("peer:disconnect",this._onPeerDisconnect),a(()=>e())}_onConnection(e,t){this._running&&(this._log("incomming new bitswap connection: %s",e),i(t,n.decode(),i.asyncMap((e,t)=>u.deserialize(e,t)),i.asyncMap((e,r)=>{t.getPeerInfo((t,n)=>{if(t)return r(t);this.bitswap._receiveMessage(n.id,e,r)})}),i.onEnd(e=>{this._log("ending connection"),e&&this.bitswap._receiveError(e)})))}_onPeerConnect(e){this._running&&this.bitswap._onPeerConnected(e.id)}_onPeerDisconnect(e){this._running&&this.bitswap._onPeerDisconnected(e.id)}findProviders(e,t,r){this.libp2p.contentRouting.findProviders(e,{maxTimeout:c.providerRequestTimeout,maxNumProviders:t},r)}findAndConnect(e,t){o([t=>this.findProviders(e,c.maxProvidersPerRequest,t),(e,t)=>{this._log("connecting to providers",e.map(e=>e.id.toB58String())),s(e,(e,t)=>this.connectTo(e,t))}],t)}provide(e,t){this.libp2p.contentRouting.provide(e,t)}sendMessage(e,t,r){if(!this._running)return r(new Error("network isn't running"));const n=e.toB58String()?e.toB58String():e.id.toB58String();this._log("sendMessage to %s",n,t),this._dialPeer(e,(n,i,o)=>{if(n)return r(n);let s;switch(o){case h:s=t.serializeToBitswap100();break;case l:s=t.serializeToBitswap110();break;default:return r(new Error("Unkown protocol: "+o))}p(i,s,e=>{e&&this._log.error(e)}),r(),this._updateSentStats(e,t.blocks)})}connectTo(e,t){if(!this._running)return t(new Error("network isn't running"));this.libp2p.dial(e,t)}_dialPeer(e,t){this.libp2p.dialProtocol(e,l,(r,n)=>{r?this.libp2p.dialProtocol(e,h,(e,r)=>{if(e)return t(e);t(null,r,h)}):t(null,n,l)})}_updateSentStats(e,t){const r=e.toB58String();this._stats&&(t.forEach(e=>this._stats.push(r,"dataSent",e.data.length)),this._stats.push(r,"blocksSent",t.size))}}function p(e,t,r){i(i.values([t]),n.encode(),e,i.onEnd(r))}e.exports=d},function(e,t,r){"use strict";const n=r(4).Buffer;e.exports=o;const i=10240;function o(e){e=Object.assign({fixed:!1},e||{});const t=r(34);let i=e.fixed?null:s(),o=0,a=!1;return r=>(u,c)=>{if(u&&(a=u),a)return c(a);r(null,(r,u)=>{if(r&&(a=r),a)return c(a);if(!n.isBuffer(u))return a=new Error("data must be a buffer"),c(a);let f;e.fixed?(f=n.alloc(4),f.writeInt32BE(u.length,0)):(t.encode(u.length,i,o),o+=t.encode.bytes,f=i.slice(o-t.encode.bytes,o),i.length-o<100&&(i=s(),o=0)),c(null,n.concat([f,u]))})}}function s(){return n.alloc(i)}},function(e,t,r){"use strict";const n=r(34),i=r(457),o=r(4).Buffer,s=r(63);t.decode=f,t.decodeFromReader=h;const a=128,u=e=>!(128&e),c=4194304;function f(e){let t=new i,r=s(e=>{t.abort(e)});return n=>{function i(){l(t,e,(e,t)=>{if(e)return r.end(e);r.push(t),i()})}return t(n),i(),r}}function h(e,t,r){"function"==typeof t&&(r=t,t={}),l(e,t,function e(t,n){if(t)return r(!0===t?new Error("Unexpected end of input from reader."):t);r(null,n)})}function l(e,t,r){t=Object.assign({fixed:!1,maxLength:c},t||{}),t.fixed?d(e,t.maxLength,r):p(e,t.maxLength,r)}function d(e,t,r){e.read(4,(n,i)=>{if(n)return r(n);const o=i.readInt32BE(0);if(o>t)return r(new Error("size longer than max permitted length of "+t+"!"));g(e,o,r)})}function p(e,t,r){let i=[];function s(){e.read(1,(a,c)=>{if(a)return r(a);if(i.push(c),c&&!u(c[0]))return void s();const f=n.decode(o.concat(i));if(f>t)return r(new Error("size longer than max permitted length of "+t+"!"));g(e,f,(e,t)=>e?r(e):(i=[],t.length{if(e)return r(e);r(null,t)})}},function(e,t,r){(function(t){e.exports=function(){var e=[],r=0;function n(){return e.reduce(function(e,t){return e+t.length},0)}return{length:r,data:this,add:function(n){if(!t.isBuffer(n))throw new Error("data must be a buffer, was: "+JSON.stringify(n));return this.length=r+=n.length,e.push(n),this},has:function(e){return null==e?r>0:r>=e},get:function(n){var i;if(null==n||n===r){r=0;var o=e;return e=[],1==o.length?o[0]:t.concat(o)}if(e.length>1&&n<=(i=e[0].length)){var s=e[0].slice(0,n);return n===i?e.shift():e[0]=e[0].slice(n,i),r-=n,s}if(ne+t.data.byteLength,0);if(n{if(u--,a.push(t),o+=t.data.byteLength,o>=m||0===u){o=0;const t=a.slice();a=[],this._sendSafeBlocks(e,t,e=>{e&&this._log("sendblock error: %s",e.message),r()})}else s(r)},r)}_sendSafeBlocks(e,t,r){const n=new c(!1);t.forEach(e=>n.addBlock(e)),this.network.sendMessage(e,n,r)}_processTasks(){if(!this._running||!this._tasks.length)return;const e=this._tasks;this._tasks=[];const t=e.map(e=>e.entry),r=t.map(e=>e.cid),i=g((e,t)=>e.equals(t),r),s=d(e=>e.target.toB58String(),e);o([e=>a(i,(e,t)=>{this.blockstore.get(e,t)},e),(e,t)=>n(Object.values(s),(t,n)=>{const i=t[0].target,o=r.map(t=>e.find(e=>e.cid.equals(t)));this._sendBlocks(i,o,e=>{e?this._log.error("should never happen: ",e):o.forEach(e=>this.messageSent(i,e)),n()})},t)],e=>{this._tasks=[],e&&this._log.error(e)})}wantlistForPeer(e){const t=e.toB58String();return this.ledgerMap.has(t)?this.ledgerMap.get(t).wantlist.sortedEntries():new Map}ledgerForPeer(e){const t=e.toB58String(),r=this.ledgerMap.get(t);return r?{peer:r.partner.toPrint(),value:r.debtRatio(),sent:r.accounting.bytesSent,recv:r.accounting.bytesRecv,exchanged:r.exchangeCount}:null}peers(){return Array.from(this.ledgerMap.values()).map(e=>e.partner)}receivedBlocks(e){e.length&&(this.ledgerMap.forEach(t=>{e.map(e=>t.wantlistContains(e)).filter(Boolean).forEach(e=>{this._tasks.push({entry:e,target:t.partner})})}),this._outbox())}messageReceived(e,t,r){const n=this._findOrCreate(e);if(t.empty)return s(r);if(t.full&&(n.wantlist=new f),this._processBlocks(t.blocks,n),0===t.wantlist.size)return s(r);let i=[],o=[];t.wantlist.forEach(e=>{e.cancel?(n.cancelWant(e.cid),i.push(e)):(n.wants(e.cid,e.priority),o.push(e))}),this._cancelWants(n,e,i),this._addWants(n,e,o,r)}_cancelWants(e,t,r){const n=t.toB58String();this._tasks=p((e,t)=>{const r=e.target.toB58String()===n,i=e.entry.cid.equals(t.cid);return r&&i},this._tasks,r)}_addWants(e,t,r,i){n(r,(e,r)=>{this.blockstore.has(e.cid,(n,i)=>{n?this._log.error("failed existence check"):i&&this._tasks.push({entry:e.entry,target:t}),r()})},()=>{this._outbox(),i()})}_processBlocks(e,t,r){const n=[];e.forEach((e,r)=>{this._log("got block (%s bytes)",e.data.length),t.receivedBytes(e.data.length),n.push(e.cid)}),this.receivedBlocks(n)}messageSent(e,t){const r=this._findOrCreate(e);r.sentBytes(t?t.data.length:0),t&&t.cid&&r.wantlist.remove(t.cid)}numBytesSentTo(e){return this._findOrCreate(e).accounting.bytesSent}numBytesReceivedFrom(e){return this._findOrCreate(e).accounting.bytesRecv}peerDisconnected(e){}_findOrCreate(e){const t=e.toB58String();if(this.ledgerMap.has(t))return this.ledgerMap.get(t);const r=new h(e);return this.ledgerMap.set(t,r),this._stats&&this._stats.push(t,"peerCount",1),r}start(e){this._running=!0,s(()=>e())}stop(e){this._running=!1,s(()=>e())}}e.exports=b},function(e,t,r){"use strict";const n=r(216);class i{constructor(e){this.partner=e,this.wantlist=new n,this.exchangeCount=0,this.sentToPeer=new Map,this.accounting={bytesSent:0,bytesRecv:0}}sentBytes(e){this.exchangeCount++,this.lastExchange=(new Date).getTime(),this.accounting.bytesSent+=e}receivedBytes(e){this.exchangeCount++,this.lastExchange=(new Date).getTime(),this.accounting.bytesRecv+=e}wants(e,t){this.wantlist.add(e,t)}cancelWant(e){this.wantlist.remove(e)}wantlistContains(e){return this.wantlist.contains(e)}debtRatio(){return this.accounting.bytesSent/(this.accounting.bytesRecv+1)}}e.exports=i},function(e,t,r){"use strict";const n=r(7).EventEmitter,i=r(293),o=r(108).logger,s=e=>`unwant:${e}`,a=e=>`block:${e}`;class u extends n{constructor(e){super(),this.setMaxListeners(i.maxListeners),this._log=o(e,"notif"),this._unwantListeners={},this._blockListeners={}}hasBlock(e){const t=`block:${e.cid.buffer.toString()}`;this._log(t),this.emit(t,e)}wantBlock(e,t,r){const n=e.buffer.toString();this._log(`wantBlock:${n}`),this._unwantListeners[n]=(()=>{this._log(`manual unwant: ${n}`),this._cleanup(n),r()}),this._blockListeners[n]=(e=>{this._cleanup(n),t(e)}),this.once(s(n),this._unwantListeners[n]),this.once(a(n),this._blockListeners[n])}unwantBlock(e){const t=`unwant:${e.buffer.toString()}`;this._log(t),this.emit(t)}_cleanup(e){this._unwantListeners[e]&&(this.removeListener(s(e),this._unwantListeners[e]),delete this._unwantListeners[e]),this._blockListeners[e]&&(this.removeListener(a(e),this._blockListeners[e]),delete this._blockListeners[e])}}e.exports=u},function(e,t,r){"use strict";const n=r(7),i=r(932),o={movingAverageIntervals:[6e4,3e5,9e5]};class s extends n{constructor(e,t){super();const r=Object.assign({},o,t);if("number"!=typeof r.computeThrottleTimeout)throw new Error("need computeThrottleTimeout");if("number"!=typeof r.computeThrottleMaxQueueSize)throw new Error("need computeThrottleMaxQueueSize");this._initialCounters=e,this._options=r,this._enabled=this._options.enabled,this._global=new i(e,r),this._global.on("update",e=>this.emit("update",e)),this._peers=new Map}enable(){this._enabled=!0,this._options.enabled=!0,this._global.enable()}disable(){this._enabled=!1,this._options.enabled=!1,this._global.disable()}stop(){this._enabled=!1,this._global.stop();for(let e of this._peers)e[1].stop()}get snapshot(){return this._global.snapshot}get movingAverages(){return this._global.movingAverages}forPeer(e){return e.toB58String&&(e=e.toB58String()),this._peers.get(e)}push(e,t,r){if(this._enabled&&(this._global.push(t,r),e)){let n=this._peers.get(e);n||(n=new i(this._initialCounters,this._options),this._peers.set(e,n)),n.push(t,r)}}disconnected(e){const t=e.toB58String(),r=this._peers.get(t);r&&(r.stop(),this._peers.delete(t))}}e.exports=s},function(e,t,r){"use strict";const n=r(7),i=r(54),o=r(459);class s extends n{constructor(e,t){super(),this._options=t,this._queue=[],this._stats={},this._frequencyLastTime=Date.now(),this._frequencyAccumulators={},this._movingAverages={},this._update=this._update.bind(this),e.forEach(e=>{this._stats[e]=i(0),this._movingAverages[e]={},this._options.movingAverageIntervals.forEach(t=>{const r=this._movingAverages[e][t]=o(t);r.push(this._frequencyLastTime,0)})}),this._enabled=this._options.enabled}enable(){this._enabled=!0}disable(){this._disabled=!0}stop(){this._timeout&&clearTimeout(this._timeout)}get snapshot(){return Object.assign({},this._stats)}get movingAverages(){return Object.assign({},this._movingAverages)}push(e,t){this._enabled&&(this._queue.push([e,t,Date.now()]),this._resetComputeTimeout())}_resetComputeTimeout(){this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout(this._update,this._nextTimeout())}_nextTimeout(){const e=this._queue.length/this._options.computeThrottleMaxQueueSize;return Math.max(this._options.computeThrottleTimeout*(1-e),0)}_update(){if(this._timeout=null,this._queue.length){let e;for(;this._queue.length;){const t=e=this._queue.shift();this._applyOp(t)}this._updateFrequency(e[2]),this.emit("update",this._stats)}}_updateFrequency(e){const t=e-this._frequencyLastTime;Object.keys(this._stats).forEach(r=>{this._updateFrequencyFor(r,t,e)}),this._frequencyLastTime=e}_updateFrequencyFor(e,t,r){const n=this._frequencyAccumulators[e]||0;this._frequencyAccumulators[e]=0;const i=n/t*1e3;let s=this._movingAverages[e];s||(s=this._movingAverages[e]={}),this._options.movingAverageIntervals.forEach(e=>{let t=s[e];t||(t=s[e]=o(e)),t.push(r,i)})}_applyOp(e){const t=e[0],r=e[1];if("number"!=typeof r)throw new Error("invalid increment number:",r);let n;n=this._stats.hasOwnProperty(t)?this._stats[t]:this._stats[t]=i(0),this._stats[t]=n.plus(r),this._frequencyAccumulators[t]||(this._frequencyAccumulators[t]=0),this._frequencyAccumulators[t]+=r}}e.exports=s},function(e,t,r){var n=r(934),i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,o=/\\(\\)?/g,s=n(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(i,function(e,r,n,i){t.push(n?i.replace(o,"$1"):r||e)}),t});e.exports=s},function(e,t,r){var n=r(935),i=500;function o(e){var t=n(e,function(e){return r.size===i&&r.clear(),e}),r=t.cache;return t}e.exports=o},function(e,t,r){var n=r(296),i="Expected a function";function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(i);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(o.Cache||n),r}o.Cache=n,e.exports=o},function(e,t,r){var n=r(937),i=r(219),o=r(297);function s(){this.size=0,this.__data__={hash:new n,map:new(o||i),string:new n}}e.exports=s},function(e,t,r){var n=r(938),i=r(943),o=r(944),s=r(945),a=r(946);function u(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t-1}e.exports=i},function(e,t,r){var n=r(220);function i(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}e.exports=i},function(e,t,r){var n=r(221);function i(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}e.exports=i},function(e,t){function r(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}e.exports=r},function(e,t,r){var n=r(221);function i(e){return n(this,e).get(e)}e.exports=i},function(e,t,r){var n=r(221);function i(e){return n(this,e).has(e)}e.exports=i},function(e,t,r){var n=r(221);function i(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}e.exports=i},function(e,t,r){var n=r(161),i=r(271),o=r(65),s=r(295),a=1/0,u=n?n.prototype:void 0,c=u?u.toString:void 0;function f(e){if("string"==typeof e)return e;if(o(e))return i(e,f)+"";if(s(e))return c?c.call(e):"";var t=e+"";return"0"==t&&1/e==-a?"-0":t}e.exports=f},function(e,t,r){"use strict";e.exports=a;var n=r(71),i=a.prototype,o=new Date%1e9;function s(){return(1e9*Math.random()>>>0)+o++}function a(e){e=e||{},this.id=e.id||s(),this.max=e.max||1/0,this.items=e.items||[],this._lookup={},this.size=this.items.length,this.lastModified=new Date(e.lastModified||new Date);for(var t,r,n=this.items.length;n--;)t=this.items[n],r=new Date(t.expires)-new Date,this._lookup[t.key]=t,r>0?this.expire(t.key,r):r<=0&&this.delete(t.key)}i.has=function(e){return e in this._lookup},i.get=function(e){if(!this.has(e))return null;var t=this._lookup[e];return t.refresh&&this.expire(e,t.refresh),this.items.splice(this.items.indexOf(t),1),this.items.push(t),t.value},i.meta=function(e){if(!this.has(e))return null;var t=this._lookup[e];return"meta"in t?t.meta:null},i.set=function(e,t,r){var n=this._lookup[e],i=this._lookup[e]={key:e,value:t};return this.lastModified=new Date,n?(clearTimeout(n.timeout),this.items.splice(this.items.indexOf(n),1,i)):(this.size>=this.max&&this.delete(this.items[0].key),this.items.push(i),this.size++),r&&("ttl"in r&&this.expire(e,r.ttl),"meta"in r&&(i.meta=r.meta),r.refresh&&(i.refresh=r.ttl)),this},i.delete=function(e){var t=this._lookup[e];return!!t&&(this.lastModified=new Date,this.items.splice(this.items.indexOf(t),1),clearTimeout(t.timeout),delete this._lookup[e],this.size--,this)},i.expire=function(e,t){var r=t||0,i=this._lookup[e];if(!i)return this;if("string"==typeof r&&(r=n(t)),"number"!=typeof r)throw new TypeError("Expiration time must be a string or number.");return clearTimeout(i.timeout),i.timeout=setTimeout(this.delete.bind(this,i.key),r),i.expires=Number(new Date)+r,this},i.clear=function(){for(var e=this.items.length;e--;)this.delete(this.items[e].key);return this},i.toJSON=function(){for(var e=new Array(this.items.length),t,r=e.length;r--;)t=this.items[r],e[r]={key:t.key,meta:t.meta,value:t.value,expires:t.expires,refresh:t.refresh};return{id:this.id,max:isFinite(this.max)?this.max:void 0,lastModified:this.lastModified,items:e}}},function(e,t,r){"use strict";const n=r(20),{Key:i}=r(28),o=r(35),s=r(19),a=r(6),u=a("jsipfs:ipns:publisher");u.error=a("jsipfs:ipns:publisher:error");const c=r(168),f=36e5;class h{constructor(e,t){this._routing=e,this._datastore=t}publishWithEOL(e,t,r,i){if(!e||!e.bytes){const e="one or more of the provided parameters are not defined";return u.error(e),i(s(new Error(e),"ERR_UNDEFINED_PARAMETER"))}n.createFromPrivKey(e.bytes,(n,o)=>{if(n)return i(n);this._updateOrCreateRecord(e,t,r,o,(e,t)=>{if(e)return i(e);this._putRecordToRouting(t,o,i)})})}publish(e,t,r){this.publishWithEOL(e,t,f,r)}_putRecordToRouting(e,t,r){if(!n.isPeerId(t)){const e="peerId received is not valid";return u.error(e),r(s(new Error(e),"ERR_INVALID_PEER_ID"))}const i=t._pubKey;c.embedPublicKey(i,e,(n,s)=>{if(n)return r(n);let a;try{a=c.getIdKeys(t.toBytes())}catch(n){return u.error(n),r(n)}o([r=>this._publishEntry(a.routingKey,s||e,t,r),e=>this._publishPublicKey(a.routingPubKey,i,t,e)],t=>{if(t)return u.error(t),r(t);r(null,s||e)})})}_publishEntry(e,t,r,n){if(!i.isKey(e)){const e="datastore key does not have a valid format";return u.error(e),n(s(new Error(e),"ERR_INVALID_DATASTORE_KEY"))}let o;try{o=c.marshal(t)}catch(e){return u.error(e),n(e)}this._routing.put(e.toBuffer(),o,(t,r)=>{if(t){const t=`ipns record for ${e.toString()} could not be stored in the routing`;return u.error(t),n(s(new Error(t),"ERR_PUTTING_TO_ROUTING"))}u(`ipns record for ${e.toString()} was stored in the routing`),n(null,r)})}_publishPublicKey(e,t,r,n){if(!i.isKey(e)){const e="datastore key does not have a valid format";return u.error(e),n(s(new Error(e),"ERR_INVALID_DATASTORE_KEY"))}if(!t||!t.bytes){const e="one or more of the provided parameters are not defined";return u.error(e),n(s(new Error(e),"ERR_UNDEFINED_PARAMETER"))}this._routing.put(e.toBuffer(),t.bytes,(t,r)=>{if(t){const t=`public key for ${e.toString()} could not be stored in the routing`;return u.error(t),n(s(new Error(t),"ERR_PUTTING_TO_ROUTING"))}u(`public key for ${e.toString()} was stored in the routing`),n(null,r)})}_getPublished(e,t,r){if(!n.isPeerId(e)){const e="peerId received is not valid";return u.error(e),r(s(new Error(e),"ERR_INVALID_PEER_ID"))}t=t||{};const i=!1!==t.checkRouting;this._datastore.get(c.getLocalKey(e.id),(t,n)=>{if(t){if("ERR_NOT_FOUND"!==t.code){const t=`unexpected error getting the ipns record ${e.id} from datastore`;return u.error(t),r(s(new Error(t),"ERR_UNEXPECTED_DATASTORE_RESPONSE"))}if(!i)return r(s(t));let n;try{n=c.getIdKeys(e.toBytes())}catch(t){return u.error(t),r(t)}this._routing.get(n.routingKey.toBuffer(),(e,t)=>{if(e)return r(e);this._unmarshalData(t,r)})}else this._unmarshalData(n,r)})}_unmarshalData(e,t){let r;try{r=c.unmarshal(e)}catch(e){return u.error(e),t(s(e,"ERR_INVALID_RECORD_DATA"))}t(null,r)}_updateOrCreateRecord(e,t,r,i,o){if(!n.isPeerId(i)){const e="peerId received is not valid";return u.error(e),o(s(new Error(e),"ERR_INVALID_PEER_ID"))}const a={checkRouting:!0};this._getPublished(i,a,(n,a)=>{if(n&&"ERR_NOT_FOUND"!==n.code){const e=`unexpected error when determining the last published IPNS record for ${i.id}`;return u.error(e),o(s(new Error(e),"ERR_DETERMINING_PUBLISHED_RECORD"))}let f=0;a&&void 0!==a.sequence&&(f=a.value.toString()!==t?a.sequence+1:a.sequence),c.create(e,t,f,r,(e,r)=>{if(e){const e=`ipns record for ${t} could not be created`;return u.error(e),o(s(new Error(e),"ERR_CREATING_IPNS_RECORD"))}const n=c.marshal(r);this._datastore.put(c.getLocalKey(i.id),n,(e,n)=>{if(e){const e=`ipns record for ${t} could not be stored in the datastore`;return u.error(e),o(s(new Error(e),"ERR_STORING_IN_DATASTORE"))}u(`ipns record for ${t} was stored in the datastore`),o(null,r)})})})}}t=e.exports=h},function(e,t){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",n="0123456789ABCDEFGHIJKLMNOPQRSTUV",i="0123456789ABCDEFGHJKMNPQRSTVWXYZ";e.exports=function e(t,o,s){var a,u;switch(s=s||{},o){case"RFC3548":case"RFC4648":a=r,u=!0;break;case"RFC4648-HEX":a=n,u=!0;break;case"Crockford":a=i,u=!1;break;default:throw new Error("Unknown base32 variant: "+o)}for(var c=void 0!==s.padding?s.padding:u,f=t.byteLength,h=new Uint8Array(t),l=0,d=0,p="",g=0;g=5;)p+=a[d>>>l-5&31],l-=5;if(l>0&&(p+=a[d<<5-l&31]),c)for(;p.length%8!=0;)p+="=";return p}},function(e,t,r){ + */(function(){var o,s="4.17.11",a=200,u="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",l="Expected a function",c="__lodash_hash_undefined__",f=500,h="__lodash_placeholder__",p=1,d=2,m=4,g=1,y=2,b=1,v=2,_=4,w=8,k=16,S=32,E=64,x=128,C=256,A=512,I=30,T="...",j=800,O=16,P=1,B=2,R=3,N=1/0,M=9007199254740991,L=1.7976931348623157e308,F=NaN,D=4294967295,U=D-1,z=D>>>1,q=[["ary",x],["bind",b],["bindKey",v],["curry",w],["curryRight",k],["flip",A],["partial",S],["partialRight",E],["rearg",C]],K="[object Arguments]",H="[object Array]",V="[object AsyncFunction]",W="[object Boolean]",$="[object Date]",G="[object DOMException]",Y="[object Error]",J="[object Function]",Z="[object GeneratorFunction]",X="[object Map]",Q="[object Number]",ee="[object Null]",te="[object Object]",ne="[object Promise]",re="[object Proxy]",ie="[object RegExp]",oe="[object Set]",se="[object String]",ae="[object Symbol]",ue="[object Undefined]",le="[object WeakMap]",ce="[object WeakSet]",fe="[object ArrayBuffer]",he="[object DataView]",pe="[object Float32Array]",de="[object Float64Array]",me="[object Int8Array]",ge="[object Int16Array]",ye="[object Int32Array]",be="[object Uint8Array]",ve="[object Uint8ClampedArray]",_e="[object Uint16Array]",we="[object Uint32Array]",ke=/\b__p \+= '';/g,Se=/\b(__p \+=) '' \+/g,Ee=/(__e\(.*?\)|\b__t\)) \+\n'';/g,xe=/&(?:amp|lt|gt|quot|#39);/g,Ce=/[&<>"']/g,Ae=RegExp(xe.source),Ie=RegExp(Ce.source),Te=/<%-([\s\S]+?)%>/g,je=/<%([\s\S]+?)%>/g,Oe=/<%=([\s\S]+?)%>/g,Pe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Be=/^\w*$/,Re=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ne=/[\\^$.*+?()[\]{}|]/g,Me=RegExp(Ne.source),Le=/^\s+|\s+$/g,Fe=/^\s+/,De=/\s+$/,Ue=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ze=/\{\n\/\* \[wrapped with (.+)\] \*/,qe=/,? & /,Ke=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,He=/\\(\\)?/g,Ve=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,We=/\w*$/,$e=/^[-+]0x[0-9a-f]+$/i,Ge=/^0b[01]+$/i,Ye=/^\[object .+?Constructor\]$/,Je=/^0o[0-7]+$/i,Ze=/^(?:0|[1-9]\d*)$/,Xe=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Qe=/($^)/,et=/['\n\r\u2028\u2029\\]/g,tt="\\ud800-\\udfff",nt="\\u0300-\\u036f",rt="\\ufe20-\\ufe2f",it="\\u20d0-\\u20ff",ot="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",st="\\u2700-\\u27bf",at="a-z\\xdf-\\xf6\\xf8-\\xff",ut="\\xac\\xb1\\xd7\\xf7",lt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ct="\\u2000-\\u206f",ft=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ht="A-Z\\xc0-\\xd6\\xd8-\\xde",pt="\\ufe0e\\ufe0f",dt=ut+lt+"\\u2000-\\u206f"+ft,mt="['’]",gt="[\\ud800-\\udfff]",yt="["+dt+"]",bt="["+ot+"]",vt="\\d+",_t="[\\u2700-\\u27bf]",wt="["+at+"]",kt="[^"+tt+dt+vt+st+at+ht+"]",St="\\ud83c[\\udffb-\\udfff]",Et="(?:"+bt+"|"+St+")",xt="[^\\ud800-\\udfff]",Ct="(?:\\ud83c[\\udde6-\\uddff]){2}",At="[\\ud800-\\udbff][\\udc00-\\udfff]",It="["+ht+"]",Tt="\\u200d",jt="(?:"+wt+"|"+kt+")",Ot="(?:"+It+"|"+kt+")",Pt="(?:['’](?:d|ll|m|re|s|t|ve))?",Bt="(?:['’](?:D|LL|M|RE|S|T|VE))?",Rt=Et+"?",Nt="[\\ufe0e\\ufe0f]?",Mt="(?:\\u200d(?:"+[xt,Ct,At].join("|")+")"+Nt+Rt+")*",Lt="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ft="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Dt=Nt+Rt+Mt,Ut="(?:"+[_t,Ct,At].join("|")+")"+Dt,zt="(?:"+[xt+bt+"?",bt,Ct,At,gt].join("|")+")",qt=RegExp("['’]","g"),Kt=RegExp(bt,"g"),Ht=RegExp(St+"(?="+St+")|"+zt+Dt,"g"),Vt=RegExp([It+"?"+wt+"+"+Pt+"(?="+[yt,It,"$"].join("|")+")",Ot+"+"+Bt+"(?="+[yt,It+jt,"$"].join("|")+")",It+"?"+jt+"+"+Pt,It+"+"+Bt,Ft,Lt,vt,Ut].join("|"),"g"),Wt=RegExp("["+Tt+tt+ot+pt+"]"),$t=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Gt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Yt=-1,Jt={};Jt[pe]=Jt[de]=Jt[me]=Jt[ge]=Jt[ye]=Jt[be]=Jt[ve]=Jt[_e]=Jt[we]=!0,Jt[K]=Jt[H]=Jt[fe]=Jt[W]=Jt[he]=Jt[$]=Jt[Y]=Jt[J]=Jt[X]=Jt[Q]=Jt[te]=Jt[ie]=Jt[oe]=Jt[se]=Jt[le]=!1;var Zt={};Zt[K]=Zt[H]=Zt[fe]=Zt[he]=Zt[W]=Zt[$]=Zt[pe]=Zt[de]=Zt[me]=Zt[ge]=Zt[ye]=Zt[X]=Zt[Q]=Zt[te]=Zt[ie]=Zt[oe]=Zt[se]=Zt[ae]=Zt[be]=Zt[ve]=Zt[_e]=Zt[we]=!0,Zt[Y]=Zt[J]=Zt[le]=!1;var Xt={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},Qt={"&":"&","<":"<",">":">",'"':""","'":"'"},en={"&":"&","<":"<",">":">",""":'"',"'":"'"},tn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},nn=parseFloat,rn=parseInt,on="object"==typeof e&&e&&e.Object===Object&&e,sn="object"==typeof self&&self&&self.Object===Object&&self,an=on||sn||Function("return this")(),un=t&&!t.nodeType&&t,ln=un&&"object"==typeof r&&r&&!r.nodeType&&r,cn=ln&&ln.exports===un,fn=cn&&on.process,hn=function(){try{var e=ln&&ln.require&&ln.require("util").types;return e||fn&&fn.binding&&fn.binding("util")}catch(e){}}(),pn=hn&&hn.isArrayBuffer,dn=hn&&hn.isDate,mn=hn&&hn.isMap,gn=hn&&hn.isRegExp,yn=hn&&hn.isSet,bn=hn&&hn.isTypedArray;function vn(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function _n(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Cn(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Xn(e,t){for(var n=e.length;n--&&Ln(t,e[n],0)>-1;);return n}function Qn(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var er=qn(Xt),tr=qn(Qt);function nr(e){return"\\"+tn[e]}function rr(e,t){return null==e?o:e[t]}function ir(e){return Wt.test(e)}function or(e){return $t.test(e)}function sr(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}function ar(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function ur(e,t){return function(n){return e(t(n))}}function lr(e,t){for(var n=-1,r=e.length,i=0,o=[];++n-1}function Ur(e,t){var n=this.__data__,r=ui(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function zr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function mi(e,t,n,r,i,s){var a,u=t&p,l=t&d,c=t&m;if(n&&(a=i?n(e,r,i,s):n(e)),a!==o)return a;if(!kc(e))return e;var f=sc(e);if(f){if(a=Qs(e),!u)return ns(e,a)}else{var h=Ys(e),g=h==J||h==Z;if(fc(e))return Wo(e,u);if(h==te||h==K||g&&!i){if(a=l||g?{}:ea(e),!u)return l?os(e,fi(a,e)):is(e,ci(a,e))}else{if(!Zt[h])return i?e:{};a=ta(e,h,u)}}s||(s=new Jr);var y=s.get(e);if(y)return y;if(s.set(e,a),Nc(e))return e.forEach(function(r){a.add(mi(r,t,n,r,e,s))}),a;if(Ec(e))return e.forEach(function(r,i){a.set(i,mi(r,t,n,i,e,s))}),a;var b=c?l?Fs:Ls:l?kf:wf,v=f?o:b(e);return wn(v||e,function(r,i){v&&(i=r,r=e[i]),ai(a,i,mi(r,t,n,i,e,s))}),a}function gi(e){var t=wf(e);return function(n){return yi(n,e,t)}}function yi(e,t,n){var r=n.length;if(null==e)return!r;for(e=tt(e);r--;){var i=n[r],s=t[i],a=e[i];if(a===o&&!(i in e)||!s(a))return!1}return!0}function bi(e,t,n){if("function"!=typeof e)throw new it(l);return Sa(function(){e.apply(o,n)},t)}function vi(e,t,n,r){var i=-1,o=xn,s=!0,u=e.length,l=[],c=t.length;if(!u)return l;n&&(t=An(t,Gn(n))),r?(o=Cn,s=!1):t.length>=a&&(o=Jn,s=!1,t=new $r(t));e:for(;++ii?0:i+n),r=r===o||r>i?i:Wc(r),r<0&&(r+=i),r=n>r?0:$c(r);n0&&n(a)?t>1?Ci(a,t-1,n,r,i):In(i,a):r||(i[i.length]=a)}return i}var Ai=ls(),Ii=ls(!0);function Ti(e,t){return e&&Ai(e,t,wf)}function ji(e,t){return e&&Ii(e,t,wf)}function Oi(e,t){return En(t,function(t){return vc(e[t])})}function Pi(e,t){t=qo(t,e);for(var n=0,r=t.length;null!=e&&nt}function Mi(e,t){return null!=e&&ct.call(e,t)}function Li(e,t){return null!=e&&t in tt(e)}function Fi(e,t,n){return e>=zt(t,n)&&e=120&&h.length>=120)?new $r(u&&h):o}h=e[0];var p=-1,d=l[0];e:for(;++p-1;)a!==e&&xt.call(a,u,1),xt.call(e,u,1);return e}function mo(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;ia(i)?xt.call(e,i,1):Ro(e,i)}}return e}function go(e,t){return e+Rt(Wt()*(t-e+1))}function yo(e,t,r,i){for(var o=-1,s=Ut(Bt((t-e)/(r||1)),0),a=n(s);s--;)a[i?s:++o]=e,e+=r;return a}function bo(e,t){var n="";if(!e||t<1||t>M)return n;do{t%2&&(n+=e),t=Rt(t/2),t&&(e+=e)}while(t);return n}function vo(e,t){return Ea(ba(e,t,Th),e+"")}function _o(e){return ri(Uf(e))}function wo(e,t){var n=Uf(e);return Aa(n,di(t,0,n.length))}function ko(e,t,n,r){if(!kc(e))return e;t=qo(t,e);for(var i=-1,s=t.length,a=s-1,u=e;null!=u&&++io?0:o+t),r=r>o?o:r,r<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var s=n(o);++i>>1,s=e[o];null!==s&&!Lc(s)&&(n?s<=t:s=a){var c=t?null:As(e);if(c)return cr(c);s=!1,i=Jn,l=new $r}else l=t?[]:u;e:for(;++r=r?e:Co(e,t,n)}var Vo=jt||function(e){return an.clearTimeout(e)};function Wo(e,t){if(t)return e.slice();var n=e.length,r=wt?wt(n):new e.constructor(n);return e.copy(r),r}function $o(e){var t=new e.constructor(e.byteLength);return new _t(t).set(new _t(e)),t}function Go(e,t){var n=t?$o(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Yo(e){var t=new e.constructor(e.source,We.exec(e));return t.lastIndex=e.lastIndex,t}function Jo(e){return yr?tt(yr.call(e)):{}}function Zo(e,t){var n=t?$o(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Xo(e,t){if(e!==t){var n=e!==o,r=null===e,i=e==e,s=Lc(e),a=t!==o,u=null===t,l=t==t,c=Lc(t);if(!u&&!c&&!s&&e>t||s&&a&&l&&!u&&!c||r&&a&&l||!n&&l||!i)return 1;if(!r&&!s&&!c&&e=a)return u;var l=n[r];return u*("desc"==l?-1:1)}}return e.index-t.index}function es(e,t,r,i){for(var o=-1,s=e.length,a=r.length,u=-1,l=t.length,c=Ut(s-a,0),f=n(l+c),h=!i;++u1?n[i-1]:o,a=i>2?n[2]:o;for(s=e.length>3&&"function"==typeof s?(i--,s):o,a&&oa(n[0],n[1],a)&&(s=i<3?o:s,i=1),t=tt(t);++r-1?i[s?t[a]:a]:o}}function gs(e){return Ms(function(t){var n=t.length,r=n,i=Er.prototype.thru;for(e&&t.reverse();r--;){var s=t[r];if("function"!=typeof s)throw new it(l);if(i&&!a&&"wrapper"==Us(s))var a=new Er([],!0)}for(r=a?r:n;++r1&&b.reverse(),h&&cu))return!1;var c=s.get(e);if(c&&s.get(t))return c==t;var f=-1,h=!0,p=n&y?new $r:o;for(s.set(e,t),s.set(t,e);++f1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(Ue,"{\n/* [wrapped with "+t+"] */\n")}function ra(e){return sc(e)||oc(e)||!!(Ct&&e&&e[Ct])}function ia(e,t){var n=typeof e;return t=null==t?M:t,!!t&&("number"==n||"symbol"!=n&&Ze.test(e))&&e>-1&&e%1==0&&e0){if(++t>=j)return arguments[0]}else t=0;return e.apply(o,arguments)}}function Aa(e,t){var n=-1,r=e.length,i=r-1;for(t=t===o?r:t;++n1?e[t-1]:o;return n="function"==typeof n?(e.pop(),n):o,Ru(e,n)});function Ku(e){var t=_r(e);return t.__chain__=!0,t}function Hu(e,t){return t(e),e}function Vu(e,t){return t(e)}var Wu=Ms(function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,i=function(t){return pi(t,e)};return!(t>1||this.__actions__.length)&&r instanceof xr&&ia(n)?(r=r.slice(n,+n+(t?1:0)),r.__actions__.push({func:Vu,args:[i],thisArg:o}),new Er(r,this.__chain__).thru(function(e){return t&&!e.length&&e.push(o),e})):this.thru(i)});function $u(){return Ku(this)}function Gu(){return new Er(this.value(),this.__chain__)}function Yu(){this.__values__===o&&(this.__values__=Hc(this.value()));var e=this.__index__>=this.__values__.length,t=e?o:this.__values__[this.__index__++];return{done:e,value:t}}function Ju(){return this}function Zu(e){for(var t,n=this;n instanceof Sr;){var r=Pa(n);r.__index__=0,r.__values__=o,t?i.__wrapped__=r:t=r;var i=r;n=n.__wrapped__}return i.__wrapped__=e,t}function Xu(){var e=this.__wrapped__;if(e instanceof xr){var t=e;return this.__actions__.length&&(t=new xr(this)),t=t.reverse(),t.__actions__.push({func:Vu,args:[hu],thisArg:o}),new Er(t,this.__chain__)}return this.thru(hu)}function Qu(){return Lo(this.__wrapped__,this.__actions__)}var el=ss(function(e,t,n){ct.call(e,n)?++e[n]:hi(e,n,1)});function tl(e,t,n){var r=sc(e)?Sn:ki;return n&&oa(e,t,n)&&(t=o),r(e,qs(t,3))}function nl(e,t){var n=sc(e)?En:xi;return n(e,qs(t,3))}var rl=ms(Ha),il=ms(Va);function ol(e,t){return Ci(dl(e,t),1)}function sl(e,t){return Ci(dl(e,t),N)}function al(e,t,n){return n=n===o?1:Wc(n),Ci(dl(e,t),n)}function ul(e,t){var n=sc(e)?wn:_i;return n(e,qs(t,3))}function ll(e,t){var n=sc(e)?kn:wi;return n(e,qs(t,3))}var cl=ss(function(e,t,n){ct.call(e,n)?e[n].push(t):hi(e,n,[t])});function fl(e,t,n,r){e=uc(e)?e:Uf(e),n=n&&!r?Wc(n):0;var i=e.length;return n<0&&(n=Ut(i+n,0)),Mc(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Ln(e,t,n)>-1}var hl=vo(function(e,t,r){var i=-1,o="function"==typeof t,s=uc(e)?n(e.length):[];return _i(e,function(e){s[++i]=o?vn(t,e,r):zi(e,t,r)}),s}),pl=ss(function(e,t,n){hi(e,n,t)});function dl(e,t){var n=sc(e)?An:ro;return n(e,qs(t,3))}function ml(e,t,n,r){return null==e?[]:(sc(t)||(t=null==t?[]:[t]),n=r?o:n,sc(n)||(n=null==n?[]:[n]),lo(e,t,n))}var gl=ss(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});function yl(e,t,n){var r=sc(e)?Tn:Kn,i=arguments.length<3;return r(e,qs(t,4),n,i,_i)}function bl(e,t,n){var r=sc(e)?jn:Kn,i=arguments.length<3;return r(e,qs(t,4),n,i,wi)}function vl(e,t){var n=sc(e)?En:xi;return n(e,Dl(qs(t,3)))}function _l(e){var t=sc(e)?ri:_o;return t(e)}function wl(e,t,n){t=(n?oa(e,t,n):t===o)?1:Wc(t);var r=sc(e)?ii:wo;return r(e,t)}function kl(e){var t=sc(e)?oi:xo;return t(e)}function Sl(e){if(null==e)return 0;if(uc(e))return Mc(e)?dr(e):e.length;var t=Ys(e);return t==X||t==oe?e.size:eo(e).length}function El(e,t,n){var r=sc(e)?On:Ao;return n&&oa(e,t,n)&&(t=o),r(e,qs(t,3))}var xl=vo(function(e,t){if(null==e)return[];var n=t.length;return n>1&&oa(e,t[0],t[1])?t=[]:n>2&&oa(t[0],t[1],t[2])&&(t=[t[0]]),lo(e,Ci(t,1),[])}),Cl=Ot||function(){return an.Date.now()};function Al(e,t){if("function"!=typeof t)throw new it(l);return e=Wc(e),function(){if(--e<1)return t.apply(this,arguments)}}function Il(e,t,n){return t=n?o:t,t=e&&null==t?e.length:t,Ts(e,x,o,o,o,o,t)}function Tl(e,t){var n;if("function"!=typeof t)throw new it(l);return e=Wc(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=o),n}}var jl=vo(function(e,t,n){var r=b;if(n.length){var i=lr(n,zs(jl));r|=S}return Ts(e,r,t,n,i)}),Ol=vo(function(e,t,n){var r=b|v;if(n.length){var i=lr(n,zs(Ol));r|=S}return Ts(t,r,e,n,i)});function Pl(e,t,n){t=n?o:t;var r=Ts(e,w,o,o,o,o,o,t);return r.placeholder=Pl.placeholder,r}function Bl(e,t,n){t=n?o:t;var r=Ts(e,k,o,o,o,o,o,t);return r.placeholder=Bl.placeholder,r}function Rl(e,t,n){var r,i,s,a,u,c,f=0,h=!1,p=!1,d=!0;if("function"!=typeof e)throw new it(l);function m(t){var n=r,s=i;return r=i=o,f=t,a=e.apply(s,n),a}function g(e){return f=e,u=Sa(v,t),h?m(e):a}function y(e){var n=e-c,r=e-f,i=t-n;return p?zt(i,s-r):i}function b(e){var n=e-c,r=e-f;return c===o||n>=t||n<0||p&&r>=s}function v(){var e=Cl();if(b(e))return _(e);u=Sa(v,y(e))}function _(e){return u=o,d&&r?m(e):(r=i=o,a)}function w(){u!==o&&Vo(u),f=0,r=c=i=u=o}function k(){return u===o?a:_(Cl())}function S(){var e=Cl(),n=b(e);if(r=arguments,i=this,c=e,n){if(u===o)return g(c);if(p)return u=Sa(v,t),m(c)}return u===o&&(u=Sa(v,t)),a}return t=Gc(t)||0,kc(n)&&(h=!!n.leading,p="maxWait"in n,s=p?Ut(Gc(n.maxWait)||0,t):s,d="trailing"in n?!!n.trailing:d),S.cancel=w,S.flush=k,S}var Nl=vo(function(e,t){return bi(e,1,t)}),Ml=vo(function(e,t,n){return bi(e,Gc(t)||0,n)});function Ll(e){return Ts(e,A)}function Fl(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new it(l);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Fl.Cache||zr),n}function Dl(e){if("function"!=typeof e)throw new it(l);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function Ul(e){return Tl(2,e)}Fl.Cache=zr;var zl=Ko(function(e,t){t=1==t.length&&sc(t[0])?An(t[0],Gn(qs())):An(Ci(t,1),Gn(qs()));var n=t.length;return vo(function(r){for(var i=-1,o=zt(r.length,n);++i=t}),oc=qi(function(){return arguments}())?qi:function(e){return Sc(e)&&ct.call(e,"callee")&&!Et.call(e,"callee")},sc=n.isArray,ac=pn?Gn(pn):Ki;function uc(e){return null!=e&&wc(e.length)&&!vc(e)}function lc(e){return Sc(e)&&uc(e)}function cc(e){return!0===e||!1===e||Sc(e)&&Ri(e)==W}var fc=Mt||$h,hc=dn?Gn(dn):Hi;function pc(e){return Sc(e)&&1===e.nodeType&&!Pc(e)}function dc(e){if(null==e)return!0;if(uc(e)&&(sc(e)||"string"==typeof e||"function"==typeof e.splice||fc(e)||Fc(e)||oc(e)))return!e.length;var t=Ys(e);if(t==X||t==oe)return!e.size;if(fa(e))return!eo(e).length;for(var n in e)if(ct.call(e,n))return!1;return!0}function mc(e,t){return Vi(e,t)}function gc(e,t,n){n="function"==typeof n?n:o;var r=n?n(e,t):o;return r===o?Vi(e,t,o,n):!!r}function yc(e){if(!Sc(e))return!1;var t=Ri(e);return t==Y||t==G||"string"==typeof e.message&&"string"==typeof e.name&&!Pc(e)}function bc(e){return"number"==typeof e&&Lt(e)}function vc(e){if(!kc(e))return!1;var t=Ri(e);return t==J||t==Z||t==V||t==re}function _c(e){return"number"==typeof e&&e==Wc(e)}function wc(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=M}function kc(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Sc(e){return null!=e&&"object"==typeof e}var Ec=mn?Gn(mn):$i;function xc(e,t){return e===t||Gi(e,t,Hs(t))}function Cc(e,t,n){return n="function"==typeof n?n:o,Gi(e,t,Hs(t),n)}function Ac(e){return Oc(e)&&e!=+e}function Ic(e){if(ca(e))throw new i(u);return Yi(e)}function Tc(e){return null===e}function jc(e){return null==e}function Oc(e){return"number"==typeof e||Sc(e)&&Ri(e)==Q}function Pc(e){if(!Sc(e)||Ri(e)!=te)return!1;var t=kt(e);if(null===t)return!0;var n=ct.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&<.call(n)==mt}var Bc=gn?Gn(gn):Ji;function Rc(e){return _c(e)&&e>=-M&&e<=M}var Nc=yn?Gn(yn):Zi;function Mc(e){return"string"==typeof e||!sc(e)&&Sc(e)&&Ri(e)==se}function Lc(e){return"symbol"==typeof e||Sc(e)&&Ri(e)==ae}var Fc=bn?Gn(bn):Xi;function Dc(e){return e===o}function Uc(e){return Sc(e)&&Ys(e)==le}function zc(e){return Sc(e)&&Ri(e)==ce}var qc=Es(no),Kc=Es(function(e,t){return e<=t});function Hc(e){if(!e)return[];if(uc(e))return Mc(e)?mr(e):ns(e);if(At&&e[At])return sr(e[At]());var t=Ys(e),n=t==X?ar:t==oe?cr:Uf;return n(e)}function Vc(e){if(!e)return 0===e?e:0;if(e=Gc(e),e===N||e===-N){var t=e<0?-1:1;return t*L}return e==e?e:0}function Wc(e){var t=Vc(e),n=t%1;return t==t?n?t-n:t:0}function $c(e){return e?di(Wc(e),0,D):0}function Gc(e){if("number"==typeof e)return e;if(Lc(e))return F;if(kc(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=kc(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Le,"");var n=Ge.test(e);return n||Je.test(e)?rn(e.slice(2),n?2:8):$e.test(e)?F:+e}function Yc(e){return rs(e,kf(e))}function Jc(e){return e?di(Wc(e),-M,M):0===e?e:0}function Zc(e){return null==e?"":Po(e)}var Xc=as(function(e,t){if(fa(t)||uc(t))rs(t,wf(t),e);else for(var n in t)ct.call(t,n)&&ai(e,n,t[n])}),Qc=as(function(e,t){rs(t,kf(t),e)}),ef=as(function(e,t,n,r){rs(t,kf(t),e,r)}),tf=as(function(e,t,n,r){rs(t,wf(t),e,r)}),nf=Ms(pi);function rf(e,t){var n=kr(e);return null==t?n:ci(n,t)}var of=vo(function(e,t){e=tt(e);var n=-1,r=t.length,i=r>2?t[2]:o;for(i&&oa(t[0],t[1],i)&&(r=1);++n1),t}),rs(e,Fs(e),n),r&&(n=mi(n,p|d|m,Ps));for(var i=t.length;i--;)Ro(n,t[i]);return n});function If(e,t){return jf(e,Dl(qs(t)))}var Tf=Ms(function(e,t){return null==e?{}:co(e,t)});function jf(e,t){if(null==e)return{};var n=An(Fs(e),function(e){return[e]});return t=qs(t),fo(e,n,function(e,n){return t(e,n[0])})}function Of(e,t,n){t=qo(t,e);var r=-1,i=t.length;for(i||(i=1,e=o);++rt){var r=e;e=t,t=r}if(n||e%1||t%1){var i=Wt();return zt(e+i*(t-e+nn("1e-"+((i+"").length-1))),t)}return go(e,t)}var Vf=hs(function(e,t,n){return t=t.toLowerCase(),e+(n?Wf(t):t)});function Wf(e){return vh(Zc(e).toLowerCase())}function $f(e){return e=Zc(e),e&&e.replace(Xe,er).replace(Kt,"")}function Gf(e,t,n){e=Zc(e),t=Po(t);var r=e.length;n=n===o?r:di(Wc(n),0,r);var i=n;return n-=t.length,n>=0&&e.slice(n,i)==t}function Yf(e){return e=Zc(e),e&&Ie.test(e)?e.replace(Ce,tr):e}function Jf(e){return e=Zc(e),e&&Me.test(e)?e.replace(Ne,"\\$&"):e}var Zf=hs(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Xf=hs(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Qf=fs("toLowerCase");function eh(e,t,n){e=Zc(e),t=Wc(t);var r=t?dr(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return ws(Rt(i),n)+e+ws(Bt(i),n)}function th(e,t,n){e=Zc(e),t=Wc(t);var r=t?dr(e):0;return t&&r>>0,n?(e=Zc(e),e&&("string"==typeof t||null!=t&&!Bc(t))&&(t=Po(t),!t&&ir(e))?Ho(mr(e),0,n):e.split(t,n)):[]}var uh=hs(function(e,t,n){return e+(n?" ":"")+vh(t)});function lh(e,t,n){return e=Zc(e),n=null==n?0:di(Wc(n),0,e.length),t=Po(t),e.slice(n,n+t.length)==t}function ch(e,t,n){var r=_r.templateSettings;n&&oa(e,t,n)&&(t=o),e=Zc(e),t=ef({},t,r,js);var i=ef({},t.imports,r.imports,js),s=wf(i),a=Yn(i,s),u,l,c=0,f=t.interpolate||Qe,h="__p += '",p=nt((t.escape||Qe).source+"|"+f.source+"|"+(f===Oe?Ve:Qe).source+"|"+(t.evaluate||Qe).source+"|$","g"),d="//# sourceURL="+("sourceURL"in t?t.sourceURL:"lodash.templateSources["+ ++Yt+"]")+"\n";e.replace(p,function(t,n,r,i,o,s){return r||(r=i),h+=e.slice(c,s).replace(et,nr),n&&(u=!0,h+="' +\n__e("+n+") +\n'"),o&&(l=!0,h+="';\n"+o+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),c=s+t.length,t}),h+="';\n";var m=t.variable;m||(h="with (obj) {\n"+h+"\n}\n"),h=(l?h.replace(ke,""):h).replace(Se,"$1").replace(Ee,"$1;"),h="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(u?", __e = _.escape":"")+(l?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var g=wh(function(){return R(s,d+"return "+h).apply(o,a)});if(g.source=h,yc(g))throw g;return g}function fh(e){return Zc(e).toLowerCase()}function hh(e){return Zc(e).toUpperCase()}function ph(e,t,n){if(e=Zc(e),e&&(n||t===o))return e.replace(Le,"");if(!e||!(t=Po(t)))return e;var r=mr(e),i=mr(t),s=Zn(r,i),a=Xn(r,i)+1;return Ho(r,s,a).join("")}function dh(e,t,n){if(e=Zc(e),e&&(n||t===o))return e.replace(De,"");if(!e||!(t=Po(t)))return e;var r=mr(e),i=Xn(r,mr(t))+1;return Ho(r,0,i).join("")}function mh(e,t,n){if(e=Zc(e),e&&(n||t===o))return e.replace(Fe,"");if(!e||!(t=Po(t)))return e;var r=mr(e),i=Zn(r,mr(t));return Ho(r,i).join("")}function gh(e,t){var n=I,r=T;if(kc(t)){var i="separator"in t?t.separator:i;n="length"in t?Wc(t.length):n,r="omission"in t?Po(t.omission):r}e=Zc(e);var s=e.length;if(ir(e)){var a=mr(e);s=a.length}if(n>=s)return e;var u=n-dr(r);if(u<1)return r;var l=a?Ho(a,0,u).join(""):e.slice(0,u);if(i===o)return l+r;if(a&&(u+=l.length-u),Bc(i)){if(e.slice(u).search(i)){var c,f=l;for(i.global||(i=nt(i.source,Zc(We.exec(i))+"g")),i.lastIndex=0;c=i.exec(f);)var h=c.index;l=l.slice(0,h===o?u:h)}}else if(e.indexOf(Po(i),u)!=u){var p=l.lastIndexOf(i);p>-1&&(l=l.slice(0,p))}return l+r}function yh(e){return e=Zc(e),e&&Ae.test(e)?e.replace(xe,gr):e}var bh=hs(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),vh=fs("toUpperCase");function _h(e,t,n){return e=Zc(e),t=n?o:t,t===o?or(e)?vr(e):Rn(e):e.match(t)||[]}var wh=vo(function(e,t){try{return vn(e,o,t)}catch(e){return yc(e)?e:new i(e)}}),kh=Ms(function(e,t){return wn(t,function(t){t=Ta(t),hi(e,t,jl(e[t],e))}),e});function Sh(e){var t=null==e?0:e.length,n=qs();return e=t?An(e,function(e){if("function"!=typeof e[1])throw new it(l);return[n(e[0]),e[1]]}):[],vo(function(n){for(var r=-1;++rM)return[];var n=D,r=zt(e,D);t=qs(t),e-=D;for(var i=Wn(r,t);++n0||t<0)?new xr(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==o&&(t=Wc(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},xr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},xr.prototype.toArray=function(){return this.take(D)},Ti(xr.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),i=_r[r?"take"+("last"==t?"Right":""):t],s=r||/^find/.test(t);i&&(_r.prototype[t]=function(){var t=this.__wrapped__,a=r?[1]:arguments,u=t instanceof xr,l=a[0],c=u||sc(t),f=function(e){var t=i.apply(_r,In([e],a));return r&&h?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(u=c=!1);var h=this.__chain__,p=!!this.__actions__.length,d=s&&!h,m=u&&!p;if(!s&&c){t=m?t:new xr(this);var g=e.apply(t,a);return g.__actions__.push({func:Vu,args:[f],thisArg:o}),new Er(g,h)}return d&&m?e.apply(this,a):(g=this.thru(f),d?r?g.value()[0]:g.value():g)})}),wn(["pop","push","shift","sort","splice","unshift"],function(e){var t=ot[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);_r.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(sc(i)?i:[],e)}return this[n](function(n){return t.apply(sc(n)?n:[],e)})}}),Ti(xr.prototype,function(e,t){var n=_r[t];if(n){var r=n.name+"",i=ln[r]||(ln[r]=[]);i.push({name:t,func:n})}}),ln[ys(o,v).name]=[{name:"wrapper",func:o}],xr.prototype.clone=Cr,xr.prototype.reverse=Ar,xr.prototype.value=Ir,_r.prototype.at=Wu,_r.prototype.chain=$u,_r.prototype.commit=Gu,_r.prototype.next=Yu,_r.prototype.plant=Zu,_r.prototype.reverse=Xu,_r.prototype.toJSON=_r.prototype.valueOf=_r.prototype.value=Qu,_r.prototype.first=_r.prototype.head,At&&(_r.prototype[At]=Ju),_r},wr=_r();an._=wr,i=function(){return wr}.call(t,n,t,r),i===o||(r.exports=i)}).call(this)}).call(this,n(8),n(75)(e))},function(e,t,n){"use strict";const r=n(485).extend(n(962)),i=r.object().keys({repo:r.alternatives().try(r.object(),r.string()).allow(null),repoOwner:r.boolean().default(!0),preload:r.object().keys({enabled:r.boolean().default(!0),addresses:r.array().items(r.multiaddr().options({convert:!1})),interval:r.number().integer().default(3e4)}).allow(null),init:r.alternatives().try(r.boolean(),r.object().keys({bits:r.number().integer()})).allow(null),start:r.boolean(),local:r.boolean(),pass:r.string().allow(""),relay:r.object().keys({enabled:r.boolean(),hop:r.object().keys({enabled:r.boolean(),active:r.boolean()}).allow(null)}).allow(null),EXPERIMENTAL:r.object().keys({pubsub:r.boolean(),ipnsPubsub:r.boolean(),sharding:r.boolean(),dht:r.boolean()}).allow(null),connectionManager:r.object().allow(null),config:r.object().keys({Addresses:r.object().keys({Swarm:r.array().items(r.multiaddr().options({convert:!1})),API:r.multiaddr().options({convert:!1}),Gateway:r.multiaddr().options({convert:!1})}).allow(null),Discovery:r.object().keys({MDNS:r.object().keys({Enabled:r.boolean(),Interval:r.number().integer()}).allow(null),webRTCStar:r.object().keys({Enabled:r.boolean()}).allow(null)}).allow(null),Bootstrap:r.array().items(r.multiaddr().IPFS().options({convert:!1}))}).allow(null),libp2p:r.alternatives().try(r.func(),r.object().keys({modules:r.object().allow(null)})).allow(null)}).options({allowUnknown:!0});e.exports.validate=(e=>r.attempt(e,i))},function(e,t,n){const r=n(24),i=n(90);e.exports={name:"multiaddr",language:{invalid:"{{message}}",fmt:"must be in {{fmt}} format"},pre(e,t,n){if(null==e)return this.createError("multiaddr.invalid",{v:e,message:"addr must be a string, Buffer, or another Multiaddr"},t,n);let i;try{i=r(e)}catch(r){return this.createError("multiaddr.invalid",{v:e,message:r.message},t,n)}return n.convert?i:e},rules:Object.keys(i).map(e=>({name:e,validate(t,n,r,o){return i[e].matches(n)?n:this.createError("multiaddr.fmt",{v:n,fmt:e},r,o)}}))}},function(e,t,n){"use strict";const r=n(11),i=n(223).errors;function o(e){return!!e&&(e.code===i.ERR_REPO_NOT_INITIALIZED||!!(e.message.match(/not found/)||e.message.match(/ENOENT/)||e.message.match(/No value/)))}e.exports=(e=>{e.log("booting");const t=e._options,n=t.init,i=t.start;r([t=>{if(!e._repo.closed)return t(null,!0);e._repo.open((e,n)=>o(e)?t(null,!1):e?t(e):void t(null,!0))},(r,i)=>{if(r)return e.init({repo:e._repo},e=>{if(e)return i(Object.assign(e,{emitted:!0}));i()});if(n){const n=Object.assign({bits:2048,pass:e._options.pass},"object"==typeof t.init?t.init:{});return e.init(n,e=>{if(e)return i(Object.assign(e,{emitted:!0}));i()})}i()},t=>{if(!i)return t();e.start(e=>{if(e)return t(Object.assign(e,{emitted:!0}));t()})}],t=>{t?t.emitted||e.emit("error",t):(e.log("booted"),e.emit("ready"))})})},function(e,t,n){"use strict";t.preStart=n(965),t.start=n(980),t.stop=n(1176),t.isOnline=n(1177),t.version=n(1178),t.id=n(1179),t.repo=n(543),t.init=n(1180),t.bootstrap=n(1183),t.config=n(1184),t.block=n(1185),t.object=n(1186),t.dag=n(1187),t.libp2p=n(503),t.swarm=n(1191),t.ping=n(1194),t.pingPullStream=n(1195),t.pingReadableStream=n(1196),t.pin=n(1197),t.filesRegular=n(1204),t.filesMFS=n(1257),t.bitswap=n(568),t.pubsub=n(1304),t.dht=n(1305),t.dns=n(1308),t.key=n(1310),t.stats=n(1311),t.resolve=n(1312),t.name=n(1314)},function(e,t,n){"use strict";const r=n(23),i=n(44),o=n(24),s=n(11),a=n(486),u=n(180),l=n(979);e.exports=function e(t){return e=>{t.log("pre-start");const n=t._options.pass;s([e=>t._repo.config.get(e),(e,n)=>{if(!t._options.config)return n(null,e);e=u(t._options.config,e),t.config.replace(e,t=>{if(t)return n(t);n(null,e)})},(e,n)=>{if(e.Keychain)return n(null,e);e.Keychain=a.generateOptions(),t.config.set("Keychain",e.Keychain,r=>{t.log("using default keychain options"),n(r,e)})},(e,r)=>{if(t._keychain);else if(n){const r=Object.assign({passPhrase:n},e.Keychain);t._keychain=new a(t._repo.keys,r),t.log("keychain constructed")}else t._keychain=new l,t.log("no keychain, use --pass");r(null,e)},(e,t)=>{const n=e.Identity.PrivKey;r.createFromPrivKey(n,(n,r)=>{t(n,e,r)})},(e,r,i)=>{if(!n)return i(null,e,r);t._keychain.findKeyByName("self",n=>{if(n)return t.log('Creating "self" key'),t._keychain.importPeer("self",r,t=>i(t,e,r));i(null,e,r)})},(e,n,r)=>{t.log("peer created"),t._peerInfo=new i(n),e.Addresses&&e.Addresses.Swarm&&e.Addresses.Swarm.forEach(e=>{let n=o(e);n.getPeerId()&&(n=n.encapsulate("/ipfs/"+t._peerInfo.id.toB58String())),t._peerInfo.multiaddrs.add(n)}),r()},e=>t.pin._load(e)],e)}}},function(e,t,n){"use strict";const r=n(967),i=n(444),o=n(71),s=n(33),a=n(36),u=n(12),l=n(971),c="/pkcs8/",f="/info/",h={minKeyLength:14,minSaltLength:16,minIterationCount:1e3},p={dek:{keyLength:64,iterationCount:1e4,salt:"you should override this value with a crypto secure random number",hash:"sha2-512"}};function d(e){return!!e&&("string"==typeof e&&e===r(e.trim()))}function m(e,t){const n=200,r=1e3,i=800*Math.random()+200;"string"==typeof t&&(t=new Error(t)),setTimeout(e,i,t,null)}function g(e){return new s.Key(c+e)}function y(e){return new s.Key(f+e)}class b{constructor(e,t){if(!e)throw new Error("store is required");this.store=e;const n=i(p,t);if(!n.passPhrase||n.passPhrase.length<20)throw new Error("passPhrase must be least 20 characters");if(n.dek.keyLengthr})}get cms(){return new l(this)}static generateOptions(){const e=Object.assign({},p),t=3*Math.ceil(h.minSaltLength/3);return e.dek.salt=o.randomBytes(t).toString("base64"),e}static get options(){return p}createKey(e,t,n,r){const i=this;if(!d(e)||"self"===e)return m(r,`Invalid key name '${e}'`);if("string"!=typeof t)return m(r,`Invalid key type '${t}'`);if(!Number.isSafeInteger(n))return m(r,`Invalid key size '${n}'`);const s=g(e);i.store.has(s,(a,u)=>{if(a)return m(r,a);if(u)return m(r,`Key '${e}' already exists`);switch(t.toLowerCase()){case"rsa":if(n<2048)return m(r,`Invalid RSA key size ${n}`)}o.keys.generateKeyPair(t,n,(t,n)=>{if(t)return m(r,t);n.id((t,o)=>{if(t)return m(r,t);n.export(this._(),(t,n)=>{if(t)return m(r,t);const a={name:e,id:o},u=i.store.batch();u.put(s,n),u.put(y(e),JSON.stringify(a)),u.commit(e=>{if(e)return m(r,e);r(null,a)})})})})})}listKeys(e){const t=this,n={prefix:f};u(this.store.query(n),a((t,n)=>{if(t)return m(e,t);const r=n.map(e=>JSON.parse(e.value));e(null,r)}))}findKeyById(e,t){this.listKeys((n,r)=>{if(n)return m(t,n);const i=r.find(t=>t.id===e);t(null,i)})}findKeyByName(e,t){if(!d(e))return m(t,`Invalid key name '${e}'`);const n=y(e);this.store.get(n,(n,r)=>{if(n)return m(t,`Key '${e}' does not exist. ${n.message}`);t(null,JSON.parse(r.toString()))})}removeKey(e,t){const n=this;if(!d(e)||"self"===e)return m(t,`Invalid key name '${e}'`);const r=g(e);n.findKeyByName(e,(i,o)=>{if(i)return m(t,i);const s=n.store.batch();s.delete(r),s.delete(y(e)),s.commit(e=>{if(e)return m(t,e);t(null,o)})})}renameKey(e,t,n){const r=this;if(!d(e)||"self"===e)return m(n,`Invalid old key name '${e}'`);if(!d(t)||"self"===t)return m(n,`Invalid new key name '${t}'`);const i=g(e),o=g(t),s=y(e),a=y(t);this.store.get(i,(u,l)=>{if(u)return m(n,`Key '${e}' does not exist. ${u.message}`);const c=l.toString();r.store.has(o,(e,u)=>e?m(n,e):u?m(n,`Key '${t}' already exists`):void r.store.get(s,(e,u)=>{if(e)return m(n,e);const l=JSON.parse(u.toString());l.name=t;const f=r.store.batch();f.put(o,c),f.put(a,JSON.stringify(l)),f.delete(i),f.delete(s),f.commit(e=>{if(e)return m(n,e);n(null,l)})}))})}exportKey(e,t,n){if(!d(e))return m(n,`Invalid key name '${e}'`);if(!t)return m(n,"Password is required");const r=g(e);this.store.get(r,(r,i)=>{if(r)return m(n,`Key '${e}' does not exist. ${r.message}`);const s=i.toString();o.keys.import(s,this._(),(e,r)=>{if(e)return m(n,e);r.export(t,n)})})}importKey(e,t,n,r){const i=this;if(!d(e)||"self"===e)return m(r,`Invalid key name '${e}'`);if(!t)return m(r,"PEM encoded key is required");const s=g(e);i.store.has(s,(a,u)=>a?m(r,a):u?m(r,`Key '${e}' already exists`):void o.keys.import(t,n,(t,n)=>{if(t)return m(r,"Cannot read the key, most likely the password is wrong");n.id((t,o)=>{if(t)return m(r,t);n.export(this._(),(t,n)=>{if(t)return m(r,t);const a={name:e,id:o},u=i.store.batch();u.put(s,n),u.put(y(e),JSON.stringify(a)),u.commit(e=>{if(e)return m(r,e);r(null,a)})})})}))}importPeer(e,t,n){const r=this;if(!d(e))return m(n,`Invalid key name '${e}'`);if(!t||!t.privKey)return m(n,"Peer.privKey is required");const i=t.privKey,o=g(e);r.store.has(o,(t,s)=>t?m(n,t):s?m(n,`Key '${e}' already exists`):void i.id((t,s)=>{if(t)return m(n,t);i.export(this._(),(t,i)=>{if(t)return m(n,t);const a={name:e,id:s},u=r.store.batch();u.put(o,i),u.put(y(e),JSON.stringify(a)),u.commit(e=>{if(e)return m(n,e);n(null,a)})})}))}_getPrivateKey(e,t){if(!d(e))return m(t,`Invalid key name '${e}'`);this.store.get(g(e),(n,r)=>{if(n)return m(t,`Key '${e}' does not exist. ${n.message}`);t(null,r.toString())})}}e.exports=b},function(e,t,n){"use strict";var r=n(968),i=/[\/\?<>\\:\*\|":]/g,o=/[\x00-\x1f\x80-\x9f]/g,s=/^\.+$/,a=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,u=/[\. ]+$/;function l(e,t){var n=e.replace(i,t).replace(o,t).replace(s,t).replace(a,t).replace(u,t);return r(n,255)}e.exports=function(e,t){var n=t&&t.replacement||"",r=l(e,n);return""===n?r:l(r,"")}},function(e,t,n){"use strict";var r=n(969),i=n(970);e.exports=r.bind(null,i)},function(e,t,n){"use strict";function r(e){return e>=55296&&e<=56319}function i(e){return e>=56320&&e<=57343}e.exports=function e(t,n,o){if("string"!=typeof n)throw new Error("Input must be string");for(var s=n.length,a=0,u,l,c=0;co)return n.slice(0,c-l.length+1)}return n}},function(e,t,n){"use strict";function r(e){return e>=55296&&e<=56319}function i(e){return e>=56320&&e<=57343}e.exports=function e(t){if("string"!=typeof t)throw new Error("Input must be string");for(var n=t.length,o=0,s=null,a=null,u=0;u=128&&s<=2047?o+=2:s>=2048&&s<=65535&&(o+=3),a=s;return o}},function(e,t,n){"use strict";(function(t){const r=n(16),i=n(39),o=n(972),s=n(11);n(973),n(307);const a=n(19),u=n(978);class l{constructor(e){if(!e)throw new Error("keychain is required");this.keychain=e}encrypt(e,n,o){const s=this,l=(e,t)=>r(()=>o(e,t));if(!t.isBuffer(n))return l(new Error("Plain data must be a Buffer"));i([t=>s.keychain.findKeyByName(e,t),t=>s.keychain._getPrivateKey(e,t)],(e,r)=>{if(e)return l(e);let i=r[0],c=r[1];try{const r=a.pki.decryptRsaPrivateKey(c,s.keychain._());u.certificateForKey(i,r,(e,r)=>{if(e)return o(e);const i=a.pkcs7.createEnvelopedData();i.addRecipient(r),i.content=a.util.createBuffer(n),i.encrypt();const s=a.asn1.toDer(i.toAsn1()).getBytes();l(null,t.from(s,"binary"))})}catch(e){l(e)}})}decrypt(e,n){const i=(e,t)=>r(()=>n(e,t));if(!t.isBuffer(e))return i(new Error("CMS data is required"));const u=this;let l;try{const t=a.util.createBuffer(e.toString("binary")),n=a.asn1.fromDer(t);l=a.pkcs7.messageFromAsn1(n)}catch(e){return i(new Error("Invalid CMS: "+e.message))}const c=l.recipients.filter(e=>e.issuer.find(e=>"O"===e.shortName&&"ipfs"===e.value)).filter(e=>e.issuer.find(e=>"CN"===e.shortName)).map(e=>({recipient:e,keyId:e.issuer.find(e=>"CN"===e.shortName).value}));o(c,(e,t)=>u.keychain.findKeyById(e.keyId,(e,n)=>t(null,!e&&n)),(e,n)=>{if(e)return i(e);if(!n){const t=c.map(e=>e.keyId);return e=new Error("Decryption needs one of the key(s): "+t.join(", ")),e.missingKeys=t,i(e)}s([e=>u.keychain.findKeyById(n.keyId,e),(e,t)=>u.keychain._getPrivateKey(e.name,t)],(e,r)=>{if(e)return i(e);const o=a.pki.decryptRsaPrivateKey(r,u.keychain._());l.decrypt(n.recipient,o),i(null,t.from(l.content.getBytes(),"binary"))})})}}e.exports=l}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(239),i=f(r),o=n(240),s=f(o),a=n(171),u=f(a),l=n(487),c=f(l);function f(e){return e&&e.__esModule?e:{default:e}}t.default=(0,u.default)((0,s.default)(i.default,c.default)),e.exports=t.default},function(e,t,n){var r=n(19);n(236),n(140),n(308),n(177),n(309),n(974),n(141),n(34),n(488);var i=r.asn1,o=e.exports=r.pkcs7=r.pkcs7||{};function s(e){var t={},n=[];if(!i.validate(e,o.asn1.recipientInfoValidator,t,n)){var s=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw s.errors=n,s}return{version:t.version.charCodeAt(0),issuer:r.pki.RDNAttributesAsArray(t.issuer),serialNumber:r.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:i.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function a(e){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[r.pki.distinguishedNameToAsn1({attributes:e.issuer}),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,r.util.hexToBytes(e.serialNumber))]),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.encryptedContent.algorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function u(e){for(var t=[],n=0;n0){for(var n=i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[]),o=0;o=n&&s0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,t)),o.length>0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,o)),s.value[0].value.push(i.create(i.Class.UNIVERSAL,i.Type.SET,!0,e.signerInfos)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),s])},addSigner:function(t){var n=t.issuer,i=t.serialNumber;if(t.certificate){var o=t.certificate;"string"==typeof o&&(o=r.pki.certificateFromPem(o)),n=o.issuer.attributes,i=o.serialNumber}var s=t.key;if(!s)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof s&&(s=r.pki.privateKeyFromPem(s));var a=t.digestAlgorithm||r.pki.oids.sha1;switch(a){case r.pki.oids.sha1:case r.pki.oids.sha256:case r.pki.oids.sha384:case r.pki.oids.sha512:case r.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+a)}var u=t.authenticatedAttributes||[];if(u.length>0){for(var l=!1,c=!1,f=0;f>8*f-c&255;return _=String.fromCharCode(_.charCodeAt(0)&~w)+_.substr(1),_+m+String.fromCharCode(188)},verify:function(e,o,a){var u,l=a-1,c=Math.ceil(l/8);if(o=o.substr(-c),c>8*c-l&255;if(0!=(h.charCodeAt(0)&d))throw new Error("Bits beyond keysize not zero as expected.");var m=n.generate(p,f),g="";for(u=0;u{const r=i.setRsaPublicKey(t.n,t.e),o=i.createCertificate();o.publicKey=r,o.serialNumber="01",o.validity.notBefore=new Date,o.validity.notAfter=new Date,o.validity.notAfter.setFullYear(o.validity.notBefore.getFullYear()+10);const s=[{name:"organizationName",value:"ipfs"},{shortName:"OU",value:"keystore"},{name:"commonName",value:e.id}];return o.setSubject(s),o.setIssuer(s),o.setExtensions([{name:"basicConstraints",cA:!0},{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0,codeSigning:!0,emailProtection:!0,timeStamping:!0},{name:"nsCertType",client:!0,server:!0,email:!0,objsign:!0,sslCA:!0,emailCA:!0,objCA:!0}]),o.sign(t),n(null,o)})},function(e,t,n){"use strict";function r(){throw new Error("Key management requires '--pass ...' option")}class i{static get options(){r()}static generateOptions(){r()}createKey(){r()}listKeys(){r()}findKeyById(){r()}findKeyByName(){r()}renameKey(){r()}removeKey(){r()}exportKey(){r()}importKey(){r()}importPeer(){r()}get cms(){r()}}e.exports=i},function(e,t,n){"use strict";const r=n(39),i=n(981),o=n(243),s=n(16),a=n(3),{TieredDatastore:u}=n(415),l=n(497),c=n(499),f=n(500),h=n(503);e.exports=(e=>a(t=>{const n=n=>{if(n)return s(()=>e.emit("error",n)),t(n);e.state.started(),s(()=>e.emit("start")),t()};if("stopped"!==e.state.state())return n(new Error(`Not able to start from state: ${e.state.state()}`));e.log("starting"),e.state.start(),r([t=>{e._repo.closed?e._repo.open(t):t()},t=>{e._repo.config.get((n,r)=>{if(n)return t(n);const i=h(e,r);i.start(n=>{if(n)return t(n);e.libp2p=i,t()})})},t=>{const n=[];let r;if(o(e._options,"EXPERIMENTAL.ipnsPubsub",!1)){const t=e.libp2p.pubsub,i=e._repo.datastore,o=e._peerInfo.id;r=new c(t,i,o),n.push(r)}if(o(e._options,"EXPERIMENTAL.dht",!1)&&!e._options.local)n.push(e.libp2p.dht);else{const t=new f(e._repo);n.push(t)}const s=new u(n);e._ipns=new l(s,e._repo.datastore,e._peerInfo,e._keychain,e._options),e._bitswap=new i(e.libp2p,e._repo.blocks,{statsEnabled:!0}),e._bitswap.start(),e._blockService.setExchange(e._bitswap),e._preload.start(),e._ipns.republisher.start(),e._mfsPreload.start(t)}],n)}))},function(e,t,n){"use strict";const r=n(11),i=n(417),o=n(61),s=n(39),a=n(97),u=n(89),l=n(982),c=n(991),f=n(995),h=n(997),p=n(120).logger,d=n(998),m={statsEnabled:!1,statsComputeThrottleTimeout:1e3,statsComputeThrottleMaxQueueSize:1e3},g=["blocksReceived","dataReceived","dupBlksReceived","dupDataReceived","blocksSent","dataSent","providesBufferLength","wantListLength","peerCount"];class y{constructor(e,t,n){this._libp2p=e,this._log=p(this.peerInfo.id),this._options=Object.assign({},m,n),this._stats=new d(g,{enabled:this._options.statsEnabled,computeThrottleTimeout:this._options.statsComputeThrottleTimeout,computeThrottleMaxQueueSize:this._options.statsComputeThrottleMaxQueueSize}),this.network=new c(e,this,{},this._stats),this.blockstore=t,this.engine=new f(this.peerInfo.id,t,this.network,this._stats),this.wm=new l(this.peerInfo.id,this.network,this._stats),this.notifications=new h(this.peerInfo.id)}get peerInfo(){return this._libp2p.peerInfo}_receiveMessage(e,t,n){this.engine.messageReceived(e,t,r=>{if(r&&this._log("failed to receive message",t),0===t.blocks.size)return n();const i=Array.from(t.blocks.values()),s=i.filter(e=>this.wm.wantlist.contains(e.cid)).map(e=>e.cid);this.wm.cancelWants(s),o(i,(t,n)=>this._handleReceivedBlock(e,t,n),n)})}_handleReceivedBlock(e,t,n){this._log("received block"),r([e=>this.blockstore.has(t.cid,e),(n,r)=>{if(this._updateReceiveCounters(e.toB58String(),t,n),n)return u(r);this._putBlock(t,r)}],n)}_updateReceiveCounters(e,t,n){this._stats.push(e,"blocksReceived",1),this._stats.push(e,"dataReceived",t.data.length),n&&(this._stats.push(e,"dupBlksReceived",1),this._stats.push(e,"dupDataReceived",t.data.length))}_receiveError(e){this._log.error("ReceiveError: %s",e.message)}_onPeerConnected(e){this.wm.connected(e)}_onPeerDisconnected(e){this.wm.disconnected(e),this.engine.peerDisconnected(e),this._stats.disconnected(e)}_putBlock(e,t){this.blockstore.put(e,n=>{if(n)return t(n);this.notifications.hasBlock(e),this.network.provide(e.cid,e=>{e&&this._log.error("Failed to provide: %s",e.message)}),this.engine.receivedBlocks([e.cid]),t()})}enableStats(){this._stats.enable()}disableStats(){this._stats.disable()}wantlistForPeer(e){return this.engine.wantlistForPeer(e)}ledgerForPeer(e){return this.engine.ledgerForPeer(e)}get(e,t){this.getMany([e],(e,n)=>{if(e)return t(e);n&&n.length>0?t(null,n[0]):t()})}getMany(e,t){let n=e.length;const i=[];let o=!1;const s=(e,t)=>{i.push(e),this.notifications.wantBlock(e,n=>{this.wm.cancelWants([e]),t(null,n)},()=>{this.wm.cancelWants([e]),t(null,void 0)}),n||this.wm.wantBlocks(i)};a(e,(t,a)=>{r([e=>this.blockstore.has(t,e),(r,a)=>{if(n--,r)return n||this.wm.wantBlocks(i),this.blockstore.get(t,a);o||(o=!0,this.network.findAndConnect(e[0],e=>{e&&this._log.error(e)})),s(t,a)}],a)},t)}unwant(e){Array.isArray(e)||(e=[e]),this.wm.unwantBlocks(e),e.forEach(e=>this.notifications.unwantBlock(e))}cancelWants(e){Array.isArray(e)||(e=[e]),this.wm.cancelWants(e)}put(e,t){this._log("putting block"),r([t=>this.blockstore.has(e.cid,t),(t,n)=>{if(t)return u(n);this._putBlock(e,n)}],t)}putMany(e,t){r([t=>i(e,(e,t)=>{this.blockstore.has(e.cid,t)},t),(e,t)=>this.blockstore.putMany(e,n=>{if(n)return t(n);e.forEach(e=>{this.notifications.hasBlock(e),this.engine.receivedBlocks([e.cid]),this.network.provide(e.cid,e=>{e&&this._log.error("Failed to provide: %s",e.message)})}),t()})],t)}getWantlist(){return this.wm.wantlist.entries()}peers(){return this.engine.peers()}stat(){return this._stats}start(e){s([e=>this.wm.start(e),e=>this.network.start(e),e=>this.engine.start(e)],e)}stop(e){this._stats.stop(),s([e=>this.wm.stop(e),e=>this.network.stop(e),e=>this.engine.stop(e)],e)}}e.exports=y},function(e,t,n){"use strict";const r=n(89),i=n(241),o=n(242),s=n(319),a=n(990),u=n(120).logger;e.exports=class e{constructor(e,t,n){this.peers=new Map,this.wantlist=new o(n),this.network=t,this._stats=n,this._peerId=e,this._log=u(e,"want")}_addEntries(e,t,n){const r=e.map((e,n)=>new i.Entry(e,s.kMaxPriority-n,t));r.forEach(e=>{e.cancel?n?this.wantlist.removeForce(e.cid):this.wantlist.remove(e.cid):(this._log("adding to wl"),this.wantlist.add(e.cid,e.priority))});for(let e of this.peers.values())e.addEntries(r)}_startPeerHandler(e){let t=this.peers.get(e.toB58String());if(t)return void t.refcnt++;t=new a(this._peerId,e,this.network);const n=new i(!0);for(let e of this.wantlist.entries())n.addEntry(e[1].cid,e[1].priority);return t.addMessage(n),this.peers.set(e.toB58String(),t),t}_stopPeerHandler(e){const t=this.peers.get(e.toB58String());t&&(t.refcnt--,t.refcnt>0||this.peers.delete(e.toB58String()))}wantBlocks(e){this._addEntries(e,!1)}unwantBlocks(e){this._log("unwant blocks: %s",e.length),this._addEntries(e,!0,!0)}cancelWants(e){this._log("cancel wants: %s",e.length),this._addEntries(e,!0)}connectedPeers(){return Array.from(this.peers.keys())}connected(e){this._startPeerHandler(e)}disconnected(e){this._stopPeerHandler(e)}start(e){this.timer=setInterval(()=>{this._log("resend full-wantlist");const e=new i(!0);this.wantlist.forEach(t=>{e.addEntry(t.cid,t.priority)}),this.peers.forEach(t=>t.addMessage(e))},6e4),r(()=>e())}stop(e){this.peers.forEach(e=>this.disconnected(e.peerId)),clearInterval(this.timer),r(()=>e())}}},function(e,t,n){(function(e,n){var r=200,i="__lodash_hash_undefined__",o=1,s=2,a=9007199254740991,u="[object Arguments]",l="[object Array]",c="[object Boolean]",f="[object Date]",h="[object Error]",p="[object Function]",d="[object GeneratorFunction]",m="[object Map]",g="[object Number]",y="[object Object]",b="[object Promise]",v="[object RegExp]",_="[object Set]",w="[object String]",k="[object Symbol]",S="[object WeakMap]",E="[object ArrayBuffer]",x="[object DataView]",C="[object Float32Array]",A="[object Float64Array]",I="[object Int8Array]",T="[object Int16Array]",j="[object Int32Array]",O="[object Uint8Array]",P="[object Uint8ClampedArray]",B="[object Uint16Array]",R="[object Uint32Array]",N=/[\\^$.*+?()[\]{}|]/g,M=/^\[object .+?Constructor\]$/,L=/^(?:0|[1-9]\d*)$/,F={};F[C]=F[A]=F[I]=F[T]=F[j]=F[O]=F[P]=F[B]=F[R]=!0,F[u]=F[l]=F[E]=F[c]=F[x]=F[f]=F[h]=F[p]=F[m]=F[g]=F[y]=F[v]=F[_]=F[w]=F[S]=!1;var D="object"==typeof e&&e&&e.Object===Object&&e,U="object"==typeof self&&self&&self.Object===Object&&self,z=D||U||Function("return this")(),q=t&&!t.nodeType&&t,K=q&&"object"==typeof n&&n&&!n.nodeType&&n,H=K&&K.exports===q,V=H&&D.process,W=function(){try{return V&&V.binding("util")}catch(e){}}(),$=W&&W.isTypedArray;function G(e,t){for(var n=-1,r=e?e.length:0;++n-1}function ze(e,t){var n=this.__data__,r=it(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}function qe(e){var t=-1,n=e?e.length:0;for(this.clear();++tl))return!1;var f=a.get(e);if(f&&a.get(t))return f==t;var h=-1,p=!0,d=i&o?new Ge:void 0;for(a.set(e,t),a.set(t,e);++h-1&&e%1==0&&e-1&&e%1==0&&e<=a}function jt(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ot(e){return!!e&&"object"==typeof e}var Pt=$?J($):lt;function Bt(e){return xt(e)?rt(e):ct(e)}n.exports=At}).call(this,n(8),n(75)(e))},function(e,t,n){"use strict";const r=n(985),i={};e.exports=i;for(let e in r){let t=r[e];i[t.toString("hex")]=e}},function(e,t,n){"use strict";(function(n){t=e.exports,t.raw=n.from("55","hex"),t.base1=n.from("01","hex"),t.base2=n.from("00","hex"),t.base8=n.from("07","hex"),t.base10=n.from("09","hex"),t.cbor=n.from("51","hex"),t.protobuf=n.from("50","hex"),t.rlp=n.from("60","hex"),t.bencode=n.from("63","hex"),t.multicodec=n.from("30","hex"),t.multihash=n.from("31","hex"),t.multiaddr=n.from("32","hex"),t.multibase=n.from("33","hex"),t.md4=n.from("d4","hex"),t.md5=n.from("d5","hex"),t.sha1=n.from("11","hex"),t["sha2-256"]=n.from("12","hex"),t["sha2-512"]=n.from("13","hex"),t["dbl-sha2-256"]=n.from("56","hex"),t["sha3-224"]=n.from("17","hex"),t["sha3-256"]=n.from("16","hex"),t["sha3-384"]=n.from("15","hex"),t["sha3-512"]=n.from("14","hex"),t["shake-128"]=n.from("18","hex"),t["shake-256"]=n.from("19","hex"),t["keccak-224"]=n.from("1a","hex"),t["keccak-256"]=n.from("1b","hex"),t["keccak-384"]=n.from("1c","hex"),t["keccak-512"]=n.from("1d","hex"),t.murmur3=n.from("22","hex"),t["blake2b-8"]=n.from("b201","hex"),t["blake2b-16"]=n.from("b202","hex"),t["blake2b-24"]=n.from("b203","hex"),t["blake2b-32"]=n.from("b204","hex"),t["blake2b-40"]=n.from("b205","hex"),t["blake2b-48"]=n.from("b206","hex"),t["blake2b-56"]=n.from("b207","hex"),t["blake2b-64"]=n.from("b208","hex"),t["blake2b-72"]=n.from("b209","hex"),t["blake2b-80"]=n.from("b20a","hex"),t["blake2b-88"]=n.from("b20b","hex"),t["blake2b-96"]=n.from("b20c","hex"),t["blake2b-104"]=n.from("b20d","hex"),t["blake2b-112"]=n.from("b20e","hex"),t["blake2b-120"]=n.from("b20f","hex"),t["blake2b-128"]=n.from("b210","hex"),t["blake2b-136"]=n.from("b211","hex"),t["blake2b-144"]=n.from("b212","hex"),t["blake2b-152"]=n.from("b213","hex"),t["blake2b-160"]=n.from("b214","hex"),t["blake2b-168"]=n.from("b215","hex"),t["blake2b-176"]=n.from("b216","hex"),t["blake2b-184"]=n.from("b217","hex"),t["blake2b-192"]=n.from("b218","hex"),t["blake2b-200"]=n.from("b219","hex"),t["blake2b-208"]=n.from("b21a","hex"),t["blake2b-216"]=n.from("b21b","hex"),t["blake2b-224"]=n.from("b21c","hex"),t["blake2b-232"]=n.from("b21d","hex"),t["blake2b-240"]=n.from("b21e","hex"),t["blake2b-248"]=n.from("b21f","hex"),t["blake2b-256"]=n.from("b220","hex"),t["blake2b-264"]=n.from("b221","hex"),t["blake2b-272"]=n.from("b222","hex"),t["blake2b-280"]=n.from("b223","hex"),t["blake2b-288"]=n.from("b224","hex"),t["blake2b-296"]=n.from("b225","hex"),t["blake2b-304"]=n.from("b226","hex"),t["blake2b-312"]=n.from("b227","hex"),t["blake2b-320"]=n.from("b228","hex"),t["blake2b-328"]=n.from("b229","hex"),t["blake2b-336"]=n.from("b22a","hex"),t["blake2b-344"]=n.from("b22b","hex"),t["blake2b-352"]=n.from("b22c","hex"),t["blake2b-360"]=n.from("b22d","hex"),t["blake2b-368"]=n.from("b22e","hex"),t["blake2b-376"]=n.from("b22f","hex"),t["blake2b-384"]=n.from("b230","hex"),t["blake2b-392"]=n.from("b231","hex"),t["blake2b-400"]=n.from("b232","hex"),t["blake2b-408"]=n.from("b233","hex"),t["blake2b-416"]=n.from("b234","hex"),t["blake2b-424"]=n.from("b235","hex"),t["blake2b-432"]=n.from("b236","hex"),t["blake2b-440"]=n.from("b237","hex"),t["blake2b-448"]=n.from("b238","hex"),t["blake2b-456"]=n.from("b239","hex"),t["blake2b-464"]=n.from("b23a","hex"),t["blake2b-472"]=n.from("b23b","hex"),t["blake2b-480"]=n.from("b23c","hex"),t["blake2b-488"]=n.from("b23d","hex"),t["blake2b-496"]=n.from("b23e","hex"),t["blake2b-504"]=n.from("b23f","hex"),t["blake2b-512"]=n.from("b240","hex"),t["blake2s-8"]=n.from("b241","hex"),t["blake2s-16"]=n.from("b242","hex"),t["blake2s-24"]=n.from("b243","hex"),t["blake2s-32"]=n.from("b244","hex"),t["blake2s-40"]=n.from("b245","hex"),t["blake2s-48"]=n.from("b246","hex"),t["blake2s-56"]=n.from("b247","hex"),t["blake2s-64"]=n.from("b248","hex"),t["blake2s-72"]=n.from("b249","hex"),t["blake2s-80"]=n.from("b24a","hex"),t["blake2s-88"]=n.from("b24b","hex"),t["blake2s-96"]=n.from("b24c","hex"),t["blake2s-104"]=n.from("b24d","hex"),t["blake2s-112"]=n.from("b24e","hex"),t["blake2s-120"]=n.from("b24f","hex"),t["blake2s-128"]=n.from("b250","hex"),t["blake2s-136"]=n.from("b251","hex"),t["blake2s-144"]=n.from("b252","hex"),t["blake2s-152"]=n.from("b253","hex"),t["blake2s-160"]=n.from("b254","hex"),t["blake2s-168"]=n.from("b255","hex"),t["blake2s-176"]=n.from("b256","hex"),t["blake2s-184"]=n.from("b257","hex"),t["blake2s-192"]=n.from("b258","hex"),t["blake2s-200"]=n.from("b259","hex"),t["blake2s-208"]=n.from("b25a","hex"),t["blake2s-216"]=n.from("b25b","hex"),t["blake2s-224"]=n.from("b25c","hex"),t["blake2s-232"]=n.from("b25d","hex"),t["blake2s-240"]=n.from("b25e","hex"),t["blake2s-248"]=n.from("b25f","hex"),t["blake2s-256"]=n.from("b260","hex"),t["skein256-8"]=n.from("b301","hex"),t["skein256-16"]=n.from("b302","hex"),t["skein256-24"]=n.from("b303","hex"),t["skein256-32"]=n.from("b304","hex"),t["skein256-40"]=n.from("b305","hex"),t["skein256-48"]=n.from("b306","hex"),t["skein256-56"]=n.from("b307","hex"),t["skein256-64"]=n.from("b308","hex"),t["skein256-72"]=n.from("b309","hex"),t["skein256-80"]=n.from("b30a","hex"),t["skein256-88"]=n.from("b30b","hex"),t["skein256-96"]=n.from("b30c","hex"),t["skein256-104"]=n.from("b30d","hex"),t["skein256-112"]=n.from("b30e","hex"),t["skein256-120"]=n.from("b30f","hex"),t["skein256-128"]=n.from("b310","hex"),t["skein256-136"]=n.from("b311","hex"),t["skein256-144"]=n.from("b312","hex"),t["skein256-152"]=n.from("b313","hex"),t["skein256-160"]=n.from("b314","hex"),t["skein256-168"]=n.from("b315","hex"),t["skein256-176"]=n.from("b316","hex"),t["skein256-184"]=n.from("b317","hex"),t["skein256-192"]=n.from("b318","hex"),t["skein256-200"]=n.from("b319","hex"),t["skein256-208"]=n.from("b31a","hex"),t["skein256-216"]=n.from("b31b","hex"),t["skein256-224"]=n.from("b31c","hex"),t["skein256-232"]=n.from("b31d","hex"),t["skein256-240"]=n.from("b31e","hex"),t["skein256-248"]=n.from("b31f","hex"),t["skein256-256"]=n.from("b320","hex"),t["skein512-8"]=n.from("b321","hex"),t["skein512-16"]=n.from("b322","hex"),t["skein512-24"]=n.from("b323","hex"),t["skein512-32"]=n.from("b324","hex"),t["skein512-40"]=n.from("b325","hex"),t["skein512-48"]=n.from("b326","hex"),t["skein512-56"]=n.from("b327","hex"),t["skein512-64"]=n.from("b328","hex"),t["skein512-72"]=n.from("b329","hex"),t["skein512-80"]=n.from("b32a","hex"),t["skein512-88"]=n.from("b32b","hex"),t["skein512-96"]=n.from("b32c","hex"),t["skein512-104"]=n.from("b32d","hex"),t["skein512-112"]=n.from("b32e","hex"),t["skein512-120"]=n.from("b32f","hex"),t["skein512-128"]=n.from("b330","hex"),t["skein512-136"]=n.from("b331","hex"),t["skein512-144"]=n.from("b332","hex"),t["skein512-152"]=n.from("b333","hex"),t["skein512-160"]=n.from("b334","hex"),t["skein512-168"]=n.from("b335","hex"),t["skein512-176"]=n.from("b336","hex"),t["skein512-184"]=n.from("b337","hex"),t["skein512-192"]=n.from("b338","hex"),t["skein512-200"]=n.from("b339","hex"),t["skein512-208"]=n.from("b33a","hex"),t["skein512-216"]=n.from("b33b","hex"),t["skein512-224"]=n.from("b33c","hex"),t["skein512-232"]=n.from("b33d","hex"),t["skein512-240"]=n.from("b33e","hex"),t["skein512-248"]=n.from("b33f","hex"),t["skein512-256"]=n.from("b340","hex"),t["skein512-264"]=n.from("b341","hex"),t["skein512-272"]=n.from("b342","hex"),t["skein512-280"]=n.from("b343","hex"),t["skein512-288"]=n.from("b344","hex"),t["skein512-296"]=n.from("b345","hex"),t["skein512-304"]=n.from("b346","hex"),t["skein512-312"]=n.from("b347","hex"),t["skein512-320"]=n.from("b348","hex"),t["skein512-328"]=n.from("b349","hex"),t["skein512-336"]=n.from("b34a","hex"),t["skein512-344"]=n.from("b34b","hex"),t["skein512-352"]=n.from("b34c","hex"),t["skein512-360"]=n.from("b34d","hex"),t["skein512-368"]=n.from("b34e","hex"),t["skein512-376"]=n.from("b34f","hex"),t["skein512-384"]=n.from("b350","hex"),t["skein512-392"]=n.from("b351","hex"),t["skein512-400"]=n.from("b352","hex"),t["skein512-408"]=n.from("b353","hex"),t["skein512-416"]=n.from("b354","hex"),t["skein512-424"]=n.from("b355","hex"),t["skein512-432"]=n.from("b356","hex"),t["skein512-440"]=n.from("b357","hex"),t["skein512-448"]=n.from("b358","hex"),t["skein512-456"]=n.from("b359","hex"),t["skein512-464"]=n.from("b35a","hex"),t["skein512-472"]=n.from("b35b","hex"),t["skein512-480"]=n.from("b35c","hex"),t["skein512-488"]=n.from("b35d","hex"),t["skein512-496"]=n.from("b35e","hex"),t["skein512-504"]=n.from("b35f","hex"),t["skein512-512"]=n.from("b360","hex"),t["skein1024-8"]=n.from("b361","hex"),t["skein1024-16"]=n.from("b362","hex"),t["skein1024-24"]=n.from("b363","hex"),t["skein1024-32"]=n.from("b364","hex"),t["skein1024-40"]=n.from("b365","hex"),t["skein1024-48"]=n.from("b366","hex"),t["skein1024-56"]=n.from("b367","hex"),t["skein1024-64"]=n.from("b368","hex"),t["skein1024-72"]=n.from("b369","hex"),t["skein1024-80"]=n.from("b36a","hex"),t["skein1024-88"]=n.from("b36b","hex"),t["skein1024-96"]=n.from("b36c","hex"),t["skein1024-104"]=n.from("b36d","hex"),t["skein1024-112"]=n.from("b36e","hex"),t["skein1024-120"]=n.from("b36f","hex"),t["skein1024-128"]=n.from("b370","hex"),t["skein1024-136"]=n.from("b371","hex"),t["skein1024-144"]=n.from("b372","hex"),t["skein1024-152"]=n.from("b373","hex"),t["skein1024-160"]=n.from("b374","hex"),t["skein1024-168"]=n.from("b375","hex"),t["skein1024-176"]=n.from("b376","hex"),t["skein1024-184"]=n.from("b377","hex"),t["skein1024-192"]=n.from("b378","hex"),t["skein1024-200"]=n.from("b379","hex"),t["skein1024-208"]=n.from("b37a","hex"),t["skein1024-216"]=n.from("b37b","hex"),t["skein1024-224"]=n.from("b37c","hex"),t["skein1024-232"]=n.from("b37d","hex"),t["skein1024-240"]=n.from("b37e","hex"),t["skein1024-248"]=n.from("b37f","hex"),t["skein1024-256"]=n.from("b380","hex"),t["skein1024-264"]=n.from("b381","hex"),t["skein1024-272"]=n.from("b382","hex"),t["skein1024-280"]=n.from("b383","hex"),t["skein1024-288"]=n.from("b384","hex"),t["skein1024-296"]=n.from("b385","hex"),t["skein1024-304"]=n.from("b386","hex"),t["skein1024-312"]=n.from("b387","hex"),t["skein1024-320"]=n.from("b388","hex"),t["skein1024-328"]=n.from("b389","hex"),t["skein1024-336"]=n.from("b38a","hex"),t["skein1024-344"]=n.from("b38b","hex"),t["skein1024-352"]=n.from("b38c","hex"),t["skein1024-360"]=n.from("b38d","hex"),t["skein1024-368"]=n.from("b38e","hex"),t["skein1024-376"]=n.from("b38f","hex"),t["skein1024-384"]=n.from("b390","hex"),t["skein1024-392"]=n.from("b391","hex"),t["skein1024-400"]=n.from("b392","hex"),t["skein1024-408"]=n.from("b393","hex"),t["skein1024-416"]=n.from("b394","hex"),t["skein1024-424"]=n.from("b395","hex"),t["skein1024-432"]=n.from("b396","hex"),t["skein1024-440"]=n.from("b397","hex"),t["skein1024-448"]=n.from("b398","hex"),t["skein1024-456"]=n.from("b399","hex"),t["skein1024-464"]=n.from("b39a","hex"),t["skein1024-472"]=n.from("b39b","hex"),t["skein1024-480"]=n.from("b39c","hex"),t["skein1024-488"]=n.from("b39d","hex"),t["skein1024-496"]=n.from("b39e","hex"),t["skein1024-504"]=n.from("b39f","hex"),t["skein1024-512"]=n.from("b3a0","hex"),t["skein1024-520"]=n.from("b3a1","hex"),t["skein1024-528"]=n.from("b3a2","hex"),t["skein1024-536"]=n.from("b3a3","hex"),t["skein1024-544"]=n.from("b3a4","hex"),t["skein1024-552"]=n.from("b3a5","hex"),t["skein1024-560"]=n.from("b3a6","hex"),t["skein1024-568"]=n.from("b3a7","hex"),t["skein1024-576"]=n.from("b3a8","hex"),t["skein1024-584"]=n.from("b3a9","hex"),t["skein1024-592"]=n.from("b3aa","hex"),t["skein1024-600"]=n.from("b3ab","hex"),t["skein1024-608"]=n.from("b3ac","hex"),t["skein1024-616"]=n.from("b3ad","hex"),t["skein1024-624"]=n.from("b3ae","hex"),t["skein1024-632"]=n.from("b3af","hex"),t["skein1024-640"]=n.from("b3b0","hex"),t["skein1024-648"]=n.from("b3b1","hex"),t["skein1024-656"]=n.from("b3b2","hex"),t["skein1024-664"]=n.from("b3b3","hex"),t["skein1024-672"]=n.from("b3b4","hex"),t["skein1024-680"]=n.from("b3b5","hex"),t["skein1024-688"]=n.from("b3b6","hex"),t["skein1024-696"]=n.from("b3b7","hex"),t["skein1024-704"]=n.from("b3b8","hex"),t["skein1024-712"]=n.from("b3b9","hex"),t["skein1024-720"]=n.from("b3ba","hex"),t["skein1024-728"]=n.from("b3bb","hex"),t["skein1024-736"]=n.from("b3bc","hex"),t["skein1024-744"]=n.from("b3bd","hex"),t["skein1024-752"]=n.from("b3be","hex"),t["skein1024-760"]=n.from("b3bf","hex"),t["skein1024-768"]=n.from("b3c0","hex"),t["skein1024-776"]=n.from("b3c1","hex"),t["skein1024-784"]=n.from("b3c2","hex"),t["skein1024-792"]=n.from("b3c3","hex"),t["skein1024-800"]=n.from("b3c4","hex"),t["skein1024-808"]=n.from("b3c5","hex"),t["skein1024-816"]=n.from("b3c6","hex"),t["skein1024-824"]=n.from("b3c7","hex"),t["skein1024-832"]=n.from("b3c8","hex"),t["skein1024-840"]=n.from("b3c9","hex"),t["skein1024-848"]=n.from("b3ca","hex"),t["skein1024-856"]=n.from("b3cb","hex"),t["skein1024-864"]=n.from("b3cc","hex"),t["skein1024-872"]=n.from("b3cd","hex"),t["skein1024-880"]=n.from("b3ce","hex"),t["skein1024-888"]=n.from("b3cf","hex"),t["skein1024-896"]=n.from("b3d0","hex"),t["skein1024-904"]=n.from("b3d1","hex"),t["skein1024-912"]=n.from("b3d2","hex"),t["skein1024-920"]=n.from("b3d3","hex"),t["skein1024-928"]=n.from("b3d4","hex"),t["skein1024-936"]=n.from("b3d5","hex"),t["skein1024-944"]=n.from("b3d6","hex"),t["skein1024-952"]=n.from("b3d7","hex"),t["skein1024-960"]=n.from("b3d8","hex"),t["skein1024-968"]=n.from("b3d9","hex"),t["skein1024-976"]=n.from("b3da","hex"),t["skein1024-984"]=n.from("b3db","hex"),t["skein1024-992"]=n.from("b3dc","hex"),t["skein1024-1000"]=n.from("b3dd","hex"),t["skein1024-1008"]=n.from("b3de","hex"),t["skein1024-1016"]=n.from("b3df","hex"),t["skein1024-1024"]=n.from("b3e0","hex"),t.ip4=n.from("04","hex"),t.ip6=n.from("29","hex"),t.tcp=n.from("06","hex"),t.udp=n.from("0111","hex"),t.dccp=n.from("21","hex"),t.sctp=n.from("84","hex"),t.udt=n.from("012d","hex"),t.utp=n.from("012e","hex"),t.ipfs=n.from("01a5","hex"),t.http=n.from("01e0","hex"),t.https=n.from("01bb","hex"),t.quic=n.from("01cc","hex"),t.ws=n.from("01dd","hex"),t.onion=n.from("01bc","hex"),t["p2p-circuit"]=n.from("0122","hex"),t["git-raw"]=n.from("78","hex"),t["dag-pb"]=n.from("70","hex"),t["dag-cbor"]=n.from("71","hex"),t["git-raw"]=n.from("78","hex"),t["eth-block"]=n.from("90","hex"),t["eth-block-list"]=n.from("91","hex"),t["eth-tx-trie"]=n.from("92","hex"),t["eth-tx"]=n.from("93","hex"),t["eth-tx-receipt-trie"]=n.from("94","hex"),t["eth-tx-receipt"]=n.from("95","hex"),t["eth-state-trie"]=n.from("96","hex"),t["eth-account-snapshot"]=n.from("97","hex"),t["eth-storage-trie"]=n.from("98","hex"),t["bitcoin-block"]=n.from("b0","hex"),t["bitcoin-tx"]=n.from("b1","hex"),t["zcash-block"]=n.from("c0","hex"),t["zcash-tx"]=n.from("c1","hex"),t["stellar-block"]=n.from("d0","hex"),t["stellar-tx"]=n.from("d1","hex"),t["torrent-info"]=n.from("7b","hex"),t["torrent-file"]=n.from("7c","hex"),t["ed25519-pub"]=n.from("ed","hex")}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(38);e.exports=(e=>{if(!t.isBuffer(e))throw new Error("arg needs to be a buffer");let n=[];for(;e.length>0;){const t=r.decode(e);n.push(t),e=e.slice(r.decode.bytes)}return n})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports="\n message Message {\n message Wantlist {\n message Entry {\n // changed from string to bytes, it makes a difference in JavaScript\n optional bytes block = 1; // the block cid (cidV0 in bitswap 1.0.0, cidV1 in bitswap 1.1.0)\n optional int32 priority = 2; // the priority (normalized). default to 1\n optional bool cancel = 3; // whether this revokes an entry\n }\n\n repeated Entry entries = 1; // a list of wantlist entries\n optional bool full = 2; // whether this is the full wantlist. default to false\n }\n\n message Block {\n optional bytes prefix = 1; // CID prefix (cid version, multicodec and multihash prefix (type + length)\n optional bytes data = 2;\n }\n\n optional Wantlist wantlist = 1;\n repeated bytes blocks = 2; // used to send Blocks in bitswap 1.0.0\n repeated Block payload = 3; // used to send Blocks in bitswap 1.1.0\n }\n"},function(e,t,n){"use strict";const r=n(242).Entry,i=n(9),o=n(18);e.exports=class e{constructor(e,t,n){o(i.isCID(e),"needs valid cid"),this.entry=new r(e,t),this.cancel=Boolean(n)}get cid(){return this.entry.cid}set cid(e){this.entry.cid=e}get priority(){return this.entry.priority}set priority(e){this.entry.priority=e}get[Symbol.toStringTag](){const e=this.cid.toBaseEncodedString();return`BitswapMessageEntry ${e} `}equals(e){return this.cancel===e.cancel&&this.entry.equals(e.entry)}}},function(e,t,n){"use strict";const r=n(18),i=n(9);class o{constructor(e,t){r(i.isCID(e),"must be valid CID"),this._refCounter=1,this.cid=e,this.priority=t||1}inc(){this._refCounter+=1}dec(){this._refCounter=Math.max(0,this._refCounter-1)}hasRefs(){return this._refCounter>0}get[Symbol.toStringTag](){const e=this.cid.toBaseEncodedString();return`WantlistEntry `}equals(e){return this._refCounter===e._refCounter&&this.cid.equals(e.cid)&&this.priority===e.priority}}e.exports=o},function(e,t,n){"use strict";const r=n(489),i=n(241),o=n(120).logger;e.exports=class e{constructor(e,t,n){this.peerId=t,this.network=n,this.refcnt=1,this._entries=[],this._log=o(e,"msgqueue",t.toB58String().slice(0,8)),this.sendEntries=r(this._sendEntries.bind(this),200)}addMessage(e){e.empty||this.send(e)}addEntries(e){this._entries=this._entries.concat(e),this.sendEntries()}_sendEntries(){if(!this._entries.length)return;const e=new i(!1);this._entries.forEach(t=>{t.cancel?e.cancel(t.cid):e.addEntry(t.cid,t.priority)}),this._entries=[],this.addMessage(e)}send(e){this.network.connectTo(this.peerId,t=>{t?this._log.error("cant connect to peer %s: %s",this.peerId.toB58String(),t.message):(this._log("sending message"),this.network.sendMessage(this.peerId,e,e=>{e&&this._log.error("send error: %s",e.message)}))})}}},function(e,t,n){"use strict";const r=n(72),i=n(26),o=n(11),s=n(61),a=n(89),u=n(241),l=n(319),c=n(120).logger,f="/ipfs/bitswap/1.0.0",h="/ipfs/bitswap/1.1.0";class p{constructor(e,t,n,r){this._log=c(e.peerInfo.id,"network"),n=n||{},this.libp2p=e,this.bitswap=t,this.b100Only=n.b100Only||!1,this._stats=r,this._running=!1}start(e){this._running=!0,this._onPeerConnect=this._onPeerConnect.bind(this),this._onPeerDisconnect=this._onPeerDisconnect.bind(this),this._onConnection=this._onConnection.bind(this),this.libp2p.handle(f,this._onConnection),this.b100Only||this.libp2p.handle(h,this._onConnection),this.libp2p.on("peer:connect",this._onPeerConnect),this.libp2p.on("peer:disconnect",this._onPeerDisconnect),this.libp2p.peerBook.getAllArray().filter(e=>e.isConnected()).forEach(e=>this._onPeerConnect(e)),a(()=>e())}stop(e){this._running=!1,this.libp2p.unhandle(f),this.b100Only||this.libp2p.unhandle(h),this.libp2p.removeListener("peer:connect",this._onPeerConnect),this.libp2p.removeListener("peer:disconnect",this._onPeerDisconnect),a(()=>e())}_onConnection(e,t){this._running&&(this._log("incomming new bitswap connection: %s",e),i(t,r.decode(),i.asyncMap((e,t)=>u.deserialize(e,t)),i.asyncMap((e,n)=>{t.getPeerInfo((t,r)=>{if(t)return n(t);this.bitswap._receiveMessage(r.id,e,n)})}),i.onEnd(e=>{this._log("ending connection"),e&&this.bitswap._receiveError(e)})))}_onPeerConnect(e){this._running&&this.bitswap._onPeerConnected(e.id)}_onPeerDisconnect(e){this._running&&this.bitswap._onPeerDisconnected(e.id)}findProviders(e,t,n){this.libp2p.contentRouting.findProviders(e,{maxTimeout:l.providerRequestTimeout,maxNumProviders:t},n)}findAndConnect(e,t){o([t=>this.findProviders(e,l.maxProvidersPerRequest,t),(e,t)=>{this._log("connecting to providers",e.map(e=>e.id.toB58String())),s(e,(e,t)=>this.connectTo(e,t))}],t)}provide(e,t){this.libp2p.contentRouting.provide(e,t)}sendMessage(e,t,n){if(!this._running)return n(new Error("network isn't running"));const r=e.toB58String()?e.toB58String():e.id.toB58String();this._log("sendMessage to %s",r,t),this._dialPeer(e,(r,i,o)=>{if(r)return n(r);let s;switch(o){case f:s=t.serializeToBitswap100();break;case h:s=t.serializeToBitswap110();break;default:return n(new Error("Unkown protocol: "+o))}d(i,s,e=>{e&&this._log.error(e)}),n(),this._updateSentStats(e,t.blocks)})}connectTo(e,t){if(!this._running)return t(new Error("network isn't running"));this.libp2p.dial(e,t)}_dialPeer(e,t){this.libp2p.dialProtocol(e,h,(n,r)=>{n?this.libp2p.dialProtocol(e,f,(e,n)=>{if(e)return t(e);t(null,n,f)}):t(null,r,h)})}_updateSentStats(e,t){const n=e.toB58String();this._stats&&(t.forEach(e=>this._stats.push(n,"dataSent",e.data.length)),this._stats.push(n,"blocksSent",t.size))}}function d(e,t,n){i(i.values([t]),r.encode(),e,i.onEnd(n))}e.exports=p},function(e,t,n){"use strict";const r=n(4).Buffer;e.exports=o;const i=10240;function o(e){e=Object.assign({fixed:!1},e||{});const t=n(38);let i=e.fixed?null:s(),o=0,a=!1;return n=>(u,l)=>{if(u&&(a=u),a)return l(a);n(null,(n,u)=>{if(n&&(a=n),a)return l(a);if(!r.isBuffer(u))return a=new Error("data must be a buffer"),l(a);let c;e.fixed?(c=r.alloc(4),c.writeInt32BE(u.length,0)):(t.encode(u.length,i,o),o+=t.encode.bytes,c=i.slice(o-t.encode.bytes,o),i.length-o<100&&(i=s(),o=0)),l(null,r.concat([c,u]))})}}function s(){return r.alloc(i)}},function(e,t,n){"use strict";const r=n(38),i=n(490),o=n(4).Buffer,s=n(73);t.decode=c,t.decodeFromReader=f;const a=128,u=e=>!(128&e),l=4194304;function c(e){let t=new i,n=s(e=>{t.abort(e)});return r=>{function i(){h(t,e,(e,t)=>{if(e)return n.end(e);n.push(t),i()})}return t(r),i(),n}}function f(e,t,n){"function"==typeof t&&(n=t,t={}),h(e,t,function e(t,r){if(t)return n(!0===t?new Error("Unexpected end of input from reader."):t);n(null,r)})}function h(e,t,n){t=Object.assign({fixed:!1,maxLength:l},t||{}),t.fixed?p(e,t.maxLength,n):d(e,t.maxLength,n)}function p(e,t,n){e.read(4,(r,i)=>{if(r)return n(r);const o=i.readInt32BE(0);if(o>t)return n(new Error("size longer than max permitted length of "+t+"!"));m(e,o,n)})}function d(e,t,n){let i=[];function s(){e.read(1,(a,l)=>{if(a)return n(a);if(i.push(l),l&&!u(l[0]))return void s();const c=r.decode(o.concat(i));if(c>t)return n(new Error("size longer than max permitted length of "+t+"!"));m(e,c,(e,t)=>e?n(e):(i=[],t.length{if(e)return n(e);n(null,t)})}},function(e,t,n){(function(t){e.exports=function(){var e=[],n=0;function r(){return e.reduce(function(e,t){return e+t.length},0)}return{length:n,data:this,add:function(r){if(!t.isBuffer(r))throw new Error("data must be a buffer, was: "+JSON.stringify(r));return this.length=n+=r.length,e.push(r),this},has:function(e){return null==e?n>0:n>=e},get:function(r){var i;if(null==r||r===n){n=0;var o=e;return e=[],1==o.length?o[0]:t.concat(o)}if(e.length>1&&r<=(i=e[0].length)){var s=e[0].slice(0,r);return r===i?e.shift():e[0]=e[0].slice(r,i),n-=r,s}if(re+t.data.byteLength,0);if(r{if(u--,a.push(t),o+=t.data.byteLength,o>=g||0===u){o=0;const t=a.slice();a=[],this._sendSafeBlocks(e,t,e=>{e&&this._log("sendblock error: %s",e.message),n()})}else s(n)},n)}_sendSafeBlocks(e,t,n){const r=new l(!1);t.forEach(e=>r.addBlock(e)),this.network.sendMessage(e,r,n)}_processTasks(){if(!this._running||!this._tasks.length)return;const e=this._tasks;this._tasks=[];const t=e.map(e=>e.entry),n=t.map(e=>e.cid),i=m((e,t)=>e.equals(t),n),s=p(e=>e.target.toB58String(),e);o([e=>a(i,(e,t)=>{this.blockstore.get(e,t)},e),(e,t)=>r(Object.values(s),(t,r)=>{const i=t[0].target,o=n.map(t=>e.find(e=>e.cid.equals(t)));this._sendBlocks(i,o,e=>{e?this._log.error("should never happen: ",e):o.forEach(e=>this.messageSent(i,e)),r()})},t)],e=>{this._tasks=[],e&&this._log.error(e)})}wantlistForPeer(e){const t=e.toB58String();return this.ledgerMap.has(t)?this.ledgerMap.get(t).wantlist.sortedEntries():new Map}ledgerForPeer(e){const t=e.toB58String(),n=this.ledgerMap.get(t);return n?{peer:n.partner.toPrint(),value:n.debtRatio(),sent:n.accounting.bytesSent,recv:n.accounting.bytesRecv,exchanged:n.exchangeCount}:null}peers(){return Array.from(this.ledgerMap.values()).map(e=>e.partner)}receivedBlocks(e){e.length&&(this.ledgerMap.forEach(t=>{e.map(e=>t.wantlistContains(e)).filter(Boolean).forEach(e=>{this._tasks.push({entry:e,target:t.partner})})}),this._outbox())}messageReceived(e,t,n){const r=this._findOrCreate(e);if(t.empty)return s(n);if(t.full&&(r.wantlist=new c),this._processBlocks(t.blocks,r),0===t.wantlist.size)return s(n);let i=[],o=[];t.wantlist.forEach(e=>{e.cancel?(r.cancelWant(e.cid),i.push(e)):(r.wants(e.cid,e.priority),o.push(e))}),this._cancelWants(r,e,i),this._addWants(r,e,o,n)}_cancelWants(e,t,n){const r=t.toB58String();this._tasks=d((e,t)=>{const n=e.target.toB58String()===r,i=e.entry.cid.equals(t.cid);return n&&i},this._tasks,n)}_addWants(e,t,n,i){r(n,(e,n)=>{this.blockstore.has(e.cid,(r,i)=>{r?this._log.error("failed existence check"):i&&this._tasks.push({entry:e.entry,target:t}),n()})},()=>{this._outbox(),i()})}_processBlocks(e,t,n){const r=[];e.forEach((e,n)=>{this._log("got block (%s bytes)",e.data.length),t.receivedBytes(e.data.length),r.push(e.cid)}),this.receivedBlocks(r)}messageSent(e,t){const n=this._findOrCreate(e);n.sentBytes(t?t.data.length:0),t&&t.cid&&n.wantlist.remove(t.cid)}numBytesSentTo(e){return this._findOrCreate(e).accounting.bytesSent}numBytesReceivedFrom(e){return this._findOrCreate(e).accounting.bytesRecv}peerDisconnected(e){}_findOrCreate(e){const t=e.toB58String();if(this.ledgerMap.has(t))return this.ledgerMap.get(t);const n=new f(e);return this.ledgerMap.set(t,n),this._stats&&this._stats.push(t,"peerCount",1),n}start(e){this._running=!0,s(()=>e())}stop(e){this._running=!1,s(()=>e())}}e.exports=y},function(e,t,n){"use strict";const r=n(242);class i{constructor(e){this.partner=e,this.wantlist=new r,this.exchangeCount=0,this.sentToPeer=new Map,this.accounting={bytesSent:0,bytesRecv:0}}sentBytes(e){this.exchangeCount++,this.lastExchange=(new Date).getTime(),this.accounting.bytesSent+=e}receivedBytes(e){this.exchangeCount++,this.lastExchange=(new Date).getTime(),this.accounting.bytesRecv+=e}wants(e,t){this.wantlist.add(e,t)}cancelWant(e){this.wantlist.remove(e)}wantlistContains(e){return this.wantlist.contains(e)}debtRatio(){return this.accounting.bytesSent/(this.accounting.bytesRecv+1)}}e.exports=i},function(e,t,n){"use strict";const r=n(6).EventEmitter,i=n(319),o=n(120).logger,s=e=>`unwant:${e}`,a=e=>`block:${e}`;class u extends r{constructor(e){super(),this.setMaxListeners(i.maxListeners),this._log=o(e,"notif"),this._unwantListeners={},this._blockListeners={}}hasBlock(e){const t=`block:${e.cid.buffer.toString()}`;this._log(t),this.emit(t,e)}wantBlock(e,t,n){const r=e.buffer.toString();this._log(`wantBlock:${r}`),this._unwantListeners[r]=(()=>{this._log(`manual unwant: ${r}`),this._cleanup(r),n()}),this._blockListeners[r]=(e=>{this._cleanup(r),t(e)}),this.once(s(r),this._unwantListeners[r]),this.once(a(r),this._blockListeners[r])}unwantBlock(e){const t=`unwant:${e.buffer.toString()}`;this._log(t),this.emit(t)}_cleanup(e){this._unwantListeners[e]&&(this.removeListener(s(e),this._unwantListeners[e]),delete this._unwantListeners[e]),this._blockListeners[e]&&(this.removeListener(a(e),this._blockListeners[e]),delete this._blockListeners[e])}}e.exports=u},function(e,t,n){"use strict";const r=n(6),i=n(999),o={movingAverageIntervals:[6e4,3e5,9e5]};class s extends r{constructor(e,t){super();const n=Object.assign({},o,t);if("number"!=typeof n.computeThrottleTimeout)throw new Error("need computeThrottleTimeout");if("number"!=typeof n.computeThrottleMaxQueueSize)throw new Error("need computeThrottleMaxQueueSize");this._initialCounters=e,this._options=n,this._enabled=this._options.enabled,this._global=new i(e,n),this._global.on("update",e=>this.emit("update",e)),this._peers=new Map}enable(){this._enabled=!0,this._options.enabled=!0,this._global.enable()}disable(){this._enabled=!1,this._options.enabled=!1,this._global.disable()}stop(){this._enabled=!1,this._global.stop();for(let e of this._peers)e[1].stop()}get snapshot(){return this._global.snapshot}get movingAverages(){return this._global.movingAverages}forPeer(e){return e.toB58String&&(e=e.toB58String()),this._peers.get(e)}push(e,t,n){if(this._enabled&&(this._global.push(t,n),e)){let r=this._peers.get(e);r||(r=new i(this._initialCounters,this._options),this._peers.set(e,r)),r.push(t,n)}}disconnected(e){const t=e.toB58String(),n=this._peers.get(t);n&&(n.stop(),this._peers.delete(t))}}e.exports=s},function(e,t,n){"use strict";const r=n(6),i=n(62),o=n(492);class s extends r{constructor(e,t){super(),this._options=t,this._queue=[],this._stats={},this._frequencyLastTime=Date.now(),this._frequencyAccumulators={},this._movingAverages={},this._update=this._update.bind(this),e.forEach(e=>{this._stats[e]=i(0),this._movingAverages[e]={},this._options.movingAverageIntervals.forEach(t=>{const n=this._movingAverages[e][t]=o(t);n.push(this._frequencyLastTime,0)})}),this._enabled=this._options.enabled}enable(){this._enabled=!0}disable(){this._disabled=!0}stop(){this._timeout&&clearTimeout(this._timeout)}get snapshot(){return Object.assign({},this._stats)}get movingAverages(){return Object.assign({},this._movingAverages)}push(e,t){this._enabled&&(this._queue.push([e,t,Date.now()]),this._resetComputeTimeout())}_resetComputeTimeout(){this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout(this._update,this._nextTimeout())}_nextTimeout(){const e=this._queue.length/this._options.computeThrottleMaxQueueSize;return Math.max(this._options.computeThrottleTimeout*(1-e),0)}_update(){if(this._timeout=null,this._queue.length){let e;for(;this._queue.length;){const t=e=this._queue.shift();this._applyOp(t)}this._updateFrequency(e[2]),this.emit("update",this._stats)}}_updateFrequency(e){const t=e-this._frequencyLastTime;Object.keys(this._stats).forEach(n=>{this._updateFrequencyFor(n,t,e)}),this._frequencyLastTime=e}_updateFrequencyFor(e,t,n){const r=this._frequencyAccumulators[e]||0;this._frequencyAccumulators[e]=0;const i=r/t*1e3;let s=this._movingAverages[e];s||(s=this._movingAverages[e]={}),this._options.movingAverageIntervals.forEach(e=>{let t=s[e];t||(t=s[e]=o(e)),t.push(n,i)})}_applyOp(e){const t=e[0],n=e[1];if("number"!=typeof n)throw new Error("invalid increment number:",n);let r;r=this._stats.hasOwnProperty(t)?this._stats[t]:this._stats[t]=i(0),this._stats[t]=r.plus(n),this._frequencyAccumulators[t]||(this._frequencyAccumulators[t]=0),this._frequencyAccumulators[t]+=n}}e.exports=s},function(e,t,n){var r=n(1001),i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,o=/\\(\\)?/g,s=r(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(i,function(e,n,r,i){t.push(r?i.replace(o,"$1"):n||e)}),t});e.exports=s},function(e,t,n){var r=n(1002),i=500;function o(e){var t=r(e,function(e){return n.size===i&&n.clear(),e}),n=t.cache;return t}e.exports=o},function(e,t,n){var r=n(322),i="Expected a function";function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(i);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(o.Cache||r),n}o.Cache=r,e.exports=o},function(e,t,n){var r=n(1004),i=n(245),o=n(323);function s(){this.size=0,this.__data__={hash:new r,map:new(o||i),string:new r}}e.exports=s},function(e,t,n){var r=n(1005),i=n(1010),o=n(1011),s=n(1012),a=n(1013);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1}e.exports=i},function(e,t,n){var r=n(246);function i(e,t){var n=this.__data__,i=r(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}e.exports=i},function(e,t,n){var r=n(247);function i(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}e.exports=i},function(e,t){function n(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}e.exports=n},function(e,t,n){var r=n(247);function i(e){return r(this,e).get(e)}e.exports=i},function(e,t,n){var r=n(247);function i(e){return r(this,e).has(e)}e.exports=i},function(e,t,n){var r=n(247);function i(e,t){var n=r(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this}e.exports=i},function(e,t,n){var r=n(174),i=n(297),o=n(67),s=n(321),a=1/0,u=r?r.prototype:void 0,l=u?u.toString:void 0;function c(e){if("string"==typeof e)return e;if(o(e))return i(e,c)+"";if(s(e))return l?l.call(e):"";var t=e+"";return"0"==t&&1/e==-a?"-0":t}e.exports=c},function(e,t,n){"use strict";e.exports=a;var r=n(80),i=a.prototype,o=new Date%1e9;function s(){return(1e9*Math.random()>>>0)+o++}function a(e){e=e||{},this.id=e.id||s(),this.max=e.max||1/0,this.items=e.items||[],this._lookup={},this.size=this.items.length,this.lastModified=new Date(e.lastModified||new Date);for(var t,n,r=this.items.length;r--;)t=this.items[r],n=new Date(t.expires)-new Date,this._lookup[t.key]=t,n>0?this.expire(t.key,n):n<=0&&this.delete(t.key)}i.has=function(e){return e in this._lookup},i.get=function(e){if(!this.has(e))return null;var t=this._lookup[e];return t.refresh&&this.expire(e,t.refresh),this.items.splice(this.items.indexOf(t),1),this.items.push(t),t.value},i.meta=function(e){if(!this.has(e))return null;var t=this._lookup[e];return"meta"in t?t.meta:null},i.set=function(e,t,n){var r=this._lookup[e],i=this._lookup[e]={key:e,value:t};return this.lastModified=new Date,r?(clearTimeout(r.timeout),this.items.splice(this.items.indexOf(r),1,i)):(this.size>=this.max&&this.delete(this.items[0].key),this.items.push(i),this.size++),n&&("ttl"in n&&this.expire(e,n.ttl),"meta"in n&&(i.meta=n.meta),n.refresh&&(i.refresh=n.ttl)),this},i.delete=function(e){var t=this._lookup[e];return!!t&&(this.lastModified=new Date,this.items.splice(this.items.indexOf(t),1),clearTimeout(t.timeout),delete this._lookup[e],this.size--,this)},i.expire=function(e,t){var n=t||0,i=this._lookup[e];if(!i)return this;if("string"==typeof n&&(n=r(t)),"number"!=typeof n)throw new TypeError("Expiration time must be a string or number.");return clearTimeout(i.timeout),i.timeout=setTimeout(this.delete.bind(this,i.key),n),i.expires=Number(new Date)+n,this},i.clear=function(){for(var e=this.items.length;e--;)this.delete(this.items[e].key);return this},i.toJSON=function(){for(var e=new Array(this.items.length),t,n=e.length;n--;)t=this.items[n],e[n]={key:t.key,meta:t.meta,value:t.value,expires:t.expires,refresh:t.refresh};return{id:this.id,max:isFinite(this.max)?this.max:void 0,lastModified:this.lastModified,items:e}}},function(e,t,n){"use strict";const r=n(23),{Key:i}=n(33),o=n(39),s=n(22),a=n(5),u=a("jsipfs:ipns:publisher");u.error=a("jsipfs:ipns:publisher:error");const l=n(181),c=36e5;class f{constructor(e,t){this._routing=e,this._datastore=t}publishWithEOL(e,t,n,i){if(!e||!e.bytes){const e="one or more of the provided parameters are not defined";return u.error(e),i(s(new Error(e),"ERR_UNDEFINED_PARAMETER"))}r.createFromPrivKey(e.bytes,(r,o)=>{if(r)return i(r);this._updateOrCreateRecord(e,t,n,o,(e,t)=>{if(e)return i(e);this._putRecordToRouting(t,o,i)})})}publish(e,t,n){this.publishWithEOL(e,t,c,n)}_putRecordToRouting(e,t,n){if(!r.isPeerId(t)){const e="peerId received is not valid";return u.error(e),n(s(new Error(e),"ERR_INVALID_PEER_ID"))}const i=t._pubKey;l.embedPublicKey(i,e,(r,s)=>{if(r)return n(r);let a;try{a=l.getIdKeys(t.toBytes())}catch(r){return u.error(r),n(r)}o([n=>this._publishEntry(a.routingKey,s||e,t,n),e=>this._publishPublicKey(a.routingPubKey,i,t,e)],t=>{if(t)return u.error(t),n(t);n(null,s||e)})})}_publishEntry(e,t,n,r){if(!i.isKey(e)){const e="datastore key does not have a valid format";return u.error(e),r(s(new Error(e),"ERR_INVALID_DATASTORE_KEY"))}let o;try{o=l.marshal(t)}catch(e){return u.error(e),r(e)}this._routing.put(e.toBuffer(),o,(t,n)=>{if(t){const t=`ipns record for ${e.toString()} could not be stored in the routing`;return u.error(t),r(s(new Error(t),"ERR_PUTTING_TO_ROUTING"))}u(`ipns record for ${e.toString()} was stored in the routing`),r(null,n)})}_publishPublicKey(e,t,n,r){if(!i.isKey(e)){const e="datastore key does not have a valid format";return u.error(e),r(s(new Error(e),"ERR_INVALID_DATASTORE_KEY"))}if(!t||!t.bytes){const e="one or more of the provided parameters are not defined";return u.error(e),r(s(new Error(e),"ERR_UNDEFINED_PARAMETER"))}this._routing.put(e.toBuffer(),t.bytes,(t,n)=>{if(t){const t=`public key for ${e.toString()} could not be stored in the routing`;return u.error(t),r(s(new Error(t),"ERR_PUTTING_TO_ROUTING"))}u(`public key for ${e.toString()} was stored in the routing`),r(null,n)})}_getPublished(e,t,n){if(!r.isPeerId(e)){const e="peerId received is not valid";return u.error(e),n(s(new Error(e),"ERR_INVALID_PEER_ID"))}t=t||{};const i=!1!==t.checkRouting;this._datastore.get(l.getLocalKey(e.id),(t,r)=>{if(t){if("ERR_NOT_FOUND"!==t.code){const t=`unexpected error getting the ipns record ${e.id} from datastore`;return u.error(t),n(s(new Error(t),"ERR_UNEXPECTED_DATASTORE_RESPONSE"))}if(!i)return n(s(t));let r;try{r=l.getIdKeys(e.toBytes())}catch(t){return u.error(t),n(t)}this._routing.get(r.routingKey.toBuffer(),(e,t)=>{if(e)return n(e);this._unmarshalData(t,n)})}else this._unmarshalData(r,n)})}_unmarshalData(e,t){let n;try{n=l.unmarshal(e)}catch(e){return u.error(e),t(s(e,"ERR_INVALID_RECORD_DATA"))}t(null,n)}_updateOrCreateRecord(e,t,n,i,o){if(!r.isPeerId(i)){const e="peerId received is not valid";return u.error(e),o(s(new Error(e),"ERR_INVALID_PEER_ID"))}const a={checkRouting:!0};this._getPublished(i,a,(r,a)=>{if(r&&"ERR_NOT_FOUND"!==r.code){const e=`unexpected error when determining the last published IPNS record for ${i.id}`;return u.error(e),o(s(new Error(e),"ERR_DETERMINING_PUBLISHED_RECORD"))}let c=0;a&&void 0!==a.sequence&&(c=a.value.toString()!==t?a.sequence+1:a.sequence),l.create(e,t,c,n,(e,n)=>{if(e){const e=`ipns record for ${t} could not be created`;return u.error(e),o(s(new Error(e),"ERR_CREATING_IPNS_RECORD"))}const r=l.marshal(n);this._datastore.put(l.getLocalKey(i.id),r,(e,r)=>{if(e){const e=`ipns record for ${t} could not be stored in the datastore`;return u.error(e),o(s(new Error(e),"ERR_STORING_IN_DATASTORE"))}u(`ipns record for ${t} was stored in the datastore`),o(null,n)})})})}}t=e.exports=f},function(e,t){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",r="0123456789ABCDEFGHIJKLMNOPQRSTUV",i="0123456789ABCDEFGHJKMNPQRSTVWXYZ";e.exports=function e(t,o,s){var a,u;switch(s=s||{},o){case"RFC3548":case"RFC4648":a=n,u=!0;break;case"RFC4648-HEX":a=r,u=!0;break;case"Crockford":a=i,u=!1;break;default:throw new Error("Unknown base32 variant: "+o)}for(var l=void 0!==s.padding?s.padding:u,c=t.byteLength,f=new Uint8Array(t),h=0,p=0,d="",m=0;m=5;)d+=a[p>>>h-5&31],h-=5;if(h>0&&(d+=a[p<<5-h&31]),l)for(;d.length%8!=0;)d+="=";return d}},function(e,t,n){ /** * Timestamp for 64-bit time_t, nanosecond precision and strftime * @@ -101,26 +341,9 @@ var n,i;n=this,i=function(){"use strict";var e=function(e,r){return t(e.slice(), * @license MIT * @see https://github.com/kawanet/timestamp-nano */ -var n=function(){e.exports=y;var t=86400,r=3200,n=146097*r/400,i=t*n,o=1e3*i,s=1e11*t,a=16777216,u=4294967296,c=1e6,f=1e9,h="000000000",l=Math.trunc||N,d=y.prototype;y.fromDate=C,y.fromInt64BE=P(0,1,2,3,0,4),y.fromInt64LE=P(3,2,1,0,4,0),y.fromString=x,y.fromTimeT=A,d.year=0,d.time=0,d.nano=0,d.addNano=E,d.getNano=k,d.getTimeT=T,d.getYear=v,d.toDate=w,d.toJSON=O,d.toString=R,d.writeInt64BE=B(0,1,2,3,0,4),d.writeInt64LE=B(3,2,1,0,4,0);var p="%Y-%m-%dT%H:%M:%S.%NZ",g=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],m=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],b={"%":"%",F:"%Y-%m-%d",n:"\n",R:"%H:%M",T:"%H:%M:%S",t:"\t",X:"%T",Z:"GMT",z:"+0000"};return y;function y(e,t,r){var n=this;if(!(n instanceof y))return new y(e,t,r);n.time=+e||0,n.nano=+t||0,n.year=+r||0,_(n)}function v(){var e=this.toDate().getUTCFullYear();return e+this.year}function _(e){var t=e.year,n=e.time,i=e.nano,a,u;if(i<0||c<=i){var f=Math.floor(i/c);i-=f*c,n+=f,a=1}var h=t%r;if(n<-s||s1?n[1]--:n[1]=0,r.time=t=Date.UTC.apply(Date,n)-(t||0),isNaN(t))throw new TypeError("Invalid Date");return _(r)}function C(e){return new y(+e)}function A(e){return I(e,0)}function I(e,t){t|=0,t*=u,e=+e||0;var n=l(t/i)+l(e/i),o=t%i+e%i,s=l(o/i);return s&&(n+=s,o-=s*i),new y(1e3*o,0,n*r)}function T(){var e=_(this),i=Math.floor(e.time/1e3),o=e.year;return o&&(i+=o*n*t/r),i}function O(){return this.toString().replace(/0{1,6}Z$/,"Z")}function R(e){var t=this,r=t.toDate(),n={H:c,L:l,M:f,N:d,S:h,Y:o,a:y,b:v,d:a,e:u,m:s};return i(e||p);function i(e){return e.replace(/%./g,function(e){var t=e[1],r=b[t],o=n[t];return r?i(r):o?o():e})}function o(){var e=t.getYear();return e>999999?"+"+e:e>9999?"+"+D(e,6):e>=0?D(e,4):e>=-999999?"-"+D(-e,6):e}function s(){return j(r.getUTCMonth()+1)}function a(){return j(r.getUTCDate())}function u(){return L(r.getUTCDate())}function c(){return j(r.getUTCHours())}function f(){return j(r.getUTCMinutes())}function h(){return j(r.getUTCSeconds())}function l(){return D(r.getUTCMilliseconds(),3)}function d(){return D(t.getNano(),9)}function y(){return m[r.getUTCDay()]}function v(){return g[r.getUTCMonth()]}}function B(e,i,o,s,a,c){return f;function f(e,i){var o=_(this);e||(e=new Array(8)),M(e,i|=0);var s=Math.floor(o.time/1e3),f=o.year*(n*t/r),d=l(f/u)+l(s/u),p=f%u+s%u,g=Math.floor(p/u);return g&&(d+=g,p-=g*u),h(e,i+a,d),h(e,i+c,p),e}function h(t,r,n){t[r+e]=n>>24&255,t[r+i]=n>>16&255,t[r+o]=n>>8&255,t[r+s]=255&n}}function P(e,t,r,n,i,o){return s;function s(e,t){M(e,t|=0);var r=u(e,t+i),n=u(e,t+o);return I(n,r)}function u(i,o){return i[o+e]*a+(i[o+t]<<16|i[o+r]<<8|i[o+n])}}function M(e,t){var r=e&&e.length;if(null==r)throw new TypeError("Invalid Buffer");if(r9?"":" ")+(0|e)}function j(e){return(e>9?"":"0")+(0|e)}function D(e,t){return(h+(0|e)).substr(-t)}}()},function(e,t,r){"use strict";const n=r(60),i='\nmessage IpnsEntry {\n enum ValidityType {\n\t\tEOL = 0; // setting an EOL says "this record is valid until..."\n\t}\n\n required bytes value = 1;\n\trequired bytes signature = 2;\n\n\toptional ValidityType validityType = 3;\n\toptional bytes validity = 4;\n\n\toptional uint64 sequence = 5;\n\n\toptional uint64 ttl = 6;\n\n\t// in order for nodes to properly validate a record upon receipt, they need the public\n\t// key associated with it. For old RSA keys, its easiest if we just send this as part of\n\t// the record itself. For newer ed25519 keys, the public key can be embedded in the\n\t// peerID, making this field unnecessary.\n\toptional bytes pubKey = 7;\n}\n';e.exports=n(i).IpnsEntry},function(e,t,r){"use strict";const n=r(202);e.exports.toRFC3339=(e=>{const t=e.getUTCFullYear(),r=n(e.getUTCMonth()+1,2,"0"),i=n(e.getUTCDate(),2,"0"),o=n(e.getUTCHours(),2,"0"),s=n(e.getUTCMinutes(),2,"0"),a=n(e.getUTCSeconds(),2,"0"),u=e.getUTCMilliseconds(),c=1e3*u*1e3;return`${t}-${r}-${i}T${o}:${s}:${a}.${c}Z`}),e.exports.parseRFC3339=(e=>{const t=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),r=String(e).trim().match(t);if(!r)throw new Error("Invalid format");const n=parseInt(r[1],10),i=parseInt(r[2],10)-1,o=parseInt(r[3],10),s=parseInt(r[4],10),a=parseInt(r[5],10),u=parseInt(r[6],10),c=parseInt(r[7].slice(0,-6),10);return new Date(Date.UTC(n,i,o,s,a,u,c))})},function(e,t,r){"use strict";t.ERR_IPNS_EXPIRED_RECORD="ERR_IPNS_EXPIRED_RECORD",t.ERR_UNRECOGNIZED_VALIDITY="ERR_UNRECOGNIZED_VALIDITY",t.ERR_SIGNATURE_CREATION="ERR_SIGNATURE_CREATION",t.ERR_SIGNATURE_VERIFICATION="ERR_SIGNATURE_VERIFICATION",t.ERR_UNRECOGNIZED_FORMAT="ERR_UNRECOGNIZED_FORMAT",t.ERR_PEER_ID_FROM_PUBLIC_KEY="ERR_PEER_ID_FROM_PUBLIC_KEY",t.ERR_PUBLIC_KEY_FROM_ID="ERR_PUBLIC_KEY_FROM_ID",t.ERR_UNDEFINED_PARAMETER="ERR_UNDEFINED_PARAMETER"},function(e,t,r){"use strict";(function(n){const i=r(168),o=r(61),s=r(20),a=r(19),u=r(6),c=r(52),f=r(11),h=u("jsipfs:ipns:republisher");h.error=u("jsipfs:ipns:republisher:error");const l=6e4,d=60*l,p=4*d,g=24*d;class m{constructor(e,t,r,n,i){this._publisher=e,this._datastore=t,this._peerInfo=r,this._keychain=n,this._options=i,this._republishHandle=null}start(){if(this._republishHandle){const e="already running";throw h.error(e),a(new Error(e),"ERR_REPUBLISH_ALREADY_RUNNING")}const e={_onCancel:null,_timeoutId:null,runPeriodically:(t,r)=>{e._timeoutId=setTimeout(()=>{e._timeoutId=null,t(n=>{if(e._onCancel)return e._onCancel();e.runPeriodically(t,n||r)})},r)},cancel:t=>{if(e._timeoutId)return clearTimeout(e._timeoutId),t();e._onCancel=t}},{privKey:t}=this._peerInfo.id,{pass:r}=this._options;e.runPeriodically(e=>{this._republishEntries(t,r,()=>e(p))},l),this._republishHandle=e}stop(e){const t=this._republishHandle;if(!t){const t="not running";return h.error(t),e(a(new Error(t),"ERR_REPUBLISH_NOT_RUNNING"))}this._republishHandle=null,t.cancel(e)}_republishEntries(e,t,r){this._republishEntry(e,e=>{if(e){const e="cannot republish entry for the node's private key";h.error(e)}else t?this._keychain.listKeys((e,n)=>{e?h.error(e):c(n,(e,r)=>{f([r=>this._keychain.exportKey(e.name,t,r),(e,r)=>o.keys.import(e,t,r)],(e,t)=>{e?h.error(e):this._republishEntry(t,r)})},e=>{e&&h.error(e),r(null)})}):r(null)})}_republishEntry(e,t){if(!e||!e.bytes){const e="one or more of the provided parameters are not defined";return h.error(e),t(a(new Error(e),"ERR_UNDEFINED_PARAMETER"))}f([t=>s.createFromPrivKey(e.bytes,t),(e,t)=>this._getPreviousValue(e,t)],(r,n)=>{if(r)return t("ERR_NO_ENTRY_FOUND"===r.code?null:r);this._publisher.publishWithEOL(e,n,g,t)})}_getPreviousValue(e,t){if(!s.isPeerId(e)){const e="peerId received is not valid";return h.error(e),t(a(new Error(e),"ERR_INVALID_PEER_ID"))}this._datastore.get(i.getLocalKey(e.id),(r,o)=>{if(r&&r.notFound){const r=`no previous entry for record with id: ${e.id}`;return h.error(r),t(a(new Error(r),"ERR_NO_ENTRY_FOUND"))}if(r)return t(r);if(!n.isBuffer(o)){const e="found ipns record that we couldn't process";return h.error(e),t(a(new Error(e),"ERR_INVALID_IPNS_RECORD"))}let s;try{s=i.unmarshal(o)}catch(r){const e="found ipns record that we couldn't convert to a value";return h.error(e),t(a(new Error(e),"ERR_INVALID_IPNS_RECORD"))}t(null,s.value)})}}t=e.exports=m}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(168),i=r(61),o=r(20),s=r(19),a=r(6),u=a("jsipfs:ipns:resolver");u.error=a("jsipfs:ipns:resolver:error");const c=32;class f{constructor(e){this._routing=e}resolve(e,t,r){if("function"==typeof t&&(r=t,t={}),"string"!=typeof e){const e="one or more of the provided parameters are not valid";return u.error(e),r(s(new Error(e),"ERR_INVALID_PARAMETER"))}t=t||{};const n=t.recursive&&"true"===t.recursive.toString(),i=e.split("/");if(3!==i.length||""!==i[0]){const t=`invalid name syntax for ${e}`;return u.error(t),r(s(new Error(t),"ERR_INVALID_NAME_SYNTAX"))}const o=i[2];let a;n&&(a=c),this.resolver(o,a,(t,n)=>{if(t)return r(t);u(`${e} was locally resolved correctly`),r(null,n)})}resolver(e,t,r){if(0===t){const e=`could not resolve name (recursion limit of ${c} exceeded)`;return u.error(e),r(s(new Error(e),"ERR_RESOLVE_RECURSION_LIMIT"))}this._resolveName(e,(e,n)=>{if(e)return r(e);const i=n.split("/");if("ipfs"===i[1]||!t)return r(null,n);this.resolver(i[2],t-1,r)})}_resolveName(e,t){let r;try{r=o.createFromB58String(e)}catch(e){return t(e)}const{routingKey:a,routingPubKey:c}=n.getIdKeys(r.toBytes());this._routing.get(a.toBuffer(),(o,f)=>{if(o){if("ERR_NOT_FOUND"!==o.code){const e=`unexpected error getting the ipns record ${r.id}`;return u.error(e),t(s(new Error(e),"ERR_UNEXPECTED_ERROR_GETTING_RECORD"))}const n=`record requested was not found for ${e} (${a}) in the network`;return u.error(n),t(s(new Error(n),"ERR_NO_RECORD_FOUND"))}let h;try{h=n.unmarshal(f)}catch(o){const e="found ipns record that we couldn't convert to a value";return u.error(e),t(s(new Error(e),"ERR_INVALID_RECORD_RECEIVED"))}if(h.pubKey)return this._validateRecord(r,h,t);this._routing.get(a.toBuffer(),(n,o)=>{if(n){if("ERR_NOT_FOUND"!==n.code){const e=`unexpected error getting the public key for the ipns record ${r.id}`;return u.error(e),t(s(new Error(e),"ERR_UNEXPECTED_ERROR_GETTING_PUB_KEY"))}const i=`public key requested was not found for ${e} (${c}) in the network`;return u.error(i),t(s(new Error(i),"ERR_NO_RECORD_FOUND"))}try{r.pubKey=i.keys.unmarshalPublicKey(o)}catch(n){const e="found public key record that we couldn't convert to a value";return u.error(e),t(s(new Error(e),"ERR_INVALID_PUB_KEY_RECEIVED"))}this._validateRecord(r,h,t)})})}_validateRecord(e,t,r){n.extractPublicKey(e,t,(e,i)=>{if(e)return r(e);n.validate(i,t,e=>{if(e)return r(e);r(null,t.value.toString())})})}}t=e.exports=f},function(e,t,r){"use strict";(function(n){const{Key:i}=r(28),{encodeBase32:o,keyToTopic:s,topicToKey:a}=r(968),u=r(19),c=r(27),f=r(6),h=f("datastore-pubsub:publisher");h.error=f("datastore-pubsub:publisher:error");class l{constructor(e,t,r,n,i){c.strictEqual(typeof n,"object","missing validator"),c.strictEqual(typeof n.validate,"function","missing validate function"),c.strictEqual(typeof n.select,"function","missing select function"),i&&c.strictEqual(typeof i,"function","invalid subscriptionKeyFn received"),this._pubsub=e,this._datastore=t,this._peerId=r,this._validator=n,this._handleSubscriptionKeyFn=i,this._onMessage=this._onMessage.bind(this)}put(e,t,r){if(!n.isBuffer(e)){const e="datastore key does not have a valid format";return h.error(e),r(u(new Error(e),"ERR_INVALID_DATASTORE_KEY"))}if(!n.isBuffer(t)){const e="received value is not a buffer";return h.error(e),r(u(new Error(e),"ERR_INVALID_VALUE_RECEIVED"))}const i=s(e);h(`publish value for topic ${i}`),this._pubsub.publish(i,t,r)}get(e,t){if(!n.isBuffer(e)){const e="datastore key does not have a valid format";return h.error(e),t(u(new Error(e),"ERR_INVALID_DATASTORE_KEY"))}const r=s(e);this._pubsub.ls((n,i)=>n?t(n):i&&Array.isArray(i)&&i.indexOf(r)>-1?this._getLocal(e,t):void this._pubsub.subscribe(r,this._onMessage,n=>{if(n){const e=`cannot subscribe topic ${r}`;return h.error(e),t(u(new Error(e),"ERR_SUBSCRIBING_TOPIC"))}h(`subscribed values for key ${r}`),this._getLocal(e,t)}))}unsubscribe(e){const t=s(e);this._pubsub.unsubscribe(t,this._onMessage)}_getLocal(e,t){const r=new i("/"+o(e),!1);this._datastore.get(r,(e,i)=>{if(e){if("ERR_NOT_FOUND"!==e.code){const e=`unexpected error getting the ipns record for ${r.toString()}`;return h.error(e),t(u(new Error(e),"ERR_UNEXPECTED_ERROR_GETTING_RECORD"))}const n=`local record requested was not found for ${r.toString()}`;return h.error(n),t(u(new Error(n),"ERR_NOT_FOUND"))}if(!n.isBuffer(i)){const e="found record that we couldn't convert to a value";return h.error(e),t(u(new Error(e),"ERR_INVALID_RECORD_RECEIVED"))}t(null,i)})}_onMessage(e){const{data:t,from:r,topicIDs:n}=e;let i;try{i=a(n[0])}catch(e){return void h.error(e)}h(`message received for ${i} topic`),r!==this._peerId.toB58String()?this._handleSubscriptionKeyFn?this._handleSubscriptionKeyFn(i,(e,r)=>{e?h.error("message discarded by the subscriptionKeyFn"):this._storeIfSubscriptionIsBetter(r,t)}):this._storeIfSubscriptionIsBetter(i,t):h("message discarded as it is from the same peer")}_storeIfSubscriptionIsBetter(e,t){this._isBetter(e,t,(r,i)=>{!r&&i&&this._storeRecord(n.from(e),t)})}_validateRecord(e,t,r){this._validator.validate(e,t,r)}_selectRecord(e,t,r){this._validator.select(e,t,(e,t)=>{if(e)return h.error(e),r(e);r(null,0===t)})}_isBetter(e,t,r){this._validateRecord(t,e,(n,o)=>{if(n||!o){const e="record received through pubsub is not valid";return h.error(e),r(u(new Error(e),"ERR_NOT_VALID_RECORD"))}const s=new i(e);this._getLocal(s.toBuffer(),(e,n)=>e?r(null,!0):n.equals(t)?r(null,!1):void this._selectRecord(t,n,r))})}_storeRecord(e,t){const r=new i("/"+o(e),!1);this._datastore.put(r,t,t=>{t?h.error(`record for ${e.toString()} could not be stored in the routing`):h(`record for ${e.toString()} was stored in the datastore`)})}open(e){const t="open function was not implemented yet";return h.error(t),e(u(new Error(t),"ERR_NOT_IMPLEMENTED_YET"))}has(e,t){const r="has function was not implemented yet";return h.error(r),t(u(new Error(r),"ERR_NOT_IMPLEMENTED_YET"))}delete(e,t){const r="delete function was not implemented yet";return h.error(r),t(u(new Error(r),"ERR_NOT_IMPLEMENTED_YET"))}close(e){const t="close function was not implemented yet";return h.error(t),e(u(new Error(t),"ERR_NOT_IMPLEMENTED_YET"))}batch(){const e="batch function was not implemented yet";throw h.error(e),u(new Error(e),"ERR_NOT_IMPLEMENTED_YET")}query(){const e="query function was not implemented yet";throw h.error(e),u(new Error(e),"ERR_NOT_IMPLEMENTED_YET")}}t=e.exports=l}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(95),i=r(19),o="/record/",s="u";e.exports.encodeBase32=(e=>n.encode("base32",e).slice(1)),e.exports.keyToTopic=(e=>{const t=n.encode("base64url",e).slice(1).toString();return`/record/${t}`}),e.exports.topicToKey=(e=>{if(e.substring(0,o.length)!==o)throw i(new Error("topic received is not from a record"),"ERR_TOPIC_IS_NOT_FROM_RECORD_NAMESPACE");const t=`u${e.substring(o.length)}`;return n.decode(t).toString()})},function(e,t,r){"use strict";e.exports={Record:r(970),validator:r(973),selection:r(982)}},function(e,t,r){"use strict";(function(t){const n=r(60),i=r(27),o=n(r(971)).Record,s=r(972);class a{constructor(e,r,n){e&&i(t.isBuffer(e),"key must be a Buffer"),r&&i(t.isBuffer(r),"value must be a buffer"),this.key=e,this.value=r,this.timeReceived=n}serialize(){return o.encode(this.prepareSerialize())}prepareSerialize(){return{key:this.key,value:this.value,timeReceived:this.timeReceived&&s.toRFC3339(this.timeReceived)}}static deserialize(e){const t=o.decode(e);return a.fromDeserialized(t)}static fromDeserialized(e){let t;e.timeReceived&&(t=s.parseRFC3339(e.timeReceived));const r=new a(e.key,e.value,t);return r}}e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports="// Record represents a dht record that contains a value\n// for a key value pair\nmessage Record {\n // The key that references this record\n bytes key = 1;\n\n // The actual value this record is storing\n bytes value = 2;\n\n // Note: These fields were removed from the Record message\n // hash of the authors public key\n // optional bytes author = 3;\n // A PKI signature for the key+value+author\n // optional bytes signature = 4;\n\n // Time the record was received, set by receiver\n optional string timeReceived = 5;\n}"},function(e,t,r){"use strict";const n=r(202);e.exports.toRFC3339=(e=>{const t=e.getUTCFullYear(),r=n(e.getUTCMonth()+1,2,"0"),i=n(e.getUTCDate(),2,"0"),o=n(e.getUTCHours(),2,"0"),s=n(e.getUTCMinutes(),2,"0"),a=n(e.getUTCSeconds(),2,"0"),u=e.getUTCMilliseconds(),c=1e3*u*1e3;return`${t}-${r}-${i}T${o}:${s}:${a}.${c}Z`}),e.exports.parseRFC3339=(e=>{const t=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),r=String(e).trim().match(t);if(!r)throw new Error("Invalid format");const n=parseInt(r[1],10),i=parseInt(r[2],10)-1,o=parseInt(r[3],10),s=parseInt(r[4],10),a=parseInt(r[5],10),u=parseInt(r[6],10),c=parseInt(r[7].slice(0,-6),10);return new Date(Date.UTC(n,i,o,s,a,u,c))})},function(e,t,r){"use strict";(function(t){const n=r(468),i=r(19),o=(e,r,o)=>{const s=r.key,a=n(s,t.from("/"));if(a.length<3)return o();const u=e[a[1].toString()];if(!u){const e="Invalid record keytype";return o(i(new Error(e),"ERR_INVALID_RECORD_KEY_TYPE"))}u.func(s,r.value,o)};e.exports={verifyRecord:o,validators:r(975)}}).call(this,r(0).Buffer)},function(e,t){e.exports=function e(t,r,n){n=n||0;for(var i=0,o=-1,s=n;s-1&&t.length-o{const s=e=>n(()=>o(e));if(!t.isBuffer(e))return s(new Error('"key" must be a Buffer'));if(e.length<3)return s(new Error("invalid public key record"));const a=e.slice(0,4).toString();if("/pk/"!==a)return s(new Error("key was not prefixed with /pk/"));const u=e.slice(4);i(r,"sha2-256",(e,t)=>e?s(e):u.equals(t)?void s():s(new Error("public key does not match passed in key")))};e.exports={func:o,sign:!1}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(33),i=r(978);function o(e,t,r,i){if("function"==typeof r&&(i=r,r=void 0),!i)throw new Error("Missing callback");o.digest(e,t,r,(e,o)=>{if(e)return i(e);i(null,n.encode(o,t,r))})}e.exports=o,o.Buffer=t,o.multihash=n,o.digest=function(e,t,r,n){if("function"==typeof r&&(n=r,r=void 0),!n)throw new Error("Missing callback");let i=n,s;r&&(i=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=n.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(979),i=r(414),o=r(469),s=r(980),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,h=(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(u(n.sha3_512)),sha3384:a(u(n.sha3_384)),sha3256:a(u(n.sha3_256)),sha3224:a(u(n.sha3_224)),shake128:a(u(n.shake_128,256)),shake256:a(u(n.shake_256,512)),keccak224:a(u(n.keccak_224)),keccak256:a(u(n.keccak_256)),keccak384:a(u(n.keccak_384)),keccak512:a(u(n.keccak_512)),murmur3128:a(u(c(i.x64.hash128))),murmur332:a(f(c(i.x86.hash32))),addBlake:r(981),dblSha2256:h}}).call(this,r(0).Buffer)},function(e,t,r){(function(n,i){var o; -/** - * [js-sha3]{@link https://github.com/emn178/js-sha3} - * - * @version 0.7.0 - * @author Chen, Yi-Cyuan [emn178@gmail.com] - * @copyright Chen, Yi-Cyuan 2015-2017 - * @license MIT - */ -/** - * [js-sha3]{@link https://github.com/emn178/js-sha3} - * - * @version 0.7.0 - * @author Chen, Yi-Cyuan [emn178@gmail.com] - * @copyright Chen, Yi-Cyuan 2015-2017 - * @license MIT - */ -!function(){"use strict";var s="input is invalid type",a="object"==typeof window,u=a?window:{};u.JS_SHA3_NO_WINDOW&&(a=!1);var c=!a&&"object"==typeof self,f=!u.JS_SHA3_NO_NODE_JS&&"object"==typeof n&&n.versions&&n.versions.node;f?u=i:c&&(u=self);var h=!u.JS_SHA3_NO_COMMON_JS&&"object"==typeof e&&e.exports,l=r(413),d=!u.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,p="0123456789abcdef".split(""),g=[31,7936,2031616,520093696],m=[4,1024,262144,67108864],b=[1,256,65536,16777216],y=[6,1536,393216,100663296],v=[0,8,16,24],_=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],w=[224,256,384,512],S=[128,256],E=["hex","buffer","arrayBuffer","array","digest"],k={128:168,256:136};!u.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!d||!u.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var x=function(e,t,r){return function(n){return new H(e,t,e).update(n)[r]()}},C=function(e,t,r){return function(n,i){return new H(e,t,i).update(n)[r]()}},A=function(e,t,r){return function(t,n,i,o){return N["cshake"+e].update(t,n,i,o)[r]()}},I=function(e,t,r){return function(t,n,i,o){return N["kmac"+e].update(t,n,i,o)[r]()}},T=function(e,t,r,n){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function K(e,t,r){H.call(this,e,t,r)}H.prototype.update=function(e){if(!this.finalized){var t,r=typeof e;if("string"!==r){if("object"!==r)throw s;if(null===e)throw s;if(d&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||d&&ArrayBuffer.isView(e)))throw s;t=!0}for(var n=this.blocks,i=this.byteCount,o=e.length,a=this.blockCount,u=0,c=this.s,f,h;u>2]|=e[u]<>2]|=h<>2]|=(192|h>>6)<>2]|=(128|63&h)<=57344?(n[f>>2]|=(224|h>>12)<>2]|=(128|h>>6&63)<>2]|=(128|63&h)<>2]|=(240|h>>18)<>2]|=(128|h>>12&63)<>2]|=(128|h>>6&63)<>2]|=(128|63&h)<=i){for(this.start=f-i,this.block=n[a],f=0;f>=8,r=255&e;r>0;)i.unshift(r),e>>=8,r=255&e,++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},H.prototype.encodeString=function(e){var t,r=typeof e;if("string"!==r){if("object"!==r)throw s;if(null===e)throw s;if(d&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||d&&ArrayBuffer.isView(e)))throw s;t=!0}var n=0,i=e.length;if(t)n=i;else for(var o=0;o=57344?n+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++o)),n+=4)}return n+=this.encode(8*n),this.update(e),n},H.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4&15]+p[15&a]+p[a>>12&15]+p[a>>8&15]+p[a>>20&15]+p[a>>16&15]+p[a>>28&15]+p[a>>24&15];o%e==0&&(W(t),i=0)}return n&&(a=t[i],s+=p[a>>4&15]+p[15&a],n>1&&(s+=p[a>>12&15]+p[a>>8&15]),n>2&&(s+=p[a>>20&15]+p[a>>16&15])),s},H.prototype.arrayBuffer=function(){this.finalize();var e=this.blockCount,t=this.s,r=this.outputBlocks,n=this.extraBytes,i=0,o=0,s=this.outputBits>>3,a;a=n?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(a);o>8&255,s[a+2]=u>>16&255,s[a+3]=u>>24&255;o%e==0&&W(t)}return n&&(a=o<<2,u=t[i],s[a]=255&u,n>1&&(s[a+1]=u>>8&255),n>2&&(s[a+2]=u>>16&255)),s},K.prototype=new H,K.prototype.finalize=function(){return this.encode(this.outputBits,!0),H.prototype.finalize.call(this)};var W=function(e){var t,r,n,i,o,s,a,u,c,f,h,l,d,p,g,m,b,y,v,w,S,E,k,x,C,A,I,T,O,R,B,P,M,N,L,j,D,F,U,q,z,H,K,W,V,G,$,Y,J,X,Z,Q,ee,te,re,ne,ie,oe,se,ae,ue,ce,fe;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],l=e[8]^e[18]^e[28]^e[38]^e[48],d=e[9]^e[19]^e[29]^e[39]^e[49],t=l^(s<<1|a>>>31),r=d^(a<<1|s>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(u<<1|c>>>31),r=o^(c<<1|u>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=s^(f<<1|h>>>31),r=a^(h<<1|f>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=u^(l<<1|d>>>31),r=c^(d<<1|l>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=f^(i<<1|o>>>31),r=h^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,p=e[0],g=e[1],G=e[11]<<4|e[10]>>>28,$=e[10]<<4|e[11]>>>28,T=e[20]<<3|e[21]>>>29,O=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ue=e[30]<<9|e[31]>>>23,H=e[40]<<18|e[41]>>>14,K=e[41]<<18|e[40]>>>14,N=e[2]<<1|e[3]>>>31,L=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,b=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,R=e[33]<<13|e[32]>>>19,B=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,fe=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,j=e[14]<<6|e[15]>>>26,D=e[15]<<6|e[14]>>>26,y=e[25]<<11|e[24]>>>21,v=e[24]<<11|e[25]>>>21,X=e[34]<<15|e[35]>>>17,Z=e[35]<<15|e[34]>>>17,P=e[45]<<29|e[44]>>>3,M=e[44]<<29|e[45]>>>3,x=e[6]<<28|e[7]>>>4,C=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,F=e[26]<<25|e[27]>>>7,U=e[27]<<25|e[26]>>>7,w=e[36]<<21|e[37]>>>11,S=e[37]<<21|e[36]>>>11,Q=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,W=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,A=e[18]<<20|e[19]>>>12,I=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,se=e[28]<<7|e[29]>>>25,q=e[38]<<8|e[39]>>>24,z=e[39]<<8|e[38]>>>24,E=e[48]<<14|e[49]>>>18,k=e[49]<<14|e[48]>>>18,e[0]=p^~m&y,e[1]=g^~b&v,e[10]=x^~A&T,e[11]=C^~I&O,e[20]=N^~j&F,e[21]=L^~D&U,e[30]=W^~G&Y,e[31]=V^~$&J,e[40]=te^~ne&oe,e[41]=re^~ie&se,e[2]=m^~y&w,e[3]=b^~v&S,e[12]=A^~T&R,e[13]=I^~O&B,e[22]=j^~F&q,e[23]=D^~U&z,e[32]=G^~Y&X,e[33]=$^~J&Z,e[42]=ne^~oe&ae,e[43]=ie^~se&ue,e[4]=y^~w&E,e[5]=v^~S&k,e[14]=T^~R&P,e[15]=O^~B&M,e[24]=F^~q&H,e[25]=U^~z&K,e[34]=Y^~X&Q,e[35]=J^~Z&ee,e[44]=oe^~ae&ce,e[45]=se^~ue&fe,e[6]=w^~E&p,e[7]=S^~k&g,e[16]=R^~P&x,e[17]=B^~M&C,e[26]=q^~H&N,e[27]=z^~K&L,e[36]=X^~Q&W,e[37]=Z^~ee&V,e[46]=ae^~ce&te,e[47]=ue^~fe&re,e[8]=E^~p&m,e[9]=k^~g&b,e[18]=P^~x&A,e[19]=M^~C&I,e[28]=H^~N&j,e[29]=K^~L&D,e[38]=Q^~W&G,e[39]=ee^~V&$,e[48]=ce^~te&ne,e[49]=fe^~re&ie,e[0]^=_[n],e[1]^=_[n+1]};if(h)e.exports=N;else{for(j=0;j{const s=i.digest({name:e},r);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));n(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function u(e,t){s("SHA-256")(e,t)}function c(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:u,sha2512:c}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(418),i=r(469).toCallback,o=45569,s=45633,a={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},u={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},c=(e,r)=>i(n=>{const i=r.init(e,null);return r.update(i,n),t.from(r.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=c(t+1,a);for(let t=0;t<32;t++)e[s+t]=c(t+1,u)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(468),i=r(19),o=(e,r,o)=>{if(0===o.length){const e="No records given";throw i(new Error(e),"ERR_NO_RECORDS_RECEIVED")}const s=n(r,t.from("/"));if(s.length<3){const e="Record key does not have a selector function";throw i(new Error(e),"ERR_NO_SELECTOR_FUNCTION_FOR_RECORD_KEY")}const a=e[s[1].toString()];if(!a){const e=`Unrecognized key prefix: ${s[1]}`;throw i(new Error(e),"ERR_UNRECOGNIZED_KEY_PREFIX")}return a(r,o)};e.exports={bestRecord:o,selectors:r(983)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports={pk:r(984)}},function(e,t,r){"use strict";const n=(e,t)=>0;e.exports=n},function(e,t,r){"use strict";const n=r(472),i=r(996),o=r(1031),s=r(1041),a=r(1054),u=r(1062),c=r(1063),f=r(167),h=r(21);class l extends c{constructor(e){const t=new i({id:e.peerInfo.id}),r=e.peerInfo.multiaddrs.toArray().map(String).filter(e=>e.includes("p2p-websocket-star"));e.peerInfo.multiaddrs.replace(r.map(h),"/p2p-websocket-star");const c=new o({servers:r,id:e.peerInfo.id,ignore_no_online:!r.length||e.wsStarIgnoreErrors}),l={modules:{transport:[n,t,c],streamMuxer:[s],connEncryption:[a],peerDiscovery:[t.discovery,c.discovery,u]},config:{peerDiscovery:{bootstrap:{enabled:!0},webRTCStar:{enabled:!0},websocketStar:{enabled:!0}},EXPERIMENTAL:{dht:!1,pubsub:!1}}};super(f(e,l))}}e.exports=l},function(e,t,r){"use strict";var n=r(987),i=r(989),o=r(993);function s(e){return"function"==typeof e}e.exports=function(e,t){s(t)&&(t={onConnect:t});var r="undefined"==typeof window?{}:window.location,a=o(e,r),u=new n(a),c=i(u,t);return c.remoteAddress=a,c.close=function(e){s(e)&&u.addEventListener("close",e),u.close()},u.addEventListener("open",function(e){t&&s(t.onConnect)&&t.onConnect(null,c)}),c},e.exports.connect=e.exports},function(e,t,r){e.exports="undefined"==typeof WebSocket?r(988):WebSocket},function(e,t){},function(e,t,r){var n=r(990),i=r(991);function o(e,t){var r=e.upgradeReq||{};return t&&t.binaryType?e.binaryType=t.binaryType:t&&t.binary&&(e.binaryType="arraybuffer"),{source:n(e,t&&t.onConnect),sink:i(e,t),headers:r.headers,url:r.url,upgrade:r.upgrade,method:r.method}}e.exports=o},function(e,t,r){var n=r(4).Buffer;function i(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}e.exports=function(e,t){var r=[],o,s,a=!1;function u(t,n){if(o=null,s)return n(s);t?(o=n,e.close()):r.length>0?n(null,r.shift()):o=n}return e.addEventListener("message",function(e){var t=e.data;if(i(t)&&(t=n.from(t)),o)return o(null,t);r.push(t)}),e.addEventListener("close",function(e){s||o&&o(s=!0)}),e.addEventListener("error",function(e){s||(s=e,a||(a=!0,t&&t(e)),o&&o(s))}),e.addEventListener("open",function(e){a||s||(a=!0)}),u}},function(e,t,r){(function(t){var n=r(992),i="undefined"!=typeof setImmediate?setImmediate:t.nextTick;e.exports=function(e,t){return function(r){t=t||{};var o=!1!==t.closeOnEnd,s="function"==typeof t?t:t.onClose;function a(t,u){t?o&&e.readyState<=1&&(s&&e.addEventListener("close",function(e){if(e.wasClean||1006===e.code)s();else{var t=new Error("ws error");t.event=e,s(t)}}),e.close()):n(e,function(t){if(t)return r(t,function(){});e.send(u),i(function(){r(null,a)})})}r(null,a)}}}).call(this,r(2))},function(e,t){e.exports=function(e,t){var r=e&&(e.removeEventListener||e.removeListener);function n(){"function"==typeof r&&(r.call(e,"open",i),r.call(e,"error",o))}function i(e){n(),t()}function o(e){n(),t(e)}return e.readyState>=2?t(!0):1===e.readyState?t():(e.addEventListener("open",i),void e.addEventListener("error",o))}},function(e,t,r){var{relative:n}=r(277),i={http:"ws",https:"wss"},o="ws";e.exports=function(e,t){return n(e,t,i,o)}},function(e,t,r){"use strict";const n=r(405);e.exports=class e{constructor(e,t){this.peerInfo=null,this.conn=n(),e?this.setInnerConn(e,t):t&&(this.info=t)}get source(){return this.conn.source}get sink(){return this.conn.sink}getPeerInfo(e){return this.info&&this.info.getPeerInfo?this.info.getPeerInfo(e):this.peerInfo?void e(null,this.peerInfo):e(new Error("Peer Info not set yet"))}setPeerInfo(e){if(this.info&&this.info.setPeerInfo)return this.info.setPeerInfo(e);this.peerInfo=e}getObservedAddrs(e){if(this.info&&this.info.getObservedAddrs)return this.info.getObservedAddrs(e);e(null,[])}setInnerConn(e,t){this.conn.resolve(e),this.info=t||e}}},function(e,t,r){"use strict";e.exports=function(){throw new Error("WebSocket Servers can not be created in the browser!")}},function(e,t,r){"use strict";const n=r(6),i=n("libp2p:webrtc-star"),o=r(21),s=r(81),a=r(51),u=r(474),c=r(7).EventEmitter,f=r(227),h=r(20),l=r(42),d=r(57).Connection,p=r(68),g=r(24),m=r(14),b=r(1029),y=r(1030),v=y.cleanUrlSIO,_=y.cleanMultiaddr,w=g(()=>{}),S={transports:["websocket"],"force new connection":!0};class E{constructor(e){e=e||{},this.maSelf=void 0,this.sioOptions={transports:["websocket"],"force new connection":!0},e.wrtc&&(this.wrtc=e.wrtc),this.discovery=new c,this.discovery.tag="webRTCStar",this.discovery.start=(e=>{m(e)}),this.discovery.stop=(e=>{m(e)}),this.listenersRefs={},this._peerDiscovered=this._peerDiscovered.bind(this)}dial(e,t,r){"function"==typeof t&&(r=t,t={}),r=r?g(r):w;const n=(~~(1e9*Math.random())).toString(36)+Date.now(),o=this.listenersRefs[Object.keys(this.listenersRefs)[0]].io,s={initiator:!0,trickle:!1};let a;this.wrtc&&(s.wrtc=this.wrtc);try{a=new f(s)}catch(e){return i("Could not create connection:",e),r(e)}const u=new d(p.duplex(a));let c=!1;return a.on("signal",t=>{o.emit("ss-handshake",{intentId:n,srcMultiaddr:this.maSelf.toString(),dstMultiaddr:e.toString(),signal:t})}),a.once("timeout",()=>r(new Error("timeout"))),a.once("error",e=>{c||r(e)}),o.on("ws-handshake",t=>{if(t.intentId===n&&t.err)return r(new Error(t.err));t.intentId===n&&t.answer&&(a.once("connect",()=>{c=!0,u.destroy=a.destroy.bind(a),a.once("close",()=>u.destroy()),u.getObservedAddrs=(t=>t(null,[e])),r(null,u)}),a.signal(t.signal))}),u}createListener(e,t){"function"==typeof e&&(t=e,e={});const r=new c;return r.listen=((e,n)=>{if(n=n?g(n):w,!b.support&&!this.wrtc)return m(()=>n(new Error("no WebRTC support")));this.maSelf=e;const o=v(e);i("Dialing to Signalling Server on: "+o),r.io=u.connect(o,S),r.io.once("connect_error",n),r.io.once("error",e=>{r.emit("error",e),r.emit("close")}),r.io.on("ws-handshake",a),r.io.on("ws-peer",this._peerDiscovered),r.io.on("connect",()=>{r.io.emit("ss-join",e.toString())}),r.io.once("connect",()=>{r.emit("listening"),n()});const s=this;function a(e){if(e.answer||e.err)return;const o={trickle:!1};let a;s.wrtc&&(o.wrtc=s.wrtc);try{a=new f(o)}catch(e){return i("Could not create incoming connection:",e),n(e)}const u=new d(p.duplex(a));a.once("connect",()=>{u.getObservedAddrs=(t=>t(null,[e.srcMultiaddr])),r.emit("connection",u),t(u)}),a.once("signal",t=>{e.signal=t,e.answer=!0,r.io.emit("ss-handshake",e)}),a.signal(e.signal)}}),r.close=(e=>{e=e?g(e):w,r.io.emit("ss-leave"),m(()=>{r.emit("close"),e()})}),r.getAddrs=(e=>{m(()=>e(null,[this.maSelf]))}),this.listenersRefs[o.toString()]=r,r}filter(e){return Array.isArray(e)||(e=[e]),e.filter(e=>!(e.protoNames().indexOf("p2p-circuit")>-1)&&s.WebRTCStar.matches(e))}_peerDiscovered(e){i("Peer Discovered:",e),e=_(e);const t=e.split("/ipfs/"),r=t[t.length-1],n=h.createFromB58String(r),s=new l(n);s.multiaddrs.add(o(e)),this.discovery.emit("peer",s)}}e.exports=a(E,{className:"WebRTCStar",symbolName:"@libp2p/js-libp2p-webrtc-star/webrtcstar"})},function(e,t,r){var n=r(475),i=r(223)("socket.io-client:url");function o(e,t){var r=e;t=t||"undefined"!=typeof location&&location,null==e&&(e=t.protocol+"//"+t.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(i("protocol-less url %s",e),e=void 0!==t?t.protocol+"//"+e:"https://"+e),i("parse %s",e),r=n(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";var o=-1!==r.host.indexOf(":"),s=o?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+s+":"+r.port,r.href=r.protocol+"://"+s+(t&&t.port===r.port?"":":"+r.port),r}e.exports=o},function(e,t,r){function n(e){var r=0,n;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}function i(e){var r;function i(){if(i.enabled){var e=i,n=+new Date,o=n-(r||n);e.diff=o,e.prev=r,e.curr=n,r=n;for(var s=new Array(arguments.length),a=0;a100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var a=parseFloat(t[1]),u=(t[2]||"ms").toLowerCase();switch(u){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"days":case"day":case"d":return a*o;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*n;case"seconds":case"second":case"secs":case"sec":case"s":return a*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}function u(e){return e>=o?Math.round(e/o)+"d":e>=i?Math.round(e/i)+"h":e>=n?Math.round(e/n)+"m":e>=r?Math.round(e/r)+"s":e+"ms"}function c(e){return f(e,o,"day")||f(e,i,"hour")||f(e,n,"minute")||f(e,r,"second")||e+" ms"}function f(e,t,r){if(!(e0)return a(e);if("number"===r&&!1===isNaN(e))return t.long?c(e):u(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,r){(function(n){function i(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),r){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,n)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function u(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e}function c(){try{return window.localStorage}catch(e){}}t=e.exports=r(1001),t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:c(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(u())}).call(this,r(2))},function(e,t,r){function n(e){var r=0,n;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}function i(e){var r;function i(){if(i.enabled){var e=i,n=+new Date,o=n-(r||n);e.diff=o,e.prev=r,e.curr=n,r=n;for(var s=new Array(arguments.length),a=0;a100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var a=parseFloat(t[1]),u=(t[2]||"ms").toLowerCase();switch(u){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"days":case"day":case"d":return a*o;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*n;case"seconds":case"second":case"secs":case"sec":case"s":return a*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}function u(e){return e>=o?Math.round(e/o)+"d":e>=i?Math.round(e/i)+"h":e>=n?Math.round(e/n)+"m":e>=r?Math.round(e/r)+"s":e+"ms"}function c(e){return f(e,o,"day")||f(e,i,"hour")||f(e,n,"minute")||f(e,r,"second")||e+" ms"}function f(e,t,r){if(!(e0)return a(e);if("number"===r&&!1===isNaN(e))return t.long?c(e):u(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,r){var n=r(476),i=r(477),o=Object.prototype.toString,s="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===o.call(Blob),a="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===o.call(File);function u(e,t){if(!e)return e;if(i(e)){var r={_placeholder:!0,num:t.length};return t.push(e),r}if(n(e)){for(var o=new Array(e.length),s=0;s0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}function h(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}e.exports=f,f.priorWebsocketSuccess=!1,i(f.prototype),f.protocol=a.protocol,f.Socket=f,f.Transport=r(301),f.transports=r(479),f.parser=r(136),f.prototype.createTransport=function(e){o('creating transport "%s"',e);var t=h(this.query);t.EIO=a.protocol,t.transport=e;var r=this.transportOptions[e]||{};this.id&&(t.sid=this.id);var i=new n[e]({query:t,socket:this,agent:r.agent||this.agent,hostname:r.hostname||this.hostname,port:r.port||this.port,secure:r.secure||this.secure,path:r.path||this.path,forceJSONP:r.forceJSONP||this.forceJSONP,jsonp:r.jsonp||this.jsonp,forceBase64:r.forceBase64||this.forceBase64,enablesXDR:r.enablesXDR||this.enablesXDR,timestampRequests:r.timestampRequests||this.timestampRequests,timestampParam:r.timestampParam||this.timestampParam,policyPort:r.policyPort||this.policyPort,pfx:r.pfx||this.pfx,key:r.key||this.key,passphrase:r.passphrase||this.passphrase,cert:r.cert||this.cert,ca:r.ca||this.ca,ciphers:r.ciphers||this.ciphers,rejectUnauthorized:r.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:r.perMessageDeflate||this.perMessageDeflate,extraHeaders:r.extraHeaders||this.extraHeaders,forceNode:r.forceNode||this.forceNode,localAddress:r.localAddress||this.localAddress,requestTimeout:r.requestTimeout||this.requestTimeout,protocols:r.protocols||void 0,isReactNative:this.isReactNative});return i},f.prototype.open=function(){var e;if(this.rememberUpgrade&&f.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout(function(){t.emit("error","No transports available")},0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},f.prototype.setTransport=function(e){o("setting transport %s",e.name);var t=this;this.transport&&(o("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",function(){t.onDrain()}).on("packet",function(e){t.onPacket(e)}).on("error",function(e){t.onError(e)}).on("close",function(){t.onClose("transport close")})},f.prototype.probe=function(e){o('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),r=!1,n=this;function i(){if(n.onlyBinaryUpgrades){var i=!this.supportsBinary&&n.transport.supportsBinary;r=r||i}r||(o('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",function(i){if(!r)if("pong"===i.type&&"probe"===i.data){if(o('probe transport "%s" pong',e),n.upgrading=!0,n.emit("upgrading",t),!t)return;f.priorWebsocketSuccess="websocket"===t.name,o('pausing current transport "%s"',n.transport.name),n.transport.pause(function(){r||"closed"!==n.readyState&&(o("changing transport and sending upgrade packet"),l(),n.setTransport(t),t.send([{type:"upgrade"}]),n.emit("upgrade",t),t=null,n.upgrading=!1,n.flush())})}else{o('probe transport "%s" failed',e);var s=new Error("probe error");s.transport=t.name,n.emit("upgradeError",s)}}))}function s(){r||(r=!0,l(),t.close(),t=null)}function a(r){var i=new Error("probe error: "+r);i.transport=t.name,s(),o('probe transport "%s" failed because of error: %s',e,r),n.emit("upgradeError",i)}function u(){a("transport closed")}function c(){a("socket closed")}function h(e){t&&e.name!==t.name&&(o('"%s" works - aborting "%s"',e.name,t.name),s())}function l(){t.removeListener("open",i),t.removeListener("error",a),t.removeListener("close",u),n.removeListener("close",c),n.removeListener("upgrading",h)}f.priorWebsocketSuccess=!1,t.once("open",i),t.once("error",a),t.once("close",u),this.once("close",c),this.once("upgrading",h),t.open()},f.prototype.onOpen=function(){if(o("socket open"),this.readyState="open",f.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){o("starting upgrade probes");for(var e=0,t=this.upgrades.length;en&&(r=n),t>=n||t>=r||0===n)return new ArrayBuffer(0);for(var i=new Uint8Array(e),o=new Uint8Array(r-t),s=t,a=0;s1?r[1]--:r[1]=0,n.time=t=Date.UTC.apply(Date,r)-(t||0),isNaN(t))throw new TypeError("Invalid Date");return _(n)}function C(e){return new b(+e)}function A(e){return I(e,0)}function I(e,t){t|=0,t*=u,e=+e||0;var r=h(t/i)+h(e/i),o=t%i+e%i,s=h(o/i);return s&&(r+=s,o-=s*i),new b(1e3*o,0,r*n)}function T(){var e=_(this),i=Math.floor(e.time/1e3),o=e.year;return o&&(i+=o*r*t/n),i}function j(){return this.toString().replace(/0{1,6}Z$/,"Z")}function O(e){var t=this,n=t.toDate(),r={H:l,L:h,M:c,N:p,S:f,Y:o,a:b,b:v,d:a,e:u,m:s};return i(e||d);function i(e){return e.replace(/%./g,function(e){var t=e[1],n=y[t],o=r[t];return n?i(n):o?o():e})}function o(){var e=t.getYear();return e>999999?"+"+e:e>9999?"+"+F(e,6):e>=0?F(e,4):e>=-999999?"-"+F(-e,6):e}function s(){return L(n.getUTCMonth()+1)}function a(){return L(n.getUTCDate())}function u(){return M(n.getUTCDate())}function l(){return L(n.getUTCHours())}function c(){return L(n.getUTCMinutes())}function f(){return L(n.getUTCSeconds())}function h(){return F(n.getUTCMilliseconds(),3)}function p(){return F(t.getNano(),9)}function b(){return g[n.getUTCDay()]}function v(){return m[n.getUTCMonth()]}}function P(e,i,o,s,a,l){return c;function c(e,i){var o=_(this);e||(e=new Array(8)),R(e,i|=0);var s=Math.floor(o.time/1e3),c=o.year*(r*t/n),p=h(c/u)+h(s/u),d=c%u+s%u,m=Math.floor(d/u);return m&&(p+=m,d-=m*u),f(e,i+a,p),f(e,i+l,d),e}function f(t,n,r){t[n+e]=r>>24&255,t[n+i]=r>>16&255,t[n+o]=r>>8&255,t[n+s]=255&r}}function B(e,t,n,r,i,o){return s;function s(e,t){R(e,t|=0);var n=u(e,t+i),r=u(e,t+o);return I(r,n)}function u(i,o){return i[o+e]*a+(i[o+t]<<16|i[o+n]<<8|i[o+r])}}function R(e,t){var n=e&&e.length;if(null==n)throw new TypeError("Invalid Buffer");if(n9?"":" ")+(0|e)}function L(e){return(e>9?"":"0")+(0|e)}function F(e,t){return(f+(0|e)).substr(-t)}}()},function(e,t,n){"use strict";const r=n(70),i='\nmessage IpnsEntry {\n enum ValidityType {\n\t\tEOL = 0; // setting an EOL says "this record is valid until..."\n\t}\n\n required bytes value = 1;\n\trequired bytes signature = 2;\n\n\toptional ValidityType validityType = 3;\n\toptional bytes validity = 4;\n\n\toptional uint64 sequence = 5;\n\n\toptional uint64 ttl = 6;\n\n\t// in order for nodes to properly validate a record upon receipt, they need the public\n\t// key associated with it. For old RSA keys, its easiest if we just send this as part of\n\t// the record itself. For newer ed25519 keys, the public key can be embedded in the\n\t// peerID, making this field unnecessary.\n\toptional bytes pubKey = 7;\n}\n';e.exports=r(i).IpnsEntry},function(e,t,n){"use strict";const r=n(228);e.exports.toRFC3339=(e=>{const t=e.getUTCFullYear(),n=r(e.getUTCMonth()+1,2,"0"),i=r(e.getUTCDate(),2,"0"),o=r(e.getUTCHours(),2,"0"),s=r(e.getUTCMinutes(),2,"0"),a=r(e.getUTCSeconds(),2,"0"),u=e.getUTCMilliseconds(),l=1e3*u*1e3;return`${t}-${n}-${i}T${o}:${s}:${a}.${l}Z`}),e.exports.parseRFC3339=(e=>{const t=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),n=String(e).trim().match(t);if(!n)throw new Error("Invalid format");const r=parseInt(n[1],10),i=parseInt(n[2],10)-1,o=parseInt(n[3],10),s=parseInt(n[4],10),a=parseInt(n[5],10),u=parseInt(n[6],10),l=parseInt(n[7].slice(0,-6),10);return new Date(Date.UTC(r,i,o,s,a,u,l))})},function(e,t,n){"use strict";t.ERR_IPNS_EXPIRED_RECORD="ERR_IPNS_EXPIRED_RECORD",t.ERR_UNRECOGNIZED_VALIDITY="ERR_UNRECOGNIZED_VALIDITY",t.ERR_SIGNATURE_CREATION="ERR_SIGNATURE_CREATION",t.ERR_SIGNATURE_VERIFICATION="ERR_SIGNATURE_VERIFICATION",t.ERR_UNRECOGNIZED_FORMAT="ERR_UNRECOGNIZED_FORMAT",t.ERR_PEER_ID_FROM_PUBLIC_KEY="ERR_PEER_ID_FROM_PUBLIC_KEY",t.ERR_PUBLIC_KEY_FROM_ID="ERR_PUBLIC_KEY_FROM_ID",t.ERR_UNDEFINED_PARAMETER="ERR_UNDEFINED_PARAMETER"},function(e,t,n){"use strict";(function(r){const i=n(181),o=n(71),s=n(23),a=n(22),u=n(5),l=n(61),c=n(11),f=u("jsipfs:ipns:republisher");f.error=u("jsipfs:ipns:republisher:error");const h=6e4,p=60*h,d=4*p,m=24*p;class g{constructor(e,t,n,r,i){this._publisher=e,this._datastore=t,this._peerInfo=n,this._keychain=r,this._options=i,this._republishHandle=null}start(){if(this._republishHandle){const e="already running";throw f.error(e),a(new Error(e),"ERR_REPUBLISH_ALREADY_RUNNING")}const e={_onCancel:null,_timeoutId:null,runPeriodically:(t,n)=>{e._timeoutId=setTimeout(()=>{e._timeoutId=null,t(r=>{if(e._onCancel)return e._onCancel();e.runPeriodically(t,r||n)})},n)},cancel:t=>{if(e._timeoutId)return clearTimeout(e._timeoutId),t();e._onCancel=t}},{privKey:t}=this._peerInfo.id,{pass:n}=this._options;e.runPeriodically(e=>{this._republishEntries(t,n,()=>e(d))},h),this._republishHandle=e}stop(e){const t=this._republishHandle;if(!t){const t="not running";return f.error(t),e(a(new Error(t),"ERR_REPUBLISH_NOT_RUNNING"))}this._republishHandle=null,t.cancel(e)}_republishEntries(e,t,n){this._republishEntry(e,e=>{if(e){const e="cannot republish entry for the node's private key";f.error(e)}else t?this._keychain.listKeys((e,r)=>{e?f.error(e):l(r,(e,n)=>{c([n=>this._keychain.exportKey(e.name,t,n),(e,n)=>o.keys.import(e,t,n)],(e,t)=>{e?f.error(e):this._republishEntry(t,n)})},e=>{e&&f.error(e),n(null)})}):n(null)})}_republishEntry(e,t){if(!e||!e.bytes){const e="one or more of the provided parameters are not defined";return f.error(e),t(a(new Error(e),"ERR_UNDEFINED_PARAMETER"))}c([t=>s.createFromPrivKey(e.bytes,t),(e,t)=>this._getPreviousValue(e,t)],(n,r)=>{if(n)return t("ERR_NO_ENTRY_FOUND"===n.code?null:n);this._publisher.publishWithEOL(e,r,m,t)})}_getPreviousValue(e,t){if(!s.isPeerId(e)){const e="peerId received is not valid";return f.error(e),t(a(new Error(e),"ERR_INVALID_PEER_ID"))}this._datastore.get(i.getLocalKey(e.id),(n,o)=>{if(n&&n.notFound){const n=`no previous entry for record with id: ${e.id}`;return f.error(n),t(a(new Error(n),"ERR_NO_ENTRY_FOUND"))}if(n)return t(n);if(!r.isBuffer(o)){const e="found ipns record that we couldn't process";return f.error(e),t(a(new Error(e),"ERR_INVALID_IPNS_RECORD"))}let s;try{s=i.unmarshal(o)}catch(n){const e="found ipns record that we couldn't convert to a value";return f.error(e),t(a(new Error(e),"ERR_INVALID_IPNS_RECORD"))}t(null,s.value)})}}t=e.exports=g}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(181),i=n(71),o=n(23),s=n(22),a=n(5),u=a("jsipfs:ipns:resolver");u.error=a("jsipfs:ipns:resolver:error");const l=32;class c{constructor(e){this._routing=e}resolve(e,t,n){if("function"==typeof t&&(n=t,t={}),"string"!=typeof e){const e="one or more of the provided parameters are not valid";return u.error(e),n(s(new Error(e),"ERR_INVALID_PARAMETER"))}t=t||{};const r=t.recursive&&"true"===t.recursive.toString(),i=e.split("/");if(3!==i.length||""!==i[0]){const t=`invalid name syntax for ${e}`;return u.error(t),n(s(new Error(t),"ERR_INVALID_NAME_SYNTAX"))}const o=i[2];let a;r&&(a=l),this.resolver(o,a,(t,r)=>{if(t)return n(t);u(`${e} was locally resolved correctly`),n(null,r)})}resolver(e,t,n){if(0===t){const e=`could not resolve name (recursion limit of ${l} exceeded)`;return u.error(e),n(s(new Error(e),"ERR_RESOLVE_RECURSION_LIMIT"))}this._resolveName(e,(e,r)=>{if(e)return n(e);const i=r.split("/");if("ipfs"===i[1]||!t)return n(null,r);this.resolver(i[2],t-1,n)})}_resolveName(e,t){let n;try{n=o.createFromB58String(e)}catch(e){return t(e)}const{routingKey:a,routingPubKey:l}=r.getIdKeys(n.toBytes());this._routing.get(a.toBuffer(),(o,c)=>{if(o){if("ERR_NOT_FOUND"!==o.code){const e=`unexpected error getting the ipns record ${n.id}`;return u.error(e),t(s(new Error(e),"ERR_UNEXPECTED_ERROR_GETTING_RECORD"))}const r=`record requested was not found for ${e} (${a}) in the network`;return u.error(r),t(s(new Error(r),"ERR_NO_RECORD_FOUND"))}let f;try{f=r.unmarshal(c)}catch(o){const e="found ipns record that we couldn't convert to a value";return u.error(e),t(s(new Error(e),"ERR_INVALID_RECORD_RECEIVED"))}if(f.pubKey)return this._validateRecord(n,f,t);this._routing.get(a.toBuffer(),(r,o)=>{if(r){if("ERR_NOT_FOUND"!==r.code){const e=`unexpected error getting the public key for the ipns record ${n.id}`;return u.error(e),t(s(new Error(e),"ERR_UNEXPECTED_ERROR_GETTING_PUB_KEY"))}const i=`public key requested was not found for ${e} (${l}) in the network`;return u.error(i),t(s(new Error(i),"ERR_NO_RECORD_FOUND"))}try{n.pubKey=i.keys.unmarshalPublicKey(o)}catch(r){const e="found public key record that we couldn't convert to a value";return u.error(e),t(s(new Error(e),"ERR_INVALID_PUB_KEY_RECEIVED"))}this._validateRecord(n,f,t)})})}_validateRecord(e,t,n){r.extractPublicKey(e,t,(e,i)=>{if(e)return n(e);r.validate(i,t,e=>{if(e)return n(e);n(null,t.value.toString())})})}}t=e.exports=c},function(e,t,n){"use strict";(function(r){const{Key:i}=n(33),{encodeBase32:o,keyToTopic:s,topicToKey:a}=n(1035),u=n(22),l=n(18),c=n(5),f=c("datastore-pubsub:publisher");f.error=c("datastore-pubsub:publisher:error");class h{constructor(e,t,n,r,i){l.strictEqual(typeof r,"object","missing validator"),l.strictEqual(typeof r.validate,"function","missing validate function"),l.strictEqual(typeof r.select,"function","missing select function"),i&&l.strictEqual(typeof i,"function","invalid subscriptionKeyFn received"),this._pubsub=e,this._datastore=t,this._peerId=n,this._validator=r,this._handleSubscriptionKeyFn=i,this._onMessage=this._onMessage.bind(this)}put(e,t,n){if(!r.isBuffer(e)){const e="datastore key does not have a valid format";return f.error(e),n(u(new Error(e),"ERR_INVALID_DATASTORE_KEY"))}if(!r.isBuffer(t)){const e="received value is not a buffer";return f.error(e),n(u(new Error(e),"ERR_INVALID_VALUE_RECEIVED"))}const i=s(e);f(`publish value for topic ${i}`),this._pubsub.publish(i,t,n)}get(e,t){if(!r.isBuffer(e)){const e="datastore key does not have a valid format";return f.error(e),t(u(new Error(e),"ERR_INVALID_DATASTORE_KEY"))}const n=s(e);this._pubsub.ls((r,i)=>r?t(r):i&&Array.isArray(i)&&i.indexOf(n)>-1?this._getLocal(e,t):void this._pubsub.subscribe(n,this._onMessage,r=>{if(r){const e=`cannot subscribe topic ${n}`;return f.error(e),t(u(new Error(e),"ERR_SUBSCRIBING_TOPIC"))}f(`subscribed values for key ${n}`),this._getLocal(e,t)}))}unsubscribe(e){const t=s(e);this._pubsub.unsubscribe(t,this._onMessage)}_getLocal(e,t){const n=new i("/"+o(e),!1);this._datastore.get(n,(e,i)=>{if(e){if("ERR_NOT_FOUND"!==e.code){const e=`unexpected error getting the ipns record for ${n.toString()}`;return f.error(e),t(u(new Error(e),"ERR_UNEXPECTED_ERROR_GETTING_RECORD"))}const r=`local record requested was not found for ${n.toString()}`;return f.error(r),t(u(new Error(r),"ERR_NOT_FOUND"))}if(!r.isBuffer(i)){const e="found record that we couldn't convert to a value";return f.error(e),t(u(new Error(e),"ERR_INVALID_RECORD_RECEIVED"))}t(null,i)})}_onMessage(e){const{data:t,from:n,topicIDs:r}=e;let i;try{i=a(r[0])}catch(e){return void f.error(e)}f(`message received for ${i} topic`),n!==this._peerId.toB58String()?this._handleSubscriptionKeyFn?this._handleSubscriptionKeyFn(i,(e,n)=>{e?f.error("message discarded by the subscriptionKeyFn"):this._storeIfSubscriptionIsBetter(n,t)}):this._storeIfSubscriptionIsBetter(i,t):f("message discarded as it is from the same peer")}_storeIfSubscriptionIsBetter(e,t){this._isBetter(e,t,(n,i)=>{!n&&i&&this._storeRecord(r.from(e),t)})}_validateRecord(e,t,n){this._validator.validate(e,t,n)}_selectRecord(e,t,n){this._validator.select(e,t,(e,t)=>{if(e)return f.error(e),n(e);n(null,0===t)})}_isBetter(e,t,n){this._validateRecord(t,e,(r,o)=>{if(r||!o){const e="record received through pubsub is not valid";return f.error(e),n(u(new Error(e),"ERR_NOT_VALID_RECORD"))}const s=new i(e);this._getLocal(s.toBuffer(),(e,r)=>e?n(null,!0):r.equals(t)?n(null,!1):void this._selectRecord(t,r,n))})}_storeRecord(e,t){const n=new i("/"+o(e),!1);this._datastore.put(n,t,t=>{t?f.error(`record for ${e.toString()} could not be stored in the routing`):f(`record for ${e.toString()} was stored in the datastore`)})}open(e){const t="open function was not implemented yet";return f.error(t),e(u(new Error(t),"ERR_NOT_IMPLEMENTED_YET"))}has(e,t){const n="has function was not implemented yet";return f.error(n),t(u(new Error(n),"ERR_NOT_IMPLEMENTED_YET"))}delete(e,t){const n="delete function was not implemented yet";return f.error(n),t(u(new Error(n),"ERR_NOT_IMPLEMENTED_YET"))}close(e){const t="close function was not implemented yet";return f.error(t),e(u(new Error(t),"ERR_NOT_IMPLEMENTED_YET"))}batch(){const e="batch function was not implemented yet";throw f.error(e),u(new Error(e),"ERR_NOT_IMPLEMENTED_YET")}query(){const e="query function was not implemented yet";throw f.error(e),u(new Error(e),"ERR_NOT_IMPLEMENTED_YET")}}t=e.exports=h}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(105),i=n(22),o="/record/",s="u";e.exports.encodeBase32=(e=>r.encode("base32",e).slice(1)),e.exports.keyToTopic=(e=>{const t=r.encode("base64url",e).slice(1).toString();return`/record/${t}`}),e.exports.topicToKey=(e=>{if(e.substring(0,o.length)!==o)throw i(new Error("topic received is not from a record"),"ERR_TOPIC_IS_NOT_FROM_RECORD_NAMESPACE");const t=`u${e.substring(o.length)}`;return r.decode(t).toString()})},function(e,t,n){"use strict";e.exports={Record:n(1037),validator:n(1040),selection:n(1044)}},function(e,t,n){"use strict";(function(t){const r=n(70),i=n(18),o=r(n(1038)).Record,s=n(1039);class a{constructor(e,n,r){e&&i(t.isBuffer(e),"key must be a Buffer"),n&&i(t.isBuffer(n),"value must be a buffer"),this.key=e,this.value=n,this.timeReceived=r}serialize(){return o.encode(this.prepareSerialize())}prepareSerialize(){return{key:this.key,value:this.value,timeReceived:this.timeReceived&&s.toRFC3339(this.timeReceived)}}static deserialize(e){const t=o.decode(e);return a.fromDeserialized(t)}static fromDeserialized(e){let t;e.timeReceived&&(t=s.parseRFC3339(e.timeReceived));const n=new a(e.key,e.value,t);return n}}e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports="// Record represents a dht record that contains a value\n// for a key value pair\nmessage Record {\n // The key that references this record\n bytes key = 1;\n\n // The actual value this record is storing\n bytes value = 2;\n\n // Note: These fields were removed from the Record message\n // hash of the authors public key\n // optional bytes author = 3;\n // A PKI signature for the key+value+author\n // optional bytes signature = 4;\n\n // Time the record was received, set by receiver\n optional string timeReceived = 5;\n}"},function(e,t,n){"use strict";const r=n(228);e.exports.toRFC3339=(e=>{const t=e.getUTCFullYear(),n=r(e.getUTCMonth()+1,2,"0"),i=r(e.getUTCDate(),2,"0"),o=r(e.getUTCHours(),2,"0"),s=r(e.getUTCMinutes(),2,"0"),a=r(e.getUTCSeconds(),2,"0"),u=e.getUTCMilliseconds(),l=1e3*u*1e3;return`${t}-${n}-${i}T${o}:${s}:${a}.${l}Z`}),e.exports.parseRFC3339=(e=>{const t=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),n=String(e).trim().match(t);if(!n)throw new Error("Invalid format");const r=parseInt(n[1],10),i=parseInt(n[2],10)-1,o=parseInt(n[3],10),s=parseInt(n[4],10),a=parseInt(n[5],10),u=parseInt(n[6],10),l=parseInt(n[7].slice(0,-6),10);return new Date(Date.UTC(r,i,o,s,a,u,l))})},function(e,t,n){"use strict";(function(t){const r=n(501),i=n(22),o=(e,n,o)=>{const s=n.key,a=r(s,t.from("/"));if(a.length<3)return o();const u=e[a[1].toString()];if(!u){const e="Invalid record keytype";return o(i(new Error(e),"ERR_INVALID_RECORD_KEY_TYPE"))}u.func(s,n.value,o)};e.exports={verifyRecord:o,validators:n(1042)}}).call(this,n(0).Buffer)},function(e,t){e.exports=function e(t,n,r){r=r||0;for(var i=0,o=-1,s=r;s-1&&t.length-o{const s=e=>r(()=>o(e));if(!t.isBuffer(e))return s(new Error('"key" must be a Buffer'));if(e.length<3)return s(new Error("invalid public key record"));const a=e.slice(0,4).toString();if("/pk/"!==a)return s(new Error("key was not prefixed with /pk/"));const u=e.slice(4);i(n,"sha2-256",(e,t)=>e?s(e):u.equals(t)?void s():s(new Error("public key does not match passed in key")))};e.exports={func:o,sign:!1}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(501),i=n(22),o=(e,n,o)=>{if(0===o.length){const e="No records given";throw i(new Error(e),"ERR_NO_RECORDS_RECEIVED")}const s=r(n,t.from("/"));if(s.length<3){const e="Record key does not have a selector function";throw i(new Error(e),"ERR_NO_SELECTOR_FUNCTION_FOR_RECORD_KEY")}const a=e[s[1].toString()];if(!a){const e=`Unrecognized key prefix: ${s[1]}`;throw i(new Error(e),"ERR_UNRECOGNIZED_KEY_PREFIX")}return a(n,o)};e.exports={bestRecord:o,selectors:n(1045)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports={pk:n(1046)}},function(e,t,n){"use strict";const r=(e,t)=>0;e.exports=r},function(e,t,n){"use strict";const r=n(504),i=n(1058),o=n(1093),s=n(1102),a=n(1108),u=n(1116),l=n(1117),c=n(180),f=n(24);class h extends l{constructor(e){const t=new i({id:e.peerInfo.id}),n=e.peerInfo.multiaddrs.toArray().map(String).filter(e=>e.includes("p2p-websocket-star"));e.peerInfo.multiaddrs.replace(n.map(f),"/p2p-websocket-star");const l=new o({servers:n,id:e.peerInfo.id,ignore_no_online:!n.length||e.wsStarIgnoreErrors}),h={modules:{transport:[r,t,l],streamMuxer:[s],connEncryption:[a],peerDiscovery:[t.discovery,l.discovery,u]},config:{peerDiscovery:{bootstrap:{enabled:!0},webRTCStar:{enabled:!0},websocketStar:{enabled:!0}},EXPERIMENTAL:{dht:!1,pubsub:!1}}};super(c(e,h))}}e.exports=h},function(e,t,n){"use strict";var r=n(1049),i=n(1051),o=n(1055);function s(e){return"function"==typeof e}e.exports=function(e,t){s(t)&&(t={onConnect:t});var n="undefined"==typeof window?{}:window.location,a=o(e,n),u=new r(a),l=i(u,t);return l.remoteAddress=a,l.close=function(e){s(e)&&u.addEventListener("close",e),u.close()},u.addEventListener("open",function(e){t&&s(t.onConnect)&&t.onConnect(null,l)}),l},e.exports.connect=e.exports},function(e,t,n){e.exports="undefined"==typeof WebSocket?n(1050):WebSocket},function(e,t){},function(e,t,n){var r=n(1052),i=n(1053);function o(e,t){var n=e.upgradeReq||{};return t&&t.binaryType?e.binaryType=t.binaryType:t&&t.binary&&(e.binaryType="arraybuffer"),{source:r(e,t&&t.onConnect),sink:i(e,t),headers:n.headers,url:n.url,upgrade:n.upgrade,method:n.method}}e.exports=o},function(e,t,n){var r=n(4).Buffer;function i(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}e.exports=function(e,t){var n=[],o,s,a=!1;function u(t,r){if(o=null,s)return r(s);t?(o=r,e.close()):n.length>0?r(null,n.shift()):o=r}return e.addEventListener("message",function(e){var t=e.data;if(i(t)&&(t=r.from(t)),o)return o(null,t);n.push(t)}),e.addEventListener("close",function(e){s||o&&o(s=!0)}),e.addEventListener("error",function(e){s||(s=e,a||(a=!0,t&&t(e)),o&&o(s))}),e.addEventListener("open",function(e){a||s||(a=!0)}),u}},function(e,t,n){(function(t){var r=n(1054),i="undefined"!=typeof setImmediate?setImmediate:t.nextTick;e.exports=function(e,t){return function(n){t=t||{};var o=!1!==t.closeOnEnd,s="function"==typeof t?t:t.onClose;function a(t,u){t?o&&e.readyState<=1&&(s&&e.addEventListener("close",function(e){if(e.wasClean||1006===e.code)s();else{var t=new Error("ws error");t.event=e,s(t)}}),e.close()):r(e,function(t){if(t)return n(t,function(){});e.send(u),i(function(){n(null,a)})})}n(null,a)}}}).call(this,n(2))},function(e,t){e.exports=function(e,t){var n=e&&(e.removeEventListener||e.removeListener);function r(){"function"==typeof n&&(n.call(e,"open",i),n.call(e,"error",o))}function i(e){r(),t()}function o(e){r(),t(e)}return e.readyState>=2?t(!0):1===e.readyState?t():(e.addEventListener("open",i),void e.addEventListener("error",o))}},function(e,t,n){var{relative:r}=n(303),i={http:"ws",https:"wss"},o="ws";e.exports=function(e,t){return r(e,t,i,o)}},function(e,t,n){"use strict";const r=n(442);e.exports=class e{constructor(e,t){this.peerInfo=null,this.conn=r(),e?this.setInnerConn(e,t):t&&(this.info=t)}get source(){return this.conn.source}get sink(){return this.conn.sink}getPeerInfo(e){return this.info&&this.info.getPeerInfo?this.info.getPeerInfo(e):this.peerInfo?void e(null,this.peerInfo):e(new Error("Peer Info not set yet"))}setPeerInfo(e){if(this.info&&this.info.setPeerInfo)return this.info.setPeerInfo(e);this.peerInfo=e}getObservedAddrs(e){if(this.info&&this.info.getObservedAddrs)return this.info.getObservedAddrs(e);e(null,[])}setInnerConn(e,t){this.conn.resolve(e),this.info=t||e}}},function(e,t,n){"use strict";e.exports=function(){throw new Error("WebSocket Servers can not be created in the browser!")}},function(e,t,n){"use strict";const r=n(5),i=r("libp2p:webrtc-star"),o=n(24),s=n(90),a=n(60),u=n(506),l=n(6).EventEmitter,c=n(253),f=n(23),h=n(44),p=n(65).Connection,d=n(78),m=n(28),g=n(16),y=n(1091),b=n(1092),v=b.cleanUrlSIO,_=b.cleanMultiaddr,w=m(()=>{}),k={transports:["websocket"],"force new connection":!0};class S{constructor(e){e=e||{},this.maSelf=void 0,this.sioOptions={transports:["websocket"],"force new connection":!0},e.wrtc&&(this.wrtc=e.wrtc),this.discovery=new l,this.discovery.tag="webRTCStar",this.discovery.start=(e=>{g(e)}),this.discovery.stop=(e=>{g(e)}),this.listenersRefs={},this._peerDiscovered=this._peerDiscovered.bind(this)}dial(e,t,n){"function"==typeof t&&(n=t,t={}),n=n?m(n):w;const r=(~~(1e9*Math.random())).toString(36)+Date.now(),o=this.listenersRefs[Object.keys(this.listenersRefs)[0]].io,s={initiator:!0,trickle:!1};let a;this.wrtc&&(s.wrtc=this.wrtc);try{a=new c(s)}catch(e){return i("Could not create connection:",e),n(e)}const u=new p(d.duplex(a));let l=!1;return a.on("signal",t=>{o.emit("ss-handshake",{intentId:r,srcMultiaddr:this.maSelf.toString(),dstMultiaddr:e.toString(),signal:t})}),a.once("timeout",()=>n(new Error("timeout"))),a.once("error",e=>{l||n(e)}),o.on("ws-handshake",t=>{if(t.intentId===r&&t.err)return n(new Error(t.err));t.intentId===r&&t.answer&&(a.once("connect",()=>{l=!0,u.destroy=a.destroy.bind(a),a.once("close",()=>u.destroy()),u.getObservedAddrs=(t=>t(null,[e])),n(null,u)}),a.signal(t.signal))}),u}createListener(e,t){"function"==typeof e&&(t=e,e={});const n=new l;return n.listen=((e,r)=>{if(r=r?m(r):w,!y.support&&!this.wrtc)return g(()=>r(new Error("no WebRTC support")));this.maSelf=e;const o=v(e);i("Dialing to Signalling Server on: "+o),n.io=u.connect(o,k),n.io.once("connect_error",r),n.io.once("error",e=>{n.emit("error",e),n.emit("close")}),n.io.on("ws-handshake",a),n.io.on("ws-peer",this._peerDiscovered),n.io.on("connect",()=>{n.io.emit("ss-join",e.toString())}),n.io.once("connect",()=>{n.emit("listening"),r()});const s=this;function a(e){if(e.answer||e.err)return;const o={trickle:!1};let a;s.wrtc&&(o.wrtc=s.wrtc);try{a=new c(o)}catch(e){return i("Could not create incoming connection:",e),r(e)}const u=new p(d.duplex(a));a.once("connect",()=>{u.getObservedAddrs=(t=>t(null,[e.srcMultiaddr])),n.emit("connection",u),t(u)}),a.once("signal",t=>{e.signal=t,e.answer=!0,n.io.emit("ss-handshake",e)}),a.signal(e.signal)}}),n.close=(e=>{e=e?m(e):w,n.io.emit("ss-leave"),g(()=>{n.emit("close"),e()})}),n.getAddrs=(e=>{g(()=>e(null,[this.maSelf]))}),this.listenersRefs[o.toString()]=n,n}filter(e){return Array.isArray(e)||(e=[e]),e.filter(e=>!(e.protoNames().indexOf("p2p-circuit")>-1)&&s.WebRTCStar.matches(e))}_peerDiscovered(e){i("Peer Discovered:",e),e=_(e);const t=e.split("/ipfs/"),n=t[t.length-1],r=f.createFromB58String(n),s=new h(r);s.multiaddrs.add(o(e)),this.discovery.emit("peer",s)}}e.exports=a(S,{className:"WebRTCStar",symbolName:"@libp2p/js-libp2p-webrtc-star/webrtcstar"})},function(e,t,n){var r=n(507),i=n(249)("socket.io-client:url");function o(e,t){var n=e;t=t||"undefined"!=typeof location&&location,null==e&&(e=t.protocol+"//"+t.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(i("protocol-less url %s",e),e=void 0!==t?t.protocol+"//"+e:"https://"+e),i("parse %s",e),n=r(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";var o=-1!==n.host.indexOf(":"),s=o?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+s+":"+n.port,n.href=n.protocol+"://"+s+(t&&t.port===n.port?"":":"+n.port),n}e.exports=o},function(e,t,n){function r(e){var n=0,r;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}function i(e){var n;function i(){if(i.enabled){var e=i,r=+new Date,o=r-(n||r);e.diff=o,e.prev=n,e.curr=r,n=r;for(var s=new Array(arguments.length),a=0;a100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var a=parseFloat(t[1]),u=(t[2]||"ms").toLowerCase();switch(u){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"days":case"day":case"d":return a*o;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*r;case"seconds":case"second":case"secs":case"sec":case"s":return a*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}function u(e){return e>=o?Math.round(e/o)+"d":e>=i?Math.round(e/i)+"h":e>=r?Math.round(e/r)+"m":e>=n?Math.round(e/n)+"s":e+"ms"}function l(e){return c(e,o,"day")||c(e,i,"hour")||c(e,r,"minute")||c(e,n,"second")||e+" ms"}function c(e,t,n){if(!(e0)return a(e);if("number"===n&&!1===isNaN(e))return t.long?l(e):u(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){(function(r){function i(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function u(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function l(){try{return window.localStorage}catch(e){}}t=e.exports=n(1063),t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:l(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(u())}).call(this,n(2))},function(e,t,n){function r(e){var n=0,r;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}function i(e){var n;function i(){if(i.enabled){var e=i,r=+new Date,o=r-(n||r);e.diff=o,e.prev=n,e.curr=r,n=r;for(var s=new Array(arguments.length),a=0;a100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var a=parseFloat(t[1]),u=(t[2]||"ms").toLowerCase();switch(u){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"days":case"day":case"d":return a*o;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*r;case"seconds":case"second":case"secs":case"sec":case"s":return a*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}function u(e){return e>=o?Math.round(e/o)+"d":e>=i?Math.round(e/i)+"h":e>=r?Math.round(e/r)+"m":e>=n?Math.round(e/n)+"s":e+"ms"}function l(e){return c(e,o,"day")||c(e,i,"hour")||c(e,r,"minute")||c(e,n,"second")||e+" ms"}function c(e,t,n){if(!(e0)return a(e);if("number"===n&&!1===isNaN(e))return t.long?l(e):u(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){var r=n(508),i=n(509),o=Object.prototype.toString,s="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===o.call(Blob),a="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===o.call(File);function u(e,t){if(!e)return e;if(i(e)){var n={_placeholder:!0,num:t.length};return t.push(e),n}if(r(e)){for(var o=new Array(e.length),s=0;s0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}function f(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}e.exports=c,c.priorWebsocketSuccess=!1,i(c.prototype),c.protocol=a.protocol,c.Socket=c,c.Transport=n(327),c.transports=n(511),c.parser=n(147),c.prototype.createTransport=function(e){o('creating transport "%s"',e);var t=f(this.query);t.EIO=a.protocol,t.transport=e;var n=this.transportOptions[e]||{};this.id&&(t.sid=this.id);var i=new r[e]({query:t,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0,isReactNative:this.isReactNative});return i},c.prototype.open=function(){var e;if(this.rememberUpgrade&&c.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout(function(){t.emit("error","No transports available")},0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},c.prototype.setTransport=function(e){o("setting transport %s",e.name);var t=this;this.transport&&(o("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",function(){t.onDrain()}).on("packet",function(e){t.onPacket(e)}).on("error",function(e){t.onError(e)}).on("close",function(){t.onClose("transport close")})},c.prototype.probe=function(e){o('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),n=!1,r=this;function i(){if(r.onlyBinaryUpgrades){var i=!this.supportsBinary&&r.transport.supportsBinary;n=n||i}n||(o('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",function(i){if(!n)if("pong"===i.type&&"probe"===i.data){if(o('probe transport "%s" pong',e),r.upgrading=!0,r.emit("upgrading",t),!t)return;c.priorWebsocketSuccess="websocket"===t.name,o('pausing current transport "%s"',r.transport.name),r.transport.pause(function(){n||"closed"!==r.readyState&&(o("changing transport and sending upgrade packet"),h(),r.setTransport(t),t.send([{type:"upgrade"}]),r.emit("upgrade",t),t=null,r.upgrading=!1,r.flush())})}else{o('probe transport "%s" failed',e);var s=new Error("probe error");s.transport=t.name,r.emit("upgradeError",s)}}))}function s(){n||(n=!0,h(),t.close(),t=null)}function a(n){var i=new Error("probe error: "+n);i.transport=t.name,s(),o('probe transport "%s" failed because of error: %s',e,n),r.emit("upgradeError",i)}function u(){a("transport closed")}function l(){a("socket closed")}function f(e){t&&e.name!==t.name&&(o('"%s" works - aborting "%s"',e.name,t.name),s())}function h(){t.removeListener("open",i),t.removeListener("error",a),t.removeListener("close",u),r.removeListener("close",l),r.removeListener("upgrading",f)}c.priorWebsocketSuccess=!1,t.once("open",i),t.once("error",a),t.once("close",u),this.once("close",l),this.once("upgrading",f),t.open()},c.prototype.onOpen=function(){if(o("socket open"),this.readyState="open",c.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){o("starting upgrade probes");for(var e=0,t=this.upgrades.length;er&&(n=r),t>=r||t>=n||0===r)return new ArrayBuffer(0);for(var i=new Uint8Array(e),o=new Uint8Array(n-t),s=t,a=0;s=55296&&i<=56319&&r65535&&(i-=65536,o+=r(i>>>10&1023|55296),i=56320|1023&i),o+=r(i);return o}function u(e,t){if(e>=55296&&e<=57343){if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function c(e,t){return r(e>>t&63|128)}function f(e,t){if(0==(4294967168&e))return r(e);var n="";return 0==(4294965248&e)?n=r(e>>6&31|192):0==(4294901760&e)?(u(e,t)||(e=65533),n=r(e>>12&15|224),n+=c(e,6)):0==(4292870144&e)&&(n=r(e>>18&7|240),n+=c(e,12),n+=c(e,6)),n+=r(63&e|128),n}function h(e,t){t=t||{};for(var r=!1!==t.strict,n=s(e),i=n.length,o=-1,a,u="";++o=i)throw Error("Invalid byte index");var e=255&n[o];if(o++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function d(e){var t,r,s,a,c;if(o>i)throw Error("Invalid byte index");if(o==i)return!1;if(t=255&n[o],o++,0==(128&t))return t;if(192==(224&t)){if(r=l(),c=(31&t)<<6|r,c>=128)return c;throw Error("Invalid continuation byte")}if(224==(240&t)){if(r=l(),s=l(),c=(15&t)<<12|r<<6|s,c>=2048)return u(c,e)?c:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(r=l(),s=l(),a=l(),c=(7&t)<<18|r<<12|s<<6|a,c>=65536&&c<=1114111))return c;throw Error("Invalid UTF-8 detected")}function p(e,t){t=t||{};var r=!1!==t.strict;n=s(e),i=n.length,o=0;for(var u=[],c;!1!==(c=d(r));)u.push(c);return a(u)}e.exports={version:"2.1.2",encode:h,decode:p}},function(e,t){!function(){"use strict";for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=new Uint8Array(256),n=0;n>2],o+=e[(3&r[n])<<4|r[n+1]>>4],o+=e[(15&r[n+1])<<2|r[n+2]>>6],o+=e[63&r[n+2]];return i%3==2?o=o.substring(0,o.length-1)+"=":i%3==1&&(o=o.substring(0,o.length-2)+"=="),o},t.decode=function(e){var t=.75*e.length,n=e.length,i,o=0,s,a,u,c;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);var f=new ArrayBuffer(t),h=new Uint8Array(f);for(i=0;i>4,h[o++]=(15&a)<<4|u>>2,h[o++]=(3&u)<<6|63&c;return f}}()},function(e,t){var r=void 0!==r?r:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,n=function(){try{var e=new Blob(["hi"]);return 2===e.size}catch(e){return!1}}(),i=n&&function(){try{var e=new Blob([new Uint8Array([1,2])]);return 2===e.size}catch(e){return!1}}(),o=r&&r.prototype.append&&r.prototype.getBlob;function s(e){return e.map(function(e){if(e.buffer instanceof ArrayBuffer){var t=e.buffer;if(e.byteLength!==t.byteLength){var r=new Uint8Array(e.byteLength);r.set(new Uint8Array(t,e.byteOffset,e.byteLength)),t=r.buffer}return t}return e})}function a(e,t){t=t||{};var n=new r;return s(e).forEach(function(e){n.append(e)}),t.type?n.getBlob(t.type):n.getBlob()}function u(e,t){return new Blob(s(e),t||{})}"undefined"!=typeof Blob&&(a.prototype=Blob.prototype,u.prototype=Blob.prototype),e.exports=n?i?Blob:u:o?a:void 0},function(e,t,r){function n(e){var r=0,n;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}function i(e){var r;function i(){if(i.enabled){var e=i,n=+new Date,o=n-(r||n);e.diff=o,e.prev=r,e.curr=n,r=n;for(var s=new Array(arguments.length),a=0;a100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var a=parseFloat(t[1]),u=(t[2]||"ms").toLowerCase();switch(u){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"days":case"day":case"d":return a*o;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*n;case"seconds":case"second":case"secs":case"sec":case"s":return a*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}function u(e){return e>=o?Math.round(e/o)+"d":e>=i?Math.round(e/i)+"h":e>=n?Math.round(e/n)+"m":e>=r?Math.round(e/r)+"s":e+"ms"}function c(e){return f(e,o,"day")||f(e,i,"hour")||f(e,n,"minute")||f(e,r,"second")||e+" ms"}function f(e,t,r){if(!(e0)return a(e);if("number"===r&&!1===isNaN(e))return t.long?c(e):u(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,r){(function(t){var n=r(480),i=r(225);e.exports=f;var o=/\n/g,s=/\\n/g,a;function u(){}function c(){return"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:{}}function f(e){if(n.call(this,e),this.query=this.query||{},!a){var t=c();a=t.___eio=t.___eio||[]}this.index=a.length;var r=this;a.push(function(e){r.onData(e)}),this.query.j=this.index,"function"==typeof addEventListener&&addEventListener("beforeunload",function(){r.script&&(r.script.onerror=u)},!1)}i(f,n),f.prototype.supportsBinary=!1,f.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),n.prototype.doClose.call(this)},f.prototype.doPoll=function(){var e=this,t=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),t.async=!0,t.src=this.uri(),t.onerror=function(t){e.onError("jsonp poll error",t)};var r=document.getElementsByTagName("script")[0];r?r.parentNode.insertBefore(t,r):(document.head||document.body).appendChild(t),this.script=t;var n="undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent);n&&setTimeout(function(){var e=document.createElement("iframe");document.body.appendChild(e),document.body.removeChild(e)},100)},f.prototype.doWrite=function(e,t){var r=this;if(!this.form){var n=document.createElement("form"),i=document.createElement("textarea"),a=this.iframeId="eio_iframe_"+this.index,u;n.className="socketio",n.style.position="absolute",n.style.top="-1000px",n.style.left="-1000px",n.target=a,n.method="POST",n.setAttribute("accept-charset","utf-8"),i.name="d",n.appendChild(i),document.body.appendChild(n),this.form=n,this.area=i}function c(){f(),t()}function f(){if(r.iframe)try{r.form.removeChild(r.iframe)}catch(e){r.onError("jsonp polling iframe removal error",e)}try{var e='