diff --git a/Transport.js b/Transport.js index 5fc63b7..fc5545e 100644 --- a/Transport.js +++ b/Transport.js @@ -55,11 +55,12 @@ class Transport { } /* Disconnect from the transport service - there is no guarrantee that a restart will be successfull so this is usually only for when exiting */ p_stop(refreshstatus) { + // refreshstatus(Transport instance) => optional callback to the UI to update the status on the display return new Promise((resolve, reject) => { this.status = Transport.STATUS_FAILED; if (refreshstatus) refreshstatus(this); //if (err) { reject(err) } else { - resolve(res); + resolve(); //} }); } diff --git a/TransportHTTP.js b/TransportHTTP.js index 00cbc04..d21f6b7 100644 --- a/TransportHTTP.js +++ b/TransportHTTP.js @@ -119,7 +119,7 @@ class TransportHTTP extends Transport { */ //PY: res = self._sendGetPost(True, "rawstore", headers={"Content-Type": "application/octet-stream"}, urlargs=[], data=data) console.assert(data, "TransportHttp.p_rawstore: requires data"); - let res = await httptools.p_POST(this._cmdurl(servercommands.rawstore), "application/octet-stream", data); // resolves to URL + const res = await httptools.p_POST(this._cmdurl(servercommands.rawstore), "application/octet-stream", data); // resolves to URL let parsedurl = Url.parse(res); let pathparts = parsedurl.pathname.split('/'); return `contenthash:/contenthash/${pathparts.slice(-1)}` @@ -271,7 +271,7 @@ class TransportHTTP extends Transport { async p_get(url, keys) { if (!url && keys) throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key"); let parmstr =Array.isArray(keys) ? keys.map(k => this._keyparm(k)).join('&') : this._keyparm(keys); - let res = await httptools.p_GET(this._url(url, servercommands.get, parmstr)); + const res = await httptools.p_GET(this._url(url, servercommands.get, parmstr)); return Array.isArray(keys) ? res : res[keys] } diff --git a/TransportIPFS.js b/TransportIPFS.js index cab6d92..b9a2cde 100644 --- a/TransportIPFS.js +++ b/TransportIPFS.js @@ -3,6 +3,8 @@ This is a shim to the IPFS library, (Lists are handled in YJS or OrbitDB) See https://github.com/ipfs/js-ipfs but note its often out of date relative to the generic API doc. */ +//TODO-IPFS Note API changes in https://github.com/ipfs/js-ipfs/issues/1721 probably all ipfs.files -> ipfs. + const httptools = require('./httptools'); // Expose some of the httptools so that IPFS can use it as a backup const debug = require('debug')('dweb-transports:ipfs'); diff --git a/Transports.js b/Transports.js index 89e42ef..4158130 100644 --- a/Transports.js +++ b/Transports.js @@ -101,7 +101,7 @@ class Transports { then resolve urls that might be names, returning a modified array. */ if (this.mirror) { - return Array.isArray(urls) ? urls.map(url=>this.gatewayUrl(url)) : this.gatewayUrl(url); + return Array.isArray(urls) ? this.gatewayUrls(urls) : this.gatewayUrl(url); } else if (this.namingcb) { return await this.namingcb(urls); // Array of resolved urls } else { @@ -756,12 +756,23 @@ class Transports { let o = this.canonicalName(url, options); return o.protocol + ":/" + o.internal; } + static _o2url(o) { + return ["http","https"].includes(o.proto) ? [o.proto, o.internal].join('://') // Shouldnt be relative + : o.proto ? [this.mirror, o.proto, o.internal].join('/') + : o.internal; // Uncanonicalizable + } static gatewayUrl(url) { // Convert url to gateway url, if not canonicalizable then just pass the url along let o = Transports.canonicalName(url); - return !o ? url - : ["http","https"].includes(o.proto) ? [o.proto, o.internal].join('://') // Shouldnt be relative - : [this.mirror, o.proto, o.internal].join('/'); + return !o ? url : this._o2url(o) + } + static gatewayUrls(urls) { //TODO-API + // Convert urls to gateway urls, + // Easier to work on single form [ { proto, internal } ] + const oo = urls.map(url => Transports.canonicalName(url) || { proto: undefined, internal: url }); //if not canonicalizable then just pass the url along + const oArc = oo.filter(o => ["arc"].includes(o.proto)); // Prefered + return (oArc.length ? oArc : oo) // Prefered if have them, else others + .map(o=>this._o2url(o)) } } Transports._transports = []; // Array of transport instances connected diff --git a/dist/dweb-transports-bundle.js b/dist/dweb-transports-bundle.js index f774165..20ea02c 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=740)}([function(e,t,r){"use strict";(function(e){ +!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=729)}([function(e,t,r){"use strict";(function(e){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -var n=r(748),i=r(749),o=r(388);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 M(this,t,r);case"utf8":case"utf-8":return P(this,t,r);case"ascii":return j(this,t,r);case"latin1":case"binary":return L(this,t,r);case"base64":return O(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 l=!0,h=0;hi&&(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,l;if(i+a<=r)switch(a){case 1:o<128&&(s=o);break;case 2:u=e[i+1],128==(192&u)&&(l=(31&o)<<6|63&u,l>127&&(s=l));break;case 3:u=e[i+1],c=e[i+2],128==(192&u)&&128==(192&c)&&(l=(15&o)<<12|(63&u)<<6|63&c,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:u=e[i+1],c=e[i+2],f=e[i+3],128==(192&u)&&128==(192&c)&&128==(192&f)&&(l=(15&o)<<18|(63&u)<<12|(63&c)<<6|63&f,l>65535&&l<1114112&&(s=l))}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 N(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 h(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),l=t.slice(r,n),h=0;ho)&&(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 A(this,t,r,n);case"utf8":case"utf-8":return x(this,t,r,n);case"ascii":return C(this,t,r,n);case"latin1":case"binary":return T(this,t,r,n);case"base64":return I(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(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 R=4096;function N(e){var t=e.length;if(t<=R)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 F(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 K(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 q(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 z(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 V(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||U(t,1,this.length),this[t]},c.prototype.readUInt16LE=function e(t,r){return r||U(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function e(t,r){return r||U(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function e(t,r){return r||U(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||U(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||U(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||U(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||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function e(t,r){r||U(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||U(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||U(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||U(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||U(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function e(t,r){return r||U(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function e(t,r){return r||U(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function e(t,r){return r||U(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;F(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||F(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||F(this,t,r,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):K(this,t,r,!0),r+2},c.prototype.writeUInt16BE=function e(t,r,n){return t=+t,r|=0,n||F(this,t,r,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):K(this,t,r,!1),r+2},c.prototype.writeUInt32LE=function e(t,r,n){return t=+t,r|=0,n||F(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):q(this,t,r,!0),r+4},c.prototype.writeUInt32BE=function e(t,r,n){return t=+t,r|=0,n||F(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):q(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);F(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);F(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||F(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||F(this,t,r,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):K(this,t,r,!0),r+2},c.prototype.writeInt16BE=function e(t,r,n){return t=+t,r|=0,n||F(this,t,r,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):K(this,t,r,!1),r+2},c.prototype.writeInt32LE=function e(t,r,n){return t=+t,r|=0,n||F(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):q(this,t,r,!0),r+4},c.prototype.writeInt32BE=function e(t,r,n){return t=+t,r|=0,n||F(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):q(this,t,r,!1),r+4},c.prototype.writeFloatLE=function e(t,r,n){return z(this,t,r,!0,n)},c.prototype.writeFloatBE=function e(t,r,n){return z(this,t,r,!1,n)},c.prototype.writeDoubleLE=function e(t,r,n){return V(this,t,r,!0,n)},c.prototype.writeDoubleBE=function e(t,r,n){return V(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(W(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,r){ +var n=r(736),i=r(384),o=r(382);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 M(this,t,r);case"utf8":case"utf-8":return P(this,t,r);case"ascii":return j(this,t,r);case"latin1":case"binary":return L(this,t,r);case"base64":return O(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 l=!0,h=0;hi&&(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,l;if(i+a<=r)switch(a){case 1:o<128&&(s=o);break;case 2:u=e[i+1],128==(192&u)&&(l=(31&o)<<6|63&u,l>127&&(s=l));break;case 3:u=e[i+1],c=e[i+2],128==(192&u)&&128==(192&c)&&(l=(15&o)<<12|(63&u)<<6|63&c,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:u=e[i+1],c=e[i+2],f=e[i+3],128==(192&u)&&128==(192&c)&&128==(192&f)&&(l=(15&o)<<18|(63&u)<<12|(63&c)<<6|63&f,l>65535&&l<1114112&&(s=l))}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 N(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 h(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),l=t.slice(r,n),h=0;ho)&&(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 A(this,t,r,n);case"utf8":case"utf-8":return x(this,t,r,n);case"ascii":return C(this,t,r,n);case"latin1":case"binary":return T(this,t,r,n);case"base64":return I(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(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 R=4096;function N(e){var t=e.length;if(t<=R)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 F(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 K(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 q(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 z(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 V(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||U(t,1,this.length),this[t]},c.prototype.readUInt16LE=function e(t,r){return r||U(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function e(t,r){return r||U(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function e(t,r){return r||U(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||U(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||U(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||U(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||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function e(t,r){r||U(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||U(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||U(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||U(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||U(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function e(t,r){return r||U(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function e(t,r){return r||U(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function e(t,r){return r||U(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;F(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||F(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||F(this,t,r,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):K(this,t,r,!0),r+2},c.prototype.writeUInt16BE=function e(t,r,n){return t=+t,r|=0,n||F(this,t,r,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):K(this,t,r,!1),r+2},c.prototype.writeUInt32LE=function e(t,r,n){return t=+t,r|=0,n||F(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):q(this,t,r,!0),r+4},c.prototype.writeUInt32BE=function e(t,r,n){return t=+t,r|=0,n||F(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):q(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);F(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);F(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||F(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||F(this,t,r,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):K(this,t,r,!0),r+2},c.prototype.writeInt16BE=function e(t,r,n){return t=+t,r|=0,n||F(this,t,r,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):K(this,t,r,!1),r+2},c.prototype.writeInt32LE=function e(t,r,n){return t=+t,r|=0,n||F(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):q(this,t,r,!0),r+4},c.prototype.writeInt32BE=function e(t,r,n){return t=+t,r|=0,n||F(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):q(this,t,r,!1),r+4},c.prototype.writeFloatLE=function e(t,r,n){return z(this,t,r,!0,n)},c.prototype.writeFloatBE=function e(t,r,n){return z(this,t,r,!1,n)},c.prototype.writeDoubleLE=function e(t,r,n){return V(this,t,r,!0,n)},c.prototype.writeDoubleBE=function e(t,r,n){return V(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 Z(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(W(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(10))},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){ /** PROMISIFY CALLBACK-STYLE FUNCTIONS TO ES6 PROMISES * * EXAMPLE: @@ -28,7 +28,7 @@ var n=r(748),i=r(749),o=r(388);function s(){try{var e=new Uint8Array(1);return e * @version: 1.0.3 * @author: Manuel Di Iorio **/ -var n=function(e,t){return function(){var r=Array.prototype.slice.call(arguments),n=r.length-1,i=r&&r.length>0?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){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,l,h=-1;function d(){f&&l&&(f=!1,l.length?c=l.concat(c):h=-1,c.length&&p())}function p(){if(!f){var e=a(d);f=!0;for(var t=c.length;t;){for(l=c,c=[];++h1)for(var r=1;r=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(745)(t);var l=e.exports.formatters;l.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,r(3))},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){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(t=(0,u.default)(t||s.default),!(0,i.default)(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var r=0;function n(t){var n=(0,p.default)(e[r++]);t.push((0,h.default)(o)),n.apply(null,t)}function o(i){if(i||r===e.length)return t.apply(null,arguments);n((0,f.default)(arguments,1))}n([])};var n=r(81),i=y(n),o=r(59),s=y(o),a=r(211),u=y(a),c=r(127),f=y(c),l=r(128),h=y(l),d=r(37),p=y(d);function y(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(279),i=o(n);function o(e){return e&&e.__esModule?e:{default:e}}t.default=i.default,e.exports=t.default},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=r(769),i=r(774),o=r(779);for(var s in t=e.exports=r(70),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(t){const n=r(18),i=r(395),o=r(766),s=r(209),a=r(768),u=r(41);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){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,r,i,a,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var f=new Error('Uncaught, unspecified "error" event. ('+t+")");throw f.context=t,f}if(r=this._events[e],s(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),r.apply(this,a)}else if(o(r))for(a=Array.prototype.slice.call(arguments,1),c=r.slice(),i=c.length,u=0;u0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){if(!n(t))throw TypeError("listener must be a function");var r=!1;function i(){this.removeListener(e,i),r||(r=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},r.prototype.removeListener=function(e,t){var r,i,s,a;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],s=r.length,i=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(r)){for(a=s;a-- >0;)if(r[a]===t||r[a].listener&&r[a].listener===t){i=a;break}if(i<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],n(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[],t},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,r){t=e.exports=r(386),t.Stream=t,t.Readable=t,t.Writable=r(390),t.Duplex=r(104),t.Transform=r(391),t.PassThrough=r(753)},function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){var n=r(208),i="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";e.exports=n(i)},function(e,t,r){(function(e,n){var i; +var n=function(e,t){return function(){var r=Array.prototype.slice.call(arguments),n=r.length-1,i=r&&r.length>0?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){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,l,h=-1;function d(){f&&l&&(f=!1,l.length?c=l.concat(c):h=-1,c.length&&p())}function p(){if(!f){var e=a(d);f=!0;for(var t=c.length;t;){for(l=c,c=[];++h1)for(var r=1;r=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(734)(t);var l=e.exports.formatters;l.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,r(3))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(t=(0,u.default)(t||s.default),!(0,i.default)(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var r=0;function n(t){var n=(0,p.default)(e[r++]);t.push((0,h.default)(o)),n.apply(null,t)}function o(i){if(i||r===e.length)return t.apply(null,arguments);n((0,f.default)(arguments,1))}n([])};var n=r(81),i=y(n),o=r(59),s=y(o),a=r(206),u=y(a),c=r(125),f=y(c),l=r(126),h=y(l),d=r(37),p=y(d);function y(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(275),i=o(n);function o(e){return e&&e.__esModule?e:{default:e}}t.default=i.default,e.exports=t.default},function(e,t,r){"use strict";var n=r(756),i=r(761),o=r(766);for(var s in t=e.exports=r(70),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(t){const n=r(18),i=r(390),o=r(753),s=r(204),a=r(755),u=r(41);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){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){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,r,i,a,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var f=new Error('Uncaught, unspecified "error" event. ('+t+")");throw f.context=t,f}if(r=this._events[e],s(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),r.apply(this,a)}else if(o(r))for(a=Array.prototype.slice.call(arguments,1),c=r.slice(),i=c.length,u=0;u0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){if(!n(t))throw TypeError("listener must be a function");var r=!1;function i(){this.removeListener(e,i),r||(r=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},r.prototype.removeListener=function(e,t){var r,i,s,a;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],s=r.length,i=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(r)){for(a=s;a-- >0;)if(r[a]===t||r[a].listener&&r[a].listener===t){i=a;break}if(i<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],n(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[],t},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,r){t=e.exports=r(381),t.Stream=t,t.Readable=t,t.Writable=r(271),t.Duplex=r(103),t.Transform=r(386),t.PassThrough=r(740)},function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){var n=r(203),i="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";e.exports=n(i)},function(e,t,r){(function(e,n){var i; /** * @license * lodash 3.10.1 (Custom Build) @@ -37,20 +37,20 @@ 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,l=16,h=32,d=64,p=128,y=256,g=30,m="...",b=150,v=16,_=200,w=1,S=2,E="Expected a function",k="__lodash_placeholder__",A="[object Arguments]",x="[object Array]",C="[object Boolean]",T="[object Date]",I="[object Error]",B="[object Function]",O="[object Map]",P="[object Number]",R="[object Object]",N="[object RegExp]",j="[object Set]",L="[object String]",M="[object WeakMap]",D="[object ArrayBuffer]",U="[object Float32Array]",F="[object Float64Array]",K="[object Int8Array]",q="[object Int16Array]",H="[object Int32Array]",z="[object Uint8Array]",V="[object Uint8ClampedArray]",G="[object Uint16Array]",W="[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,le=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,he=/\w*$/,de=/^0[xX]/,pe=/^\[object .+?Constructor\]$/,ye=/^\d+$/,ge=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,me=/($^)/,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,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[U]=ke[F]=ke[K]=ke[q]=ke[H]=ke[z]=ke[V]=ke[G]=ke[W]=!0,ke[A]=ke[x]=ke[D]=ke[C]=ke[T]=ke[I]=ke[B]=ke[O]=ke[P]=ke[R]=ke[N]=ke[j]=ke[L]=ke[M]=!1;var Ae={};Ae[A]=Ae[x]=Ae[D]=Ae[C]=Ae[T]=Ae[U]=Ae[F]=Ae[K]=Ae[q]=Ae[H]=Ae[P]=Ae[R]=Ae[N]=Ae[L]=Ae[z]=Ae[V]=Ae[G]=Ae[W]=!0,Ae[I]=Ae[B]=Ae[O]=Ae[j]=Ae[M]=!1;var xe={"À":"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"},Ce={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Te={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Ie={function:!0,object:!0},Be={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=Ie[typeof t]&&t&&!t.nodeType&&t,Re=Ie[typeof e]&&e&&!e.nodeType&&e,Ne=Pe&&Re&&"object"==typeof n&&n&&n.Object&&n,je=Ie[typeof self]&&self&&self.Object&&self,Le=Ie[typeof window]&&window&&window.Object&&window,Me=Re&&Re.exports===Pe&&Pe,De=Ne||Le!==(this&&this.window)&&Le||je||this;function Ue(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 Ve(e,t){for(var r=e.length;r--&&t.indexOf(e.charAt(r))>-1;);return r}function Ge(e,t){return Ue(e.criteria,t.criteria)||e.index-t.index}function We(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 xe[e]}function Ye(e){return Ce[e]}function Je(e,t,r){return t?e=Be[e]:r&&(e=Oe[e]),"\\"+e}function Xe(e){return"\\"+Oe[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,Ot=9007199254740991,Pt=pt&&new pt,Rt={};function Nt(e){if(Qe(e)&&!bs(e)&&!(e instanceof Dt)){if(e instanceof Lt)return e;if(Oe.call(e,"__chain__")&&Oe.call(e,"__wrapped__"))return vi(e)}return new Lt(e)}function jt(){}function Lt(e,t,r){this.__wrapped__=e,this.__actions__=r||[],this.__chain__=!!t}var Mt=Nt.support={};function Dt(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Ct,this.__views__=[]}function Ut(){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 Ft(){if(this.__filtered__){var e=new Dt(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function Kt(){var e=this.__wrapped__.value(),t=this.__dir__,r=bs(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__,l=f.length,h=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--&&h=_?gn(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?gn():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 xr(r,n,e)}}function En(e){return function(t,r,n){return t&&t.length?(r=qn(r,n,3),Fe(t,r,e)):-1}}function kn(e){return function(t,r,n){return r=qn(r,n,3),xr(t,r,e,!0)}}function An(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+"",Ta(r,yt(i/r.length)).slice(0,i)}function jn(e,r,n,i){var o=r&a,s=bn(e);function u(){for(var r=-1,a=arguments.length,c=-1,f=i.length,l=t(f+a);++cc))return!1;for(;++u-1&&e%1==0&&e-1&&e%1==0&&e<=Ot}function si(e){return e==e&&!Cs(e)}function ai(e,t){var r=e[1],n=t[1],i=r|n,o=i0){if(++di>=b)return e}else di=0;return $r(e,t)}),di,pi;function yi(e){for(var t=ia(e),r=t.length,n=r&&e.length,i=!!n&&oi(n)&&(bs(e)||ms(e)),o=-1,s=[];++o=120?gn(n&&u):null}var c=e[0],f=-1,l=c?c.length:0,h=i[0];e:for(;++f-1;)ht.call(t,o,1);return t}var Ui=cs(function(e,t){t=Cr(t);var r=dr(e,t);return Vr(e,t.sort(Ue)),r});function Fi(e,t,r){var n=[];if(!e||!e.length)return n;var i=-1,o=[],s=e.length;for(t=qn(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=Nt(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=Cr(e),this.thru(function(t){return Jt(bs(t)?t:[mi(t)],e)})});function fo(e){for(var t,r=this;r instanceof jt;){var n=vi(r);t?i.__wrapped__=n:t=n;var i=n;r=r.__wrapped__}return i.__wrapped__=e,t}function lo(){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 ho(){return this.value()+""}function po(){return nn(this.__wrapped__,this.__actions__)}var yo=cs(function(e,t){return dr(e,Cr(t))}),go=ln(function(e,t,r){Oe.call(e,r)?++e[r]:e[r]=1});function mo(e,t,r){var n=bs(e)?er:Sr;return r&&ri(e,t,r)&&(t=o),"function"==typeof t&&r===o||(t=qn(t,r,3)),n(e,t)}function bo(e,t,r){var n=bs(e)?rr:Ar;return t=qn(t,r,3),n(e,t)}var vo=Sn(_r),_o=Sn(wr,!0);function wo(e,t){return vo(e,Ur(t))}var So=xn(Zt,_r),Eo=xn(Qt,wr),ko=ln(function(e,t,r){Oe.call(e,r)?e[r].push(t):e[r]=[t]});function Ao(e,t,r,n){var i=e?Gn(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||!bs(e)&&js(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&Vn(e,t,r)>-1}var xo=ln(function(e,t,r){e[r]=t}),Co=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 To(e,t,r){var n=bs(e)?nr:Dr;return t=qn(t,r,3),n(e,t)}var Io=ln(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]});function Bo(e,t){return To(e,Ja(t))}var Oo=Pn(or,_r),Po=Pn(sr,wr);function Ro(e,t,r){var n=bs(e)?rr:Ar;return t=qn(t,r,3),n(e,function(e,r,n){return!t(e,r,n)})}function No(e,t,r){if(r?ri(e,t,r):null==t){e=gi(e);var n=e.length;return n>0?e[Gr(0,n-1)]:o}var i=-1,s=Fs(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 Go=cs(function(e,t,r){var n=a;if(r.length){var i=tt(r,Go.placeholder);n|=h}return Dn(e,n,t,r,i)}),Wo=cs(function(e,t){t=t.length?Cr(t):Qs(e);for(var r=-1,n=t.length;++rt?g(f,i):c=lt(m,e)}function b(){g(d,c)}function v(){if(n=arguments,a=qo(),u=this,f=d&&(c||!p),!1===h)var r=p&&!c;else{i||p||(l=a);var y=h-(a-l),g=y<=0||y>h;g?(i&&(i=Me(i)),l=a,s=e.apply(u,n)):i||(i=lt(b,y))}return g&&c?c=Me(c):c||t===h||(c=lt(m,t)),r&&(g=!0,s=e.apply(u,n)),!g||c||i||(n=u=o),s}return v.cancel=y,v}var Zo=cs(function(e,t){return br(e,1,t)}),Qo=cs(function(e,t,r){return br(e,t,r)}),es=An(),ts=An(!0);function rs(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new xe(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=Cr(t),"function"!=typeof e||!er(t,qe))throw new xe(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 xe(E);return function(){return!e.apply(this,arguments)}}function os(e){return Vo(2,e)}var ss=On(h),as=On(d),us=cs(function(e,t){return Dn(e,y,o,o,o,Cr(t))});function cs(e,r){if("function"!=typeof e)throw new xe(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 gs(e,t){return e>=t}function ms(e){return Qe(e)&&ei(e)&&Oe.call(e,"callee")&&!ct.call(e,"callee")}var bs=bt||function(e){return Qe(e)&&oi(e.length)&&Re.call(e)==x};function vs(e){return!0===e||!1===e||Qe(e)&&Re.call(e)==C}function _s(e){return Qe(e)&&Re.call(e)==T}function ws(e){return!!e&&1===e.nodeType&&Qe(e)&&!Rs(e)}function Ss(e){return null==e||(ei(e)&&(bs(e)||js(e)||ms(e)||Qe(e)&&xs(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?jr(e,t,r):!!i}function ks(e){return Qe(e)&&"string"==typeof e.message&&Re.call(e)==I}function As(e){return"number"==typeof e&&vt(e)}function xs(e){return Cs(e)&&Re.call(e)==B}function Cs(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ts(e,t,r,n){return r="function"==typeof r?an(r,n,3):o,Mr(e,Wn(t),r)}function Is(e){return Ps(e)&&e!=+e}function Bs(e){return null!=e&&(xs(e)?je.test(Be.call(e)):Qe(e)&&pe.test(e))}function Os(e){return null===e}function Ps(e){return"number"==typeof e||Qe(e)&&Re.call(e)==P}function Rs(e){var t,r;return!(!Qe(e)||Re.call(e)!=R||ms(e)||!(Oe.call(e,"constructor")||(t=e.constructor,"function"!=typeof t||t instanceof t)))&&(Br(e,function(e,t){r=t}),r===o||Oe.call(e,r))}function Ns(e){return Cs(e)&&Re.call(e)==N}function js(e){return"string"==typeof e||Qe(e)&&Re.call(e)==L}function Ls(e){return Qe(e)&&oi(e.length)&&!!ke[Re.call(e)]}function Ms(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=mn(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=mt(i),s=yt(i);return r=Nn("",s,r),r.slice(0,o)+e+r}var Aa=Bn(),xa=Bn(!0);function Ca(e,t,r){return(r?ri(e,t,r):null==t)?t=0:t&&(t=+t),e=Ra(e),kt(e,t||(de.test(e)?16:10))}function Ta(e,t){var r="";if(e=He(e),t=+t,t<1||!e||!vt(t))return r;do{t%2&&(r+=e),t=mt(t/2),e+=e}while(t);return r}var Ia=mn(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}),Ba=mn(function(e,t,r){return e+(r?" ":"")+(t.charAt(0).toUpperCase()+t.slice(1))});function Oa(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 Pa(e,t,r){var n=Nt.templateSettings;r&&ri(e,t,r)&&(t=r=o),e=He(e),t=lr(hr({},r||t),n,fr);var s=lr(hr({},t.imports),n.imports,fr),a=na(s),u=tn(s,a),c,f,l=0,h=t.interpolate||me,d="__p += '",p=_e((t.escape||me).source+"|"+h.source+"|"+(h===ne?le:me).source+"|"+(t.evaluate||me).source+"|$","g"),y="//# 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(l,s).replace(be,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'"),l=s+t.length,t}),d+="';\n";var g=t.variable;g||(d="with (obj) {\n"+d+"\n}\n"),d=(f?d.replace($,""):d).replace(Y,"$1").replace(J,"$1;"),d="function("+(g||"obj")+") {\n"+(g?"":"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 m=Ua(function(){return i(a,y+"return "+d).apply(o,u)});if(m.source=d,ks(m))throw m;return m}function Ra(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(ze(e,t),Ve(e,t)+1)):e}function Na(e,t,r){var n=e;return e=He(e),e?(r?ri(n,t,r):null==t)?e.slice(nt(e)):e.slice(ze(e,t+"")):e}function ja(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,Ve(e,t+"")+1):e}function La(e,t,r){r&&ri(e,t,r)&&(t=o);var n=g,i=m;if(null!=t)if(Cs(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(Ns(s)){if(e.slice(a).search(s)){var c,f,l=e.slice(0,a);for(s.global||(s=_e(s.source,(he.exec(s)||"")+"g")),s.lastIndex=0;c=s.exec(l);)f=c.index;u=u.slice(0,null==f?a:f)}}else if(e.indexOf(s,a)!=a){var h=u.lastIndexOf(s);h>-1&&(u=u.slice(0,h))}return u+i}function Ma(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 Ua=cs(function(e,t){try{return e.apply(o,t)}catch(e){return ks(e)?e:new n(e)}});function Fa(e,t,r){return r&&ri(e,t,r)&&(t=o),Qe(e)?Ha(e):yr(e,t)}function Ka(e){return function(){return e}}function qa(e){return e}function Ha(e){return Ur(gr(e,!0))}function za(e,t){return Fr(e,gr(t,!0))}var Va=cs(function(e,t){return function(r){return Qn(r,e,t)}}),Ga=cs(function(e,t){return function(r){return Qn(e,r,t)}});function Wa(e,t,r){if(null==r){var n=Cs(t),i=n?na(t):o,s=i&&i.length?Rr(t,i):o;(s?s.length:n)||(s=!1,r=t,t=e,e=this)}s||(s=Rr(t,na(t)));var a=!0,u=-1,c=xs(e),f=s.length;!1===r?a=!1:Cs(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(Ct)},Or(Dt.prototype,function(e,t){var r=/^(?:filter|map|reject)|While$/.test(t),n=/^(?:first|last)$/.test(t),i=Nt[n?"take"+("last"==t?"Right":""):t];i&&(Nt.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],l=c||bs(a);l&&r&&"function"==typeof f&&1!=f.length&&(c=l=!1);var h=function(e){return n&&s?i(e,1)[0]:i.apply(o,ir([e],t))},d={func:so,args:[h],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&&l){a=p?a:new Dt(this);var y=e.apply(a,t);return y.__actions__.push(d),new Lt(y,s)}return this.thru(h)})}),Zt(["join","pop","push","replace","shift","sort","splice","split","unshift"],function(e){var t=(/^(?:replace|split)$/.test(e)?Ie:Ce)[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:join|pop|replace|shift)$/.test(e);Nt.prototype[e]=function(){var e=arguments;return n&&!this.__chain__?t.apply(this.value(),e):this[r](function(r){return t.apply(r,e)})}}),Or(Dt.prototype,function(e,t){var r=Nt[t];if(r){var n=r.name,i=Rt[n]||(Rt[n]=[]);i.push({name:t,func:r})}}),Rt[Rn(o,u).name]=[{name:"wrapper",func:o}],Dt.prototype.clone=Ut,Dt.prototype.reverse=Ft,Dt.prototype.value=Kt,Nt.prototype.chain=ao,Nt.prototype.commit=uo,Nt.prototype.concat=co,Nt.prototype.plant=fo,Nt.prototype.reverse=lo,Nt.prototype.toString=ho,Nt.prototype.run=Nt.prototype.toJSON=Nt.prototype.valueOf=Nt.prototype.value=po,Nt.prototype.collect=Nt.prototype.map,Nt.prototype.head=Nt.prototype.first,Nt.prototype.select=Nt.prototype.filter,Nt.prototype.tail=Nt.prototype.rest,Nt}var at=st();De._=at,i=function(){return at}.call(t,r,t,e),i===o||(e.exports=i)}).call(this)}).call(this,r(32)(e),r(8))},function(e,t,r){(function(t,n){var i=r(13),o=r(1042),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 l="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],d="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";s.encode64=function(e,t){for(var r="",n="",i,o,s,a=0;a>2),r+=l.charAt((3&i)<<4|o>>4),isNaN(o)?r+="==":(r+=l.charAt((15&o)<<2|s>>6),r+=isNaN(s)?"=":l.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+=l.charAt((3&i)<<4|o>>4),isNaN(o)?r+="==":(r+=l.charAt((15&o)<<2|s>>6),r+=isNaN(s)?"=":l.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){"use strict";const n=r(694),i=r(695),o=r(27);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";(function(t){ + */(function(){var o,s="3.10.1",a=1,u=2,c=4,f=8,l=16,h=32,d=64,p=128,y=256,g=30,m="...",b=150,v=16,_=200,w=1,S=2,E="Expected a function",k="__lodash_placeholder__",A="[object Arguments]",x="[object Array]",C="[object Boolean]",T="[object Date]",I="[object Error]",B="[object Function]",O="[object Map]",P="[object Number]",R="[object Object]",N="[object RegExp]",j="[object Set]",L="[object String]",M="[object WeakMap]",D="[object ArrayBuffer]",U="[object Float32Array]",F="[object Float64Array]",K="[object Int8Array]",q="[object Int16Array]",H="[object Int32Array]",z="[object Uint8Array]",V="[object Uint8ClampedArray]",G="[object Uint16Array]",W="[object Uint32Array]",$=/\b__p \+= '';/g,Y=/\b(__p \+=) '' \+/g,J=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Z=/&(?:amp|lt|gt|quot|#39|#96);/g,X=/[&<>"'`]/g,Q=RegExp(Z.source),ee=RegExp(X.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,le=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,he=/\w*$/,de=/^0[xX]/,pe=/^\[object .+?Constructor\]$/,ye=/^\d+$/,ge=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,me=/($^)/,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,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[U]=ke[F]=ke[K]=ke[q]=ke[H]=ke[z]=ke[V]=ke[G]=ke[W]=!0,ke[A]=ke[x]=ke[D]=ke[C]=ke[T]=ke[I]=ke[B]=ke[O]=ke[P]=ke[R]=ke[N]=ke[j]=ke[L]=ke[M]=!1;var Ae={};Ae[A]=Ae[x]=Ae[D]=Ae[C]=Ae[T]=Ae[U]=Ae[F]=Ae[K]=Ae[q]=Ae[H]=Ae[P]=Ae[R]=Ae[N]=Ae[L]=Ae[z]=Ae[V]=Ae[G]=Ae[W]=!0,Ae[I]=Ae[B]=Ae[O]=Ae[j]=Ae[M]=!1;var xe={"À":"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"},Ce={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Te={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Ie={function:!0,object:!0},Be={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=Ie[typeof t]&&t&&!t.nodeType&&t,Re=Ie[typeof e]&&e&&!e.nodeType&&e,Ne=Pe&&Re&&"object"==typeof n&&n&&n.Object&&n,je=Ie[typeof self]&&self&&self.Object&&self,Le=Ie[typeof window]&&window&&window.Object&&window,Me=Re&&Re.exports===Pe&&Pe,De=Ne||Le!==(this&&this.window)&&Le||je||this;function Ue(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 Ve(e,t){for(var r=e.length;r--&&t.indexOf(e.charAt(r))>-1;);return r}function Ge(e,t){return Ue(e.criteria,t.criteria)||e.index-t.index}function We(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 xe[e]}function Ye(e){return Ce[e]}function Je(e,t,r){return t?e=Be[e]:r&&(e=Oe[e]),"\\"+e}function Ze(e){return"\\"+Oe[e]}function Xe(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,Ot=9007199254740991,Pt=pt&&new pt,Rt={};function Nt(e){if(Qe(e)&&!bs(e)&&!(e instanceof Dt)){if(e instanceof Lt)return e;if(Oe.call(e,"__chain__")&&Oe.call(e,"__wrapped__"))return vi(e)}return new Lt(e)}function jt(){}function Lt(e,t,r){this.__wrapped__=e,this.__actions__=r||[],this.__chain__=!!t}var Mt=Nt.support={};function Dt(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Ct,this.__views__=[]}function Ut(){var e=new Dt(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 Ft(){if(this.__filtered__){var e=new Dt(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function Kt(){var e=this.__wrapped__.value(),t=this.__dir__,r=bs(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__,l=f.length,h=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--&&h=_?gn(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?gn():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 xr(r,n,e)}}function En(e){return function(t,r,n){return t&&t.length?(r=qn(r,n,3),Fe(t,r,e)):-1}}function kn(e){return function(t,r,n){return r=qn(r,n,3),xr(t,r,e,!0)}}function An(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+"",Ta(r,yt(i/r.length)).slice(0,i)}function jn(e,r,n,i){var o=r&a,s=bn(e);function u(){for(var r=-1,a=arguments.length,c=-1,f=i.length,l=t(f+a);++cc))return!1;for(;++u-1&&e%1==0&&e-1&&e%1==0&&e<=Ot}function si(e){return e==e&&!Cs(e)}function ai(e,t){var r=e[1],n=t[1],i=r|n,o=i0){if(++di>=b)return e}else di=0;return $r(e,t)}),di,pi;function yi(e){for(var t=ia(e),r=t.length,n=r&&e.length,i=!!n&&oi(n)&&(bs(e)||ms(e)),o=-1,s=[];++o=120?gn(n&&u):null}var c=e[0],f=-1,l=c?c.length:0,h=i[0];e:for(;++f-1;)ht.call(t,o,1);return t}var Ui=cs(function(e,t){t=Cr(t);var r=dr(e,t);return Vr(e,t.sort(Ue)),r});function Fi(e,t,r){var n=[];if(!e||!e.length)return n;var i=-1,o=[],s=e.length;for(t=qn(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,Xi(e,r,n)});function io(e){var t=Nt(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=Cr(e),this.thru(function(t){return Jt(bs(t)?t:[mi(t)],e)})});function fo(e){for(var t,r=this;r instanceof jt;){var n=vi(r);t?i.__wrapped__=n:t=n;var i=n;r=r.__wrapped__}return i.__wrapped__=e,t}function lo(){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 ho(){return this.value()+""}function po(){return nn(this.__wrapped__,this.__actions__)}var yo=cs(function(e,t){return dr(e,Cr(t))}),go=ln(function(e,t,r){Oe.call(e,r)?++e[r]:e[r]=1});function mo(e,t,r){var n=bs(e)?er:Sr;return r&&ri(e,t,r)&&(t=o),"function"==typeof t&&r===o||(t=qn(t,r,3)),n(e,t)}function bo(e,t,r){var n=bs(e)?rr:Ar;return t=qn(t,r,3),n(e,t)}var vo=Sn(_r),_o=Sn(wr,!0);function wo(e,t){return vo(e,Ur(t))}var So=xn(Xt,_r),Eo=xn(Qt,wr),ko=ln(function(e,t,r){Oe.call(e,r)?e[r].push(t):e[r]=[t]});function Ao(e,t,r,n){var i=e?Gn(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||!bs(e)&&js(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&Vn(e,t,r)>-1}var xo=ln(function(e,t,r){e[r]=t}),Co=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 To(e,t,r){var n=bs(e)?nr:Dr;return t=qn(t,r,3),n(e,t)}var Io=ln(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]});function Bo(e,t){return To(e,Ja(t))}var Oo=Pn(or,_r),Po=Pn(sr,wr);function Ro(e,t,r){var n=bs(e)?rr:Ar;return t=qn(t,r,3),n(e,function(e,r,n){return!t(e,r,n)})}function No(e,t,r){if(r?ri(e,t,r):null==t){e=gi(e);var n=e.length;return n>0?e[Gr(0,n-1)]:o}var i=-1,s=Fs(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 Go=cs(function(e,t,r){var n=a;if(r.length){var i=tt(r,Go.placeholder);n|=h}return Dn(e,n,t,r,i)}),Wo=cs(function(e,t){t=t.length?Cr(t):Qs(e);for(var r=-1,n=t.length;++rt?g(f,i):c=lt(m,e)}function b(){g(d,c)}function v(){if(n=arguments,a=qo(),u=this,f=d&&(c||!p),!1===h)var r=p&&!c;else{i||p||(l=a);var y=h-(a-l),g=y<=0||y>h;g?(i&&(i=Me(i)),l=a,s=e.apply(u,n)):i||(i=lt(b,y))}return g&&c?c=Me(c):c||t===h||(c=lt(m,t)),r&&(g=!0,s=e.apply(u,n)),!g||c||i||(n=u=o),s}return v.cancel=y,v}var Xo=cs(function(e,t){return br(e,1,t)}),Qo=cs(function(e,t,r){return br(e,t,r)}),es=An(),ts=An(!0);function rs(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new xe(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=Cr(t),"function"!=typeof e||!er(t,qe))throw new xe(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 xe(E);return function(){return!e.apply(this,arguments)}}function os(e){return Vo(2,e)}var ss=On(h),as=On(d),us=cs(function(e,t){return Dn(e,y,o,o,o,Cr(t))});function cs(e,r){if("function"!=typeof e)throw new xe(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 gs(e,t){return e>=t}function ms(e){return Qe(e)&&ei(e)&&Oe.call(e,"callee")&&!ct.call(e,"callee")}var bs=bt||function(e){return Qe(e)&&oi(e.length)&&Re.call(e)==x};function vs(e){return!0===e||!1===e||Qe(e)&&Re.call(e)==C}function _s(e){return Qe(e)&&Re.call(e)==T}function ws(e){return!!e&&1===e.nodeType&&Qe(e)&&!Rs(e)}function Ss(e){return null==e||(ei(e)&&(bs(e)||js(e)||ms(e)||Qe(e)&&xs(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?jr(e,t,r):!!i}function ks(e){return Qe(e)&&"string"==typeof e.message&&Re.call(e)==I}function As(e){return"number"==typeof e&&vt(e)}function xs(e){return Cs(e)&&Re.call(e)==B}function Cs(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ts(e,t,r,n){return r="function"==typeof r?an(r,n,3):o,Mr(e,Wn(t),r)}function Is(e){return Ps(e)&&e!=+e}function Bs(e){return null!=e&&(xs(e)?je.test(Be.call(e)):Qe(e)&&pe.test(e))}function Os(e){return null===e}function Ps(e){return"number"==typeof e||Qe(e)&&Re.call(e)==P}function Rs(e){var t,r;return!(!Qe(e)||Re.call(e)!=R||ms(e)||!(Oe.call(e,"constructor")||(t=e.constructor,"function"!=typeof t||t instanceof t)))&&(Br(e,function(e,t){r=t}),r===o||Oe.call(e,r))}function Ns(e){return Cs(e)&&Re.call(e)==N}function js(e){return"string"==typeof e||Qe(e)&&Re.call(e)==L}function Ls(e){return Qe(e)&&oi(e.length)&&!!ke[Re.call(e)]}function Ms(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(X,Ye):e}function Sa(e){return e=He(e),e&&ue.test(e)?e.replace(ae,Je):e||"(?:)"}var Ea=mn(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=mt(i),s=yt(i);return r=Nn("",s,r),r.slice(0,o)+e+r}var Aa=Bn(),xa=Bn(!0);function Ca(e,t,r){return(r?ri(e,t,r):null==t)?t=0:t&&(t=+t),e=Ra(e),kt(e,t||(de.test(e)?16:10))}function Ta(e,t){var r="";if(e=He(e),t=+t,t<1||!e||!vt(t))return r;do{t%2&&(r+=e),t=mt(t/2),e+=e}while(t);return r}var Ia=mn(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}),Ba=mn(function(e,t,r){return e+(r?" ":"")+(t.charAt(0).toUpperCase()+t.slice(1))});function Oa(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 Pa(e,t,r){var n=Nt.templateSettings;r&&ri(e,t,r)&&(t=r=o),e=He(e),t=lr(hr({},r||t),n,fr);var s=lr(hr({},t.imports),n.imports,fr),a=na(s),u=tn(s,a),c,f,l=0,h=t.interpolate||me,d="__p += '",p=_e((t.escape||me).source+"|"+h.source+"|"+(h===ne?le:me).source+"|"+(t.evaluate||me).source+"|$","g"),y="//# 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(l,s).replace(be,Ze),r&&(c=!0,d+="' +\n__e("+r+") +\n'"),o&&(f=!0,d+="';\n"+o+";\n__p += '"),n&&(d+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),l=s+t.length,t}),d+="';\n";var g=t.variable;g||(d="with (obj) {\n"+d+"\n}\n"),d=(f?d.replace($,""):d).replace(Y,"$1").replace(J,"$1;"),d="function("+(g||"obj")+") {\n"+(g?"":"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 m=Ua(function(){return i(a,y+"return "+d).apply(o,u)});if(m.source=d,ks(m))throw m;return m}function Ra(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(ze(e,t),Ve(e,t)+1)):e}function Na(e,t,r){var n=e;return e=He(e),e?(r?ri(n,t,r):null==t)?e.slice(nt(e)):e.slice(ze(e,t+"")):e}function ja(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,Ve(e,t+"")+1):e}function La(e,t,r){r&&ri(e,t,r)&&(t=o);var n=g,i=m;if(null!=t)if(Cs(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(Ns(s)){if(e.slice(a).search(s)){var c,f,l=e.slice(0,a);for(s.global||(s=_e(s.source,(he.exec(s)||"")+"g")),s.lastIndex=0;c=s.exec(l);)f=c.index;u=u.slice(0,null==f?a:f)}}else if(e.indexOf(s,a)!=a){var h=u.lastIndexOf(s);h>-1&&(u=u.slice(0,h))}return u+i}function Ma(e){return e=He(e),e&&Q.test(e)?e.replace(Z,ot):e}function Da(e,t,r){return r&&ri(e,t,r)&&(t=o),e=He(e),e.match(t||ve)||[]}var Ua=cs(function(e,t){try{return e.apply(o,t)}catch(e){return ks(e)?e:new n(e)}});function Fa(e,t,r){return r&&ri(e,t,r)&&(t=o),Qe(e)?Ha(e):yr(e,t)}function Ka(e){return function(){return e}}function qa(e){return e}function Ha(e){return Ur(gr(e,!0))}function za(e,t){return Fr(e,gr(t,!0))}var Va=cs(function(e,t){return function(r){return Qn(r,e,t)}}),Ga=cs(function(e,t){return function(r){return Qn(e,r,t)}});function Wa(e,t,r){if(null==r){var n=Cs(t),i=n?na(t):o,s=i&&i.length?Rr(t,i):o;(s?s.length:n)||(s=!1,r=t,t=e,e=this)}s||(s=Rr(t,na(t)));var a=!0,u=-1,c=xs(e),f=s.length;!1===r?a=!1:Cs(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(Ct)},Or(Dt.prototype,function(e,t){var r=/^(?:filter|map|reject)|While$/.test(t),n=/^(?:first|last)$/.test(t),i=Nt[n?"take"+("last"==t?"Right":""):t];i&&(Nt.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],l=c||bs(a);l&&r&&"function"==typeof f&&1!=f.length&&(c=l=!1);var h=function(e){return n&&s?i(e,1)[0]:i.apply(o,ir([e],t))},d={func:so,args:[h],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&&l){a=p?a:new Dt(this);var y=e.apply(a,t);return y.__actions__.push(d),new Lt(y,s)}return this.thru(h)})}),Xt(["join","pop","push","replace","shift","sort","splice","split","unshift"],function(e){var t=(/^(?:replace|split)$/.test(e)?Ie:Ce)[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:join|pop|replace|shift)$/.test(e);Nt.prototype[e]=function(){var e=arguments;return n&&!this.__chain__?t.apply(this.value(),e):this[r](function(r){return t.apply(r,e)})}}),Or(Dt.prototype,function(e,t){var r=Nt[t];if(r){var n=r.name,i=Rt[n]||(Rt[n]=[]);i.push({name:t,func:r})}}),Rt[Rn(o,u).name]=[{name:"wrapper",func:o}],Dt.prototype.clone=Ut,Dt.prototype.reverse=Ft,Dt.prototype.value=Kt,Nt.prototype.chain=ao,Nt.prototype.commit=uo,Nt.prototype.concat=co,Nt.prototype.plant=fo,Nt.prototype.reverse=lo,Nt.prototype.toString=ho,Nt.prototype.run=Nt.prototype.toJSON=Nt.prototype.valueOf=Nt.prototype.value=po,Nt.prototype.collect=Nt.prototype.map,Nt.prototype.head=Nt.prototype.first,Nt.prototype.select=Nt.prototype.filter,Nt.prototype.tail=Nt.prototype.rest,Nt}var at=st();De._=at,i=function(){return at}.call(t,r,t,e),i===o||(e.exports=i)}).call(this)}).call(this,r(32)(e),r(10))},function(e,t,r){(function(t,n){var i=r(13),o=r(1022),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 l="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],d="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";s.encode64=function(e,t){for(var r="",n="",i,o,s,a=0;a>2),r+=l.charAt((3&i)<<4|o>>4),isNaN(o)?r+="==":(r+=l.charAt((15&o)<<2|s>>6),r+=isNaN(s)?"=":l.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+=l.charAt((3&i)<<4|o>>4),isNaN(o)?r+="==":(r+=l.charAt((15&o)<<2|s>>6),r+=isNaN(s)?"=":l.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){"use strict";const n=r(685),i=r(686),o=r(27);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";(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;l--)if(u[l]!==c[l])return!1;for(l=u.length-1;l>=0;l--)if(f=u[l],!v(e[f],t[f],r,n))return!1;return!0}function S(e,t,r){v(e,t,!0)&&m(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 A(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&&m(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)&&m(i,r,"Got unwanted exception"+n),e&&i&&r&&!E(i,r)||!e&&i)throw i}l.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 r=t.stackStartFunction||m;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(l.AssertionError,Error),l.fail=m,l.ok=b,l.equal=function e(t,r,n){t!=r&&m(t,r,n,"==",l.equal)},l.notEqual=function e(t,r,n){t==r&&m(t,r,n,"!=",l.notEqual)},l.deepEqual=function e(t,r,n){v(t,r,!1)||m(t,r,n,"deepEqual",l.deepEqual)},l.deepStrictEqual=function e(t,r,n){v(t,r,!0)||m(t,r,n,"deepStrictEqual",l.deepStrictEqual)},l.notDeepEqual=function e(t,r,n){v(t,r,!1)&&m(t,r,n,"notDeepEqual",l.notDeepEqual)},l.notDeepStrictEqual=S,l.strictEqual=function e(t,r,n){t!==r&&m(t,r,n,"===",l.strictEqual)},l.notStrictEqual=function e(t,r,n){t===r&&m(t,r,n,"!==",l.notStrictEqual)},l.throws=function(e,t,r){A(!0,e,t,r)},l.doesNotThrow=function(e,t,r){A(!1,e,t,r)},l.ifError=function(e){if(e)throw e};var x=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";var n=r(65),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(25);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){e.exports={encode:r(758),decode:r(759),encodingLength:r(760)}},function(e,t,r){const n=r(5).Buffer,i=r(296),o=r(114),s=r(921),a=r(36),u=r(74),c=r(473),f=r(29),l=r(923),h=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 y(e){return u.Array(e)&&e.every(p)}function g(e){return 0===e.length?f.OP_0:1===e.length?e[0]>=1&&e[0]<=16?h+e[0]:129===e[0]?f.OP_1NEGATE:void 0:void 0}function m(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!==g(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=g(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 b(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=g(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=b(e)),e.map(function(e){if(n.isBuffer(e)){const t=g(e);if(void 0===t)return e.toString("hex");e=t}return l[e]}).join(" ")}function _(e){return a(u.String,e),m(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=b(e),a(y,e),e.map(function(e){return n.isBuffer(e)?e:e===f.OP_0?n.allocUnsafe(0):c.encode(e-h)})}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:m,decompile:b,fromASM:_,toASM:v,toStack:w,number:r(473),signature:r(924),isCanonicalPubKey:S,isCanonicalScriptSignature:k,isPushOnly:y,isDefinedHashType:E}},function(e,t,r){e.exports=r(13),r(121),r(1043),r(87),r(318),r(518),r(237),r(1045),r(177),r(1046),r(520),r(1047),r(517),r(320),r(137),r(513),r(515),r(1048),r(507),r(514),r(511),r(322),r(68),r(512),r(1049),r(1050),r(506),r(16)},function(e,t,r){"use strict";(function(t){var n=r(0),i=r(20),o=r(34),s=r(21);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;i0&&"/"!==e.charAt(0))throw new Error(`multiaddr "${e}" must start with a "/"`);this.buffer=s.fromString(e)}else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=s.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});h.prototype.toString=function e(){return s.bufferToString(this.buffer)},h.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},h.prototype.inspect=function e(){return""},h.prototype.protos=function e(){return i(this.protoCodes(),function(e){return o(a(e))})},h.prototype.protoCodes=function e(){const t=[],r=this.buffer;let n=0;for(;n{if(e[0]===a.names.ipfs.code)return!0})[0][1],c.decode(t)}catch(e){t=null}return t},h.prototype.equals=function e(t){return this.buffer.equals(t.buffer)},h.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]}},h.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 h("/"+[n,t.address,r,t.port].join("/"))},h.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||17===r[1].code))},h.prototype.fromStupidString=function e(t){throw l},h.protocols=a,h.isName=function e(t){return!!h.isMultiaddr(t)&&t.protos().some(e=>e.resolvable)},h.resolve=function e(t,r){return h.isMultiaddr(t)&&h.isName(t)?r(new Error("not implemented yet")):r(new Error("not a valid name"))},t=e.exports=h}).call(this,r(0).Buffer)},function(e,t){e.exports=n;var r=Object.prototype.hasOwnProperty;function n(){for(var e={},t=0;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,l=n;l1&&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],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];function h(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,l=67108863&u,h=Math.min(c,t.length-1),d=Math.max(0,c-e.length+1);d<=h;d++){var p=c-d|0;i=0|e.words[p],o=0|t.words[d],s=i*o+l,f+=s/67108864|0,l=67108863&s}r.words[c]=0|l,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-h.length]+h+i:h+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=l[t];i="";var y=this.clone();for(y.negative=0;!y.isZero();){var g=y.modn(p).toString(t);y=y.idivn(p),i=y.isZero()?g+i:c[d-g.length]+g+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,l=this.clone();if(a){for(f=0;!l.isZero();f++)c=l.andln(255),l.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],y=8191&p,g=p>>>13,m=0|i[2],b=8191&m,v=m>>>13,_=0|i[3],w=8191&_,S=_>>>13,E=0|i[4],k=8191&E,A=E>>>13,x=0|i[5],C=8191&x,T=x>>>13,I=0|i[6],B=8191&I,O=I>>>13,P=0|i[7],R=8191&P,N=P>>>13,j=0|i[8],L=8191&j,M=j>>>13,D=0|i[9],U=8191&D,F=D>>>13,K=0|o[0],q=8191&K,H=K>>>13,z=0|o[1],V=8191&z,G=z>>>13,W=0|o[2],$=8191&W,Y=W>>>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,le=0|o[8],he=8191&le,de=le>>>13,pe=0|o[9],ye=8191&pe,ge=pe>>>13;n.negative=t.negative^r.negative,n.length=19,u=Math.imul(h,q),c=Math.imul(h,H),c=c+Math.imul(d,q)|0,f=Math.imul(d,H);var me=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(me>>>26)|0,me&=67108863,u=Math.imul(y,q),c=Math.imul(y,H),c=c+Math.imul(g,q)|0,f=Math.imul(g,H),u=u+Math.imul(h,V)|0,c=c+Math.imul(h,G)|0,c=c+Math.imul(d,V)|0,f=f+Math.imul(d,G)|0;var be=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(be>>>26)|0,be&=67108863,u=Math.imul(b,q),c=Math.imul(b,H),c=c+Math.imul(v,q)|0,f=Math.imul(v,H),u=u+Math.imul(y,V)|0,c=c+Math.imul(y,G)|0,c=c+Math.imul(g,V)|0,f=f+Math.imul(g,G)|0,u=u+Math.imul(h,$)|0,c=c+Math.imul(h,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,q),c=Math.imul(w,H),c=c+Math.imul(S,q)|0,f=Math.imul(S,H),u=u+Math.imul(b,V)|0,c=c+Math.imul(b,G)|0,c=c+Math.imul(v,V)|0,f=f+Math.imul(v,G)|0,u=u+Math.imul(y,$)|0,c=c+Math.imul(y,Y)|0,c=c+Math.imul(g,$)|0,f=f+Math.imul(g,Y)|0,u=u+Math.imul(h,X)|0,c=c+Math.imul(h,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,q),c=Math.imul(k,H),c=c+Math.imul(A,q)|0,f=Math.imul(A,H),u=u+Math.imul(w,V)|0,c=c+Math.imul(w,G)|0,c=c+Math.imul(S,V)|0,f=f+Math.imul(S,G)|0,u=u+Math.imul(b,$)|0,c=c+Math.imul(b,Y)|0,c=c+Math.imul(v,$)|0,f=f+Math.imul(v,Y)|0,u=u+Math.imul(y,X)|0,c=c+Math.imul(y,Z)|0,c=c+Math.imul(g,X)|0,f=f+Math.imul(g,Z)|0,u=u+Math.imul(h,ee)|0,c=c+Math.imul(h,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(C,q),c=Math.imul(C,H),c=c+Math.imul(T,q)|0,f=Math.imul(T,H),u=u+Math.imul(k,V)|0,c=c+Math.imul(k,G)|0,c=c+Math.imul(A,V)|0,f=f+Math.imul(A,G)|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(b,X)|0,c=c+Math.imul(b,Z)|0,c=c+Math.imul(v,X)|0,f=f+Math.imul(v,Z)|0,u=u+Math.imul(y,ee)|0,c=c+Math.imul(y,te)|0,c=c+Math.imul(g,ee)|0,f=f+Math.imul(g,te)|0,u=u+Math.imul(h,ne)|0,c=c+Math.imul(h,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(B,q),c=Math.imul(B,H),c=c+Math.imul(O,q)|0,f=Math.imul(O,H),u=u+Math.imul(C,V)|0,c=c+Math.imul(C,G)|0,c=c+Math.imul(T,V)|0,f=f+Math.imul(T,G)|0,u=u+Math.imul(k,$)|0,c=c+Math.imul(k,Y)|0,c=c+Math.imul(A,$)|0,f=f+Math.imul(A,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(b,ee)|0,c=c+Math.imul(b,te)|0,c=c+Math.imul(v,ee)|0,f=f+Math.imul(v,te)|0,u=u+Math.imul(y,ne)|0,c=c+Math.imul(y,ie)|0,c=c+Math.imul(g,ne)|0,f=f+Math.imul(g,ie)|0,u=u+Math.imul(h,se)|0,c=c+Math.imul(h,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(R,q),c=Math.imul(R,H),c=c+Math.imul(N,q)|0,f=Math.imul(N,H),u=u+Math.imul(B,V)|0,c=c+Math.imul(B,G)|0,c=c+Math.imul(O,V)|0,f=f+Math.imul(O,G)|0,u=u+Math.imul(C,$)|0,c=c+Math.imul(C,Y)|0,c=c+Math.imul(T,$)|0,f=f+Math.imul(T,Y)|0,u=u+Math.imul(k,X)|0,c=c+Math.imul(k,Z)|0,c=c+Math.imul(A,X)|0,f=f+Math.imul(A,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(b,ne)|0,c=c+Math.imul(b,ie)|0,c=c+Math.imul(v,ne)|0,f=f+Math.imul(v,ie)|0,u=u+Math.imul(y,se)|0,c=c+Math.imul(y,ae)|0,c=c+Math.imul(g,se)|0,f=f+Math.imul(g,ae)|0,u=u+Math.imul(h,ce)|0,c=c+Math.imul(h,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,q),c=Math.imul(L,H),c=c+Math.imul(M,q)|0,f=Math.imul(M,H),u=u+Math.imul(R,V)|0,c=c+Math.imul(R,G)|0,c=c+Math.imul(N,V)|0,f=f+Math.imul(N,G)|0,u=u+Math.imul(B,$)|0,c=c+Math.imul(B,Y)|0,c=c+Math.imul(O,$)|0,f=f+Math.imul(O,Y)|0,u=u+Math.imul(C,X)|0,c=c+Math.imul(C,Z)|0,c=c+Math.imul(T,X)|0,f=f+Math.imul(T,Z)|0,u=u+Math.imul(k,ee)|0,c=c+Math.imul(k,te)|0,c=c+Math.imul(A,ee)|0,f=f+Math.imul(A,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(b,se)|0,c=c+Math.imul(b,ae)|0,c=c+Math.imul(v,se)|0,f=f+Math.imul(v,ae)|0,u=u+Math.imul(y,ce)|0,c=c+Math.imul(y,fe)|0,c=c+Math.imul(g,ce)|0,f=f+Math.imul(g,fe)|0,u=u+Math.imul(h,he)|0,c=c+Math.imul(h,de)|0,c=c+Math.imul(d,he)|0,f=f+Math.imul(d,de)|0;var Ae=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,u=Math.imul(U,q),c=Math.imul(U,H),c=c+Math.imul(F,q)|0,f=Math.imul(F,H),u=u+Math.imul(L,V)|0,c=c+Math.imul(L,G)|0,c=c+Math.imul(M,V)|0,f=f+Math.imul(M,G)|0,u=u+Math.imul(R,$)|0,c=c+Math.imul(R,Y)|0,c=c+Math.imul(N,$)|0,f=f+Math.imul(N,Y)|0,u=u+Math.imul(B,X)|0,c=c+Math.imul(B,Z)|0,c=c+Math.imul(O,X)|0,f=f+Math.imul(O,Z)|0,u=u+Math.imul(C,ee)|0,c=c+Math.imul(C,te)|0,c=c+Math.imul(T,ee)|0,f=f+Math.imul(T,te)|0,u=u+Math.imul(k,ne)|0,c=c+Math.imul(k,ie)|0,c=c+Math.imul(A,ne)|0,f=f+Math.imul(A,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(b,ce)|0,c=c+Math.imul(b,fe)|0,c=c+Math.imul(v,ce)|0,f=f+Math.imul(v,fe)|0,u=u+Math.imul(y,he)|0,c=c+Math.imul(y,de)|0,c=c+Math.imul(g,he)|0,f=f+Math.imul(g,de)|0,u=u+Math.imul(h,ye)|0,c=c+Math.imul(h,ge)|0,c=c+Math.imul(d,ye)|0,f=f+Math.imul(d,ge)|0;var xe=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(xe>>>26)|0,xe&=67108863,u=Math.imul(U,V),c=Math.imul(U,G),c=c+Math.imul(F,V)|0,f=Math.imul(F,G),u=u+Math.imul(L,$)|0,c=c+Math.imul(L,Y)|0,c=c+Math.imul(M,$)|0,f=f+Math.imul(M,Y)|0,u=u+Math.imul(R,X)|0,c=c+Math.imul(R,Z)|0,c=c+Math.imul(N,X)|0,f=f+Math.imul(N,Z)|0,u=u+Math.imul(B,ee)|0,c=c+Math.imul(B,te)|0,c=c+Math.imul(O,ee)|0,f=f+Math.imul(O,te)|0,u=u+Math.imul(C,ne)|0,c=c+Math.imul(C,ie)|0,c=c+Math.imul(T,ne)|0,f=f+Math.imul(T,ie)|0,u=u+Math.imul(k,se)|0,c=c+Math.imul(k,ae)|0,c=c+Math.imul(A,se)|0,f=f+Math.imul(A,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(b,he)|0,c=c+Math.imul(b,de)|0,c=c+Math.imul(v,he)|0,f=f+Math.imul(v,de)|0,u=u+Math.imul(y,ye)|0,c=c+Math.imul(y,ge)|0,c=c+Math.imul(g,ye)|0,f=f+Math.imul(g,ge)|0;var Ce=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,u=Math.imul(U,$),c=Math.imul(U,Y),c=c+Math.imul(F,$)|0,f=Math.imul(F,Y),u=u+Math.imul(L,X)|0,c=c+Math.imul(L,Z)|0,c=c+Math.imul(M,X)|0,f=f+Math.imul(M,Z)|0,u=u+Math.imul(R,ee)|0,c=c+Math.imul(R,te)|0,c=c+Math.imul(N,ee)|0,f=f+Math.imul(N,te)|0,u=u+Math.imul(B,ne)|0,c=c+Math.imul(B,ie)|0,c=c+Math.imul(O,ne)|0,f=f+Math.imul(O,ie)|0,u=u+Math.imul(C,se)|0,c=c+Math.imul(C,ae)|0,c=c+Math.imul(T,se)|0,f=f+Math.imul(T,ae)|0,u=u+Math.imul(k,ce)|0,c=c+Math.imul(k,fe)|0,c=c+Math.imul(A,ce)|0,f=f+Math.imul(A,fe)|0,u=u+Math.imul(w,he)|0,c=c+Math.imul(w,de)|0,c=c+Math.imul(S,he)|0,f=f+Math.imul(S,de)|0,u=u+Math.imul(b,ye)|0,c=c+Math.imul(b,ge)|0,c=c+Math.imul(v,ye)|0,f=f+Math.imul(v,ge)|0;var Te=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Te>>>26)|0,Te&=67108863,u=Math.imul(U,X),c=Math.imul(U,Z),c=c+Math.imul(F,X)|0,f=Math.imul(F,Z),u=u+Math.imul(L,ee)|0,c=c+Math.imul(L,te)|0,c=c+Math.imul(M,ee)|0,f=f+Math.imul(M,te)|0,u=u+Math.imul(R,ne)|0,c=c+Math.imul(R,ie)|0,c=c+Math.imul(N,ne)|0,f=f+Math.imul(N,ie)|0,u=u+Math.imul(B,se)|0,c=c+Math.imul(B,ae)|0,c=c+Math.imul(O,se)|0,f=f+Math.imul(O,ae)|0,u=u+Math.imul(C,ce)|0,c=c+Math.imul(C,fe)|0,c=c+Math.imul(T,ce)|0,f=f+Math.imul(T,fe)|0,u=u+Math.imul(k,he)|0,c=c+Math.imul(k,de)|0,c=c+Math.imul(A,he)|0,f=f+Math.imul(A,de)|0,u=u+Math.imul(w,ye)|0,c=c+Math.imul(w,ge)|0,c=c+Math.imul(S,ye)|0,f=f+Math.imul(S,ge)|0;var Ie=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,u=Math.imul(U,ee),c=Math.imul(U,te),c=c+Math.imul(F,ee)|0,f=Math.imul(F,te),u=u+Math.imul(L,ne)|0,c=c+Math.imul(L,ie)|0,c=c+Math.imul(M,ne)|0,f=f+Math.imul(M,ie)|0,u=u+Math.imul(R,se)|0,c=c+Math.imul(R,ae)|0,c=c+Math.imul(N,se)|0,f=f+Math.imul(N,ae)|0,u=u+Math.imul(B,ce)|0,c=c+Math.imul(B,fe)|0,c=c+Math.imul(O,ce)|0,f=f+Math.imul(O,fe)|0,u=u+Math.imul(C,he)|0,c=c+Math.imul(C,de)|0,c=c+Math.imul(T,he)|0,f=f+Math.imul(T,de)|0,u=u+Math.imul(k,ye)|0,c=c+Math.imul(k,ge)|0,c=c+Math.imul(A,ye)|0,f=f+Math.imul(A,ge)|0;var Be=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Be>>>26)|0,Be&=67108863,u=Math.imul(U,ne),c=Math.imul(U,ie),c=c+Math.imul(F,ne)|0,f=Math.imul(F,ie),u=u+Math.imul(L,se)|0,c=c+Math.imul(L,ae)|0,c=c+Math.imul(M,se)|0,f=f+Math.imul(M,ae)|0,u=u+Math.imul(R,ce)|0,c=c+Math.imul(R,fe)|0,c=c+Math.imul(N,ce)|0,f=f+Math.imul(N,fe)|0,u=u+Math.imul(B,he)|0,c=c+Math.imul(B,de)|0,c=c+Math.imul(O,he)|0,f=f+Math.imul(O,de)|0,u=u+Math.imul(C,ye)|0,c=c+Math.imul(C,ge)|0,c=c+Math.imul(T,ye)|0,f=f+Math.imul(T,ge)|0;var Oe=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,u=Math.imul(U,se),c=Math.imul(U,ae),c=c+Math.imul(F,se)|0,f=Math.imul(F,ae),u=u+Math.imul(L,ce)|0,c=c+Math.imul(L,fe)|0,c=c+Math.imul(M,ce)|0,f=f+Math.imul(M,fe)|0,u=u+Math.imul(R,he)|0,c=c+Math.imul(R,de)|0,c=c+Math.imul(N,he)|0,f=f+Math.imul(N,de)|0,u=u+Math.imul(B,ye)|0,c=c+Math.imul(B,ge)|0,c=c+Math.imul(O,ye)|0,f=f+Math.imul(O,ge)|0;var Pe=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,u=Math.imul(U,ce),c=Math.imul(U,fe),c=c+Math.imul(F,ce)|0,f=Math.imul(F,fe),u=u+Math.imul(L,he)|0,c=c+Math.imul(L,de)|0,c=c+Math.imul(M,he)|0,f=f+Math.imul(M,de)|0,u=u+Math.imul(R,ye)|0,c=c+Math.imul(R,ge)|0,c=c+Math.imul(N,ye)|0,f=f+Math.imul(N,ge)|0;var Re=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Re>>>26)|0,Re&=67108863,u=Math.imul(U,he),c=Math.imul(U,de),c=c+Math.imul(F,he)|0,f=Math.imul(F,de),u=u+Math.imul(L,ye)|0,c=c+Math.imul(L,ge)|0,c=c+Math.imul(M,ye)|0,f=f+Math.imul(M,ge)|0;var Ne=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,u=Math.imul(U,ye),c=Math.imul(U,ge),c=c+Math.imul(F,ye)|0,f=Math.imul(F,ge);var je=(a+u|0)+((8191&c)<<13)|0;return a=(f+(c>>>13)|0)+(je>>>26)|0,je&=67108863,s[0]=me,s[1]=be,s[2]=ve,s[3]=_e,s[4]=we,s[5]=Se,s[6]=Ee,s[7]=ke,s[8]=Ae,s[9]=xe,s[10]=Ce,s[11]=Te,s[12]=Ie,s[13]=Be,s[14]=Oe,s[15]=Pe,s[16]=Re,s[17]=Ne,s[18]=je,0!==a&&(s[19]=a,n.length++),n};function y(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 g(e,t,r){var n=new m;return n.mulp(e,t,r)}function m(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?y(this,t,r):g(this,t,r),n},m.prototype.makeRBT=function e(t){for(var r=new Array(t),n=o.prototype._countBits(t)-1,i=0;i>=1;return i},m.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=h(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!==l||f>=o);f--){var h=0|this.words[f];this.words[f]=l<<26-s|h>>>s,l=h&u}return c&&0!==l&&(c.words[c.length++]=l),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 l=0;l=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 l=i.clone(),h=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(l),a.isub(h)),s.iushrn(1),a.iushrn(1);for(var y=0,g=1;0==(i.words[0]&g)&&y<26;++y,g<<=1);if(y>0)for(i.iushrn(y);y-- >0;)(u.isOdd()||c.isOdd())&&(u.iadd(l),c.isub(h)),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,l=1;0==(r.words[0]&l)&&f<26;++f,l<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var h=0,d=1;0==(i.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(i.iushrn(h);h-- >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 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 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 A(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(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 S;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return b[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),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,f).cmp(c);)l.redIAdd(c);for(var h=this.pow(l,s),d=this.pow(t,s.addn(1).iushrn(1)),p=this.pow(t,s),y=a;0!==p.cmp(u);){for(var g=p,m=0;0!==g.cmp(u);m++)g=g.redSqr();n(m=0;s--){for(var l=r.words[s],h=f-1;h>=0;h--){var d=l>>h&1;a!==i[0]&&(a=this.sqr(a)),0!==d||0!==u?(u<<=1,u|=d,c++,(4===c||0===s&&0===h)&&(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 A(t)},i(A,k),A.prototype.convertTo=function e(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function e(t){var r=this.imod(t.mul(this.rinv));return r.red=null,r},A.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)},A.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)},A.prototype.invm=function e(t){var r=this.imod(t._invmp(this.m).mul(this.r2));return r._forceRed(this)}}(void 0===e||e,this)}).call(this,r(32)(e))},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,r){"use strict";(function(t){const n=r(18),i=r(851);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";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,r){"use strict";var n=r(741),i=r(742);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=E,t.resolveObject=k,t.format=S,t.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["<",">",'"',"`"," ","\r","\n","\t"],f=["{","}","|","\\","^","`"].concat(c),l=["'"].concat(f),h=["%","/","?",";","#"].concat(l),d=["/","?","#"],p=255,y=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={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},_=r(275);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?N+="x":N+=R[j];if(!N.match(y)){var M=O.slice(0,x),D=O.slice(x+1),U=R.match(g);U&&(M.push(U[1]),D.unshift(U[2])),D.length&&(p="/"+D.join(".")+p),this.hostname=M.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),B||(this.hostname=n.toASCII(this.hostname));var F=this.port?":"+this.port:"",K=this.hostname||"";this.host=K+F,this.href+=this.host,B&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==p[0]&&(p="/"+p))}if(!m[E])for(var x=0,P=l.length;x0)&&r.host.split("@");A&&(r.auth=A.shift(),r.host=r.hostname=A.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 x=E.slice(-1)[0],C=(r.host||e.host||E.length>1)&&("."===x||".."===x)||""===x,T=0,I=E.length;I>=0;I--)x=E[I],"."===x?E.splice(I,1):".."===x?(E.splice(I,1),T++):T&&(E.splice(I,1),T--);if(!w&&!S)for(;T--;T)E.unshift("..");!w||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),C&&"/"!==E.join("/").substr(-1)&&E.push("");var B=""===E[0]||E[0]&&"/"===E[0].charAt(0);if(k){r.hostname=r.host=B?"":E.length?E.shift():"";var A=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");A&&(r.auth=A.shift(),r.host=r.hostname=A.shift())}return w=w||r.host&&E.length,w&&!B&&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){var n=r(472),i=r(300),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 h(t,e,n)}catch(e){throw u(e,r)}})))))}return t=l(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=l(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&&h(r,o,n)}catch(e){throw u(e,o,"key")}try{var s=e[o];h(t,s,n)}catch(e){throw u(e,o)}}return!0}return t=l(t),r&&(r=l(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]=l(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];h(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(l);function r(e,r){return t.some(function(t){try{return h(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(l);function r(e,r){return t.every(function(t){try{return h(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(l);function r(e,r){return!i.Nil(e)&&(!i.Nil(e.length)&&((!r||e.length===t.length)&&t.every(function(t,n){try{return h(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 l(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 h(e,t,r,n){if(i.Function(e)){if(e(t,r))return!0;throw new s(n||e,t)}return h(l(e),t,r)}for(var d in f.oneOf=f.anyOf,i)h[d]=i[d];for(d in f)h[d]=f[d];var p=r(922);for(d in p)h[d]=p[d];h.compile=l,h.TfTypeError=s,h.TfPropertyTypeError=a,e.exports=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isAsync=void 0;var n=r(210),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";const n=r(417),i=r(801),o=r(285),s=r(420);t.Key=n,t.MemoryDatastore=i,t.utils=o,t.Errors=s},function(e,t,r){"use strict";(function(t){var n=r(84),i=r(21),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{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 n(e,{className:t,symbolName:r}){const n=Symbol.for(r),i={[t]:class extends e{constructor(...e){super(...e),Object.defineProperty(this,n,{value:!0})}get[Symbol.toStringTag](){return t}}}[t];return i[`is${t}`]=(e=>!(!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=u;var n=r(406),i=a(n),o=r(280),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";Object.defineProperty(t,"__esModule",{value:!0}),t.default=f;var n=r(215),i=c(n),o=r(416),s=c(o),a=r(37),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){"use strict";var n=r(207).Buffer,i=n.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function s(e){var t=o(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}function a(e){var t;switch(this.encoding=s(e),this.encoding){case"utf16le":this.text=p,this.end=y,t=4;break;case"utf8":this.fillLast=l,t=4;break;case"base64":this.text=g,this.end=m,t=3;break;default:return this.write=b,void(this.end=v)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function u(e){return e<=127?0:e>>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 l(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 h(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 y(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 g(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 m(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,r;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=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;us)n=e(n);else if(n{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){"use strict";const n=r(564),i=r(1162),o=r(337);t.Key=n,t.MemoryDatastore=i,t.utils=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(215),i=a(n),o=r(406),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){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=r,r.equal=function e(t,r,n){if(t!=r)throw new Error(n||"Assertion failed: "+t+" != "+r)}},function(e,t,r){"use strict";(function(n){const i=r(18),o=r(86),s=r(20),a=r(6);class u{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.keys.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return o.keys.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:c(this.marshalPrivKey()),pubKey:c(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"))}}function c(e){if(e)return e.toString("base64")}t=e.exports=u,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.keys.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 u(r,n))})},t.createFromHexString=function(e){return new u(i.fromHexString(e))},t.createFromBytes=function(e){return new u(e)},t.createFromB58String=function(e){return new u(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.keys.unmarshalPublicKey(i)}catch(e){return t(e)}r.hash((e,n)=>{if(e)return t(e);t(null,new u(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.keys.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 u(r,n,n.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r,s,c,f;try{r=i.fromB58String(e.id),s=e.privKey&&n.from(e.privKey,"base64"),c=e.pubKey&&n.from(e.pubKey,"base64"),f=c&&o.keys.unmarshalPublicKey(c)}catch(e){return t(e)}s?a([e=>o.keys.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)}),(e,t,r)=>{f?f.hash((n,i)=>{r(n,e,t,i)}):r(null,e,t)}],(e,n,i,o)=>e?t(e):f&&!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 u(r,i,f))):t(null,new u(r,null,f))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,r(0).Buffer)},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";t.Connection=r(1302)},function(e,t,r){(function(t){var n=r(26),i=r(186),o=r(1384),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)},l=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 l=!1;return function(t){if(!a&&!l)return l=!0,c(e)?e.close(s):f(e)?e.abort():u(e.destroy)?e.destroy():void o(t||new Error("stream was destroyed"))}},h=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 l(i,s,a,function(e){r||(r=e),e&&n.forEach(h),s||(n.forEach(h),t(r))})});return e.reduce(d)};e.exports=p}).call(this,r(3))},function(e,t,r){"use strict";const n=r(195);e.exports={addLink:r(373),bufferPullStreamSource:r(1602),countStreamBytes:r(1603),createLock:r(1604),createNode:r(674),errors:r(675),formatCid:r(1619),limitStreamBytes:r(1620),loadNode:r(1621),toPullSource:r(1622),toSourcesAndDestination:r(1627),toSources:r(677),traverseTo:r(1628),updateMfsRoot:r(1630),updateTree:r(1631),validatePath:r(679),withMfsRoot:r(678),zeros:r(1632),FILE_SEPARATOR:n.FILE_SEPARATOR,MAX_CHUNK_SIZE:n.MAX_CHUNK_SIZE,MAX_LINKS:n.MAX_LINKS,FILE_TYPES:n.FILE_TYPES}},function(e,t,r){(function(e,n){var i=/%[sdj%]/g;t.format=function(e){if(!S(e)){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]),b(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),l(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 l(e,r,n){if(e.customInspect&&r&&I(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return S(i)||(i=l(e,i,n)),i}var o=h(e,r);if(o)return o;var s=Object.keys(r),a=f(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),T(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return d(r);if(0===s.length){if(I(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(A(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(C(r))return e.stylize(Date.prototype.toString.call(r),"date");if(T(r))return d(r)}var c="",b=!1,v=["{","}"],_;if(m(r)&&(b=!0,v=["[","]"]),I(r)){var w=r.name?": "+r.name:"";c=" [Function"+w+"]"}return A(r)&&(c=" "+RegExp.prototype.toString.call(r)),C(r)&&(c=" "+Date.prototype.toUTCString.call(r)),T(r)&&(c=" "+d(r)),0!==s.length||b&&0!=r.length?n<0?A(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),_=b?p(e,r,n,a,s):s.map(function(t){return y(e,r,n,a,t,b)}),e.seen.pop(),g(_,c,v)):v[0]+c+v[1]}function h(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"):b(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 g(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 m(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 S(e){return"string"==typeof e}function E(e){return"symbol"==typeof e}function k(e){return void 0===e}function A(e){return x(e)&&"[object RegExp]"===O(e)}function x(e){return"object"==typeof e&&null!==e}function C(e){return x(e)&&"[object Date]"===O(e)}function T(e){return x(e)&&("[object Error]"===O(e)||e instanceof Error)}function I(e){return"function"==typeof e}function B(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(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=m,t.isBoolean=b,t.isNull=v,t.isNullOrUndefined=_,t.isNumber=w,t.isString=S,t.isSymbol=E,t.isUndefined=k,t.isRegExp=A,t.isObject=x,t.isDate=C,t.isError=T,t.isFunction=I,t.isPrimitive=B,t.isBuffer=r(798);var R=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function N(){var e=new Date,t=[P(e.getHours()),P(e.getMinutes()),P(e.getSeconds())].join(":");return[e.getDate(),R[e.getMonth()],t].join(" ")}function j(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",N(),t.format.apply(t,arguments))},t.inherits=r(82),t._extend=function(e,t){if(!t||!x(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}}).call(this,r(8),r(3))},function(e,t,r){"use strict";var n=t;n.version=r(891).version,n.utils=r(892),n.rand=r(893),n.curve=r(228),n.curves=r(899),n.ec=r(907),n.eddsa=r(911)},function(e,t,r){"use strict";const n=r(1262),i=r(1263);t.encode=n,t.decode=i.decode,t.decodeFromReader=i.decodeFromReader},function(e,t){function r(){}e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var n=r(59),i=l(n),o=r(127),s=l(o),a=r(128),u=l(a),c=r(37),f=l(c);function l(e){return e&&e.__esModule?e:{default:e}}function h(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){var n=r(25),i=r(20),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,r){(function(e,r){var n=200,i="Expected a function",o="__lodash_hash_undefined__",s=1,a=2,u=1/0,c=9007199254740991,f="[object Arguments]",l="[object Array]",h="[object Boolean]",d="[object Date]",p="[object Error]",y="[object Function]",g="[object GeneratorFunction]",m="[object Map]",b="[object Number]",v="[object Object]",_="[object Promise]",w="[object RegExp]",S="[object Set]",E="[object String]",k="[object Symbol]",A="[object WeakMap]",x="[object ArrayBuffer]",C="[object DataView]",T="[object Float32Array]",I="[object Float64Array]",B="[object Int8Array]",O="[object Int16Array]",P="[object Int32Array]",R="[object Uint8Array]",N="[object Uint8ClampedArray]",j="[object Uint16Array]",L="[object Uint32Array]",M=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,D=/^\w*$/,U=/^\./,F=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,K=/[\\^$.*+?()[\]{}|]/g,q=/\\(\\)?/g,H=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,V={};V[T]=V[I]=V[B]=V[O]=V[P]=V[R]=V[N]=V[j]=V[L]=!0,V[f]=V[l]=V[x]=V[h]=V[C]=V[d]=V[p]=V[y]=V[m]=V[b]=V[v]=V[w]=V[S]=V[E]=V[A]=!1;var G="object"==typeof e&&e&&e.Object===Object&&e,W="object"==typeof self&&self&&self.Object===Object&&self,$=G||W||Function("return this")(),Y="object"==typeof t&&t&&!t.nodeType&&t,J=Y&&"object"==typeof r&&r&&!r.nodeType&&r,X=J&&J.exports===Y,Z=X&&G.process,Q=function(){try{return Z&&Z.binding("util")}catch(e){}}(),ee=Q&&Q.isTypedArray;function te(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r-1}function Xe(e,t){var r=this.__data__,n=pt(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 l=o.get(e);if(l&&o.get(t))return l==t;var h=-1,d=!0,p=i&s?new it:void 0;for(o.set(e,t),o.set(t,e);++h-1&&e%1==0&&e-1&&e%1==0&&e<=c}function cr(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function fr(e){return!!e&&"object"==typeof e}function lr(e){return"symbol"==typeof e||fr(e)&&ve.call(e)==k}var hr=ee?oe(ee):At;function dr(e){return null==e?"":Pt(e)}function pr(e,t,r){var n=null==e?void 0:bt(e,t);return void 0===n?r:n}function yr(e,t){return null!=e&&Ht(e,t,_t)}function gr(e){return or(e)?dt(e):Ct(e)}function mr(e){return e}function br(e){return Vt(e)?ne(Zt(e)):Ot(e)}r.exports=er}).call(this,r(8),r(32)(e))},function(e,t,r){var n;!function(i){"use strict";var o,s=20,a=1,u=1e6,c=1e6,f=-7,l=21,h="[big.js] ",d=h+"Invalid ",p=d+"decimal places",y=d+"rounding mode",g=h+"Division by zero",m={},b=void 0,v=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function _(){function e(t){var r=this;if(!(r instanceof e))return t===b?_():new e(t);t instanceof e?(r.s=t.s,r.e=t.e,r.c=t.c.slice()):w(r,t),r.constructor=e}return e.prototype=m,e.DP=s,e.RM=a,e.NE=f,e.PE=l,e.version="5.2.2",e}function w(e,t){var r,n,i;if(0===t&&1/t<0)t="-0";else if(!v.test(t+=""))throw Error(d+"number");for(e.s="-"==t.charAt(0)?(t=t.slice(1),-1):1,(r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),i=t.length,n=0;n0&&"0"==t.charAt(--i););for(e.e=r-n-1,e.c=[],r=0;n<=i;)e.c[r++]=+t.charAt(n++)}return e}function S(e,t,r,n){var i=e.c,o=e.e+t+1;if(o=5;else if(2===r)n=i[o]>5||5==i[o]&&(n||o<0||i[o+1]!==b||1&i[o-1]);else if(3===r)n=n||!!i[0];else if(n=!1,0!==r)throw Error(y);if(o<1)i.length=1,n?(e.e=-t,i[0]=1):i[0]=e.e=0;else{if(i.length=o--,n)for(;++i[o]>9;)i[o]=0,o--||(++e.e,i.unshift(1));for(o=i.length;!i[--o];)i.pop()}}else if(r<0||r>3||r!==~~r)throw Error(y);return e}function E(e,t,r,n){var i,o,s=e.constructor,a=!e.c[0];if(r!==b){if(r!==~~r||r<(3==t)||r>u)throw Error(3==t?d+"precision":p);for(e=new s(e),r=n-e.e,e.c.length>++n&&S(e,r,s.RM),2==t&&(n=e.e+r+1);e.c.length=s.PE))o=o.charAt(0)+(r>1?"."+o.slice(1):"")+(i<0?"e":"e+")+i;else if(i<0){for(;++i;)o="0"+o;o="0."+o}else if(i>0)if(++i>r)for(i-=r;i--;)o+="0";else i1&&(o=o.charAt(0)+"."+o.slice(1));return e.s<0&&(!a||4==t)?"-"+o:o}m.abs=function(){var e=new this.constructor(this);return e.s=1,e},m.cmp=function(e){var t,r=this,n=r.c,i=(e=new r.constructor(e)).c,o=r.s,s=e.s,a=r.e,u=e.e;if(!n[0]||!i[0])return n[0]?o:i[0]?-s:0;if(o!=s)return o;if(t=o<0,a!=u)return a>u^t?1:-1;for(s=(a=n.length)<(u=i.length)?a:u,o=-1;++oi[o]^t?1:-1;return a==u?0:a>u^t?1:-1},m.div=function(e){var t=this,r=t.constructor,n=t.c,i=(e=new r(e)).c,o=t.s==e.s?1:-1,s=r.DP;if(s!==~~s||s<0||s>u)throw Error(p);if(!i[0])throw Error(g);if(!n[0])return new r(0*o);var a,c,f,l,h,d=i.slice(),y=a=i.length,m=n.length,v=n.slice(0,a),_=v.length,w=e,E=w.c=[],k=0,A=s+(w.e=t.e-e.e)+1;for(w.s=o,o=A<0?0:A,d.unshift(0);_++_?1:-1;else for(h=-1,l=0;++hv[h]?1:-1;break}if(!(l<0))break;for(c=_==a?i:d;_;){if(v[--_]A&&S(w,s,r.RM,v[0]!==b),w},m.eq=function(e){return!this.cmp(e)},m.gt=function(e){return this.cmp(e)>0},m.gte=function(e){return this.cmp(e)>-1},m.lt=function(e){return this.cmp(e)<0},m.lte=function(e){return this.cmp(e)<1},m.minus=m.sub=function(e){var t,r,n,i,o=this,s=o.constructor,a=o.s,u=(e=new s(e)).s;if(a!=u)return e.s=-u,o.plus(e);var c=o.c.slice(),f=o.e,l=e.c,h=e.e;if(!c[0]||!l[0])return l[0]?(e.s=-u,e):new s(c[0]?o:0);if(a=f-h){for((i=a<0)?(a=-a,n=c):(h=f,n=l),n.reverse(),u=a;u--;)n.push(0);n.reverse()}else for(r=((i=c.length0)for(;u--;)c[t++]=0;for(u=t;r>a;){if(c[--r]0?(u=s,t=c):(i=-i,t=a),t.reverse();i--;)t.push(0);t.reverse()}for(a.length-c.length<0&&(t=c,c=a,a=t),i=c.length,o=0;i;a[i]%=10)o=(a[--i]=a[i]+c[i]+o)/10|0;for(o&&(a.unshift(o),++u),i=a.length;0===a[--i];)a.pop();return e.c=a,e.e=u,e},m.pow=function(e){var t=this,r=new t.constructor(1),n=r,i=e<0;if(e!==~~e||e<-1e6||e>1e6)throw Error(d+"exponent");for(i&&(e=-e);1&e&&(n=n.times(t)),e>>=1,e;)t=t.times(t);return i?r.div(n):n},m.round=function(e,t){var r=this.constructor;if(e===b)e=0;else if(e!==~~e||e<-u||e>u)throw Error(p);return S(new r(this),e,t===b?r.RM:t)},m.sqrt=function(){var e,t,r,n=this,i=n.constructor,o=n.s,s=n.e,a=new i(.5);if(!n.c[0])return new i(n);if(o<0)throw Error(h+"No square root");o=Math.sqrt(n+""),0===o||o===1/0?(t=n.c.join(""),t.length+s&1||(t+="0"),o=Math.sqrt(t),s=((s+1)/2|0)-(s<0||1&s),e=new i((o==1/0?"1e":(o=o.toExponential()).slice(0,o.indexOf("e")+1))+s)):e=new i(o),s=e.e+(i.DP+=4);do{r=e,e=a.times(r.plus(n.div(r)))}while(r.c.slice(0,s).join("")!==e.c.slice(0,s).join(""));return S(e,i.DP-=4,i.RM)},m.times=m.mul=function(e){var t,r=this,n=r.constructor,i=r.c,o=(e=new n(e)).c,s=i.length,a=o.length,u=r.e,c=e.e;if(e.s=r.s==e.s?1:-1,!i[0]||!o[0])return new n(0*e.s);for(e.e=u+c,su;)a=t[c]+o[u]*i[c-u-1]+a,t[c--]=a%10,a=a/10|0;t[c]=(t[c]+a)%10}for(a?++e.e:t.shift(),u=t.length;!t[--u];)t.pop();return e.c=t,e},m.toExponential=function(e){return E(this,1,e,e)},m.toFixed=function(e){return E(this,2,e,this.e+e)},m.toPrecision=function(e){return E(this,3,e,e-1)},m.toString=function(){return E(this)},m.valueOf=m.toJSON=function(){return E(this,4)},o=_(),o.default=o.Big=o,n=function(){return o}.call(t,r,t,e),void 0===n||(e.exports=n)}(this)},function(e,t){e.exports={bitcoin:{messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},testnet:{messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239}}},function(e,t,r){"use strict";var n=r(15);function i(e,t){return e.replace("{0}",t[0]).replace("{1}",t[1]).replace("{2}",t[2])}var o=function(e,t){var r=function(){if(n.isString(t.message))this.message=i(t.message,arguments);else{if(!n.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 r.prototype=Object.create(e.prototype),r.prototype.name=e.prototype.name+t.name,e[t.name]=r,t.errors&&s(r,t.errors),r},s=function(e,t){n.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 c=r(998);a(u.Error,c),e.exports=u.Error,e.exports.extend=function(e){return o(u.Error,e)}},function(e,t,r){"use strict";(function(t){var n=r(39),i=r(15),o=r(21),s=r(25),a=r(34),u=function e(t,r){if(!(this instanceof e))return new e(t,r);if(t instanceof n)this.set({r:t,s:r});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,r=!0,i=e.slice(0,1)[0]-27-4;i<0&&(r=!1,i+=4);var a=e.slice(1,33),c=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===c.length,new Error("s must be 32 bytes")),t.compressed=r,t.i=i,t.r=n.fromBuffer(a),t.s=n.fromBuffer(c),t},u.fromDER=u.fromBuffer=function(e,t){var r=u.parseDER(e,t),n=new u;return n.r=r.r,n.s=r.s,n},u.fromTxFormat=function(e){var t=e.readUInt8(e.length-1),r=e.slice(0,e.length-1),n=new u.fromDER(r,!1);return n.nhashtype=t,n},u.fromString=function(e){var r=new t(e,"hex");return u.fromDER(r)},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 r=e[0];o.checkArgument(48===r,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 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(492),e.exports.Interpreter=r(1017)},function(e,t,r){var n=r(13);r(121),r(510),r(511),r(16),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 l in navigator)try{"string"==typeof navigator[l]&&(f+=navigator[l])}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 l in a)n.random[l]=a[l];else n.random=a;n.random.createInstance=s,e.exports=n.random}("undefined"!=typeof jQuery?jQuery:null)},function(e,t,r){(function(n){var i=r(70),o=r(599);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,h(),i?c():e(i=!0,c))}function l(t){h(),i||e(i=t,c)}function h(){t.on("finish",f),t.removeListener("close",f),t.removeListener("error",l)}t.on("close",f),t.on("finish",f),t.on("error",l),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 l=f,h=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)}:h(e,t):d(e)},t.sink=h,t.source=d,t.read=l,t.read1=f,t.read2=c,t.duplex=function(e,t){return{source:d(e),sink:h(e,t)}},t.transform=function(e){return function(t){var r=d(e);return h(e)(t),r}}}).call(this,r(3))},function(e,t,r){"use strict";e.exports=function e(t){var r=arguments.length;if("function"==typeof t&&1===t.length){for(var n=new Array(r),i=0;i=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 y(e,t){return e<>>32-t}function g(e,t){return e+t>>>0}function m(e,t,r){return e+t+r>>>0}function b(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 A(e,t,r,n,i,o,s,a,u,c){var f=0,l=t;l=l+n>>>0,f+=l>>0,f+=l>>0,f+=l>>0,f+=l>>0}function x(e,t,r,n,i,o,s,a,u,c){var f=t+n+o+a+c;return f>>>0}function C(e,t,r){var n=t<<32-r|e>>>r;return n>>>0}function T(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}function I(e,t,r){return e>>>r}function B(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=l,t.join32=h,t.split32=d,t.rotr32=p,t.rotl32=y,t.sum32=g,t.sum32_3=m,t.sum32_4=b,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=A,t.sum64_5_lo=x,t.rotr64_hi=C,t.rotr64_lo=T,t.shr64_hi=I,t.shr64_lo=B},function(e,t,r){const n=r(36),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}),l={BIP32Path:s,Buffer256bit:n.BufferN(32),ECPoint:c,Hash160bit:n.BufferN(20),Hash256bit:n.BufferN(32),Network:f,Satoshi:u,UInt31:o};for(var h in n)l[h]=n[h];e.exports=l},function(e,t,r){"use strict";var n=t;n.version=r(999).version,n.utils=r(1e3),n.rand=r(1001),n.hmacDRBG=r(1002),n.curve=r(230),n.curves=r(1012),n.ec=r(1014)},function(e,t,r){"use strict";(function(t){var n=r(39),i=r(135),o=r(46),s=r(34),a=r(119),u=r(15),c=r(21);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(231);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,l;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),l=e.slice(33,65),32!==a.length||32!==l.length||65!==e.length)throw new TypeError("Length of x and y must be 32 bytes");o=new n(a),s=new n(l),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(120);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";(function(t){const n=r(14),i=r(18),o=r(395),s=r(10),a=/^https?:\/\/[^/]+\/(ip(f|n)s)\/((\w+).*)/,u=/^\/(ip(f|n)s)\/((\w+).*)/,c=1,f=4,l=/^https?:\/\/([^/]+)\.(ip(?:f|n)s)\.[^/]+/,h=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 y(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 m(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===l&&(s=s.toLowerCase()),g(s)}function b(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===l){let e=o[n];return e=e.toLowerCase(),g(e)}return!0}function v(e){return t.isBuffer(e)?n.encode(e):"string"==typeof e&&e}const _=e=>m(e,l,2,1),w=e=>b(e,l,2,1);e.exports={multihash:p,cid:g,base32cid:e=>"base32"===y(e)&&g(e),ipfsSubdomain:_,ipnsSubdomain:w,subdomain:e=>_(e)||w(e),subdomainPattern:l,ipfsUrl:e=>m(e,a),ipnsUrl:e=>b(e,a),url:e=>m(e,a)||b(e,a),urlPattern:a,ipfsPath:e=>m(e,u),ipnsPath:e=>b(e,u),path:e=>m(e,u)||b(e,u),pathPattern:u,urlOrPath:e=>m(e,a)||b(e,a)||m(e,u)||b(e,u)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(54),i=r(196);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(398);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){function r(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}e.exports=r},function(e,t){var r=Array.isArray;e.exports=r},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";Object.defineProperty(t,"__esModule",{value:!0});var n=r(218),i=a(n),o=r(449),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){(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,l=n;l1&&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-h.length]+h+i:h+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="",y=this.clone();for(y.sign=!1;0!==y.cmpn(0);){var g=y.modn(p).toString(t);y=y.idivn(p),i=0!==y.cmpn(0)?a[d-g.length]+g+i:g+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],l=0|t.words[u],h=f*l,d=67108863&h;o=o+(h/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],l=t.words[u],h=f*l,d=67108863&h;o+=h/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!==l||f>=o);f--){var h=this.words[f];this.words[f]=l<<26-s|h>>>s,l=h&u}return c&&0!==l&&(c.words[c.length++]=l),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 l=0;l=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 l=o.clone(),h=n.clone();0!==n.cmpn(0);){for(;n.isEven();)n.ishrn(1),s.isEven()&&a.isEven()?(s.ishrn(1),a.ishrn(1)):(s.iadd(l).ishrn(1),a.isub(h).ishrn(1));for(;o.isEven();)o.ishrn(1),u.isEven()&&c.isEven()?(u.ishrn(1),c.ishrn(1)):(u.iadd(l).ishrn(1),c.isub(h).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 g(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 l(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(){l.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function d(){l.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function p(){l.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){l.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 m(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)}l.prototype._tmp=function e(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},l.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},l.prototype.split=function e(t,r){t.ishrn(this.n,0,r)},l.prototype.imulK=function e(t){return t.imul(this.k)},n(h,l),h.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},h.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 h;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 y}return f[t]=e,e},g.prototype._verify1=function e(t){r(!t.sign,"red works only with positives"),r(t.red,"red works only with red numbers")},g.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")},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 r=t.clone();return r.sign=!r.sign,r.iadd(this.m)._forceRed(this)},g.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)},g.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},g.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)},g.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},g.prototype.shl=function e(t,r){return this._verify1(t),this.imod(t.shln(r))},g.prototype.imul=function e(t,r){return this._verify2(t,r),this.imod(t.imul(r))},g.prototype.mul=function e(t,r){return this._verify2(t,r),this.imod(t.mul(r))},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 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(),l=this.m.subn(1).ishrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,l).cmp(f);)h.redIAdd(f);for(var d=this.pow(h,a),s=this.pow(t,a.addn(1).ishrn(1)),p=this.pow(t,a),y=u;0!==p.cmp(c);){for(var g=p,m=0;0!==g.cmp(c);m++)g=g.redSqr();r(m=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},m.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)},m.prototype.invm=function e(t){var r=this.imod(t._invmp(this.m).mul(this.r2));return r._forceRed(this)}}(void 0===e||e,this)}).call(this,r(32)(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";const n=r(497),i=r(1030),o=r(1041);t=e.exports,t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(533),t.pbkdf2=r(1081)},function(e,t,r){var n=r(13);r(16),r(122);var i=e.exports=n.asn1=n.asn1||{};function o(e,t,r){if(r>t){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 y=new Error("Too few bytes to read ASN.1 value.");throw y.available=e.length(),y.remaining=t,y.requested=h,y}h=t}var g=32==(32&c);if(g)if(d=[],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(),d.push(a(e,t,r+1,n)),t-=u-e.length()}else for(;h>0;)u=e.length(),d.push(a(e,h,r+1,n)),t-=u-e.length(),h-=u-e.length();if(void 0===d&&f===i.Class.UNIVERSAL&&l===i.Type.BITSTRING&&(p=e.bytes(h)),void 0===d&&n.decodeBitStrings&&f===i.Class.UNIVERSAL&&l===i.Type.BITSTRING&&h>1){var m=e.read,b=t,v=0;if(l===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,l==i.Type.BITSTRING&&S++;var E=w.tagClass;S!==h||E!==i.Class.UNIVERSAL&&E!==i.Class.CONTEXT_SPECIFIC||(d=[w])}catch(e){}void 0===d&&(e.read=m,t=b)}if(void 0===d){if(void 0===h){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");h=t}if(l===i.Type.BMPSTRING)for(d="";h>0;h-=2)o(e,t,2),d+=String.fromCharCode(e.getInt16()),t-=2;else d=e.getBytes(h)}var k=void 0===p?null:{bitStringContents:p};return i.create(f,l,g,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),l=parseInt(e.substr(c+4,2),10),h=60*f+l;h*=6e4,"+"===u?t.setTime(+t-h):t.setTime(+t+h)}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 l=e.length-5,h=e.charAt(l);if("+"===h||"-"===h){var d=parseInt(e.substr(l+1,2),10),p=parseInt(e.substr(l+4,2),10);c=60*d+p,c*=6e4,"+"===h&&(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 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"+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(13);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},function(e,t,r){"use strict";const n=r(1156),i=C("dns4"),o=C("dns6"),s=x(C("dnsaddr"),i,o),a=x(C("ip4"),C("ip6")),u=x(A(a,C("tcp")),A(s,C("tcp"))),c=A(a,C("udp")),f=A(c,C("utp")),l=x(A(s,C("tcp")),s),h=x(A(u,C("ws")),A(l,C("ws"))),d=x(A(u,C("wss")),A(l,C("wss"))),p=x(A(u,C("http")),A(a,C("http")),A(l,C("http")),A(l)),y=x(A(u,C("https")),A(a,C("https")),A(l,C("https"))),g=x(A(h,C("p2p-webrtc-star"),C("ipfs")),A(d,C("p2p-webrtc-star"),C("ipfs"))),m=x(A(h,C("p2p-websocket-star"),C("ipfs")),A(d,C("p2p-websocket-star"),C("ipfs")),A(h,C("p2p-websocket-star")),A(d,C("p2p-websocket-star"))),b=x(A(p,C("p2p-webrtc-direct")),A(y,C("p2p-webrtc-direct"))),v=x(h,d,p,y,g,b,u,f);let _=x(A(v,C("ipfs")),g,C("ipfs"));const w=x(A(_,C("p2p-circuit"),_),A(_,C("p2p-circuit")),A(C("p2p-circuit"),_),A(v,C("p2p-circuit")),A(C("p2p-circuit"),v),C("p2p-circuit")),S=()=>x(A(w,S),w),E=S(),k=x(A(E,_,E),A(_,E),A(E,_),E,_);function A(){const e=Array.from(arguments);function t(e){"string"==typeof e&&(e=n(e));let t=r(e.protoNames());return null!==t&&0===t.length}function r(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:t,partialMatch:r}}function x(){const e=Array.from(arguments);function t(e){"string"==typeof e&&(e=n(e));const t=r(e.protoNames());return null!==t&&0===t.length}function r(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 i={toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:t,partialMatch:r};return i}function C(e){const t=e;function r(e){"string"==typeof e&&(e=n(e));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=l,t.DNS4=i,t.DNS6=o,t.IP=a,t.TCP=u,t.UDP=c,t.UTP=f,t.HTTP=p,t.HTTPS=y,t.WebSockets=h,t.WebSocketsSecure=d,t.WebSocketStar=m,t.WebRTCStar=g,t.WebRTCDirect=b,t.Reliable=v,t.Circuit=E,t.IPFS=k},function(e,t,r){"use strict";const n=t;n.bignum=r(31),n.define=r(1395).define,n.base=r(188),n.constants=r(625),n.decoders=r(1399),n.encoders=r(1401)},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";var n=r(278);e.exports=function e(t){return n(function(e,t){return e.push(t),e},[],t)}},function(e,t,r){var n=r(212),i=r(408);function o(e){return null!=e&&i(e.length)&&!n(e)}e.exports=o},function(e,t,r){e.exports=o;var n=r(11).EventEmitter,i=r(82);function o(){n.call(this)}i(o,n),o.Readable=r(165),o.Writable=r(843),o.Duplex=r(844),o.Transform=r(845),o.PassThrough=r(846),o.Stream=o,o.prototype.pipe=function(e,t){var r=this;function i(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(r.on("end",a),r.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 c(e){if(f(),0===n.listenerCount(this,"error"))throw e}function f(){r.removeListener("data",i),e.removeListener("drain",o),r.removeListener("end",a),r.removeListener("close",u),r.removeListener("error",c),e.removeListener("error",c),r.removeListener("end",f),r.removeListener("close",f),e.removeListener("close",f)}return r.on("error",c),e.on("error",c),r.on("end",f),r.on("close",f),e.on("close",f),e.emit("pipe",r),e}},function(e,t,r){const n=r(133);function i(e){return n("rmd160").update(e).digest()}function o(e){return n("sha1").update(e).digest()}function s(e){return n("sha256").update(e).digest()}function a(e){return i(s(e))}function u(e){return s(s(e))}e.exports={hash160:a,hash256:u,ripemd160:i,sha1:o,sha256:s}},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(21),o=r(25),s=r(39),a=function e(r){if(!(this instanceof e))return new e(r);if(!n.isUndefined(r))if(t.isBuffer(r))this.set({buf:r});else if(n.isString(r))this.set({buf:new t(r,"hex")});else{if(!n.isObject(r))throw new TypeError("Unrecognized argument for BufferReader");var i=r;this.set(i)}};a.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this.pos=e.pos||this.pos||0,this},a.prototype.eof=function(){return this.pos>=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 l.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){ +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;l--)if(u[l]!==c[l])return!1;for(l=u.length-1;l>=0;l--)if(f=u[l],!v(e[f],t[f],r,n))return!1;return!0}function S(e,t,r){v(e,t,!0)&&m(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 A(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&&m(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)&&m(i,r,"Got unwanted exception"+n),e&&i&&r&&!E(i,r)||!e&&i)throw i}l.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 r=t.stackStartFunction||m;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(l.AssertionError,Error),l.fail=m,l.ok=b,l.equal=function e(t,r,n){t!=r&&m(t,r,n,"==",l.equal)},l.notEqual=function e(t,r,n){t==r&&m(t,r,n,"!=",l.notEqual)},l.deepEqual=function e(t,r,n){v(t,r,!1)||m(t,r,n,"deepEqual",l.deepEqual)},l.deepStrictEqual=function e(t,r,n){v(t,r,!0)||m(t,r,n,"deepStrictEqual",l.deepStrictEqual)},l.notDeepEqual=function e(t,r,n){v(t,r,!1)&&m(t,r,n,"notDeepEqual",l.notDeepEqual)},l.notDeepStrictEqual=S,l.strictEqual=function e(t,r,n){t!==r&&m(t,r,n,"===",l.strictEqual)},l.notStrictEqual=function e(t,r,n){t===r&&m(t,r,n,"!==",l.notStrictEqual)},l.throws=function(e,t,r){A(!0,e,t,r)},l.doesNotThrow=function(e,t,r){A(!1,e,t,r)},l.ifError=function(e){if(e)throw e};var x=Object.keys||function(e){var t=[];for(var r in e)s.call(e,r)&&t.push(r);return t}}).call(this,r(10))},function(e,t,r){"use strict";var n=r(65),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(25);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){e.exports={encode:r(745),decode:r(746),encodingLength:r(747)}},function(e,t,r){const n=r(4).Buffer,i=r(291),o=r(112),s=r(901),a=r(35),u=r(74),c=r(465),f=r(29),l=r(903),h=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 y(e){return u.Array(e)&&e.every(p)}function g(e){return 0===e.length?f.OP_0:1===e.length?e[0]>=1&&e[0]<=16?h+e[0]:129===e[0]?f.OP_1NEGATE:void 0:void 0}function m(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!==g(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=g(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 b(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=g(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=b(e)),e.map(function(e){if(n.isBuffer(e)){const t=g(e);if(void 0===t)return e.toString("hex");e=t}return l[e]}).join(" ")}function _(e){return a(u.String,e),m(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=b(e),a(y,e),e.map(function(e){return n.isBuffer(e)?e:e===f.OP_0?n.allocUnsafe(0):c.encode(e-h)})}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:m,decompile:b,fromASM:_,toASM:v,toStack:w,number:r(465),signature:r(904),isCanonicalPubKey:S,isCanonicalScriptSignature:k,isPushOnly:y,isDefinedHashType:E}},function(e,t,r){e.exports=r(13),r(119),r(1023),r(86),r(313),r(510),r(231),r(1025),r(173),r(1026),r(512),r(1027),r(509),r(315),r(135),r(505),r(507),r(1028),r(499),r(506),r(503),r(317),r(68),r(504),r(1029),r(1030),r(498),r(16)},function(e,t,r){"use strict";(function(t){var n=r(0),i=r(20),o=r(34),s=r(21);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;i0&&"/"!==e.charAt(0))throw new Error(`multiaddr "${e}" must start with a "/"`);this.buffer=s.fromString(e)}else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=s.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});h.prototype.toString=function e(){return s.bufferToString(this.buffer)},h.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},h.prototype.inspect=function e(){return""},h.prototype.protos=function e(){return i(this.protoCodes(),function(e){return o(a(e))})},h.prototype.protoCodes=function e(){const t=[],r=this.buffer;let n=0;for(;n{if(e[0]===a.names.ipfs.code)return!0})[0][1],c.decode(t)}catch(e){t=null}return t},h.prototype.equals=function e(t){return this.buffer.equals(t.buffer)},h.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]}},h.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 h("/"+[n,t.address,r,t.port].join("/"))},h.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||17===r[1].code))},h.prototype.fromStupidString=function e(t){throw l},h.protocols=a,h.isName=function e(t){return!!h.isMultiaddr(t)&&t.protos().some(e=>e.resolvable)},h.resolve=function e(t,r){return h.isMultiaddr(t)&&h.isName(t)?r(new Error("not implemented yet")):r(new Error("not a valid name"))},t=e.exports=h}).call(this,r(0).Buffer)},function(e,t){e.exports=n;var r=Object.prototype.hasOwnProperty;function n(){for(var e={},t=0;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,l=n;l1&&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],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];function h(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,l=67108863&u,h=Math.min(c,t.length-1),d=Math.max(0,c-e.length+1);d<=h;d++){var p=c-d|0;i=0|e.words[p],o=0|t.words[d],s=i*o+l,f+=s/67108864|0,l=67108863&s}r.words[c]=0|l,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-h.length]+h+i:h+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=l[t];i="";var y=this.clone();for(y.negative=0;!y.isZero();){var g=y.modn(p).toString(t);y=y.idivn(p),i=y.isZero()?g+i:c[d-g.length]+g+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,l=this.clone();if(a){for(f=0;!l.isZero();f++)c=l.andln(255),l.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],y=8191&p,g=p>>>13,m=0|i[2],b=8191&m,v=m>>>13,_=0|i[3],w=8191&_,S=_>>>13,E=0|i[4],k=8191&E,A=E>>>13,x=0|i[5],C=8191&x,T=x>>>13,I=0|i[6],B=8191&I,O=I>>>13,P=0|i[7],R=8191&P,N=P>>>13,j=0|i[8],L=8191&j,M=j>>>13,D=0|i[9],U=8191&D,F=D>>>13,K=0|o[0],q=8191&K,H=K>>>13,z=0|o[1],V=8191&z,G=z>>>13,W=0|o[2],$=8191&W,Y=W>>>13,J=0|o[3],Z=8191&J,X=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,le=0|o[8],he=8191&le,de=le>>>13,pe=0|o[9],ye=8191&pe,ge=pe>>>13;n.negative=t.negative^r.negative,n.length=19,u=Math.imul(h,q),c=Math.imul(h,H),c=c+Math.imul(d,q)|0,f=Math.imul(d,H);var me=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(me>>>26)|0,me&=67108863,u=Math.imul(y,q),c=Math.imul(y,H),c=c+Math.imul(g,q)|0,f=Math.imul(g,H),u=u+Math.imul(h,V)|0,c=c+Math.imul(h,G)|0,c=c+Math.imul(d,V)|0,f=f+Math.imul(d,G)|0;var be=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(be>>>26)|0,be&=67108863,u=Math.imul(b,q),c=Math.imul(b,H),c=c+Math.imul(v,q)|0,f=Math.imul(v,H),u=u+Math.imul(y,V)|0,c=c+Math.imul(y,G)|0,c=c+Math.imul(g,V)|0,f=f+Math.imul(g,G)|0,u=u+Math.imul(h,$)|0,c=c+Math.imul(h,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,q),c=Math.imul(w,H),c=c+Math.imul(S,q)|0,f=Math.imul(S,H),u=u+Math.imul(b,V)|0,c=c+Math.imul(b,G)|0,c=c+Math.imul(v,V)|0,f=f+Math.imul(v,G)|0,u=u+Math.imul(y,$)|0,c=c+Math.imul(y,Y)|0,c=c+Math.imul(g,$)|0,f=f+Math.imul(g,Y)|0,u=u+Math.imul(h,Z)|0,c=c+Math.imul(h,X)|0,c=c+Math.imul(d,Z)|0,f=f+Math.imul(d,X)|0;var _e=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(_e>>>26)|0,_e&=67108863,u=Math.imul(k,q),c=Math.imul(k,H),c=c+Math.imul(A,q)|0,f=Math.imul(A,H),u=u+Math.imul(w,V)|0,c=c+Math.imul(w,G)|0,c=c+Math.imul(S,V)|0,f=f+Math.imul(S,G)|0,u=u+Math.imul(b,$)|0,c=c+Math.imul(b,Y)|0,c=c+Math.imul(v,$)|0,f=f+Math.imul(v,Y)|0,u=u+Math.imul(y,Z)|0,c=c+Math.imul(y,X)|0,c=c+Math.imul(g,Z)|0,f=f+Math.imul(g,X)|0,u=u+Math.imul(h,ee)|0,c=c+Math.imul(h,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(C,q),c=Math.imul(C,H),c=c+Math.imul(T,q)|0,f=Math.imul(T,H),u=u+Math.imul(k,V)|0,c=c+Math.imul(k,G)|0,c=c+Math.imul(A,V)|0,f=f+Math.imul(A,G)|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(b,Z)|0,c=c+Math.imul(b,X)|0,c=c+Math.imul(v,Z)|0,f=f+Math.imul(v,X)|0,u=u+Math.imul(y,ee)|0,c=c+Math.imul(y,te)|0,c=c+Math.imul(g,ee)|0,f=f+Math.imul(g,te)|0,u=u+Math.imul(h,ne)|0,c=c+Math.imul(h,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(B,q),c=Math.imul(B,H),c=c+Math.imul(O,q)|0,f=Math.imul(O,H),u=u+Math.imul(C,V)|0,c=c+Math.imul(C,G)|0,c=c+Math.imul(T,V)|0,f=f+Math.imul(T,G)|0,u=u+Math.imul(k,$)|0,c=c+Math.imul(k,Y)|0,c=c+Math.imul(A,$)|0,f=f+Math.imul(A,Y)|0,u=u+Math.imul(w,Z)|0,c=c+Math.imul(w,X)|0,c=c+Math.imul(S,Z)|0,f=f+Math.imul(S,X)|0,u=u+Math.imul(b,ee)|0,c=c+Math.imul(b,te)|0,c=c+Math.imul(v,ee)|0,f=f+Math.imul(v,te)|0,u=u+Math.imul(y,ne)|0,c=c+Math.imul(y,ie)|0,c=c+Math.imul(g,ne)|0,f=f+Math.imul(g,ie)|0,u=u+Math.imul(h,se)|0,c=c+Math.imul(h,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(R,q),c=Math.imul(R,H),c=c+Math.imul(N,q)|0,f=Math.imul(N,H),u=u+Math.imul(B,V)|0,c=c+Math.imul(B,G)|0,c=c+Math.imul(O,V)|0,f=f+Math.imul(O,G)|0,u=u+Math.imul(C,$)|0,c=c+Math.imul(C,Y)|0,c=c+Math.imul(T,$)|0,f=f+Math.imul(T,Y)|0,u=u+Math.imul(k,Z)|0,c=c+Math.imul(k,X)|0,c=c+Math.imul(A,Z)|0,f=f+Math.imul(A,X)|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(b,ne)|0,c=c+Math.imul(b,ie)|0,c=c+Math.imul(v,ne)|0,f=f+Math.imul(v,ie)|0,u=u+Math.imul(y,se)|0,c=c+Math.imul(y,ae)|0,c=c+Math.imul(g,se)|0,f=f+Math.imul(g,ae)|0,u=u+Math.imul(h,ce)|0,c=c+Math.imul(h,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,q),c=Math.imul(L,H),c=c+Math.imul(M,q)|0,f=Math.imul(M,H),u=u+Math.imul(R,V)|0,c=c+Math.imul(R,G)|0,c=c+Math.imul(N,V)|0,f=f+Math.imul(N,G)|0,u=u+Math.imul(B,$)|0,c=c+Math.imul(B,Y)|0,c=c+Math.imul(O,$)|0,f=f+Math.imul(O,Y)|0,u=u+Math.imul(C,Z)|0,c=c+Math.imul(C,X)|0,c=c+Math.imul(T,Z)|0,f=f+Math.imul(T,X)|0,u=u+Math.imul(k,ee)|0,c=c+Math.imul(k,te)|0,c=c+Math.imul(A,ee)|0,f=f+Math.imul(A,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(b,se)|0,c=c+Math.imul(b,ae)|0,c=c+Math.imul(v,se)|0,f=f+Math.imul(v,ae)|0,u=u+Math.imul(y,ce)|0,c=c+Math.imul(y,fe)|0,c=c+Math.imul(g,ce)|0,f=f+Math.imul(g,fe)|0,u=u+Math.imul(h,he)|0,c=c+Math.imul(h,de)|0,c=c+Math.imul(d,he)|0,f=f+Math.imul(d,de)|0;var Ae=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,u=Math.imul(U,q),c=Math.imul(U,H),c=c+Math.imul(F,q)|0,f=Math.imul(F,H),u=u+Math.imul(L,V)|0,c=c+Math.imul(L,G)|0,c=c+Math.imul(M,V)|0,f=f+Math.imul(M,G)|0,u=u+Math.imul(R,$)|0,c=c+Math.imul(R,Y)|0,c=c+Math.imul(N,$)|0,f=f+Math.imul(N,Y)|0,u=u+Math.imul(B,Z)|0,c=c+Math.imul(B,X)|0,c=c+Math.imul(O,Z)|0,f=f+Math.imul(O,X)|0,u=u+Math.imul(C,ee)|0,c=c+Math.imul(C,te)|0,c=c+Math.imul(T,ee)|0,f=f+Math.imul(T,te)|0,u=u+Math.imul(k,ne)|0,c=c+Math.imul(k,ie)|0,c=c+Math.imul(A,ne)|0,f=f+Math.imul(A,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(b,ce)|0,c=c+Math.imul(b,fe)|0,c=c+Math.imul(v,ce)|0,f=f+Math.imul(v,fe)|0,u=u+Math.imul(y,he)|0,c=c+Math.imul(y,de)|0,c=c+Math.imul(g,he)|0,f=f+Math.imul(g,de)|0,u=u+Math.imul(h,ye)|0,c=c+Math.imul(h,ge)|0,c=c+Math.imul(d,ye)|0,f=f+Math.imul(d,ge)|0;var xe=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(xe>>>26)|0,xe&=67108863,u=Math.imul(U,V),c=Math.imul(U,G),c=c+Math.imul(F,V)|0,f=Math.imul(F,G),u=u+Math.imul(L,$)|0,c=c+Math.imul(L,Y)|0,c=c+Math.imul(M,$)|0,f=f+Math.imul(M,Y)|0,u=u+Math.imul(R,Z)|0,c=c+Math.imul(R,X)|0,c=c+Math.imul(N,Z)|0,f=f+Math.imul(N,X)|0,u=u+Math.imul(B,ee)|0,c=c+Math.imul(B,te)|0,c=c+Math.imul(O,ee)|0,f=f+Math.imul(O,te)|0,u=u+Math.imul(C,ne)|0,c=c+Math.imul(C,ie)|0,c=c+Math.imul(T,ne)|0,f=f+Math.imul(T,ie)|0,u=u+Math.imul(k,se)|0,c=c+Math.imul(k,ae)|0,c=c+Math.imul(A,se)|0,f=f+Math.imul(A,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(b,he)|0,c=c+Math.imul(b,de)|0,c=c+Math.imul(v,he)|0,f=f+Math.imul(v,de)|0,u=u+Math.imul(y,ye)|0,c=c+Math.imul(y,ge)|0,c=c+Math.imul(g,ye)|0,f=f+Math.imul(g,ge)|0;var Ce=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,u=Math.imul(U,$),c=Math.imul(U,Y),c=c+Math.imul(F,$)|0,f=Math.imul(F,Y),u=u+Math.imul(L,Z)|0,c=c+Math.imul(L,X)|0,c=c+Math.imul(M,Z)|0,f=f+Math.imul(M,X)|0,u=u+Math.imul(R,ee)|0,c=c+Math.imul(R,te)|0,c=c+Math.imul(N,ee)|0,f=f+Math.imul(N,te)|0,u=u+Math.imul(B,ne)|0,c=c+Math.imul(B,ie)|0,c=c+Math.imul(O,ne)|0,f=f+Math.imul(O,ie)|0,u=u+Math.imul(C,se)|0,c=c+Math.imul(C,ae)|0,c=c+Math.imul(T,se)|0,f=f+Math.imul(T,ae)|0,u=u+Math.imul(k,ce)|0,c=c+Math.imul(k,fe)|0,c=c+Math.imul(A,ce)|0,f=f+Math.imul(A,fe)|0,u=u+Math.imul(w,he)|0,c=c+Math.imul(w,de)|0,c=c+Math.imul(S,he)|0,f=f+Math.imul(S,de)|0,u=u+Math.imul(b,ye)|0,c=c+Math.imul(b,ge)|0,c=c+Math.imul(v,ye)|0,f=f+Math.imul(v,ge)|0;var Te=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Te>>>26)|0,Te&=67108863,u=Math.imul(U,Z),c=Math.imul(U,X),c=c+Math.imul(F,Z)|0,f=Math.imul(F,X),u=u+Math.imul(L,ee)|0,c=c+Math.imul(L,te)|0,c=c+Math.imul(M,ee)|0,f=f+Math.imul(M,te)|0,u=u+Math.imul(R,ne)|0,c=c+Math.imul(R,ie)|0,c=c+Math.imul(N,ne)|0,f=f+Math.imul(N,ie)|0,u=u+Math.imul(B,se)|0,c=c+Math.imul(B,ae)|0,c=c+Math.imul(O,se)|0,f=f+Math.imul(O,ae)|0,u=u+Math.imul(C,ce)|0,c=c+Math.imul(C,fe)|0,c=c+Math.imul(T,ce)|0,f=f+Math.imul(T,fe)|0,u=u+Math.imul(k,he)|0,c=c+Math.imul(k,de)|0,c=c+Math.imul(A,he)|0,f=f+Math.imul(A,de)|0,u=u+Math.imul(w,ye)|0,c=c+Math.imul(w,ge)|0,c=c+Math.imul(S,ye)|0,f=f+Math.imul(S,ge)|0;var Ie=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,u=Math.imul(U,ee),c=Math.imul(U,te),c=c+Math.imul(F,ee)|0,f=Math.imul(F,te),u=u+Math.imul(L,ne)|0,c=c+Math.imul(L,ie)|0,c=c+Math.imul(M,ne)|0,f=f+Math.imul(M,ie)|0,u=u+Math.imul(R,se)|0,c=c+Math.imul(R,ae)|0,c=c+Math.imul(N,se)|0,f=f+Math.imul(N,ae)|0,u=u+Math.imul(B,ce)|0,c=c+Math.imul(B,fe)|0,c=c+Math.imul(O,ce)|0,f=f+Math.imul(O,fe)|0,u=u+Math.imul(C,he)|0,c=c+Math.imul(C,de)|0,c=c+Math.imul(T,he)|0,f=f+Math.imul(T,de)|0,u=u+Math.imul(k,ye)|0,c=c+Math.imul(k,ge)|0,c=c+Math.imul(A,ye)|0,f=f+Math.imul(A,ge)|0;var Be=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Be>>>26)|0,Be&=67108863,u=Math.imul(U,ne),c=Math.imul(U,ie),c=c+Math.imul(F,ne)|0,f=Math.imul(F,ie),u=u+Math.imul(L,se)|0,c=c+Math.imul(L,ae)|0,c=c+Math.imul(M,se)|0,f=f+Math.imul(M,ae)|0,u=u+Math.imul(R,ce)|0,c=c+Math.imul(R,fe)|0,c=c+Math.imul(N,ce)|0,f=f+Math.imul(N,fe)|0,u=u+Math.imul(B,he)|0,c=c+Math.imul(B,de)|0,c=c+Math.imul(O,he)|0,f=f+Math.imul(O,de)|0,u=u+Math.imul(C,ye)|0,c=c+Math.imul(C,ge)|0,c=c+Math.imul(T,ye)|0,f=f+Math.imul(T,ge)|0;var Oe=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,u=Math.imul(U,se),c=Math.imul(U,ae),c=c+Math.imul(F,se)|0,f=Math.imul(F,ae),u=u+Math.imul(L,ce)|0,c=c+Math.imul(L,fe)|0,c=c+Math.imul(M,ce)|0,f=f+Math.imul(M,fe)|0,u=u+Math.imul(R,he)|0,c=c+Math.imul(R,de)|0,c=c+Math.imul(N,he)|0,f=f+Math.imul(N,de)|0,u=u+Math.imul(B,ye)|0,c=c+Math.imul(B,ge)|0,c=c+Math.imul(O,ye)|0,f=f+Math.imul(O,ge)|0;var Pe=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,u=Math.imul(U,ce),c=Math.imul(U,fe),c=c+Math.imul(F,ce)|0,f=Math.imul(F,fe),u=u+Math.imul(L,he)|0,c=c+Math.imul(L,de)|0,c=c+Math.imul(M,he)|0,f=f+Math.imul(M,de)|0,u=u+Math.imul(R,ye)|0,c=c+Math.imul(R,ge)|0,c=c+Math.imul(N,ye)|0,f=f+Math.imul(N,ge)|0;var Re=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Re>>>26)|0,Re&=67108863,u=Math.imul(U,he),c=Math.imul(U,de),c=c+Math.imul(F,he)|0,f=Math.imul(F,de),u=u+Math.imul(L,ye)|0,c=c+Math.imul(L,ge)|0,c=c+Math.imul(M,ye)|0,f=f+Math.imul(M,ge)|0;var Ne=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,u=Math.imul(U,ye),c=Math.imul(U,ge),c=c+Math.imul(F,ye)|0,f=Math.imul(F,ge);var je=(a+u|0)+((8191&c)<<13)|0;return a=(f+(c>>>13)|0)+(je>>>26)|0,je&=67108863,s[0]=me,s[1]=be,s[2]=ve,s[3]=_e,s[4]=we,s[5]=Se,s[6]=Ee,s[7]=ke,s[8]=Ae,s[9]=xe,s[10]=Ce,s[11]=Te,s[12]=Ie,s[13]=Be,s[14]=Oe,s[15]=Pe,s[16]=Re,s[17]=Ne,s[18]=je,0!==a&&(s[19]=a,n.length++),n};function y(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 g(e,t,r){var n=new m;return n.mulp(e,t,r)}function m(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?y(this,t,r):g(this,t,r),n},m.prototype.makeRBT=function e(t){for(var r=new Array(t),n=o.prototype._countBits(t)-1,i=0;i>=1;return i},m.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=h(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!==l||f>=o);f--){var h=0|this.words[f];this.words[f]=l<<26-s|h>>>s,l=h&u}return c&&0!==l&&(c.words[c.length++]=l),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 l=0;l=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 l=i.clone(),h=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(l),a.isub(h)),s.iushrn(1),a.iushrn(1);for(var y=0,g=1;0==(i.words[0]&g)&&y<26;++y,g<<=1);if(y>0)for(i.iushrn(y);y-- >0;)(u.isOdd()||c.isOdd())&&(u.iadd(l),c.isub(h)),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,l=1;0==(r.words[0]&l)&&f<26;++f,l<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var h=0,d=1;0==(i.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(i.iushrn(h);h-- >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 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 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 A(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(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 S;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return b[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),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,f).cmp(c);)l.redIAdd(c);for(var h=this.pow(l,s),d=this.pow(t,s.addn(1).iushrn(1)),p=this.pow(t,s),y=a;0!==p.cmp(u);){for(var g=p,m=0;0!==g.cmp(u);m++)g=g.redSqr();n(m=0;s--){for(var l=r.words[s],h=f-1;h>=0;h--){var d=l>>h&1;a!==i[0]&&(a=this.sqr(a)),0!==d||0!==u?(u<<=1,u|=d,c++,(4===c||0===s&&0===h)&&(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 A(t)},i(A,k),A.prototype.convertTo=function e(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function e(t){var r=this.imod(t.mul(this.rinv));return r.red=null,r},A.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)},A.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)},A.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(32)(e))},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,r){"use strict";(function(t){const n=r(18),i=r(832);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";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,r){var n=r(464),i=r(295),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 h(t,e,n)}catch(e){throw u(e,r)}})))))}return t=l(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=l(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&&h(r,o,n)}catch(e){throw u(e,o,"key")}try{var s=e[o];h(t,s,n)}catch(e){throw u(e,o)}}return!0}return t=l(t),r&&(r=l(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]=l(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];h(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(l);function r(e,r){return t.some(function(t){try{return h(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(l);function r(e,r){return t.every(function(t){try{return h(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(l);function r(e,r){return!i.Nil(e)&&(!i.Nil(e.length)&&((!r||e.length===t.length)&&t.every(function(t,n){try{return h(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 l(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 h(e,t,r,n){if(i.Function(e)){if(e(t,r))return!0;throw new s(n||e,t)}return h(l(e),t,r)}for(var d in f.oneOf=f.anyOf,i)h[d]=i[d];for(d in f)h[d]=f[d];var p=r(902);for(d in p)h[d]=p[d];h.compile=l,h.TfTypeError=s,h.TfPropertyTypeError=a,e.exports=h},function(e,t,r){"use strict";var n=r(730),i=r(731);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=E,t.resolveObject=k,t.format=S,t.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["<",">",'"',"`"," ","\r","\n","\t"],f=["{","}","|","\\","^","`"].concat(c),l=["'"].concat(f),h=["%","/","?",";","#"].concat(l),d=["/","?","#"],p=255,y=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={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},_=r(270);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?N+="x":N+=R[j];if(!N.match(y)){var M=O.slice(0,x),D=O.slice(x+1),U=R.match(g);U&&(M.push(U[1]),D.unshift(U[2])),D.length&&(p="/"+D.join(".")+p),this.hostname=M.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),B||(this.hostname=n.toASCII(this.hostname));var F=this.port?":"+this.port:"",K=this.hostname||"";this.host=K+F,this.href+=this.host,B&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==p[0]&&(p="/"+p))}if(!m[E])for(var x=0,P=l.length;x0)&&r.host.split("@");A&&(r.auth=A.shift(),r.host=r.hostname=A.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 x=E.slice(-1)[0],C=(r.host||e.host||E.length>1)&&("."===x||".."===x)||""===x,T=0,I=E.length;I>=0;I--)x=E[I],"."===x?E.splice(I,1):".."===x?(E.splice(I,1),T++):T&&(E.splice(I,1),T--);if(!w&&!S)for(;T--;T)E.unshift("..");!w||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),C&&"/"!==E.join("/").substr(-1)&&E.push("");var B=""===E[0]||E[0]&&"/"===E[0].charAt(0);if(k){r.hostname=r.host=B?"":E.length?E.shift():"";var A=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");A&&(r.auth=A.shift(),r.host=r.hostname=A.shift())}return w=w||r.host&&E.length,w&&!B&&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.isAsync=void 0;var n=r(205),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";const n=r(412),i=r(788),o=r(281),s=r(415);t.Key=n,t.MemoryDatastore=i,t.utils=o,t.Errors=s},function(e,t,r){"use strict";(function(t){var n=r(83),i=r(21),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{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 n(e,{className:t,symbolName:r}){const n=Symbol.for(r),i={[t]:class extends e{constructor(...e){super(...e),Object.defineProperty(this,n,{value:!0})}get[Symbol.toStringTag](){return t}}}[t];return i[`is${t}`]=(e=>!(!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=u;var n=r(401),i=a(n),o=r(276),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";Object.defineProperty(t,"__esModule",{value:!0}),t.default=f;var n=r(210),i=c(n),o=r(411),s=c(o),a=r(37),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){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;us)n=e(n);else if(n{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){"use strict";const n=r(556),i=r(1141),o=r(333);t.Key=n,t.MemoryDatastore=i,t.utils=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(210),i=a(n),o=r(401),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){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=r,r.equal=function e(t,r,n){if(t!=r)throw new Error(n||"Assertion failed: "+t+" != "+r)}},function(e,t,r){"use strict";(function(n){const i=r(18),o=r(85),s=r(20),a=r(6);class u{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.keys.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return o.keys.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:c(this.marshalPrivKey()),pubKey:c(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"))}}function c(e){if(e)return e.toString("base64")}t=e.exports=u,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.keys.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 u(r,n))})},t.createFromHexString=function(e){return new u(i.fromHexString(e))},t.createFromBytes=function(e){return new u(e)},t.createFromB58String=function(e){return new u(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.keys.unmarshalPublicKey(i)}catch(e){return t(e)}r.hash((e,n)=>{if(e)return t(e);t(null,new u(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.keys.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 u(r,n,n.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r,s,c,f;try{r=i.fromB58String(e.id),s=e.privKey&&n.from(e.privKey,"base64"),c=e.pubKey&&n.from(e.pubKey,"base64"),f=c&&o.keys.unmarshalPublicKey(c)}catch(e){return t(e)}s?a([e=>o.keys.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)}),(e,t,r)=>{f?f.hash((n,i)=>{r(n,e,t,i)}):r(null,e,t)}],(e,n,i,o)=>e?t(e):f&&!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 u(r,i,f))):t(null,new u(r,null,f))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,r(0).Buffer)},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";t.Connection=r(1281)},function(e,t,r){(function(t){var n=r(26),i=r(182),o=r(1363),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)},l=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 l=!1;return function(t){if(!a&&!l)return l=!0,c(e)?e.close(s):f(e)?e.abort():u(e.destroy)?e.destroy():void o(t||new Error("stream was destroyed"))}},h=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 l(i,s,a,function(e){r||(r=e),e&&n.forEach(h),s||(n.forEach(h),t(r))})});return e.reduce(d)};e.exports=p}).call(this,r(3))},function(e,t,r){"use strict";const n=r(191);e.exports={addLink:r(369),bufferPullStreamSource:r(1581),countStreamBytes:r(1582),createLock:r(1583),createNode:r(665),errors:r(666),formatCid:r(1598),limitStreamBytes:r(1599),loadNode:r(1600),toPullSource:r(1601),toSourcesAndDestination:r(1606),toSources:r(668),traverseTo:r(1607),updateMfsRoot:r(1609),updateTree:r(1610),validatePath:r(670),withMfsRoot:r(669),zeros:r(1611),FILE_SEPARATOR:n.FILE_SEPARATOR,MAX_CHUNK_SIZE:n.MAX_CHUNK_SIZE,MAX_LINKS:n.MAX_LINKS,FILE_TYPES:n.FILE_TYPES}},function(e,t,r){"use strict";var n=r(4).Buffer,i=n.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function s(e){var t=o(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}function a(e){var t;switch(this.encoding=s(e),this.encoding){case"utf16le":this.text=p,this.end=y,t=4;break;case"utf8":this.fillLast=l,t=4;break;case"base64":this.text=g,this.end=m,t=3;break;default:return this.write=b,void(this.end=v)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function u(e){return e<=127?0:e>>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 l(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 h(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 y(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 g(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 m(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,r;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return 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]),b(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),l(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 l(e,r,n){if(e.customInspect&&r&&I(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return S(i)||(i=l(e,i,n)),i}var o=h(e,r);if(o)return o;var s=Object.keys(r),a=f(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),T(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return d(r);if(0===s.length){if(I(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(A(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(C(r))return e.stylize(Date.prototype.toString.call(r),"date");if(T(r))return d(r)}var c="",b=!1,v=["{","}"],_;if(m(r)&&(b=!0,v=["[","]"]),I(r)){var w=r.name?": "+r.name:"";c=" [Function"+w+"]"}return A(r)&&(c=" "+RegExp.prototype.toString.call(r)),C(r)&&(c=" "+Date.prototype.toUTCString.call(r)),T(r)&&(c=" "+d(r)),0!==s.length||b&&0!=r.length?n<0?A(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),_=b?p(e,r,n,a,s):s.map(function(t){return y(e,r,n,a,t,b)}),e.seen.pop(),g(_,c,v)):v[0]+c+v[1]}function h(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"):b(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 g(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 m(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 S(e){return"string"==typeof e}function E(e){return"symbol"==typeof e}function k(e){return void 0===e}function A(e){return x(e)&&"[object RegExp]"===O(e)}function x(e){return"object"==typeof e&&null!==e}function C(e){return x(e)&&"[object Date]"===O(e)}function T(e){return x(e)&&("[object Error]"===O(e)||e instanceof Error)}function I(e){return"function"==typeof e}function B(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(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=m,t.isBoolean=b,t.isNull=v,t.isNullOrUndefined=_,t.isNumber=w,t.isString=S,t.isSymbol=E,t.isUndefined=k,t.isRegExp=A,t.isObject=x,t.isDate=C,t.isError=T,t.isFunction=I,t.isPrimitive=B,t.isBuffer=r(785);var R=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function N(){var e=new Date,t=[P(e.getHours()),P(e.getMinutes()),P(e.getSeconds())].join(":");return[e.getDate(),R[e.getMonth()],t].join(" ")}function j(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",N(),t.format.apply(t,arguments))},t.inherits=r(1),t._extend=function(e,t){if(!t||!x(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}}).call(this,r(10),r(3))},function(e,t,r){"use strict";var n=t;n.version=r(871).version,n.utils=r(872),n.rand=r(873),n.curve=r(222),n.curves=r(879),n.ec=r(887),n.eddsa=r(891)},function(e,t,r){"use strict";const n=r(1241),i=r(1242);t.encode=n,t.decode=i.decode,t.decodeFromReader=i.decodeFromReader},function(e,t){function r(){}e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var n=r(59),i=l(n),o=r(125),s=l(o),a=r(126),u=l(a),c=r(37),f=l(c);function l(e){return e&&e.__esModule?e:{default:e}}function h(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){var n=r(25),i=r(20),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,r){(function(e,r){var n=200,i="Expected a function",o="__lodash_hash_undefined__",s=1,a=2,u=1/0,c=9007199254740991,f="[object Arguments]",l="[object Array]",h="[object Boolean]",d="[object Date]",p="[object Error]",y="[object Function]",g="[object GeneratorFunction]",m="[object Map]",b="[object Number]",v="[object Object]",_="[object Promise]",w="[object RegExp]",S="[object Set]",E="[object String]",k="[object Symbol]",A="[object WeakMap]",x="[object ArrayBuffer]",C="[object DataView]",T="[object Float32Array]",I="[object Float64Array]",B="[object Int8Array]",O="[object Int16Array]",P="[object Int32Array]",R="[object Uint8Array]",N="[object Uint8ClampedArray]",j="[object Uint16Array]",L="[object Uint32Array]",M=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,D=/^\w*$/,U=/^\./,F=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,K=/[\\^$.*+?()[\]{}|]/g,q=/\\(\\)?/g,H=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,V={};V[T]=V[I]=V[B]=V[O]=V[P]=V[R]=V[N]=V[j]=V[L]=!0,V[f]=V[l]=V[x]=V[h]=V[C]=V[d]=V[p]=V[y]=V[m]=V[b]=V[v]=V[w]=V[S]=V[E]=V[A]=!1;var G="object"==typeof e&&e&&e.Object===Object&&e,W="object"==typeof self&&self&&self.Object===Object&&self,$=G||W||Function("return this")(),Y=t&&!t.nodeType&&t,J=Y&&"object"==typeof r&&r&&!r.nodeType&&r,Z=J&&J.exports===Y,X=Z&&G.process,Q=function(){try{return X&&X.binding("util")}catch(e){}}(),ee=Q&&Q.isTypedArray;function te(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r-1}function Ze(e,t){var r=this.__data__,n=pt(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function Xe(e){var t=-1,r=e?e.length:0;for(this.clear();++tc))return!1;var l=o.get(e);if(l&&o.get(t))return l==t;var h=-1,d=!0,p=i&s?new it:void 0;for(o.set(e,t),o.set(t,e);++h-1&&e%1==0&&e-1&&e%1==0&&e<=c}function cr(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function fr(e){return!!e&&"object"==typeof e}function lr(e){return"symbol"==typeof e||fr(e)&&ve.call(e)==k}var hr=ee?oe(ee):At;function dr(e){return null==e?"":Pt(e)}function pr(e,t,r){var n=null==e?void 0:bt(e,t);return void 0===n?r:n}function yr(e,t){return null!=e&&Ht(e,t,_t)}function gr(e){return or(e)?dt(e):Ct(e)}function mr(e){return e}function br(e){return Vt(e)?ne(Xt(e)):Ot(e)}r.exports=er}).call(this,r(10),r(32)(e))},function(e,t,r){var n;!function(i){"use strict";var o,s=20,a=1,u=1e6,c=1e6,f=-7,l=21,h="[big.js] ",d=h+"Invalid ",p=d+"decimal places",y=d+"rounding mode",g=h+"Division by zero",m={},b=void 0,v=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function _(){function e(t){var r=this;if(!(r instanceof e))return t===b?_():new e(t);t instanceof e?(r.s=t.s,r.e=t.e,r.c=t.c.slice()):w(r,t),r.constructor=e}return e.prototype=m,e.DP=s,e.RM=a,e.NE=f,e.PE=l,e.version="5.2.2",e}function w(e,t){var r,n,i;if(0===t&&1/t<0)t="-0";else if(!v.test(t+=""))throw Error(d+"number");for(e.s="-"==t.charAt(0)?(t=t.slice(1),-1):1,(r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),i=t.length,n=0;n0&&"0"==t.charAt(--i););for(e.e=r-n-1,e.c=[],r=0;n<=i;)e.c[r++]=+t.charAt(n++)}return e}function S(e,t,r,n){var i=e.c,o=e.e+t+1;if(o=5;else if(2===r)n=i[o]>5||5==i[o]&&(n||o<0||i[o+1]!==b||1&i[o-1]);else if(3===r)n=n||!!i[0];else if(n=!1,0!==r)throw Error(y);if(o<1)i.length=1,n?(e.e=-t,i[0]=1):i[0]=e.e=0;else{if(i.length=o--,n)for(;++i[o]>9;)i[o]=0,o--||(++e.e,i.unshift(1));for(o=i.length;!i[--o];)i.pop()}}else if(r<0||r>3||r!==~~r)throw Error(y);return e}function E(e,t,r,n){var i,o,s=e.constructor,a=!e.c[0];if(r!==b){if(r!==~~r||r<(3==t)||r>u)throw Error(3==t?d+"precision":p);for(e=new s(e),r=n-e.e,e.c.length>++n&&S(e,r,s.RM),2==t&&(n=e.e+r+1);e.c.length=s.PE))o=o.charAt(0)+(r>1?"."+o.slice(1):"")+(i<0?"e":"e+")+i;else if(i<0){for(;++i;)o="0"+o;o="0."+o}else if(i>0)if(++i>r)for(i-=r;i--;)o+="0";else i1&&(o=o.charAt(0)+"."+o.slice(1));return e.s<0&&(!a||4==t)?"-"+o:o}m.abs=function(){var e=new this.constructor(this);return e.s=1,e},m.cmp=function(e){var t,r=this,n=r.c,i=(e=new r.constructor(e)).c,o=r.s,s=e.s,a=r.e,u=e.e;if(!n[0]||!i[0])return n[0]?o:i[0]?-s:0;if(o!=s)return o;if(t=o<0,a!=u)return a>u^t?1:-1;for(s=(a=n.length)<(u=i.length)?a:u,o=-1;++oi[o]^t?1:-1;return a==u?0:a>u^t?1:-1},m.div=function(e){var t=this,r=t.constructor,n=t.c,i=(e=new r(e)).c,o=t.s==e.s?1:-1,s=r.DP;if(s!==~~s||s<0||s>u)throw Error(p);if(!i[0])throw Error(g);if(!n[0])return new r(0*o);var a,c,f,l,h,d=i.slice(),y=a=i.length,m=n.length,v=n.slice(0,a),_=v.length,w=e,E=w.c=[],k=0,A=s+(w.e=t.e-e.e)+1;for(w.s=o,o=A<0?0:A,d.unshift(0);_++_?1:-1;else for(h=-1,l=0;++hv[h]?1:-1;break}if(!(l<0))break;for(c=_==a?i:d;_;){if(v[--_]A&&S(w,s,r.RM,v[0]!==b),w},m.eq=function(e){return!this.cmp(e)},m.gt=function(e){return this.cmp(e)>0},m.gte=function(e){return this.cmp(e)>-1},m.lt=function(e){return this.cmp(e)<0},m.lte=function(e){return this.cmp(e)<1},m.minus=m.sub=function(e){var t,r,n,i,o=this,s=o.constructor,a=o.s,u=(e=new s(e)).s;if(a!=u)return e.s=-u,o.plus(e);var c=o.c.slice(),f=o.e,l=e.c,h=e.e;if(!c[0]||!l[0])return l[0]?(e.s=-u,e):new s(c[0]?o:0);if(a=f-h){for((i=a<0)?(a=-a,n=c):(h=f,n=l),n.reverse(),u=a;u--;)n.push(0);n.reverse()}else for(r=((i=c.length0)for(;u--;)c[t++]=0;for(u=t;r>a;){if(c[--r]0?(u=s,t=c):(i=-i,t=a),t.reverse();i--;)t.push(0);t.reverse()}for(a.length-c.length<0&&(t=c,c=a,a=t),i=c.length,o=0;i;a[i]%=10)o=(a[--i]=a[i]+c[i]+o)/10|0;for(o&&(a.unshift(o),++u),i=a.length;0===a[--i];)a.pop();return e.c=a,e.e=u,e},m.pow=function(e){var t=this,r=new t.constructor(1),n=r,i=e<0;if(e!==~~e||e<-1e6||e>1e6)throw Error(d+"exponent");for(i&&(e=-e);1&e&&(n=n.times(t)),e>>=1,e;)t=t.times(t);return i?r.div(n):n},m.round=function(e,t){var r=this.constructor;if(e===b)e=0;else if(e!==~~e||e<-u||e>u)throw Error(p);return S(new r(this),e,t===b?r.RM:t)},m.sqrt=function(){var e,t,r,n=this,i=n.constructor,o=n.s,s=n.e,a=new i(.5);if(!n.c[0])return new i(n);if(o<0)throw Error(h+"No square root");o=Math.sqrt(n+""),0===o||o===1/0?(t=n.c.join(""),t.length+s&1||(t+="0"),o=Math.sqrt(t),s=((s+1)/2|0)-(s<0||1&s),e=new i((o==1/0?"1e":(o=o.toExponential()).slice(0,o.indexOf("e")+1))+s)):e=new i(o),s=e.e+(i.DP+=4);do{r=e,e=a.times(r.plus(n.div(r)))}while(r.c.slice(0,s).join("")!==e.c.slice(0,s).join(""));return S(e,i.DP-=4,i.RM)},m.times=m.mul=function(e){var t,r=this,n=r.constructor,i=r.c,o=(e=new n(e)).c,s=i.length,a=o.length,u=r.e,c=e.e;if(e.s=r.s==e.s?1:-1,!i[0]||!o[0])return new n(0*e.s);for(e.e=u+c,su;)a=t[c]+o[u]*i[c-u-1]+a,t[c--]=a%10,a=a/10|0;t[c]=(t[c]+a)%10}for(a?++e.e:t.shift(),u=t.length;!t[--u];)t.pop();return e.c=t,e},m.toExponential=function(e){return E(this,1,e,e)},m.toFixed=function(e){return E(this,2,e,this.e+e)},m.toPrecision=function(e){return E(this,3,e,e-1)},m.toString=function(){return E(this)},m.valueOf=m.toJSON=function(){return E(this,4)},o=_(),o.default=o.Big=o,n=function(){return o}.call(t,r,t,e),void 0===n||(e.exports=n)}(this)},function(e,t){e.exports={bitcoin:{messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},testnet:{messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239}}},function(e,t,r){"use strict";var n=r(15);function i(e,t){return e.replace("{0}",t[0]).replace("{1}",t[1]).replace("{2}",t[2])}var o=function(e,t){var r=function(){if(n.isString(t.message))this.message=i(t.message,arguments);else{if(!n.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 r.prototype=Object.create(e.prototype),r.prototype.name=e.prototype.name+t.name,e[t.name]=r,t.errors&&s(r,t.errors),r},s=function(e,t){n.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 c=r(978);a(u.Error,c),e.exports=u.Error,e.exports.extend=function(e){return o(u.Error,e)}},function(e,t,r){"use strict";(function(t){var n=r(39),i=r(15),o=r(21),s=r(25),a=r(34),u=function e(t,r){if(!(this instanceof e))return new e(t,r);if(t instanceof n)this.set({r:t,s:r});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,r=!0,i=e.slice(0,1)[0]-27-4;i<0&&(r=!1,i+=4);var a=e.slice(1,33),c=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===c.length,new Error("s must be 32 bytes")),t.compressed=r,t.i=i,t.r=n.fromBuffer(a),t.s=n.fromBuffer(c),t},u.fromDER=u.fromBuffer=function(e,t){var r=u.parseDER(e,t),n=new u;return n.r=r.r,n.s=r.s,n},u.fromTxFormat=function(e){var t=e.readUInt8(e.length-1),r=e.slice(0,e.length-1),n=new u.fromDER(r,!1);return n.nhashtype=t,n},u.fromString=function(e){var r=new t(e,"hex");return u.fromDER(r)},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 r=e[0];o.checkArgument(48===r,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 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(484),e.exports.Interpreter=r(997)},function(e,t,r){var n=r(13);r(119),r(502),r(503),r(16),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 l in navigator)try{"string"==typeof navigator[l]&&(f+=navigator[l])}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 l in a)n.random[l]=a[l];else n.random=a;n.random.createInstance=s,e.exports=n.random}("undefined"!=typeof jQuery?jQuery:null)},function(e,t,r){(function(n){var i=r(70),o=r(590);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,h(),i?c():e(i=!0,c))}function l(t){h(),i||e(i=t,c)}function h(){t.on("finish",f),t.removeListener("close",f),t.removeListener("error",l)}t.on("close",f),t.on("finish",f),t.on("error",l),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 l=f,h=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)}:h(e,t):d(e)},t.sink=h,t.source=d,t.read=l,t.read1=f,t.read2=c,t.duplex=function(e,t){return{source:d(e),sink:h(e,t)}},t.transform=function(e){return function(t){var r=d(e);return h(e)(t),r}}}).call(this,r(3))},function(e,t,r){"use strict";e.exports=function e(t){var r=arguments.length;if("function"==typeof t&&1===t.length){for(var n=new Array(r),i=0;i=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 y(e,t){return e<>>32-t}function g(e,t){return e+t>>>0}function m(e,t,r){return e+t+r>>>0}function b(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 A(e,t,r,n,i,o,s,a,u,c){var f=0,l=t;l=l+n>>>0,f+=l>>0,f+=l>>0,f+=l>>0,f+=l>>0}function x(e,t,r,n,i,o,s,a,u,c){var f=t+n+o+a+c;return f>>>0}function C(e,t,r){var n=t<<32-r|e>>>r;return n>>>0}function T(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}function I(e,t,r){return e>>>r}function B(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=l,t.join32=h,t.split32=d,t.rotr32=p,t.rotl32=y,t.sum32=g,t.sum32_3=m,t.sum32_4=b,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=A,t.sum64_5_lo=x,t.rotr64_hi=C,t.rotr64_lo=T,t.shr64_hi=I,t.shr64_lo=B},function(e,t,r){const n=r(35),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}),l={BIP32Path:s,Buffer256bit:n.BufferN(32),ECPoint:c,Hash160bit:n.BufferN(20),Hash256bit:n.BufferN(32),Network:f,Satoshi:u,UInt31:o};for(var h in n)l[h]=n[h];e.exports=l},function(e,t,r){"use strict";var n=t;n.version=r(979).version,n.utils=r(980),n.rand=r(981),n.hmacDRBG=r(982),n.curve=r(224),n.curves=r(992),n.ec=r(994)},function(e,t,r){"use strict";(function(t){var n=r(39),i=r(133),o=r(45),s=r(34),a=r(117),u=r(15),c=r(21);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(225);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,l;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),l=e.slice(33,65),32!==a.length||32!==l.length||65!==e.length)throw new TypeError("Length of x and y must be 32 bytes");o=new n(a),s=new n(l),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(118);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";(function(t){const n=r(14),i=r(18),o=r(390),s=r(9),a=/^https?:\/\/[^/]+\/(ip(f|n)s)\/((\w+).*)/,u=/^\/(ip(f|n)s)\/((\w+).*)/,c=1,f=4,l=/^https?:\/\/([^/]+)\.(ip(?:f|n)s)\.[^/]+/,h=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 y(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 m(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===l&&(s=s.toLowerCase()),g(s)}function b(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===l){let e=o[n];return e=e.toLowerCase(),g(e)}return!0}function v(e){return t.isBuffer(e)?n.encode(e):"string"==typeof e&&e}const _=e=>m(e,l,2,1),w=e=>b(e,l,2,1);e.exports={multihash:p,cid:g,base32cid:e=>"base32"===y(e)&&g(e),ipfsSubdomain:_,ipnsSubdomain:w,subdomain:e=>_(e)||w(e),subdomainPattern:l,ipfsUrl:e=>m(e,a),ipnsUrl:e=>b(e,a),url:e=>m(e,a)||b(e,a),urlPattern:a,ipfsPath:e=>m(e,u),ipnsPath:e=>b(e,u),path:e=>m(e,u)||b(e,u),pathPattern:u,urlOrPath:e=>m(e,a)||b(e,a)||m(e,u)||b(e,u)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(53),i=r(192);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(393);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){function r(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}e.exports=r},function(e,t){var r=Array.isArray;e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(213),i=a(n),o=r(441),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){(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,l=n;l1&&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-h.length]+h+i:h+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="",y=this.clone();for(y.sign=!1;0!==y.cmpn(0);){var g=y.modn(p).toString(t);y=y.idivn(p),i=0!==y.cmpn(0)?a[d-g.length]+g+i:g+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],l=0|t.words[u],h=f*l,d=67108863&h;o=o+(h/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],l=t.words[u],h=f*l,d=67108863&h;o+=h/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!==l||f>=o);f--){var h=this.words[f];this.words[f]=l<<26-s|h>>>s,l=h&u}return c&&0!==l&&(c.words[c.length++]=l),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 l=0;l=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 l=o.clone(),h=n.clone();0!==n.cmpn(0);){for(;n.isEven();)n.ishrn(1),s.isEven()&&a.isEven()?(s.ishrn(1),a.ishrn(1)):(s.iadd(l).ishrn(1),a.isub(h).ishrn(1));for(;o.isEven();)o.ishrn(1),u.isEven()&&c.isEven()?(u.ishrn(1),c.ishrn(1)):(u.iadd(l).ishrn(1),c.isub(h).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 g(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 l(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(){l.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function d(){l.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function p(){l.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){l.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 m(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)}l.prototype._tmp=function e(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},l.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},l.prototype.split=function e(t,r){t.ishrn(this.n,0,r)},l.prototype.imulK=function e(t){return t.imul(this.k)},n(h,l),h.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},h.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 h;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 y}return f[t]=e,e},g.prototype._verify1=function e(t){r(!t.sign,"red works only with positives"),r(t.red,"red works only with red numbers")},g.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")},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 r=t.clone();return r.sign=!r.sign,r.iadd(this.m)._forceRed(this)},g.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)},g.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},g.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)},g.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},g.prototype.shl=function e(t,r){return this._verify1(t),this.imod(t.shln(r))},g.prototype.imul=function e(t,r){return this._verify2(t,r),this.imod(t.imul(r))},g.prototype.mul=function e(t,r){return this._verify2(t,r),this.imod(t.mul(r))},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 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(),l=this.m.subn(1).ishrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,l).cmp(f);)h.redIAdd(f);for(var d=this.pow(h,a),s=this.pow(t,a.addn(1).ishrn(1)),p=this.pow(t,a),y=u;0!==p.cmp(c);){for(var g=p,m=0;0!==g.cmp(c);m++)g=g.redSqr();r(m=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},m.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)},m.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(32)(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";const n=r(489),i=r(1010),o=r(1021);t=e.exports,t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(525),t.pbkdf2=r(1060)},function(e,t,r){var n=r(13);r(16),r(120);var i=e.exports=n.asn1=n.asn1||{};function o(e,t,r){if(r>t){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 y=new Error("Too few bytes to read ASN.1 value.");throw y.available=e.length(),y.remaining=t,y.requested=h,y}h=t}var g=32==(32&c);if(g)if(d=[],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(),d.push(a(e,t,r+1,n)),t-=u-e.length()}else for(;h>0;)u=e.length(),d.push(a(e,h,r+1,n)),t-=u-e.length(),h-=u-e.length();if(void 0===d&&f===i.Class.UNIVERSAL&&l===i.Type.BITSTRING&&(p=e.bytes(h)),void 0===d&&n.decodeBitStrings&&f===i.Class.UNIVERSAL&&l===i.Type.BITSTRING&&h>1){var m=e.read,b=t,v=0;if(l===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,l==i.Type.BITSTRING&&S++;var E=w.tagClass;S!==h||E!==i.Class.UNIVERSAL&&E!==i.Class.CONTEXT_SPECIFIC||(d=[w])}catch(e){}void 0===d&&(e.read=m,t=b)}if(void 0===d){if(void 0===h){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");h=t}if(l===i.Type.BMPSTRING)for(d="";h>0;h-=2)o(e,t,2),d+=String.fromCharCode(e.getInt16()),t-=2;else d=e.getBytes(h)}var k=void 0===p?null:{bitStringContents:p};return i.create(f,l,g,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),l=parseInt(e.substr(c+4,2),10),h=60*f+l;h*=6e4,"+"===u?t.setTime(+t-h):t.setTime(+t+h)}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 l=e.length-5,h=e.charAt(l);if("+"===h||"-"===h){var d=parseInt(e.substr(l+1,2),10),p=parseInt(e.substr(l+4,2),10);c=60*d+p,c*=6e4,"+"===h&&(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 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"+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(13);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},function(e,t,r){"use strict";const n=r(1135),i=C("dns4"),o=C("dns6"),s=x(C("dnsaddr"),i,o),a=x(C("ip4"),C("ip6")),u=x(A(a,C("tcp")),A(s,C("tcp"))),c=A(a,C("udp")),f=A(c,C("utp")),l=x(A(s,C("tcp")),s),h=x(A(u,C("ws")),A(l,C("ws"))),d=x(A(u,C("wss")),A(l,C("wss"))),p=x(A(u,C("http")),A(a,C("http")),A(l,C("http")),A(l)),y=x(A(u,C("https")),A(a,C("https")),A(l,C("https"))),g=x(A(h,C("p2p-webrtc-star"),C("ipfs")),A(d,C("p2p-webrtc-star"),C("ipfs"))),m=x(A(h,C("p2p-websocket-star"),C("ipfs")),A(d,C("p2p-websocket-star"),C("ipfs")),A(h,C("p2p-websocket-star")),A(d,C("p2p-websocket-star"))),b=x(A(p,C("p2p-webrtc-direct")),A(y,C("p2p-webrtc-direct"))),v=x(h,d,p,y,g,b,u,f);let _=x(A(v,C("ipfs")),g,C("ipfs"));const w=x(A(_,C("p2p-circuit"),_),A(_,C("p2p-circuit")),A(C("p2p-circuit"),_),A(v,C("p2p-circuit")),A(C("p2p-circuit"),v),C("p2p-circuit")),S=()=>x(A(w,S),w),E=S(),k=x(A(E,_,E),A(_,E),A(E,_),E,_);function A(){const e=Array.from(arguments);function t(e){"string"==typeof e&&(e=n(e));let t=r(e.protoNames());return null!==t&&0===t.length}function r(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:t,partialMatch:r}}function x(){const e=Array.from(arguments);function t(e){"string"==typeof e&&(e=n(e));const t=r(e.protoNames());return null!==t&&0===t.length}function r(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 i={toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:t,partialMatch:r};return i}function C(e){const t=e;function r(e){"string"==typeof e&&(e=n(e));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=l,t.DNS4=i,t.DNS6=o,t.IP=a,t.TCP=u,t.UDP=c,t.UTP=f,t.HTTP=p,t.HTTPS=y,t.WebSockets=h,t.WebSocketsSecure=d,t.WebSocketStar=m,t.WebRTCStar=g,t.WebRTCDirect=b,t.Reliable=v,t.Circuit=E,t.IPFS=k},function(e,t,r){"use strict";const n=t;n.bignum=r(31),n.define=r(1374).define,n.base=r(184),n.constants=r(616),n.decoders=r(1378),n.encoders=r(1380)},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";var n=r(274);e.exports=function e(t){return n(function(e,t){return e.push(t),e},[],t)}},function(e,t,r){var n=r(207),i=r(403);function o(e){return null!=e&&i(e.length)&&!n(e)}e.exports=o},function(e,t,r){e.exports=o;var n=r(11).EventEmitter,i=r(1);function o(){n.call(this)}i(o,n),o.Readable=r(12),o.Writable=r(825),o.Duplex=r(437),o.Transform=r(826),o.PassThrough=r(827),o.Stream=o,o.prototype.pipe=function(e,t){var r=this;function i(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(r.on("end",a),r.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 c(e){if(f(),0===n.listenerCount(this,"error"))throw e}function f(){r.removeListener("data",i),e.removeListener("drain",o),r.removeListener("end",a),r.removeListener("close",u),r.removeListener("error",c),e.removeListener("error",c),r.removeListener("end",f),r.removeListener("close",f),e.removeListener("close",f)}return r.on("error",c),e.on("error",c),r.on("end",f),r.on("close",f),e.on("close",f),e.emit("pipe",r),e}},function(e,t,r){const n=r(131);function i(e){return n("rmd160").update(e).digest()}function o(e){return n("sha1").update(e).digest()}function s(e){return n("sha256").update(e).digest()}function a(e){return i(s(e))}function u(e){return s(s(e))}e.exports={hash160:a,hash256:u,ripemd160:i,sha1:o,sha256:s}},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(21),o=r(25),s=r(39),a=function e(r){if(!(this instanceof e))return new e(r);if(!n.isUndefined(r))if(t.isBuffer(r))this.set({buf:r});else if(n.isString(r))this.set({buf:new t(r,"hex")});else{if(!n.isObject(r))throw new TypeError("Unrecognized argument for BufferReader");var i=r;this.set(i)}};a.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this.pos=e.pos||this.pos||0,this},a.prototype.eof=function(){return this.pos>=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 l.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){ /** * @file Web Cryptography API shim * @author Artem S Vybornov * @license MIT */ -e.exports=function e(t){"use strict";if("function"!=typeof Promise)throw"Promise support required";var r=t.crypto||t.msCrypto;if(r){var n=r.subtle||r.webkitSubtle;if(n){var i=t.Crypto||r.constructor||Object,o=t.SubtleCrypto||n.constructor||Object,s=t.CryptoKey||t.Key||Object,a=t.navigator.userAgent.indexOf("Edge/")>-1,u=!!t.msCrypto&&!a,c=!r.subtle&&!!r.webkitSubtle;if(u||c){var f={KoZIhvcNAQEB:"1.2.840.113549.1.1.1"},l={"1.2.840.113549.1.1.1":"KoZIhvcNAQEB"};if(["generateKey","importKey","unwrapKey"].forEach(function(e){var t=n[e];n[e]=function(i,o,s){var a=[].slice.call(arguments),f,l,h,d;switch(e){case"generateKey":f=m(i),l=o,h=s;break;case"importKey":f=m(s),l=a[3],h=a[4],"jwk"===i&&(o=v(o),o.alg||(o.alg=b(f)),o.key_ops||(o.key_ops="oct"!==o.kty?"d"in o?h.filter(C):h.filter(x):h.slice()),a[1]=_(o));break;case"unwrapKey":f=a[4],l=a[5],h=a[6],a[2]=s._key}if("generateKey"===e&&"HMAC"===f.name&&f.hash)return f.length=f.length||{"SHA-1":512,"SHA-256":512,"SHA-384":1024,"SHA-512":1024}[f.hash.name],n.importKey("raw",r.getRandomValues(new Uint8Array(f.length+7>>3)),f,l,h);if(c&&"generateKey"===e&&"RSASSA-PKCS1-v1_5"===f.name&&(!f.modulusLength||f.modulusLength>=2048))return i=m(i),i.name="RSAES-PKCS1-v1_5",delete i.hash,n.generateKey(i,!0,["encrypt","decrypt"]).then(function(e){return Promise.all([n.exportKey("jwk",e.publicKey),n.exportKey("jwk",e.privateKey)])}).then(function(e){return e[0].alg=e[1].alg=b(f),e[0].key_ops=h.filter(x),e[1].key_ops=h.filter(C),Promise.all([n.importKey("jwk",e[0],f,!0,e[0].key_ops),n.importKey("jwk",e[1],f,l,e[1].key_ops)])}).then(function(e){return{publicKey:e[0],privateKey:e[1]}});if((c||u&&"SHA-1"===(f.hash||{}).name)&&"importKey"===e&&"jwk"===i&&"HMAC"===f.name&&"oct"===o.kty)return n.importKey("raw",y(p(o.k)),s,a[3],a[4]);if(c&&"importKey"===e&&("spki"===i||"pkcs8"===i))return n.importKey("jwk",w(o),s,a[3],a[4]);if(u&&"unwrapKey"===e)return n.decrypt(a[3],s,o).then(function(e){return n.importKey(i,e,a[4],a[5],a[6])});try{d=t.apply(n,a)}catch(e){return Promise.reject(e)}return u&&(d=new Promise(function(e,t){d.onabort=d.onerror=function(e){t(e)},d.oncomplete=function(t){e(t.target.result)}})),d=d.then(function(e){return"HMAC"===f.name&&(f.length||(f.length=8*e.algorithm.length)),0==f.name.search("RSA")&&(f.modulusLength||(f.modulusLength=(e.publicKey||e).algorithm.modulusLength),f.publicExponent||(f.publicExponent=(e.publicKey||e).algorithm.publicExponent)),e=e.publicKey&&e.privateKey?{publicKey:new A(e.publicKey,f,l,h.filter(x)),privateKey:new A(e.privateKey,f,l,h.filter(C))}:new A(e,f,l,h),e}),d}}),["exportKey","wrapKey"].forEach(function(e){var t=n[e];n[e]=function(r,i,o){var s=[].slice.call(arguments),a;switch(e){case"exportKey":s[1]=i._key;break;case"wrapKey":s[1]=i._key,s[2]=o._key}if((c||u&&"SHA-1"===(i.algorithm.hash||{}).name)&&"exportKey"===e&&"jwk"===r&&"HMAC"===i.algorithm.name&&(s[0]="raw"),!c||"exportKey"!==e||"spki"!==r&&"pkcs8"!==r||(s[0]="jwk"),u&&"wrapKey"===e)return n.exportKey(r,i).then(function(e){return"jwk"===r&&(e=y(unescape(encodeURIComponent(JSON.stringify(v(e)))))),n.encrypt(s[3],o,e)});try{a=t.apply(n,s)}catch(e){return Promise.reject(e)}return u&&(a=new Promise(function(e,t){a.onabort=a.onerror=function(e){t(e)},a.oncomplete=function(t){e(t.target.result)}})),"exportKey"===e&&"jwk"===r&&(a=a.then(function(e){return(c||u&&"SHA-1"===(i.algorithm.hash||{}).name)&&"HMAC"===i.algorithm.name?{kty:"oct",alg:b(i.algorithm),key_ops:i.usages.slice(),ext:!0,k:d(g(e))}:(e=v(e),e.alg||(e.alg=b(i.algorithm)),e.key_ops||(e.key_ops="public"===i.type?i.usages.filter(x):"private"===i.type?i.usages.filter(C):i.usages.slice()),e)})),!c||"exportKey"!==e||"spki"!==r&&"pkcs8"!==r||(a=a.then(function(e){return e=S(v(e)),e})),a}}),["encrypt","decrypt","sign","verify"].forEach(function(e){var t=n[e];n[e]=function(r,i,o,s){if(u&&(!o.byteLength||s&&!s.byteLength))throw new Error("Empy input is not allowed");var a=[].slice.call(arguments),c=m(r),f;if(u&&"decrypt"===e&&"AES-GCM"===c.name){var l=r.tagLength>>3;a[2]=(o.buffer||o).slice(0,o.byteLength-l),r.tag=(o.buffer||o).slice(o.byteLength-l)}a[1]=i._key;try{f=t.apply(n,a)}catch(e){return Promise.reject(e)}return u&&(f=new Promise(function(t,r){f.onabort=f.onerror=function(e){r(e)},f.oncomplete=function(r){var r=r.target.result;if("encrypt"===e&&r instanceof AesGcmEncryptResult){var n=r.ciphertext,i=r.tag;r=new Uint8Array(n.byteLength+i.byteLength),r.set(new Uint8Array(n),0),r.set(new Uint8Array(i),n.byteLength),r=r.buffer}t(r)}})),f}}),u){var h=n.digest;n.digest=function(e,t){if(!t.byteLength)throw new Error("Empy input is not allowed");var r;try{r=h.call(n,e,t)}catch(e){return Promise.reject(e)}return r=new Promise(function(e,t){r.onabort=r.onerror=function(e){t(e)},r.oncomplete=function(t){e(t.target.result)}}),r},t.crypto=Object.create(r,{getRandomValues:{value:function(e){return r.getRandomValues(e)}},subtle:{value:n}}),t.CryptoKey=A}c&&(r.subtle=n,t.Crypto=i,t.SubtleCrypto=o,t.CryptoKey=A)}}}function d(e){return btoa(e).replace(/\=+$/,"").replace(/\+/g,"-").replace(/\//g,"_")}function p(e){return e+="===",e=e.slice(0,-e.length%4),atob(e.replace(/-/g,"+").replace(/_/g,"/"))}function y(e){for(var t=new Uint8Array(e.length),r=0;r2&&(r=!0,t.shift());var n={ext:!0};switch(t[0][0]){case"1.2.840.113549.1.1.1":var i=["n","e","d","p","q","dp","dq","qi"],o=E(t[1]);r&&o.shift();for(var s=0;s2&&(n=!0,o.unshift(new Uint8Array([0]))),r[0][0]="1.2.840.113549.1.1.1",t=o;break;default:throw new TypeError("Unsupported key type")}return r.push(new Uint8Array(k(t)).buffer),n?r.unshift(new Uint8Array([0])):r[1]={tag:3,value:r[1]},new Uint8Array(k(r)).buffer}function E(e,t){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),t||(t={pos:0,end:e.length}),t.end-t.pos<2||t.end>e.length)throw new RangeError("Malformed DER");var r=e[t.pos++],n=e[t.pos++],i;if(n>=128){if(n&=127,t.end-t.pos=128){var a=n,n=4;for(t.splice(i,0,a>>24&255,a>>16&255,a>>8&255,255&a);n>1&&!(a>>24);)a<<=8,n--;n<4&&t.splice(i,4-n),n|=128}return t.splice(i-2,2,r,n),t}function A(e,t,r,n){Object.defineProperties(this,{_key:{value:e},type:{value:e.type,enumerable:!0},extractable:{value:void 0===r?e.extractable:r,enumerable:!0},algorithm:{value:void 0===t?e.algorithm:t,enumerable:!0},usages:{value:void 0===n?e.usages:n,enumerable:!0}})}function x(e){return"verify"===e||"encrypt"===e||"wrapKey"===e}function C(e){return"sign"===e||"decrypt"===e||"unwrapKey"===e}}},function(e,t,r){var n=r(1032),i=r(1040),o=r(501);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){!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 y(e,t,r,n,i){var o,s=0;for(o=0;o>>8)-1}function g(e,t,r,n){return y(e,t,r,n,16)}function m(e,t,r,n){return y(e,t,r,n,32)}function b(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,l=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,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,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,g=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,m=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,b=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,A=c,x=f,C=l,T=h,I=d,B=p,O=y,P=g,R=m,N=b,j=v,L,M=0;M<20;M+=2)L=_+P|0,k^=L<<7|L>>>25,L=k+_|0,T^=L<<9|L>>>23,L=T+k|0,P^=L<<13|L>>>19,L=P+T|0,_^=L<<18|L>>>14,L=A+w|0,I^=L<<7|L>>>25,L=I+A|0,R^=L<<9|L>>>23,L=R+I|0,w^=L<<13|L>>>19,L=w+R|0,A^=L<<18|L>>>14,L=B+x|0,N^=L<<7|L>>>25,L=N+B|0,S^=L<<9|L>>>23,L=S+N|0,x^=L<<13|L>>>19,L=x+S|0,B^=L<<18|L>>>14,L=j+O|0,E^=L<<7|L>>>25,L=E+j|0,C^=L<<9|L>>>23,L=C+E|0,O^=L<<13|L>>>19,L=O+C|0,j^=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=A+k|0,x^=L<<7|L>>>25,L=x+A|0,C^=L<<9|L>>>23,L=C+x|0,k^=L<<13|L>>>19,L=k+C|0,A^=L<<18|L>>>14,L=B+I|0,O^=L<<7|L>>>25,L=O+B|0,T^=L<<9|L>>>23,L=T+O|0,I^=L<<13|L>>>19,L=I+T|0,B^=L<<18|L>>>14,L=j+N|0,P^=L<<7|L>>>25,L=P+j|0,R^=L<<9|L>>>23,L=R+P|0,N^=L<<13|L>>>19,L=N+R|0,j^=L<<18|L>>>14;_=_+i|0,w=w+o|0,S=S+s|0,E=E+a|0,k=k+u|0,A=A+c|0,x=x+f|0,C=C+l|0,T=T+h|0,I=I+d|0,B=B+p|0,O=O+y|0,P=P+g|0,R=R+m|0,N=N+b|0,j=j+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]=A>>>0&255,e[21]=A>>>8&255,e[22]=A>>>16&255,e[23]=A>>>24&255,e[24]=x>>>0&255,e[25]=x>>>8&255,e[26]=x>>>16&255,e[27]=x>>>24&255,e[28]=C>>>0&255,e[29]=C>>>8&255,e[30]=C>>>16&255,e[31]=C>>>24&255,e[32]=T>>>0&255,e[33]=T>>>8&255,e[34]=T>>>16&255,e[35]=T>>>24&255,e[36]=I>>>0&255,e[37]=I>>>8&255,e[38]=I>>>16&255,e[39]=I>>>24&255,e[40]=B>>>0&255,e[41]=B>>>8&255,e[42]=B>>>16&255,e[43]=B>>>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]=R>>>0&255,e[53]=R>>>8&255,e[54]=R>>>16&255,e[55]=R>>>24&255,e[56]=N>>>0&255,e[57]=N>>>8&255,e[58]=N>>>16&255,e[59]=N>>>24&255,e[60]=j>>>0&255,e[61]=j>>>8&255,e[62]=j>>>16&255,e[63]=j>>>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,l=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,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,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,g=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,m=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,b=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,A=c,x=f,C=l,T=h,I=d,B=p,O=y,P=g,R=m,N=b,j=v,L,M=0;M<20;M+=2)L=_+P|0,k^=L<<7|L>>>25,L=k+_|0,T^=L<<9|L>>>23,L=T+k|0,P^=L<<13|L>>>19,L=P+T|0,_^=L<<18|L>>>14,L=A+w|0,I^=L<<7|L>>>25,L=I+A|0,R^=L<<9|L>>>23,L=R+I|0,w^=L<<13|L>>>19,L=w+R|0,A^=L<<18|L>>>14,L=B+x|0,N^=L<<7|L>>>25,L=N+B|0,S^=L<<9|L>>>23,L=S+N|0,x^=L<<13|L>>>19,L=x+S|0,B^=L<<18|L>>>14,L=j+O|0,E^=L<<7|L>>>25,L=E+j|0,C^=L<<9|L>>>23,L=C+E|0,O^=L<<13|L>>>19,L=O+C|0,j^=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=A+k|0,x^=L<<7|L>>>25,L=x+A|0,C^=L<<9|L>>>23,L=C+x|0,k^=L<<13|L>>>19,L=k+C|0,A^=L<<18|L>>>14,L=B+I|0,O^=L<<7|L>>>25,L=O+B|0,T^=L<<9|L>>>23,L=T+O|0,I^=L<<13|L>>>19,L=I+T|0,B^=L<<18|L>>>14,L=j+N|0,P^=L<<7|L>>>25,L=P+j|0,R^=L<<9|L>>>23,L=R+P|0,N^=L<<13|L>>>19,L=N+R|0,j^=L<<18|L>>>14;e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=A>>>0&255,e[5]=A>>>8&255,e[6]=A>>>16&255,e[7]=A>>>24&255,e[8]=B>>>0&255,e[9]=B>>>8&255,e[10]=B>>>16&255,e[11]=B>>>24&255,e[12]=j>>>0&255,e[13]=j>>>8&255,e[14]=j>>>16&255,e[15]=j>>>24&255,e[16]=x>>>0&255,e[17]=x>>>8&255,e[18]=x>>>16&255,e[19]=x>>>24&255,e[20]=C>>>0&255,e[21]=C>>>8&255,e[22]=C>>>16&255,e[23]=C>>>24&255,e[24]=T>>>0&255,e[25]=T>>>8&255,e[26]=T>>>16&255,e[27]=T>>>24&255,e[28]=I>>>0&255,e[29]=I>>>8&255,e[30]=I>>>16&255,e[31]=I>>>24&255}function _(e,t,r,n){b(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 T(e,t,r,n,i,o){var s=new C(o);return s.update(r,n,i),s.finish(e,t),0}function I(e,t,r,n,i,o){var s=new Uint8Array(16);return T(s,0,r,n,i,o),g(e,t,s,0)}function B(e,t,r,n,i){var o;if(r<32)return-1;for(x(e,0,t,0,r,n,i),T(e,16,e,32,r-32,e),o=0;o<16;o++)e[o]=0;return 0}function O(e,t,r,n,i){var o,s=new Uint8Array(32);if(r<32)return-1;if(A(s,0,32,n,i),0!==I(t,16,t,32,r-32,s))return-1;for(x(e,0,t,0,r,n,i),o=0;o<32;o++)e[o]=0;return 0}function P(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function R(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 N(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 j(e,r){var n,i,o,s=t(),a=t();for(n=0;n<16;n++)a[n]=r[n];for(R(a),R(a),R(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,N(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 j(r,e),j(n,t),m(r,0,n,0)}function M(e){var t=new Uint8Array(32);return j(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 U(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function F(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function K(e,t,r){var n,i,o=0,s=0,a=0,u=0,c=0,f=0,l=0,h=0,d=0,p=0,y=0,g=0,m=0,b=0,v=0,_=0,w=0,S=0,E=0,k=0,A=0,x=0,C=0,T=0,I=0,B=0,O=0,P=0,R=0,N=0,j=0,L=r[0],M=r[1],D=r[2],U=r[3],F=r[4],K=r[5],q=r[6],H=r[7],z=r[8],V=r[9],G=r[10],W=r[11],$=r[12],Y=r[13],J=r[14],X=r[15];n=t[0],o+=n*L,s+=n*M,a+=n*D,u+=n*U,c+=n*F,f+=n*K,l+=n*q,h+=n*H,d+=n*z,p+=n*V,y+=n*G,g+=n*W,m+=n*$,b+=n*Y,v+=n*J,_+=n*X,n=t[1],s+=n*L,a+=n*M,u+=n*D,c+=n*U,f+=n*F,l+=n*K,h+=n*q,d+=n*H,p+=n*z,y+=n*V,g+=n*G,m+=n*W,b+=n*$,v+=n*Y,_+=n*J,w+=n*X,n=t[2],a+=n*L,u+=n*M,c+=n*D,f+=n*U,l+=n*F,h+=n*K,d+=n*q,p+=n*H,y+=n*z,g+=n*V,m+=n*G,b+=n*W,v+=n*$,_+=n*Y,w+=n*J,S+=n*X,n=t[3],u+=n*L,c+=n*M,f+=n*D,l+=n*U,h+=n*F,d+=n*K,p+=n*q,y+=n*H,g+=n*z,m+=n*V,b+=n*G,v+=n*W,_+=n*$,w+=n*Y,S+=n*J,E+=n*X,n=t[4],c+=n*L,f+=n*M,l+=n*D,h+=n*U,d+=n*F,p+=n*K,y+=n*q,g+=n*H,m+=n*z,b+=n*V,v+=n*G,_+=n*W,w+=n*$,S+=n*Y,E+=n*J,k+=n*X,n=t[5],f+=n*L,l+=n*M,h+=n*D,d+=n*U,p+=n*F,y+=n*K,g+=n*q,m+=n*H,b+=n*z,v+=n*V,_+=n*G,w+=n*W,S+=n*$,E+=n*Y,k+=n*J,A+=n*X,n=t[6],l+=n*L,h+=n*M,d+=n*D,p+=n*U,y+=n*F,g+=n*K,m+=n*q,b+=n*H,v+=n*z,_+=n*V,w+=n*G,S+=n*W,E+=n*$,k+=n*Y,A+=n*J,x+=n*X,n=t[7],h+=n*L,d+=n*M,p+=n*D,y+=n*U,g+=n*F,m+=n*K,b+=n*q,v+=n*H,_+=n*z,w+=n*V,S+=n*G,E+=n*W,k+=n*$,A+=n*Y,x+=n*J,C+=n*X,n=t[8],d+=n*L,p+=n*M,y+=n*D,g+=n*U,m+=n*F,b+=n*K,v+=n*q,_+=n*H,w+=n*z,S+=n*V,E+=n*G,k+=n*W,A+=n*$,x+=n*Y,C+=n*J,T+=n*X,n=t[9],p+=n*L,y+=n*M,g+=n*D,m+=n*U,b+=n*F,v+=n*K,_+=n*q,w+=n*H,S+=n*z,E+=n*V,k+=n*G,A+=n*W,x+=n*$,C+=n*Y,T+=n*J,I+=n*X,n=t[10],y+=n*L,g+=n*M,m+=n*D,b+=n*U,v+=n*F,_+=n*K,w+=n*q,S+=n*H,E+=n*z,k+=n*V,A+=n*G,x+=n*W,C+=n*$,T+=n*Y,I+=n*J,B+=n*X,n=t[11],g+=n*L,m+=n*M,b+=n*D,v+=n*U,_+=n*F,w+=n*K,S+=n*q,E+=n*H,k+=n*z,A+=n*V,x+=n*G,C+=n*W,T+=n*$,I+=n*Y,B+=n*J,O+=n*X,n=t[12],m+=n*L,b+=n*M,v+=n*D,_+=n*U,w+=n*F,S+=n*K,E+=n*q,k+=n*H,A+=n*z,x+=n*V,C+=n*G,T+=n*W,I+=n*$,B+=n*Y,O+=n*J,P+=n*X,n=t[13],b+=n*L,v+=n*M,_+=n*D,w+=n*U,S+=n*F,E+=n*K,k+=n*q,A+=n*H,x+=n*z,C+=n*V,T+=n*G,I+=n*W,B+=n*$,O+=n*Y,P+=n*J,R+=n*X,n=t[14],v+=n*L,_+=n*M,w+=n*D,S+=n*U,E+=n*F,k+=n*K,A+=n*q,x+=n*H,C+=n*z,T+=n*V,I+=n*G,B+=n*W,O+=n*$,P+=n*Y,R+=n*J,N+=n*X,n=t[15],_+=n*L,w+=n*M,S+=n*D,E+=n*U,k+=n*F,A+=n*K,x+=n*q,C+=n*H,T+=n*z,I+=n*V,B+=n*G,O+=n*W,P+=n*$,R+=n*Y,N+=n*J,j+=n*X,o+=38*w,s+=38*S,a+=38*E,u+=38*k,c+=38*A,f+=38*x,l+=38*C,h+=38*T,d+=38*I,p+=38*B,y+=38*O,g+=38*P,m+=38*R,b+=38*N,v+=38*j,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=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=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=y+i+65535,i=Math.floor(n/65536),y=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=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=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=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=y+i+65535,i=Math.floor(n/65536),y=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=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]=l,e[7]=h,e[8]=d,e[9]=p,e[10]=y,e[11]=g,e[12]=m,e[13]=b,e[14]=v,e[15]=_}function q(e,t){K(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--)q(n,n),2!==i&&4!==i&&K(n,n,r);for(i=0;i<16;i++)e[i]=n[i]}function z(e,r){var n=t(),i;for(i=0;i<16;i++)n[i]=r[i];for(i=250;i>=0;i--)q(n,n),1!==i&&K(n,n,r);for(i=0;i<16;i++)e[i]=n[i]}function V(e,r,n){var i=new Uint8Array(32),o=new Float64Array(80),s,a,c=t(),f=t(),l=t(),h=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],h[a]=c[a]=l[a]=0;for(c[0]=h[0]=1,a=254;a>=0;--a)s=i[a>>>3]>>>(7&a)&1,N(c,f,s),N(l,h,s),U(d,c,l),F(c,c,l),U(l,f,h),F(f,f,h),q(h,d),q(p,c),K(c,l,c),K(l,f,d),U(d,c,l),F(c,c,l),q(f,c),F(l,h,p),K(c,l,u),U(c,c,h),K(l,l,c),K(c,h,p),K(h,f,o),q(f,d),N(c,f,s),N(l,h,s);for(a=0;a<16;a++)o[a+16]=c[a],o[a+32]=l[a],o[a+48]=f[a],o[a+64]=h[a];var y=o.subarray(32),g=o.subarray(16);return H(y,y),K(g,g,y),j(e,g),0}function G(e,t){return V(e,t,o)}function W(e,t){return n(t,32),G(e,t)}function $(e,t,r){var n=new Uint8Array(32);return V(n,r,t),w(e,i,n,S)}C.prototype.blocks=function(e,t,r){for(var n=this.fin?0:2048,i,o,s,a,u,c,f,l,h,d,p,y,g,m,b,v,_,w,S,E=this.h[0],k=this.h[1],A=this.h[2],x=this.h[3],C=this.h[4],T=this.h[5],I=this.h[6],B=this.h[7],O=this.h[8],P=this.h[9],R=this.r[0],N=this.r[1],j=this.r[2],L=this.r[3],M=this.r[4],D=this.r[5],U=this.r[6],F=this.r[7],K=this.r[8],q=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,A+=8191&(o>>>10|s<<6),a=255&e[t+6]|(255&e[t+7])<<8,x+=8191&(s>>>7|a<<9),u=255&e[t+8]|(255&e[t+9])<<8,C+=8191&(a>>>4|u<<12),T+=u>>>1&8191,c=255&e[t+10]|(255&e[t+11])<<8,I+=8191&(u>>>14|c<<2),f=255&e[t+12]|(255&e[t+13])<<8,B+=8191&(c>>>11|f<<5),l=255&e[t+14]|(255&e[t+15])<<8,O+=8191&(f>>>8|l<<8),P+=l>>>5|n,h=0,d=h,d+=E*R,d+=k*(5*q),d+=A*(5*K),d+=x*(5*F),d+=C*(5*U),h=d>>>13,d&=8191,d+=T*(5*D),d+=I*(5*M),d+=B*(5*L),d+=O*(5*j),d+=P*(5*N),h+=d>>>13,d&=8191,p=h,p+=E*N,p+=k*R,p+=A*(5*q),p+=x*(5*K),p+=C*(5*F),h=p>>>13,p&=8191,p+=T*(5*U),p+=I*(5*D),p+=B*(5*M),p+=O*(5*L),p+=P*(5*j),h+=p>>>13,p&=8191,y=h,y+=E*j,y+=k*N,y+=A*R,y+=x*(5*q),y+=C*(5*K),h=y>>>13,y&=8191,y+=T*(5*F),y+=I*(5*U),y+=B*(5*D),y+=O*(5*M),y+=P*(5*L),h+=y>>>13,y&=8191,g=h,g+=E*L,g+=k*j,g+=A*N,g+=x*R,g+=C*(5*q),h=g>>>13,g&=8191,g+=T*(5*K),g+=I*(5*F),g+=B*(5*U),g+=O*(5*D),g+=P*(5*M),h+=g>>>13,g&=8191,m=h,m+=E*M,m+=k*L,m+=A*j,m+=x*N,m+=C*R,h=m>>>13,m&=8191,m+=T*(5*q),m+=I*(5*K),m+=B*(5*F),m+=O*(5*U),m+=P*(5*D),h+=m>>>13,m&=8191,b=h,b+=E*D,b+=k*M,b+=A*L,b+=x*j,b+=C*N,h=b>>>13,b&=8191,b+=T*R,b+=I*(5*q),b+=B*(5*K),b+=O*(5*F),b+=P*(5*U),h+=b>>>13,b&=8191,v=h,v+=E*U,v+=k*D,v+=A*M,v+=x*L,v+=C*j,h=v>>>13,v&=8191,v+=T*N,v+=I*R,v+=B*(5*q),v+=O*(5*K),v+=P*(5*F),h+=v>>>13,v&=8191,_=h,_+=E*F,_+=k*U,_+=A*D,_+=x*M,_+=C*L,h=_>>>13,_&=8191,_+=T*j,_+=I*N,_+=B*R,_+=O*(5*q),_+=P*(5*K),h+=_>>>13,_&=8191,w=h,w+=E*K,w+=k*F,w+=A*U,w+=x*D,w+=C*M,h=w>>>13,w&=8191,w+=T*L,w+=I*j,w+=B*N,w+=O*R,w+=P*(5*q),h+=w>>>13,w&=8191,S=h,S+=E*q,S+=k*K,S+=A*F,S+=x*U,S+=C*D,h=S>>>13,S&=8191,S+=T*M,S+=I*L,S+=B*j,S+=O*N,S+=P*R,h+=S>>>13,S&=8191,h=(h<<2)+h|0,h=h+d|0,d=8191&h,h>>>=13,p+=h,E=d,k=p,A=y,x=g,C=m,T=b,I=v,B=_,O=w,P=S,t+=16,r-=16;this.h[0]=E,this.h[1]=k,this.h[2]=A,this.h[3]=x,this.h[4]=C,this.h[5]=T,this.h[6]=I,this.h[7]=B,this.h[8]=O,this.h[9]=P},C.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},C.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++)A=8*k+$,i[k]=r[A+0]<<24|r[A+1]<<16|r[A+2]<<8|r[A+3],o[k]=r[A+4]<<24|r[A+5]<<16|r[A+6]<<8|r[A+7];for(k=0;k<80;k++)if(s=P,a=R,u=N,c=j,f=L,l=M,h=D,d=U,p=F,y=K,g=q,m=H,b=z,v=V,_=G,w=W,x=U,C=W,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=(L>>>14|z<<18)^(L>>>18|z<<14)^(z>>>9|L<<23),C=(z>>>14|L<<18)^(z>>>18|L<<14)^(L>>>9|z<<23),T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,x=L&M^~L&D,C=z&V^~z&G,T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,x=Q[2*k],C=Q[2*k+1],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,x=i[k%16],C=o[k%16],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,S=65535&B|O<<16,E=65535&T|I<<16,x=S,C=E,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=(P>>>28|F<<4)^(F>>>2|P<<30)^(F>>>7|P<<25),C=(F>>>28|P<<4)^(P>>>2|F<<30)^(P>>>7|F<<25),T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,x=P&R^P&N^R&N,C=F&K^F&q^K&q,T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,d=65535&B|O<<16,w=65535&T|I<<16,x=c,C=m,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=S,C=E,T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,c=65535&B|O<<16,m=65535&T|I<<16,R=s,N=a,j=u,L=c,M=f,D=l,U=h,P=d,K=p,q=y,H=g,z=m,V=b,G=v,W=_,F=w,k%16==15)for(A=0;A<16;A++)x=i[A],C=o[A],T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=i[(A+9)%16],C=o[(A+9)%16],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,S=i[(A+1)%16],E=o[(A+1)%16],x=(S>>>1|E<<31)^(S>>>8|E<<24)^S>>>7,C=(E>>>1|S<<31)^(E>>>8|S<<24)^(E>>>7|S<<25),T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,S=i[(A+14)%16],E=o[(A+14)%16],x=(S>>>19|E<<13)^(E>>>29|S<<3)^S>>>6,C=(E>>>19|S<<13)^(S>>>29|E<<3)^(E>>>6|S<<26),T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,i[A]=65535&B|O<<16,o[A]=65535&T|I<<16;x=P,C=F,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=e[0],C=t[0],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,e[0]=P=65535&B|O<<16,t[0]=F=65535&T|I<<16,x=R,C=K,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=e[1],C=t[1],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,e[1]=R=65535&B|O<<16,t[1]=K=65535&T|I<<16,x=N,C=q,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=e[2],C=t[2],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,e[2]=N=65535&B|O<<16,t[2]=q=65535&T|I<<16,x=j,C=H,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=e[3],C=t[3],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,e[3]=j=65535&B|O<<16,t[3]=H=65535&T|I<<16,x=L,C=z,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=e[4],C=t[4],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,e[4]=L=65535&B|O<<16,t[4]=z=65535&T|I<<16,x=M,C=V,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=e[5],C=t[5],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,e[5]=M=65535&B|O<<16,t[5]=V=65535&T|I<<16,x=D,C=G,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=e[6],C=t[6],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,e[6]=D=65535&B|O<<16,t[6]=G=65535&T|I<<16,x=U,C=W,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=e[7],C=t[7],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,e[7]=U=65535&B|O<<16,t[7]=W=65535&T|I<<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()];P(n[0],l),P(n[1],h),P(n[2],a),K(n[3],l,h),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 le(e,r,n,i){var o=new Uint8Array(64),s=new Uint8Array(64),a=new Uint8Array(64),u,c,f=new Float64Array(64),l=[t(),t(),t(),t()];te(o,i,32),o[0]&=248,o[31]&=127,o[31]|=64;var h=n+64;for(u=0;u>7&&F(e[0],s,e[0]),K(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(he(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(Re(e),64!==e.length)throw new Error("bad secret key size");for(var t=new Uint8Array(32),r=0;r{i=i||r(1071)(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){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?l(e,t,o,"day"):t>=i?l(e,t,i,"hour"):t>=n?l(e,t,n,"minute"):t>=r?l(e,t,r,"second"):e+" ms"}function l(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";var n=r(206),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=l;var o=r(157);o.inherits=r(1);var s=r(386),a=r(390);o.inherits(l,s);for(var u=i(a.prototype),c=0;c-1,u=!!t.msCrypto&&!a,c=!r.subtle&&!!r.webkitSubtle;if(u||c){var f={KoZIhvcNAQEB:"1.2.840.113549.1.1.1"},l={"1.2.840.113549.1.1.1":"KoZIhvcNAQEB"};if(["generateKey","importKey","unwrapKey"].forEach(function(e){var t=n[e];n[e]=function(i,o,s){var a=[].slice.call(arguments),f,l,h,d;switch(e){case"generateKey":f=m(i),l=o,h=s;break;case"importKey":f=m(s),l=a[3],h=a[4],"jwk"===i&&(o=v(o),o.alg||(o.alg=b(f)),o.key_ops||(o.key_ops="oct"!==o.kty?"d"in o?h.filter(C):h.filter(x):h.slice()),a[1]=_(o));break;case"unwrapKey":f=a[4],l=a[5],h=a[6],a[2]=s._key}if("generateKey"===e&&"HMAC"===f.name&&f.hash)return f.length=f.length||{"SHA-1":512,"SHA-256":512,"SHA-384":1024,"SHA-512":1024}[f.hash.name],n.importKey("raw",r.getRandomValues(new Uint8Array(f.length+7>>3)),f,l,h);if(c&&"generateKey"===e&&"RSASSA-PKCS1-v1_5"===f.name&&(!f.modulusLength||f.modulusLength>=2048))return i=m(i),i.name="RSAES-PKCS1-v1_5",delete i.hash,n.generateKey(i,!0,["encrypt","decrypt"]).then(function(e){return Promise.all([n.exportKey("jwk",e.publicKey),n.exportKey("jwk",e.privateKey)])}).then(function(e){return e[0].alg=e[1].alg=b(f),e[0].key_ops=h.filter(x),e[1].key_ops=h.filter(C),Promise.all([n.importKey("jwk",e[0],f,!0,e[0].key_ops),n.importKey("jwk",e[1],f,l,e[1].key_ops)])}).then(function(e){return{publicKey:e[0],privateKey:e[1]}});if((c||u&&"SHA-1"===(f.hash||{}).name)&&"importKey"===e&&"jwk"===i&&"HMAC"===f.name&&"oct"===o.kty)return n.importKey("raw",y(p(o.k)),s,a[3],a[4]);if(c&&"importKey"===e&&("spki"===i||"pkcs8"===i))return n.importKey("jwk",w(o),s,a[3],a[4]);if(u&&"unwrapKey"===e)return n.decrypt(a[3],s,o).then(function(e){return n.importKey(i,e,a[4],a[5],a[6])});try{d=t.apply(n,a)}catch(e){return Promise.reject(e)}return u&&(d=new Promise(function(e,t){d.onabort=d.onerror=function(e){t(e)},d.oncomplete=function(t){e(t.target.result)}})),d=d.then(function(e){return"HMAC"===f.name&&(f.length||(f.length=8*e.algorithm.length)),0==f.name.search("RSA")&&(f.modulusLength||(f.modulusLength=(e.publicKey||e).algorithm.modulusLength),f.publicExponent||(f.publicExponent=(e.publicKey||e).algorithm.publicExponent)),e=e.publicKey&&e.privateKey?{publicKey:new A(e.publicKey,f,l,h.filter(x)),privateKey:new A(e.privateKey,f,l,h.filter(C))}:new A(e,f,l,h),e}),d}}),["exportKey","wrapKey"].forEach(function(e){var t=n[e];n[e]=function(r,i,o){var s=[].slice.call(arguments),a;switch(e){case"exportKey":s[1]=i._key;break;case"wrapKey":s[1]=i._key,s[2]=o._key}if((c||u&&"SHA-1"===(i.algorithm.hash||{}).name)&&"exportKey"===e&&"jwk"===r&&"HMAC"===i.algorithm.name&&(s[0]="raw"),!c||"exportKey"!==e||"spki"!==r&&"pkcs8"!==r||(s[0]="jwk"),u&&"wrapKey"===e)return n.exportKey(r,i).then(function(e){return"jwk"===r&&(e=y(unescape(encodeURIComponent(JSON.stringify(v(e)))))),n.encrypt(s[3],o,e)});try{a=t.apply(n,s)}catch(e){return Promise.reject(e)}return u&&(a=new Promise(function(e,t){a.onabort=a.onerror=function(e){t(e)},a.oncomplete=function(t){e(t.target.result)}})),"exportKey"===e&&"jwk"===r&&(a=a.then(function(e){return(c||u&&"SHA-1"===(i.algorithm.hash||{}).name)&&"HMAC"===i.algorithm.name?{kty:"oct",alg:b(i.algorithm),key_ops:i.usages.slice(),ext:!0,k:d(g(e))}:(e=v(e),e.alg||(e.alg=b(i.algorithm)),e.key_ops||(e.key_ops="public"===i.type?i.usages.filter(x):"private"===i.type?i.usages.filter(C):i.usages.slice()),e)})),!c||"exportKey"!==e||"spki"!==r&&"pkcs8"!==r||(a=a.then(function(e){return e=S(v(e)),e})),a}}),["encrypt","decrypt","sign","verify"].forEach(function(e){var t=n[e];n[e]=function(r,i,o,s){if(u&&(!o.byteLength||s&&!s.byteLength))throw new Error("Empy input is not allowed");var a=[].slice.call(arguments),c=m(r),f;if(u&&"decrypt"===e&&"AES-GCM"===c.name){var l=r.tagLength>>3;a[2]=(o.buffer||o).slice(0,o.byteLength-l),r.tag=(o.buffer||o).slice(o.byteLength-l)}a[1]=i._key;try{f=t.apply(n,a)}catch(e){return Promise.reject(e)}return u&&(f=new Promise(function(t,r){f.onabort=f.onerror=function(e){r(e)},f.oncomplete=function(r){var r=r.target.result;if("encrypt"===e&&r instanceof AesGcmEncryptResult){var n=r.ciphertext,i=r.tag;r=new Uint8Array(n.byteLength+i.byteLength),r.set(new Uint8Array(n),0),r.set(new Uint8Array(i),n.byteLength),r=r.buffer}t(r)}})),f}}),u){var h=n.digest;n.digest=function(e,t){if(!t.byteLength)throw new Error("Empy input is not allowed");var r;try{r=h.call(n,e,t)}catch(e){return Promise.reject(e)}return r=new Promise(function(e,t){r.onabort=r.onerror=function(e){t(e)},r.oncomplete=function(t){e(t.target.result)}}),r},t.crypto=Object.create(r,{getRandomValues:{value:function(e){return r.getRandomValues(e)}},subtle:{value:n}}),t.CryptoKey=A}c&&(r.subtle=n,t.Crypto=i,t.SubtleCrypto=o,t.CryptoKey=A)}}}function d(e){return btoa(e).replace(/\=+$/,"").replace(/\+/g,"-").replace(/\//g,"_")}function p(e){return e+="===",e=e.slice(0,-e.length%4),atob(e.replace(/-/g,"+").replace(/_/g,"/"))}function y(e){for(var t=new Uint8Array(e.length),r=0;r2&&(r=!0,t.shift());var n={ext:!0};switch(t[0][0]){case"1.2.840.113549.1.1.1":var i=["n","e","d","p","q","dp","dq","qi"],o=E(t[1]);r&&o.shift();for(var s=0;s2&&(n=!0,o.unshift(new Uint8Array([0]))),r[0][0]="1.2.840.113549.1.1.1",t=o;break;default:throw new TypeError("Unsupported key type")}return r.push(new Uint8Array(k(t)).buffer),n?r.unshift(new Uint8Array([0])):r[1]={tag:3,value:r[1]},new Uint8Array(k(r)).buffer}function E(e,t){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),t||(t={pos:0,end:e.length}),t.end-t.pos<2||t.end>e.length)throw new RangeError("Malformed DER");var r=e[t.pos++],n=e[t.pos++],i;if(n>=128){if(n&=127,t.end-t.pos=128){var a=n,n=4;for(t.splice(i,0,a>>24&255,a>>16&255,a>>8&255,255&a);n>1&&!(a>>24);)a<<=8,n--;n<4&&t.splice(i,4-n),n|=128}return t.splice(i-2,2,r,n),t}function A(e,t,r,n){Object.defineProperties(this,{_key:{value:e},type:{value:e.type,enumerable:!0},extractable:{value:void 0===r?e.extractable:r,enumerable:!0},algorithm:{value:void 0===t?e.algorithm:t,enumerable:!0},usages:{value:void 0===n?e.usages:n,enumerable:!0}})}function x(e){return"verify"===e||"encrypt"===e||"wrapKey"===e}function C(e){return"sign"===e||"decrypt"===e||"unwrapKey"===e}}},function(e,t,r){var n=r(1012),i=r(1020),o=r(493);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){!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 y(e,t,r,n,i){var o,s=0;for(o=0;o>>8)-1}function g(e,t,r,n){return y(e,t,r,n,16)}function m(e,t,r,n){return y(e,t,r,n,32)}function b(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,l=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,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,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,g=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,m=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,b=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,A=c,x=f,C=l,T=h,I=d,B=p,O=y,P=g,R=m,N=b,j=v,L,M=0;M<20;M+=2)L=_+P|0,k^=L<<7|L>>>25,L=k+_|0,T^=L<<9|L>>>23,L=T+k|0,P^=L<<13|L>>>19,L=P+T|0,_^=L<<18|L>>>14,L=A+w|0,I^=L<<7|L>>>25,L=I+A|0,R^=L<<9|L>>>23,L=R+I|0,w^=L<<13|L>>>19,L=w+R|0,A^=L<<18|L>>>14,L=B+x|0,N^=L<<7|L>>>25,L=N+B|0,S^=L<<9|L>>>23,L=S+N|0,x^=L<<13|L>>>19,L=x+S|0,B^=L<<18|L>>>14,L=j+O|0,E^=L<<7|L>>>25,L=E+j|0,C^=L<<9|L>>>23,L=C+E|0,O^=L<<13|L>>>19,L=O+C|0,j^=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=A+k|0,x^=L<<7|L>>>25,L=x+A|0,C^=L<<9|L>>>23,L=C+x|0,k^=L<<13|L>>>19,L=k+C|0,A^=L<<18|L>>>14,L=B+I|0,O^=L<<7|L>>>25,L=O+B|0,T^=L<<9|L>>>23,L=T+O|0,I^=L<<13|L>>>19,L=I+T|0,B^=L<<18|L>>>14,L=j+N|0,P^=L<<7|L>>>25,L=P+j|0,R^=L<<9|L>>>23,L=R+P|0,N^=L<<13|L>>>19,L=N+R|0,j^=L<<18|L>>>14;_=_+i|0,w=w+o|0,S=S+s|0,E=E+a|0,k=k+u|0,A=A+c|0,x=x+f|0,C=C+l|0,T=T+h|0,I=I+d|0,B=B+p|0,O=O+y|0,P=P+g|0,R=R+m|0,N=N+b|0,j=j+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]=A>>>0&255,e[21]=A>>>8&255,e[22]=A>>>16&255,e[23]=A>>>24&255,e[24]=x>>>0&255,e[25]=x>>>8&255,e[26]=x>>>16&255,e[27]=x>>>24&255,e[28]=C>>>0&255,e[29]=C>>>8&255,e[30]=C>>>16&255,e[31]=C>>>24&255,e[32]=T>>>0&255,e[33]=T>>>8&255,e[34]=T>>>16&255,e[35]=T>>>24&255,e[36]=I>>>0&255,e[37]=I>>>8&255,e[38]=I>>>16&255,e[39]=I>>>24&255,e[40]=B>>>0&255,e[41]=B>>>8&255,e[42]=B>>>16&255,e[43]=B>>>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]=R>>>0&255,e[53]=R>>>8&255,e[54]=R>>>16&255,e[55]=R>>>24&255,e[56]=N>>>0&255,e[57]=N>>>8&255,e[58]=N>>>16&255,e[59]=N>>>24&255,e[60]=j>>>0&255,e[61]=j>>>8&255,e[62]=j>>>16&255,e[63]=j>>>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,l=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,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,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,g=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,m=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,b=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,A=c,x=f,C=l,T=h,I=d,B=p,O=y,P=g,R=m,N=b,j=v,L,M=0;M<20;M+=2)L=_+P|0,k^=L<<7|L>>>25,L=k+_|0,T^=L<<9|L>>>23,L=T+k|0,P^=L<<13|L>>>19,L=P+T|0,_^=L<<18|L>>>14,L=A+w|0,I^=L<<7|L>>>25,L=I+A|0,R^=L<<9|L>>>23,L=R+I|0,w^=L<<13|L>>>19,L=w+R|0,A^=L<<18|L>>>14,L=B+x|0,N^=L<<7|L>>>25,L=N+B|0,S^=L<<9|L>>>23,L=S+N|0,x^=L<<13|L>>>19,L=x+S|0,B^=L<<18|L>>>14,L=j+O|0,E^=L<<7|L>>>25,L=E+j|0,C^=L<<9|L>>>23,L=C+E|0,O^=L<<13|L>>>19,L=O+C|0,j^=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=A+k|0,x^=L<<7|L>>>25,L=x+A|0,C^=L<<9|L>>>23,L=C+x|0,k^=L<<13|L>>>19,L=k+C|0,A^=L<<18|L>>>14,L=B+I|0,O^=L<<7|L>>>25,L=O+B|0,T^=L<<9|L>>>23,L=T+O|0,I^=L<<13|L>>>19,L=I+T|0,B^=L<<18|L>>>14,L=j+N|0,P^=L<<7|L>>>25,L=P+j|0,R^=L<<9|L>>>23,L=R+P|0,N^=L<<13|L>>>19,L=N+R|0,j^=L<<18|L>>>14;e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=A>>>0&255,e[5]=A>>>8&255,e[6]=A>>>16&255,e[7]=A>>>24&255,e[8]=B>>>0&255,e[9]=B>>>8&255,e[10]=B>>>16&255,e[11]=B>>>24&255,e[12]=j>>>0&255,e[13]=j>>>8&255,e[14]=j>>>16&255,e[15]=j>>>24&255,e[16]=x>>>0&255,e[17]=x>>>8&255,e[18]=x>>>16&255,e[19]=x>>>24&255,e[20]=C>>>0&255,e[21]=C>>>8&255,e[22]=C>>>16&255,e[23]=C>>>24&255,e[24]=T>>>0&255,e[25]=T>>>8&255,e[26]=T>>>16&255,e[27]=T>>>24&255,e[28]=I>>>0&255,e[29]=I>>>8&255,e[30]=I>>>16&255,e[31]=I>>>24&255}function _(e,t,r,n){b(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 T(e,t,r,n,i,o){var s=new C(o);return s.update(r,n,i),s.finish(e,t),0}function I(e,t,r,n,i,o){var s=new Uint8Array(16);return T(s,0,r,n,i,o),g(e,t,s,0)}function B(e,t,r,n,i){var o;if(r<32)return-1;for(x(e,0,t,0,r,n,i),T(e,16,e,32,r-32,e),o=0;o<16;o++)e[o]=0;return 0}function O(e,t,r,n,i){var o,s=new Uint8Array(32);if(r<32)return-1;if(A(s,0,32,n,i),0!==I(t,16,t,32,r-32,s))return-1;for(x(e,0,t,0,r,n,i),o=0;o<32;o++)e[o]=0;return 0}function P(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function R(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 N(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 j(e,r){var n,i,o,s=t(),a=t();for(n=0;n<16;n++)a[n]=r[n];for(R(a),R(a),R(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,N(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 j(r,e),j(n,t),m(r,0,n,0)}function M(e){var t=new Uint8Array(32);return j(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 U(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function F(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function K(e,t,r){var n,i,o=0,s=0,a=0,u=0,c=0,f=0,l=0,h=0,d=0,p=0,y=0,g=0,m=0,b=0,v=0,_=0,w=0,S=0,E=0,k=0,A=0,x=0,C=0,T=0,I=0,B=0,O=0,P=0,R=0,N=0,j=0,L=r[0],M=r[1],D=r[2],U=r[3],F=r[4],K=r[5],q=r[6],H=r[7],z=r[8],V=r[9],G=r[10],W=r[11],$=r[12],Y=r[13],J=r[14],Z=r[15];n=t[0],o+=n*L,s+=n*M,a+=n*D,u+=n*U,c+=n*F,f+=n*K,l+=n*q,h+=n*H,d+=n*z,p+=n*V,y+=n*G,g+=n*W,m+=n*$,b+=n*Y,v+=n*J,_+=n*Z,n=t[1],s+=n*L,a+=n*M,u+=n*D,c+=n*U,f+=n*F,l+=n*K,h+=n*q,d+=n*H,p+=n*z,y+=n*V,g+=n*G,m+=n*W,b+=n*$,v+=n*Y,_+=n*J,w+=n*Z,n=t[2],a+=n*L,u+=n*M,c+=n*D,f+=n*U,l+=n*F,h+=n*K,d+=n*q,p+=n*H,y+=n*z,g+=n*V,m+=n*G,b+=n*W,v+=n*$,_+=n*Y,w+=n*J,S+=n*Z,n=t[3],u+=n*L,c+=n*M,f+=n*D,l+=n*U,h+=n*F,d+=n*K,p+=n*q,y+=n*H,g+=n*z,m+=n*V,b+=n*G,v+=n*W,_+=n*$,w+=n*Y,S+=n*J,E+=n*Z,n=t[4],c+=n*L,f+=n*M,l+=n*D,h+=n*U,d+=n*F,p+=n*K,y+=n*q,g+=n*H,m+=n*z,b+=n*V,v+=n*G,_+=n*W,w+=n*$,S+=n*Y,E+=n*J,k+=n*Z,n=t[5],f+=n*L,l+=n*M,h+=n*D,d+=n*U,p+=n*F,y+=n*K,g+=n*q,m+=n*H,b+=n*z,v+=n*V,_+=n*G,w+=n*W,S+=n*$,E+=n*Y,k+=n*J,A+=n*Z,n=t[6],l+=n*L,h+=n*M,d+=n*D,p+=n*U,y+=n*F,g+=n*K,m+=n*q,b+=n*H,v+=n*z,_+=n*V,w+=n*G,S+=n*W,E+=n*$,k+=n*Y,A+=n*J,x+=n*Z,n=t[7],h+=n*L,d+=n*M,p+=n*D,y+=n*U,g+=n*F,m+=n*K,b+=n*q,v+=n*H,_+=n*z,w+=n*V,S+=n*G,E+=n*W,k+=n*$,A+=n*Y,x+=n*J,C+=n*Z,n=t[8],d+=n*L,p+=n*M,y+=n*D,g+=n*U,m+=n*F,b+=n*K,v+=n*q,_+=n*H,w+=n*z,S+=n*V,E+=n*G,k+=n*W,A+=n*$,x+=n*Y,C+=n*J,T+=n*Z,n=t[9],p+=n*L,y+=n*M,g+=n*D,m+=n*U,b+=n*F,v+=n*K,_+=n*q,w+=n*H,S+=n*z,E+=n*V,k+=n*G,A+=n*W,x+=n*$,C+=n*Y,T+=n*J,I+=n*Z,n=t[10],y+=n*L,g+=n*M,m+=n*D,b+=n*U,v+=n*F,_+=n*K,w+=n*q,S+=n*H,E+=n*z,k+=n*V,A+=n*G,x+=n*W,C+=n*$,T+=n*Y,I+=n*J,B+=n*Z,n=t[11],g+=n*L,m+=n*M,b+=n*D,v+=n*U,_+=n*F,w+=n*K,S+=n*q,E+=n*H,k+=n*z,A+=n*V,x+=n*G,C+=n*W,T+=n*$,I+=n*Y,B+=n*J,O+=n*Z,n=t[12],m+=n*L,b+=n*M,v+=n*D,_+=n*U,w+=n*F,S+=n*K,E+=n*q,k+=n*H,A+=n*z,x+=n*V,C+=n*G,T+=n*W,I+=n*$,B+=n*Y,O+=n*J,P+=n*Z,n=t[13],b+=n*L,v+=n*M,_+=n*D,w+=n*U,S+=n*F,E+=n*K,k+=n*q,A+=n*H,x+=n*z,C+=n*V,T+=n*G,I+=n*W,B+=n*$,O+=n*Y,P+=n*J,R+=n*Z,n=t[14],v+=n*L,_+=n*M,w+=n*D,S+=n*U,E+=n*F,k+=n*K,A+=n*q,x+=n*H,C+=n*z,T+=n*V,I+=n*G,B+=n*W,O+=n*$,P+=n*Y,R+=n*J,N+=n*Z,n=t[15],_+=n*L,w+=n*M,S+=n*D,E+=n*U,k+=n*F,A+=n*K,x+=n*q,C+=n*H,T+=n*z,I+=n*V,B+=n*G,O+=n*W,P+=n*$,R+=n*Y,N+=n*J,j+=n*Z,o+=38*w,s+=38*S,a+=38*E,u+=38*k,c+=38*A,f+=38*x,l+=38*C,h+=38*T,d+=38*I,p+=38*B,y+=38*O,g+=38*P,m+=38*R,b+=38*N,v+=38*j,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=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=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=y+i+65535,i=Math.floor(n/65536),y=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=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=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=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=y+i+65535,i=Math.floor(n/65536),y=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=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]=l,e[7]=h,e[8]=d,e[9]=p,e[10]=y,e[11]=g,e[12]=m,e[13]=b,e[14]=v,e[15]=_}function q(e,t){K(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--)q(n,n),2!==i&&4!==i&&K(n,n,r);for(i=0;i<16;i++)e[i]=n[i]}function z(e,r){var n=t(),i;for(i=0;i<16;i++)n[i]=r[i];for(i=250;i>=0;i--)q(n,n),1!==i&&K(n,n,r);for(i=0;i<16;i++)e[i]=n[i]}function V(e,r,n){var i=new Uint8Array(32),o=new Float64Array(80),s,a,c=t(),f=t(),l=t(),h=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],h[a]=c[a]=l[a]=0;for(c[0]=h[0]=1,a=254;a>=0;--a)s=i[a>>>3]>>>(7&a)&1,N(c,f,s),N(l,h,s),U(d,c,l),F(c,c,l),U(l,f,h),F(f,f,h),q(h,d),q(p,c),K(c,l,c),K(l,f,d),U(d,c,l),F(c,c,l),q(f,c),F(l,h,p),K(c,l,u),U(c,c,h),K(l,l,c),K(c,h,p),K(h,f,o),q(f,d),N(c,f,s),N(l,h,s);for(a=0;a<16;a++)o[a+16]=c[a],o[a+32]=l[a],o[a+48]=f[a],o[a+64]=h[a];var y=o.subarray(32),g=o.subarray(16);return H(y,y),K(g,g,y),j(e,g),0}function G(e,t){return V(e,t,o)}function W(e,t){return n(t,32),G(e,t)}function $(e,t,r){var n=new Uint8Array(32);return V(n,r,t),w(e,i,n,S)}C.prototype.blocks=function(e,t,r){for(var n=this.fin?0:2048,i,o,s,a,u,c,f,l,h,d,p,y,g,m,b,v,_,w,S,E=this.h[0],k=this.h[1],A=this.h[2],x=this.h[3],C=this.h[4],T=this.h[5],I=this.h[6],B=this.h[7],O=this.h[8],P=this.h[9],R=this.r[0],N=this.r[1],j=this.r[2],L=this.r[3],M=this.r[4],D=this.r[5],U=this.r[6],F=this.r[7],K=this.r[8],q=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,A+=8191&(o>>>10|s<<6),a=255&e[t+6]|(255&e[t+7])<<8,x+=8191&(s>>>7|a<<9),u=255&e[t+8]|(255&e[t+9])<<8,C+=8191&(a>>>4|u<<12),T+=u>>>1&8191,c=255&e[t+10]|(255&e[t+11])<<8,I+=8191&(u>>>14|c<<2),f=255&e[t+12]|(255&e[t+13])<<8,B+=8191&(c>>>11|f<<5),l=255&e[t+14]|(255&e[t+15])<<8,O+=8191&(f>>>8|l<<8),P+=l>>>5|n,h=0,d=h,d+=E*R,d+=k*(5*q),d+=A*(5*K),d+=x*(5*F),d+=C*(5*U),h=d>>>13,d&=8191,d+=T*(5*D),d+=I*(5*M),d+=B*(5*L),d+=O*(5*j),d+=P*(5*N),h+=d>>>13,d&=8191,p=h,p+=E*N,p+=k*R,p+=A*(5*q),p+=x*(5*K),p+=C*(5*F),h=p>>>13,p&=8191,p+=T*(5*U),p+=I*(5*D),p+=B*(5*M),p+=O*(5*L),p+=P*(5*j),h+=p>>>13,p&=8191,y=h,y+=E*j,y+=k*N,y+=A*R,y+=x*(5*q),y+=C*(5*K),h=y>>>13,y&=8191,y+=T*(5*F),y+=I*(5*U),y+=B*(5*D),y+=O*(5*M),y+=P*(5*L),h+=y>>>13,y&=8191,g=h,g+=E*L,g+=k*j,g+=A*N,g+=x*R,g+=C*(5*q),h=g>>>13,g&=8191,g+=T*(5*K),g+=I*(5*F),g+=B*(5*U),g+=O*(5*D),g+=P*(5*M),h+=g>>>13,g&=8191,m=h,m+=E*M,m+=k*L,m+=A*j,m+=x*N,m+=C*R,h=m>>>13,m&=8191,m+=T*(5*q),m+=I*(5*K),m+=B*(5*F),m+=O*(5*U),m+=P*(5*D),h+=m>>>13,m&=8191,b=h,b+=E*D,b+=k*M,b+=A*L,b+=x*j,b+=C*N,h=b>>>13,b&=8191,b+=T*R,b+=I*(5*q),b+=B*(5*K),b+=O*(5*F),b+=P*(5*U),h+=b>>>13,b&=8191,v=h,v+=E*U,v+=k*D,v+=A*M,v+=x*L,v+=C*j,h=v>>>13,v&=8191,v+=T*N,v+=I*R,v+=B*(5*q),v+=O*(5*K),v+=P*(5*F),h+=v>>>13,v&=8191,_=h,_+=E*F,_+=k*U,_+=A*D,_+=x*M,_+=C*L,h=_>>>13,_&=8191,_+=T*j,_+=I*N,_+=B*R,_+=O*(5*q),_+=P*(5*K),h+=_>>>13,_&=8191,w=h,w+=E*K,w+=k*F,w+=A*U,w+=x*D,w+=C*M,h=w>>>13,w&=8191,w+=T*L,w+=I*j,w+=B*N,w+=O*R,w+=P*(5*q),h+=w>>>13,w&=8191,S=h,S+=E*q,S+=k*K,S+=A*F,S+=x*U,S+=C*D,h=S>>>13,S&=8191,S+=T*M,S+=I*L,S+=B*j,S+=O*N,S+=P*R,h+=S>>>13,S&=8191,h=(h<<2)+h|0,h=h+d|0,d=8191&h,h>>>=13,p+=h,E=d,k=p,A=y,x=g,C=m,T=b,I=v,B=_,O=w,P=S,t+=16,r-=16;this.h[0]=E,this.h[1]=k,this.h[2]=A,this.h[3]=x,this.h[4]=C,this.h[5]=T,this.h[6]=I,this.h[7]=B,this.h[8]=O,this.h[9]=P},C.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},C.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++)A=8*k+$,i[k]=r[A+0]<<24|r[A+1]<<16|r[A+2]<<8|r[A+3],o[k]=r[A+4]<<24|r[A+5]<<16|r[A+6]<<8|r[A+7];for(k=0;k<80;k++)if(s=P,a=R,u=N,c=j,f=L,l=M,h=D,d=U,p=F,y=K,g=q,m=H,b=z,v=V,_=G,w=W,x=U,C=W,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=(L>>>14|z<<18)^(L>>>18|z<<14)^(z>>>9|L<<23),C=(z>>>14|L<<18)^(z>>>18|L<<14)^(L>>>9|z<<23),T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,x=L&M^~L&D,C=z&V^~z&G,T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,x=Q[2*k],C=Q[2*k+1],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,x=i[k%16],C=o[k%16],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,S=65535&B|O<<16,E=65535&T|I<<16,x=S,C=E,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=(P>>>28|F<<4)^(F>>>2|P<<30)^(F>>>7|P<<25),C=(F>>>28|P<<4)^(P>>>2|F<<30)^(P>>>7|F<<25),T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,x=P&R^P&N^R&N,C=F&K^F&q^K&q,T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,d=65535&B|O<<16,w=65535&T|I<<16,x=c,C=m,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=S,C=E,T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,c=65535&B|O<<16,m=65535&T|I<<16,R=s,N=a,j=u,L=c,M=f,D=l,U=h,P=d,K=p,q=y,H=g,z=m,V=b,G=v,W=_,F=w,k%16==15)for(A=0;A<16;A++)x=i[A],C=o[A],T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=i[(A+9)%16],C=o[(A+9)%16],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,S=i[(A+1)%16],E=o[(A+1)%16],x=(S>>>1|E<<31)^(S>>>8|E<<24)^S>>>7,C=(E>>>1|S<<31)^(E>>>8|S<<24)^(E>>>7|S<<25),T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,S=i[(A+14)%16],E=o[(A+14)%16],x=(S>>>19|E<<13)^(E>>>29|S<<3)^S>>>6,C=(E>>>19|S<<13)^(S>>>29|E<<3)^(E>>>6|S<<26),T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,i[A]=65535&B|O<<16,o[A]=65535&T|I<<16;x=P,C=F,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=e[0],C=t[0],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,e[0]=P=65535&B|O<<16,t[0]=F=65535&T|I<<16,x=R,C=K,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=e[1],C=t[1],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,e[1]=R=65535&B|O<<16,t[1]=K=65535&T|I<<16,x=N,C=q,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=e[2],C=t[2],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,e[2]=N=65535&B|O<<16,t[2]=q=65535&T|I<<16,x=j,C=H,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=e[3],C=t[3],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,e[3]=j=65535&B|O<<16,t[3]=H=65535&T|I<<16,x=L,C=z,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=e[4],C=t[4],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,e[4]=L=65535&B|O<<16,t[4]=z=65535&T|I<<16,x=M,C=V,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=e[5],C=t[5],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,e[5]=M=65535&B|O<<16,t[5]=V=65535&T|I<<16,x=D,C=G,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=e[6],C=t[6],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,e[6]=D=65535&B|O<<16,t[6]=G=65535&T|I<<16,x=U,C=W,T=65535&C,I=C>>>16,B=65535&x,O=x>>>16,x=e[7],C=t[7],T+=65535&C,I+=C>>>16,B+=65535&x,O+=x>>>16,I+=T>>>16,B+=I>>>16,O+=B>>>16,e[7]=U=65535&B|O<<16,t[7]=W=65535&T|I<<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()];P(n[0],l),P(n[1],h),P(n[2],a),K(n[3],l,h),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 le(e,r,n,i){var o=new Uint8Array(64),s=new Uint8Array(64),a=new Uint8Array(64),u,c,f=new Float64Array(64),l=[t(),t(),t(),t()];te(o,i,32),o[0]&=248,o[31]&=127,o[31]|=64;var h=n+64;for(u=0;u>7&&F(e[0],s,e[0]),K(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(he(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(Re(e),64!==e.length)throw new Error("bad secret key size");for(var t=new Uint8Array(32),r=0;r{i=i||r(1050)(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){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?l(e,t,o,"day"):t>=i?l(e,t,i,"hour"):t>=n?l(e,t,n,"minute"):t>=r?l(e,t,r,"second"):e+" ms"}function l(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";var n=r(202),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=l;var o=r(155);o.inherits=r(1);var s=r(381),a=r(271);o.inherits(l,s);for(var u=i(a.prototype),c=0;c>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 z(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,l;u>2]|=e[u]<>2]|=l<>2]|=(192|l>>6)<>2]|=(128|63&l)<=57344?(n[f>>2]|=(224|l>>12)<>2]|=(128|l>>6&63)<>2]|=(128|63&l)<>2]|=(240|l>>18)<>2]|=(128|l>>12&63)<>2]|=(128|l>>6&63)<>2]|=(128|63&l)<=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&&(V(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&&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},z.prototype=new H,z.prototype.finalize=function(){return this.encode(this.outputBits,!0),H.prototype.finalize.call(this)};var V=function(e){var t,r,n,i,o,s,a,u,c,f,l,h,d,p,y,g,m,b,v,w,S,E,k,A,x,C,T,I,B,O,P,R,N,j,L,M,D,U,F,K,q,H,z,V,G,W,$,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],l=e[7]^e[17]^e[27]^e[37]^e[47],h=e[8]^e[18]^e[28]^e[38]^e[48],d=e[9]^e[19]^e[29]^e[39]^e[49],t=h^(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|l>>>31),r=a^(l<<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^(h<<1|d>>>31),r=c^(d<<1|h>>>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=l^(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],y=e[1],W=e[11]<<4|e[10]>>>28,$=e[10]<<4|e[11]>>>28,I=e[20]<<3|e[21]>>>29,B=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,z=e[41]<<18|e[40]>>>14,j=e[2]<<1|e[3]>>>31,L=e[3]<<1|e[2]>>>31,g=e[13]<<12|e[12]>>>20,m=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,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,M=e[14]<<6|e[15]>>>26,D=e[15]<<6|e[14]>>>26,b=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,R=e[45]<<29|e[44]>>>3,N=e[44]<<29|e[45]>>>3,A=e[6]<<28|e[7]>>>4,x=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,U=e[26]<<25|e[27]>>>7,F=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,V=e[8]<<27|e[9]>>>5,G=e[9]<<27|e[8]>>>5,C=e[18]<<20|e[19]>>>12,T=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,se=e[28]<<7|e[29]>>>25,K=e[38]<<8|e[39]>>>24,q=e[39]<<8|e[38]>>>24,E=e[48]<<14|e[49]>>>18,k=e[49]<<14|e[48]>>>18,e[0]=p^~g&b,e[1]=y^~m&v,e[10]=A^~C&I,e[11]=x^~T&B,e[20]=j^~M&U,e[21]=L^~D&F,e[30]=V^~W&Y,e[31]=G^~$&J,e[40]=te^~ne&oe,e[41]=re^~ie&se,e[2]=g^~b&w,e[3]=m^~v&S,e[12]=C^~I&O,e[13]=T^~B&P,e[22]=M^~U&K,e[23]=D^~F&q,e[32]=W^~Y&X,e[33]=$^~J&Z,e[42]=ne^~oe&ae,e[43]=ie^~se&ue,e[4]=b^~w&E,e[5]=v^~S&k,e[14]=I^~O&R,e[15]=B^~P&N,e[24]=U^~K&H,e[25]=F^~q&z,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&y,e[16]=O^~R&A,e[17]=P^~N&x,e[26]=K^~H&j,e[27]=q^~z&L,e[36]=X^~Q&V,e[37]=Z^~ee&G,e[46]=ae^~ce&te,e[47]=ue^~fe&re,e[8]=E^~p&g,e[9]=k^~y&m,e[18]=R^~A&C,e[19]=N^~x&T,e[28]=H^~j&M,e[29]=z^~L&D,e[38]=Q^~V&W,e[39]=ee^~G&$,e[48]=ce^~te&ne,e[49]=fe^~re&ie,e[0]^=_[n],e[1]^=_[n+1]};if(l)e.exports=j;else{for(M=0;M`}toJSON(){return this._json||(this._json=Object.freeze({name:this.name,size:this.size,multihash:this._cid.toBaseEncodedString()})),Object.assign({},this._json)}get name(){return this._name}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 multihash(){return this._cid.buffer}set multihash(e){throw new Error("Can't set property: 'multihash' is immutable")}get cid(){return this._cid}set cid(e){throw new Error("Can't set property: 'cid' is immutable")}}t=e.exports=o(s,{className:"DAGLink",symbolName:"@ipld/js-ipld-dag-pb/daglink"}),t.create=r(871),t.util=r(872)},function(e,t,r){(function(t){const n=r(31),i=r(57).ec,o=new i("secp256k1"),s=r(914),a=t.alloc(32,0),u=t.from("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),c=t.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex"),f=o.curve.n,l=f.shrn(1),h=o.curve.g,d="Expected Private",p="Expected Point",y="Expected Tweak",g="Expected Hash",m="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 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!!b(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 A(e,t){return void 0===e&&void 0!==t?w(t):void 0===e||e}function x(e){return new n(e)}function C(e){return e.toArrayLike(t,"be",32)}function T(e){return o.curve.decodePoint(e)}function I(e,r){return t.from(e._encode(r))}function B(e,t,r){if(!_(e))throw new TypeError(p);if(!_(t))throw new TypeError(p);const n=T(e),i=T(t),o=n.add(i);if(o.isInfinity())return null;const s=A(r,e);return I(o,s)}function O(e,t,r){if(!_(e))throw new TypeError(p);if(!v(t))throw new TypeError(y);const n=A(r,e),i=T(e);if(0===t.compare(a))return I(i,n);const o=x(t),s=h.mul(o),u=i.add(s);return u.isInfinity()?null:I(u,n)}function P(e,t){if(!_(e))throw new TypeError(p);const r=T(e);if(r.isInfinity())throw new TypeError(p);return I(r,t)}function R(e,t){if(!E(e))throw new TypeError(d);const r=x(e),n=h.mul(r);if(n.isInfinity())return null;const i=A(t);return I(n,i)}function N(e,t,r){if(!_(e))throw new TypeError(p);if(!v(t))throw new TypeError(y);const n=A(r,e),i=T(e),o=x(t),s=i.mul(o);return s.isInfinity()?null:I(s,n)}function j(e,t){if(!E(e))throw new TypeError(d);if(!v(t))throw new TypeError(y);const r=x(e),n=x(t),i=C(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(y);const r=x(e),n=x(t),i=C(r.sub(n).umod(f));return E(i)?i:null}function M(e,r){if(!b(e))throw new TypeError(g);if(!E(r))throw new TypeError(d);const n=x(r),i=x(e);let o,a;s(e,r,function(e){const t=x(e),r=h.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(l)>0&&(a=f.sub(a));const u=t.allocUnsafe(64);return C(o).copy(u,0),C(a).copy(u,32),u}function D(e,t,r){if(!b(e))throw new TypeError(g);if(!_(t))throw new TypeError(p);if(!k(r))throw new TypeError(m);const n=T(t),i=x(r.slice(0,32)),o=x(r.slice(32,64));if(i.gtn(0)<=0)return!1;if(o.gtn(0)<=0)return!1;const s=x(e),a=o.invm(f),u=s.mul(a).umod(f),c=i.mul(a).umod(f),l=h.mulAdd(u,n,c);if(l.isInfinity())return!1;const d=l.x,y=d.umod(f);return y.eq(i)}e.exports={isPoint:_,isPointCompressed:S,isPrivate:E,pointAdd:B,pointAddScalar:O,pointCompress:P,pointFromScalar:R,pointMultiply:N,privateAdd:j,privateSub:L,sign:M,verify:D}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(5).Buffer,i=r(94).Transform,o=r(44).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){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(480),t.ethBlock=r(486),t.ethBlockList=r(986),t.ethStateTrie=r(987),t.ethStorageTrie=r(990),t.ethTx=r(488),t.ethTxTrie=r(993)},function(e,t){},function(e,t,r){"use strict";var n=r(15),i=r(25),o=r(34),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 l(e){for(var t=0;t"},e.exports=l;var h=r(67)}).call(this,r(0).Buffer)},function(e,t,r){var n=r(13);function i(e,t){var r=function(){return new n.aes.Algorithm(e,t)};n.cipher.registerAlgorithm(e,r)}r(318),r(505),r(16),e.exports=n.aes=n.aes||{},n.aes.startEncrypting=function(e,t,r,n){var i=y({key:e,output:r,decrypt:!1,mode:n});return i.start(t),i},n.aes.createEncryptionCipher=function(e,t){return y({key:e,output:null,decrypt:!1,mode:t})},n.aes.startDecrypting=function(e,t,r,n){var i=y({key:e,output:r,decrypt:!0,mode:n});return i.start(t),i},n.aes.createDecryptionCipher=function(e,t){return y({key:e,output:null,decrypt:!0,mode:t})},n.aes.Algorithm=function(e,t){o||h();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],h=e[s],y=p<<24^d<<16^d<<8^d^p,g=(i^s^h)<<24^(r^h)<<16^(r^s^h)<<8^r^i^h;for(var m=0;m<4;++m)f[m][r]=y,l[m][d]=g,y=y<<24|y>>>8,g=g<<24|g>>>8;0===r?r=n=1:(r=i^e[e[e[i^h]]],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,h=o;h>>16&255]<<24^a[n>>>8&255]<<16^a[255&n]<<8^a[n>>>24]^c[i]<<24,i++):o>6&&h%o==4&&(n=a[n>>>24]<<24^a[n>>>16&255]<<16^a[n>>>8&255]<<8^a[255&n]),r[h]=r[h-o]^n;if(t){var d,p=l[0],y=l[1],g=l[2],m=l[3],b=r.slice(0);f=r.length;for(var h=0,v=f-s;h>>24]]^y[a[d>>>16&255]]^g[a[d>>>8&255]]^m[a[255&d]];r=b}return r}function p(e,t,r,n){var i=e.length/4-1,o,s,c,h,d,p,y,g,m,b,v,_;n?(o=l[0],s=l[1],c=l[2],h=l[3],d=u):(o=f[0],s=f[1],c=f[2],h=f[3],d=a),p=t[0]^e[0],y=t[n?3:1]^e[1],g=t[2]^e[2],m=t[n?1:3]^e[3];for(var w=3,S=1;S>>24]^s[y>>>16&255]^c[g>>>8&255]^h[255&m]^e[++w],v=o[y>>>24]^s[g>>>16&255]^c[m>>>8&255]^h[255&p]^e[++w],_=o[g>>>24]^s[m>>>16&255]^c[p>>>8&255]^h[255&y]^e[++w],m=o[m>>>24]^s[p>>>16&255]^c[y>>>8&255]^h[255&g]^e[++w],p=b,y=v,g=_;r[0]=d[p>>>24]<<24^d[y>>>16&255]<<16^d[g>>>8&255]<<8^d[255&m]^e[++w],r[n?3:1]=d[y>>>24]<<24^d[g>>>16&255]<<16^d[m>>>8&255]<<8^d[255&p]^e[++w],r[2]=d[g>>>24]<<24^d[m>>>16&255]<<16^d[p>>>8&255]<<8^d[255&y]^e[++w],r[n?1:3]=d[m>>>24]<<24^d[p>>>16&255]<<16^d[y>>>8&255]<<8^d[255&g]^e[++w]}function y(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){var n=r(13);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(module,exports,__webpack_require__){var indexOf=__webpack_require__(1057),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!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 a._connected().find(e=>"HTTP"===e.name)}static ipfs(){return a._connected().find(e=>"IPFS"===e.name)}static webtorrent(){return a._connected().find(e=>"WEBTORRENT"===e.name)}static gun(){return a._connected().find(e=>"GUN"===e.name)}static async p_resolveNames(e){return this.mirror?Array.isArray(e)?e.map(e=>this.gatewayUrl(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){a._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])),a.statuscb&&a.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 a.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 gatewayUrl(e){let t=a.canonicalName(e);return t?["http","https"].includes(t.proto)?[t.proto,t.internal].join("://"):[this.mirror,t.proto,t.internal].join("/"):e}}a._transports=[],a.namingcb=void 0,a._transportclasses={},t=e.exports=a},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._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";var n=r(1),i=r(299),o=r(468),s=r(469),a=r(115);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){"use strict";(function(t,n){function i(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}var o=r(5).Buffer,s=t.crypto||t.msCrypto;function a(e,r){if(e>65536)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(3))},function(e,t,r){"use strict";(function(t){var n=r(39),i=r(25),o=r(75).curves.secp256k1,s=o.curve.point.bind(o.curve),a=o.curve.pointFromX.bind(o.curve),u=function e(t,r,n){var i=s(t,r,n);return i.validate(),i};u.prototype=Object.getPrototypeOf(o.curve.point()),u.fromX=function e(t,r){var n=a(t,r);return n.validate(),n},u.getG=function e(){return o.curve.g},u.getN=function e(){return new n(o.curve.n.toArray())},u.prototype._getX=u.prototype.getX,u.prototype.getX=function e(){return new n(this._getX().toArray())},u.prototype._getY=u.prototype.getY,u.prototype.getY=function e(){return new n(this._getY().toArray())},u.prototype.validate=function e(){if(this.isInfinity())throw new Error("Point cannot be equal to Infinity");if(0===this.getX().cmp(n.Zero)||0===this.getY().cmp(n.Zero))throw new Error("Invalid x,y value for curve, cannot equal 0.");var t=a(this.getY().isOdd(),this.getX());if(0!==t.y.cmp(this.y))throw new Error("Invalid y value for curve.");var r=this.getX().gt(n.Minus1)&&this.getX().lt(u.getN()),i=this.getY().gt(n.Minus1)&&this.getY().lt(u.getN());if(!r||!i)throw new Error("Point does not lie on the curve");if(!this.mul(u.getN()).isInfinity())throw new Error("Point times N must be infinity");return this},u.pointToCompressed=function e(r){var n=r.getX().toBuffer({size:32}),o=r.getY().toBuffer({size:32}),s,a=o[o.length-1]%2;return s=new t(a?[3]:[2]),i.concat([s,n])},e.exports=u}).call(this,r(0).Buffer)},function(e,t,r){var n=t;n.utils=r(1003),n.common=r(1004),n.sha=r(1005),n.ripemd=r(1006),n.hmac=r(1007),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,r){var n=r(13);r(16);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{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})},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 y&&"blob"===r&&(a=new y([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&&y&&(n=new y([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 y&&!l?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 l=o(i,0,c);if(u)try{l=String.fromCharCode.apply(null,new Uint8Array(l))}catch(e){var h=new Uint8Array(l);l="";for(var f=0;f{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";(function(t){const n=r(14),i=r(77);e.exports=function(e){if(t.isBuffer(e)&&(e=n.encode(e)),"string"!=typeof e)throw new Error("unexpected multihash type: "+typeof e);if(!i.multihash(e.split("/")[0]))throw new Error("not valid multihash");return e}}).call(this,r(0).Buffer)},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(711),o=r(715);r(1)(c,i);for(var s=n(o.prototype),a=0;a{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(res)})}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){(function(e){function r(e){return Array.isArray?Array.isArray(e):"[object Array]"===g(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]"===g(e)}function l(e){return"object"==typeof e&&null!==e}function h(e){return"[object Date]"===g(e)}function d(e){return"[object Error]"===g(e)||e instanceof Error}function p(e){return"function"==typeof e}function y(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=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=l,t.isDate=h,t.isError=d,t.isFunction=p,t.isPrimitive=y,t.isBuffer=e.isBuffer}).call(this,r(0).Buffer)},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";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){"use strict";function n(e){return e}var i=r(160);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";var n=r(401);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){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,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(803),i=a(n),o=r(37),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){t=e.exports=r(442),t.Stream=t,t.Readable=t,t.Writable=r(290),t.Duplex=r(108),t.Transform=r(445),t.PassThrough=r(842)},function(e,t,r){(function(e){function r(e){return Array.isArray?Array.isArray(e):"[object Array]"===g(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]"===g(e)}function l(e){return"object"==typeof e&&null!==e}function h(e){return"[object Date]"===g(e)}function d(e){return"[object Error]"===g(e)||e instanceof Error}function p(e){return"function"==typeof e}function y(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=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=l,t.isDate=h,t.isError=d,t.isFunction=p,t.isPrimitive=y,t.isBuffer=e.isBuffer}).call(this,r(0).Buffer)},function(e,t,r){"use strict";t.util=r(454),t.resolver=r(458)},function(e,t,r){"use strict";var n=r(73),i=r(50);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,l),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(l)}}function f(e){return"0x"===e.slice(0,2)}function l(e){return"string"!=typeof e?e:f(e)?e.slice(2):e}function h(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=h(t);return e.from(r,"hex")}function y(t){if(!e.isBuffer(t)){if("string"==typeof t)return f(t)?e.from(d(l(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(10),i=r(18);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(6),i=r(483),o=r(484);function s(e,t,r){const s=o(e,t),a={multicodec:e,defaultHashAlg:"keccak-256",resolve:f,tree:u,isLink:i(f),_resolveFromEthObject:l,_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)=>l(e,t,r)],r)}function l(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(232),o=r(0),s=r(46).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(21),o=r(65),s=r(61),a=r(0),u=r(25),c=r(34),f=r(67),l=r(97),h=r(98),d=4294967295,p=d-2,y=d,g=d-1;function m(e){return this instanceof m?e?this._fromObject(e):void 0:new m(e)}m.MAXINT=d,m.DEFAULT_SEQNUMBER=4294967295,m.DEFAULT_LOCKTIME_SEQNUMBER=4294967294,m.DEFAULT_RBF_SEQNUMBER=4294967293,Object.defineProperty(m.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)}}),m.fromObject=function(e){i.checkArgument(n.isObject(e));var t=new m;return t._fromObject(e)},m.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 h?e.output:new h(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},m.prototype.toObject=m.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},m.fromBufferReader=function(e){var t=new m;return t.prevTxId=e.readReverse(32),t.outputIndex=e.readUInt32LE(),t._scriptBuffer=e.readVarLengthBuffer(),t.sequenceNumber=e.readUInt32LE(),t},m.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},m.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},m.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))},m.prototype.isFullySigned=function(){throw new o.AbstractMethodInvoked("Input#isFullySigned")},m.prototype.isFinal=function(){return 4294967295!==this.sequenceNumber},m.prototype.addSignature=function(){throw new o.AbstractMethodInvoked("Input#addSignature")},m.prototype.clearSignatures=function(){throw new o.AbstractMethodInvoked("Input#clearSignatures")},m.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,l.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script)},m.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},m.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},e.exports=m},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(21),o=r(85),s=r(25),a=r(34),u=r(76),c=r(65),f=r(66);function l(e){if(!(this instanceof l))return new l(e);if(e instanceof l)return e;if(n.isObject(e))return this._fromObject(e);throw new c.InvalidArgument("TransactionSignatures must be instantiated from an object")}o(l,f),l.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},l.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")},l.prototype.toObject=l.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}},l.fromObject=function(e){return i.checkArgument(e),new l(e)},e.exports=l}).call(this,r(0).Buffer)},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;st.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>>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,l;s.putBytes(o.substr(0,i.blockLength-c));for(var h=8*i.fullMessageLength[0],d=0;d>>0,h+=l,s.putInt32(h>>>0),h=f>>>0;s.putInt32(h);var p={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};u(p,r,s);var y=n.util.createBuffer();return y.putInt32(p.h0),y.putInt32(p.h1),y.putInt32(p.h2),y.putInt32(p.h3),y.putInt32(p.h4),y},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,l=r.length();l>=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,l-=64}}},function(e,t,r){"use strict";const n=t;n.Reporter=r(1058).Reporter,n.DecoderBuffer=r(524).DecoderBuffer,n.EncoderBuffer=r(524).EncoderBuffer,n.Node=r(1059)},function(e,t,r){"use strict";const n=t;n.Reporter=r(1094).Reporter,n.DecoderBuffer=r(538).DecoderBuffer,n.EncoderBuffer=r(538).EncoderBuffer,n.Node=r(1095)},function(e,t,r){var n;!function(i){"use strict";var o={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};function s(){var e=arguments[0],t=s.cache;return t[e]||(t[e]=s.parse(e)),s.format.call(null,t[e],arguments)}s.format=function(e,t){var r=1,n=e.length,i="",a,c=[],l,h,d,p,y,g,m=!0,b="";for(l=0;l=0),d[8]){case"b":a=parseInt(a,10).toString(2);break;case"c":a=String.fromCharCode(parseInt(a,10));break;case"d":case"i":a=parseInt(a,10);break;case"j":a=JSON.stringify(a,null,d[6]?parseInt(d[6]):0);break;case"e":a=d[7]?parseFloat(a).toExponential(d[7]):parseFloat(a).toExponential();break;case"f":a=d[7]?parseFloat(a).toFixed(d[7]):parseFloat(a);break;case"g":a=d[7]?parseFloat(a).toPrecision(d[7]):parseFloat(a);break;case"o":a=a.toString(8);break;case"s":a=String(a),a=d[7]?a.substring(0,d[7]):a;break;case"t":a=String(!!a),a=d[7]?a.substring(0,d[7]):a;break;case"T":a=u(a),a=d[7]?a.substring(0,d[7]):a;break;case"u":a=parseInt(a,10)>>>0;break;case"v":a=a.valueOf(),a=d[7]?a.substring(0,d[7]):a;break;case"x":a=parseInt(a,10).toString(16);break;case"X":a=parseInt(a,10).toString(16).toUpperCase()}o.json.test(d[8])?c[c.length]=a:(!o.number.test(d[8])||m&&!d[3]?b="":(b=m?"+":"-",a=a.toString().replace(o.sign,"")),y=d[4]?"0"===d[4]?"0":d[4].charAt(1):" ",g=d[6]-(b+a).length,p=d[6]&&g>0?f(y,g):"",c[c.length]=d[5]?b+a+p:"0"===y?b+p+a:p+b+a)}return c.join("")},s.cache=Object.create(null),s.parse=function(e){for(var t=e,r=[],n=[],i=0;t;){if(null!==(r=o.text.exec(t)))n[n.length]=r[0];else if(null!==(r=o.modulo.exec(t)))n[n.length]="%";else{if(null===(r=o.placeholder.exec(t)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var s=[],a=r[2],u=[];if(null===(u=o.key.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(s[s.length]=u[1];""!==(a=a.substring(u[0].length));)if(null!==(u=o.key_access.exec(a)))s[s.length]=u[1];else{if(null===(u=o.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");s[s.length]=u[1]}r[2]=s}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}t=t.substring(r[0].length)}return n};var a=function(e,t,r){return r=(t||[]).slice(0),r.splice(0,0,e),s.apply(null,r)};function u(e){return"number"==typeof e?"number":"string"==typeof e?"string":Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}var c={0:["","0","00","000","0000","00000","000000","0000000"]," ":[""," "," "," "," "," "," "," "],_:["","_","__","___","____","_____","______","_______"]};function f(e,t){return t>=0&&t<=7&&c[e]?c[e][t]:Array(t+1).join(e)}t.sprintf=s,t.vsprintf=a,void 0!==i&&(i.sprintf=s,i.vsprintf=a,n=function(){return{sprintf:s,vsprintf:a}}.call(t,r,t,e),void 0===n||(e.exports=n))}("undefined"==typeof window?this:window)},function(e,t,r){"use strict";const n=t;n.Reporter=r(1132).Reporter,n.DecoderBuffer=r(557).DecoderBuffer,n.EncoderBuffer=r(557).EncoderBuffer,n.Node=r(1133)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(580),i=a(n),o=r(214),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){"use strict";const n=t;n.Reporter=r(1352).Reporter,n.DecoderBuffer=r(605).DecoderBuffer,n.EncoderBuffer=r(605).EncoderBuffer,n.Node=r(1353)},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){var n=r(26),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,l=t.writable||!1!==t.writable&&e.writable,h=function(){e.writable||d()},d=function(){l=!1,f||r.call(e)},p=function(){f=!1,l||r.call(e)},y=function(t){r.call(e,t?new Error("exited with error code: "+t):null)},g=function(t){r.call(e,t)},m=function(){return(!f||c&&c.ended)&&(!l||u&&u.ended)?void 0:r.call(e,new Error("premature close"))},b=function(){e.req.on("finish",d)};return o(e)?(e.on("complete",d),e.on("abort",m),e.req?b():e.on("request",b)):l&&!u&&(e.on("end",h),e.on("close",h)),s(e)&&e.on("exit",y),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",h),e.removeListener("close",h),e.removeListener("finish",d),e.removeListener("exit",y),e.removeListener("end",p),e.removeListener("error",g),e.removeListener("close",m)}};e.exports=a},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(1386)(t);const{formatters:f}=e.exports;f.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,r(3))},function(e,t,r){"use strict";const n=t;n.Reporter=r(1396).Reporter,n.DecoderBuffer=r(624).DecoderBuffer,n.EncoderBuffer=r(624).EncoderBuffer,n.Node=r(1397)},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";const n=r(27),i=r(47),o=r(51),s=r(191);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(17);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=t;n.Reporter=r(1477).Reporter,n.DecoderBuffer=r(647).DecoderBuffer,n.EncoderBuffer=r(647).EncoderBuffer,n.Node=r(1478)},function(e,t,r){"use strict";const n=t;n.Reporter=r(1528).Reporter,n.DecoderBuffer=r(660).DecoderBuffer,n.EncoderBuffer=r(660).EncoderBuffer,n.Node=r(1529)},function(e,t,r){"use strict";t.importer=t.Importer=r(1556),t.exporter=t.Exporter=r(1581)},function(e,t,r){"use strict";const n=r(48).Key,i={file:0,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){(function(t){var n=r(12).Writable,i=r(1),o=r(268);if("undefined"==typeof Uint8Array)var s=r(1654).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?l(this.body):"buffer"===this.encoding?h(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 l(e){for(var r=[],n=!1,i=0;ir=>{let l,h=!1,d=!1;r=r?Object.assign({},r,r.qs):{};const p=new u,y=new n({objectMode:!0});y._read=(e=>{}),y._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);h&&p.end(),o()})}catch(e){o(e)}}),y.once("finish",()=>{h||(h=!0,d||p.end())});const g=r.qs||{};g["cid-version"]=f(r,"cid-version","cidVersion"),g["raw-leaves"]=f(r,"raw-leaves","rawLeaves"),g["only-hash"]=f(r,"only-hash","onlyHash"),g["wrap-with-directory"]=f(r,"wrap-with-directory","wrapWithDirectory"),g.hash=f(r,"hash","hashAlg");const m={path:t,qs:g,args:r.args,multipart:!0,multipartBoundary:p._boundary,stream:!0,recursive:!0,progress:r.progress};return p.on("error",e=>{y.emit("error",e)}),l=e(m,(e,t)=>{if(e)return y.emit("error",e);if(!t)return y.push(null);if(!o(t))return y.push(t),void y.push(null);if(t.on("error",e=>y.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",()=>y.push(null)),n.on("data",e=>y.push(e)),t.pipe(n)}else t.on("data",e=>{e.Bytes&&r.progress&&r.progress(e.Bytes),y.push(e)}),t.once("end",()=>y.push(null))}),l.on("drain",()=>p.emit("drain")),p.pipe(l),y})},function(e,t){e.exports=!1},function(e,t,r){"use strict";(function(t){const n=r(2),i=r(30),o=i.DAGNode,s=i.DAGLink,a=r(14),u=r(10),c=r(270),f={max:128},l=c(f);e.exports=(e=>n((r,n,i)=>{let c;"function"==typeof n&&(i=n,n={}),n||(n={});try{r=new u(r),c=r.toBaseEncodedString()}catch(e){return i(e)}const f=l.get(c);if(f)return i(null,f);e({path:"object/get",args:c,qs:{"data-encoding":"base64"}},(e,r)=>{if(e)return i(e);r.Data=t.from(r.Data,"base64");const n=r.Links.map(e=>new s(e.Name,e.Size,t.from(a.decode(e.Hash))));o.create(r.Data,n,(e,t)=>{if(e)return i(e);l.set(c,t),i(null,t)})})}))}).call(this,r(0).Buffer)},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(3))},function(e,t,r){var n=r(1848),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(l(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){"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";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";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){const n=r(91);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";(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;a0;)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&&f-1}function W(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();++t{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";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(215),i=a(n),o=r(37),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){"use strict";(function(t){const n=r(9),i=r(427),o=r(38).utils.asyncFilter,s=r(38).utils.asyncSort,a=r(38).Key,u=r(38).Errors,c=r(434);class f{constructor(e,t){let n;t&&t.db?(n=t.db,delete t.db):n=r(437),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";(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;ae.toJSON()),multihash:this._cid.toBaseEncodedString(),size:this.size})),Object.assign({},this._json)}toString(){return`DAGNode <${this._cid.toBaseEncodedString()} - data: "${this.data.toString()}", links: ${this.links.length}, size: ${this.size}>`}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 serialized(){return this._serialized}set serialized(e){throw new Error("Can't set property: 'serialized' is immutable")}get size(){return void 0===this._size&&(this._size=this.links.reduce((e,t)=>e+t.size,this.serialized.length)),this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}get multihash(){return this._cid.buffer}set multihash(e){throw new Error("Can't set property: 'multihash' is immutable")}get cid(){return this._cid}set cid(e){throw new Error("Can't set property: 'cid' is immutable")}}t=e.exports=o(a,{className:"DAGNode",symbolName:"@ipld/js-ipld-dag-pb/dagnode"}),t.create=r(222),t.clone=r(873),t.addLink=r(874),t.rmLink=r(875)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(33),i=r(859),o=r(292),s=o.serialize,a=r(223),u=a.linkSort,c=r(221),f=r(113);function l(e,r,o,a){if("function"==typeof e?(a=e,e=void 0):"string"==typeof e&&(e=t.from(e)),"function"==typeof r&&(a=r,r=[]),"function"==typeof o&&(a=o,o=void 0),!t.isBuffer(e))return a(new Error("Passed 'data' is not a buffer or a string!"));o||(o="sha2-256");const l=r.map(e=>f.isDAGLink(e)?e:f.util.createDagLinkFromB58EncodedHash(e)),h=i(l,u);s({data:e,links:h},(t,r)=>{if(t)return a(t);n(r,o,(t,n)=>{if(t)return a(t);const i=new c(e,h,r,n);a(null,i)})})}e.exports=l}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(113);function o(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 s(e){return e.links.slice()}function a(e,t){const r=n.from(e.name||""),i=n.from(t.name||"");return r.compare(i)}function u(e){return new i("",e.size,e.multihash)}t=e.exports,t.cloneData=o,t.cloneLinks=s,t.linkSort=a,t.toDAGLink=u}).call(this,r(0).Buffer)},function(e,t,r){var n;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,u=Math.floor,c="[BigNumber Error] ",f=c+"Number primitive has more than 15 significant digits: ",l=1e14,h=14,d=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,g=1e9;function m(e){var t,r,n,i=z.prototype={constructor:z,toString:null,valueOf:null},o=new z(1),x=20,C=4,T=-7,I=21,B=-1e7,O=1e7,P=!1,R=1,N=0,j={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0},L="0123456789abcdefghijklmnopqrstuvwxyz",M,D,U,F,K,q,H;function z(e,t){var i,o,a,c,l,p,y,g,m=this;if(!(m instanceof z))return new z(e,t);if(null==t){if(e instanceof z)return m.s=e.s,m.e=e.e,void(m.c=(e=e.c)?e.slice():e);if(p="number"==typeof e,p&&0*e==0){if(m.s=1/e<0?(e=-e,-1):1,e===~~e){for(c=0,l=e;l>=10;l/=10,c++);return m.e=c,void(m.c=[e])}g=e+""}else{if(!s.test(g=e+""))return n(m,g,p);m.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(c=g.indexOf("."))>-1&&(g=g.replace(".","")),(l=g.search(/e/i))>0?(c<0&&(c=l),c+=+g.slice(l+1),g=g.substring(0,l)):c<0&&(c=g.length)}else{if(w(t,2,L.length,"Base"),g=e+"",10==t)return m=new z(e instanceof z?e:g),$(m,x+m.e+1,C);if(p="number"==typeof e,p){if(0*e!=0)return n(m,g,p,t);if(m.s=1/e<0?(g=g.slice(1),-1):1,z.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(f+e);p=!1}else m.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(i=L.slice(0,t),c=l=0,y=g.length;lc){c=y;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,l=-1,c=0;continue}return n(m,e+"",p,t)}g=r(g,t,10,m.s),(c=g.indexOf("."))>-1?g=g.replace(".",""):c=g.length}for(l=0;48===g.charCodeAt(l);l++);for(y=g.length;48===g.charCodeAt(--y););if(g=g.slice(l,++y),g){if(y-=l,p&&z.DEBUG&&y>15&&(e>d||e!==u(e)))throw Error(f+m.s*e);if(c=c-l-1,c>O)m.c=m.e=null;else if(ca){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 G(e,t){var r,n,i=0;for(S(e[0])&&(e=e[0]),r=new z(e[0]);++i=10;i/=10,n++);return(r=n+r*h-1)>O?e.c=e.e=null:r=10;c/=10,i++);if(o=t-i,o<0)o+=h,s=t,f=g[d=0],y=f/m[i-s-1]%10|0;else if(d=a((o+1)/h),d>=g.length){if(!n)break e;for(;g.length<=d;g.push(0));f=y=0,i=1,o%=h,s=o-h+1}else{for(f=c=g[d],i=1;c>=10;c/=10,i++);o%=h,s=o-h+i,y=s<0?0:f/m[i-s-1]%10|0}if(n=n||t<0||null!=g[d+1]||(s<0?f:f%m[i-s-1]),n=r<4?(y||n)&&(0==r||r==(e.s<0?3:2)):y>5||5==y&&(4==r||n||6==r&&(o>0?s>0?f/m[i-s]:0:g[d-1])%10&1||r==(e.s<0?8:7)),t<1||!g[0])return g.length=0,n?(t-=e.e+1,g[0]=m[(h-t%h)%h],e.e=-t||0):g[0]=e.e=0,e;if(0==o?(g.length=d,c=1,d--):(g.length=d+1,c=m[h-o],g[d]=s>0?u(f/m[i-s]%m[s])*c:0),n)for(;;){if(0==d){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=c,c=1;s>=10;s/=10,c++);o!=c&&(e.e++,g[0]==l&&(g[0]=1));break}if(g[d]+=c,g[d]!=l)break;g[d--]=0,c=1}for(o=g.length;0===g[--o];g.pop());}e.e>O?e.c=e.e=null:e.e>>11),s>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[f]=r[0],t[f+1]=r[1]):(l.push(s%1e14),f+=2);f=i/2}else{if(!crypto.randomBytes)throw P=!1,Error(c+"crypto unavailable");for(t=crypto.randomBytes(i*=7);f=9e15?crypto.randomBytes(7).copy(t,f):(l.push(s%1e14),f+=7);f=i/7}if(!P)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,l,h,d,p,y,g=n.indexOf("."),m=x,b=C;for(g>=0&&(l=N,N=0,n=n.replace(".",""),y=new z(i),d=y.pow(n.length-g),N=l,y.c=r(A(v(d.c),d.e,"0"),10,o,e),y.e=y.c.length),p=r(n,i,o,a?(u=L,e):(u=e,L)),f=l=p.length;0==p[--l];p.pop());if(!p[0])return u.charAt(0);if(g<0?--f:(d.c=p,d.e=f,d.s=s,d=t(d,y,m,b,o),p=d.c,h=d.r,f=d.e),c=f+m+1,g=p[c],l=o/2,h=h||c<0||null!=p[c+1],h=b<4?(null!=g||h)&&(0==b||b==(d.s<0?3:2)):g>l||g==l&&(4==b||h||6==b&&1&p[c-1]||b==(d.s<0?8:7)),c<1||!p[0])n=h?A(u.charAt(1),-m,u.charAt(0)):u.charAt(0);else{if(p.length=c,h)for(--o;++p[--c]>o;)p[c]=0,c||(++f,p=[1].concat(p));for(l=p.length;!p[--l];);for(g=0,n="";g<=l;n+=u.charAt(p[g++]));n=A(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%y,f=t/y|0;for(e=e.slice();u--;)o=e[u]%y,s=e[u]/y|0,n=f*o+s*c,i=c*o+n%y*y+a,a=(i/r|0)+(n/y|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,y,g,m,v,_,w,S,E,k,A,x,C,T,I=n.s==i.s?1:-1,B=n.c,O=i.c;if(!(B&&B[0]&&O&&O[0]))return new z(n.s&&i.s&&(B?!O||B[0]!=O[0]:O)?B&&0==B[0]||!O?0*I:I/0:NaN);for(v=new z(I),_=v.c=[],f=n.e-i.e,I=o+f+1,a||(a=l,f=b(n.e/h)-b(i.e/h),I=I/h|0),d=0;O[d]==(B[d]||0);d++);if(O[d]>(B[d]||0)&&f--,I<0)_.push(1),p=!0;else{for(A=B.length,C=O.length,d=0,I+=2,y=u(a/(O[0]+1)),y>1&&(O=e(O,y,a),B=e(B,y,a),C=O.length,A=B.length),k=C,w=B.slice(0,C),S=w.length;S=a/2&&x++;do{if(y=0,c=t(O,w,C,S),c<0){if(E=w[0],C!=S&&(E=E*a+(w[1]||0)),y=u(E/x),y>1)for(y>=a&&(y=a-1),g=e(O,y,a),m=g.length,S=w.length;1==t(g,w,m,S);)y--,r(g,C=10;I/=10,d++);$(v,o+(v.e=d+f*h-1)+1,s,p)}else v.e=f,v.r=+p;return v}}(),U=/^(-?)0([xbo])(?=\w[\w.]*$)/i,F=/^([^.]+)\.$/,K=/^\.([^.]+)$/,q=/^-?(Infinity|NaN)$/,H=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(e,t,r,n){var i,o=r?t:t.replace(H,"");if(q.test(o))e.s=isNaN(o)?null:o<0?-1:1,e.c=e.e=null;else{if(!r&&(o=o.replace(U,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(K,"0.$1")),t!=o))return new z(o,i);if(z.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 z(this);return e.s<0&&(e.s=1),e},i.comparedTo=function(e,t){return _(this,new z(e,t))},i.decimalPlaces=i.dp=function(e,t){var r,n,i,o=this;if(null!=e)return w(e,0,g),null==t?t=C:w(t,0,8),$(new z(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-b(this.e/h))*h,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 z(e,r),x,C)},i.dividedToIntegerBy=i.idiv=function(e,r){return t(this,new z(e,r),0,1)},i.exponentiatedBy=i.pow=function(e,t){var r,n,i,s,f,l,d,p,y=this;if(e=new z(e),e.c&&!e.isInteger())throw Error(c+"Exponent not an integer: "+e);if(null!=t&&(t=new z(t)),f=e.e>14,!y.c||!y.c[0]||1==y.c[0]&&!y.e&&1==y.c.length||!e.c||!e.c[0])return p=new z(Math.pow(+y.valueOf(),f?2-E(e):+e)),t?p.mod(t):p;if(l=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new z(NaN);n=!l&&y.isInteger()&&t.isInteger(),n&&(y=y.mod(t))}else{if(e.e>9&&(y.e>0||y.e<-1||(0==y.e?y.c[0]>1||f&&y.c[1]>=24e7:y.c[0]<8e13||f&&y.c[0]<=9999975e7)))return i=y.s<0&&E(e)?-0:0,y.e>-1&&(i=1/i),new z(l?1/i:i);N&&(i=a(N/h+2))}for(f?(r=new z(.5),d=E(e)):d=e%2,l&&(e.s=1),p=new z(o);;){if(d){if(p=p.times(y),!p.c)break;i?p.c.length>i&&(p.c.length=i):n&&(p=p.mod(t))}if(f){if(e=e.times(r),$(e,e.e+1,1),!e.c[0])break;f=e.e>14,d=E(e)}else{if(e=u(e/2),!e)break;d=e%2}y=y.times(y),i?y.c&&y.c.length>i&&(y.c.length=i):n&&(y=y.mod(t))}return n?p:(l&&(p=o.div(p)),t?p.mod(t):i?$(p,N,C,s):p)},i.integerValue=function(e){var t=new z(this);return null==e?e=C:w(e,0,8),$(t,t.e+1,e)},i.isEqualTo=i.eq=function(e,t){return 0===_(this,new z(e,t))},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(e,t){return _(this,new z(e,t))>0},i.isGreaterThanOrEqualTo=i.gte=function(e,t){return 1===(t=_(this,new z(e,t)))||0===t},i.isInteger=function(){return!!this.c&&b(this.e/h)>this.c.length-2},i.isLessThan=i.lt=function(e,t){return _(this,new z(e,t))<0},i.isLessThanOrEqualTo=i.lte=function(e,t){return-1===(t=_(this,new z(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 z(e,t),t=e.s,!a||!t)return new z(NaN);if(a!=t)return e.s=-t,s.plus(e);var u=s.e/h,c=e.e/h,f=s.c,d=e.c;if(!u||!c){if(!f||!d)return f?(e.s=-t,e):new z(d?s:NaN);if(!f[0]||!d[0])return d[0]?(e.s=-t,e):new z(f[0]?s:3==C?-0:0)}if(u=b(u),c=b(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=l-1;n>a;){if(f[--n]=0;){for(r=0,p=E[i]%_,g=E[i]/_|0,s=u,o=i+s;o>i;)c=S[--s]%_,f=S[s]/_|0,a=g*c+f*p,c=p*c+a%_*_+m[o]+r,r=(c/v|0)+(a/_|0)+g*f,m[o--]=c%v;m[o]=r}return r?++n:m.splice(0,1),W(e,m,n)},i.negated=function(){var e=new z(this);return e.s=-e.s||null,e},i.plus=function(e,t){var r,n=this,i=n.s;if(e=new z(e,t),t=e.s,!i||!t)return new z(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/h,s=e.e/h,a=n.c,u=e.c;if(!o||!s){if(!a||!u)return new z(i/0);if(!a[0]||!u[0])return u[0]?e:new z(a[0]?n:0*i)}if(o=b(o),s=b(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)/l|0,a[t]=l===a[t]?0:a[t]%l;return i&&(a=[i].concat(a),++s),W(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,g),null==t?t=C:w(t,0,8),$(new z(o),e,t);if(!(r=o.c))return null;if(i=r.length-1,n=i*h+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,l=new z("0.5");if(1!==u||!a||!a[0])return new z(!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=b((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 z(r)):n=new z(u+""),n.c[0])for(c=n.e,u=c+f,u<3&&(u=0);;)if(o=n,n=l.times(o.plus(t(s,o,f,1))),v(o.c).slice(0,u)===(r=v(n.c)).slice(0,u)){if(n.e0&&h>0){for(n=h%o||o,u=l.substr(0,n);n0&&(u+=a+l.slice(n)),f&&(u="-"+u)}r=c?u+j.decimalSeparator+((s=+j.fractionGroupSize)?c.replace(new RegExp("\\d{"+s+"}\\B","g"),"$&"+j.fractionGroupSeparator):c):u}return r},i.toFraction=function(e){var r,n,i,s,a,u,f,l,d,y,g,m,b=this,_=b.c;if(null!=e&&(l=new z(e),!l.isInteger()&&(l.c||1!==l.s)||l.lt(o)))throw Error(c+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+e);if(!_)return b.toString();for(n=new z(o),y=i=new z(o),s=d=new z(o),m=v(_),u=n.e=m.length-b.e-1,n.c[0]=p[(f=u%h)<0?h+f:f],e=!e||l.comparedTo(n)>0?u>0?n:y:l,f=O,O=1/0,l=new z(m),d.c[0]=0;g=t(l,n,0,1),a=i.plus(g.times(s)),1!=a.comparedTo(e);)i=s,s=a,y=d.plus(g.times(a=y)),d=a,n=l.minus(g.times(a=n)),l=a;return a=t(e.minus(i),s,0,1),d=d.plus(a.times(y)),i=i.plus(a.times(s)),d.s=y.s=b.s,u*=2,r=t(y,s,u,C).minus(b).abs().comparedTo(t(d,i,u,C).minus(b).abs())<1?[y.toString(),s.toString()]:[d.toString(),i.toString()],O=f,r},i.toNumber=function(){return+this},i.toPrecision=function(e,t){return null!=e&&w(e,1,g),V(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":(t=v(n.c),null==e?t=o<=T||o>=I?k(t,o):A(t,o,"0"):(w(e,2,L.length,"Base"),t=r(A(t,o,"0"),10,e,i,!0)),i<0&&n.c[0]&&(t="-"+t)),t},i.valueOf=i.toJSON=function(){var e,t=this,r=t.e;return null===r?t.toString():(e=v(t.c),e=r<=T||r>=I?k(e,r):A(e,r,"0"),t.s<0?"-"+e:e)},i._isBigNumber=!0,null!=e&&z.set(e),z}function b(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: ")+e)}function S(e){return"[object Array]"==Object.prototype.toString.call(e)}function E(e){var t=e.c.length-1;return b(e.e/h)==t&&e.c[t]%2!=0}function k(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function A(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{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(884),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),this}writeInt16BE(t,r){return this._writeNumberValue(e.prototype.writeInt16BE,2,t,r),this}insertInt16BE(t,r){return this._insertNumberValue(e.prototype.writeInt16BE,2,t,r),this}writeInt16LE(t,r){return this._writeNumberValue(e.prototype.writeInt16LE,2,t,r),this}insertInt16LE(t,r){return this._insertNumberValue(e.prototype.writeInt16LE,2,t,r),this}writeInt32BE(t,r){return this._writeNumberValue(e.prototype.writeInt32BE,4,t,r),this}insertInt32BE(t,r){return this._insertNumberValue(e.prototype.writeInt32BE,4,t,r),this}writeInt32LE(t,r){return this._writeNumberValue(e.prototype.writeInt32LE,4,t,r),this}insertInt32LE(t,r){return this._insertNumberValue(e.prototype.writeInt32LE,4,t,r),this}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),this}insertUInt8(t,r){return this._insertNumberValue(e.prototype.writeUInt8,1,t,r),this}writeUInt16BE(t,r){return this._writeNumberValue(e.prototype.writeUInt16BE,2,t,r),this}insertUInt16BE(t,r){return this._insertNumberValue(e.prototype.writeUInt16BE,2,t,r),this}writeUInt16LE(t,r){return this._writeNumberValue(e.prototype.writeUInt16LE,2,t,r),this}insertUInt16LE(t,r){return this._insertNumberValue(e.prototype.writeUInt16LE,2,t,r),this}writeUInt32BE(t,r){return this._writeNumberValue(e.prototype.writeUInt32BE,4,t,r),this}insertUInt32BE(t,r){return this._insertNumberValue(e.prototype.writeUInt32BE,4,t,r),this}writeUInt32LE(t,r){return this._writeNumberValue(e.prototype.writeUInt32LE,4,t,r),this}insertUInt32LE(t,r){return this._insertNumberValue(e.prototype.writeUInt32LE,4,t,r),this}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),this}insertFloatBE(t,r){return this._insertNumberValue(e.prototype.writeFloatBE,4,t,r),this}writeFloatLE(t,r){return this._writeNumberValue(e.prototype.writeFloatLE,4,t,r),this}insertFloatLE(t,r){return this._insertNumberValue(e.prototype.writeFloatLE,4,t,r),this}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),this}insertDoubleBE(t,r){return this._insertNumberValue(e.prototype.writeDoubleBE,8,t,r),this}writeDoubleLE(t,r){return this._writeNumberValue(e.prototype.writeDoubleLE,8,t,r),this}insertDoubleLE(t,r){return this._insertNumberValue(e.prototype.writeDoubleLE,8,t,r),this}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;i0&&"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 l=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(l(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";var n=t;n.base=r(1008),n.short=r(1009),n.mont=r(1010),n.edwards=r(1011)},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(120),o=r(173),s=r(39),a=r(34),u=r(119),c=r(135),f=r(76),l=r(234),h=r(21);function d(e,t){if(!(this instanceof d))return new d(e,t);if(e instanceof d)return e;var r=this._classifyArguments(e,t);if(!r.bn||0===r.bn.cmp(new s(0)))throw new TypeError("Number can not be equal to zero, undefined, null or false");if(!r.bn.lt(c.getN()))throw new TypeError("Number must be less than N");if(void 0===r.network)throw new TypeError('Must specify the network ("livenet" or "testnet")');return a.defineImmutable(this,{bn:r.bn,compressed:r.compressed,network:r.network}),Object.defineProperty(this,"publicKey",{configurable:!1,enumerable:!0,get:this.toPublicKey.bind(this)}),this}d.prototype._classifyArguments=function(e,r){var i={compressed:!0,network:r?u.get(r):u.defaultNetwork};if(n.isUndefined(e)||n.isNull(e))i.bn=d._getRandomBN();else if(e instanceof s)i.bn=e;else if(e instanceof t||e instanceof Uint8Array)i=d._transformBuffer(e,r);else if(e.bn&&e.network)i=d._transformObject(e);else if(!r&&u.get(e))i.bn=d._getRandomBN(),i.network=u.get(e);else{if("string"!=typeof e)throw new TypeError("First argument is an unrecognized data type.");a.isHexa(e)?i.bn=new s(new t(e,"hex")):i=d._transformWIF(e,r)}return i},d._getRandomBN=function(){var e,t;do{var r=l.getRandomBuffer(32);t=s.fromBuffer(r),e=t.lt(c.getN())}while(!e);return t},d._transformBuffer=function(e,t){var r={};if(32===e.length)return d._transformBNBuffer(e,t);if(r.network=u.get(e[0],"privatekey"),!r.network)throw new Error("Invalid network");if(t&&r.network!==u.get(t))throw new TypeError("Private key network mismatch");if(34===e.length&&1===e[33])r.compressed=!0;else{if(33!==e.length)throw new Error("Length of buffer must be 33 (uncompressed) or 34 (compressed)");r.compressed=!1}return r.bn=s.fromBuffer(e.slice(1,33)),r},d._transformBNBuffer=function(e,t){var r={};return r.network=u.get(t)||u.defaultNetwork,r.bn=s.fromBuffer(e),r.compressed=!1,r},d._transformWIF=function(e,t){return d._transformBuffer(o.decode(e),t)},d.fromBuffer=function(e,t){return new d(e,t)},d._transformObject=function(e){var t=new s(e.bn,"hex"),r=u.get(e.network);return{bn:t,network:r,compressed:e.compressed}},d.fromString=d.fromWIF=function(e){return h.checkArgument(n.isString(e),"First argument is expected to be a string."),new d(e)},d.fromObject=function(e){return h.checkArgument(n.isObject(e),"First argument is expected to be an object."),new d(e)},d.fromRandom=function(e){var t=d._getRandomBN();return new d(t,e)},d.getValidationError=function(e,t){var r;try{new d(e,t)}catch(e){r=e}return r},d.isValid=function(e,t){return!!e&&!d.getValidationError(e,t)},d.prototype.toString=function(){return this.toBuffer().toString("hex")},d.prototype.toWIF=function(){var e=this.network,r=this.compressed,n;return n=r?t.concat([new t([e.privatekey]),this.bn.toBuffer({size:32}),new t([1])]):t.concat([new t([e.privatekey]),this.bn.toBuffer({size:32})]),o.encode(n)},d.prototype.toBigNumber=function(){return this.bn},d.prototype.toBuffer=function(){return this.bn.toBuffer()},d.prototype.toPublicKey=function(){return this._pubkey||(this._pubkey=f.fromPrivateKey(this)),this._pubkey},d.prototype.toAddress=function(e){var t=this.toPublicKey();return i.fromPublicKey(t,e||this.network)},d.prototype.toObject=d.prototype.toJSON=function e(){return{bn:this.bn.toString("hex"),compressed:this.compressed,network:this.network.toString()}},d.prototype.inspect=function(){var e=this.compressed?"":", uncompressed";return""},e.exports=d}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(491),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(311),e.exports.Input=r(312),e.exports.Output=r(98),e.exports.UnspentOutput=r(493),e.exports.Signature=r(175),e.exports.Sighash=r(97)},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(118);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(3),r(0).Buffer)},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(39),o=r(25),s=r(96),a=r(61),u=r(46),c=r(34),f=r(21),l=537133055,h=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};h._from=function e(t){var r={};if(o.isBuffer(t))r=h._fromBufferReader(s(t));else{if(!n.isObject(t))throw new TypeError("Unrecognized argument for BlockHeader");r=h._fromObject(t)}return r},h._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 l={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 l},h.fromObject=function e(t){var r=h._fromObject(t);return new h(r)},h.fromRawBlock=function e(r){o.isBuffer(r)||(r=new t(r,"binary"));var n=s(r);n.pos=h.Constants.START_OF_HEADER;var i=h._fromBufferReader(n);return new h(i)},h.fromBuffer=function e(t){var r=h._fromBufferReader(s(t));return new h(r)},h.fromString=function e(r){var n=new t(r,"hex");return h.fromBuffer(n)},h._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},h.fromBufferReader=function e(t){var r=h._fromBufferReader(t);return new h(r)},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 r=new i(16777215&t),n=8*((t>>>24)-3);n-- >0;)r=r.mul(new i(2));return r},h.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)},h.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(h.prototype,"id",d),Object.defineProperty(h.prototype,"hash",d),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"),r=this.getTargetDifficulty();return!(t.cmp(r)>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,r(0).Buffer)},function(e,t,r){var n=r(5).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[l>>>8&255]^u[255&h]^t[m++],p=o[f>>>24]^s[l>>>16&255]^a[h>>>8&255]^u[255&c]^t[m++],y=o[l>>>24]^s[h>>>16&255]^a[c>>>8&255]^u[255&f]^t[m++],g=o[h>>>24]^s[c>>>16&255]^a[f>>>8&255]^u[255&l]^t[m++],c=d,f=p,l=y,h=g;return d=(n[c>>>24]<<24|n[f>>>16&255]<<16|n[l>>>8&255]<<8|n[255&h])^t[m++],p=(n[f>>>24]<<24|n[l>>>16&255]<<16|n[h>>>8&255]<<8|n[255&c])^t[m++],y=(n[l>>>24]<<24|n[h>>>16&255]<<16|n[c>>>8&255]<<8|n[255&f])^t[m++],g=(n[h>>>24]<<24|n[c>>>16&255]<<16|n[f>>>8&255]<<8|n[255&l])^t[m++],d>>>=0,p>>>=0,y>>>=0,g>>>=0,[d,p,y,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 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],l=e[f],h=e[l],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*h^65537*l^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[h^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[h>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[h>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&h]]}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,r){var n=r(13);function i(e,t){var r=function(){return new n.des.Algorithm(e,t)};n.cipher.registerAlgorithm(e,r)}r(318),r(505),r(16),e.exports=n.des=n.des||{},n.des.startEncrypting=function(e,t,r,n){var i=y({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createEncryptionCipher=function(e,t){return y({key:e,output:null,decrypt:!1,mode:t})},n.des.startDecrypting=function(e,t,r,n){var i=y({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createDecryptionCipher=function(e,t){return y({key:e,output:null,decrypt:!0,mode:t})},n.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return p(r._keys,e,t,!1)},decrypt:function(e,t){return p(r._keys,e,t,!0)}}}),r._init=!1},n.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=n.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=d(t),this._init=!0}},i("DES-ECB",n.cipher.modes.ecb),i("DES-CBC",n.cipher.modes.cbc),i("DES-CFB",n.cipher.modes.cfb),i("DES-OFB",n.cipher.modes.ofb),i("DES-CTR",n.cipher.modes.ctr),i("3DES-ECB",n.cipher.modes.ecb),i("3DES-CBC",n.cipher.modes.cbc),i("3DES-CFB",n.cipher.modes.cfb),i("3DES-OFB",n.cipher.modes.ofb),i("3DES-CTR",n.cipher.modes.ctr);var o=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],s=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],a=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],u=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],c=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],f=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],l=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],h=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function d(e){for(var t=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],r=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],o=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],s=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],a=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],u=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],c=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],f=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],l=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],h=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],d=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],p=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],y=e.length()>8?3:1,g=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=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],A=u[S>>>28]|c[S>>>24&15]|f[S>>>20&15]|l[S>>>16&15]|h[S>>>12&15]|d[S>>>8&15]|p[S>>>4&15];v=65535&(A>>>16^k),g[b++]=k^v,g[b++]=A^v<<16}}return g}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 y=t[0],g=t[1];p=252645135&(y>>>4^g),g^=p,y^=p<<4,p=65535&(y>>>16^g),g^=p,y^=p<<16,p=858993459&(g>>>2^y),y^=p,g^=p<<2,p=16711935&(g>>>8^y),y^=p,g^=p<<8,p=1431655765&(y>>>1^g),g^=p,y^=p<<1,y=y<<1|y>>>31,g=g<<1|g>>>31;for(var m=0;m>>4|g<<28)^e[_+1];p=y,y=g,g=p^(s[w>>>24&63]|u[w>>>16&63]|f[w>>>8&63]|h[63&w]|o[S>>>24&63]|a[S>>>16&63]|c[S>>>8&63]|l[63&S])}p=y,y=g,g=p}y=y>>>1|y<<31,g=g>>>1|g<<31,p=1431655765&(y>>>1^g),g^=p,y^=p<<1,p=16711935&(g>>>8^y),y^=p,g^=p<<8,p=858993459&(g>>>2^y),y^=p,g^=p<<2,p=65535&(y>>>16^g),g^=p,y^=p<<16,p=252645135&(y>>>4^g),g^=p,y^=p<<4,r[0]=y,r[1]=g}function y(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(13);if(r(87),r(239),r(122),r(513),r(514),r(68),r(16),void 0===i)var i=n.jsbn.BigInteger;var o=n.asn1;n.pki=n.pki||{},e.exports=n.pki.rsa=n.rsa=n.rsa||{};var s=n.pki,a=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",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:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},c={name:"RSAPrivateKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},f={name:"RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},l=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",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:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},h=function(e){var t;if(!(e.algorithm in s.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=s.oids[e.algorithm];var n=o.oidToDer(t).getBytes(),i=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]),a=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]);a.value.push(o.create(o.Class.UNIVERSAL,o.Type.OID,!1,n)),a.value.push(o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,""));var u=o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(a),i.value.push(u),o.toDer(i).getBytes()},d=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var o;t.dP||(t.dP=t.d.mod(t.p.subtract(i.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(i.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{o=new i(n.util.bytesToHex(n.random.getBytes(t.n.bitLength()/8)),16)}while(o.compareTo(t.n)>=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,l=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 l=s.getByte();if(0!==l||c!==o-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function g(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 m(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 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=n.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),i=0;i0;)l.putByte(0),--h;return l.putBytes(n.util.hexToBytes(f)),l.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),l=n.util.createBuffer(),h=s-Math.ceil(f.length/2);h>0;)l.putByte(0),--h;return l.putBytes(n.util.hexToBytes(f)),!1!==o?y(l.getBytes(),t,r):l.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||fl?e.pqState=0:e.num.isProbablePrime(b(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;g(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=y(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=y(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:y};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:h},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,l,h,d,p,y,g;if(o.validate(e,u,t,r)&&(e=o.fromDer(n.util.createBuffer(t.privateKey))),t={},r=[],!o.validate(e,c,t,r)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=r,m}return a=n.util.createBuffer(t.privateKeyModulus).toHex(),f=n.util.createBuffer(t.privateKeyPublicExponent).toHex(),l=n.util.createBuffer(t.privateKeyPrivateExponent).toHex(),h=n.util.createBuffer(t.privateKeyPrime1).toHex(),d=n.util.createBuffer(t.privateKeyPrime2).toHex(),p=n.util.createBuffer(t.privateKeyExponent1).toHex(),y=n.util.createBuffer(t.privateKeyExponent2).toHex(),g=n.util.createBuffer(t.privateKeyCoefficient).toHex(),s.setRsaPrivateKey(new i(a,16),new i(f,16),new i(l,16),new i(h,16),new i(d,16),new i(p,16),new i(y,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,m(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.e)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.d)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.p)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.q)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.dP)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.dQ)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.qInv))])},s.publicKeyFromAsn1=function(e){var t={},r=[];if(o.validate(e,l,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(),h=n.util.createBuffer(t.publicKeyExponent).toHex();return s.setRsaPublicKey(new i(c,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,m(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.e))])}},function(e,t,r){var n=r(13),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 l(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=l,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=l,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]:b(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=m(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+=m(n));return i?o:"0"}function A(){var e=u();return a.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 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 T(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 I(){return this.t<=0?0:this.DB*(this.t-1)+T(this.data[this.t-1]^this.s&this.DM)}function B(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 O(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 R(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 j(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 M(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 l=o.t,h=o.data[l-1];if(0!=h){var d=h*(1<1?o.data[l-2]>>this.F2:0),p=this.FV/d,y=(1<=0&&(r.data[r.t++]=1,r.subTo(v,r)),a.ONE.dlShiftTo(l,v),v.subTo(o,o);o.t=0;){var _=r.data[--m]==h?this.DM:Math.floor(r.data[m]*p+(r.data[m-1]+g)*y);if((r.data[m]+=o.am(0,_,r,b,0,l))<_)for(o.dlShiftTo(b,v),r.subTo(v,r);r.data[m]<--_;)r.subTo(v,r)}null!=t&&(r.drShiftTo(l,t),s!=c&&a.ZERO.subTo(t,t)),r.t=l,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 U(e){this.m=e}function F(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function K(e){return e}function q(e){e.divRemTo(this.m,null,e)}function H(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function z(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 G(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=T(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 U(t):new G(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),me,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 le(e){return 0==this.compareTo(e)}function he(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 Ce(){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 Me(e){var t=u();return this.subTo(e,t),t}function De(e){var t=u();return this.multiplyTo(e,t),t}function Ue(e){var t=u();return this.divRemTo(e,t,null),t}function Fe(e){var t=u();return this.divRemTo(e,null,t),t}function Ke(e){var t=u(),r=u();return this.divRemTo(e,t,r),new Array(t,r)}function qe(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 ze(){}function Ve(e){return e}function Ge(e,t,r){e.multiplyTo(t,r)}function We(e,t){e.squareTo(t)}function $e(e){return this.exp(e,new ze)}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 U(t):t.isEven()?new Xe(t):new G(t);var s=new Array,a=3,c=n-1,f=(1<1){var l=u();for(o.sqrTo(s[1],l);a<=f;)s[a]=u(),o.mulTo(l,s[a-2],s[a]),a+=2}var h=e.t-1,d,p=!0,y=u(),g;for(r=T(e.data[h])-1;h>=0;){for(r>=c?d=e.data[h]>>r-c&f:(d=(e.data[h]&(1<0&&(d|=e.data[h-1]>>this.DB+r-c)),a=n;0==(1&d);)d>>=1,--a;if((r-=a)<0&&(r+=this.DB,--h),p)s[d].copyTo(i),p=!1;else{for(;a>1;)o.sqrTo(i,y),o.sqrTo(y,i),a-=2;a>0?o.sqrTo(i,y):(g=i,i=y,y=g),o.mulTo(y,s[d],i)}for(;h>=0&&0==(e.data[h]&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}U.prototype.convert=F,U.prototype.revert=K,U.prototype.reduce=q,U.prototype.mulTo=H,U.prototype.sqrTo=z,G.prototype.convert=W,G.prototype.revert=$,G.prototype.reduce=Y,G.prototype.mulTo=X,G.prototype.sqrTo=J,a.prototype.copyTo=v,a.prototype.fromInt=_,a.prototype.fromString=S,a.prototype.clamp=E,a.prototype.dlShiftTo=B,a.prototype.drShiftTo=O,a.prototype.lShiftTo=P,a.prototype.rShiftTo=R,a.prototype.subTo=N,a.prototype.multiplyTo=j,a.prototype.squareTo=L,a.prototype.divRemTo=M,a.prototype.invDigit=V,a.prototype.isEven=Z,a.prototype.exp=Q,a.prototype.toString=k,a.prototype.negate=A,a.prototype.abs=x,a.prototype.compareTo=C,a.prototype.bitLength=I,a.prototype.mod=D,a.prototype.modPowInt=ee,a.ZERO=w(0),a.ONE=w(1),ze.prototype.convert=Ve,ze.prototype.revert=Ve,ze.prototype.mulTo=Ge,ze.prototype.sqrTo=We,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++>>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,l=Math.max(0,a-e.length+1),h=Math.min(a,t.length-1);l<=h;l++){var d=a-l,p=e.words[d],y=t.words[l],g=p*y+f;c+=g/67108864|0,f=67108863&g}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 l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.ishrn(l);l-- >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 y=i.ureduce();return y.negative^=1,y.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){(function(e,r){var n=200,i="Expected a function",o="__lodash_hash_undefined__",s=1,a=2,u=1/0,c=9007199254740991,f="[object Arguments]",l="[object Array]",h="[object Boolean]",d="[object Date]",p="[object Error]",y="[object Function]",g="[object GeneratorFunction]",m="[object Map]",b="[object Number]",v="[object Object]",_="[object Promise]",w="[object RegExp]",S="[object Set]",E="[object String]",k="[object Symbol]",A="[object WeakMap]",x="[object ArrayBuffer]",C="[object DataView]",T="[object Float32Array]",I="[object Float64Array]",B="[object Int8Array]",O="[object Int16Array]",P="[object Int32Array]",R="[object Uint8Array]",N="[object Uint8ClampedArray]",j="[object Uint16Array]",L="[object Uint32Array]",M=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,D=/^\w*$/,U=/^\./,F=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,K=/[\\^$.*+?()[\]{}|]/g,q=/\\(\\)?/g,H=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,V={};V[T]=V[I]=V[B]=V[O]=V[P]=V[R]=V[N]=V[j]=V[L]=!0,V[f]=V[l]=V[x]=V[h]=V[C]=V[d]=V[p]=V[y]=V[m]=V[b]=V[v]=V[w]=V[S]=V[E]=V[A]=!1;var G="object"==typeof e&&e&&e.Object===Object&&e,W="object"==typeof self&&self&&self.Object===Object&&self,$=G||W||Function("return this")(),Y="object"==typeof t&&t&&!t.nodeType&&t,J=Y&&"object"==typeof r&&r&&!r.nodeType&&r,X=J&&J.exports===Y,Z=X&&G.process,Q=function(){try{return Z&&Z.binding("util")}catch(e){}}(),ee=Q&&Q.isTypedArray;function te(e,t){for(var r=-1,n=e?e.length:0,i=0,o=[];++r-1}function Xe(e,t){var r=this.__data__,n=pt(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 l=o.get(e);if(l&&o.get(t))return l==t;var h=-1,d=!0,p=i&s?new it:void 0;for(o.set(e,t),o.set(t,e);++h-1&&e%1==0&&e-1&&e%1==0&&e<=c}function cr(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function fr(e){return!!e&&"object"==typeof e}function lr(e){return"symbol"==typeof e||fr(e)&&ve.call(e)==k}var hr=ee?oe(ee):xt;function dr(e){return null==e?"":Pt(e)}function pr(e,t,r){var n=null==e?void 0:vt(e,t);return void 0===n?r:n}function yr(e,t){return null!=e&&Ht(e,t,wt)}function gr(e){return or(e)?dt(e):Tt(e)}function mr(e){return e}function br(e){return Vt(e)?ne(Zt(e)):Ot(e)}r.exports=er}).call(this,r(8),r(32)(e))},function(e,t,r){"use strict";var n=t,i=r(0).Buffer,o=r(163);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";t.Address4=r(545),t.Address6=r(1110),t.v6={helpers:r(551)}},function(e,t,r){"use strict";const n=r(9);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";(function(t){const n=r(9),i=r(427),o=r(48).utils.asyncFilter,s=r(48).utils.asyncSort,a=r(48).Key,u=r(434);class c{constructor(e,t){let n;t&&t.db?(n=t.db,delete t.db):n=r(437),this.db=i(u(n(e),{valueEncoding:"binary"}),Object.assign({},t,{compression:!1}),e=>{if(e)throw e})}open(e){this.db.open(e)}put(e,t,r){this.db.put(e.toString(),t,r)}get(e,t){this.db.get(e.toString(),t)}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=>{t(e)})}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=c}).call(this,r(0).Buffer)},function(e,t,r){var n=r(1187),i=r(1188),o=r(1189),s=r(1190),a=r(1191);function u(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t({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),h.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})}),h.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 `}}p.deserialize=((e,t)=>{let r;try{r=h.Message.decode(e)}catch(e){return setImmediate(()=>t(e))}const n=r.wantlist&&r.wantlist.full||!1,o=new p(n);return r.wantlist&&r.wantlist.entries.forEach(e=>{let r;try{r=new u(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 u(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,r)=>{e.prefix&&e.data||r();const n=f(e.prefix),s=n[0],a=n[1],h=n[2];l(e.data,h,(n,f)=>{if(n)return r(n);let l;try{l=new u(s,c[a.toString("16")],f)}catch(n){return t(n)}o.addBlock(new i(e.data,l)),r()})},e=>{if(e)return t(e);t(null,o)}):void t(null,o)}),p.Entry=d,e.exports=p},function(e,t,r){"use strict";const n=r(1258),i=r(1259);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(Array.from(this.set.entries()),e=>e[1].key))}contains(e){const t=e.buffer.toString();return this.set.get(t)}}o.Entry=i,e.exports=o},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(1309),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(3))},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(1326),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(3))},function(e,t,r){(function(t){e.exports=l;var n=r(1333)("simple-peer"),i=r(1335),o=r(1),s=r(134),a=r(12),u=65536,c=5e3,f=5e3;function l(e){var t=this;if(!(t instanceof l))return new l(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||l.channelConfig,t.config=e.config||l.config,t.constraints=t._transformConstraints(e.constraints||l.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 WeakMap,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)&&h(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 h(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 y(){}o(l,a.Duplex),l.WEBRTC_SUPPORT=!!i(),l.config={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:global.stun.twilio.com:3478?transport=udp"}]},l.constraints={},l.channelConfig={},Object.defineProperty(l.prototype,"bufferSize",{get:function(){var e=this;return this._channel&&this._channel.bufferedAmount||0}}),l.prototype.address=function(){var e=this;return{port:this.localPort,family:"IPv4",address:this.localAddress}},l.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"))},l.prototype._addIceCandidate=function(e){var t=this;try{t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e),y,function(e){t.destroy(p(e,"ERR_ADD_ICE_CANDIDATE"))})}catch(e){t.destroy(p("error adding candidate: "+e.message,"ERR_ADD_ICE_CANDIDATE"))}},l.prototype.send=function(e){var t=this;this._channel.send(e)},l.prototype.addStream=function(e){var t=this;t._debug("addStream()"),e.getTracks().forEach(function(r){t.addTrack(r,e)})},l.prototype.addTrack=function(e,t){var r=this;this._debug("addTrack()");var n=this._pc.addTrack(e,t),i=this._senderMap.get(e)||new WeakMap;i.set(t,n),this._senderMap.set(e,i),this._needsNegotiation()},l.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"))},l.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)}},l.prototype.removeStream=function(e){var t=this;t._debug("removeSenders()"),e.getTracks().forEach(function(r){t.removeTrack(r,e)})},l.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))},l.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},l.prototype.destroy=function(e){var t=this;this._destroy(e,function(){})},l.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()}},l.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)},l.prototype._read=function(){},l.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},l.prototype._onFinish=function(){var e=this;function t(){setTimeout(function(){e.destroy()},1e3)}e.destroyed||(e.connected?t():e.once("connect",t))},l.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))},l.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"))})},l.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"))})},l.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."))}},l.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,[])},l.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())},l.prototype._onInterval=function(){var e=this;!this._cb||!this._channel||this._channel.bufferedAmount>65536||this._onChannelBufferedAmountLow()},l.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))},l.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())},l.prototype._onChannelMessage=function(e){var r=this;if(!this.destroyed){var n=e.data;n instanceof ArrayBuffer&&(n=t.from(n)),this.push(n)}},l.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)}},l.prototype._onChannelOpen=function(){var e=this;this.connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())},l.prototype._onChannelClose=function(){var e=this;this.destroyed||(this._debug("on channel close"),this.destroy())},l.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))})},l.prototype.setConstraints=function(e){var t=this;this.initiator?this.offerConstraints=this._transformConstraints(e):this.answerConstraints=this._transformConstraints(e)},l.prototype._debug=function(){var e=this,t=[].slice.call(arguments);t[0]="["+this._id+"] "+t[0],n.apply(null,t)},l.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,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";(function(n){const i=r(9),o=r(58),s=r(4);function a(){return(~~(1e9*Math.random())).toString(36)}function u(e,t){const r=n.isBuffer(e)?[e]:[n.from(e)];i(i.values(r),o.encode(),i.collect((e,r)=>{if(e)return t(e);t(null,r[0])}))}function c(e){const t=a();function r(e){return r=>{Array.isArray(r)&&(r=r.join(" ")),e("(%s) %s",t,r)}}const n=r(s("mss:"+e));return n.error=r(s("mss:"+e+":error")),n}t=e.exports,t.writeEncoded=((e,t,r)=>{u(t,(t,n)=>{if(t)return r(t);e.write(n)})}),t.log={},t.log.dialer=(()=>c("dialer\t")),t.log.listener=(()=>c("listener\t"))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(2),i=r(83),o=r(77),s=r(10);function a(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 u=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){if(r)return n(r);if(!t.length)return n(null,i.multihash);const o=t[0],s=i.links.find(e=>e.name===o);if(!s)return n(new Error(`no link named "${o}" under ${i.toJSON().multihash}`));e.get(s.multihash,u.bind(null,t.slice(1)))}e.get(o,u.bind(null,a))},n)});t.parseIpfsPath=a,t.resolvePath=u},function(e,t,r){var n=r(1557);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,l=!1,h=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?l||o(!0===s?null:s):(f=t(f,n),h=f&&f.length||0,null!=f&&y(),h0;)r=n.nextValue(),s=Math.floor(r*e.length),t.push(e.splice(s,1)[0]);return t.join("")}function d(){return a||(a=h(),a)}function p(e){var t=d();return t[e]}function y(){return o||i}e.exports={get:y,characters:f,seed:l,lookup:p,shuffled:d}},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){(function(t){var n=r(12).Transform,i=r(56).inherits,o=r(28);function s(e){n.call(this,e),this._destroyed=!1}function a(e,t,r){r(null,e)}function u(e){return function(t,r,n){return"function"==typeof t&&(n=r,r=t,t={}),"function"!=typeof r&&(r=a),"function"!=typeof n&&(n=null),e(t,r,n)}}i(s,n),s.prototype.destroy=function(e){if(!this._destroyed){this._destroyed=!0;var r=this;t.nextTick(function(){e&&r.emit("error",e),r.emit("close")})}},e.exports=u(function(e,t,r){var n=new s(e);return n._transform=t,r&&(n._flush=r),n}),e.exports.ctor=u(function(e,t,r){function n(t){if(!(this instanceof n))return new n(t);this.options=o(e,t),s.call(this,this.options)}return i(n,s),n.prototype._transform=t,r&&(n.prototype._flush=r),n}),e.exports.obj=u(function(e,t,r){var n=new s(o({objectMode:!0,highWaterMark:16},e));return n._transform=t,r&&(n._flush=r),n})}).call(this,r(3))},function(e,t,r){"use strict";(function(t){e.exports=b;var n=r(1735),i=r(56),o=r(1737),s="function"==typeof Symbol&&"1"!==t.env._nodeLRUCacheForceNoSymbol,a;a=s?function(e){return Symbol(e)}:function(e){return"_"+e};var u=a("max"),c=a("length"),f=a("lengthCalculator"),l=a("allowStale"),h=a("maxAge"),d=a("dispose"),p=a("noDisposeOnSet"),y=a("lruList"),g=a("cache");function m(){return 1}function b(e){if(!(this instanceof b))return new b(e);"number"==typeof e&&(e={max:e}),e||(e={});var t=this[u]=e.max;(!t||"number"!=typeof t||t<=0)&&(this[u]=1/0);var r=e.length||m;"function"!=typeof r&&(r=m),this[f]=r,this[l]=e.stale||!1,this[h]=e.maxAge||0,this[d]=e.dispose,this[p]=e.noDisposeOnSet||!1,this.reset()}function v(e,t,r,n){var i=r.value;w(e,i)&&(E(e,r),e[l]||(i=void 0)),i&&t.call(n,i.value,i.key,e)}function _(e,t,r){var n=e[g].get(t);if(n){var i=n.value;w(e,i)?(E(e,n),e[l]||(i=void 0)):r&&e[y].unshiftNode(n),i&&(i=i.value)}return i}function w(e,t){if(!t||!t.maxAge&&!e[h])return!1;var r=!1,n=Date.now()-t.now;return r=t.maxAge?n>t.maxAge:e[h]&&n>e[h],r}function S(e){if(e[c]>e[u])for(var t=e[y].tail;e[c]>e[u]&&null!==t;){var r=t.prev;E(e,t),t=r}}function E(e,t){if(t){var r=t.value;e[d]&&e[d](r.key,r.value),e[c]-=r.length,e[g].delete(r.key),e[y].removeNode(t)}}function k(e,t,r,n,i){this.key=e,this.value=t,this.length=r,this.now=n,this.maxAge=i||0}Object.defineProperty(b.prototype,"max",{set:function(e){(!e||"number"!=typeof e||e<=0)&&(e=1/0),this[u]=e,S(this)},get:function(){return this[u]},enumerable:!0}),Object.defineProperty(b.prototype,"allowStale",{set:function(e){this[l]=!!e},get:function(){return this[l]},enumerable:!0}),Object.defineProperty(b.prototype,"maxAge",{set:function(e){(!e||"number"!=typeof e||e<0)&&(e=0),this[h]=e,S(this)},get:function(){return this[h]},enumerable:!0}),Object.defineProperty(b.prototype,"lengthCalculator",{set:function(e){"function"!=typeof e&&(e=m),e!==this[f]&&(this[f]=e,this[c]=0,this[y].forEach(function(e){e.length=this[f](e.value,e.key),this[c]+=e.length},this)),S(this)},get:function(){return this[f]},enumerable:!0}),Object.defineProperty(b.prototype,"length",{get:function(){return this[c]},enumerable:!0}),Object.defineProperty(b.prototype,"itemCount",{get:function(){return this[y].length},enumerable:!0}),b.prototype.rforEach=function(e,t){t=t||this;for(var r=this[y].tail;null!==r;){var n=r.prev;v(this,e,r,t),r=n}},b.prototype.forEach=function(e,t){t=t||this;for(var r=this[y].head;null!==r;){var n=r.next;v(this,e,r,t),r=n}},b.prototype.keys=function(){return this[y].toArray().map(function(e){return e.key},this)},b.prototype.values=function(){return this[y].toArray().map(function(e){return e.value},this)},b.prototype.reset=function(){this[d]&&this[y]&&this[y].length&&this[y].forEach(function(e){this[d](e.key,e.value)},this),this[g]=new n,this[y]=new o,this[c]=0},b.prototype.dump=function(){return this[y].map(function(e){if(!w(this,e))return{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}},this).toArray().filter(function(e){return e})},b.prototype.dumpLru=function(){return this[y]},b.prototype.inspect=function(e,t){var r="LRUCache {",n=!1,o=this[l];o&&(r+="\n allowStale: true",n=!0);var s=this[u];s&&s!==1/0&&(n&&(r+=","),r+="\n max: "+i.inspect(s,t),n=!0);var a=this[h];a&&(n&&(r+=","),r+="\n maxAge: "+i.inspect(a,t),n=!0);var d=this[f];d&&d!==m&&(n&&(r+=","),r+="\n length: "+i.inspect(this[c],t),n=!0);var p=!1;return this[y].forEach(function(e){p?r+=",\n ":(n&&(r+=",\n"),p=!0,r+="\n ");var o=i.inspect(e.key).split("\n").join("\n "),s={value:e.value};e.maxAge!==a&&(s.maxAge=e.maxAge),d!==m&&(s.length=e.length),w(this,e)&&(s.stale=!0),s=i.inspect(s,t).split("\n").join("\n "),r+=o+" => "+s}),(p||n)&&(r+="\n"),r+="}",r},b.prototype.set=function(e,t,r){r=r||this[h];var n=r?Date.now():0,i=this[f](t,e);if(this[g].has(e)){if(i>this[u])return E(this,this[g].get(e)),!1;var o=this[g].get(e),s=o.value;return this[d]&&(this[p]||this[d](e,s.value)),s.now=n,s.maxAge=r,s.value=t,this[c]+=i-s.length,s.length=i,this.get(e),S(this),!0}var a=new k(e,t,i,n,r);return a.length>this[u]?(this[d]&&this[d](e,t),!1):(this[c]+=a.length,this[y].unshift(a),this[g].set(e,this[y].head),S(this),!0)},b.prototype.has=function(e){if(!this[g].has(e))return!1;var t=this[g].get(e).value;return!w(this,t)},b.prototype.get=function(e){return _(this,e,!0)},b.prototype.peek=function(e){return _(this,e,!1)},b.prototype.pop=function(){var e=this[y].tail;return e?(E(this,e),e.value):null},b.prototype.del=function(e){E(this,this[g].get(e))},b.prototype.load=function(e){this.reset();for(var t=Date.now(),r=e.length-1;r>=0;r--){var n=e[r],i=n.e||0;if(0===i)this.set(n.k,n.v);else{var o=i-t;o>0&&this.set(n.k,n.v,o)}}},b.prototype.prune=function(){var e=this;this[g].forEach(function(t,r){_(e,r,!1)})}}).call(this,r(3))},function(e,t,r){var n=e.exports;n.encode=r(1839),n.decode=r(1840),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 l=s[i].encode;l(e,t,a),a+=l.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-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],l=r;n-l>=8;){var h=u.decode(t,l,n);if(l+=h.length,f.indexOf(h.type)>=0)a[h.type]=h;else if(f.indexOf(h.type+"s")>=0){var d=h.type+"s",p=a[d]=a[d]||[];p.push(h)}else a.otherBoxes.push(h)}}else if(s[i]){var y=s[i].decode;a=y(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(743),t.encode=t.stringify=r(744)},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,l=o,h,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,h=[],"[object Array]"===Object.prototype.toString.apply(d)){for(a=d.length,r=0;r{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,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});var n=r(819),i=a(n),o=r(218),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,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(166);c.inherits=r(82);var f={deprecate:r(841)},l=r(443),h=r(207).Buffer,d=n.Uint8Array||function(){};function p(e){return h.from(e)}function y(e){return h.isBuffer(e)||e instanceof d}var g=r(444),m;function b(){}function v(e,t){u=u||r(108),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){T(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(108),!(m.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)),l.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=h.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=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(3),r(8))},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";(function(n){const i=r(10),o=r(17),s=o(r(870)),a=r(453),u=r(113),c=r(221),f=r(33),l=r(6);function h(e,t,r){"function"==typeof t&&(r=t,t={}),t=t||{};const n=t.hashAlg||a.defaultHashAlg;let o=t.version;void 0===o&&(o="sha2-256"===n?0:1),l([t=>d(e,t),(e,t)=>f(e,n,t),(e,t)=>t(null,new i(o,a.multicodec,e))],r)}function d(e,t){let r;!c.isDAGNode(e)&&e.links&&(e.links=e.links.map(e=>u.isDAGLink(e)?e:u.util.createDagLinkFromB58EncodedHash(e)));try{r=s.PBNode.encode(y(e))}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):n.from(r.Data);c.create(o,i,t)}function y(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.multihash,Name:e.name,Tsize:e.size})):t.Links=null,t}t=e.exports,t.serialize=d,t.deserialize=p,t.cid=h}).call(this,r(0).Buffer)},function(e,t,r){"use strict";t.defined=function(e){return null!==e&&void 0!==e&&("number"!=typeof e||!isNaN(e))}},function(e,t,r){"use strict";(function(e){const n=r(224),i=r(225),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<{"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=r(5).Buffer;function i(e){if(e.length<8)return!1;if(e.length>72)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,t,r){var n=t;n.utils=r(73),n.common=r(168),n.sha=r(900),n.ripemd=r(904),n.hmac=r(905),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,r){"use strict";var n=r(1),i=r(915),o=r(115),s=r(5).Buffer,a=r(916),u=r(468),c=r(469),f=s.alloc(128);function l(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>>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 l(e,t,r,n,i,o,s){return u(e+(t^r^n)+i+o|0,s)+t|0}function h(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=l(r,n,i,o,e[5],4294588738,4),o=l(o,r,n,i,e[8],2272392833,11),i=l(i,o,r,n,e[11],1839030562,16),n=l(n,i,o,r,e[14],4259657740,23),r=l(r,n,i,o,e[1],2763975236,4),o=l(o,r,n,i,e[4],1272893353,11),i=l(i,o,r,n,e[7],4139469664,16),n=l(n,i,o,r,e[10],3200236656,23),r=l(r,n,i,o,e[13],681279174,4),o=l(o,r,n,i,e[0],3936430074,11),i=l(i,o,r,n,e[3],3572445317,16),n=l(n,i,o,r,e[6],76029189,23),r=l(r,n,i,o,e[9],3654602809,4),o=l(o,r,n,i,e[12],3873151461,11),i=l(i,o,r,n,e[15],530742520,16),n=l(n,i,o,r,e[2],3299628645,23),r=h(r,n,i,o,e[0],4096336452,6),o=h(o,r,n,i,e[7],1126891415,10),i=h(i,o,r,n,e[14],2878612391,15),n=h(n,i,o,r,e[5],4237533241,21),r=h(r,n,i,o,e[12],1700485571,6),o=h(o,r,n,i,e[3],2399980690,10),i=h(i,o,r,n,e[10],4293915773,15),n=h(n,i,o,r,e[1],2240044497,21),r=h(r,n,i,o,e[8],1873313359,6),o=h(o,r,n,i,e[15],4264355552,10),i=h(i,o,r,n,e[6],2734768916,15),n=h(n,i,o,r,e[13],1309151649,21),r=h(r,n,i,o,e[4],4149444226,6),o=h(o,r,n,i,e[11],3174756917,10),i=h(i,o,r,n,e[2],718787259,15),n=h(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){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(5).Buffer,i=r(95),o=r(23),s=r(927),a=r(29),u=r(36),c=r(74),f=r(474);function l(e){const t=e.length;return f.encodingLength(t)+t}function h(e){const t=e.length;return f.encodingLength(t)+e.reduce(function(e,t){return e+l(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),y=[],g=n.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),m=n.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),b=n.from("ffffffffffffffff","hex"),v={script:p,valueBuffer:b};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 l(){const e=u(),t=[];for(var r=0;r=this.ins.length)return m;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 m;f.outs.length=e+1;for(var l=0;l>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),l=[],h=0;h=c.length||l.push(p)}if(1!==f)throw new Error("Invalid checksum for "+e);return{prefix:s,words:l}}function l(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 l(e,o,s){h(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 h(t,r,i){let o=[];"leaf"===t.type&&o.push({path:y(t.getKey()),value:t.getValue()}),n(t.getChildren(),(t,n)=>{const i=y(t[0]),s=t[1];if(a.isRawNode(s)){const e=new a(s);o.push({path:i,value:e}),h(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 y(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(489),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(21),o=r(25),s=r(34);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(21),o=r(0),s=t.compare||r(1018),a=r(65),u=r(25),c=r(34),f=r(96),l=r(61),h=r(46),d=r(66),p=r(97),y=r(120),g=r(493),m=r(312),b=m.PublicKeyHash,v=m.PublicKey,_=m.MultiSigScriptHash,w=m.MultiSig,S=r(98),E=r(67),k=r(231),A=r(39),x=r(1023);function C(e){if(!(this instanceof C))return new C(e);if(this.inputs=[],this.outputs=[],this.joinSplits=[],this._inputAmount=void 0,this._outputAmount=void 0,e){if(e instanceof C)return C.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 T=1,I=0,B=1e6;C.DUST_AMOUNT=546,C.FEE_SECURITY_MARGIN=15,C.MAX_MONEY=21e14,C.NLOCKTIME_BLOCKHEIGHT_LIMIT=5e8,C.NLOCKTIME_MAX_VALUE=4294967295,C.FEE_PER_KB=1e4,C.CHANGE_OUTPUT_MAX_SIZE=62,C.MAXIMUM_EXTRA_SIZE=26,C.shallowCopy=function(e){var t=new C(e.toBuffer());return t};var O={configurable:!1,enumerable:!0,get:function(){return new f(this._getHash()).readReverse().toString("hex")}};Object.defineProperty(C.prototype,"hash",O),Object.defineProperty(C.prototype,"id",O);var P={configurable:!1,enumerable:!0,get:function(){return this._getInputAmount()}};Object.defineProperty(C.prototype,"inputAmount",P),P.get=function(){return this._getOutputAmount()},Object.defineProperty(C.prototype,"outputAmount",P),C.prototype._getHash=function(){return h.sha256sha256(this.toBuffer())},C.prototype.serialize=function(e){return!0===e||e&&e.disableAll?this.uncheckedSerialize():this.checkedSerialize(e)},C.prototype.uncheckedSerialize=C.prototype.toString=function(){return this.toBuffer().toString("hex")},C.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()},C.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()/C.FEE_SECURITY_MARGIN);if(t"},C.prototype.toBuffer=function(){var e=new l;return this.toBufferWriter(e).toBuffer()},C.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},C.prototype.fromBuffer=function(e){var t=new f(e);return this.fromBufferReader(t)},C.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},C.prototype.toObject=C.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},C.prototype.fromObject=function e(r){i.checkArgument(n.isObject(r)||r instanceof C);var o=this,s;return s=r instanceof C?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 m.PublicKeyHash(e);else if(t.isScriptHashOut()&&e.publicKeys&&e.threshold)r=new m.MultiSigScriptHash(e,e.publicKeys,e.threshold,e.signatures);else{if(!t.isPublicKeyOut())throw new a.Transaction.Input.UnsupportedScript(e.output.script);r=new m.PublicKey(e)}o.addInput(r)}else o.uncheckedAddInput(new m(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 x(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},C.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")},C.prototype.lockUntilDate=function(e){if(i.checkArgument(e),n.isNumber(e)&&e=C.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}},C.prototype.getFee=function(){return this.isCoinbase()?0:n.isUndefined(this._fee)?this._changeScript?this._estimateFee():this._getUnspentValue():this._fee},C.prototype._estimateFee=function(){var e=this._estimateSize(),t=this._getUnspentValue();return C._estimateFee(e,t,this._feePerKb)},C.prototype._getUnspentValue=function(){return this._getInputAmount()-this._getOutputAmount()},C.prototype._clearSignatures=function(){n.each(this.inputs,function(e){e.clearSignatures()})},C._estimateFee=function(e,t,r){var n=Math.ceil(e/1e3)*(r||C.FEE_PER_KB);return t>n&&(e+=C.CHANGE_OUTPUT_MAX_SIZE),Math.ceil(e/1e3)*(r||C.FEE_PER_KB)},C.prototype._estimateSize=function(){var e=C.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},C.prototype._removeOutput=function(e){var t=this.outputs[e];this.outputs=n.without(this.outputs,t),this._outputAmount=void 0},C.prototype.removeOutput=function(e){this._removeOutput(e),this._updateChangeOutput()},C.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},C.prototype.shuffleOutputs=function(){return this.sortOutputs(n.shuffle)},C.prototype.sortOutputs=function(e){var t=e(this.outputs);return this._newOutputOrder(t)},C.prototype.sortInputs=function(e){return this.inputs=e(this.inputs),this._clearSignatures(),this},C.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},C.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()},C.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)},C.prototype.getSignatures=function(e,t){e=new k(e),t=t||d.SIGHASH_ALL;var r=this,i=[],o=h.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},C.prototype.applySignature=function(e){return this.inputs[e.inputIndex].addSignature(this,e),this},C.prototype.isFullySigned=function(){return n.each(this.inputs,function(e){if(e.isFullySigned===m.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()}))},C.prototype.isValidSignature=function(e){var t=this;if(this.inputs[e.inputIndex].isValidSignature===m.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)},C.prototype.verifySignature=function(e,t,r,n){return p.verify(this,e,t,r,n)},C.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 A(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=m.MAXINT-1&&(t.sequenceNumber=m.DEFAULT_RBF_SEQNUMBER)}return this},e.exports=C}).call(this,r(0).Buffer)},function(e,t,r){e.exports=r(174),e.exports.PublicKey=r(1019),e.exports.PublicKeyHash=r(1020),e.exports.MultiSig=r(1021),e.exports.MultiSigScriptHash=r(1022)},function(e,t,r){"use strict";var n=r(15),i=r(65),o=r(21),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{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(99)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){var n=r(13);r(16),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var i=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};i.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},i.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},i.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){var n=r(13);r(88),r(16);var i=e.exports=n.md5=n.md5||{};n.md.md5=n.md.algorithms.md5=i,i.create=function(){c||f();var e=null,t=n.util.createBuffer(),r=new Array(16),i={algorithm:"md5",blockLength:64,digestLength:16,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 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,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;s.putBytes(o.substr(0,i.blockLength-u));for(var c,f=0,h=i.fullMessageLength.length-1;h>=0;--h)c=8*i.fullMessageLength[h]+f,f=c/4294967296>>>0,s.putInt32Le(c>>>0);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};l(d,r,s);var p=n.util.createBuffer();return p.putInt32Le(d.h0),p.putInt32Le(d.h1),p.putInt32Le(d.h2),p.putInt32Le(d.h3),p},i};var o=null,s=null,a=null,u=null,c=!1;function f(){o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],a=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],u=new Array(64);for(var e=0;e<64;++e)u[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));c=!0}function l(e,t,r){for(var n,i,o,c,f,l,h,d,p=r.length();p>=64;){for(i=e.h0,o=e.h1,c=e.h2,f=e.h3,d=0;d<16;++d)t[d]=r.getInt32Le(),l=f^o&(c^f),n=i+l+u[d]+t[d],h=a[d],i=f,f=c,c=o,o+=n<>>32-h;for(;d<32;++d)l=c^f&(o^c),n=i+l+u[d]+t[s[d]],h=a[d],i=f,f=c,c=o,o+=n<>>32-h;for(;d<48;++d)l=o^c^f,n=i+l+u[d]+t[s[d]],h=a[d],i=f,f=c,c=o,o+=n<>>32-h;for(;d<64;++d)l=c^(o|~f),n=i+l+u[d]+t[s[d]],h=a[d],i=f,f=c,c=o,o+=n<>>32-h;e.h0=e.h0+i|0,e.h1=e.h1+o|0,e.h2=e.h2+c|0,e.h3=e.h3+f|0,p-=64}}},function(e,t,r){(function(t){var n=r(13);r(177),r(88),r(16);var i=n.pkcs5=n.pkcs5||{},o;n.util.isNodejs&&!n.options.usePureJavaScript&&(o=r(509)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,s,a,u){if("function"==typeof a&&(u=a,a=null),n.util.isNodejs&&!n.options.usePureJavaScript&&o.pbkdf2&&(null===a||"object"!=typeof a)&&(o.pbkdf2Sync.length>4||!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 l=Math.ceil(s/c),h=s-(l-1)*c,d=n.hmac.create();d.start(a,e);var p="",y,g,m;if(!u){for(var b=1;b<=l;++b){d.start(null,null),d.update(r),d.update(n.util.int32ToBytes(b)),y=m=d.digest().getBytes();for(var v=2;v<=i;++v)d.start(null,null),d.update(m),g=d.digest().getBytes(),y=n.util.xorBytes(y,g,c),m=g;p+=bl)return u(null,p);d.start(null,null),d.update(r),d.update(n.util.int32ToBytes(b)),y=m=d.digest().getBytes(),v=2,w()}function w(){if(v<=i)return d.start(null,null),d.update(m),g=d.digest().getBytes(),y=n.util.xorBytes(y,g,c),m=g,++v,n.util.setImmediate(w);p+=b2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(y.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(l.validity.notBefore=y[0],l.validity.notAfter=y[1],l.tbsCertificate=r.tbsCertificate,t){if(l.md=null,l.signatureOid in s){var f=s[l.signatureOid];switch(f){case"sha1WithRSAEncryption":l.md=n.md.sha1.create();break;case"md5WithRSAEncryption":l.md=n.md.md5.create();break;case"sha256WithRSAEncryption":l.md=n.md.sha256.create();break;case"sha384WithRSAEncryption":l.md=n.md.sha384.create();break;case"sha512WithRSAEncryption":l.md=n.md.sha512.create();break;case"RSASSA-PSS":l.md=n.md.sha256.create()}}if(null===l.md){var u=new Error("Could not compute certificate digest. Unknown signature OID.");throw u.signatureOid=l.signatureOid,u}var g=i.toDer(l.tbsCertificate);l.md.update(g.getBytes())}var b=n.md.sha1.create();l.issuer.getField=function(e){return d(l.issuer,e)},l.issuer.addField=function(e){m([e]),l.issuer.attributes.push(e)},l.issuer.attributes=o.RDNAttributesAsArray(r.certIssuer,b),r.certIssuerUniqueId&&(l.issuer.uniqueId=r.certIssuerUniqueId),l.issuer.hash=b.digest().toHex();var v=n.md.sha1.create();return l.subject.getField=function(e){return d(l.subject,e)},l.subject.addField=function(e){m([e]),l.subject.attributes.push(e)},l.subject.attributes=o.RDNAttributesAsArray(r.certSubject,v),r.certSubjectUniqueId&&(l.subject.uniqueId=r.certSubjectUniqueId),l.subject.hash=v.digest().toHex(),r.certExtensions?l.extensions=o.certificateExtensionsFromAsn1(r.certExtensions):l.extensions=[],l.publicKey=o.publicKeyFromAsn1(r.subjectPublicKeyInfo),l},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 l;t.altNames=[];for(var r=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()),y(e.subject),o.publicKeyToAsn1(e.publicKey),_(e)]);return t},o.distinguishedNameToAsn1=function(e){return y(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(l=t[0]||e.getIssuer(f),null===l&&f.isIssuer(f)&&(h=!0,l=f),l){var d=l;n.util.isArray(d)||(d=[d]);for(var p=!1;!p&&d.length>0;){l=d.shift();try{p=l.verify(f)}catch(e){}}p||(u={message:"Certificate signature is invalid.",error:o.certificateError.bad_certificate})}null!==u||l&&!h||e.hasCertificate(f)||(u={message:"Certificate is not trusted.",error:o.certificateError.unknown_ca})}if(null===u&&l&&!f.isIssuer(l)&&(u={message:"Certificate issuer is invalid.",error:o.certificateError.bad_certificate}),null===u)for(var y={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,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,r){var n=r(13);r(68),r(16);var i=e.exports=n.pss=n.pss||{};i.create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t=e.md,r=e.mgf,i=t.digestLength,o=e.salt||null,s;if("string"==typeof o&&(o=n.util.createBuffer(o)),"saltLength"in e)s=e.saltLength;else{if(null===o)throw new Error("Salt length not specified or specific salt not given.");s=o.length()}if(null!==o&&o.length()!==s)throw new Error("Given salt length does not match length of given salt.");var a=e.prng||n.random,u={encode:function(e,u){var c,f=u-1,l=Math.ceil(f/8),h=e.digest().getBytes(),d;if(l>8*l-f&255;return _=String.fromCharCode(_.charCodeAt(0)&~w)+_.substr(1),_+y+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!=(h.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var y=r.generate(d,l),g="";for(u=0;u{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(99)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t){t.BITS=32,t.GROUPS=4,t.RE_ADDRESS=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g,t.RE_SUBNET_STRING=/\/\d{1,2}$/},function(e,t){t.BITS=128,t.GROUPS=8,t.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},t.TYPES={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"},t.RE_BAD_CHARACTERS=/([^0-9a-f:\/%])/gi,t.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,t.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/,t.RE_ZONE_STRING=/%.*$/,t.RE_URL=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),t.RE_URL_WITH_PORT=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/)},function(e,t,r){"use strict";const n=r(62);function i(e){if("number"==typeof e){if(i.codes[e])return i.codes[e];throw new Error("no protocol with code: "+e)}if("string"==typeof e||e instanceof String){if(i.names[e])return i.names[e];throw new Error("no protocol with name: "+e)}throw new Error("invalid protocol id type: "+e)}const o=-1;function s(e,t,r,n){return{code:e,size:t,name:r,resolvable:Boolean(n)}}i.lengthPrefixedVarSize=o,i.V=o,i.table=[[4,32,"ip4"],[6,16,"tcp"],[17,16,"udp"],[33,16,"dccp"],[41,128,"ip6"],[54,o,"dns4","resolvable"],[55,o,"dns6","resolvable"],[56,o,"dnsaddr","resolvable"],[132,16,"sctp"],[302,0,"utp"],[421,i.lengthPrefixedVarSize,"ipfs"],[480,0,"http"],[443,0,"https"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[290,0,"p2p-circuit"]],i.names={},i.codes={},n(i.table,function(e){const t=s.apply(null,e);i.codes[t.code]=t,i.names[t.name]=t}),i.object=s,e.exports=i},function(e,t,r){"use strict";const n=r(62);function i(e){if("number"==typeof e){if(i.codes[e])return i.codes[e];throw new Error("no protocol with code: "+e)}if("string"==typeof e||e instanceof String){if(i.names[e])return i.names[e];throw new Error("no protocol with name: "+e)}throw new Error("invalid protocol id type: "+e)}const o=-1;function s(e,t,r,n){return{code:e,size:t,name:r,resolvable:Boolean(n)}}i.lengthPrefixedVarSize=o,i.V=o,i.table=[[4,32,"ip4"],[6,16,"tcp"],[17,16,"udp"],[33,16,"dccp"],[41,128,"ip6"],[54,o,"dns4","resolvable"],[55,o,"dns6","resolvable"],[56,o,"dnsaddr","resolvable"],[132,16,"sctp"],[302,0,"utp"],[421,i.lengthPrefixedVarSize,"ipfs"],[480,0,"http"],[443,0,"https"],[460,0,"quic"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[290,0,"p2p-circuit"]],i.names={},i.codes={},n(i.table,function(e){const t=s.apply(null,e);i.codes[t.code]=t,i.names[t.name]=t}),i.object=s,e.exports=i},function(e,t,r){"use strict";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(99)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){"use strict";(function(t){ +!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 l=!u.JS_SHA3_NO_COMMON_JS&&"object"==typeof e&&e.exports,h=r(833),d=!u.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,p="0123456789abcdef".split(""),y=[31,7936,2031616,520093696],g=[4,1024,262144,67108864],m=[1,256,65536,16777216],b=[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 A=function(e,t,r){return function(n){return new H(e,t,e).update(n)[r]()}},x=function(e,t,r){return function(n,i){return new H(e,t,i).update(n)[r]()}},C=function(e,t,r){return function(t,n,i,o){return j["cshake"+e].update(t,n,i,o)[r]()}},T=function(e,t,r){return function(t,n,i,o){return j["kmac"+e].update(t,n,i,o)[r]()}},I=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 z(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,l;u>2]|=e[u]<>2]|=l<>2]|=(192|l>>6)<>2]|=(128|63&l)<=57344?(n[f>>2]|=(224|l>>12)<>2]|=(128|l>>6&63)<>2]|=(128|63&l)<>2]|=(240|l>>18)<>2]|=(128|l>>12&63)<>2]|=(128|l>>6&63)<>2]|=(128|63&l)<=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&&(V(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&&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},z.prototype=new H,z.prototype.finalize=function(){return this.encode(this.outputBits,!0),H.prototype.finalize.call(this)};var V=function(e){var t,r,n,i,o,s,a,u,c,f,l,h,d,p,y,g,m,b,v,w,S,E,k,A,x,C,T,I,B,O,P,R,N,j,L,M,D,U,F,K,q,H,z,V,G,W,$,Y,J,Z,X,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],l=e[7]^e[17]^e[27]^e[37]^e[47],h=e[8]^e[18]^e[28]^e[38]^e[48],d=e[9]^e[19]^e[29]^e[39]^e[49],t=h^(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|l>>>31),r=a^(l<<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^(h<<1|d>>>31),r=c^(d<<1|h>>>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=l^(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],y=e[1],W=e[11]<<4|e[10]>>>28,$=e[10]<<4|e[11]>>>28,I=e[20]<<3|e[21]>>>29,B=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,z=e[41]<<18|e[40]>>>14,j=e[2]<<1|e[3]>>>31,L=e[3]<<1|e[2]>>>31,g=e[13]<<12|e[12]>>>20,m=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,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,M=e[14]<<6|e[15]>>>26,D=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,R=e[45]<<29|e[44]>>>3,N=e[44]<<29|e[45]>>>3,A=e[6]<<28|e[7]>>>4,x=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,U=e[26]<<25|e[27]>>>7,F=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,V=e[8]<<27|e[9]>>>5,G=e[9]<<27|e[8]>>>5,C=e[18]<<20|e[19]>>>12,T=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,se=e[28]<<7|e[29]>>>25,K=e[38]<<8|e[39]>>>24,q=e[39]<<8|e[38]>>>24,E=e[48]<<14|e[49]>>>18,k=e[49]<<14|e[48]>>>18,e[0]=p^~g&b,e[1]=y^~m&v,e[10]=A^~C&I,e[11]=x^~T&B,e[20]=j^~M&U,e[21]=L^~D&F,e[30]=V^~W&Y,e[31]=G^~$&J,e[40]=te^~ne&oe,e[41]=re^~ie&se,e[2]=g^~b&w,e[3]=m^~v&S,e[12]=C^~I&O,e[13]=T^~B&P,e[22]=M^~U&K,e[23]=D^~F&q,e[32]=W^~Y&Z,e[33]=$^~J&X,e[42]=ne^~oe&ae,e[43]=ie^~se&ue,e[4]=b^~w&E,e[5]=v^~S&k,e[14]=I^~O&R,e[15]=B^~P&N,e[24]=U^~K&H,e[25]=F^~q&z,e[34]=Y^~Z&Q,e[35]=J^~X&ee,e[44]=oe^~ae&ce,e[45]=se^~ue&fe,e[6]=w^~E&p,e[7]=S^~k&y,e[16]=O^~R&A,e[17]=P^~N&x,e[26]=K^~H&j,e[27]=q^~z&L,e[36]=Z^~Q&V,e[37]=X^~ee&G,e[46]=ae^~ce&te,e[47]=ue^~fe&re,e[8]=E^~p&g,e[9]=k^~y&m,e[18]=R^~A&C,e[19]=N^~x&T,e[28]=H^~j&M,e[29]=z^~L&D,e[38]=Q^~V&W,e[39]=ee^~G&$,e[48]=ce^~te&ne,e[49]=fe^~re&ie,e[0]^=_[n],e[1]^=_[n+1]};if(l)e.exports=j;else{for(M=0;M`}toJSON(){return this._json||(this._json=Object.freeze({name:this.name,size:this.size,multihash:this._cid.toBaseEncodedString()})),Object.assign({},this._json)}get name(){return this._name}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 multihash(){return this._cid.buffer}set multihash(e){throw new Error("Can't set property: 'multihash' is immutable")}get cid(){return this._cid}set cid(e){throw new Error("Can't set property: 'cid' is immutable")}}t=e.exports=o(s,{className:"DAGLink",symbolName:"@ipld/js-ipld-dag-pb/daglink"}),t.create=r(852),t.util=r(853)},function(e,t,r){(function(t){const n=r(31),i=r(57).ec,o=new i("secp256k1"),s=r(894),a=t.alloc(32,0),u=t.from("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),c=t.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex"),f=o.curve.n,l=f.shrn(1),h=o.curve.g,d="Expected Private",p="Expected Point",y="Expected Tweak",g="Expected Hash",m="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 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!!b(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 A(e,t){return void 0===e&&void 0!==t?w(t):void 0===e||e}function x(e){return new n(e)}function C(e){return e.toArrayLike(t,"be",32)}function T(e){return o.curve.decodePoint(e)}function I(e,r){return t.from(e._encode(r))}function B(e,t,r){if(!_(e))throw new TypeError(p);if(!_(t))throw new TypeError(p);const n=T(e),i=T(t),o=n.add(i);if(o.isInfinity())return null;const s=A(r,e);return I(o,s)}function O(e,t,r){if(!_(e))throw new TypeError(p);if(!v(t))throw new TypeError(y);const n=A(r,e),i=T(e);if(0===t.compare(a))return I(i,n);const o=x(t),s=h.mul(o),u=i.add(s);return u.isInfinity()?null:I(u,n)}function P(e,t){if(!_(e))throw new TypeError(p);const r=T(e);if(r.isInfinity())throw new TypeError(p);return I(r,t)}function R(e,t){if(!E(e))throw new TypeError(d);const r=x(e),n=h.mul(r);if(n.isInfinity())return null;const i=A(t);return I(n,i)}function N(e,t,r){if(!_(e))throw new TypeError(p);if(!v(t))throw new TypeError(y);const n=A(r,e),i=T(e),o=x(t),s=i.mul(o);return s.isInfinity()?null:I(s,n)}function j(e,t){if(!E(e))throw new TypeError(d);if(!v(t))throw new TypeError(y);const r=x(e),n=x(t),i=C(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(y);const r=x(e),n=x(t),i=C(r.sub(n).umod(f));return E(i)?i:null}function M(e,r){if(!b(e))throw new TypeError(g);if(!E(r))throw new TypeError(d);const n=x(r),i=x(e);let o,a;s(e,r,function(e){const t=x(e),r=h.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(l)>0&&(a=f.sub(a));const u=t.allocUnsafe(64);return C(o).copy(u,0),C(a).copy(u,32),u}function D(e,t,r){if(!b(e))throw new TypeError(g);if(!_(t))throw new TypeError(p);if(!k(r))throw new TypeError(m);const n=T(t),i=x(r.slice(0,32)),o=x(r.slice(32,64));if(i.gtn(0)<=0)return!1;if(o.gtn(0)<=0)return!1;const s=x(e),a=o.invm(f),u=s.mul(a).umod(f),c=i.mul(a).umod(f),l=h.mulAdd(u,n,c);if(l.isInfinity())return!1;const d=l.x,y=d.umod(f);return y.eq(i)}e.exports={isPoint:_,isPointCompressed:S,isPrivate:E,pointAdd:B,pointAddScalar:O,pointCompress:P,pointFromScalar:R,pointMultiply:N,privateAdd:j,privateSub:L,sign:M,verify:D}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(4).Buffer,i=r(93).Transform,o=r(55).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){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(472),t.ethBlock=r(478),t.ethBlockList=r(966),t.ethStateTrie=r(967),t.ethStorageTrie=r(970),t.ethTx=r(480),t.ethTxTrie=r(973)},function(e,t){},function(e,t,r){"use strict";var n=r(15),i=r(25),o=r(34),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 l(e){for(var t=0;t"},e.exports=l;var h=r(67)}).call(this,r(0).Buffer)},function(e,t,r){var n=r(13);function i(e,t){var r=function(){return new n.aes.Algorithm(e,t)};n.cipher.registerAlgorithm(e,r)}r(313),r(497),r(16),e.exports=n.aes=n.aes||{},n.aes.startEncrypting=function(e,t,r,n){var i=y({key:e,output:r,decrypt:!1,mode:n});return i.start(t),i},n.aes.createEncryptionCipher=function(e,t){return y({key:e,output:null,decrypt:!1,mode:t})},n.aes.startDecrypting=function(e,t,r,n){var i=y({key:e,output:r,decrypt:!0,mode:n});return i.start(t),i},n.aes.createDecryptionCipher=function(e,t){return y({key:e,output:null,decrypt:!0,mode:t})},n.aes.Algorithm=function(e,t){o||h();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],h=e[s],y=p<<24^d<<16^d<<8^d^p,g=(i^s^h)<<24^(r^h)<<16^(r^s^h)<<8^r^i^h;for(var m=0;m<4;++m)f[m][r]=y,l[m][d]=g,y=y<<24|y>>>8,g=g<<24|g>>>8;0===r?r=n=1:(r=i^e[e[e[i^h]]],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,h=o;h>>16&255]<<24^a[n>>>8&255]<<16^a[255&n]<<8^a[n>>>24]^c[i]<<24,i++):o>6&&h%o==4&&(n=a[n>>>24]<<24^a[n>>>16&255]<<16^a[n>>>8&255]<<8^a[255&n]),r[h]=r[h-o]^n;if(t){var d,p=l[0],y=l[1],g=l[2],m=l[3],b=r.slice(0);f=r.length;for(var h=0,v=f-s;h>>24]]^y[a[d>>>16&255]]^g[a[d>>>8&255]]^m[a[255&d]];r=b}return r}function p(e,t,r,n){var i=e.length/4-1,o,s,c,h,d,p,y,g,m,b,v,_;n?(o=l[0],s=l[1],c=l[2],h=l[3],d=u):(o=f[0],s=f[1],c=f[2],h=f[3],d=a),p=t[0]^e[0],y=t[n?3:1]^e[1],g=t[2]^e[2],m=t[n?1:3]^e[3];for(var w=3,S=1;S>>24]^s[y>>>16&255]^c[g>>>8&255]^h[255&m]^e[++w],v=o[y>>>24]^s[g>>>16&255]^c[m>>>8&255]^h[255&p]^e[++w],_=o[g>>>24]^s[m>>>16&255]^c[p>>>8&255]^h[255&y]^e[++w],m=o[m>>>24]^s[p>>>16&255]^c[y>>>8&255]^h[255&g]^e[++w],p=b,y=v,g=_;r[0]=d[p>>>24]<<24^d[y>>>16&255]<<16^d[g>>>8&255]<<8^d[255&m]^e[++w],r[n?3:1]=d[y>>>24]<<24^d[g>>>16&255]<<16^d[m>>>8&255]<<8^d[255&p]^e[++w],r[2]=d[g>>>24]<<24^d[m>>>16&255]<<16^d[p>>>8&255]<<8^d[255&y]^e[++w],r[n?1:3]=d[m>>>24]<<24^d[p>>>16&255]<<16^d[y>>>8&255]<<8^d[255&g]^e[++w]}function y(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){var n=r(13);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(module,exports,__webpack_require__){var indexOf=__webpack_require__(318),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!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 a._connected().find(e=>"HTTP"===e.name)}static ipfs(){return a._connected().find(e=>"IPFS"===e.name)}static webtorrent(){return a._connected().find(e=>"WEBTORRENT"===e.name)}static gun(){return a._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){a._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])),a.statuscb&&a.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 a.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=a.canonicalName(e);return t?this._o2url(t):e}static gatewayUrls(e){const t=e.map(e=>a.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))}}a._transports=[],a.namingcb=void 0,a._transportclasses={},t=e.exports=a},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._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";var n=r(1),i=r(294),o=r(460),s=r(461),a=r(113);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){"use strict";(function(t,n){function i(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}var o=r(4).Buffer,s=t.crypto||t.msCrypto;function a(e,r){if(e>65536)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(10),r(3))},function(e,t,r){"use strict";(function(t){var n=r(39),i=r(25),o=r(75).curves.secp256k1,s=o.curve.point.bind(o.curve),a=o.curve.pointFromX.bind(o.curve),u=function e(t,r,n){var i=s(t,r,n);return i.validate(),i};u.prototype=Object.getPrototypeOf(o.curve.point()),u.fromX=function e(t,r){var n=a(t,r);return n.validate(),n},u.getG=function e(){return o.curve.g},u.getN=function e(){return new n(o.curve.n.toArray())},u.prototype._getX=u.prototype.getX,u.prototype.getX=function e(){return new n(this._getX().toArray())},u.prototype._getY=u.prototype.getY,u.prototype.getY=function e(){return new n(this._getY().toArray())},u.prototype.validate=function e(){if(this.isInfinity())throw new Error("Point cannot be equal to Infinity");if(0===this.getX().cmp(n.Zero)||0===this.getY().cmp(n.Zero))throw new Error("Invalid x,y value for curve, cannot equal 0.");var t=a(this.getY().isOdd(),this.getX());if(0!==t.y.cmp(this.y))throw new Error("Invalid y value for curve.");var r=this.getX().gt(n.Minus1)&&this.getX().lt(u.getN()),i=this.getY().gt(n.Minus1)&&this.getY().lt(u.getN());if(!r||!i)throw new Error("Point does not lie on the curve");if(!this.mul(u.getN()).isInfinity())throw new Error("Point times N must be infinity");return this},u.pointToCompressed=function e(r){var n=r.getX().toBuffer({size:32}),o=r.getY().toBuffer({size:32}),s,a=o[o.length-1]%2;return s=new t(a?[3]:[2]),i.concat([s,n])},e.exports=u}).call(this,r(0).Buffer)},function(e,t,r){var n=t;n.utils=r(983),n.common=r(984),n.sha=r(985),n.ripemd=r(986),n.hmac=r(987),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,r){var n=r(13);r(16);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{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})},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 y&&"blob"===r&&(a=new y([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&&y&&(n=new y([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 y&&!l?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 l=o(i,0,c);if(u)try{l=String.fromCharCode.apply(null,new Uint8Array(l))}catch(e){var h=new Uint8Array(l);l="";for(var f=0;f{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";(function(t){const n=r(14),i=r(77);e.exports=function(e){if(t.isBuffer(e)&&(e=n.encode(e)),"string"!=typeof e)throw new Error("unexpected multihash type: "+typeof e);if(!i.multihash(e.split("/")[0]))throw new Error("not valid multihash");return e}}).call(this,r(0).Buffer)},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(700),o=r(704);r(1)(c,i);for(var s=n(o.prototype),a=0;a{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){(function(e){function r(e){return Array.isArray?Array.isArray(e):"[object Array]"===g(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]"===g(e)}function l(e){return"object"==typeof e&&null!==e}function h(e){return"[object Date]"===g(e)}function d(e){return"[object Error]"===g(e)||e instanceof Error}function p(e){return"function"==typeof e}function y(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=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=l,t.isDate=h,t.isError=d,t.isFunction=p,t.isPrimitive=y,t.isBuffer=e.isBuffer}).call(this,r(0).Buffer)},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(10))},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){"use strict";function n(e){return e}var i=r(158);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";var n=r(396);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){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,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(790),i=a(n),o=r(37),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){"use strict";t.util=r(446),t.resolver=r(450)},function(e,t,r){"use strict";var n=r(73),i=r(49);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,l),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(l)}}function f(e){return"0x"===e.slice(0,2)}function l(e){return"string"!=typeof e?e:f(e)?e.slice(2):e}function h(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=h(t);return e.from(r,"hex")}function y(t){if(!e.isBuffer(t)){if("string"==typeof t)return f(t)?e.from(d(l(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(18);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(6),i=r(475),o=r(476);function s(e,t,r){const s=o(e,t),a={multicodec:e,defaultHashAlg:"keccak-256",resolve:f,tree:u,isLink:i(f),_resolveFromEthObject:l,_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)=>l(e,t,r)],r)}function l(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(226),o=r(0),s=r(45).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(21),o=r(65),s=r(61),a=r(0),u=r(25),c=r(34),f=r(67),l=r(96),h=r(97),d=4294967295,p=d-2,y=d,g=d-1;function m(e){return this instanceof m?e?this._fromObject(e):void 0:new m(e)}m.MAXINT=d,m.DEFAULT_SEQNUMBER=4294967295,m.DEFAULT_LOCKTIME_SEQNUMBER=4294967294,m.DEFAULT_RBF_SEQNUMBER=4294967293,Object.defineProperty(m.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)}}),m.fromObject=function(e){i.checkArgument(n.isObject(e));var t=new m;return t._fromObject(e)},m.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 h?e.output:new h(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},m.prototype.toObject=m.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},m.fromBufferReader=function(e){var t=new m;return t.prevTxId=e.readReverse(32),t.outputIndex=e.readUInt32LE(),t._scriptBuffer=e.readVarLengthBuffer(),t.sequenceNumber=e.readUInt32LE(),t},m.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},m.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},m.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))},m.prototype.isFullySigned=function(){throw new o.AbstractMethodInvoked("Input#isFullySigned")},m.prototype.isFinal=function(){return 4294967295!==this.sequenceNumber},m.prototype.addSignature=function(){throw new o.AbstractMethodInvoked("Input#addSignature")},m.prototype.clearSignatures=function(){throw new o.AbstractMethodInvoked("Input#clearSignatures")},m.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,l.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script)},m.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},m.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},e.exports=m},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(21),o=r(84),s=r(25),a=r(34),u=r(76),c=r(65),f=r(66);function l(e){if(!(this instanceof l))return new l(e);if(e instanceof l)return e;if(n.isObject(e))return this._fromObject(e);throw new c.InvalidArgument("TransactionSignatures must be instantiated from an object")}o(l,f),l.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},l.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")},l.prototype.toObject=l.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}},l.fromObject=function(e){return i.checkArgument(e),new l(e)},e.exports=l}).call(this,r(0).Buffer)},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;st.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>>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,l;s.putBytes(o.substr(0,i.blockLength-c));for(var h=8*i.fullMessageLength[0],d=0;d>>0,h+=l,s.putInt32(h>>>0),h=f>>>0;s.putInt32(h);var p={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};u(p,r,s);var y=n.util.createBuffer();return y.putInt32(p.h0),y.putInt32(p.h1),y.putInt32(p.h2),y.putInt32(p.h3),y.putInt32(p.h4),y},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,l=r.length();l>=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,l-=64}}},function(e,t,r){"use strict";const n=t;n.Reporter=r(1037).Reporter,n.DecoderBuffer=r(516).DecoderBuffer,n.EncoderBuffer=r(516).EncoderBuffer,n.Node=r(1038)},function(e,t,r){"use strict";const n=t;n.Reporter=r(1073).Reporter,n.DecoderBuffer=r(530).DecoderBuffer,n.EncoderBuffer=r(530).EncoderBuffer,n.Node=r(1074)},function(e,t,r){var n;!function(i){"use strict";var o={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};function s(){var e=arguments[0],t=s.cache;return t[e]||(t[e]=s.parse(e)),s.format.call(null,t[e],arguments)}s.format=function(e,t){var r=1,n=e.length,i="",a,c=[],l,h,d,p,y,g,m=!0,b="";for(l=0;l=0),d[8]){case"b":a=parseInt(a,10).toString(2);break;case"c":a=String.fromCharCode(parseInt(a,10));break;case"d":case"i":a=parseInt(a,10);break;case"j":a=JSON.stringify(a,null,d[6]?parseInt(d[6]):0);break;case"e":a=d[7]?parseFloat(a).toExponential(d[7]):parseFloat(a).toExponential();break;case"f":a=d[7]?parseFloat(a).toFixed(d[7]):parseFloat(a);break;case"g":a=d[7]?parseFloat(a).toPrecision(d[7]):parseFloat(a);break;case"o":a=a.toString(8);break;case"s":a=String(a),a=d[7]?a.substring(0,d[7]):a;break;case"t":a=String(!!a),a=d[7]?a.substring(0,d[7]):a;break;case"T":a=u(a),a=d[7]?a.substring(0,d[7]):a;break;case"u":a=parseInt(a,10)>>>0;break;case"v":a=a.valueOf(),a=d[7]?a.substring(0,d[7]):a;break;case"x":a=parseInt(a,10).toString(16);break;case"X":a=parseInt(a,10).toString(16).toUpperCase()}o.json.test(d[8])?c[c.length]=a:(!o.number.test(d[8])||m&&!d[3]?b="":(b=m?"+":"-",a=a.toString().replace(o.sign,"")),y=d[4]?"0"===d[4]?"0":d[4].charAt(1):" ",g=d[6]-(b+a).length,p=d[6]&&g>0?f(y,g):"",c[c.length]=d[5]?b+a+p:"0"===y?b+p+a:p+b+a)}return c.join("")},s.cache=Object.create(null),s.parse=function(e){for(var t=e,r=[],n=[],i=0;t;){if(null!==(r=o.text.exec(t)))n[n.length]=r[0];else if(null!==(r=o.modulo.exec(t)))n[n.length]="%";else{if(null===(r=o.placeholder.exec(t)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var s=[],a=r[2],u=[];if(null===(u=o.key.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(s[s.length]=u[1];""!==(a=a.substring(u[0].length));)if(null!==(u=o.key_access.exec(a)))s[s.length]=u[1];else{if(null===(u=o.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");s[s.length]=u[1]}r[2]=s}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}t=t.substring(r[0].length)}return n};var a=function(e,t,r){return r=(t||[]).slice(0),r.splice(0,0,e),s.apply(null,r)};function u(e){return"number"==typeof e?"number":"string"==typeof e?"string":Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}var c={0:["","0","00","000","0000","00000","000000","0000000"]," ":[""," "," "," "," "," "," "," "],_:["","_","__","___","____","_____","______","_______"]};function f(e,t){return t>=0&&t<=7&&c[e]?c[e][t]:Array(t+1).join(e)}t.sprintf=s,t.vsprintf=a,void 0!==i&&(i.sprintf=s,i.vsprintf=a,n=function(){return{sprintf:s,vsprintf:a}}.call(t,r,t,e),void 0===n||(e.exports=n))}("undefined"==typeof window?this:window)},function(e,t,r){"use strict";const n=t;n.Reporter=r(1111).Reporter,n.DecoderBuffer=r(549).DecoderBuffer,n.EncoderBuffer=r(549).EncoderBuffer,n.Node=r(1112)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(572),i=a(n),o=r(209),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){"use strict";const n=t;n.Reporter=r(1331).Reporter,n.DecoderBuffer=r(596).DecoderBuffer,n.EncoderBuffer=r(596).EncoderBuffer,n.Node=r(1332)},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){var n=r(26),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,l=t.writable||!1!==t.writable&&e.writable,h=function(){e.writable||d()},d=function(){l=!1,f||r.call(e)},p=function(){f=!1,l||r.call(e)},y=function(t){r.call(e,t?new Error("exited with error code: "+t):null)},g=function(t){r.call(e,t)},m=function(){return(!f||c&&c.ended)&&(!l||u&&u.ended)?void 0:r.call(e,new Error("premature close"))},b=function(){e.req.on("finish",d)};return o(e)?(e.on("complete",d),e.on("abort",m),e.req?b():e.on("request",b)):l&&!u&&(e.on("end",h),e.on("close",h)),s(e)&&e.on("exit",y),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",h),e.removeListener("close",h),e.removeListener("finish",d),e.removeListener("exit",y),e.removeListener("end",p),e.removeListener("error",g),e.removeListener("close",m)}};e.exports=a},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(1365)(t);const{formatters:f}=e.exports;f.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,r(3))},function(e,t,r){"use strict";const n=t;n.Reporter=r(1375).Reporter,n.DecoderBuffer=r(615).DecoderBuffer,n.EncoderBuffer=r(615).EncoderBuffer,n.Node=r(1376)},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";const n=r(27),i=r(46),o=r(50),s=r(187);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(17);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=t;n.Reporter=r(1456).Reporter,n.DecoderBuffer=r(638).DecoderBuffer,n.EncoderBuffer=r(638).EncoderBuffer,n.Node=r(1457)},function(e,t,r){"use strict";const n=t;n.Reporter=r(1507).Reporter,n.DecoderBuffer=r(651).DecoderBuffer,n.EncoderBuffer=r(651).EncoderBuffer,n.Node=r(1508)},function(e,t,r){"use strict";t.importer=t.Importer=r(1535),t.exporter=t.Exporter=r(1560)},function(e,t,r){"use strict";const n=r(47).Key,i={file:0,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){(function(t){var n=r(12).Writable,i=r(1),o=r(262);if("undefined"==typeof Uint8Array)var s=r(1633).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?l(this.body):"buffer"===this.encoding?h(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 l(e){for(var r=[],n=!1,i=0;ir=>{let l,h=!1,d=!1;r=r?Object.assign({},r,r.qs):{};const p=new u,y=new n({objectMode:!0});y._read=(e=>{}),y._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);h&&p.end(),o()})}catch(e){o(e)}}),y.once("finish",()=>{h||(h=!0,d||p.end())});const g=r.qs||{};g["cid-version"]=f(r,"cid-version","cidVersion"),g["raw-leaves"]=f(r,"raw-leaves","rawLeaves"),g["only-hash"]=f(r,"only-hash","onlyHash"),g["wrap-with-directory"]=f(r,"wrap-with-directory","wrapWithDirectory"),g.hash=f(r,"hash","hashAlg");const m={path:t,qs:g,args:r.args,multipart:!0,multipartBoundary:p._boundary,stream:!0,recursive:!0,progress:r.progress};return p.on("error",e=>{y.emit("error",e)}),l=e(m,(e,t)=>{if(e)return y.emit("error",e);if(!t)return y.push(null);if(!o(t))return y.push(t),void y.push(null);if(t.on("error",e=>y.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",()=>y.push(null)),n.on("data",e=>y.push(e)),t.pipe(n)}else t.on("data",e=>{e.Bytes&&r.progress&&r.progress(e.Bytes),y.push(e)}),t.once("end",()=>y.push(null))}),l.on("drain",()=>p.emit("drain")),p.pipe(l),y})},function(e,t){e.exports=!1},function(e,t,r){"use strict";(function(t){const n=r(2),i=r(30),o=i.DAGNode,s=i.DAGLink,a=r(14),u=r(9),c=r(265),f={max:128},l=c(f);e.exports=(e=>n((r,n,i)=>{let c;"function"==typeof n&&(i=n,n={}),n||(n={});try{r=new u(r),c=r.toBaseEncodedString()}catch(e){return i(e)}const f=l.get(c);if(f)return i(null,f);e({path:"object/get",args:c,qs:{"data-encoding":"base64"}},(e,r)=>{if(e)return i(e);r.Data=t.from(r.Data,"base64");const n=r.Links.map(e=>new s(e.Name,e.Size,t.from(a.decode(e.Hash))));o.create(r.Data,n,(e,t)=>{if(e)return i(e);l.set(c,t),i(null,t)})})}))}).call(this,r(0).Buffer)},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(3))},function(e,t,r){var n=r(1821),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(l(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){"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";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";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){const n=r(90);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";(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;a0;)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&&f-1}function W(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();++t{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";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(210),i=a(n),o=r(37),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){"use strict";(function(t){const n=r(8),i=r(422),o=r(38).utils.asyncFilter,s=r(38).utils.asyncSort,a=r(38).Key,u=r(38).Errors,c=r(429);class f{constructor(e,t){let n;t&&t.db?(n=t.db,delete t.db):n=r(432),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";(function(n){const i=r(20),o=r(41),s=r(9);class a{constructor(e,t,r,o){i(r,"DAGNode needs its serialized format"),i(o,"DAGNode needs its multihash"),this._cid=new s(o),this._data=e||n.alloc(0),this._links=t||[],this._serialized=r}toJSON(){return this._json||(this._json=Object.freeze({data:this.data,links:this.links.map(e=>e.toJSON()),multihash:this._cid.toBaseEncodedString(),size:this.size})),Object.assign({},this._json)}toString(){return`DAGNode <${this._cid.toBaseEncodedString()} - data: "${this.data.toString()}", links: ${this.links.length}, size: ${this.size}>`}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 serialized(){return this._serialized}set serialized(e){throw new Error("Can't set property: 'serialized' is immutable")}get size(){return void 0===this._size&&(this._size=this.links.reduce((e,t)=>e+t.size,this.serialized.length)),this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}get multihash(){return this._cid.buffer}set multihash(e){throw new Error("Can't set property: 'multihash' is immutable")}get cid(){return this._cid}set cid(e){throw new Error("Can't set property: 'cid' is immutable")}}t=e.exports=o(a,{className:"DAGNode",symbolName:"@ipld/js-ipld-dag-pb/dagnode"}),t.create=r(216),t.clone=r(854),t.addLink=r(855),t.rmLink=r(856)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(33),i=r(840),o=r(287),s=o.serialize,a=r(217),u=a.linkSort,c=r(215),f=r(111);function l(e,r,o,a){if("function"==typeof e?(a=e,e=void 0):"string"==typeof e&&(e=t.from(e)),"function"==typeof r&&(a=r,r=[]),"function"==typeof o&&(a=o,o=void 0),!t.isBuffer(e))return a(new Error("Passed 'data' is not a buffer or a string!"));o||(o="sha2-256");const l=r.map(e=>f.isDAGLink(e)?e:f.util.createDagLinkFromB58EncodedHash(e)),h=i(l,u);s({data:e,links:h},(t,r)=>{if(t)return a(t);n(r,o,(t,n)=>{if(t)return a(t);const i=new c(e,h,r,n);a(null,i)})})}e.exports=l}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(111);function o(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 s(e){return e.links.slice()}function a(e,t){const r=n.from(e.name||""),i=n.from(t.name||"");return r.compare(i)}function u(e){return new i("",e.size,e.multihash)}t=e.exports,t.cloneData=o,t.cloneLinks=s,t.linkSort=a,t.toDAGLink=u}).call(this,r(0).Buffer)},function(e,t,r){var n;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,u=Math.floor,c="[BigNumber Error] ",f=c+"Number primitive has more than 15 significant digits: ",l=1e14,h=14,d=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,g=1e9;function m(e){var t,r,n,i=z.prototype={constructor:z,toString:null,valueOf:null},o=new z(1),x=20,C=4,T=-7,I=21,B=-1e7,O=1e7,P=!1,R=1,N=0,j={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0},L="0123456789abcdefghijklmnopqrstuvwxyz",M,D,U,F,K,q,H;function z(e,t){var i,o,a,c,l,p,y,g,m=this;if(!(m instanceof z))return new z(e,t);if(null==t){if(e instanceof z)return m.s=e.s,m.e=e.e,void(m.c=(e=e.c)?e.slice():e);if(p="number"==typeof e,p&&0*e==0){if(m.s=1/e<0?(e=-e,-1):1,e===~~e){for(c=0,l=e;l>=10;l/=10,c++);return m.e=c,void(m.c=[e])}g=e+""}else{if(!s.test(g=e+""))return n(m,g,p);m.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(c=g.indexOf("."))>-1&&(g=g.replace(".","")),(l=g.search(/e/i))>0?(c<0&&(c=l),c+=+g.slice(l+1),g=g.substring(0,l)):c<0&&(c=g.length)}else{if(w(t,2,L.length,"Base"),g=e+"",10==t)return m=new z(e instanceof z?e:g),$(m,x+m.e+1,C);if(p="number"==typeof e,p){if(0*e!=0)return n(m,g,p,t);if(m.s=1/e<0?(g=g.slice(1),-1):1,z.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(f+e);p=!1}else m.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(i=L.slice(0,t),c=l=0,y=g.length;lc){c=y;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,l=-1,c=0;continue}return n(m,e+"",p,t)}g=r(g,t,10,m.s),(c=g.indexOf("."))>-1?g=g.replace(".",""):c=g.length}for(l=0;48===g.charCodeAt(l);l++);for(y=g.length;48===g.charCodeAt(--y););if(g=g.slice(l,++y),g){if(y-=l,p&&z.DEBUG&&y>15&&(e>d||e!==u(e)))throw Error(f+m.s*e);if(c=c-l-1,c>O)m.c=m.e=null;else if(ca){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 G(e,t){var r,n,i=0;for(S(e[0])&&(e=e[0]),r=new z(e[0]);++i=10;i/=10,n++);return(r=n+r*h-1)>O?e.c=e.e=null:r=10;c/=10,i++);if(o=t-i,o<0)o+=h,s=t,f=g[d=0],y=f/m[i-s-1]%10|0;else if(d=a((o+1)/h),d>=g.length){if(!n)break e;for(;g.length<=d;g.push(0));f=y=0,i=1,o%=h,s=o-h+1}else{for(f=c=g[d],i=1;c>=10;c/=10,i++);o%=h,s=o-h+i,y=s<0?0:f/m[i-s-1]%10|0}if(n=n||t<0||null!=g[d+1]||(s<0?f:f%m[i-s-1]),n=r<4?(y||n)&&(0==r||r==(e.s<0?3:2)):y>5||5==y&&(4==r||n||6==r&&(o>0?s>0?f/m[i-s]:0:g[d-1])%10&1||r==(e.s<0?8:7)),t<1||!g[0])return g.length=0,n?(t-=e.e+1,g[0]=m[(h-t%h)%h],e.e=-t||0):g[0]=e.e=0,e;if(0==o?(g.length=d,c=1,d--):(g.length=d+1,c=m[h-o],g[d]=s>0?u(f/m[i-s]%m[s])*c:0),n)for(;;){if(0==d){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=c,c=1;s>=10;s/=10,c++);o!=c&&(e.e++,g[0]==l&&(g[0]=1));break}if(g[d]+=c,g[d]!=l)break;g[d--]=0,c=1}for(o=g.length;0===g[--o];g.pop());}e.e>O?e.c=e.e=null:e.e>>11),s>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[f]=r[0],t[f+1]=r[1]):(l.push(s%1e14),f+=2);f=i/2}else{if(!crypto.randomBytes)throw P=!1,Error(c+"crypto unavailable");for(t=crypto.randomBytes(i*=7);f=9e15?crypto.randomBytes(7).copy(t,f):(l.push(s%1e14),f+=7);f=i/7}if(!P)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,l,h,d,p,y,g=n.indexOf("."),m=x,b=C;for(g>=0&&(l=N,N=0,n=n.replace(".",""),y=new z(i),d=y.pow(n.length-g),N=l,y.c=r(A(v(d.c),d.e,"0"),10,o,e),y.e=y.c.length),p=r(n,i,o,a?(u=L,e):(u=e,L)),f=l=p.length;0==p[--l];p.pop());if(!p[0])return u.charAt(0);if(g<0?--f:(d.c=p,d.e=f,d.s=s,d=t(d,y,m,b,o),p=d.c,h=d.r,f=d.e),c=f+m+1,g=p[c],l=o/2,h=h||c<0||null!=p[c+1],h=b<4?(null!=g||h)&&(0==b||b==(d.s<0?3:2)):g>l||g==l&&(4==b||h||6==b&&1&p[c-1]||b==(d.s<0?8:7)),c<1||!p[0])n=h?A(u.charAt(1),-m,u.charAt(0)):u.charAt(0);else{if(p.length=c,h)for(--o;++p[--c]>o;)p[c]=0,c||(++f,p=[1].concat(p));for(l=p.length;!p[--l];);for(g=0,n="";g<=l;n+=u.charAt(p[g++]));n=A(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%y,f=t/y|0;for(e=e.slice();u--;)o=e[u]%y,s=e[u]/y|0,n=f*o+s*c,i=c*o+n%y*y+a,a=(i/r|0)+(n/y|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,y,g,m,v,_,w,S,E,k,A,x,C,T,I=n.s==i.s?1:-1,B=n.c,O=i.c;if(!(B&&B[0]&&O&&O[0]))return new z(n.s&&i.s&&(B?!O||B[0]!=O[0]:O)?B&&0==B[0]||!O?0*I:I/0:NaN);for(v=new z(I),_=v.c=[],f=n.e-i.e,I=o+f+1,a||(a=l,f=b(n.e/h)-b(i.e/h),I=I/h|0),d=0;O[d]==(B[d]||0);d++);if(O[d]>(B[d]||0)&&f--,I<0)_.push(1),p=!0;else{for(A=B.length,C=O.length,d=0,I+=2,y=u(a/(O[0]+1)),y>1&&(O=e(O,y,a),B=e(B,y,a),C=O.length,A=B.length),k=C,w=B.slice(0,C),S=w.length;S=a/2&&x++;do{if(y=0,c=t(O,w,C,S),c<0){if(E=w[0],C!=S&&(E=E*a+(w[1]||0)),y=u(E/x),y>1)for(y>=a&&(y=a-1),g=e(O,y,a),m=g.length,S=w.length;1==t(g,w,m,S);)y--,r(g,C=10;I/=10,d++);$(v,o+(v.e=d+f*h-1)+1,s,p)}else v.e=f,v.r=+p;return v}}(),U=/^(-?)0([xbo])(?=\w[\w.]*$)/i,F=/^([^.]+)\.$/,K=/^\.([^.]+)$/,q=/^-?(Infinity|NaN)$/,H=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(e,t,r,n){var i,o=r?t:t.replace(H,"");if(q.test(o))e.s=isNaN(o)?null:o<0?-1:1,e.c=e.e=null;else{if(!r&&(o=o.replace(U,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(K,"0.$1")),t!=o))return new z(o,i);if(z.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 z(this);return e.s<0&&(e.s=1),e},i.comparedTo=function(e,t){return _(this,new z(e,t))},i.decimalPlaces=i.dp=function(e,t){var r,n,i,o=this;if(null!=e)return w(e,0,g),null==t?t=C:w(t,0,8),$(new z(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-b(this.e/h))*h,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 z(e,r),x,C)},i.dividedToIntegerBy=i.idiv=function(e,r){return t(this,new z(e,r),0,1)},i.exponentiatedBy=i.pow=function(e,t){var r,n,i,s,f,l,d,p,y=this;if(e=new z(e),e.c&&!e.isInteger())throw Error(c+"Exponent not an integer: "+e);if(null!=t&&(t=new z(t)),f=e.e>14,!y.c||!y.c[0]||1==y.c[0]&&!y.e&&1==y.c.length||!e.c||!e.c[0])return p=new z(Math.pow(+y.valueOf(),f?2-E(e):+e)),t?p.mod(t):p;if(l=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new z(NaN);n=!l&&y.isInteger()&&t.isInteger(),n&&(y=y.mod(t))}else{if(e.e>9&&(y.e>0||y.e<-1||(0==y.e?y.c[0]>1||f&&y.c[1]>=24e7:y.c[0]<8e13||f&&y.c[0]<=9999975e7)))return i=y.s<0&&E(e)?-0:0,y.e>-1&&(i=1/i),new z(l?1/i:i);N&&(i=a(N/h+2))}for(f?(r=new z(.5),d=E(e)):d=e%2,l&&(e.s=1),p=new z(o);;){if(d){if(p=p.times(y),!p.c)break;i?p.c.length>i&&(p.c.length=i):n&&(p=p.mod(t))}if(f){if(e=e.times(r),$(e,e.e+1,1),!e.c[0])break;f=e.e>14,d=E(e)}else{if(e=u(e/2),!e)break;d=e%2}y=y.times(y),i?y.c&&y.c.length>i&&(y.c.length=i):n&&(y=y.mod(t))}return n?p:(l&&(p=o.div(p)),t?p.mod(t):i?$(p,N,C,s):p)},i.integerValue=function(e){var t=new z(this);return null==e?e=C:w(e,0,8),$(t,t.e+1,e)},i.isEqualTo=i.eq=function(e,t){return 0===_(this,new z(e,t))},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(e,t){return _(this,new z(e,t))>0},i.isGreaterThanOrEqualTo=i.gte=function(e,t){return 1===(t=_(this,new z(e,t)))||0===t},i.isInteger=function(){return!!this.c&&b(this.e/h)>this.c.length-2},i.isLessThan=i.lt=function(e,t){return _(this,new z(e,t))<0},i.isLessThanOrEqualTo=i.lte=function(e,t){return-1===(t=_(this,new z(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 z(e,t),t=e.s,!a||!t)return new z(NaN);if(a!=t)return e.s=-t,s.plus(e);var u=s.e/h,c=e.e/h,f=s.c,d=e.c;if(!u||!c){if(!f||!d)return f?(e.s=-t,e):new z(d?s:NaN);if(!f[0]||!d[0])return d[0]?(e.s=-t,e):new z(f[0]?s:3==C?-0:0)}if(u=b(u),c=b(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=l-1;n>a;){if(f[--n]=0;){for(r=0,p=E[i]%_,g=E[i]/_|0,s=u,o=i+s;o>i;)c=S[--s]%_,f=S[s]/_|0,a=g*c+f*p,c=p*c+a%_*_+m[o]+r,r=(c/v|0)+(a/_|0)+g*f,m[o--]=c%v;m[o]=r}return r?++n:m.splice(0,1),W(e,m,n)},i.negated=function(){var e=new z(this);return e.s=-e.s||null,e},i.plus=function(e,t){var r,n=this,i=n.s;if(e=new z(e,t),t=e.s,!i||!t)return new z(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/h,s=e.e/h,a=n.c,u=e.c;if(!o||!s){if(!a||!u)return new z(i/0);if(!a[0]||!u[0])return u[0]?e:new z(a[0]?n:0*i)}if(o=b(o),s=b(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)/l|0,a[t]=l===a[t]?0:a[t]%l;return i&&(a=[i].concat(a),++s),W(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,g),null==t?t=C:w(t,0,8),$(new z(o),e,t);if(!(r=o.c))return null;if(i=r.length-1,n=i*h+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,l=new z("0.5");if(1!==u||!a||!a[0])return new z(!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=b((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 z(r)):n=new z(u+""),n.c[0])for(c=n.e,u=c+f,u<3&&(u=0);;)if(o=n,n=l.times(o.plus(t(s,o,f,1))),v(o.c).slice(0,u)===(r=v(n.c)).slice(0,u)){if(n.e0&&h>0){for(n=h%o||o,u=l.substr(0,n);n0&&(u+=a+l.slice(n)),f&&(u="-"+u)}r=c?u+j.decimalSeparator+((s=+j.fractionGroupSize)?c.replace(new RegExp("\\d{"+s+"}\\B","g"),"$&"+j.fractionGroupSeparator):c):u}return r},i.toFraction=function(e){var r,n,i,s,a,u,f,l,d,y,g,m,b=this,_=b.c;if(null!=e&&(l=new z(e),!l.isInteger()&&(l.c||1!==l.s)||l.lt(o)))throw Error(c+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+e);if(!_)return b.toString();for(n=new z(o),y=i=new z(o),s=d=new z(o),m=v(_),u=n.e=m.length-b.e-1,n.c[0]=p[(f=u%h)<0?h+f:f],e=!e||l.comparedTo(n)>0?u>0?n:y:l,f=O,O=1/0,l=new z(m),d.c[0]=0;g=t(l,n,0,1),a=i.plus(g.times(s)),1!=a.comparedTo(e);)i=s,s=a,y=d.plus(g.times(a=y)),d=a,n=l.minus(g.times(a=n)),l=a;return a=t(e.minus(i),s,0,1),d=d.plus(a.times(y)),i=i.plus(a.times(s)),d.s=y.s=b.s,u*=2,r=t(y,s,u,C).minus(b).abs().comparedTo(t(d,i,u,C).minus(b).abs())<1?[y.toString(),s.toString()]:[d.toString(),i.toString()],O=f,r},i.toNumber=function(){return+this},i.toPrecision=function(e,t){return null!=e&&w(e,1,g),V(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":(t=v(n.c),null==e?t=o<=T||o>=I?k(t,o):A(t,o,"0"):(w(e,2,L.length,"Base"),t=r(A(t,o,"0"),10,e,i,!0)),i<0&&n.c[0]&&(t="-"+t)),t},i.valueOf=i.toJSON=function(){var e,t=this,r=t.e;return null===r?t.toString():(e=v(t.c),e=r<=T||r>=I?k(e,r):A(e,r,"0"),t.s<0?"-"+e:e)},i._isBigNumber=!0,null!=e&&z.set(e),z}function b(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: ")+e)}function S(e){return"[object Array]"==Object.prototype.toString.call(e)}function E(e){var t=e.c.length-1;return b(e.e/h)==t&&e.c[t]%2!=0}function k(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function A(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{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(864),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),this}writeInt16BE(t,r){return this._writeNumberValue(e.prototype.writeInt16BE,2,t,r),this}insertInt16BE(t,r){return this._insertNumberValue(e.prototype.writeInt16BE,2,t,r),this}writeInt16LE(t,r){return this._writeNumberValue(e.prototype.writeInt16LE,2,t,r),this}insertInt16LE(t,r){return this._insertNumberValue(e.prototype.writeInt16LE,2,t,r),this}writeInt32BE(t,r){return this._writeNumberValue(e.prototype.writeInt32BE,4,t,r),this}insertInt32BE(t,r){return this._insertNumberValue(e.prototype.writeInt32BE,4,t,r),this}writeInt32LE(t,r){return this._writeNumberValue(e.prototype.writeInt32LE,4,t,r),this}insertInt32LE(t,r){return this._insertNumberValue(e.prototype.writeInt32LE,4,t,r),this}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),this}insertUInt8(t,r){return this._insertNumberValue(e.prototype.writeUInt8,1,t,r),this}writeUInt16BE(t,r){return this._writeNumberValue(e.prototype.writeUInt16BE,2,t,r),this}insertUInt16BE(t,r){return this._insertNumberValue(e.prototype.writeUInt16BE,2,t,r),this}writeUInt16LE(t,r){return this._writeNumberValue(e.prototype.writeUInt16LE,2,t,r),this}insertUInt16LE(t,r){return this._insertNumberValue(e.prototype.writeUInt16LE,2,t,r),this}writeUInt32BE(t,r){return this._writeNumberValue(e.prototype.writeUInt32BE,4,t,r),this}insertUInt32BE(t,r){return this._insertNumberValue(e.prototype.writeUInt32BE,4,t,r),this}writeUInt32LE(t,r){return this._writeNumberValue(e.prototype.writeUInt32LE,4,t,r),this}insertUInt32LE(t,r){return this._insertNumberValue(e.prototype.writeUInt32LE,4,t,r),this}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),this}insertFloatBE(t,r){return this._insertNumberValue(e.prototype.writeFloatBE,4,t,r),this}writeFloatLE(t,r){return this._writeNumberValue(e.prototype.writeFloatLE,4,t,r),this}insertFloatLE(t,r){return this._insertNumberValue(e.prototype.writeFloatLE,4,t,r),this}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),this}insertDoubleBE(t,r){return this._insertNumberValue(e.prototype.writeDoubleBE,8,t,r),this}writeDoubleLE(t,r){return this._writeNumberValue(e.prototype.writeDoubleLE,8,t,r),this}insertDoubleLE(t,r){return this._insertNumberValue(e.prototype.writeDoubleLE,8,t,r),this}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;i0&&"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 l=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(l(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";var n=t;n.base=r(988),n.short=r(989),n.mont=r(990),n.edwards=r(991)},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(118),o=r(169),s=r(39),a=r(34),u=r(117),c=r(133),f=r(76),l=r(228),h=r(21);function d(e,t){if(!(this instanceof d))return new d(e,t);if(e instanceof d)return e;var r=this._classifyArguments(e,t);if(!r.bn||0===r.bn.cmp(new s(0)))throw new TypeError("Number can not be equal to zero, undefined, null or false");if(!r.bn.lt(c.getN()))throw new TypeError("Number must be less than N");if(void 0===r.network)throw new TypeError('Must specify the network ("livenet" or "testnet")');return a.defineImmutable(this,{bn:r.bn,compressed:r.compressed,network:r.network}),Object.defineProperty(this,"publicKey",{configurable:!1,enumerable:!0,get:this.toPublicKey.bind(this)}),this}d.prototype._classifyArguments=function(e,r){var i={compressed:!0,network:r?u.get(r):u.defaultNetwork};if(n.isUndefined(e)||n.isNull(e))i.bn=d._getRandomBN();else if(e instanceof s)i.bn=e;else if(e instanceof t||e instanceof Uint8Array)i=d._transformBuffer(e,r);else if(e.bn&&e.network)i=d._transformObject(e);else if(!r&&u.get(e))i.bn=d._getRandomBN(),i.network=u.get(e);else{if("string"!=typeof e)throw new TypeError("First argument is an unrecognized data type.");a.isHexa(e)?i.bn=new s(new t(e,"hex")):i=d._transformWIF(e,r)}return i},d._getRandomBN=function(){var e,t;do{var r=l.getRandomBuffer(32);t=s.fromBuffer(r),e=t.lt(c.getN())}while(!e);return t},d._transformBuffer=function(e,t){var r={};if(32===e.length)return d._transformBNBuffer(e,t);if(r.network=u.get(e[0],"privatekey"),!r.network)throw new Error("Invalid network");if(t&&r.network!==u.get(t))throw new TypeError("Private key network mismatch");if(34===e.length&&1===e[33])r.compressed=!0;else{if(33!==e.length)throw new Error("Length of buffer must be 33 (uncompressed) or 34 (compressed)");r.compressed=!1}return r.bn=s.fromBuffer(e.slice(1,33)),r},d._transformBNBuffer=function(e,t){var r={};return r.network=u.get(t)||u.defaultNetwork,r.bn=s.fromBuffer(e),r.compressed=!1,r},d._transformWIF=function(e,t){return d._transformBuffer(o.decode(e),t)},d.fromBuffer=function(e,t){return new d(e,t)},d._transformObject=function(e){var t=new s(e.bn,"hex"),r=u.get(e.network);return{bn:t,network:r,compressed:e.compressed}},d.fromString=d.fromWIF=function(e){return h.checkArgument(n.isString(e),"First argument is expected to be a string."),new d(e)},d.fromObject=function(e){return h.checkArgument(n.isObject(e),"First argument is expected to be an object."),new d(e)},d.fromRandom=function(e){var t=d._getRandomBN();return new d(t,e)},d.getValidationError=function(e,t){var r;try{new d(e,t)}catch(e){r=e}return r},d.isValid=function(e,t){return!!e&&!d.getValidationError(e,t)},d.prototype.toString=function(){return this.toBuffer().toString("hex")},d.prototype.toWIF=function(){var e=this.network,r=this.compressed,n;return n=r?t.concat([new t([e.privatekey]),this.bn.toBuffer({size:32}),new t([1])]):t.concat([new t([e.privatekey]),this.bn.toBuffer({size:32})]),o.encode(n)},d.prototype.toBigNumber=function(){return this.bn},d.prototype.toBuffer=function(){return this.bn.toBuffer()},d.prototype.toPublicKey=function(){return this._pubkey||(this._pubkey=f.fromPrivateKey(this)),this._pubkey},d.prototype.toAddress=function(e){var t=this.toPublicKey();return i.fromPublicKey(t,e||this.network)},d.prototype.toObject=d.prototype.toJSON=function e(){return{bn:this.bn.toString("hex"),compressed:this.compressed,network:this.network.toString()}},d.prototype.inspect=function(){var e=this.compressed?"":", uncompressed";return""},e.exports=d}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(483),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(306),e.exports.Input=r(307),e.exports.Output=r(97),e.exports.UnspentOutput=r(485),e.exports.Signature=r(171),e.exports.Sighash=r(96)},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(116);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(3),r(0).Buffer)},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(39),o=r(25),s=r(95),a=r(61),u=r(45),c=r(34),f=r(21),l=537133055,h=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};h._from=function e(t){var r={};if(o.isBuffer(t))r=h._fromBufferReader(s(t));else{if(!n.isObject(t))throw new TypeError("Unrecognized argument for BlockHeader");r=h._fromObject(t)}return r},h._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 l={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 l},h.fromObject=function e(t){var r=h._fromObject(t);return new h(r)},h.fromRawBlock=function e(r){o.isBuffer(r)||(r=new t(r,"binary"));var n=s(r);n.pos=h.Constants.START_OF_HEADER;var i=h._fromBufferReader(n);return new h(i)},h.fromBuffer=function e(t){var r=h._fromBufferReader(s(t));return new h(r)},h.fromString=function e(r){var n=new t(r,"hex");return h.fromBuffer(n)},h._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},h.fromBufferReader=function e(t){var r=h._fromBufferReader(t);return new h(r)},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 r=new i(16777215&t),n=8*((t>>>24)-3);n-- >0;)r=r.mul(new i(2));return r},h.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)},h.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(h.prototype,"id",d),Object.defineProperty(h.prototype,"hash",d),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"),r=this.getTargetDifficulty();return!(t.cmp(r)>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,r(0).Buffer)},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[l>>>8&255]^u[255&h]^t[m++],p=o[f>>>24]^s[l>>>16&255]^a[h>>>8&255]^u[255&c]^t[m++],y=o[l>>>24]^s[h>>>16&255]^a[c>>>8&255]^u[255&f]^t[m++],g=o[h>>>24]^s[c>>>16&255]^a[f>>>8&255]^u[255&l]^t[m++],c=d,f=p,l=y,h=g;return d=(n[c>>>24]<<24|n[f>>>16&255]<<16|n[l>>>8&255]<<8|n[255&h])^t[m++],p=(n[f>>>24]<<24|n[l>>>16&255]<<16|n[h>>>8&255]<<8|n[255&c])^t[m++],y=(n[l>>>24]<<24|n[h>>>16&255]<<16|n[c>>>8&255]<<8|n[255&f])^t[m++],g=(n[h>>>24]<<24|n[c>>>16&255]<<16|n[f>>>8&255]<<8|n[255&l])^t[m++],d>>>=0,p>>>=0,y>>>=0,g>>>=0,[d,p,y,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 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],l=e[f],h=e[l],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*h^65537*l^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[h^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[h>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[h>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&h]]}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,r){var n=r(13);function i(e,t){var r=function(){return new n.des.Algorithm(e,t)};n.cipher.registerAlgorithm(e,r)}r(313),r(497),r(16),e.exports=n.des=n.des||{},n.des.startEncrypting=function(e,t,r,n){var i=y({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createEncryptionCipher=function(e,t){return y({key:e,output:null,decrypt:!1,mode:t})},n.des.startDecrypting=function(e,t,r,n){var i=y({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createDecryptionCipher=function(e,t){return y({key:e,output:null,decrypt:!0,mode:t})},n.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return p(r._keys,e,t,!1)},decrypt:function(e,t){return p(r._keys,e,t,!0)}}}),r._init=!1},n.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=n.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=d(t),this._init=!0}},i("DES-ECB",n.cipher.modes.ecb),i("DES-CBC",n.cipher.modes.cbc),i("DES-CFB",n.cipher.modes.cfb),i("DES-OFB",n.cipher.modes.ofb),i("DES-CTR",n.cipher.modes.ctr),i("3DES-ECB",n.cipher.modes.ecb),i("3DES-CBC",n.cipher.modes.cbc),i("3DES-CFB",n.cipher.modes.cfb),i("3DES-OFB",n.cipher.modes.ofb),i("3DES-CTR",n.cipher.modes.ctr);var o=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],s=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],a=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],u=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],c=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],f=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],l=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],h=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function d(e){for(var t=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],r=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],o=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],s=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],a=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],u=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],c=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],f=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],l=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],h=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],d=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],p=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],y=e.length()>8?3:1,g=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=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],A=u[S>>>28]|c[S>>>24&15]|f[S>>>20&15]|l[S>>>16&15]|h[S>>>12&15]|d[S>>>8&15]|p[S>>>4&15];v=65535&(A>>>16^k),g[b++]=k^v,g[b++]=A^v<<16}}return g}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 y=t[0],g=t[1];p=252645135&(y>>>4^g),g^=p,y^=p<<4,p=65535&(y>>>16^g),g^=p,y^=p<<16,p=858993459&(g>>>2^y),y^=p,g^=p<<2,p=16711935&(g>>>8^y),y^=p,g^=p<<8,p=1431655765&(y>>>1^g),g^=p,y^=p<<1,y=y<<1|y>>>31,g=g<<1|g>>>31;for(var m=0;m>>4|g<<28)^e[_+1];p=y,y=g,g=p^(s[w>>>24&63]|u[w>>>16&63]|f[w>>>8&63]|h[63&w]|o[S>>>24&63]|a[S>>>16&63]|c[S>>>8&63]|l[63&S])}p=y,y=g,g=p}y=y>>>1|y<<31,g=g>>>1|g<<31,p=1431655765&(y>>>1^g),g^=p,y^=p<<1,p=16711935&(g>>>8^y),y^=p,g^=p<<8,p=858993459&(g>>>2^y),y^=p,g^=p<<2,p=65535&(y>>>16^g),g^=p,y^=p<<16,p=252645135&(y>>>4^g),g^=p,y^=p<<4,r[0]=y,r[1]=g}function y(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(13);if(r(86),r(233),r(120),r(505),r(506),r(68),r(16),void 0===i)var i=n.jsbn.BigInteger;var o=n.asn1;n.pki=n.pki||{},e.exports=n.pki.rsa=n.rsa=n.rsa||{};var s=n.pki,a=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",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:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},c={name:"RSAPrivateKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},f={name:"RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},l=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",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:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},h=function(e){var t;if(!(e.algorithm in s.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=s.oids[e.algorithm];var n=o.oidToDer(t).getBytes(),i=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]),a=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]);a.value.push(o.create(o.Class.UNIVERSAL,o.Type.OID,!1,n)),a.value.push(o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,""));var u=o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(a),i.value.push(u),o.toDer(i).getBytes()},d=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var o;t.dP||(t.dP=t.d.mod(t.p.subtract(i.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(i.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{o=new i(n.util.bytesToHex(n.random.getBytes(t.n.bitLength()/8)),16)}while(o.compareTo(t.n)>=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,l=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 l=s.getByte();if(0!==l||c!==o-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function g(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 m(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 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=n.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),i=0;i0;)l.putByte(0),--h;return l.putBytes(n.util.hexToBytes(f)),l.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),l=n.util.createBuffer(),h=s-Math.ceil(f.length/2);h>0;)l.putByte(0),--h;return l.putBytes(n.util.hexToBytes(f)),!1!==o?y(l.getBytes(),t,r):l.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||fl?e.pqState=0:e.num.isProbablePrime(b(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;g(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=y(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=y(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:y};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:h},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,l,h,d,p,y,g;if(o.validate(e,u,t,r)&&(e=o.fromDer(n.util.createBuffer(t.privateKey))),t={},r=[],!o.validate(e,c,t,r)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=r,m}return a=n.util.createBuffer(t.privateKeyModulus).toHex(),f=n.util.createBuffer(t.privateKeyPublicExponent).toHex(),l=n.util.createBuffer(t.privateKeyPrivateExponent).toHex(),h=n.util.createBuffer(t.privateKeyPrime1).toHex(),d=n.util.createBuffer(t.privateKeyPrime2).toHex(),p=n.util.createBuffer(t.privateKeyExponent1).toHex(),y=n.util.createBuffer(t.privateKeyExponent2).toHex(),g=n.util.createBuffer(t.privateKeyCoefficient).toHex(),s.setRsaPrivateKey(new i(a,16),new i(f,16),new i(l,16),new i(h,16),new i(d,16),new i(p,16),new i(y,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,m(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.e)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.d)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.p)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.q)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.dP)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.dQ)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.qInv))])},s.publicKeyFromAsn1=function(e){var t={},r=[];if(o.validate(e,l,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(),h=n.util.createBuffer(t.publicKeyExponent).toHex();return s.setRsaPublicKey(new i(c,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,m(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.e))])}},function(e,t,r){var n=r(13),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 l(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=l,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=l,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]:b(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=m(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+=m(n));return i?o:"0"}function A(){var e=u();return a.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 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 T(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 I(){return this.t<=0?0:this.DB*(this.t-1)+T(this.data[this.t-1]^this.s&this.DM)}function B(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 O(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 R(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 j(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 M(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 l=o.t,h=o.data[l-1];if(0!=h){var d=h*(1<1?o.data[l-2]>>this.F2:0),p=this.FV/d,y=(1<=0&&(r.data[r.t++]=1,r.subTo(v,r)),a.ONE.dlShiftTo(l,v),v.subTo(o,o);o.t=0;){var _=r.data[--m]==h?this.DM:Math.floor(r.data[m]*p+(r.data[m-1]+g)*y);if((r.data[m]+=o.am(0,_,r,b,0,l))<_)for(o.dlShiftTo(b,v),r.subTo(v,r);r.data[m]<--_;)r.subTo(v,r)}null!=t&&(r.drShiftTo(l,t),s!=c&&a.ZERO.subTo(t,t)),r.t=l,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 U(e){this.m=e}function F(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function K(e){return e}function q(e){e.divRemTo(this.m,null,e)}function H(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function z(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 G(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 Z(e,t,r){e.multiplyTo(t,r),this.reduce(r)}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 r=u(),n=u(),i=t.convert(this),o=T(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 U(t):new G(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),me,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 le(e){return 0==this.compareTo(e)}function he(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 Ce(){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 Me(e){var t=u();return this.subTo(e,t),t}function De(e){var t=u();return this.multiplyTo(e,t),t}function Ue(e){var t=u();return this.divRemTo(e,t,null),t}function Fe(e){var t=u();return this.divRemTo(e,null,t),t}function Ke(e){var t=u(),r=u();return this.divRemTo(e,t,r),new Array(t,r)}function qe(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 ze(){}function Ve(e){return e}function Ge(e,t,r){e.multiplyTo(t,r)}function We(e,t){e.squareTo(t)}function $e(e){return this.exp(e,new ze)}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 U(t):t.isEven()?new Ze(t):new G(t);var s=new Array,a=3,c=n-1,f=(1<1){var l=u();for(o.sqrTo(s[1],l);a<=f;)s[a]=u(),o.mulTo(l,s[a-2],s[a]),a+=2}var h=e.t-1,d,p=!0,y=u(),g;for(r=T(e.data[h])-1;h>=0;){for(r>=c?d=e.data[h]>>r-c&f:(d=(e.data[h]&(1<0&&(d|=e.data[h-1]>>this.DB+r-c)),a=n;0==(1&d);)d>>=1,--a;if((r-=a)<0&&(r+=this.DB,--h),p)s[d].copyTo(i),p=!1;else{for(;a>1;)o.sqrTo(i,y),o.sqrTo(y,i),a-=2;a>0?o.sqrTo(i,y):(g=i,i=y,y=g),o.mulTo(y,s[d],i)}for(;h>=0&&0==(e.data[h]&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}U.prototype.convert=F,U.prototype.revert=K,U.prototype.reduce=q,U.prototype.mulTo=H,U.prototype.sqrTo=z,G.prototype.convert=W,G.prototype.revert=$,G.prototype.reduce=Y,G.prototype.mulTo=Z,G.prototype.sqrTo=J,a.prototype.copyTo=v,a.prototype.fromInt=_,a.prototype.fromString=S,a.prototype.clamp=E,a.prototype.dlShiftTo=B,a.prototype.drShiftTo=O,a.prototype.lShiftTo=P,a.prototype.rShiftTo=R,a.prototype.subTo=N,a.prototype.multiplyTo=j,a.prototype.squareTo=L,a.prototype.divRemTo=M,a.prototype.invDigit=V,a.prototype.isEven=X,a.prototype.exp=Q,a.prototype.toString=k,a.prototype.negate=A,a.prototype.abs=x,a.prototype.compareTo=C,a.prototype.bitLength=I,a.prototype.mod=D,a.prototype.modPowInt=ee,a.ZERO=w(0),a.ONE=w(1),ze.prototype.convert=Ve,ze.prototype.revert=Ve,ze.prototype.mulTo=Ge,ze.prototype.sqrTo=We,Ze.prototype.convert=Xe,Ze.prototype.revert=Qe,Ze.prototype.reduce=et,Ze.prototype.mulTo=rt,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 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++>>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,l=Math.max(0,a-e.length+1),h=Math.min(a,t.length-1);l<=h;l++){var d=a-l,p=e.words[d],y=t.words[l],g=p*y+f;c+=g/67108864|0,f=67108863&g}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 l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.ishrn(l);l-- >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 y=i.ureduce();return y.negative^=1,y.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){(function(e,r){var n=200,i="Expected a function",o="__lodash_hash_undefined__",s=1,a=2,u=1/0,c=9007199254740991,f="[object Arguments]",l="[object Array]",h="[object Boolean]",d="[object Date]",p="[object Error]",y="[object Function]",g="[object GeneratorFunction]",m="[object Map]",b="[object Number]",v="[object Object]",_="[object Promise]",w="[object RegExp]",S="[object Set]",E="[object String]",k="[object Symbol]",A="[object WeakMap]",x="[object ArrayBuffer]",C="[object DataView]",T="[object Float32Array]",I="[object Float64Array]",B="[object Int8Array]",O="[object Int16Array]",P="[object Int32Array]",R="[object Uint8Array]",N="[object Uint8ClampedArray]",j="[object Uint16Array]",L="[object Uint32Array]",M=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,D=/^\w*$/,U=/^\./,F=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,K=/[\\^$.*+?()[\]{}|]/g,q=/\\(\\)?/g,H=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,V={};V[T]=V[I]=V[B]=V[O]=V[P]=V[R]=V[N]=V[j]=V[L]=!0,V[f]=V[l]=V[x]=V[h]=V[C]=V[d]=V[p]=V[y]=V[m]=V[b]=V[v]=V[w]=V[S]=V[E]=V[A]=!1;var G="object"==typeof e&&e&&e.Object===Object&&e,W="object"==typeof self&&self&&self.Object===Object&&self,$=G||W||Function("return this")(),Y=t&&!t.nodeType&&t,J=Y&&"object"==typeof r&&r&&!r.nodeType&&r,Z=J&&J.exports===Y,X=Z&&G.process,Q=function(){try{return X&&X.binding("util")}catch(e){}}(),ee=Q&&Q.isTypedArray;function te(e,t){for(var r=-1,n=e?e.length:0,i=0,o=[];++r-1}function Ze(e,t){var r=this.__data__,n=pt(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function Xe(e){var t=-1,r=e?e.length:0;for(this.clear();++tc))return!1;var l=o.get(e);if(l&&o.get(t))return l==t;var h=-1,d=!0,p=i&s?new it:void 0;for(o.set(e,t),o.set(t,e);++h-1&&e%1==0&&e-1&&e%1==0&&e<=c}function cr(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function fr(e){return!!e&&"object"==typeof e}function lr(e){return"symbol"==typeof e||fr(e)&&ve.call(e)==k}var hr=ee?oe(ee):xt;function dr(e){return null==e?"":Pt(e)}function pr(e,t,r){var n=null==e?void 0:vt(e,t);return void 0===n?r:n}function yr(e,t){return null!=e&&Ht(e,t,wt)}function gr(e){return or(e)?dt(e):Tt(e)}function mr(e){return e}function br(e){return Vt(e)?ne(Xt(e)):Ot(e)}r.exports=er}).call(this,r(10),r(32)(e))},function(e,t,r){"use strict";var n=t,i=r(0).Buffer,o=r(161);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";t.Address4=r(537),t.Address6=r(1089),t.v6={helpers:r(543)}},function(e,t,r){"use strict";const n=r(8);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";(function(t){const n=r(8),i=r(422),o=r(47).utils.asyncFilter,s=r(47).utils.asyncSort,a=r(47).Key,u=r(429);class c{constructor(e,t){let n;t&&t.db?(n=t.db,delete t.db):n=r(432),this.db=i(u(n(e),{valueEncoding:"binary"}),Object.assign({},t,{compression:!1}),e=>{if(e)throw e})}open(e){this.db.open(e)}put(e,t,r){this.db.put(e.toString(),t,r)}get(e,t){this.db.get(e.toString(),t)}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=>{t(e)})}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=c}).call(this,r(0).Buffer)},function(e,t,r){var n=r(1166),i=r(1167),o=r(1168),s=r(1169),a=r(1170);function u(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t({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),h.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})}),h.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 `}}p.deserialize=((e,t)=>{let r;try{r=h.Message.decode(e)}catch(e){return setImmediate(()=>t(e))}const n=r.wantlist&&r.wantlist.full||!1,o=new p(n);return r.wantlist&&r.wantlist.entries.forEach(e=>{let r;try{r=new u(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 u(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,r)=>{e.prefix&&e.data||r();const n=f(e.prefix),s=n[0],a=n[1],h=n[2];l(e.data,h,(n,f)=>{if(n)return r(n);let l;try{l=new u(s,c[a.toString("16")],f)}catch(n){return t(n)}o.addBlock(new i(e.data,l)),r()})},e=>{if(e)return t(e);t(null,o)}):void t(null,o)}),p.Entry=d,e.exports=p},function(e,t,r){"use strict";const n=r(1237),i=r(1238);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(Array.from(this.set.entries()),e=>e[1].key))}contains(e){const t=e.buffer.toString();return this.set.get(t)}}o.Entry=i,e.exports=o},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(1288),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(3))},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(1305),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(3))},function(e,t,r){(function(t){e.exports=l;var n=r(1312)("simple-peer"),i=r(1314),o=r(1),s=r(132),a=r(12),u=65536,c=5e3,f=5e3;function l(e){var t=this;if(!(t instanceof l))return new l(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||l.channelConfig,t.config=e.config||l.config,t.constraints=t._transformConstraints(e.constraints||l.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 WeakMap,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)&&h(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 h(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 y(){}o(l,a.Duplex),l.WEBRTC_SUPPORT=!!i(),l.config={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:global.stun.twilio.com:3478?transport=udp"}]},l.constraints={},l.channelConfig={},Object.defineProperty(l.prototype,"bufferSize",{get:function(){var e=this;return this._channel&&this._channel.bufferedAmount||0}}),l.prototype.address=function(){var e=this;return{port:this.localPort,family:"IPv4",address:this.localAddress}},l.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"))},l.prototype._addIceCandidate=function(e){var t=this;try{t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e),y,function(e){t.destroy(p(e,"ERR_ADD_ICE_CANDIDATE"))})}catch(e){t.destroy(p("error adding candidate: "+e.message,"ERR_ADD_ICE_CANDIDATE"))}},l.prototype.send=function(e){var t=this;this._channel.send(e)},l.prototype.addStream=function(e){var t=this;t._debug("addStream()"),e.getTracks().forEach(function(r){t.addTrack(r,e)})},l.prototype.addTrack=function(e,t){var r=this;this._debug("addTrack()");var n=this._pc.addTrack(e,t),i=this._senderMap.get(e)||new WeakMap;i.set(t,n),this._senderMap.set(e,i),this._needsNegotiation()},l.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"))},l.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)}},l.prototype.removeStream=function(e){var t=this;t._debug("removeSenders()"),e.getTracks().forEach(function(r){t.removeTrack(r,e)})},l.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))},l.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},l.prototype.destroy=function(e){var t=this;this._destroy(e,function(){})},l.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()}},l.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)},l.prototype._read=function(){},l.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},l.prototype._onFinish=function(){var e=this;function t(){setTimeout(function(){e.destroy()},1e3)}e.destroyed||(e.connected?t():e.once("connect",t))},l.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))},l.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"))})},l.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"))})},l.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."))}},l.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,[])},l.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())},l.prototype._onInterval=function(){var e=this;!this._cb||!this._channel||this._channel.bufferedAmount>65536||this._onChannelBufferedAmountLow()},l.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))},l.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())},l.prototype._onChannelMessage=function(e){var r=this;if(!this.destroyed){var n=e.data;n instanceof ArrayBuffer&&(n=t.from(n)),this.push(n)}},l.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)}},l.prototype._onChannelOpen=function(){var e=this;this.connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())},l.prototype._onChannelClose=function(){var e=this;this.destroyed||(this._debug("on channel close"),this.destroy())},l.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))})},l.prototype.setConstraints=function(e){var t=this;this.initiator?this.offerConstraints=this._transformConstraints(e):this.answerConstraints=this._transformConstraints(e)},l.prototype._debug=function(){var e=this,t=[].slice.call(arguments);t[0]="["+this._id+"] "+t[0],n.apply(null,t)},l.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,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";(function(n){const i=r(8),o=r(58),s=r(5);function a(){return(~~(1e9*Math.random())).toString(36)}function u(e,t){const r=n.isBuffer(e)?[e]:[n.from(e)];i(i.values(r),o.encode(),i.collect((e,r)=>{if(e)return t(e);t(null,r[0])}))}function c(e){const t=a();function r(e){return r=>{Array.isArray(r)&&(r=r.join(" ")),e("(%s) %s",t,r)}}const n=r(s("mss:"+e));return n.error=r(s("mss:"+e+":error")),n}t=e.exports,t.writeEncoded=((e,t,r)=>{u(t,(t,n)=>{if(t)return r(t);e.write(n)})}),t.log={},t.log.dialer=(()=>c("dialer\t")),t.log.listener=(()=>c("listener\t"))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(2),i=r(82),o=r(77),s=r(9);function a(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 u=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){if(r)return n(r);if(!t.length)return n(null,i.multihash);const o=t[0],s=i.links.find(e=>e.name===o);if(!s)return n(new Error(`no link named "${o}" under ${i.toJSON().multihash}`));e.get(s.multihash,u.bind(null,t.slice(1)))}e.get(o,u.bind(null,a))},n)});t.parseIpfsPath=a,t.resolvePath=u},function(e,t,r){var n=r(1536);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,l=!1,h=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?l||o(!0===s?null:s):(f=t(f,n),h=f&&f.length||0,null!=f&&y(),h0;)r=n.nextValue(),s=Math.floor(r*e.length),t.push(e.splice(s,1)[0]);return t.join("")}function d(){return a||(a=h(),a)}function p(e){var t=d();return t[e]}function y(){return o||i}e.exports={get:y,characters:f,seed:l,lookup:p,shuffled:d}},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){(function(t){var n=r(12).Transform,i=r(56).inherits,o=r(28);function s(e){n.call(this,e),this._destroyed=!1}function a(e,t,r){r(null,e)}function u(e){return function(t,r,n){return"function"==typeof t&&(n=r,r=t,t={}),"function"!=typeof r&&(r=a),"function"!=typeof n&&(n=null),e(t,r,n)}}i(s,n),s.prototype.destroy=function(e){if(!this._destroyed){this._destroyed=!0;var r=this;t.nextTick(function(){e&&r.emit("error",e),r.emit("close")})}},e.exports=u(function(e,t,r){var n=new s(e);return n._transform=t,r&&(n._flush=r),n}),e.exports.ctor=u(function(e,t,r){function n(t){if(!(this instanceof n))return new n(t);this.options=o(e,t),s.call(this,this.options)}return i(n,s),n.prototype._transform=t,r&&(n.prototype._flush=r),n}),e.exports.obj=u(function(e,t,r){var n=new s(o({objectMode:!0,highWaterMark:16},e));return n._transform=t,r&&(n._flush=r),n})}).call(this,r(3))},function(e,t,r){(function(e){var n=r(1656),i=r(691),o=r(28),s=r(1657),a=r(36),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 l=new n(t);return r&&l.on("response",r),l},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(10))},function(e,t,r){"use strict";(function(t){e.exports=b;var n=r(1708),i=r(56),o=r(1710),s="function"==typeof Symbol&&"1"!==t.env._nodeLRUCacheForceNoSymbol,a;a=s?function(e){return Symbol(e)}:function(e){return"_"+e};var u=a("max"),c=a("length"),f=a("lengthCalculator"),l=a("allowStale"),h=a("maxAge"),d=a("dispose"),p=a("noDisposeOnSet"),y=a("lruList"),g=a("cache");function m(){return 1}function b(e){if(!(this instanceof b))return new b(e);"number"==typeof e&&(e={max:e}),e||(e={});var t=this[u]=e.max;(!t||"number"!=typeof t||t<=0)&&(this[u]=1/0);var r=e.length||m;"function"!=typeof r&&(r=m),this[f]=r,this[l]=e.stale||!1,this[h]=e.maxAge||0,this[d]=e.dispose,this[p]=e.noDisposeOnSet||!1,this.reset()}function v(e,t,r,n){var i=r.value;w(e,i)&&(E(e,r),e[l]||(i=void 0)),i&&t.call(n,i.value,i.key,e)}function _(e,t,r){var n=e[g].get(t);if(n){var i=n.value;w(e,i)?(E(e,n),e[l]||(i=void 0)):r&&e[y].unshiftNode(n),i&&(i=i.value)}return i}function w(e,t){if(!t||!t.maxAge&&!e[h])return!1;var r=!1,n=Date.now()-t.now;return r=t.maxAge?n>t.maxAge:e[h]&&n>e[h],r}function S(e){if(e[c]>e[u])for(var t=e[y].tail;e[c]>e[u]&&null!==t;){var r=t.prev;E(e,t),t=r}}function E(e,t){if(t){var r=t.value;e[d]&&e[d](r.key,r.value),e[c]-=r.length,e[g].delete(r.key),e[y].removeNode(t)}}function k(e,t,r,n,i){this.key=e,this.value=t,this.length=r,this.now=n,this.maxAge=i||0}Object.defineProperty(b.prototype,"max",{set:function(e){(!e||"number"!=typeof e||e<=0)&&(e=1/0),this[u]=e,S(this)},get:function(){return this[u]},enumerable:!0}),Object.defineProperty(b.prototype,"allowStale",{set:function(e){this[l]=!!e},get:function(){return this[l]},enumerable:!0}),Object.defineProperty(b.prototype,"maxAge",{set:function(e){(!e||"number"!=typeof e||e<0)&&(e=0),this[h]=e,S(this)},get:function(){return this[h]},enumerable:!0}),Object.defineProperty(b.prototype,"lengthCalculator",{set:function(e){"function"!=typeof e&&(e=m),e!==this[f]&&(this[f]=e,this[c]=0,this[y].forEach(function(e){e.length=this[f](e.value,e.key),this[c]+=e.length},this)),S(this)},get:function(){return this[f]},enumerable:!0}),Object.defineProperty(b.prototype,"length",{get:function(){return this[c]},enumerable:!0}),Object.defineProperty(b.prototype,"itemCount",{get:function(){return this[y].length},enumerable:!0}),b.prototype.rforEach=function(e,t){t=t||this;for(var r=this[y].tail;null!==r;){var n=r.prev;v(this,e,r,t),r=n}},b.prototype.forEach=function(e,t){t=t||this;for(var r=this[y].head;null!==r;){var n=r.next;v(this,e,r,t),r=n}},b.prototype.keys=function(){return this[y].toArray().map(function(e){return e.key},this)},b.prototype.values=function(){return this[y].toArray().map(function(e){return e.value},this)},b.prototype.reset=function(){this[d]&&this[y]&&this[y].length&&this[y].forEach(function(e){this[d](e.key,e.value)},this),this[g]=new n,this[y]=new o,this[c]=0},b.prototype.dump=function(){return this[y].map(function(e){if(!w(this,e))return{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}},this).toArray().filter(function(e){return e})},b.prototype.dumpLru=function(){return this[y]},b.prototype.inspect=function(e,t){var r="LRUCache {",n=!1,o=this[l];o&&(r+="\n allowStale: true",n=!0);var s=this[u];s&&s!==1/0&&(n&&(r+=","),r+="\n max: "+i.inspect(s,t),n=!0);var a=this[h];a&&(n&&(r+=","),r+="\n maxAge: "+i.inspect(a,t),n=!0);var d=this[f];d&&d!==m&&(n&&(r+=","),r+="\n length: "+i.inspect(this[c],t),n=!0);var p=!1;return this[y].forEach(function(e){p?r+=",\n ":(n&&(r+=",\n"),p=!0,r+="\n ");var o=i.inspect(e.key).split("\n").join("\n "),s={value:e.value};e.maxAge!==a&&(s.maxAge=e.maxAge),d!==m&&(s.length=e.length),w(this,e)&&(s.stale=!0),s=i.inspect(s,t).split("\n").join("\n "),r+=o+" => "+s}),(p||n)&&(r+="\n"),r+="}",r},b.prototype.set=function(e,t,r){r=r||this[h];var n=r?Date.now():0,i=this[f](t,e);if(this[g].has(e)){if(i>this[u])return E(this,this[g].get(e)),!1;var o=this[g].get(e),s=o.value;return this[d]&&(this[p]||this[d](e,s.value)),s.now=n,s.maxAge=r,s.value=t,this[c]+=i-s.length,s.length=i,this.get(e),S(this),!0}var a=new k(e,t,i,n,r);return a.length>this[u]?(this[d]&&this[d](e,t),!1):(this[c]+=a.length,this[y].unshift(a),this[g].set(e,this[y].head),S(this),!0)},b.prototype.has=function(e){if(!this[g].has(e))return!1;var t=this[g].get(e).value;return!w(this,t)},b.prototype.get=function(e){return _(this,e,!0)},b.prototype.peek=function(e){return _(this,e,!1)},b.prototype.pop=function(){var e=this[y].tail;return e?(E(this,e),e.value):null},b.prototype.del=function(e){E(this,this[g].get(e))},b.prototype.load=function(e){this.reset();for(var t=Date.now(),r=e.length-1;r>=0;r--){var n=e[r],i=n.e||0;if(0===i)this.set(n.k,n.v);else{var o=i-t;o>0&&this.set(n.k,n.v,o)}}},b.prototype.prune=function(){var e=this;this[g].forEach(function(t,r){_(e,r,!1)})}}).call(this,r(3))},function(e,t,r){var n=e.exports;n.encode=r(1812),n.decode=r(1813),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 l=s[i].encode;l(e,t,a),a+=l.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-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],l=r;n-l>=8;){var h=u.decode(t,l,n);if(l+=h.length,f.indexOf(h.type)>=0)a[h.type]=h;else if(f.indexOf(h.type+"s")>=0){var d=h.type+"s",p=a[d]=a[d]||[];p.push(h)}else a.otherBoxes.push(h)}}else if(s[i]){var y=s[i].decode;a=y(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(732),t.encode=t.stringify=r(733)},function(e,t,r){"use strict";(function(t,n){var i=r(202);function o(e,t,r){this.chunk=e,this.encoding=t,this.callback=r,this.next=null}function s(e){var t=this;this.next=null,this.entry=null,this.finish=function(){M(t,e)}}e.exports=_;var a=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?setImmediate:i.nextTick,u;_.WritableState=v;var c=r(155);c.inherits=r(1);var f={deprecate:r(156)},l=r(383),h=r(4).Buffer,d=n.Uint8Array||function(){};function p(e){return h.from(e)}function y(e){return h.isBuffer(e)||e instanceof d}var g=r(385),m;function b(){}function v(e,t){u=u||r(103),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){T(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(103),!(m.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)),l.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=h.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=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(3),r(10))},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,l=o,h,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,h=[],"[object Array]"===Object.prototype.toString.apply(d)){for(a=d.length,r=0;r{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,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});var n=r(806),i=a(n),o=r(213),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,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++rd(e,t),(e,t)=>f(e,n,t),(e,t)=>t(null,new i(o,a.multicodec,e))],r)}function d(e,t){let r;!c.isDAGNode(e)&&e.links&&(e.links=e.links.map(e=>u.isDAGLink(e)?e:u.util.createDagLinkFromB58EncodedHash(e)));try{r=s.PBNode.encode(y(e))}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):n.from(r.Data);c.create(o,i,t)}function y(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.multihash,Name:e.name,Tsize:e.size})):t.Links=null,t}t=e.exports,t.serialize=d,t.deserialize=p,t.cid=h}).call(this,r(0).Buffer)},function(e,t,r){"use strict";t.defined=function(e){return null!==e&&void 0!==e&&("number"!=typeof e||!isNaN(e))}},function(e,t,r){"use strict";(function(e){const n=r(218),i=r(219),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<{"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=r(4).Buffer;function i(e){if(e.length<8)return!1;if(e.length>72)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,t,r){var n=t;n.utils=r(73),n.common=r(164),n.sha=r(880),n.ripemd=r(884),n.hmac=r(885),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,r){"use strict";var n=r(1),i=r(895),o=r(113),s=r(4).Buffer,a=r(896),u=r(460),c=r(461),f=s.alloc(128);function l(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>>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 l(e,t,r,n,i,o,s){return u(e+(t^r^n)+i+o|0,s)+t|0}function h(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=l(r,n,i,o,e[5],4294588738,4),o=l(o,r,n,i,e[8],2272392833,11),i=l(i,o,r,n,e[11],1839030562,16),n=l(n,i,o,r,e[14],4259657740,23),r=l(r,n,i,o,e[1],2763975236,4),o=l(o,r,n,i,e[4],1272893353,11),i=l(i,o,r,n,e[7],4139469664,16),n=l(n,i,o,r,e[10],3200236656,23),r=l(r,n,i,o,e[13],681279174,4),o=l(o,r,n,i,e[0],3936430074,11),i=l(i,o,r,n,e[3],3572445317,16),n=l(n,i,o,r,e[6],76029189,23),r=l(r,n,i,o,e[9],3654602809,4),o=l(o,r,n,i,e[12],3873151461,11),i=l(i,o,r,n,e[15],530742520,16),n=l(n,i,o,r,e[2],3299628645,23),r=h(r,n,i,o,e[0],4096336452,6),o=h(o,r,n,i,e[7],1126891415,10),i=h(i,o,r,n,e[14],2878612391,15),n=h(n,i,o,r,e[5],4237533241,21),r=h(r,n,i,o,e[12],1700485571,6),o=h(o,r,n,i,e[3],2399980690,10),i=h(i,o,r,n,e[10],4293915773,15),n=h(n,i,o,r,e[1],2240044497,21),r=h(r,n,i,o,e[8],1873313359,6),o=h(o,r,n,i,e[15],4264355552,10),i=h(i,o,r,n,e[6],2734768916,15),n=h(n,i,o,r,e[13],1309151649,21),r=h(r,n,i,o,e[4],4149444226,6),o=h(o,r,n,i,e[11],3174756917,10),i=h(i,o,r,n,e[2],718787259,15),n=h(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){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(94),o=r(23),s=r(907),a=r(29),u=r(35),c=r(74),f=r(466);function l(e){const t=e.length;return f.encodingLength(t)+t}function h(e){const t=e.length;return f.encodingLength(t)+e.reduce(function(e,t){return e+l(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),y=[],g=n.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),m=n.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),b=n.from("ffffffffffffffff","hex"),v={script:p,valueBuffer:b};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 l(){const e=u(),t=[];for(var r=0;r=this.ins.length)return m;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 m;f.outs.length=e+1;for(var l=0;l>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),l=[],h=0;h=c.length||l.push(p)}if(1!==f)throw new Error("Invalid checksum for "+e);return{prefix:s,words:l}}function l(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 l(e,o,s){h(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 h(t,r,i){let o=[];"leaf"===t.type&&o.push({path:y(t.getKey()),value:t.getValue()}),n(t.getChildren(),(t,n)=>{const i=y(t[0]),s=t[1];if(a.isRawNode(s)){const e=new a(s);o.push({path:i,value:e}),h(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 y(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(481),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(21),o=r(25),s=r(34);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(21),o=r(0),s=t.compare||r(998),a=r(65),u=r(25),c=r(34),f=r(95),l=r(61),h=r(45),d=r(66),p=r(96),y=r(118),g=r(485),m=r(307),b=m.PublicKeyHash,v=m.PublicKey,_=m.MultiSigScriptHash,w=m.MultiSig,S=r(97),E=r(67),k=r(225),A=r(39),x=r(1003);function C(e){if(!(this instanceof C))return new C(e);if(this.inputs=[],this.outputs=[],this.joinSplits=[],this._inputAmount=void 0,this._outputAmount=void 0,e){if(e instanceof C)return C.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 T=1,I=0,B=1e6;C.DUST_AMOUNT=546,C.FEE_SECURITY_MARGIN=15,C.MAX_MONEY=21e14,C.NLOCKTIME_BLOCKHEIGHT_LIMIT=5e8,C.NLOCKTIME_MAX_VALUE=4294967295,C.FEE_PER_KB=1e4,C.CHANGE_OUTPUT_MAX_SIZE=62,C.MAXIMUM_EXTRA_SIZE=26,C.shallowCopy=function(e){var t=new C(e.toBuffer());return t};var O={configurable:!1,enumerable:!0,get:function(){return new f(this._getHash()).readReverse().toString("hex")}};Object.defineProperty(C.prototype,"hash",O),Object.defineProperty(C.prototype,"id",O);var P={configurable:!1,enumerable:!0,get:function(){return this._getInputAmount()}};Object.defineProperty(C.prototype,"inputAmount",P),P.get=function(){return this._getOutputAmount()},Object.defineProperty(C.prototype,"outputAmount",P),C.prototype._getHash=function(){return h.sha256sha256(this.toBuffer())},C.prototype.serialize=function(e){return!0===e||e&&e.disableAll?this.uncheckedSerialize():this.checkedSerialize(e)},C.prototype.uncheckedSerialize=C.prototype.toString=function(){return this.toBuffer().toString("hex")},C.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()},C.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()/C.FEE_SECURITY_MARGIN);if(t"},C.prototype.toBuffer=function(){var e=new l;return this.toBufferWriter(e).toBuffer()},C.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},C.prototype.fromBuffer=function(e){var t=new f(e);return this.fromBufferReader(t)},C.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},C.prototype.toObject=C.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},C.prototype.fromObject=function e(r){i.checkArgument(n.isObject(r)||r instanceof C);var o=this,s;return s=r instanceof C?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 m.PublicKeyHash(e);else if(t.isScriptHashOut()&&e.publicKeys&&e.threshold)r=new m.MultiSigScriptHash(e,e.publicKeys,e.threshold,e.signatures);else{if(!t.isPublicKeyOut())throw new a.Transaction.Input.UnsupportedScript(e.output.script);r=new m.PublicKey(e)}o.addInput(r)}else o.uncheckedAddInput(new m(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 x(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},C.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")},C.prototype.lockUntilDate=function(e){if(i.checkArgument(e),n.isNumber(e)&&e=C.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}},C.prototype.getFee=function(){return this.isCoinbase()?0:n.isUndefined(this._fee)?this._changeScript?this._estimateFee():this._getUnspentValue():this._fee},C.prototype._estimateFee=function(){var e=this._estimateSize(),t=this._getUnspentValue();return C._estimateFee(e,t,this._feePerKb)},C.prototype._getUnspentValue=function(){return this._getInputAmount()-this._getOutputAmount()},C.prototype._clearSignatures=function(){n.each(this.inputs,function(e){e.clearSignatures()})},C._estimateFee=function(e,t,r){var n=Math.ceil(e/1e3)*(r||C.FEE_PER_KB);return t>n&&(e+=C.CHANGE_OUTPUT_MAX_SIZE),Math.ceil(e/1e3)*(r||C.FEE_PER_KB)},C.prototype._estimateSize=function(){var e=C.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},C.prototype._removeOutput=function(e){var t=this.outputs[e];this.outputs=n.without(this.outputs,t),this._outputAmount=void 0},C.prototype.removeOutput=function(e){this._removeOutput(e),this._updateChangeOutput()},C.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},C.prototype.shuffleOutputs=function(){return this.sortOutputs(n.shuffle)},C.prototype.sortOutputs=function(e){var t=e(this.outputs);return this._newOutputOrder(t)},C.prototype.sortInputs=function(e){return this.inputs=e(this.inputs),this._clearSignatures(),this},C.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},C.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()},C.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)},C.prototype.getSignatures=function(e,t){e=new k(e),t=t||d.SIGHASH_ALL;var r=this,i=[],o=h.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},C.prototype.applySignature=function(e){return this.inputs[e.inputIndex].addSignature(this,e),this},C.prototype.isFullySigned=function(){return n.each(this.inputs,function(e){if(e.isFullySigned===m.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()}))},C.prototype.isValidSignature=function(e){var t=this;if(this.inputs[e.inputIndex].isValidSignature===m.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)},C.prototype.verifySignature=function(e,t,r,n){return p.verify(this,e,t,r,n)},C.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 A(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=m.MAXINT-1&&(t.sequenceNumber=m.DEFAULT_RBF_SEQNUMBER)}return this},e.exports=C}).call(this,r(0).Buffer)},function(e,t,r){e.exports=r(170),e.exports.PublicKey=r(999),e.exports.PublicKeyHash=r(1e3),e.exports.MultiSig=r(1001),e.exports.MultiSigScriptHash=r(1002)},function(e,t,r){"use strict";var n=r(15),i=r(65),o=r(21),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{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(98)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){var n=r(13);r(16),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var i=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};i.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},i.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},i.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){var n=r(13);r(87),r(16);var i=e.exports=n.md5=n.md5||{};n.md.md5=n.md.algorithms.md5=i,i.create=function(){c||f();var e=null,t=n.util.createBuffer(),r=new Array(16),i={algorithm:"md5",blockLength:64,digestLength:16,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 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,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;s.putBytes(o.substr(0,i.blockLength-u));for(var c,f=0,h=i.fullMessageLength.length-1;h>=0;--h)c=8*i.fullMessageLength[h]+f,f=c/4294967296>>>0,s.putInt32Le(c>>>0);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};l(d,r,s);var p=n.util.createBuffer();return p.putInt32Le(d.h0),p.putInt32Le(d.h1),p.putInt32Le(d.h2),p.putInt32Le(d.h3),p},i};var o=null,s=null,a=null,u=null,c=!1;function f(){o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],a=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],u=new Array(64);for(var e=0;e<64;++e)u[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));c=!0}function l(e,t,r){for(var n,i,o,c,f,l,h,d,p=r.length();p>=64;){for(i=e.h0,o=e.h1,c=e.h2,f=e.h3,d=0;d<16;++d)t[d]=r.getInt32Le(),l=f^o&(c^f),n=i+l+u[d]+t[d],h=a[d],i=f,f=c,c=o,o+=n<>>32-h;for(;d<32;++d)l=c^f&(o^c),n=i+l+u[d]+t[s[d]],h=a[d],i=f,f=c,c=o,o+=n<>>32-h;for(;d<48;++d)l=o^c^f,n=i+l+u[d]+t[s[d]],h=a[d],i=f,f=c,c=o,o+=n<>>32-h;for(;d<64;++d)l=c^(o|~f),n=i+l+u[d]+t[s[d]],h=a[d],i=f,f=c,c=o,o+=n<>>32-h;e.h0=e.h0+i|0,e.h1=e.h1+o|0,e.h2=e.h2+c|0,e.h3=e.h3+f|0,p-=64}}},function(e,t,r){(function(t){var n=r(13);r(173),r(87),r(16);var i=n.pkcs5=n.pkcs5||{},o;n.util.isNodejs&&!n.options.usePureJavaScript&&(o=r(501)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,s,a,u){if("function"==typeof a&&(u=a,a=null),n.util.isNodejs&&!n.options.usePureJavaScript&&o.pbkdf2&&(null===a||"object"!=typeof a)&&(o.pbkdf2Sync.length>4||!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 l=Math.ceil(s/c),h=s-(l-1)*c,d=n.hmac.create();d.start(a,e);var p="",y,g,m;if(!u){for(var b=1;b<=l;++b){d.start(null,null),d.update(r),d.update(n.util.int32ToBytes(b)),y=m=d.digest().getBytes();for(var v=2;v<=i;++v)d.start(null,null),d.update(m),g=d.digest().getBytes(),y=n.util.xorBytes(y,g,c),m=g;p+=bl)return u(null,p);d.start(null,null),d.update(r),d.update(n.util.int32ToBytes(b)),y=m=d.digest().getBytes(),v=2,w()}function w(){if(v<=i)return d.start(null,null),d.update(m),g=d.digest().getBytes(),y=n.util.xorBytes(y,g,c),m=g,++v,n.util.setImmediate(w);p+=b2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(y.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(l.validity.notBefore=y[0],l.validity.notAfter=y[1],l.tbsCertificate=r.tbsCertificate,t){if(l.md=null,l.signatureOid in s){var f=s[l.signatureOid];switch(f){case"sha1WithRSAEncryption":l.md=n.md.sha1.create();break;case"md5WithRSAEncryption":l.md=n.md.md5.create();break;case"sha256WithRSAEncryption":l.md=n.md.sha256.create();break;case"sha384WithRSAEncryption":l.md=n.md.sha384.create();break;case"sha512WithRSAEncryption":l.md=n.md.sha512.create();break;case"RSASSA-PSS":l.md=n.md.sha256.create()}}if(null===l.md){var u=new Error("Could not compute certificate digest. Unknown signature OID.");throw u.signatureOid=l.signatureOid,u}var g=i.toDer(l.tbsCertificate);l.md.update(g.getBytes())}var b=n.md.sha1.create();l.issuer.getField=function(e){return d(l.issuer,e)},l.issuer.addField=function(e){m([e]),l.issuer.attributes.push(e)},l.issuer.attributes=o.RDNAttributesAsArray(r.certIssuer,b),r.certIssuerUniqueId&&(l.issuer.uniqueId=r.certIssuerUniqueId),l.issuer.hash=b.digest().toHex();var v=n.md.sha1.create();return l.subject.getField=function(e){return d(l.subject,e)},l.subject.addField=function(e){m([e]),l.subject.attributes.push(e)},l.subject.attributes=o.RDNAttributesAsArray(r.certSubject,v),r.certSubjectUniqueId&&(l.subject.uniqueId=r.certSubjectUniqueId),l.subject.hash=v.digest().toHex(),r.certExtensions?l.extensions=o.certificateExtensionsFromAsn1(r.certExtensions):l.extensions=[],l.publicKey=o.publicKeyFromAsn1(r.subjectPublicKeyInfo),l},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 l;t.altNames=[];for(var r=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()),y(e.subject),o.publicKeyToAsn1(e.publicKey),_(e)]);return t},o.distinguishedNameToAsn1=function(e){return y(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(l=t[0]||e.getIssuer(f),null===l&&f.isIssuer(f)&&(h=!0,l=f),l){var d=l;n.util.isArray(d)||(d=[d]);for(var p=!1;!p&&d.length>0;){l=d.shift();try{p=l.verify(f)}catch(e){}}p||(u={message:"Certificate signature is invalid.",error:o.certificateError.bad_certificate})}null!==u||l&&!h||e.hasCertificate(f)||(u={message:"Certificate is not trusted.",error:o.certificateError.unknown_ca})}if(null===u&&l&&!f.isIssuer(l)&&(u={message:"Certificate issuer is invalid.",error:o.certificateError.bad_certificate}),null===u)for(var y={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,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,r){var n=r(13);r(68),r(16);var i=e.exports=n.pss=n.pss||{};i.create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t=e.md,r=e.mgf,i=t.digestLength,o=e.salt||null,s;if("string"==typeof o&&(o=n.util.createBuffer(o)),"saltLength"in e)s=e.saltLength;else{if(null===o)throw new Error("Salt length not specified or specific salt not given.");s=o.length()}if(null!==o&&o.length()!==s)throw new Error("Given salt length does not match length of given salt.");var a=e.prng||n.random,u={encode:function(e,u){var c,f=u-1,l=Math.ceil(f/8),h=e.digest().getBytes(),d;if(l>8*l-f&255;return _=String.fromCharCode(_.charCodeAt(0)&~w)+_.substr(1),_+y+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!=(h.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var y=r.generate(d,l),g="";for(u=0;u{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(98)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t){t.BITS=32,t.GROUPS=4,t.RE_ADDRESS=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g,t.RE_SUBNET_STRING=/\/\d{1,2}$/},function(e,t){t.BITS=128,t.GROUPS=8,t.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},t.TYPES={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"},t.RE_BAD_CHARACTERS=/([^0-9a-f:\/%])/gi,t.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,t.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/,t.RE_ZONE_STRING=/%.*$/,t.RE_URL=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),t.RE_URL_WITH_PORT=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/)},function(e,t,r){"use strict";const n=r(62);function i(e){if("number"==typeof e){if(i.codes[e])return i.codes[e];throw new Error("no protocol with code: "+e)}if("string"==typeof e||e instanceof String){if(i.names[e])return i.names[e];throw new Error("no protocol with name: "+e)}throw new Error("invalid protocol id type: "+e)}const o=-1;function s(e,t,r,n){return{code:e,size:t,name:r,resolvable:Boolean(n)}}i.lengthPrefixedVarSize=o,i.V=o,i.table=[[4,32,"ip4"],[6,16,"tcp"],[17,16,"udp"],[33,16,"dccp"],[41,128,"ip6"],[54,o,"dns4","resolvable"],[55,o,"dns6","resolvable"],[56,o,"dnsaddr","resolvable"],[132,16,"sctp"],[302,0,"utp"],[421,i.lengthPrefixedVarSize,"ipfs"],[480,0,"http"],[443,0,"https"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[290,0,"p2p-circuit"]],i.names={},i.codes={},n(i.table,function(e){const t=s.apply(null,e);i.codes[t.code]=t,i.names[t.name]=t}),i.object=s,e.exports=i},function(e,t,r){"use strict";const n=r(62);function i(e){if("number"==typeof e){if(i.codes[e])return i.codes[e];throw new Error("no protocol with code: "+e)}if("string"==typeof e||e instanceof String){if(i.names[e])return i.names[e];throw new Error("no protocol with name: "+e)}throw new Error("invalid protocol id type: "+e)}const o=-1;function s(e,t,r,n){return{code:e,size:t,name:r,resolvable:Boolean(n)}}i.lengthPrefixedVarSize=o,i.V=o,i.table=[[4,32,"ip4"],[6,16,"tcp"],[17,16,"udp"],[33,16,"dccp"],[41,128,"ip6"],[54,o,"dns4","resolvable"],[55,o,"dns6","resolvable"],[56,o,"dnsaddr","resolvable"],[132,16,"sctp"],[302,0,"utp"],[421,i.lengthPrefixedVarSize,"ipfs"],[480,0,"http"],[443,0,"https"],[460,0,"quic"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[290,0,"p2p-circuit"]],i.names={},i.codes={},n(i.table,function(e){const t=s.apply(null,e);i.codes[t.code]=t,i.names[t.name]=t}),i.object=s,e.exports=i},function(e,t,r){"use strict";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(98)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){"use strict";(function(t){ /*! * @description Recursive object extending * @author Viacheslav Lotsmanov @@ -94,7 +94,7 @@ e.exports=function e(t){"use strict";if("function"!=typeof Promise)throw"Promise * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -function r(e){return e instanceof t||e instanceof Date||e instanceof RegExp}function n(e){if(e instanceof t){var r=t.alloc?t.alloc(e.length):new t(e.length);return e.copy(r),r}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e);throw new Error("Unexpected situation")}function i(e){var t=[];return e.forEach(function(e,o){"object"==typeof e&&null!==e?Array.isArray(e)?t[o]=i(e):r(e)?t[o]=n(e):t[o]=s({},e):t[o]=e}),t}function o(e,t){return"__proto__"===t?void 0:e[t]}var s=e.exports=function(){if(arguments.length<1||"object"!=typeof arguments[0])return!1;if(arguments.length<2)return arguments[0];var e=arguments[0],t=Array.prototype.slice.call(arguments,1),a,u,c;return t.forEach(function(t){"object"!=typeof t||null===t||Array.isArray(t)||Object.keys(t).forEach(function(c){return u=o(e,c),a=o(t,c),a===e?void 0:"object"!=typeof a||null===a?void(e[c]=a):Array.isArray(a)?void(e[c]=i(a)):r(a)?void(e[c]=n(a)):"object"!=typeof u||null===u||Array.isArray(u)?void(e[c]=s({},a)):void(e[c]=s(u,a))})}),e}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(62);function i(e){if("number"==typeof e){if(i.codes[e])return i.codes[e];throw new Error("no protocol with code: "+e)}if("string"==typeof e||e instanceof String){if(i.names[e])return i.names[e];throw new Error("no protocol with name: "+e)}throw new Error("invalid protocol id type: "+e)}const o=-1;function s(e,t,r,n){return{code:e,size:t,name:r,resolvable:Boolean(n)}}i.lengthPrefixedVarSize=o,i.V=o,i.table=[[4,32,"ip4"],[6,16,"tcp"],[17,16,"udp"],[33,16,"dccp"],[41,128,"ip6"],[54,o,"dns4","resolvable"],[55,o,"dns6","resolvable"],[56,o,"dnsaddr","resolvable"],[132,16,"sctp"],[302,0,"utp"],[421,i.lengthPrefixedVarSize,"ipfs"],[480,0,"http"],[443,0,"https"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[290,0,"p2p-circuit"]],i.names={},i.codes={},n(i.table,function(e){const t=s.apply(null,e);i.codes[t.code]=t,i.names[t.name]=t}),i.object=s,e.exports=i},function(e,t,r){"use strict";const n=r(62);function i(e){if("number"==typeof e){if(i.codes[e])return i.codes[e];throw new Error("no protocol with code: "+e)}if("string"==typeof e||e instanceof String){if(i.names[e])return i.names[e];throw new Error("no protocol with name: "+e)}throw new Error("invalid protocol id type: "+e)}const o=-1;function s(e,t,r,n){return{code:e,size:t,name:r,resolvable:Boolean(n)}}i.lengthPrefixedVarSize=o,i.V=o,i.table=[[4,32,"ip4"],[6,16,"tcp"],[273,16,"udp"],[33,16,"dccp"],[41,128,"ip6"],[54,o,"dns4","resolvable"],[55,o,"dns6","resolvable"],[56,o,"dnsaddr","resolvable"],[132,16,"sctp"],[302,0,"utp"],[421,i.lengthPrefixedVarSize,"p2p"],[421,i.lengthPrefixedVarSize,"ipfs"],[480,0,"http"],[443,0,"https"],[460,0,"quic"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[290,0,"p2p-circuit"]],i.names={},i.codes={},n(i.table,function(e){const t=s.apply(null,e);i.codes[t.code]=t,i.names[t.name]=t}),i.object=s,e.exports=i},function(e,t,r){"use strict";const n=r(6),i=r(42),o=r(49),s=r(43),a=r(216),u=r(20),c=r(45),f=r(4),l=r(63),h=r(9),d=r(1160),p=r(1161),y=r(1163),g=r(1164),m=r(1165),b=r(1166),v=r(1173),_=r(1174),w=r(1175),S=f("repo"),E=Number.MAX_SAFE_INTEGER,k={memory:r(566),fs:r(566)},A=r(1176).repoVersion;class x{constructor(e,t){u.equal(typeof e,"string","missing repoPath"),this.options=O(t),this.closed=!0,this.path=e,this._locker=this._getLocker(),this.root=d.create("root",this.path,this.options),this.version=p(this.root),this.config=y(this.root),this.spec=g(this.root),this.apiAddr=m(this.root)}init(e,t){S("initializing at: %s",this.path),i([e=>this.root.open(I(e)),t=>this.config.set(P(e),t),t=>this.spec.set(R(e),t),e=>this.version.set(A,e)],t)}open(e){this.closed?(S("opening at: %s",this.path),n([e=>this.root.open(I(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);b(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.equal(typeof r.close,"function","Locks must have a close method"),t(null,r)})}_closeLock(e){if(this.lockfile)return this.lockfile.close(e);e()}_isLocked(e,t){if(this._locker)return this._locker.locked(e,t);t(null,!1)}_isInitialized(e){S("init check"),o({config:e=>this.config.exists(e),spec:e=>this.spec.exists(e),version:e=>this.version.check(A,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(B(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 l(t?E:r))}),version:e=>this.version.get(e),blocks:e=>this.blocks.query({},(t,r)=>{r=r||[];const n=new l(r.length);let i=new l(0);r.forEach(e=>{i=i.plus(e.value.byteLength).plus(e.key._buf.byteLength)}),e(t,{count:n,size:i})}),datastore:e=>C(this.datastore,e),keys:e=>C(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 C(e,t){h(e.query({}),h.reduce((e,t)=>e.plus(t.value.byteLength).plus(t.key._buf.byteLength),new l(0),t))}function T(e,t){return r=>{t(r&&!e(r)?r:null)}}function I(e){return T(e=>"Already open"===e.message,e)}function B(e){return T(e=>e&&(e.code===w.ERR_REPO_NOT_INITIALIZED||e.message.startsWith("ENOENT")),e)}function O(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 P(e){return e.datastore=Object.assign({},_,a(e,"datastore",{})),e}function R(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=x,e.exports.repoVersion=A,e.exports.errors=w},function(e,t,r){"use strict";const n=r(9),i=r(131),o=r(45),s=r(163),a=r(107);t.asyncFilter=function(e){let t=!1,r,n;return function(i){return function o(s,a){if(n)return a(n);s?(n=s,i(s,t?()=>{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,r){var n=r(1197),i=r(1201);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(571);function i(e,t,r){"__proto__"==t&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}e.exports=i},function(e,t,r){"use strict";const n=r(9),i=r(131),o=r(45),s=r(163),a=r(107);t.asyncFilter=function(e){let t=!1,r,n;return function(i){return function o(s,a){if(n)return a(n);s?(n=s,i(s,t?()=>{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,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(1311)("socket.io-parser"),i=r(142),o=r(1314),s=r(588),a=r(589);function u(){}t.protocol=4,t.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],t.CONNECT=0,t.DISCONNECT=1,t.EVENT=2,t.ACK=3,t.ERROR=4,t.BINARY_EVENT=5,t.BINARY_ACK=6,t.Encoder=u,t.Decoder=d;var c=t.ERROR+'"encode error"';function f(e){var r=""+e.type;if(t.BINARY_EVENT!==e.type&&t.BINARY_ACK!==e.type||(r+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(r+=e.nsp+","),null!=e.id&&(r+=e.id),null!=e.data){var i=l(e.data);if(!1===i)return c;r+=i}return n("encoded %j as %s",e,r),r}function l(e){try{return JSON.stringify(e)}catch(e){return!1}}function h(e,t){function r(e){var r=o.deconstructPacket(e),n=f(r.packet),i=r.buffers;i.unshift(n),t(i)}o.removeBlobs(e,r)}function d(){this.reconstructor=null}function p(e){var r=0,i={type:Number(e.charAt(0))};if(null==t.types[i.type])return m("unknown packet type "+i.type);if(t.BINARY_EVENT===i.type||t.BINARY_ACK===i.type){for(var o="";"-"!==e.charAt(++r)&&(o+=e.charAt(r),r!=e.length););if(o!=Number(o)||"-"!==e.charAt(r))throw new Error("Illegal attachments");i.attachments=Number(o)}if("/"===e.charAt(r+1))for(i.nsp="";++r;){var a=e.charAt(r);if(","===a)break;if(i.nsp+=a,r===e.length)break}else i.nsp="/";var u=e.charAt(r+1);if(""!==u&&Number(u)==u){for(i.id="";++r;){var a=e.charAt(r);if(null==a||Number(a)!=a){--r;break}if(i.id+=e.charAt(r),r===e.length)break}i.id=Number(i.id)}if(e.charAt(++r)){var c=y(e.substr(r)),f=!1!==c&&(i.type===t.ERROR||s(c));if(!f)return m("invalid payload");i.data=c}return n("decoded %s as %j",e,i),i}function y(e){try{return JSON.parse(e)}catch(e){return!1}}function g(e){this.reconPack=e,this.buffers=[]}function m(e){return{type:t.ERROR,data:"parser error: "+e}}u.prototype.encode=function(e,r){if(n("encoding packet %j",e),t.BINARY_EVENT===e.type||t.BINARY_ACK===e.type)h(e,r);else{var i=f(e);r([i])}},i(d.prototype),d.prototype.add=function(e){var r;if("string"==typeof e)r=p(e),t.BINARY_EVENT===r.type||t.BINARY_ACK===r.type?(this.reconstructor=new g(r),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",r)):this.emit("decoded",r);else{if(!a(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");r=this.reconstructor.takeBinaryData(e),r&&(this.reconstructor=null,this.emit("decoded",r))}},d.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},g.prototype.takeBinaryData=function(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t=o.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null},g.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(e,t,r){var n=r(1317);e.exports=function(e){var t=e.xdomain,r=e.xscheme,i=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!t||n))return new XMLHttpRequest}catch(e){}try{if("undefined"!=typeof XDomainRequest&&!r&&i)return new XDomainRequest}catch(e){}if(!t)try{return new(self[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}},function(e,t,r){var n=r(143),i=r(142);function o(e){this.path=e.path,this.hostname=e.hostname,this.port=e.port,this.secure=e.secure,this.query=e.query,this.timestampParam=e.timestampParam,this.timestampRequests=e.timestampRequests,this.readyState="",this.agent=e.agent||!1,this.socket=e.socket,this.enablesXDR=e.enablesXDR,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.forceNode=e.forceNode,this.isReactNative=e.isReactNative,this.extraHeaders=e.extraHeaders,this.localAddress=e.localAddress}e.exports=o,i(o.prototype),o.prototype.onError=function(e,t){var r=new Error(e);return r.type="TransportError",r.description=t,this.emit("error",r),this},o.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},o.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},o.prototype.send=function(e){if("open"!==this.readyState)throw new Error("Transport not open");this.write(e)},o.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},o.prototype.onData=function(e){var t=n.decodePacket(e,this.socket.binaryType);this.onPacket(t)},o.prototype.onPacket=function(e){this.emit("packet",e)},o.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(e,t,r){"use strict";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(99)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},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(1380)(t);const{formatters:f}=e.exports;f.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,r(3))},function(e,t,r){"use strict";(function(e){const n=r(33),i=r(58),o=r(9),s=r(621),a=r(49);function u(e,t,r){s.hmac.create(e,t,r)}function c(e,t,r,n){if("AES-128"===e||"AES-256"===e)return s.aes.create(r,t,n);n(new Error(`unrecognized cipher type: ${e}`))}t.exchanges=["P-256","P-384","P-521"],t.ciphers=["AES-256","AES-128"],t.hashes=["SHA256","SHA512"],t.theBest=((e,t,r)=>{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)=>{a([t=>u(e.hashT,e.keys.macKey,t),t=>c(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(o.values([r]),i.encode({fixed:!0,bytes:4}),o.collect((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";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(99)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){"use strict";(function(e){const n=r(17),i=r(1409),o=r(621),s=r(49),a=r(6),u=r(187),c=u("libp2p:secio");c.error=u("libp2p:secio:error");const f=n(r(1426)),l=r(349),h=16;t.createProposal=(e=>(e.proposal.out={rand:o.randomBytes(16),pubkey:e.key.local.public.bytes,exchanges:l.exchanges.join(","),ciphers:l.ciphers.join(","),hashes:l.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:l.exchanges,hashes:l.hashes,ciphers:l.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};l.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=>l.makeMacAndCipher(e.protocols.local,t),t=>l.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";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(99)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){"use strict";const n=r(17),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";t.Listener=t.listener=r(1446),t.Dialer=t.dialer=r(1449),t.matchSemver=r(1450),t.matchExact=r(639)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(59),i=a(n),o=r(284),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(9),i=r(58),o=r(124),s=r(4),a=s("libp2p:circuit:stream-handler");a.err=s("libp2p:circuit:error:stream-handler");class u{constructor(e,t,r,i){this.conn=e,this.stream=null,this.shake=null,this.timeout=t||6e4,this.maxLength=i||4096,"function"==typeof t&&(this.timeout=r||6e4),this.stream=o({timeout:this.timeout},t),this.shake=this.stream.handshake,n(this.stream,e,this.stream)}isValid(){return this.conn&&this.shake&&this.stream}read(e){this.isValid()||e(new Error("handler is not in a valid state")),i.decodeFromReader(this.shake,{maxLength:this.maxLength},(t,r)=>t?(a.err(t),e(t)):e(null,r))}write(e,t){t=t||(()=>{}),this.isValid()||t(new Error("handler is not in a valid state")),n(n.values([e]),i.encode(),n.collect((e,r)=>{if(e)return a.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(){n(n.empty(),this.rest())}}e.exports=u},function(e,t,r){"use strict";e.exports={relay:"/libp2p/circuit/relay/0.1.0"}},function(e,t,r){"use strict";e.exports={PROTOCOL:"/ipfs/ping/1.0.0",PING_LENGTH:32}},function(e,t,r){"use strict";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(99)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){"use strict";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(99)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){(function(e,n){var i; +function r(e){return e instanceof t||e instanceof Date||e instanceof RegExp}function n(e){if(e instanceof t){var r=t.alloc?t.alloc(e.length):new t(e.length);return e.copy(r),r}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e);throw new Error("Unexpected situation")}function i(e){var t=[];return e.forEach(function(e,o){"object"==typeof e&&null!==e?Array.isArray(e)?t[o]=i(e):r(e)?t[o]=n(e):t[o]=s({},e):t[o]=e}),t}function o(e,t){return"__proto__"===t?void 0:e[t]}var s=e.exports=function(){if(arguments.length<1||"object"!=typeof arguments[0])return!1;if(arguments.length<2)return arguments[0];var e=arguments[0],t=Array.prototype.slice.call(arguments,1),a,u,c;return t.forEach(function(t){"object"!=typeof t||null===t||Array.isArray(t)||Object.keys(t).forEach(function(c){return u=o(e,c),a=o(t,c),a===e?void 0:"object"!=typeof a||null===a?void(e[c]=a):Array.isArray(a)?void(e[c]=i(a)):r(a)?void(e[c]=n(a)):"object"!=typeof u||null===u||Array.isArray(u)?void(e[c]=s({},a)):void(e[c]=s(u,a))})}),e}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(62);function i(e){if("number"==typeof e){if(i.codes[e])return i.codes[e];throw new Error("no protocol with code: "+e)}if("string"==typeof e||e instanceof String){if(i.names[e])return i.names[e];throw new Error("no protocol with name: "+e)}throw new Error("invalid protocol id type: "+e)}const o=-1;function s(e,t,r,n){return{code:e,size:t,name:r,resolvable:Boolean(n)}}i.lengthPrefixedVarSize=o,i.V=o,i.table=[[4,32,"ip4"],[6,16,"tcp"],[17,16,"udp"],[33,16,"dccp"],[41,128,"ip6"],[54,o,"dns4","resolvable"],[55,o,"dns6","resolvable"],[56,o,"dnsaddr","resolvable"],[132,16,"sctp"],[302,0,"utp"],[421,i.lengthPrefixedVarSize,"ipfs"],[480,0,"http"],[443,0,"https"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[290,0,"p2p-circuit"]],i.names={},i.codes={},n(i.table,function(e){const t=s.apply(null,e);i.codes[t.code]=t,i.names[t.name]=t}),i.object=s,e.exports=i},function(e,t,r){"use strict";const n=r(62);function i(e){if("number"==typeof e){if(i.codes[e])return i.codes[e];throw new Error("no protocol with code: "+e)}if("string"==typeof e||e instanceof String){if(i.names[e])return i.names[e];throw new Error("no protocol with name: "+e)}throw new Error("invalid protocol id type: "+e)}const o=-1;function s(e,t,r,n){return{code:e,size:t,name:r,resolvable:Boolean(n)}}i.lengthPrefixedVarSize=o,i.V=o,i.table=[[4,32,"ip4"],[6,16,"tcp"],[273,16,"udp"],[33,16,"dccp"],[41,128,"ip6"],[54,o,"dns4","resolvable"],[55,o,"dns6","resolvable"],[56,o,"dnsaddr","resolvable"],[132,16,"sctp"],[302,0,"utp"],[421,i.lengthPrefixedVarSize,"p2p"],[421,i.lengthPrefixedVarSize,"ipfs"],[480,0,"http"],[443,0,"https"],[460,0,"quic"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[290,0,"p2p-circuit"]],i.names={},i.codes={},n(i.table,function(e){const t=s.apply(null,e);i.codes[t.code]=t,i.names[t.name]=t}),i.object=s,e.exports=i},function(e,t,r){"use strict";const n=r(6),i=r(42),o=r(48),s=r(43),a=r(211),u=r(20),c=r(44),f=r(5),l=r(63),h=r(8),d=r(1139),p=r(1140),y=r(1142),g=r(1143),m=r(1144),b=r(1145),v=r(1152),_=r(1153),w=r(1154),S=f("repo"),E=Number.MAX_SAFE_INTEGER,k={memory:r(558),fs:r(558)},A=r(1155).repoVersion;class x{constructor(e,t){u.equal(typeof e,"string","missing repoPath"),this.options=O(t),this.closed=!0,this.path=e,this._locker=this._getLocker(),this.root=d.create("root",this.path,this.options),this.version=p(this.root),this.config=y(this.root),this.spec=g(this.root),this.apiAddr=m(this.root)}init(e,t){S("initializing at: %s",this.path),i([e=>this.root.open(I(e)),t=>this.config.set(P(e),t),t=>this.spec.set(R(e),t),e=>this.version.set(A,e)],t)}open(e){this.closed?(S("opening at: %s",this.path),n([e=>this.root.open(I(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);b(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.equal(typeof r.close,"function","Locks must have a close method"),t(null,r)})}_closeLock(e){if(this.lockfile)return this.lockfile.close(e);e()}_isLocked(e,t){if(this._locker)return this._locker.locked(e,t);t(null,!1)}_isInitialized(e){S("init check"),o({config:e=>this.config.exists(e),spec:e=>this.spec.exists(e),version:e=>this.version.check(A,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(B(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 l(t?E:r))}),version:e=>this.version.get(e),blocks:e=>this.blocks.query({},(t,r)=>{r=r||[];const n=new l(r.length);let i=new l(0);r.forEach(e=>{i=i.plus(e.value.byteLength).plus(e.key._buf.byteLength)}),e(t,{count:n,size:i})}),datastore:e=>C(this.datastore,e),keys:e=>C(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 C(e,t){h(e.query({}),h.reduce((e,t)=>e.plus(t.value.byteLength).plus(t.key._buf.byteLength),new l(0),t))}function T(e,t){return r=>{t(r&&!e(r)?r:null)}}function I(e){return T(e=>"Already open"===e.message,e)}function B(e){return T(e=>e&&(e.code===w.ERR_REPO_NOT_INITIALIZED||e.message.startsWith("ENOENT")),e)}function O(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 P(e){return e.datastore=Object.assign({},_,a(e,"datastore",{})),e}function R(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=x,e.exports.repoVersion=A,e.exports.errors=w},function(e,t,r){"use strict";const n=r(8),i=r(129),o=r(44),s=r(161),a=r(106);t.asyncFilter=function(e){let t=!1,r,n;return function(i){return function o(s,a){if(n)return a(n);s?(n=s,i(s,t?()=>{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,r){var n=r(1176),i=r(1180);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(563);function i(e,t,r){"__proto__"==t&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}e.exports=i},function(e,t,r){"use strict";const n=r(8),i=r(129),o=r(44),s=r(161),a=r(106);t.asyncFilter=function(e){let t=!1,r,n;return function(i){return function o(s,a){if(n)return a(n);s?(n=s,i(s,t?()=>{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,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(1290)("socket.io-parser"),i=r(140),o=r(1293),s=r(580),a=r(581);function u(){}t.protocol=4,t.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],t.CONNECT=0,t.DISCONNECT=1,t.EVENT=2,t.ACK=3,t.ERROR=4,t.BINARY_EVENT=5,t.BINARY_ACK=6,t.Encoder=u,t.Decoder=d;var c=t.ERROR+'"encode error"';function f(e){var r=""+e.type;if(t.BINARY_EVENT!==e.type&&t.BINARY_ACK!==e.type||(r+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(r+=e.nsp+","),null!=e.id&&(r+=e.id),null!=e.data){var i=l(e.data);if(!1===i)return c;r+=i}return n("encoded %j as %s",e,r),r}function l(e){try{return JSON.stringify(e)}catch(e){return!1}}function h(e,t){function r(e){var r=o.deconstructPacket(e),n=f(r.packet),i=r.buffers;i.unshift(n),t(i)}o.removeBlobs(e,r)}function d(){this.reconstructor=null}function p(e){var r=0,i={type:Number(e.charAt(0))};if(null==t.types[i.type])return m("unknown packet type "+i.type);if(t.BINARY_EVENT===i.type||t.BINARY_ACK===i.type){for(var o="";"-"!==e.charAt(++r)&&(o+=e.charAt(r),r!=e.length););if(o!=Number(o)||"-"!==e.charAt(r))throw new Error("Illegal attachments");i.attachments=Number(o)}if("/"===e.charAt(r+1))for(i.nsp="";++r;){var a=e.charAt(r);if(","===a)break;if(i.nsp+=a,r===e.length)break}else i.nsp="/";var u=e.charAt(r+1);if(""!==u&&Number(u)==u){for(i.id="";++r;){var a=e.charAt(r);if(null==a||Number(a)!=a){--r;break}if(i.id+=e.charAt(r),r===e.length)break}i.id=Number(i.id)}if(e.charAt(++r)){var c=y(e.substr(r)),f=!1!==c&&(i.type===t.ERROR||s(c));if(!f)return m("invalid payload");i.data=c}return n("decoded %s as %j",e,i),i}function y(e){try{return JSON.parse(e)}catch(e){return!1}}function g(e){this.reconPack=e,this.buffers=[]}function m(e){return{type:t.ERROR,data:"parser error: "+e}}u.prototype.encode=function(e,r){if(n("encoding packet %j",e),t.BINARY_EVENT===e.type||t.BINARY_ACK===e.type)h(e,r);else{var i=f(e);r([i])}},i(d.prototype),d.prototype.add=function(e){var r;if("string"==typeof e)r=p(e),t.BINARY_EVENT===r.type||t.BINARY_ACK===r.type?(this.reconstructor=new g(r),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",r)):this.emit("decoded",r);else{if(!a(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");r=this.reconstructor.takeBinaryData(e),r&&(this.reconstructor=null,this.emit("decoded",r))}},d.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},g.prototype.takeBinaryData=function(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t=o.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null},g.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(e,t,r){var n=r(1296);e.exports=function(e){var t=e.xdomain,r=e.xscheme,i=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!t||n))return new XMLHttpRequest}catch(e){}try{if("undefined"!=typeof XDomainRequest&&!r&&i)return new XDomainRequest}catch(e){}if(!t)try{return new(self[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}},function(e,t,r){var n=r(141),i=r(140);function o(e){this.path=e.path,this.hostname=e.hostname,this.port=e.port,this.secure=e.secure,this.query=e.query,this.timestampParam=e.timestampParam,this.timestampRequests=e.timestampRequests,this.readyState="",this.agent=e.agent||!1,this.socket=e.socket,this.enablesXDR=e.enablesXDR,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.forceNode=e.forceNode,this.isReactNative=e.isReactNative,this.extraHeaders=e.extraHeaders,this.localAddress=e.localAddress}e.exports=o,i(o.prototype),o.prototype.onError=function(e,t){var r=new Error(e);return r.type="TransportError",r.description=t,this.emit("error",r),this},o.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},o.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},o.prototype.send=function(e){if("open"!==this.readyState)throw new Error("Transport not open");this.write(e)},o.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},o.prototype.onData=function(e){var t=n.decodePacket(e,this.socket.binaryType);this.onPacket(t)},o.prototype.onPacket=function(e){this.emit("packet",e)},o.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(e,t,r){"use strict";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(98)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},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(1359)(t);const{formatters:f}=e.exports;f.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,r(3))},function(e,t,r){"use strict";(function(e){const n=r(33),i=r(58),o=r(8),s=r(612),a=r(48);function u(e,t,r){s.hmac.create(e,t,r)}function c(e,t,r,n){if("AES-128"===e||"AES-256"===e)return s.aes.create(r,t,n);n(new Error(`unrecognized cipher type: ${e}`))}t.exchanges=["P-256","P-384","P-521"],t.ciphers=["AES-256","AES-128"],t.hashes=["SHA256","SHA512"],t.theBest=((e,t,r)=>{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)=>{a([t=>u(e.hashT,e.keys.macKey,t),t=>c(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(o.values([r]),i.encode({fixed:!0,bytes:4}),o.collect((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";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(98)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){"use strict";(function(e){const n=r(17),i=r(1388),o=r(612),s=r(48),a=r(6),u=r(183),c=u("libp2p:secio");c.error=u("libp2p:secio:error");const f=n(r(1405)),l=r(345),h=16;t.createProposal=(e=>(e.proposal.out={rand:o.randomBytes(16),pubkey:e.key.local.public.bytes,exchanges:l.exchanges.join(","),ciphers:l.ciphers.join(","),hashes:l.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:l.exchanges,hashes:l.hashes,ciphers:l.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};l.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=>l.makeMacAndCipher(e.protocols.local,t),t=>l.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";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(98)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){"use strict";const n=r(17),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";t.Listener=t.listener=r(1425),t.Dialer=t.dialer=r(1428),t.matchSemver=r(1429),t.matchExact=r(630)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(59),i=a(n),o=r(280),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(8),i=r(58),o=r(122),s=r(5),a=s("libp2p:circuit:stream-handler");a.err=s("libp2p:circuit:error:stream-handler");class u{constructor(e,t,r,i){this.conn=e,this.stream=null,this.shake=null,this.timeout=t||6e4,this.maxLength=i||4096,"function"==typeof t&&(this.timeout=r||6e4),this.stream=o({timeout:this.timeout},t),this.shake=this.stream.handshake,n(this.stream,e,this.stream)}isValid(){return this.conn&&this.shake&&this.stream}read(e){this.isValid()||e(new Error("handler is not in a valid state")),i.decodeFromReader(this.shake,{maxLength:this.maxLength},(t,r)=>t?(a.err(t),e(t)):e(null,r))}write(e,t){t=t||(()=>{}),this.isValid()||t(new Error("handler is not in a valid state")),n(n.values([e]),i.encode(),n.collect((e,r)=>{if(e)return a.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(){n(n.empty(),this.rest())}}e.exports=u},function(e,t,r){"use strict";e.exports={relay:"/libp2p/circuit/relay/0.1.0"}},function(e,t,r){"use strict";e.exports={PROTOCOL:"/ipfs/ping/1.0.0",PING_LENGTH:32}},function(e,t,r){"use strict";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(98)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){"use strict";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(98)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){(function(e,n){var i; /** * @license * Lodash @@ -102,30 +102,30 @@ function r(e){return e instanceof t||e instanceof Date||e instanceof RegExp}func * 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__",l=500,h="__lodash_placeholder__",d=1,p=2,y=4,g=1,m=2,b=1,v=2,_=4,w=8,S=16,E=32,k=64,A=128,x=256,C=512,T=30,I="...",B=800,O=16,P=1,R=2,N=3,j=1/0,L=9007199254740991,M=1.7976931348623157e308,D=NaN,U=4294967295,F=U-1,K=U>>>1,q=[["ary",A],["bind",b],["bindKey",v],["curry",w],["curryRight",S],["flip",C],["partial",E],["partialRight",k],["rearg",x]],H="[object Arguments]",z="[object Array]",V="[object AsyncFunction]",G="[object Boolean]",W="[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]",le="[object ArrayBuffer]",he="[object DataView]",de="[object Float32Array]",pe="[object Float64Array]",ye="[object Int8Array]",ge="[object Int16Array]",me="[object Int32Array]",be="[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,Ae=/&(?:amp|lt|gt|quot|#39);/g,xe=/[&<>"']/g,Ce=RegExp(Ae.source),Te=RegExp(xe.source),Ie=/<%-([\s\S]+?)%>/g,Be=/<%([\s\S]+?)%>/g,Oe=/<%=([\s\S]+?)%>/g,Pe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Re=/^\w*$/,Ne=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,je=/[\\^$.*+?()[\]{}|]/g,Le=RegExp(je.source),Me=/^\s+|\s+$/g,De=/^\s+/,Ue=/\s+$/,Fe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ke=/\{\n\/\* \[wrapped with (.+)\] \*/,qe=/,? & /,He=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ze=/\\(\\)?/g,Ve=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ge=/\w*$/,We=/^[-+]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",lt=" \\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",dt="\\ufe0e\\ufe0f",pt=ut+ct+"\\u2000-\\u206f"+lt,yt="['’]",gt="[\\ud800-\\udfff]",mt="["+pt+"]",bt="["+ot+"]",vt="\\d+",_t="[\\u2700-\\u27bf]",wt="["+at+"]",St="[^"+tt+pt+vt+st+at+ht+"]",Et="\\ud83c[\\udffb-\\udfff]",kt="(?:"+bt+"|"+Et+")",At="[^\\ud800-\\udfff]",xt="(?:\\ud83c[\\udde6-\\uddff]){2}",Ct="[\\ud800-\\udbff][\\udc00-\\udfff]",Tt="["+ht+"]",It="\\u200d",Bt="(?:"+wt+"|"+St+")",Ot="(?:"+Tt+"|"+St+")",Pt="(?:['’](?:d|ll|m|re|s|t|ve))?",Rt="(?:['’](?:D|LL|M|RE|S|T|VE))?",Nt=kt+"?",jt="[\\ufe0e\\ufe0f]?",Lt="(?:\\u200d(?:"+[At,xt,Ct].join("|")+")"+jt+Nt+")*",Mt="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Dt="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ut=jt+Nt+Lt,Ft="(?:"+[_t,xt,Ct].join("|")+")"+Ut,Kt="(?:"+[At+bt+"?",bt,xt,Ct,gt].join("|")+")",qt=RegExp("['’]","g"),Ht=RegExp(bt,"g"),zt=RegExp(Et+"(?="+Et+")|"+Kt+Ut,"g"),Vt=RegExp([Tt+"?"+wt+"+"+Pt+"(?="+[mt,Tt,"$"].join("|")+")",Ot+"+"+Rt+"(?="+[mt,Tt+Bt,"$"].join("|")+")",Tt+"?"+Bt+"+"+Pt,Tt+"+"+Rt,Dt,Mt,vt,Ft].join("|"),"g"),Gt=RegExp("["+It+tt+ot+dt+"]"),Wt=/[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[ye]=Jt[ge]=Jt[me]=Jt[be]=Jt[ve]=Jt[_e]=Jt[we]=!0,Jt[H]=Jt[z]=Jt[le]=Jt[G]=Jt[he]=Jt[W]=Jt[Y]=Jt[J]=Jt[Z]=Jt[Q]=Jt[te]=Jt[ie]=Jt[oe]=Jt[se]=Jt[ce]=!1;var Xt={};Xt[H]=Xt[z]=Xt[le]=Xt[he]=Xt[G]=Xt[W]=Xt[de]=Xt[pe]=Xt[ye]=Xt[ge]=Xt[me]=Xt[Z]=Xt[Q]=Xt[te]=Xt[ie]=Xt[oe]=Xt[se]=Xt[ae]=Xt[be]=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="object"==typeof t&&t&&!t.nodeType&&t,ur=ar&&"object"==typeof n&&n&&!n.nodeType&&n,cr=ur&&ur.exports===ar,fr=cr&&ir.process,lr=function(){try{var e=ur&&ur.require&&ur.require("util").types;return e||fr&&fr.binding&&fr.binding("util")}catch(e){}}(),hr=lr&&lr.isArrayBuffer,dr=lr&&lr.isDate,pr=lr&&lr.isMap,yr=lr&&lr.isRegExp,gr=lr&&lr.isSet,mr=lr&&lr.isTypedArray;function br(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 Ar(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=Kr(Zt),en=Kr(Qt);function tn(e){return"\\"+tr[e]}function rn(e,t){return null==e?o:e[t]}function nn(e){return Gt.test(e)}function on(e){return Wt.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 Fn(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 Kn(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function yi(e,t,r,n,i,s){var a,u=t&d,c=t&p,f=t&y;if(r&&(a=i?r(e,n,i,s):r(e)),a!==o)return a;if(!Ef(e))return e;var l=af(e);if(l){if(a=Qs(e),!u)return rs(e,a)}else{var h=Ys(e),g=h==J||h==X;if(hf(e))return Go(e,u);if(h==te||h==H||g&&!i){if(a=c||g?{}:ea(e),!u)return c?os(e,li(a,e)):is(e,fi(a,e))}else{if(!Xt[h])return i?e:{};a=ta(e,h,u)}}s||(s=new Jn);var m=s.get(e);if(m)return m;if(s.set(e,a),Lf(e))return e.forEach(function(n){a.add(yi(n,t,r,n,e,s))}),a;if(Af(e))return e.forEach(function(n,i){a.set(i,yi(n,t,r,i,e,s))}),a;var b=f?c?Ds:Ms:c?Sl:wl,v=l?o:b(e);return _r(v||e,function(n,i){v&&(i=n,n=e[i]),ai(a,i,yi(n,t,r,i,e,s))}),a}function gi(e){var t=wl(e);return function(r){return mi(r,e,t)}}function mi(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 bi(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=xr(t,Wr(r))),n?(o=Ar,s=!1):t.length>=a&&(o=Yr,s=!1,t=new Wn(t));e:for(;++ii?0:i+r),n=n===o||n>i?i:Wf(n),n<0&&(n+=i),n=r>n?0:$f(n);r0&&r(a)?t>1?xi(a,t-1,r,n,i):Cr(i,a):n||(i[i.length]=a)}return i}var Ci=cs(),Ti=cs(!0);function Ii(e,t){return e&&Ci(e,t,wl)}function Bi(e,t){return e&&Ti(e,t,wl)}function Oi(e,t){return Er(t,function(t){return _f(e[t])})}function Pi(e,t){t=qo(t,e);for(var r=0,n=t.length;null!=e&&rt}function Li(e,t){return null!=e&&ft.call(e,t)}function Mi(e,t){return null!=e&&t in tt(e)}function Di(e,t,r){return e>=Kt(t,r)&&e=120&&h.length>=120)?new Wn(u&&h):o}h=e[0];var d=-1,p=c[0];e:for(;++d-1;)a!==e&&At.call(a,u,1),At.call(e,u,1);return e}function yo(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)?At.call(e,i,1):No(e,i)}}return e}function go(e,t){return e+Nt(Gt()*(t-e+1))}function mo(e,t,n,i){for(var o=-1,s=Ft(Rt((t-e)/(n||1)),0),a=r(s);s--;)a[i?s:++o]=e,e+=n;return a}function bo(e,t){var r="";if(!e||t<1||t>L)return r;do{t%2&&(r+=e),t=Nt(t/2),t&&(e+=e)}while(t);return r}function vo(e,t){return ka(ba(e,t,Ih),e+"")}function _o(e){return ni(Fl(e))}function wo(e,t){var r=Fl(e);return Ca(r,pi(t,0,r.length))}function So(e,t,r,n){if(!Ef(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),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:Cs(e);if(f)return fn(f);s=!1,i=Yr,c=new Wn}else c=t?[]:u;e:for(;++n=n?e:xo(e,t,r)}var Vo=Bt||function(e){return sr.clearTimeout(e)};function Go(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 Wo(e){var t=new e.constructor(e.byteLength);return new _t(t).set(new _t(e)),t}function $o(e,t){var r=t?Wo(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function Yo(e){var t=new e.constructor(e.source,Ge.exec(e));return t.lastIndex=e.lastIndex,t}function Jo(e){return mn?tt(mn.call(e)):{}}function Xo(e,t){var r=t?Wo(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=Ft(s-a,0),l=r(c+f),h=!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 gs(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"==Fs(s))var a=new kn([],!0)}for(n=a?n:r;++n1&&b.reverse(),h&&fu))return!1;var f=s.get(e);if(f&&s.get(t))return f==t;var l=-1,h=!0,d=r&m?new Wn:o;for(s.set(e,t),s.set(t,e);++l1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(Fe,"{\n/* [wrapped with "+t+"] */\n")}function na(e){return af(e)||sf(e)||!!(xt&&e&&e[xt])}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>=B)return arguments[0]}else t=0;return e.apply(o,arguments)}}function Ca(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,Nu(e,r)});function Hu(e){var t=_n(e);return t.__chain__=!0,t}function zu(e,t){return t(e),e}function Vu(e,t){return t(e)}var Gu=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 An&&ia(r)?(n=n.slice(r,+r+(t?1:0)),n.__actions__.push({func:Vu,args:[i],thisArg:o}),new kn(n,this.__chain__).thru(function(e){return t&&!e.length&&e.push(o),e})):this.thru(i)});function Wu(){return Hu(this)}function $u(){return new kn(this.value(),this.__chain__)}function Yu(){this.__values__===o&&(this.__values__=Vf(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=Pa(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 An){var t=e;return this.__actions__.length&&(t=new An(this)),t=t.reverse(),t.__actions__.push({func:Vu,args:[hu],thisArg:o}),new kn(t,this.__chain__)}return this.thru(hu)}function Qu(){return Mo(this.__wrapped__,this.__actions__)}var ec=ss(function(e,t,r){ft.call(e,r)?++e[r]:hi(e,r,1)});function tc(e,t,r){var n=af(e)?Sr:Si;return r&&oa(e,t,r)&&(t=o),n(e,qs(t,3))}function rc(e,t){var r=af(e)?Er:Ai;return r(e,qs(t,3))}var nc=ys(za),ic=ys(Va);function oc(e,t){return xi(pc(e,t),1)}function sc(e,t){return xi(pc(e,t),j)}function ac(e,t,r){return r=r===o?1:Wf(r),xi(pc(e,t),r)}function uc(e,t){var r=af(e)?_r:_i;return r(e,qs(t,3))}function cc(e,t){var r=af(e)?wr:wi;return r(e,qs(t,3))}var fc=ss(function(e,t,r){ft.call(e,r)?e[r].push(t):hi(e,r,[t])});function lc(e,t,r,n){e=cf(e)?e:Fl(e),r=r&&!n?Wf(r):0;var i=e.length;return r<0&&(r=Ft(i+r,0)),Mf(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&Lr(e,t,r)>-1}var hc=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?br(t,e,n):Ki(e,t,n)}),s}),dc=ss(function(e,t,r){hi(e,r,t)});function pc(e,t){var r=af(e)?xr:no;return r(e,qs(t,3))}function yc(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 gc=ss(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]});function mc(e,t,r){var n=af(e)?Tr:qr,i=arguments.length<3;return n(e,qs(t,4),r,i,_i)}function bc(e,t,r){var n=af(e)?Ir:qr,i=arguments.length<3;return n(e,qs(t,4),r,i,wi)}function vc(e,t){var r=af(e)?Er:Ai;return r(e,Uc(qs(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:Wf(t);var n=af(e)?ii:wo;return n(e,t)}function Sc(e){var t=af(e)?oi:Ao;return t(e)}function Ec(e){if(null==e)return 0;if(cf(e))return Mf(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)?Br:Co;return r&&oa(e,t,r)&&(t=o),n(e,qs(t,3))}var Ac=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,xi(t,1),[])}),xc=Ot||function(){return sr.Date.now()};function Cc(e,t){if("function"!=typeof t)throw new it(c);return e=Wf(e),function(){if(--e<1)return t.apply(this,arguments)}}function Tc(e,t,r){return t=r?o:t,t=e&&null==t?e.length:t,Is(e,A,o,o,o,o,t)}function Ic(e,t){var r;if("function"!=typeof t)throw new it(c);return e=Wf(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=o),r}}var Bc=vo(function(e,t,r){var n=b;if(r.length){var i=cn(r,Ks(Bc));n|=E}return Is(e,n,t,r,i)}),Oc=vo(function(e,t,r){var n=b|v;if(r.length){var i=cn(r,Ks(Oc));n|=E}return Is(t,n,e,r,i)});function Pc(e,t,r){t=r?o:t;var n=Is(e,w,o,o,o,o,o,t);return n.placeholder=Pc.placeholder,n}function Rc(e,t,r){t=r?o:t;var n=Is(e,S,o,o,o,o,o,t);return n.placeholder=Rc.placeholder,n}function Nc(e,t,r){var n,i,s,a,u,f,l=0,h=!1,d=!1,p=!0;if("function"!=typeof e)throw new it(c);function y(t){var r=n,s=i;return n=i=o,l=t,a=e.apply(s,r),a}function g(e){return l=e,u=Ea(v,t),h?y(e):a}function m(e){var r=e-f,n=e-l,i=t-r;return d?Kt(i,s-n):i}function b(e){var r=e-f,n=e-l;return f===o||r>=t||r<0||d&&n>=s}function v(){var e=xc();if(b(e))return _(e);u=Ea(v,m(e))}function _(e){return u=o,p&&n?y(e):(n=i=o,a)}function w(){u!==o&&Vo(u),l=0,n=f=i=u=o}function S(){return u===o?a:_(xc())}function E(){var e=xc(),r=b(e);if(n=arguments,i=this,f=e,r){if(u===o)return g(f);if(d)return u=Ea(v,t),y(f)}return u===o&&(u=Ea(v,t)),a}return t=Yf(t)||0,Ef(r)&&(h=!!r.leading,d="maxWait"in r,s=d?Ft(Yf(r.maxWait)||0,t):s,p="trailing"in r?!!r.trailing:p),E.cancel=w,E.flush=S,E}var jc=vo(function(e,t){return bi(e,1,t)}),Lc=vo(function(e,t,r){return bi(e,Yf(t)||0,r)});function Mc(e){return Is(e,C)}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||Kn),r}function Uc(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 Fc(e){return Ic(2,e)}Dc.Cache=Kn;var Kc=Ho(function(e,t){t=1==t.length&&af(t[0])?xr(t[0],Wr(qs())):xr(xi(t,1),Wr(qs()));var r=t.length;return vo(function(n){for(var i=-1,o=Kt(n.length,r);++i=t}),sf=qi(function(){return arguments}())?qi:function(e){return kf(e)&&ft.call(e,"callee")&&!kt.call(e,"callee")},af=r.isArray,uf=hr?Wr(hr):Hi;function cf(e){return null!=e&&Sf(e.length)&&!_f(e)}function ff(e){return kf(e)&&cf(e)}function lf(e){return!0===e||!1===e||kf(e)&&Ni(e)==G}var hf=Lt||Wh,df=dr?Wr(dr):zi;function pf(e){return kf(e)&&1===e.nodeType&&!Rf(e)}function yf(e){if(null==e)return!0;if(cf(e)&&(af(e)||"string"==typeof e||"function"==typeof e.splice||hf(e)||Uf(e)||sf(e)))return!e.length;var t=Ys(e);if(t==Z||t==oe)return!e.size;if(la(e))return!eo(e).length;for(var r in e)if(ft.call(e,r))return!1;return!0}function gf(e,t){return Vi(e,t)}function mf(e,t,r){r="function"==typeof r?r:o;var n=r?r(e,t):o;return n===o?Vi(e,t,o,r):!!n}function bf(e){if(!kf(e))return!1;var t=Ni(e);return t==Y||t==$||"string"==typeof e.message&&"string"==typeof e.name&&!Rf(e)}function vf(e){return"number"==typeof e&&Mt(e)}function _f(e){if(!Ef(e))return!1;var t=Ni(e);return t==J||t==X||t==V||t==ne}function wf(e){return"number"==typeof e&&e==Wf(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 Af=pr?Wr(pr):Wi;function xf(e,t){return e===t||$i(e,t,zs(t))}function Cf(e,t,r){return r="function"==typeof r?r:o,$i(e,t,zs(t),r)}function Tf(e){return Pf(e)&&e!=+e}function If(e){if(fa(e))throw new i(u);return Yi(e)}function Bf(e){return null===e}function Of(e){return null==e}function Pf(e){return"number"==typeof e||kf(e)&&Ni(e)==Q}function Rf(e){if(!kf(e)||Ni(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)==yt}var Nf=yr?Wr(yr):Ji;function jf(e){return wf(e)&&e>=-L&&e<=L}var Lf=gr?Wr(gr):Xi;function Mf(e){return"string"==typeof e||!af(e)&&kf(e)&&Ni(e)==se}function Df(e){return"symbol"==typeof e||kf(e)&&Ni(e)==ae}var Uf=mr?Wr(mr):Zi;function Ff(e){return e===o}function Kf(e){return kf(e)&&Ys(e)==ce}function qf(e){return kf(e)&&Ni(e)==fe}var Hf=ks(ro),zf=ks(function(e,t){return e<=t});function Vf(e){if(!e)return[];if(cf(e))return Mf(e)?yn(e):rs(e);if(Ct&&e[Ct])return sn(e[Ct]());var t=Ys(e),r=t==Z?an:t==oe?fn:Fl;return r(e)}function Gf(e){if(!e)return 0===e?e:0;if(e=Yf(e),e===j||e===-j){var t=e<0?-1:1;return t*M}return e==e?e:0}function Wf(e){var t=Gf(e),r=t%1;return t==t?r?t-r:t:0}function $f(e){return e?pi(Wf(e),0,U):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(Me,"");var r=$e.test(e);return r||Je.test(e)?nr(e.slice(2),r?2:8):We.test(e)?D:+e}function Jf(e){return ns(e,Sl(e))}function Xf(e){return e?pi(Wf(e),-L,L):0===e?e:0}function Zf(e){return null==e?"":Po(e)}var Qf=as(function(e,t){if(la(t)||cf(t))ns(t,wl(t),e);else for(var r in t)ft.call(t,r)&&ai(e,r,t[r])}),el=as(function(e,t){ns(t,Sl(t),e)}),tl=as(function(e,t,r,n){ns(t,Sl(t),e,n)}),rl=as(function(e,t,r,n){ns(t,wl(t),e,n)}),nl=Ls(di);function il(e,t){var r=Sn(e);return null==t?r:fi(r,t)}var ol=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=yi(r,d|p|y,Ps));for(var i=t.length;i--;)No(r,t[i]);return r});function Tl(e,t){return Bl(e,Uc(qs(t)))}var Il=Ls(function(e,t){return null==e?{}:fo(e,t)});function Bl(e,t){if(null==e)return{};var r=xr(Ds(e),function(e){return[e]});return t=qs(t),lo(e,r,function(e,r){return t(e,r[0])})}function Ol(e,t,r){t=qo(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=Gt();return Kt(e+i*(t-e+rr("1e-"+((i+"").length-1))),t)}return go(e,t)}var Vl=hs(function(e,t,r){return t=t.toLowerCase(),e+(r?Gl(t):t)});function Gl(e){return vh(Zf(e).toLowerCase())}function Wl(e){return e=Zf(e),e&&e.replace(Ze,Qr).replace(Ht,"")}function $l(e,t,r){e=Zf(e),t=Po(t);var n=e.length;r=r===o?n:pi(Wf(r),0,n);var i=r;return r-=t.length,r>=0&&e.slice(r,i)==t}function Yl(e){return e=Zf(e),e&&Te.test(e)?e.replace(xe,en):e}function Jl(e){return e=Zf(e),e&&Le.test(e)?e.replace(je,"\\$&"):e}var Xl=hs(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),Zl=hs(function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}),Ql=ls("toLowerCase");function eh(e,t,r){e=Zf(e),t=Wf(t);var n=t?pn(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return ws(Nt(i),r)+e+ws(Rt(i),r)}function th(e,t,r){e=Zf(e),t=Wf(t);var n=t?pn(e):0;return t&&n>>0,r?(e=Zf(e),e&&("string"==typeof t||null!=t&&!Nf(t))&&(t=Po(t),!t&&nn(e))?zo(yn(e),0,r):e.split(t,r)):[]}var uh=hs(function(e,t,r){return e+(r?" ":"")+vh(t)});function ch(e,t,r){return e=Zf(e),r=null==r?0:pi(Wf(r),0,e.length),t=Po(t),e.slice(r,r+t.length)==t}function fh(e,t,r){var n=_n.templateSettings;r&&oa(e,t,r)&&(t=o),e=Zf(e),t=tl({},t,n,Bs);var i=tl({},t.imports,n.imports,Bs),s=wl(i),a=$r(i,s),u,c,f=0,l=t.interpolate||Qe,h="__p += '",d=rt((t.escape||Qe).source+"|"+l.source+"|"+(l===Oe?Ve: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),h+=e.slice(f,s).replace(et,tn),r&&(u=!0,h+="' +\n__e("+r+") +\n'"),o&&(c=!0,h+="';\n"+o+";\n__p += '"),n&&(h+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),f=s+t.length,t}),h+="';\n";var y=t.variable;y||(h="with (obj) {\n"+h+"\n}\n"),h=(c?h.replace(Se,""):h).replace(Ee,"$1").replace(ke,"$1;"),h="function("+(y||"obj")+") {\n"+(y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(u?", __e = _.escape":"")+(c?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var g=wh(function(){return N(s,p+"return "+h).apply(o,a)});if(g.source=h,bf(g))throw g;return g}function lh(e){return Zf(e).toLowerCase()}function hh(e){return Zf(e).toUpperCase()}function dh(e,t,r){if(e=Zf(e),e&&(r||t===o))return e.replace(Me,"");if(!e||!(t=Po(t)))return e;var n=yn(e),i=yn(t),s=Jr(n,i),a=Xr(n,i)+1;return zo(n,s,a).join("")}function ph(e,t,r){if(e=Zf(e),e&&(r||t===o))return e.replace(Ue,"");if(!e||!(t=Po(t)))return e;var n=yn(e),i=Xr(n,yn(t))+1;return zo(n,0,i).join("")}function yh(e,t,r){if(e=Zf(e),e&&(r||t===o))return e.replace(De,"");if(!e||!(t=Po(t)))return e;var n=yn(e),i=Jr(n,yn(t));return zo(n,i).join("")}function gh(e,t){var r=T,n=I;if(Ef(t)){var i="separator"in t?t.separator:i;r="length"in t?Wf(t.length):r,n="omission"in t?Po(t.omission):n}e=Zf(e);var s=e.length;if(nn(e)){var a=yn(e);s=a.length}if(r>=s)return e;var u=r-pn(n);if(u<1)return n;var c=a?zo(a,0,u).join(""):e.slice(0,u);if(i===o)return c+n;if(a&&(u+=c.length-u),Nf(i)){if(e.slice(u).search(i)){var f,l=c;for(i.global||(i=rt(i.source,Zf(Ge.exec(i))+"g")),i.lastIndex=0;f=i.exec(l);)var h=f.index;c=c.slice(0,h===o?u:h)}}else if(e.indexOf(Po(i),u)!=u){var d=c.lastIndexOf(i);d>-1&&(c=c.slice(0,d))}return c+n}function mh(e){return e=Zf(e),e&&Ce.test(e)?e.replace(Ae,gn):e}var bh=hs(function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}),vh=ls("toUpperCase");function _h(e,t,r){return e=Zf(e),t=r?o:t,t===o?on(e)?vn(e):Rr(e):e.match(t)||[]}var wh=vo(function(e,t){try{return br(e,o,t)}catch(e){return bf(e)?e:new i(e)}}),Sh=Ls(function(e,t){return _r(t,function(t){t=Ia(t),hi(e,t,Bc(e[t],e))}),e});function Eh(e){var t=null==e?0:e.length,r=qs();return e=t?xr(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=U,n=Kt(e,U);t=qs(t),e-=U;for(var i=Vr(n,t);++r0||t<0)?new An(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==o&&(t=Wf(t),r=t<0?r.dropRight(-t):r.take(t-e)),r)},An.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},An.prototype.toArray=function(){return this.take(U)},Ii(An.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 An,c=a[0],f=u||af(t),l=function(e){var t=i.apply(_n,Cr([e],a));return n&&h?t[0]:t};f&&r&&"function"==typeof c&&1!=c.length&&(u=f=!1);var h=this.__chain__,d=!!this.__actions__.length,p=s&&!h,y=u&&!d;if(!s&&f){t=y?t:new An(this);var g=e.apply(t,a);return g.__actions__.push({func:Vu,args:[l],thisArg:o}),new kn(g,h)}return p&&y?e.apply(this,a):(g=this.thru(l),p?n?g.value()[0]:g.value():g)})}),_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)})}}),Ii(An.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[ms(o,v).name]=[{name:"wrapper",func:o}],An.prototype.clone=xn,An.prototype.reverse=Cn,An.prototype.value=Tn,_n.prototype.at=Gu,_n.prototype.chain=Wu,_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,Ct&&(_n.prototype[Ct]=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(32)(e))},function(e,t,r){"use strict";const n=r(264),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){var n=r(1583);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=[],l=!1,h=!1,d,p;function y(){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&&g()}else u>=c&&h&&(d=null,e(h))}}var g=n(function(){if(l=!0,h)return y();i||t&&a-t>=u||(i=!0,s(o,function(t,n){if(i=!1,t)c=a,h=t,y();else{var o=a++;e(n,function(e,t){r?f[o]=t:f.push(t),e&&(p=e),y()}),h||g()}}))});return function(e,t){e?s(h=o=e,function(e){if(t)return t(e)}):(d=t,l||g(),y())}}}},function(e,t,r){"use strict";const n=r(10),i=r(30),{DAGNode:o,DAGLink:s}=i,a=r(6),u=(e,t,r)=>(t=Object.assign({},{parent:void 0,child:void 0,name:"",flush:!0},t),t.parent?t.child?void a([e=>{if(t.name)return o.rmLink(t.parent,t.name,e);e(null,t.parent)},(e,r)=>{o.addLink(e,new s(t.name,t.child.size,t.child.hash||t.child.multihash),r)},(r,i)=>{if(!t.flush)return i(null,r);e.dag.put(r,{cid:new n(r.hash||r.multihash)},e=>i(e,r))}],r):r(new Error("No child passed to addLink")):r(new Error("No parent passed to addLink")));e.exports=u},function(e,t,r){"use strict";const n=r(194).exporter,i=r(70),o=r(277),s=r(161),a=r(72),u=r(92),c=r(40),{traverseTo:f,createLock:l}=r(55),h=r(4)("ipfs:mfs:read-pull-stream"),d={offset:0,length:void 0};e.exports=(e=>(function t(r,p={}){p=Object.assign({},d,p),h(`Reading ${r}`);const y=a.source();return i(o(r),s((t,r)=>{l().readLock(r=>{f(e,t,{parents:!1},r)})(r)}),s((t,o)=>{const s=t.node,a=c.unmarshal(s.data);if("file"!==a.type)return o(new Error(`${r} was not a file`));h(`Getting ${r} content`),i(n(s.multihash,e.dag,{offset:p.offset,length:p.length}),u((e,t)=>{o(e,e?null:t[0].content)}))}),u((e,t)=>e?y.abort(e):t.length?(h(`Got ${r} content`),void y.resolve(t[0])):y.abort(new Error(`Could not load content stream from ${r}`)))),y}))},function(e,t,r){"use strict";(function(t){const n=r(2),i=r(196),o=r(26),s=r(265),a=r(0).Buffer,u=r(266).isSource,c=r(149),f=r(197);e.exports=(e=>{const r=f(e,"add"),l=n((e,n,f)=>{"function"==typeof n&&(f=n,n=null);const l=o(f);n||(n={}),n.converter=c;const h=t.isBuffer(e)||s.readable(e)||Array.isArray(e)||a.isBuffer(e)||"object"==typeof e||u(e);if(!h)return l(new Error("first arg must be a buffer, readable stream, pull stream, an object or array of objects"));const d=[].concat(e),p=r({qs:n}),y=i(e=>l(null,e));p.once("error",l),p.pipe(y),d.forEach(e=>p.write(e)),p.end()});return function(){const e=Array.from(arguments);return 1===e.length&&u(e[0])&&e.push({}),l.apply(null,e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(54),i=r(1661),o=r(12).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},l=function e(t){for(var r=[{obj:{o:t},prop:"o"}],n=[],i=0;i{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){"use strict";const n=r(12).Transform,i=r(1752);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(63);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.99.4"}},function(e,t,r){"use strict";(function(t,n){var i=r(206);e.exports=E;var o=r(747),s;E.ReadableState=S;var a=r(11).EventEmitter,u=function(e,t){return e.listeners(t).length},c=r(387),f=r(5).Buffer,l=t.Uint8Array||function(){};function h(e){return f.from(e)}function d(e){return f.isBuffer(e)||e instanceof l}var p=r(157);p.inherits=r(1);var y=r(750),g=void 0;g=y&&y.debuglog?y.debuglog("stream"):function(){};var m=r(751),b=r(389),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(104),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 m,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(44).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function E(e){if(s=s||r(104),!(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,O(e,o)):(i||(s=x(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=h(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):A(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?A(e,o,t,!1):N(e,o)):A(e,o,t,!1))):n||(o.reading=!1));return C(o)}function A(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&&P(e)),N(e,t)}function x(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 C(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function B(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=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(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,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(R,e):R(e))}function R(e){g("emit readable"),e.emit("readable"),F(e)}function N(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(j,e,t))}function j(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=q(e,t.buffer,t.decoder),r);var r}function q(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 z(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 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(G,t,e))}function G(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=B(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var n=t.needReadable,i;return g("need readable",n),(0===t.length||t.length-e0?K(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&&V(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,g("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){g("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function f(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",c);var l=L(r);e.on("drain",l);var h=!1;function d(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",l),e.removeListener("error",m),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",y),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||l()}var p=!1;function y(t){g("ondata"),p=!1;var n=e.write(t);!1!==n||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!h&&(g("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function m(t){g("onerror",t),_(),e.removeListener("error",m),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"),r.unpipe(e)}return r.on("data",y),w(e,"error",m),e.once("close",b),e.once("finish",v),e.emit("pipe",r),o.flowing||(g("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(157);c.inherits=r(1);var f={deprecate:r(158)},l=r(387),h=r(5).Buffer,d=n.Uint8Array||function(){};function p(e){return h.from(e)}function y(e){return h.isBuffer(e)||e instanceof d}var g=r(389),m;function b(){}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){T(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),!(m.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)),l.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=h.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=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(3),r(8))},function(e,t,r){"use strict";e.exports=s;var n=r(104),i=r(157);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{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,12,"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={}){let r=new Headers;(t.start||t.end)&&r.append("range",`bytes=${t.start||0}-${t.end<1/0?t.end:""}`);let n={method:"GET",headers:r,mode:"cors",cache:"default",redirect:"follow",keepalive:!0};return httptools.p_httpfetch(e,n,{wantstream:t.wantstream})},httptools.p_POST=function(e,t,r){let n={method:"POST",headers:{},body:r,mode:"cors",cache:"default",redirect:"follow",keepalive:!0};return httptools.p_httpfetch(e,n)},t=e.exports=httptools}).call(this,r(0).Buffer)},function(e,t,r){"use strict";class n{constructor(e){this._repo=e,this._bitswap=null}setExchange(e){this._bitswap=e}unsetExchange(){this._bitswap=null}hasExchange(){return null!=this._bitswap}put(e,t){if(this.hasExchange())return this._bitswap.put(e,t);this._repo.blocks.put(e,t)}putMany(e,t){if(this.hasExchange())return this._bitswap.putMany(e,t);this._repo.blocks.putMany(e,t)}get(e,t){return this.hasExchange()?this._bitswap.get(e,t):this._repo.blocks.get(e,t)}delete(e,t){this._repo.blocks.delete(e,t)}}e.exports=n},function(e,t,r){"use strict";t.names=Object.freeze({id:0,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,"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}),t.codes=Object.freeze({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",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"}),t.defaultLengths=Object.freeze({17:20,18:32,19:64,86:32,23:28,22:32,21:48,20:64,24:32,25:64,26:28,27:32,28:48,29:64,34:32,45569:1,45570:2,45571:3,45572:4,45573:5,45574:6,45575:7,45576:8,45577:9,45578:10,45579:11,45580:12,45581:13,45582:14,45583:15,45584:16,45585:17,45586:18,45587:19,45588:20,45589:21,45590:22,45591:23,45592:24,45593:25,45594:26,45595:27,45596:28,45597:29,45598:30,45599:31,45600:32,45601:33,45602:34,45603:35,45604:36,45605:37,45606:38,45607:39,45608:40,45609:41,45610:42,45611:43,45612:44,45613:45,45614:46,45615:47,45616:48,45617:49,45618:50,45619:51,45620:52,45621:53,45622:54,45623:55,45624:56,45625:57,45626:58,45627:59,45628:60,45629:61,45630:62,45631:63,45632:64,45633:1,45634:2,45635:3,45636:4,45637:5,45638:6,45639:7,45640:8,45641:9,45642:10,45643:11,45644:12,45645:13,45646:14,45647:15,45648:16,45649:17,45650:18,45651:19,45652:20,45653:21,45654:22,45655:23,45656:24,45657:25,45658:26,45659:27,45660:28,45661:29,45662:30,45663:31,45664:32,45825:1,45826:2,45827:3,45828:4,45829:5,45830:6,45831:7,45832:8,45833:9,45834:10,45835:11,45836:12,45837:13,45838:14,45839:15,45840:16,45841:17,45842:18,45843:19,45844:20,45845:21,45846:22,45847:23,45848:24,45849:25,45850:26,45851:27,45852:28,45853:29,45854:30,45855:31,45856:32,45857:1,45858:2,45859:3,45860:4,45861:5,45862:6,45863:7,45864:8,45865:9,45866:10,45867:11,45868:12,45869:13,45870:14,45871:15,45872:16,45873:17,45874:18,45875:19,45876:20,45877:21,45878:22,45879:23,45880:24,45881:25,45882:26,45883:27,45884:28,45885:29,45886:30,45887:31,45888:32,45889:33,45890:34,45891:35,45892:36,45893:37,45894:38,45895:39,45896:40,45897:41,45898:42,45899:43,45900:44,45901:45,45902:46,45903:47,45904:48,45905:49,45906:50,45907:51,45908:52,45909:53,45910:54,45911:55,45912:56,45913:57,45914:58,45915:59,45916:60,45917:61,45918:62,45919:63,45920:64,45921:1,45922:2,45923:3,45924:4,45925:5,45926:6,45927:7,45928:8,45929:9,45930:10,45931:11,45932:12,45933:13,45934:14,45935:15,45936:16,45937:17,45938:18,45939:19,45940:20,45941:21,45942:22,45943:23,45944:24,45945:25,45946:26,45947:27,45948:28,45949:29,45950:30,45951:31,45952:32,45953:33,45954:34,45955:35,45956:36,45957:37,45958:38,45959:39,45960:40,45961:41,45962:42,45963:43,45964:44,45965:45,45966:46,45967:47,45968:48,45969:49,45970:50,45971:51,45972:52,45973:53,45974:54,45975:55,45976:56,45977:57,45978:58,45979:59,45980:60,45981:61,45982:62,45983:63,45984:64,45985:65,45986:66,45987:67,45988:68,45989:69,45990:70,45991:71,45992:72,45993:73,45994:74,45995:75,45996:76,45997:77,45998:78,45999:79,46000:80,46001:81,46002:82,46003:83,46004:84,46005:85,46006:86,46007:87,46008:88,46009:89,46010:90,46011:91,46012:92,46013:93,46014:94,46015:95,46016:96,46017:97,46018:98,46019:99,46020:100,46021:101,46022:102,46023:103,46024:104,46025:105,46026:106,46027:107,46028:108,46029:109,46030:110,46031:111,46032:112,46033:113,46034:114,46035:115,46036:116,46037:117,46038:118,46039:119,46040:120,46041:121,46042:122,46043:123,46044:124,46045:125,46046:126,46047:127,46048:128})},function(e,t,r){"use strict";(function(n){const i=r(761);t=e.exports=s,t.encode=a,t.decode=u,t.isEncoded=c,t.names=Object.freeze(Object.keys(i.names)),t.codes=Object.freeze(Object.keys(i.codes));const o=new Error("Unsupported encoding");function s(e,t){if(!t)throw new Error("requires an encoded buffer");const r=l(e),i=n.from(r.code),o=r.name;return f(o,t),n.concat([i,t])}function a(e,t){const r=l(e),i=r.name;return s(i,n.from(r.encode(t)))}function u(e){n.isBuffer(e)&&(e=e.toString());const t=e.substring(0,1);e=e.substring(1,e.length),"string"==typeof e&&(e=n.from(e));const r=l(t);return n.from(r.decode(e.toString()))}function c(e){if(n.isBuffer(e)&&(e=e.toString()),"[object String]"!==Object.prototype.toString.call(e))return!1;const t=e.substring(0,1);try{const e=l(t);return e.name}catch(e){return!1}}function f(e,t){const r=l(e);r.decode(t.toString())}function l(e){let t;if(i.names[e])t=i.names[e];else{if(!i.codes[e])throw o;t=i.codes[e]}if(!t.isImplemented())throw new Error("Base "+e+" is not implemented yet");return t}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(22);function i(e){return parseInt(e.toString("hex"),16)}function o(e){let r=e.toString(16);return r.length%2==1&&(r="0"+r),t.from(r,"hex")}function s(e){return t.from(n.encode(i(e)))}function a(e){return o(n.decode(e))}e.exports={numberToBuffer:o,bufferToNumber:i,varintBufferEncode:s,varintBufferDecode:a}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(209),i={};e.exports=i;for(let e in n){let t=n[e];i[t.toString("hex")]=e}},function(e,t){e.exports=function e(t,r,n){t(r),n&&n(!0===r?null:r)}},function(e,t,r){"use strict";e.exports=function e(t){return function(e,r){r(t)}}},function(e,t,r){"use strict";function n(e){return e}var i=r(160);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){var n=r(160);function i(e){return e}e.exports=function e(t){return"object"==typeof t&&"function"==typeof t.test?function(e){return t.test(e)}:n(t)||i}},function(e,t,r){"use strict";e.exports=function e(t,r){var n=!1;function i(e){!n&&r&&(n=!0,r(!0===e?null:e))}return function(e){return function(r,n){return r&&i(r),e(r,function(e,r){e?i(e):t&&t(r),n(e,r)})}}}},function(e,t,r){"use strict";function n(e){return e}var i=r(160),o=r(162);e.exports=function e(t,r){t=i(t)||n;var s={};return o(function(e){var n=t(e);return s[n]?!!r:(s[n]=!0,!r)})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var n=r(59),i=l(n),o=r(127),s=l(o),a=r(128),u=l(a),c=r(37),f=l(c);function l(e){return e&&e.__esModule?e:{default:e}}function h(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,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(){var t=(0,i.default)(arguments),r=t.pop();e.call(this,t,r)}};var n=r(127),i=o(n);function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var n=r(59),i=l(n),o=r(93),s=l(o),a=r(127),u=l(a),c=r(37),f=l(c);function l(e){return e&&e.__esModule?e:{default:e}}function h(e,t,r){r=r||i.default;var n=(0,s.default)(t)?[]:{};e(t,function(e,t,r){(0,f.default)(e)(function(e,i){arguments.length>2&&(i=(0,u.default)(arguments,1)),n[t]=i,r(e)})},function(e){r(e,n)})}e.exports=t.default},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){var r=9007199254740991;function n(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}e.exports=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(281),i=a(n),o=r(37),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){var n=r(411),i=r(796),o=r(93);function s(e){return o(e)?n(e):i(e)}e.exports=s},function(e,t,r){var n=r(790),i=r(282),o=r(81),s=r(412),a=r(413),u=r(414),c=Object.prototype,f=c.hasOwnProperty;function l(e,t){var r=o(e),c=!r&&i(e),l=!r&&!c&&s(e),h=!r&&!c&&!l&&u(e),d=r||c||l||h,p=d?n(e.length,String):[],y=p.length;for(var g in e)!t&&!f.call(e,g)||d&&("length"==g||l&&("offset"==g||"parent"==g)||h&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||a(g,y))||p.push(g);return p}e.exports=l},function(e,t,r){(function(e){var n=r(130),i=r(792),o="object"==typeof t&&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(32)(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&&e1&&this._buf[this._buf.length-1]===s;)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(71);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){(function(t){var r="Expected a function",n="__lodash_hash_undefined__",i=1/0,o=9007199254740991,s="[object Function]",a="[object GeneratorFunction]",u="[object Symbol]",c=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,f=/^\w*$/,l=/^\./,h=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,d=/[\\^$.*+?()[\]{}|]/g,p=/\\(\\)?/g,y=/^\[object .+?Constructor\]$/,g=/^(?:0|[1-9]\d*)$/,m="object"==typeof t&&t&&t.Object===Object&&t,b="object"==typeof self&&self&&self.Object===Object&&self,v=m||b||Function("return this")();function _(e,t){return null==e?void 0:e[t]}function w(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}var S=Array.prototype,E=Function.prototype,k=Object.prototype,A=v["__core-js_shared__"],x=(C=/[^.]+$/.exec(A&&A.keys&&A.keys.IE_PROTO||""),C?"Symbol(src)_1."+C:""),C,T=E.toString,I=k.hasOwnProperty,B=k.toString,O=RegExp("^"+T.call(I).replace(d,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),P=v.Symbol,R=S.splice,N=ce(v,"Map"),j=ce(Object,"create"),L=P?P.prototype:void 0,M=L?L.toString:void 0;function D(e){var t=-1,r=e?e.length:0;for(this.clear();++t-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 Ce(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Te(e){return!!e&&"object"==typeof e}function Ie(e){return"symbol"==typeof e||Te(e)&&O.call(e)==c}function Be(e){return null==e?"":ae(e)}function Oe(e,t){return null!=e&&le(e,t,oe)}e.exports=Oe}).call(this,r(8))},function(e,t,r){"use strict";const n=r(810);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{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=h((t||"").toString().trim())}catch(e){return r(e)}r(null,n)})}),t.readme=o,t.parseShardFun=h,t.Prefix=c,t.Suffix=f,t.NextToLast=l},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";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?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=h(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):A(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?A(e,o,t,!1):N(e,o)):A(e,o,t,!1))):n||(o.reading=!1));return C(o)}function A(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&&P(e)),N(e,t)}function x(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 C(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function B(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=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(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,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(R,e):R(e))}function R(e){g("emit readable"),e.emit("readable"),F(e)}function N(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(j,e,t))}function j(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=q(e,t.buffer,t.decoder),r);var r}function q(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 z(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 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(G,t,e))}function G(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=B(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var n=t.needReadable,i;return g("need readable",n),(0===t.length||t.length-e0?K(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&&V(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,g("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){g("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function f(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",c);var l=L(r);e.on("drain",l);var h=!1;function d(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",l),e.removeListener("error",m),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",y),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||l()}var p=!1;function y(t){g("ondata"),p=!1;var n=e.write(t);!1!==n||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!h&&(g("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function m(t){g("onerror",t),_(),e.removeListener("error",m),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"),r.unpipe(e)}return r.on("data",y),w(e,"error",m),e.once("close",b),e.once("finish",v),e.emit("pipe",r),o.flowing||(g("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(131),i=r(447);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,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(59),i=a(n),o=r(37),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t,r,n){n=n||i.default,t=t||[];var o=[],a=0,u=(0,s.default)(r);e(t,function(e,t,r){var n=a++;u(e,function(e,t){o[n]=t,r(e)})},function(e){n(e,o)})}e.exports=t.default},function(e,t,r){"use strict";(function(e){const n=r(7);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){function r(e){return e&&"function"==typeof e.then}e.exports=r},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{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]={hash:n.multihash,name:n.name,size:n.size}});let o=r[i[1]];"Hash"===i[2]?o={"/":o.hash}:"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]={hash:n.multihash,name:n.name,size:n.size}});const r=t[i[0]];if(r)return n(null,{value:{"/":r.hash},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(876),o=r(33),s=r(10),a=r(6),u=r(7),c=r(881),f=r(458),l=42;function h(e){return"string"==typeof e&&(e=new s(e).buffer),new i.Tagged(l,n.concat([n.from("00","hex"),e]))}const d=new i.Decoder({tags:{[l]:e=>(e=e.slice(1),{"/":e})}});function p(e){let t;try{t=c(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);const t=Object.keys(e);if(1===t.length&&"/"===t[0])return h(e["/"]);if(t.length>0){let 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=p(e);r=i.encode(n)}catch(e){return u(()=>t(e))}u(()=>t(null,r))}),t.deserialize=((e,t)=>{let r;try{r=d.decodeFirst(e)}catch(e){return u(()=>t(e))}u(()=>t(null,r))}),t.cid=((e,r,n)=>{"function"==typeof r&&(n=r,r={}),r=r||{};const i=r.hashAlg||f.defaultHashAlg,u=void 0===r.version?1:r.version;a([r=>t.serialize(e,r),(e,t)=>o(e,i,t),(e,t)=>t(null,new s(u,f.multicodec,e))],n)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t,n){const i=r(878),o=r(224),s=r(879),a=r(294),u=r(225),c=r(456),f=r(457),l=r(35);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=>l.parse(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 h({size:e.length});return n.decodeFirst(e)}static decodeAll(e,r){"string"==typeof e&&(e=t.from(e,r||"hex"));const n=new h({size:e.length});return n.decodeAll(e)}}h.decodeFirst=h.decode,e.exports=h}).call(this,r(0).Buffer,r(8))},function(e,t,r){"use strict";const n=r(225),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";(function(n){const i=r(454),o=r(459);function s(e,t){return t=t||"/",0===Object.keys(e).length?[]:o(e).reduce(function(e,r){"object"==typeof r&&r["/"]&&this.update(void 0);const n=this.path.join(t);return""!==n&&e.push({path:n,value:r}),e},[])}t=e.exports,t.multicodec="dag-cbor",t.defaultHashAlg="sha2-256",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:""});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);const n=s(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("object"==typeof t.value&&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={},l=!0,h={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){h.isRoot||(h.parent.node[h.key]=e),h.node=e,t&&(l=!1)},delete:function(e){delete h.parent.node[h.key],e&&(l=!1)},remove:function(e){p(h.parent.node)?h.parent.node.splice(h.key,1):delete h.parent.node[h.key],e&&(l=!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(){l=!1}};if(!a)return h;function d(){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{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":l.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 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":l.deserialize(e.slice(r+1),t);break;case"tree":h.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(460),o=r(459);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(889).Block,i=r(10),o=r(18),s=r(33),a=r(6),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)},l=(e,t,n)=>{"function"==typeof t&&(n=t,t={}),t=t||{};const o=t.hashAlg||r(295).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)},h=e=>{const t=r(295).defaultHashAlg,n=o.encode(e,t),s=1,a=new i(1,"bitcoin-block",n);return a};e.exports={hashToCid:h,BITCOIN_BLOCK_HEADER_SIZE:80,cid:l,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 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=c,t.s1_256=f,t.g0_256=l,t.g1_256=h},function(e,t,r){"use strict";var n=r(73),i=r(168),o=r(464),s=r(50),a=n.sum32,u=n.sum32_4,c=n.sum32_5,f=o.ch32,l=o.maj32,h=o.s0_256,d=o.s1_256,p=o.g0_256,y=o.g1_256,g=i.BlockHash,m=[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=m,this.W=new Array(64)}n.inherits(b,g),e.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=function e(t,r){for(var n=this.W,i=0;i<16;i++)n[i]=t[r+i];for(;i=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(467),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],l=[0,1518500249,1859775393,2400959708,2840853838],h=[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 y(e,t,r,n,i,o,s,a){return p(e+(t^r^n)+o+s|0,a)+i|0}function g(e,t,r,n,i,o,s,a){return p(e+(t&r|~t&n)+o+s|0,a)+i|0}function m(e,t,r,n,i,o,s,a){return p(e+((t|~r)^n)+o+s|0,a)+i|0}function b(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,A=0;A<80;A+=1){var x,C;A<16?(x=y(r,n,i,o,d,e[a[A]],l[0],c[A]),C=v(_,w,S,E,k,e[u[A]],h[0],f[A])):A<32?(x=g(r,n,i,o,d,e[a[A]],l[1],c[A]),C=b(_,w,S,E,k,e[u[A]],h[1],f[A])):A<48?(x=m(r,n,i,o,d,e[a[A]],l[2],c[A]),C=m(_,w,S,E,k,e[u[A]],h[2],f[A])):A<64?(x=b(r,n,i,o,d,e[a[A]],l[3],c[A]),C=g(_,w,S,E,k,e[u[A]],h[3],f[A])):(x=v(r,n,i,o,d,e[a[A]],l[4],c[A]),C=y(_,w,S,E,k,e[u[A]],h[4],f[A])),r=d,d=o,o=p(i,10),i=n,n=x,_=k,k=E,E=p(S,10),S=w,w=C}var T=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=T},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(917),t.sha1=r(918),t.sha224=r(919),t.sha256=r(470),t.sha384=r(920),t.sha512=r(471)},function(e,t,r){var n=r(1),i=r(132),o=r(5).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 l(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 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,y=0|this._g,g=0|this._h,m=0;m<16;++m)t[m]=e.readInt32BE(4*m);for(;m<64;++m)t[m]=p(t[m-2])+t[m-7]+d(t[m-15])+t[m-16]|0;for(var b=0;b<64;++b){var v=g+h(a)+c(a,u,y)+s[b]+t[b]|0,_=l(r)+f(r,n,i)|0;g=y,y=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=y+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,r){var n=r(1),i=r(132),o=r(5).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 l(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 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 y(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 m(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,b=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,A=0|this._fl,x=0|this._gl,C=0|this._hl,T=0;T<32;T+=2)t[T]=e.readInt32BE(4*T),t[T+1]=e.readInt32BE(4*T+4);for(;T<160;T+=2){var I=t[T-30],B=t[T-30+1],O=d(I,B),P=p(B,I);I=t[T-4],B=t[T-4+1];var R=y(I,B),N=g(B,I),j=t[T-14],L=t[T-14+1],M=t[T-32],D=t[T-32+1],U=P+L|0,F=O+j+m(U,P)|0;U=U+N|0,F=F+R+m(U,N)|0,U=U+D|0,F=F+M+m(U,D)|0,t[T]=F,t[T+1]=U}for(var K=0;K<160;K+=2){F=t[K],U=t[K+1];var q=f(r,n,i),H=f(_,w,S),z=l(r,_),V=l(_,r),G=h(a,k),W=h(k,a),$=s[K],Y=s[K+1],J=c(a,u,b),X=c(k,A,x),Z=C+W|0,Q=v+G+m(Z,C)|0;Z=Z+X|0,Q=Q+J+m(Z,X)|0,Z=Z+Y|0,Q=Q+$+m(Z,Y)|0,Z=Z+U|0,Q=Q+F+m(Z,U)|0;var ee=V+H|0,te=z+q+m(ee,V)|0;v=b,C=x,b=u,x=A,u=a,A=k,k=E+Z|0,a=o+Q+m(k,E)|0,o=i,E=S,i=n,S=w,n=r,w=_,_=Z+ee|0,r=Q+te+m(_,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+A|0,this._gl=this._gl+x|0,this._hl=this._hl+C|0,this._ah=this._ah+r+m(this._al,_)|0,this._bh=this._bh+n+m(this._bl,w)|0,this._ch=this._ch+i+m(this._cl,S)|0,this._dh=this._dh+o+m(this._dl,E)|0,this._eh=this._eh+a+m(this._el,k)|0,this._fh=this._fh+u+m(this._fl,A)|0,this._gh=this._gh+b+m(this._gl,x)|0,this._hh=this._hh+v+m(this._hl,C)|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){var n=r(300);function i(e){return e.name||e.toString().match(/function (.*?)\s*\(/)[1]}function o(e){return n.Nil(e)?"":i(e.constructor)}function s(e){return n.Function(e)?"":n.String(e)?JSON.stringify(e):e&&n.Object(e)?"":e}function a(e,t){Error.captureStackTrace&&Error.captureStackTrace(e,t)}function u(e){return n.Function(e)?e.toJSON?e.toJSON():i(e):n.Array(e)?"Array":e&&n.Object(e)?"Object":void 0!==e?e:""}function c(e,t,r){var n=s(t);return"Expected "+u(e)+", got"+(""!==r?" "+r:"")+(""!==n?" "+n:"")}function f(e,t,r){r=r||o(t),this.message=c(e,t,r),a(this,f),this.__type=e,this.__value=t,this.__valueTypeName=r}function l(e,t,r,n,i){var o='" of type ';return"key"===t&&(o='" with key type '),c('property "'+u(r)+o+u(e),n,i)}function h(e,t,r,n,i){e?(i=i||o(n),this.message=l(e,r,t,n,i)):this.message='Unexpected property "'+t+'"',a(this,f),this.__label=r,this.__property=t,this.__type=e,this.__value=n,this.__valueTypeName=i}function d(e,t){return new f(e,{},t)}function p(e,t,r){return e instanceof h?(t=t+"."+e.__property,e=new h(e.__type,t,e.__label,e.__value,e.__valueTypeName)):e instanceof f&&(e=new h(e.__type,t,r,e.__value,e.__valueTypeName)),a(e),e}f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,h.prototype=Object.create(Error.prototype),h.prototype.constructor=f,e.exports={TfTypeError:f,TfPropertyTypeError:h,tfCustomError:d,tfSubError:p,tfJSON:u,getValueTypeName:o}},function(e,t,r){const n=r(5).Buffer;function i(e,t,r){t=t||4,r=void 0===r||r;const n=e.length;if(0===n)return 0;if(n>t)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(5).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(114),i=r(134),o=r(36),s=r(74),a=r(476),u=r(64),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 l(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 h(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 l(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 l(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:l,fromPublicKey:h,fromWIF:d}},function(e,t,r){(function(t){var n=r(169);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(5).Buffer,i=r(302),o=r(169),s=r(23),a=r(64),u=r(36),c=r(74),f=r(303);function l(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 h(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 y(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 g(e,t){let r;t=t||a.bitcoin;try{r=l(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=h(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:l,fromBech32:h,fromOutputScript:y,toBase58Check:d,toBech32:p,toOutputScript:g}},function(e,t,r){const n=r(23),i=r(29);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(23),i=r(29);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(956),i=r(171),o=r(172),s=r(969);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,r){"use strict";var n=r(964),i=r(965),o=r(307);function s(e,t){return void 0===e?t:(n.isBoolean(e,o.COMPRESSED_TYPE_INVALID),e)}e.exports=function(e){return{privateKeyVerify:function(t){return n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),32===t.length&&e.privateKeyVerify(t)},privateKeyExport:function(t,r){n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),r=s(r,!0);var a=e.privateKeyExport(t,r);return i.privateKeyExport(t,a,r)},privateKeyImport:function(t){if(n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),t=i.privateKeyImport(t),t&&32===t.length&&e.privateKeyVerify(t))return t;throw new Error(o.EC_PRIVATE_KEY_IMPORT_DER_FAIL)},privateKeyNegate:function(t){return n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),e.privateKeyNegate(t)},privateKeyModInverse:function(t){return n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),e.privateKeyModInverse(t)},privateKeyTweakAdd:function(t,r){return n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),n.isBuffer(r,o.TWEAK_TYPE_INVALID),n.isBufferLength(r,32,o.TWEAK_LENGTH_INVALID),e.privateKeyTweakAdd(t,r)},privateKeyTweakMul:function(t,r){return n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),n.isBuffer(r,o.TWEAK_TYPE_INVALID),n.isBufferLength(r,32,o.TWEAK_LENGTH_INVALID),e.privateKeyTweakMul(t,r)},publicKeyCreate:function(t,r){return n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),r=s(r,!0),e.publicKeyCreate(t,r)},publicKeyConvert:function(t,r){return n.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),n.isBufferLength2(t,33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID),r=s(r,!0),e.publicKeyConvert(t,r)},publicKeyVerify:function(t){return n.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),e.publicKeyVerify(t)},publicKeyTweakAdd:function(t,r,i){return n.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),n.isBufferLength2(t,33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID),n.isBuffer(r,o.TWEAK_TYPE_INVALID),n.isBufferLength(r,32,o.TWEAK_LENGTH_INVALID),i=s(i,!0),e.publicKeyTweakAdd(t,r,i)},publicKeyTweakMul:function(t,r,i){return n.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),n.isBufferLength2(t,33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID),n.isBuffer(r,o.TWEAK_TYPE_INVALID),n.isBufferLength(r,32,o.TWEAK_LENGTH_INVALID),i=s(i,!0),e.publicKeyTweakMul(t,r,i)},publicKeyCombine:function(t,r){n.isArray(t,o.EC_PUBLIC_KEYS_TYPE_INVALID),n.isLengthGTZero(t,o.EC_PUBLIC_KEYS_LENGTH_INVALID);for(var i=0;ie?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(485),i=r(210);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(171);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(487),i=r(171),o=r(172);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(970),i=r(229),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:new t([])},{name:"number",default:i.intToBuffer(115e4)},{name:"gasLimit",default:new t("ffffffffffffff","hex")},{name:"gasUsed",empty:!0,default:new t([])},{name:"timestamp",default:new t([])},{name:"extraData",allowZero:!0,empty:!0,default:new t([])},{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,l,h;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),l=new o(-99),1===l.cmp(f)&&(f=l),h=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),l=new o(-99),1===l.cmp(f)&&(f=l),h=s.add(u.mul(f))):h=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()||h.iadd(new o(2).pow(p)),-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),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=new t([])}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(991),i=r(172);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";const n=r(996).BlockHeader,i=r(10),o=r(18),s=r(33),a=r(6),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)},l=(e,t,n)=>{"function"==typeof t&&(n=t,t={}),t=t||{};const o=t.hashAlg||r(309).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)},h=e=>{const t=r(309).defaultHashAlg,n=o.encode(e,t),s=1,a=new i(1,"zcash-block",n);return a};e.exports={hashToCid:h,ZCASH_BLOCK_HEADER_SIZE:1487,cid:l,deserialize:f,serialize:c}},function(e,t,r){"use strict";(function(t){var n=r(39),i=r(135),o=r(66),s=r(76),a=r(234),u=r(46),c=r(25),f=r(15),l=r(21),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=n.fromBuffer(a.getRandomBuffer(32))}while(!t.lt(e)||!t.gt(n.Zero));return this.k=t,this},h.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 l=n.fromBuffer(r),h=i.getN(),d=0;d>1,c=i.getN(),f=i.getG(),h=u?r.add(c):r,d=i.fromX(a,h),p=d.mul(c);if(!p.isInfinity())throw new Error("nR is not a valid curve point");var y=t.neg().mod(c),g=r.invm(c),m=d.mul(o).add(f.mul(y)).mul(g),b=s.fromPoint(m,this.sig.compressed);return b},h.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"},h.toLowS=function(e){return e.gt(n.fromBuffer(new t("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(e=i.getN().sub(e)),e},h.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=h.toLowS(f),{s:f,r:c}},h.prototype.sign=function(){var e=this.hashbuf,t=this.privkey,r=t.bn;l.checkState(e&&t&&r,new Error("invalid parameters")),l.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},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,r){return h().set({hashbuf:e,endian:r,privkey:t}).sign().sig},h.verify=function(e,t,r,n){return h().set({hashbuf:e,endian:n,sig:t,pubkey:r}).verify().verified},e.exports=h}).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},m.prototype.toASM=function(){for(var e="",t=0;t"},m.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)},m.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},m.prototype.getPublicKey=function(){return l.checkState(this.isPublicKeyOut(),"Can't retreive PublicKey from a non-PK output"),this.chunks[0].buf},m.prototype.getPublicKeyHash=function(){return l.checkState(this.isPublicKeyHashOut(),"Can't retrieve PublicKeyHash from a non-PKH output"),this.chunks[2].buf},m.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},m.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},m.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},m.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=m.fromBuffer(t)}catch(e){if(e instanceof d.Script.InvalidBuffer)return!1;throw e}var n=r.classify();return n!==m.types.UNKNOWN},m.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&&y.isBuffer(e.buf)})&&a.isSmallIntOp(this.chunks[this.chunks.length-2].opcodenum)&&this.chunks[this.chunks.length-1].opcodenum===a.OP_CHECKMULTISIG},m.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&&y.isBuffer(e.buf)&&c.isTxDER(e.buf)})},m.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<=m.OP_RETURN_STANDARD_SIZE&&this.chunks[1].length===this.chunks.len)},m.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")},m.prototype.isPushOnly=function(){return h.every(this.chunks,function(e){return e.opcodenum<=a.OP_16})},m.types={},m.types.UNKNOWN="Unknown",m.types.PUBKEY_OUT="Pay to public key",m.types.PUBKEY_IN="Spend from public key",m.types.PUBKEYHASH_OUT="Pay to public key hash",m.types.PUBKEYHASH_IN="Spend from public key hash",m.types.SCRIPTHASH_OUT="Pay to script hash",m.types.SCRIPTHASH_IN="Spend from script hash",m.types.MULTISIG_OUT="Pay to multisig",m.types.MULTISIG_IN="Spend from multisig",m.types.DATA_OUT="Data push",m.OP_RETURN_STANDARD_SIZE=80,m.prototype.classify=function(){if(this._isInput)return this.classifyInput();if(this._isOutput)return this.classifyOutput();var e=this.classifyOutput();return e!=m.types.UNKNOWN?e:this.classifyInput()},m.outputIdentifiers={},m.outputIdentifiers.PUBKEY_OUT=m.prototype.isPublicKeyOut,m.outputIdentifiers.PUBKEYHASH_OUT=m.prototype.isPublicKeyHashOut,m.outputIdentifiers.MULTISIG_OUT=m.prototype.isMultisigOut,m.outputIdentifiers.SCRIPTHASH_OUT=m.prototype.isScriptHashOut,m.outputIdentifiers.DATA_OUT=m.prototype.isDataOut,m.prototype.classifyOutput=function(){for(var e in m.outputIdentifiers)if(m.outputIdentifiers[e].bind(this)())return m.types[e];return m.types.UNKNOWN},m.inputIdentifiers={},m.inputIdentifiers.PUBKEY_IN=m.prototype.isPublicKeyIn,m.inputIdentifiers.PUBKEYHASH_IN=m.prototype.isPublicKeyHashIn,m.inputIdentifiers.MULTISIG_IN=m.prototype.isMultisigIn,m.inputIdentifiers.SCRIPTHASH_IN=m.prototype.isScriptHashIn,m.prototype.classifyInput=function(){for(var e in m.inputIdentifiers)if(m.inputIdentifiers[e].bind(this)())return m.types[e];return m.types.UNKNOWN},m.prototype.isStandard=function(){return this.classify()!==m.types.UNKNOWN},m.prototype.prepend=function(e){return this._addByType(e,!0),this},m.prototype.equals=function(e){if(l.checkState(e instanceof m,"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)},m.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))},m.prototype.getSignatureOperationsCount=function(e){e=!!h.isUndefined(e)||e;var t=this,r=0,n=a.OP_INVALIDOPCODE;return h.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=m}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(15),i=r(21),o=r(34),s=r(67),a=r(120),u=r(313);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 l=new s(e.scriptPubKey||e.script);i.checkArgument(!n.isUndefined(e.amount)||!n.isUndefined(e.satoshis),"Must provide an amount for the output");var h=n.isUndefined(e.amount)?e.satoshis:new u.fromBTC(e.amount).toSatoshis();i.checkArgument(n.isNumber(h),"Amount must be a number"),o.defineImmutable(this,{address:t,txId:r,outputIndex:f,script:l,satoshis:h})}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(235),o=r(25),s=r(96),a=r(61),u=r(46),c=r(34),f=r(233),l=r(21);function h(e){if(!(this instanceof h))return new h(e);var t={};if(o.isBuffer(e))t=h._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}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(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")},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(r){l.checkArgument(!n.isUndefined(r),"tx cannot be undefined"),l.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)},h._fromBufferReader=function e(t){l.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 m.InvalidEntropyArgument.TooMuchEntropy(e);var n=f.sha512hmac(e,new i.Buffer("Bitcoin seed"));return new E({network:l.get(r)||l.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(496);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,b.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 g.InvalidB58Checksum(n)}else e.checksum=c.checksum(n);var o=l.get(b.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),h=u.toPublicKey(),d=E.ParentFingerPrintSize,y=f.sha256ripemd160(h.toBuffer()).slice(0,d);return v.defineImmutable(this,{xprivkey:s,network:o,depth:b.integerFromSingleByteBuffer(e.depth),privateKey:u,publicKey:h,fingerPrint:y}),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(b.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:l.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}},E.fromBuffer=function(e){return new E(e.toString())},E.prototype.toBuffer=function(){return b.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(21),o=r(39),s=r(232),a=r(173),u=r(46),c=r(495),f=r(314),l=r(119),h=r(135),d=r(76),p=r(65),y=p,g=p.HDPublicKey,m=r(20),b=r(34),v=r(25);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 g.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 g.UnrecognizedArgument(e)}throw new g.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 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 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),l=d.fromPoint(h.getG().mul(a).add(this.publicKey.point)),p=new _({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:e,chainCode:c,publicKey:l});return f.set(this.xpubkey,e,!1,p),p},_.prototype._deriveFromString=function(e){if(n.contains(e,"'"))throw new g.InvalidIndexCantDeriveHardened;if(!_.isValidPath(e))throw new g.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 g.UnrecognizedArgument("expected buffer or string");if(!s.validCharacters(e))return new y.InvalidB58Char("(unknown)",e);try{e=a.decode(e)}catch(t){return new y.InvalidB58Checksum(e)}if(e.length!==_.DataSize)return new g.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===l.livenet.xprivkey||i===l.testnet.xprivkey?new g.ArgumentIsPrivateExtended:null},_._validateNetwork=function(e,t){var r=l.get(t);if(!r)return new y.InvalidNetworkArgument(t);var n=e.slice(_.VersionStart,_.VersionEnd);return v.integerFromBuffer(n)!==r.xpubkey?new y.InvalidNetwork(n):null},_.prototype._buildFromPrivate=function(e){var t=n.clone(e._buffers),r=h.getG().mul(o.fromBuffer(t.privateKey));return t.publicKey=h.pointToCompressed(r),t.version=v.integerAsBuffer(l.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(l.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),b.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 y.InvalidB58Checksum(n,i)}else e.checksum=i;var o=l.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,h=u.sha256ripemd160(c.toBuffer()).slice(0,f);return b.defineImmutable(this,{xpubkey:s,network:o,depth:v.integerFromSingleByteBuffer(e.depth),publicKey:c,fingerPrint:h}),this},_._validateBufferArguments=function(e){var t=function(t,r){var n=e[t];m(v.isBuffer(n),t+" argument is not a buffer, it's "+typeof n),m(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:l.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,m(_.PublicKeyEnd===_.DataSize),m(_.ChecksumEnd===_.SerializedByteSize),e.exports=_}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(315),i=r(316)(),o=r(1029),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=(t,r,o)=>{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){var n={ECB:r(1033),CBC:r(1034),CFB:r(1035),CFB8:r(1036),CFB1:r(1037),OFB:r(1038),CTR:r(499),GCM:r(499)},i=r(501);for(var o in i)i[o].module=n[i[o].mode];e.exports=i},function(e,t,r){var n=r(176),i=r(5).Buffer,o=r(500);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 l=0;if(s>0){var h=a.length-s;l=Math.min(s,c.length),c.copy(a,h,0,l),s-=l}if(l0){var d=u.length-o,p=Math.min(o,c.length-l);c.copy(u,d,l,l+p),o-=p}}return c.fill(0),{key:a,iv:u}}e.exports=o},function(e,t,r){var n=r(13);r(16),n.cipher=n.cipher||{};var i=e.exports=n.cipher.modes=n.cipher.modes||{};function o(e){if("string"==typeof e&&(e=n.util.createBuffer(e)),n.util.isArray(e)&&e.length>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;o>1,a=s+(1&e.length),u=e.substr(0,a),c=e.substr(s,a),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var h=Math.ceil(i/16),d=Math.ceil(i/20);l.start("MD5",u);var p=n.util.createBuffer();f.putBytes(r);for(var y=0;y0&&(l.queue(e,l.createAlert(e,{level:l.Alert.Level.warning,description:l.Alert.Description.no_renegotiation})),l.flush(e)),e.process()},l.parseHelloMessage=function(e,t,r){var i=null,o=e.entity===l.ConnectionEnd.client;if(r<38)e.error(e,{message:o?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});else{var s=t.fragment,a=s.length();if(i={version:{major:s.getByte(),minor:s.getByte()},random:n.util.createBuffer(s.getBytes(32)),session_id:c(s,1),extensions:[]},o?(i.cipher_suite=s.getBytes(2),i.compression_method=s.getByte()):(i.cipher_suites=c(s,2),i.compression_methods=c(s,1)),a=r-(a-s.length()),a>0){for(var u=c(s,2);u.length()>0;)i.extensions.push({type:[u.getByte(),u.getByte()],data:c(u,2)});if(!o)for(var f=0;f0;){var p=d.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(c(d,2).getBytes())}}}if(e.session.version&&(i.version.major!==e.session.version.major||i.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.protocol_version}});if(o)e.session.cipherSuite=l.getCipherSuite(i.cipher_suite);else for(var y=n.util.createBuffer(i.cipher_suites.bytes());y.length()>0&&(e.session.cipherSuite=l.getCipherSuite(y.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(i.cipher_suite)});e.session.compressionMethod=o?i.compression_method:l.CompressionMethod.none}return i},l.createSecurityParameters=function(e,t){var r=e.entity===l.ConnectionEnd.client,n=t.random.bytes(),i=r?e.session.sp.client_random:n,o=r?n:l.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:l.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:i,server_random:o}},l.handleServerHello=function(e,t,r){var n=l.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var i=n.session_id.bytes();i.length>0&&i===e.session.id?(e.expect=m,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=d,e.session.resuming=!1,l.createSecurityParameters(e,n)),e.session.id=i,e.process()}},l.handleClientHello=function(e,t,r){var i=l.parseHelloMessage(e,t,r);if(!e.fail){var o=i.session_id.bytes(),s=null;if(e.sessionCache&&(s=e.sessionCache.getSession(o),null===s?o="":(s.version.major!==i.version.major||s.version.minor>i.version.minor)&&(s=null,o="")),0===o.length&&(o=n.random.getBytes(32)),e.session.id=o,e.session.clientHelloVersion=i.version,e.session.sp={},s)e.version=e.session.version=s.version,e.session.sp=s.sp;else{for(var a,u=1;u0;)s=c(o.certificate_list,3),a=n.asn1.fromDer(s),s=n.pki.certificateFromAsn1(a,!0),u.push(s)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.bad_certificate}})}var f=e.entity===l.ConnectionEnd.client;!f&&!0!==e.verifyClient||0!==u.length?0===u.length?e.expect=f?p:E:(f?e.session.serverCertificate=u[0]:e.session.clientCertificate=u[0],l.verifyCertificateChain(e,u)&&(e.expect=f?p:E)):e.error(e,{message:f?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}}),e.process()},l.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.unsupported_certificate}});e.expect=y,e.process()},l.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.unsupported_certificate}});var i=t.fragment,o={enc_pre_master_secret:c(i,2).getBytes()},s=null;if(e.getPrivateKey)try{s=e.getPrivateKey(e,e.session.serverCertificate),s=n.pki.privateKeyFromPem(s)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}})}if(null===s)return e.error(e,{message:"No private key set.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}});try{var a=e.session.sp;a.pre_master_secret=s.decrypt(o.enc_pre_master_secret);var u=e.session.clientHelloVersion;if(u.major!==a.pre_master_secret.charCodeAt(0)||u.minor!==a.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){a.pre_master_secret=n.random.getBytes(48)}e.expect=A,null!==e.session.clientCertificate&&(e.expect=k),e.process()},l.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});var n=t.fragment,i={certificate_types:c(n,1),certificate_authorities:c(n,2)};e.session.certificateRequest=i,e.expect=g,e.process()},l.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var s={signature:c(i,2).getBytes()},a=n.util.createBuffer();a.putBuffer(e.session.md5.digest()),a.putBuffer(e.session.sha1.digest()),a=a.getBytes();try{var u=e.session.clientCertificate;if(!u.publicKey.verify(a,s.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(o),e.session.sha1.update(o)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.handshake_failure}})}e.expect=A,e.process()},l.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.record_overflow}});if(null===e.serverCertificate){var i={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.insufficient_security}},o=0,s=e.verify(e,i.alert.description,0,[]);if(!0!==s)return(s||0===s)&&("object"!=typeof s||n.util.isArray(s)?"number"==typeof s&&(i.alert.description=s):(s.message&&(i.message=s.message),s.alert&&(i.alert.description=s.alert))),e.error(e,i)}null!==e.session.certificateRequest&&(t=l.createRecord(e,{type:l.ContentType.handshake,data:l.createCertificate(e)}),l.queue(e,t)),t=l.createRecord(e,{type:l.ContentType.handshake,data:l.createClientKeyExchange(e)}),l.queue(e,t),e.expect=_;var a=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createCertificateVerify(e,t)})),l.queue(e,l.createRecord(e,{type:l.ContentType.change_cipher_spec,data:l.createChangeCipherSpec()})),e.state.pending=l.createConnectionState(e),e.state.current.write=e.state.pending.write,l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createFinished(e)})),e.expect=m,l.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return a(e,null);l.getClientSignature(e,a)},l.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});var r=e.entity===l.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=l.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?b:x,e.process()},l.handleFinished=function(e,t,r){var o=t.fragment;o.read-=4;var s=o.bytes();o.read+=4;var a=t.fragment.getBytes();o=n.util.createBuffer(),o.putBuffer(e.session.md5.digest()),o.putBuffer(e.session.sha1.digest());var u=e.entity===l.ConnectionEnd.client,c=u?"server finished":"client finished",f=e.session.sp,h=12,d=i;if(o=d(f.master_secret,c,o.getBytes(),12),o.getBytes()!==a)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.decrypt_error}});e.session.md5.update(s),e.session.sha1.update(s),(e.session.resuming&&u||!e.session.resuming&&!u)&&(l.queue(e,l.createRecord(e,{type:l.ContentType.change_cipher_spec,data:l.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createFinished(e)}))),e.expect=u?v:C,e.handshaking=!1,++e.handshakes,e.peerCertificate=u?e.session.serverCertificate:e.session.clientCertificate,l.flush(e),e.isConnected=!0,e.connected(e),e.process()},l.handleAlert=function(e,t){var r=t.fragment,n={level:r.getByte(),description:r.getByte()},i;switch(n.description){case l.Alert.Description.close_notify:i="Connection closed.";break;case l.Alert.Description.unexpected_message:i="Unexpected message.";break;case l.Alert.Description.bad_record_mac:i="Bad record MAC.";break;case l.Alert.Description.decryption_failed:i="Decryption failed.";break;case l.Alert.Description.record_overflow:i="Record overflow.";break;case l.Alert.Description.decompression_failure:i="Decompression failed.";break;case l.Alert.Description.handshake_failure:i="Handshake failure.";break;case l.Alert.Description.bad_certificate:i="Bad certificate.";break;case l.Alert.Description.unsupported_certificate:i="Unsupported certificate.";break;case l.Alert.Description.certificate_revoked:i="Certificate revoked.";break;case l.Alert.Description.certificate_expired:i="Certificate expired.";break;case l.Alert.Description.certificate_unknown:i="Certificate unknown.";break;case l.Alert.Description.illegal_parameter:i="Illegal parameter.";break;case l.Alert.Description.unknown_ca:i="Unknown certificate authority.";break;case l.Alert.Description.access_denied:i="Access denied.";break;case l.Alert.Description.decode_error:i="Decode error.";break;case l.Alert.Description.decrypt_error:i="Decrypt error.";break;case l.Alert.Description.export_restriction:i="Export restriction.";break;case l.Alert.Description.protocol_version:i="Unsupported protocol version.";break;case l.Alert.Description.insufficient_security:i="Insufficient security.";break;case l.Alert.Description.internal_error:i="Internal error.";break;case l.Alert.Description.user_canceled:i="User canceled.";break;case l.Alert.Description.no_renegotiation:i="Renegotiation not supported.";break;default:i="Unknown error."}if(n.description===l.Alert.Description.close_notify)return e.close();e.error(e,{message:i,send:!1,origin:e.entity===l.ConnectionEnd.client?"server":"client",alert:n}),e.process()},l.handleHandshake=function(e,t){var r=t.fragment,i=r.getByte(),o=r.getInt24();if(o>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var s=r.bytes(o+4);r.read+=4,i in H[e.entity][e.expect]?(e.entity!==l.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),i!==l.HandshakeType.hello_request&&i!==l.HandshakeType.certificate_verify&&i!==l.HandshakeType.finished&&(e.session.md5.update(s),e.session.sha1.update(s)),H[e.entity][e.expect][i](e,t,o)):l.handleUnexpected(e,t)},l.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},l.handleHeartbeat=function(e,t){var r=t.fragment,i=r.getByte(),o=r.getInt16(),s=r.getBytes(o);if(i===l.HeartbeatMessageType.heartbeat_request){if(e.handshaking||o>s.length)return e.process();l.queue(e,l.createRecord(e,{type:l.ContentType.heartbeat,data:l.createHeartbeat(l.HeartbeatMessageType.heartbeat_response,s)})),l.flush(e)}else if(i===l.HeartbeatMessageType.heartbeat_response){if(s!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(s))}e.process()};var h=0,d=1,p=2,y=3,g=4,m=5,b=6,v=7,_=8,w=0,S=1,E=2,k=3,A=4,x=5,C=6,T=7,I=l.handleUnexpected,B=l.handleChangeCipherSpec,O=l.handleAlert,P=l.handleHandshake,R=l.handleApplicationData,N=l.handleHeartbeat,j=[];j[l.ConnectionEnd.client]=[[I,O,P,I,N],[I,O,P,I,N],[I,O,P,I,N],[I,O,P,I,N],[I,O,P,I,N],[B,O,I,I,N],[I,O,P,I,N],[I,O,P,R,N],[I,O,P,I,N]],j[l.ConnectionEnd.server]=[[I,O,P,I,N],[I,O,P,I,N],[I,O,P,I,N],[I,O,P,I,N],[B,O,I,I,N],[I,O,P,I,N],[I,O,P,R,N],[I,O,P,I,N]];var L=l.handleHelloRequest,M=l.handleServerHello,D=l.handleCertificate,U=l.handleServerKeyExchange,F=l.handleCertificateRequest,K=l.handleServerHelloDone,q=l.handleFinished,H=[];H[l.ConnectionEnd.client]=[[I,I,M,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,D,U,F,K,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,U,F,K,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,I,F,K,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,I,I,K,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,q],[L,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I]];var z=l.handleClientHello,V=l.handleClientKeyExchange,G=l.handleCertificateVerify;H[l.ConnectionEnd.server]=[[I,z,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,D,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,V,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,G,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,q],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I]],l.generateKeys=function(e,t){var r=i,n=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",n,48).bytes(),t.pre_master_secret=null),n=t.server_random+t.client_random;var o=2*t.mac_key_length+2*t.enc_key_length,s=e.version.major===l.Versions.TLS_1_0.major&&e.version.minor===l.Versions.TLS_1_0.minor;s&&(o+=2*t.fixed_iv_length);var a=r(t.master_secret,"key expansion",n,o),u={client_write_MAC_key:a.getBytes(t.mac_key_length),server_write_MAC_key:a.getBytes(t.mac_key_length),client_write_key:a.getBytes(t.enc_key_length),server_write_key:a.getBytes(t.enc_key_length)};return s&&(u.client_write_IV=a.getBytes(t.fixed_iv_length),u.server_write_IV=a.getBytes(t.fixed_iv_length)),u},l.createConnectionState=function(e){var t=e.entity===l.ConnectionEnd.client,r=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},n={read:r(),write:r()};if(n.read.update=function(e,t){return n.read.cipherFunction(t,n.read)?n.read.compressFunction(e,t,n.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.bad_record_mac}}),!e.fail},n.write.update=function(e,t){return n.write.compressFunction(e,t,n.write)?n.write.cipherFunction(t,n.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}}),!e.fail},e.session){var i=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(i),i.keys=l.generateKeys(e,i),n.read.macKey=t?i.keys.server_write_MAC_key:i.keys.client_write_MAC_key,n.write.macKey=t?i.keys.client_write_MAC_key:i.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(n,e,i),i.compression_algorithm){case l.CompressionMethod.none:break;case l.CompressionMethod.deflate:n.read.compressFunction=u,n.write.compressFunction=a;break;default:throw new Error("Unsupported compression algorithm.")}}return n},l.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=n.util.createBuffer();return r.putInt32(t),r.putBytes(n.random.getBytes(28)),r},l.createRecord=function(e,t){if(!t.data)return null;var r={type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data};return r},l.createAlert=function(e,t){var r=n.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),l.createRecord(e,{type:l.ContentType.alert,data:r})},l.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=n.util.createBuffer(),r=0;r0&&(p+=2);var y=e.session.id,g=y.length+1+2+4+28+2+o+1+a+p,m=n.util.createBuffer();return m.putByte(l.HandshakeType.client_hello),m.putInt24(g),m.putByte(e.version.major),m.putByte(e.version.minor),m.putBytes(e.session.sp.client_random),f(m,1,n.util.createBuffer(y)),f(m,2,t),f(m,1,s),p>0&&f(m,2,u),m},l.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,i=n.util.createBuffer();return i.putByte(l.HandshakeType.server_hello),i.putInt24(r),i.putByte(e.version.major),i.putByte(e.version.minor),i.putBytes(e.session.sp.server_random),f(i,1,n.util.createBuffer(t)),i.putByte(e.session.cipherSuite.id[0]),i.putByte(e.session.cipherSuite.id[1]),i.putByte(e.session.compressionMethod),i},l.createCertificate=function(e){var t=e.entity===l.ConnectionEnd.client,r=null,i;e.getCertificate&&(i=t?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,r=e.getCertificate(e,i));var o=n.util.createBuffer();if(null!==r)try{n.util.isArray(r)||(r=[r]);for(var s=null,a=0;al.MaxFragment;)i.push(l.createRecord(e,{type:t.type,data:n.util.createBuffer(o.slice(0,l.MaxFragment))})),o=o.slice(l.MaxFragment);o.length>0&&i.push(l.createRecord(e,{type:t.type,data:n.util.createBuffer(o)}))}for(var s=0;s0&&(i=r.order[0]),null!==i&&i in r.cache)for(var o in t=r.cache[i],delete r.cache[i],r.order)if(r.order[o]===i){r.order.splice(o,1);break}return t},r.setSession=function(e,t){if(r.order.length===r.capacity){var i=r.order.shift();delete r.cache[i]}var i=n.util.bytesToHex(e);r.order.push(i),r.cache[i]=t}}return r},l.createConnection=function(e){var t=null;t=e.caStore?n.util.isArray(e.caStore)?n.pki.createCaStore(e.caStore):e.caStore:n.pki.createCaStore();var r=e.cipherSuites||null;if(null===r)for(var i in r=[],l.CipherSuites)r.push(l.CipherSuites[i]);var o=e.server?l.ConnectionEnd.server:l.ConnectionEnd.client,s=e.sessionCache?l.createSessionCache(e.sessionCache):null,a={version:{major:l.Version.major,minor:l.Version.minor},entity:o,sessionId:e.sessionId,caStore:t,sessionCache:s,cipherSuites:r,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(e,t,r,n){return t},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:n.util.createBuffer(),tlsData:n.util.createBuffer(),data:n.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(t,r){r.origin=r.origin||(t.entity===l.ConnectionEnd.client?"client":"server"),r.send&&(l.queue(t,l.createAlert(t,r.alert)),l.flush(t));var n=!1!==r.fatal;n&&(t.fail=!0),e.error(t,r),n&&t.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null,reset:function(e){a.version={major:l.Version.major,minor:l.Version.minor},a.record=null,a.session=null,a.peerCertificate=null,a.state={pending:null,current:null},a.expect=(a.entity,l.ConnectionEnd.client,0),a.fragmented=null,a.records=[],a.open=!1,a.handshakes=0,a.handshaking=!1,a.isConnected=!1,a.fail=!(e||void 0===e),a.input.clear(),a.tlsData.clear(),a.data.clear(),a.state.current=l.createConnectionState(a)}};a.reset();var u=function(e,t){var r=t.type-l.ContentType.change_cipher_spec,n=j[e.entity][e.expect];r in n?n[r](e,t):l.handleUnexpected(e,t)},c=function(e){var t=0,r=e.input,i=r.length();if(i<5)t=5-i;else{e.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:n.util.createBuffer(),ready:!1};var o=e.record.version.major===e.version.major;o&&e.session&&e.session.version&&(o=e.record.version.minor===e.version.minor),o||e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.protocol_version}})}return t},f=function(e){var t=0,r=e.input,n=r.length();if(n0&&(a.sessionCache&&(t=a.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&a.sessionCache&&(t=a.sessionCache.getSession(),null!==t&&(e=t.id)),a.session={id:e,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:n.md.md5.create(),sha1:n.md.sha1.create()},t&&(a.version=t.version,a.session.sp=t.sp),a.session.sp.client_random=l.createRandom().getBytes(),a.open=!0,l.queue(a,l.createRecord(a,{type:l.ContentType.handshake,data:l.createClientHello(a)})),l.flush(a)}},a.process=function(e){var t=0;return e&&a.input.putBytes(e),a.fail||(null!==a.record&&a.record.ready&&a.record.fragment.isEmpty()&&(a.record=null),null===a.record&&(t=c(a)),a.fail||null===a.record||a.record.ready||(t=f(a)),!a.fail&&null!==a.record&&a.record.ready&&u(a,a.record)),t},a.prepare=function(e){return l.queue(a,l.createRecord(a,{type:l.ContentType.application_data,data:n.util.createBuffer(e)})),l.flush(a)},a.prepareHeartbeatRequest=function(e,t){return e instanceof n.util.ByteBuffer&&(e=e.bytes()),void 0===t&&(t=e.length),a.expectedHeartbeatPayload=e,l.queue(a,l.createRecord(a,{type:l.ContentType.heartbeat,data:l.createHeartbeat(l.HeartbeatMessageType.heartbeat_request,e,t)})),l.flush(a)},a.close=function(e){if(!a.fail&&a.sessionCache&&a.session){var t={id:a.session.id,version:a.session.version,sp:a.session.sp};t.sp.keys=null,a.sessionCache.setSession(t.id,t)}a.open&&(a.open=!1,a.input.clear(),(a.isConnected||a.handshaking)&&(a.isConnected=a.handshaking=!1,l.queue(a,l.createAlert(a,{level:l.Alert.Level.warning,description:l.Alert.Description.close_notify})),l.flush(a)),a.closed(a)),a.reset(e)},a},e.exports=n.tls=n.tls||{},l)"function"!=typeof l[Y]&&(n.tls[Y]=l[Y]);n.tls.prf_tls1=i,n.tls.hmac_sha1=s,n.tls.createSessionCache=l.createSessionCache,n.tls.createConnection=l.createConnection},function(e,t,r){var n=r(13);r(87),r(122),r(508),r(137),r(320),r(515),r(322),r(238),r(16),r(321);var i=n.asn1,o=e.exports=n.pki=n.pki||{};o.pemToDer=function(e){var t=n.pem.decode(e)[0];if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return n.util.createBuffer(t.body)},o.privateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("PRIVATE KEY"!==t.type&&"RSA PRIVATE KEY"!==t.type){var r=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var s=i.fromDer(t.body);return o.privateKeyFromAsn1(s)},o.privateKeyToPem=function(e,t){var r={type:"RSA PRIVATE KEY",body:i.toDer(o.privateKeyToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},o.privateKeyInfoToPem=function(e,t){var r={type:"PRIVATE KEY",body:i.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})}},function(e,t,r){var n=r(13);if(r(121),r(87),r(237),r(88),r(122),r(320),r(137),r(68),r(512),r(238),r(16),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 l(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 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,l,h;if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var y,g,m;switch(r.algorithm){case"aes128":f=16,y=16,g=a["aes128-CBC"],m=n.aes.createEncryptionCipher;break;case"aes192":f=24,y=16,g=a["aes192-CBC"],m=n.aes.createEncryptionCipher;break;case"aes256":f=32,y=16,g=a["aes256-CBC"],m=n.aes.createEncryptionCipher;break;case"des":f=8,y=8,g=a.desCBC,m=n.des.createEncryptionCipher;break;default:var b=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw b.algorithm=r.algorithm,b}var v="hmacWith"+r.prfAlgorithm.toUpperCase(),_=d(v),w=n.pkcs5.pbkdf2(t,i,u,f,_),S=n.random.getBytesSync(y),E=m(w);E.start(S),E.update(o.toDer(e)),E.finish(),h=E.output.getBytes();var k=p(i,c,f,v);l=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(g).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,S)])])])}else{if("3des"!==r.algorithm){var b=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw b.algorithm=r.algorithm,b}f=24;var A=new n.util.ByteBuffer(i),w=s.pbe.generatePkcs12Key(t,A,1,u,f),S=s.pbe.generatePkcs12Key(t,A,2,u,f),E=n.des.createEncryptionCipher(w);E.start(S),E.update(o.toDer(e)),E.finish(),h=E.output.getBytes(),l=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 x=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[l,o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,h)]);return x},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),l=s.pbe.getCipher(f,i.encryptionParams,t),h=n.util.createBuffer(i.encryptedData);return l.update(h),l.finish()&&(r=o.fromDer(l.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 l=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw l.algorithm=r.algorithm,l}var h=n.pbe.opensslDeriveBytes(t,u.substr(0,8),c),d=f(h);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),l=n.pbe.opensslDeriveBytes(t,f.substr(0,8),u),h=c(l);if(h.start(f),h.update(n.util.createBuffer(i.body)),!h.finish())return r;r=h.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,l=new n.util.ByteBuffer,h=new n.util.ByteBuffer;if(null!==e&&void 0!==e){for(u=0;u=0;u--)I>>=8,I+=A.at(u)+T.at(u),T.setAt(u,255&I);C.putBuffer(T)}_=C,l.putBuffer(E)}return l.truncate(l.length()-o),l},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,l=n.util.createBuffer(i.kdfIterationCount),d,p;switch(l=l.getInt(l.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 y=h(i.prfOid),g=n.pkcs5.pbkdf2(r,f,l,d,y),m=i.encIv,b=p(g);return b.start(m),b},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),l=n.util.createBuffer(i.iterations),d,p,y;switch(l=l.getInt(l.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,p=8,y=n.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,p=8,y=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 g=h(i.prfOid),m=s.pbe.generatePkcs12Key(r,c,1,l,d,g);g.start();var b=s.pbe.generatePkcs12Key(r,c,2,l,p,g);return y(m,b)},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=[l(i,e+t)],s=16,a=1;s>>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,l;s.putBytes(o.substr(0,i.blockLength-u));for(var h=8*i.fullMessageLength[0],d=0;d>>0,h+=l,s.putInt32(h>>>0),h=f>>>0;s.putInt32(h);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 y=n.util.createBuffer();return y.putInt32(p.h0),y.putInt32(p.h1),y.putInt32(p.h2),y.putInt32(p.h3),y.putInt32(p.h4),y.putInt32(p.h5),y.putInt32(p.h6),y.putInt32(p.h7),y},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,l,h,d,p,y,g,m,b,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(l=e.h0,h=e.h1,d=e.h2,p=e.h3,y=e.h4,g=e.h5,m=e.h6,b=e.h7,f=0;f<64;++f)s=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),u=m^y&(g^m),o=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),c=l&h|d&(l^h),n=b+s+u+a[f]+t[f],i=o+c,b=m,m=g,g=y,y=p+n>>>0,p=d,d=h,h=l,l=n+i>>>0;e.h0=e.h0+l|0,e.h1=e.h1+h|0,e.h2=e.h2+d|0,e.h3=e.h3+p|0,e.h4=e.h4+y|0,e.h5=e.h5+g|0,e.h6=e.h6+m|0,e.h7=e.h7+b|0,v-=64}}},function(e,t,r){(function(t){var n=r(13);r(16);var i=null;!n.util.isNodejs||n.options.usePureJavaScript||t.versions["node-webkit"]||(i=r(509));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),l=4294967295&c;for(var a=0;a<3;++a)f=l>>>(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(l){if(l)return r(l);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 h=i(t.key,t.seed);t.generated+=h.length,c.putBytes(h),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(3))},function(e,t,r){var n=r(13);r(16);var i=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],o=[1,2,3,5],s=function(e,t){return e<>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,l,h,d,p,y=[];for(e=n.rc2.expandKey(e,t),d=0;d<64;d++)y.push(e.getInt16Le());r?(l=function(e){for(d=0;d<4;d++)e[d]+=y[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++},h=function(e){for(d=0;d<4;d++)e[d]+=y[63&e[(d+3)%4]]}):(l=function(e){for(d=3;d>=0;d--)e[d]=a(e[d],o[d]),e[d]-=y[p]+(e[(d+3)%4]&e[(d+2)%4])+(~e[(d+3)%4]&e[(d+1)%4]),p--},h=function(e){for(d=3;d>=0;d--)e[d]-=y[63&e[(d+3)%4]]});var g=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;)g([[5,l],[1,h],[6,l],[1,h],[5,l]])},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,m.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}},m};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){var n=r(13);r(16),r(68),r(178);var i=e.exports=n.pkcs1=n.pkcs1||{};function o(e,t,r){r||(r=n.md.sha1.create());for(var i="",o=Math.ceil(t/r.digestLength),s=0;s>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 l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),a.update(i,"raw");for(var h=a.digest(),d="",p=f-t.length,y=0;yt&&(e=l(t,r)),e.isProbablePrime(s))return u(null,e);e.dAddOffset(i[o++%8],0)}while(a<0||+new Date-fe&&(s=l(e,t));var p=s.toString(16);i.target.postMessage({hex:p,workLoad:c}),s.dAddOffset(f,0)}}}d()}function l(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 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,r){var n=r(13);r(87),r(177),r(122),r(516),r(508),r(68),r(238),r(178),r(16),r(321);var i=n.asn1,o=n.pki,s=e.exports=n.pkcs12=n.pkcs12||{},a={name:"ContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:i.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},u={name:"PFX",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},a,{name:"PFX.macData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:i.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},c={name:"SafeBag",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:i.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},f={name:"Attribute",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,capture:"values"}]},l={name:"CertBag",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:i.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:i.Class.UNIVERSAL,type:i.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function h(e,t,r,n){for(var i=[],o=0;o=0&&i.push(a):i.push(a))}return i}function d(e){if(e.composed||e.constructed){for(var t=n.util.createBuffer(),r=0;r0&&(c=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,h));var d=[],p=[];null!==t&&(p=n.util.isArray(t)?t:[t]);for(var y=[],g=0;g0){var _=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,y),w=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.data).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(_).getBytes())])]);d.push(w)}var S=null;if(null!==e){var E=o.wrapRsaPrivateKey(o.privateKeyToAsn1(e));S=null===r?i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.keyBag).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[E]),c]):i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.pkcs8ShroudedKeyBag).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[o.encryptPrivateKeyInfo(E,r,a)]),c]);var k=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[S]),A=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.data).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(k).getBytes())])]);d.push(A)}var x=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,d),C;if(a.useMac){var l=n.md.sha1.create(),T=new n.util.ByteBuffer(n.random.getBytes(a.saltSize)),I=a.count,e=s.generateKey(r,T,3,I,20),B=n.hmac.create();B.start(l,e),B.update(i.toDer(x).getBytes());var O=B.getMac();C=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.sha1).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,O.getBytes())]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,T.getBytes()),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(I).getBytes())])}return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(3).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.data).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(x).getBytes())])]),C])},s.generateKey=n.pbe.generatePkcs12Key},function(e,t,r){var n=r(13);r(87),r(16);var i=n.asn1,o=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=o;var s={name:"ContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};o.contentInfoValidator=s;var a={name:"EncryptedContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};o.envelopedDataValidator={name:"EnvelopedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(a)},o.encryptedDataValidator={name:"EncryptedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"}].concat(a)};var u={name:"SignerInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};o.signedDataValidator={name:"SignedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},s,{name:"SignedData.Certificates",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,capture:"signerInfos",optional:!0,value:[u]}]},o.recipientInfoValidator={name:"RecipientInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},function(e,t,r){var n=r(13);r(16),n.mgf=n.mgf||{};var i=e.exports=n.mgf.mgf1=n.mgf1=n.mgf1||{};i.create=function(e){var t={generate:function(t,r){for(var i=new n.util.ByteBuffer,o=Math.ceil(r/e.digestLength),s=0;s>>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),l(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 h=8*d.fullMessageLength[0],p=0;p>>0,h+=f,t.putInt32(h>>>0),h=c>>>0;t.putInt32(h);for(var y=new Array(r.length),p=0;p=128;){for(P=0;P<16;++P)t[P][0]=r.getInt32()>>>0,t[P][1]=r.getInt32()>>>0;for(;P<80;++P)j=t[P-2],R=j[0],N=j[1],n=((R>>>19|N<<13)^(N>>>29|R<<3)^R>>>6)>>>0,i=((R<<13|N>>>19)^(N<<3|R>>>29)^(R<<26|N>>>6))>>>0,M=t[P-15],R=M[0],N=M[1],o=((R>>>1|N<<31)^(R>>>8|N<<24)^R>>>7)>>>0,s=((R<<31|N>>>1)^(R<<24|N>>>8)^(R<<25|N>>>7))>>>0,L=t[P-7],D=t[P-16],N=i+L[1]+s+D[1],t[P][0]=n+L[0]+o+D[0]+(N/4294967296>>>0)>>>0,t[P][1]=N>>>0;for(g=e[0][0],m=e[0][1],b=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],A=e[4][1],x=e[5][0],C=e[5][1],T=e[6][0],I=e[6][1],B=e[7][0],O=e[7][1],P=0;P<80;++P)f=((k>>>14|A<<18)^(k>>>18|A<<14)^(A>>>9|k<<23))>>>0,l=((k<<18|A>>>14)^(k<<14|A>>>18)^(A<<23|k>>>9))>>>0,h=(T^k&(x^T))>>>0,d=(I^A&(C^I))>>>0,a=((g>>>28|m<<4)^(m>>>2|g<<30)^(m>>>7|g<<25))>>>0,c=((g<<4|m>>>28)^(m<<30|g>>>2)^(m<<25|g>>>7))>>>0,p=(g&b|_&(g^b))>>>0,y=(m&v|w&(m^v))>>>0,N=O+l+d+u[P][1]+t[P][1],n=B+f+h+u[P][0]+t[P][0]+(N/4294967296>>>0)>>>0,i=N>>>0,N=c+y,o=a+p+(N/4294967296>>>0)>>>0,s=N>>>0,B=T,O=I,T=x,I=C,x=k,C=A,N=E+i,k=S+n+(N/4294967296>>>0)>>>0,A=N>>>0,S=_,E=w,_=b,w=v,b=g,v=m,N=i+s,g=n+o+(N/4294967296>>>0)>>>0,m=N>>>0;N=e[0][1]+m,e[0][0]=e[0][0]+g+(N/4294967296>>>0)>>>0,e[0][1]=N>>>0,N=e[1][1]+v,e[1][0]=e[1][0]+b+(N/4294967296>>>0)>>>0,e[1][1]=N>>>0,N=e[2][1]+w,e[2][0]=e[2][0]+_+(N/4294967296>>>0)>>>0,e[2][1]=N>>>0,N=e[3][1]+E,e[3][0]=e[3][0]+S+(N/4294967296>>>0)>>>0,e[3][1]=N>>>0,N=e[4][1]+A,e[4][0]=e[4][0]+k+(N/4294967296>>>0)>>>0,e[4][1]=N>>>0,N=e[5][1]+C,e[5][0]=e[5][0]+x+(N/4294967296>>>0)>>>0,e[5][1]=N>>>0,N=e[6][1]+I,e[6][0]=e[6][0]+T+(N/4294967296>>>0)>>>0,e[6][1]=N>>>0,N=e[7][1]+O,e[7][0]=e[7][0]+B+(N/4294967296>>>0)>>>0,e[7][1]=N>>>0,U-=128}}},function(e,t,r){var n=r(13);r(16),e.exports=n.log=n.log||{},n.log.levels=["none","error","warning","info","debug","verbose","max"];var i={},o=[],s=null;n.log.LEVEL_LOCKED=2,n.log.NO_LEVEL_CHECK=4,n.log.INTERPOLATE=8;for(var a=0;a{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(e){const n=r(7);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";(function(e){const n=r(315),i=r(316)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(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(1055),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(o).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,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},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";const n=r(1),i=r(179).Reporter,o=r(0).Buffer;function s(e,t){i.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function a(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof a||(e=new a(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}n(s,i),t.DecoderBuffer=s,s.prototype.save=function e(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},s.prototype.restore=function e(t){const r=new s(this.base);return r.offset=t.offset,r.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),r},s.prototype.isEmpty=function e(){return this.offset===this.length},s.prototype.readUInt8=function e(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},s.prototype.skip=function e(t,r){if(!(this.offset+t<=this.length))return this.error(r||"DecoderBuffer overrun");const n=new s(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},s.prototype.raw=function e(t){return this.base.slice(t?t.offset:this.offset,this.length)},t.EncoderBuffer=a,a.prototype.join=function e(t,r){return t||(t=new o(this.length)),r||(r=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach(function(e){e.join(t,r),r+=e.length}):("number"==typeof this.value?t[r]=this.value:"string"==typeof this.value?t.write(this.value,r):o.isBuffer(this.value)&&this.value.copy(t,r),r+=this.length),t)}},function(e,t,r){"use strict";const n=t;n._reverse=function e(t){const r={};return Object.keys(t).forEach(function(e){(0|e)==e&&(e|=0);const n=t[e];r[n]=e}),r},n.der=r(1060)},function(e,t,r){"use strict";const n=r(1),i=r(138),o=i.base,s=i.bignum,a=i.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.Node.call(this,"der",e)}function f(e,t){let r=e.readUInt8(t);if(e.isError(r))return r;const n=a.tagClass[r>>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 l(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=l(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{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(e){const n=r(7);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";var n=r(5).Buffer,i=r(240),o=r(532);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";(function(t){const n=r(18),i=r(1089);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(e){const n=r(7);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";(function(e){const n=r(323),i=r(324)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(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(1092),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(o).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,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},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";const n=r(1),i=r(180).Reporter,o=r(0).Buffer;function s(e,t){i.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function a(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof a||(e=new a(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}n(s,i),t.DecoderBuffer=s,s.prototype.save=function e(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},s.prototype.restore=function e(t){const r=new s(this.base);return r.offset=t.offset,r.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),r},s.prototype.isEmpty=function e(){return this.offset===this.length},s.prototype.readUInt8=function e(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},s.prototype.skip=function e(t,r){if(!(this.offset+t<=this.length))return this.error(r||"DecoderBuffer overrun");const n=new s(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},s.prototype.raw=function e(t){return this.base.slice(t?t.offset:this.offset,this.length)},t.EncoderBuffer=a,a.prototype.join=function e(t,r){return t||(t=new o(this.length)),r||(r=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach(function(e){e.join(t,r),r+=e.length}):("number"==typeof this.value?t[r]=this.value:"string"==typeof this.value?t.write(this.value,r):o.isBuffer(this.value)&&this.value.copy(t,r),r+=this.length),t)}},function(e,t,r){"use strict";const n=t;n._reverse=function e(t){const r={};return Object.keys(t).forEach(function(e){(0|e)==e&&(e|=0);const n=t[e];r[n]=e}),r},n.der=r(1096)},function(e,t,r){"use strict";const n=r(1),i=r(139),o=i.base,s=i.bignum,a=i.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.Node.call(this,"der",e)}function f(e,t){let r=e.readUInt8(t);if(e.isError(r))return r;const n=a.tagClass[r>>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 l(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=l(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;ou.BITS)return this.valid=!1,void(this.error="Invalid subnet mask.");e=e.replace(u.RE_SUBNET_STRING,"")}this.addressMinusSuffix=e,this.parsedAddress=this.parse(e)}c.prototype.parse=function(e){var t=e.split(".");return e.match(u.RE_ADDRESS)?this.valid=!0:this.error="Invalid IPv4 address.",t},c.prototype.isValid=function(){return this.valid},c.prototype.correctForm=function(){return this.parsedAddress.map(function(e){return parseInt(e,10)}).join(".")},c.prototype.isCorrect=i.isCorrect(u.BITS),c.fromHex=function(e){var t=o(e.replace(/:/g,""),8,"0"),r=[],n;for(n=0;n<8;n+=2){var i=t.slice(n,n+2);r.push(parseInt(i,16))}return new c(r.join("."))},c.fromInteger=function(e){return c.fromHex(e.toString(16))},c.prototype.toHex=function(){return this.parsedAddress.map(function(e){return a("%02x",parseInt(e,10))}).join(":")},c.prototype.toArray=function(){return this.parsedAddress.map(function(e){return parseInt(e,10)})},c.prototype.toGroup6=function(){var e=[],t;for(t=0;t=0;){var s=t*this[e++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=67108863&s}return i}function u(e,t,r,n,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var u=32767&this[e],c=this[e++]>>15,f=a*u+c*s;u=s*u+((32767&f)<<15)+r[n]+(1073741823&i),i=(u>>>30)+(f>>>15)+a*c+(i>>>30),r[n++]=1073741823&u}return i}function c(e,t,r,n,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var u=16383&this[e],c=this[e++]>>14,f=a*u+c*s;u=s*u+((16383&f)<<14)+r[n]+i,i=(u>>28)+(f>>14)+a*c,r[n++]=268435455&u}return i}var f="undefined"!=typeof navigator;f&&"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=u,r=30):f&&"Netscape"!=navigator.appName?(o.prototype.am=a,r=26):(o.prototype.am=c,r=28),o.prototype.DB=r,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 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,s=0;--n>=0;){var a=8==r?255&e[n]:m(e,n);a<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==s?this[this.t++]=a:s+r>this.DB?(this[this.t-1]|=(a&(1<>this.DB-s):this[this.t-1]|=a<=this.DB&&(s-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<0&&this[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 r=(1<0)for(a>a)>0&&(i=!0,o=g(n));s>=0;)a>(a+=this.DB-t)):(n=this[s]>>(a-=t)&r,a<=0&&(a+=this.DB,--s)),n>0&&(i=!0),i&&(o+=g(n));return i?o:"0"}function k(){var e=s();return o.ZERO.subTo(this,e),e}function A(){return this.s<0?this.negate():this}function x(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[r]-e[r]))return t;return 0}function C(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)+C(this[this.t-1]^this.s&this.DM)}function I(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s}function B(e,t){for(var r=e;r=0;--a)t[a+o+1]=this[a]>>n|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 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[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[r++]=this.DV+n:n>0&&(t[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[i]=0;for(i=0;i=0;)e[r]=0;for(r=0;r=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()}function L(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(f,a),i.lShiftTo(f,r)):(n.copyTo(a),i.copyTo(r));var l=a.t,h=a[l-1];if(0!=h){var d=h*(1<1?a[l-2]>>this.F2:0),p=this.FV/d,y=(1<=0&&(r[r.t++]=1,r.subTo(v,r)),o.ONE.dlShiftTo(l,v),v.subTo(a,a);a.t=0;){var _=r[--m]==h?this.DM:Math.floor(r[m]*p+(r[m-1]+g)*y);if((r[m]+=a.am(0,_,r,b,0,l))<_)for(a.dlShiftTo(b,v),r.subTo(v,r);r[m]<--_;)r.subTo(v,r)}null!=t&&(r.drShiftTo(l,t),u!=c&&o.ZERO.subTo(t,t)),r.t=l,r.clamp(),f>0&&r.rShiftTo(f,r),u<0&&o.ZERO.subTo(r,r)}}}function M(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 D(e){this.m=e}function U(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function F(e){return e}function K(e){e.divRemTo(this.m,null,e)}function q(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function H(e,t){e.squareTo(t),this.reduce(t)}function z(){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 W(e){var t=s();return e.copyTo(t),this.reduce(t),t}function $(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e[r]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}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,r){e.multiplyTo(t,r),this.reduce(r)}function X(){return 0==(this.t>0?1&this[0]:this.s)}function Z(e,t){if(e>4294967295||e<1)return o.ONE;var r=s(),n=s(),i=t.convert(this),a=C(e)-1;for(i.copyTo(r);--a>=0;)if(t.sqrTo(r,n),(e&1<0)t.mulTo(n,i,r);else{var u=r;r=n,n=u}return t.revert(r)}function Q(e,t){var r;return r=e<256||t.isEven()?new D(t):new V(t),this.exp(e,r)}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 ne(){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),r=Math.pow(e,t),n=_(r),i=s(),o=s(),a="";for(this.divRemTo(n,i,o);i.signum()>0;)a=(r+o.intValue()).toString(e).substr(1)+a,i.divRemTo(n,i,o);return o.intValue().toString(e)+a}function ae(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,s=0,a=0,u=0;u=r&&(this.dMultiply(n),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,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),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 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[e]&(1<>(r+=this.DB-8)):(n=this[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 fe(e){return 0==this.compareTo(e)}function le(e){return this.compareTo(e)<0?this:e}function he(e){return this.compareTo(e)>0?this:e}function de(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 xe(){for(var e=0;e=this.t?0!=this.s:0!=(this[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[r++]=n:n<-1&&(t[r++]=this.DV+n),t.t=r,t.clamp()}function je(e){var t=s();return this.addTo(e,t),t}function Le(e){var t=s();return this.subTo(e,t),t}function Me(e){var t=s();return this.multiplyTo(e,t),t}function De(){var e=s();return this.squareTo(e),e}function Ue(e){var t=s();return this.divRemTo(e,t,null),t}function Fe(e){var t=s();return this.divRemTo(e,null,t),t}function Ke(e){var t=s(),r=s();return this.divRemTo(e,t,r),new Array(t,r)}function qe(e){this[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[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 ze(){}function Ve(e){return e}function Ge(e,t,r){e.multiplyTo(t,r)}function We(e,t){e.squareTo(t)}function $e(e){return this.exp(e,new ze)}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[--n]=0;for(i=r.t-this.t;n=0;)r[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=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 rt(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function nt(e,t){var r=e.bitLength(),n,i=_(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 D(t):t.isEven()?new Xe(t):new V(t);var a=new Array,u=3,c=n-1,f=(1<1){var l=s();for(o.sqrTo(a[1],l);u<=f;)a[u]=s(),o.mulTo(l,a[u-2],a[u]),u+=2}var h=e.t-1,d,p=!0,y=s(),g;for(r=C(e[h])-1;h>=0;){for(r>=c?d=e[h]>>r-c&f:(d=(e[h]&(1<0&&(d|=e[h-1]>>this.DB+r-c)),u=n;0==(1&d);)d>>=1,--u;if((r-=u)<0&&(r+=this.DB,--h),p)a[d].copyTo(i),p=!1;else{for(;u>1;)o.sqrTo(i,y),o.sqrTo(y,i),u-=2;u>0?o.sqrTo(i,y):(g=i,i=y,y=g),o.mulTo(y,a[d],i)}for(;h>=0&&0==(e[h]&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[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r}function st(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return o.ZERO;for(var r=e.clone(),n=this.clone(),i=_(1),s=_(0),a=_(0),u=_(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),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(;n.isEven();)n.rShiftTo(1,n),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);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(a,i),s.subTo(u,s)):(n.subTo(r,n),t&&a.subTo(i,a),u.subTo(s,u))}return 0!=n.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}D.prototype.convert=U,D.prototype.revert=F,D.prototype.reduce=K,D.prototype.mulTo=q,D.prototype.sqrTo=H,V.prototype.convert=G,V.prototype.revert=W,V.prototype.reduce=$,V.prototype.mulTo=J,V.prototype.sqrTo=Y,o.prototype.copyTo=b,o.prototype.fromInt=v,o.prototype.fromString=w,o.prototype.clamp=S,o.prototype.dlShiftTo=I,o.prototype.drShiftTo=B,o.prototype.lShiftTo=O,o.prototype.rShiftTo=P,o.prototype.subTo=R,o.prototype.multiplyTo=N,o.prototype.squareTo=j,o.prototype.divRemTo=L,o.prototype.invDigit=z,o.prototype.isEven=X,o.prototype.exp=Z,o.prototype.toString=E,o.prototype.negate=k,o.prototype.abs=A,o.prototype.compareTo=x,o.prototype.bitLength=T,o.prototype.mod=M,o.prototype.modPowInt=Q,o.ZERO=_(0),o.ONE=_(1),ze.prototype.convert=Ve,ze.prototype.revert=Ve,ze.prototype.mulTo=Ge,ze.prototype.sqrTo=We,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,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],ct,ft,lt;function ht(e){var t,r=this.abs();if(1==r.t&&r[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,ft[lt++]^=e>>16&255,ft[lt++]^=e>>24&255,lt>=xt&&(lt-=xt)}function yt(){pt((new Date).getTime())}if(o.prototype.chunkSize=ie,o.prototype.toRadix=se,o.prototype.fromRadix=ae,o.prototype.fromNumber=ue,o.prototype.bitwiseTo=de,o.prototype.changeBit=Be,o.prototype.addTo=Ne,o.prototype.dMultiply=qe,o.prototype.dAddOffset=He,o.prototype.multiplyLowerTo=Ye,o.prototype.multiplyUpperTo=Je,o.prototype.modInt=ot,o.prototype.millerRabin=dt,o.prototype.clone=ee,o.prototype.intValue=te,o.prototype.byteValue=re,o.prototype.shortValue=ne,o.prototype.signum=oe,o.prototype.toByteArray=ce,o.prototype.equals=fe,o.prototype.min=le,o.prototype.max=he,o.prototype.and=ye,o.prototype.or=me,o.prototype.xor=ve,o.prototype.andNot=we,o.prototype.not=Se,o.prototype.shiftLeft=Ee,o.prototype.shiftRight=ke,o.prototype.getLowestSetBit=xe,o.prototype.bitCount=Te,o.prototype.testBit=Ie,o.prototype.setBit=Oe,o.prototype.clearBit=Pe,o.prototype.flipBit=Re,o.prototype.add=je,o.prototype.subtract=Le,o.prototype.multiply=Me,o.prototype.divide=Ue,o.prototype.remainder=Fe,o.prototype.divideAndRemainder=Ke,o.prototype.modPow=nt,o.prototype.modInverse=st,o.prototype.pow=$e,o.prototype.gcd=it,o.prototype.isProbablePrime=ht,o.prototype.square=De,o.prototype.Barrett=Xe,null==ft){var gt;if(ft=new Array,lt=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var mt=new Uint8Array(32);for(window.crypto.getRandomValues(mt),gt=0;gt<32;++gt)ft[lt++]=mt[gt]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var bt=window.crypto.random(32);for(gt=0;gt>>8,ft[lt++]=255>lt=0,yt()}function vt(){if(null==ct){for(yt(),ct=At(),ct.init(ft),lt=0;ltn)return r;do{t%2&&(r+=e),t=G(t/2),t&&(e+=e)}while(t);return r}function J(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),r=r>i?i:r,r<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(i);++n=n?e:J(e,t,r)}function Q(e,t){t=void 0===t?" ":X(t);var r=t.length;if(r<2)return r?Y(t,e):t;var n=Y(t,V(e/D(t)));return M(t)?Z(U(n),0,e).join(""):n.slice(0,e)}function ee(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function te(e){return!!e&&"object"==typeof e}function re(e){return"symbol"==typeof e||te(e)&&H.call(e)==s}function ne(e){if(!e)return 0===e?e:0;if(e=oe(e),e===r||e===-r){var t=e<0?-1:1;return t*i}return e==e?e:0}function ie(e){var t=ne(e),r=t%1;return t==t?r?t-r:t:0}function oe(e){if("number"==typeof e)return e;if(re(e))return o;if(ee(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ee(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(a,"");var r=c.test(e);return r||f.test(e)?B(e.slice(2),r?2:8):u.test(e)?o:+e}function se(e){return null==e?"":X(e)}function ae(e,t,r){e=se(e),t=ie(t);var n=t?D(e):0;return t&&nn)return r;do{t%2&&(r+=e),t=w(t/2),t&&(e+=e)}while(t);return r}function A(e){if("string"==typeof e)return e;if(N(e))return E?E.call(e):"";var t=e+"";return"0"==t&&1/e==-r?"-0":t}function x(e,t){return t=null==t?n:t,!!t&&("number"==typeof e||d.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=n}function P(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function R(e){return!!e&&"object"==typeof e}function N(e){return"symbol"==typeof e||R(e)&&v.call(e)==u}function j(e){if(!e)return 0===e?e:0;if(e=M(e),e===r||e===-r){var t=e<0?-1:1;return t*i}return e==e?e:0}function L(e){var t=j(e),r=t%1;return t==t?r?t-r:t:0}function M(e){if("number"==typeof e)return e;if(N(e))return o;if(P(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=P(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(c,"");var r=l.test(e);return r||h.test(e)?p(e.slice(2),r?2:8):f.test(e)?o:+e}function D(e){return null==e?"":A(e)}function U(e,t,r){return t=(r?C(e,t,r):void 0===t)?1:L(t),k(D(e),t)}e.exports=U}).call(this,r(8))},function(e,t,r){(function(e,r){var n=200,i="Expected a function",o="__lodash_hash_undefined__",s=1,a=2,u=1/0,c=9007199254740991,f=1.7976931348623157e308,l=NaN,h="[object Arguments]",d="[object Array]",p="[object Boolean]",y="[object Date]",g="[object Error]",m="[object Function]",b="[object GeneratorFunction]",v="[object Map]",_="[object Number]",w="[object Object]",S="[object Promise]",E="[object RegExp]",k="[object Set]",A="[object String]",x="[object Symbol]",C="[object WeakMap]",T="[object ArrayBuffer]",I="[object DataView]",B="[object Float32Array]",O="[object Float64Array]",P="[object Int8Array]",R="[object Int16Array]",N="[object Int32Array]",j="[object Uint8Array]",L="[object Uint8ClampedArray]",M="[object Uint16Array]",D="[object Uint32Array]",U=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,F=/^\w*$/,K=/^\./,q=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,H=/[\\^$.*+?()[\]{}|]/g,z=/^\s+|\s+$/g,V=/\\(\\)?/g,G=/^[-+]0x[0-9a-f]+$/i,W=/^0b[01]+$/i,$=/^\[object .+?Constructor\]$/,Y=/^0o[0-7]+$/i,J=/^(?:0|[1-9]\d*)$/,X={};X[B]=X[O]=X[P]=X[R]=X[N]=X[j]=X[L]=X[M]=X[D]=!0,X[h]=X[d]=X[T]=X[p]=X[I]=X[y]=X[g]=X[m]=X[v]=X[_]=X[w]=X[E]=X[k]=X[A]=X[C]=!1;var Z=parseInt,Q="object"==typeof e&&e&&e.Object===Object&&e,ee="object"==typeof self&&self&&self.Object===Object&&self,te=Q||ee||Function("return this")(),re="object"==typeof t&&t&&!t.nodeType&&t,ne=re&&"object"==typeof r&&r&&!r.nodeType&&r,ie=ne&&ne.exports===re,oe=ie&&Q.process,se=function(){try{return oe&&oe.binding("util")}catch(e){}}(),ae=se&&se.isTypedArray;function ue(e,t){for(var r=-1,n=e?e.length:0;++r-1}function ot(e,t){var r=this.__data__,n=St(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function st(e){var t=-1,r=e?e.length:0;for(this.clear();++t-1?i[o?t[s]:s]:void 0}}function Ut(e,t,r,n,i,o){var u=i&a,c=e.length,f=t.length;if(c!=f&&!(u&&f>c))return!1;var l=o.get(e);if(l&&o.get(t))return l==t;var h=-1,d=!0,p=i&s?new ht:void 0;for(o.set(e,t),o.set(t,e);++h-1&&e%1==0&&e-1&&e%1==0&&e<=c}function dr(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function pr(e){return!!e&&"object"==typeof e}function yr(e){return"symbol"==typeof e||pr(e)&&xe.call(e)==x}var gr=ae?he(ae):Bt;function mr(e){if(!e)return 0===e?e:0;if(e=vr(e),e===u||e===-u){var t=e<0?-1:1;return t*f}return e==e?e:0}function br(e){var t=mr(e),r=t%1;return t==t?r?t-r:t:0}function vr(e){if("number"==typeof e)return e;if(yr(e))return l;if(dr(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=dr(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(z,"");var r=W.test(e);return r||Y.test(e)?Z(e.slice(2),r?2:8):G.test(e)?l:+e}function _r(e){return null==e?"":Lt(e)}function wr(e,t,r){var n=null==e?void 0:Et(e,t);return void 0===n?r:n}function Sr(e,t){return null!=e&&Gt(e,t,At)}function Er(e){return cr(e)?wt(e):Pt(e)}function kr(e){return e}function Ar(e){return $t(e)?fe(tr(e)):jt(e)}r.exports=ir}).call(this,r(8),r(32)(e))},function(e,t,r){"use strict";var n=r(181).sprintf,i=t.spanAllZeroes=function(e){return e.replace(/(0+)/g,'$1')};function o(e){return e.replace(/^(0+)/,'$1')}t.spanAll=function(e,t){void 0===t&&(t=0);var r=e.split("");return r.map(function(e,r){return n('%s',e,r+t,i(e))}).join("")},t.spanLeadingZeroes=function(e){var t=e.split(":");return t.map(function(e){return o(e)}).join(":")},t.simpleGroup=function(e,t){var r=e.split(":");return t||(t=0),r.map(function(e,r){return/group-v4/.test(e)?e:n('%s',r+t,o(e))}).join(":")}},function(e,t,r){"use strict";(function(t){const n=r(14),i=r(1120),o=r(47);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){"use strict";(function(e){const n=r(330),i=r(331)(),o=r(1122),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=(t,r,o)=>{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";(function(t){const n=r(18),i=r(1127);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(e){const n=r(7);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";(function(e){const n=r(330),i=r(331)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(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(1130),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(o).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,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},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";const n=r(1),i=r(182).Reporter,o=r(0).Buffer;function s(e,t){i.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function a(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof a||(e=new a(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}n(s,i),t.DecoderBuffer=s,s.prototype.save=function e(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},s.prototype.restore=function e(t){const r=new s(this.base);return r.offset=t.offset,r.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),r},s.prototype.isEmpty=function e(){return this.offset===this.length},s.prototype.readUInt8=function e(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},s.prototype.skip=function e(t,r){if(!(this.offset+t<=this.length))return this.error(r||"DecoderBuffer overrun");const n=new s(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},s.prototype.raw=function e(t){return this.base.slice(t?t.offset:this.offset,this.length)},t.EncoderBuffer=a,a.prototype.join=function e(t,r){return t||(t=new o(this.length)),r||(r=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach(function(e){e.join(t,r),r+=e.length}):("number"==typeof this.value?t[r]=this.value:"string"==typeof this.value?t.write(this.value,r):o.isBuffer(this.value)&&this.value.copy(t,r),r+=this.length),t)}},function(e,t,r){"use strict";const n=t;n._reverse=function e(t){const r={};return Object.keys(t).forEach(function(e){(0|e)==e&&(e|=0);const n=t[e];r[n]=e}),r},n.der=r(1134)},function(e,t,r){"use strict";const n=r(1),i=r(140),o=i.base,s=i.bignum,a=i.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.Node.call(this,"der",e)}function f(e,t){let r=e.readUInt8(t);if(e.isError(r))return r;const n=a.tagClass[r>>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 l(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=l(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;o1||!n.part&&!l[x])return!1;return(!n.only||!f)&&A},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=h.shift(),y[p]||(y[p]={}),y=y[p];p=h.shift(),y[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[y[b]]={key:b,schema:p[y[b]].schema.concat(d[m].schema)}:p.push(d[m])}}else r._inner[l]=r._inner[l].concat(d);else r._inner[l]=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=l.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(l.schema(this._currentJoi,i.then)):void 0,a=i.hasOwnProperty("otherwise")?this.concat(l.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 l=[],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=h._try(o._flags.default,a);i=c.value,c.error&&l.push(o.createError("any.default",{error:c.error},r,n))}if(l.length&&"function"==typeof o._flags.error){var d=o._flags.error.call(o,l);l="string"==typeof d?[o.createOverrideError("override",{reason:l},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:l.length?l:null}};if(this._coerce){var p=this._coerce.call(this,t,r,n);if(p.errors)return t=p.value,l=l.concat(p.errors),d();t=p.value}this._flags.empty&&!this._flags.empty._validate(this._prepareEmptyValue(t),null,h.defaults).errors&&(t=void 0);var y=this._flags.presence||n.presence;if("optional"===y){if(void 0===t){var g=this._flags.hasOwnProperty("default")&&void 0===this._flags.default;if(!g||"object"!==this._type)return d();t={}}}else{if("required"===y&&void 0===t)return l.push(this.createError("any.required",null,r,n)),d();if("forbidden"===y)return void 0===t?d():(l.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)&&(l.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 m=this._base.call(this,t,r,n);if(m.errors)return t=m.value,l=l.concat(m.errors),d();if(m.value!==t){if(t=m.value,this._valids.has(t,r,n,this._flags.insensitive))return d();if(this._invalids.has(t,r,n,this._flags.insensitive)&&(l.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&&(l.push(this.createError("any.allowOnly",{value:t,valids:this._valids.values({stripUndefined:!0})},r,n)),n.abortEarly))return d();for(var b=0;b>>1,q=[["ary",A],["bind",b],["bindKey",v],["curry",w],["curryRight",S],["flip",C],["partial",E],["partialRight",k],["rearg",x]],H="[object Arguments]",z="[object Array]",V="[object AsyncFunction]",G="[object Boolean]",W="[object Date]",$="[object DOMException]",Y="[object Error]",J="[object Function]",Z="[object GeneratorFunction]",X="[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]",le="[object ArrayBuffer]",he="[object DataView]",de="[object Float32Array]",pe="[object Float64Array]",ye="[object Int8Array]",ge="[object Int16Array]",me="[object Int32Array]",be="[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,Ae=/&(?:amp|lt|gt|quot|#39);/g,xe=/[&<>"']/g,Ce=RegExp(Ae.source),Te=RegExp(xe.source),Ie=/<%-([\s\S]+?)%>/g,Be=/<%([\s\S]+?)%>/g,Oe=/<%=([\s\S]+?)%>/g,Pe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Re=/^\w*$/,Ne=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,je=/[\\^$.*+?()[\]{}|]/g,Le=RegExp(je.source),Me=/^\s+|\s+$/g,De=/^\s+/,Ue=/\s+$/,Fe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ke=/\{\n\/\* \[wrapped with (.+)\] \*/,qe=/,? & /,He=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ze=/\\(\\)?/g,Ve=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ge=/\w*$/,We=/^[-+]0x[0-9a-f]+$/i,$e=/^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",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",lt=" \\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",dt="\\ufe0e\\ufe0f",pt=ut+ct+"\\u2000-\\u206f"+lt,yt="['’]",gt="[\\ud800-\\udfff]",mt="["+pt+"]",bt="["+ot+"]",vt="\\d+",_t="[\\u2700-\\u27bf]",wt="["+at+"]",St="[^"+tt+pt+vt+st+at+ht+"]",Et="\\ud83c[\\udffb-\\udfff]",kt="(?:"+bt+"|"+Et+")",At="[^\\ud800-\\udfff]",xt="(?:\\ud83c[\\udde6-\\uddff]){2}",Ct="[\\ud800-\\udbff][\\udc00-\\udfff]",Tt="["+ht+"]",It="\\u200d",Bt="(?:"+wt+"|"+St+")",Ot="(?:"+Tt+"|"+St+")",Pt="(?:['’](?:d|ll|m|re|s|t|ve))?",Rt="(?:['’](?:D|LL|M|RE|S|T|VE))?",Nt=kt+"?",jt="[\\ufe0e\\ufe0f]?",Lt="(?:\\u200d(?:"+[At,xt,Ct].join("|")+")"+jt+Nt+")*",Mt="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Dt="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ut=jt+Nt+Lt,Ft="(?:"+[_t,xt,Ct].join("|")+")"+Ut,Kt="(?:"+[At+bt+"?",bt,xt,Ct,gt].join("|")+")",qt=RegExp("['’]","g"),Ht=RegExp(bt,"g"),zt=RegExp(Et+"(?="+Et+")|"+Kt+Ut,"g"),Vt=RegExp([Tt+"?"+wt+"+"+Pt+"(?="+[mt,Tt,"$"].join("|")+")",Ot+"+"+Rt+"(?="+[mt,Tt+Bt,"$"].join("|")+")",Tt+"?"+Bt+"+"+Pt,Tt+"+"+Rt,Dt,Mt,vt,Ft].join("|"),"g"),Gt=RegExp("["+It+tt+ot+dt+"]"),Wt=/[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[ye]=Jt[ge]=Jt[me]=Jt[be]=Jt[ve]=Jt[_e]=Jt[we]=!0,Jt[H]=Jt[z]=Jt[le]=Jt[G]=Jt[he]=Jt[W]=Jt[Y]=Jt[J]=Jt[X]=Jt[Q]=Jt[te]=Jt[ie]=Jt[oe]=Jt[se]=Jt[ce]=!1;var Zt={};Zt[H]=Zt[z]=Zt[le]=Zt[he]=Zt[G]=Zt[W]=Zt[de]=Zt[pe]=Zt[ye]=Zt[ge]=Zt[me]=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[ce]=!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={"&":"&","<":"<",">":">",'"':""","'":"'"},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,lr=function(){try{var e=ur&&ur.require&&ur.require("util").types;return e||fr&&fr.binding&&fr.binding("util")}catch(e){}}(),hr=lr&&lr.isArrayBuffer,dr=lr&&lr.isDate,pr=lr&&lr.isMap,yr=lr&&lr.isRegExp,gr=lr&&lr.isSet,mr=lr&&lr.isTypedArray;function br(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 Ar(e,t,r){for(var n=-1,i=null==e?0:e.length;++n-1;);return r}function Zr(e,t){for(var r=e.length;r--&&Lr(t,e[r],0)>-1;);return r}function Xr(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}var Qr=Kr(Xt),en=Kr(Qt);function tn(e){return"\\"+tr[e]}function rn(e,t){return null==e?o:e[t]}function nn(e){return Gt.test(e)}function on(e){return Wt.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 Fn(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 Kn(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function yi(e,t,r,n,i,s){var a,u=t&d,c=t&p,f=t&y;if(r&&(a=i?r(e,n,i,s):r(e)),a!==o)return a;if(!Ef(e))return e;var l=af(e);if(l){if(a=Qs(e),!u)return rs(e,a)}else{var h=Ys(e),g=h==J||h==Z;if(hf(e))return Go(e,u);if(h==te||h==H||g&&!i){if(a=c||g?{}:ea(e),!u)return c?os(e,li(a,e)):is(e,fi(a,e))}else{if(!Zt[h])return i?e:{};a=ta(e,h,u)}}s||(s=new Jn);var m=s.get(e);if(m)return m;if(s.set(e,a),Lf(e))return e.forEach(function(n){a.add(yi(n,t,r,n,e,s))}),a;if(Af(e))return e.forEach(function(n,i){a.set(i,yi(n,t,r,i,e,s))}),a;var b=f?c?Ds:Ms:c?Sl:wl,v=l?o:b(e);return _r(v||e,function(n,i){v&&(i=n,n=e[i]),ai(a,i,yi(n,t,r,i,e,s))}),a}function gi(e){var t=wl(e);return function(r){return mi(r,e,t)}}function mi(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 bi(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=xr(t,Wr(r))),n?(o=Ar,s=!1):t.length>=a&&(o=Yr,s=!1,t=new Wn(t));e:for(;++ii?0:i+r),n=n===o||n>i?i:Wf(n),n<0&&(n+=i),n=r>n?0:$f(n);r0&&r(a)?t>1?xi(a,t-1,r,n,i):Cr(i,a):n||(i[i.length]=a)}return i}var Ci=cs(),Ti=cs(!0);function Ii(e,t){return e&&Ci(e,t,wl)}function Bi(e,t){return e&&Ti(e,t,wl)}function Oi(e,t){return Er(t,function(t){return _f(e[t])})}function Pi(e,t){t=qo(t,e);for(var r=0,n=t.length;null!=e&&rt}function Li(e,t){return null!=e&&ft.call(e,t)}function Mi(e,t){return null!=e&&t in tt(e)}function Di(e,t,r){return e>=Kt(t,r)&&e=120&&h.length>=120)?new Wn(u&&h):o}h=e[0];var d=-1,p=c[0];e:for(;++d-1;)a!==e&&At.call(a,u,1),At.call(e,u,1);return e}function yo(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)?At.call(e,i,1):No(e,i)}}return e}function go(e,t){return e+Nt(Gt()*(t-e+1))}function mo(e,t,n,i){for(var o=-1,s=Ft(Rt((t-e)/(n||1)),0),a=r(s);s--;)a[i?s:++o]=e,e+=n;return a}function bo(e,t){var r="";if(!e||t<1||t>L)return r;do{t%2&&(r+=e),t=Nt(t/2),t&&(e+=e)}while(t);return r}function vo(e,t){return ka(ba(e,t,Ih),e+"")}function _o(e){return ni(Fl(e))}function wo(e,t){var r=Fl(e);return Ca(r,pi(t,0,r.length))}function So(e,t,r,n){if(!Ef(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),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:Cs(e);if(f)return fn(f);s=!1,i=Yr,c=new Wn}else c=t?[]:u;e:for(;++n=n?e:xo(e,t,r)}var Vo=Bt||function(e){return sr.clearTimeout(e)};function Go(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 Wo(e){var t=new e.constructor(e.byteLength);return new _t(t).set(new _t(e)),t}function $o(e,t){var r=t?Wo(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function Yo(e){var t=new e.constructor(e.source,Ge.exec(e));return t.lastIndex=e.lastIndex,t}function Jo(e){return mn?tt(mn.call(e)):{}}function Zo(e,t){var r=t?Wo(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Xo(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=Ft(s-a,0),l=r(c+f),h=!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 gs(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"==Fs(s))var a=new kn([],!0)}for(n=a?n:r;++n1&&b.reverse(),h&&fu))return!1;var f=s.get(e);if(f&&s.get(t))return f==t;var l=-1,h=!0,d=r&m?new Wn:o;for(s.set(e,t),s.set(t,e);++l1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(Fe,"{\n/* [wrapped with "+t+"] */\n")}function na(e){return af(e)||sf(e)||!!(xt&&e&&e[xt])}function ia(e,t){var r=typeof e;return t=null==t?L:t,!!t&&("number"==r||"symbol"!=r&&Ze.test(e))&&e>-1&&e%1==0&&e0){if(++t>=B)return arguments[0]}else t=0;return e.apply(o,arguments)}}function Ca(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,Nu(e,r)});function Hu(e){var t=_n(e);return t.__chain__=!0,t}function zu(e,t){return t(e),e}function Vu(e,t){return t(e)}var Gu=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 An&&ia(r)?(n=n.slice(r,+r+(t?1:0)),n.__actions__.push({func:Vu,args:[i],thisArg:o}),new kn(n,this.__chain__).thru(function(e){return t&&!e.length&&e.push(o),e})):this.thru(i)});function Wu(){return Hu(this)}function $u(){return new kn(this.value(),this.__chain__)}function Yu(){this.__values__===o&&(this.__values__=Vf(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,r=this;r instanceof En;){var n=Pa(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 Xu(){var e=this.__wrapped__;if(e instanceof An){var t=e;return this.__actions__.length&&(t=new An(this)),t=t.reverse(),t.__actions__.push({func:Vu,args:[hu],thisArg:o}),new kn(t,this.__chain__)}return this.thru(hu)}function Qu(){return Mo(this.__wrapped__,this.__actions__)}var ec=ss(function(e,t,r){ft.call(e,r)?++e[r]:hi(e,r,1)});function tc(e,t,r){var n=af(e)?Sr:Si;return r&&oa(e,t,r)&&(t=o),n(e,qs(t,3))}function rc(e,t){var r=af(e)?Er:Ai;return r(e,qs(t,3))}var nc=ys(za),ic=ys(Va);function oc(e,t){return xi(pc(e,t),1)}function sc(e,t){return xi(pc(e,t),j)}function ac(e,t,r){return r=r===o?1:Wf(r),xi(pc(e,t),r)}function uc(e,t){var r=af(e)?_r:_i;return r(e,qs(t,3))}function cc(e,t){var r=af(e)?wr:wi;return r(e,qs(t,3))}var fc=ss(function(e,t,r){ft.call(e,r)?e[r].push(t):hi(e,r,[t])});function lc(e,t,r,n){e=cf(e)?e:Fl(e),r=r&&!n?Wf(r):0;var i=e.length;return r<0&&(r=Ft(i+r,0)),Mf(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&Lr(e,t,r)>-1}var hc=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?br(t,e,n):Ki(e,t,n)}),s}),dc=ss(function(e,t,r){hi(e,r,t)});function pc(e,t){var r=af(e)?xr:no;return r(e,qs(t,3))}function yc(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 gc=ss(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]});function mc(e,t,r){var n=af(e)?Tr:qr,i=arguments.length<3;return n(e,qs(t,4),r,i,_i)}function bc(e,t,r){var n=af(e)?Ir:qr,i=arguments.length<3;return n(e,qs(t,4),r,i,wi)}function vc(e,t){var r=af(e)?Er:Ai;return r(e,Uc(qs(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:Wf(t);var n=af(e)?ii:wo;return n(e,t)}function Sc(e){var t=af(e)?oi:Ao;return t(e)}function Ec(e){if(null==e)return 0;if(cf(e))return Mf(e)?pn(e):e.length;var t=Ys(e);return t==X||t==oe?e.size:eo(e).length}function kc(e,t,r){var n=af(e)?Br:Co;return r&&oa(e,t,r)&&(t=o),n(e,qs(t,3))}var Ac=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,xi(t,1),[])}),xc=Ot||function(){return sr.Date.now()};function Cc(e,t){if("function"!=typeof t)throw new it(c);return e=Wf(e),function(){if(--e<1)return t.apply(this,arguments)}}function Tc(e,t,r){return t=r?o:t,t=e&&null==t?e.length:t,Is(e,A,o,o,o,o,t)}function Ic(e,t){var r;if("function"!=typeof t)throw new it(c);return e=Wf(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=o),r}}var Bc=vo(function(e,t,r){var n=b;if(r.length){var i=cn(r,Ks(Bc));n|=E}return Is(e,n,t,r,i)}),Oc=vo(function(e,t,r){var n=b|v;if(r.length){var i=cn(r,Ks(Oc));n|=E}return Is(t,n,e,r,i)});function Pc(e,t,r){t=r?o:t;var n=Is(e,w,o,o,o,o,o,t);return n.placeholder=Pc.placeholder,n}function Rc(e,t,r){t=r?o:t;var n=Is(e,S,o,o,o,o,o,t);return n.placeholder=Rc.placeholder,n}function Nc(e,t,r){var n,i,s,a,u,f,l=0,h=!1,d=!1,p=!0;if("function"!=typeof e)throw new it(c);function y(t){var r=n,s=i;return n=i=o,l=t,a=e.apply(s,r),a}function g(e){return l=e,u=Ea(v,t),h?y(e):a}function m(e){var r=e-f,n=e-l,i=t-r;return d?Kt(i,s-n):i}function b(e){var r=e-f,n=e-l;return f===o||r>=t||r<0||d&&n>=s}function v(){var e=xc();if(b(e))return _(e);u=Ea(v,m(e))}function _(e){return u=o,p&&n?y(e):(n=i=o,a)}function w(){u!==o&&Vo(u),l=0,n=f=i=u=o}function S(){return u===o?a:_(xc())}function E(){var e=xc(),r=b(e);if(n=arguments,i=this,f=e,r){if(u===o)return g(f);if(d)return u=Ea(v,t),y(f)}return u===o&&(u=Ea(v,t)),a}return t=Yf(t)||0,Ef(r)&&(h=!!r.leading,d="maxWait"in r,s=d?Ft(Yf(r.maxWait)||0,t):s,p="trailing"in r?!!r.trailing:p),E.cancel=w,E.flush=S,E}var jc=vo(function(e,t){return bi(e,1,t)}),Lc=vo(function(e,t,r){return bi(e,Yf(t)||0,r)});function Mc(e){return Is(e,C)}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||Kn),r}function Uc(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 Fc(e){return Ic(2,e)}Dc.Cache=Kn;var Kc=Ho(function(e,t){t=1==t.length&&af(t[0])?xr(t[0],Wr(qs())):xr(xi(t,1),Wr(qs()));var r=t.length;return vo(function(n){for(var i=-1,o=Kt(n.length,r);++i=t}),sf=qi(function(){return arguments}())?qi:function(e){return kf(e)&&ft.call(e,"callee")&&!kt.call(e,"callee")},af=r.isArray,uf=hr?Wr(hr):Hi;function cf(e){return null!=e&&Sf(e.length)&&!_f(e)}function ff(e){return kf(e)&&cf(e)}function lf(e){return!0===e||!1===e||kf(e)&&Ni(e)==G}var hf=Lt||Wh,df=dr?Wr(dr):zi;function pf(e){return kf(e)&&1===e.nodeType&&!Rf(e)}function yf(e){if(null==e)return!0;if(cf(e)&&(af(e)||"string"==typeof e||"function"==typeof e.splice||hf(e)||Uf(e)||sf(e)))return!e.length;var t=Ys(e);if(t==X||t==oe)return!e.size;if(la(e))return!eo(e).length;for(var r in e)if(ft.call(e,r))return!1;return!0}function gf(e,t){return Vi(e,t)}function mf(e,t,r){r="function"==typeof r?r:o;var n=r?r(e,t):o;return n===o?Vi(e,t,o,r):!!n}function bf(e){if(!kf(e))return!1;var t=Ni(e);return t==Y||t==$||"string"==typeof e.message&&"string"==typeof e.name&&!Rf(e)}function vf(e){return"number"==typeof e&&Mt(e)}function _f(e){if(!Ef(e))return!1;var t=Ni(e);return t==J||t==Z||t==V||t==ne}function wf(e){return"number"==typeof e&&e==Wf(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 Af=pr?Wr(pr):Wi;function xf(e,t){return e===t||$i(e,t,zs(t))}function Cf(e,t,r){return r="function"==typeof r?r:o,$i(e,t,zs(t),r)}function Tf(e){return Pf(e)&&e!=+e}function If(e){if(fa(e))throw new i(u);return Yi(e)}function Bf(e){return null===e}function Of(e){return null==e}function Pf(e){return"number"==typeof e||kf(e)&&Ni(e)==Q}function Rf(e){if(!kf(e)||Ni(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)==yt}var Nf=yr?Wr(yr):Ji;function jf(e){return wf(e)&&e>=-L&&e<=L}var Lf=gr?Wr(gr):Zi;function Mf(e){return"string"==typeof e||!af(e)&&kf(e)&&Ni(e)==se}function Df(e){return"symbol"==typeof e||kf(e)&&Ni(e)==ae}var Uf=mr?Wr(mr):Xi;function Ff(e){return e===o}function Kf(e){return kf(e)&&Ys(e)==ce}function qf(e){return kf(e)&&Ni(e)==fe}var Hf=ks(ro),zf=ks(function(e,t){return e<=t});function Vf(e){if(!e)return[];if(cf(e))return Mf(e)?yn(e):rs(e);if(Ct&&e[Ct])return sn(e[Ct]());var t=Ys(e),r=t==X?an:t==oe?fn:Fl;return r(e)}function Gf(e){if(!e)return 0===e?e:0;if(e=Yf(e),e===j||e===-j){var t=e<0?-1:1;return t*M}return e==e?e:0}function Wf(e){var t=Gf(e),r=t%1;return t==t?r?t-r:t:0}function $f(e){return e?pi(Wf(e),0,U):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(Me,"");var r=$e.test(e);return r||Je.test(e)?nr(e.slice(2),r?2:8):We.test(e)?D:+e}function Jf(e){return ns(e,Sl(e))}function Zf(e){return e?pi(Wf(e),-L,L):0===e?e:0}function Xf(e){return null==e?"":Po(e)}var Qf=as(function(e,t){if(la(t)||cf(t))ns(t,wl(t),e);else for(var r in t)ft.call(t,r)&&ai(e,r,t[r])}),el=as(function(e,t){ns(t,Sl(t),e)}),tl=as(function(e,t,r,n){ns(t,Sl(t),e,n)}),rl=as(function(e,t,r,n){ns(t,wl(t),e,n)}),nl=Ls(di);function il(e,t){var r=Sn(e);return null==t?r:fi(r,t)}var ol=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=yi(r,d|p|y,Ps));for(var i=t.length;i--;)No(r,t[i]);return r});function Tl(e,t){return Bl(e,Uc(qs(t)))}var Il=Ls(function(e,t){return null==e?{}:fo(e,t)});function Bl(e,t){if(null==e)return{};var r=xr(Ds(e),function(e){return[e]});return t=qs(t),lo(e,r,function(e,r){return t(e,r[0])})}function Ol(e,t,r){t=qo(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=Gt();return Kt(e+i*(t-e+rr("1e-"+((i+"").length-1))),t)}return go(e,t)}var Vl=hs(function(e,t,r){return t=t.toLowerCase(),e+(r?Gl(t):t)});function Gl(e){return vh(Xf(e).toLowerCase())}function Wl(e){return e=Xf(e),e&&e.replace(Xe,Qr).replace(Ht,"")}function $l(e,t,r){e=Xf(e),t=Po(t);var n=e.length;r=r===o?n:pi(Wf(r),0,n);var i=r;return r-=t.length,r>=0&&e.slice(r,i)==t}function Yl(e){return e=Xf(e),e&&Te.test(e)?e.replace(xe,en):e}function Jl(e){return e=Xf(e),e&&Le.test(e)?e.replace(je,"\\$&"):e}var Zl=hs(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),Xl=hs(function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}),Ql=ls("toLowerCase");function eh(e,t,r){e=Xf(e),t=Wf(t);var n=t?pn(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return ws(Nt(i),r)+e+ws(Rt(i),r)}function th(e,t,r){e=Xf(e),t=Wf(t);var n=t?pn(e):0;return t&&n>>0,r?(e=Xf(e),e&&("string"==typeof t||null!=t&&!Nf(t))&&(t=Po(t),!t&&nn(e))?zo(yn(e),0,r):e.split(t,r)):[]}var uh=hs(function(e,t,r){return e+(r?" ":"")+vh(t)});function ch(e,t,r){return e=Xf(e),r=null==r?0:pi(Wf(r),0,e.length),t=Po(t),e.slice(r,r+t.length)==t}function fh(e,t,r){var n=_n.templateSettings;r&&oa(e,t,r)&&(t=o),e=Xf(e),t=tl({},t,n,Bs);var i=tl({},t.imports,n.imports,Bs),s=wl(i),a=$r(i,s),u,c,f=0,l=t.interpolate||Qe,h="__p += '",d=rt((t.escape||Qe).source+"|"+l.source+"|"+(l===Oe?Ve: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),h+=e.slice(f,s).replace(et,tn),r&&(u=!0,h+="' +\n__e("+r+") +\n'"),o&&(c=!0,h+="';\n"+o+";\n__p += '"),n&&(h+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),f=s+t.length,t}),h+="';\n";var y=t.variable;y||(h="with (obj) {\n"+h+"\n}\n"),h=(c?h.replace(Se,""):h).replace(Ee,"$1").replace(ke,"$1;"),h="function("+(y||"obj")+") {\n"+(y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(u?", __e = _.escape":"")+(c?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var g=wh(function(){return N(s,p+"return "+h).apply(o,a)});if(g.source=h,bf(g))throw g;return g}function lh(e){return Xf(e).toLowerCase()}function hh(e){return Xf(e).toUpperCase()}function dh(e,t,r){if(e=Xf(e),e&&(r||t===o))return e.replace(Me,"");if(!e||!(t=Po(t)))return e;var n=yn(e),i=yn(t),s=Jr(n,i),a=Zr(n,i)+1;return zo(n,s,a).join("")}function ph(e,t,r){if(e=Xf(e),e&&(r||t===o))return e.replace(Ue,"");if(!e||!(t=Po(t)))return e;var n=yn(e),i=Zr(n,yn(t))+1;return zo(n,0,i).join("")}function yh(e,t,r){if(e=Xf(e),e&&(r||t===o))return e.replace(De,"");if(!e||!(t=Po(t)))return e;var n=yn(e),i=Jr(n,yn(t));return zo(n,i).join("")}function gh(e,t){var r=T,n=I;if(Ef(t)){var i="separator"in t?t.separator:i;r="length"in t?Wf(t.length):r,n="omission"in t?Po(t.omission):n}e=Xf(e);var s=e.length;if(nn(e)){var a=yn(e);s=a.length}if(r>=s)return e;var u=r-pn(n);if(u<1)return n;var c=a?zo(a,0,u).join(""):e.slice(0,u);if(i===o)return c+n;if(a&&(u+=c.length-u),Nf(i)){if(e.slice(u).search(i)){var f,l=c;for(i.global||(i=rt(i.source,Xf(Ge.exec(i))+"g")),i.lastIndex=0;f=i.exec(l);)var h=f.index;c=c.slice(0,h===o?u:h)}}else if(e.indexOf(Po(i),u)!=u){var d=c.lastIndexOf(i);d>-1&&(c=c.slice(0,d))}return c+n}function mh(e){return e=Xf(e),e&&Ce.test(e)?e.replace(Ae,gn):e}var bh=hs(function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}),vh=ls("toUpperCase");function _h(e,t,r){return e=Xf(e),t=r?o:t,t===o?on(e)?vn(e):Rr(e):e.match(t)||[]}var wh=vo(function(e,t){try{return br(e,o,t)}catch(e){return bf(e)?e:new i(e)}}),Sh=Ls(function(e,t){return _r(t,function(t){t=Ia(t),hi(e,t,Bc(e[t],e))}),e});function Eh(e){var t=null==e?0:e.length,r=qs();return e=t?xr(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=U,n=Kt(e,U);t=qs(t),e-=U;for(var i=Vr(n,t);++r0||t<0)?new An(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==o&&(t=Wf(t),r=t<0?r.dropRight(-t):r.take(t-e)),r)},An.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},An.prototype.toArray=function(){return this.take(U)},Ii(An.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 An,c=a[0],f=u||af(t),l=function(e){var t=i.apply(_n,Cr([e],a));return n&&h?t[0]:t};f&&r&&"function"==typeof c&&1!=c.length&&(u=f=!1);var h=this.__chain__,d=!!this.__actions__.length,p=s&&!h,y=u&&!d;if(!s&&f){t=y?t:new An(this);var g=e.apply(t,a);return g.__actions__.push({func:Vu,args:[l],thisArg:o}),new kn(g,h)}return p&&y?e.apply(this,a):(g=this.thru(l),p?n?g.value()[0]:g.value():g)})}),_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)})}}),Ii(An.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[ms(o,v).name]=[{name:"wrapper",func:o}],An.prototype.clone=xn,An.prototype.reverse=Cn,An.prototype.value=Tn,_n.prototype.at=Gu,_n.prototype.chain=Wu,_n.prototype.commit=$u,_n.prototype.next=Yu,_n.prototype.plant=Zu,_n.prototype.reverse=Xu,_n.prototype.toJSON=_n.prototype.valueOf=_n.prototype.value=Qu,_n.prototype.first=_n.prototype.head,Ct&&(_n.prototype[Ct]=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(10),r(32)(e))},function(e,t,r){"use strict";const n=r(258),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){var n=r(1562);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=[],l=!1,h=!1,d,p;function y(){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&&g()}else u>=c&&h&&(d=null,e(h))}}var g=n(function(){if(l=!0,h)return y();i||t&&a-t>=u||(i=!0,s(o,function(t,n){if(i=!1,t)c=a,h=t,y();else{var o=a++;e(n,function(e,t){r?f[o]=t:f.push(t),e&&(p=e),y()}),h||g()}}))});return function(e,t){e?s(h=o=e,function(e){if(t)return t(e)}):(d=t,l||g(),y())}}}},function(e,t,r){"use strict";const n=r(9),i=r(30),{DAGNode:o,DAGLink:s}=i,a=r(6),u=(e,t,r)=>(t=Object.assign({},{parent:void 0,child:void 0,name:"",flush:!0},t),t.parent?t.child?void a([e=>{if(t.name)return o.rmLink(t.parent,t.name,e);e(null,t.parent)},(e,r)=>{o.addLink(e,new s(t.name,t.child.size,t.child.hash||t.child.multihash),r)},(r,i)=>{if(!t.flush)return i(null,r);e.dag.put(r,{cid:new n(r.hash||r.multihash)},e=>i(e,r))}],r):r(new Error("No child passed to addLink")):r(new Error("No parent passed to addLink")));e.exports=u},function(e,t,r){"use strict";const n=r(190).exporter,i=r(70),o=r(273),s=r(159),a=r(72),u=r(91),c=r(40),{traverseTo:f,createLock:l}=r(54),h=r(5)("ipfs:mfs:read-pull-stream"),d={offset:0,length:void 0};e.exports=(e=>(function t(r,p={}){p=Object.assign({},d,p),h(`Reading ${r}`);const y=a.source();return i(o(r),s((t,r)=>{l().readLock(r=>{f(e,t,{parents:!1},r)})(r)}),s((t,o)=>{const s=t.node,a=c.unmarshal(s.data);if("file"!==a.type)return o(new Error(`${r} was not a file`));h(`Getting ${r} content`),i(n(s.multihash,e.dag,{offset:p.offset,length:p.length}),u((e,t)=>{o(e,e?null:t[0].content)}))}),u((e,t)=>e?y.abort(e):t.length?(h(`Got ${r} content`),void y.resolve(t[0])):y.abort(new Error(`Could not load content stream from ${r}`)))),y}))},function(e,t,r){"use strict";(function(t){const n=r(2),i=r(192),o=r(26),s=r(259),a=r(0).Buffer,u=r(260).isSource,c=r(147),f=r(193);e.exports=(e=>{const r=f(e,"add"),l=n((e,n,f)=>{"function"==typeof n&&(f=n,n=null);const l=o(f);n||(n={}),n.converter=c;const h=t.isBuffer(e)||s.readable(e)||Array.isArray(e)||a.isBuffer(e)||"object"==typeof e||u(e);if(!h)return l(new Error("first arg must be a buffer, readable stream, pull stream, an object or array of objects"));const d=[].concat(e),p=r({qs:n}),y=i(e=>l(null,e));p.once("error",l),p.pipe(y),d.forEach(e=>p.write(e)),p.end()});return function(){const e=Array.from(arguments);return 1===e.length&&u(e[0])&&e.push({}),l.apply(null,e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(53),i=r(1640),o=r(12).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},l=function e(t){for(var r=[{obj:{o:t},prop:"o"}],n=[],i=0;i{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){"use strict";const n=r(12).Transform,i=r(1725);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(63);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.99.4"}},function(e,t,r){"use strict";(function(t,n){var i=r(202);e.exports=E;var o=r(382),s;E.ReadableState=S;var a=r(11).EventEmitter,u=function(e,t){return e.listeners(t).length},c=r(383),f=r(4).Buffer,l=t.Uint8Array||function(){};function h(e){return f.from(e)}function d(e){return f.isBuffer(e)||e instanceof l}var p=r(155);p.inherits=r(1);var y=r(737),g=void 0;g=y&&y.debuglog?y.debuglog("stream"):function(){};var m=r(738),b=r(385),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(103),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 m,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(55).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function E(e){if(s=s||r(103),!(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,O(e,o)):(i||(s=x(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=h(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):A(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?A(e,o,t,!1):N(e,o)):A(e,o,t,!1))):n||(o.reading=!1));return C(o)}function A(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&&P(e)),N(e,t)}function x(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 C(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function B(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=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(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,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(R,e):R(e))}function R(e){g("emit readable"),e.emit("readable"),F(e)}function N(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(j,e,t))}function j(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=q(e,t.buffer,t.decoder),r);var r}function q(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 z(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 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(G,t,e))}function G(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):P(this),null;if(e=B(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var n=t.needReadable,i;return g("need readable",n),(0===t.length||t.length-e0?K(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&&V(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,g("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){g("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function f(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",c);var l=L(r);e.on("drain",l);var h=!1;function d(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",l),e.removeListener("error",m),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",y),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||l()}var p=!1;function y(t){g("ondata"),p=!1;var n=e.write(t);!1!==n||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!h&&(g("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function m(t){g("onerror",t),_(),e.removeListener("error",m),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"),r.unpipe(e)}return r.on("data",y),w(e,"error",m),e.once("close",b),e.once("finish",v),e.emit("pipe",r),o.flowing||(g("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,f=-7,l=r?i-1:0,h=r?-1:1,d=e[t+l];for(l+=h,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=256*o+e[t+l],l+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+e[t+l],l+=h,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,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+l>=1?h/u:h*Math.pow(2,1-l),t*u>=2&&(s++,u/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(t*u-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-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*y}},function(e,t,r){"use strict";var n=r(202);function i(e,t){var r=this,i=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return i||o?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||n.nextTick(s,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(n.nextTick(s,r,e),r._writableState&&(r._writableState.errorEmitted=!0)):t&&t(e)}),this)}function o(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function s(e,t){e.emit("error",t)}e.exports={destroy:i,undestroy:o}},function(e,t,r){"use strict";e.exports=s;var n=r(103),i=r(155);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{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,12,"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={}){let r=new Headers;(t.start||t.end)&&r.append("range",`bytes=${t.start||0}-${t.end<1/0?t.end:""}`);let n={method:"GET",headers:r,mode:"cors",cache:"default",redirect:"follow",keepalive:!0};return httptools.p_httpfetch(e,n,{wantstream:t.wantstream})},httptools.p_POST=function(e,t,r){let n={method:"POST",headers:{},body:r,mode:"cors",cache:"default",redirect:"follow",keepalive:!0};return httptools.p_httpfetch(e,n)},t=e.exports=httptools}).call(this,r(0).Buffer)},function(e,t,r){"use strict";class n{constructor(e){this._repo=e,this._bitswap=null}setExchange(e){this._bitswap=e}unsetExchange(){this._bitswap=null}hasExchange(){return null!=this._bitswap}put(e,t){if(this.hasExchange())return this._bitswap.put(e,t);this._repo.blocks.put(e,t)}putMany(e,t){if(this.hasExchange())return this._bitswap.putMany(e,t);this._repo.blocks.putMany(e,t)}get(e,t){return this.hasExchange()?this._bitswap.get(e,t):this._repo.blocks.get(e,t)}delete(e,t){this._repo.blocks.delete(e,t)}}e.exports=n},function(e,t,r){"use strict";t.names=Object.freeze({id:0,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,"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}),t.codes=Object.freeze({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",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"}),t.defaultLengths=Object.freeze({17:20,18:32,19:64,86:32,23:28,22:32,21:48,20:64,24:32,25:64,26:28,27:32,28:48,29:64,34:32,45569:1,45570:2,45571:3,45572:4,45573:5,45574:6,45575:7,45576:8,45577:9,45578:10,45579:11,45580:12,45581:13,45582:14,45583:15,45584:16,45585:17,45586:18,45587:19,45588:20,45589:21,45590:22,45591:23,45592:24,45593:25,45594:26,45595:27,45596:28,45597:29,45598:30,45599:31,45600:32,45601:33,45602:34,45603:35,45604:36,45605:37,45606:38,45607:39,45608:40,45609:41,45610:42,45611:43,45612:44,45613:45,45614:46,45615:47,45616:48,45617:49,45618:50,45619:51,45620:52,45621:53,45622:54,45623:55,45624:56,45625:57,45626:58,45627:59,45628:60,45629:61,45630:62,45631:63,45632:64,45633:1,45634:2,45635:3,45636:4,45637:5,45638:6,45639:7,45640:8,45641:9,45642:10,45643:11,45644:12,45645:13,45646:14,45647:15,45648:16,45649:17,45650:18,45651:19,45652:20,45653:21,45654:22,45655:23,45656:24,45657:25,45658:26,45659:27,45660:28,45661:29,45662:30,45663:31,45664:32,45825:1,45826:2,45827:3,45828:4,45829:5,45830:6,45831:7,45832:8,45833:9,45834:10,45835:11,45836:12,45837:13,45838:14,45839:15,45840:16,45841:17,45842:18,45843:19,45844:20,45845:21,45846:22,45847:23,45848:24,45849:25,45850:26,45851:27,45852:28,45853:29,45854:30,45855:31,45856:32,45857:1,45858:2,45859:3,45860:4,45861:5,45862:6,45863:7,45864:8,45865:9,45866:10,45867:11,45868:12,45869:13,45870:14,45871:15,45872:16,45873:17,45874:18,45875:19,45876:20,45877:21,45878:22,45879:23,45880:24,45881:25,45882:26,45883:27,45884:28,45885:29,45886:30,45887:31,45888:32,45889:33,45890:34,45891:35,45892:36,45893:37,45894:38,45895:39,45896:40,45897:41,45898:42,45899:43,45900:44,45901:45,45902:46,45903:47,45904:48,45905:49,45906:50,45907:51,45908:52,45909:53,45910:54,45911:55,45912:56,45913:57,45914:58,45915:59,45916:60,45917:61,45918:62,45919:63,45920:64,45921:1,45922:2,45923:3,45924:4,45925:5,45926:6,45927:7,45928:8,45929:9,45930:10,45931:11,45932:12,45933:13,45934:14,45935:15,45936:16,45937:17,45938:18,45939:19,45940:20,45941:21,45942:22,45943:23,45944:24,45945:25,45946:26,45947:27,45948:28,45949:29,45950:30,45951:31,45952:32,45953:33,45954:34,45955:35,45956:36,45957:37,45958:38,45959:39,45960:40,45961:41,45962:42,45963:43,45964:44,45965:45,45966:46,45967:47,45968:48,45969:49,45970:50,45971:51,45972:52,45973:53,45974:54,45975:55,45976:56,45977:57,45978:58,45979:59,45980:60,45981:61,45982:62,45983:63,45984:64,45985:65,45986:66,45987:67,45988:68,45989:69,45990:70,45991:71,45992:72,45993:73,45994:74,45995:75,45996:76,45997:77,45998:78,45999:79,46000:80,46001:81,46002:82,46003:83,46004:84,46005:85,46006:86,46007:87,46008:88,46009:89,46010:90,46011:91,46012:92,46013:93,46014:94,46015:95,46016:96,46017:97,46018:98,46019:99,46020:100,46021:101,46022:102,46023:103,46024:104,46025:105,46026:106,46027:107,46028:108,46029:109,46030:110,46031:111,46032:112,46033:113,46034:114,46035:115,46036:116,46037:117,46038:118,46039:119,46040:120,46041:121,46042:122,46043:123,46044:124,46045:125,46046:126,46047:127,46048:128})},function(e,t,r){"use strict";(function(n){const i=r(748);t=e.exports=s,t.encode=a,t.decode=u,t.isEncoded=c,t.names=Object.freeze(Object.keys(i.names)),t.codes=Object.freeze(Object.keys(i.codes));const o=new Error("Unsupported encoding");function s(e,t){if(!t)throw new Error("requires an encoded buffer");const r=l(e),i=n.from(r.code),o=r.name;return f(o,t),n.concat([i,t])}function a(e,t){const r=l(e),i=r.name;return s(i,n.from(r.encode(t)))}function u(e){n.isBuffer(e)&&(e=e.toString());const t=e.substring(0,1);e=e.substring(1,e.length),"string"==typeof e&&(e=n.from(e));const r=l(t);return n.from(r.decode(e.toString()))}function c(e){if(n.isBuffer(e)&&(e=e.toString()),"[object String]"!==Object.prototype.toString.call(e))return!1;const t=e.substring(0,1);try{const e=l(t);return e.name}catch(e){return!1}}function f(e,t){const r=l(e);r.decode(t.toString())}function l(e){let t;if(i.names[e])t=i.names[e];else{if(!i.codes[e])throw o;t=i.codes[e]}if(!t.isImplemented())throw new Error("Base "+e+" is not implemented yet");return t}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(22);function i(e){return parseInt(e.toString("hex"),16)}function o(e){let r=e.toString(16);return r.length%2==1&&(r="0"+r),t.from(r,"hex")}function s(e){return t.from(n.encode(i(e)))}function a(e){return o(n.decode(e))}e.exports={numberToBuffer:o,bufferToNumber:i,varintBufferEncode:s,varintBufferDecode:a}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(204),i={};e.exports=i;for(let e in n){let t=n[e];i[t.toString("hex")]=e}},function(e,t){e.exports=function e(t,r,n){t(r),n&&n(!0===r?null:r)}},function(e,t,r){"use strict";e.exports=function e(t){return function(e,r){r(t)}}},function(e,t,r){"use strict";function n(e){return e}var i=r(158);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){var n=r(158);function i(e){return e}e.exports=function e(t){return"object"==typeof t&&"function"==typeof t.test?function(e){return t.test(e)}:n(t)||i}},function(e,t,r){"use strict";e.exports=function e(t,r){var n=!1;function i(e){!n&&r&&(n=!0,r(!0===e?null:e))}return function(e){return function(r,n){return r&&i(r),e(r,function(e,r){e?i(e):t&&t(r),n(e,r)})}}}},function(e,t,r){"use strict";function n(e){return e}var i=r(158),o=r(160);e.exports=function e(t,r){t=i(t)||n;var s={};return o(function(e){var n=t(e);return s[n]?!!r:(s[n]=!0,!r)})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var n=r(59),i=l(n),o=r(125),s=l(o),a=r(126),u=l(a),c=r(37),f=l(c);function l(e){return e&&e.__esModule?e:{default:e}}function h(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,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(){var t=(0,i.default)(arguments),r=t.pop();e.call(this,t,r)}};var n=r(125),i=o(n);function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var n=r(59),i=l(n),o=r(92),s=l(o),a=r(125),u=l(a),c=r(37),f=l(c);function l(e){return e&&e.__esModule?e:{default:e}}function h(e,t,r){r=r||i.default;var n=(0,s.default)(t)?[]:{};e(t,function(e,t,r){(0,f.default)(e)(function(e,i){arguments.length>2&&(i=(0,u.default)(arguments,1)),n[t]=i,r(e)})},function(e){r(e,n)})}e.exports=t.default},function(e,t,r){(function(t){var r="object"==typeof t&&t&&t.Object===Object&&t;e.exports=r}).call(this,r(10))},function(e,t){var r=9007199254740991;function n(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}e.exports=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(277),i=a(n),o=r(37),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){var n=r(406),i=r(783),o=r(92);function s(e){return o(e)?n(e):i(e)}e.exports=s},function(e,t,r){var n=r(777),i=r(278),o=r(81),s=r(407),a=r(408),u=r(409),c=Object.prototype,f=c.hasOwnProperty;function l(e,t){var r=o(e),c=!r&&i(e),l=!r&&!c&&s(e),h=!r&&!c&&!l&&u(e),d=r||c||l||h,p=d?n(e.length,String):[],y=p.length;for(var g in e)!t&&!f.call(e,g)||d&&("length"==g||l&&("offset"==g||"parent"==g)||h&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||a(g,y))||p.push(g);return p}e.exports=l},function(e,t,r){(function(e){var n=r(128),i=r(779),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(32)(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&&e1&&this._buf[this._buf.length-1]===s;)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(71);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){(function(t){var r="Expected a function",n="__lodash_hash_undefined__",i=1/0,o=9007199254740991,s="[object Function]",a="[object GeneratorFunction]",u="[object Symbol]",c=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,f=/^\w*$/,l=/^\./,h=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,d=/[\\^$.*+?()[\]{}|]/g,p=/\\(\\)?/g,y=/^\[object .+?Constructor\]$/,g=/^(?:0|[1-9]\d*)$/,m="object"==typeof t&&t&&t.Object===Object&&t,b="object"==typeof self&&self&&self.Object===Object&&self,v=m||b||Function("return this")();function _(e,t){return null==e?void 0:e[t]}function w(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}var S=Array.prototype,E=Function.prototype,k=Object.prototype,A=v["__core-js_shared__"],x=(C=/[^.]+$/.exec(A&&A.keys&&A.keys.IE_PROTO||""),C?"Symbol(src)_1."+C:""),C,T=E.toString,I=k.hasOwnProperty,B=k.toString,O=RegExp("^"+T.call(I).replace(d,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),P=v.Symbol,R=S.splice,N=ce(v,"Map"),j=ce(Object,"create"),L=P?P.prototype:void 0,M=L?L.toString:void 0;function D(e){var t=-1,r=e?e.length:0;for(this.clear();++t-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 Z(e,t){var r=this.__data__,n=ie(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function X(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 Ce(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Te(e){return!!e&&"object"==typeof e}function Ie(e){return"symbol"==typeof e||Te(e)&&O.call(e)==c}function Be(e){return null==e?"":ae(e)}function Oe(e,t){return null!=e&&le(e,t,oe)}e.exports=Oe}).call(this,r(10))},function(e,t,r){"use strict";const n=r(797);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{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=h((t||"").toString().trim())}catch(e){return r(e)}r(null,n)})}),t.readme=o,t.parseShardFun=h,t.Prefix=c,t.Suffix=f,t.NextToLast=l},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";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<{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(129),i=r(439);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,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(59),i=a(n),o=r(37),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t,r,n){n=n||i.default,t=t||[];var o=[],a=0,u=(0,s.default)(r);e(t,function(e,t,r){var n=a++;u(e,function(e,t){o[n]=t,r(e)})},function(e){n(e,o)})}e.exports=t.default},function(e,t,r){"use strict";(function(e){const n=r(7);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){function r(e){return e&&"function"==typeof e.then}e.exports=r},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{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]={hash:n.multihash,name:n.name,size:n.size}});let o=r[i[1]];"Hash"===i[2]?o={"/":o.hash}:"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]={hash:n.multihash,name:n.name,size:n.size}});const r=t[i[0]];if(r)return n(null,{value:{"/":r.hash},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(857),o=r(33),s=r(9),a=r(6),u=r(7),c=r(861),f=r(450),l=42;function h(e){return"string"==typeof e&&(e=new s(e).buffer),new i.Tagged(l,n.concat([n.from("00","hex"),e]))}const d=new i.Decoder({tags:{[l]:e=>(e=e.slice(1),{"/":e})}});function p(e){let t;try{t=c(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);const t=Object.keys(e);if(1===t.length&&"/"===t[0])return h(e["/"]);if(t.length>0){let 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=p(e);r=i.encode(n)}catch(e){return u(()=>t(e))}u(()=>t(null,r))}),t.deserialize=((e,t)=>{let r;try{r=d.decodeFirst(e)}catch(e){return u(()=>t(e))}u(()=>t(null,r))}),t.cid=((e,r,n)=>{"function"==typeof r&&(n=r,r={}),r=r||{};const i=r.hashAlg||f.defaultHashAlg,u=void 0===r.version?1:r.version;a([r=>t.serialize(e,r),(e,t)=>o(e,i,t),(e,t)=>t(null,new s(u,f.multicodec,e))],n)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t,n){const i=r(384),o=r(218),s=r(859),a=r(289),u=r(219),c=r(448),f=r(449),l=r(36);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=>l.parse(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 h({size:e.length});return n.decodeFirst(e)}static decodeAll(e,r){"string"==typeof e&&(e=t.from(e,r||"hex"));const n=new h({size:e.length});return n.decodeAll(e)}}h.decodeFirst=h.decode,e.exports=h}).call(this,r(0).Buffer,r(10))},function(e,t,r){"use strict";const n=r(219),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";(function(n){const i=r(446),o=r(451);function s(e,t){return t=t||"/",0===Object.keys(e).length?[]:o(e).reduce(function(e,r){"object"==typeof r&&r["/"]&&this.update(void 0);const n=this.path.join(t);return""!==n&&e.push({path:n,value:r}),e},[])}t=e.exports,t.multicodec="dag-cbor",t.defaultHashAlg="sha2-256",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:""});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);const n=s(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("object"==typeof t.value&&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={},l=!0,h={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){h.isRoot||(h.parent.node[h.key]=e),h.node=e,t&&(l=!1)},delete:function(e){delete h.parent.node[h.key],e&&(l=!1)},remove:function(e){p(h.parent.node)?h.parent.node.splice(h.key,1):delete h.parent.node[h.key],e&&(l=!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(){l=!1}};if(!a)return h;function d(){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{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":l.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 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":l.deserialize(e.slice(r+1),t);break;case"tree":h.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(452),o=r(451);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(869).Block,i=r(9),o=r(18),s=r(33),a=r(6),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)},l=(e,t,n)=>{"function"==typeof t&&(n=t,t={}),t=t||{};const o=t.hashAlg||r(290).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)},h=e=>{const t=r(290).defaultHashAlg,n=o.encode(e,t),s=1,a=new i(1,"bitcoin-block",n);return a};e.exports={hashToCid:h,BITCOIN_BLOCK_HEADER_SIZE:80,cid:l,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 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=c,t.s1_256=f,t.g0_256=l,t.g1_256=h},function(e,t,r){"use strict";var n=r(73),i=r(164),o=r(456),s=r(49),a=n.sum32,u=n.sum32_4,c=n.sum32_5,f=o.ch32,l=o.maj32,h=o.s0_256,d=o.s1_256,p=o.g0_256,y=o.g1_256,g=i.BlockHash,m=[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=m,this.W=new Array(64)}n.inherits(b,g),e.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=function e(t,r){for(var n=this.W,i=0;i<16;i++)n[i]=t[r+i];for(;i=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(459),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],l=[0,1518500249,1859775393,2400959708,2840853838],h=[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 y(e,t,r,n,i,o,s,a){return p(e+(t^r^n)+o+s|0,a)+i|0}function g(e,t,r,n,i,o,s,a){return p(e+(t&r|~t&n)+o+s|0,a)+i|0}function m(e,t,r,n,i,o,s,a){return p(e+((t|~r)^n)+o+s|0,a)+i|0}function b(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,A=0;A<80;A+=1){var x,C;A<16?(x=y(r,n,i,o,d,e[a[A]],l[0],c[A]),C=v(_,w,S,E,k,e[u[A]],h[0],f[A])):A<32?(x=g(r,n,i,o,d,e[a[A]],l[1],c[A]),C=b(_,w,S,E,k,e[u[A]],h[1],f[A])):A<48?(x=m(r,n,i,o,d,e[a[A]],l[2],c[A]),C=m(_,w,S,E,k,e[u[A]],h[2],f[A])):A<64?(x=b(r,n,i,o,d,e[a[A]],l[3],c[A]),C=g(_,w,S,E,k,e[u[A]],h[3],f[A])):(x=v(r,n,i,o,d,e[a[A]],l[4],c[A]),C=y(_,w,S,E,k,e[u[A]],h[4],f[A])),r=d,d=o,o=p(i,10),i=n,n=x,_=k,k=E,E=p(S,10),S=w,w=C}var T=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=T},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(897),t.sha1=r(898),t.sha224=r(899),t.sha256=r(462),t.sha384=r(900),t.sha512=r(463)},function(e,t,r){var n=r(1),i=r(130),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 l(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 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,y=0|this._g,g=0|this._h,m=0;m<16;++m)t[m]=e.readInt32BE(4*m);for(;m<64;++m)t[m]=p(t[m-2])+t[m-7]+d(t[m-15])+t[m-16]|0;for(var b=0;b<64;++b){var v=g+h(a)+c(a,u,y)+s[b]+t[b]|0,_=l(r)+f(r,n,i)|0;g=y,y=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=y+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,r){var n=r(1),i=r(130),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 l(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 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 y(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 m(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,b=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,A=0|this._fl,x=0|this._gl,C=0|this._hl,T=0;T<32;T+=2)t[T]=e.readInt32BE(4*T),t[T+1]=e.readInt32BE(4*T+4);for(;T<160;T+=2){var I=t[T-30],B=t[T-30+1],O=d(I,B),P=p(B,I);I=t[T-4],B=t[T-4+1];var R=y(I,B),N=g(B,I),j=t[T-14],L=t[T-14+1],M=t[T-32],D=t[T-32+1],U=P+L|0,F=O+j+m(U,P)|0;U=U+N|0,F=F+R+m(U,N)|0,U=U+D|0,F=F+M+m(U,D)|0,t[T]=F,t[T+1]=U}for(var K=0;K<160;K+=2){F=t[K],U=t[K+1];var q=f(r,n,i),H=f(_,w,S),z=l(r,_),V=l(_,r),G=h(a,k),W=h(k,a),$=s[K],Y=s[K+1],J=c(a,u,b),Z=c(k,A,x),X=C+W|0,Q=v+G+m(X,C)|0;X=X+Z|0,Q=Q+J+m(X,Z)|0,X=X+Y|0,Q=Q+$+m(X,Y)|0,X=X+U|0,Q=Q+F+m(X,U)|0;var ee=V+H|0,te=z+q+m(ee,V)|0;v=b,C=x,b=u,x=A,u=a,A=k,k=E+X|0,a=o+Q+m(k,E)|0,o=i,E=S,i=n,S=w,n=r,w=_,_=X+ee|0,r=Q+te+m(_,X)|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+A|0,this._gl=this._gl+x|0,this._hl=this._hl+C|0,this._ah=this._ah+r+m(this._al,_)|0,this._bh=this._bh+n+m(this._bl,w)|0,this._ch=this._ch+i+m(this._cl,S)|0,this._dh=this._dh+o+m(this._dl,E)|0,this._eh=this._eh+a+m(this._el,k)|0,this._fh=this._fh+u+m(this._fl,A)|0,this._gh=this._gh+b+m(this._gl,x)|0,this._hh=this._hh+v+m(this._hl,C)|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){var n=r(295);function i(e){return e.name||e.toString().match(/function (.*?)\s*\(/)[1]}function o(e){return n.Nil(e)?"":i(e.constructor)}function s(e){return n.Function(e)?"":n.String(e)?JSON.stringify(e):e&&n.Object(e)?"":e}function a(e,t){Error.captureStackTrace&&Error.captureStackTrace(e,t)}function u(e){return n.Function(e)?e.toJSON?e.toJSON():i(e):n.Array(e)?"Array":e&&n.Object(e)?"Object":void 0!==e?e:""}function c(e,t,r){var n=s(t);return"Expected "+u(e)+", got"+(""!==r?" "+r:"")+(""!==n?" "+n:"")}function f(e,t,r){r=r||o(t),this.message=c(e,t,r),a(this,f),this.__type=e,this.__value=t,this.__valueTypeName=r}function l(e,t,r,n,i){var o='" of type ';return"key"===t&&(o='" with key type '),c('property "'+u(r)+o+u(e),n,i)}function h(e,t,r,n,i){e?(i=i||o(n),this.message=l(e,r,t,n,i)):this.message='Unexpected property "'+t+'"',a(this,f),this.__label=r,this.__property=t,this.__type=e,this.__value=n,this.__valueTypeName=i}function d(e,t){return new f(e,{},t)}function p(e,t,r){return e instanceof h?(t=t+"."+e.__property,e=new h(e.__type,t,e.__label,e.__value,e.__valueTypeName)):e instanceof f&&(e=new h(e.__type,t,r,e.__value,e.__valueTypeName)),a(e),e}f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,h.prototype=Object.create(Error.prototype),h.prototype.constructor=f,e.exports={TfTypeError:f,TfPropertyTypeError:h,tfCustomError:d,tfSubError:p,tfJSON:u,getValueTypeName:o}},function(e,t,r){const n=r(4).Buffer;function i(e,t,r){t=t||4,r=void 0===r||r;const n=e.length;if(0===n)return 0;if(n>t)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(132),o=r(35),s=r(74),a=r(468),u=r(64),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 l(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 h(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 l(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 l(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:l,fromPublicKey:h,fromWIF:d}},function(e,t,r){(function(t){var n=r(165);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(297),o=r(165),s=r(23),a=r(64),u=r(35),c=r(74),f=r(298);function l(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 h(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 y(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 g(e,t){let r;t=t||a.bitcoin;try{r=l(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=h(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:l,fromBech32:h,fromOutputScript:y,toBase58Check:d,toBech32:p,toOutputScript:g}},function(e,t,r){const n=r(23),i=r(29);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(23),i=r(29);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(936),i=r(167),o=r(168),s=r(949);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,r){"use strict";var n=r(944),i=r(945),o=r(302);function s(e,t){return void 0===e?t:(n.isBoolean(e,o.COMPRESSED_TYPE_INVALID),e)}e.exports=function(e){return{privateKeyVerify:function(t){return n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),32===t.length&&e.privateKeyVerify(t)},privateKeyExport:function(t,r){n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),r=s(r,!0);var a=e.privateKeyExport(t,r);return i.privateKeyExport(t,a,r)},privateKeyImport:function(t){if(n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),t=i.privateKeyImport(t),t&&32===t.length&&e.privateKeyVerify(t))return t;throw new Error(o.EC_PRIVATE_KEY_IMPORT_DER_FAIL)},privateKeyNegate:function(t){return n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),e.privateKeyNegate(t)},privateKeyModInverse:function(t){return n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),e.privateKeyModInverse(t)},privateKeyTweakAdd:function(t,r){return n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),n.isBuffer(r,o.TWEAK_TYPE_INVALID),n.isBufferLength(r,32,o.TWEAK_LENGTH_INVALID),e.privateKeyTweakAdd(t,r)},privateKeyTweakMul:function(t,r){return n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),n.isBuffer(r,o.TWEAK_TYPE_INVALID),n.isBufferLength(r,32,o.TWEAK_LENGTH_INVALID),e.privateKeyTweakMul(t,r)},publicKeyCreate:function(t,r){return n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),r=s(r,!0),e.publicKeyCreate(t,r)},publicKeyConvert:function(t,r){return n.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),n.isBufferLength2(t,33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID),r=s(r,!0),e.publicKeyConvert(t,r)},publicKeyVerify:function(t){return n.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),e.publicKeyVerify(t)},publicKeyTweakAdd:function(t,r,i){return n.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),n.isBufferLength2(t,33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID),n.isBuffer(r,o.TWEAK_TYPE_INVALID),n.isBufferLength(r,32,o.TWEAK_LENGTH_INVALID),i=s(i,!0),e.publicKeyTweakAdd(t,r,i)},publicKeyTweakMul:function(t,r,i){return n.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),n.isBufferLength2(t,33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID),n.isBuffer(r,o.TWEAK_TYPE_INVALID),n.isBufferLength(r,32,o.TWEAK_LENGTH_INVALID),i=s(i,!0),e.publicKeyTweakMul(t,r,i)},publicKeyCombine:function(t,r){n.isArray(t,o.EC_PUBLIC_KEYS_TYPE_INVALID),n.isLengthGTZero(t,o.EC_PUBLIC_KEYS_LENGTH_INVALID);for(var i=0;ie?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(477),i=r(205);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(167);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(479),i=r(167),o=r(168);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(950),i=r(223),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:new t([])},{name:"number",default:i.intToBuffer(115e4)},{name:"gasLimit",default:new t("ffffffffffffff","hex")},{name:"gasUsed",empty:!0,default:new t([])},{name:"timestamp",default:new t([])},{name:"extraData",allowZero:!0,empty:!0,default:new t([])},{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,l,h;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),l=new o(-99),1===l.cmp(f)&&(f=l),h=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),l=new o(-99),1===l.cmp(f)&&(f=l),h=s.add(u.mul(f))):h=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()||h.iadd(new o(2).pow(p)),-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),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=new t([])}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(971),i=r(168);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";const n=r(976).BlockHeader,i=r(9),o=r(18),s=r(33),a=r(6),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)},l=(e,t,n)=>{"function"==typeof t&&(n=t,t={}),t=t||{};const o=t.hashAlg||r(304).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)},h=e=>{const t=r(304).defaultHashAlg,n=o.encode(e,t),s=1,a=new i(1,"zcash-block",n);return a};e.exports={hashToCid:h,ZCASH_BLOCK_HEADER_SIZE:1487,cid:l,deserialize:f,serialize:c}},function(e,t,r){"use strict";(function(t){var n=r(39),i=r(133),o=r(66),s=r(76),a=r(228),u=r(45),c=r(25),f=r(15),l=r(21),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=n.fromBuffer(a.getRandomBuffer(32))}while(!t.lt(e)||!t.gt(n.Zero));return this.k=t,this},h.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 l=n.fromBuffer(r),h=i.getN(),d=0;d>1,c=i.getN(),f=i.getG(),h=u?r.add(c):r,d=i.fromX(a,h),p=d.mul(c);if(!p.isInfinity())throw new Error("nR is not a valid curve point");var y=t.neg().mod(c),g=r.invm(c),m=d.mul(o).add(f.mul(y)).mul(g),b=s.fromPoint(m,this.sig.compressed);return b},h.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"},h.toLowS=function(e){return e.gt(n.fromBuffer(new t("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(e=i.getN().sub(e)),e},h.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=h.toLowS(f),{s:f,r:c}},h.prototype.sign=function(){var e=this.hashbuf,t=this.privkey,r=t.bn;l.checkState(e&&t&&r,new Error("invalid parameters")),l.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},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,r){return h().set({hashbuf:e,endian:r,privkey:t}).sign().sig},h.verify=function(e,t,r,n){return h().set({hashbuf:e,endian:n,sig:t,pubkey:r}).verify().verified},e.exports=h}).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},m.prototype.toASM=function(){for(var e="",t=0;t"},m.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)},m.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},m.prototype.getPublicKey=function(){return l.checkState(this.isPublicKeyOut(),"Can't retreive PublicKey from a non-PK output"),this.chunks[0].buf},m.prototype.getPublicKeyHash=function(){return l.checkState(this.isPublicKeyHashOut(),"Can't retrieve PublicKeyHash from a non-PKH output"),this.chunks[2].buf},m.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},m.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},m.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},m.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=m.fromBuffer(t)}catch(e){if(e instanceof d.Script.InvalidBuffer)return!1;throw e}var n=r.classify();return n!==m.types.UNKNOWN},m.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&&y.isBuffer(e.buf)})&&a.isSmallIntOp(this.chunks[this.chunks.length-2].opcodenum)&&this.chunks[this.chunks.length-1].opcodenum===a.OP_CHECKMULTISIG},m.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&&y.isBuffer(e.buf)&&c.isTxDER(e.buf)})},m.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<=m.OP_RETURN_STANDARD_SIZE&&this.chunks[1].length===this.chunks.len)},m.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")},m.prototype.isPushOnly=function(){return h.every(this.chunks,function(e){return e.opcodenum<=a.OP_16})},m.types={},m.types.UNKNOWN="Unknown",m.types.PUBKEY_OUT="Pay to public key",m.types.PUBKEY_IN="Spend from public key",m.types.PUBKEYHASH_OUT="Pay to public key hash",m.types.PUBKEYHASH_IN="Spend from public key hash",m.types.SCRIPTHASH_OUT="Pay to script hash",m.types.SCRIPTHASH_IN="Spend from script hash",m.types.MULTISIG_OUT="Pay to multisig",m.types.MULTISIG_IN="Spend from multisig",m.types.DATA_OUT="Data push",m.OP_RETURN_STANDARD_SIZE=80,m.prototype.classify=function(){if(this._isInput)return this.classifyInput();if(this._isOutput)return this.classifyOutput();var e=this.classifyOutput();return e!=m.types.UNKNOWN?e:this.classifyInput()},m.outputIdentifiers={},m.outputIdentifiers.PUBKEY_OUT=m.prototype.isPublicKeyOut,m.outputIdentifiers.PUBKEYHASH_OUT=m.prototype.isPublicKeyHashOut,m.outputIdentifiers.MULTISIG_OUT=m.prototype.isMultisigOut,m.outputIdentifiers.SCRIPTHASH_OUT=m.prototype.isScriptHashOut,m.outputIdentifiers.DATA_OUT=m.prototype.isDataOut,m.prototype.classifyOutput=function(){for(var e in m.outputIdentifiers)if(m.outputIdentifiers[e].bind(this)())return m.types[e];return m.types.UNKNOWN},m.inputIdentifiers={},m.inputIdentifiers.PUBKEY_IN=m.prototype.isPublicKeyIn,m.inputIdentifiers.PUBKEYHASH_IN=m.prototype.isPublicKeyHashIn,m.inputIdentifiers.MULTISIG_IN=m.prototype.isMultisigIn,m.inputIdentifiers.SCRIPTHASH_IN=m.prototype.isScriptHashIn,m.prototype.classifyInput=function(){for(var e in m.inputIdentifiers)if(m.inputIdentifiers[e].bind(this)())return m.types[e];return m.types.UNKNOWN},m.prototype.isStandard=function(){return this.classify()!==m.types.UNKNOWN},m.prototype.prepend=function(e){return this._addByType(e,!0),this},m.prototype.equals=function(e){if(l.checkState(e instanceof m,"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)},m.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))},m.prototype.getSignatureOperationsCount=function(e){e=!!h.isUndefined(e)||e;var t=this,r=0,n=a.OP_INVALIDOPCODE;return h.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=m}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(15),i=r(21),o=r(34),s=r(67),a=r(118),u=r(308);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 l=new s(e.scriptPubKey||e.script);i.checkArgument(!n.isUndefined(e.amount)||!n.isUndefined(e.satoshis),"Must provide an amount for the output");var h=n.isUndefined(e.amount)?e.satoshis:new u.fromBTC(e.amount).toSatoshis();i.checkArgument(n.isNumber(h),"Amount must be a number"),o.defineImmutable(this,{address:t,txId:r,outputIndex:f,script:l,satoshis:h})}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(229),o=r(25),s=r(95),a=r(61),u=r(45),c=r(34),f=r(227),l=r(21);function h(e){if(!(this instanceof h))return new h(e);var t={};if(o.isBuffer(e))t=h._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}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(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")},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(r){l.checkArgument(!n.isUndefined(r),"tx cannot be undefined"),l.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)},h._fromBufferReader=function e(t){l.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 m.InvalidEntropyArgument.TooMuchEntropy(e);var n=f.sha512hmac(e,new i.Buffer("Bitcoin seed"));return new E({network:l.get(r)||l.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(488);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,b.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 g.InvalidB58Checksum(n)}else e.checksum=c.checksum(n);var o=l.get(b.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),h=u.toPublicKey(),d=E.ParentFingerPrintSize,y=f.sha256ripemd160(h.toBuffer()).slice(0,d);return v.defineImmutable(this,{xprivkey:s,network:o,depth:b.integerFromSingleByteBuffer(e.depth),privateKey:u,publicKey:h,fingerPrint:y}),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(b.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:l.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}},E.fromBuffer=function(e){return new E(e.toString())},E.prototype.toBuffer=function(){return b.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(21),o=r(39),s=r(226),a=r(169),u=r(45),c=r(487),f=r(309),l=r(117),h=r(133),d=r(76),p=r(65),y=p,g=p.HDPublicKey,m=r(20),b=r(34),v=r(25);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 g.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 g.UnrecognizedArgument(e)}throw new g.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 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 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),l=d.fromPoint(h.getG().mul(a).add(this.publicKey.point)),p=new _({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:e,chainCode:c,publicKey:l});return f.set(this.xpubkey,e,!1,p),p},_.prototype._deriveFromString=function(e){if(n.contains(e,"'"))throw new g.InvalidIndexCantDeriveHardened;if(!_.isValidPath(e))throw new g.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 g.UnrecognizedArgument("expected buffer or string");if(!s.validCharacters(e))return new y.InvalidB58Char("(unknown)",e);try{e=a.decode(e)}catch(t){return new y.InvalidB58Checksum(e)}if(e.length!==_.DataSize)return new g.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===l.livenet.xprivkey||i===l.testnet.xprivkey?new g.ArgumentIsPrivateExtended:null},_._validateNetwork=function(e,t){var r=l.get(t);if(!r)return new y.InvalidNetworkArgument(t);var n=e.slice(_.VersionStart,_.VersionEnd);return v.integerFromBuffer(n)!==r.xpubkey?new y.InvalidNetwork(n):null},_.prototype._buildFromPrivate=function(e){var t=n.clone(e._buffers),r=h.getG().mul(o.fromBuffer(t.privateKey));return t.publicKey=h.pointToCompressed(r),t.version=v.integerAsBuffer(l.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(l.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),b.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 y.InvalidB58Checksum(n,i)}else e.checksum=i;var o=l.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,h=u.sha256ripemd160(c.toBuffer()).slice(0,f);return b.defineImmutable(this,{xpubkey:s,network:o,depth:v.integerFromSingleByteBuffer(e.depth),publicKey:c,fingerPrint:h}),this},_._validateBufferArguments=function(e){var t=function(t,r){var n=e[t];m(v.isBuffer(n),t+" argument is not a buffer, it's "+typeof n),m(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:l.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,m(_.PublicKeyEnd===_.DataSize),m(_.ChecksumEnd===_.SerializedByteSize),e.exports=_}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(310),i=r(311)(),o=r(1009),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=(t,r,o)=>{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){var n={ECB:r(1013),CBC:r(1014),CFB:r(1015),CFB8:r(1016),CFB1:r(1017),OFB:r(1018),CTR:r(491),GCM:r(491)},i=r(493);for(var o in i)i[o].module=n[i[o].mode];e.exports=i},function(e,t,r){var n=r(172),i=r(4).Buffer,o=r(492);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 l=0;if(s>0){var h=a.length-s;l=Math.min(s,c.length),c.copy(a,h,0,l),s-=l}if(l0){var d=u.length-o,p=Math.min(o,c.length-l);c.copy(u,d,l,l+p),o-=p}}return c.fill(0),{key:a,iv:u}}e.exports=o},function(e,t,r){var n=r(13);r(16),n.cipher=n.cipher||{};var i=e.exports=n.cipher.modes=n.cipher.modes||{};function o(e){if("string"==typeof e&&(e=n.util.createBuffer(e)),n.util.isArray(e)&&e.length>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;o>1,a=s+(1&e.length),u=e.substr(0,a),c=e.substr(s,a),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var h=Math.ceil(i/16),d=Math.ceil(i/20);l.start("MD5",u);var p=n.util.createBuffer();f.putBytes(r);for(var y=0;y0&&(l.queue(e,l.createAlert(e,{level:l.Alert.Level.warning,description:l.Alert.Description.no_renegotiation})),l.flush(e)),e.process()},l.parseHelloMessage=function(e,t,r){var i=null,o=e.entity===l.ConnectionEnd.client;if(r<38)e.error(e,{message:o?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});else{var s=t.fragment,a=s.length();if(i={version:{major:s.getByte(),minor:s.getByte()},random:n.util.createBuffer(s.getBytes(32)),session_id:c(s,1),extensions:[]},o?(i.cipher_suite=s.getBytes(2),i.compression_method=s.getByte()):(i.cipher_suites=c(s,2),i.compression_methods=c(s,1)),a=r-(a-s.length()),a>0){for(var u=c(s,2);u.length()>0;)i.extensions.push({type:[u.getByte(),u.getByte()],data:c(u,2)});if(!o)for(var f=0;f0;){var p=d.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(c(d,2).getBytes())}}}if(e.session.version&&(i.version.major!==e.session.version.major||i.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.protocol_version}});if(o)e.session.cipherSuite=l.getCipherSuite(i.cipher_suite);else for(var y=n.util.createBuffer(i.cipher_suites.bytes());y.length()>0&&(e.session.cipherSuite=l.getCipherSuite(y.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(i.cipher_suite)});e.session.compressionMethod=o?i.compression_method:l.CompressionMethod.none}return i},l.createSecurityParameters=function(e,t){var r=e.entity===l.ConnectionEnd.client,n=t.random.bytes(),i=r?e.session.sp.client_random:n,o=r?n:l.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:l.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:i,server_random:o}},l.handleServerHello=function(e,t,r){var n=l.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var i=n.session_id.bytes();i.length>0&&i===e.session.id?(e.expect=m,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=d,e.session.resuming=!1,l.createSecurityParameters(e,n)),e.session.id=i,e.process()}},l.handleClientHello=function(e,t,r){var i=l.parseHelloMessage(e,t,r);if(!e.fail){var o=i.session_id.bytes(),s=null;if(e.sessionCache&&(s=e.sessionCache.getSession(o),null===s?o="":(s.version.major!==i.version.major||s.version.minor>i.version.minor)&&(s=null,o="")),0===o.length&&(o=n.random.getBytes(32)),e.session.id=o,e.session.clientHelloVersion=i.version,e.session.sp={},s)e.version=e.session.version=s.version,e.session.sp=s.sp;else{for(var a,u=1;u0;)s=c(o.certificate_list,3),a=n.asn1.fromDer(s),s=n.pki.certificateFromAsn1(a,!0),u.push(s)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.bad_certificate}})}var f=e.entity===l.ConnectionEnd.client;!f&&!0!==e.verifyClient||0!==u.length?0===u.length?e.expect=f?p:E:(f?e.session.serverCertificate=u[0]:e.session.clientCertificate=u[0],l.verifyCertificateChain(e,u)&&(e.expect=f?p:E)):e.error(e,{message:f?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}}),e.process()},l.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.unsupported_certificate}});e.expect=y,e.process()},l.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.unsupported_certificate}});var i=t.fragment,o={enc_pre_master_secret:c(i,2).getBytes()},s=null;if(e.getPrivateKey)try{s=e.getPrivateKey(e,e.session.serverCertificate),s=n.pki.privateKeyFromPem(s)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}})}if(null===s)return e.error(e,{message:"No private key set.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}});try{var a=e.session.sp;a.pre_master_secret=s.decrypt(o.enc_pre_master_secret);var u=e.session.clientHelloVersion;if(u.major!==a.pre_master_secret.charCodeAt(0)||u.minor!==a.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){a.pre_master_secret=n.random.getBytes(48)}e.expect=A,null!==e.session.clientCertificate&&(e.expect=k),e.process()},l.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});var n=t.fragment,i={certificate_types:c(n,1),certificate_authorities:c(n,2)};e.session.certificateRequest=i,e.expect=g,e.process()},l.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var s={signature:c(i,2).getBytes()},a=n.util.createBuffer();a.putBuffer(e.session.md5.digest()),a.putBuffer(e.session.sha1.digest()),a=a.getBytes();try{var u=e.session.clientCertificate;if(!u.publicKey.verify(a,s.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(o),e.session.sha1.update(o)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.handshake_failure}})}e.expect=A,e.process()},l.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.record_overflow}});if(null===e.serverCertificate){var i={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.insufficient_security}},o=0,s=e.verify(e,i.alert.description,0,[]);if(!0!==s)return(s||0===s)&&("object"!=typeof s||n.util.isArray(s)?"number"==typeof s&&(i.alert.description=s):(s.message&&(i.message=s.message),s.alert&&(i.alert.description=s.alert))),e.error(e,i)}null!==e.session.certificateRequest&&(t=l.createRecord(e,{type:l.ContentType.handshake,data:l.createCertificate(e)}),l.queue(e,t)),t=l.createRecord(e,{type:l.ContentType.handshake,data:l.createClientKeyExchange(e)}),l.queue(e,t),e.expect=_;var a=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createCertificateVerify(e,t)})),l.queue(e,l.createRecord(e,{type:l.ContentType.change_cipher_spec,data:l.createChangeCipherSpec()})),e.state.pending=l.createConnectionState(e),e.state.current.write=e.state.pending.write,l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createFinished(e)})),e.expect=m,l.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return a(e,null);l.getClientSignature(e,a)},l.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});var r=e.entity===l.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=l.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?b:x,e.process()},l.handleFinished=function(e,t,r){var o=t.fragment;o.read-=4;var s=o.bytes();o.read+=4;var a=t.fragment.getBytes();o=n.util.createBuffer(),o.putBuffer(e.session.md5.digest()),o.putBuffer(e.session.sha1.digest());var u=e.entity===l.ConnectionEnd.client,c=u?"server finished":"client finished",f=e.session.sp,h=12,d=i;if(o=d(f.master_secret,c,o.getBytes(),12),o.getBytes()!==a)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.decrypt_error}});e.session.md5.update(s),e.session.sha1.update(s),(e.session.resuming&&u||!e.session.resuming&&!u)&&(l.queue(e,l.createRecord(e,{type:l.ContentType.change_cipher_spec,data:l.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createFinished(e)}))),e.expect=u?v:C,e.handshaking=!1,++e.handshakes,e.peerCertificate=u?e.session.serverCertificate:e.session.clientCertificate,l.flush(e),e.isConnected=!0,e.connected(e),e.process()},l.handleAlert=function(e,t){var r=t.fragment,n={level:r.getByte(),description:r.getByte()},i;switch(n.description){case l.Alert.Description.close_notify:i="Connection closed.";break;case l.Alert.Description.unexpected_message:i="Unexpected message.";break;case l.Alert.Description.bad_record_mac:i="Bad record MAC.";break;case l.Alert.Description.decryption_failed:i="Decryption failed.";break;case l.Alert.Description.record_overflow:i="Record overflow.";break;case l.Alert.Description.decompression_failure:i="Decompression failed.";break;case l.Alert.Description.handshake_failure:i="Handshake failure.";break;case l.Alert.Description.bad_certificate:i="Bad certificate.";break;case l.Alert.Description.unsupported_certificate:i="Unsupported certificate.";break;case l.Alert.Description.certificate_revoked:i="Certificate revoked.";break;case l.Alert.Description.certificate_expired:i="Certificate expired.";break;case l.Alert.Description.certificate_unknown:i="Certificate unknown.";break;case l.Alert.Description.illegal_parameter:i="Illegal parameter.";break;case l.Alert.Description.unknown_ca:i="Unknown certificate authority.";break;case l.Alert.Description.access_denied:i="Access denied.";break;case l.Alert.Description.decode_error:i="Decode error.";break;case l.Alert.Description.decrypt_error:i="Decrypt error.";break;case l.Alert.Description.export_restriction:i="Export restriction.";break;case l.Alert.Description.protocol_version:i="Unsupported protocol version.";break;case l.Alert.Description.insufficient_security:i="Insufficient security.";break;case l.Alert.Description.internal_error:i="Internal error.";break;case l.Alert.Description.user_canceled:i="User canceled.";break;case l.Alert.Description.no_renegotiation:i="Renegotiation not supported.";break;default:i="Unknown error."}if(n.description===l.Alert.Description.close_notify)return e.close();e.error(e,{message:i,send:!1,origin:e.entity===l.ConnectionEnd.client?"server":"client",alert:n}),e.process()},l.handleHandshake=function(e,t){var r=t.fragment,i=r.getByte(),o=r.getInt24();if(o>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var s=r.bytes(o+4);r.read+=4,i in H[e.entity][e.expect]?(e.entity!==l.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),i!==l.HandshakeType.hello_request&&i!==l.HandshakeType.certificate_verify&&i!==l.HandshakeType.finished&&(e.session.md5.update(s),e.session.sha1.update(s)),H[e.entity][e.expect][i](e,t,o)):l.handleUnexpected(e,t)},l.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},l.handleHeartbeat=function(e,t){var r=t.fragment,i=r.getByte(),o=r.getInt16(),s=r.getBytes(o);if(i===l.HeartbeatMessageType.heartbeat_request){if(e.handshaking||o>s.length)return e.process();l.queue(e,l.createRecord(e,{type:l.ContentType.heartbeat,data:l.createHeartbeat(l.HeartbeatMessageType.heartbeat_response,s)})),l.flush(e)}else if(i===l.HeartbeatMessageType.heartbeat_response){if(s!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(s))}e.process()};var h=0,d=1,p=2,y=3,g=4,m=5,b=6,v=7,_=8,w=0,S=1,E=2,k=3,A=4,x=5,C=6,T=7,I=l.handleUnexpected,B=l.handleChangeCipherSpec,O=l.handleAlert,P=l.handleHandshake,R=l.handleApplicationData,N=l.handleHeartbeat,j=[];j[l.ConnectionEnd.client]=[[I,O,P,I,N],[I,O,P,I,N],[I,O,P,I,N],[I,O,P,I,N],[I,O,P,I,N],[B,O,I,I,N],[I,O,P,I,N],[I,O,P,R,N],[I,O,P,I,N]],j[l.ConnectionEnd.server]=[[I,O,P,I,N],[I,O,P,I,N],[I,O,P,I,N],[I,O,P,I,N],[B,O,I,I,N],[I,O,P,I,N],[I,O,P,R,N],[I,O,P,I,N]];var L=l.handleHelloRequest,M=l.handleServerHello,D=l.handleCertificate,U=l.handleServerKeyExchange,F=l.handleCertificateRequest,K=l.handleServerHelloDone,q=l.handleFinished,H=[];H[l.ConnectionEnd.client]=[[I,I,M,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,D,U,F,K,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,U,F,K,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,I,F,K,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,I,I,K,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,q],[L,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I]];var z=l.handleClientHello,V=l.handleClientKeyExchange,G=l.handleCertificateVerify;H[l.ConnectionEnd.server]=[[I,z,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,D,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,V,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,G,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,q],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I]],l.generateKeys=function(e,t){var r=i,n=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",n,48).bytes(),t.pre_master_secret=null),n=t.server_random+t.client_random;var o=2*t.mac_key_length+2*t.enc_key_length,s=e.version.major===l.Versions.TLS_1_0.major&&e.version.minor===l.Versions.TLS_1_0.minor;s&&(o+=2*t.fixed_iv_length);var a=r(t.master_secret,"key expansion",n,o),u={client_write_MAC_key:a.getBytes(t.mac_key_length),server_write_MAC_key:a.getBytes(t.mac_key_length),client_write_key:a.getBytes(t.enc_key_length),server_write_key:a.getBytes(t.enc_key_length)};return s&&(u.client_write_IV=a.getBytes(t.fixed_iv_length),u.server_write_IV=a.getBytes(t.fixed_iv_length)),u},l.createConnectionState=function(e){var t=e.entity===l.ConnectionEnd.client,r=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},n={read:r(),write:r()};if(n.read.update=function(e,t){return n.read.cipherFunction(t,n.read)?n.read.compressFunction(e,t,n.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.bad_record_mac}}),!e.fail},n.write.update=function(e,t){return n.write.compressFunction(e,t,n.write)?n.write.cipherFunction(t,n.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}}),!e.fail},e.session){var i=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(i),i.keys=l.generateKeys(e,i),n.read.macKey=t?i.keys.server_write_MAC_key:i.keys.client_write_MAC_key,n.write.macKey=t?i.keys.client_write_MAC_key:i.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(n,e,i),i.compression_algorithm){case l.CompressionMethod.none:break;case l.CompressionMethod.deflate:n.read.compressFunction=u,n.write.compressFunction=a;break;default:throw new Error("Unsupported compression algorithm.")}}return n},l.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=n.util.createBuffer();return r.putInt32(t),r.putBytes(n.random.getBytes(28)),r},l.createRecord=function(e,t){if(!t.data)return null;var r={type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data};return r},l.createAlert=function(e,t){var r=n.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),l.createRecord(e,{type:l.ContentType.alert,data:r})},l.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=n.util.createBuffer(),r=0;r0&&(p+=2);var y=e.session.id,g=y.length+1+2+4+28+2+o+1+a+p,m=n.util.createBuffer();return m.putByte(l.HandshakeType.client_hello),m.putInt24(g),m.putByte(e.version.major),m.putByte(e.version.minor),m.putBytes(e.session.sp.client_random),f(m,1,n.util.createBuffer(y)),f(m,2,t),f(m,1,s),p>0&&f(m,2,u),m},l.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,i=n.util.createBuffer();return i.putByte(l.HandshakeType.server_hello),i.putInt24(r),i.putByte(e.version.major),i.putByte(e.version.minor),i.putBytes(e.session.sp.server_random),f(i,1,n.util.createBuffer(t)),i.putByte(e.session.cipherSuite.id[0]),i.putByte(e.session.cipherSuite.id[1]),i.putByte(e.session.compressionMethod),i},l.createCertificate=function(e){var t=e.entity===l.ConnectionEnd.client,r=null,i;e.getCertificate&&(i=t?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,r=e.getCertificate(e,i));var o=n.util.createBuffer();if(null!==r)try{n.util.isArray(r)||(r=[r]);for(var s=null,a=0;al.MaxFragment;)i.push(l.createRecord(e,{type:t.type,data:n.util.createBuffer(o.slice(0,l.MaxFragment))})),o=o.slice(l.MaxFragment);o.length>0&&i.push(l.createRecord(e,{type:t.type,data:n.util.createBuffer(o)}))}for(var s=0;s0&&(i=r.order[0]),null!==i&&i in r.cache)for(var o in t=r.cache[i],delete r.cache[i],r.order)if(r.order[o]===i){r.order.splice(o,1);break}return t},r.setSession=function(e,t){if(r.order.length===r.capacity){var i=r.order.shift();delete r.cache[i]}var i=n.util.bytesToHex(e);r.order.push(i),r.cache[i]=t}}return r},l.createConnection=function(e){var t=null;t=e.caStore?n.util.isArray(e.caStore)?n.pki.createCaStore(e.caStore):e.caStore:n.pki.createCaStore();var r=e.cipherSuites||null;if(null===r)for(var i in r=[],l.CipherSuites)r.push(l.CipherSuites[i]);var o=e.server?l.ConnectionEnd.server:l.ConnectionEnd.client,s=e.sessionCache?l.createSessionCache(e.sessionCache):null,a={version:{major:l.Version.major,minor:l.Version.minor},entity:o,sessionId:e.sessionId,caStore:t,sessionCache:s,cipherSuites:r,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(e,t,r,n){return t},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:n.util.createBuffer(),tlsData:n.util.createBuffer(),data:n.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(t,r){r.origin=r.origin||(t.entity===l.ConnectionEnd.client?"client":"server"),r.send&&(l.queue(t,l.createAlert(t,r.alert)),l.flush(t));var n=!1!==r.fatal;n&&(t.fail=!0),e.error(t,r),n&&t.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null,reset:function(e){a.version={major:l.Version.major,minor:l.Version.minor},a.record=null,a.session=null,a.peerCertificate=null,a.state={pending:null,current:null},a.expect=(a.entity,l.ConnectionEnd.client,0),a.fragmented=null,a.records=[],a.open=!1,a.handshakes=0,a.handshaking=!1,a.isConnected=!1,a.fail=!(e||void 0===e),a.input.clear(),a.tlsData.clear(),a.data.clear(),a.state.current=l.createConnectionState(a)}};a.reset();var u=function(e,t){var r=t.type-l.ContentType.change_cipher_spec,n=j[e.entity][e.expect];r in n?n[r](e,t):l.handleUnexpected(e,t)},c=function(e){var t=0,r=e.input,i=r.length();if(i<5)t=5-i;else{e.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:n.util.createBuffer(),ready:!1};var o=e.record.version.major===e.version.major;o&&e.session&&e.session.version&&(o=e.record.version.minor===e.version.minor),o||e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.protocol_version}})}return t},f=function(e){var t=0,r=e.input,n=r.length();if(n0&&(a.sessionCache&&(t=a.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&a.sessionCache&&(t=a.sessionCache.getSession(),null!==t&&(e=t.id)),a.session={id:e,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:n.md.md5.create(),sha1:n.md.sha1.create()},t&&(a.version=t.version,a.session.sp=t.sp),a.session.sp.client_random=l.createRandom().getBytes(),a.open=!0,l.queue(a,l.createRecord(a,{type:l.ContentType.handshake,data:l.createClientHello(a)})),l.flush(a)}},a.process=function(e){var t=0;return e&&a.input.putBytes(e),a.fail||(null!==a.record&&a.record.ready&&a.record.fragment.isEmpty()&&(a.record=null),null===a.record&&(t=c(a)),a.fail||null===a.record||a.record.ready||(t=f(a)),!a.fail&&null!==a.record&&a.record.ready&&u(a,a.record)),t},a.prepare=function(e){return l.queue(a,l.createRecord(a,{type:l.ContentType.application_data,data:n.util.createBuffer(e)})),l.flush(a)},a.prepareHeartbeatRequest=function(e,t){return e instanceof n.util.ByteBuffer&&(e=e.bytes()),void 0===t&&(t=e.length),a.expectedHeartbeatPayload=e,l.queue(a,l.createRecord(a,{type:l.ContentType.heartbeat,data:l.createHeartbeat(l.HeartbeatMessageType.heartbeat_request,e,t)})),l.flush(a)},a.close=function(e){if(!a.fail&&a.sessionCache&&a.session){var t={id:a.session.id,version:a.session.version,sp:a.session.sp};t.sp.keys=null,a.sessionCache.setSession(t.id,t)}a.open&&(a.open=!1,a.input.clear(),(a.isConnected||a.handshaking)&&(a.isConnected=a.handshaking=!1,l.queue(a,l.createAlert(a,{level:l.Alert.Level.warning,description:l.Alert.Description.close_notify})),l.flush(a)),a.closed(a)),a.reset(e)},a},e.exports=n.tls=n.tls||{},l)"function"!=typeof l[Y]&&(n.tls[Y]=l[Y]);n.tls.prf_tls1=i,n.tls.hmac_sha1=s,n.tls.createSessionCache=l.createSessionCache,n.tls.createConnection=l.createConnection},function(e,t,r){var n=r(13);r(86),r(120),r(500),r(135),r(315),r(507),r(317),r(232),r(16),r(316);var i=n.asn1,o=e.exports=n.pki=n.pki||{};o.pemToDer=function(e){var t=n.pem.decode(e)[0];if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return n.util.createBuffer(t.body)},o.privateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("PRIVATE KEY"!==t.type&&"RSA PRIVATE KEY"!==t.type){var r=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var s=i.fromDer(t.body);return o.privateKeyFromAsn1(s)},o.privateKeyToPem=function(e,t){var r={type:"RSA PRIVATE KEY",body:i.toDer(o.privateKeyToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},o.privateKeyInfoToPem=function(e,t){var r={type:"PRIVATE KEY",body:i.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})}},function(e,t,r){var n=r(13);if(r(119),r(86),r(231),r(87),r(120),r(315),r(135),r(68),r(504),r(232),r(16),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 l(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 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,l,h;if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var y,g,m;switch(r.algorithm){case"aes128":f=16,y=16,g=a["aes128-CBC"],m=n.aes.createEncryptionCipher;break;case"aes192":f=24,y=16,g=a["aes192-CBC"],m=n.aes.createEncryptionCipher;break;case"aes256":f=32,y=16,g=a["aes256-CBC"],m=n.aes.createEncryptionCipher;break;case"des":f=8,y=8,g=a.desCBC,m=n.des.createEncryptionCipher;break;default:var b=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw b.algorithm=r.algorithm,b}var v="hmacWith"+r.prfAlgorithm.toUpperCase(),_=d(v),w=n.pkcs5.pbkdf2(t,i,u,f,_),S=n.random.getBytesSync(y),E=m(w);E.start(S),E.update(o.toDer(e)),E.finish(),h=E.output.getBytes();var k=p(i,c,f,v);l=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(g).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,S)])])])}else{if("3des"!==r.algorithm){var b=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw b.algorithm=r.algorithm,b}f=24;var A=new n.util.ByteBuffer(i),w=s.pbe.generatePkcs12Key(t,A,1,u,f),S=s.pbe.generatePkcs12Key(t,A,2,u,f),E=n.des.createEncryptionCipher(w);E.start(S),E.update(o.toDer(e)),E.finish(),h=E.output.getBytes(),l=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 x=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[l,o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,h)]);return x},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),l=s.pbe.getCipher(f,i.encryptionParams,t),h=n.util.createBuffer(i.encryptedData);return l.update(h),l.finish()&&(r=o.fromDer(l.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 l=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw l.algorithm=r.algorithm,l}var h=n.pbe.opensslDeriveBytes(t,u.substr(0,8),c),d=f(h);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),l=n.pbe.opensslDeriveBytes(t,f.substr(0,8),u),h=c(l);if(h.start(f),h.update(n.util.createBuffer(i.body)),!h.finish())return r;r=h.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,l=new n.util.ByteBuffer,h=new n.util.ByteBuffer;if(null!==e&&void 0!==e){for(u=0;u=0;u--)I>>=8,I+=A.at(u)+T.at(u),T.setAt(u,255&I);C.putBuffer(T)}_=C,l.putBuffer(E)}return l.truncate(l.length()-o),l},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,l=n.util.createBuffer(i.kdfIterationCount),d,p;switch(l=l.getInt(l.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 y=h(i.prfOid),g=n.pkcs5.pbkdf2(r,f,l,d,y),m=i.encIv,b=p(g);return b.start(m),b},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),l=n.util.createBuffer(i.iterations),d,p,y;switch(l=l.getInt(l.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,p=8,y=n.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,p=8,y=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 g=h(i.prfOid),m=s.pbe.generatePkcs12Key(r,c,1,l,d,g);g.start();var b=s.pbe.generatePkcs12Key(r,c,2,l,p,g);return y(m,b)},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=[l(i,e+t)],s=16,a=1;s>>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,l;s.putBytes(o.substr(0,i.blockLength-u));for(var h=8*i.fullMessageLength[0],d=0;d>>0,h+=l,s.putInt32(h>>>0),h=f>>>0;s.putInt32(h);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 y=n.util.createBuffer();return y.putInt32(p.h0),y.putInt32(p.h1),y.putInt32(p.h2),y.putInt32(p.h3),y.putInt32(p.h4),y.putInt32(p.h5),y.putInt32(p.h6),y.putInt32(p.h7),y},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,l,h,d,p,y,g,m,b,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(l=e.h0,h=e.h1,d=e.h2,p=e.h3,y=e.h4,g=e.h5,m=e.h6,b=e.h7,f=0;f<64;++f)s=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),u=m^y&(g^m),o=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),c=l&h|d&(l^h),n=b+s+u+a[f]+t[f],i=o+c,b=m,m=g,g=y,y=p+n>>>0,p=d,d=h,h=l,l=n+i>>>0;e.h0=e.h0+l|0,e.h1=e.h1+h|0,e.h2=e.h2+d|0,e.h3=e.h3+p|0,e.h4=e.h4+y|0,e.h5=e.h5+g|0,e.h6=e.h6+m|0,e.h7=e.h7+b|0,v-=64}}},function(e,t,r){(function(t){var n=r(13);r(16);var i=null;!n.util.isNodejs||n.options.usePureJavaScript||t.versions["node-webkit"]||(i=r(501));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),l=4294967295&c;for(var a=0;a<3;++a)f=l>>>(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(l){if(l)return r(l);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 h=i(t.key,t.seed);t.generated+=h.length,c.putBytes(h),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(3))},function(e,t,r){var n=r(13);r(16);var i=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],o=[1,2,3,5],s=function(e,t){return e<>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,l,h,d,p,y=[];for(e=n.rc2.expandKey(e,t),d=0;d<64;d++)y.push(e.getInt16Le());r?(l=function(e){for(d=0;d<4;d++)e[d]+=y[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++},h=function(e){for(d=0;d<4;d++)e[d]+=y[63&e[(d+3)%4]]}):(l=function(e){for(d=3;d>=0;d--)e[d]=a(e[d],o[d]),e[d]-=y[p]+(e[(d+3)%4]&e[(d+2)%4])+(~e[(d+3)%4]&e[(d+1)%4]),p--},h=function(e){for(d=3;d>=0;d--)e[d]-=y[63&e[(d+3)%4]]});var g=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;)g([[5,l],[1,h],[6,l],[1,h],[5,l]])},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,m.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}},m};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){var n=r(13);r(16),r(68),r(174);var i=e.exports=n.pkcs1=n.pkcs1||{};function o(e,t,r){r||(r=n.md.sha1.create());for(var i="",o=Math.ceil(t/r.digestLength),s=0;s>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 l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),a.update(i,"raw");for(var h=a.digest(),d="",p=f-t.length,y=0;yt&&(e=l(t,r)),e.isProbablePrime(s))return u(null,e);e.dAddOffset(i[o++%8],0)}while(a<0||+new Date-fe&&(s=l(e,t));var p=s.toString(16);i.target.postMessage({hex:p,workLoad:c}),s.dAddOffset(f,0)}}}d()}function l(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 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,r){var n=r(13);r(86),r(173),r(120),r(508),r(500),r(68),r(232),r(174),r(16),r(316);var i=n.asn1,o=n.pki,s=e.exports=n.pkcs12=n.pkcs12||{},a={name:"ContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:i.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},u={name:"PFX",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},a,{name:"PFX.macData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:i.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},c={name:"SafeBag",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:i.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},f={name:"Attribute",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,capture:"values"}]},l={name:"CertBag",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:i.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:i.Class.UNIVERSAL,type:i.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function h(e,t,r,n){for(var i=[],o=0;o=0&&i.push(a):i.push(a))}return i}function d(e){if(e.composed||e.constructed){for(var t=n.util.createBuffer(),r=0;r0&&(c=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,h));var d=[],p=[];null!==t&&(p=n.util.isArray(t)?t:[t]);for(var y=[],g=0;g0){var _=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,y),w=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.data).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(_).getBytes())])]);d.push(w)}var S=null;if(null!==e){var E=o.wrapRsaPrivateKey(o.privateKeyToAsn1(e));S=null===r?i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.keyBag).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[E]),c]):i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.pkcs8ShroudedKeyBag).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[o.encryptPrivateKeyInfo(E,r,a)]),c]);var k=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[S]),A=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.data).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(k).getBytes())])]);d.push(A)}var x=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,d),C;if(a.useMac){var l=n.md.sha1.create(),T=new n.util.ByteBuffer(n.random.getBytes(a.saltSize)),I=a.count,e=s.generateKey(r,T,3,I,20),B=n.hmac.create();B.start(l,e),B.update(i.toDer(x).getBytes());var O=B.getMac();C=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.sha1).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,O.getBytes())]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,T.getBytes()),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(I).getBytes())])}return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(3).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.data).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(x).getBytes())])]),C])},s.generateKey=n.pbe.generatePkcs12Key},function(e,t,r){var n=r(13);r(86),r(16);var i=n.asn1,o=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=o;var s={name:"ContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};o.contentInfoValidator=s;var a={name:"EncryptedContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};o.envelopedDataValidator={name:"EnvelopedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(a)},o.encryptedDataValidator={name:"EncryptedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"}].concat(a)};var u={name:"SignerInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};o.signedDataValidator={name:"SignedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},s,{name:"SignedData.Certificates",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,capture:"signerInfos",optional:!0,value:[u]}]},o.recipientInfoValidator={name:"RecipientInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},function(e,t,r){var n=r(13);r(16),n.mgf=n.mgf||{};var i=e.exports=n.mgf.mgf1=n.mgf1=n.mgf1||{};i.create=function(e){var t={generate:function(t,r){for(var i=new n.util.ByteBuffer,o=Math.ceil(r/e.digestLength),s=0;s>>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),l(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 h=8*d.fullMessageLength[0],p=0;p>>0,h+=f,t.putInt32(h>>>0),h=c>>>0;t.putInt32(h);for(var y=new Array(r.length),p=0;p=128;){for(P=0;P<16;++P)t[P][0]=r.getInt32()>>>0,t[P][1]=r.getInt32()>>>0;for(;P<80;++P)j=t[P-2],R=j[0],N=j[1],n=((R>>>19|N<<13)^(N>>>29|R<<3)^R>>>6)>>>0,i=((R<<13|N>>>19)^(N<<3|R>>>29)^(R<<26|N>>>6))>>>0,M=t[P-15],R=M[0],N=M[1],o=((R>>>1|N<<31)^(R>>>8|N<<24)^R>>>7)>>>0,s=((R<<31|N>>>1)^(R<<24|N>>>8)^(R<<25|N>>>7))>>>0,L=t[P-7],D=t[P-16],N=i+L[1]+s+D[1],t[P][0]=n+L[0]+o+D[0]+(N/4294967296>>>0)>>>0,t[P][1]=N>>>0;for(g=e[0][0],m=e[0][1],b=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],A=e[4][1],x=e[5][0],C=e[5][1],T=e[6][0],I=e[6][1],B=e[7][0],O=e[7][1],P=0;P<80;++P)f=((k>>>14|A<<18)^(k>>>18|A<<14)^(A>>>9|k<<23))>>>0,l=((k<<18|A>>>14)^(k<<14|A>>>18)^(A<<23|k>>>9))>>>0,h=(T^k&(x^T))>>>0,d=(I^A&(C^I))>>>0,a=((g>>>28|m<<4)^(m>>>2|g<<30)^(m>>>7|g<<25))>>>0,c=((g<<4|m>>>28)^(m<<30|g>>>2)^(m<<25|g>>>7))>>>0,p=(g&b|_&(g^b))>>>0,y=(m&v|w&(m^v))>>>0,N=O+l+d+u[P][1]+t[P][1],n=B+f+h+u[P][0]+t[P][0]+(N/4294967296>>>0)>>>0,i=N>>>0,N=c+y,o=a+p+(N/4294967296>>>0)>>>0,s=N>>>0,B=T,O=I,T=x,I=C,x=k,C=A,N=E+i,k=S+n+(N/4294967296>>>0)>>>0,A=N>>>0,S=_,E=w,_=b,w=v,b=g,v=m,N=i+s,g=n+o+(N/4294967296>>>0)>>>0,m=N>>>0;N=e[0][1]+m,e[0][0]=e[0][0]+g+(N/4294967296>>>0)>>>0,e[0][1]=N>>>0,N=e[1][1]+v,e[1][0]=e[1][0]+b+(N/4294967296>>>0)>>>0,e[1][1]=N>>>0,N=e[2][1]+w,e[2][0]=e[2][0]+_+(N/4294967296>>>0)>>>0,e[2][1]=N>>>0,N=e[3][1]+E,e[3][0]=e[3][0]+S+(N/4294967296>>>0)>>>0,e[3][1]=N>>>0,N=e[4][1]+A,e[4][0]=e[4][0]+k+(N/4294967296>>>0)>>>0,e[4][1]=N>>>0,N=e[5][1]+C,e[5][0]=e[5][0]+x+(N/4294967296>>>0)>>>0,e[5][1]=N>>>0,N=e[6][1]+I,e[6][0]=e[6][0]+T+(N/4294967296>>>0)>>>0,e[6][1]=N>>>0,N=e[7][1]+O,e[7][0]=e[7][0]+B+(N/4294967296>>>0)>>>0,e[7][1]=N>>>0,U-=128}}},function(e,t,r){var n=r(13);r(16),e.exports=n.log=n.log||{},n.log.levels=["none","error","warning","info","debug","verbose","max"];var i={},o=[],s=null;n.log.LEVEL_LOCKED=2,n.log.NO_LEVEL_CHECK=4,n.log.INTERPOLATE=8;for(var a=0;a{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(e){const n=r(7);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";(function(e){const n=r(310),i=r(311)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(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(1035),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(o).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,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},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";const n=r(1),i=r(175).Reporter,o=r(0).Buffer;function s(e,t){i.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function a(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof a||(e=new a(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}n(s,i),t.DecoderBuffer=s,s.prototype.save=function e(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},s.prototype.restore=function e(t){const r=new s(this.base);return r.offset=t.offset,r.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),r},s.prototype.isEmpty=function e(){return this.offset===this.length},s.prototype.readUInt8=function e(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},s.prototype.skip=function e(t,r){if(!(this.offset+t<=this.length))return this.error(r||"DecoderBuffer overrun");const n=new s(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},s.prototype.raw=function e(t){return this.base.slice(t?t.offset:this.offset,this.length)},t.EncoderBuffer=a,a.prototype.join=function e(t,r){return t||(t=new o(this.length)),r||(r=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach(function(e){e.join(t,r),r+=e.length}):("number"==typeof this.value?t[r]=this.value:"string"==typeof this.value?t.write(this.value,r):o.isBuffer(this.value)&&this.value.copy(t,r),r+=this.length),t)}},function(e,t,r){"use strict";const n=t;n._reverse=function e(t){const r={};return Object.keys(t).forEach(function(e){(0|e)==e&&(e|=0);const n=t[e];r[n]=e}),r},n.der=r(1039)},function(e,t,r){"use strict";const n=r(1),i=r(136),o=i.base,s=i.bignum,a=i.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.Node.call(this,"der",e)}function f(e,t){let r=e.readUInt8(t);if(e.isError(r))return r;const n=a.tagClass[r>>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 l(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=l(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{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(e){const n=r(7);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";var n=r(4).Buffer,i=r(234),o=r(524);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";(function(t){const n=r(18),i=r(1068);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(e){const n=r(7);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";(function(e){const n=r(319),i=r(320)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(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(1071),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(o).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,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},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";const n=r(1),i=r(176).Reporter,o=r(0).Buffer;function s(e,t){i.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function a(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof a||(e=new a(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}n(s,i),t.DecoderBuffer=s,s.prototype.save=function e(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},s.prototype.restore=function e(t){const r=new s(this.base);return r.offset=t.offset,r.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),r},s.prototype.isEmpty=function e(){return this.offset===this.length},s.prototype.readUInt8=function e(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},s.prototype.skip=function e(t,r){if(!(this.offset+t<=this.length))return this.error(r||"DecoderBuffer overrun");const n=new s(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},s.prototype.raw=function e(t){return this.base.slice(t?t.offset:this.offset,this.length)},t.EncoderBuffer=a,a.prototype.join=function e(t,r){return t||(t=new o(this.length)),r||(r=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach(function(e){e.join(t,r),r+=e.length}):("number"==typeof this.value?t[r]=this.value:"string"==typeof this.value?t.write(this.value,r):o.isBuffer(this.value)&&this.value.copy(t,r),r+=this.length),t)}},function(e,t,r){"use strict";const n=t;n._reverse=function e(t){const r={};return Object.keys(t).forEach(function(e){(0|e)==e&&(e|=0);const n=t[e];r[n]=e}),r},n.der=r(1075)},function(e,t,r){"use strict";const n=r(1),i=r(137),o=i.base,s=i.bignum,a=i.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.Node.call(this,"der",e)}function f(e,t){let r=e.readUInt8(t);if(e.isError(r))return r;const n=a.tagClass[r>>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 l(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=l(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;ou.BITS)return this.valid=!1,void(this.error="Invalid subnet mask.");e=e.replace(u.RE_SUBNET_STRING,"")}this.addressMinusSuffix=e,this.parsedAddress=this.parse(e)}c.prototype.parse=function(e){var t=e.split(".");return e.match(u.RE_ADDRESS)?this.valid=!0:this.error="Invalid IPv4 address.",t},c.prototype.isValid=function(){return this.valid},c.prototype.correctForm=function(){return this.parsedAddress.map(function(e){return parseInt(e,10)}).join(".")},c.prototype.isCorrect=i.isCorrect(u.BITS),c.fromHex=function(e){var t=o(e.replace(/:/g,""),8,"0"),r=[],n;for(n=0;n<8;n+=2){var i=t.slice(n,n+2);r.push(parseInt(i,16))}return new c(r.join("."))},c.fromInteger=function(e){return c.fromHex(e.toString(16))},c.prototype.toHex=function(){return this.parsedAddress.map(function(e){return a("%02x",parseInt(e,10))}).join(":")},c.prototype.toArray=function(){return this.parsedAddress.map(function(e){return parseInt(e,10)})},c.prototype.toGroup6=function(){var e=[],t;for(t=0;t=0;){var s=t*this[e++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=67108863&s}return i}function u(e,t,r,n,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var u=32767&this[e],c=this[e++]>>15,f=a*u+c*s;u=s*u+((32767&f)<<15)+r[n]+(1073741823&i),i=(u>>>30)+(f>>>15)+a*c+(i>>>30),r[n++]=1073741823&u}return i}function c(e,t,r,n,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var u=16383&this[e],c=this[e++]>>14,f=a*u+c*s;u=s*u+((16383&f)<<14)+r[n]+i,i=(u>>28)+(f>>14)+a*c,r[n++]=268435455&u}return i}var f="undefined"!=typeof navigator;f&&"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=u,r=30):f&&"Netscape"!=navigator.appName?(o.prototype.am=a,r=26):(o.prototype.am=c,r=28),o.prototype.DB=r,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 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,s=0;--n>=0;){var a=8==r?255&e[n]:m(e,n);a<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==s?this[this.t++]=a:s+r>this.DB?(this[this.t-1]|=(a&(1<>this.DB-s):this[this.t-1]|=a<=this.DB&&(s-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<0&&this[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 r=(1<0)for(a>a)>0&&(i=!0,o=g(n));s>=0;)a>(a+=this.DB-t)):(n=this[s]>>(a-=t)&r,a<=0&&(a+=this.DB,--s)),n>0&&(i=!0),i&&(o+=g(n));return i?o:"0"}function k(){var e=s();return o.ZERO.subTo(this,e),e}function A(){return this.s<0?this.negate():this}function x(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[r]-e[r]))return t;return 0}function C(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)+C(this[this.t-1]^this.s&this.DM)}function I(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s}function B(e,t){for(var r=e;r=0;--a)t[a+o+1]=this[a]>>n|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 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[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[r++]=this.DV+n:n>0&&(t[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[i]=0;for(i=0;i=0;)e[r]=0;for(r=0;r=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()}function L(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(f,a),i.lShiftTo(f,r)):(n.copyTo(a),i.copyTo(r));var l=a.t,h=a[l-1];if(0!=h){var d=h*(1<1?a[l-2]>>this.F2:0),p=this.FV/d,y=(1<=0&&(r[r.t++]=1,r.subTo(v,r)),o.ONE.dlShiftTo(l,v),v.subTo(a,a);a.t=0;){var _=r[--m]==h?this.DM:Math.floor(r[m]*p+(r[m-1]+g)*y);if((r[m]+=a.am(0,_,r,b,0,l))<_)for(a.dlShiftTo(b,v),r.subTo(v,r);r[m]<--_;)r.subTo(v,r)}null!=t&&(r.drShiftTo(l,t),u!=c&&o.ZERO.subTo(t,t)),r.t=l,r.clamp(),f>0&&r.rShiftTo(f,r),u<0&&o.ZERO.subTo(r,r)}}}function M(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 D(e){this.m=e}function U(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function F(e){return e}function K(e){e.divRemTo(this.m,null,e)}function q(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function H(e,t){e.squareTo(t),this.reduce(t)}function z(){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 W(e){var t=s();return e.copyTo(t),this.reduce(t),t}function $(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e[r]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}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,r){e.multiplyTo(t,r),this.reduce(r)}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 r=s(),n=s(),i=t.convert(this),a=C(e)-1;for(i.copyTo(r);--a>=0;)if(t.sqrTo(r,n),(e&1<0)t.mulTo(n,i,r);else{var u=r;r=n,n=u}return t.revert(r)}function Q(e,t){var r;return r=e<256||t.isEven()?new D(t):new V(t),this.exp(e,r)}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 ne(){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),r=Math.pow(e,t),n=_(r),i=s(),o=s(),a="";for(this.divRemTo(n,i,o);i.signum()>0;)a=(r+o.intValue()).toString(e).substr(1)+a,i.divRemTo(n,i,o);return o.intValue().toString(e)+a}function ae(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,s=0,a=0,u=0;u=r&&(this.dMultiply(n),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,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),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 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[e]&(1<>(r+=this.DB-8)):(n=this[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 fe(e){return 0==this.compareTo(e)}function le(e){return this.compareTo(e)<0?this:e}function he(e){return this.compareTo(e)>0?this:e}function de(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 xe(){for(var e=0;e=this.t?0!=this.s:0!=(this[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[r++]=n:n<-1&&(t[r++]=this.DV+n),t.t=r,t.clamp()}function je(e){var t=s();return this.addTo(e,t),t}function Le(e){var t=s();return this.subTo(e,t),t}function Me(e){var t=s();return this.multiplyTo(e,t),t}function De(){var e=s();return this.squareTo(e),e}function Ue(e){var t=s();return this.divRemTo(e,t,null),t}function Fe(e){var t=s();return this.divRemTo(e,null,t),t}function Ke(e){var t=s(),r=s();return this.divRemTo(e,t,r),new Array(t,r)}function qe(e){this[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[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 ze(){}function Ve(e){return e}function Ge(e,t,r){e.multiplyTo(t,r)}function We(e,t){e.squareTo(t)}function $e(e){return this.exp(e,new ze)}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[--n]=0;for(i=r.t-this.t;n=0;)r[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=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 rt(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function nt(e,t){var r=e.bitLength(),n,i=_(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 D(t):t.isEven()?new Ze(t):new V(t);var a=new Array,u=3,c=n-1,f=(1<1){var l=s();for(o.sqrTo(a[1],l);u<=f;)a[u]=s(),o.mulTo(l,a[u-2],a[u]),u+=2}var h=e.t-1,d,p=!0,y=s(),g;for(r=C(e[h])-1;h>=0;){for(r>=c?d=e[h]>>r-c&f:(d=(e[h]&(1<0&&(d|=e[h-1]>>this.DB+r-c)),u=n;0==(1&d);)d>>=1,--u;if((r-=u)<0&&(r+=this.DB,--h),p)a[d].copyTo(i),p=!1;else{for(;u>1;)o.sqrTo(i,y),o.sqrTo(y,i),u-=2;u>0?o.sqrTo(i,y):(g=i,i=y,y=g),o.mulTo(y,a[d],i)}for(;h>=0&&0==(e[h]&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[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r}function st(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return o.ZERO;for(var r=e.clone(),n=this.clone(),i=_(1),s=_(0),a=_(0),u=_(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),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(;n.isEven();)n.rShiftTo(1,n),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);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(a,i),s.subTo(u,s)):(n.subTo(r,n),t&&a.subTo(i,a),u.subTo(s,u))}return 0!=n.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}D.prototype.convert=U,D.prototype.revert=F,D.prototype.reduce=K,D.prototype.mulTo=q,D.prototype.sqrTo=H,V.prototype.convert=G,V.prototype.revert=W,V.prototype.reduce=$,V.prototype.mulTo=J,V.prototype.sqrTo=Y,o.prototype.copyTo=b,o.prototype.fromInt=v,o.prototype.fromString=w,o.prototype.clamp=S,o.prototype.dlShiftTo=I,o.prototype.drShiftTo=B,o.prototype.lShiftTo=O,o.prototype.rShiftTo=P,o.prototype.subTo=R,o.prototype.multiplyTo=N,o.prototype.squareTo=j,o.prototype.divRemTo=L,o.prototype.invDigit=z,o.prototype.isEven=Z,o.prototype.exp=X,o.prototype.toString=E,o.prototype.negate=k,o.prototype.abs=A,o.prototype.compareTo=x,o.prototype.bitLength=T,o.prototype.mod=M,o.prototype.modPowInt=Q,o.ZERO=_(0),o.ONE=_(1),ze.prototype.convert=Ve,ze.prototype.revert=Ve,ze.prototype.mulTo=Ge,ze.prototype.sqrTo=We,Ze.prototype.convert=Xe,Ze.prototype.revert=Qe,Ze.prototype.reduce=et,Ze.prototype.mulTo=rt,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],ct,ft,lt;function ht(e){var t,r=this.abs();if(1==r.t&&r[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,ft[lt++]^=e>>16&255,ft[lt++]^=e>>24&255,lt>=xt&&(lt-=xt)}function yt(){pt((new Date).getTime())}if(o.prototype.chunkSize=ie,o.prototype.toRadix=se,o.prototype.fromRadix=ae,o.prototype.fromNumber=ue,o.prototype.bitwiseTo=de,o.prototype.changeBit=Be,o.prototype.addTo=Ne,o.prototype.dMultiply=qe,o.prototype.dAddOffset=He,o.prototype.multiplyLowerTo=Ye,o.prototype.multiplyUpperTo=Je,o.prototype.modInt=ot,o.prototype.millerRabin=dt,o.prototype.clone=ee,o.prototype.intValue=te,o.prototype.byteValue=re,o.prototype.shortValue=ne,o.prototype.signum=oe,o.prototype.toByteArray=ce,o.prototype.equals=fe,o.prototype.min=le,o.prototype.max=he,o.prototype.and=ye,o.prototype.or=me,o.prototype.xor=ve,o.prototype.andNot=we,o.prototype.not=Se,o.prototype.shiftLeft=Ee,o.prototype.shiftRight=ke,o.prototype.getLowestSetBit=xe,o.prototype.bitCount=Te,o.prototype.testBit=Ie,o.prototype.setBit=Oe,o.prototype.clearBit=Pe,o.prototype.flipBit=Re,o.prototype.add=je,o.prototype.subtract=Le,o.prototype.multiply=Me,o.prototype.divide=Ue,o.prototype.remainder=Fe,o.prototype.divideAndRemainder=Ke,o.prototype.modPow=nt,o.prototype.modInverse=st,o.prototype.pow=$e,o.prototype.gcd=it,o.prototype.isProbablePrime=ht,o.prototype.square=De,o.prototype.Barrett=Ze,null==ft){var gt;if(ft=new Array,lt=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var mt=new Uint8Array(32);for(window.crypto.getRandomValues(mt),gt=0;gt<32;++gt)ft[lt++]=mt[gt]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var bt=window.crypto.random(32);for(gt=0;gt>>8,ft[lt++]=255>lt=0,yt()}function vt(){if(null==ct){for(yt(),ct=At(),ct.init(ft),lt=0;ltn)return r;do{t%2&&(r+=e),t=G(t/2),t&&(e+=e)}while(t);return r}function J(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),r=r>i?i:r,r<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(i);++n=n?e:J(e,t,r)}function Q(e,t){t=void 0===t?" ":Z(t);var r=t.length;if(r<2)return r?Y(t,e):t;var n=Y(t,V(e/D(t)));return M(t)?X(U(n),0,e).join(""):n.slice(0,e)}function ee(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function te(e){return!!e&&"object"==typeof e}function re(e){return"symbol"==typeof e||te(e)&&H.call(e)==s}function ne(e){if(!e)return 0===e?e:0;if(e=oe(e),e===r||e===-r){var t=e<0?-1:1;return t*i}return e==e?e:0}function ie(e){var t=ne(e),r=t%1;return t==t?r?t-r:t:0}function oe(e){if("number"==typeof e)return e;if(re(e))return o;if(ee(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ee(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(a,"");var r=c.test(e);return r||f.test(e)?B(e.slice(2),r?2:8):u.test(e)?o:+e}function se(e){return null==e?"":Z(e)}function ae(e,t,r){e=se(e),t=ie(t);var n=t?D(e):0;return t&&nn)return r;do{t%2&&(r+=e),t=w(t/2),t&&(e+=e)}while(t);return r}function A(e){if("string"==typeof e)return e;if(N(e))return E?E.call(e):"";var t=e+"";return"0"==t&&1/e==-r?"-0":t}function x(e,t){return t=null==t?n:t,!!t&&("number"==typeof e||d.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=n}function P(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function R(e){return!!e&&"object"==typeof e}function N(e){return"symbol"==typeof e||R(e)&&v.call(e)==u}function j(e){if(!e)return 0===e?e:0;if(e=M(e),e===r||e===-r){var t=e<0?-1:1;return t*i}return e==e?e:0}function L(e){var t=j(e),r=t%1;return t==t?r?t-r:t:0}function M(e){if("number"==typeof e)return e;if(N(e))return o;if(P(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=P(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(c,"");var r=l.test(e);return r||h.test(e)?p(e.slice(2),r?2:8):f.test(e)?o:+e}function D(e){return null==e?"":A(e)}function U(e,t,r){return t=(r?C(e,t,r):void 0===t)?1:L(t),k(D(e),t)}e.exports=U}).call(this,r(10))},function(e,t,r){(function(e,r){var n=200,i="Expected a function",o="__lodash_hash_undefined__",s=1,a=2,u=1/0,c=9007199254740991,f=1.7976931348623157e308,l=NaN,h="[object Arguments]",d="[object Array]",p="[object Boolean]",y="[object Date]",g="[object Error]",m="[object Function]",b="[object GeneratorFunction]",v="[object Map]",_="[object Number]",w="[object Object]",S="[object Promise]",E="[object RegExp]",k="[object Set]",A="[object String]",x="[object Symbol]",C="[object WeakMap]",T="[object ArrayBuffer]",I="[object DataView]",B="[object Float32Array]",O="[object Float64Array]",P="[object Int8Array]",R="[object Int16Array]",N="[object Int32Array]",j="[object Uint8Array]",L="[object Uint8ClampedArray]",M="[object Uint16Array]",D="[object Uint32Array]",U=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,F=/^\w*$/,K=/^\./,q=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,H=/[\\^$.*+?()[\]{}|]/g,z=/^\s+|\s+$/g,V=/\\(\\)?/g,G=/^[-+]0x[0-9a-f]+$/i,W=/^0b[01]+$/i,$=/^\[object .+?Constructor\]$/,Y=/^0o[0-7]+$/i,J=/^(?:0|[1-9]\d*)$/,Z={};Z[B]=Z[O]=Z[P]=Z[R]=Z[N]=Z[j]=Z[L]=Z[M]=Z[D]=!0,Z[h]=Z[d]=Z[T]=Z[p]=Z[I]=Z[y]=Z[g]=Z[m]=Z[v]=Z[_]=Z[w]=Z[E]=Z[k]=Z[A]=Z[C]=!1;var X=parseInt,Q="object"==typeof e&&e&&e.Object===Object&&e,ee="object"==typeof self&&self&&self.Object===Object&&self,te=Q||ee||Function("return this")(),re=t&&!t.nodeType&&t,ne=re&&"object"==typeof r&&r&&!r.nodeType&&r,ie=ne&&ne.exports===re,oe=ie&&Q.process,se=function(){try{return oe&&oe.binding("util")}catch(e){}}(),ae=se&&se.isTypedArray;function ue(e,t){for(var r=-1,n=e?e.length:0;++r-1}function ot(e,t){var r=this.__data__,n=St(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function st(e){var t=-1,r=e?e.length:0;for(this.clear();++t-1?i[o?t[s]:s]:void 0}}function Ut(e,t,r,n,i,o){var u=i&a,c=e.length,f=t.length;if(c!=f&&!(u&&f>c))return!1;var l=o.get(e);if(l&&o.get(t))return l==t;var h=-1,d=!0,p=i&s?new ht:void 0;for(o.set(e,t),o.set(t,e);++h-1&&e%1==0&&e-1&&e%1==0&&e<=c}function dr(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function pr(e){return!!e&&"object"==typeof e}function yr(e){return"symbol"==typeof e||pr(e)&&xe.call(e)==x}var gr=ae?he(ae):Bt;function mr(e){if(!e)return 0===e?e:0;if(e=vr(e),e===u||e===-u){var t=e<0?-1:1;return t*f}return e==e?e:0}function br(e){var t=mr(e),r=t%1;return t==t?r?t-r:t:0}function vr(e){if("number"==typeof e)return e;if(yr(e))return l;if(dr(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=dr(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(z,"");var r=W.test(e);return r||Y.test(e)?X(e.slice(2),r?2:8):G.test(e)?l:+e}function _r(e){return null==e?"":Lt(e)}function wr(e,t,r){var n=null==e?void 0:Et(e,t);return void 0===n?r:n}function Sr(e,t){return null!=e&&Gt(e,t,At)}function Er(e){return cr(e)?wt(e):Pt(e)}function kr(e){return e}function Ar(e){return $t(e)?fe(tr(e)):jt(e)}r.exports=ir}).call(this,r(10),r(32)(e))},function(e,t,r){"use strict";var n=r(177).sprintf,i=t.spanAllZeroes=function(e){return e.replace(/(0+)/g,'$1')};function o(e){return e.replace(/^(0+)/,'$1')}t.spanAll=function(e,t){void 0===t&&(t=0);var r=e.split("");return r.map(function(e,r){return n('%s',e,r+t,i(e))}).join("")},t.spanLeadingZeroes=function(e){var t=e.split(":");return t.map(function(e){return o(e)}).join(":")},t.simpleGroup=function(e,t){var r=e.split(":");return t||(t=0),r.map(function(e,r){return/group-v4/.test(e)?e:n('%s',r+t,o(e))}).join(":")}},function(e,t,r){"use strict";(function(t){const n=r(14),i=r(1099),o=r(46);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){"use strict";(function(e){const n=r(326),i=r(327)(),o=r(1101),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=(t,r,o)=>{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";(function(t){const n=r(18),i=r(1106);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(e){const n=r(7);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";(function(e){const n=r(326),i=r(327)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(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(1109),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(o).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,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},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";const n=r(1),i=r(178).Reporter,o=r(0).Buffer;function s(e,t){i.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function a(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof a||(e=new a(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}n(s,i),t.DecoderBuffer=s,s.prototype.save=function e(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},s.prototype.restore=function e(t){const r=new s(this.base);return r.offset=t.offset,r.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),r},s.prototype.isEmpty=function e(){return this.offset===this.length},s.prototype.readUInt8=function e(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},s.prototype.skip=function e(t,r){if(!(this.offset+t<=this.length))return this.error(r||"DecoderBuffer overrun");const n=new s(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},s.prototype.raw=function e(t){return this.base.slice(t?t.offset:this.offset,this.length)},t.EncoderBuffer=a,a.prototype.join=function e(t,r){return t||(t=new o(this.length)),r||(r=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach(function(e){e.join(t,r),r+=e.length}):("number"==typeof this.value?t[r]=this.value:"string"==typeof this.value?t.write(this.value,r):o.isBuffer(this.value)&&this.value.copy(t,r),r+=this.length),t)}},function(e,t,r){"use strict";const n=t;n._reverse=function e(t){const r={};return Object.keys(t).forEach(function(e){(0|e)==e&&(e|=0);const n=t[e];r[n]=e}),r},n.der=r(1113)},function(e,t,r){"use strict";const n=r(1),i=r(138),o=i.base,s=i.bignum,a=i.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.Node.call(this,"der",e)}function f(e,t){let r=e.readUInt8(t);if(e.isError(r))return r;const n=a.tagClass[r>>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 l(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=l(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;o1||!n.part&&!l[x])return!1;return(!n.only||!f)&&A},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=h.shift(),y[p]||(y[p]={}),y=y[p];p=h.shift(),y[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[y[b]]={key:b,schema:p[y[b]].schema.concat(d[m].schema)}:p.push(d[m])}}else r._inner[l]=r._inner[l].concat(d);else r._inner[l]=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=l.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(l.schema(this._currentJoi,i.then)):void 0,a=i.hasOwnProperty("otherwise")?this.concat(l.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 l=[],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=h._try(o._flags.default,a);i=c.value,c.error&&l.push(o.createError("any.default",{error:c.error},r,n))}if(l.length&&"function"==typeof o._flags.error){var d=o._flags.error.call(o,l);l="string"==typeof d?[o.createOverrideError("override",{reason:l},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:l.length?l:null}};if(this._coerce){var p=this._coerce.call(this,t,r,n);if(p.errors)return t=p.value,l=l.concat(p.errors),d();t=p.value}this._flags.empty&&!this._flags.empty._validate(this._prepareEmptyValue(t),null,h.defaults).errors&&(t=void 0);var y=this._flags.presence||n.presence;if("optional"===y){if(void 0===t){var g=this._flags.hasOwnProperty("default")&&void 0===this._flags.default;if(!g||"object"!==this._type)return d();t={}}}else{if("required"===y&&void 0===t)return l.push(this.createError("any.required",null,r,n)),d();if("forbidden"===y)return void 0===t?d():(l.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)&&(l.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 m=this._base.call(this,t,r,n);if(m.errors)return t=m.value,l=l.concat(m.errors),d();if(m.value!==t){if(t=m.value,this._valids.has(t,r,n,this._flags.insensitive))return d();if(this._invalids.has(t,r,n,this._flags.insensitive)&&(l.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&&(l.push(this.createError("any.allowOnly",{value:t,valids:this._valids.values({stripUndefined:!0})},r,n)),n.abortEarly))return d();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 M(this,t,r);case"utf8":case"utf-8":return P(this,t,r);case"ascii":return j(this,t,r);case"latin1":case"binary":return L(this,t,r);case"base64":return O(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 l=!0,h=0;hi&&(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,l;if(i+a<=r)switch(a){case 1:o<128&&(s=o);break;case 2:u=e[i+1],128==(192&u)&&(l=(31&o)<<6|63&u,l>127&&(s=l));break;case 3:u=e[i+1],c=e[i+2],128==(192&u)&&128==(192&c)&&(l=(15&o)<<12|(63&u)<<6|63&c,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:u=e[i+1],c=e[i+2],f=e[i+3],128==(192&u)&&128==(192&c)&&128==(192&f)&&(l=(15&o)<<18|(63&u)<<12|(63&c)<<6|63&f,l>65535&&l<1114112&&(s=l))}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 N(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 h(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),l=t.slice(r,n),h=0;ho)&&(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 A(this,t,r,n);case"utf8":case"utf-8":return x(this,t,r,n);case"ascii":return C(this,t,r,n);case"latin1":case"binary":return T(this,t,r,n);case"base64":return I(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(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 R=4096;function N(e){var t=e.length;if(t<=R)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 F(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 K(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 q(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 z(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 V(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||U(t,1,this.length),this[t]},c.prototype.readUInt16LE=function e(t,r){return r||U(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function e(t,r){return r||U(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function e(t,r){return r||U(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||U(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||U(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||U(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||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function e(t,r){r||U(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||U(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||U(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||U(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||U(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function e(t,r){return r||U(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function e(t,r){return r||U(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function e(t,r){return r||U(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;F(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||F(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||F(this,t,r,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):K(this,t,r,!0),r+2},c.prototype.writeUInt16BE=function e(t,r,n){return t=+t,r|=0,n||F(this,t,r,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):K(this,t,r,!1),r+2},c.prototype.writeUInt32LE=function e(t,r,n){return t=+t,r|=0,n||F(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):q(this,t,r,!0),r+4},c.prototype.writeUInt32BE=function e(t,r,n){return t=+t,r|=0,n||F(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):q(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);F(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);F(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||F(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||F(this,t,r,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):K(this,t,r,!0),r+2},c.prototype.writeInt16BE=function e(t,r,n){return t=+t,r|=0,n||F(this,t,r,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):K(this,t,r,!1),r+2},c.prototype.writeInt32LE=function e(t,r,n){return t=+t,r|=0,n||F(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):q(this,t,r,!0),r+4},c.prototype.writeInt32BE=function e(t,r,n){return t=+t,r|=0,n||F(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):q(this,t,r,!1),r+4},c.prototype.writeFloatLE=function e(t,r,n){return z(this,t,r,!0,n)},c.prototype.writeFloatBE=function e(t,r,n){return z(this,t,r,!1,n)},c.prototype.writeDoubleLE=function e(t,r,n){return V(this,t,r,!0,n)},c.prototype.writeDoubleBE=function e(t,r,n){return V(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(W(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 l=o.reach(n,"key");r="string"==typeof l?l+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],l=f.path,h=s,d=0;;++d){var p=l[d];if(h.isImmutable&&(h=h.clone()),!(d+11)for(var r=1;r0,"You need to provide at least one extension"),this.assert(p,t.extensionsSchema);var b=Object.create(this.any());n(b,this);for(var v=function r(i){var c=p[i];"function"==typeof c&&(c=c(b)),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=g.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 l?n.params._inner.children.map(function(e){return e.key}):Object.keys(n.params):[],o=n.params?h.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=h.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=h.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=h.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]),b(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),l(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 l(e,r,n){if(e.customInspect&&r&&I(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return S(i)||(i=l(e,i,n)),i}var o=h(e,r);if(o)return o;var s=Object.keys(r),a=f(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),T(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return d(r);if(0===s.length){if(I(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(A(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(C(r))return e.stylize(Date.prototype.toString.call(r),"date");if(T(r))return d(r)}var c="",b=!1,v=["{","}"],_;if(m(r)&&(b=!0,v=["[","]"]),I(r)){var w=r.name?": "+r.name:"";c=" [Function"+w+"]"}return A(r)&&(c=" "+RegExp.prototype.toString.call(r)),C(r)&&(c=" "+Date.prototype.toUTCString.call(r)),T(r)&&(c=" "+d(r)),0!==s.length||b&&0!=r.length?n<0?A(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),_=b?p(e,r,n,a,s):s.map(function(t){return y(e,r,n,a,t,b)}),e.seen.pop(),g(_,c,v)):v[0]+c+v[1]}function h(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"):b(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 g(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 m(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 S(e){return"string"==typeof e}function E(e){return"symbol"==typeof e}function k(e){return void 0===e}function A(e){return x(e)&&"[object RegExp]"===O(e)}function x(e){return"object"==typeof e&&null!==e}function C(e){return x(e)&&"[object Date]"===O(e)}function T(e){return x(e)&&("[object Error]"===O(e)||e instanceof Error)}function I(e){return"function"==typeof e}function B(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(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=m,t.isBoolean=b,t.isNull=v,t.isNullOrUndefined=_,t.isNumber=w,t.isString=S,t.isSymbol=E,t.isUndefined=k,t.isRegExp=A,t.isObject=x,t.isDate=C,t.isError=T,t.isFunction=I,t.isPrimitive=B,t.isBuffer=r(40);var R=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function N(){var e=new Date,t=[P(e.getHours()),P(e.getMinutes()),P(e.getSeconds())].join(":");return[e.getDate(),R[e.getMonth()],t].join(" ")}function j(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",N(),t.format.apply(t,arguments))},t.inherits=r(39),t._extend=function(e,t){if(!t||!x(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 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 M(this,t,r);case"utf8":case"utf-8":return P(this,t,r);case"ascii":return j(this,t,r);case"latin1":case"binary":return L(this,t,r);case"base64":return O(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 l=!0,h=0;hi&&(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,l;if(i+a<=r)switch(a){case 1:o<128&&(s=o);break;case 2:u=e[i+1],128==(192&u)&&(l=(31&o)<<6|63&u,l>127&&(s=l));break;case 3:u=e[i+1],c=e[i+2],128==(192&u)&&128==(192&c)&&(l=(15&o)<<12|(63&u)<<6|63&c,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:u=e[i+1],c=e[i+2],f=e[i+3],128==(192&u)&&128==(192&c)&&128==(192&f)&&(l=(15&o)<<18|(63&u)<<12|(63&c)<<6|63&f,l>65535&&l<1114112&&(s=l))}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 N(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 h(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),l=t.slice(r,n),h=0;ho)&&(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 A(this,t,r,n);case"utf8":case"utf-8":return x(this,t,r,n);case"ascii":return C(this,t,r,n);case"latin1":case"binary":return T(this,t,r,n);case"base64":return I(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(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 R=4096;function N(e){var t=e.length;if(t<=R)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 F(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 K(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 q(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 z(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 V(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||U(t,1,this.length),this[t]},c.prototype.readUInt16LE=function e(t,r){return r||U(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function e(t,r){return r||U(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function e(t,r){return r||U(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||U(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||U(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||U(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||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function e(t,r){r||U(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||U(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||U(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||U(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||U(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function e(t,r){return r||U(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function e(t,r){return r||U(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function e(t,r){return r||U(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;F(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||F(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||F(this,t,r,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):K(this,t,r,!0),r+2},c.prototype.writeUInt16BE=function e(t,r,n){return t=+t,r|=0,n||F(this,t,r,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):K(this,t,r,!1),r+2},c.prototype.writeUInt32LE=function e(t,r,n){return t=+t,r|=0,n||F(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):q(this,t,r,!0),r+4},c.prototype.writeUInt32BE=function e(t,r,n){return t=+t,r|=0,n||F(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):q(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);F(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);F(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||F(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||F(this,t,r,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):K(this,t,r,!0),r+2},c.prototype.writeInt16BE=function e(t,r,n){return t=+t,r|=0,n||F(this,t,r,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):K(this,t,r,!1),r+2},c.prototype.writeInt32LE=function e(t,r,n){return t=+t,r|=0,n||F(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):q(this,t,r,!0),r+4},c.prototype.writeInt32BE=function e(t,r,n){return t=+t,r|=0,n||F(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):q(this,t,r,!1),r+4},c.prototype.writeFloatLE=function e(t,r,n){return z(this,t,r,!0,n)},c.prototype.writeFloatBE=function e(t,r,n){return z(this,t,r,!1,n)},c.prototype.writeDoubleLE=function e(t,r,n){return V(this,t,r,!0,n)},c.prototype.writeDoubleBE=function e(t,r,n){return V(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 Z(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(W(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 l=o.reach(n,"key");r="string"==typeof l?l+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],l=f.path,h=s,d=0;;++d){var p=l[d];if(h.isImmutable&&(h=h.clone()),!(d+11)for(var r=1;r0,"You need to provide at least one extension"),this.assert(p,t.extensionsSchema);var b=Object.create(this.any());n(b,this);for(var v=function r(i){var c=p[i];"function"==typeof c&&(c=c(b)),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=g.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 l?n.params._inner.children.map(function(e){return e.key}):Object.keys(n.params):[],o=n.params?h.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=h.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=h.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=h.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]),b(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),l(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 l(e,r,n){if(e.customInspect&&r&&I(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return S(i)||(i=l(e,i,n)),i}var o=h(e,r);if(o)return o;var s=Object.keys(r),a=f(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),T(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return d(r);if(0===s.length){if(I(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(A(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(C(r))return e.stylize(Date.prototype.toString.call(r),"date");if(T(r))return d(r)}var c="",b=!1,v=["{","}"],_;if(m(r)&&(b=!0,v=["[","]"]),I(r)){var w=r.name?": "+r.name:"";c=" [Function"+w+"]"}return A(r)&&(c=" "+RegExp.prototype.toString.call(r)),C(r)&&(c=" "+Date.prototype.toUTCString.call(r)),T(r)&&(c=" "+d(r)),0!==s.length||b&&0!=r.length?n<0?A(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),_=b?p(e,r,n,a,s):s.map(function(t){return y(e,r,n,a,t,b)}),e.seen.pop(),g(_,c,v)):v[0]+c+v[1]}function h(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"):b(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 g(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 m(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 S(e){return"string"==typeof e}function E(e){return"symbol"==typeof e}function k(e){return void 0===e}function A(e){return x(e)&&"[object RegExp]"===O(e)}function x(e){return"object"==typeof e&&null!==e}function C(e){return x(e)&&"[object Date]"===O(e)}function T(e){return x(e)&&("[object Error]"===O(e)||e instanceof Error)}function I(e){return"function"==typeof e}function B(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(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=m,t.isBoolean=b,t.isNull=v,t.isNullOrUndefined=_,t.isNumber=w,t.isString=S,t.isSymbol=E,t.isUndefined=k,t.isRegExp=A,t.isObject=x,t.isDate=C,t.isError=T,t.isFunction=I,t.isPrimitive=B,t.isBuffer=r(40);var R=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function N(){var e=new Date,t=[P(e.getHours()),P(e.getMinutes()),P(e.getSeconds())].join(":");return[e.getDate(),R[e.getMonth()],t].join(" ")}function j(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",N(),t.format.apply(t,arguments))},t.inherits=r(39),t._extend=function(e,t){if(!t||!x(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){ /*! * 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;l--)if(u[l]!==c[l])return!1;for(l=u.length-1;l>=0;l--)if(f=u[l],!v(e[f],t[f],r,n))return!1;return!0}function S(e,t,r){v(e,t,!0)&&m(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 A(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&&m(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)&&m(i,r,"Got unwanted exception"+n),e&&i&&r&&!E(i,r)||!e&&i)throw i}l.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 r=t.stackStartFunction||m;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(l.AssertionError,Error),l.fail=m,l.ok=b,l.equal=function e(t,r,n){t!=r&&m(t,r,n,"==",l.equal)},l.notEqual=function e(t,r,n){t==r&&m(t,r,n,"!=",l.notEqual)},l.deepEqual=function e(t,r,n){v(t,r,!1)||m(t,r,n,"deepEqual",l.deepEqual)},l.deepStrictEqual=function e(t,r,n){v(t,r,!0)||m(t,r,n,"deepStrictEqual",l.deepStrictEqual)},l.notDeepEqual=function e(t,r,n){v(t,r,!1)&&m(t,r,n,"notDeepEqual",l.notDeepEqual)},l.notDeepStrictEqual=S,l.strictEqual=function e(t,r,n){t!==r&&m(t,r,n,"===",l.strictEqual)},l.notStrictEqual=function e(t,r,n){t===r&&m(t,r,n,"!==",l.notStrictEqual)},l.throws=function(e,t,r){A(!0,e,t,r)},l.doesNotThrow=function(e,t,r){A(!1,e,t,r)},l.ifError=function(e){if(e)throw e};var x=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)},l=void 0===r.allowUnicode||!!r.allowUnicode;!l&&/[^\x00-\x7f]/.test(t)&&f(o.diagnoses.undesiredNonAscii);for(var h={now:o.components.localpart,prev:o.components.localpart,stack:[o.components.localpart]},d="",p={local:"",domain:""},y={locals:[""],domains:[""]},g=0,m=0,b=0,v=void 0,_=!1,w=!1,S=t.length,E=void 0,k=0;k64?f(o.diagnoses.rfc5322LocalTooLong):h.prev!==o.components.contextComment&&h.prev!==o.components.contextFWS||f(o.diagnoses.deprecatedCFWSNearAt),h.now=o.components.domain,h.stack[0]=o.components.domain,g=0,m=0,w=!1;break;default:if(w)switch(h.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: "+h.prev)}else h.prev=h.now,v=E.codePointAt(0),(o.specials(v)||o.c0Controls(v)||o.c1Controls(v))&&f(o.diagnoses.errExpectingATEXT),p.local+=E,y.locals[g]+=E,m+=e.byteLength(E,"utf8")}break;case o.components.domain:switch(E){case"(":0===m?f(0===g?o.diagnoses.deprecatedCFWSNearAt:o.diagnoses.deprecatedComment):(w=!0,f(o.diagnoses.cfwsComment)),h.stack.push(h.now),h.now=o.components.contextComment;break;case".":var A=i.encode(y.domains[g]).length;0===m?f(0===g?o.diagnoses.errDotStart:o.diagnoses.errConsecutiveDots):_?f(o.diagnoses.errDomainHyphenEnd):A>63&&f(o.diagnoses.rfc5322LabelTooLong),w=!1,m=0,++g,y.domains[g]="",p.domain+=E;break;case"[":0===p.domain.length?(w=!0,m+=e.byteLength(E,"utf8"),h.stack.push(h.now),h.now=o.components.literal,p.domain+=E,y.domains[g]+=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===m?f(0===g?o.diagnoses.deprecatedCFWSNearAt:o.diagnoses.deprecatedFWS):(f(o.diagnoses.cfwsFWS),w=!0),h.stack.push(h.now),h.now=o.components.contextFWS,d=E;break;default:if(w)switch(h.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: "+h.prev)}v=E.codePointAt(0),_=!1,o.specials(v)||o.c0Controls(v)||o.c1Controls(v)?f(o.diagnoses.errExpectingATEXT):"-"===E?(0===m&&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,y.domains[g]+=E,m+=e.byteLength(E,"utf8")}break;case o.components.literal:switch(E){case"]":if(cB?f(o.diagnoses.rfc5322IPv6MaxGroups):O.length===B&&f(o.diagnoses.deprecatedIPv6)):O.length!==B&&f(o.diagnoses.rfc5322IPv6GroupCount),":"===I[0]&&":"!==I[1]?f(o.diagnoses.rfc5322IPv6ColonStart):":"===I[I.length-1]&&":"!==I[I.length-2]?f(o.diagnoses.rfc5322IPv6ColonEnd):o.checkIpV6(O)?f(o.diagnoses.rfc5321AddressLiteral):f(o.diagnoses.rfc5322IPv6BadCharacter)}}else f(o.diagnoses.rfc5322DomainLiteral);p.domain+=E,y.domains[g]+=E,m+=e.byteLength(E,"utf8"),h.prev=h.now,h.now=h.stack.pop();break;case"\\":f(o.diagnoses.rfc5322DomainLiteralOBSDText),h.stack.push(h.now),h.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),h.stack.push(h.now),h.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,y.domains[g]+=E,m+=e.byteLength(E,"utf8")}break;case o.components.contextQuotedString:switch(E){case"\\":h.stack.push(h.now),h.now=o.components.contextQuotedPair;break;case"\r":if(S===++k||"\n"!==t[k]){f(o.diagnoses.errCRNoLF);break}case"\t":p.local+=" ",y.locals[g]+=" ",m+=e.byteLength(E,"utf8"),f(o.diagnoses.cfwsFWS),h.stack.push(h.now),h.now=o.components.contextFWS,d=E;break;case'"':p.local+=E,y.locals[g]+=E,m+=e.byteLength(E,"utf8"),h.prev=h.now,h.now=h.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,y.locals[g]+=E,m+=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),h.prev=h.now,h.now=h.stack.pop();var P="\\"+E;switch(h.now){case o.components.contextComment:break;case o.components.contextQuotedString:p.local+=P,y.locals[g]+=P,m+=2;break;case o.components.literal:p.domain+=P,y.domains[g]+=P,m+=2;break;default:throw new Error("quoted pair logic invoked in an invalid context: "+h.now)}break;case o.components.contextComment:switch(E){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(S===++k||"\n"!==t[k]){f(o.diagnoses.errCRNoLF);break}case" ":case"\t":f(o.diagnoses.cfwsFWS),h.stack.push(h.now),h.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}++b>1?f(o.diagnoses.deprecatedFWS):b=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),b=0,h.prev=h.now,h.now=h.stack.pop(),--k}d=E;break;default:throw new Error("unknown context: "+h.now)}if(c>o.categories.rfc5322)break}if(c255)f(o.diagnoses.rfc5322DomainTooLong);else if(e.byteLength(p.local,"utf8")+R+1>254)f(o.diagnoses.rfc5322TooLong);else if(m>63)f(o.diagnoses.rfc5322LabelTooLong);else if(r.minDomainAtoms&&y.domains.length0){var _=u.shift();if(b=_._validate(d,m,i),b.errors){if(o.push(this.createError("array.ordered",{pos:l,reason:b.errors,value:d},{key:n.key,path:m.path},i)),i.abortEarly)return o}else if(_._flags.strip)h.fastSplice(t,l),--l,--f;else{if(!this._flags.sparse&&void 0===b.value){if(o.push(this.createError("array.sparse",null,{key:n.key,path:m.path,pos:l},i)),i.abortEarly)return o;continue}t[l]=b.value}continue}if(!this._inner.items.length){if(o.push(this.createError("array.orderedLength",{pos:l,limit:this._inner.ordereds.length},{key:n.key,path:m.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 l.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 l.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){l.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||l.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=g.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(g.cidrPresences,t.cidr),"cidr must be one of "+g.cidrPresences.join(", ")),t.version||"optional"===t.cidr||(r=y.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(g.normalizationForms,t),"normalization form must be one of "+g.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}(l),g.compare=function(e,r){return function(n,i){var o=h.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)})}},g.String.prototype.min=g.compare("min",function(e,r,n){var i=n?t.byteLength(e,n):e.length;return i>=r}),g.String.prototype.max=g.compare("max",function(e,r,n){var i=n?t.byteLength(e,n):e.length;return i<=r}),g.String.prototype.length=g.compare("length",function(e,r,n){var i=n?t.byteLength(e,n):e.length;return i===r}),g.String.prototype.uuid=g.String.prototype.guid,e.exports=new g.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 l(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 h(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,l=r?i-1:0,h=r?-1:1,d=e[t+l];for(l+=h,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=256*o+e[t+l],l+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+e[t+l],l+=h,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,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+l>=1?h/u:h*Math.pow(2,1-l),t*u>=2&&(s++,u/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(t*u-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-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*y}},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=l-h,k=Math.floor,A=String.fromCharCode,x;function C(e){throw new RangeError(S[e])}function T(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function I(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=T(i,t).join(".");return n+o}function B(e){for(var t=[],r=0,n=e.length,i,o;r=55296&&i<=56319&&r65535&&(e-=65536,t+=A(e>>>10&1023|55296),e=56320|1023&e),t+=A(e),t}).join("")}function P(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:l}function R(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function N(e,t,r){var n=0;for(e=r?k(e/y):e>>1,e+=k(e/t);e>E*d>>1;n+=l)e=k(e/E);return k(n+(E+1)*e/(e+p))}function j(e){var t=[],r=e.length,n,i=0,o=m,s=g,a,u,c,p,y,v,_,w,S;for(a=e.lastIndexOf(b),a<0&&(a=0),u=0;u=128&&C("not-basic"),t.push(e.charCodeAt(u));for(c=a>0?a+1:0;c=r&&C("invalid-input"),_=P(e.charCodeAt(c++)),(_>=l||_>k((f-i)/y))&&C("overflow"),i+=_*y,w=v<=s?h:v>=s+d?d:v-s,!(_k(f/S)&&C("overflow"),y*=S;n=t.length+1,s=N(i-p,n,0==p),k(i/n)>f-o&&C("overflow"),o+=k(i/n),i%=n,t.splice(i++,0,o)}return O(t)}function L(e){var t,r,n,i,o,s,a,u,c,p,y,v=[],_,w,S,E;for(e=B(e),_=e.length,t=m,r=0,o=g,s=0;s<_;++s)y=e[s],y<128&&v.push(A(y));for(n=i=v.length,i&&v.push(b);n<_;){for(a=f,s=0;s<_;++s)y=e[s],y>=t&&yk((f-r)/w)&&C("overflow"),r+=(a-t)*w,t=a,s=0;s<_;++s)if(y=e[s],yf&&C("overflow"),y==t){for(u=r,c=l;p=c<=o?h:c>=o+d?d:c-o,!(u1&&this._buf[this._buf.length-1]===s;)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{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=h((t||"").toString().trim())}catch(e){return r(e)}r(null,n)})}),t.readme=o,t.parseShardFun=h,t.Prefix=c,t.Suffix=f,t.NextToLast=l},function(e,t,r){"use strict";const n=r(4),i=r(7),o=n("repo:lock"),s="repo.lock",a={};t.lock=((e,t)=>{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,r){"use strict";e.exports=r(1179)},function(e,t,r){var n=r(338),i=r(130),o=n(i,"Map");e.exports=o},function(e,t,r){var n=r(1202),i=r(1209),o=r(1211),s=r(1212),a=r(1213);function u(e){var t=-1,r=null==e?0:e.length;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(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){(function(t){var r="Expected a function",n=NaN,i="[object Symbol]",o=/^\s+|\s+$/g,s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt,f="object"==typeof t&&t&&t.Object===Object&&t,l="object"==typeof self&&self&&self.Object===Object&&self,h=f||l||Function("return this")(),d=Object.prototype,p=d.toString,y=Math.max,g=Math.min,m=function(){return h.Date.now()};function b(e,t,n){var i,o,s,a,u,c,f=0,l=!1,h=!1,d=!0;if("function"!=typeof e)throw new TypeError(r);function p(t){var r=i,n=o;return i=o=void 0,f=t,a=e.apply(n,r),a}function b(e){return f=e,u=setTimeout(E,t),l?p(e):a}function _(e){var r=e-c,n=e-f,i=t-r;return h?g(i,s-n):i}function w(e){var r=e-c,n=e-f;return void 0===c||r>=t||r<0||h&&n>=s}function E(){var e=m();if(w(e))return k(e);u=setTimeout(E,_(e))}function k(e){return u=void 0,d&&i?p(e):(i=o=void 0,a)}function A(){void 0!==u&&clearTimeout(u),f=0,i=c=o=u=void 0}function x(){return void 0===u?a:k(m())}function C(){var e=m(),r=w(e);if(i=arguments,o=this,c=e,r){if(void 0===u)return b(c);if(h)return u=setTimeout(E,t),p(c)}return void 0===u&&(u=setTimeout(E,t)),a}return t=S(t)||0,v(n)&&(l=!!n.leading,h="maxWait"in n,s=h?y(S(n.maxWait)||0,t):s,d="trailing"in n?!!n.trailing:d),C.cancel=A,C.flush=x,C}function v(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function _(e){return!!e&&"object"==typeof e}function w(e){return"symbol"==typeof e||_(e)&&p.call(e)==i}function S(e){if("number"==typeof e)return e;if(w(e))return n;if(v(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=v(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(o,"");var r=a.test(e);return r||u.test(e)?c(e.slice(2),r?2:8):s.test(e)?n:+e}e.exports=b}).call(this,r(8))},function(e,t,r){"use strict";var n=r(1264);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,l,h;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){e.exports={_from:"ipfs@^0.31.7",_id:"ipfs@0.31.7",_inBundle:!1,_integrity:"sha512-HuA0Y6K7Y6f2Yu+ehUlGhv5VF2PtdZuME1AWYu/8zkfZ+HRpIYANjoK9GqZh6CQjOTJnIrEdqkHpOivUrZnIIg==",_location:"/ipfs",_phantomChildren:{"base-x":"3.0.4"},_requested:{type:"range",registry:!0,raw:"ipfs@^0.31.7",name:"ipfs",escapedName:"ipfs",rawSpec:"^0.31.7",saveSpec:null,fetchSpec:"^0.31.7"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/ipfs/-/ipfs-0.31.7.tgz",_shasum:"4383c263421da9e6020257e44aae3759f3fdc7f0",_spec:"ipfs@^0.31.7",_where:"/Users/mitra/git/dweb-transports",bin:{jsipfs:"src/cli/bin.js"},browser:{"./src/core/components/init-assets.js":!1,"./src/core/runtime/config-nodejs.js":"./src/core/runtime/config-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","./src/core/runtime/dns-nodejs.js":"./src/core/runtime/dns-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:"Alan Shaw",email:"alan@tableflip.io"},{name:"Alex Potsides",email:"alex@achingbrain.net"},{name:"Andrew de Andrade",email:"andrew@deandrade.com.br"},{name:"André Cruz",email:"andremiguelcruz@msn.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:"Christian Couder",email:"chriscool@tuxfamily.org"},{name:"Dafeng",email:"dfguo.joe@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:"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:"Marius Darila",email:"marius.darila@gmail.com"},{name:"Michelle Lee",email:"michelle@protocol.ai"},{name:"Mikeal Rogers",email:"mikeal.rogers@gmail.com"},{name:"Mithgol",email:"getgit@mithgol.ru"},{name:"My9Bot",email:"34904312+My9Bot@users.noreply.github.com"},{name:"Nuno Nogueira",email:"nunofmn@gmail.com"},{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:"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:"bitspill",email:"bitspill+github@bitspill.net"},{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:"Łukasz Magiera",email:"magik6k@users.noreply.github.com"},{name:"Максим Ильин",email:"negamaxi@gmail.com"},{name:"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ",email:"victorbjelkholm@gmail.com"}],dependencies:{"@nodeutils/defaults-deep":"^1.1.0",async:"^2.6.1","big.js":"^5.1.2","binary-querystring":"~0.1.2",bl:"^2.0.1",boom:"^7.2.0",bs58:"^4.0.1",byteman:"^1.3.5",cids:"~0.5.3",debug:"^3.1.0","err-code":"^1.1.2","file-type":"^8.1.0",filesize:"^3.6.1",fnv1a:"^1.0.1","fsm-event":"^2.1.0","get-folder-size":"^2.0.0",glob:"^7.1.2",hapi:"^16.6.2","hapi-set-header":"^1.0.2",hoek:"^5.0.3","human-to-milliseconds":"^1.0.0","interface-datastore":"~0.4.2","ipfs-api":"^24.0.0","ipfs-bitswap":"~0.20.3","ipfs-block":"~0.7.1","ipfs-block-service":"~0.14.0","ipfs-http-response":"~0.1.2","ipfs-mfs":"~0.3.0","ipfs-multipart":"~0.1.0","ipfs-repo":"~0.23.1","ipfs-unixfs":"~0.1.15","ipfs-unixfs-engine":"~0.32.1",ipld:"~0.17.3","ipld-dag-cbor":"~0.12.1","ipld-dag-pb":"~0.14.6","is-ipfs":"~0.4.2","is-pull-stream":"~0.0.0","is-stream":"^1.1.0",joi:"^13.4.0","joi-browser":"^13.4.0","joi-multiaddr":"^2.0.0",libp2p:"~0.23.0","libp2p-bootstrap":"~0.9.3","libp2p-circuit":"~0.2.0","libp2p-floodsub":"~0.15.0","libp2p-kad-dht":"~0.10.1","libp2p-keychain":"~0.3.1","libp2p-mdns":"~0.12.0","libp2p-mplex":"~0.8.0","libp2p-secio":"~0.10.0","libp2p-tcp":"~0.12.0","libp2p-webrtc-star":"~0.15.3","libp2p-websocket-star":"~0.8.1","libp2p-websockets":"~0.12.0",lodash:"^4.17.10",mafmt:"^6.0.0","mime-types":"^2.1.19",mkdirp:"~0.5.1",multiaddr:"^5.0.0","multiaddr-to-uri":"^4.0.0",multibase:"~0.4.0",multihashes:"~0.4.13",once:"^1.4.0","path-exists":"^3.0.0","peer-book":"~0.8.0","peer-id":"~0.11.0","peer-info":"~0.14.1",progress:"^2.0.0","prom-client":"^11.1.1","prometheus-gc-stats":"~0.5.1","promisify-es6":"^1.0.3","pull-abortable":"^4.1.1","pull-defer":"~0.2.2","pull-file":"^1.1.0","pull-ndjson":"~0.1.1","pull-paramap":"^1.2.2","pull-pushable":"^2.2.0","pull-sort":"^1.0.1","pull-stream":"^3.6.8","pull-stream-to-stream":"^1.3.4","pull-zip":"^2.0.1","read-pkg-up":"^4.0.0","readable-stream":"2.3.6","stream-to-pull-stream":"^1.7.2","tar-stream":"^1.6.1",temp:"~0.8.3",through2:"^2.0.3","update-notifier":"^2.5.0",yargs:"^12.0.1","yargs-parser":"^10.1.0","yargs-promise":"^1.1.0"},deprecated:!1,description:"JavaScript implementation of the IPFS specification",devDependencies:{aegir:"^15.1.0","buffer-loader":"~0.0.1",chai:"^4.1.2",delay:"^3.0.0","detect-node":"^2.0.3","dir-compare":"^1.4.0","dirty-chai":"^2.0.1","eslint-plugin-react":"^7.10.0",execa:"~0.10.0","expose-loader":"~0.7.5","form-data":"^2.3.2",hat:"0.0.3","interface-ipfs-core":"~0.76.1","ipfsd-ctl":"~0.39.1",mocha:"^5.2.0",ncp:"^2.0.0",nexpect:"~0.5.0","pretty-bytes":"^5.1.0",qs:"^6.5.2","random-fs":"^1.0.3",rimraf:"^2.6.2","stream-to-promise":"^2.2.0","transform-loader":"~0.2.4"},engines:{node:">=6.0.0",npm:">=3.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.1","prometheus-gc-stats":"~0.5.1"},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",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","test:bootstrapers":"IPFS_TEST=bootstrapers aegir test -t browser -f test/bootstrapers.js","test:browser":"aegir test -t browser --no-cors","test:node":"aegir test -t node","test:node:cli":"aegir test -t node -f test/cli/index.js","test:node:core":"aegir test -t node -f test/core/**/*.js","test:node:gateway":"aegir test -t node -f test/gateway/index.js","test:node:http":"aegir test -t node -f test/http-api/index.js","test:webworker":"aegir test -t webworker --no-cors"},version:"0.31.7"}},function(e,t,r){"use strict";const n=r(2),i=r(336).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,r){"use strict";const n=r(1292),i=r(89),o=r(41),s=r(1301),a=r(53).Connection,u=r(1303),c=r(4),f=c("libp2p:websockets:dialer"),l=r(1304);class h{dial(e,t,r){"function"==typeof t&&(r=t,t={}),r=r||function(){};const i=u(e);f("dialing %s",i);const o=n(i,{binary:!0,onConnect:e=>{r(e)}}),s=new a(o);return s.getObservedAddrs=(t=>t(null,[e])),s.close=(e=>o.close(e)),s}createListener(e,t){return"function"==typeof e&&(t=e,e={}),l(e,t)}filter(e){return Array.isArray(e)||(e=[e]),e.filter(e=>!s(e.protoNames(),"p2p-circuit")&&(s(e.protoNames(),"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){var n=r(1308),i=r(342),o=r(590),s=r(255)("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,l=t.forceNew||t["force new connection"]||!1===t.multiplex||f,h;return l?(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]),r.query&&!t.query&&(t.query=r.query),h.socket(r.path,t)}t.protocol=i.protocol,t.connect=u,t.Manager=r(590),t.Socket=r(596)},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(1315),i=r(596),o=r(142),s=r(342),a=r(597),u=r(598),c=r(255)("socket.io-client:manager"),f=r(595),l=r(1332),h=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 l({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)h.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},d.prototype.updateSocketIds=function(){for(var e in this.nsps)h.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(343),i=r(1318),o=r(1328),s=r(1329);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(344),i=r(256),o=r(143),s=r(257),a=r(594),u=r(258)("engine.io-client:polling");e.exports=h;var c=(f=r(343),l=new f({xdomain:!1}),null!=l.responseType),f,l;function h(e){var t=e&&e.forceBase64;c&&!t||(this.supportsBinary=!1),n.call(this,e)}s(h,n),h.prototype.name="polling",h.prototype.doOpen=function(){this.poll()},h.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()},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 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))},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 r=function(){t.writable=!0,t.emit("drain")};o.encodePayload(e,this.supportsBinary,function(e){t.doWrite(e,r)})},h.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(1320),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;ao.keys.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 u(r,n))})},t.createFromHexString=function(e){return new u(i.fromHexString(e))},t.createFromBytes=function(e){return new u(e)},t.createFromB58String=function(e){return new u(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.keys.unmarshalPublicKey(i)}catch(e){return t(e)}r.hash((e,n)=>{if(e)return t(e);t(null,new u(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.keys.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 u(r,n,n.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r,s,c,f;try{r=i.fromB58String(e.id),s=e.privKey&&n.from(e.privKey,"base64"),c=e.pubKey&&n.from(e.pubKey,"base64"),f=c&&o.keys.unmarshalPublicKey(c)}catch(e){return t(e)}s?a([e=>o.keys.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)}),(e,t,r)=>{f?f.hash((n,i)=>{r(n,e,t,i)}):r(null,e,t)}],(e,n,i,o)=>e?t(e):f&&!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 u(r,i,f))):t(null,new u(r,null,f))},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(e){const n=r(345),i=r(346)(),o=r(1342),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=(t,r,o)=>{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";(function(t){const n=r(18),i=r(1347);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(e){const n=r(7);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";(function(e){const n=r(345),i=r(346)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(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(1350),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(o).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,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},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";const n=r(1),i=r(184).Reporter,o=r(0).Buffer;function s(e,t){i.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function a(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof a||(e=new a(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}n(s,i),t.DecoderBuffer=s,s.prototype.save=function e(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},s.prototype.restore=function e(t){const r=new s(this.base);return r.offset=t.offset,r.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),r},s.prototype.isEmpty=function e(){return this.offset===this.length},s.prototype.readUInt8=function e(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},s.prototype.skip=function e(t,r){if(!(this.offset+t<=this.length))return this.error(r||"DecoderBuffer overrun");const n=new s(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},s.prototype.raw=function e(t){return this.base.slice(t?t.offset:this.offset,this.length)},t.EncoderBuffer=a,a.prototype.join=function e(t,r){return t||(t=new o(this.length)),r||(r=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach(function(e){e.join(t,r),r+=e.length}):("number"==typeof this.value?t[r]=this.value:"string"==typeof this.value?t.write(this.value,r):o.isBuffer(this.value)&&this.value.copy(t,r),r+=this.length),t)}},function(e,t,r){"use strict";const n=t;n._reverse=function e(t){const r={};return Object.keys(t).forEach(function(e){(0|e)==e&&(e|=0);const n=t[e];r[n]=e}),r},n.der=r(1354)},function(e,t,r){"use strict";const n=r(1),i=r(144),o=i.base,s=i.bignum,a=i.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.Node.call(this,"der",e)}function f(e,t){let r=e.readUInt8(t);if(e.isError(r))return r;const n=a.tagClass[r>>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 l(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=l(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"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 l(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 h(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=l,t.getIdAndValidate=h,t.validateMa=(e=>a.WebSocketStar.matches(i(e)))}).call(this,r(0).Buffer)},function(e,t,r){var n=r(1368),i=r(107),o=i;o.v1=n,o.v4=i,e.exports=o},function(e,t,r){t=e.exports=r(614),t.Stream=t,t.Readable=t,t.Writable=r(618),t.Duplex=r(146),t.Transform=r(619),t.PassThrough=r(1377)},function(e,t,r){"use strict";(function(t,n){var i;e.exports=B,B.ReadableState=I;var o=r(11).EventEmitter,s=function e(t,r){return t.listeners(r).length},a=r(615),u=r(0).Buffer,c=t.Uint8Array||function(){};function f(e){return u.from(e)}function l(e){return u.isBuffer(e)||e instanceof c}var h=r(1371),d;d=h&&h.debuglog?h.debuglog("stream"):function e(){};var p=r(1372),y=r(616),g=r(617),m=g.getHighWaterMark,b=r(185).codes,v=b.ERR_INVALID_ARG_TYPE,_=b.ERR_STREAM_PUSH_AFTER_EOF,w=b.ERR_METHOD_NOT_IMPLEMENTED,S=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,E=r(1374),k=E.emitExperimentalWarning,A,x;r(1)(B,a);var C=["error","close","destroy","pause","resume"];function T(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 I(e,t,n){i=i||r(146),e=e||{},"boolean"!=typeof n&&(n=t instanceof i),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(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&&(A||(A=r(44).StringDecoder),this.decoder=new A(e.encoding),this.encoding=e.encoding)}function B(e){if(i=i||r(146),!(this instanceof B))return new B(e);var t=this instanceof i;this._readableState=new I(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,r,n,i){d("readableAddChunk",t);var o=e._readableState,s;if(null===t)o.reading=!1,M(e,o);else if(i||(s=R(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):P(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?P(e,o,t,!1):F(e,o)):P(e,o,t,!1)}else n||(o.reading=!1,F(e,o));return!o.ended&&(o.length=N?e=N:(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=j(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function M(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,U(e)))}}function D(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(U,e))}function U(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,W(e)}function F(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(K,e,t))}function K(e,t){for(var r=t.length;!t.reading&&!t.ended&&t.length0,e.listenerCount("data")>0&&e.resume()}function z(e){d("readable nexttick read 0"),e.read(0)}function V(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(G,e,t))}function G(e,t){d("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),W(e),t.flowing&&!t.reading&&e.read(0)}function W(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},B.prototype._read=function(e){this.emit("error",new w("_read()"))},B.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:b;function u(e,t){d("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,h())}function c(){d("onend"),e.end()}i.endEmitted?n.nextTick(a):r.once("end",a),e.on("unpipe",u);var f=q(r);e.on("drain",f);var l=!1;function h(){d("cleanup"),e.removeListener("close",g),e.removeListener("finish",m),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",u),r.removeListener("end",c),r.removeListener("end",b),r.removeListener("data",p),l=!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))&&!l&&(d("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function y(t){d("onerror",t),b(),e.removeListener("error",y),0===s(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",m),b()}function m(){d("onfinish"),e.removeListener("close",g),b()}function b(){d("unpipe"),r.unpipe(e)}return r.on("data",p),T(e,"error",y),e.once("close",g),e.once("finish",m),e.emit("pipe",r),i.flowing||(d("pipe resume"),r.resume()),e},B.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(z,this))),r},B.prototype.addListener=B.prototype.on,B.prototype.removeListener=function(e,t){var r=a.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(H,this),r},B.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(H,this),t},B.prototype.resume=function(){var e=this._readableState;return e.flowing||(d("resume"),e.flowing=!e.readableListening,V(this,e)),this},B.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},B.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(T.prototype,"writableBuffer",{enumerable:!1,get:function e(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function e(){return this._writableState.highWaterMark}}),T.prototype._write=function(e,t,r){r(new b("_write()"))},T.prototype._writev=null,T.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||z(this,n,r),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function e(){return this._writableState.length}}),Object.defineProperty(T.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)}}),T.prototype.destroy=d.destroy,T.prototype._undestroy=d.undestroy,T.prototype._destroy=function(e,t){t(e)}}).call(this,r(8),r(3))},function(e,t,r){"use strict";e.exports=f;var n=r(185).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(146);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.length{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";(function(e){const n=r(350),i=r(351)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(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(1394),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(o).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,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},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";const n=r(1),i=r(188).Reporter,o=r(0).Buffer;function s(e,t){i.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function a(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof a||(e=new a(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}n(s,i),t.DecoderBuffer=s,s.prototype.save=function e(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},s.prototype.restore=function e(t){const r=new s(this.base);return r.offset=t.offset,r.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),r},s.prototype.isEmpty=function e(){return this.offset===this.length},s.prototype.readUInt8=function e(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},s.prototype.skip=function e(t,r){if(!(this.offset+t<=this.length))return this.error(r||"DecoderBuffer overrun");const n=new s(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},s.prototype.raw=function e(t){return this.base.slice(t?t.offset:this.offset,this.length)},t.EncoderBuffer=a,a.prototype.join=function e(t,r){return t||(t=new o(this.length)),r||(r=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach(function(e){e.join(t,r),r+=e.length}):("number"==typeof this.value?t[r]=this.value:"string"==typeof this.value?t.write(this.value,r):o.isBuffer(this.value)&&this.value.copy(t,r),r+=this.length),t)}},function(e,t,r){"use strict";const n=t;n._reverse=function e(t){const r={};return Object.keys(t).forEach(function(e){(0|e)==e&&(e|=0);const n=t[e];r[n]=e}),r},n.der=r(1398)},function(e,t,r){"use strict";const n=r(1),i=r(90),o=i.base,s=i.bignum,a=i.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.Node.call(this,"der",e)}function f(e,t){let r=e.readUInt8(t);if(e.isError(r))return r;const n=a.tagClass[r>>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 l(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=l(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{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";(function(t){const n=r(18),i=r(1416);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(e){const n=r(7);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";(function(e){const n=r(354),i=r(355)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(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(1419),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(o).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,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},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(e){const n=r(90).bignum;t.toBase64=function t(r,n){let i=r.toArrayLike(e,"be",n).toString("base64");return i.replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function t(r){return new n(e.from(r,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(633);function i(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}e.exports=i},function(e,t,r){(function(t){var r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",o="[object Null]",s="[object Proxy]",a="[object Undefined]",u="object"==typeof t&&t&&t.Object===Object&&t,c="object"==typeof self&&self&&self.Object===Object&&self,f=u||c||Function("return this")(),l=Object.prototype,h=l.hasOwnProperty,d=l.toString,p=f.Symbol,y=p?p.toStringTag:void 0;function g(e){return null==e?void 0===e?a:o:y&&y in Object(e)?m(e):b(e)}function m(e){var t=h.call(e,y),r=e[y];try{e[y]=void 0;var n=!0}catch(e){}var i=d.call(e);return n&&(t?e[y]=r:delete e[y]),i}function b(e){return d.call(e)}function v(e){if(!_(e))return!1;var t=g(e);return t==n||t==i||t==r||t==s}function _(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}e.exports=v}).call(this,r(8))},function(e,t,r){"use strict";(function(t){const n=r(124),i=r(58),o=r(261),s=o.writeEncoded;function a(e,r,o){const a=n({timeout:6e4},r),u=a.handshake;return o("writing multicodec: "+e),s(u,t.from(e+"\n"),r),i.decodeFromReader(u,(t,n)=>{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(359),i=c(n),o=r(218),s=c(o),a=r(251),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";e.exports=r(1452)},function(e,t,r){"use strict";const n=r(7);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(51),i=r(47),o=r(27);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){"use strict";const n=r(53).Connection,i=r(9);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";(function(e){const n=r(363),i=r(364)(),o=r(1470),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=(t,r,o)=>{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";(function(e){const n=r(363),i=r(364)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(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(1475),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(o).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,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},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";const n=r(1),i=r(192).Reporter,o=r(0).Buffer;function s(e,t){i.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function a(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof a||(e=new a(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}n(s,i),t.DecoderBuffer=s,s.prototype.save=function e(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},s.prototype.restore=function e(t){const r=new s(this.base);return r.offset=t.offset,r.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),r},s.prototype.isEmpty=function e(){return this.offset===this.length},s.prototype.readUInt8=function e(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},s.prototype.skip=function e(t,r){if(!(this.offset+t<=this.length))return this.error(r||"DecoderBuffer overrun");const n=new s(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},s.prototype.raw=function e(t){return this.base.slice(t?t.offset:this.offset,this.length)},t.EncoderBuffer=a,a.prototype.join=function e(t,r){return t||(t=new o(this.length)),r||(r=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach(function(e){e.join(t,r),r+=e.length}):("number"==typeof this.value?t[r]=this.value:"string"==typeof this.value?t.write(this.value,r):o.isBuffer(this.value)&&this.value.copy(t,r),r+=this.length),t)}},function(e,t,r){"use strict";const n=t;n._reverse=function e(t){const r={};return Object.keys(t).forEach(function(e){(0|e)==e&&(e|=0);const n=t[e];r[n]=e}),r},n.der=r(1479)},function(e,t,r){"use strict";const n=r(1),i=r(147),o=i.base,s=i.bignum,a=i.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.Node.call(this,"der",e)}function f(e,t){let r=e.readUInt8(t);if(e.isError(r))return r;const n=a.tagClass[r>>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 l(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=l(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=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(1503),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(3))},function(e,t,r){var n=r(1514),i=r(410);function o(e){return null==e?[]:n(e,i(e))}e.exports=o},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(1515)(t);const{formatters:f}=e.exports;f.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,r(3))},function(e,t,r){"use strict";const n=r(17),i=n(r(1517)),o=n(r(1518));t=e.exports,t.rpc=i,t.td=o},function(e,t,r){"use strict";(function(e){const n=r(366),i=r(367)(),o=r(1521),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=(t,r,o)=>{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";(function(e){const n=r(366),i=r(367)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(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(1526),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(o).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,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},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";const n=r(1),i=r(193).Reporter,o=r(0).Buffer;function s(e,t){i.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function a(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof a||(e=new a(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}n(s,i),t.DecoderBuffer=s,s.prototype.save=function e(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},s.prototype.restore=function e(t){const r=new s(this.base);return r.offset=t.offset,r.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),r},s.prototype.isEmpty=function e(){return this.offset===this.length},s.prototype.readUInt8=function e(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},s.prototype.skip=function e(t,r){if(!(this.offset+t<=this.length))return this.error(r||"DecoderBuffer overrun");const n=new s(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},s.prototype.raw=function e(t){return this.base.slice(t?t.offset:this.offset,this.length)},t.EncoderBuffer=a,a.prototype.join=function e(t,r){return t||(t=new o(this.length)),r||(r=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach(function(e){e.join(t,r),r+=e.length}):("number"==typeof this.value?t[r]=this.value:"string"==typeof this.value?t.write(this.value,r):o.isBuffer(this.value)&&this.value.copy(t,r),r+=this.length),t)}},function(e,t,r){"use strict";const n=t;n._reverse=function e(t){const r={};return Object.keys(t).forEach(function(e){(0|e)==e&&(e|=0);const n=t[e];r[n]=e}),r},n.der=r(1530)},function(e,t,r){"use strict";const n=r(1),i=r(148),o=i.base,s=i.bignum,a=i.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.Node.call(this,"der",e)}function f(e,t){let r=e.readUInt8(t);if(e.isError(r))return r;const n=a.tagClass[r>>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 l(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=l(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=a||o=n&&o=n&&i({"/":e[1].cid.toBaseEncodedString()}))}e.exports=function e(t){return{wantlist:i((e,r)=>{if(r||(r=e,e=void 0),!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();return i=f(i),o(()=>r(null,{Keys:i}))}),stat:i(e=>{if(!t.isOnline())return o(()=>e(new Error(n)));const r=t._bitswap.stat().snapshot;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")))}return o(()=>r(null,t._bitswap.unwant(e)))})}}},function(e,t,r){"use strict";e.exports=r(1607)},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 n=r(6),{DAGNode:i}=r(30),o={format:"dag-pb",hashAlg:"sha2-256"},s=(e,t,r,s,a)=>{s=Object.assign({},o,s),n([e=>i.create(t,r,e),(t,r)=>{e.dag.put(t,{format:s.format,hashAlg:s.hashAlg},e=>r(e,t))}],a)};e.exports=s},function(e,t,r){"use strict";class n extends Error{constructor(e){super(e),this.code=0}}class i extends Error{constructor(e){super(e),this.code=1}}e.exports={NonFatalError:n,FatalError:i}},function(e,t,r){(function(t){var n=r(1625).strict;e.exports=function e(r){if(n(r)){var i=t.from(r.buffer);return r.byteLength!==r.buffer.byteLength&&(i=i.slice(r.byteOffset,r.byteOffset+r.byteLength)),i}return t.from(r)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(45);function i(e,t){e=e.slice();const r=e.filter(e=>"function"==typeof e).pop(),i=Object.assign({},t,e.filter(e=>"object"==typeof e).pop()||{});Array.isArray(e[0])&&(e=e[0]);const o=e.filter(e=>"string"==typeof e).map(e=>(e=e.trim(),{path:e,name:n.basename(e),dir:n.dirname(e)}));return{sources:o,options:i,callback:r}}e.exports=i},function(e,t,r){"use strict";const n=r(10),i=r(4)("ipfs:mfs:utils:with-mfs-root"),o=r(6),{MFS_ROOT_KEY:s}=r(195),a=(e,t)=>{const r=e._repo,a=r&&r.datastore;if(!r||!a)return t(new Error("Please run jsipfs init first"));o([e=>a.open(t=>e(t)),t=>{a.get(s,(u,c)=>{if(u&&u.notFound)return i("Creating new MFS root"),o([t=>e.files.add({path:"/"},t),([{hash:e}],t)=>t(null,new n(e)),(e,t)=>r.closed?a.open(r=>t(r,e)):t(null,e),(e,t)=>a.put(s,e.buffer,r=>t(r,e))],t);t(u,new n(c))})},(e,t)=>{i(`Fetched MFS root ${e.toBaseEncodedString()}`),t(null,e)}],t)};e.exports=a},function(e,t,r){"use strict";const{FILE_SEPARATOR:n}=r(195),i="/ipfs",o=(e,t)=>{if(e=(e||"").trim(),!e)return t(new Error("paths must not be empty"));if(e.substring(0,1)!==n)return t(new Error(`paths must start with a leading ${n}`));e.substring(e.length-n.length)===n&&(e=e.substring(0,e.length-n.length));const r=e.split(n).filter(Boolean),i=r.pop(),o=`${n}${r.join(n)}`;if("/ipfs"===e.substring(0,"/ipfs".length))return t(null,{type:"ifps",path:e.substring("/ipfs".length+1),directory:o,name:i});t(null,{type:"mfs",path:e||n,directory:o,name:i})};e.exports=o},function(e,t,r){"use strict";const n=r(40).unmarshal,{traverseTo:i,formatCid:o}=r(55),s=r(6),a=r(4)("ipfs:mfs:stat"),u={hash:!1,size:!1,withLocal:!1,cidBase:"base58btc"};e.exports=(e=>(function t(r,c,f){"function"==typeof c&&(f=c,c={}),c=Object.assign({},u,c),a(`Fetching stats for ${r}`),s([t=>i(e,r,{withCreateHint:!1},t),({node:e},t)=>{if(c.hash)return t(null,{hash:o(e.multihash,c.cidBase)});if(c.size)return t(null,{size:e.size});const r=n(e.data);let i=e.links.length;"file"===r.type&&(i=r.blockSizes.length),t(null,{hash:o(e.multihash,c.cidBase),size:r.fileSize()||0,cumulativeSize:e.size,blocks:i,type:r.type,local:void 0,sizeLocal:void 0,withLocality:!1})}],f)}))},function(e,t,r){"use strict";const n=r(6),i=r(49),o=r(42),s=r(40),{traverseTo:a,addLink:u,updateTree:c,updateMfsRoot:f,toSourcesAndDestination:l}=r(55),h=r(680),d=r(4)("ipfs:mfs:cp"),p={parents:!1,flush:!0,format:"dag-pb",hashAlg:"sha2-256"};e.exports=(e=>(function t(){const r=Array.from(arguments),{sources:n,destination:i,options:o,callback:u}=l(r,p);return n.length?i?(o.parents=o.p||o.parents,void a(e,i.path,{},(t,r)=>{if(t)return 1===n.length?(d("Only one source, copying to a file"),y(e,n.pop(),i,o,u)):(d("Multiple sources, copying to a directory"),g(e,n,i,o,u));const a=s.unmarshal(r.node.data);if("directory"===a.type)return g(e,n,i,o,u);u(new Error("directory already has entry by that name"))})):u(new Error("Please supply a destination")):u(new Error("Please supply at least one source"))}));const y=(e,t,r,o,s)=>{n([n=>{i([r=>h(e)(t.path,o,r),t=>h(e)(r.path,o,e=>{if(!e)return t(new Error("directory already has entry by that name"));t()}),t=>a(e,r.dir,o,t)],n)},([t,i,o],s)=>{n([n=>u(e,{parent:o.node,child:{size:t.cumulativeSize,hash:t.hash},name:r.name},n),(t,r)=>{o.node=t,c(e,o,r)},(t,r)=>f(e,t.node.multihash,r)],s)}],e=>s(e))},g=(e,t,r,s,l)=>{n([n=>{o([r=>i(t.map(t=>r=>h(e)(t.path,s,r)),r),t=>a(e,r.path,Object.assign({},s,{createLastComponent:!0}),t)],n)},(o,a)=>{const l=o.pop(),d=o[0];n([n=>{i(t.map(t=>n=>{h(e)(`${r.path}/${t.name}`,s,e=>{if(!e)return n(new Error("directory already has entry by that name"));n()})}),e=>n(e))},r=>{n([e=>e(null,l.node)].concat(d.map((r,n)=>(i,o)=>u(e,{parent:i,child:{size:r.cumulativeSize,hash:r.hash},name:t[n].name},o))),r)},(t,r)=>{l.node=t,c(e,l,r)},(t,r)=>f(e,t.node.multihash,r)],a)}],e=>l(e))}},function(e,t,r){"use strict";const n=r(40),i=r(6),o=r(42),{DAGNode:s}=r(30),a=r(10),{traverseTo:u,updateTree:c,updateMfsRoot:f,toSources:l,FILE_SEPARATOR:h}=r(55),d={recursive:!1};e.exports=(e=>(function t(){const r=Array.from(arguments),{sources:n,options:i,callback:s}=l(r,d);if(!n.length)return s(new Error("Please supply at least one path to remove"));o(n.map(t=>r=>p(e,t.path,i,r)),e=>s(e))}));const p=(e,t,r,o)=>{if(t===h)return o(new Error("Cannot delete root"));i([r=>u(e,t,{withCreateHint:!1},r),(o,u)=>{const l=n.unmarshal(o.node.data);if("directory"===l.type&&!r.recursive)return u(new Error(`${t} is a directory, use -r to remove directories`));i([e=>s.rmLink(o.parent.node,o.name,e),(t,r)=>{e.dag.put(t,{cid:new a(t.hash||t.multihash)},e=>r(e,t))},(t,r)=>{o.parent.node=t,c(e,o.parent,r)},(t,r)=>f(e,t.node.multihash,r)],u)}],o)}},function(e,t,r){"use strict";const n=r(6),i=r(70),o=r(79),s=r(92),a=r(194).importer,{loadNode:u}=r(55),c=(e,t,r,c)=>{n([n=>i(o([{content:i(t)}]),a(e.dag,{progress:r.progress,hashAlg:r.hashAlg,cidVersion:r.cidVersion,strategy:r.strategy,rawLeaves:r.rawLeaves,reduceSingleLeafToSelf:r.reduceSingleLeafToSelf,leafType:r.leafType}),s(n)),(t,r)=>u(e,t[0],r)],c)};e.exports=c},function(e,t,r){"use strict";const n=r(197),i=r(149);e.exports=(e=>t=>(t=t||{},t.converter=i,n(e,"add")(t)))},function(e,t,r){"use strict";const n=r(197),i=r(149),o=r(69);e.exports=(e=>t=>(t=t||{},t.converter=i,o(n(e,"add")({qs:t}))))},function(e,t,r){"use strict";const n=r(2),i=r(150),o=r(77),s=r(1660);e.exports=(e=>n((t,r,n)=>{"function"==typeof r&&(n=r,r={});try{t=i(t)}catch(e){if(!o.ipfsPath(t))return n(e)}const a={offset:r.offset,length:r.length};e({path:"cat",args:t,buffer:r.buffer,qs:a},(e,t)=>{if(e)return n(e);t.pipe(s((e,t)=>{if(e)return n(e);n(null,t)}))})}))},function(e,t,r){"use strict";const n=r(150),i=r(77),o=r(12),s=r(54);e.exports=(e=>(t,r)=>{r=r||{};const a=new o.PassThrough;try{t=n(t)}catch(e){if(!i.ipfsPath(t))return a.destroy(e)}const u={offset:r.offset,length:r.length};return e({path:"cat",args:t,buffer:r.buffer,qs:u},(e,t)=>{if(e)return a.destroy(e);s(t,a)}),a})},function(e,t,r){"use strict";const n=r(150),i=r(77),o=r(69),s=r(72);e.exports=(e=>(t,r)=>{r=r||{};const a=s.source();try{t=n(t)}catch(e){if(!i.ipfsPath(t))return a.end(e)}const u={offset:r.offset,length:r.length};return e({path:"cat",args:t,buffer:r.buffer,qs:u},(e,t)=>{if(e)return a.end(e);a.resolve(o(t))}),a})},function(e,t,r){"use strict";const n=r(2),i=r(150),o=r(376),s=r(196),a=r(269),u=r(77);e.exports=(e=>n((t,r,n)=>{"function"!=typeof r||n||(n=r,r={}),"function"==typeof r&&"function"==typeof n&&(n=r,r={});try{t=i(t)}catch(e){if(!u.ipfsPath(t))return n(e)}const c={path:"get",args:t,qs:r};e.andTransform(c,o,(e,t)=>{if(e)return n(e);const r=[];t.pipe(a.obj((e,t,n)=>{e.content?e.content.pipe(s(t=>{r.push({path:e.path,content:t})})):r.push(e),n()},()=>n(null,r)))})}))},function(e,t,r){(function(e){var n=r(691),i=r(125),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))},l=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},d=function(e,t,r,n){for(;rt?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 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 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 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(y(t.mode&c,6),100),r.write(y(t.uid,6),108),r.write(y(t.gid,6),116),r.write(y(t.size,11),124),r.write(y(t.mtime.getTime()/1e3|0,11),136),r[156]=a+h(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(y(t.devmajor||0,6),329),r.write(y(t.devminor||0,6),337),o&&r.write(o,345),r.write(y(p(r),6),148),r)},t.decode=function(e,t){var r=0===e[156]?0:e[156]-a,n=b(e,0,100,t),i=m(e,100,8),o=m(e,108,8),s=m(e,116,8),u=m(e,124,12),c=m(e,136,12),f=l(r),h=0===e[157]?null:b(e,157,100,t),d=b(e,265,32),y=b(e,297,32),g=m(e,329,8),v=m(e,337,8);e[345]&&(n=b(e,345,155,t)+"/"+n),0===r&&n&&"/"===n[n.length-1]&&(r=5);var _=p(e);if(256===_)return null;if(_!==m(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:h,uname:d,gname:y,devmajor:g,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";const n=r(150),i=r(376),o=r(77),s=r(12),a=r(54);e.exports=(e=>(t,r)=>{r=r||{};const u=new s.PassThrough({objectMode:!0});try{t=n(t)}catch(e){if(!o.ipfsPath(t))return u.destroy(e)}const c={path:"get",args:t,qs:r};return e.andTransform(c,i,(e,t)=>{if(e)return u.destroy(e);a(t,u)}),u})},function(e,t,r){"use strict";const n=r(150),i=r(376),o=r(77),s=r(269),a=r(9),u=r(69),c=r(72);e.exports=(e=>(t,r)=>{r=r||{};const f=c.source();try{t=n(t)}catch(e){if(!o.ipfsPath(t))return f.end(e)}const l={path:"get",args:t,qs:r};return e.andTransform(l,i,(e,t)=>{if(e)return f.end(e);const r=[];t.pipe(s.obj((e,t,n)=>{e.content?r.push({path:e.path,content:u(e.content)}):r.push(e),n()},()=>f.resolve(a.values(r))))}),f})},function(e,t,r){"use strict";const n=r(1671);t=e.exports=(()=>({"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(1672),o=r(377).encode,s=r(198),a=r(697),u=r(54),c=r(26),f=r(78),l=r(1677),h=r(698),d=r(4)("ipfs-api:request");function p(e,t){const r=new Error(`Server responded with ${e.statusCode}`);l(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 y(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?l(r,t):f(r,t)}}function g(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)}}),l={hostname:e.host,path:`${e["api-path"]}${t.path}?${f}`,port:e.port,method:"POST",headers:u,protocol:`${e.protocol}:`},d=h(e.protocol)(l,y(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")):g(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){var n=r(269),i=r(1675),o=r(163).EOL,s=r(1676);function a(e){function t(t){try{if(t)return JSON.parse(t)}catch(r){e.strict&&this.emit("error",new Error("Could not parse row "+t.slice(0,50)+"..."))}}return e=e||{},e.strict=!1!==e.strict,i(t,e)}function u(e){return n.obj(e,function(e,t,r){r(null,s(e)+o)})}e.exports=a,e.exports.serialize=e.exports.stringify=u,e.exports.parse=a},function(e,t,r){"use strict";const n=r(1678),i=r(378);e.exports=(e=>0===e.indexOf("https")?i.request:n.request)},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(699),s=r(1),a=r(12),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 l=r.body.getReader();function h(){l.read().then(function(e){if(!c._destroyed){if(e.done)return i.clearTimeout(u),void c.push(null);c.push(new n(e.value)),h()}}).catch(function(e){i.clearTimeout(u),c._destroyed||c.emit("error",e)})}h()}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 y=p.match(/;\s*charset=([^;])(;|$)/);y&&(c._charset=y[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(3),r(0).Buffer,r(8))},function(e,t,r){var n=r(0).Buffer;e.exports=function(e){if(e instanceof Uint8Array){if(0===e.byteOffset&&e.byteLength===e.buffer.byteLength)return e.buffer;if("function"==typeof e.buffer.slice)return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(n.isBuffer(e)){for(var t=new Uint8Array(e.length),r=e.length,i=0;ie._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(3),r(0).Buffer,r(8))},function(e,t,r){"use strict";const n=r(19);e.exports=(e=>{const t=n(e);return{get:r(1691)(t),stat:r(1692)(t),put:r(1693)(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){(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]",l="[object Function]",h="[object GeneratorFunction]",d="[object Map]",p="[object Number]",y="[object Object]",g="[object Promise]",m="[object RegExp]",b="[object Set]",v="[object String]",_="[object Symbol]",w="[object WeakMap]",S="[object ArrayBuffer]",E="[object DataView]",k="[object Float32Array]",A="[object Float64Array]",x="[object Int8Array]",C="[object Int16Array]",T="[object Int32Array]",I="[object Uint8Array]",B="[object Uint8ClampedArray]",O="[object Uint16Array]",P="[object Uint32Array]",R=/[\\^$.*+?()[\]{}|]/g,N=/\w*$/,j=/^\[object .+?Constructor\]$/,L=/^(?:0|[1-9]\d*)$/,M={};M[s]=M[a]=M[S]=M[E]=M[u]=M[c]=M[k]=M[A]=M[x]=M[C]=M[T]=M[d]=M[p]=M[y]=M[m]=M[b]=M[v]=M[_]=M[I]=M[B]=M[O]=M[P]=!0,M[f]=M[l]=M[w]=!1;var D="object"==typeof e&&e&&e.Object===Object&&e,U="object"==typeof self&&self&&self.Object===Object&&self,F=D||U||Function("return this")(),K="object"==typeof t&&t&&!t.nodeType&&t,q=K&&"object"==typeof r&&r&&!r.nodeType&&r,H=q&&q.exports===K;function z(e,t){return e.set(t[0],t[1]),e}function V(e,t){return e.add(t),e}function G(e,t){for(var r=-1,n=e?e.length:0;++r-1}function Ve(e,t){var r=this.__data__,n=st(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function Ge(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 Wt(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function $t(e){return!!e&&"object"==typeof e}function Yt(e){return qt(e)?it(e):dt(e)}function Jt(){return[]}function Xt(){return!1}r.exports=Dt}).call(this,r(8),r(32)(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){(function(t){var n=r(1),i=r(12).Transform,o=r(1841);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){e.exports=o;var n=r(1),i=r(12);function o(e,t){var r=this;if(!(r instanceof o))return new o(e,t);i.Readable.call(r,t),r.destroyed=!1,r._drained=!1,r._forwarding=!1,r._current=null,r._toStreams2=t&&t.objectMode?s:a,"function"==typeof e?r._queue=e:(r._queue=e.map(r._toStreams2),r._queue.forEach(function(e){"function"!=typeof e&&r._attachErrorListener(e)})),r._next()}function s(e){return u(e,{objectMode:!0,highWaterMark:16})}function a(e){return u(e)}function u(e,t){if(!e||"function"==typeof e||e._readableState)return e;var r=new i.Readable(t).wrap(e);return e.destroy&&(r.destroy=e.destroy.bind(e)),r}n(o,i.Readable),o.obj=function(e){return new o(e,{objectMode:!0,highWaterMark:16})},o.prototype._read=function(){this._drained=!0,this._forward()},o.prototype._forward=function(){if(!this._forwarding&&this._drained&&this._current){var e;for(this._forwarding=!0;null!==(e=this._current.read());)this._drained=this.push(e);this._forwarding=!1}},o.prototype.destroy=function(e){this.destroyed||(this.destroyed=!0,this._current&&this._current.destroy&&this._current.destroy(),"function"!=typeof this._queue&&this._queue.forEach(function(e){e.destroy&&e.destroy()}),e&&this.emit("error",e),this.emit("close"))},o.prototype._next=function(){var e=this;if(e._current=null,"function"==typeof e._queue)e._queue(function(t,r){if(t)return e.destroy(t);r=e._toStreams2(r),e._attachErrorListener(r),e._gotNextStream(r)});else{var t=e._queue.shift();"function"==typeof t&&(t=e._toStreams2(t()),e._attachErrorListener(t)),e._gotNextStream(t)}},o.prototype._gotNextStream=function(e){var t=this;if(!e)return t.push(null),void t.destroy();function r(){t._forward()}function n(){e._readableState.ended||t.destroy()}function i(){t._current=null,e.removeListener("readable",r),e.removeListener("end",i),e.removeListener("close",n),t._next()}t._current=e,t._forward(),e.on("readable",r),e.once("end",i),e.once("close",n)},o.prototype._attachErrorListener=function(e){var t=this;function r(n){e.removeListener("error",r),t.destroy(n)}e&&e.once("error",r)}},function(e,t,r){"use strict";(function(t,n){var i;e.exports=B,B.ReadableState=I;var o=r(11).EventEmitter,s=function e(t,r){return t.listeners(r).length},a=r(712),u=r(0).Buffer,c=t.Uint8Array||function(){};function f(e){return u.from(e)}function l(e){return u.isBuffer(e)||e instanceof c}var h=r(1850),d;d=h&&h.debuglog?h.debuglog("stream"):function e(){};var p=r(1851),y=r(713),g=r(714),m=g.getHighWaterMark,b=r(202).codes,v=b.ERR_INVALID_ARG_TYPE,_=b.ERR_STREAM_PUSH_AFTER_EOF,w=b.ERR_METHOD_NOT_IMPLEMENTED,S=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,E=r(1853),k=E.emitExperimentalWarning,A,x;r(1)(B,a);var C=["error","close","destroy","pause","resume"];function T(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 I(e,t,n){i=i||r(153),e=e||{},"boolean"!=typeof n&&(n=t instanceof i),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(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&&(A||(A=r(44).StringDecoder),this.decoder=new A(e.encoding),this.encoding=e.encoding)}function B(e){if(i=i||r(153),!(this instanceof B))return new B(e);var t=this instanceof i;this._readableState=new I(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,r,n,i){d("readableAddChunk",t);var o=e._readableState,s;if(null===t)o.reading=!1,M(e,o);else if(i||(s=R(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):P(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?P(e,o,t,!1):F(e,o)):P(e,o,t,!1)}else n||(o.reading=!1,F(e,o));return!o.ended&&(o.length=N?e=N:(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=j(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function M(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,U(e)))}}function D(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(U,e))}function U(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,W(e)}function F(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(K,e,t))}function K(e,t){for(var r=t.length;!t.reading&&!t.ended&&t.length0,e.listenerCount("data")>0&&e.resume()}function z(e){d("readable nexttick read 0"),e.read(0)}function V(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(G,e,t))}function G(e,t){d("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),W(e),t.flowing&&!t.reading&&e.read(0)}function W(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},B.prototype._read=function(e){this.emit("error",new w("_read()"))},B.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:b;function u(e,t){d("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,h())}function c(){d("onend"),e.end()}i.endEmitted?n.nextTick(a):r.once("end",a),e.on("unpipe",u);var f=q(r);e.on("drain",f);var l=!1;function h(){d("cleanup"),e.removeListener("close",g),e.removeListener("finish",m),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",u),r.removeListener("end",c),r.removeListener("end",b),r.removeListener("data",p),l=!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))&&!l&&(d("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function y(t){d("onerror",t),b(),e.removeListener("error",y),0===s(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",m),b()}function m(){d("onfinish"),e.removeListener("close",g),b()}function b(){d("unpipe"),r.unpipe(e)}return r.on("data",p),T(e,"error",y),e.once("close",g),e.once("finish",m),e.emit("pipe",r),i.flowing||(d("pipe resume"),r.resume()),e},B.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(z,this))),r},B.prototype.addListener=B.prototype.on,B.prototype.removeListener=function(e,t){var r=a.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(H,this),r},B.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(H,this),t},B.prototype.resume=function(){var e=this._readableState;return e.flowing||(d("resume"),e.flowing=!e.readableListening,V(this,e)),this},B.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},B.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(T.prototype,"writableBuffer",{enumerable:!1,get:function e(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function e(){return this._writableState.highWaterMark}}),T.prototype._write=function(e,t,r){r(new b("_write()"))},T.prototype._writev=null,T.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||z(this,n,r),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function e(){return this._writableState.length}}),Object.defineProperty(T.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)}}),T.prototype.destroy=d.destroy,T.prototype._undestroy=d.undestroy,T.prototype._destroy=function(e,t){t(e)}}).call(this,r(8),r(3))},function(e,t,r){"use strict";e.exports=f;var n=r(202).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(153);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.length{t(null,r)}):g(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()),l(r.announce),l(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(m,0)}}),r.length=n.reduce(m,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=b(e.info.pieces),r}function y(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 g(e){return"undefined"!=typeof Blob&&e instanceof Blob}function m(e,t){return e+t.length}function b(e){const t=[];for(let r=0;rnull!==e&&"object"==typeof e&&"function"==typeof e.pipe;function l(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 h;e.headers&&Object.keys(e.headers).forEach(t=>n[t.toLowerCase()]=e.headers[t]),e.headers=n,e.body?h=e.json&&!f(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"),f(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 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")):l(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(h)?h.on("error",r).pipe(p):p.end(h),p}l.concat=((e,t)=>l(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=>{l[e]=((t,r)=>("string"==typeof t&&(t={url:t}),l(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(1895),o=r(701),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){l(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 l(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){"use strict";(function(t,n){var i;e.exports=B,B.ReadableState=I;var o=r(11).EventEmitter,s=function e(t,r){return t.listeners(r).length},a=r(723),u=r(0).Buffer,c=t.Uint8Array||function(){};function f(e){return u.from(e)}function l(e){return u.isBuffer(e)||e instanceof c}var h=r(1896),d;d=h&&h.debuglog?h.debuglog("stream"):function e(){};var p=r(1897),y=r(724),g=r(725),m=g.getHighWaterMark,b=r(203).codes,v=b.ERR_INVALID_ARG_TYPE,_=b.ERR_STREAM_PUSH_AFTER_EOF,w=b.ERR_METHOD_NOT_IMPLEMENTED,S=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,E=r(1899),k=E.emitExperimentalWarning,A,x;r(1)(B,a);var C=["error","close","destroy","pause","resume"];function T(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 I(e,t,n){i=i||r(154),e=e||{},"boolean"!=typeof n&&(n=t instanceof i),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(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&&(A||(A=r(44).StringDecoder),this.decoder=new A(e.encoding),this.encoding=e.encoding)}function B(e){if(i=i||r(154),!(this instanceof B))return new B(e);var t=this instanceof i;this._readableState=new I(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,r,n,i){d("readableAddChunk",t);var o=e._readableState,s;if(null===t)o.reading=!1,M(e,o);else if(i||(s=R(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):P(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?P(e,o,t,!1):F(e,o)):P(e,o,t,!1)}else n||(o.reading=!1,F(e,o));return!o.ended&&(o.length=N?e=N:(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=j(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function M(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,U(e)))}}function D(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(U,e))}function U(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,W(e)}function F(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(K,e,t))}function K(e,t){for(var r=t.length;!t.reading&&!t.ended&&t.length0,e.listenerCount("data")>0&&e.resume()}function z(e){d("readable nexttick read 0"),e.read(0)}function V(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(G,e,t))}function G(e,t){d("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),W(e),t.flowing&&!t.reading&&e.read(0)}function W(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},B.prototype._read=function(e){this.emit("error",new w("_read()"))},B.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:b;function u(e,t){d("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,h())}function c(){d("onend"),e.end()}i.endEmitted?n.nextTick(a):r.once("end",a),e.on("unpipe",u);var f=q(r);e.on("drain",f);var l=!1;function h(){d("cleanup"),e.removeListener("close",g),e.removeListener("finish",m),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",u),r.removeListener("end",c),r.removeListener("end",b),r.removeListener("data",p),l=!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))&&!l&&(d("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function y(t){d("onerror",t),b(),e.removeListener("error",y),0===s(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",m),b()}function m(){d("onfinish"),e.removeListener("close",g),b()}function b(){d("unpipe"),r.unpipe(e)}return r.on("data",p),T(e,"error",y),e.once("close",g),e.once("finish",m),e.emit("pipe",r),i.flowing||(d("pipe resume"),r.resume()),e},B.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(z,this))),r},B.prototype.addListener=B.prototype.on,B.prototype.removeListener=function(e,t){var r=a.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(H,this),r},B.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(H,this),t},B.prototype.resume=function(){var e=this._readableState;return e.flowing||(d("resume"),e.flowing=!e.readableListening,V(this,e)),this},B.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},B.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(T.prototype,"writableBuffer",{enumerable:!1,get:function e(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function e(){return this._writableState.highWaterMark}}),T.prototype._write=function(e,t,r){r(new b("_write()"))},T.prototype._writev=null,T.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||z(this,n,r),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function e(){return this._writableState.length}}),Object.defineProperty(T.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)}}),T.prototype.destroy=d.destroy,T.prototype._undestroy=d.undestroy,T.prototype._destroy=function(e,t){t(e)}}).call(this,r(8),r(3))},function(e,t,r){"use strict";e.exports=f;var n=r(203).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(154);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.length0)if("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=f(t)),n)o.endEmitted?e.emit("error",new S):P(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?P(e,o,t,!1):F(e,o)):P(e,o,t,!1)}else n||(o.reading=!1,F(e,o));return!o.ended&&(o.length=N?e=N:(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=j(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function M(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,U(e)))}}function D(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(U,e))}function U(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,W(e)}function F(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(K,e,t))}function K(e,t){for(var r=t.length;!t.reading&&!t.ended&&t.length0,e.listenerCount("data")>0&&e.resume()}function z(e){d("readable nexttick read 0"),e.read(0)}function V(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(G,e,t))}function G(e,t){d("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),W(e),t.flowing&&!t.reading&&e.read(0)}function W(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},B.prototype._read=function(e){this.emit("error",new w("_read()"))},B.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:b;function u(e,t){d("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,h())}function c(){d("onend"),e.end()}i.endEmitted?n.nextTick(a):r.once("end",a),e.on("unpipe",u);var f=q(r);e.on("drain",f);var l=!1;function h(){d("cleanup"),e.removeListener("close",g),e.removeListener("finish",m),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",u),r.removeListener("end",c),r.removeListener("end",b),r.removeListener("data",p),l=!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))&&!l&&(d("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function y(t){d("onerror",t),b(),e.removeListener("error",y),0===s(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",m),b()}function m(){d("onfinish"),e.removeListener("close",g),b()}function b(){d("unpipe"),r.unpipe(e)}return r.on("data",p),T(e,"error",y),e.once("close",g),e.once("finish",m),e.emit("pipe",r),i.flowing||(d("pipe resume"),r.resume()),e},B.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(z,this))),r},B.prototype.addListener=B.prototype.on,B.prototype.removeListener=function(e,t){var r=a.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(H,this),r},B.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(H,this),t},B.prototype.resume=function(){var e=this._readableState;return e.flowing||(d("resume"),e.flowing=!e.readableListening,V(this,e)),this},B.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},B.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(T.prototype,"writableBuffer",{enumerable:!1,get:function e(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function e(){return this._writableState.highWaterMark}}),T.prototype._write=function(e,t,r){r(new b("_write()"))},T.prototype._writev=null,T.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||z(this,n,r),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function e(){return this._writableState.length}}),Object.defineProperty(T.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)}}),T.prototype.destroy=d.destroy,T.prototype._undestroy=d.undestroy,T.prototype._destroy=function(e,t){t(e)}}).call(this,r(8),r(3))},function(e,t,r){"use strict";e.exports=f;var n=r(204).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(155);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.length=e.length||t<0)){var r=e.pop();if(t=this._parserSize;){var n=1===this._buffer.length?this._buffer[0]:s.concat(this._buffer);this._bufferSize-=this._parserSize,this._buffer=this._bufferSize?[n.slice(this._parserSize)]:[],this._parser(n.slice(0,this._parserSize))}r(null)},k.prototype._callback=function(e,t,r){e&&(this._clearTimeout(),this.peerChoking||this._finished||this._updateTimeout(),e.callback(t,r))},k.prototype._clearTimeout=function(){this._timeout&&(clearTimeout(this._timeout),this._timeout=null)},k.prototype._updateTimeout=function(){var e=this;e._timeoutMs&&e.requests.length&&!e._timeout&&(e._timeout=setTimeout(function(){e._onTimeout()},e._timeoutMs),e._timeoutUnref&&e._timeout.unref&&e._timeout.unref())},k.prototype._parse=function(e,t){this._parserSize=e,this._parser=t},k.prototype._onMessageLength=function(e){var t=e.readUInt32BE(0);t>0?this._parse(t,this._onMessage):(this._onKeepAlive(),this._parse(4,this._onMessageLength))},k.prototype._onMessage=function(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)}},k.prototype._parseHandshake=function(){var e=this;e._parse(1,function(t){var r=t.readUInt8(0);e._parse(r+48,function(t){var n=t.slice(0,r);if("BitTorrent protocol"!==n.toString())return e._debug("Error: wire not speaking BitTorrent protocol (%s)",n.toString()),void e.end();t=t.slice(r),e._onHandshake(t.slice(8,28),t.slice(28,48),{dht:!!(1&t[7]),extended:!!(16&t[5])}),e._parse(4,e._onMessageLength)})})},k.prototype._onFinish=function(){for(this._finished=!0,this.push(null);this.read(););for(clearInterval(this._keepAliveInterval),this._parse(Number.MAX_VALUE,function(){});this.peerRequests.length;)this.peerRequests.pop();for(;this.requests.length;)this._callback(this.requests.pop(),new Error("wire was closed"),null)},k.prototype._debug=function(){var e=[].slice.call(arguments);e[0]="["+this._debugId+"] "+e[0],a.apply(null,e)}},function(e,t,r){(function(e,t){!function(){var n;"undefined"!=typeof window&&(n=window),void 0!==e&&(n=e),n=n||{};var i=n.console||{log:function(){}};function o(e,t){return t?r(1927)(e):e.slice?o[n(e)]:function(t,r){e(t={exports:{}}),o[n(r)]=t.exports};function n(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!n(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 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,l=0,h,d,p,y,g=r(u);if(e.r=null,i&&o(a)&&(p=i(a),y=!0),n(a)||p)for(h=(p||a).length;l",n.drift=0,n.is=function(e,t,r){var i=t&&e&&e[w]&&e[w][n._]||r;if(i)return b(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=h(e[w],n._);return S!==t&&t!==w&&(b(i)&&(a[t]=i),S!==o&&(e[t]=o)),e},n.to=function(e,t,i){var o=(e||{})[t];return p(o)&&(o=g(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=b(r)?r:n(),s[w]=s[w]||{},y(s,e,{o:s,s:r}),s):(i=i||p(r)?r:o,r=b(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 l=t.obj,h=l.as,d=l.has,p=l.is,y=l.map,g=l.copy,m=t.num,b=m.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)||l(t))&&!d(t,e,{cb:r,fn:n,as:i})}}(),function(){function e(e,t){var i;return(i=l(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,l,h;if(n._===i&&f(t,r.rel._))return o._;if(l=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))),(h=u.map)&&(h.call(u.as||{},t,i,o,s),f(o,i))){if(t=o[i],y===t)return void c(o,i);if(!(l=a(t,i,o,s,u)))return}if(!i)return s.node;if(!0===l)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=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 l(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 h({},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(l(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,l=a.empty,h=a.put,d=a.map,p=a.copy,y;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],l=t.HAM(o.machine,s,c,e,f);l.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):l.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[m],s=n.graph[o],a=i[b],u,c=n.next||(n.next={}),f=c[o];if(h(o,"*")){var l={};t.obj.map(n.graph,function(e,r){t.text.match(r,o)&&(l[r]=t.obj.copy(e))}),t.obj.empty(l)||n.on("in",{"@":e["#"],how:"*",put:l,$:r})}if(!s)return n.on("get",e);if(a){if(!h(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 l(e)||(e={}),l(i.opt)||(i.opt=e),u(o)&&(o=[o]),n(o)&&(o=p(o,function(e,t,r){r(e,{url:e})}),l(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 g()+c(12)},r};var n=t.list.is,a=t.text,u=a.is,c=a.random,f=t.obj,l=f.is,h=f.has,d=f.to,p=f.map,y=f.copy,g=t.state.lex,m=t.val.rel._,b=".",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 l();s||(s=setTimeout(l,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.I})}}Gun.debug?setTimeout(u,1):u()});var f=function(e,t,r,n){a[n]=Gun.state.to(r,t,a[n])},l=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:l})}(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.mesh)return o.say(t,r.mesh.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.mesh=function(){}).via=n,(f=c["><"])&&(c.mesh.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 l=0,h;h=c[l++];)o.hear(h,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,l=u.wire||a.wire&&a.wire(u),h,d;if(l&&(h=s.mesh||n,u!==h.via&&((d=h.raw)||(d=o.raw(s)),!((f=s["@"])&&(f=e.dup.s[f])&&(f=f.it)&&f.get&&f["##"]&&f["##"]===s["##"])&&(!(f=h.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.mesh||{},l,h,d;if(d=f.raw)return d;if("string"==typeof r)return r;r["@"]&&(d=r.put)&&((h=r["##"])||(l=u(d,n)||"",h=o.hash(r,l),r["##"]=h),(d=i.s)[h=r["@"]+h]=d[r["#"]],r["#"]=h||r["#"],l&&((r=t.obj.to(r)).put=c));var p=0,y=[];t.obj.map(a.peers,function(e){if(y.push(e.url||e.id),++p>9)return!0}),r["><"]=y.join();var g=u(r);return s!==l&&(d=g.indexOf(c,g.indexOf("put")),g=g.slice(0,d-1)+l+g.slice(d+c.length+1)),f&&(f.raw=g),g},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=l-h,k=Math.floor,A=String.fromCharCode,x;function C(e){throw new RangeError(S[e])}function T(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function I(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=T(i,t).join(".");return n+o}function B(e){for(var t=[],r=0,n=e.length,i,o;r=55296&&i<=56319&&r65535&&(e-=65536,t+=A(e>>>10&1023|55296),e=56320|1023&e),t+=A(e),t}).join("")}function P(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:l}function R(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function N(e,t,r){var n=0;for(e=r?k(e/y):e>>1,e+=k(e/t);e>E*d>>1;n+=l)e=k(e/E);return k(n+(E+1)*e/(e+p))}function j(e){var t=[],r=e.length,n,i=0,o=m,s=g,a,u,c,p,y,v,_,w,S;for(a=e.lastIndexOf(b),a<0&&(a=0),u=0;u=128&&C("not-basic"),t.push(e.charCodeAt(u));for(c=a>0?a+1:0;c=r&&C("invalid-input"),_=P(e.charCodeAt(c++)),(_>=l||_>k((f-i)/y))&&C("overflow"),i+=_*y,w=v<=s?h:v>=s+d?d:v-s,!(_k(f/S)&&C("overflow"),y*=S;n=t.length+1,s=N(i-p,n,0==p),k(i/n)>f-o&&C("overflow"),o+=k(i/n),i%=n,t.splice(i++,0,o)}return O(t)}function L(e){var t,r,n,i,o,s,a,u,c,p,y,v=[],_,w,S,E;for(e=B(e),_=e.length,t=m,r=0,o=g,s=0;s<_;++s)y=e[s],y<128&&v.push(A(y));for(n=i=v.length,i&&v.push(b);n<_;){for(a=f,s=0;s<_;++s)y=e[s],y>=t&&yk((f-r)/w)&&C("overflow"),r+=(a-t)*w,t=a,s=0;s<_;++s)if(y=e[s],yf&&C("overflow"),y==t){for(u=r,c=l;p=c<=o?h:c>=o+d?d:c-o,!(u0&&c>u&&(c=u);for(var f=0;f=0?(d=l.substr(0,h),p=l.substr(h+1)):(d=l,p=""),y=decodeURIComponent(d),g=decodeURIComponent(p),n(s,y)?i(s[y])?s[y].push(g):s[y]=[s[y],g]:s[y]=g}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;ns.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),"application/json",n)}else{let r=c(Object.keys(t).map(e=>({key:e,value:t[e]})));await o.p_POST(this._url(e,servercommands.set),"application/json",r)}}_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),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){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){"use strict";t.byteLength=f,t.toByteArray=h,t.fromByteArray=y;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 l(e,t,r){return 3*(t+r)/4-r}function h(e){for(var t,r=c(e),n=r[0],s=r[1],a=new o(l(e,n,s)),u=0,f=s>0?n-4:n,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 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){t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<>1,f=-7,l=r?i-1:0,h=r?-1:1,d=e[t+l];for(l+=h,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=256*o+e[t+l],l+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+e[t+l],l+=h,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,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+l>=1?h/u:h*Math.pow(2,1-l),t*u>=2&&(s++,u/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(t*u-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-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*y}},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(5).Buffer,o=r(752);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(391),i=r(157);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){},function(e,t,r){(function(n,i){const o=r(392),s=r(4)("dweb-transports:ipfs"),a=r(756),u=r(1652),c=r(10),f=r(40),l=r(35),h=r(12),d=r(91),p=r(156),y=r(126),g=r(205),m={repo:"/tmp/dweb_ipfsv3107",config:{Bootstrap:["/dns4/dweb.me/tcp/4245/wss/ipfs/QmQ921MRjsbP12fHSEDcdFeuHFg6qKDFurm2rXgA5K3RQD"]},EXPERIMENTAL:{pubsub:!0},preload:{enabled:!1}};class b 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),r(n)):(s("IPFS available via %s: %o",t,i),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(m,e.ipfs);s("setup options=%o",t);const r=new b(t);return y.addtransport(r),r}async p_setup1(e){try{this.status=p.STATUS_STARTING,e&&e(this),this.ipfs=await new Promise((e,t)=>{this.IPFSAutoConnect((r,n)=>{r?t(r):e(n)})}),this.status=p.STATUS_CONNECTED}catch(e){console.error(this.name,"failed to connect",e),this.status=p.STATUS_FAILED}return e&&e(this),this}p_stop(e){return new Promise((t,r)=>this.ipfs.stop((n,i)=>{this.status=p.STATUS_FAILED,e&&e(this),n?r(n):t(i)}))}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=l.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=b.cidFrom(e),i=b.ipfsFrom(e);try{const r=await g.p_timeout(this.ipfs.dag.get(n),t,"Timed out IPFS fetch of "+b._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.files.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=b.ipfsGatewayFrom(e);return await g.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.files.add(t,{"cid-version":1,hashAlg:"sha2-256"}))[0];return b.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.files.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=b.cidFrom(a);console.assert(a===o,"url should match url from rawstore");const c=a.split("/")[2],f=b.urlFrom(u);console.assert(a===f,"Should round trip"),n=a;const l=await t.p_rawfetch(n);return console.assert(l.toString()===i,"Should fetch block stored above"),t}catch(e){throw console.log("Exception thrown in TransportIPFS.test:",e.message),e}}}y._transportclasses.IPFS=b,t=e.exports=b}).call(this,r(8),r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(393),o=r(757),s=r(51),a=r(47),u=r(167),c=r(30),f=r(86),l=r(77),h=r(27),d=r(18),p=r(552),y=r(1145),g=r(10),m=r(4),b=r(333),v=r(11),_=r(1151),w=r(1159),S=r(1177),E=r(1643),k=r(1644),A=r(1648);class x extends v{constructor(e){super(),this._options={init:!0,start:!0,EXPERIMENTAL:{},preload:{enabled:!0,addresses:["/dnsaddr/node0.preload.ipfs.io/https","/dnsaddr/node1.preload.ipfs.io/https"]}},e=_.validate(e||{}),b(this._options,e),!1===e.init&&(this._options.init=!1),!1!==e.start&&(this._options.start=!0),"string"==typeof e.repo||void 0===e.repo?this._repo=E(e.repo):this._repo=e.repo,this.log=m("jsipfs"),this.log.err=m("jsipfs:err"),this.types={Buffer:n,PeerId:s,PeerInfo:a,multiaddr:h,multibase:y,multihash:d,CID:g,dagPB:c,dagCBOR:u},this._peerInfoBook=new p,this._peerInfo=void 0,this._libp2pNode=void 0,this._bitswap=void 0,this._blockService=new i(this._repo),this._ipld=new o(this._blockService),this._pubsub=void 0,this._preload=k(this),this._mfsPreload=A(this),this.init=S.init(this),this.preStart=S.preStart(this),this.start=S.start(this),this.stop=S.stop(this),this.shutdown=this.stop,this.isOnline=S.isOnline(this),this.version=S.version(this),this.id=S.id(this),this.repo=S.repo(this),this.bootstrap=S.bootstrap(this),this.config=S.config(this),this.block=S.block(this),this.object=S.object(this),this.dag=S.dag(this),this.libp2p=S.libp2p(this),this.swarm=S.swarm(this),this.files=S.files(this),this.bitswap=S.bitswap(this),this.pin=S.pin(this),this.ping=S.ping(this),this.pingPullStream=S.pingPullStream(this),this.pingReadableStream=S.pingReadableStream(this),this.pubsub=S.pubsub(this),this.dht=S.dht(this),this.dns=S.dns(this),this.key=S.key(this),this.stats=S.stats(this),this._options.EXPERIMENTAL.pubsub&&this.log("EXPERIMENTAL 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(1649)(this),this.ls=this.files.lsImmutable,this.lsReadableStream=this.files.lsReadableStreamImmutable,this.lsPullStream=this.files.lsPullStreamImmutable,this.util={crypto:f,isIPFS:l};const t=S.mfs(this);Object.keys(t).forEach(e=>{this.files[e]=t[e]}),w(this)}}t=e.exports=x,t.createNode=(e=>new x(e))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(105),i=r(9),o=r(10),s=r(784),a=r(785),u=r(393),c=r(45).join,f=r(45).sep,l=r(72).source,h=r(291),d=r(83),p=r(42),y=r(6),g=r(38).MemoryDatastore;function m(){}class b{constructor(e){if(!e)throw new Error("Missing blockservice");this.bs=e,this.resolvers={get"dag-pb"(){const e=r(30);return{resolver:e.resolver,util:e.util}},get"dag-cbor"(){const e=r(167);return{resolver:e.resolver,util:e.util}},get"git-raw"(){const e=r(883);return{resolver:e.resolver,util:e.util}},get"bitcoin-block"(){const e=r(888);return{resolver:e.resolver,util:e.util}},get"eth-account-snapshot"(){const e=r(117).ethAccountSnapshot;return{resolver:e.resolver,util:e.util}},get"eth-block"(){const e=r(117).ethBlock;return{resolver:e.resolver,util:e.util}},get"eth-block-list"(){const e=r(117).ethBlockList;return{resolver:e.resolver,util:e.util}},get"eth-state-trie"(){const e=r(117).ethStateTrie;return{resolver:e.resolver,util:e.util}},get"eth-storage-trie"(){const e=r(117).ethStorageTrie;return{resolver:e.resolver,util:e.util}},get"eth-tx"(){const e=r(117).ethTx;return{resolver:e.resolver,util:e.util}},get"eth-tx-trie"(){const e=r(117).ethTxTrie;return{resolver:e.resolver,util:e.util}},get raw(){const e=r(994);return{resolver:e.resolver,util:e.util}},get"zcash-block"(){const e=r(995);return{resolver:e.resolver,util:e.util}}},this.support={},this.support.add=((e,t,r)=>{if(this.resolvers[e])throw new Error('Resolver already exists for codec "'+e+'"');this.resolvers[e]={resolver:t,util:r}}),this.support.rm=(e=>{this.resolvers[e]&&delete this.resolvers[e]})}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,(e,t)=>{if(e)return n(e);n(null,{value:t,remainderPath:""})});let i;s(r=>{this.bs.get(e,(n,o)=>{if(n)return r(n);const s=this.resolvers[e.codec];if(!s)return r(new Error('No resolver found for codec "'+e.codec+'"'));s.resolver.resolve(o.data,t,(e,n)=>{if(e)return r(e);i=n.value,t=n.remainderPath,r()})})},()=>{const n=!t||""===t||"/"===t,s=i&&!i["/"];return!!(n&&s||r.localResolve)||(i&&i["/"]&&(e=new o(i["/"])),!1)},(e,r)=>e?n(e):n(null,{value:i,remainderPath:t}))}getStream(e,t,r){const n=l();return this.get(e,t,r,(e,t)=>{if(e)return n.resolve(i.error(e));n.resolve(i.values([t]))}),n}put(e,t,r){if("function"==typeof t)return r=t,setImmediate(()=>r(new Error("IPLDResolver.put requires options")));if(r=r||m,t.cid&&o.isCID(t.cid))return this._put(t.cid,e,r);const n=this.resolvers[t.format];if(!n)return r(new Error('No resolver found for codec "'+t.format+'"'));n.util.cid(e,t,(t,n)=>{if(t)return r(t);this._put(n,e,r)})}treeStream(e,t,r){let n;if("object"==typeof t&&(r=t,t=void 0),r=r||{},!r.recursive){n=l();const t=this.resolvers[e.codec];if(!t)return n.abort(new Error('No resolver found for codec "'+e.codec+'"')),n;y([t=>this.bs.get(e,t),(e,r)=>t.resolver.tree(e.data,r)],(e,t)=>{if(e)return n.abort(e),n;n.resolve(i.values(t))})}return r.recursive&&(n=i(h.widthFirst({basePath:null,cid:e},e=>{if("string"==typeof e)return i.empty();const t=l(),r=e.cid,n=this.resolvers[r.codec];return n?(y([t=>this.bs.get(e.cid,t),(e,t)=>n.resolver.tree(e.data,(r,i)=>{if(r)return t(r);d(i,(t,r)=>{n.resolver.isLink(e.data,t,(e,n)=>{if(e)return r(e);r(null,{path:t,link:n})})},t)})],(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:new o(t.link["/"])}:r})))}),t):(t.abort(new Error('No resolver found for codec "'+r.codec+'"')),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){const r=this.resolvers[e.codec];if(!r)return t(new Error('No resolver found for codec "'+e.codec+'"'));y([t=>this.bs.get(e,t),(e,t)=>{r?r.util.deserialize(e.data,(e,r)=>{if(e)return t(e);t(null,r)}):t(null,e.data)}],t)}_put(e,t,r){r=r||m;const i=this.resolvers[e.codec];if(!i)return r(new Error('No resolver found for codec "'+e.codec+'"'));y([e=>i.util.serialize(t,e),(t,r)=>this.bs.put(new n(t,e),r)],t=>{if(t)return r(t);r(null,e)})}}b.inMemory=function(e){const t=new a("in-memory",{storageBackends:{root:g,blocks:g,datastore:g},lock:"memory"}),r=new u(t);p([e=>t.init({},e),e=>t.open(e)],t=>{if(t)return e(t);e(null,new b(r))})},e.exports=b},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(22),o=r(767),s=r(397),a=r(396);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(209),i=r(396).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(18);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(770),once:r(277),values:r(79),count:r(771),infinite:r(772),empty:r(773),error:r(399)}},function(e,t,r){"use strict";var n=r(79);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=function e(){return function(e,t){t(!0)}}},function(e,t,r){"use strict";e.exports={drain:r(159),onEnd:r(775),log:r(776),find:r(777),reduce:r(278),collect:r(92),concat:r(778)}},function(e,t,r){"use strict";var n=r(159);e.exports=function e(t){return n(null,t)}},function(e,t,r){"use strict";var n=r(159);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(160),o=r(159);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(278);e.exports=function e(t){return n(function(e,t){return e+t},"",t)}},function(e,t,r){"use strict";e.exports={map:r(400),asyncMap:r(161),filter:r(162),filterNot:r(780),through:r(402),take:r(781),unique:r(403),nonUnique:r(782),flatten:r(783)}},function(e,t,r){"use strict";var n=r(401),i=r(162);e.exports=function e(t){return t=n(t),i(function(e){return!t(e)})}},function(e,t,r){"use strict";e.exports=function e(t,r){r=r||{};var n=r.last||!1,i=!1;if("number"==typeof t){n=!0;var o=t;t=function(){return--o}}return function(e){function r(t){e(!0,function(e){n=!1,t(e||!0)})}return function(o,s){i&&!o?n?r(s):s(i):(i=o)?e(i,s):e(null,function(e,o){(i=i||e)?s(i):t(o)?s(null,o):(i=!0,n?s(null,o):r(s))})}}}},function(e,t,r){"use strict";var n=r(403);e.exports=function e(t){return n(t,!0)}},function(e,t,r){"use strict";var n=r(79),i=r(277);e.exports=function e(){return function(e){var t;return function(r,o){function s(){t(null,function(t,r){!0===t?a():t?e(!0,function(e){o(t)}):o(null,r)})}function a(){t=null,e(null,function(e,r){if(e)return o(e);Array.isArray(r)||r&&"object"==typeof r?r=n(r):"function"!=typeof r&&(r=i(r)),t=r,s()})}r?t?t(r,function(t){e(t||r,o)}):e(r,o):t?s():a()}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;var n=r(404),i=o(n);function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t,r){(0,i.default)(e,function(){return!t.apply(this,arguments)},r)}e.exports=t.default},function(e,t,r){"use strict";const n=r(6),i=r(42),o=r(49),s=r(43),a=r(216),u=r(20),c=r(45),f=r(4),l=r(63),h=r(9),d=r(799),p=r(800),y=r(802),g=r(809),m=r(811),b=r(812),v=r(822),_=r(847),w=r(848),S=f("repo"),E=Number.MAX_SAFE_INTEGER,k={memory:r(446),fs:r(446)},A=r(849).repoVersion;class x{constructor(e,t){u.equal(typeof e,"string","missing repoPath"),this.options=O(t),this.closed=!0,this.path=e,this._locker=this._getLocker(),this.root=d.create("root",this.path,this.options),this.version=p(this.root),this.config=y(this.root),this.spec=g(this.root),this.apiAddr=m(this.root)}init(e,t){S("initializing at: %s",this.path),i([e=>this.root.open(I(e)),t=>this.config.set(P(e),t),t=>this.spec.set(R(e),t),e=>this.version.set(A,e)],t)}open(e){this.closed?(S("opening at: %s",this.path),n([e=>this.root.open(I(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);b(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.equal(typeof r.close,"function","Locks must have a close method"),t(null,r)})}_closeLock(e){if(this.lockfile)return this.lockfile.close(e);e()}_isLocked(e,t){if(this._locker)return this._locker.locked(e,t);t(null,!1)}_isInitialized(e){S("init check"),o({config:e=>this.config.exists(e),spec:e=>this.spec.exists(e),version:e=>this.version.check(A,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(B(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 l(t?E:r))}),version:e=>this.version.get(e),blocks:e=>this.blocks.query({},(t,r)=>{r=r||[];const n=new l(r.length);let i=new l(0);r.forEach(e=>{i=i.plus(e.value.byteLength).plus(e.key._buf.byteLength)}),e(t,{count:n,size:i})}),datastore:e=>C(this.datastore,e),keys:e=>C(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 C(e,t){h(e.query({}),h.reduce((e,t)=>e.plus(t.value.byteLength).plus(t.key._buf.byteLength),new l(0),t))}function T(e,t){return r=>{t(r&&!e(r)?r:null)}}function I(e){return T(e=>"Already open"===e.message,e)}function B(e){return T(e=>e&&(e.code===w.ERR_REPO_NOT_INITIALIZED||e.message.startsWith("ENOENT")),e)}function O(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 P(e){return e.datastore=Object.assign({},_,a(e,"datastore",{})),e}function R(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=x,e.exports.repoVersion=A,e.exports.errors=w},function(e,t,r){var n=r(213),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(93),i=c(n),o=r(789),s=c(o),a=r(410),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({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(`version mismatch: expected v${e}, found v${n}`));t()})}}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(9),i=r(7),o=r(285).asyncFilter,s=r(285).asyncSort,a=r(417),u=r(420);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(38).Key,i=r(164),o=r(6),s=r(216),a=r(421),u=r(422),c=r(5).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"));let 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)),l],t):l(i,t)}function l(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=b;var n=r(804),i=m(n),o=r(81),s=m(o),a=r(59),u=m(a),c=r(128),f=m(c),l=r(279),h=m(l),d=r(808),p=m(d),y=r(37),g=m(y);function m(e){return e&&e.__esModule?e:{default:e}}function b(e,t,r){if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var n=(0,g.default)(e),o=0,a=[],c=!1;function l(e,t,r){if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");if(m.started=!0,(0,s.default)(e)||(e=[e]),0===e.length&&m.idle())return(0,h.default)(function(){m.drain()});for(var n=0,i=e.length;n0&&a.splice(u,1),s.callback.apply(s,arguments),null!=t&&m.error(t,s.data)}o<=m.concurrency-m.buffer&&m.unsaturated(),m.idle()&&m.drain(),m.process()}}var y=!1,m={_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){l(e,!1,t)},kill:function(){m.drain=u.default,m._tasks.empty()},unshift:function(e,t){l(e,!0,t)},remove:function(e){m._tasks.remove(e)},process:function(){if(!y){for(y=!0;!m.paused&&o({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";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(38).Key,i=r(5).Buffer,o=new n("api");e.exports=(e=>({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(813),i=n.ShardingDatastore,o=r(38).Key,s=r(426),a=r(105),u=r(7),c=r(287),f=r(10),l=r(9),h=e=>{const t=new s.Encoder;return new o("/"+t.write(e).finalize(),!1)},d=e=>h(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 y(e){return{query(t,r){l(e.query(t),l.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,(e,n)=>{if(e)return r(e);r(null,new a(n,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),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)}}}e.exports=((e,t,r)=>{p(e,t,(e,t)=>{if(e)return r(e);r(null,y(t))})})},function(e,t,r){"use strict";const n=r(217),i=r(814),o=r(816),s=r(817),a=r(818),u=r(424);t.KeytransformDatastore=n,t.ShardingDatastore=i,t.MountDatastore=o,t.TieredDatastore=s,t.NamespaceDatastore=a,t.shard=u},function(e,t,r){"use strict";(function(t){const n=r(6),i=r(49),o=r(38).Key,s=r(424),a=r(217),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(43),i=r(425),o=r(9),s=r(38).Key,a=r(38).Errors,u=r(38).utils,c=u.asyncFilter,f=u.asyncSort,l=u.replaceStartWith,h=r(217);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=l(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 h(t.datastore,{convert:e=>{throw new Error("should never be called")},invert:e=>t.prefix.child(e)});let n;return null!=e.prefix&&(n=l(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,r){"use strict";const n=r(43),i=r(60),o=r(38).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(38).Key,i=r(217);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";Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;var n=r(820),i=o(n);function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t,r,n){(0,i.default)(e,t,function(e,t){r(e,function(e,r){t(e,!r)})},n)}e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=g;var n=r(288),i=d(n),o=r(93),s=d(o),a=r(821),u=d(a),c=r(59),f=d(c),l=r(37),h=d(l);function d(e){return e&&e.__esModule?e:{default:e}}function p(e,t,r,n){var i=new Array(t.length);e(t,function(e,t,n){r(e,function(e,r){i[t]=!!r,n(e)})},function(e){if(e)return n(e);for(var r=[],o=0;o=0;l--)if(u[l]!==c[l])return!1;for(l=u.length-1;l>=0;l--)if(f=u[l],!v(e[f],t[f],r,n))return!1;return!0}function S(e,t,r){v(e,t,!0)&&m(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 A(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&&m(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)&&m(i,r,"Got unwanted exception"+n),e&&i&&r&&!E(i,r)||!e&&i)throw i}l.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 r=t.stackStartFunction||m;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(l.AssertionError,Error),l.fail=m,l.ok=b,l.equal=function e(t,r,n){t!=r&&m(t,r,n,"==",l.equal)},l.notEqual=function e(t,r,n){t==r&&m(t,r,n,"!=",l.notEqual)},l.deepEqual=function e(t,r,n){v(t,r,!1)||m(t,r,n,"deepEqual",l.deepEqual)},l.deepStrictEqual=function e(t,r,n){v(t,r,!0)||m(t,r,n,"deepStrictEqual",l.deepStrictEqual)},l.notDeepEqual=function e(t,r,n){v(t,r,!1)&&m(t,r,n,"notDeepEqual",l.notDeepEqual)},l.notDeepStrictEqual=S,l.strictEqual=function e(t,r,n){t!==r&&m(t,r,n,"===",l.strictEqual)},l.notStrictEqual=function e(t,r,n){t===r&&m(t,r,n,"!==",l.notStrictEqual)},l.throws=function(e,t,r){A(!0,e,t,r)},l.doesNotThrow=function(e,t,r){A(!1,e,t,r)},l.ifError=function(e){if(e)throw e};var x=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)},l=void 0===r.allowUnicode||!!r.allowUnicode;!l&&/[^\x00-\x7f]/.test(t)&&f(o.diagnoses.undesiredNonAscii);for(var h={now:o.components.localpart,prev:o.components.localpart,stack:[o.components.localpart]},d="",p={local:"",domain:""},y={locals:[""],domains:[""]},g=0,m=0,b=0,v=void 0,_=!1,w=!1,S=t.length,E=void 0,k=0;k64?f(o.diagnoses.rfc5322LocalTooLong):h.prev!==o.components.contextComment&&h.prev!==o.components.contextFWS||f(o.diagnoses.deprecatedCFWSNearAt),h.now=o.components.domain,h.stack[0]=o.components.domain,g=0,m=0,w=!1;break;default:if(w)switch(h.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: "+h.prev)}else h.prev=h.now,v=E.codePointAt(0),(o.specials(v)||o.c0Controls(v)||o.c1Controls(v))&&f(o.diagnoses.errExpectingATEXT),p.local+=E,y.locals[g]+=E,m+=e.byteLength(E,"utf8")}break;case o.components.domain:switch(E){case"(":0===m?f(0===g?o.diagnoses.deprecatedCFWSNearAt:o.diagnoses.deprecatedComment):(w=!0,f(o.diagnoses.cfwsComment)),h.stack.push(h.now),h.now=o.components.contextComment;break;case".":var A=i.encode(y.domains[g]).length;0===m?f(0===g?o.diagnoses.errDotStart:o.diagnoses.errConsecutiveDots):_?f(o.diagnoses.errDomainHyphenEnd):A>63&&f(o.diagnoses.rfc5322LabelTooLong),w=!1,m=0,++g,y.domains[g]="",p.domain+=E;break;case"[":0===p.domain.length?(w=!0,m+=e.byteLength(E,"utf8"),h.stack.push(h.now),h.now=o.components.literal,p.domain+=E,y.domains[g]+=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===m?f(0===g?o.diagnoses.deprecatedCFWSNearAt:o.diagnoses.deprecatedFWS):(f(o.diagnoses.cfwsFWS),w=!0),h.stack.push(h.now),h.now=o.components.contextFWS,d=E;break;default:if(w)switch(h.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: "+h.prev)}v=E.codePointAt(0),_=!1,o.specials(v)||o.c0Controls(v)||o.c1Controls(v)?f(o.diagnoses.errExpectingATEXT):"-"===E?(0===m&&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,y.domains[g]+=E,m+=e.byteLength(E,"utf8")}break;case o.components.literal:switch(E){case"]":if(cB?f(o.diagnoses.rfc5322IPv6MaxGroups):O.length===B&&f(o.diagnoses.deprecatedIPv6)):O.length!==B&&f(o.diagnoses.rfc5322IPv6GroupCount),":"===I[0]&&":"!==I[1]?f(o.diagnoses.rfc5322IPv6ColonStart):":"===I[I.length-1]&&":"!==I[I.length-2]?f(o.diagnoses.rfc5322IPv6ColonEnd):o.checkIpV6(O)?f(o.diagnoses.rfc5321AddressLiteral):f(o.diagnoses.rfc5322IPv6BadCharacter)}}else f(o.diagnoses.rfc5322DomainLiteral);p.domain+=E,y.domains[g]+=E,m+=e.byteLength(E,"utf8"),h.prev=h.now,h.now=h.stack.pop();break;case"\\":f(o.diagnoses.rfc5322DomainLiteralOBSDText),h.stack.push(h.now),h.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),h.stack.push(h.now),h.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,y.domains[g]+=E,m+=e.byteLength(E,"utf8")}break;case o.components.contextQuotedString:switch(E){case"\\":h.stack.push(h.now),h.now=o.components.contextQuotedPair;break;case"\r":if(S===++k||"\n"!==t[k]){f(o.diagnoses.errCRNoLF);break}case"\t":p.local+=" ",y.locals[g]+=" ",m+=e.byteLength(E,"utf8"),f(o.diagnoses.cfwsFWS),h.stack.push(h.now),h.now=o.components.contextFWS,d=E;break;case'"':p.local+=E,y.locals[g]+=E,m+=e.byteLength(E,"utf8"),h.prev=h.now,h.now=h.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,y.locals[g]+=E,m+=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),h.prev=h.now,h.now=h.stack.pop();var P="\\"+E;switch(h.now){case o.components.contextComment:break;case o.components.contextQuotedString:p.local+=P,y.locals[g]+=P,m+=2;break;case o.components.literal:p.domain+=P,y.domains[g]+=P,m+=2;break;default:throw new Error("quoted pair logic invoked in an invalid context: "+h.now)}break;case o.components.contextComment:switch(E){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(S===++k||"\n"!==t[k]){f(o.diagnoses.errCRNoLF);break}case" ":case"\t":f(o.diagnoses.cfwsFWS),h.stack.push(h.now),h.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}++b>1?f(o.diagnoses.deprecatedFWS):b=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),b=0,h.prev=h.now,h.now=h.stack.pop(),--k}d=E;break;default:throw new Error("unknown context: "+h.now)}if(c>o.categories.rfc5322)break}if(c255)f(o.diagnoses.rfc5322DomainTooLong);else if(e.byteLength(p.local,"utf8")+R+1>254)f(o.diagnoses.rfc5322TooLong);else if(m>63)f(o.diagnoses.rfc5322LabelTooLong);else if(r.minDomainAtoms&&y.domains.length0){var _=u.shift();if(b=_._validate(d,m,i),b.errors){if(o.push(this.createError("array.ordered",{pos:l,reason:b.errors,value:d},{key:n.key,path:m.path},i)),i.abortEarly)return o}else if(_._flags.strip)h.fastSplice(t,l),--l,--f;else{if(!this._flags.sparse&&void 0===b.value){if(o.push(this.createError("array.sparse",null,{key:n.key,path:m.path,pos:l},i)),i.abortEarly)return o;continue}t[l]=b.value}continue}if(!this._inner.items.length){if(o.push(this.createError("array.orderedLength",{pos:l,limit:this._inner.ordereds.length},{key:n.key,path:m.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 l.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 l.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){l.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||l.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=g.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(g.cidrPresences,t.cidr),"cidr must be one of "+g.cidrPresences.join(", ")),t.version||"optional"===t.cidr||(r=y.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(g.normalizationForms,t),"normalization form must be one of "+g.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}(l),g.compare=function(e,r){return function(n,i){var o=h.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)})}},g.String.prototype.min=g.compare("min",function(e,r,n){var i=n?t.byteLength(e,n):e.length;return i>=r}),g.String.prototype.max=g.compare("max",function(e,r,n){var i=n?t.byteLength(e,n):e.length;return i<=r}),g.String.prototype.length=g.compare("length",function(e,r,n){var i=n?t.byteLength(e,n):e.length;return i===r}),g.String.prototype.uuid=g.String.prototype.guid,e.exports=new g.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 l(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 h(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,l=r?i-1:0,h=r?-1:1,d=e[t+l];for(l+=h,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=256*o+e[t+l],l+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+e[t+l],l+=h,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,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+l>=1?h/u:h*Math.pow(2,1-l),t*u>=2&&(s++,u/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(t*u-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-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*y}},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=l-h,k=Math.floor,A=String.fromCharCode,x;function C(e){throw new RangeError(S[e])}function T(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function I(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=T(i,t).join(".");return n+o}function B(e){for(var t=[],r=0,n=e.length,i,o;r=55296&&i<=56319&&r65535&&(e-=65536,t+=A(e>>>10&1023|55296),e=56320|1023&e),t+=A(e),t}).join("")}function P(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:l}function R(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function N(e,t,r){var n=0;for(e=r?k(e/y):e>>1,e+=k(e/t);e>E*d>>1;n+=l)e=k(e/E);return k(n+(E+1)*e/(e+p))}function j(e){var t=[],r=e.length,n,i=0,o=m,s=g,a,u,c,p,y,v,_,w,S;for(a=e.lastIndexOf(b),a<0&&(a=0),u=0;u=128&&C("not-basic"),t.push(e.charCodeAt(u));for(c=a>0?a+1:0;c=r&&C("invalid-input"),_=P(e.charCodeAt(c++)),(_>=l||_>k((f-i)/y))&&C("overflow"),i+=_*y,w=v<=s?h:v>=s+d?d:v-s,!(_k(f/S)&&C("overflow"),y*=S;n=t.length+1,s=N(i-p,n,0==p),k(i/n)>f-o&&C("overflow"),o+=k(i/n),i%=n,t.splice(i++,0,o)}return O(t)}function L(e){var t,r,n,i,o,s,a,u,c,p,y,v=[],_,w,S,E;for(e=B(e),_=e.length,t=m,r=0,o=g,s=0;s<_;++s)y=e[s],y<128&&v.push(A(y));for(n=i=v.length,i&&v.push(b);n<_;){for(a=f,s=0;s<_;++s)y=e[s],y>=t&&yk((f-r)/w)&&C("overflow"),r+=(a-t)*w,t=a,s=0;s<_;++s)if(y=e[s],yf&&C("overflow"),y==t){for(u=r,c=l;p=c<=o?h:c>=o+d?d:c-o,!(u1&&this._buf[this._buf.length-1]===s;)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{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=h((t||"").toString().trim())}catch(e){return r(e)}r(null,n)})}),t.readme=o,t.parseShardFun=h,t.Prefix=c,t.Suffix=f,t.NextToLast=l},function(e,t,r){"use strict";const n=r(5),i=r(7),o=n("repo:lock"),s="repo.lock",a={};t.lock=((e,t)=>{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,r){"use strict";e.exports=r(1158)},function(e,t,r){var n=r(334),i=r(128),o=n(i,"Map");e.exports=o},function(e,t,r){var n=r(1181),i=r(1188),o=r(1190),s=r(1191),a=r(1192);function u(e){var t=-1,r=null==e?0:e.length;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(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){(function(t){var r="Expected a function",n=NaN,i="[object Symbol]",o=/^\s+|\s+$/g,s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt,f="object"==typeof t&&t&&t.Object===Object&&t,l="object"==typeof self&&self&&self.Object===Object&&self,h=f||l||Function("return this")(),d=Object.prototype,p=d.toString,y=Math.max,g=Math.min,m=function(){return h.Date.now()};function b(e,t,n){var i,o,s,a,u,c,f=0,l=!1,h=!1,d=!0;if("function"!=typeof e)throw new TypeError(r);function p(t){var r=i,n=o;return i=o=void 0,f=t,a=e.apply(n,r),a}function b(e){return f=e,u=setTimeout(E,t),l?p(e):a}function _(e){var r=e-c,n=e-f,i=t-r;return h?g(i,s-n):i}function w(e){var r=e-c,n=e-f;return void 0===c||r>=t||r<0||h&&n>=s}function E(){var e=m();if(w(e))return k(e);u=setTimeout(E,_(e))}function k(e){return u=void 0,d&&i?p(e):(i=o=void 0,a)}function A(){void 0!==u&&clearTimeout(u),f=0,i=c=o=u=void 0}function x(){return void 0===u?a:k(m())}function C(){var e=m(),r=w(e);if(i=arguments,o=this,c=e,r){if(void 0===u)return b(c);if(h)return u=setTimeout(E,t),p(c)}return void 0===u&&(u=setTimeout(E,t)),a}return t=S(t)||0,v(n)&&(l=!!n.leading,h="maxWait"in n,s=h?y(S(n.maxWait)||0,t):s,d="trailing"in n?!!n.trailing:d),C.cancel=A,C.flush=x,C}function v(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function _(e){return!!e&&"object"==typeof e}function w(e){return"symbol"==typeof e||_(e)&&p.call(e)==i}function S(e){if("number"==typeof e)return e;if(w(e))return n;if(v(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=v(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(o,"");var r=a.test(e);return r||u.test(e)?c(e.slice(2),r?2:8):s.test(e)?n:+e}e.exports=b}).call(this,r(10))},function(e,t,r){"use strict";var n=r(1243);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,l,h;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){e.exports={_from:"ipfs@^0.31.7",_id:"ipfs@0.31.7",_inBundle:!1,_integrity:"sha512-HuA0Y6K7Y6f2Yu+ehUlGhv5VF2PtdZuME1AWYu/8zkfZ+HRpIYANjoK9GqZh6CQjOTJnIrEdqkHpOivUrZnIIg==",_location:"/ipfs",_phantomChildren:{"base-x":"3.0.4"},_requested:{type:"range",registry:!0,raw:"ipfs@^0.31.7",name:"ipfs",escapedName:"ipfs",rawSpec:"^0.31.7",saveSpec:null,fetchSpec:"^0.31.7"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/ipfs/-/ipfs-0.31.7.tgz",_shasum:"4383c263421da9e6020257e44aae3759f3fdc7f0",_spec:"ipfs@^0.31.7",_where:"/Users/mitra/git/dweb-transports",bin:{jsipfs:"src/cli/bin.js"},browser:{"./src/core/components/init-assets.js":!1,"./src/core/runtime/config-nodejs.js":"./src/core/runtime/config-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","./src/core/runtime/dns-nodejs.js":"./src/core/runtime/dns-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:"Alan Shaw",email:"alan@tableflip.io"},{name:"Alex Potsides",email:"alex@achingbrain.net"},{name:"Andrew de Andrade",email:"andrew@deandrade.com.br"},{name:"André Cruz",email:"andremiguelcruz@msn.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:"Christian Couder",email:"chriscool@tuxfamily.org"},{name:"Dafeng",email:"dfguo.joe@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:"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:"Marius Darila",email:"marius.darila@gmail.com"},{name:"Michelle Lee",email:"michelle@protocol.ai"},{name:"Mikeal Rogers",email:"mikeal.rogers@gmail.com"},{name:"Mithgol",email:"getgit@mithgol.ru"},{name:"My9Bot",email:"34904312+My9Bot@users.noreply.github.com"},{name:"Nuno Nogueira",email:"nunofmn@gmail.com"},{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:"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:"bitspill",email:"bitspill+github@bitspill.net"},{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:"Łukasz Magiera",email:"magik6k@users.noreply.github.com"},{name:"Максим Ильин",email:"negamaxi@gmail.com"},{name:"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ",email:"victorbjelkholm@gmail.com"}],dependencies:{"@nodeutils/defaults-deep":"^1.1.0",async:"^2.6.1","big.js":"^5.1.2","binary-querystring":"~0.1.2",bl:"^2.0.1",boom:"^7.2.0",bs58:"^4.0.1",byteman:"^1.3.5",cids:"~0.5.3",debug:"^3.1.0","err-code":"^1.1.2","file-type":"^8.1.0",filesize:"^3.6.1",fnv1a:"^1.0.1","fsm-event":"^2.1.0","get-folder-size":"^2.0.0",glob:"^7.1.2",hapi:"^16.6.2","hapi-set-header":"^1.0.2",hoek:"^5.0.3","human-to-milliseconds":"^1.0.0","interface-datastore":"~0.4.2","ipfs-api":"^24.0.0","ipfs-bitswap":"~0.20.3","ipfs-block":"~0.7.1","ipfs-block-service":"~0.14.0","ipfs-http-response":"~0.1.2","ipfs-mfs":"~0.3.0","ipfs-multipart":"~0.1.0","ipfs-repo":"~0.23.1","ipfs-unixfs":"~0.1.15","ipfs-unixfs-engine":"~0.32.1",ipld:"~0.17.3","ipld-dag-cbor":"~0.12.1","ipld-dag-pb":"~0.14.6","is-ipfs":"~0.4.2","is-pull-stream":"~0.0.0","is-stream":"^1.1.0",joi:"^13.4.0","joi-browser":"^13.4.0","joi-multiaddr":"^2.0.0",libp2p:"~0.23.0","libp2p-bootstrap":"~0.9.3","libp2p-circuit":"~0.2.0","libp2p-floodsub":"~0.15.0","libp2p-kad-dht":"~0.10.1","libp2p-keychain":"~0.3.1","libp2p-mdns":"~0.12.0","libp2p-mplex":"~0.8.0","libp2p-secio":"~0.10.0","libp2p-tcp":"~0.12.0","libp2p-webrtc-star":"~0.15.3","libp2p-websocket-star":"~0.8.1","libp2p-websockets":"~0.12.0",lodash:"^4.17.10",mafmt:"^6.0.0","mime-types":"^2.1.19",mkdirp:"~0.5.1",multiaddr:"^5.0.0","multiaddr-to-uri":"^4.0.0",multibase:"~0.4.0",multihashes:"~0.4.13",once:"^1.4.0","path-exists":"^3.0.0","peer-book":"~0.8.0","peer-id":"~0.11.0","peer-info":"~0.14.1",progress:"^2.0.0","prom-client":"^11.1.1","prometheus-gc-stats":"~0.5.1","promisify-es6":"^1.0.3","pull-abortable":"^4.1.1","pull-defer":"~0.2.2","pull-file":"^1.1.0","pull-ndjson":"~0.1.1","pull-paramap":"^1.2.2","pull-pushable":"^2.2.0","pull-sort":"^1.0.1","pull-stream":"^3.6.8","pull-stream-to-stream":"^1.3.4","pull-zip":"^2.0.1","read-pkg-up":"^4.0.0","readable-stream":"2.3.6","stream-to-pull-stream":"^1.7.2","tar-stream":"^1.6.1",temp:"~0.8.3",through2:"^2.0.3","update-notifier":"^2.5.0",yargs:"^12.0.1","yargs-parser":"^10.1.0","yargs-promise":"^1.1.0"},deprecated:!1,description:"JavaScript implementation of the IPFS specification",devDependencies:{aegir:"^15.1.0","buffer-loader":"~0.0.1",chai:"^4.1.2",delay:"^3.0.0","detect-node":"^2.0.3","dir-compare":"^1.4.0","dirty-chai":"^2.0.1","eslint-plugin-react":"^7.10.0",execa:"~0.10.0","expose-loader":"~0.7.5","form-data":"^2.3.2",hat:"0.0.3","interface-ipfs-core":"~0.76.1","ipfsd-ctl":"~0.39.1",mocha:"^5.2.0",ncp:"^2.0.0",nexpect:"~0.5.0","pretty-bytes":"^5.1.0",qs:"^6.5.2","random-fs":"^1.0.3",rimraf:"^2.6.2","stream-to-promise":"^2.2.0","transform-loader":"~0.2.4"},engines:{node:">=6.0.0",npm:">=3.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.1","prometheus-gc-stats":"~0.5.1"},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",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","test:bootstrapers":"IPFS_TEST=bootstrapers aegir test -t browser -f test/bootstrapers.js","test:browser":"aegir test -t browser --no-cors","test:node":"aegir test -t node","test:node:cli":"aegir test -t node -f test/cli/index.js","test:node:core":"aegir test -t node -f test/core/**/*.js","test:node:gateway":"aegir test -t node -f test/gateway/index.js","test:node:http":"aegir test -t node -f test/http-api/index.js","test:webworker":"aegir test -t webworker --no-cors"},version:"0.31.7"}},function(e,t,r){"use strict";const n=r(2),i=r(332).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,r){"use strict";const n=r(1271),i=r(88),o=r(41),s=r(1280),a=r(52).Connection,u=r(1282),c=r(5),f=c("libp2p:websockets:dialer"),l=r(1283);class h{dial(e,t,r){"function"==typeof t&&(r=t,t={}),r=r||function(){};const i=u(e);f("dialing %s",i);const o=n(i,{binary:!0,onConnect:e=>{r(e)}}),s=new a(o);return s.getObservedAddrs=(t=>t(null,[e])),s.close=(e=>o.close(e)),s}createListener(e,t){return"function"==typeof e&&(t=e,e={}),l(e,t)}filter(e){return Array.isArray(e)||(e=[e]),e.filter(e=>!s(e.protoNames(),"p2p-circuit")&&(s(e.protoNames(),"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){var n=r(1287),i=r(338),o=r(582),s=r(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 r=n(e),i=r.source,u=r.id,c=r.path,f=a[u]&&c in a[u].nsps,l=t.forceNew||t["force new connection"]||!1===t.multiplex||f,h;return l?(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]),r.query&&!t.query&&(t.query=r.query),h.socket(r.path,t)}t.protocol=i.protocol,t.connect=u,t.Manager=r(582),t.Socket=r(587)},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(1294),i=r(587),o=r(140),s=r(338),a=r(588),u=r(589),c=r(249)("socket.io-client:manager"),f=r(318),l=r(1311),h=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 l({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)h.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},d.prototype.updateSocketIds=function(){for(var e in this.nsps)h.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(339),i=r(1297),o=r(1307),s=r(1308);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(340),i=r(250),o=r(141),s=r(251),a=r(586),u=r(252)("engine.io-client:polling");e.exports=h;var c=(f=r(339),l=new f({xdomain:!1}),null!=l.responseType),f,l;function h(e){var t=e&&e.forceBase64;c&&!t||(this.supportsBinary=!1),n.call(this,e)}s(h,n),h.prototype.name="polling",h.prototype.doOpen=function(){this.poll()},h.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()},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 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))},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 r=function(){t.writable=!0,t.emit("drain")};o.encodePayload(e,this.supportsBinary,function(e){t.doWrite(e,r)})},h.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(1299),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;ao.keys.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 u(r,n))})},t.createFromHexString=function(e){return new u(i.fromHexString(e))},t.createFromBytes=function(e){return new u(e)},t.createFromB58String=function(e){return new u(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.keys.unmarshalPublicKey(i)}catch(e){return t(e)}r.hash((e,n)=>{if(e)return t(e);t(null,new u(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.keys.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 u(r,n,n.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r,s,c,f;try{r=i.fromB58String(e.id),s=e.privKey&&n.from(e.privKey,"base64"),c=e.pubKey&&n.from(e.pubKey,"base64"),f=c&&o.keys.unmarshalPublicKey(c)}catch(e){return t(e)}s?a([e=>o.keys.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)}),(e,t,r)=>{f?f.hash((n,i)=>{r(n,e,t,i)}):r(null,e,t)}],(e,n,i,o)=>e?t(e):f&&!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 u(r,i,f))):t(null,new u(r,null,f))},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(e){const n=r(341),i=r(342)(),o=r(1321),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=(t,r,o)=>{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";(function(t){const n=r(18),i=r(1326);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(e){const n=r(7);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";(function(e){const n=r(341),i=r(342)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(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(1329),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(o).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,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},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";const n=r(1),i=r(180).Reporter,o=r(0).Buffer;function s(e,t){i.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function a(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof a||(e=new a(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}n(s,i),t.DecoderBuffer=s,s.prototype.save=function e(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},s.prototype.restore=function e(t){const r=new s(this.base);return r.offset=t.offset,r.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),r},s.prototype.isEmpty=function e(){return this.offset===this.length},s.prototype.readUInt8=function e(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},s.prototype.skip=function e(t,r){if(!(this.offset+t<=this.length))return this.error(r||"DecoderBuffer overrun");const n=new s(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},s.prototype.raw=function e(t){return this.base.slice(t?t.offset:this.offset,this.length)},t.EncoderBuffer=a,a.prototype.join=function e(t,r){return t||(t=new o(this.length)),r||(r=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach(function(e){e.join(t,r),r+=e.length}):("number"==typeof this.value?t[r]=this.value:"string"==typeof this.value?t.write(this.value,r):o.isBuffer(this.value)&&this.value.copy(t,r),r+=this.length),t)}},function(e,t,r){"use strict";const n=t;n._reverse=function e(t){const r={};return Object.keys(t).forEach(function(e){(0|e)==e&&(e|=0);const n=t[e];r[n]=e}),r},n.der=r(1333)},function(e,t,r){"use strict";const n=r(1),i=r(142),o=i.base,s=i.bignum,a=i.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.Node.call(this,"der",e)}function f(e,t){let r=e.readUInt8(t);if(e.isError(r))return r;const n=a.tagClass[r>>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 l(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=l(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"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 l(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 h(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=l,t.getIdAndValidate=h,t.validateMa=(e=>a.WebSocketStar.matches(i(e)))}).call(this,r(0).Buffer)},function(e,t,r){var n=r(1347),i=r(106),o=i;o.v1=n,o.v4=i,e.exports=o},function(e,t,r){t=e.exports=r(605),t.Stream=t,t.Readable=t,t.Writable=r(609),t.Duplex=r(144),t.Transform=r(610),t.PassThrough=r(1356)},function(e,t,r){"use strict";(function(t,n){var i;e.exports=B,B.ReadableState=I;var o=r(11).EventEmitter,s=function e(t,r){return t.listeners(r).length},a=r(606),u=r(0).Buffer,c=t.Uint8Array||function(){};function f(e){return u.from(e)}function l(e){return u.isBuffer(e)||e instanceof c}var h=r(1350),d;d=h&&h.debuglog?h.debuglog("stream"):function e(){};var p=r(1351),y=r(607),g=r(608),m=g.getHighWaterMark,b=r(181).codes,v=b.ERR_INVALID_ARG_TYPE,_=b.ERR_STREAM_PUSH_AFTER_EOF,w=b.ERR_METHOD_NOT_IMPLEMENTED,S=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,E=r(1353),k=E.emitExperimentalWarning,A,x;r(1)(B,a);var C=["error","close","destroy","pause","resume"];function T(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 I(e,t,n){i=i||r(144),e=e||{},"boolean"!=typeof n&&(n=t instanceof i),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(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&&(A||(A=r(55).StringDecoder),this.decoder=new A(e.encoding),this.encoding=e.encoding)}function B(e){if(i=i||r(144),!(this instanceof B))return new B(e);var t=this instanceof i;this._readableState=new I(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,r,n,i){d("readableAddChunk",t);var o=e._readableState,s;if(null===t)o.reading=!1,M(e,o);else if(i||(s=R(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):P(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?P(e,o,t,!1):F(e,o)):P(e,o,t,!1)}else n||(o.reading=!1,F(e,o));return!o.ended&&(o.length=N?e=N:(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=j(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function M(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,U(e)))}}function D(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(U,e))}function U(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,W(e)}function F(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(K,e,t))}function K(e,t){for(var r=t.length;!t.reading&&!t.ended&&t.length0,e.listenerCount("data")>0&&e.resume()}function z(e){d("readable nexttick read 0"),e.read(0)}function V(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(G,e,t))}function G(e,t){d("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),W(e),t.flowing&&!t.reading&&e.read(0)}function W(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 Z(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},B.prototype._read=function(e){this.emit("error",new w("_read()"))},B.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:b;function u(e,t){d("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,h())}function c(){d("onend"),e.end()}i.endEmitted?n.nextTick(a):r.once("end",a),e.on("unpipe",u);var f=q(r);e.on("drain",f);var l=!1;function h(){d("cleanup"),e.removeListener("close",g),e.removeListener("finish",m),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",u),r.removeListener("end",c),r.removeListener("end",b),r.removeListener("data",p),l=!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!==Z(i.pipes,e))&&!l&&(d("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function y(t){d("onerror",t),b(),e.removeListener("error",y),0===s(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",m),b()}function m(){d("onfinish"),e.removeListener("close",g),b()}function b(){d("unpipe"),r.unpipe(e)}return r.on("data",p),T(e,"error",y),e.once("close",g),e.once("finish",m),e.emit("pipe",r),i.flowing||(d("pipe resume"),r.resume()),e},B.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(z,this))),r},B.prototype.addListener=B.prototype.on,B.prototype.removeListener=function(e,t){var r=a.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(H,this),r},B.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(H,this),t},B.prototype.resume=function(){var e=this._readableState;return e.flowing||(d("resume"),e.flowing=!e.readableListening,V(this,e)),this},B.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},B.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(T.prototype,"writableBuffer",{enumerable:!1,get:function e(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function e(){return this._writableState.highWaterMark}}),T.prototype._write=function(e,t,r){r(new b("_write()"))},T.prototype._writev=null,T.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||z(this,n,r),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function e(){return this._writableState.length}}),Object.defineProperty(T.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)}}),T.prototype.destroy=d.destroy,T.prototype._undestroy=d.undestroy,T.prototype._destroy=function(e,t){t(e)}}).call(this,r(10),r(3))},function(e,t,r){"use strict";e.exports=f;var n=r(181).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(144);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.length{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";(function(e){const n=r(346),i=r(347)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(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(1373),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(o).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,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},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";const n=r(1),i=r(184).Reporter,o=r(0).Buffer;function s(e,t){i.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function a(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof a||(e=new a(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}n(s,i),t.DecoderBuffer=s,s.prototype.save=function e(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},s.prototype.restore=function e(t){const r=new s(this.base);return r.offset=t.offset,r.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),r},s.prototype.isEmpty=function e(){return this.offset===this.length},s.prototype.readUInt8=function e(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},s.prototype.skip=function e(t,r){if(!(this.offset+t<=this.length))return this.error(r||"DecoderBuffer overrun");const n=new s(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},s.prototype.raw=function e(t){return this.base.slice(t?t.offset:this.offset,this.length)},t.EncoderBuffer=a,a.prototype.join=function e(t,r){return t||(t=new o(this.length)),r||(r=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach(function(e){e.join(t,r),r+=e.length}):("number"==typeof this.value?t[r]=this.value:"string"==typeof this.value?t.write(this.value,r):o.isBuffer(this.value)&&this.value.copy(t,r),r+=this.length),t)}},function(e,t,r){"use strict";const n=t;n._reverse=function e(t){const r={};return Object.keys(t).forEach(function(e){(0|e)==e&&(e|=0);const n=t[e];r[n]=e}),r},n.der=r(1377)},function(e,t,r){"use strict";const n=r(1),i=r(89),o=i.base,s=i.bignum,a=i.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.Node.call(this,"der",e)}function f(e,t){let r=e.readUInt8(t);if(e.isError(r))return r;const n=a.tagClass[r>>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 l(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=l(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{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";(function(t){const n=r(18),i=r(1395);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(e){const n=r(7);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";(function(e){const n=r(350),i=r(351)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(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(1398),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(o).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,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},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(e){const n=r(89).bignum;t.toBase64=function t(r,n){let i=r.toArrayLike(e,"be",n).toString("base64");return i.replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function t(r){return new n(e.from(r,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(624);function i(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}e.exports=i},function(e,t,r){(function(t){var r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",o="[object Null]",s="[object Proxy]",a="[object Undefined]",u="object"==typeof t&&t&&t.Object===Object&&t,c="object"==typeof self&&self&&self.Object===Object&&self,f=u||c||Function("return this")(),l=Object.prototype,h=l.hasOwnProperty,d=l.toString,p=f.Symbol,y=p?p.toStringTag:void 0;function g(e){return null==e?void 0===e?a:o:y&&y in Object(e)?m(e):b(e)}function m(e){var t=h.call(e,y),r=e[y];try{e[y]=void 0;var n=!0}catch(e){}var i=d.call(e);return n&&(t?e[y]=r:delete e[y]),i}function b(e){return d.call(e)}function v(e){if(!_(e))return!1;var t=g(e);return t==n||t==i||t==r||t==s}function _(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}e.exports=v}).call(this,r(10))},function(e,t,r){"use strict";(function(t){const n=r(122),i=r(58),o=r(255),s=o.writeEncoded;function a(e,r,o){const a=n({timeout:6e4},r),u=a.handshake;return o("writing multicodec: "+e),s(u,t.from(e+"\n"),r),i.decodeFromReader(u,(t,n)=>{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(355),i=c(n),o=r(213),s=c(o),a=r(245),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";e.exports=r(1431)},function(e,t,r){"use strict";const n=r(7);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(50),i=r(46),o=r(27);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){"use strict";const n=r(52).Connection,i=r(8);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";(function(e){const n=r(359),i=r(360)(),o=r(1449),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=(t,r,o)=>{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";(function(e){const n=r(359),i=r(360)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(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(1454),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(o).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,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},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";const n=r(1),i=r(188).Reporter,o=r(0).Buffer;function s(e,t){i.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function a(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof a||(e=new a(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}n(s,i),t.DecoderBuffer=s,s.prototype.save=function e(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},s.prototype.restore=function e(t){const r=new s(this.base);return r.offset=t.offset,r.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),r},s.prototype.isEmpty=function e(){return this.offset===this.length},s.prototype.readUInt8=function e(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},s.prototype.skip=function e(t,r){if(!(this.offset+t<=this.length))return this.error(r||"DecoderBuffer overrun");const n=new s(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},s.prototype.raw=function e(t){return this.base.slice(t?t.offset:this.offset,this.length)},t.EncoderBuffer=a,a.prototype.join=function e(t,r){return t||(t=new o(this.length)),r||(r=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach(function(e){e.join(t,r),r+=e.length}):("number"==typeof this.value?t[r]=this.value:"string"==typeof this.value?t.write(this.value,r):o.isBuffer(this.value)&&this.value.copy(t,r),r+=this.length),t)}},function(e,t,r){"use strict";const n=t;n._reverse=function e(t){const r={};return Object.keys(t).forEach(function(e){(0|e)==e&&(e|=0);const n=t[e];r[n]=e}),r},n.der=r(1458)},function(e,t,r){"use strict";const n=r(1),i=r(145),o=i.base,s=i.bignum,a=i.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.Node.call(this,"der",e)}function f(e,t){let r=e.readUInt8(t);if(e.isError(r))return r;const n=a.tagClass[r>>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 l(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=l(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=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(1482),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(3))},function(e,t,r){var n=r(1493),i=r(405);function o(e){return null==e?[]:n(e,i(e))}e.exports=o},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(1494)(t);const{formatters:f}=e.exports;f.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,r(3))},function(e,t,r){"use strict";const n=r(17),i=n(r(1496)),o=n(r(1497));t=e.exports,t.rpc=i,t.td=o},function(e,t,r){"use strict";(function(e){const n=r(362),i=r(363)(),o=r(1500),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=(t,r,o)=>{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";(function(e){const n=r(362),i=r(363)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(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(1505),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(o).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,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},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";const n=r(1),i=r(189).Reporter,o=r(0).Buffer;function s(e,t){i.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function a(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof a||(e=new a(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}n(s,i),t.DecoderBuffer=s,s.prototype.save=function e(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},s.prototype.restore=function e(t){const r=new s(this.base);return r.offset=t.offset,r.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),r},s.prototype.isEmpty=function e(){return this.offset===this.length},s.prototype.readUInt8=function e(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},s.prototype.skip=function e(t,r){if(!(this.offset+t<=this.length))return this.error(r||"DecoderBuffer overrun");const n=new s(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},s.prototype.raw=function e(t){return this.base.slice(t?t.offset:this.offset,this.length)},t.EncoderBuffer=a,a.prototype.join=function e(t,r){return t||(t=new o(this.length)),r||(r=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach(function(e){e.join(t,r),r+=e.length}):("number"==typeof this.value?t[r]=this.value:"string"==typeof this.value?t.write(this.value,r):o.isBuffer(this.value)&&this.value.copy(t,r),r+=this.length),t)}},function(e,t,r){"use strict";const n=t;n._reverse=function e(t){const r={};return Object.keys(t).forEach(function(e){(0|e)==e&&(e|=0);const n=t[e];r[n]=e}),r},n.der=r(1509)},function(e,t,r){"use strict";const n=r(1),i=r(146),o=i.base,s=i.bignum,a=i.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.Node.call(this,"der",e)}function f(e,t){let r=e.readUInt8(t);if(e.isError(r))return r;const n=a.tagClass[r>>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 l(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=l(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=a||o=n&&o=n&&i({"/":e[1].cid.toBaseEncodedString()}))}e.exports=function e(t){return{wantlist:i((e,r)=>{if(r||(r=e,e=void 0),!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();return i=f(i),o(()=>r(null,{Keys:i}))}),stat:i(e=>{if(!t.isOnline())return o(()=>e(new Error(n)));const r=t._bitswap.stat().snapshot;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")))}return o(()=>r(null,t._bitswap.unwant(e)))})}}},function(e,t,r){"use strict";e.exports=r(1586)},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 n=r(6),{DAGNode:i}=r(30),o={format:"dag-pb",hashAlg:"sha2-256"},s=(e,t,r,s,a)=>{s=Object.assign({},o,s),n([e=>i.create(t,r,e),(t,r)=>{e.dag.put(t,{format:s.format,hashAlg:s.hashAlg},e=>r(e,t))}],a)};e.exports=s},function(e,t,r){"use strict";class n extends Error{constructor(e){super(e),this.code=0}}class i extends Error{constructor(e){super(e),this.code=1}}e.exports={NonFatalError:n,FatalError:i}},function(e,t,r){(function(t){var n=r(1604).strict;e.exports=function e(r){if(n(r)){var i=t.from(r.buffer);return r.byteLength!==r.buffer.byteLength&&(i=i.slice(r.byteOffset,r.byteOffset+r.byteLength)),i}return t.from(r)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(44);function i(e,t){e=e.slice();const r=e.filter(e=>"function"==typeof e).pop(),i=Object.assign({},t,e.filter(e=>"object"==typeof e).pop()||{});Array.isArray(e[0])&&(e=e[0]);const o=e.filter(e=>"string"==typeof e).map(e=>(e=e.trim(),{path:e,name:n.basename(e),dir:n.dirname(e)}));return{sources:o,options:i,callback:r}}e.exports=i},function(e,t,r){"use strict";const n=r(9),i=r(5)("ipfs:mfs:utils:with-mfs-root"),o=r(6),{MFS_ROOT_KEY:s}=r(191),a=(e,t)=>{const r=e._repo,a=r&&r.datastore;if(!r||!a)return t(new Error("Please run jsipfs init first"));o([e=>a.open(t=>e(t)),t=>{a.get(s,(u,c)=>{if(u&&u.notFound)return i("Creating new MFS root"),o([t=>e.files.add({path:"/"},t),([{hash:e}],t)=>t(null,new n(e)),(e,t)=>r.closed?a.open(r=>t(r,e)):t(null,e),(e,t)=>a.put(s,e.buffer,r=>t(r,e))],t);t(u,new n(c))})},(e,t)=>{i(`Fetched MFS root ${e.toBaseEncodedString()}`),t(null,e)}],t)};e.exports=a},function(e,t,r){"use strict";const{FILE_SEPARATOR:n}=r(191),i="/ipfs",o=(e,t)=>{if(e=(e||"").trim(),!e)return t(new Error("paths must not be empty"));if(e.substring(0,1)!==n)return t(new Error(`paths must start with a leading ${n}`));e.substring(e.length-n.length)===n&&(e=e.substring(0,e.length-n.length));const r=e.split(n).filter(Boolean),i=r.pop(),o=`${n}${r.join(n)}`;if("/ipfs"===e.substring(0,"/ipfs".length))return t(null,{type:"ifps",path:e.substring("/ipfs".length+1),directory:o,name:i});t(null,{type:"mfs",path:e||n,directory:o,name:i})};e.exports=o},function(e,t,r){"use strict";const n=r(40).unmarshal,{traverseTo:i,formatCid:o}=r(54),s=r(6),a=r(5)("ipfs:mfs:stat"),u={hash:!1,size:!1,withLocal:!1,cidBase:"base58btc"};e.exports=(e=>(function t(r,c,f){"function"==typeof c&&(f=c,c={}),c=Object.assign({},u,c),a(`Fetching stats for ${r}`),s([t=>i(e,r,{withCreateHint:!1},t),({node:e},t)=>{if(c.hash)return t(null,{hash:o(e.multihash,c.cidBase)});if(c.size)return t(null,{size:e.size});const r=n(e.data);let i=e.links.length;"file"===r.type&&(i=r.blockSizes.length),t(null,{hash:o(e.multihash,c.cidBase),size:r.fileSize()||0,cumulativeSize:e.size,blocks:i,type:r.type,local:void 0,sizeLocal:void 0,withLocality:!1})}],f)}))},function(e,t,r){"use strict";const n=r(6),i=r(48),o=r(42),s=r(40),{traverseTo:a,addLink:u,updateTree:c,updateMfsRoot:f,toSourcesAndDestination:l}=r(54),h=r(671),d=r(5)("ipfs:mfs:cp"),p={parents:!1,flush:!0,format:"dag-pb",hashAlg:"sha2-256"};e.exports=(e=>(function t(){const r=Array.from(arguments),{sources:n,destination:i,options:o,callback:u}=l(r,p);return n.length?i?(o.parents=o.p||o.parents,void a(e,i.path,{},(t,r)=>{if(t)return 1===n.length?(d("Only one source, copying to a file"),y(e,n.pop(),i,o,u)):(d("Multiple sources, copying to a directory"),g(e,n,i,o,u));const a=s.unmarshal(r.node.data);if("directory"===a.type)return g(e,n,i,o,u);u(new Error("directory already has entry by that name"))})):u(new Error("Please supply a destination")):u(new Error("Please supply at least one source"))}));const y=(e,t,r,o,s)=>{n([n=>{i([r=>h(e)(t.path,o,r),t=>h(e)(r.path,o,e=>{if(!e)return t(new Error("directory already has entry by that name"));t()}),t=>a(e,r.dir,o,t)],n)},([t,i,o],s)=>{n([n=>u(e,{parent:o.node,child:{size:t.cumulativeSize,hash:t.hash},name:r.name},n),(t,r)=>{o.node=t,c(e,o,r)},(t,r)=>f(e,t.node.multihash,r)],s)}],e=>s(e))},g=(e,t,r,s,l)=>{n([n=>{o([r=>i(t.map(t=>r=>h(e)(t.path,s,r)),r),t=>a(e,r.path,Object.assign({},s,{createLastComponent:!0}),t)],n)},(o,a)=>{const l=o.pop(),d=o[0];n([n=>{i(t.map(t=>n=>{h(e)(`${r.path}/${t.name}`,s,e=>{if(!e)return n(new Error("directory already has entry by that name"));n()})}),e=>n(e))},r=>{n([e=>e(null,l.node)].concat(d.map((r,n)=>(i,o)=>u(e,{parent:i,child:{size:r.cumulativeSize,hash:r.hash},name:t[n].name},o))),r)},(t,r)=>{l.node=t,c(e,l,r)},(t,r)=>f(e,t.node.multihash,r)],a)}],e=>l(e))}},function(e,t,r){"use strict";const n=r(40),i=r(6),o=r(42),{DAGNode:s}=r(30),a=r(9),{traverseTo:u,updateTree:c,updateMfsRoot:f,toSources:l,FILE_SEPARATOR:h}=r(54),d={recursive:!1};e.exports=(e=>(function t(){const r=Array.from(arguments),{sources:n,options:i,callback:s}=l(r,d);if(!n.length)return s(new Error("Please supply at least one path to remove"));o(n.map(t=>r=>p(e,t.path,i,r)),e=>s(e))}));const p=(e,t,r,o)=>{if(t===h)return o(new Error("Cannot delete root"));i([r=>u(e,t,{withCreateHint:!1},r),(o,u)=>{const l=n.unmarshal(o.node.data);if("directory"===l.type&&!r.recursive)return u(new Error(`${t} is a directory, use -r to remove directories`));i([e=>s.rmLink(o.parent.node,o.name,e),(t,r)=>{e.dag.put(t,{cid:new a(t.hash||t.multihash)},e=>r(e,t))},(t,r)=>{o.parent.node=t,c(e,o.parent,r)},(t,r)=>f(e,t.node.multihash,r)],u)}],o)}},function(e,t,r){"use strict";const n=r(6),i=r(70),o=r(79),s=r(91),a=r(190).importer,{loadNode:u}=r(54),c=(e,t,r,c)=>{n([n=>i(o([{content:i(t)}]),a(e.dag,{progress:r.progress,hashAlg:r.hashAlg,cidVersion:r.cidVersion,strategy:r.strategy,rawLeaves:r.rawLeaves,reduceSingleLeafToSelf:r.reduceSingleLeafToSelf,leafType:r.leafType}),s(n)),(t,r)=>u(e,t[0],r)],c)};e.exports=c},function(e,t,r){"use strict";const n=r(193),i=r(147);e.exports=(e=>t=>(t=t||{},t.converter=i,n(e,"add")(t)))},function(e,t,r){"use strict";const n=r(193),i=r(147),o=r(69);e.exports=(e=>t=>(t=t||{},t.converter=i,o(n(e,"add")({qs:t}))))},function(e,t,r){"use strict";const n=r(2),i=r(148),o=r(77),s=r(1639);e.exports=(e=>n((t,r,n)=>{"function"==typeof r&&(n=r,r={});try{t=i(t)}catch(e){if(!o.ipfsPath(t))return n(e)}const a={offset:r.offset,length:r.length};e({path:"cat",args:t,buffer:r.buffer,qs:a},(e,t)=>{if(e)return n(e);t.pipe(s((e,t)=>{if(e)return n(e);n(null,t)}))})}))},function(e,t,r){"use strict";const n=r(148),i=r(77),o=r(12),s=r(53);e.exports=(e=>(t,r)=>{r=r||{};const a=new o.PassThrough;try{t=n(t)}catch(e){if(!i.ipfsPath(t))return a.destroy(e)}const u={offset:r.offset,length:r.length};return e({path:"cat",args:t,buffer:r.buffer,qs:u},(e,t)=>{if(e)return a.destroy(e);s(t,a)}),a})},function(e,t,r){"use strict";const n=r(148),i=r(77),o=r(69),s=r(72);e.exports=(e=>(t,r)=>{r=r||{};const a=s.source();try{t=n(t)}catch(e){if(!i.ipfsPath(t))return a.end(e)}const u={offset:r.offset,length:r.length};return e({path:"cat",args:t,buffer:r.buffer,qs:u},(e,t)=>{if(e)return a.end(e);a.resolve(o(t))}),a})},function(e,t,r){"use strict";const n=r(2),i=r(148),o=r(372),s=r(192),a=r(263),u=r(77);e.exports=(e=>n((t,r,n)=>{"function"!=typeof r||n||(n=r,r={}),"function"==typeof r&&"function"==typeof n&&(n=r,r={});try{t=i(t)}catch(e){if(!u.ipfsPath(t))return n(e)}const c={path:"get",args:t,qs:r};e.andTransform(c,o,(e,t)=>{if(e)return n(e);const r=[];t.pipe(a.obj((e,t,n)=>{e.content?e.content.pipe(s(t=>{r.push({path:e.path,content:t})})):r.push(e),n()},()=>n(null,r)))})}))},function(e,t,r){(function(e){var n=r(682),i=r(123),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))},l=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},d=function(e,t,r,n){for(;rt?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 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 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 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(y(t.mode&c,6),100),r.write(y(t.uid,6),108),r.write(y(t.gid,6),116),r.write(y(t.size,11),124),r.write(y(t.mtime.getTime()/1e3|0,11),136),r[156]=a+h(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(y(t.devmajor||0,6),329),r.write(y(t.devminor||0,6),337),o&&r.write(o,345),r.write(y(p(r),6),148),r)},t.decode=function(e,t){var r=0===e[156]?0:e[156]-a,n=b(e,0,100,t),i=m(e,100,8),o=m(e,108,8),s=m(e,116,8),u=m(e,124,12),c=m(e,136,12),f=l(r),h=0===e[157]?null:b(e,157,100,t),d=b(e,265,32),y=b(e,297,32),g=m(e,329,8),v=m(e,337,8);e[345]&&(n=b(e,345,155,t)+"/"+n),0===r&&n&&"/"===n[n.length-1]&&(r=5);var _=p(e);if(256===_)return null;if(_!==m(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:h,uname:d,gname:y,devmajor:g,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";const n=r(148),i=r(372),o=r(77),s=r(12),a=r(53);e.exports=(e=>(t,r)=>{r=r||{};const u=new s.PassThrough({objectMode:!0});try{t=n(t)}catch(e){if(!o.ipfsPath(t))return u.destroy(e)}const c={path:"get",args:t,qs:r};return e.andTransform(c,i,(e,t)=>{if(e)return u.destroy(e);a(t,u)}),u})},function(e,t,r){"use strict";const n=r(148),i=r(372),o=r(77),s=r(263),a=r(8),u=r(69),c=r(72);e.exports=(e=>(t,r)=>{r=r||{};const f=c.source();try{t=n(t)}catch(e){if(!o.ipfsPath(t))return f.end(e)}const l={path:"get",args:t,qs:r};return e.andTransform(l,i,(e,t)=>{if(e)return f.end(e);const r=[];t.pipe(s.obj((e,t,n)=>{e.content?r.push({path:e.path,content:u(e.content)}):r.push(e),n()},()=>f.resolve(a.values(r))))}),f})},function(e,t,r){"use strict";const n=r(1649);t=e.exports=(()=>({"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(1650),o=r(373).encode,s=r(194),a=r(688),u=r(53),c=r(26),f=r(78),l=r(1655),h=r(689),d=r(5)("ipfs-api:request");function p(e,t){const r=new Error(`Server responded with ${e.statusCode}`);l(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 y(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?l(r,t):f(r,t)}}function g(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)}}),l={hostname:e.host,path:`${e["api-path"]}${t.path}?${f}`,port:e.port,method:"POST",headers:u,protocol:`${e.protocol}:`},d=h(e.protocol)(l,y(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")):g(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){var n=r(263),i=r(1653),o=r(161).EOL,s=r(1654);function a(e){function t(t){try{if(t)return JSON.parse(t)}catch(r){e.strict&&this.emit("error",new Error("Could not parse row "+t.slice(0,50)+"..."))}}return e=e||{},e.strict=!1!==e.strict,i(t,e)}function u(e){return n.obj(e,function(e,t,r){r(null,s(e)+o)})}e.exports=a,e.exports.serialize=e.exports.stringify=u,e.exports.parse=a},function(e,t,r){"use strict";const n=r(264),i=r(374);e.exports=(e=>0===e.indexOf("https")?i.request:n.request)},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(10))},function(e,t,r){(function(e,n,i){var o=r(690),s=r(1),a=r(12),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 l=r.body.getReader();function h(){l.read().then(function(e){if(!c._destroyed){if(e.done)return i.clearTimeout(u),void c.push(null);c.push(new n(e.value)),h()}}).catch(function(e){i.clearTimeout(u),c._destroyed||c.emit("error",e)})}h()}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 y=p.match(/;\s*charset=([^;])(;|$)/);y&&(c._charset=y[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(3),r(0).Buffer,r(10))},function(e,t,r){var n=r(0).Buffer;e.exports=function(e){if(e instanceof Uint8Array){if(0===e.byteOffset&&e.byteLength===e.buffer.byteLength)return e.buffer;if("function"==typeof e.buffer.slice)return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(n.isBuffer(e)){for(var t=new Uint8Array(e.length),r=e.length,i=0;i{const t=n(e);return{get:r(1664)(t),stat:r(1665)(t),put:r(1666)(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){(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]",l="[object Function]",h="[object GeneratorFunction]",d="[object Map]",p="[object Number]",y="[object Object]",g="[object Promise]",m="[object RegExp]",b="[object Set]",v="[object String]",_="[object Symbol]",w="[object WeakMap]",S="[object ArrayBuffer]",E="[object DataView]",k="[object Float32Array]",A="[object Float64Array]",x="[object Int8Array]",C="[object Int16Array]",T="[object Int32Array]",I="[object Uint8Array]",B="[object Uint8ClampedArray]",O="[object Uint16Array]",P="[object Uint32Array]",R=/[\\^$.*+?()[\]{}|]/g,N=/\w*$/,j=/^\[object .+?Constructor\]$/,L=/^(?:0|[1-9]\d*)$/,M={};M[s]=M[a]=M[S]=M[E]=M[u]=M[c]=M[k]=M[A]=M[x]=M[C]=M[T]=M[d]=M[p]=M[y]=M[m]=M[b]=M[v]=M[_]=M[I]=M[B]=M[O]=M[P]=!0,M[f]=M[l]=M[w]=!1;var D="object"==typeof e&&e&&e.Object===Object&&e,U="object"==typeof self&&self&&self.Object===Object&&self,F=D||U||Function("return this")(),K=t&&!t.nodeType&&t,q=K&&"object"==typeof r&&r&&!r.nodeType&&r,H=q&&q.exports===K;function z(e,t){return e.set(t[0],t[1]),e}function V(e,t){return e.add(t),e}function G(e,t){for(var r=-1,n=e?e.length:0;++r-1}function Ve(e,t){var r=this.__data__,n=st(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function Ge(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 Wt(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function $t(e){return!!e&&"object"==typeof e}function Yt(e){return qt(e)?it(e):dt(e)}function Jt(){return[]}function Zt(){return!1}r.exports=Dt}).call(this,r(10),r(32)(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){(function(t){var n=r(1),i=r(12).Transform,o=r(1814);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){e.exports=o;var n=r(1),i=r(12);function o(e,t){var r=this;if(!(r instanceof o))return new o(e,t);i.Readable.call(r,t),r.destroyed=!1,r._drained=!1,r._forwarding=!1,r._current=null,r._toStreams2=t&&t.objectMode?s:a,"function"==typeof e?r._queue=e:(r._queue=e.map(r._toStreams2),r._queue.forEach(function(e){"function"!=typeof e&&r._attachErrorListener(e)})),r._next()}function s(e){return u(e,{objectMode:!0,highWaterMark:16})}function a(e){return u(e)}function u(e,t){if(!e||"function"==typeof e||e._readableState)return e;var r=new i.Readable(t).wrap(e);return e.destroy&&(r.destroy=e.destroy.bind(e)),r}n(o,i.Readable),o.obj=function(e){return new o(e,{objectMode:!0,highWaterMark:16})},o.prototype._read=function(){this._drained=!0,this._forward()},o.prototype._forward=function(){if(!this._forwarding&&this._drained&&this._current){var e;for(this._forwarding=!0;null!==(e=this._current.read());)this._drained=this.push(e);this._forwarding=!1}},o.prototype.destroy=function(e){this.destroyed||(this.destroyed=!0,this._current&&this._current.destroy&&this._current.destroy(),"function"!=typeof this._queue&&this._queue.forEach(function(e){e.destroy&&e.destroy()}),e&&this.emit("error",e),this.emit("close"))},o.prototype._next=function(){var e=this;if(e._current=null,"function"==typeof e._queue)e._queue(function(t,r){if(t)return e.destroy(t);r=e._toStreams2(r),e._attachErrorListener(r),e._gotNextStream(r)});else{var t=e._queue.shift();"function"==typeof t&&(t=e._toStreams2(t()),e._attachErrorListener(t)),e._gotNextStream(t)}},o.prototype._gotNextStream=function(e){var t=this;if(!e)return t.push(null),void t.destroy();function r(){t._forward()}function n(){e._readableState.ended||t.destroy()}function i(){t._current=null,e.removeListener("readable",r),e.removeListener("end",i),e.removeListener("close",n),t._next()}t._current=e,t._forward(),e.on("readable",r),e.once("end",i),e.once("close",n)},o.prototype._attachErrorListener=function(e){var t=this;function r(n){e.removeListener("error",r),t.destroy(n)}e&&e.once("error",r)}},function(e,t,r){"use strict";(function(t,n){var i;e.exports=B,B.ReadableState=I;var o=r(11).EventEmitter,s=function e(t,r){return t.listeners(r).length},a=r(701),u=r(0).Buffer,c=t.Uint8Array||function(){};function f(e){return u.from(e)}function l(e){return u.isBuffer(e)||e instanceof c}var h=r(1823),d;d=h&&h.debuglog?h.debuglog("stream"):function e(){};var p=r(1824),y=r(702),g=r(703),m=g.getHighWaterMark,b=r(198).codes,v=b.ERR_INVALID_ARG_TYPE,_=b.ERR_STREAM_PUSH_AFTER_EOF,w=b.ERR_METHOD_NOT_IMPLEMENTED,S=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,E=r(1826),k=E.emitExperimentalWarning,A,x;r(1)(B,a);var C=["error","close","destroy","pause","resume"];function T(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 I(e,t,n){i=i||r(151),e=e||{},"boolean"!=typeof n&&(n=t instanceof i),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(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&&(A||(A=r(55).StringDecoder),this.decoder=new A(e.encoding),this.encoding=e.encoding)}function B(e){if(i=i||r(151),!(this instanceof B))return new B(e);var t=this instanceof i;this._readableState=new I(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,r,n,i){d("readableAddChunk",t);var o=e._readableState,s;if(null===t)o.reading=!1,M(e,o);else if(i||(s=R(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):P(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?P(e,o,t,!1):F(e,o)):P(e,o,t,!1)}else n||(o.reading=!1,F(e,o));return!o.ended&&(o.length=N?e=N:(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=j(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function M(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,U(e)))}}function D(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(U,e))}function U(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,W(e)}function F(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(K,e,t))}function K(e,t){for(var r=t.length;!t.reading&&!t.ended&&t.length0,e.listenerCount("data")>0&&e.resume()}function z(e){d("readable nexttick read 0"),e.read(0)}function V(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(G,e,t))}function G(e,t){d("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),W(e),t.flowing&&!t.reading&&e.read(0)}function W(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 Z(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},B.prototype._read=function(e){this.emit("error",new w("_read()"))},B.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:b;function u(e,t){d("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,h())}function c(){d("onend"),e.end()}i.endEmitted?n.nextTick(a):r.once("end",a),e.on("unpipe",u);var f=q(r);e.on("drain",f);var l=!1;function h(){d("cleanup"),e.removeListener("close",g),e.removeListener("finish",m),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",u),r.removeListener("end",c),r.removeListener("end",b),r.removeListener("data",p),l=!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!==Z(i.pipes,e))&&!l&&(d("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function y(t){d("onerror",t),b(),e.removeListener("error",y),0===s(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",m),b()}function m(){d("onfinish"),e.removeListener("close",g),b()}function b(){d("unpipe"),r.unpipe(e)}return r.on("data",p),T(e,"error",y),e.once("close",g),e.once("finish",m),e.emit("pipe",r),i.flowing||(d("pipe resume"),r.resume()),e},B.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(z,this))),r},B.prototype.addListener=B.prototype.on,B.prototype.removeListener=function(e,t){var r=a.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(H,this),r},B.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(H,this),t},B.prototype.resume=function(){var e=this._readableState;return e.flowing||(d("resume"),e.flowing=!e.readableListening,V(this,e)),this},B.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},B.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(T.prototype,"writableBuffer",{enumerable:!1,get:function e(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function e(){return this._writableState.highWaterMark}}),T.prototype._write=function(e,t,r){r(new b("_write()"))},T.prototype._writev=null,T.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||z(this,n,r),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function e(){return this._writableState.length}}),Object.defineProperty(T.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)}}),T.prototype.destroy=d.destroy,T.prototype._undestroy=d.undestroy,T.prototype._destroy=function(e,t){t(e)}}).call(this,r(10),r(3))},function(e,t,r){"use strict";e.exports=f;var n=r(198).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(151);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.length{t(null,r)}):g(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()),l(r.announce),l(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(m,0)}}),r.length=n.reduce(m,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=b(e.info.pieces),r}function y(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 g(e){return"undefined"!=typeof Blob&&e instanceof Blob}function m(e,t){return e+t.length}function b(e){const t=[];for(let r=0;rnull!==e&&"object"==typeof e&&"function"==typeof e.pipe;function l(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 h;e.headers&&Object.keys(e.headers).forEach(t=>n[t.toLowerCase()]=e.headers[t]),e.headers=n,e.body?h=e.json&&!f(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"),f(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 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")):l(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(h)?h.on("error",r).pipe(p):p.end(h),p}l.concat=((e,t)=>l(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=>{l[e]=((t,r)=>("string"==typeof t&&(t={url:t}),l(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(1868),o=r(692),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){l(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 l(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){"use strict";(function(t,n){var i;e.exports=B,B.ReadableState=I;var o=r(11).EventEmitter,s=function e(t,r){return t.listeners(r).length},a=r(712),u=r(0).Buffer,c=t.Uint8Array||function(){};function f(e){return u.from(e)}function l(e){return u.isBuffer(e)||e instanceof c}var h=r(1869),d;d=h&&h.debuglog?h.debuglog("stream"):function e(){};var p=r(1870),y=r(713),g=r(714),m=g.getHighWaterMark,b=r(199).codes,v=b.ERR_INVALID_ARG_TYPE,_=b.ERR_STREAM_PUSH_AFTER_EOF,w=b.ERR_METHOD_NOT_IMPLEMENTED,S=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,E=r(1872),k=E.emitExperimentalWarning,A,x;r(1)(B,a);var C=["error","close","destroy","pause","resume"];function T(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 I(e,t,n){i=i||r(152),e=e||{},"boolean"!=typeof n&&(n=t instanceof i),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(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&&(A||(A=r(55).StringDecoder),this.decoder=new A(e.encoding),this.encoding=e.encoding)}function B(e){if(i=i||r(152),!(this instanceof B))return new B(e);var t=this instanceof i;this._readableState=new I(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,r,n,i){d("readableAddChunk",t);var o=e._readableState,s;if(null===t)o.reading=!1,M(e,o);else if(i||(s=R(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):P(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?P(e,o,t,!1):F(e,o)):P(e,o,t,!1)}else n||(o.reading=!1,F(e,o));return!o.ended&&(o.length=N?e=N:(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=j(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function M(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,U(e)))}}function D(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(U,e))}function U(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,W(e)}function F(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(K,e,t))}function K(e,t){for(var r=t.length;!t.reading&&!t.ended&&t.length0,e.listenerCount("data")>0&&e.resume()}function z(e){d("readable nexttick read 0"),e.read(0)}function V(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(G,e,t))}function G(e,t){d("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),W(e),t.flowing&&!t.reading&&e.read(0)}function W(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 Z(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},B.prototype._read=function(e){this.emit("error",new w("_read()"))},B.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:b;function u(e,t){d("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,h())}function c(){d("onend"),e.end()}i.endEmitted?n.nextTick(a):r.once("end",a),e.on("unpipe",u);var f=q(r);e.on("drain",f);var l=!1;function h(){d("cleanup"),e.removeListener("close",g),e.removeListener("finish",m),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",u),r.removeListener("end",c),r.removeListener("end",b),r.removeListener("data",p),l=!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!==Z(i.pipes,e))&&!l&&(d("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function y(t){d("onerror",t),b(),e.removeListener("error",y),0===s(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",m),b()}function m(){d("onfinish"),e.removeListener("close",g),b()}function b(){d("unpipe"),r.unpipe(e)}return r.on("data",p),T(e,"error",y),e.once("close",g),e.once("finish",m),e.emit("pipe",r),i.flowing||(d("pipe resume"),r.resume()),e},B.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(z,this))),r},B.prototype.addListener=B.prototype.on,B.prototype.removeListener=function(e,t){var r=a.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(H,this),r},B.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(H,this),t},B.prototype.resume=function(){var e=this._readableState;return e.flowing||(d("resume"),e.flowing=!e.readableListening,V(this,e)),this},B.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},B.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(T.prototype,"writableBuffer",{enumerable:!1,get:function e(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function e(){return this._writableState.highWaterMark}}),T.prototype._write=function(e,t,r){r(new b("_write()"))},T.prototype._writev=null,T.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||z(this,n,r),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function e(){return this._writableState.length}}),Object.defineProperty(T.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)}}),T.prototype.destroy=d.destroy,T.prototype._undestroy=d.undestroy,T.prototype._destroy=function(e,t){t(e)}}).call(this,r(10),r(3))},function(e,t,r){"use strict";e.exports=f;var n=r(199).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(152);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.length0)if("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=f(t)),n)o.endEmitted?e.emit("error",new S):P(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?P(e,o,t,!1):F(e,o)):P(e,o,t,!1)}else n||(o.reading=!1,F(e,o));return!o.ended&&(o.length=N?e=N:(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=j(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function M(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,U(e)))}}function D(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(U,e))}function U(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,W(e)}function F(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(K,e,t))}function K(e,t){for(var r=t.length;!t.reading&&!t.ended&&t.length0,e.listenerCount("data")>0&&e.resume()}function z(e){d("readable nexttick read 0"),e.read(0)}function V(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(G,e,t))}function G(e,t){d("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),W(e),t.flowing&&!t.reading&&e.read(0)}function W(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 Z(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},B.prototype._read=function(e){this.emit("error",new w("_read()"))},B.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:b;function u(e,t){d("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,h())}function c(){d("onend"),e.end()}i.endEmitted?n.nextTick(a):r.once("end",a),e.on("unpipe",u);var f=q(r);e.on("drain",f);var l=!1;function h(){d("cleanup"),e.removeListener("close",g),e.removeListener("finish",m),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",u),r.removeListener("end",c),r.removeListener("end",b),r.removeListener("data",p),l=!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!==Z(i.pipes,e))&&!l&&(d("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function y(t){d("onerror",t),b(),e.removeListener("error",y),0===s(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",m),b()}function m(){d("onfinish"),e.removeListener("close",g),b()}function b(){d("unpipe"),r.unpipe(e)}return r.on("data",p),T(e,"error",y),e.once("close",g),e.once("finish",m),e.emit("pipe",r),i.flowing||(d("pipe resume"),r.resume()),e},B.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(z,this))),r},B.prototype.addListener=B.prototype.on,B.prototype.removeListener=function(e,t){var r=a.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(H,this),r},B.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(H,this),t},B.prototype.resume=function(){var e=this._readableState;return e.flowing||(d("resume"),e.flowing=!e.readableListening,V(this,e)),this},B.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},B.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(T.prototype,"writableBuffer",{enumerable:!1,get:function e(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function e(){return this._writableState.highWaterMark}}),T.prototype._write=function(e,t,r){r(new b("_write()"))},T.prototype._writev=null,T.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||z(this,n,r),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function e(){return this._writableState.length}}),Object.defineProperty(T.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)}}),T.prototype.destroy=d.destroy,T.prototype._undestroy=d.undestroy,T.prototype._destroy=function(e,t){t(e)}}).call(this,r(10),r(3))},function(e,t,r){"use strict";e.exports=f;var n=r(200).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(153);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.length=e.length||t<0)){var r=e.pop();if(t=this._parserSize;){var n=1===this._buffer.length?this._buffer[0]:s.concat(this._buffer);this._bufferSize-=this._parserSize,this._buffer=this._bufferSize?[n.slice(this._parserSize)]:[],this._parser(n.slice(0,this._parserSize))}r(null)},k.prototype._callback=function(e,t,r){e&&(this._clearTimeout(),this.peerChoking||this._finished||this._updateTimeout(),e.callback(t,r))},k.prototype._clearTimeout=function(){this._timeout&&(clearTimeout(this._timeout),this._timeout=null)},k.prototype._updateTimeout=function(){var e=this;e._timeoutMs&&e.requests.length&&!e._timeout&&(e._timeout=setTimeout(function(){e._onTimeout()},e._timeoutMs),e._timeoutUnref&&e._timeout.unref&&e._timeout.unref())},k.prototype._parse=function(e,t){this._parserSize=e,this._parser=t},k.prototype._onMessageLength=function(e){var t=e.readUInt32BE(0);t>0?this._parse(t,this._onMessage):(this._onKeepAlive(),this._parse(4,this._onMessageLength))},k.prototype._onMessage=function(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)}},k.prototype._parseHandshake=function(){var e=this;e._parse(1,function(t){var r=t.readUInt8(0);e._parse(r+48,function(t){var n=t.slice(0,r);if("BitTorrent protocol"!==n.toString())return e._debug("Error: wire not speaking BitTorrent protocol (%s)",n.toString()),void e.end();t=t.slice(r),e._onHandshake(t.slice(8,28),t.slice(28,48),{dht:!!(1&t[7]),extended:!!(16&t[5])}),e._parse(4,e._onMessageLength)})})},k.prototype._onFinish=function(){for(this._finished=!0,this.push(null);this.read(););for(clearInterval(this._keepAliveInterval),this._parse(Number.MAX_VALUE,function(){});this.peerRequests.length;)this.peerRequests.pop();for(;this.requests.length;)this._callback(this.requests.pop(),new Error("wire was closed"),null)},k.prototype._debug=function(){var e=[].slice.call(arguments);e[0]="["+this._debugId+"] "+e[0],a.apply(null,e)}},function(e,t,r){(function(e,t){!function(){var n;"undefined"!=typeof window&&(n=window),void 0!==e&&(n=e),n=n||{};var i=n.console||{log:function(){}};function o(e,t){return t?r(1900)(e):e.slice?o[n(e)]:function(t,r){e(t={exports:{}}),o[n(r)]=t.exports};function n(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!n(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 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,l=0,h,d,p,y,g=r(u);if(e.r=null,i&&o(a)&&(p=i(a),y=!0),n(a)||p)for(h=(p||a).length;l",n.drift=0,n.is=function(e,t,r){var i=t&&e&&e[w]&&e[w][n._]||r;if(i)return b(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=h(e[w],n._);return S!==t&&t!==w&&(b(i)&&(a[t]=i),S!==o&&(e[t]=o)),e},n.to=function(e,t,i){var o=(e||{})[t];return p(o)&&(o=g(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=b(r)?r:n(),s[w]=s[w]||{},y(s,e,{o:s,s:r}),s):(i=i||p(r)?r:o,r=b(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 l=t.obj,h=l.as,d=l.has,p=l.is,y=l.map,g=l.copy,m=t.num,b=m.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)||l(t))&&!d(t,e,{cb:r,fn:n,as:i})}}(),function(){function e(e,t){var i;return(i=l(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,l,h;if(n._===i&&f(t,r.rel._))return o._;if(l=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))),(h=u.map)&&(h.call(u.as||{},t,i,o,s),f(o,i))){if(t=o[i],y===t)return void c(o,i);if(!(l=a(t,i,o,s,u)))return}if(!i)return s.node;if(!0===l)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=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 l(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 h({},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(l(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,l=a.empty,h=a.put,d=a.map,p=a.copy,y;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],l=t.HAM(o.machine,s,c,e,f);l.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):l.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[m],s=n.graph[o],a=i[b],u,c=n.next||(n.next={}),f=c[o];if(h(o,"*")){var l={};t.obj.map(n.graph,function(e,r){t.text.match(r,o)&&(l[r]=t.obj.copy(e))}),t.obj.empty(l)||n.on("in",{"@":e["#"],how:"*",put:l,$:r})}if(!s)return n.on("get",e);if(a){if(!h(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 l(e)||(e={}),l(i.opt)||(i.opt=e),u(o)&&(o=[o]),n(o)&&(o=p(o,function(e,t,r){r(e,{url:e})}),l(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 g()+c(12)},r};var n=t.list.is,a=t.text,u=a.is,c=a.random,f=t.obj,l=f.is,h=f.has,d=f.to,p=f.map,y=f.copy,g=t.state.lex,m=t.val.rel._,b=".",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 l();s||(s=setTimeout(l,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.I})}}Gun.debug?setTimeout(u,1):u()});var f=function(e,t,r,n){a[n]=Gun.state.to(r,t,a[n])},l=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:l})}(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.mesh)return o.say(t,r.mesh.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.mesh=function(){}).via=n,(f=c["><"])&&(c.mesh.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 l=0,h;h=c[l++];)o.hear(h,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,l=u.wire||a.wire&&a.wire(u),h,d;if(l&&(h=s.mesh||n,u!==h.via&&((d=h.raw)||(d=o.raw(s)),!((f=s["@"])&&(f=e.dup.s[f])&&(f=f.it)&&f.get&&f["##"]&&f["##"]===s["##"])&&(!(f=h.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.mesh||{},l,h,d;if(d=f.raw)return d;if("string"==typeof r)return r;r["@"]&&(d=r.put)&&((h=r["##"])||(l=u(d,n)||"",h=o.hash(r,l),r["##"]=h),(d=i.s)[h=r["@"]+h]=d[r["#"]],r["#"]=h||r["#"],l&&((r=t.obj.to(r)).put=c));var p=0,y=[];t.obj.map(a.peers,function(e){if(y.push(e.url||e.id),++p>9)return!0}),r["><"]=y.join();var g=u(r);return s!==l&&(d=g.indexOf(c,g.indexOf("put")),g=g.slice(0,d-1)+l+g.slice(d+c.length+1)),f&&(f.raw=g),g},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=l-h,k=Math.floor,A=String.fromCharCode,x;function C(e){throw new RangeError(S[e])}function T(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function I(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=T(i,t).join(".");return n+o}function B(e){for(var t=[],r=0,n=e.length,i,o;r=55296&&i<=56319&&r65535&&(e-=65536,t+=A(e>>>10&1023|55296),e=56320|1023&e),t+=A(e),t}).join("")}function P(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:l}function R(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function N(e,t,r){var n=0;for(e=r?k(e/y):e>>1,e+=k(e/t);e>E*d>>1;n+=l)e=k(e/E);return k(n+(E+1)*e/(e+p))}function j(e){var t=[],r=e.length,n,i=0,o=m,s=g,a,u,c,p,y,v,_,w,S;for(a=e.lastIndexOf(b),a<0&&(a=0),u=0;u=128&&C("not-basic"),t.push(e.charCodeAt(u));for(c=a>0?a+1:0;c=r&&C("invalid-input"),_=P(e.charCodeAt(c++)),(_>=l||_>k((f-i)/y))&&C("overflow"),i+=_*y,w=v<=s?h:v>=s+d?d:v-s,!(_k(f/S)&&C("overflow"),y*=S;n=t.length+1,s=N(i-p,n,0==p),k(i/n)>f-o&&C("overflow"),o+=k(i/n),i%=n,t.splice(i++,0,o)}return O(t)}function L(e){var t,r,n,i,o,s,a,u,c,p,y,v=[],_,w,S,E;for(e=B(e),_=e.length,t=m,r=0,o=g,s=0;s<_;++s)y=e[s],y<128&&v.push(A(y));for(n=i=v.length,i&&v.push(b);n<_;){for(a=f,s=0;s<_;++s)y=e[s],y>=t&&yk((f-r)/w)&&C("overflow"),r+=(a-t)*w,t=a,s=0;s<_;++s)if(y=e[s],yf&&C("overflow"),y==t){for(u=r,c=l;p=c<=o?h:c>=o+d?d:c-o,!(u0&&c>u&&(c=u);for(var f=0;f=0?(d=l.substr(0,h),p=l.substr(h+1)):(d=l,p=""),y=decodeURIComponent(d),g=decodeURIComponent(p),n(s,y)?i(s[y])?s[y].push(g):s[y]=[s[y],g]:s[y]=g}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;ns.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),"application/json",n)}else{let r=c(Object.keys(t).map(e=>({key:e,value:t[e]})));await o.p_POST(this._url(e,servercommands.set),"application/json",r)}}_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,r){"use strict";t.byteLength=f,t.toByteArray=h,t.fromByteArray=y;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 l(e,t,r){return 3*(t+r)/4-r}function h(e){for(var t,r=c(e),n=r[0],s=r[1],a=new o(l(e,n,s)),u=0,f=s>0?n-4:n,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 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){"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(739);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(386),i=r(155);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){},function(e,t,r){(function(n,i){const o=r(387),s=r(5)("dweb-transports:ipfs"),a=r(743),u=r(1631),c=r(9),f=r(40),l=r(36),h=r(12),d=r(90),p=r(154),y=r(124),g=r(201),m={repo:"/tmp/dweb_ipfsv3107",config:{Bootstrap:["/dns4/dweb.me/tcp/4245/wss/ipfs/QmQ921MRjsbP12fHSEDcdFeuHFg6qKDFurm2rXgA5K3RQD"]},EXPERIMENTAL:{pubsub:!0},preload:{enabled:!1}};class b 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),r(n)):(s("IPFS available via %s: %o",t,i),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(m,e.ipfs);s("setup options=%o",t);const r=new b(t);return y.addtransport(r),r}async p_setup1(e){try{this.status=p.STATUS_STARTING,e&&e(this),this.ipfs=await new Promise((e,t)=>{this.IPFSAutoConnect((r,n)=>{r?t(r):e(n)})}),this.status=p.STATUS_CONNECTED}catch(e){console.error(this.name,"failed to connect",e),this.status=p.STATUS_FAILED}return e&&e(this),this}p_stop(e){return new Promise((t,r)=>this.ipfs.stop((n,i)=>{this.status=p.STATUS_FAILED,e&&e(this),n?r(n):t(i)}))}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=l.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=b.cidFrom(e),i=b.ipfsFrom(e);try{const r=await g.p_timeout(this.ipfs.dag.get(n),t,"Timed out IPFS fetch of "+b._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.files.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=b.ipfsGatewayFrom(e);return await g.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.files.add(t,{"cid-version":1,hashAlg:"sha2-256"}))[0];return b.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.files.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=b.cidFrom(a);console.assert(a===o,"url should match url from rawstore");const c=a.split("/")[2],f=b.urlFrom(u);console.assert(a===f,"Should round trip"),n=a;const l=await t.p_rawfetch(n);return console.assert(l.toString()===i,"Should fetch block stored above"),t}catch(e){throw console.log("Exception thrown in TransportIPFS.test:",e.message),e}}}y._transportclasses.IPFS=b,t=e.exports=b}).call(this,r(10),r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(388),o=r(744),s=r(50),a=r(46),u=r(163),c=r(30),f=r(85),l=r(77),h=r(27),d=r(18),p=r(544),y=r(1124),g=r(9),m=r(5),b=r(329),v=r(11),_=r(1130),w=r(1138),S=r(1156),E=r(1622),k=r(1623),A=r(1627);class x extends v{constructor(e){super(),this._options={init:!0,start:!0,EXPERIMENTAL:{},preload:{enabled:!0,addresses:["/dnsaddr/node0.preload.ipfs.io/https","/dnsaddr/node1.preload.ipfs.io/https"]}},e=_.validate(e||{}),b(this._options,e),!1===e.init&&(this._options.init=!1),!1!==e.start&&(this._options.start=!0),"string"==typeof e.repo||void 0===e.repo?this._repo=E(e.repo):this._repo=e.repo,this.log=m("jsipfs"),this.log.err=m("jsipfs:err"),this.types={Buffer:n,PeerId:s,PeerInfo:a,multiaddr:h,multibase:y,multihash:d,CID:g,dagPB:c,dagCBOR:u},this._peerInfoBook=new p,this._peerInfo=void 0,this._libp2pNode=void 0,this._bitswap=void 0,this._blockService=new i(this._repo),this._ipld=new o(this._blockService),this._pubsub=void 0,this._preload=k(this),this._mfsPreload=A(this),this.init=S.init(this),this.preStart=S.preStart(this),this.start=S.start(this),this.stop=S.stop(this),this.shutdown=this.stop,this.isOnline=S.isOnline(this),this.version=S.version(this),this.id=S.id(this),this.repo=S.repo(this),this.bootstrap=S.bootstrap(this),this.config=S.config(this),this.block=S.block(this),this.object=S.object(this),this.dag=S.dag(this),this.libp2p=S.libp2p(this),this.swarm=S.swarm(this),this.files=S.files(this),this.bitswap=S.bitswap(this),this.pin=S.pin(this),this.ping=S.ping(this),this.pingPullStream=S.pingPullStream(this),this.pingReadableStream=S.pingReadableStream(this),this.pubsub=S.pubsub(this),this.dht=S.dht(this),this.dns=S.dns(this),this.key=S.key(this),this.stats=S.stats(this),this._options.EXPERIMENTAL.pubsub&&this.log("EXPERIMENTAL 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(1628)(this),this.ls=this.files.lsImmutable,this.lsReadableStream=this.files.lsReadableStreamImmutable,this.lsPullStream=this.files.lsPullStreamImmutable,this.util={crypto:f,isIPFS:l};const t=S.mfs(this);Object.keys(t).forEach(e=>{this.files[e]=t[e]}),w(this)}}t=e.exports=x,t.createNode=(e=>new x(e))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(104),i=r(8),o=r(9),s=r(771),a=r(772),u=r(388),c=r(44).join,f=r(44).sep,l=r(72).source,h=r(286),d=r(82),p=r(42),y=r(6),g=r(38).MemoryDatastore;function m(){}class b{constructor(e){if(!e)throw new Error("Missing blockservice");this.bs=e,this.resolvers={get"dag-pb"(){const e=r(30);return{resolver:e.resolver,util:e.util}},get"dag-cbor"(){const e=r(163);return{resolver:e.resolver,util:e.util}},get"git-raw"(){const e=r(863);return{resolver:e.resolver,util:e.util}},get"bitcoin-block"(){const e=r(868);return{resolver:e.resolver,util:e.util}},get"eth-account-snapshot"(){const e=r(115).ethAccountSnapshot;return{resolver:e.resolver,util:e.util}},get"eth-block"(){const e=r(115).ethBlock;return{resolver:e.resolver,util:e.util}},get"eth-block-list"(){const e=r(115).ethBlockList;return{resolver:e.resolver,util:e.util}},get"eth-state-trie"(){const e=r(115).ethStateTrie;return{resolver:e.resolver,util:e.util}},get"eth-storage-trie"(){const e=r(115).ethStorageTrie;return{resolver:e.resolver,util:e.util}},get"eth-tx"(){const e=r(115).ethTx;return{resolver:e.resolver,util:e.util}},get"eth-tx-trie"(){const e=r(115).ethTxTrie;return{resolver:e.resolver,util:e.util}},get raw(){const e=r(974);return{resolver:e.resolver,util:e.util}},get"zcash-block"(){const e=r(975);return{resolver:e.resolver,util:e.util}}},this.support={},this.support.add=((e,t,r)=>{if(this.resolvers[e])throw new Error('Resolver already exists for codec "'+e+'"');this.resolvers[e]={resolver:t,util:r}}),this.support.rm=(e=>{this.resolvers[e]&&delete this.resolvers[e]})}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,(e,t)=>{if(e)return n(e);n(null,{value:t,remainderPath:""})});let i;s(r=>{this.bs.get(e,(n,o)=>{if(n)return r(n);const s=this.resolvers[e.codec];if(!s)return r(new Error('No resolver found for codec "'+e.codec+'"'));s.resolver.resolve(o.data,t,(e,n)=>{if(e)return r(e);i=n.value,t=n.remainderPath,r()})})},()=>{const n=!t||""===t||"/"===t,s=i&&!i["/"];return!!(n&&s||r.localResolve)||(i&&i["/"]&&(e=new o(i["/"])),!1)},(e,r)=>e?n(e):n(null,{value:i,remainderPath:t}))}getStream(e,t,r){const n=l();return this.get(e,t,r,(e,t)=>{if(e)return n.resolve(i.error(e));n.resolve(i.values([t]))}),n}put(e,t,r){if("function"==typeof t)return r=t,setImmediate(()=>r(new Error("IPLDResolver.put requires options")));if(r=r||m,t.cid&&o.isCID(t.cid))return this._put(t.cid,e,r);const n=this.resolvers[t.format];if(!n)return r(new Error('No resolver found for codec "'+t.format+'"'));n.util.cid(e,t,(t,n)=>{if(t)return r(t);this._put(n,e,r)})}treeStream(e,t,r){let n;if("object"==typeof t&&(r=t,t=void 0),r=r||{},!r.recursive){n=l();const t=this.resolvers[e.codec];if(!t)return n.abort(new Error('No resolver found for codec "'+e.codec+'"')),n;y([t=>this.bs.get(e,t),(e,r)=>t.resolver.tree(e.data,r)],(e,t)=>{if(e)return n.abort(e),n;n.resolve(i.values(t))})}return r.recursive&&(n=i(h.widthFirst({basePath:null,cid:e},e=>{if("string"==typeof e)return i.empty();const t=l(),r=e.cid,n=this.resolvers[r.codec];return n?(y([t=>this.bs.get(e.cid,t),(e,t)=>n.resolver.tree(e.data,(r,i)=>{if(r)return t(r);d(i,(t,r)=>{n.resolver.isLink(e.data,t,(e,n)=>{if(e)return r(e);r(null,{path:t,link:n})})},t)})],(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:new o(t.link["/"])}:r})))}),t):(t.abort(new Error('No resolver found for codec "'+r.codec+'"')),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){const r=this.resolvers[e.codec];if(!r)return t(new Error('No resolver found for codec "'+e.codec+'"'));y([t=>this.bs.get(e,t),(e,t)=>{r?r.util.deserialize(e.data,(e,r)=>{if(e)return t(e);t(null,r)}):t(null,e.data)}],t)}_put(e,t,r){r=r||m;const i=this.resolvers[e.codec];if(!i)return r(new Error('No resolver found for codec "'+e.codec+'"'));y([e=>i.util.serialize(t,e),(t,r)=>this.bs.put(new n(t,e),r)],t=>{if(t)return r(t);r(null,e)})}}b.inMemory=function(e){const t=new a("in-memory",{storageBackends:{root:g,blocks:g,datastore:g},lock:"memory"}),r=new u(t);p([e=>t.init({},e),e=>t.open(e)],t=>{if(t)return e(t);e(null,new b(r))})},e.exports=b},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(22),o=r(754),s=r(392),a=r(391);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(204),i=r(391).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(18);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(757),once:r(273),values:r(79),count:r(758),infinite:r(759),empty:r(760),error:r(394)}},function(e,t,r){"use strict";var n=r(79);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=function e(){return function(e,t){t(!0)}}},function(e,t,r){"use strict";e.exports={drain:r(157),onEnd:r(762),log:r(763),find:r(764),reduce:r(274),collect:r(91),concat:r(765)}},function(e,t,r){"use strict";var n=r(157);e.exports=function e(t){return n(null,t)}},function(e,t,r){"use strict";var n=r(157);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(158),o=r(157);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(274);e.exports=function e(t){return n(function(e,t){return e+t},"",t)}},function(e,t,r){"use strict";e.exports={map:r(395),asyncMap:r(159),filter:r(160),filterNot:r(767),through:r(397),take:r(768),unique:r(398),nonUnique:r(769),flatten:r(770)}},function(e,t,r){"use strict";var n=r(396),i=r(160);e.exports=function e(t){return t=n(t),i(function(e){return!t(e)})}},function(e,t,r){"use strict";e.exports=function e(t,r){r=r||{};var n=r.last||!1,i=!1;if("number"==typeof t){n=!0;var o=t;t=function(){return--o}}return function(e){function r(t){e(!0,function(e){n=!1,t(e||!0)})}return function(o,s){i&&!o?n?r(s):s(i):(i=o)?e(i,s):e(null,function(e,o){(i=i||e)?s(i):t(o)?s(null,o):(i=!0,n?s(null,o):r(s))})}}}},function(e,t,r){"use strict";var n=r(398);e.exports=function e(t){return n(t,!0)}},function(e,t,r){"use strict";var n=r(79),i=r(273);e.exports=function e(){return function(e){var t;return function(r,o){function s(){t(null,function(t,r){!0===t?a():t?e(!0,function(e){o(t)}):o(null,r)})}function a(){t=null,e(null,function(e,r){if(e)return o(e);Array.isArray(r)||r&&"object"==typeof r?r=n(r):"function"!=typeof r&&(r=i(r)),t=r,s()})}r?t?t(r,function(t){e(t||r,o)}):e(r,o):t?s():a()}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;var n=r(399),i=o(n);function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t,r){(0,i.default)(e,function(){return!t.apply(this,arguments)},r)}e.exports=t.default},function(e,t,r){"use strict";const n=r(6),i=r(42),o=r(48),s=r(43),a=r(211),u=r(20),c=r(44),f=r(5),l=r(63),h=r(8),d=r(786),p=r(787),y=r(789),g=r(796),m=r(798),b=r(799),v=r(809),_=r(828),w=r(829),S=f("repo"),E=Number.MAX_SAFE_INTEGER,k={memory:r(438),fs:r(438)},A=r(830).repoVersion;class x{constructor(e,t){u.equal(typeof e,"string","missing repoPath"),this.options=O(t),this.closed=!0,this.path=e,this._locker=this._getLocker(),this.root=d.create("root",this.path,this.options),this.version=p(this.root),this.config=y(this.root),this.spec=g(this.root),this.apiAddr=m(this.root)}init(e,t){S("initializing at: %s",this.path),i([e=>this.root.open(I(e)),t=>this.config.set(P(e),t),t=>this.spec.set(R(e),t),e=>this.version.set(A,e)],t)}open(e){this.closed?(S("opening at: %s",this.path),n([e=>this.root.open(I(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);b(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.equal(typeof r.close,"function","Locks must have a close method"),t(null,r)})}_closeLock(e){if(this.lockfile)return this.lockfile.close(e);e()}_isLocked(e,t){if(this._locker)return this._locker.locked(e,t);t(null,!1)}_isInitialized(e){S("init check"),o({config:e=>this.config.exists(e),spec:e=>this.spec.exists(e),version:e=>this.version.check(A,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(B(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 l(t?E:r))}),version:e=>this.version.get(e),blocks:e=>this.blocks.query({},(t,r)=>{r=r||[];const n=new l(r.length);let i=new l(0);r.forEach(e=>{i=i.plus(e.value.byteLength).plus(e.key._buf.byteLength)}),e(t,{count:n,size:i})}),datastore:e=>C(this.datastore,e),keys:e=>C(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 C(e,t){h(e.query({}),h.reduce((e,t)=>e.plus(t.value.byteLength).plus(t.key._buf.byteLength),new l(0),t))}function T(e,t){return r=>{t(r&&!e(r)?r:null)}}function I(e){return T(e=>"Already open"===e.message,e)}function B(e){return T(e=>e&&(e.code===w.ERR_REPO_NOT_INITIALIZED||e.message.startsWith("ENOENT")),e)}function O(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 P(e){return e.datastore=Object.assign({},_,a(e,"datastore",{})),e}function R(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=x,e.exports.repoVersion=A,e.exports.errors=w},function(e,t,r){var n=r(208),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(92),i=c(n),o=r(776),s=c(o),a=r(405),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({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(`version mismatch: expected v${e}, found v${n}`));t()})}}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(8),i=r(7),o=r(281).asyncFilter,s=r(281).asyncSort,a=r(412),u=r(415);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(38).Key,i=r(162),o=r(6),s=r(211),a=r(416),u=r(417),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"));let 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)),l],t):l(i,t)}function l(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=b;var n=r(791),i=m(n),o=r(81),s=m(o),a=r(59),u=m(a),c=r(126),f=m(c),l=r(275),h=m(l),d=r(795),p=m(d),y=r(37),g=m(y);function m(e){return e&&e.__esModule?e:{default:e}}function b(e,t,r){if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var n=(0,g.default)(e),o=0,a=[],c=!1;function l(e,t,r){if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");if(m.started=!0,(0,s.default)(e)||(e=[e]),0===e.length&&m.idle())return(0,h.default)(function(){m.drain()});for(var n=0,i=e.length;n0&&a.splice(u,1),s.callback.apply(s,arguments),null!=t&&m.error(t,s.data)}o<=m.concurrency-m.buffer&&m.unsaturated(),m.idle()&&m.drain(),m.process()}}var y=!1,m={_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){l(e,!1,t)},kill:function(){m.drain=u.default,m._tasks.empty()},unshift:function(e,t){l(e,!0,t)},remove:function(e){m._tasks.remove(e)},process:function(){if(!y){for(y=!0;!m.paused&&o({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";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(38).Key,i=r(4).Buffer,o=new n("api");e.exports=(e=>({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(800),i=n.ShardingDatastore,o=r(38).Key,s=r(421),a=r(104),u=r(7),c=r(283),f=r(9),l=r(8),h=e=>{const t=new s.Encoder;return new o("/"+t.write(e).finalize(),!1)},d=e=>h(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 y(e){return{query(t,r){l(e.query(t),l.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,(e,n)=>{if(e)return r(e);r(null,new a(n,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),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)}}}e.exports=((e,t,r)=>{p(e,t,(e,t)=>{if(e)return r(e);r(null,y(t))})})},function(e,t,r){"use strict";const n=r(212),i=r(801),o=r(803),s=r(804),a=r(805),u=r(419);t.KeytransformDatastore=n,t.ShardingDatastore=i,t.MountDatastore=o,t.TieredDatastore=s,t.NamespaceDatastore=a,t.shard=u},function(e,t,r){"use strict";(function(t){const n=r(6),i=r(48),o=r(38).Key,s=r(419),a=r(212),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(43),i=r(420),o=r(8),s=r(38).Key,a=r(38).Errors,u=r(38).utils,c=u.asyncFilter,f=u.asyncSort,l=u.replaceStartWith,h=r(212);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=l(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 h(t.datastore,{convert:e=>{throw new Error("should never be called")},invert:e=>t.prefix.child(e)});let n;return null!=e.prefix&&(n=l(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,r){"use strict";const n=r(43),i=r(60),o=r(38).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(38).Key,i=r(212);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";Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;var n=r(807),i=o(n);function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t,r,n){(0,i.default)(e,t,function(e,t){r(e,function(e,r){t(e,!r)})},n)}e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=g;var n=r(284),i=d(n),o=r(92),s=d(o),a=r(808),u=d(a),c=r(59),f=d(c),l=r(37),h=d(l);function d(e){return e&&e.__esModule?e:{default:e}}function p(e,t,r,n){var i=new Array(t.length);e(t,function(e,t,n){r(e,function(e,r){i[t]=!!r,n(e)})},function(e){if(e)return n(e);for(var r=[],o=0;o * https://github.com/rvagg/prr * License: MIT */ -var r,n,i;r="prr",n=this,i=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},void 0!==e&&e.exports?e.exports=i():n.prr=i()},function(e,t,r){(function(t,n){var i=r(28),o=r(435),s=r(436),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)&&(l(r)&&h(e[r])||(t[r]=e[r]));return t}function l(e){return-1!==u.indexOf(e)}function h(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(432).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){var n=r(439);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(56),o=r(438).AbstractIterator,s=r(836),a=r(837),u=r(94),c=r(28),f=u.Writable;function l(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=l,i.inherits(l,o),l.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),l=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:l})),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()}})},l.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)},l.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(3))},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)},l=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 r=l(e);return r?e[r]:t};function d(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,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=h(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(94),i=r(28);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",l=r.range||{},h;n=l.lower,i=l.upper,u=!!l.lowerOpen,c=!!l.upperOpen,s&&("next"===f?(u=!0,n=s):(c=!0,i=s)),n&&i?h=IDBKeyRange.bound(n,i,u,c):n?h=IDBKeyRange.lowerBound(n,u):i&&(h=IDBKeyRange.upperBound(i,c));var d=e.transaction(t,"readonly"),p=d.objectStore(t);o._cursorsOpened++;var y=p.openCursor(h,r.direction);function g(e){try{e.continue()}catch(e){"TransactionInactiveError"!==e.name||r.snapshot?o.emit("error",e):a()}}y.onsuccess=function(){var e=y.result;if(e){s=e.key;var t=o.write({key:e.key,value:e.value});r.snapshot||t?g(e):o.once("drain",function(){g(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(207).Buffer,o=r(840);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){(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";e.exports=o;var n=r(445),i=r(166);function o(e){if(!(this instanceof o))return new o(e);n.call(this,e)}i.inherits=r(82),i.inherits(o,n),o.prototype._transform=function(e,t,r){r(null,e)}},function(e,t,r){e.exports=r(290)},function(e,t,r){e.exports=r(108)},function(e,t,r){e.exports=r(165).Transform},function(e,t,r){e.exports=r(165).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";(function(t){const n=r(109),i=r(110),o=r(450),s=r(854),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(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,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(856),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t,r){!function(r,n){"use strict";var i={version:"3.0.1",x86:{},x64:{}};function o(e,t){return(65535&e)*t+(((e>>>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 l(e,t){return t%=64,0===t?e:t<32?[e[0]<>>32-t,e[1]<>>1]),e=c(e,[4283543511,3981806797]),e=h(e,[0,e[0]>>>1]),e=c(e,[3301882366,444984403]),e=h(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,l=0;l>>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,l=0,h=0,d=0,p=0,y=597399067,g=2869860233,m=951274213,b=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],y=[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)},void 0!==e&&e.exports&&(t=e.exports=i),t.murmurHash3=i}(this)},function(e,t,r){"use strict";(function(t){const n=r(111),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(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,r=!1,u,c=[],f=!1;function l(e){c.length?(f=!0,c.shift()(e||!1)):f=!1}function h(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),l()}o.fulfill(e),l(!0)}t?a():i(a)}else r?(o.fulfill(u),l(t)):(o.reject(u),l(t))}c.push(s),t&&!f&&l()})}this.then=h,function(){function i(e){t||(n(e)?e.then(i,s):(t=r=!0,u=e,l()))}function s(e){t||(t=!0,r=!1,u=e,l())}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(452);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=h[s],c=h[s+1],f=h[a],d=h[a+1];i(l,e,t),o(l,e,u,c);var p=l[n]^l[e],y=l[n+1]^l[e+1];l[n]=y,l[n+1]=p,i(l,r,n),p=l[t]^l[r],y=l[t+1]^l[r+1],l[t]=p>>>24^y<<8,l[t+1]=y>>>24^p<<8,i(l,e,t),o(l,e,f,d),p=l[n]^l[e],y=l[n+1]^l[e+1],l[n]=p>>>16^y<<16,l[n+1]=y>>>16^p<<16,i(l,r,n),p=l[t]^l[r],y=l[t+1]^l[r+1],l[t]=y>>>31^p<<1,l[t+1]=p>>>31^y<<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})),l=new Uint32Array(32),h=new Uint32Array(32);function d(e,t){var r=0;for(r=0;r<16;r++)l[r]=e.h[r],l[r+16]=u[r];for(l[24]=l[24]^e.t,l[25]=l[25]^e.t/4294967296,t&&(l[28]=~l[28],l[29]=~l[29]),r=0;r<32;r++)h[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]^l[r]^l[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&&(y(r,t),r.c=128),r}function y(e,t){for(var r=0;r>2]>>8*(3&r);return t}function m(e,t,r){r=r||64,e=n.normalizeInput(e);var i=p(r,t);return y(i,e),g(i)}function b(e,t,r){var i=m(e,t,r);return n.toHex(i)}e.exports={blake2b:m,blake2bHex:b,blake2bInit:p,blake2bUpdate:y,blake2bFinal:g}},function(e,t,r){var n=r(452);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 l(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 h(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 y(e,t,r){r=r||32,e=n.normalizeInput(e);var i=h(r,t);return d(i,e),p(i)}function g(e,t,r){var i=y(e,t,r);return n.toHex(i)}e.exports={blake2s:y,blake2sHex:g,blake2sInit:h,blake2sUpdate:d,blake2sFinal:p}},function(e,t,r){ +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){(function(t,n){var i=r(28),o=r(430),s=r(431),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)&&(l(r)&&h(e[r])||(t[r]=e[r]));return t}function l(e){return-1!==u.indexOf(e)}function h(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(427).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){var n=r(434);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(56),o=r(433).AbstractIterator,s=r(823),a=r(824),u=r(93),c=r(28),f=u.Writable;function l(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=l,i.inherits(l,o),l.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),l=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:l})),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()}})},l.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)},l.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(3))},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)},l=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 r=l(e);return r?e[r]:t};function d(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,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=h(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(93),i=r(28);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",l=r.range||{},h;n=l.lower,i=l.upper,u=!!l.lowerOpen,c=!!l.upperOpen,s&&("next"===f?(u=!0,n=s):(c=!0,i=s)),n&&i?h=IDBKeyRange.bound(n,i,u,c):n?h=IDBKeyRange.lowerBound(n,u):i&&(h=IDBKeyRange.upperBound(i,c));var d=e.transaction(t,"readonly"),p=d.objectStore(t);o._cursorsOpened++;var y=p.openCursor(h,r.direction);function g(e){try{e.continue()}catch(e){"TransactionInactiveError"!==e.name||r.snapshot?o.emit("error",e):a()}}y.onsuccess=function(){var e=y.result;if(e){s=e.key;var t=o.write({key:e.key,value:e.value});r.snapshot||t?g(e):o.once("drain",function(){g(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,r){e.exports=r(271)},function(e,t,r){e.exports=r(12).Transform},function(e,t,r){e.exports=r(12).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";(function(t){const n=r(107),i=r(108),o=r(442),s=r(835),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(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,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(837),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t,r){!function(r,n){"use strict";var i={version:"3.0.1",x86:{},x64:{}};function o(e,t){return(65535&e)*t+(((e>>>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 l(e,t){return t%=64,0===t?e:t<32?[e[0]<>>32-t,e[1]<>>1]),e=c(e,[4283543511,3981806797]),e=h(e,[0,e[0]>>>1]),e=c(e,[3301882366,444984403]),e=h(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,l=0;l>>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,l=0,h=0,d=0,p=0,y=597399067,g=2869860233,m=951274213,b=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],y=[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,r){"use strict";(function(t){const n=r(109),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(443),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 l(e){c.length?(f=!0,c.shift()(e||!1)):f=!1}function h(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),l()}o.fulfill(e),l(!0)}t?a():i(a)}else r?(o.fulfill(u),l(t)):(o.reject(u),l(t))}c.push(s),t&&!f&&l()})}this.then=h,function(){function i(e){t||(n(e)?e.then(i,s):(t=r=!0,u=e,l()))}function s(e){t||(t=!0,r=!1,u=e,l())}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(444);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=h[s],c=h[s+1],f=h[a],d=h[a+1];i(l,e,t),o(l,e,u,c);var p=l[n]^l[e],y=l[n+1]^l[e+1];l[n]=y,l[n+1]=p,i(l,r,n),p=l[t]^l[r],y=l[t+1]^l[r+1],l[t]=p>>>24^y<<8,l[t+1]=y>>>24^p<<8,i(l,e,t),o(l,e,f,d),p=l[n]^l[e],y=l[n+1]^l[e+1],l[n]=p>>>16^y<<16,l[n+1]=y>>>16^p<<16,i(l,r,n),p=l[t]^l[r],y=l[t+1]^l[r+1],l[t]=y>>>31^p<<1,l[t+1]=p>>>31^y<<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})),l=new Uint32Array(32),h=new Uint32Array(32);function d(e,t){var r=0;for(r=0;r<16;r++)l[r]=e.h[r],l[r+16]=u[r];for(l[24]=l[24]^e.t,l[25]=l[25]^e.t/4294967296,t&&(l[28]=~l[28],l[29]=~l[29]),r=0;r<32;r++)h[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]^l[r]^l[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&&(y(r,t),r.c=128),r}function y(e,t){for(var r=0;r>2]>>8*(3&r);return t}function m(e,t,r){r=r||64,e=n.normalizeInput(e);var i=p(r,t);return y(i,e),g(i)}function b(e,t,r){var i=m(e,t,r);return n.toHex(i)}e.exports={blake2b:m,blake2bHex:b,blake2bInit:p,blake2bUpdate:y,blake2bFinal:g}},function(e,t,r){var n=r(444);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 l(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 h(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 y(e,t,r){r=r||32,e=n.normalizeInput(e);var i=h(r,t);return d(i,e),p(i)}function g(e,t,r){var i=y(e,t,r);return n.toHex(i)}e.exports={blake2s:y,blake2sHex:g,blake2sInit:h,blake2sUpdate:d,blake2sFinal:p}},function(e,t,r){ //! 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,l=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(y(e));break;case"message":t.messages.push(l(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:l(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}},l=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")},h=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}},y=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=g(e),r.options[t.name]=t.value}throw new Error("No closing tag for enum")},g=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=m(e));break;default:throw new Error("Unexpected token in option: "+e[0])}}},m=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=m(e)),r[i]=o,";"===e[0]&&e.shift();break;case"{":if(e.shift(),o=m(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")},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 r=g(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=g(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(865),i=r(867),o=r(868),s=r(869),a=r(22),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={},l=function(e,t){e.enums&&e.enums.forEach(function(e){e.id=t+(t?".":"")+e.name,c[e.id]=e,l(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}}),l(n,n.id)})};l(e,"");var h=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 h(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(22),i=r(866),o=r(5).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,l;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},l=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,l.bytes=t-r,o},s(2,f,l,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(22),i=r(293).defined;function o(e,t,r){for(var o=[],u={},c=[],f=[],l=0;l-1&&delete r[u[f]];if(e.message){var l=n.decode(i,o);o+=n.decode.bytes;var h=e.decode(i,o,o+l);t.map?(r[a]=r[a]||{},r[a][h.key]=h.value):t.repeated?(r[a]=r[a]||[],r[a].push(h)):r[a]=h}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(l,h,d){if(null==h&&(h=0),null==d&&(d=l.length),!(d<=l.length&&h<=l.length))throw new Error("Decoded message is not valid");for(var p=h,g={},m;;){if(d<=h){var b="",v=0,_,w;for(v=0;v-1){S=!0;break}S||(_?m.repeated?g[b]=[]:(w=w&&_[w]?_[w].value:_[Object.keys(_)[0]].value,g[b]=parseInt(w||0,10)):g[b]=a(m,w))}return t.bytes=h-p,g}var A=n.decode(l,h);h+=n.decode.bytes;var x=A>>3,C=u[x];if(null!=C){var T=r[C];if(m=e.fields[C],m.packed){var I=n.decode(l,h);for(h+=n.decode.bytes,I+=h;h-1){if(b)throw new Error("only one of the properties defined in oneof "+v+" can be set");b=!0}}for(m=0;me.name!==r);else{if(!t.isBuffer(r))return n(new Error("second arg needs to be a name or multihash"),null);u=u.filter(e=>!e.multihash.equals(r))}s(a,u,n)}e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";t.Diagnose=r(877),t.Decoder=r(455),t.Encoder=r(880),t.Simple=r(456),t.Tagged=r(457),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(455),i=r(294);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){t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<>1,f=-7,l=r?i-1:0,h=r?-1:1,d=e[t+l];for(l+=h,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=256*o+e[t+l],l+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+e[t+l],l+=h,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,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+l>=1?h/u:h*Math.pow(2,1-l),t*u>=2&&(s++,u/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(t*u-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-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*y}},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 l=r.pushFloatSingle;var h=r.pushFloatDouble;var d=r.pushTrue;var p=r.pushFalse;var y=r.pushUndefined;var g=r.pushNull;var m=r.pushInfinity;var b=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 A=r.pushObjectStart;var x=r.pushObjectStartFixed;var C=r.pushObjectStartFixed32;var T=r.pushObjectStartFixed64;var I=r.pushByteString;var B=r.pushByteStringStart;var O=r.pushUtf8String;var P=r.pushUtf8StringStart;var R=r.pushSimpleUnassigned;var N=r.pushTagStart;var j=r.pushTagStart4;var L=r.pushTagStart8;var M=r.pushTagUnassigned;var D=r.pushBreak;var U=t.Math.pow;var F=0;var K=0;var q=0;function H(e){e=e|0;F=0;K=e;while((F|0)<(K|0)){q=Xe[i[F]&255](i[F]|0)|0;if((q|0)>0){break}}return q|0}function z(e){e=e|0;if(((F|0)+(e|0)|0)<(K|0)){return 0}return 1}function V(e){e=e|0;return i[e|0]<<8|i[e+1|0]|0}function G(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 W(e){e=e|0;o(e|0);F=F+1|0;return 0}function $(e){e=e|0;if(z(1)|0){return 1}o(i[F+1|0]|0);F=F+2|0;return 0}function Y(e){e=e|0;if(z(2)|0){return 1}o(V(F+1|0)|0);F=F+3|0;return 0}function J(e){e=e|0;if(z(4)|0){return 1}s(V(F+1|0)|0,V(F+3|0)|0);F=F+5|0;return 0}function X(e){e=e|0;if(z(8)|0){return 1}u(V(F+1|0)|0,V(F+3|0)|0,V(F+5|0)|0,V(F+7|0)|0);F=F+9|0;return 0}function Z(e){e=e|0;o(-1-(e-32|0)|0);F=F+1|0;return 0}function Q(e){e=e|0;if(z(1)|0){return 1}o(-1-(i[F+1|0]|0)|0);F=F+2|0;return 0}function ee(e){e=e|0;var t=0;if(z(2)|0){return 1}t=V(F+1|0)|0;o(-1-(t|0)|0);F=F+3|0;return 0}function te(e){e=e|0;if(z(4)|0){return 1}a(V(F+1|0)|0,V(F+3|0)|0);F=F+5|0;return 0}function re(e){e=e|0;if(z(8)|0){return 1}c(V(F+1|0)|0,V(F+3|0)|0,V(F+5|0)|0,V(F+7|0)|0);F=F+9|0;return 0}function ne(e){e=e|0;var t=0;var r=0;var n=0;n=e-64|0;if(z(n|0)|0){return 1}t=F+1|0;r=(F+1|0)+(n|0)|0;I(t|0,r|0);F=r|0;return 0}function ie(e){e=e|0;var t=0;var r=0;var n=0;if(z(1)|0){return 1}n=i[F+1|0]|0;t=F+2|0;r=(F+2|0)+(n|0)|0;if(z(n+1|0)|0){return 1}I(t|0,r|0);F=r|0;return 0}function oe(e){e=e|0;var t=0;var r=0;var n=0;if(z(2)|0){return 1}n=V(F+1|0)|0;t=F+3|0;r=(F+3|0)+(n|0)|0;if(z(n+2|0)|0){return 1}I(t|0,r|0);F=r|0;return 0}function se(e){e=e|0;var t=0;var r=0;var n=0;if(z(4)|0){return 1}n=G(F+1|0)|0;t=F+5|0;r=(F+5|0)+(n|0)|0;if(z(n+4|0)|0){return 1}I(t|0,r|0);F=r|0;return 0}function ae(e){e=e|0;return 1}function ue(e){e=e|0;B();F=F+1|0;return 0}function ce(e){e=e|0;var t=0;var r=0;var n=0;n=e-96|0;if(z(n|0)|0){return 1}t=F+1|0;r=(F+1|0)+(n|0)|0;O(t|0,r|0);F=r|0;return 0}function fe(e){e=e|0;var t=0;var r=0;var n=0;if(z(1)|0){return 1}n=i[F+1|0]|0;t=F+2|0;r=(F+2|0)+(n|0)|0;if(z(n+1|0)|0){return 1}O(t|0,r|0);F=r|0;return 0}function le(e){e=e|0;var t=0;var r=0;var n=0;if(z(2)|0){return 1}n=V(F+1|0)|0;t=F+3|0;r=(F+3|0)+(n|0)|0;if(z(n+2|0)|0){return 1}O(t|0,r|0);F=r|0;return 0}function he(e){e=e|0;var t=0;var r=0;var n=0;if(z(4)|0){return 1}n=G(F+1|0)|0;t=F+5|0;r=(F+5|0)+(n|0)|0;if(z(n+4|0)|0){return 1}O(t|0,r|0);F=r|0;return 0}function de(e){e=e|0;return 1}function pe(e){e=e|0;P();F=F+1|0;return 0}function ye(e){e=e|0;S(e-128|0);F=F+1|0;return 0}function ge(e){e=e|0;if(z(1)|0){return 1}S(i[F+1|0]|0);F=F+2|0;return 0}function me(e){e=e|0;if(z(2)|0){return 1}S(V(F+1|0)|0);F=F+3|0;return 0}function be(e){e=e|0;if(z(4)|0){return 1}E(V(F+1|0)|0,V(F+3|0)|0);F=F+5|0;return 0}function ve(e){e=e|0;if(z(8)|0){return 1}k(V(F+1|0)|0,V(F+3|0)|0,V(F+5|0)|0,V(F+7|0)|0);F=F+9|0;return 0}function _e(e){e=e|0;w();F=F+1|0;return 0}function we(e){e=e|0;var t=0;t=e-160|0;if(z(t|0)|0){return 1}x(t|0);F=F+1|0;return 0}function Se(e){e=e|0;if(z(1)|0){return 1}x(i[F+1|0]|0);F=F+2|0;return 0}function Ee(e){e=e|0;if(z(2)|0){return 1}x(V(F+1|0)|0);F=F+3|0;return 0}function ke(e){e=e|0;if(z(4)|0){return 1}C(V(F+1|0)|0,V(F+3|0)|0);F=F+5|0;return 0}function Ae(e){e=e|0;if(z(8)|0){return 1}T(V(F+1|0)|0,V(F+3|0)|0,V(F+5|0)|0,V(F+7|0)|0);F=F+9|0;return 0}function xe(e){e=e|0;A();F=F+1|0;return 0}function Ce(e){e=e|0;N(e-192|0|0);F=F+1|0;return 0}function Te(e){e=e|0;N(e|0);F=F+1|0;return 0}function Ie(e){e=e|0;N(e|0);F=F+1|0;return 0}function Be(e){e=e|0;N(e|0);F=F+1|0;return 0}function Oe(e){e=e|0;N(e|0);F=F+1|0;return 0}function Pe(e){e=e|0;N(e-192|0|0);F=F+1|0;return 0}function Re(e){e=e|0;N(e|0);F=F+1|0;return 0}function Ne(e){e=e|0;N(e|0);F=F+1|0;return 0}function je(e){e=e|0;N(e|0);F=F+1|0;return 0}function Le(e){e=e|0;if(z(1)|0){return 1}N(i[F+1|0]|0);F=F+2|0;return 0}function Me(e){e=e|0;if(z(2)|0){return 1}N(V(F+1|0)|0);F=F+3|0;return 0}function De(e){e=e|0;if(z(4)|0){return 1}j(V(F+1|0)|0,V(F+3|0)|0);F=F+5|0;return 0}function Ue(e){e=e|0;if(z(8)|0){return 1}L(V(F+1|0)|0,V(F+3|0)|0,V(F+5|0)|0,V(F+7|0)|0);F=F+9|0;return 0}function Fe(e){e=e|0;R((e|0)-224|0);F=F+1|0;return 0}function Ke(e){e=e|0;p();F=F+1|0;return 0}function qe(e){e=e|0;d();F=F+1|0;return 0}function He(e){e=e|0;g();F=F+1|0;return 0}function ze(e){e=e|0;y();F=F+1|0;return 0}function Ve(e){e=e|0;if(z(1)|0){return 1}R(i[F+1|0]|0);F=F+2|0;return 0}function Ge(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(z(2)|0){return 1}t=i[F+1|0]|0;r=i[F+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{m()}}else{if(+s>0.0){_()}else{b()}}}else{f(+(+n*U(+2,+(+o-25.0))*+(1024.0+s)))}F=F+3|0;return 0}function We(e){e=e|0;if(z(4)|0){return 1}l(i[F+1|0]|0,i[F+2|0]|0,i[F+3|0]|0,i[F+4|0]|0);F=F+5|0;return 0}function $e(e){e=e|0;if(z(8)|0){return 1}h(i[F+1|0]|0,i[F+2|0]|0,i[F+3|0]|0,i[F+4|0]|0,i[F+5|0]|0,i[F+6|0]|0,i[F+7|0]|0,i[F+8|0]|0);F=F+9|0;return 0}function Ye(e){e=e|0;return 1}function Je(e){e=e|0;D();F=F+1|0;return 0}var Xe=[W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,$,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,le,he,de,Ye,Ye,Ye,pe,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ge,me,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,Se,Ee,ke,Ae,Ye,Ye,Ye,xe,Ce,Ce,Ce,Ce,Ce,Ce,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Le,Me,De,Ue,Ye,Ye,Ye,Ye,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Ke,qe,He,ze,Ve,Ge,We,$e,Ye,Ye,Ye,Je];return{parse:H}}},function(e,t,r){"use strict";(function(t){const n=r(35),i=r(224),o=r(294),s=r(225),a=s.MT,u=s.NUMBYTES,c=s.SHIFT32,f=s.SYMS,l=s.TAG,h=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,y=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.TRUE,g=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.FALSE,m=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"),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.Url,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;rt.length)throw new Error(r.INVALID_TARGET_OFFSET)}function c(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}t.ERRORS=r,t.checkEncoding=n,t.isFiniteInteger=i,t.checkLengthValue=s,t.checkOffsetValue=a,t.checkTargetOffset=u}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(7),o=r(227).SmartBuffer,s=r(226);t=e.exports,t.serialize=((e,t)=>{let r=[];r.push("tree "+s.cidToSha(e.tree["/"]).toString("hex")),e.parents.forEach(e=>{r.push("parent "+s.cidToSha(e["/"]).toString("hex"))}),r.push("author "+s.serializePersonLine(e.author)),r.push("committer "+s.serializePersonLine(e.committer)),e.encoding&&r.push("encoding "+e.encoding),e.mergetag&&e.mergetag.forEach(e=>{r.push("mergetag object "+s.cidToSha(e.object["/"]).toString("hex")),r.push(e.text)}),e.signature&&(r.push("gpgsig -----BEGIN PGP SIGNATURE-----"),r.push(e.signature.text)),r.push(""),r.push(e.message);let n=r.join("\n"),a=new o;a.writeString("commit "),a.writeString(n.length.toString()),a.writeUInt8(0),a.writeString(n),i(()=>t(null,a.toBuffer()))}),t.deserialize=((e,t)=>{let r=e.toString().split("\n"),o={gitType:"commit",parents:[]};for(let e=0;et(new Error("Invalid commit line "+e))),o.message=r.slice(e+1).join("\n");break}let u=a[1],c=a[2];switch(u){case"tree":o.tree={"/":s.shaToCid(n.from(c,"hex"))};break;case"committer":o.committer=s.parsePersonLine(c);break;case"author":o.author=s.parsePersonLine(c);break;case"parent":o.parents.push({"/":s.shaToCid(n.from(c,"hex"))});break;case"gpgsig":{"-----BEGIN PGP SIGNATURE-----"!==c&&i(()=>t(new Error("Invalid commit line "+e))),o.signature={};let n=e;for(;et(new Error("Invalid commit line "+e)));let u={object:{"/":s.shaToCid(n.from(a[1],"hex"))}},f=e;for(;et(null,o))})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(7),o=r(227).SmartBuffer,s=r(226);t=e.exports,t.serialize=((e,t)=>{let r=[];r.push("object "+s.cidToSha(e.object["/"]).toString("hex")),r.push("type "+e.type),r.push("tag "+e.tag),null!==e.tagger&&r.push("tagger "+s.serializePersonLine(e.tagger)),r.push(""),r.push(e.message);let n=r.join("\n"),a=new o;a.writeString("tag "),a.writeString(n.length.toString()),a.writeUInt8(0),a.writeString(n),i(()=>t(null,a.toBuffer()))}),t.deserialize=((e,t)=>{let r=e.toString().split("\n"),o={gitType:"tag"};for(let e=0;et(new Error("Invalid tag line "+e))),o.message=r.slice(e+1).join("\n");break}let u=a[1],c=a[2];switch(u){case"object":o.object={"/":s.shaToCid(n.from(c,"hex"))};break;case"tagger":o.tagger=s.parsePersonLine(c);break;case"tag":o.tag=c;break;case"type":o.type=c;break;default:o[u]=c}}i(()=>t(null,o))})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(7),i=r(227).SmartBuffer,o=r(226);t=e.exports,t.serialize=((e,t)=>{let r=[];Object.keys(e).forEach(t=>{r.push([t,e[t]])}),r.sort((e,t)=>e[0]>t[0]?1:-1);let s=new i;r.forEach(e=>{s.writeStringNT(e[1].mode+" "+e[0]),s.writeBuffer(o.cidToSha(e[1].hash["/"]))});let a=new i;a.writeString("tree "),a.writeString(s.length.toString()),a.writeUInt8(0),a.writeBuffer(s.toBuffer()),n(()=>t(null,a.toBuffer()))}),t.deserialize=((e,t)=>{let r={},s=i.fromBuffer(e,"utf8");for(;;){let e=s.readStringNT();if(""===e)break;let i=s.readBuffer(o.SHA1_LENGTH),a=e.match(/^(\d+) (.+)$/);a||n(()=>t(new Error("invalid file mode/name"))),r[a[2]]&&n(()=>t(new Error("duplicate file in tree"))),r[a[2]]={mode:a[1],hash:{"/":o.shaToCid(i)}}}n(()=>t(null,r))})},function(e,t,r){"use strict";t.resolver=r(295),t.util=r(462)},function(e,t,r){const n=r(23);e.exports={Block:r(925),ECPair:r(475),Transaction:r(301),TransactionBuilder:r(929),address:r(477),bip32:r(954),crypto:r(95),networks:r(64),opcodes:r(29),payments:r(303),script:n}},function(e,t){},function(e){e.exports={_from:"elliptic@^6.4.0",_id:"elliptic@6.4.1",_inBundle:!1,_integrity:"sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==",_location:"/elliptic",_phantomChildren:{},_requested:{type:"range",registry:!0,raw:"elliptic@^6.4.0",name:"elliptic",escapedName:"elliptic",rawSpec:"^6.4.0",saveSpec:null,fetchSpec:"^6.4.0"},_requiredBy:["/@trust/keyto","/@trust/webcrypto","/browserify-sign","/create-ecdh","/secp256k1","/tiny-secp256k1"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz",_shasum:"c2d0b7776911b86722c632c3c06c60f2f819939a",_spec:"elliptic@^6.4.0",_where:"/Users/mitra/git/dweb-transports/node_modules/@trust/webcrypto",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},bundleDependencies:!1,dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0",inherits:"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"},deprecated:!1,description:"EC cryptography",devDependencies:{brfs:"^1.4.3",coveralls:"^2.11.3",grunt:"^0.4.5","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2",istanbul:"^0.4.2",jscs:"^2.9.0",jshint:"^2.6.0",mocha:"^2.1.0"},files:["lib"],homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.4.1"}},function(e,t,r){"use strict";var n=t,i=r(31),o=r(50),s=r(463);function a(e,t){for(var r=[],n=1<=0;){var o;if(i.isOdd()){var s=i.andln(n-1);o=s>(n>>1)-1?(n>>1)-s:s,i.isubn(o)}else o=0;r.push(o);for(var a=0!==i.cmpn(0)&&0===i.andln(n-1)?t+1:1,u=1;u0||t.cmpn(-i)>0;){var o=e.andln(3)+n&3,s=t.andln(3)+i&3,a,u;if(3===o&&(o=-1),3===s&&(s=-1),0==(1&o))a=0;else{var c=e.andln(7)+n&7;a=3!==c&&5!==c||2!==s?o:-o}if(r[0].push(a),0==(1&s))u=0;else{var c=t.andln(7)+i&7;u=3!==c&&5!==c||2!==o?s:-s}r[1].push(u),2*n===a+1&&(n=1-n),2*i===u+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r}function c(e,t,r){var n="_"+t;e.prototype[t]=function e(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}}function f(e){return"string"==typeof e?n.toArray(e,"hex"):e}function l(e){return new i(e,"hex","le")}n.assert=o,n.toArray=s.toArray,n.zero2=s.zero2,n.toHex=s.toHex,n.encode=s.encode,n.getNAF=a,n.getJSF=u,n.cachedProperty=c,n.parseBytes=f,n.intFromLE=l},function(e,t,r){var n;function i(e){this.rand=e}if(e.exports=function e(t){return n||(n=new i(null)),n.generate(t)},e.exports.Rand=i,i.prototype.generate=function e(t){return this._rand(t)},i.prototype._rand=function e(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var r=new Uint8Array(t),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function f(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=c,c.prototype.point=function e(){throw new Error("Not implemented")},c.prototype.validate=function e(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function e(t,r){u(t.precomputed);var n=t._getDoubles(),i=s(r,1),o=(1<=c;r--)f=(f<<1)+i[r];a.push(f)}for(var l=this.jpoint(null,null,null),h=this.jpoint(null,null,null),d=o;d>0;d--){for(var c=0;c=0;f--){for(var r=0;f>=0&&0===a[f];f--)r++;if(f>=0&&r++,c=c.dblp(r),f<0)break;var l=a[f];u(0!==l),c="affine"===t.type?l>0?c.mixedAdd(o[l-1>>1]):c.mixedAdd(o[-l-1>>1].neg()):l>0?c.add(o[l-1>>1]):c.add(o[-l-1>>1].neg())}return"affine"===t.type?c.toP():c},c.prototype._wnafMulAdd=function e(t,r,n,i,o){for(var u=this._wnafT1,c=this._wnafT2,f=this._wnafT3,l=0,h=0;h=1;h-=2){var y=h-1,g=h;if(1===u[y]&&1===u[g]){var m=[r[y],null,null,r[g]];0===r[y].y.cmp(r[g].y)?(m[1]=r[y].add(r[g]),m[2]=r[y].toJ().mixedAdd(r[g].neg())):0===r[y].y.cmp(r[g].y.redNeg())?(m[1]=r[y].toJ().mixedAdd(r[g]),m[2]=r[y].add(r[g].neg())):(m[1]=r[y].toJ().mixedAdd(r[g]),m[2]=r[y].toJ().mixedAdd(r[g].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],v=a(n[y],n[g]);l=Math.max(v[0].length,l),f[y]=new Array(l),f[g]=new Array(l);for(var _=0;_=0;h--){for(var A=0;h>=0;){for(var x=!0,_=0;_=0&&A++,E=E.dblp(A),h<0)break;for(var _=0;_0?d=c[_][C-1>>1]:C<0&&(d=c[_][-C-1>>1].neg()),E="affine"===d.type?E.mixedAdd(d):E.add(d))}}for(var h=0;h=Math.ceil((t.bitLength()+1)/r.step)},f.prototype._getDoubles=function e(t,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,o=0;o=0&&(p=f,y=l),h.negative&&(h=h.neg(),d=d.neg()),p.negative&&(p=p.neg(),y=y.neg()),[{a:h,b:d},{a:p,b:y}]},c.prototype._endoSplit=function e(t){var r=this.endo.basis,n=r[0],i=r[1],o=i.b.mul(t).divRound(this.n),s=n.b.neg().mul(t).divRound(this.n),a=o.mul(n.a),u=s.mul(i.a),c=o.mul(n.b),f=s.mul(i.b),l=t.sub(a).sub(u),h=c.add(f).neg();return{k1:l,k2:h}},c.prototype.pointFromX=function e(t,r){t=new o(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(0!==i.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(t,i)},c.prototype.validate=function e(t){if(t.inf)return!0;var r=t.x,n=t.y,i=this.a.redMul(r),o=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return 0===n.redSqr().redISub(o).cmpn(0)},c.prototype._endoWnafMulAdd=function e(t,r,n){for(var i=this._endoWnafT1,o=this._endoWnafT2,s=0;s":""},f.prototype.isInfinity=function e(){return this.inf},f.prototype.add=function e(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var r=this.y.redSub(t.y);0!==r.cmpn(0)&&(r=r.redMul(this.x.redSub(t.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(t.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},f.prototype.dbl=function e(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=t.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),s=o.redSqr().redISub(this.x.redAdd(this.x)),a=o.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,a)},f.prototype.getX=function e(){return this.x.fromRed()},f.prototype.getY=function e(){return this.y.fromRed()},f.prototype.mul=function e(t){return t=new o(t,16),this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function e(t,r,n){var i=[this,r],o=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o):this.curve._wnafMulAdd(1,i,o,2)},f.prototype.jmulAdd=function e(t,r,n){var i=[this,r],o=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o,!0):this.curve._wnafMulAdd(1,i,o,2,!0)},f.prototype.eq=function e(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},f.prototype.neg=function e(t){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,i=function(e){return e.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},f.prototype.toJ=function e(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t},s(l,a.BasePoint),c.prototype.jpoint=function e(t,r,n){return new l(this,t,r,n)},l.prototype.toP=function e(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),r=t.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(t);return this.curve.point(n,i)},l.prototype.neg=function e(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function e(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var r=t.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),o=t.x.redMul(n),s=this.y.redMul(r.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),u=i.redSub(o),c=s.redSub(a);if(0===u.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=u.redSqr(),l=f.redMul(u),h=i.redMul(f),d=c.redSqr().redIAdd(l).redISub(h).redISub(h),p=c.redMul(h.redISub(d)).redISub(s.redMul(l)),y=this.z.redMul(t.z).redMul(u);return this.curve.jpoint(d,p,y)},l.prototype.mixedAdd=function e(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=t.x.redMul(r),o=this.y,s=t.y.redMul(r).redMul(this.z),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),f=c.redMul(a),l=n.redMul(c),h=u.redSqr().redIAdd(f).redISub(l).redISub(l),d=u.redMul(l.redISub(h)).redISub(o.redMul(f)),p=this.z.redMul(a);return this.curve.jpoint(h,d,p)},l.prototype.dblp=function e(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var r=this,n=0;n=0)return!1;if(n.redIAdd(o),0===this.x.cmp(n))return!0}},l.prototype.inspect=function e(){return this.isInfinity()?"":""},l.prototype.isInfinity=function e(){return 0===this.z.cmpn(0)}},function(e,t,r){"use strict";var n=r(228),i=r(31),o=r(1),s=n.base,a=r(57),u=a.utils;function c(e){s.call(this,"mont",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function f(e,t,r){s.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(t,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(c,s),e.exports=c,c.prototype.validate=function e(t){var r=t.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),o=i.redSqrt();return 0===o.redSqr().cmp(i)},o(f,s.BasePoint),c.prototype.decodePoint=function e(t,r){return this.point(u.toArray(t,r),1)},c.prototype.point=function e(t,r){return new f(this,t,r)},c.prototype.pointFromJSON=function e(t){return f.fromJSON(this,t)},f.prototype.precompute=function e(){},f.prototype._encode=function e(){return this.getX().toArray("be",this.curve.p.byteLength())},f.fromJSON=function e(t,r){return new f(t,r[0],r[1]||t.one)},f.prototype.inspect=function e(){return this.isInfinity()?"":""},f.prototype.isInfinity=function e(){return 0===this.z.cmpn(0)},f.prototype.dbl=function e(){var t=this.x.redAdd(this.z),r=t.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),o=r.redSub(i),s=r.redMul(i),a=o.redMul(i.redAdd(this.curve.a24.redMul(o)));return this.curve.point(s,a)},f.prototype.add=function e(){throw new Error("Not supported on Montgomery curve")},f.prototype.diffAdd=function e(t,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),o=t.x.redAdd(t.z),s=t.x.redSub(t.z),a=s.redMul(n),u=o.redMul(i),c=r.z.redMul(a.redAdd(u).redSqr()),f=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(c,f)},f.prototype.mul=function e(t){for(var r=t.clone(),n=this,i=this.curve.point(null,null),o=this,s=[];0!==r.cmpn(0);r.iushrn(1))s.push(r.andln(1));for(var a=s.length-1;a>=0;a--)0===s[a]?(n=n.diffAdd(i,o),i=i.dbl()):(i=n.diffAdd(i,o),n=n.dbl());return i},f.prototype.mulAdd=function e(){throw new Error("Not supported on Montgomery curve")},f.prototype.jumlAdd=function e(){throw new Error("Not supported on Montgomery curve")},f.prototype.eq=function e(t){return 0===this.getX().cmp(t.getX())},f.prototype.normalize=function e(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},f.prototype.getX=function e(){return this.normalize(),this.x.fromRed()}},function(e,t,r){"use strict";var n=r(228),i=r(57),o=r(31),s=r(1),a=n.base,u=i.utils.assert;function c(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,a.call(this,"edwards",e),this.a=new o(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new o(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new o(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),u(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function f(e,t,r,n,i){a.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new o(t,16),this.y=new o(r,16),this.z=n?new o(n,16):this.curve.one,this.t=i&&new o(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}s(c,a),e.exports=c,c.prototype._mulA=function e(t){return this.mOneA?t.redNeg():this.a.redMul(t)},c.prototype._mulC=function e(t){return this.oneC?t:this.c.redMul(t)},c.prototype.jpoint=function e(t,r,n,i){return this.point(t,r,n,i)},c.prototype.pointFromX=function e(t,r){t=new o(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),a=i.redMul(s.redInvm()),u=a.redSqrt();if(0!==u.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");var c=u.fromRed().isOdd();return(r&&!c||!r&&c)&&(u=u.redNeg()),this.point(t,u)},c.prototype.pointFromY=function e(t,r){t=new o(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),a=i.redMul(s.redInvm());if(0===a.cmp(this.zero)){if(r)throw new Error("invalid point");return this.point(this.zero,t)}var u=a.redSqrt();if(0!==u.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");return u.fromRed().isOdd()!==r&&(u=u.redNeg()),this.point(u,t)},c.prototype.validate=function e(t){if(t.isInfinity())return!0;t.normalize();var r=t.x.redSqr(),n=t.y.redSqr(),i=r.redMul(this.a).redAdd(n),o=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return 0===i.cmp(o)},s(f,a.BasePoint),c.prototype.pointFromJSON=function e(t){return f.fromJSON(this,t)},c.prototype.point=function e(t,r,n,i){return new f(this,t,r,n,i)},f.fromJSON=function e(t,r){return new f(t,r[0],r[1],r[2])},f.prototype.inspect=function e(){return this.isInfinity()?"":""},f.prototype.isInfinity=function e(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},f.prototype._extDbl=function e(){var t=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(t),o=this.x.redAdd(this.y).redSqr().redISub(t).redISub(r),s=i.redAdd(r),a=s.redSub(n),u=i.redSub(r),c=o.redMul(a),f=s.redMul(u),l=o.redMul(u),h=a.redMul(s);return this.curve.point(c,f,h,l)},f.prototype._projDbl=function e(){var t=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,o,s;if(this.curve.twisted){var a=this.curve._mulA(r),u=a.redAdd(n);if(this.zOne)i=t.redSub(r).redSub(n).redMul(u.redSub(this.curve.two)),o=u.redMul(a.redSub(n)),s=u.redSqr().redSub(u).redSub(u);else{var c=this.z.redSqr(),f=u.redSub(c).redISub(c);i=t.redSub(r).redISub(n).redMul(f),o=u.redMul(a.redSub(n)),s=u.redMul(f)}}else{var a=r.redAdd(n),c=this.curve._mulC(this.z).redSqr(),f=a.redSub(c).redSub(c);i=this.curve._mulC(t.redISub(a)).redMul(f),o=this.curve._mulC(a).redMul(r.redISub(n)),s=a.redMul(f)}return this.curve.point(i,o,s)},f.prototype.dbl=function e(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},f.prototype._extAdd=function e(t){var r=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),o=this.z.redMul(t.z.redAdd(t.z)),s=n.redSub(r),a=o.redSub(i),u=o.redAdd(i),c=n.redAdd(r),f=s.redMul(a),l=u.redMul(c),h=s.redMul(c),d=a.redMul(u);return this.curve.point(f,l,d,h)},f.prototype._projAdd=function e(t){var r=this.z.redMul(t.z),n=r.redSqr(),i=this.x.redMul(t.x),o=this.y.redMul(t.y),s=this.curve.d.redMul(i).redMul(o),a=n.redSub(s),u=n.redAdd(s),c=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(i).redISub(o),f=r.redMul(a).redMul(c),l,h;return this.curve.twisted?(l=r.redMul(u).redMul(o.redSub(this.curve._mulA(i))),h=a.redMul(u)):(l=r.redMul(u).redMul(o.redSub(i)),h=this.curve._mulC(a).redMul(u)),this.curve.point(f,l,h)},f.prototype.add=function e(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},f.prototype.mul=function e(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function e(t,r,n){return this.curve._wnafMulAdd(1,[this,r],[t,n],2,!1)},f.prototype.jmulAdd=function e(t,r,n){return this.curve._wnafMulAdd(1,[this,r],[t,n],2,!0)},f.prototype.normalize=function e(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},f.prototype.neg=function e(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},f.prototype.getX=function e(){return this.normalize(),this.x.fromRed()},f.prototype.getY=function e(){return this.normalize(),this.y.fromRed()},f.prototype.eq=function e(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},f.prototype.eqXToP=function e(t){var r=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(r))return!0;for(var n=t.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},f.prototype.toP=f.prototype.normalize,f.prototype.mixedAdd=f.prototype.add},function(e,t,r){"use strict";var n=t,i=r(297),o=r(57),s=o.utils.assert,a;function u(e){"short"===e.type?this.curve=new o.curve.short(e):"edwards"===e.type?this.curve=new o.curve.edwards(e):this.curve=new o.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new u(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=u,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:i.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:i.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:i.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:i.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:i.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{a=r(906)}catch(e){a=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:i.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})},function(e,t,r){"use strict";t.sha1=r(901),t.sha224=r(902),t.sha256=r(465),t.sha384=r(903),t.sha512=r(466)},function(e,t,r){"use strict";var n=r(73),i=r(168),o=r(464),s=n.rotl32,a=n.sum32,u=n.sum32_5,c=o.ft_1,f=i.BlockHash,l=[1518500249,1859775393,2400959708,3395469782];function h(){if(!(this instanceof h))return new h;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(h,f),e.exports=h,h.blockSize=512,h.outSize=160,h.hmacStrength=80,h.padLength=64,h.prototype._update=function e(t,r){for(var n=this.W,i=0;i<16;i++)n[i]=t[r+i];for(;ithis.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var r=t.length;r0))return u.iaddn(1),this.keyFromPrivate(u)}},f.prototype._truncateToN=function e(t,r){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!r&&t.cmp(this.n)>=0?t.sub(this.n):t},f.prototype.sign=function e(t,r,o,s){"object"==typeof o&&(s=o,o=null),s||(s={}),r=this.keyFromPrivate(r,o),t=this._truncateToN(new n(t,16));for(var a=this.n.byteLength(),u=r.getPrivate().toArray("be",a),f=t.toArray("be",a),l=new i({hash:this.hash,entropy:u,nonce:f,pers:s.pers,persEnc:s.persEnc||"utf8"}),h=this.n.sub(new n(1)),d=0;;d++){var p=s.k?s.k(d):new n(l.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(h)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var g=y.getX(),m=g.umod(this.n);if(0!==m.cmpn(0)){var b=p.invm(this.n).mul(m.mul(r.getPrivate()).iadd(t));if(b=b.umod(this.n),0!==b.cmpn(0)){var v=(y.getY().isOdd()?1:0)|(0!==g.cmp(m)?2:0);return s.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),v^=1),new c({r:m,s:b,recoveryParam:v})}}}}}},f.prototype.verify=function e(t,r,i,o){t=this._truncateToN(new n(t,16)),i=this.keyFromPublic(i,o),r=new c(r,"hex");var s=r.r,a=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),f=u.mul(t).umod(this.n),l=u.mul(s).umod(this.n);if(!this.curve._maxwellTrick){var h=this.g.mulAdd(f,i.getPublic(),l);return!h.isInfinity()&&0===h.getX().umod(this.n).cmp(s)}var h=this.g.jmulAdd(f,i.getPublic(),l);return!h.isInfinity()&&h.eqXToP(s)},f.prototype.recoverPubKey=function(e,t,r,i){a((3&r)===r,"The recovery param is more than two bits"),t=new c(t,i);var o=this.n,s=new n(e),u=t.r,f=t.s,l=1&r,h=r>>1;if(u.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");u=h?this.curve.pointFromX(u.add(this.curve.n),l):this.curve.pointFromX(u,l);var d=t.r.invm(o),p=o.sub(s).mul(d).umod(o),y=f.mul(d).umod(o);return this.g.mulAdd(p,u,y)},f.prototype.getKeyRecoveryParam=function(e,t,r,n){if(t=new c(t,n),null!==t.recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},function(e,t,r){"use strict";var n=r(297),i=r(463),o=r(50);function s(e){if(!(this instanceof s))return new s(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=i.toArray(e.entropy,e.entropyEnc||"hex"),r=i.toArray(e.nonce,e.nonceEnc||"hex"),n=i.toArray(e.pers,e.persEnc||"hex");o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}e.exports=s,s.prototype._init=function e(t,r,n){var i=t.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},s.prototype.generate=function e(t,r,n,o){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof r&&(o=n,n=r,r=null),n&&(n=i.toArray(n,o||"hex"),this._update(n));for(var s=[];s.length"}},function(e,t,r){"use strict";var n=r(31),i=r(57),o=i.utils,s=o.assert;function a(e,t){if(e instanceof a)return e;this._importDER(e,t)||(s(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function u(){this.place=0}function c(e,t){var r=e[t.place++];if(!(128&r))return r;for(var n=15&r,i=0,o=0,s=t.place;o>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}e.exports=a,a.prototype._importDER=function e(t,r){t=o.toArray(t,r);var i=new u;if(48!==t[i.place++])return!1;var s=c(t,i);if(s+i.place!==t.length)return!1;if(2!==t[i.place++])return!1;var a=c(t,i),f=t.slice(i.place,a+i.place);if(i.place+=a,2!==t[i.place++])return!1;var l=c(t,i);if(t.length!==l+i.place)return!1;var h=t.slice(i.place,l+i.place);return 0===f[0]&&128&f[1]&&(f=f.slice(1)),0===h[0]&&128&h[1]&&(h=h.slice(1)),this.r=new n(f),this.s=new n(h),this.recoveryParam=null,!0},a.prototype.toDER=function e(t){var r=this.r.toArray(),n=this.s.toArray();for(128&r[0]&&(r=[0].concat(r)),128&n[0]&&(n=[0].concat(n)),r=f(r),n=f(n);!(n[0]||128&n[1]);)n=n.slice(1);var i=[2];l(i,r.length),i=i.concat(r),i.push(2),l(i,n.length);var s=i.concat(n),a=[48];return l(a,s.length),a=a.concat(s),o.encode(a,t)}},function(e,t,r){"use strict";var n=r(297),i=r(57),o=i.utils,s=o.assert,a=o.parseBytes,u=r(912),c=r(913);function f(e){if(s("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof f))return new f(e);var e=i.curves[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}e.exports=f,f.prototype.sign=function e(t,r){t=a(t);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),t),o=this.g.mul(i),s=this.encodePoint(o),u=this.hashInt(s,n.pubBytes(),t).mul(n.priv()),c=i.add(u).umod(this.curve.n);return this.makeSignature({R:o,S:c,Rencoded:s})},f.prototype.verify=function e(t,r,n){t=a(t),r=this.makeSignature(r);var i=this.keyFromPublic(n),o=this.hashInt(r.Rencoded(),i.pubBytes(),t),s=this.g.mul(r.S()),u=r.R().add(i.pub().mul(o));return u.eq(s)},f.prototype.hashInt=function e(){for(var t=this.hash(),r=0;ra?t=e(t):t.length>>27}function f(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]=t[u-3]^t[u-8]^t[u-14]^t[u-16];for(var h=0;h<80;++h){var d=~~(h/20),p=c(r)+l(d,n,i,o)+a+t[h]+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(132),o=r(5).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 l(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]=c(t[u-3]^t[u-8]^t[u-14]^t[u-16]);for(var d=0;d<80;++d){var p=~~(d/20),y=f(r)+h(p,n,i,o)+a+t[d]+s[p]|0;a=o,o=i,i=l(n),n=r,r=y}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(470),o=r(132),s=r(5).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(471),o=r(132),s=r(5).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){var n=r(29);function i(e){return ee.length)return null;i=e.readUInt8(t+1),o=2}else if(r===n.OP_PUSHDATA2){if(t+3>e.length)return null;i=e.readUInt16LE(t+1),o=3}else{if(t+5>e.length)return null;if(r!==n.OP_PUSHDATA4)throw new Error("Unexpected opcode");i=e.readUInt32LE(t+1),o=5}return{opcode:r,number:i,size:o}}e.exports={encodingLength:i,encode:o,decode:s}},function(e,t,r){(function(t){var n=r(300),i=r(472);function o(e){return t.isBuffer(e)}function s(e){return"string"==typeof e&&/^([0-9a-f]{2})+$/i.test(e)}function a(e,t){var r=e.toJSON();function n(n){if(!e(n))return!1;if(n.length===t)return!0;throw i.tfCustomError(r+"(Length: "+t+")",r+"(Length: "+n.length+")")}return n.toJSON=function(){return r},n}var u=a.bind(null,n.Array),c=a.bind(null,o),f=a.bind(null,s),l=a.bind(null,n.String);function h(e,t,r){function i(n,i){return r(n,i)&&n>e&&n>24===e}function g(e){return e<<16>>16===e}function m(e){return(0|e)===e}function b(e){return"number"==typeof e&&e>=-d&&e<=d&&Math.floor(e)===e}function v(e){return(255&e)===e}function _(e){return(65535&e)===e}function w(e){return e>>>0===e}function S(e){return"number"==typeof e&&e>=0&&e<=d&&Math.floor(e)===e}var E={ArrayN:u,Buffer:o,BufferN:c,Finite:p,Hex:s,HexN:f,Int8:y,Int16:g,Int32:m,Int53:b,Range:h,StringN:l,UInt8:v,UInt16:_,UInt32:w,UInt53:S};for(var k in E)E[k].toJSON=function(e){return e}.bind(null,k);e.exports=E}).call(this,r(0).Buffer)},function(e,t,r){var n=r(29),i={};for(var o in n){var s=n[o];i[s]=o}e.exports=i},function(e,t,r){const n=r(296),i=r(5).Buffer,o=r(36),s=r(74),a=i.alloc(1,0);function u(e){let t=0;for(;0===e[t];)++t;return t===e.length?a:(e=e.slice(t),128&e[0]?i.concat([a,e],1+e.length):e)}function c(e){0===e[0]&&(e=e.slice(1));const t=i.alloc(32,0),r=Math.max(0,32-e.length);return e.copy(t,r),t}function f(e){const t=e.readUInt8(e.length-1),r=-129&t;if(r<=0||r>=4)throw new Error("Invalid hashType "+t);const o=n.decode(e.slice(0,-1)),s=c(o.r),a=c(o.s);return{signature:i.concat([s,a],64),hashType:t}}function l(e,t){o({signature:s.BufferN(64),hashType:s.UInt8},{signature:e,hashType:t});const r=-129&t;if(r<=0||r>=4)throw new Error("Invalid hashType "+t);const a=i.allocUnsafe(1);a.writeUInt8(t,0);const c=u(e.slice(0,32)),f=u(e.slice(32,64));return i.concat([n.encode(c,f),a])}e.exports={decode:f,encode:l}},function(e,t,r){const n=r(5).Buffer,i=r(95),o=r(926),s=r(36),a=r(74),u=r(474),c=r(301);function f(){this.version=1,this.prevHash=null,this.merkleRoot=null,this.timestamp=0,this.bits=0,this.nonce=0}f.fromBuffer=function(e){if(e.length<80)throw new Error("Buffer too small (< 80 bytes)");let t=0;function r(r){return t+=r,e.slice(t-r,t)}function n(){const r=e.readUInt32LE(t);return t+=4,r}function i(){const r=e.readInt32LE(t);return t+=4,r}const o=new f;if(o.version=i(),o.prevHash=r(32),o.merkleRoot=r(32),o.timestamp=n(),o.bits=n(),o.nonce=n(),80===e.length)return o;function s(){const r=u.decode(e,t);return t+=u.decode.bytes,r}function a(){const r=c.fromBuffer(e.slice(t),!0);return t+=r.byteLength(),r}const l=s();o.transactions=[];for(var h=0;h>24)-3,r=8388607&e,i=n.alloc(32,0);return i.writeUInt32BE(r,28-t),i},f.calculateMerkleRoot=function(e){if(s([{getHash:a.Function}],e),0===e.length)throw TypeError("Cannot compute merkle root for zero transactions");const t=e.map(function(e){return e.getHash()});return o(t,i.hash256)},f.prototype.checkMerkleRoot=function(){if(!this.transactions)return!1;const e=f.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(e)},f.prototype.checkProofOfWork=function(){const e=this.getHash().reverse(),t=f.calculateTarget(this.bits);return e.compare(t)<=0},e.exports=f},function(e,t,r){(function(t){e.exports=function e(r,n){if(!Array.isArray(r))throw TypeError("Expected values Array");if("function"!=typeof n)throw TypeError("Expected digest Function");for(var i=r.length,o=r.concat();i>1;){for(var s=0,a=0;at)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}function n(e,t){const n=e.readUInt32LE(t);let i=e.readUInt32LE(t+4);return i*=4294967296,r(i+n,9007199254740991),i+n}function i(e,t,n){return r(t,9007199254740991),e.writeInt32LE(-1&t,n),e.writeUInt32LE(Math.floor(t/4294967296),n+4),n+8}e.exports={readUInt64LE:n,writeUInt64LE:i}},function(e,t,r){"use strict";var n=r(14),i=r(5).Buffer;e.exports=function(e){function t(t){var r=e(t);return n.encode(i.concat([t,r],t.length+4))}function r(t){var r=t.slice(0,-4),n=t.slice(-4),i=e(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}function o(e){var t=n.decodeUnsafe(e);if(t)return r(t)}function s(t){var i=n.decode(t),o=r(i,e);if(!o)throw new Error("Invalid checksum");return o}return{encode:t,decode:s,decodeUnsafe:o}}},function(e,t,r){const n=r(5).Buffer,i=r(477),o=r(95),s=r(23),a=r(64),u=r(29),c=r(303),f=r(36),l=r(74),h=r(937),d=h.types,p=r(475),y=r(301);function g(e,t,r,n){if(0===e.length&&0===t.length)return{};if(!r){let n=h.input(e,!0),i=h.witness(t,!0);n===d.NONSTANDARD&&(n=void 0),i===d.NONSTANDARD&&(i=void 0),r=n||i}switch(r){case d.P2WPKH:{const{output:e,pubkey:r,signature:n}=c.p2wpkh({witness:t});return{prevOutScript:e,prevOutType:d.P2WPKH,pubkeys:[r],signatures:[n]}}case d.P2PKH:{const{output:t,pubkey:r,signature:n}=c.p2pkh({input:e});return{prevOutScript:t,prevOutType:d.P2PKH,pubkeys:[r],signatures:[n]}}case d.P2PK:{const{signature:t}=c.p2pk({input:e});return{prevOutType:d.P2PK,pubkeys:[void 0],signatures:[t]}}case d.MULTISIG:{const{pubkeys:t,signatures:r}=c.p2ms({input:e,output:n},{allowIncomplete:!0});return{prevOutType:d.MULTISIG,pubkeys:t,signatures:r}}}if(r===d.P2SH){const{output:r,redeem:n}=c.p2sh({input:e,witness:t}),i=h.output(n.output),o=g(n.input,n.witness,i,n.output);return o.prevOutType?{prevOutScript:r,prevOutType:d.P2SH,redeemScript:n.output,redeemScriptType:o.prevOutType,witnessScript:o.witnessScript,witnessScriptType:o.witnessScriptType,pubkeys:o.pubkeys,signatures:o.signatures}:{}}if(r===d.P2WSH){const{output:r,redeem:n}=c.p2wsh({input:e,witness:t}),i=h.output(n.output);let o;return o=i===d.P2WPKH?g(n.input,n.witness,i):g(s.compile(n.witness),[],i,n.output),o.prevOutType?{prevOutScript:r,prevOutType:d.P2WSH,witnessScript:n.output,witnessScriptType:o.prevOutType,pubkeys:o.pubkeys,signatures:o.signatures}:{}}return{prevOutType:d.NONSTANDARD,prevOutScript:e}}function m(e,t,r){if(e.redeemScriptType!==d.MULTISIG||!e.redeemScript)return;if(e.pubkeys.length===e.signatures.length)return;const n=e.signatures.concat();e.signatures=e.pubkeys.map(function(i){const o=p.fromPublicKey(i);let a;return n.some(function(i,u){if(!i)return!1;const c=s.signature.decode(i),f=t.hashForSignature(r,e.redeemScript,c.hashType);return!!o.verify(f,c.signature)&&(n[u]=void 0,a=i,!0)}),a})}function b(e,t){f(l.Buffer,e);const r=h.output(e);switch(r){case d.P2PKH:{if(!t)return{type:r};const n=c.p2pkh({output:e}).hash,i=o.hash160(t);return n.equals(i)?{type:r,pubkeys:[t],signatures:[void 0]}:{type:r}}case d.P2WPKH:{if(!t)return{type:r};const n=c.p2wpkh({output:e}).hash,i=o.hash160(t);return n.equals(i)?{type:r,pubkeys:[t],signatures:[void 0]}:{type:r}}case d.P2PK:{const t=c.p2pk({output:e});return{type:r,pubkeys:[t.pubkey],signatures:[void 0]}}case d.MULTISIG:{const t=c.p2ms({output:e});return{type:r,pubkeys:t.pubkeys,signatures:t.pubkeys.map(()=>void 0)}}}return{type:r}}function v(e,t,r,n,i){if(r&&i){const n=c.p2wsh({redeem:{output:i}}),o=c.p2wsh({output:r}),a=c.p2sh({redeem:{output:r}}),u=c.p2sh({redeem:n});if(!n.hash.equals(o.hash))throw new Error("Witness script inconsistent with prevOutScript");if(!a.hash.equals(u.hash))throw new Error("Redeem script inconsistent with prevOutScript");const f=b(n.redeem.output,t);if(!f.pubkeys)throw new Error(f.type+" not supported as witnessScript ("+s.toASM(i)+")");e.signatures&&e.signatures.some(e=>e)&&(f.signatures=e.signatures);let l=i;if(f.type===d.P2WPKH)throw new Error("P2SH(P2WSH(P2WPKH)) is a consensus failure");return{redeemScript:r,redeemScriptType:d.P2WSH,witnessScript:i,witnessScriptType:f.type,prevOutType:d.P2SH,prevOutScript:a.output,hasWitness:!0,signScript:l,signType:f.type,pubkeys:f.pubkeys,signatures:f.signatures}}if(r){const n=c.p2sh({redeem:{output:r}});if(e.prevOutScript){let t;try{t=c.p2sh({output:e.prevOutScript})}catch(e){throw new Error("PrevOutScript must be P2SH")}if(!n.hash.equals(t.hash))throw new Error("Redeem script inconsistent with prevOutScript")}const i=b(n.redeem.output,t);if(!i.pubkeys)throw new Error(i.type+" not supported as redeemScript ("+s.toASM(r)+")");e.signatures&&e.signatures.some(e=>e)&&(i.signatures=e.signatures);let o=r;return i.type===d.P2WPKH&&(o=c.p2pkh({pubkey:i.pubkeys[0]}).output),{redeemScript:r,redeemScriptType:i.type,prevOutType:d.P2SH,prevOutScript:n.output,hasWitness:i.type===d.P2WPKH,signScript:o,signType:i.type,pubkeys:i.pubkeys,signatures:i.signatures}}if(i){const r=c.p2wsh({redeem:{output:i}});if(e.prevOutScript){const t=c.p2wsh({output:e.prevOutScript});if(!r.hash.equals(t.hash))throw new Error("Witness script inconsistent with prevOutScript")}const n=b(r.redeem.output,t);if(!n.pubkeys)throw new Error(n.type+" not supported as witnessScript ("+s.toASM(i)+")");e.signatures&&e.signatures.some(e=>e)&&(n.signatures=e.signatures);let o=i;if(n.type===d.P2WPKH)throw new Error("P2WSH(P2WPKH) is a consensus failure");return{witnessScript:i,witnessScriptType:n.type,prevOutType:d.P2WSH,prevOutScript:r.output,hasWitness:!0,signScript:o,signType:n.type,pubkeys:n.pubkeys,signatures:n.signatures}}if(e.prevOutType&&e.prevOutScript){if(e.prevOutType===d.P2SH)throw new Error("PrevOutScript is "+e.prevOutType+", requires redeemScript");if(e.prevOutType===d.P2WSH)throw new Error("PrevOutScript is "+e.prevOutType+", requires witnessScript");if(!e.prevOutScript)throw new Error("PrevOutScript is missing");const r=b(e.prevOutScript,t);if(!r.pubkeys)throw new Error(r.type+" not supported ("+s.toASM(e.prevOutScript)+")");e.signatures&&e.signatures.some(e=>e)&&(r.signatures=e.signatures);let n=e.prevOutScript;return r.type===d.P2WPKH&&(n=c.p2pkh({pubkey:r.pubkeys[0]}).output),{prevOutType:r.type,prevOutScript:e.prevOutScript,hasWitness:r.type===d.P2WPKH,signScript:n,signType:r.type,pubkeys:r.pubkeys,signatures:r.signatures}}const o=c.p2pkh({pubkey:t}).output;return{prevOutType:d.P2PKH,prevOutScript:o,hasWitness:!1,signScript:o,signType:d.P2PKH,pubkeys:[t],signatures:[void 0]}}function _(e,t,r){const n=t.pubkeys||[];let i=t.signatures||[];switch(e){case d.P2PKH:if(0===n.length)break;if(0===i.length)break;return c.p2pkh({pubkey:n[0],signature:i[0]});case d.P2WPKH:if(0===n.length)break;if(0===i.length)break;return c.p2wpkh({pubkey:n[0],signature:i[0]});case d.P2PK:if(0===n.length)break;if(0===i.length)break;return c.p2pk({signature:i[0]});case d.MULTISIG:return i=r?i.map(e=>e||u.OP_0):i.filter(e=>e),c.p2ms({signatures:i},{allowIncomplete:r});case d.P2SH:{const e=_(t.redeemScriptType,t,r);if(!e)return;return c.p2sh({redeem:{output:e.output||t.redeemScript,input:e.input,witness:e.witness}})}case d.P2WSH:{const e=_(t.witnessScriptType,t,r);if(!e)return;return c.p2wsh({redeem:{output:t.witnessScript,input:e.input,witness:e.witness}})}}}function w(e,t){this.__prevTxSet={},this.network=e||a.bitcoin,this.maximumFeeRate=t||2500,this.__inputs=[],this.__tx=new y,this.__tx.version=2}function S(e){return void 0!==e.signScript&&void 0!==e.signType&&void 0!==e.pubkeys&&void 0!==e.signatures&&e.signatures.length===e.pubkeys.length&&e.pubkeys.length>0&&(!1===e.hasWitness||void 0!==e.value)}function E(e){return e.readUInt8(e.length-1)}w.prototype.setLockTime=function(e){if(f(l.UInt32,e),this.__inputs.some(function(e){return!!e.signatures&&e.signatures.some(function(e){return e})}))throw new Error("No, this would invalidate signatures");this.__tx.locktime=e},w.prototype.setVersion=function(e){f(l.UInt32,e),this.__tx.version=e},w.fromTransaction=function(e,t){const r=new w(t);return r.setVersion(e.version),r.setLockTime(e.locktime),e.outs.forEach(function(e){r.addOutput(e.script,e.value)}),e.ins.forEach(function(e){r.__addInputUnsafe(e.hash,e.index,{sequence:e.sequence,script:e.script,witness:e.witness})}),r.__inputs.forEach(function(t,r){m(t,e,r)}),r},w.prototype.addInput=function(e,t,r,i){if(!this.__canModifyInputs())throw new Error("No, this would invalidate signatures");let o;if("string"==typeof e)e=n.from(e,"hex").reverse();else if(e instanceof y){const r=e.outs[t];i=r.script,o=r.value,e=e.getHash()}return this.__addInputUnsafe(e,t,{sequence:r,prevOutScript:i,value:o})},w.prototype.__addInputUnsafe=function(e,t,r){if(y.isCoinbaseHash(e))throw new Error("coinbase inputs not supported");const n=e.toString("hex")+":"+t;if(void 0!==this.__prevTxSet[n])throw new Error("Duplicate TxOut: "+n);let i={};if(void 0!==r.script&&(i=g(r.script,r.witness||[])),void 0!==r.value&&(i.value=r.value),!i.prevOutScript&&r.prevOutScript){let e;if(!i.pubkeys&&!i.signatures){const t=b(r.prevOutScript);t.pubkeys&&(i.pubkeys=t.pubkeys,i.signatures=t.signatures),e=t.type}i.prevOutScript=r.prevOutScript,i.prevOutType=e||h.output(r.prevOutScript)}const o=this.__tx.addInput(e,t,r.sequence,r.scriptSig);return this.__inputs[o]=i,this.__prevTxSet[n]=!0,o},w.prototype.addOutput=function(e,t){if(!this.__canModifyOutputs())throw new Error("No, this would invalidate signatures");return"string"==typeof e&&(e=i.toOutputScript(e,this.network)),this.__tx.addOutput(e,t)},w.prototype.build=function(){return this.__build(!1)},w.prototype.buildIncomplete=function(){return this.__build(!0)},w.prototype.__build=function(e){if(!e){if(!this.__tx.ins.length)throw new Error("Transaction has no inputs");if(!this.__tx.outs.length)throw new Error("Transaction has no outputs")}const t=this.__tx.clone();if(this.__inputs.forEach(function(r,n){if(!r.prevOutType&&!e)throw new Error("Transaction is not complete");const i=_(r.prevOutType,r,e);if(i)t.setInputScript(n,i.input),t.setWitness(n,i.witness);else{if(!e&&r.prevOutType===d.NONSTANDARD)throw new Error("Unknown input type");if(!e)throw new Error("Not enough information")}}),!e&&this.__overMaximumFees(t.virtualSize()))throw new Error("Transaction has absurd fees");return t},w.prototype.sign=function(e,t,r,n,i,o){if(t.network&&t.network!==this.network)throw new TypeError("Inconsistent network");if(!this.__inputs[e])throw new Error("No input at index: "+e);n=n||y.SIGHASH_ALL;const a=this.__inputs[e];if(void 0!==a.redeemScript&&r&&!a.redeemScript.equals(r))throw new Error("Inconsistent redeemScript");const u=t.publicKey||t.getPublicKey();if(!S(a)){if(void 0!==i){if(void 0!==a.value&&a.value!==i)throw new Error("Input didn't match witnessValue");f(l.Satoshi,i),a.value=i}if(!S(a)){const e=v(a,u,r,i,o);Object.assign(a,e)}if(!S(a))throw Error(a.prevOutType+" not supported")}let c;c=a.hasWitness?this.__tx.hashForWitnessV0(e,a.signScript,a.value,n):this.__tx.hashForSignature(e,a.signScript,n);const h=a.pubkeys.some(function(e,r){if(!u.equals(e))return!1;if(a.signatures[r])throw new Error("Signature already exists");if(33!==u.length&&a.hasWitness)throw new Error("BIP143 rejects uncompressed public keys in P2WPKH or P2WSH");const i=t.sign(c);return a.signatures[r]=s.signature.encode(i,n),!0});if(!h)throw new Error("Key pair cannot sign for this input")},w.prototype.__canModifyInputs=function(){return this.__inputs.every(function(e){return void 0===e.signatures||e.signatures.every(function(e){if(!e)return!0;const t=E(e);return t&y.SIGHASH_ANYONECANPAY})})},w.prototype.__canModifyOutputs=function(){const e=this.__tx.ins.length,t=this.__tx.outs.length;return this.__inputs.every(function(r){return void 0===r.signatures||r.signatures.every(function(r){if(!r)return!0;const n=E(r),i=31&n;return i===y.SIGHASH_NONE||(i===y.SIGHASH_SINGLE?e<=t:void 0)})})},w.prototype.__overMaximumFees=function(e){const t=this.__inputs.reduce(function(e,t){return e+(t.value>>>0)},0),r=this.__tx.outs.reduce(function(e,t){return e+t.value},0),n=t-r,i=n/e;return i>this.maximumFeeRate},e.exports=w},function(e,t,r){const n=r(116),i=r(36),o=r(29),s=r(23),a=r(64).bitcoin;function u(e,t){return e.length===t.length&&e.every(function(e,r){return e.equals(t[r])})}function c(e,t){if(!e.data&&!e.output)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),i({network:i.maybe(i.Object),output:i.maybe(i.Buffer),data:i.maybe(i.arrayOf(i.Buffer))},e);const r=e.network||a,c={network:r};if(n.prop(c,"output",function(){if(e.data)return s.compile([o.OP_RETURN].concat(e.data))}),n.prop(c,"data",function(){if(e.output)return s.decompile(e.output).slice(1)}),t.validate&&e.output){const t=s.decompile(e.output);if(t[0]!==o.OP_RETURN)throw new TypeError("Output is invalid");if(!t.slice(1).every(i.Buffer))throw new TypeError("Output is invalid");if(e.data&&!u(e.data,c.data))throw new TypeError("Data mismatch")}return Object.assign(c,e)}e.exports=c},function(e,t,r){const n=r(116),i=r(36),o=r(29),s=r(114),a=r(23),u=r(64).bitcoin,c=o.OP_RESERVED;function f(e,t){return e.length===t.length&&e.every(function(e,r){return e.equals(t[r])})}function l(e,t){if(!(e.input||e.output||e.pubkeys&&void 0!==e.m||e.signatures))throw new TypeError("Not enough data");function r(e){return a.isCanonicalScriptSignature(e)||t.allowIncomplete&&e===o.OP_0}t=Object.assign({validate:!0},t||{}),i({network:i.maybe(i.Object),m:i.maybe(i.Number),n:i.maybe(i.Number),output:i.maybe(i.Buffer),pubkeys:i.maybe(i.arrayOf(s.isPoint)),signatures:i.maybe(i.arrayOf(r)),input:i.maybe(i.Buffer)},e);const l=e.network||u,h={network:l};let d,p=!1;function y(e){p||(p=!0,d=a.decompile(e),h.m=d[0]-c,h.n=d[d.length-2]-c,h.pubkeys=d.slice(1,-2))}if(n.prop(h,"output",function(){if(e.m&&h.n&&e.pubkeys)return a.compile([].concat(c+e.m,e.pubkeys,c+h.n,o.OP_CHECKMULTISIG))}),n.prop(h,"m",function(){if(h.output)return y(h.output),h.m}),n.prop(h,"n",function(){if(h.pubkeys)return h.pubkeys.length}),n.prop(h,"pubkeys",function(){if(e.output)return y(e.output),h.pubkeys}),n.prop(h,"signatures",function(){if(e.input)return a.decompile(e.input).slice(1)}),n.prop(h,"input",function(){if(e.signatures)return a.compile([o.OP_0].concat(e.signatures))}),n.prop(h,"witness",function(){if(h.input)return[]}),t.validate){if(e.output){if(y(e.output),!i.Number(d[0]))throw new TypeError("Output is invalid");if(!i.Number(d[d.length-2]))throw new TypeError("Output is invalid");if(d[d.length-1]!==o.OP_CHECKMULTISIG)throw new TypeError("Output is invalid");if(h.m<=0||h.n>16||h.m>h.n||h.n!==d.length-3)throw new TypeError("Output is invalid");if(!h.pubkeys.every(e=>s.isPoint(e)))throw new TypeError("Output is invalid");if(void 0!==e.m&&e.m!==h.m)throw new TypeError("m mismatch");if(void 0!==e.n&&e.n!==h.n)throw new TypeError("n mismatch");if(e.pubkeys&&!f(e.pubkeys,h.pubkeys))throw new TypeError("Pubkeys mismatch")}if(e.pubkeys){if(void 0!==e.n&&e.n!==e.pubkeys.length)throw new TypeError("Pubkey count mismatch");if(h.n=e.pubkeys.length,h.nh.m)throw new TypeError("Too many signatures provided")}if(e.input){if(e.input[0]!==o.OP_0)throw new TypeError("Input is invalid");if(0===h.signatures.length||!h.signatures.every(r))throw new TypeError("Input has invalid signature(s)");if(e.signatures&&!f(e.signatures.equals(h.signatures)))throw new TypeError("Signature mismatch");if(void 0!==e.m&&e.m!==e.signatures.length)throw new TypeError("Signature count mismatch")}}return Object.assign(h,e)}e.exports=l},function(e,t,r){const n=r(116),i=r(36),o=r(29),s=r(114),a=r(23),u=r(64).bitcoin;function c(e,t){if(!(e.input||e.output||e.pubkey||e.input||e.signature))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),i({network:i.maybe(i.Object),output:i.maybe(i.Buffer),pubkey:i.maybe(s.isPoint),signature:i.maybe(a.isCanonicalScriptSignature),input:i.maybe(i.Buffer)},e);const r=n.value(function(){return a.decompile(e.input)}),c=e.network||u,f={network:c};if(n.prop(f,"output",function(){if(e.pubkey)return a.compile([e.pubkey,o.OP_CHECKSIG])}),n.prop(f,"pubkey",function(){if(e.output)return e.output.slice(1,-1)}),n.prop(f,"signature",function(){if(e.input)return r()[0]}),n.prop(f,"input",function(){if(e.signature)return a.compile([e.signature])}),n.prop(f,"witness",function(){if(f.input)return[]}),t.validate){if(e.output){if(e.output[e.output.length-1]!==o.OP_CHECKSIG)throw new TypeError("Output is invalid");if(!s.isPoint(f.pubkey))throw new TypeError("Output pubkey is invalid");if(e.pubkey&&!e.pubkey.equals(f.pubkey))throw new TypeError("Pubkey mismatch")}if(e.signature&&e.input&&!e.input.equals(f.input))throw new TypeError("Signature mismatch");if(e.input){if(1!==r().length)throw new TypeError("Input is invalid");if(!a.isCanonicalScriptSignature(f.signature))throw new TypeError("Input has invalid signature")}}return Object.assign(f,e)}e.exports=c},function(e,t,r){(function(t){const n=r(116),i=r(36),o=r(29),s=r(114),a=r(95),u=r(23),c=r(64).bitcoin,f=r(169);function l(e,r){if(!(e.address||e.hash||e.output||e.pubkey||e.input))throw new TypeError("Not enough data");r=Object.assign({validate:!0},r||{}),i({network:i.maybe(i.Object),address:i.maybe(i.String),hash:i.maybe(i.BufferN(20)),output:i.maybe(i.BufferN(25)),pubkey:i.maybe(s.isPoint),signature:i.maybe(u.isCanonicalScriptSignature),input:i.maybe(i.Buffer)},e);const l=n.value(function(){const t=f.decode(e.address),r=t.readUInt8(0),n=t.slice(1);return{version:r,hash:n}}),h=n.value(function(){return u.decompile(e.input)}),d=e.network||c,p={network:d};if(n.prop(p,"address",function(){if(!p.hash)return;const e=t.allocUnsafe(21);return e.writeUInt8(d.pubKeyHash,0),p.hash.copy(e,1),f.encode(e)}),n.prop(p,"hash",function(){return e.output?e.output.slice(3,23):e.address?l().hash:e.pubkey||p.pubkey?a.hash160(e.pubkey||p.pubkey):void 0}),n.prop(p,"output",function(){if(p.hash)return u.compile([o.OP_DUP,o.OP_HASH160,p.hash,o.OP_EQUALVERIFY,o.OP_CHECKSIG])}),n.prop(p,"pubkey",function(){if(e.input)return h()[1]}),n.prop(p,"signature",function(){if(e.input)return h()[0]}),n.prop(p,"input",function(){if(e.pubkey&&e.signature)return u.compile([e.signature,e.pubkey])}),n.prop(p,"witness",function(){if(p.input)return[]}),r.validate){let t;if(e.address){if(l().version!==d.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(20!==l().hash.length)throw new TypeError("Invalid address");t=l().hash}if(e.hash){if(t&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(25!==e.output.length||e.output[0]!==o.OP_DUP||e.output[1]!==o.OP_HASH160||20!==e.output[2]||e.output[23]!==o.OP_EQUALVERIFY||e.output[24]!==o.OP_CHECKSIG)throw new TypeError("Output is invalid");const r=e.output.slice(3,23);if(t&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.pubkey){const r=a.hash160(e.pubkey);if(t&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.input){const r=h();if(2!==r.length)throw new TypeError("Input is invalid");if(!u.isCanonicalScriptSignature(r[0]))throw new TypeError("Input has invalid signature");if(!s.isPoint(r[1]))throw new TypeError("Input has invalid pubkey");if(e.signature&&!e.signature.equals(r[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(r[1]))throw new TypeError("Pubkey mismatch");const n=a.hash160(r[1]);if(t&&!t.equals(n))throw new TypeError("Hash mismatch")}}return Object.assign(p,e)}e.exports=l}).call(this,r(0).Buffer)},function(e,t,r){(function(t){const n=r(116),i=r(36),o=r(29),s=r(95),a=r(23),u=r(64).bitcoin,c=r(169);function f(e,t){return e.length===t.length&&e.every(function(e,r){return e.equals(t[r])})}function l(e,r){if(!(e.address||e.hash||e.output||e.redeem||e.input))throw new TypeError("Not enough data");r=Object.assign({validate:!0},r||{}),i({network:i.maybe(i.Object),address:i.maybe(i.String),hash:i.maybe(i.BufferN(20)),output:i.maybe(i.BufferN(23)),redeem:i.maybe({network:i.maybe(i.Object),output:i.maybe(i.Buffer),input:i.maybe(i.Buffer),witness:i.maybe(i.arrayOf(i.Buffer))}),input:i.maybe(i.Buffer),witness:i.maybe(i.arrayOf(i.Buffer))},e);const l=e.network||u,h={network:l},d=n.value(function(){const t=c.decode(e.address),r=t.readUInt8(0),n=t.slice(1);return{version:r,hash:n}}),p=n.value(function(){return a.decompile(e.input)}),y=n.value(function(){const t=p();return{network:l,output:t[t.length-1],input:a.compile(t.slice(0,-1)),witness:e.witness||[]}});if(n.prop(h,"address",function(){if(!h.hash)return;const e=t.allocUnsafe(21);return e.writeUInt8(l.scriptHash,0),h.hash.copy(e,1),c.encode(e)}),n.prop(h,"hash",function(){return e.output?e.output.slice(2,22):e.address?d().hash:h.redeem&&h.redeem.output?s.hash160(h.redeem.output):void 0}),n.prop(h,"output",function(){if(h.hash)return a.compile([o.OP_HASH160,h.hash,o.OP_EQUAL])}),n.prop(h,"redeem",function(){if(e.input)return y()}),n.prop(h,"input",function(){if(e.redeem&&e.redeem.input&&e.redeem.output)return a.compile([].concat(a.decompile(e.redeem.input),e.redeem.output))}),n.prop(h,"witness",function(){return h.redeem&&h.redeem.witness?h.redeem.witness:h.input?[]:void 0}),r.validate){let r;if(e.address){if(d().version!==l.scriptHash)throw new TypeError("Invalid version or Network mismatch");if(20!==d().hash.length)throw new TypeError("Invalid address");r=d().hash}if(e.hash){if(r&&!r.equals(e.hash))throw new TypeError("Hash mismatch");r=e.hash}if(e.output){if(23!==e.output.length||e.output[0]!==o.OP_HASH160||20!==e.output[1]||e.output[22]!==o.OP_EQUAL)throw new TypeError("Output is invalid");const t=e.output.slice(2,22);if(r&&!r.equals(t))throw new TypeError("Hash mismatch");r=t}const n=function(e){if(e.output){const t=a.decompile(e.output);if(!t||t.length<1)throw new TypeError("Redeem.output too short");const n=s.hash160(e.output);if(r&&!r.equals(n))throw new TypeError("Hash mismatch");r=n}if(e.input){const t=e.input.length>0,r=e.witness&&e.witness.length>0;if(!t&&!r)throw new TypeError("Empty input");if(t&&r)throw new TypeError("Input and witness provided");if(t){const t=a.decompile(e.input);if(!a.isPushOnly(t))throw new TypeError("Non push-only scriptSig")}}};if(e.input){const e=p();if(!e||e.length<1)throw new TypeError("Input too short");if(!t.isBuffer(y().output))throw new TypeError("Input is invalid");n(y())}if(e.redeem){if(e.redeem.network&&e.redeem.network!==l)throw new TypeError("Network mismatch");if(e.input){const t=y();if(e.redeem.output&&!e.redeem.output.equals(t.output))throw new TypeError("Redeem.output mismatch");if(e.redeem.input&&!e.redeem.input.equals(t.input))throw new TypeError("Redeem.input mismatch")}n(e.redeem)}if(e.witness&&e.redeem&&e.redeem.witness&&!f(e.redeem.witness,e.witness))throw new TypeError("Witness and redeem.witness mismatch")}return Object.assign(h,e)}e.exports=l}).call(this,r(0).Buffer)},function(e,t,r){(function(t){const n=r(116),i=r(36),o=r(29),s=r(114),a=r(95),u=r(302),c=r(23),f=r(64).bitcoin,l=t.alloc(0);function h(e,r){if(!(e.address||e.hash||e.output||e.pubkey||e.witness))throw new TypeError("Not enough data");r=Object.assign({validate:!0},r||{}),i({address:i.maybe(i.String),hash:i.maybe(i.BufferN(20)),input:i.maybe(i.BufferN(0)),network:i.maybe(i.Object),output:i.maybe(i.BufferN(22)),pubkey:i.maybe(s.isPoint),signature:i.maybe(c.isCanonicalScriptSignature),witness:i.maybe(i.arrayOf(i.Buffer))},e);const h=n.value(function(){const r=u.decode(e.address),n=r.words.shift(),i=u.fromWords(r.words);return{version:n,prefix:r.prefix,data:t.from(i)}}),d=e.network||f,p={network:d};if(n.prop(p,"address",function(){if(!p.hash)return;const e=u.toWords(p.hash);return e.unshift(0),u.encode(d.bech32,e)}),n.prop(p,"hash",function(){return e.output?e.output.slice(2,22):e.address?h().data:e.pubkey||p.pubkey?a.hash160(e.pubkey||p.pubkey):void 0}),n.prop(p,"output",function(){if(p.hash)return c.compile([o.OP_0,p.hash])}),n.prop(p,"pubkey",function(){return e.pubkey?e.pubkey:e.witness?e.witness[1]:void 0}),n.prop(p,"signature",function(){if(e.witness)return e.witness[0]}),n.prop(p,"input",function(){if(p.witness)return l}),n.prop(p,"witness",function(){if(e.pubkey&&e.signature)return[e.signature,e.pubkey]}),r.validate){let t;if(e.address){if(d&&d.bech32!==h().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(0!==h().version)throw new TypeError("Invalid address version");if(20!==h().data.length)throw new TypeError("Invalid address data");t=h().data}if(e.hash){if(t&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(22!==e.output.length||e.output[0]!==o.OP_0||20!==e.output[1])throw new TypeError("Output is invalid");if(t&&!t.equals(e.output.slice(2)))throw new TypeError("Hash mismatch");t=e.output.slice(2)}if(e.pubkey){const r=a.hash160(e.pubkey);if(t&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.witness){if(2!==e.witness.length)throw new TypeError("Witness is invalid");if(!c.isCanonicalScriptSignature(e.witness[0]))throw new TypeError("Witness has invalid signature");if(!s.isPoint(e.witness[1]))throw new TypeError("Witness has invalid pubkey");if(e.signature&&!e.signature.equals(e.witness[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(e.witness[1]))throw new TypeError("Pubkey mismatch");const r=a.hash160(e.witness[1]);if(t&&!t.equals(r))throw new TypeError("Hash mismatch")}}return Object.assign(p,e)}e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){(function(t){const n=r(116),i=r(36),o=r(29),s=r(302),a=r(95),u=r(23),c=r(64).bitcoin,f=t.alloc(0);function l(e,t){return e.length===t.length&&e.every(function(e,r){return e.equals(t[r])})}function h(e,r){if(!(e.address||e.hash||e.output||e.redeem||e.witness))throw new TypeError("Not enough data");r=Object.assign({validate:!0},r||{}),i({network:i.maybe(i.Object),address:i.maybe(i.String),hash:i.maybe(i.BufferN(32)),output:i.maybe(i.BufferN(34)),redeem:i.maybe({input:i.maybe(i.Buffer),network:i.maybe(i.Object),output:i.maybe(i.Buffer),witness:i.maybe(i.arrayOf(i.Buffer))}),input:i.maybe(i.BufferN(0)),witness:i.maybe(i.arrayOf(i.Buffer))},e);const h=n.value(function(){const r=s.decode(e.address),n=r.words.shift(),i=s.fromWords(r.words);return{version:n,prefix:r.prefix,data:t.from(i)}}),d=n.value(function(){return u.decompile(e.redeem.input)}),p=e.network||c,y={network:p};if(n.prop(y,"address",function(){if(!y.hash)return;const e=s.toWords(y.hash);return e.unshift(0),s.encode(p.bech32,e)}),n.prop(y,"hash",function(){return e.output?e.output.slice(2):e.address?h().data:y.redeem&&y.redeem.output?a.sha256(y.redeem.output):void 0}),n.prop(y,"output",function(){if(y.hash)return u.compile([o.OP_0,y.hash])}),n.prop(y,"redeem",function(){if(e.witness)return{output:e.witness[e.witness.length-1],input:f,witness:e.witness.slice(0,-1)}}),n.prop(y,"input",function(){if(y.witness)return f}),n.prop(y,"witness",function(){if(e.redeem&&e.redeem.input&&e.redeem.input.length>0&&e.redeem.output&&e.redeem.output.length>0){const t=u.toStack(d());return y.redeem=Object.assign({witness:t},e.redeem),y.redeem.input=f,[].concat(t,e.redeem.output)}if(e.redeem&&e.redeem.output&&e.redeem.witness)return[].concat(e.redeem.witness,e.redeem.output)}),r.validate){let t;if(e.address){if(h().prefix!==p.bech32)throw new TypeError("Invalid prefix or Network mismatch");if(0!==h().version)throw new TypeError("Invalid address version");if(32!==h().data.length)throw new TypeError("Invalid address data");t=h().data}if(e.hash){if(t&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(34!==e.output.length||e.output[0]!==o.OP_0||32!==e.output[1])throw new TypeError("Output is invalid");const r=e.output.slice(2);if(t&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.redeem){if(e.redeem.network&&e.redeem.network!==p)throw new TypeError("Network mismatch");if(e.redeem.input&&e.redeem.input.length>0&&e.redeem.witness&&e.redeem.witness.length>0)throw new TypeError("Ambiguous witness source");if(e.redeem.output){if(0===u.decompile(e.redeem.output).length)throw new TypeError("Redeem.output is invalid");const r=a.sha256(e.redeem.output);if(t&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.redeem.input&&!u.isPushOnly(d()))throw new TypeError("Non push-only scriptSig");if(e.witness&&e.redeem.witness&&!l(e.witness,e.redeem.witness))throw new TypeError("Witness and redeem.witness mismatch")}if(e.witness&&e.redeem&&e.redeem.output&&!e.redeem.output.equals(e.witness[e.witness.length-1]))throw new TypeError("Witness and redeem.output mismatch")}return Object.assign(y,e)}e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){const n=r(23).decompile,i=r(304),o=r(940),s=r(305),a=r(306),u=r(945),c=r(948),f=r(950),l=r(952),h={MULTISIG:"multisig",NONSTANDARD:"nonstandard",NULLDATA:"nulldata",P2PK:"pubkey",P2PKH:"pubkeyhash",P2SH:"scripthash",P2WPKH:"witnesspubkeyhash",P2WSH:"witnessscripthash",WITNESS_COMMITMENT:"witnesscommitment"};function d(e){if(c.output.check(e))return h.P2WPKH;if(f.output.check(e))return h.P2WSH;if(a.output.check(e))return h.P2PKH;if(u.output.check(e))return h.P2SH;const t=n(e);if(!t)throw new TypeError("Invalid script");return i.output.check(t)?h.MULTISIG:s.output.check(t)?h.P2PK:l.output.check(t)?h.WITNESS_COMMITMENT:o.output.check(t)?h.NULLDATA:h.NONSTANDARD}function p(e,t){const r=n(e);if(!r)throw new TypeError("Invalid script");return a.input.check(r)?h.P2PKH:u.input.check(r,t)?h.P2SH:i.input.check(r,t)?h.MULTISIG:s.input.check(r)?h.P2PK:h.NONSTANDARD}function y(e,t){const r=n(e);if(!r)throw new TypeError("Invalid script");return c.input.check(r)?h.P2WPKH:f.input.check(r,t)?h.P2WSH:h.NONSTANDARD}e.exports={input:p,output:d,witness:y,types:h}},function(e,t,r){const n=r(23),i=r(29);function o(e){return e===i.OP_0||n.isCanonicalScriptSignature(e)}function s(e,t){const r=n.decompile(e);return!(r.length<2)&&(r[0]===i.OP_0&&(t?r.slice(1).every(o):r.slice(1).every(n.isCanonicalScriptSignature)))}s.toJSON=function(){return"multisig input"},e.exports={check:s}},function(e,t,r){const n=r(23),i=r(74),o=r(29),s=o.OP_RESERVED;function a(e,t){const r=n.decompile(e);if(r.length<4)return!1;if(r[r.length-1]!==o.OP_CHECKMULTISIG)return!1;if(!i.Number(r[0]))return!1;if(!i.Number(r[r.length-2]))return!1;const a=r[0]-s,u=r[r.length-2]-s;if(a<=0)return!1;if(u>16)return!1;if(a>u)return!1;if(u!==r.length-3)return!1;if(t)return!0;const c=r.slice(1,-2);return c.every(n.isCanonicalPubKey)}a.toJSON=function(){return"multi-sig output"},e.exports={check:a}},function(e,t,r){const n=r(23),i=r(29);function o(e){const t=n.compile(e);return t.length>1&&t[0]===i.OP_RETURN}o.toJSON=function(){return"null data output"},e.exports={output:{check:o}}},function(e,t,r){const n=r(23);function i(e){const t=n.decompile(e);return 1===t.length&&n.isCanonicalScriptSignature(t[0])}i.toJSON=function(){return"pubKey input"},e.exports={check:i}},function(e,t,r){const n=r(23),i=r(29);function o(e){const t=n.decompile(e);return 2===t.length&&n.isCanonicalPubKey(t[0])&&t[1]===i.OP_CHECKSIG}o.toJSON=function(){return"pubKey output"},e.exports={check:o}},function(e,t,r){const n=r(23);function i(e){const t=n.decompile(e);return 2===t.length&&n.isCanonicalScriptSignature(t[0])&&n.isCanonicalPubKey(t[1])}i.toJSON=function(){return"pubKeyHash input"},e.exports={check:i}},function(e,t,r){const n=r(23),i=r(29);function o(e){const t=n.compile(e);return 25===t.length&&t[0]===i.OP_DUP&&t[1]===i.OP_HASH160&&20===t[2]&&t[23]===i.OP_EQUALVERIFY&&t[24]===i.OP_CHECKSIG}o.toJSON=function(){return"pubKeyHash output"},e.exports={check:o}},function(e,t,r){e.exports={input:r(946),output:r(947)}},function(e,t,r){const n=r(5).Buffer,i=r(23),o=r(304),s=r(305),a=r(306),u=r(478),c=r(479);function f(e,t){const r=i.decompile(e);if(r.length<1)return!1;const f=r[r.length-1];if(!n.isBuffer(f))return!1;const l=i.decompile(i.compile(r.slice(0,-1))),h=i.decompile(f);return!!h&&(!!i.isPushOnly(l)&&(1===r.length?c.check(h)||u.check(h):!(!a.input.check(l)||!a.output.check(h))||(!(!o.input.check(l,t)||!o.output.check(h))||!(!s.input.check(l)||!s.output.check(h)))))}f.toJSON=function(){return"scriptHash input"},e.exports={check:f}},function(e,t,r){const n=r(23),i=r(29);function o(e){const t=n.compile(e);return 23===t.length&&t[0]===i.OP_HASH160&&20===t[1]&&t[22]===i.OP_EQUAL}o.toJSON=function(){return"scriptHash output"},e.exports={check:o}},function(e,t,r){e.exports={input:r(949),output:r(478)}},function(e,t,r){const n=r(23);function i(e){return n.isCanonicalPubKey(e)&&33===e.length}function o(e){const t=n.decompile(e);return 2===t.length&&n.isCanonicalScriptSignature(t[0])&&i(t[1])}o.toJSON=function(){return"witnessPubKeyHash input"},e.exports={check:o}},function(e,t,r){e.exports={input:r(951),output:r(479)}},function(e,t,r){(function(t){const n=r(23),i=r(74),o=r(36),s=r(304),a=r(305),u=r(306);function c(e,r){if(o(i.Array,e),e.length<1)return!1;const c=e[e.length-1];if(!t.isBuffer(c))return!1;const f=n.decompile(c);if(!f||0===f.length)return!1;const l=n.compile(e.slice(0,-1));return!(!u.input.check(l)||!u.output.check(f))||(!(!s.input.check(l,r)||!s.output.check(f))||!(!a.input.check(l)||!a.output.check(f)))}c.toJSON=function(){return"witnessScriptHash input"},e.exports={check:c}}).call(this,r(0).Buffer)},function(e,t,r){e.exports={output:r(953)}},function(e,t,r){const n=r(5).Buffer,i=r(23),o=r(74),s=r(36),a=r(29),u=n.from("aa21a9ed","hex");function c(e){const t=i.compile(e);return t.length>37&&t[0]===a.OP_RETURN&&36===t[1]&&t.slice(2,6).equals(u)}function f(e){s(o.Hash256bit,e);const t=n.allocUnsafe(36);return u.copy(t,0),e.copy(t,4),i.compile([a.OP_RETURN,t])}function l(e){return s(c,e),i.decompile(e)[1].slice(4,36)}c.toJSON=function(){return"Witness commitment output"},e.exports={check:c,decode:l,encode:f}},function(e,t,r){let n=r(5).Buffer,i=r(169),o=r(955),s=r(114),a=r(36),u=r(476),c=a.BufferN(32),f=a.compile({wif:a.UInt8,bip32:{public:a.UInt32,private:a.UInt32}}),l={wif:128,bip32:{public:76067358,private:76066276}};function h(e,t,r,n){a(f,n),this.__d=e||null,this.__Q=t||null,this.chainCode=r,this.depth=0,this.index=0,this.network=n,this.parentFingerprint=0}Object.defineProperty(h.prototype,"identifier",{get:function(){return o.hash160(this.publicKey)}}),Object.defineProperty(h.prototype,"fingerprint",{get:function(){return this.identifier.slice(0,4)}}),Object.defineProperty(h.prototype,"privateKey",{enumerable:!1,get:function(){return this.__d}}),Object.defineProperty(h.prototype,"publicKey",{get:function(){return this.__Q||(this.__Q=s.pointFromScalar(this.__d,this.compressed)),this.__Q}}),h.prototype.isNeutered=function(){return null===this.__d},h.prototype.neutered=function(){let e=v(this.publicKey,this.chainCode,this.network);return e.depth=this.depth,e.index=this.index,e.parentFingerprint=this.parentFingerprint,e},h.prototype.toBase58=function(){let e=this.network,t=this.isNeutered()?e.bip32.public:e.bip32.private,r=n.allocUnsafe(78);return r.writeUInt32BE(t,0),r.writeUInt8(this.depth,4),r.writeUInt32BE(this.parentFingerprint,5),r.writeUInt32BE(this.index,9),this.chainCode.copy(r,13),this.isNeutered()?this.publicKey.copy(r,45):(r.writeUInt8(0,45),this.privateKey.copy(r,46)),i.encode(r)},h.prototype.toWIF=function(){if(!this.privateKey)throw new TypeError("Missing private key");return u.encode(this.network.wif,this.privateKey,!0)};let d=2147483648;h.prototype.derive=function(e){a(a.UInt32,e);let t=e>=2147483648,r=n.allocUnsafe(37);if(t){if(this.isNeutered())throw new TypeError("Missing private key for hardened child key");r[0]=0,this.privateKey.copy(r,1),r.writeUInt32BE(e,33)}else this.publicKey.copy(r,0),r.writeUInt32BE(e,33);let i=o.hmacSHA512(this.chainCode,r),u=i.slice(0,32),c=i.slice(32),f;if(!s.isPrivate(u))return this.derive(e+1);if(this.isNeutered()){let t=s.pointAddScalar(this.publicKey,u,!0);if(null===t)return this.derive(e+1);f=v(t,c,this.network)}else{let t=s.privateAdd(this.privateKey,u);if(null==t)return this.derive(e+1);f=b(t,c,this.network)}return f.depth=this.depth+1,f.index=e,f.parentFingerprint=this.fingerprint.readUInt32BE(0),f};let p=Math.pow(2,31)-1;function y(e){return a.UInt32(e)&&e<=p}function g(e){return a.String(e)&&e.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}function m(e,t){let r=i.decode(e);if(78!==r.length)throw new TypeError("Invalid buffer length");t=t||l;let n=r.readUInt32BE(0);if(n!==t.bip32.private&&n!==t.bip32.public)throw new TypeError("Invalid network version");let o=r[4],s=r.readUInt32BE(5);if(0===o&&0!==s)throw new TypeError("Invalid parent fingerprint");let a=r.readUInt32BE(9);if(0===o&&0!==a)throw new TypeError("Invalid index");let u=r.slice(13,45),c;if(n===t.bip32.private){if(0!==r.readUInt8(45))throw new TypeError("Invalid private key");let e=r.slice(46,78);c=b(e,u,t)}else{let e=r.slice(45,78);c=v(e,u,t)}return c.depth=o,c.index=a,c.parentFingerprint=s,c}function b(e,t,r){if(a({privateKey:c,chainCode:c},{privateKey:e,chainCode:t}),r=r||l,!s.isPrivate(e))throw new TypeError("Private key not in range [1, n)");return new h(e,null,t,r)}function v(e,t,r){if(a({publicKey:a.BufferN(33),chainCode:c},{publicKey:e,chainCode:t}),r=r||l,!s.isPoint(e))throw new TypeError("Point is not on the curve");return new h(null,e,t,r)}function _(e,t){if(a(a.Buffer,e),e.length<16)throw new TypeError("Seed should be at least 128 bits");if(e.length>64)throw new TypeError("Seed should be at most 512 bits");t=t||l;let r=o.hmacSHA512("Bitcoin seed",e),n=r.slice(0,32),i=r.slice(32);return b(n,i,t)}h.prototype.deriveHardened=function(e){return a(y,e),this.derive(e+2147483648)},h.prototype.derivePath=function(e){a(g,e);let t=e.split("/");if("m"===t[0]){if(this.parentFingerprint)throw new TypeError("Expected master, got child");t=t.slice(1)}return t.reduce(function(e,t){let r;return"'"===t.slice(-1)?(r=parseInt(t.slice(0,-1),10),e.deriveHardened(r)):(r=parseInt(t,10),e.derive(r))},this)},h.prototype.sign=function(e){return s.sign(e,this.privateKey)},h.prototype.verify=function(e,t){return s.verify(e,this.publicKey,t)},e.exports={fromBase58:m,fromPrivateKey:b,fromPublicKey:v,fromSeed:_}},function(e,t,r){let n=r(133),i=r(298);function o(e){return n("rmd160").update(n("sha256").update(e).digest()).digest()}function s(e,t){return i("sha512",e).update(t).digest()}e.exports={hash160:o,hmacSHA512:s}},function(e,t,r){const n=r(229),i=r(170),o=r(5).Buffer;var s=e.exports=function(e){var t=[{name:"nonce",default:o.alloc(0)},{name:"balance",default:o.alloc(0)},{name:"stateRoot",length:32,default:n.SHA3_RLP},{name:"codeHash",length:32,default:n.SHA3_NULL}];n.defineProperties(this,t,e)};s.prototype.serialize=function(){return i.encode(this.raw)},s.prototype.isContract=function(){return this.codeHash.toString("hex")!==n.SHA3_NULL_S},s.prototype.getCode=function(e,t){this.isContract()?e.getRaw(this.codeHash,t):t(null,o.alloc(0))},s.prototype.setCode=function(e,t,r){var i=this;this.codeHash=n.sha3(t),this.codeHash.toString("hex")!==n.SHA3_NULL_S?e.putRaw(this.codeHash,t,function(e){r(e,i.codeHash)}):r(null,o.alloc(0))},s.prototype.getStorage=function(e,t,r){var n=e.copy();n.root=this.stateRoot,n.get(t,r)},s.prototype.setStorage=function(e,t,r,n){var i=this,o=e.copy();o.root=i.stateRoot,o.put(t,r,function(e){if(e)return n();i.stateRoot=o.root,n()})},s.prototype.isEmpty=function(){return""===this.balance.toString("hex")&&""===this.nonce.toString("hex")&&this.stateRoot.toString("hex")===n.SHA3_RLP_S&&this.codeHash.toString("hex")===n.SHA3_NULL_S}},function(e,t,r){"use strict";e.exports=r(958)(r(961))},function(e,t,r){"use strict";var n=r(959),i=r(960);e.exports=function(e){var t=n(e),r=i(e);return function(e,n){var i="string"==typeof e?e.toLowerCase():e;switch(i){case"keccak224":return new t(1152,448,null,224,n);case"keccak256":return new t(1088,512,null,256,n);case"keccak384":return new t(832,768,null,384,n);case"keccak512":return new t(576,1024,null,512,n);case"sha3-224":return new t(1152,448,6,224,n);case"sha3-256":return new t(1088,512,6,256,n);case"sha3-384":return new t(832,768,6,384,n);case"sha3-512":return new t(576,1024,6,512,n);case"shake128":return new r(1344,256,31,n);case"shake256":return new r(1088,512,31,n);default:throw new Error("Invald algorithm: "+e)}}}},function(e,t,r){"use strict";var n=r(5).Buffer,i=r(94).Transform,o=r(1);e.exports=function(e){function t(t,r,n,o,s){i.call(this,s),this._rate=t,this._capacity=r,this._delimitedSuffix=n,this._hashBitLength=o,this._options=s,this._state=new e,this._state.initialize(t,r),this._finalized=!1}return o(t,i),t.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(e){n=e}r(n)},t.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},t.prototype.update=function(e,t){if(!n.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return n.isBuffer(e)||(e=n.from(e,t)),this._state.absorb(e),this},t.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);var t=this._state.squeeze(this._hashBitLength/8);return void 0!==e&&(t=t.toString(e)),this._resetState(),t},t.prototype._resetState=function(){return this._state.initialize(this._rate,this._capacity),this},t.prototype._clone=function(){var e=new t(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e},t}},function(e,t,r){"use strict";var n=r(5).Buffer,i=r(94).Transform,o=r(1);e.exports=function(e){function t(t,r,n,o){i.call(this,o),this._rate=t,this._capacity=r,this._delimitedSuffix=n,this._options=o,this._state=new e,this._state.initialize(t,r),this._finalized=!1}return o(t,i),t.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(e){n=e}r(n)},t.prototype._flush=function(){},t.prototype._read=function(e){this.push(this.squeeze(e))},t.prototype.update=function(e,t){if(!n.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return n.isBuffer(e)||(e=n.from(e,t)),this._state.absorb(e),this},t.prototype.squeeze=function(e,t){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));var r=this._state.squeeze(e);return void 0!==t&&(r=r.toString(t)),r},t.prototype._resetState=function(){return this._state.initialize(this._rate,this._capacity),this},t.prototype._clone=function(){var e=new t(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e},t}},function(e,t,r){"use strict";var n=r(5).Buffer,i=r(962);function o(){this.state=[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],this.blockSize=null,this.count=0,this.squeezing=!1}o.prototype.initialize=function(e,t){for(var r=0;r<50;++r)this.state[r]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1},o.prototype.absorb=function(e){for(var t=0;t>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(i.p1600(this.state),this.count=0);return t},o.prototype.copy=function(e){for(var t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing},e.exports=o},function(e,t,r){"use strict";var n=[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];t.p1600=function(e){for(var t=0;t<24;++t){var r=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],a=e[4]^e[14]^e[24]^e[34]^e[44],u=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],l=e[8]^e[18]^e[28]^e[38]^e[48],h=e[9]^e[19]^e[29]^e[39]^e[49],d=l^(o<<1|s>>>31),p=h^(s<<1|o>>>31),y=e[0]^d,g=e[1]^p,m=e[10]^d,b=e[11]^p,v=e[20]^d,_=e[21]^p,w=e[30]^d,S=e[31]^p,E=e[40]^d,k=e[41]^p;d=r^(a<<1|u>>>31),p=i^(u<<1|a>>>31);var A=e[2]^d,x=e[3]^p,C=e[12]^d,T=e[13]^p,I=e[22]^d,B=e[23]^p,O=e[32]^d,P=e[33]^p,R=e[42]^d,N=e[43]^p;d=o^(c<<1|f>>>31),p=s^(f<<1|c>>>31);var j=e[4]^d,L=e[5]^p,M=e[14]^d,D=e[15]^p,U=e[24]^d,F=e[25]^p,K=e[34]^d,q=e[35]^p,H=e[44]^d,z=e[45]^p;d=a^(l<<1|h>>>31),p=u^(h<<1|l>>>31);var V=e[6]^d,G=e[7]^p,W=e[16]^d,$=e[17]^p,Y=e[26]^d,J=e[27]^p,X=e[36]^d,Z=e[37]^p,Q=e[46]^d,ee=e[47]^p;d=c^(r<<1|i>>>31),p=f^(i<<1|r>>>31);var te=e[8]^d,re=e[9]^p,ne=e[18]^d,ie=e[19]^p,oe=e[28]^d,se=e[29]^p,ae=e[38]^d,ue=e[39]^p,ce=e[48]^d,fe=e[49]^p,le=y,he=g,de=b<<4|m>>>28,pe=m<<4|b>>>28,ye=v<<3|_>>>29,ge=_<<3|v>>>29,me=S<<9|w>>>23,be=w<<9|S>>>23,ve=E<<18|k>>>14,_e=k<<18|E>>>14,we=A<<1|x>>>31,Se=x<<1|A>>>31,Ee=T<<12|C>>>20,ke=C<<12|T>>>20,Ae=I<<10|B>>>22,xe=B<<10|I>>>22,Ce=P<<13|O>>>19,Te=O<<13|P>>>19,Ie=R<<2|N>>>30,Be=N<<2|R>>>30,Oe=L<<30|j>>>2,Pe=j<<30|L>>>2,Re=M<<6|D>>>26,Ne=D<<6|M>>>26,je=F<<11|U>>>21,Le=U<<11|F>>>21,Me=K<<15|q>>>17,De=q<<15|K>>>17,Ue=z<<29|H>>>3,Fe=H<<29|z>>>3,Ke=V<<28|G>>>4,qe=G<<28|V>>>4,He=$<<23|W>>>9,ze=W<<23|$>>>9,Ve=Y<<25|J>>>7,Ge=J<<25|Y>>>7,We=X<<21|Z>>>11,$e=Z<<21|X>>>11,Ye=ee<<24|Q>>>8,Je=Q<<24|ee>>>8,Xe=te<<27|re>>>5,Ze=re<<27|te>>>5,Qe=ne<<20|ie>>>12,et=ie<<20|ne>>>12,tt=se<<7|oe>>>25,rt=oe<<7|se>>>25,nt=ae<<8|ue>>>24,it=ue<<8|ae>>>24,ot=ce<<14|fe>>>18,st=fe<<14|ce>>>18;e[0]=le^~Ee&je,e[1]=he^~ke&Le,e[10]=Ke^~Qe&ye,e[11]=qe^~et&ge,e[20]=we^~Re&Ve,e[21]=Se^~Ne&Ge,e[30]=Xe^~de&Ae,e[31]=Ze^~pe&xe,e[40]=Oe^~He&tt,e[41]=Pe^~ze&rt,e[2]=Ee^~je&We,e[3]=ke^~Le&$e,e[12]=Qe^~ye&Ce,e[13]=et^~ge&Te,e[22]=Re^~Ve&nt,e[23]=Ne^~Ge&it,e[32]=de^~Ae&Me,e[33]=pe^~xe&De,e[42]=He^~tt&me,e[43]=ze^~rt&be,e[4]=je^~We&ot,e[5]=Le^~$e&st,e[14]=ye^~Ce&Ue,e[15]=ge^~Te&Fe,e[24]=Ve^~nt&ve,e[25]=Ge^~it&_e,e[34]=Ae^~Me&Ye,e[35]=xe^~De&Je,e[44]=tt^~me&Ie,e[45]=rt^~be&Be,e[6]=We^~ot&le,e[7]=$e^~st&he,e[16]=Ce^~Ue&Ke,e[17]=Te^~Fe&qe,e[26]=nt^~ve&we,e[27]=it^~_e&Se,e[36]=Me^~Ye&Xe,e[37]=De^~Je&Ze,e[46]=me^~Ie&Oe,e[47]=be^~Be&Pe,e[8]=ot^~le&Ee,e[9]=st^~he&ke,e[18]=Ue^~Ke&Qe,e[19]=Fe^~qe&et,e[28]=ve^~we&Re,e[29]=_e^~Se&Ne,e[38]=Ye^~Xe&de,e[39]=Je^~Ze&pe,e[48]=Ie^~Oe&He,e[49]=Be^~Pe&ze,e[0]^=n[2*t],e[1]^=n[2*t+1]}}},function(e,t,r){"use strict";e.exports=r(481)(r(966))},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(5).Buffer,i=r(296),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 l=e.slice(u,u+a);for(l.copy(t,32-l.length);c>0&&0===e[f];c-=1,f+=1);if(!(c>32)){var h=e.slice(f,f+c);return h.copy(r,32-h.length),{r:t,s:r}}}}}}}}}},function(e,t,r){"use strict";var n=r(5).Buffer,i=r(133),o=r(31),s=r(57).ec,a=r(307),u=new s("secp256k1"),c=u.curve;function f(e,t){var r=new o(t);if(r.cmp(c.p)>=0)return null;r=r.toRed(c.red);var n=r.redSqr().redIMul(r).redIAdd(c.b).redSqrt();return 3===e!==n.isOdd()&&(n=n.redNeg()),u.keyPair({pub:{x:r,y:n}})}function l(e,t,r){var n=new o(t),i=new o(r);if(n.cmp(c.p)>=0||i.cmp(c.p)>=0)return null;if(n=n.toRed(c.red),i=i.toRed(c.red),(6===e||7===e)&&i.isOdd()!==(7===e))return null;var s=n.redSqr().redIMul(n);return i.redSqr().redISub(s.redIAdd(c.b)).isZero()?u.keyPair({pub:{x:n,y:i}}):null}function h(e){var t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:f(t,e.slice(1,33));case 4:case 6:case 7:return 65!==e.length?null:l(t,e.slice(1,33),e.slice(33,65));default:return null}}t.privateKeyVerify=function(e){var t=new o(e);return t.cmp(c.n)<0&&!t.isZero()},t.privateKeyExport=function(e,t){var r=new o(e);if(r.cmp(c.n)>=0||r.isZero())throw new Error(a.EC_PRIVATE_KEY_EXPORT_DER_FAIL);return n.from(u.keyFromPrivate(e).getPublic(t,!0))},t.privateKeyNegate=function(e){var t=new o(e);return t.isZero()?n.alloc(32):c.n.sub(t).umod(c.n).toArrayLike(n,"be",32)},t.privateKeyModInverse=function(e){var t=new o(e);if(t.cmp(c.n)>=0||t.isZero())throw new Error(a.EC_PRIVATE_KEY_RANGE_INVALID);return t.invm(c.n).toArrayLike(n,"be",32)},t.privateKeyTweakAdd=function(e,t){var r=new o(t);if(r.cmp(c.n)>=0)throw new Error(a.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);if(r.iadd(new o(e)),r.cmp(c.n)>=0&&r.isub(c.n),r.isZero())throw new Error(a.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);return r.toArrayLike(n,"be",32)},t.privateKeyTweakMul=function(e,t){var r=new o(t);if(r.cmp(c.n)>=0||r.isZero())throw new Error(a.EC_PRIVATE_KEY_TWEAK_MUL_FAIL);return r.imul(new o(e)),r.cmp(c.n)&&(r=r.umod(c.n)),r.toArrayLike(n,"be",32)},t.publicKeyCreate=function(e,t){var r=new o(e);if(r.cmp(c.n)>=0||r.isZero())throw new Error(a.EC_PUBLIC_KEY_CREATE_FAIL);return n.from(u.keyFromPrivate(e).getPublic(t,!0))},t.publicKeyConvert=function(e,t){var r=h(e);if(null===r)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);return n.from(r.getPublic(t,!0))},t.publicKeyVerify=function(e){return null!==h(e)},t.publicKeyTweakAdd=function(e,t,r){var i=h(e);if(null===i)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);if(t=new o(t),t.cmp(c.n)>=0)throw new Error(a.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);return n.from(c.g.mul(t).add(i.pub).encode(!0,r))},t.publicKeyTweakMul=function(e,t,r){var i=h(e);if(null===i)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);if(t=new o(t),t.cmp(c.n)>=0||t.isZero())throw new Error(a.EC_PUBLIC_KEY_TWEAK_MUL_FAIL);return n.from(i.pub.mul(t).encode(!0,r))},t.publicKeyCombine=function(e,t){for(var r=new Array(e.length),i=0;i=0||r.cmp(c.n)>=0)throw new Error(a.ECDSA_SIGNATURE_PARSE_FAIL);var i=n.from(e);return 1===r.cmp(u.nh)&&c.n.sub(r).toArrayLike(n,"be",32).copy(i,32),i},t.signatureExport=function(e){var t=e.slice(0,32),r=e.slice(32,64);if(new o(t).cmp(c.n)>=0||new o(r).cmp(c.n)>=0)throw new Error(a.ECDSA_SIGNATURE_PARSE_FAIL);return{r:t,s:r}},t.signatureImport=function(e){var t=new o(e.r);t.cmp(c.n)>=0&&(t=new o(0));var r=new o(e.s);return r.cmp(c.n)>=0&&(r=new o(0)),n.concat([t.toArrayLike(n,"be",32),r.toArrayLike(n,"be",32)])},t.sign=function(e,t,r,i){if("function"==typeof r){var s=r;r=function(r){var u=s(e,t,null,i,r);if(!n.isBuffer(u)||32!==u.length)throw new Error(a.ECDSA_SIGN_FAIL);return new o(u)}}var f=new o(t);if(f.cmp(c.n)>=0||f.isZero())throw new Error(a.ECDSA_SIGN_FAIL);var l=u.sign(e,t,{canonical:!0,k:r,pers:i});return{signature:n.concat([l.r.toArrayLike(n,"be",32),l.s.toArrayLike(n,"be",32)]),recovery:l.recoveryParam}},t.verify=function(e,t,r){var n={r:t.slice(0,32),s:t.slice(32,64)},i=new o(n.r),s=new o(n.s);if(i.cmp(c.n)>=0||s.cmp(c.n)>=0)throw new Error(a.ECDSA_SIGNATURE_PARSE_FAIL);if(1===s.cmp(u.nh)||i.isZero()||s.isZero())return!1;var f=h(r);if(null===f)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);return u.verify(e,n,{x:f.pub.x,y:f.pub.y})},t.recover=function(e,t,r,i){var s={r:t.slice(0,32),s:t.slice(32,64)},f=new o(s.r),l=new o(s.s);if(f.cmp(c.n)>=0||l.cmp(c.n)>=0)throw new Error(a.ECDSA_SIGNATURE_PARSE_FAIL);try{if(f.isZero()||l.isZero())throw new Error;var h=u.recoverPubKey(e,s,r);return n.from(h.encode(!0,i))}catch(e){throw new Error(a.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 i=h(e);if(null===i)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);var s=new o(t);if(s.cmp(c.n)>=0||s.isZero())throw new Error(a.ECDH_FAIL);return n.from(i.pub.mul(s).encode(!0,r))}},function(e,t,r){"use strict";(function(t){var n=r(482),i=r(968);function o(e){var t=e;if("string"!=typeof t)throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof t+", while padToEven.");return t.length%2&&(t="0"+t),t}function s(e){var t=e.toString(16);return"0x"+t}function a(e){var r=s(e);return new t(o(r.slice(2)),"hex")}function u(e){if("string"!=typeof e)throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof e+"'.");return t.byteLength(e,"utf8")}function c(e,t,r){if(!0!==Array.isArray(e))throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof e+"'");if(!0!==Array.isArray(t))throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof t+"'");return t[Boolean(r)?"some":"every"](function(t){return e.indexOf(t)>=0})}function f(e){var r=new t(o(i(e).replace(/^0+|0+$/g,"")),"hex");return r.toString("utf8")}function l(e){var t="",r=0,n=e.length;for("0x"===e.substring(0,2)&&(r=2);r0))return!0;for(let t of this._supportedHardforks)if(e===t)return!0;return!1}param(e,t,r){let n;r=this._chooseHardfork(r);for(let o of i){if(!o[1][e])throw new Error(`Topic ${e} not defined`);if(void 0!==o[1][e][t]&&(n=o[1][e][t].v),o[0]===r)break}if(void 0===n)throw new Error(`${e} value for ${t} not found`);return n}paramByBlock(e,t,r){let n=this.activeHardforks(r),i=n[n.length-1].name;return this.param(e,t,i)}hardforkIsActiveOnBlock(e,t,r){r=void 0!==r?r:[];let n=void 0!==r.onlySupported&&r.onlySupported;e=this._chooseHardfork(e,n);let i=this.hardforkBlock(e);return null!==i&&t>=i}activeOnBlock(e,t){return this.hardforkIsActiveOnBlock(null,e,t)}hardforkGteHardfork(e,t,r){r=void 0!==r?r:[];let n=void 0!==r.onlyActive&&r.onlyActive,i,o,s;e=this._chooseHardfork(e,r.onlySupported),i=n?this.activeHardforks(null,r):this.hardforks();let a=0;for(let r of i)r.name===e&&(o=a),r.name===t&&(s=a),a+=1;return o>=s}gteHardfork(e,t){return this.hardforkGteHardfork(null,e,t)}hardforkIsActiveOnChain(e,t){t=void 0!==t?t:[];let r=void 0!==t.onlySupported&&t.onlySupported;e=this._chooseHardfork(e,r);for(let t of this.hardforks())if(t.name===e&&null!==t.block)return!0;return!1}activeHardforks(e,t){t=void 0!==t?t:[];let r=[],n=this.hardforks();for(let i of n)if(null!==i.block){if(void 0!==e&&null!==e&&e0)return r[r.length-1].name;throw new Error("No (supported) active hardfork found")}hardforkBlock(e){return e=this._chooseHardfork(e,!1),this._getHardfork(e).block}isHardforkBlock(e,t){return t=this._chooseHardfork(t,!1),this.hardforkBlock(t)===e}consensus(e){return e=this._chooseHardfork(e),this._getHardfork(e).consensus}finality(e){return e=this._chooseHardfork(e),this._getHardfork(e).finality}genesis(){return this._chainParams.genesis}hardforks(){return this._chainParams.hardforks}bootstrapNodes(){return this._chainParams.bootstrapNodes}hardfork(){return this._hardfork}chainId(){return this._chainParams.chainId}chainName(){return n.names[this.chainId()]||this._chainParams.name}networkId(){return this._chainParams.networkId}}e.exports=o},function(e,t,r){var n={names:{}};n.names[1]="mainnet",n.names[3]="ropsten",n.names[4]="rinkeby",n.names[42]="kovan",n.names[6284]="goerli",n.mainnet=r(972),n.ropsten=r(973),n.rinkeby=r(974),n.kovan=r(975),n.goerli=r(976),e.exports=n},function(e){e.exports={name:"mainnet",chainId:1,networkId:1,comment:"The Ethereum main chain",url:"https://ethstats.net/",genesis:{hash:"0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",timestamp:null,gasLimit:5e3,difficulty:17179869184,nonce:"0x0000000000000042",extraData:"0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",stateRoot:"0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544"},hardforks:[{name:"chainstart",block:0,consensus:"pow",finality:null},{name:"homestead",block:115e4,consensus:"pow",finality:null},{name:"dao",block:192e4,consensus:"pow",finality:null},{name:"tangerineWhistle",block:2463e3,consensus:"pow",finality:null},{name:"spuriousDragon",block:2675e3,consensus:"pow",finality:null},{name:"byzantium",block:437e4,consensus:"pow",finality:null},{name:"constantinople",block:null,consensus:"pow",finality:null},{name:"hybridCasper",block:null,consensus:"pow",finality:"pos"}],bootstrapNodes:[{ip:"13.93.211.84",port:30303,id:"3f1d12044546b76342d59d4a05532c14b85aa669704bfe1f864fe079415aa2c02d743e03218e57a33fb94523adb54032871a6c51b2cc5514cb7c7e35b3ed0a99",location:"US-WEST",comment:"Go Bootnode"},{ip:"191.235.84.50",port:30303,id:"78de8a0916848093c73790ead81d1928bec737d565119932b98c6b100d944b7a95e94f847f689fc723399d2e31129d182f7ef3863f2b4c820abbf3ab2722344d",location:"BR",comment:"Go Bootnode"},{ip:"13.75.154.138",port:30303,id:"158f8aab45f6d19c6cbf4a089c2670541a8da11978a2f90dbf6a502a4a3bab80d288afdbeb7ec0ef6d92de563767f3b1ea9e8e334ca711e9f8e2df5a0385e8e6",location:"AU",comment:"Go Bootnode"},{ip:"52.74.57.123",port:30303,id:"1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082",location:"SG",comment:"Go Bootnode"}]}},function(e){e.exports={name:"ropsten",chainId:3,networkId:3,comment:"PoW test network",url:"https://github.com/ethereum/ropsten",genesis:{hash:"0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d",timestamp:null,gasLimit:16777216,difficulty:1048576,nonce:"0x0000000000000042",extraData:"0x3535353535353535353535353535353535353535353535353535353535353535",stateRoot:"0x217b0bbcfb72e2d57e28f33cb361b9983513177755dc3f33ce3e7022ed62b77b"},hardforks:[{name:"chainstart",block:0,consensus:"pow",finality:null},{name:"homestead",block:0,consensus:"pow",finality:null},{name:"dao",block:null,consensus:"pow",finality:null},{name:"tangerineWhistle",block:0,consensus:"pow",finality:null},{name:"spuriousDragon",block:10,consensus:"pow",finality:null},{name:"byzantium",block:17e5,consensus:"pow",finality:null},{name:"constantinople",block:null,consensus:"pow",finality:null},{name:"hybridCasper",block:null,consensus:"pow",finality:"pos"}],bootstrapNodes:[{ip:"52.176.7.10",port:"30303",id:"30b7ab30a01c124a6cceca36863ece12c4f5fa68e3ba9b0b51407ccc002eeed3b3102d20a88f1c1d3c3154e2449317b8ef95090e77b312d5cc39354f86d5d606",network:"Ropsten",chainId:3,location:"US",comment:"US-Azure geth"},{ip:"52.176.100.77",port:"30303",id:"865a63255b3bb68023b6bffd5095118fcc13e79dcf014fe4e47e065c350c7cc72af2e53eff895f11ba1bbb6a2b33271c1116ee870f266618eadfc2e78aa7349c",network:"Ropsten",chainId:3,location:"US",comment:"US-Azure parity"},{ip:"52.232.243.152",port:"30303",id:"6332792c4a00e3e4ee0926ed89e0d27ef985424d97b6a45bf0f23e51f0dcb5e66b875777506458aea7af6f9e4ffb69f43f3778ee73c81ed9d34c51c4b16b0b0f",network:"Ropsten",chainId:3,location:"US",comment:"Parity"},{ip:"192.81.208.223",port:"30303",id:"94c15d1b9e2fe7ce56e458b9a3b672ef11894ddedd0c6f247e0f1d3487f52b66208fb4aeb8179fce6e3a749ea93ed147c37976d67af557508d199d9594c35f09",network:"Ropsten",chainId:3,location:"US",comment:"@gpip"}]}},function(e){e.exports={name:"rinkeby",chainId:4,networkId:4,comment:"PoA test network",url:"https://www.rinkeby.io",genesis:{hash:"0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177",timestamp:"0x58ee40ba",gasLimit:47e5,difficulty:1,nonce:"0x0000000000000000",extraData:"0x52657370656374206d7920617574686f7269746168207e452e436172746d616e42eb768f2244c8811c63729a21a3569731535f067ffc57839b00206d1ad20c69a1981b489f772031b279182d99e65703f0076e4812653aab85fca0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",stateRoot:"0x53580584816f617295ea26c0e17641e0120cab2f0a8ffb53a866fd53aa8e8c2d"},hardforks:[{name:"chainstart",block:0,consensus:"poa",finality:null},{name:"homestead",block:1,consensus:"poa",finality:null},{name:"dao",block:null,consensus:"poa",finality:null},{name:"tangerineWhistle",block:2,consensus:"poa",finality:null},{name:"spuriousDragon",block:3,consensus:"poa",finality:null},{name:"byzantium",block:1035301,consensus:"poa",finality:null},{name:"constantinople",block:null,consensus:"poa",finality:null},{name:"hybridCasper",block:null,consensus:"poa",finality:"pos"}],bootstrapNodes:[{ip:"52.169.42.101",port:30303,id:"a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf",location:"IE",comment:""},{ip:"52.3.158.184",port:30303,id:"343149e4feefa15d882d9fe4ac7d88f885bd05ebb735e547f12e12080a9fa07c8014ca6fd7f373123488102fe5e34111f8509cf0b7de3f5b44339c9f25e87cb8",location:"",comment:"INFURA"}]}},function(e){e.exports={name:"kovan",chainId:42,networkId:42,comment:"Parity PoA test network",url:"https://kovan-testnet.github.io/website/",genesis:{hash:"0xa3c565fc15c7478862d50ccd6561e3c06b24cc509bf388941c25ea985ce32cb9",timestamp:null,gasLimit:6e6,difficulty:131072,nonce:"0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",extraData:"0x",stateRoot:"0x2480155b48a1cea17d67dbfdfaafe821c1d19cdd478c5358e8ec56dec24502b2"},hardforks:[],bootstrapNodes:[{ip:"40.71.221.215",port:30303,id:"56abaf065581a5985b8c5f4f88bd202526482761ba10be9bfdcd14846dd01f652ec33fde0f8c0fd1db19b59a4c04465681fcef50e11380ca88d25996191c52de",location:"",comment:"Parity Bootnode"},{ip:"52.166.117.77",port:30303,id:"d07827483dc47b368eaf88454fb04b41b7452cf454e194e2bd4c14f98a3278fed5d819dbecd0d010407fc7688d941ee1e58d4f9c6354d3da3be92f55c17d7ce3",location:"",comment:"Parity Bootnode"},{ip:"52.165.239.18",port:30303,id:"8fa162563a8e5a05eef3e1cd5abc5828c71344f7277bb788a395cce4a0e30baf2b34b92fe0b2dbbba2313ee40236bae2aab3c9811941b9f5a7e8e90aaa27ecba",location:"",comment:"Parity Bootnode"},{ip:"52.243.47.56",port:30303,id:"7e2e7f00784f516939f94e22bdc6cf96153603ca2b5df1c7cc0f90a38e7a2f218ffb1c05b156835e8b49086d11fdd1b3e2965be16baa55204167aa9bf536a4d9",location:"",comment:"Parity Bootnode"},{ip:"40.68.248.100",port:30303,id:"0518a3d35d4a7b3e8c433e7ffd2355d84a1304ceb5ef349787b556197f0c87fad09daed760635b97d52179d645d3e6d16a37d2cc0a9945c2ddf585684beb39ac",location:"",comment:"Parity Bootnode"}]}},function(e){e.exports={name:"goerli",chainId:6284,networkId:6284,comment:"Cross-client PoA test network",url:"https://github.com/goerli/testnet",genesis:{hash:"0xfa57319d09fd8a32faaf18d338c8a925a5a7975285bf29ecd024e083cba8abb1",timestamp:"0x5bdda800",gasLimit:10485760,difficulty:1,nonce:"0x0000000000000000",extraData:"0x2249276d20646f6e652077616974696e672e2e2e20666f7220626c6f636b2066696e616c69747922202d2049676779270000000001fa1804c408085d9c57eeb167ce953c99b6cb1e20794Fd02933F303FbA550bd1fe2f0649E3576eB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",stateRoot:"0x0f410b6a6eae3d3156eccd966ac842a4c545c47921b9fe36386de18152cfddcf"},hardforks:[{name:"chainstart",block:0,consensus:"poa",finality:null},{name:"homestead",block:0,consensus:"poa",finality:null},{name:"dao",block:null,consensus:"poa",finality:null},{name:"tangerineWhistle",block:0,consensus:"poa",finality:null},{name:"spuriousDragon",block:0,consensus:"poa",finality:null},{name:"byzantium",block:0,consensus:"poa",finality:null},{name:"constantinople",block:0,consensus:"poa",finality:null},{name:"hybridCasper",block:null,consensus:"poa",finality:"pos"}],bootstrapNodes:[{ip:"40.70.214.166",port:40303,id:"04fb7acb86f47b64298374b5ccb3c2959f1e5e9362158e50e0793c261518ffe83759d8295ca4a88091d4726d5f85e6276d53ae9ef4f35b8c4c0cc6b99c8c0537",location:"",comment:""},{ip:"213.186.16.82",port:1345,id:"17de5580bbc1620081a21f82954731c7854305463630a0d677ed991487609829a6bf1ffcb8fb8ef269eff4829690625db176b498c629b9b13cb39b73b6e7b08b",location:"",comment:""},{ip:"85.7.110.224",port:30303,id:"22da3ef3707626a92a32b0527d0846f88228daa0536c62d83c9ac7e96660bc8e4ac70a9aa8f8cedf71b580cd41449ad46c6e5a06ecf138b142f38a9d1b2b856a",location:"",comment:""},{ip:"54.88.169.219",port:30303,id:"3897b1a5786948f643d9755df92dc56d0b2284f36730dc198ef371aebf191b24b5cbe8162c2032b09b2f14ba73460bfc3f7d4ef1e26bcc59297d4f235dc5cdc5",location:"",comment:""},{ip:"40.70.214.166",port:30405,id:"3d197d65ed92af6d0adf280ce486714fb641ef9f9f38f0bdd5ddd552666fc1132f033eb249a87f7f30086902c131f30f054f872ae80ac83eea6bd3760a7bbce2",location:"",comment:""},{ip:"188.166.20.30",port:30303,id:"3d8d6698d2d4d730d896c7c1e3602ff845343f71bacbf8cb614b0e94fcb3b10e1a49ac2a5063c76617182a1c5928a4a63d4be897e54ae1cb858a1b94d0d275b8",location:"",comment:""},{ip:"94.237.54.114",port:30313,id:"46add44b9f13965f7b9875ac6b85f016f341012d84f975377573800a863526f4da19ae2c620ec73d11591fa9510e992ecc03ad0751f53cc02f7c7ed6d55c7291",location:"",comment:""},{ip:"13.113.211.0",port:30303,id:"5065d5221b507764771a8b74abc69df0351217eae09b96ec0df4275576a8b2bbba9986ce3037e6fb3c933b5b301364e18030c1ada8cec4ae00f1fa4dfff32eb8",location:"",comment:""},{ip:"52.56.136.200",port:30303,id:"573b6607cd59f241e30e4c4943fd50e99e2b6f42f9bd5ca111659d309c06741247f4f1e93843ad3e8c8c18b6e2d94c161b7ef67479b3938780a97134b618b5ce",location:"",comment:""},{ip:"213.186.16.82",port:30303,id:"57f58f16fccdd9fb6f587565ac09af4b3b4b33d0fbd14252cc61d29a65b0d83c08419e67ac5292b9342090053526b847f2487278e609f4b4cd1dbf0f48105b2b",location:"",comment:""},{ip:"13.78.10.94",port:30405,id:"5d9b1cba03738dfd23e12e4efb99b72623474fece2cc582c95e3ba7d481d519dea0029901f1f844116bab806044e8552f0431b21cf8d96010fc351b483330faa",location:"",comment:""}]}},function(e,t,r){const n=[["chainstart",r(978)],["homestead",r(979)],["dao",r(980)],["tangerineWhistle",r(981)],["spuriousDragon",r(982)],["byzantium",r(983)],["constantinople",r(984)],["hybridCasper",r(985)]];e.exports=n},function(e){e.exports={name:"chainstart",comment:"Start of the Ethereum main chain",eip:{url:"",status:""},status:"",gasConfig:{minGasLimit:{v:5e3,d:"Minimum the gas limit may ever be"},gasLimitBoundDivisor:{v:1024,d:"The bound divisor of the gas limit, used in update calculations"}},gasPrices:{tierStep:{v:[0,2,3,5,8,10,20],d:"Once per operation, for a selection of them"},exp:{v:10,d:"Once per EXP instuction"},expByte:{v:10,d:"Times ceil(log256(exponent)) for the EXP instruction"},sha3:{v:30,d:"Once per SHA3 operation"},sha3Word:{v:6,d:"Once per word of the SHA3 operation's data"},sload:{v:50,d:"Once per SLOAD operation"},sstoreSet:{v:2e4,d:"Once per SSTORE operation if the zeroness changes from zero"},sstoreReset:{v:5e3,d:"Once per SSTORE operation if the zeroness does not change from zero"},sstoreRefund:{v:15e3,d:"Once per SSTORE operation if the zeroness changes to zero"},jumpdest:{v:1,d:"Refunded gas, once per SSTORE operation if the zeroness changes to zero"},log:{v:375,d:"Per LOG* operation"},logData:{v:8,d:"Per byte in a LOG* operation's data"},logTopic:{v:375,d:"Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas"},create:{v:32e3,d:"Once per CREATE operation & contract-creation transaction"},call:{v:40,d:"Once per CALL operation & message call transaction"},callStipend:{v:2300,d:"Free gas given at beginning of call"},callValueTransfer:{v:9e3,d:"Paid for CALL when the value transfor is non-zero"},callNewAccount:{v:25e3,d:"Paid for CALL when the destination address didn't exist prior"},selfdestructRefund:{v:24e3,d:"Refunded following a selfdestruct operation"},memory:{v:3,d:"Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL"},quadCoeffDiv:{v:512,d:"Divisor for the quadratic particle of the memory cost equation"},createData:{v:200,d:""},tx:{v:21e3,d:"Per transaction. NOTE: Not payable on data of calls between transactions"},txCreation:{v:32e3,d:"The cost of creating a contract via tx"},txDataZero:{v:4,d:"Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions"},txDataNonZero:{v:68,d:"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions"},copy:{v:3,d:"Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added"},ecRecover:{v:3e3,d:""},sha256:{v:60,d:""},sha256Word:{v:12,d:""},ripemd160:{v:600,d:""},ripemd160Word:{v:120,d:""},identity:{v:15,d:""},identityWord:{v:3,d:""}},vm:{stackLimit:{v:1024,d:"Maximum size of VM stack allowed"},callCreateDepth:{v:1024,d:"Maximum depth of call/create stack"},maxExtraDataSize:{v:32,d:"Maximum size extra data may be after Genesis"}},pow:{minimumDifficulty:{v:131072,d:"The minimum that the difficulty may ever be"},difficultyBoundDivisor:{v:2048,d:"The bound divisor of the difficulty, used in the update calculations"},durationLimit:{v:13,d:"The decision boundary on the blocktime duration used to determine whether difficulty should go up or not"},epochDuration:{v:3e4,d:"Duration between proof-of-work epochs"},timebombPeriod:{v:1e5,d:"Exponential difficulty timebomb period"},minerReward:{v:"5000000000000000000",d:"the amount a miner get rewarded for mining a block"}},casper:{},sharding:{}}},function(e){e.exports={name:"homestead",comment:"Homestead hardfork with protocol and network changes",eip:{url:"https://eips.ethereum.org/EIPS/eip-606",status:"Final"},gasConfig:{},gasPrices:{},vm:{},pow:{},casper:{},sharding:{}}},function(e){e.exports={name:"dao",comment:"DAO rescue hardfork",eip:{url:"https://eips.ethereum.org/EIPS/eip-779",status:"Final"},gasConfig:{},gasPrices:{},vm:{},pow:{},casper:{},sharding:{}}},function(e){e.exports={name:"tangerineWhistle",comment:"Hardfork with gas cost changes for IO-heavy operations",eip:{url:"https://eips.ethereum.org/EIPS/eip-608",status:"Final"},gasConfig:{},gasPrices:{sload:{v:200,d:"Once per SLOAD operation"},call:{v:700,d:"Once per CALL operation & message call transaction"}},vm:{},pow:{},casper:{},sharding:{}}},function(e){e.exports={name:"spuriousDragon",comment:"HF with EIPs for simple replay attack protection, EXP cost increase, state trie clearing, contract code size limit",eip:{url:"https://eips.ethereum.org/EIPS/eip-607",status:"Final"},gasConfig:{},gasPrices:{expByte:{v:50,d:"Times ceil(log256(exponent)) for the EXP instruction"}},vm:{maxCodeSize:{v:24576,d:"Maximum length of contract code"}},pow:{},casper:{},sharding:{}}},function(e){e.exports={name:"byzantium",comment:"Hardfork with new precompiles, instructions and other protocol changes",eip:{url:"https://eips.ethereum.org/EIPS/eip-609",status:"Final"},gasConfig:{},gasPrices:{modexpGquaddivisor:{v:20,d:"Gquaddivisor from modexp precompile for gas calculation"},ecAdd:{v:500,d:"Gas costs for curve addition precompile"},ecMul:{v:4e4,d:"Gas costs for curve multiplication precompile"},ecPairing:{v:1e5,d:"Base gas costs for curve pairing precompile"},ecPairingWord:{v:8e4,d:"Gas costs regarding curve pairing precompile input length"}},vm:{},pow:{minerReward:{v:"3000000000000000000",d:"the amount a miner get rewarded for mining a block"}},casper:{},sharding:{}}},function(e){e.exports={name:"constantinople",comment:"Hardfork with new instructions and protocol changes",eip:{url:"https://eips.ethereum.org/EIPS/eip-1013",status:"Draft"},gasConfig:{},gasPrices:{netSstoreNoopGas:{v:200,d:"Once per SSTORE operation if the value doesn't change"},netSstoreInitGas:{v:2e4,d:"Once per SSTORE operation from clean zero"},netSstoreCleanGas:{v:5e3,d:"Once per SSTORE operation from clean non-zero"},netSstoreDirtyGas:{v:200,d:"Once per SSTORE operation from dirty"},netSstoreClearRefund:{v:15e3,d:"Once per SSTORE operation for clearing an originally existing storage slot"},netSstoreResetRefund:{v:4800,d:"Once per SSTORE operation for resetting to the original non-zero value"},netSstoreResetClearRefund:{v:19800,d:"Once per SSTORE operation for resetting to the original zero value"}},vm:{},pow:{minerReward:{v:"2000000000000000000",d:"The amount a miner gets rewarded for mining a block"}},casper:{},sharding:{}}},function(e){e.exports={name:"hybridCasper",comment:"Future hardfork to move to hybrid proof-of-stake",eip:{url:"https://eips.ethereum.org/EIPS/eip-1011",status:"Draft"},gasConfig:{},gasPrices:{},vm:{},pow:{minerReward:{v:"600000000000000000",d:"the amount a miner get rewarded for mining a block"}},casper:{casperBalance:{v:"1000000000000000000000000",d:"Balance of the Casper contract, 1e24 wei"},epochLength:{v:50,d:"Number of blocks between epochs"},withdrawalDelay:{v:15e3,d:"Number of epochs a withdrawal of deposited funds is delayed"},dynastyLogoutDelay:{v:700,d:"Number of dynasties a logout is delayed"},baseInterestFactor:{v:.007,d:"Base interest factor for validator earnings, 7e-3"},basePenaltyFactor:{v:2e-7,d:"Base penalty factor for validators getting offline, 2e-7"},minDepositSize:{v:"1500000000000000000000",d:"Minimum size of a deposit, 1.5e21 wei"}},sharding:{}}},function(e,t,r){"use strict";const n=r(6),i=r(43),o=r(210),s=r(170),a=r(487),u=r(33),c=r(171),f=r(486).resolver,l=r(172),h=l("eth-block-list",void 0,p),d=h.util;function p(e,t,r){let n=[];n.push({path:"count",value:e.length}),i(e,(t,r)=>{const i=e.indexOf(t),o=i.toString();n.push({path:o,value:t}),f._mapFromEthObject(t,{},(e,t)=>{if(e)return r(e);t.forEach(e=>e.path=o+"/"+e.path),n=n.concat(t),r()})},e=>{if(e)return r(e);r(null,n)})}d.serialize=o(e=>{const t=e.map(e=>e.raw);return s.encode(t)}),d.deserialize=o(e=>{const t=s.decode(e);return t.map(e=>new a(e))}),d.cid=((e,t,r)=>{"function"==typeof t&&(r=t,t={}),t=t||{};const i=t.hashAlg||"keccak-256",s=void 0===t.version?1:t.version;n([t=>d.serialize(e,t),(e,t)=>u.digest(e,i,t),o(e=>c("eth-block-list",e,t))],r)}),e.exports=h},function(e,t,r){"use strict";const n=r(480),i=r(308),o=i("eth-state-trie",n);e.exports=o},function(e,t,r){(function(t){const n=r(170),i=r(229);function o(e,t,r){if(Array.isArray(e))this.parseNode(e);else if(this.type=e,"branch"===e){var n=t;this.raw=Array.apply(null,Array(17)),n&&n.forEach(function(e){this.set.apply(this,e)})}else this.raw=Array(2),this.setValue(r),this.setKey(t)}function s(e,t){return e.length%2?e.unshift(1):(e.unshift(0),e.unshift(0)),t&&(e[0]+=2),e}function a(e){return e=e[0]%2?e.slice(1):e.slice(2),e}function u(e){return e[0]>1}function c(e){for(var r=new t(e),n=[],i=0;i>4,++o,n[o]=r[i]%16}return n}function f(e){for(var r=new t(e.length/2),n=0;n0){var n=this.raw.slice();this.v=this._chainId,this.r=0,this.s=0,r=this.raw,this.raw=n}else r=this.raw.slice(0,6);return i.rlphash(r)},e.prototype.getChainId=function e(){return this._chainId},e.prototype.getSenderAddress=function e(){if(this._from)return this._from;var t=this.getSenderPublicKey();return this._from=i.publicToAddress(t),this._from},e.prototype.getSenderPublicKey=function e(){if(!(this._senderPubKey&&this._senderPubKey.length||this.verifySignature()))throw new Error("Invalid Signature");return this._senderPubKey},e.prototype.verifySignature=function e(){var t=this.hash(!1);if(this._homestead&&1===new s(this.s).cmp(a))return!1;try{var r=i.bufferToInt(this.v);this._chainId>0&&(r-=2*this._chainId+8),this._senderPubKey=i.ecrecover(t,r,this.r,this.s)}catch(e){return!1}return!!this._senderPubKey},e.prototype.sign=function e(t){var r=this.hash(!1),n=i.ecsign(r,t);this._chainId>0&&(n.v+=2*this._chainId+8),Object.assign(this,n)},e.prototype.getDataFee=function e(){for(var t=this.raw[5],r=new s(0),n=0;n0&&r.push(["gas limit is too low. Need at least "+this.getBaseFee()]),void 0===t||!1===t?0===r.length:r.join(" ")},e}();e.exports=u}).call(this,r(0).Buffer)},function(e){e.exports={genesisGasLimit:{v:5e3,d:"Gas limit of the Genesis block."},genesisDifficulty:{v:17179869184,d:"Difficulty of the Genesis block."},genesisNonce:{v:"0x0000000000000042",d:"the geneis nonce"},genesisExtraData:{v:"0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",d:"extra data "},genesisHash:{v:"0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",d:"genesis hash"},genesisStateRoot:{v:"0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544",d:"the genesis state root"},minGasLimit:{v:5e3,d:"Minimum the gas limit may ever be."},gasLimitBoundDivisor:{v:1024,d:"The bound divisor of the gas limit, used in update calculations."},minimumDifficulty:{v:131072,d:"The minimum that the difficulty may ever be."},difficultyBoundDivisor:{v:2048,d:"The bound divisor of the difficulty, used in the update calculations."},durationLimit:{v:13,d:"The decision boundary on the blocktime duration used to determine whether difficulty should go up or not."},maximumExtraDataSize:{v:32,d:"Maximum size extra data may be after Genesis."},epochDuration:{v:3e4,d:"Duration between proof-of-work epochs."},stackLimit:{v:1024,d:"Maximum size of VM stack allowed."},callCreateDepth:{v:1024,d:"Maximum depth of call/create stack."},tierStepGas:{v:[0,2,3,5,8,10,20],d:"Once per operation, for a selection of them."},expGas:{v:10,d:"Once per EXP instuction."},expByteGas:{v:10,d:"Times ceil(log256(exponent)) for the EXP instruction."},sha3Gas:{v:30,d:"Once per SHA3 operation."},sha3WordGas:{v:6,d:"Once per word of the SHA3 operation's data."},sloadGas:{v:50,d:"Once per SLOAD operation."},sstoreSetGas:{v:2e4,d:"Once per SSTORE operation if the zeroness changes from zero."},sstoreResetGas:{v:5e3,d:"Once per SSTORE operation if the zeroness does not change from zero."},sstoreRefundGas:{v:15e3,d:"Once per SSTORE operation if the zeroness changes to zero."},jumpdestGas:{v:1,d:"Refunded gas, once per SSTORE operation if the zeroness changes to zero."},logGas:{v:375,d:"Per LOG* operation."},logDataGas:{v:8,d:"Per byte in a LOG* operation's data."},logTopicGas:{v:375,d:"Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas."},createGas:{v:32e3,d:"Once per CREATE operation & contract-creation transaction."},callGas:{v:40,d:"Once per CALL operation & message call transaction."},callStipend:{v:2300,d:"Free gas given at beginning of call."},callValueTransferGas:{v:9e3,d:"Paid for CALL when the value transfor is non-zero."},callNewAccountGas:{v:25e3,d:"Paid for CALL when the destination address didn't exist prior."},suicideRefundGas:{v:24e3,d:"Refunded following a suicide operation."},memoryGas:{v:3,d:"Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL."},quadCoeffDiv:{v:512,d:"Divisor for the quadratic particle of the memory cost equation."},createDataGas:{v:200,d:""},txGas:{v:21e3,d:"Per transaction. NOTE: Not payable on data of calls between transactions."},txCreation:{v:32e3,d:"the cost of creating a contract via tx"},txDataZeroGas:{v:4,d:"Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions."},txDataNonZeroGas:{v:68,d:"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions."},copyGas:{v:3,d:"Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added."},ecrecoverGas:{v:3e3,d:""},sha256Gas:{v:60,d:""},sha256WordGas:{v:12,d:""},ripemd160Gas:{v:600,d:""},ripemd160WordGas:{v:120,d:""},identityGas:{v:15,d:""},identityWordGas:{v:3,d:""},minerReward:{v:"5000000000000000000",d:"the amount a miner get rewarded for mining a block"},ommerReward:{v:"625000000000000000",d:"The amount of wei a miner of an uncle block gets for being inculded in the blockchain"},niblingReward:{v:"156250000000000000",d:"the amount a miner gets for inculding a uncle"},homeSteadForkNumber:{v:115e4,d:"the block that the Homestead fork started at"},homesteadRepriceForkNumber:{v:2463e3,d:"the block that the Homestead Reprice (EIP150) fork started at"},timebombPeriod:{v:1e5,d:"Exponential difficulty timebomb period"},freeBlockPeriod:{v:2}}},function(e,t,r){"use strict";const n=r(488),i=r(308),o=i("eth-tx-trie",n);e.exports=o},function(e,t,r){"use strict";const n=r(10),i=r(33);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){"use strict";t.resolver=r(309),t.util=r(489)},function(e,t,r){"use strict";(function(t,n){var i=e.exports;i.version="v"+r(997).version,i.versionGuard=function(e){if(void 0!==e)var t="More than one instance of zcash-bitcore-lib found. Please make sure to require zcash-bitcore-lib and check that submodules do not also include their own zcash-bitcore-lib dependency."},i.versionGuard(t._bitcore),t._bitcore=i.version,i.crypto={},i.crypto.BN=r(39),i.crypto.ECDSA=r(490),i.crypto.Hash=r(46),i.crypto.Random=r(234),i.crypto.Point=r(135),i.crypto.Signature=r(66),i.encoding={},i.encoding.Base58=r(232),i.encoding.Base58Check=r(173),i.encoding.BufferReader=r(96),i.encoding.BufferWriter=r(61),i.encoding.Varint=r(1025),i.util={},i.util.buffer=r(25),i.util.js=r(34),i.util.preconditions=r(21),i.errors=r(65),i.Address=r(120),i.Block=r(1026),i.MerkleBlock=r(494),i.BlockHeader=r(235),i.HDPrivateKey=r(495),i.HDPublicKey=r(496),i.Networks=r(119),i.Opcode=r(310),i.PrivateKey=r(231),i.PublicKey=r(76),i.Script=r(67),i.Transaction=r(233),i.URI=r(1028),i.Unit=r(313),i.deps={},i.deps.bnjs=r(84),i.deps.bs58=r(491),i.deps.Buffer=n,i.deps.elliptic=r(75),i.deps._=r(15),i._HDKeyCache=r(314),i.Transaction.sighash=r(97)}).call(this,r(8),r(0).Buffer)},function(e){e.exports={_from:"zcash-bitcore-lib@~0.13.20-rc3",_id:"zcash-bitcore-lib@0.13.20-rc3",_inBundle:!1,_integrity:"sha1-gToPVtz4t2vBQplRvqbRI2xQcAg=",_location:"/zcash-bitcore-lib",_phantomChildren:{},_requested:{type:"range",registry:!0,raw:"zcash-bitcore-lib@~0.13.20-rc3",name:"zcash-bitcore-lib",escapedName:"zcash-bitcore-lib",rawSpec:"~0.13.20-rc3",saveSpec:null,fetchSpec:"~0.13.20-rc3"},_requiredBy:["/ipld-zcash"],_resolved:"https://registry.npmjs.org/zcash-bitcore-lib/-/zcash-bitcore-lib-0.13.20-rc3.tgz",_shasum:"813a0f56dcf8b76bc1429951bea6d1236c507008",_shrinkwrap:{name:"bitcore",version:"0.13.19",dependencies:{"bn.js":{version:"2.0.4",from:"bn.js@=2.0.4",resolved:"https://registry.npmjs.org/bn.js/-/bn.js-2.0.4.tgz"},bs58:{version:"2.0.0",from:"bs58@=2.0.0",resolved:"https://registry.npmjs.org/bs58/-/bs58-2.0.0.tgz"},"buffer-compare":{version:"1.0.0",from:"buffer-compare@=1.0.0",resolved:"https://registry.npmjs.org/buffer-compare/-/buffer-compare-1.0.0.tgz"},elliptic:{version:"3.0.3",from:"elliptic@=3.0.3",resolved:"https://registry.npmjs.org/elliptic/-/elliptic-3.0.3.tgz",dependencies:{brorand:{version:"1.0.5",from:"brorand@^1.0.1",resolved:"https://registry.npmjs.org/brorand/-/brorand-1.0.5.tgz"},"hash.js":{version:"1.0.3",from:"hash.js@=1.0.3",resolved:"https://registry.npmjs.org/hash.js/-/hash.js-1.0.3.tgz"}}},inherits:{version:"2.0.1",from:"inherits@=2.0.1",resolved:"https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"},lodash:{version:"3.10.1",from:"lodash@=3.10.1",resolved:"https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz"}}},_spec:"zcash-bitcore-lib@~0.13.20-rc3",_where:"/Users/mitra/git/dweb-transports/node_modules/ipld-zcash",author:{name:"BitPay",email:"dev@bitpay.com"},browser:{request:"browser-request"},bugs:{url:"https://github.com/bitmex/zcash-bitcore-lib/issues"},bundleDependencies:!1,contributors:[{name:"Daniel Cousens",email:"bitcoin@dcousens.com"},{name:"Esteban Ordano",email:"eordano@gmail.com"},{name:"Gordon Hall",email:"gordon@bitpay.com"},{name:"Jeff Garzik",email:"jgarzik@bitpay.com"},{name:"Kyle Drake",email:"kyle@kyledrake.net"},{name:"Manuel Araoz",email:"manuelaraoz@gmail.com"},{name:"Matias Alejo Garcia",email:"ematiu@gmail.com"},{name:"Ryan X. Charles",email:"ryanxcharles@gmail.com"},{name:"Stefan Thomas",email:"moon@justmoon.net"},{name:"Stephen Pair",email:"stephen@bitpay.com"},{name:"Wei Lu",email:"luwei.here@gmail.com"},{name:"Jack Grigg",email:"jack@z.cash"}],dependencies:{"bn.js":"=2.0.4",bs58:"=2.0.0","buffer-compare":"=1.0.0",elliptic:"=3.0.3",inherits:"=2.0.1",lodash:"=3.10.1"},deprecated:!1,description:"A pure and powerful JavaScript Zcash library.",devDependencies:{brfs:"^1.2.0",chai:"^1.10.0",gulp:"^3.8.10",sinon:"^1.13.0","zcash-bitcore-build":"^0.5.4"},homepage:"https://github.com/bitmex/zcash-bitcore-lib#readme",keywords:["zcash","transaction","address","p2p","ecies","cryptocurrency","blockchain","payment","bip21","bip32","bip37","bip69","bip70","multisig"],license:"MIT",main:"index.js",name:"zcash-bitcore-lib",repository:{type:"git",url:"git+https://github.com/bitmex/zcash-bitcore-lib.git"},scripts:{build:"gulp",coverage:"gulp coverage",lint:"gulp lint",test:"gulp test"},version:"0.13.20-rc3"}},function(e,t,r){"use strict";var n="http://bitcore.io/";e.exports=[{name:"InvalidB58Char",message:"Invalid Base58 character: {0} in {1}"},{name:"InvalidB58Checksum",message:"Invalid Base58 checksum for {0}"},{name:"InvalidNetwork",message:"Invalid version for network: got {0}"},{name:"InvalidState",message:"Invalid state: {0}"},{name:"NotImplemented",message:"Function {0} was not implemented yet"},{name:"InvalidNetworkArgument",message:'Invalid network: must be "livenet" or "testnet", got {0}'},{name:"InvalidArgument",message:function(){return"Invalid Argument"+(arguments[0]?": "+arguments[0]:"")+(arguments[1]?" Documentation: "+n+arguments[1]:"")}},{name:"AbstractMethodInvoked",message:"Abstract Method Invocation: {0}"},{name:"InvalidArgumentType",message:function(){return"Invalid Argument for "+arguments[2]+", expected "+arguments[1]+" but got "+typeof arguments[0]}},{name:"Unit",message:"Internal Error on Unit {0}",errors:[{name:"UnknownCode",message:"Unrecognized unit code: {0}"},{name:"InvalidRate",message:"Invalid exchange rate: {0}"}]},{name:"Transaction",message:"Internal Error on Transaction {0}",errors:[{name:"Input",message:"Internal Error on Input {0}",errors:[{name:"MissingScript",message:"Need a script to create an input"},{name:"UnsupportedScript",message:"Unsupported input script type: {0}"},{name:"MissingPreviousOutput",message:"No previous output information."}]},{name:"NeedMoreInfo",message:"{0}"},{name:"InvalidSorting",message:"The sorting function provided did not return the change output as one of the array elements"},{name:"InvalidOutputAmountSum",message:"{0}"},{name:"MissingSignatures",message:"Some inputs have not been fully signed"},{name:"InvalidIndex",message:"Invalid index: {0} is not between 0, {1}"},{name:"UnableToVerifySignature",message:"Unable to verify signature: {0}"},{name:"DustOutputs",message:"Dust amount detected in one output"},{name:"InvalidSatoshis",message:"Output satoshis are invalid"},{name:"FeeError",message:"Internal Error on Fee {0}",errors:[{name:"TooSmall",message:"Fee is too small: {0}"},{name:"TooLarge",message:"Fee is too large: {0}"},{name:"Different",message:"Unspent value is different from specified fee: {0}"}]},{name:"ChangeAddressMissing",message:"Change address is missing"},{name:"BlockHeightTooHigh",message:"Block Height can be at most 2^32 -1"},{name:"NLockTimeOutOfRange",message:"Block Height can only be between 0 and 499 999 999"},{name:"LockTimeTooEarly",message:"Lock Time can't be earlier than UNIX date 500 000 000"}]},{name:"Script",message:"Internal Error on Script {0}",errors:[{name:"UnrecognizedAddress",message:"Expected argument {0} to be an address"},{name:"CantDeriveAddress",message:"Can't derive address associated with script {0}, needs to be p2pkh in, p2pkh out, p2sh in, or p2sh out."},{name:"InvalidBuffer",message:"Invalid script buffer: can't parse valid script from given buffer {0}"}]},{name:"HDPrivateKey",message:"Internal Error on HDPrivateKey {0}",errors:[{name:"InvalidDerivationArgument",message:"Invalid derivation argument {0}, expected string, or number and boolean"},{name:"InvalidEntropyArgument",message:"Invalid entropy: must be an hexa string or binary buffer, got {0}",errors:[{name:"TooMuchEntropy",message:'Invalid entropy: more than 512 bits is non standard, got "{0}"'},{name:"NotEnoughEntropy",message:'Invalid entropy: at least 128 bits needed, got "{0}"'}]},{name:"InvalidLength",message:"Invalid length for xprivkey string in {0}"},{name:"InvalidPath",message:"Invalid derivation path: {0}"},{name:"UnrecognizedArgument",message:'Invalid argument: creating a HDPrivateKey requires a string, buffer, json or object, got "{0}"'}]},{name:"HDPublicKey",message:"Internal Error on HDPublicKey {0}",errors:[{name:"ArgumentIsPrivateExtended",message:"Argument is an extended private key: {0}"},{name:"InvalidDerivationArgument",message:"Invalid derivation argument: got {0}"},{name:"InvalidLength",message:'Invalid length for xpubkey: got "{0}"'},{name:"InvalidPath",message:'Invalid derivation path, it should look like: "m/1/100", got "{0}"'},{name:"InvalidIndexCantDeriveHardened",message:"Invalid argument: creating a hardened path requires an HDPrivateKey"},{name:"MustSupplyArgument",message:"Must supply an argument to create a HDPublicKey"},{name:"UnrecognizedArgument",message:"Invalid argument for creation, must be string, json, buffer, or object"}]}]},function(e){e.exports={_from:"elliptic@=3.0.3",_id:"elliptic@3.0.3",_inBundle:!1,_integrity:"sha1-hlybQgv75VAGuflp+XoNLESWZZU=",_location:"/zcash-bitcore-lib/elliptic",_phantomChildren:{inherits:"2.0.1"},_requested:{type:"version",registry:!0,raw:"elliptic@3.0.3",name:"elliptic",escapedName:"elliptic",rawSpec:"3.0.3",saveSpec:null,fetchSpec:"3.0.3"},_requiredBy:["/zcash-bitcore-lib"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-3.0.3.tgz",_shasum:"865c9b420bfbe55006b9f969f97a0d2c44966595",_spec:"elliptic@3.0.3",_where:"/Users/mitra/git/dweb-transports/node_modules/zcash-bitcore-lib",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},bundleDependencies:!1,dependencies:{"bn.js":"^2.0.0",brorand:"^1.0.1","hash.js":"^1.0.0",inherits:"^2.0.1"},deprecated:!1,description:"EC cryptography",devDependencies:{browserify:"^3.44.2",jscs:"^1.11.3",jshint:"^2.6.0",mocha:"^2.1.0","uglify-js":"^2.4.13"},homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{test:"make lint && mocha --reporter=spec test/*-test.js"},version:"3.0.3"}},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=0;){var o;if(i.isOdd()){var s=i.andln(n-1);o=s>(n>>1)-1?(n>>1)-s:s,i.isubn(o)}else o=0;r.push(o);for(var a=0!==i.cmpn(0)&&0===i.andln(n-1)?t+1:1,u=1;u0||t.cmpn(-i)>0;){var o=e.andln(3)+n&3,s=t.andln(3)+i&3,a,u;if(3===o&&(o=-1),3===s&&(s=-1),0==(1&o))a=0;else{var c=e.andln(7)+n&7;a=3!==c&&5!==c||2!==s?o:-o}if(r[0].push(a),0==(1&s))u=0;else{var c=t.andln(7)+i&7;u=3!==c&&5!==c||2!==o?s:-s}r[1].push(u),2*n===a+1&&(n=1-n),2*i===u+1&&(i=1-i),e.ishrn(1),t.ishrn(1)}return r}n.assert=function e(t,r){if(!t)throw new Error(r||"Assertion failed")},n.toArray=i,n.zero2=o,n.toHex=s,n.encode=function e(t,r){return"hex"===r?s(t):t},n.getNAF=a,n.getJSF=u},function(e,t,r){var n;function i(e){this.rand=e}if(e.exports=function e(t){return n||(n=new i(null)),n.generate(t)},e.exports.Rand=i,i.prototype.generate=function e(t){return this._rand(t)},"object"==typeof window)window.crypto&&window.crypto.getRandomValues?i.prototype._rand=function e(t){var r=new Uint8Array(t);return window.crypto.getRandomValues(r),r}:window.msCrypto&&window.msCrypto.getRandomValues?i.prototype._rand=function e(t){var r=new Uint8Array(t);return window.msCrypto.getRandomValues(r),r}:i.prototype._rand=function(){throw new Error("Not implemented yet")};else try{var o=r(118);i.prototype._rand=function e(t){return o.randomBytes(t)}}catch(e){i.prototype._rand=function e(t){for(var r=new Uint8Array(t),n=0;n=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}e.exports=a,a.prototype._init=function e(t,r,n){var i=t.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this.reseed=1},a.prototype.generate=function e(t,r,n,i){if(this.reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof r&&(i=n,n=r,r=null),n&&(n=o.toArray(n,i),this._update(n));for(var s=[];s.length>8,s=255&i;o?r.push(o,s):r.push(s)}else for(var n=0;n>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24;return t>>>0}function u(e,t){for(var r="",n=0;n>>0}return o}function h(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 d(e,t){return e>>>t|e<<32-t}function p(e,t){return e<>>32-t}function y(e,t){return e+t>>>0}function g(e,t,r){return e+t+r>>>0}function m(e,t,r,n){return e+t+r+n>>>0}function b(e,t,r,n,i){return e+t+r+n+i>>>0}function v(e,t){if(!e)throw new Error(t||"Assertion failed")}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 A(e,t,r,n,i,o,s,a,u,c){var f=0,l=t;l=l+n>>>0,f+=l>>0,f+=l>>0,f+=l>>0,f+=l>>0}function x(e,t,r,n,i,o,s,a,u,c){var f=t+n+o+a+c;return f>>>0}function C(e,t,r){var n=t<<32-r|e>>>r;return n>>>0}function T(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}function I(e,t,r){return e>>>r}function B(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}n.toArray=o,n.toHex=s,n.htonl=a,n.toHex32=u,n.zero2=c,n.zero8=f,n.join32=l,n.split32=h,n.rotr32=d,n.rotl32=p,n.sum32=y,n.sum32_3=g,n.sum32_4=m,n.sum32_5=b,n.assert=v,n.inherits=i,t.sum64=_,t.sum64_hi=w,t.sum64_lo=S,t.sum64_4_hi=E,t.sum64_4_lo=k,t.sum64_5_hi=A,t.sum64_5_lo=x,t.rotr64_hi=C,t.rotr64_lo=T,t.shr64_hi=I,t.shr64_lo=B},function(e,t,r){var n=r(136),i=n.utils,o=i.assert;function s(){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=s,s.prototype.update=function e(t,r){if(t=i.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 n=t.length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=i.join32(t,0,t.length-n,this.endian);for(var o=0;o>>24&255,i[o++]=t>>>16&255,i[o++]=t>>>8&255,i[o++]=255&t}else{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;for(var s=8;s>>3}function M(e){return s(e,17)^s(e,19)^e>>>10}function D(e,t,r,n){return 0===e?O(t,r,n):1===e||3===e?R(t,r,n):2===e?P(t,r,n):void 0}function U(e,t,r,n,i,o){var s=e&r^~e&i;return s<0&&(s+=4294967296),s}function F(e,t,r,n,i,o){var s=t&n^~t&o;return s<0&&(s+=4294967296),s}function K(e,t,r,n,i,o){var s=e&r^e&i^r&i;return s<0&&(s+=4294967296),s}function q(e,t,r,n,i,o){var s=t&n^t&o^n&o;return s<0&&(s+=4294967296),s}function H(e,t){var r=l(e,t,28),n=l(t,e,2),i=l(t,e,7),o=r^n^i;return o<0&&(o+=4294967296),o}function z(e,t){var r=h(e,t,28),n=h(t,e,2),i=h(t,e,7),o=r^n^i;return o<0&&(o+=4294967296),o}function V(e,t){var r=l(e,t,14),n=l(e,t,18),i=l(t,e,9),o=r^n^i;return o<0&&(o+=4294967296),o}function G(e,t){var r=h(e,t,14),n=h(e,t,18),i=h(t,e,9),o=r^n^i;return o<0&&(o+=4294967296),o}function W(e,t){var r=l(e,t,1),n=l(e,t,8),i=d(e,t,7),o=r^n^i;return o<0&&(o+=4294967296),o}function $(e,t){var r=h(e,t,1),n=h(e,t,8),i=p(e,t,7),o=r^n^i;return o<0&&(o+=4294967296),o}function Y(e,t){var r=l(e,t,19),n=l(t,e,29),i=d(e,t,6),o=r^n^i;return o<0&&(o+=4294967296),o}function J(e,t){var r=h(e,t,19),n=h(t,e,29),i=p(e,t,6),o=r^n^i;return o<0&&(o+=4294967296),o}i.inherits(x,S),t.sha256=x,x.blockSize=512,x.outSize=256,x.hmacStrength=192,x.padLength=64,x.prototype._update=function e(t,r){for(var n=this.W,i=0;i<16;i++)n[i]=t[r+i];for(;ithis.blockSize&&(t=(new this.Hash).update(t).digest()),s(t.length<=this.blockSize);for(var r=t.length;r=u;r--)c=(c<<1)+i[r];a.push(c)}for(var f=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=s;h>0;h--){for(var u=0;u=0;f--){for(var r=0;f>=0&&0===u[f];f--)r++;if(f>=0&&r++,c=c.dblp(r),f<0)break;var l=u[f];a(0!==l),c="affine"===t.type?l>0?c.mixedAdd(s[l-1>>1]):c.mixedAdd(s[-l-1>>1].neg()):l>0?c.add(s[l-1>>1]):c.add(s[-l-1>>1].neg())}return"affine"===t.type?c.toP():c},u.prototype._wnafMulAdd=function e(t,r,n,i){for(var a=this._wnafT1,u=this._wnafT2,c=this._wnafT3,f=0,l=0;l=1;l-=2){var p=l-1,y=l;if(1===a[p]&&1===a[y]){var g=[r[p],null,null,r[y]];0===r[p].y.cmp(r[y].y)?(g[1]=r[p].add(r[y]),g[2]=r[p].toJ().mixedAdd(r[y].neg())):0===r[p].y.cmp(r[y].y.redNeg())?(g[1]=r[p].toJ().mixedAdd(r[y]),g[2]=r[p].add(r[y].neg())):(g[1]=r[p].toJ().mixedAdd(r[y]),g[2]=r[p].toJ().mixedAdd(r[y].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],b=s(n[p],n[y]);f=Math.max(b[0].length,f),c[p]=new Array(f),c[y]=new Array(f);for(var v=0;v=0;l--){for(var k=0;l>=0;){for(var A=!0,v=0;v=0&&k++,S=S.dblp(k),l<0)break;for(var v=0;v0?h=u[v][x-1>>1]:x<0&&(h=u[v][-x-1>>1].neg()),S="affine"===h.type?S.mixedAdd(h):S.add(h))}}for(var l=0;l=0&&(p=f,y=l),h.sign&&(h=h.neg(),d=d.neg()),p.sign&&(p=p.neg(),y=y.neg()),[{a:h,b:d},{a:p,b:y}]},c.prototype._endoSplit=function e(t){var r=this.endo.basis,n=r[0],i=r[1],o=i.b.mul(t).divRound(this.n),s=n.b.neg().mul(t).divRound(this.n),a=o.mul(n.a),u=s.mul(i.a),c=o.mul(n.b),f=s.mul(i.b),l=t.sub(a).sub(u),h=c.add(f).neg();return{k1:l,k2:h}},c.prototype.pointFromX=function e(t,r){r=new o(r,16),r.red||(r=r.toRed(this.red));var n=r.redSqr().redMul(r).redIAdd(r.redMul(this.a)).redIAdd(this.b),i=n.redSqrt(),s=i.fromRed().isOdd();return(t&&!s||!t&&s)&&(i=i.redNeg()),this.point(r,i)},c.prototype.validate=function e(t){if(t.inf)return!0;var r=t.x,n=t.y,i=this.a.redMul(r),o=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return 0===n.redSqr().redISub(o).cmpn(0)},c.prototype._endoWnafMulAdd=function e(t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},f.prototype.isInfinity=function e(){return this.inf},f.prototype.add=function e(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var r=this.y.redSub(t.y);0!==r.cmpn(0)&&(r=r.redMul(this.x.redSub(t.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(t.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},f.prototype.dbl=function e(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=t.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),s=o.redSqr().redISub(this.x.redAdd(this.x)),a=o.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,a)},f.prototype.getX=function e(){return this.x.fromRed()},f.prototype.getY=function e(){return this.y.fromRed()},f.prototype.mul=function e(t){return t=new o(t,16),this.precomputed&&this.precomputed.doubles?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function e(t,r,n){var i=[this,r],o=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o):this.curve._wnafMulAdd(1,i,o,2)},f.prototype.eq=function e(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},f.prototype.neg=function e(t){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,i=function(e){return e.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},f.prototype.toJ=function e(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t},s(l,a.BasePoint),c.prototype.jpoint=function e(t,r,n){return new l(this,t,r,n)},l.prototype.toP=function e(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),r=t.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(t);return this.curve.point(n,i)},l.prototype.neg=function e(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function e(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var r=t.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),o=t.x.redMul(n),s=this.y.redMul(r.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),u=i.redSub(o),c=s.redSub(a);if(0===u.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=u.redSqr(),l=f.redMul(u),h=i.redMul(f),d=c.redSqr().redIAdd(l).redISub(h).redISub(h),p=c.redMul(h.redISub(d)).redISub(s.redMul(l)),y=this.z.redMul(t.z).redMul(u);return this.curve.jpoint(d,p,y)},l.prototype.mixedAdd=function e(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=t.x.redMul(r),o=this.y,s=t.y.redMul(r).redMul(this.z),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),f=c.redMul(a),l=n.redMul(c),h=u.redSqr().redIAdd(f).redISub(l).redISub(l),d=u.redMul(l.redISub(h)).redISub(o.redMul(f)),p=this.z.redMul(a);return this.curve.jpoint(h,d,p)},l.prototype.dblp=function e(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var r=this,n=0;n":""},l.prototype.isInfinity=function e(){return 0===this.z.cmpn(0)}},function(e,t,r){"use strict";var n=r(230),i=r(84),o=r(85),s=n.base;function a(e){s.call(this,"mont",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(e,t,r){s.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(t,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(a,s),e.exports=a,a.prototype.validate=function e(t){var r=t.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),o=i.redSqrt();return 0===o.redSqr().cmp(i)},o(u,s.BasePoint),a.prototype.point=function e(t,r){return new u(this,t,r)},a.prototype.pointFromJSON=function e(t){return u.fromJSON(this,t)},u.prototype.precompute=function e(){},u.fromJSON=function e(t,r){return new u(t,r[0],r[1]||t.one)},u.prototype.inspect=function e(){return this.isInfinity()?"":""},u.prototype.isInfinity=function e(){return 0===this.z.cmpn(0)},u.prototype.dbl=function e(){var t=this.x.redAdd(this.z),r=t.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),o=r.redSub(i),s=r.redMul(i),a=o.redMul(i.redAdd(this.curve.a24.redMul(o)));return this.curve.point(s,a)},u.prototype.add=function e(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function e(t,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),o=t.x.redAdd(t.z),s=t.x.redSub(t.z),a=s.redMul(n),u=o.redMul(i),c=r.z.redMul(a.redAdd(u).redSqr()),f=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(c,f)},u.prototype.mul=function e(t){for(var r=t.clone(),n=this,i=this.curve.point(null,null),o=this,s=[];0!==r.cmpn(0);r.ishrn(1))s.push(r.andln(1));for(var a=s.length-1;a>=0;a--)0===s[a]?(n=n.diffAdd(i,o),i=i.dbl()):(i=n.diffAdd(i,o),n=n.dbl());return i},u.prototype.mulAdd=function e(){throw new Error("Not supported on Montgomery curve")},u.prototype.normalize=function e(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function e(){return this.normalize(),this.x.fromRed()}},function(e,t,r){"use strict";var n=r(230),i=r(75),o=r(84),s=r(85),a=n.base,u=i.utils.assert;function c(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,a.call(this,"edwards",e),this.a=new o(e.a,16).mod(this.red.m).toRed(this.red),this.c=new o(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new o(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),u(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function f(e,t,r,n,i){a.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new o(t,16),this.y=new o(r,16),this.z=n?new o(n,16):this.curve.one,this.t=i&&new o(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}s(c,a),e.exports=c,c.prototype._mulA=function e(t){return this.mOneA?t.redNeg():this.a.redMul(t)},c.prototype._mulC=function e(t){return this.oneC?t:this.c.redMul(t)},c.prototype.jpoint=function e(t,r,n,i){return this.point(t,r,n,i)},c.prototype.pointFromX=function e(t,r){r=new o(r,16),r.red||(r=r.toRed(this.red));var i=r.redSqr(),s=this.c2.redSub(this.a.redMul(i)),a=this.one.redSub(this.c2.redMul(this.d).redMul(i)),u=s.redMul(a.redInvm()).redSqrt(),c=u.fromRed().isOdd();return(t&&!c||!t&&c)&&(u=u.redNeg()),this.point(r,u,n.one)},c.prototype.validate=function e(t){if(t.isInfinity())return!0;t.normalize();var r=t.x.redSqr(),n=t.y.redSqr(),i=r.redMul(this.a).redAdd(n),o=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return 0===i.cmp(o)},s(f,a.BasePoint),c.prototype.pointFromJSON=function e(t){return f.fromJSON(this,t)},c.prototype.point=function e(t,r,n,i){return new f(this,t,r,n,i)},f.fromJSON=function e(t,r){return new f(t,r[0],r[1],r[2])},f.prototype.inspect=function e(){return this.isInfinity()?"":""},f.prototype.isInfinity=function e(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},f.prototype._extDbl=function e(){var t=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(t),o=this.x.redAdd(this.y).redSqr().redISub(t).redISub(r),s=i.redAdd(r),a=s.redSub(n),u=i.redSub(r),c=o.redMul(a),f=s.redMul(u),l=o.redMul(u),h=a.redMul(s);return this.curve.point(c,f,h,l)},f.prototype._projDbl=function e(){var t=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,o,s;if(this.curve.twisted){var a=this.curve._mulA(r),u=a.redAdd(n);if(this.zOne)i=t.redSub(r).redSub(n).redMul(u.redSub(this.curve.two)),o=u.redMul(a.redSub(n)),s=u.redSqr().redSub(u).redSub(u);else{var c=this.z.redSqr(),f=u.redSub(c).redISub(c);i=t.redSub(r).redISub(n).redMul(f),o=u.redMul(a.redSub(n)),s=u.redMul(f)}}else{var a=r.redAdd(n),c=this.curve._mulC(this.c.redMul(this.z)).redSqr(),f=a.redSub(c).redSub(c);i=this.curve._mulC(t.redISub(a)).redMul(f),o=this.curve._mulC(a).redMul(r.redISub(n)),s=a.redMul(f)}return this.curve.point(i,o,s)},f.prototype.dbl=function e(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},f.prototype._extAdd=function e(t){var r=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),o=this.z.redMul(t.z.redAdd(t.z)),s=n.redSub(r),a=o.redSub(i),u=o.redAdd(i),c=n.redAdd(r),f=s.redMul(a),l=u.redMul(c),h=s.redMul(c),d=a.redMul(u);return this.curve.point(f,l,d,h)},f.prototype._projAdd=function e(t){var r=this.z.redMul(t.z),n=r.redSqr(),i=this.x.redMul(t.x),o=this.y.redMul(t.y),s=this.curve.d.redMul(i).redMul(o),a=n.redSub(s),u=n.redAdd(s),c=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(i).redISub(o),f=r.redMul(a).redMul(c),l,h;return this.curve.twisted?(l=r.redMul(u).redMul(o.redSub(this.curve._mulA(i))),h=a.redMul(u)):(l=r.redMul(u).redMul(o.redSub(i)),h=this.curve._mulC(a).redMul(u)),this.curve.point(f,l,h)},f.prototype.add=function e(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},f.prototype.mul=function e(t){return this.precomputed&&this.precomputed.doubles?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function e(t,r,n){return this.curve._wnafMulAdd(1,[this,r],[t,n],2)},f.prototype.normalize=function e(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},f.prototype.neg=function e(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},f.prototype.getX=function e(){return this.normalize(),this.x.fromRed()},f.prototype.getY=function e(){return this.normalize(),this.y.fromRed()},f.prototype.toP=f.prototype.normalize,f.prototype.mixedAdd=f.prototype.add},function(e,t,r){"use strict";var n=t,i=r(136),o=r(75),s=o.utils.assert,a;function u(e){"short"===e.type?this.curve=new o.curve.short(e):"edwards"===e.type?this.curve=new o.curve.edwards(e):this.curve=new o.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new u(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=u,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:i.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:i.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:i.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"0",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{a=r(1013)}catch(e){a=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:i.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})},function(e,t){e.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},function(e,t,r){"use strict";var n=r(84),i=r(75),o=i.utils,s=o.assert,a=r(1015),u=r(1016);function c(e){if(!(this instanceof c))return new c(e);"string"==typeof e&&(s(i.curves.hasOwnProperty(e),"Unknown curve "+e),e=i.curves[e]),e instanceof i.curves.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.shrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=c,c.prototype.keyPair=function e(t){return new a(this,t)},c.prototype.keyFromPrivate=function e(t,r){return a.fromPrivate(this,t,r)},c.prototype.keyFromPublic=function e(t,r){return a.fromPublic(this,t,r)},c.prototype.genKeyPair=function e(t){t||(t={});for(var r=new i.hmacDRBG({hash:this.hash,pers:t.pers,entropy:t.entropy||i.rand(this.hash.hmacStrength),nonce:this.n.toArray()}),o=this.n.byteLength(),s=this.n.sub(new n(2));;){var a=new n(r.generate(o));if(!(a.cmp(s)>0))return a.iaddn(1),this.keyFromPrivate(a)}},c.prototype._truncateToN=function e(t,r){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.shrn(n)),!r&&t.cmp(this.n)>=0?t.sub(this.n):t},c.prototype.sign=function e(t,r,o,s){"object"==typeof o&&(s=o,o=null),s||(s={}),r=this.keyFromPrivate(r,o),t=this._truncateToN(new n(t,16));for(var a=this.n.byteLength(),c=r.getPrivate().toArray(),f=c.length;f<21;f++)c.unshift(0);for(var l=t.toArray(),f=l.length;f=0)){var y=this.g.mul(p);if(!y.isInfinity()){var g=y.getX().mod(this.n);if(0!==g.cmpn(0)){var m=p.invm(this.n).mul(g.mul(r.getPrivate()).iadd(t)).mod(this.n);if(0!==m.cmpn(0))return s.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m)),new u({r:g,s:m})}}}}},c.prototype.verify=function e(t,r,i,o){t=this._truncateToN(new n(t,16)),i=this.keyFromPublic(i,o),r=new u(r,"hex");var s=r.r,a=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var c=a.invm(this.n),f=c.mul(t).mod(this.n),l=c.mul(s).mod(this.n),h=this.g.mulAdd(f,i.getPublic(),l);return!h.isInfinity()&&0===h.getX().mod(this.n).cmp(s)}},function(e,t,r){"use strict";var n=r(84),i=r(75),o=i.utils;function s(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=s,s.fromPublic=function e(t,r,n){return r instanceof s?r:new s(t,{pub:r,pubEnc:n})},s.fromPrivate=function e(t,r,n){return r instanceof s?r:new s(t,{priv:r,privEnc:n})},s.prototype.validate=function e(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},s.prototype.getPublic=function e(t,r){if(this.pub||(this.pub=this.ec.g.mul(this.priv)),"string"==typeof t&&(r=t,t=null),!r)return this.pub;for(var n=this.ec.curve.p.byteLength(),i=this.pub.getX().toArray(),s=i.length,a;s"}},function(e,t,r){"use strict";var n=r(84),i=r(75),o=i.utils,s=o.assert;function a(e,t){if(e instanceof a)return e;this._importDER(e,t)||(s(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16))}e.exports=a,a.prototype._importDER=function e(t,r){if(t=o.toArray(t,r),t.length<6||48!==t[0]||2!==t[2])return!1;var i=t[1];if(1+i>t.length)return!1;var s=t[3];if(s>=128)return!1;if(4+s+2>=t.length)return!1;if(2!==t[4+s])return!1;var a=t[5+s];return!(a>=128)&&(!(4+s+2+a>t.length)&&(this.r=new n(t.slice(4,4+s)),this.s=new n(t.slice(4+s+2,4+s+2+a)),!0))},a.prototype.toDER=function e(t){var r=this.r.toArray(),n=this.s.toArray();128&r[0]&&(r=[0].concat(r)),128&n[0]&&(n=[0].concat(n));var i=r.length+n.length+4,s=[48,i,2,r.length];return s=s.concat(r,[2,n.length],n),o.encode(s,t)}},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(492),o=r(310),s=r(39),a=r(46),u=r(66),c=r(76),f=function e(t){if(!(this instanceof e))return new e(t);t?(this.initialize(),this.set(t)):this.initialize()};f.prototype.verify=function(e,t,o,s,a){var u=r(233),c;if(n.isUndefined(o)&&(o=new u),n.isUndefined(s)&&(s=0),n.isUndefined(a)&&(a=0),this.set({script:e,tx:o,nin:s,flags:a}),0!=(a&f.SCRIPT_VERIFY_SIGPUSHONLY)&&!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(!this.evaluate())return!1;a&f.SCRIPT_VERIFY_P2SH&&(c=this.stack.slice());var l=this.stack;if(this.initialize(),this.set({script:t,stack:l,tx:o,nin:s,flags:a}),!this.evaluate())return!1;if(0===this.stack.length)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_RESULT",!1;var h=this.stack[this.stack.length-1];if(!f.castToBool(h))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_STACK",!1;if(a&f.SCRIPT_VERIFY_P2SH&&t.isScriptHashOut()){if(!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(0===c.length)throw new Error("internal error - stack copy empty");var d=c[c.length-1],p=i.fromBuffer(d);return c.pop(),this.initialize(),this.set({script:p,stack:c,tx:o,nin:s,flags:a}),!!this.evaluate()&&(0===c.length?(this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK",!1):!!f.castToBool(c[c.length-1])||(this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK",!1))}return!0},e.exports=f,f.prototype.initialize=function(e){this.stack=[],this.altstack=[],this.pc=0,this.pbegincodehash=0,this.nOpCount=0,this.vfExec=[],this.errstr="",this.flags=0},f.prototype.set=function(e){this.script=e.script||this.script,this.tx=e.tx||this.tx,this.nin=void 0!==e.nin?e.nin:this.nin,this.stack=e.stack||this.stack,this.altstack=e.altack||this.altstack,this.pc=void 0!==e.pc?e.pc:this.pc,this.pbegincodehash=void 0!==e.pbegincodehash?e.pbegincodehash:this.pbegincodehash,this.nOpCount=void 0!==e.nOpCount?e.nOpCount:this.nOpCount,this.vfExec=e.vfExec||this.vfExec,this.errstr=e.errstr||this.errstr,this.flags=void 0!==e.flags?e.flags:this.flags},f.true=new t([1]),f.false=new t([]),f.MAX_SCRIPT_ELEMENT_SIZE=520,f.LOCKTIME_THRESHOLD=5e8,f.LOCKTIME_THRESHOLD_BN=new s(f.LOCKTIME_THRESHOLD),f.SCRIPT_VERIFY_NONE=0,f.SCRIPT_VERIFY_P2SH=1,f.SCRIPT_VERIFY_STRICTENC=2,f.SCRIPT_VERIFY_DERSIG=4,f.SCRIPT_VERIFY_LOW_S=8,f.SCRIPT_VERIFY_NULLDUMMY=16,f.SCRIPT_VERIFY_SIGPUSHONLY=32,f.SCRIPT_VERIFY_MINIMALDATA=64,f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS=128,f.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY=512,f.castToBool=function(e){for(var t=0;t1e4)return this.errstr="SCRIPT_ERR_SCRIPT_SIZE",!1;try{for(;this.pc1e3)return this.errstr="SCRIPT_ERR_STACK_SIZE",!1}catch(e){return this.errstr="SCRIPT_ERR_UNKNOWN_ERROR: "+e,!1}return!(this.vfExec.length>0)||(this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1)},f.prototype.checkLockTime=function(e){return!!(this.tx.nLockTime=f.LOCKTIME_THRESHOLD&&e.gte(f.LOCKTIME_THRESHOLD_BN))&&(!e.gt(new s(this.tx.nLockTime))&&!!this.tx.inputs[this.nin].isFinal())},f.prototype.step=function(){var e=0!=(this.flags&f.SCRIPT_VERIFY_MINIMALDATA),t=-1===this.vfExec.indexOf(!1),r,l,h,d,p,y,g,m,b,v,_,w,S,E,k,A,x,C=this.script.chunks[this.pc];this.pc++;var T=C.opcodenum;if(n.isUndefined(T))return this.errstr="SCRIPT_ERR_UNDEFINED_OPCODE",!1;if(C.buf&&C.buf.length>f.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;if(T>o.OP_16&&++this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;if(T===o.OP_CAT||T===o.OP_SUBSTR||T===o.OP_LEFT||T===o.OP_RIGHT||T===o.OP_INVERT||T===o.OP_AND||T===o.OP_OR||T===o.OP_XOR||T===o.OP_2MUL||T===o.OP_2DIV||T===o.OP_MUL||T===o.OP_DIV||T===o.OP_MOD||T===o.OP_LSHIFT||T===o.OP_RSHIFT)return this.errstr="SCRIPT_ERR_DISABLED_OPCODE",!1;if(t&&0<=T&&T<=o.OP_PUSHDATA4){if(e&&!this.script.checkMinimalPush(this.pc-1))return this.errstr="SCRIPT_ERR_MINIMALDATA",!1;if(C.buf){if(C.len!==C.buf.length)throw new Error("Length of push value not equal to length of data");this.stack.push(C.buf)}else this.stack.push(f.false)}else if(t||o.OP_IF<=T&&T<=o.OP_ENDIF)switch(T){case o.OP_1NEGATE:case o.OP_1:case o.OP_2:case o.OP_3:case o.OP_4:case o.OP_5:case o.OP_6:case o.OP_7:case o.OP_8:case o.OP_9:case o.OP_10:case o.OP_11:case o.OP_12:case o.OP_13:case o.OP_14:case o.OP_15:case o.OP_16:p=T-(o.OP_1-1),r=new s(p).toScriptNumBuffer(),this.stack.push(r);break;case o.OP_NOP:break;case o.OP_NOP2:case o.OP_CHECKLOCKTIMEVERIFY:if(!(this.flags&f.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)){if(this.flags&f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var I=s.fromScriptNumBuffer(this.stack[this.stack.length-1],e,5);if(I.lt(new s(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(!this.checkLockTime(I))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case o.OP_NOP1:case o.OP_NOP3:case o.OP_NOP4:case o.OP_NOP5:case o.OP_NOP6:case o.OP_NOP7:case o.OP_NOP8:case o.OP_NOP9:case o.OP_NOP10:if(this.flags&f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break;case o.OP_IF:case o.OP_NOTIF:if(A=!1,t){if(this.stack.length<1)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;r=this.stack.pop(),A=f.castToBool(r),T===o.OP_NOTIF&&(A=!A)}this.vfExec.push(A);break;case o.OP_ELSE:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec[this.vfExec.length-1]=!this.vfExec[this.vfExec.length-1];break;case o.OP_ENDIF:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec.pop();break;case o.OP_VERIFY:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(r=this.stack[this.stack.length-1],A=f.castToBool(r),!A)return this.errstr="SCRIPT_ERR_VERIFY",!1;this.stack.pop();break;case o.OP_RETURN:return this.errstr="SCRIPT_ERR_OP_RETURN",!1;case o.OP_TOALTSTACK:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.altstack.push(this.stack.pop());break;case o.OP_FROMALTSTACK:if(this.altstack.length<1)return this.errstr="SCRIPT_ERR_INVALID_ALTSTACK_OPERATION",!1;this.stack.push(this.altstack.pop());break;case o.OP_2DROP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop(),this.stack.pop();break;case o.OP_2DUP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=this.stack[this.stack.length-2],h=this.stack[this.stack.length-1],this.stack.push(l),this.stack.push(h);break;case o.OP_3DUP:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=this.stack[this.stack.length-3],h=this.stack[this.stack.length-2];var B=this.stack[this.stack.length-1];this.stack.push(l),this.stack.push(h),this.stack.push(B);break;case o.OP_2OVER:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=this.stack[this.stack.length-4],h=this.stack[this.stack.length-3],this.stack.push(l),this.stack.push(h);break;case o.OP_2ROT:if(this.stack.length<6)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;d=this.stack.splice(this.stack.length-6,2),this.stack.push(d[0]),this.stack.push(d[1]);break;case o.OP_2SWAP:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;d=this.stack.splice(this.stack.length-4,2),this.stack.push(d[0]),this.stack.push(d[1]);break;case o.OP_IFDUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;r=this.stack[this.stack.length-1],A=f.castToBool(r),A&&this.stack.push(r);break;case o.OP_DEPTH:r=new s(this.stack.length).toScriptNumBuffer(),this.stack.push(r);break;case o.OP_DROP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop();break;case o.OP_DUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-1]);break;case o.OP_NIP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,1);break;case o.OP_OVER:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-2]);break;case o.OP_PICK:case o.OP_ROLL:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(r=this.stack[this.stack.length-1],m=s.fromScriptNumBuffer(r,e),p=m.toNumber(),this.stack.pop(),p<0||p>=this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;r=this.stack[this.stack.length-p-1],T===o.OP_ROLL&&this.stack.splice(this.stack.length-p-1,1),this.stack.push(r);break;case o.OP_ROT:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;y=this.stack[this.stack.length-3],g=this.stack[this.stack.length-2];var O=this.stack[this.stack.length-1];this.stack[this.stack.length-3]=g,this.stack[this.stack.length-2]=O,this.stack[this.stack.length-1]=y;break;case o.OP_SWAP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;y=this.stack[this.stack.length-2],g=this.stack[this.stack.length-1],this.stack[this.stack.length-2]=g,this.stack[this.stack.length-1]=y;break;case o.OP_TUCK:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,0,this.stack[this.stack.length-1]);break;case o.OP_SIZE:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;m=new s(this.stack[this.stack.length-1].length),this.stack.push(m.toScriptNumBuffer());break;case o.OP_EQUAL:case o.OP_EQUALVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=this.stack[this.stack.length-2],h=this.stack[this.stack.length-1];var P=l.toString("hex")===h.toString("hex");if(this.stack.pop(),this.stack.pop(),this.stack.push(P?f.true:f.false),T===o.OP_EQUALVERIFY){if(!P)return this.errstr="SCRIPT_ERR_EQUALVERIFY",!1;this.stack.pop()}break;case o.OP_1ADD:case o.OP_1SUB:case o.OP_NEGATE:case o.OP_ABS:case o.OP_NOT:case o.OP_0NOTEQUAL:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(r=this.stack[this.stack.length-1],m=s.fromScriptNumBuffer(r,e),T){case o.OP_1ADD:m=m.add(s.One);break;case o.OP_1SUB:m=m.sub(s.One);break;case o.OP_NEGATE:m=m.neg();break;case o.OP_ABS:m.cmp(s.Zero)<0&&(m=m.neg());break;case o.OP_NOT:m=new s((0===m.cmp(s.Zero))+0);break;case o.OP_0NOTEQUAL:m=new s((0!==m.cmp(s.Zero))+0)}this.stack.pop(),this.stack.push(m.toScriptNumBuffer());break;case o.OP_ADD:case o.OP_SUB:case o.OP_BOOLAND:case o.OP_BOOLOR:case o.OP_NUMEQUAL:case o.OP_NUMEQUALVERIFY:case o.OP_NUMNOTEQUAL:case o.OP_LESSTHAN:case o.OP_GREATERTHAN:case o.OP_LESSTHANOREQUAL:case o.OP_GREATERTHANOREQUAL:case o.OP_MIN:case o.OP_MAX:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(b=s.fromScriptNumBuffer(this.stack[this.stack.length-2],e),v=s.fromScriptNumBuffer(this.stack[this.stack.length-1],e),m=new s(0),T){case o.OP_ADD:m=b.add(v);break;case o.OP_SUB:m=b.sub(v);break;case o.OP_BOOLAND:m=new s((0!==b.cmp(s.Zero)&&0!==v.cmp(s.Zero))+0);break;case o.OP_BOOLOR:m=new s((0!==b.cmp(s.Zero)||0!==v.cmp(s.Zero))+0);break;case o.OP_NUMEQUAL:case o.OP_NUMEQUALVERIFY:m=new s((0===b.cmp(v))+0);break;case o.OP_NUMNOTEQUAL:m=new s((0!==b.cmp(v))+0);break;case o.OP_LESSTHAN:m=new s((b.cmp(v)<0)+0);break;case o.OP_GREATERTHAN:m=new s((b.cmp(v)>0)+0);break;case o.OP_LESSTHANOREQUAL:m=new s((b.cmp(v)<=0)+0);break;case o.OP_GREATERTHANOREQUAL:m=new s((b.cmp(v)>=0)+0);break;case o.OP_MIN:m=b.cmp(v)<0?b:v;break;case o.OP_MAX:m=b.cmp(v)>0?b:v}if(this.stack.pop(),this.stack.pop(),this.stack.push(m.toScriptNumBuffer()),T===o.OP_NUMEQUALVERIFY){if(!f.castToBool(this.stack[this.stack.length-1]))return this.errstr="SCRIPT_ERR_NUMEQUALVERIFY",!1;this.stack.pop()}break;case o.OP_WITHIN:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;b=s.fromScriptNumBuffer(this.stack[this.stack.length-3],e),v=s.fromScriptNumBuffer(this.stack[this.stack.length-2],e);var R=s.fromScriptNumBuffer(this.stack[this.stack.length-1],e);A=v.cmp(b)<=0&&b.cmp(R)<0,this.stack.pop(),this.stack.pop(),this.stack.pop(),this.stack.push(A?f.true:f.false);break;case o.OP_RIPEMD160:case o.OP_SHA1:case o.OP_SHA256:case o.OP_HASH160:case o.OP_HASH256:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var N;r=this.stack[this.stack.length-1],T===o.OP_RIPEMD160?N=a.ripemd160(r):T===o.OP_SHA1?N=a.sha1(r):T===o.OP_SHA256?N=a.sha256(r):T===o.OP_HASH160?N=a.sha256ripemd160(r):T===o.OP_HASH256&&(N=a.sha256sha256(r)),this.stack.pop(),this.stack.push(N);break;case o.OP_CODESEPARATOR:this.pbegincodehash=this.pc;break;case o.OP_CHECKSIG:case o.OP_CHECKSIGVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;_=this.stack[this.stack.length-2],w=this.stack[this.stack.length-1],S=(new i).set({chunks:this.script.chunks.slice(this.pbegincodehash)});var j=(new i).add(_);if(S.findAndDelete(j),!this.checkSignatureEncoding(_)||!this.checkPubkeyEncoding(w))return!1;try{E=u.fromTxFormat(_),k=c.fromBuffer(w,!1),x=this.tx.verifySignature(E,k,this.nin,S)}catch(e){x=!1}if(this.stack.pop(),this.stack.pop(),this.stack.push(x?f.true:f.false),T===o.OP_CHECKSIGVERIFY){if(!x)return this.errstr="SCRIPT_ERR_CHECKSIGVERIFY",!1;this.stack.pop()}break;case o.OP_CHECKMULTISIG:case o.OP_CHECKMULTISIGVERIFY:var L=1;if(this.stack.length20)return this.errstr="SCRIPT_ERR_PUBKEY_COUNT",!1;if(this.nOpCount+=M,this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;var D=++L;if(L+=M,this.stack.lengthM)return this.errstr="SCRIPT_ERR_SIG_COUNT",!1;var F=++L;if(L+=U,this.stack.length0;){if(_=this.stack[this.stack.length-F],w=this.stack[this.stack.length-D],!this.checkSignatureEncoding(_)||!this.checkPubkeyEncoding(w))return!1;var q;try{E=u.fromTxFormat(_),k=c.fromBuffer(w,!1),q=this.tx.verifySignature(E,k,this.nin,S)}catch(e){q=!1}q&&(F++,U--),D++,M--,U>M&&(x=!1)}for(;L-- >1;)this.stack.pop();if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(this.flags&f.SCRIPT_VERIFY_NULLDUMMY&&this.stack[this.stack.length-1].length)return this.errstr="SCRIPT_ERR_SIG_NULLDUMMY",!1;if(this.stack.pop(),this.stack.push(x?f.true:f.false),T===o.OP_CHECKMULTISIGVERIFY){if(!x)return this.errstr="SCRIPT_ERR_CHECKMULTISIGVERIFY",!1;this.stack.pop()}break;default:return this.errstr="SCRIPT_ERR_BAD_OPCODE",!1}return!0}}).call(this,r(0).Buffer)},function(e,t){e.exports=function(e,t){for(var r=0,n=0;nt[n]?1:0,0==r);++n);return 0==r&&(t.length>e.length?r=-1:e.length>t.length&&(r=1)),r}},function(e,t,r){"use strict";var n=r(85),i=r(21),o=r(25),s=r(174),a=r(98),u=r(97),c=r(67),f=r(66),l=r(175);function h(){s.apply(this,arguments)}n(h,s),h.prototype.getSignatures=function(e,t,r,n){i.checkState(this.output instanceof a),n=n||f.SIGHASH_ALL;var o=t.toPublicKey();return o.toString()===this.output.script.getPublicKey().toString("hex")?[new l({publicKey:o,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:u.sign(e,t,n,r,this.output.script),sigtype:n})]:[]},h.prototype.addSignature=function(e,t){return i.checkState(this.isValidSignature(e,t),"Signature is invalid"),this.setScript(c.buildPublicKeyIn(t.signature.toDER(),t.sigtype)),this},h.prototype.clearSignatures=function(){return this.setScript(c.empty()),this},h.prototype.isFullySigned=function(){return this.script.isPublicKeyIn()},h.SCRIPT_MAX_SIZE=73,h.prototype._estimateSize=function(){return h.SCRIPT_MAX_SIZE},e.exports=h},function(e,t,r){"use strict";var n=r(85),i=r(21),o=r(25),s=r(46),a=r(174),u=r(98),c=r(97),f=r(67),l=r(66),h=r(175);function d(){a.apply(this,arguments)}n(d,a),d.prototype.getSignatures=function(e,t,r,n,a){return i.checkState(this.output instanceof u),a=a||s.sha256ripemd160(t.publicKey.toBuffer()),n=n||l.SIGHASH_ALL,o.equals(a,this.output.script.getPublicKeyHash())?[new h({publicKey:t.publicKey,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:c.sign(e,t,n,r,this.output.script),sigtype:n})]:[]},d.prototype.addSignature=function(e,t){return i.checkState(this.isValidSignature(e,t),"Signature is invalid"),this.setScript(f.buildPublicKeyHashIn(t.publicKey,t.signature.toDER(),t.sigtype)),this},d.prototype.clearSignatures=function(){return this.setScript(f.empty()),this},d.prototype.isFullySigned=function(){return this.script.isPublicKeyHashIn()},d.SCRIPT_MAX_SIZE=107,d.prototype._estimateSize=function(){return d.SCRIPT_MAX_SIZE},e.exports=d},function(e,t,r){"use strict";var n=r(15),i=r(85),o=r(311),s=r(174),a=r(98),u=r(21),c=r(67),f=r(66),l=r(97),h=r(76),d=r(25),p=r(175);function y(e,t,r,i){s.apply(this,arguments);var o=this;t=t||e.publicKeys,r=r||e.threshold,i=i||e.signatures,this.publicKeys=n.sortBy(t,function(e){return e.toString("hex")}),u.checkState(c.buildMultisigOut(this.publicKeys,r).equals(this.output.script),"Provided public keys don't match to the provided output script"),this.publicKeyIndex={},n.each(this.publicKeys,function(e,t){o.publicKeyIndex[e.toString()]=t}),this.threshold=r,this.signatures=i?this._deserializeSignatures(i):new Array(this.publicKeys.length)}i(y,s),y.prototype.toObject=function(){var e=s.prototype.toObject.apply(this,arguments);return e.threshold=this.threshold,e.publicKeys=n.map(this.publicKeys,function(e){return e.toString()}),e.signatures=this._serializeSignatures(),e},y.prototype._deserializeSignatures=function(e){return n.map(e,function(e){if(e)return new p(e)})},y.prototype._serializeSignatures=function(){return n.map(this.signatures,function(e){if(e)return e.toObject()})},y.prototype.getSignatures=function(e,t,r,i){u.checkState(this.output instanceof a),i=i||f.SIGHASH_ALL;var o=this,s=[];return n.each(this.publicKeys,function(n){n.toString()===t.publicKey.toString()&&s.push(new p({publicKey:t.publicKey,prevTxId:o.prevTxId,outputIndex:o.outputIndex,inputIndex:r,signature:l.sign(e,t,i,r,o.output.script),sigtype:i}))}),s},y.prototype.addSignature=function(e,t){return u.checkState(!this.isFullySigned(),"All needed signatures have already been added"),u.checkArgument(!n.isUndefined(this.publicKeyIndex[t.publicKey.toString()]),"Signature has no matching public key"),u.checkState(this.isValidSignature(e,t)),this.signatures[this.publicKeyIndex[t.publicKey.toString()]]=t,this._updateScript(),this},y.prototype._updateScript=function(){return this.setScript(c.buildMultisigIn(this.publicKeys,this.threshold,this._createSignatures())),this},y.prototype._createSignatures=function(){return n.map(n.filter(this.signatures,function(e){return!n.isUndefined(e)}),function(e){return d.concat([e.signature.toDER(),d.integerAsSingleByteBuffer(e.sigtype)])})},y.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},y.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},y.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},y.prototype.countSignatures=function(){return n.reduce(this.signatures,function(e,t){return e+!!t},0)},y.prototype.publicKeysWithoutSignature=function(){var e=this;return n.filter(this.publicKeys,function(t){return!e.signatures[e.publicKeyIndex[t.toString()]]})},y.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,l.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script)},y.normalizeSignatures=function(e,t,r,n,i){return i.map(function(i){var o=null;return n=n.filter(function(n){if(o)return!0;var s=new p({signature:f.fromTxFormat(n),publicKey:i,prevTxId:t.prevTxId,outputIndex:t.outputIndex,inputIndex:r,sigtype:f.SIGHASH_ALL});s.signature.nhashtype=s.sigtype;var a=l.verify(e,s.signature,s.publicKey,s.inputIndex,t.output.script);return!a||(o=s,!1)}),o||null})},y.OPCODES_SIZE=1,y.SIGNATURE_SIZE=73,y.prototype._estimateSize=function(){return y.OPCODES_SIZE+this.threshold*y.SIGNATURE_SIZE},e.exports=y},function(e,t,r){"use strict";var n=r(15),i=r(85),o=r(174),s=r(98),a=r(21),u=r(67),c=r(66),f=r(97),l=r(76),h=r(25),d=r(175);function p(e,t,r,i){o.apply(this,arguments);var s=this;t=t||e.publicKeys,r=r||e.threshold,i=i||e.signatures,this.publicKeys=n.sortBy(t,function(e){return e.toString("hex")}),this.redeemScript=u.buildMultisigOut(this.publicKeys,r),a.checkState(u.buildScriptHashOut(this.redeemScript).equals(this.output.script),"Provided public keys don't hash to the provided output"),this.publicKeyIndex={},n.each(this.publicKeys,function(e,t){s.publicKeyIndex[e.toString()]=t}),this.threshold=r,this.signatures=i?this._deserializeSignatures(i):new Array(this.publicKeys.length)}i(p,o),p.prototype.toObject=function(){var e=o.prototype.toObject.apply(this,arguments);return e.threshold=this.threshold,e.publicKeys=n.map(this.publicKeys,function(e){return e.toString()}),e.signatures=this._serializeSignatures(),e},p.prototype._deserializeSignatures=function(e){return n.map(e,function(e){if(e)return new d(e)})},p.prototype._serializeSignatures=function(){return n.map(this.signatures,function(e){if(e)return e.toObject()})},p.prototype.getSignatures=function(e,t,r,i){a.checkState(this.output instanceof s),i=i||c.SIGHASH_ALL;var o=this,u=[];return n.each(this.publicKeys,function(n){n.toString()===t.publicKey.toString()&&u.push(new d({publicKey:t.publicKey,prevTxId:o.prevTxId,outputIndex:o.outputIndex,inputIndex:r,signature:f.sign(e,t,i,r,o.redeemScript),sigtype:i}))}),u},p.prototype.addSignature=function(e,t){return a.checkState(!this.isFullySigned(),"All needed signatures have already been added"),a.checkArgument(!n.isUndefined(this.publicKeyIndex[t.publicKey.toString()]),"Signature has no matching public key"),a.checkState(this.isValidSignature(e,t)),this.signatures[this.publicKeyIndex[t.publicKey.toString()]]=t,this._updateScript(),this},p.prototype._updateScript=function(){return this.setScript(u.buildP2SHMultisigIn(this.publicKeys,this.threshold,this._createSignatures(),{cachedMultisig:this.redeemScript})),this},p.prototype._createSignatures=function(){return n.map(n.filter(this.signatures,function(e){return!n.isUndefined(e)}),function(e){return h.concat([e.signature.toDER(),h.integerAsSingleByteBuffer(e.sigtype)])})},p.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},p.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},p.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},p.prototype.countSignatures=function(){return n.reduce(this.signatures,function(e,t){return e+!!t},0)},p.prototype.publicKeysWithoutSignature=function(){var e=this;return n.filter(this.publicKeys,function(t){return!e.signatures[e.publicKeyIndex[t.toString()]]})},p.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,f.verify(e,t.signature,t.publicKey,t.inputIndex,this.redeemScript)},p.OPCODES_SIZE=7,p.SIGNATURE_SIZE=74,p.PUBKEY_SIZE=34,p.prototype._estimateSize=function(){return p.OPCODES_SIZE+this.threshold*p.SIGNATURE_SIZE+this.publicKeys.length*p.PUBKEY_SIZE},e.exports=p},function(e,t,r){"use strict";var n=r(15),i=r(21),o=r(39),s=r(0),a=r(61),u=r(25),c=r(34),f=r(1024),l=2,h=2,d=601;function p(e){return this instanceof p?(this.nullifiers=[],this.commitments=[],this.ciphertexts=[],this.macs=[],e?this._fromObject(e):void 0):new p(e)}Object.defineProperty(p.prototype,"vpub_old",{configurable:!1,enumerable:!0,get:function(){return this._vpub_old},set:function(e){e instanceof o?(this._vpub_oldBN=e,this._vpub_old=e.toNumber()):n.isString(e)?(this._vpub_old=parseInt(e),this._vpub_oldBN=o.fromNumber(this._vpub_old)):(i.checkArgument(c.isNaturalNumber(e),"vpub_old is not a natural number"),this._vpub_oldBN=o.fromNumber(e),this._vpub_old=e),i.checkState(c.isNaturalNumber(this._vpub_old),"vpub_old is not a natural number")}}),Object.defineProperty(p.prototype,"vpub_new",{configurable:!1,enumerable:!0,get:function(){return this._vpub_new},set:function(e){e instanceof o?(this._vpub_newBN=e,this._vpub_new=e.toNumber()):n.isString(e)?(this._vpub_new=parseInt(e),this._vpub_newBN=o.fromNumber(this._vpub_new)):(i.checkArgument(c.isNaturalNumber(e),"vpub_new is not a natural number"),this._vpub_newBN=o.fromNumber(e),this._vpub_new=e),i.checkState(c.isNaturalNumber(this._vpub_new),"vpub_new is not a natural number")}}),p.fromObject=function(e){i.checkArgument(n.isObject(e));var t=new p;return t._fromObject(e)},p.prototype._fromObject=function(e){var t=[];n.each(e.nullifiers,function(e){t.push(u.reverse(new s.Buffer(e,"hex")))});var r=[];n.each(e.commitments,function(e){r.push(u.reverse(new s.Buffer(e,"hex")))});var i=[];n.each(e.ciphertexts,function(e){i.push(new s.Buffer(e,"hex"))});var o=[];return n.each(e.macs,function(e){o.push(u.reverse(new s.Buffer(e,"hex")))}),this.vpub_old=e.vpub_old,this.vpub_new=e.vpub_new,this.anchor=u.reverse(new s.Buffer(e.anchor,"hex")),this.nullifiers=t,this.commitments=r,this.ephemeralKey=u.reverse(new s.Buffer(e.ephemeralKey,"hex")),this.ciphertexts=i,this.randomSeed=u.reverse(new s.Buffer(e.randomSeed,"hex")),this.macs=o,this.proof=f.fromObject(e.proof),this},p.prototype.toObject=p.prototype.toJSON=function e(){var t=[];n.each(this.nullifiers,function(e){t.push(u.reverse(e).toString("hex"))});var r=[];n.each(this.commitments,function(e){r.push(u.reverse(e).toString("hex"))});var i=[];n.each(this.ciphertexts,function(e){i.push(e.toString("hex"))});var o=[];n.each(this.macs,function(e){o.push(u.reverse(e).toString("hex"))});var s={vpub_old:this.vpub_old,vpub_new:this.vpub_new,anchor:u.reverse(this.anchor).toString("hex"),nullifiers:t,commitments:r,ephemeralKey:u.reverse(this.ephemeralKey).toString("hex"),ciphertexts:i,randomSeed:u.reverse(this.randomSeed).toString("hex"),macs:o,proof:this.proof.toObject()};return s},p.fromBufferReader=function(e){var t,r=new p;for(r.vpub_old=e.readUInt64LEBN(),r.vpub_new=e.readUInt64LEBN(),r.anchor=e.read(32),t=0;t<2;t++)r.nullifiers.push(e.read(32));for(t=0;t<2;t++)r.commitments.push(e.read(32));for(r.ephemeralKey=e.read(32),r.randomSeed=e.read(32),t=0;t<2;t++)r.macs.push(e.read(32));for(r.proof=f.fromBufferReader(e),t=0;t<2;t++)r.ciphertexts.push(e.read(601));return r},p.prototype.toBufferWriter=function(e){var t;for(e||(e=new a),e.writeUInt64LEBN(this._vpub_oldBN),e.writeUInt64LEBN(this._vpub_newBN),e.write(this.anchor),t=0;t<2;t++)e.write(this.nullifiers[t]);for(t=0;t<2;t++)e.write(this.commitments[t]);for(e.write(this.ephemeralKey),e.write(this.randomSeed),t=0;t<2;t++)e.write(this.macs[t]);for(this.proof.toBufferWriter(e),t=0;t<2;t++)e.write(this.ciphertexts[t]);return e},e.exports=p},function(e,t,r){"use strict";var n=r(21),i=r(0),o=r(61),s=2,a=10;function u(e){return this instanceof u?e?this._fromObject(e):void 0:new u(e)}function c(e){return this instanceof c?e?this._fromObject(e):void 0:new c(e)}function f(e){return this instanceof f?e?this._fromObject(e):void 0:new f(e)}u.fromObject=function(e){n.checkArgument(_.isObject(e));var t=new u;return t._fromObject(e)},u.prototype._fromObject=function(e){return this.y_lsb=e.y_lsb,this.x=new i.Buffer(e.x,"hex"),this},u.prototype.toObject=u.prototype.toJSON=function e(){var t={y_lsb:this.y_lsb,x:this.x.toString("hex")};return t},u.fromBufferReader=function(e){var t=new u,r=e.readUInt8();return t.y_lsb=1&r,t.x=e.read(32),t},u.prototype.toBufferWriter=function(e){return e||(e=new o),e.writeUInt8(2|this.y_lsb),e.write(this.x),e},c.fromObject=function(e){n.checkArgument(_.isObject(e));var t=new c;return t._fromObject(e)},c.prototype._fromObject=function(e){return this.y_gt=e.y_gt,this.x=new i.Buffer(e.x,"hex"),this},c.prototype.toObject=c.prototype.toJSON=function e(){var t={y_gt:this.y_gt,x:this.x.toString("hex")};return t},c.fromBufferReader=function(e){var t=new c,r=e.readUInt8();return t.y_gt=1&r,t.x=e.read(64),t},c.prototype.toBufferWriter=function(e){return e||(e=new o),e.writeUInt8(10|this.y_gt),e.write(this.x),e},f.fromObject=function(e){n.checkArgument(_.isObject(e));var t=new f;return t._fromObject(e)},f.prototype._fromObject=function(e){return this.g_A=u.fromObject(e.g_A),this.g_A_prime=u.fromObject(e.g_A_prime),this.g_B=c.fromObject(e.g_B),this.g_B_prime=u.fromObject(e.g_B_prime),this.g_C=u.fromObject(e.g_C),this.g_C_prime=u.fromObject(e.g_C_prime),this.g_K=u.fromObject(e.g_K),this.g_H=u.fromObject(e.g_H),this},f.prototype.toObject=f.prototype.toJSON=function e(){var t={g_A:this.g_A.toObject(),g_A_prime:this.g_A_prime.toObject(),g_B:this.g_B.toObject(),g_B_prime:this.g_B_prime.toObject(),g_C:this.g_C.toObject(),g_C_prime:this.g_C_prime.toObject(),g_K:this.g_K.toObject(),g_H:this.g_H.toObject()};return t},f.fromBufferReader=function(e){var t=new f;return t.g_A=u.fromBufferReader(e),t.g_A_prime=u.fromBufferReader(e),t.g_B=c.fromBufferReader(e),t.g_B_prime=u.fromBufferReader(e),t.g_C=u.fromBufferReader(e),t.g_C_prime=u.fromBufferReader(e),t.g_K=u.fromBufferReader(e),t.g_H=u.fromBufferReader(e),t},f.prototype.toBufferWriter=function(e){return e||(e=new o),this.g_A.toBufferWriter(e),this.g_A_prime.toBufferWriter(e),this.g_B.toBufferWriter(e),this.g_B_prime.toBufferWriter(e),this.g_C.toBufferWriter(e),this.g_C_prime.toBufferWriter(e),this.g_K.toBufferWriter(e),this.g_H.toBufferWriter(e),e},e.exports=f},function(e,t,r){"use strict";(function(t){var n=r(61),i=r(96),o=r(39),s=function e(r){if(!(this instanceof e))return new e(r);if(t.isBuffer(r))this.buf=r;else if("number"==typeof r){var n=r;this.fromNumber(n)}else if(r instanceof o){var i=r;this.fromBN(i)}else if(r){var s=r;this.set(s)}};s.prototype.set=function(e){return this.buf=e.buf||this.buf,this},s.prototype.fromString=function(e){return this.set({buf:new t(e,"hex")}),this},s.prototype.toString=function(){return this.buf.toString("hex")},s.prototype.fromBuffer=function(e){return this.buf=e,this},s.prototype.fromBufferReader=function(e){return this.buf=e.readVarintBuf(),this},s.prototype.fromBN=function(e){return this.buf=n().writeVarintBN(e).concat(),this},s.prototype.fromNumber=function(e){return this.buf=n().writeVarintNum(e).concat(),this},s.prototype.toBuffer=function(){return this.buf},s.prototype.toBN=function(){return i(this.buf).readVarintBN()},s.prototype.toNumber=function(){return i(this.buf).readVarintNum()},e.exports=s}).call(this,r(0).Buffer)},function(e,t,r){e.exports=r(1027),e.exports.BlockHeader=r(235),e.exports.MerkleBlock=r(494)},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(235),o=r(39),s=r(25),a=r(96),u=r(61),c=r(46),f=r(233),l=r(21);function h(e){return this instanceof h?(n.extend(this,h._from(e)),this):new h(e)}h.MAX_BLOCK_SIZE=1e6,h._from=function e(t){var r={};if(s.isBuffer(t))r=h._fromBufferReader(a(t));else{if(!n.isObject(t))throw new TypeError("Unrecognized argument for Block");r=h._fromObject(t)}return r},h._fromObject=function e(t){var r=[];t.transactions.forEach(function(e){e instanceof f?r.push(e):r.push(f().fromObject(e))});var n={header:i.fromObject(t.header),transactions:r};return n},h.fromObject=function e(t){var r=h._fromObject(t);return new h(r)},h._fromBufferReader=function e(t){var r={};l.checkState(!t.finished(),"No block data received"),r.header=i.fromBufferReader(t);var n=t.readVarintNum();r.transactions=[];for(var o=0;o1;i=Math.floor((i+1)/2)){for(var o=0;o"},h.Values={START_OF_BLOCK:8,NULL_HASH:new t("0000000000000000000000000000000000000000000000000000000000000000","hex")},e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(15),i=r(35),o=r(120),s=r(313),a=function(e,t){if(!(this instanceof a))return new a(e,t);if(this.extras={},this.knownParams=t||[],this.address=this.network=this.amount=this.message=null,"string"==typeof e){var r=a.parse(e);r.amount&&(r.amount=this._parseAmount(r.amount)),this._fromObject(r)}else{if("object"!=typeof e)throw new TypeError("Unrecognized data format.");this._fromObject(e)}};a.fromString=function e(t){if("string"!=typeof t)throw new TypeError("Expected a string");return new a(t)},a.fromObject=function e(t){return new a(t)},a.isValid=function(e,t){try{new a(e,t)}catch(e){return!1}return!0},a.parse=function(e){var t=i.parse(e,!0);if("zcash:"!==t.protocol)throw new TypeError("Invalid zcash URI");var r=/[^:]*:\/?\/?([^?]*)/.exec(e);return t.query.address=r&&r[1]||void 0,t.query},a.Members=["address","amount","message","label","r"],a.prototype._fromObject=function(e){if(!o.isValid(e.address))throw new TypeError("Invalid zcash address");for(var t in this.address=new o(e.address),this.network=this.address.network,this.amount=e.amount,e)if("address"!==t&&"amount"!==t){if(/^req-/.exec(t)&&-1===this.knownParams.indexOf(t))throw Error("Unknown required argument "+t);var r=a.Members.indexOf(t)>-1?this:this.extras;r[t]=e[t]}},a.prototype._parseAmount=function(e){if(e=Number(e),isNaN(e))throw new TypeError("Invalid amount");return s.fromBTC(e).toSatoshis()},a.prototype.toObject=a.prototype.toJSON=function e(){for(var t={},r=0;r"},e.exports=a},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(1031),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(100);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){var n=r(498),i=r(502),o=r(5).Buffer,s=r(503),a=r(115),u=r(236),c=r(504),f=r(1);function l(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(l,a),l.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 h=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 l(a.module,t,r)}function y(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)}l.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")},l.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(502),i=r(5).Buffer,o=r(498),s=r(503),a=r(115),u=r(236),c=r(504),f=r(1);function l(e,t,r){a.call(this),this._cache=new h,this._last=void 0,this._cipher=new u.AES(t),this._prev=i.from(r),this._mode=e,this._autopadding=!0}function h(){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},h.prototype.flush=function(){if(this.cache.length)return this.cache},t.createDecipher=y,t.createDecipheriv=p},function(e,t,r){"use strict";(function(n){const i=r(17),o=i(r(317)),s=r(24);t=e.exports;const a={rsa:r(1051),ed25519:r(1065),secp256k1:r(102)(o,r(533))};function u(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=o,t.keyStretcher=r(1078),t.generateEphemeralKeyPair=r(1079),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){(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 l=new RegExp(".{1,"+r+"}","g");n=n.match(l).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(;l>0;)u.push(255&l),l>>=8}for(var h=0;e[h]===a&&h=i.Versions.TLS_1_1.minor&&u.output.putBytes(s),u.update(e.fragment),u.finish(a)&&(e.fragment=u.output,e.length=e.fragment.length(),r=!0),r}function a(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function u(e,t,r){var n=!0;if(r){for(var i=t.length(),o=t.last(),s=i-1-o;s=a?(e.fragment=s.output.getBytes(h-a),f=s.output.getBytes(a)):e.fragment=s.output.getBytes(),e.fragment=n.util.createBuffer(e.fragment),e.length=e.fragment.length();var d=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=l(t.macKey,f,d)&&r,r}function l(e,t,r){var i=n.hmac.create();return i.start("SHA1",e),i.update(t),t=i.digest().getBytes(),i.start(null,null),i.update(r),r=i.digest().getBytes(),t===r}},function(e,t,r){var n=r(13);r(517),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},function(e,t,r){(function(t){var n=r(13);if(r(239),r(68),r(519),r(16),void 0===i)var i=n.jsbn.BigInteger;var o=n.util.ByteBuffer,s=void 0===t?Uint8Array:t;n.pki=n.pki||{},e.exports=n.pki.ed25519=n.ed25519=n.ed25519||{};var a=n.ed25519;function u(e){var r=e.message;if(r instanceof Uint8Array)return r;var n=e.encoding;if(void 0===r){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');r=e.md.digest().getBytes(),n="binary"}if("string"==typeof r&&!n)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof r){if(void 0!==t)return new t(r,n);r=new o(r,n)}else if(!(r instanceof o))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var i=new s(r.length()),a=0;a=0};var c=F(),f=F([1]),l=F([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),h=F([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),d=F([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),p=F([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),y=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]),g=F([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function m(e,r){var i=n.md.sha512.create(),u=new o(e);i.update(u.getBytes(r),"binary");var c=i.digest().getBytes();if(void 0!==t)return new t(c,"binary");for(var f=new s(a.constants.HASH_BYTE_LENGTH),l=0;l<64;++l)f[l]=c.charCodeAt(l);return f}function b(e,t){var r=[F(),F(),F(),F()],n,i=m(t,32);for(i[0]&=248,i[31]&=127,i[31]|=64,j(r,i),A(e,r),n=0;n<32;++n)t[n+32]=e[n];return 0}function v(e,t,r,n){var i,o,s=new Float64Array(64),a=[F(),F(),F(),F()],u=m(n,32);u[0]&=248,u[31]&=127,u[31]|=64;var c=r+64;for(i=0;i=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)*y[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;++i)t[i]-=r*y[i];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function S(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;w(e,t)}function E(e,t){var r=F(),n=F(),i=F(),o=F(),s=F(),a=F(),u=F(),c=F(),f=F();q(r,e[1],e[0]),q(f,t[1],t[0]),z(r,r,f),K(n,e[0],e[1]),K(f,t[0],t[1]),z(n,n,f),z(i,e[3],t[3]),z(i,i,h),z(o,e[2],t[2]),K(o,o,o),q(s,n,r),q(a,o,i),K(u,o,i),K(c,n,r),z(e[0],s,a),z(e[1],c,u),z(e[2],u,a),z(e[3],s,c)}function k(e,t,r){for(var n=0;n<4;++n)U(e[n],t[n],r)}function A(e,t){var r=F(),n=F(),i=F();M(i,t[2]),z(r,t[0],i),z(n,t[1],i),x(e,n),e[31]^=R(r)<<7}function x(e,t){var r,n,i,o=F(),s=F();for(r=0;r<16;++r)s[r]=t[r];for(D(s),D(s),D(s),n=0;n<2;++n){for(o[0]=s[0]-65517,r=1;r<15;++r)o[r]=s[r]-65535-(o[r-1]>>16&1),o[r-1]&=65535;o[15]=s[15]-32767-(o[14]>>16&1),i=o[15]>>16&1,o[14]&=65535,U(s,o,1-i)}for(r=0;r<16;r++)e[2*r]=255&s[r],e[2*r+1]=s[r]>>8}function C(e,t){var r=F(),n=F(),i=F(),o=F(),s=F(),a=F(),u=F();return L(e[2],f),T(e[1],t),H(i,e[1]),z(o,i,l),q(i,i,e[2]),K(o,e[2],o),H(s,o),H(a,s),z(u,a,s),z(r,u,i),z(r,r,o),I(r,r),z(r,r,i),z(r,r,o),z(r,r,o),z(e[0],r,o),H(n,e[0]),z(n,n,o),B(n,i)&&z(e[0],e[0],g),H(n,e[0]),z(n,n,o),B(n,i)?-1:(R(e[0])===t[31]>>7&&q(e[0],c,e[0]),z(e[3],e[0],e[1]),0)}function T(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function I(e,t){var r=F(),n;for(n=0;n<16;++n)r[n]=t[n];for(n=250;n>=0;--n)H(r,r),1!==n&&z(r,r,t);for(n=0;n<16;++n)e[n]=r[n]}function B(e,t){var r=new s(32),n=new s(32);return x(r,e),x(n,t),O(r,0,n,0)}function O(e,t,r,n){return P(e,t,r,n,32)}function P(e,t,r,n,i){var o,s=0;for(o=0;o>>8)-1}function R(e){var t=new s(32);return x(t,e),1&t[0]}function N(e,t,r){var n,i;for(L(e[0],c),L(e[1],f),L(e[2],f),L(e[3],c),i=255;i>=0;--i)n=r[i/8|0]>>(7&i)&1,k(e,t,n),E(t,e),E(e,e),k(e,t,n)}function j(e,t){var r=[F(),F(),F(),F()];L(r[0],d),L(r[1],p),L(r[2],f),z(r[3],d,p),N(e,r,t)}function L(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function M(e,t){var r=F(),n;for(n=0;n<16;++n)r[n]=t[n];for(n=253;n>=0;--n)H(r,r),2!==n&&4!==n&&z(r,r,t);for(n=0;n<16;++n)e[n]=r[n]}function D(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 U(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 F(e){var t,r=new Float64Array(16);if(e)for(t=0;t0&&(a=n.util.fillString(String.fromCharCode(0),u)+a);var c=t.encrypt(a,"NONE"),f=e.generate(a,o);return{encapsulation:c,key:f}},decrypt:function(t,r,n){var i=t.decrypt(r,"NONE");return e.generate(i,n)}};return o},n.kem.kdf1=function(e,t){o(this,e,0,t||e.digestLength)},n.kem.kdf2=function(e,t){o(this,e,1,t||e.digestLength)}},function(e,t,r){e.exports=r(88),r(319),r(178),r(510),r(519)},function(e,t,r){var n=r(13);r(121),r(87),r(237),r(122),r(137),r(516),r(68),r(16),r(321);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,l=0;l="8"&&(r="00"+r);var i=n.util.hexToBytes(r);e.putInt32(i.length),e.putBytes(i)}function s(e,t){e.putInt32(t.length),e.putString(t)}function a(){for(var e=n.md.sha1.create(),t=arguments.length,r=0;r0&&(this.state=x[this.state].block)},C.prototype.unblock=function(e){return e=void 0===e?1:e,this.blocks-=e,0===this.blocks&&this.state!==g&&(this.state=d,I(this,0)),this.blocks},C.prototype.sleep=function(e){e=void 0===e?0:e,this.state=x[this.state].sleep;var t=this;this.timeoutId=setTimeout(function(){t.timeoutId=null,t.state=d,I(t,0)},e)},C.prototype.wait=function(e){e.wait(this)},C.prototype.wakeup=function(){this.state===y&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state=d,I(this,0))},C.prototype.cancel=function(){this.state=x[this.state].cancel,this.permitsNeeded=0,null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null),this.subtasks=[]},C.prototype.fail=function(e){if(this.error=!0,B(this,!0),e)e.error=this.error,e.swapTime=this.swapTime,e.userData=this.userData,I(e,0);else{if(null!==this.parent){for(var t=this.parent;null!==t.parent;)t.error=this.error,t.swapTime=this.swapTime,t.userData=this.userData,t=t.parent;B(t,!0)}this.failureCallback&&this.failureCallback(this)}};var T=function(e){e.error=!1,e.state=x[e.state].start,setTimeout(function(){e.state===d&&(e.swapTime=+new Date,e.run(e),I(e,0))},0)},I=function(e,t){var r=t>30||+new Date-e.swapTime>20,n=function(t){if(t++,e.state===d)if(r&&(e.swapTime=+new Date),e.subtasks.length>0){var n=e.subtasks.shift();n.error=e.error,n.swapTime=e.swapTime,n.userData=e.userData,n.run(n),n.error||I(n,t)}else B(e),e.error||null!==e.parent&&(e.parent.error=e.error,e.parent.swapTime=e.swapTime,e.parent.userData=e.userData,I(e.parent,t))};r?setTimeout(n,0):n(t)},B=function(e,t){e.state=g,delete s[e.id],null===e.parent&&(e.type in u?0===u[e.type].length?n.log.error(i,"[%s][%s] task queue empty [%s]",e.id,e.name,e.type):u[e.type][0]!==e?n.log.error(i,"[%s][%s] task not first in queue [%s]",e.id,e.name,e.type):(u[e.type].shift(),0===u[e.type].length?delete u[e.type]:u[e.type][0].start()):n.log.error(i,"[%s][%s] task queue missing [%s]",e.id,e.name,e.type),t||(e.error&&e.failureCallback?e.failureCallback(e):!e.error&&e.successCallback&&e.successCallback(e)))};e.exports=n.task=n.task||{},n.task.start=function(e){var t=new C({run:e.run,name:e.name||"?"});t.type=e.type,t.successCallback=e.success||null,t.failureCallback=e.failure||null,t.type in u?u[e.type].push(t):(u[t.type]=[t],T(t))},n.task.cancel=function(e){e in u&&(u[e]=[u[e][0]])},n.task.createCondition=function(){var e={tasks:{},wait:function(t){t.id in e.tasks||(t.block(),e.tasks[t.id]=t)},notify:function(){var t=e.tasks;for(var r in e.tasks={},t)t[r].unblock()}};return e}},function(e,t,r){"use strict";const n=r(521),i=r(17),o=r(14),s=r(523),a=i(r(317)),u=r(24),c=r(7);class f{constructor(e){this._key=e}verify(e,t,r){g(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return s.utils.jwkToPkix(this._key)}get bytes(){return a.PublicKey.encode({Type:a.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),n(this.bytes,"sha2-256",e)}}class l{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return s.getRandomValues(new Uint8Array(16))}sign(e,t){g(t),s.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){s.decrypt(this._key,e,t)}marshal(){return s.utils.jwkToPkcs1(this._key)}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(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"),g(r),c(()=>{let n=null,i=null;try{const r=new u.util.ByteBuffer(this.marshal()),o=u.asn1.fromDer(r),s=u.pki.privateKeyFromAsn1(o);if("pkcs-8"===e){const e={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};i=u.pki.encryptRsaPrivateKey(s,t,e)}else n=new Error(`Unknown export format '${e}'`)}catch(e){n=e}r(n,i)})}}function h(e,t){const r=s.utils.pkcs1ToJwk(e);s.unmarshalPrivateKey(r,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function d(e){const t=s.utils.pkixToJwk(e);return new f(t)}function p(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function y(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function g(e){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:d,unmarshalRsaPrivateKey:h,generateKeyPair:y,fromJwk:p}},function(e,t,r){"use strict";(function(t){const n=r(109),i=r(110),o=r(522),s=r(1053),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(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(1054),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(111),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");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){"use strict";(function(t){const n=r(112),i=r(522).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";const n=r(138),i=r(528),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,r){"use strict";const n=r(138),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(123).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(e,t){var r=[].indexOf;e.exports=function(e,t){if(r)return e.indexOf(t);for(var n=0;n{if(t)return e(t);e(null,o.encode(r))})}}function f(e,t){try{e=y(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 l(e){return e=y(e,s.publicKeyLength),new u(e)}function h(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 y(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:l,generateKeyPair:h,generateKeyPairFromSeed:d}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(101),i=r(7);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){},function(e,t,r){"use strict";(function(t){const n=r(109),i=r(110),o=r(530),s=r(1069),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(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(1070),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(111),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");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){"use strict";(function(t){const n=r(112),i=r(530).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";const n=r(1072),i=r(529),o=r(7),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 l(e){if(!n.privateKeyVerify(e))throw new Error("Invalid private key")}function h(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key")}function d(e){return l(e),n.publicKeyCreate(e)}return{generateKey:r,privateKeyLength:32,hashAndSign:a,hashAndVerify:u,compressPublicKey:c,decompressPublicKey:f,validatePrivateKey:l,validatePublicKey:h,computePublicKey:d}})},function(e,t,r){"use strict";e.exports=r(481)(r(1073))},function(e,t,r){"use strict";var n=r(5).Buffer,i=r(133),o=r(1074),s=r(307),a=r(240),u=r(531),c=r(1077);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);return c.mul(t).add(n).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 l=o;if(r>>1){if(l.ucmp(a.psn)>=0)break;l=o.add(a.n)}var h=n.concat([n.from([2+(1&r)]),l.toBuffer()]),d=u.fromPublicKey(h);if(null===d)break;var p=o.uinvm(),y=a.n.sub(a.fromBuffer(e)).umul(p).ureduce(),g=f.umul(p).ureduce(),m=u.fromECJPoint(c.mulAdd(y,d,g));return m.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){"use strict";(function(t){var n=r(298),i=r(1075),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.length>>13,d=0|n[1],p=8191&d,y=d>>>13,g=0|n[2],m=8191&g,b=g>>>13,v=0|n[3],_=8191&v,w=v>>>13,S=0|n[4],E=8191&S,k=S>>>13,A=0|n[5],x=8191&A,C=A>>>13,T=0|n[6],I=8191&T,B=T>>>13,O=0|n[7],P=8191&O,R=O>>>13,N=0|n[8],j=8191&N,L=N>>>13,M=0|n[9],D=8191&M,U=M>>>13,F=0|i[0],K=8191&F,q=F>>>13,H=0|i[1],z=8191&H,V=H>>>13,G=0|i[2],W=8191&G,$=G>>>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],le=8191&fe,he=fe>>>13,de=0|i[9],pe=8191&de,ye=de>>>13;r.length=19,a=Math.imul(l,K),u=Math.imul(l,q),u+=Math.imul(h,K),c=Math.imul(h,q);var ge=s+a+((8191&u)<<13);s=c+(u>>>13)+(ge>>>26),ge&=67108863,a=Math.imul(p,K),u=Math.imul(p,q),u+=Math.imul(y,K),c=Math.imul(y,q),a+=Math.imul(l,z),u+=Math.imul(l,V),u+=Math.imul(h,z),c+=Math.imul(h,V);var me=s+a+((8191&u)<<13);s=c+(u>>>13)+(me>>>26),me&=67108863,a=Math.imul(m,K),u=Math.imul(m,q),u+=Math.imul(b,K),c=Math.imul(b,q),a+=Math.imul(p,z),u+=Math.imul(p,V),u+=Math.imul(y,z),c+=Math.imul(y,V),a+=Math.imul(l,W),u+=Math.imul(l,$),u+=Math.imul(h,W),c+=Math.imul(h,$);var be=s+a+((8191&u)<<13);s=c+(u>>>13)+(be>>>26),be&=67108863,a=Math.imul(_,K),u=Math.imul(_,q),u+=Math.imul(w,K),c=Math.imul(w,q),a+=Math.imul(m,z),u+=Math.imul(m,V),u+=Math.imul(b,z),c+=Math.imul(b,V),a+=Math.imul(p,W),u+=Math.imul(p,$),u+=Math.imul(y,W),c+=Math.imul(y,$),a+=Math.imul(l,J),u+=Math.imul(l,X),u+=Math.imul(h,J),c+=Math.imul(h,X);var ve=s+a+((8191&u)<<13);s=c+(u>>>13)+(ve>>>26),ve&=67108863,a=Math.imul(E,K),u=Math.imul(E,q),u+=Math.imul(k,K),c=Math.imul(k,q),a+=Math.imul(_,z),u+=Math.imul(_,V),u+=Math.imul(w,z),c+=Math.imul(w,V),a+=Math.imul(m,W),u+=Math.imul(m,$),u+=Math.imul(b,W),c+=Math.imul(b,$),a+=Math.imul(p,J),u+=Math.imul(p,X),u+=Math.imul(y,J),c+=Math.imul(y,X),a+=Math.imul(l,Q),u+=Math.imul(l,ee),u+=Math.imul(h,Q),c+=Math.imul(h,ee);var _e=s+a+((8191&u)<<13);s=c+(u>>>13)+(_e>>>26),_e&=67108863,a=Math.imul(x,K),u=Math.imul(x,q),u+=Math.imul(C,K),c=Math.imul(C,q),a+=Math.imul(E,z),u+=Math.imul(E,V),u+=Math.imul(k,z),c+=Math.imul(k,V),a+=Math.imul(_,W),u+=Math.imul(_,$),u+=Math.imul(w,W),c+=Math.imul(w,$),a+=Math.imul(m,J),u+=Math.imul(m,X),u+=Math.imul(b,J),c+=Math.imul(b,X),a+=Math.imul(p,Q),u+=Math.imul(p,ee),u+=Math.imul(y,Q),c+=Math.imul(y,ee),a+=Math.imul(l,re),u+=Math.imul(l,ne),u+=Math.imul(h,re),c+=Math.imul(h,ne);var we=s+a+((8191&u)<<13);s=c+(u>>>13)+(we>>>26),we&=67108863,a=Math.imul(I,K),u=Math.imul(I,q),u+=Math.imul(B,K),c=Math.imul(B,q),a+=Math.imul(x,z),u+=Math.imul(x,V),u+=Math.imul(C,z),c+=Math.imul(C,V),a+=Math.imul(E,W),u+=Math.imul(E,$),u+=Math.imul(k,W),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(m,Q),u+=Math.imul(m,ee),u+=Math.imul(b,Q),c+=Math.imul(b,ee),a+=Math.imul(p,re),u+=Math.imul(p,ne),u+=Math.imul(y,re),c+=Math.imul(y,ne),a+=Math.imul(l,oe),u+=Math.imul(l,se),u+=Math.imul(h,oe),c+=Math.imul(h,se);var Se=s+a+((8191&u)<<13);s=c+(u>>>13)+(Se>>>26),Se&=67108863,a=Math.imul(P,K),u=Math.imul(P,q),u+=Math.imul(R,K),c=Math.imul(R,q),a+=Math.imul(I,z),u+=Math.imul(I,V),u+=Math.imul(B,z),c+=Math.imul(B,V),a+=Math.imul(x,W),u+=Math.imul(x,$),u+=Math.imul(C,W),c+=Math.imul(C,$),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(m,re),u+=Math.imul(m,ne),u+=Math.imul(b,re),c+=Math.imul(b,ne),a+=Math.imul(p,oe),u+=Math.imul(p,se),u+=Math.imul(y,oe),c+=Math.imul(y,se),a+=Math.imul(l,ue),u+=Math.imul(l,ce),u+=Math.imul(h,ue),c+=Math.imul(h,ce);var Ee=s+a+((8191&u)<<13);s=c+(u>>>13)+(Ee>>>26),Ee&=67108863,a=Math.imul(j,K),u=Math.imul(j,q),u+=Math.imul(L,K),c=Math.imul(L,q),a+=Math.imul(P,z),u+=Math.imul(P,V),u+=Math.imul(R,z),c+=Math.imul(R,V),a+=Math.imul(I,W),u+=Math.imul(I,$),u+=Math.imul(B,W),c+=Math.imul(B,$),a+=Math.imul(x,J),u+=Math.imul(x,X),u+=Math.imul(C,J),c+=Math.imul(C,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(m,oe),u+=Math.imul(m,se),u+=Math.imul(b,oe),c+=Math.imul(b,se),a+=Math.imul(p,ue),u+=Math.imul(p,ce),u+=Math.imul(y,ue),c+=Math.imul(y,ce),a+=Math.imul(l,le),u+=Math.imul(l,he),u+=Math.imul(h,le),c+=Math.imul(h,he);var ke=s+a+((8191&u)<<13);s=c+(u>>>13)+(ke>>>26),ke&=67108863,a=Math.imul(D,K),u=Math.imul(D,q),u+=Math.imul(U,K),c=Math.imul(U,q),a+=Math.imul(j,z),u+=Math.imul(j,V),u+=Math.imul(L,z),c+=Math.imul(L,V),a+=Math.imul(P,W),u+=Math.imul(P,$),u+=Math.imul(R,W),c+=Math.imul(R,$),a+=Math.imul(I,J),u+=Math.imul(I,X),u+=Math.imul(B,J),c+=Math.imul(B,X),a+=Math.imul(x,Q),u+=Math.imul(x,ee),u+=Math.imul(C,Q),c+=Math.imul(C,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(m,ue),u+=Math.imul(m,ce),u+=Math.imul(b,ue),c+=Math.imul(b,ce),a+=Math.imul(p,le),u+=Math.imul(p,he),u+=Math.imul(y,le),c+=Math.imul(y,he),a+=Math.imul(l,pe),u+=Math.imul(l,ye),u+=Math.imul(h,pe),c+=Math.imul(h,ye);var Ae=s+a+((8191&u)<<13);s=c+(u>>>13)+(Ae>>>26),Ae&=67108863,a=Math.imul(D,z),u=Math.imul(D,V),u+=Math.imul(U,z),c=Math.imul(U,V),a+=Math.imul(j,W),u+=Math.imul(j,$),u+=Math.imul(L,W),c+=Math.imul(L,$),a+=Math.imul(P,J),u+=Math.imul(P,X),u+=Math.imul(R,J),c+=Math.imul(R,X),a+=Math.imul(I,Q),u+=Math.imul(I,ee),u+=Math.imul(B,Q),c+=Math.imul(B,ee),a+=Math.imul(x,re),u+=Math.imul(x,ne),u+=Math.imul(C,re),c+=Math.imul(C,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(m,le),u+=Math.imul(m,he),u+=Math.imul(b,le),c+=Math.imul(b,he),a+=Math.imul(p,pe),u+=Math.imul(p,ye),u+=Math.imul(y,pe),c+=Math.imul(y,ye);var xe=s+a+((8191&u)<<13);s=c+(u>>>13)+(xe>>>26),xe&=67108863,a=Math.imul(D,W),u=Math.imul(D,$),u+=Math.imul(U,W),c=Math.imul(U,$),a+=Math.imul(j,J),u+=Math.imul(j,X),u+=Math.imul(L,J),c+=Math.imul(L,X),a+=Math.imul(P,Q),u+=Math.imul(P,ee),u+=Math.imul(R,Q),c+=Math.imul(R,ee),a+=Math.imul(I,re),u+=Math.imul(I,ne),u+=Math.imul(B,re),c+=Math.imul(B,ne),a+=Math.imul(x,oe),u+=Math.imul(x,se),u+=Math.imul(C,oe),c+=Math.imul(C,se),a+=Math.imul(E,ue),u+=Math.imul(E,ce),u+=Math.imul(k,ue),c+=Math.imul(k,ce),a+=Math.imul(_,le),u+=Math.imul(_,he),u+=Math.imul(w,le),c+=Math.imul(w,he),a+=Math.imul(m,pe),u+=Math.imul(m,ye),u+=Math.imul(b,pe),c+=Math.imul(b,ye);var Ce=s+a+((8191&u)<<13);s=c+(u>>>13)+(Ce>>>26),Ce&=67108863,a=Math.imul(D,J),u=Math.imul(D,X),u+=Math.imul(U,J),c=Math.imul(U,X),a+=Math.imul(j,Q),u+=Math.imul(j,ee),u+=Math.imul(L,Q),c+=Math.imul(L,ee),a+=Math.imul(P,re),u+=Math.imul(P,ne),u+=Math.imul(R,re),c+=Math.imul(R,ne),a+=Math.imul(I,oe),u+=Math.imul(I,se),u+=Math.imul(B,oe),c+=Math.imul(B,se),a+=Math.imul(x,ue),u+=Math.imul(x,ce),u+=Math.imul(C,ue),c+=Math.imul(C,ce),a+=Math.imul(E,le),u+=Math.imul(E,he),u+=Math.imul(k,le),c+=Math.imul(k,he),a+=Math.imul(_,pe),u+=Math.imul(_,ye),u+=Math.imul(w,pe),c+=Math.imul(w,ye);var Te=s+a+((8191&u)<<13);s=c+(u>>>13)+(Te>>>26),Te&=67108863,a=Math.imul(D,Q),u=Math.imul(D,ee),u+=Math.imul(U,Q),c=Math.imul(U,ee),a+=Math.imul(j,re),u+=Math.imul(j,ne),u+=Math.imul(L,re),c+=Math.imul(L,ne),a+=Math.imul(P,oe),u+=Math.imul(P,se),u+=Math.imul(R,oe),c+=Math.imul(R,se),a+=Math.imul(I,ue),u+=Math.imul(I,ce),u+=Math.imul(B,ue),c+=Math.imul(B,ce),a+=Math.imul(x,le),u+=Math.imul(x,he),u+=Math.imul(C,le),c+=Math.imul(C,he),a+=Math.imul(E,pe),u+=Math.imul(E,ye),u+=Math.imul(k,pe),c+=Math.imul(k,ye);var Ie=s+a+((8191&u)<<13);s=c+(u>>>13)+(Ie>>>26),Ie&=67108863,a=Math.imul(D,re),u=Math.imul(D,ne),u+=Math.imul(U,re),c=Math.imul(U,ne),a+=Math.imul(j,oe),u+=Math.imul(j,se),u+=Math.imul(L,oe),c+=Math.imul(L,se),a+=Math.imul(P,ue),u+=Math.imul(P,ce),u+=Math.imul(R,ue),c+=Math.imul(R,ce),a+=Math.imul(I,le),u+=Math.imul(I,he),u+=Math.imul(B,le),c+=Math.imul(B,he),a+=Math.imul(x,pe),u+=Math.imul(x,ye),u+=Math.imul(C,pe),c+=Math.imul(C,ye);var Be=s+a+((8191&u)<<13);s=c+(u>>>13)+(Be>>>26),Be&=67108863,a=Math.imul(D,oe),u=Math.imul(D,se),u+=Math.imul(U,oe),c=Math.imul(U,se),a+=Math.imul(j,ue),u+=Math.imul(j,ce),u+=Math.imul(L,ue),c+=Math.imul(L,ce),a+=Math.imul(P,le),u+=Math.imul(P,he),u+=Math.imul(R,le),c+=Math.imul(R,he),a+=Math.imul(I,pe),u+=Math.imul(I,ye),u+=Math.imul(B,pe),c+=Math.imul(B,ye);var Oe=s+a+((8191&u)<<13);s=c+(u>>>13)+(Oe>>>26),Oe&=67108863,a=Math.imul(D,ue),u=Math.imul(D,ce),u+=Math.imul(U,ue),c=Math.imul(U,ce),a+=Math.imul(j,le),u+=Math.imul(j,he),u+=Math.imul(L,le),c+=Math.imul(L,he),a+=Math.imul(P,pe),u+=Math.imul(P,ye),u+=Math.imul(R,pe),c+=Math.imul(R,ye);var Pe=s+a+((8191&u)<<13);s=c+(u>>>13)+(Pe>>>26),Pe&=67108863,a=Math.imul(D,le),u=Math.imul(D,he),u+=Math.imul(U,le),c=Math.imul(U,he),a+=Math.imul(j,pe),u+=Math.imul(j,ye),u+=Math.imul(L,pe),c+=Math.imul(L,ye);var Re=s+a+((8191&u)<<13);s=c+(u>>>13)+(Re>>>26),Re&=67108863,a=Math.imul(D,pe),u=Math.imul(D,ye),u+=Math.imul(U,pe),c=Math.imul(U,ye);var Ne=s+a+((8191&u)<<13);return s=c+(u>>>13)+(Ne>>>26),Ne&=67108863,o[0]=ge,o[1]=me,o[2]=be,o[3]=ve,o[4]=_e,o[5]=we,o[6]=Se,o[7]=Ee,o[8]=ke,o[9]=Ae,o[10]=xe,o[11]=Ce,o[12]=Te,o[13]=Ie,o[14]=Be,o[15]=Oe,o[16]=Pe,o[17]=Re,o[18]=Ne,0!==s&&(o[19]=s,r.length++),r}},function(e,t,r){"use strict";var n=r(5).Buffer,i=r(240),o=r(531),s=r(532);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;l--)f=(f<<1)+i[l];u.push(f)}for(var h=new s(null,null,null),d=new s(null,null,null),p=a;p>0;p--){for(var y=0;y=0;f--){for(var l=0;f>=0&&(c[0]=0|a[0][f],c[1]=0|a[1][f],0===c[0]&&0===c[1]);++l,--f);if(f>=0&&(l+=1),u=u.dblp(l),f<0)break;for(var h=0;h<2;h++){var d=c[h],p;0!==d&&(d>0?p=o[h][d>>1]:d<0&&(p=o[h][-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(60),i=r(497),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,l=20,h=t.from("key expansion"),d=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(h,(e,i)=>{if(e)return a(e);let o=[],s=0;function u(e){r.digest(t.concat([i,h]),(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 l(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(316)(),i=r(315),o=r(138).bignum,s=r(528),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",h(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:l(e),genSharedKey:o}))}),r)};const f={"P-256":32,"P-384":48,"P-521":66};function l(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 h(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=h(e,t.public);return r.d=a(new o(t.private)),r}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(24),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function o(e,t,r,o,s){const a=i[s];if(!a)throw new Error(`Hash '${s}' is unknown or not supported`);const u=n.pkcs5.pbkdf2(e,t,r,o,a);return n.util.encode64(u)}e.exports=o},function(e,t,r){"use strict";(function(n){const i=r(18),o=r(1083),s=r(20),a=r(6);class u{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.keys.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return o.keys.marshalPrivateKey(this.privKey)}toPrint(){return this.toJSON()}toJSON(){return{id:this.toB58String(),privKey:c(this.marshalPrivKey()),pubKey:c(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"))}}function c(e){if(e)return e.toString("base64")}t=e.exports=u,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.keys.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 u(r,n))})},t.createFromHexString=function(e){return new u(i.fromHexString(e))},t.createFromBytes=function(e){return new u(e)},t.createFromB58String=function(e){return new u(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.keys.unmarshalPublicKey(i)}catch(e){return t(e)}r.hash((e,n)=>{if(e)return t(e);t(null,new u(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.keys.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 u(r,n,n.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r,s,c,f;try{r=i.fromB58String(e.id),s=e.privKey&&n.from(e.privKey,"base64"),c=e.pubKey&&n.from(e.pubKey,"base64"),f=c&&o.keys.unmarshalPublicKey(c)}catch(e){return t(e)}s?a([e=>o.keys.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)}),(e,t,r)=>{f?f.hash((n,i)=>{r(n,e,t,i)}):r(null,e,t)}],(e,n,i,o)=>e?t(e):f&&!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 u(r,i,f))):t(null,new u(r,null,f))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(534),i=r(1085),o=r(1087);t=e.exports,t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(543),t.pbkdf2=r(1106)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(1086),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(100);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(17),o=i(r(325)),s=r(24);t=e.exports;const a={rsa:r(1088),ed25519:r(1101),secp256k1:r(102)(o,r(543))};function u(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=o,t.keyStretcher=r(1103),t.generateEphemeralKeyPair=r(1104),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){"use strict";const n=r(535),i=r(17),o=r(14),s=r(537),a=i(r(325)),u=r(24),c=r(7);class f{constructor(e){this._key=e}verify(e,t,r){g(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return s.utils.jwkToPkix(this._key)}get bytes(){return a.PublicKey.encode({Type:a.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),n(this.bytes,"sha2-256",e)}}class l{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return s.getRandomValues(new Uint8Array(16))}sign(e,t){g(t),s.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){s.decrypt(this._key,e,t)}marshal(){return s.utils.jwkToPkcs1(this._key)}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(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"),g(r),c(()=>{let n=null,i=null;try{const r=new u.util.ByteBuffer(this.marshal()),o=u.asn1.fromDer(r),s=u.pki.privateKeyFromAsn1(o);if("pkcs-8"===e){const e={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};i=u.pki.encryptRsaPrivateKey(s,t,e)}else n=new Error(`Unknown export format '${e}'`)}catch(e){n=e}r(n,i)})}}function h(e,t){const r=s.utils.pkcs1ToJwk(e);s.unmarshalPrivateKey(r,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function d(e){const t=s.utils.pkixToJwk(e);return new f(t)}function p(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function y(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function g(e){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:d,unmarshalRsaPrivateKey:h,generateKeyPair:y,fromJwk:p}},function(e,t,r){"use strict";(function(t){const n=r(109),i=r(110),o=r(536),s=r(1090),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(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(1091),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(111),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");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){"use strict";(function(t){const n=r(112),i=r(536).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";const n=r(139),i=r(542),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,r){"use strict";const n=r(139),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(123).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(e,t,r){"use strict";const n=r(1);function i(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function o(e,t){this.path=e,this.rethrow(t)}t.Reporter=i,i.prototype.isError=function e(t){return t instanceof o},i.prototype.save=function e(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},i.prototype.restore=function e(t){const r=this._reporterState;r.obj=t.obj,r.path=r.path.slice(0,t.pathLen)},i.prototype.enterKey=function e(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function e(t){const r=this._reporterState;r.path=r.path.slice(0,t-1)},i.prototype.leaveKey=function e(t,r,n){const i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[r]=n)},i.prototype.path=function e(){return this._reporterState.path.join("/")},i.prototype.enterObject=function e(){const t=this._reporterState,r=t.obj;return t.obj={},r},i.prototype.leaveObject=function e(t){const r=this._reporterState,n=r.obj;return r.obj=t,n},i.prototype.error=function e(t){let r;const n=this._reporterState,i=t instanceof o;if(r=i?t:new o(n.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),t.message||t,t.stack),!n.options.partial)throw r;return i||n.errors.push(r),r},i.prototype.wrapResult=function e(t){const r=this._reporterState;return r.options.partial?{result:this.isError(t)?null:t,errors:r.errors}:t},n(o,Error),o.prototype.rethrow=function e(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},function(e,t,r){"use strict";const n=r(180).Reporter,i=r(180).EncoderBuffer,o=r(180).DecoderBuffer,s=r(50),a=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(a),c=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function f(e,t){const r={};this._baseState=r,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}e.exports=f;const l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];f.prototype.clone=function e(){const t=this._baseState,r={};l.forEach(function(e){r[e]=t[e]});const n=new this.constructor(r.parent);return n._baseState=r,n},f.prototype._wrap=function e(){const t=this._baseState;u.forEach(function(e){this[e]=function r(){const n=new this.constructor(this);return t.children.push(n),n[e].apply(n,arguments)}},this)},f.prototype._init=function e(t){const r=this._baseState;s(null===r.parent),t.call(this),r.children=r.children.filter(function(e){return e._baseState.parent===this},this),s.equal(r.children.length,1,"Root node can have only one child")},f.prototype._useArgs=function e(t){const r=this._baseState,n=t.filter(function(e){return e instanceof this.constructor},this);t=t.filter(function(e){return!(e instanceof this.constructor)},this),0!==n.length&&(s(null===r.children),r.children=n,n.forEach(function(e){e._baseState.parent=this},this)),0!==t.length&&(s(null===r.args),r.args=t,r.reverseArgs=t.map(function(e){if("object"!=typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach(function(r){r==(0|r)&&(r|=0);const n=e[r];t[n]=r}),t}))},c.forEach(function(e){f.prototype[e]=function t(){const r=this._baseState;throw new Error(e+" not implemented for encoding: "+r.enc)}}),a.forEach(function(e){f.prototype[e]=function t(){const r=this._baseState,n=Array.prototype.slice.call(arguments);return s(null===r.tag),r.tag=e,this._useArgs(n),this}}),f.prototype.use=function e(t){s(t);const r=this._baseState;return s(null===r.use),r.use=t,this},f.prototype.optional=function e(){const t=this._baseState;return t.optional=!0,this},f.prototype.def=function e(t){const r=this._baseState;return s(null===r.default),r.default=t,r.optional=!0,this},f.prototype.explicit=function e(t){const r=this._baseState;return s(null===r.explicit&&null===r.implicit),r.explicit=t,this},f.prototype.implicit=function e(t){const r=this._baseState;return s(null===r.explicit&&null===r.implicit),r.implicit=t,this},f.prototype.obj=function e(){const t=this._baseState,r=Array.prototype.slice.call(arguments);return t.obj=!0,0!==r.length&&this._useArgs(r),this},f.prototype.key=function e(t){const r=this._baseState;return s(null===r.key),r.key=t,this},f.prototype.any=function e(){const t=this._baseState;return t.any=!0,this},f.prototype.choice=function e(t){const r=this._baseState;return s(null===r.choice),r.choice=t,this._useArgs(Object.keys(t).map(function(e){return t[e]})),this},f.prototype.contains=function e(t){const r=this._baseState;return s(null===r.use),r.contains=t,this},f.prototype._decode=function e(t,r){const n=this._baseState;if(null===n.parent)return t.wrapResult(n.children[0]._decode(t,r));let i=n.default,s=!0,a=null,u;if(null!==n.key&&(a=t.enterKey(n.key)),n.optional){let e=null;if(null!==n.explicit?e=n.explicit:null!==n.implicit?e=n.implicit:null!==n.tag&&(e=n.tag),null!==e||n.any){if(s=this._peekTag(t,e,n.any),t.isError(s))return s}else{const e=t.save();try{null===n.choice?this._decodeGeneric(n.tag,t,r):this._decodeChoice(t,r),s=!0}catch(e){s=!1}t.restore(e)}}if(n.obj&&s&&(u=t.enterObject()),s){if(null!==n.explicit){const e=this._decodeTag(t,n.explicit);if(t.isError(e))return e;t=e}const e=t.offset;if(null===n.use&&null===n.choice){let e;n.any&&(e=t.save());const r=this._decodeTag(t,null!==n.implicit?n.implicit:n.tag,n.any);if(t.isError(r))return r;n.any?i=t.raw(e):t=r}if(r&&r.track&&null!==n.tag&&r.track(t.path(),e,t.length,"tagged"),r&&r.track&&null!==n.tag&&r.track(t.path(),t.offset,t.length,"content"),n.any||(i=null===n.choice?this._decodeGeneric(n.tag,t,r):this._decodeChoice(t,r)),t.isError(i))return i;if(n.any||null!==n.choice||null===n.children||n.children.forEach(function e(n){n._decode(t,r)}),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){const e=new o(i);i=this._getUse(n.contains,t._reporterState.obj)._decode(e,r)}}return n.obj&&s&&(i=t.leaveObject(u)),null===n.key||null===i&&!0!==s?null!==a&&t.exitKey(a):t.leaveKey(a,n.key,i),i},f.prototype._decodeGeneric=function e(t,r,n){const i=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(r,t,i.args[0],n):/str$/.test(t)?this._decodeStr(r,t,n):"objid"===t&&i.args?this._decodeObjid(r,i.args[0],i.args[1],n):"objid"===t?this._decodeObjid(r,null,null,n):"gentime"===t||"utctime"===t?this._decodeTime(r,t,n):"null_"===t?this._decodeNull(r,n):"bool"===t?this._decodeBool(r,n):"objDesc"===t?this._decodeStr(r,t,n):"int"===t||"enum"===t?this._decodeInt(r,i.args&&i.args[0],n):null!==i.use?this._getUse(i.use,r._reporterState.obj)._decode(r,n):r.error("unknown tag: "+t)},f.prototype._getUse=function e(t,r){const n=this._baseState;return n.useDecoder=this._use(t,r),s(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},f.prototype._decodeChoice=function e(t,r){const n=this._baseState;let i=null,o=!1;return Object.keys(n.choice).some(function(e){const s=t.save(),a=n.choice[e];try{const n=a._decode(t,r);if(t.isError(n))return!1;i={type:e,value:n},o=!0}catch(e){return t.restore(s),!1}return!0},this),o?i:t.error("Choice not matched")},f.prototype._createEncoderBuffer=function e(t){return new i(t,this.reporter)},f.prototype._encode=function e(t,r,n){const i=this._baseState;if(null!==i.default&&i.default===t)return;const o=this._encodeValue(t,r,n);return void 0===o||this._skipDefault(o,r,n)?void 0:o},f.prototype._encodeValue=function e(t,r,i){const o=this._baseState;if(null===o.parent)return o.children[0]._encode(t,r||new n);let s=null;if(this.reporter=r,o.optional&&void 0===t){if(null===o.default)return;t=o.default}let a=null,u=!1;if(o.any)s=this._createEncoderBuffer(t);else if(o.choice)s=this._encodeChoice(t,r);else if(o.contains)a=this._getUse(o.contains,i)._encode(t,r),u=!0;else if(o.children)a=o.children.map(function(e){if("null_"===e._baseState.tag)return e._encode(null,r,t);if(null===e._baseState.key)return r.error("Child should have a key");const n=r.enterKey(e._baseState.key);if("object"!=typeof t)return r.error("Child expected, but input is not object");const i=e._encode(t[e._baseState.key],r,t);return r.leaveKey(n),i},this).filter(function(e){return e}),a=this._createEncoderBuffer(a);else if("seqof"===o.tag||"setof"===o.tag){if(!o.args||1!==o.args.length)return r.error("Too many args for : "+o.tag);if(!Array.isArray(t))return r.error("seqof/setof, but data is not Array");const e=this.clone();e._baseState.implicit=null,a=this._createEncoderBuffer(t.map(function(e){const n=this._baseState;return this._getUse(n.args[0],t)._encode(e,r)},e))}else null!==o.use?s=this._getUse(o.use,i)._encode(t,r):(a=this._encodePrimitive(o.tag,t),u=!0);if(!o.any&&null===o.choice){const e=null!==o.implicit?o.implicit:o.tag,t=null===o.implicit?"universal":"context";null===e?null===o.use&&r.error("Tag could be omitted only for .use()"):null===o.use&&(s=this._encodeComposite(e,u,t,a))}return null!==o.explicit&&(s=this._encodeComposite(o.explicit,!1,"context",s)),s},f.prototype._encodeChoice=function e(t,r){const n=this._baseState,i=n.choice[t.type];return i||s(!1,t.type+" not found in "+JSON.stringify(Object.keys(n.choice))),i._encode(t.value,r)},f.prototype._encodePrimitive=function e(t,r){const n=this._baseState;if(/str$/.test(t))return this._encodeStr(r,t);if("objid"===t&&n.args)return this._encodeObjid(r,n.reverseArgs[0],n.args[1]);if("objid"===t)return this._encodeObjid(r,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(r,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(r,n.args&&n.reverseArgs[0]);if("bool"===t)return this._encodeBool(r);if("objDesc"===t)return this._encodeStr(r,t);throw new Error("Unsupported tag: "+t)},f.prototype._isNumstr=function e(t){return/^[0-9 ]*$/.test(t)},f.prototype._isPrintstr=function e(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},function(e,t,r){"use strict";const n=r(539);t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=n._reverse(t.tagClass),t.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},t.tagByName=n._reverse(t.tag)},function(e,t,r){"use strict";const n=t;n.der=r(540),n.pem=r(1098)},function(e,t,r){"use strict";const n=r(1),i=r(0).Buffer,o=r(540);function s(e){o.call(this,e),this.enc="pem"}n(s,o),e.exports=s,s.prototype.decode=function e(t,r){const n=t.toString().split(/[\r\n]+/g),s=r.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/;let u=-1,c=-1;for(let e=0;e{if(t)return e(t);e(null,o.encode(r))})}}function f(e,t){try{e=y(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 l(e){return e=y(e,s.publicKeyLength),new u(e)}function h(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 y(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:l,generateKeyPair:h,generateKeyPairFromSeed:d}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(101),i=r(7);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){"use strict";(function(t){const n=r(60),i=r(534),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,l=20,h=t.from("key expansion"),d=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(h,(e,i)=>{if(e)return a(e);let o=[],s=0;function u(e){r.digest(t.concat([i,h]),(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 l(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(324)(),i=r(323),o=r(139).bignum,s=r(542),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",h(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:l(e),genSharedKey:o}))}),r)};const f={"P-256":32,"P-384":48,"P-521":66};function l(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 h(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=h(e,t.public);return r.d=a(new o(t.private)),r}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(24),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function o(e,t,r,o,s){const a=i[s];if(!a)throw new Error(`Hash '${s}' is unknown or not supported`);const u=n.pkcs5.pbkdf2(e,t,r,o,a);return n.util.encode64(u)}e.exports=o},function(e,t,r){"use strict";(function(n){const i=r(62),o=r(28),s=r(1108),a=r(328),u=r(22),c=r(14),f=r(41),l=new Error("Sorry, Not Implemented Yet."),h=f.proto(function(e){if(!(this instanceof h))return new h(e);if(null==e&&(e=""),e instanceof n)this.buffer=s.fromBuffer(e);else if("string"==typeof e||e instanceof String)this.buffer=s.fromString(e);else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=s.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});h.prototype.toString=function e(){return s.bufferToString(this.buffer)},h.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},h.prototype.inspect=function e(){return""},h.prototype.protos=function e(){return i(this.protoCodes(),function(e){return o(a(e))})},h.prototype.protoCodes=function e(){const t=[],r=this.buffer;let n=0;for(;n{if(e[0]===a.names.ipfs.code)return!0})[0][1],c.decode(t)}catch(e){t=null}return t},h.prototype.equals=function e(t){return this.buffer.equals(t.buffer)},h.prototype.nodeAddress=function e(){if(!this.isThinWaistAddress())throw new Error('Multiaddr must be "thin waist" address for nodeAddress.');const t=this.protoCodes(),r=this.toString().split("/").slice(1);return{family:41===t[0]?"IPv6":"IPv4",address:r[1],port:r[3]}},h.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 h("/"+[n,t.address,r,t.port].join("/"))},h.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||17===r[1].code))},h.prototype.fromStupidString=function e(t){throw l},h.protocols=a,h.isName=function e(t){return!!h.isMultiaddr(t)&&t.protos().some(e=>e.resolvable)},h.resolve=function e(t,r){return h.isMultiaddr(t)&&h.isName(t)?r(new Error("not implemented yet")):r(new Error("not a valid name"))},t=e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(62),i=r(241),o=r(1109),s=r(328),a=r(22);function u(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n=r.length)throw S("invalid address: "+e);t.push([i,r[n]])}else t.push([i])}return t}function c(e){const t=[];return n(e,function(e){const r=E(e);t.push(r.name),e.length>1&&t.push(e[1])}),"/"+t.join("/")}function f(e){return n(e,function(e){Array.isArray(e)||(e=[e]);const t=E(e);return e.length>1?[t.code,o.toBuffer(t.code,e[1])]:[t.code]})}function l(e){return n(e,function(e){const t=E(e);return e.length>1?[t.code,o.toString(t.code,e[1])]:[t.code]})}function h(e){return b(t.concat(n(e,function(e){const r=E(e);let n=t.from(a.encode(r.code));return e.length>1&&(n=t.concat([n,e[1]])),n})))}function d(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;{const e=a.decode(t);return e+a.decode.bytes}}function p(e){const t=[];let r=0;for(;re.length)throw S("Invalid address buffer: "+e.toString("hex"));t.push([n,c])}return t}function y(e){const t=p(e),r=l(t);return c(r)}function g(e){e=w(e);const t=u(e),r=f(t);return h(r)}function m(e){return g(e)}function b(e){const r=v(e);if(r)throw r;return t.from(e)}function v(e){try{p(e)}catch(e){return e}}function _(e){return void 0===v(e)}function w(e){return"/"+i(e.trim().split("/")).join("/")}function S(e){return new Error("Error parsing address: "+e)}function E(e){const t=s(e[0]);return t}e.exports={stringToStringTuples:u,stringTuplesToString:c,tuplesToStringTuples:l,stringTuplesToTuples:f,bufferToTuples:p,tuplesToBuffer:h,bufferToString:y,stringToBuffer:g,fromString:m,fromBuffer:b,validateBuffer:v,isValidBuffer:_,cleanPath:w,ParseError:S,protoFromTuple:E,sizeForAddr:d}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(242),i=r(243),o=r(328),s=r(14),a=r(22);function u(e,r){return r instanceof t?u.toString(e,r):u.toBuffer(e,r)}function c(e){if(!e.isValid())throw new Error("invalid ip address");return n.toBuffer(e.address)}function f(e){const r=t.alloc(2);return r.writeUInt16BE(e,0),r}function l(e){return e.readUInt16BE(0)}function h(e){const r=t.from(e),n=t.from(a.encode(r.length));return t.concat([n,r])}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 p(e){const r=t.from(s.decode(e)),n=t.from(a.encode(r.length));return t.concat([n,r])}function y(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 n.toString(r);case 6:case 17:case 33:case 132:return l(r);case 54:case 55:case 56:return d(r);case 421:return y(r);default:return r.toString("hex")}},u.toBuffer=function e(r,n){switch(r=o(r),r.code){case 4:return c(new i.Address4(n));case 41:return c(new i.Address6(n));case 6:case 17:case 33:case 132:return f(parseInt(n,10));case 54:case 55:case 56:return h(n);case 421:return p(n);default:return t.from(n,"hex")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(546).BigInteger,i=r(550),o=r(1111),s=r(1112),a=r(548),u=r(549),c=r(181).sprintf,f=r(326),l=r(327),h=r(545);function d(e){for(var t=/(\d+)(\d{3})/;t.test(e);)e=e.replace(t,"$1,$2");return e}function p(e){return e=e.replace(/^(0{1,})([1-9]+)$/,'$1$2'),e=e.replace(/^(0{1,})(0)$/,'$1$2'),e}function y(e,t){this.groups=void 0===t?l.GROUPS:t,this.v4=!1,this.subnet="/128",this.subnetMask=128,this.zone="",this.address=e;var r=l.RE_SUBNET_STRING.exec(e);if(r){if(this.parsedSubnet=r[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet="/"+this.subnetMask,isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>l.BITS)return this.valid=!1,void(this.error="Invalid subnet mask.");e=e.replace(l.RE_SUBNET_STRING,"")}else if(/\//.test(e))return this.valid=!1,void(this.error="Invalid subnet mask.");var n=l.RE_ZONE_STRING.exec(e);n&&(this.zone=n[0],e=e.replace(l.RE_ZONE_STRING,"")),this.addressMinusSuffix=e,this.parsedAddress=this.parse(this.addressMinusSuffix)}function g(e,t){var r=[],n=[],i;for(i=0;it[1]&&n.push(e[i]);return r.concat(["compact"]).concat(n)}function m(e){return c("%04x",parseInt(e,16))}function b(e){return 255&e}s(y.prototype,r(1113)),s(y.prototype,r(1114)),s(y.prototype,r(1115)),y.fromBigInteger=function(e){var t=a(e.toString(16),32,"0"),r=[],n;for(n=0;n65536)&&(r=null)):r=null,{address:new y(t),port:r}},y.fromAddress4=function(e){var e=new h(e),t=l.BITS-(f.BITS-e.subnetMask);return new y("::ffff:"+e.correctForm()+"/"+t)},y.fromArpa=function(e){var t=e.replace(/(\.ip6\.arpa)?\.$/,""),r=7;if(63!==t.length)return t={error:"Not Valid 'ip6.arpa' form",address:null},t;t=t.split(".").reverse();for(var n=7;n>0;n--){var i=4*n;t.splice(i,0,":")}return t=t.join(""),new y(t)},y.prototype.microsoftTranscription=function(){return c("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))},y.prototype.mask=function(e){return void 0===e&&(e=this.subnetMask),this.getBitsBase2(0,e)},y.prototype.possibleSubnets=function(e){void 0===e&&(e=128);var t=l.BITS-this.subnetMask,r=Math.abs(e-l.BITS),i=t-r;return i<0?"0":d(new n("2",10).pow(i).toString(10))},y.prototype.startAddress=function(){var e=new n(this.mask()+u(0,l.BITS-this.subnetMask),2);return y.fromBigInteger(e)},y.prototype.endAddress=function(){var e=new n(this.mask()+u(1,l.BITS-this.subnetMask),2);return y.fromBigInteger(e)},y.prototype.getScope=function(){var e=l.SCOPES[this.getBits(12,16)];return"Global unicast"===this.getType()&&"Link local"!==e&&(e="Global"),e},y.prototype.getType=function(){var e=this;function t(t,r){return e.isInSubnet(new y(r))}return i(l.TYPES,t)||"Global unicast"},y.prototype.getBits=function(e,t){return new n(this.getBitsBase2(e,t),2)},y.prototype.getBitsBase2=function(e,t){return this.binaryZeroPad().slice(e,t)},y.prototype.getBitsBase16=function(e,t){var r=t-e;return r%4!=0?null:a(this.getBits(e,t).toString(16),r/4,"0")},y.prototype.getBitsPastSubnet=function(){return this.getBitsBase2(this.subnetMask,l.BITS)},y.prototype.reverseForm=function(e){e||(e={});var t=Math.floor(this.subnetMask/4),r=this.canonicalForm().replace(/:/g,"").split("").slice(0,t).reverse().join(".");return t>0?e.omitSuffix?r:c("%s.ip6.arpa.",r):e.omitSuffix?"":"ip6.arpa."},y.prototype.correctForm=function(){if(!this.parsedAddress)return null;var e,t=[],r=0,n=[];for(e=0;e0&&(r>1&&n.push([e-r,e-1]),r=0)}r>1&&n.push([this.parsedAddress.length-r,this.parsedAddress.length-1]);var s=n.map(function(e){return e[1]-e[0]+1});if(n.length>0){var a=s.indexOf(o(s));t=g(this.parsedAddress,n[a])}else t=this.parsedAddress;for(e=0;e1?"s":"",t.join("")),this.parseError=e.replace(l.RE_BAD_CHARACTERS,'$1'),null;var r=e.match(l.RE_BAD_ADDRESS);if(r)return this.valid=!1,this.error=c("Address failed regex: %s",r.join("")),this.parseError=e.replace(l.RE_BAD_ADDRESS,'$1'),null;var n=[],i=e.split("::");if(2===i.length){var o=i[0].split(":"),s=i[1].split(":");1===o.length&&""===o[0]&&(o=[]),1===s.length&&""===s[0]&&(s=[]);var a=this.groups-(o.length+s.length);if(!a)return this.valid=!1,this.error="Error parsing groups",null;this.elidedGroups=a,this.elisionBegin=o.length,this.elisionEnd=o.length+this.elidedGroups,o.forEach(function(e){n.push(e)});for(var u=0;u=0;o--)r=r.add(i.multiply(new n(e[o].toString(10),10))),i=i.multiply(t);return y.fromBigInteger(r)},e.exports=y},function(e,t){var r="[object Symbol]",n=Object.prototype,i=n.toString;function o(e,t,r){for(var n=-1,i=e.length;++nt}function a(e){return!!e&&"object"==typeof e}function u(e){return"symbol"==typeof e||a(e)&&i.call(e)==r}function c(e){return e}function f(e){return e&&e.length?o(e,c,s):void 0}e.exports=f},function(e,t,r){(function(e,r){var n=200,i="__lodash_hash_undefined__",o=800,s=16,a=9007199254740991,u="[object Arguments]",c="[object Array]",f="[object AsyncFunction]",l="[object Boolean]",h="[object Date]",d="[object Error]",p="[object Function]",y="[object GeneratorFunction]",g="[object Map]",m="[object Number]",b="[object Null]",v="[object Object]",_="[object Proxy]",w="[object RegExp]",S="[object Set]",E="[object String]",k="[object Undefined]",A="[object WeakMap]",x="[object ArrayBuffer]",C="[object DataView]",T="[object Float32Array]",I="[object Float64Array]",B="[object Int8Array]",O="[object Int16Array]",P="[object Int32Array]",R="[object Uint8Array]",N="[object Uint8ClampedArray]",j="[object Uint16Array]",L="[object Uint32Array]",M=/[\\^$.*+?()[\]{}|]/g,D=/^\[object .+?Constructor\]$/,U=/^(?:0|[1-9]\d*)$/,F={};F[T]=F[I]=F[B]=F[O]=F[P]=F[R]=F[N]=F[j]=F[L]=!0,F[u]=F[c]=F[x]=F[l]=F[C]=F[h]=F[d]=F[p]=F[g]=F[m]=F[v]=F[w]=F[S]=F[E]=F[A]=!1;var K="object"==typeof e&&e&&e.Object===Object&&e,q="object"==typeof self&&self&&self.Object===Object&&self,H=K||q||Function("return this")(),z="object"==typeof t&&t&&!t.nodeType&&t,V=z&&"object"==typeof r&&r&&!r.nodeType&&r,G=V&&V.exports===z,W=G&&K.process,$=function(){try{return W&&W.binding&&W.binding("util")}catch(e){}}(),Y=$&&$.isTypedArray;function J(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 X(e,t){for(var r=-1,n=Array(e);++r-1}function Fe(e,t){var r=this.__data__,n=rt(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function Ke(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t1?r[i-1]:void 0,s=i>2?r[2]:void 0;for(o=e.length>3&&"function"==typeof o?(i--,o):void 0,s&&xt(r[0],r[1],s)&&(o=i<3?void 0:o,i=1),t=Object(t);++n-1&&e%1==0&&e0){if(++t>=o)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function jt(e){if(null!=e){try{return se.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Lt(e,t){return e===t||e!=e&&t!=t}var Mt=st(function(){return arguments}())?st:function(e){return Vt(e)&&ae.call(e,"callee")&&!ve.call(e,"callee")},Dt=Array.isArray;function Ut(e){return null!=e&&Ht(e.length)&&!qt(e)}function Ft(e){return Vt(e)&&Ut(e)}var Kt=Ee||Qt;function qt(e){if(!zt(e))return!1;var t=ot(e);return t==p||t==y||t==f||t==_}function Ht(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=a}function zt(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Vt(e){return null!=e&&"object"==typeof e}function Gt(e){if(!Vt(e)||ot(e)!=v)return!1;var t=me(e);if(null===t)return!0;var r=ae.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&se.call(r)==le}var Wt=Y?Z(Y):ut;function $t(e){return bt(e,Yt(e))}function Yt(e){return Ut(e)?Qe(e,!0):ct(e)}var Jt=vt(function(e,t,r){ft(e,t,r)});function Xt(e){return function(){return e}}function Zt(e){return e}function Qt(){return!1}r.exports=Jt}).call(this,r(8),r(32)(e))},function(e,t,r){"use strict";var n=r(547),i=r(327);t.isValid=function(){return this.valid},t.isInSubnet=n.isInSubnet,t.isCorrect=n.isCorrect(i.BITS),t.isCanonical=n.falseIfInvalid(function(){return this.addressMinusSuffix===this.canonicalForm()}),t.isLinkLocal=n.falseIfInvalid(function(){return"1111111010000000000000000000000000000000000000000000000000000000"===this.getBitsBase2(0,64)}),t.isMulticast=n.falseIfInvalid(function(){return"Multicast"===this.getType()}),t.is4=n.falseIfInvalid(function(){return this.v4}),t.isTeredo=n.falseIfInvalid(function(){return this.isInSubnet(new this.constructor("2001::/32"))}),t.is6to4=n.falseIfInvalid(function(){return this.isInSubnet(new this.constructor("2002::/16"))}),t.isLoopback=n.falseIfInvalid(function(){return"Loopback"===this.getType()})},function(e,t,r){"use strict";var n=r(326),i=r(551),o=r(181).sprintf;t.href=function(e){return e=void 0===e?"":o(":%s",e),o("http://[%s]%s/",this.correctForm(),e)},t.link=function(e){e||(e={}),void 0===e.className&&(e.className=""),void 0===e.prefix&&(e.prefix="/#address="),void 0===e.v4&&(e.v4=!1);var t=this.correctForm;return e.v4&&(t=this.to4in6),e.className?o('%2$s',e.prefix,t.call(this),e.className):o('%2$s',e.prefix,t.call(this))},t.group=function(){var e=this.address.match(n.RE_ADDRESS),t;if(e){var r=e[0].split(".");this.address=this.address.replace(n.RE_ADDRESS,o('%s.%s',r.slice(0,2).join("."),r.slice(2,4).join(".")))}if(0===this.elidedGroups)return i.simpleGroup(this.address);var s=[],a=this.address.split("::");a[0].length?s.push(i.simpleGroup(a[0])):s.push("");var u=["hover-group"];for(t=this.elisionBegin;t',u.join(" "))),a[1].length?s.push(i.simpleGroup(a[1],this.elisionEnd)):s.push(""),s.join(":")}},function(e,t,r){"use strict";var n=r(181).sprintf,i=r(327);function o(e){return n("(%s)",e.join("|"))}function s(e){return e.length<4?n("0{0,%d}%s",4-e.length,e):e}function a(e){var t=[];e.forEach(function(e,r){var n=parseInt(e,16);0===n&&t.push(r)});var r=t.map(function(t){return e.map(function(e,r){if(r===t){var n=0===r||r===i.GROUPS-1?":":"";return o([s(e),n])}return s(e)}).join(":")});return r.push(e.map(s).join(":")),o(r)}function u(e,t,r){var i=t?"":":",s=r?"":":",a=[];t||r||a.push("::"),t&&r&&a.push(""),(r&&!t||!r&&t)&&a.push(":"),a.push(n("%s(:0{1,4}){1,%d}",i,e-1)),a.push(n("(0{1,4}:){1,%d}%s",e-1,s)),a.push(n("(0{1,4}:){%d}0{1,4}",e-1));for(var u=1;u{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){(function(e,r){var n=200,i="Expected a function",o="__lodash_hash_undefined__",s=1,a=2,u=1/0,c=9007199254740991,f="[object Arguments]",l="[object Array]",h="[object Boolean]",d="[object Date]",p="[object Error]",y="[object Function]",g="[object GeneratorFunction]",m="[object Map]",b="[object Number]",v="[object Object]",_="[object Promise]",w="[object RegExp]",S="[object Set]",E="[object String]",k="[object Symbol]",A="[object WeakMap]",x="[object ArrayBuffer]",C="[object DataView]",T="[object Float32Array]",I="[object Float64Array]",B="[object Int8Array]",O="[object Int16Array]",P="[object Int32Array]",R="[object Uint8Array]",N="[object Uint8ClampedArray]",j="[object Uint16Array]",L="[object Uint32Array]",M=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,D=/^\w*$/,U=/^\./,F=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,K=/[\\^$.*+?()[\]{}|]/g,q=/\\(\\)?/g,H=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,V={};V[T]=V[I]=V[B]=V[O]=V[P]=V[R]=V[N]=V[j]=V[L]=!0,V[f]=V[l]=V[x]=V[h]=V[C]=V[d]=V[p]=V[y]=V[m]=V[b]=V[v]=V[w]=V[S]=V[E]=V[A]=!1;var G="object"==typeof e&&e&&e.Object===Object&&e,W="object"==typeof self&&self&&self.Object===Object&&self,$=G||W||Function("return this")(),Y="object"==typeof t&&t&&!t.nodeType&&t,J=Y&&"object"==typeof r&&r&&!r.nodeType&&r,X=J&&J.exports===Y,Z=X&&G.process,Q=function(){try{return Z&&Z.binding("util")}catch(e){}}(),ee=Q&&Q.isTypedArray;function te(e,t){var r=e?e.length:0;return!!r&&oe(e,t,0)>-1}function re(e,t,r){for(var n=-1,i=e?e.length:0;++n-1}function rt(e,t){var r=this.__data__,n=vt(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function nt(e){var t=-1,r=e?e.length:0;for(this.clear();++t=n){var f=t?null:Lt(e);if(f)return ye(f);a=!1,o=fe,c=new ct}else c=t?[]:u;e:for(;++ic))return!1;var l=o.get(e);if(l&&o.get(t))return l==t;var h=-1,d=!0,p=i&s?new ct:void 0;for(o.set(e,t),o.set(t,e);++h-1&&e%1==0&&e-1&&e%1==0&&e<=c}function fr(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function lr(e){return!!e&&"object"==typeof e}function hr(e){return"symbol"==typeof e||lr(e)&&ke.call(e)==k}var dr=ee?ce(ee):Ct;function pr(e){return null==e?"":Rt(e)}function yr(e,t,r){var n=null==e?void 0:_t(e,t);return void 0===n?r:n}function gr(e,t){return null!=e&&zt(e,t,St)}function mr(e){return sr(e)?bt(e):It(e)}function br(e){return e}function vr(){}function _r(e){return Gt(e)?ae(Qt(e)):Pt(e)}r.exports=tr}).call(this,r(8),r(32)(e))},function(e,t,r){"use strict";(function(t){const n=r(62),i=r(241),o=r(1119),s=r(329),a=r(22);function u(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n=r.length)throw S("invalid address: "+e);t.push([i,r[n]])}else t.push([i])}return t}function c(e){const t=[];return n(e,function(e){const r=E(e);t.push(r.name),e.length>1&&t.push(e[1])}),"/"+t.join("/")}function f(e){return n(e,function(e){Array.isArray(e)||(e=[e]);const t=E(e);return e.length>1?[t.code,o.toBuffer(t.code,e[1])]:[t.code]})}function l(e){return n(e,function(e){const t=E(e);return e.length>1?[t.code,o.toString(t.code,e[1])]:[t.code]})}function h(e){return b(t.concat(n(e,function(e){const r=E(e);let n=t.from(a.encode(r.code));return e.length>1&&(n=t.concat([n,e[1]])),n})))}function d(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;{const e=a.decode(t);return e+a.decode.bytes}}function p(e){const t=[];let r=0;for(;re.length)throw S("Invalid address buffer: "+e.toString("hex"));t.push([n,c])}return t}function y(e){const t=p(e),r=l(t);return c(r)}function g(e){e=w(e);const t=u(e),r=f(t);return h(r)}function m(e){return g(e)}function b(e){const r=v(e);if(r)throw r;return t.from(e)}function v(e){try{p(e)}catch(e){return e}}function _(e){return void 0===v(e)}function w(e){return"/"+i(e.trim().split("/")).join("/")}function S(e){return new Error("Error parsing address: "+e)}function E(e){const t=s(e[0]);return t}e.exports={stringToStringTuples:u,stringTuplesToString:c,tuplesToStringTuples:l,stringTuplesToTuples:f,bufferToTuples:p,tuplesToBuffer:h,bufferToString:y,stringToBuffer:g,fromString:m,fromBuffer:b,validateBuffer:v,isValidBuffer:_,cleanPath:w,ParseError:S,protoFromTuple:E,sizeForAddr:d}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(242),i=r(243),o=r(329),s=r(14),a=r(22);function u(e,r){return r instanceof t?u.toString(e,r):u.toBuffer(e,r)}function c(e){if(!e.isValid())throw new Error("invalid ip address");return n.toBuffer(e.address)}function f(e){const r=t.alloc(2);return r.writeUInt16BE(e,0),r}function l(e){return e.readUInt16BE(0)}function h(e){const r=t.from(e),n=t.from(a.encode(r.length));return t.concat([n,r])}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 p(e){const r=t.from(s.decode(e)),n=t.from(a.encode(r.length));return t.concat([n,r])}function y(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 n.toString(r);case 6:case 17:case 33:case 132:return l(r);case 54:case 55:case 56:return d(r);case 421:return y(r);default:return r.toString("hex")}},u.toBuffer=function e(r,n){switch(r=o(r),r.code){case 4:return c(new i.Address4(n));case 41:return c(new i.Address6(n));case 6:case 17:case 33:case 132:return f(parseInt(n,10));case 54:case 55:case 56:return h(n);case 421:return p(n);default:return t.from(n,"hex")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(18),o=r(1121),s=r(20),a=r(6);class u{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.keys.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return o.keys.marshalPrivateKey(this.privKey)}toPrint(){return this.toJSON()}toJSON(){return{id:this.toB58String(),privKey:c(this.marshalPrivKey()),pubKey:c(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"))}}function c(e){if(e)return e.toString("base64")}t=e.exports=u,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.keys.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 u(r,n))})},t.createFromHexString=function(e){return new u(i.fromHexString(e))},t.createFromBytes=function(e){return new u(e)},t.createFromB58String=function(e){return new u(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.keys.unmarshalPublicKey(i)}catch(e){return t(e)}r.hash((e,n)=>{if(e)return t(e);t(null,new u(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.keys.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 u(r,n,n.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r,s,c,f;try{r=i.fromB58String(e.id),s=e.privKey&&n.from(e.privKey,"base64"),c=e.pubKey&&n.from(e.pubKey,"base64"),f=c&&o.keys.unmarshalPublicKey(c)}catch(e){return t(e)}s?a([e=>o.keys.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)}),(e,t,r)=>{f?f.hash((n,i)=>{r(n,e,t,i)}):r(null,e,t)}],(e,n,i,o)=>e?t(e):f&&!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 u(r,i,f))):t(null,new u(r,null,f))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(553),i=r(1123),o=r(1125);t=e.exports,t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(562),t.pbkdf2=r(1144)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(1124),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(100);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(17),o=i(r(332)),s=r(24);t=e.exports;const a={rsa:r(1126),ed25519:r(1139),secp256k1:r(102)(o,r(562))};function u(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=o,t.keyStretcher=r(1141),t.generateEphemeralKeyPair=r(1142),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){"use strict";const n=r(554),i=r(17),o=r(14),s=r(556),a=i(r(332)),u=r(24),c=r(7);class f{constructor(e){this._key=e}verify(e,t,r){g(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return s.utils.jwkToPkix(this._key)}get bytes(){return a.PublicKey.encode({Type:a.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),n(this.bytes,"sha2-256",e)}}class l{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return s.getRandomValues(new Uint8Array(16))}sign(e,t){g(t),s.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){s.decrypt(this._key,e,t)}marshal(){return s.utils.jwkToPkcs1(this._key)}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(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"),g(r),c(()=>{let n=null,i=null;try{const r=new u.util.ByteBuffer(this.marshal()),o=u.asn1.fromDer(r),s=u.pki.privateKeyFromAsn1(o);if("pkcs-8"===e){const e={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};i=u.pki.encryptRsaPrivateKey(s,t,e)}else n=new Error(`Unknown export format '${e}'`)}catch(e){n=e}r(n,i)})}}function h(e,t){const r=s.utils.pkcs1ToJwk(e);s.unmarshalPrivateKey(r,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function d(e){const t=s.utils.pkixToJwk(e);return new f(t)}function p(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function y(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function g(e){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:d,unmarshalRsaPrivateKey:h,generateKeyPair:y,fromJwk:p}},function(e,t,r){"use strict";(function(t){const n=r(109),i=r(110),o=r(555),s=r(1128),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(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(1129),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(111),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");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){"use strict";(function(t){const n=r(112),i=r(555).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";const n=r(140),i=r(561),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,r){"use strict";const n=r(140),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(123).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(e,t,r){"use strict";const n=r(1);function i(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function o(e,t){this.path=e,this.rethrow(t)}t.Reporter=i,i.prototype.isError=function e(t){return t instanceof o},i.prototype.save=function e(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},i.prototype.restore=function e(t){const r=this._reporterState;r.obj=t.obj,r.path=r.path.slice(0,t.pathLen)},i.prototype.enterKey=function e(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function e(t){const r=this._reporterState;r.path=r.path.slice(0,t-1)},i.prototype.leaveKey=function e(t,r,n){const i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[r]=n)},i.prototype.path=function e(){return this._reporterState.path.join("/")},i.prototype.enterObject=function e(){const t=this._reporterState,r=t.obj;return t.obj={},r},i.prototype.leaveObject=function e(t){const r=this._reporterState,n=r.obj;return r.obj=t,n},i.prototype.error=function e(t){let r;const n=this._reporterState,i=t instanceof o;if(r=i?t:new o(n.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),t.message||t,t.stack),!n.options.partial)throw r;return i||n.errors.push(r),r},i.prototype.wrapResult=function e(t){const r=this._reporterState;return r.options.partial?{result:this.isError(t)?null:t,errors:r.errors}:t},n(o,Error),o.prototype.rethrow=function e(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},function(e,t,r){"use strict";const n=r(182).Reporter,i=r(182).EncoderBuffer,o=r(182).DecoderBuffer,s=r(50),a=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(a),c=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function f(e,t){const r={};this._baseState=r,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}e.exports=f;const l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];f.prototype.clone=function e(){const t=this._baseState,r={};l.forEach(function(e){r[e]=t[e]});const n=new this.constructor(r.parent);return n._baseState=r,n},f.prototype._wrap=function e(){const t=this._baseState;u.forEach(function(e){this[e]=function r(){const n=new this.constructor(this);return t.children.push(n),n[e].apply(n,arguments)}},this)},f.prototype._init=function e(t){const r=this._baseState;s(null===r.parent),t.call(this),r.children=r.children.filter(function(e){return e._baseState.parent===this},this),s.equal(r.children.length,1,"Root node can have only one child")},f.prototype._useArgs=function e(t){const r=this._baseState,n=t.filter(function(e){return e instanceof this.constructor},this);t=t.filter(function(e){return!(e instanceof this.constructor)},this),0!==n.length&&(s(null===r.children),r.children=n,n.forEach(function(e){e._baseState.parent=this},this)),0!==t.length&&(s(null===r.args),r.args=t,r.reverseArgs=t.map(function(e){if("object"!=typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach(function(r){r==(0|r)&&(r|=0);const n=e[r];t[n]=r}),t}))},c.forEach(function(e){f.prototype[e]=function t(){const r=this._baseState;throw new Error(e+" not implemented for encoding: "+r.enc)}}),a.forEach(function(e){f.prototype[e]=function t(){const r=this._baseState,n=Array.prototype.slice.call(arguments);return s(null===r.tag),r.tag=e,this._useArgs(n),this}}),f.prototype.use=function e(t){s(t);const r=this._baseState;return s(null===r.use),r.use=t,this},f.prototype.optional=function e(){const t=this._baseState;return t.optional=!0,this},f.prototype.def=function e(t){const r=this._baseState;return s(null===r.default),r.default=t,r.optional=!0,this},f.prototype.explicit=function e(t){const r=this._baseState;return s(null===r.explicit&&null===r.implicit),r.explicit=t,this},f.prototype.implicit=function e(t){const r=this._baseState;return s(null===r.explicit&&null===r.implicit),r.implicit=t,this},f.prototype.obj=function e(){const t=this._baseState,r=Array.prototype.slice.call(arguments);return t.obj=!0,0!==r.length&&this._useArgs(r),this},f.prototype.key=function e(t){const r=this._baseState;return s(null===r.key),r.key=t,this},f.prototype.any=function e(){const t=this._baseState;return t.any=!0,this},f.prototype.choice=function e(t){const r=this._baseState;return s(null===r.choice),r.choice=t,this._useArgs(Object.keys(t).map(function(e){return t[e]})),this},f.prototype.contains=function e(t){const r=this._baseState;return s(null===r.use),r.contains=t,this},f.prototype._decode=function e(t,r){const n=this._baseState;if(null===n.parent)return t.wrapResult(n.children[0]._decode(t,r));let i=n.default,s=!0,a=null,u;if(null!==n.key&&(a=t.enterKey(n.key)),n.optional){let e=null;if(null!==n.explicit?e=n.explicit:null!==n.implicit?e=n.implicit:null!==n.tag&&(e=n.tag),null!==e||n.any){if(s=this._peekTag(t,e,n.any),t.isError(s))return s}else{const e=t.save();try{null===n.choice?this._decodeGeneric(n.tag,t,r):this._decodeChoice(t,r),s=!0}catch(e){s=!1}t.restore(e)}}if(n.obj&&s&&(u=t.enterObject()),s){if(null!==n.explicit){const e=this._decodeTag(t,n.explicit);if(t.isError(e))return e;t=e}const e=t.offset;if(null===n.use&&null===n.choice){let e;n.any&&(e=t.save());const r=this._decodeTag(t,null!==n.implicit?n.implicit:n.tag,n.any);if(t.isError(r))return r;n.any?i=t.raw(e):t=r}if(r&&r.track&&null!==n.tag&&r.track(t.path(),e,t.length,"tagged"),r&&r.track&&null!==n.tag&&r.track(t.path(),t.offset,t.length,"content"),n.any||(i=null===n.choice?this._decodeGeneric(n.tag,t,r):this._decodeChoice(t,r)),t.isError(i))return i;if(n.any||null!==n.choice||null===n.children||n.children.forEach(function e(n){n._decode(t,r)}),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){const e=new o(i);i=this._getUse(n.contains,t._reporterState.obj)._decode(e,r)}}return n.obj&&s&&(i=t.leaveObject(u)),null===n.key||null===i&&!0!==s?null!==a&&t.exitKey(a):t.leaveKey(a,n.key,i),i},f.prototype._decodeGeneric=function e(t,r,n){const i=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(r,t,i.args[0],n):/str$/.test(t)?this._decodeStr(r,t,n):"objid"===t&&i.args?this._decodeObjid(r,i.args[0],i.args[1],n):"objid"===t?this._decodeObjid(r,null,null,n):"gentime"===t||"utctime"===t?this._decodeTime(r,t,n):"null_"===t?this._decodeNull(r,n):"bool"===t?this._decodeBool(r,n):"objDesc"===t?this._decodeStr(r,t,n):"int"===t||"enum"===t?this._decodeInt(r,i.args&&i.args[0],n):null!==i.use?this._getUse(i.use,r._reporterState.obj)._decode(r,n):r.error("unknown tag: "+t)},f.prototype._getUse=function e(t,r){const n=this._baseState;return n.useDecoder=this._use(t,r),s(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},f.prototype._decodeChoice=function e(t,r){const n=this._baseState;let i=null,o=!1;return Object.keys(n.choice).some(function(e){const s=t.save(),a=n.choice[e];try{const n=a._decode(t,r);if(t.isError(n))return!1;i={type:e,value:n},o=!0}catch(e){return t.restore(s),!1}return!0},this),o?i:t.error("Choice not matched")},f.prototype._createEncoderBuffer=function e(t){return new i(t,this.reporter)},f.prototype._encode=function e(t,r,n){const i=this._baseState;if(null!==i.default&&i.default===t)return;const o=this._encodeValue(t,r,n);return void 0===o||this._skipDefault(o,r,n)?void 0:o},f.prototype._encodeValue=function e(t,r,i){const o=this._baseState;if(null===o.parent)return o.children[0]._encode(t,r||new n);let s=null;if(this.reporter=r,o.optional&&void 0===t){if(null===o.default)return;t=o.default}let a=null,u=!1;if(o.any)s=this._createEncoderBuffer(t);else if(o.choice)s=this._encodeChoice(t,r);else if(o.contains)a=this._getUse(o.contains,i)._encode(t,r),u=!0;else if(o.children)a=o.children.map(function(e){if("null_"===e._baseState.tag)return e._encode(null,r,t);if(null===e._baseState.key)return r.error("Child should have a key");const n=r.enterKey(e._baseState.key);if("object"!=typeof t)return r.error("Child expected, but input is not object");const i=e._encode(t[e._baseState.key],r,t);return r.leaveKey(n),i},this).filter(function(e){return e}),a=this._createEncoderBuffer(a);else if("seqof"===o.tag||"setof"===o.tag){if(!o.args||1!==o.args.length)return r.error("Too many args for : "+o.tag);if(!Array.isArray(t))return r.error("seqof/setof, but data is not Array");const e=this.clone();e._baseState.implicit=null,a=this._createEncoderBuffer(t.map(function(e){const n=this._baseState;return this._getUse(n.args[0],t)._encode(e,r)},e))}else null!==o.use?s=this._getUse(o.use,i)._encode(t,r):(a=this._encodePrimitive(o.tag,t),u=!0);if(!o.any&&null===o.choice){const e=null!==o.implicit?o.implicit:o.tag,t=null===o.implicit?"universal":"context";null===e?null===o.use&&r.error("Tag could be omitted only for .use()"):null===o.use&&(s=this._encodeComposite(e,u,t,a))}return null!==o.explicit&&(s=this._encodeComposite(o.explicit,!1,"context",s)),s},f.prototype._encodeChoice=function e(t,r){const n=this._baseState,i=n.choice[t.type];return i||s(!1,t.type+" not found in "+JSON.stringify(Object.keys(n.choice))),i._encode(t.value,r)},f.prototype._encodePrimitive=function e(t,r){const n=this._baseState;if(/str$/.test(t))return this._encodeStr(r,t);if("objid"===t&&n.args)return this._encodeObjid(r,n.reverseArgs[0],n.args[1]);if("objid"===t)return this._encodeObjid(r,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(r,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(r,n.args&&n.reverseArgs[0]);if("bool"===t)return this._encodeBool(r);if("objDesc"===t)return this._encodeStr(r,t);throw new Error("Unsupported tag: "+t)},f.prototype._isNumstr=function e(t){return/^[0-9 ]*$/.test(t)},f.prototype._isPrintstr=function e(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},function(e,t,r){"use strict";const n=r(558);t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=n._reverse(t.tagClass),t.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},t.tagByName=n._reverse(t.tag)},function(e,t,r){"use strict";const n=t;n.der=r(559),n.pem=r(1136)},function(e,t,r){"use strict";const n=r(1),i=r(0).Buffer,o=r(559);function s(e){o.call(this,e),this.enc="pem"}n(s,o),e.exports=s,s.prototype.decode=function e(t,r){const n=t.toString().split(/[\r\n]+/g),s=r.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/;let u=-1,c=-1;for(let e=0;e{if(t)return e(t);e(null,o.encode(r))})}}function f(e,t){try{e=y(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 l(e){return e=y(e,s.publicKeyLength),new u(e)}function h(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 y(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:l,generateKeyPair:h,generateKeyPairFromSeed:d}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(101),i=r(7);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){"use strict";(function(t){const n=r(60),i=r(553),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,l=20,h=t.from("key expansion"),d=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(h,(e,i)=>{if(e)return a(e);let o=[],s=0;function u(e){r.digest(t.concat([i,h]),(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 l(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(331)(),i=r(330),o=r(140).bignum,s=r(561),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",h(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:l(e),genSharedKey:o}))}),r)};const f={"P-256":32,"P-384":48,"P-521":66};function l(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 h(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=h(e,t.public);return r.d=a(new o(t.private)),r}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(24),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function o(e,t,r,o,s){const a=i[s];if(!a)throw new Error(`Hash '${s}' is unknown or not supported`);const u=n.pkcs5.pbkdf2(e,t,r,o,a);return n.util.encode64(u)}e.exports=o},function(e,t,r){"use strict";(function(n){const i=r(1146);t=e.exports=s,t.encode=a,t.decode=u,t.isEncoded=c;const o=new Error("Unsupported encoding");function s(e,t){if(!t)throw new Error("requires an encoded buffer");const r=l(e),i=n.from(r.code),o=r.name;return f(o,t),n.concat([i,t])}function a(e,t){const r=l(e),i=r.name;return s(i,n.from(r.encode(t)))}function u(e){n.isBuffer(e)&&(e=e.toString());const t=e.substring(0,1);e=e.substring(1,e.length),"string"==typeof e&&(e=n.from(e));const r=l(t),i={base:r.name,data:n.from(r.decode(e.toString()))};return i.data}function c(e){n.isBuffer(e)&&(e=e.toString());const t=e.substring(0,1);try{const e=l(t);return e.name}catch(e){return!1}}function f(e,t){const r=l(e);r.decode(t.toString())}function l(e){let t;if(i.names[e])t=i.names[e];else{if(!i.codes[e])throw o;t=i.codes[e]}if(!t.isImplemented())throw new Error("Base "+e+" is not implemented yet");return t}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1147),i=r(208),o=r(1148),s=r(1149),a=r(1150),u=[["base1","1","","1"],["base2","0",i,"01"],["base8","7",i,"01234567"],["base10","9",i,"0123456789"],["base16","f",o,"0123456789abcdef"],["base32","b",s,"abcdefghijklmnopqrstuvwxyz234567"],["base32pad","c",s,"abcdefghijklmnopqrstuvwxyz234567="],["base32hex","v",s,"0123456789abcdefghijklmnopqrstuv"],["base32hexpad","t",s,"0123456789abcdefghijklmnopqrstuv="],["base32z","h",s,"ybndrfg8ejkmcpqxot1uwisza345h769"],["base58flickr","Z",i,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base58btc","z",i,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base64","m",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],c=u.reduce((e,t)=>(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("+","-"),r=r.replace("/","_"));const o=r.indexOf("=");return o>0&&!n&&(r=r.substring(0,o)),r},decode(e){i&&(e=e.replace("+","-"),e=e.replace("/","_"));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";const n=r(563).extend(r(1152)),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}))}).allow(null),init:n.alternatives().try(n.boolean(),n.object().keys({bits:n.number().integer()})).allow(null),start: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(),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.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(1153),i=r(89);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";(function(n){const i=r(62),o=r(28),s=r(1154),a=r(334),u=r(22),c=r(14),f=r(41),l=new Error("Sorry, Not Implemented Yet."),h=f.proto(function(e){if(!(this instanceof h))return new h(e);if(null==e&&(e=""),e instanceof n)this.buffer=s.fromBuffer(e);else if("string"==typeof e||e instanceof String)this.buffer=s.fromString(e);else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=s.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});h.prototype.toString=function e(){return s.bufferToString(this.buffer)},h.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},h.prototype.inspect=function e(){return""},h.prototype.protos=function e(){return i(this.protoCodes(),function(e){return o(a(e))})},h.prototype.protoCodes=function e(){const t=[],r=this.buffer;let n=0;for(;n{if(e[0]===a.names.ipfs.code)return!0})[0][1],c.decode(t)}catch(e){t=null}return t},h.prototype.equals=function e(t){return this.buffer.equals(t.buffer)},h.prototype.nodeAddress=function e(){if(!this.isThinWaistAddress())throw new Error('Multiaddr must be "thin waist" address for nodeAddress.');const t=this.protoCodes(),r=this.toString().split("/").slice(1);return{family:41===t[0]?"IPv6":"IPv4",address:r[1],port:r[3]}},h.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 h("/"+[n,t.address,r,t.port].join("/"))},h.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||17===r[1].code))},h.prototype.fromStupidString=function e(t){throw l},h.protocols=a,h.isName=function e(t){return!!h.isMultiaddr(t)&&t.protos().some(e=>e.resolvable)},h.resolve=function e(t,r){return h.isMultiaddr(t)&&h.isName(t)?r(new Error("not implemented yet")):r(new Error("not a valid name"))},t=e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(62),i=r(241),o=r(1155),s=r(334),a=r(22);function u(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n=r.length)throw S("invalid address: "+e);t.push([i,r[n]])}else t.push([i])}return t}function c(e){const t=[];return n(e,function(e){const r=E(e);t.push(r.name),e.length>1&&t.push(e[1])}),"/"+t.join("/")}function f(e){return n(e,function(e){Array.isArray(e)||(e=[e]);const t=E(e);return e.length>1?[t.code,o.toBuffer(t.code,e[1])]:[t.code]})}function l(e){return n(e,function(e){const t=E(e);return e.length>1?[t.code,o.toString(t.code,e[1])]:[t.code]})}function h(e){return b(t.concat(n(e,function(e){const r=E(e);let n=t.from(a.encode(r.code));return e.length>1&&(n=t.concat([n,e[1]])),n})))}function d(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;{const e=a.decode(t);return e+a.decode.bytes}}function p(e){const t=[];let r=0;for(;re.length)throw S("Invalid address buffer: "+e.toString("hex"));t.push([n,c])}return t}function y(e){const t=p(e),r=l(t);return c(r)}function g(e){e=w(e);const t=u(e),r=f(t);return h(r)}function m(e){return g(e)}function b(e){const r=v(e);if(r)throw r;return t.from(e)}function v(e){try{p(e)}catch(e){return e}}function _(e){return void 0===v(e)}function w(e){return"/"+i(e.trim().split("/")).join("/")}function S(e){return new Error("Error parsing address: "+e)}function E(e){const t=s(e[0]);return t}e.exports={stringToStringTuples:u,stringTuplesToString:c,tuplesToStringTuples:l,stringTuplesToTuples:f,bufferToTuples:p,tuplesToBuffer:h,bufferToString:y,stringToBuffer:g,fromString:m,fromBuffer:b,validateBuffer:v,isValidBuffer:_,cleanPath:w,ParseError:S,protoFromTuple:E,sizeForAddr:d}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(242),i=r(243),o=r(334),s=r(14),a=r(22);function u(e,r){return r instanceof t?u.toString(e,r):u.toBuffer(e,r)}function c(e){if(!e.isValid())throw new Error("invalid ip address");return n.toBuffer(e.address)}function f(e){const r=t.alloc(2);return r.writeUInt16BE(e,0),r}function l(e){return e.readUInt16BE(0)}function h(e){const r=t.from(e),n=t.from(a.encode(r.length));return t.concat([n,r])}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 p(e){const r=t.from(s.decode(e)),n=t.from(a.encode(r.length));return t.concat([n,r])}function y(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 n.toString(r);case 6:case 17:case 33:case 132:return l(r);case 54:case 55:case 56:return d(r);case 421:return y(r);default:return r.toString("hex")}},u.toBuffer=function e(r,n){switch(r=o(r),r.code){case 4:return c(new i.Address4(n));case 41:return c(new i.Address6(n));case 6:case 17:case 33:case 132:return f(parseInt(n,10));case 54:case 55:case 56:return h(n);case 421:return p(n);default:return t.from(n,"hex")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(62),o=r(28),s=r(1157),a=r(335),u=r(22),c=r(14),f=r(41),l=new Error("Sorry, Not Implemented Yet."),h=f.proto(function(e){if(!(this instanceof h))return new h(e);if(null==e&&(e=""),e instanceof n)this.buffer=s.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=s.fromString(e)}else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=s.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});h.prototype.toString=function e(){return s.bufferToString(this.buffer)},h.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},h.prototype.inspect=function e(){return""},h.prototype.protos=function e(){return i(this.protoCodes(),function(e){return o(a(e))})},h.prototype.protoCodes=function e(){const t=[],r=this.buffer;let n=0;for(;n{if(e[0]===a.names.ipfs.code)return!0})[0][1],c.decode(t)}catch(e){t=null}return t},h.prototype.equals=function e(t){return this.buffer.equals(t.buffer)},h.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]}},h.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 h("/"+[n,t.address,r,t.port].join("/"))},h.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))},h.prototype.fromStupidString=function e(t){throw l},h.protocols=a,h.isName=function e(t){return!!h.isMultiaddr(t)&&t.protos().some(e=>e.resolvable)},h.resolve=function e(t,r){return h.isMultiaddr(t)&&h.isName(t)?r(new Error("not implemented yet")):r(new Error("not a valid name"))},t=e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(62),i=r(241),o=r(1158),s=r(335),a=r(22);function u(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n=r.length)throw S("invalid address: "+e);t.push([i,r[n]])}else t.push([i])}return t}function c(e){const t=[];return n(e,function(e){const r=E(e);t.push(r.name),e.length>1&&t.push(e[1])}),"/"+t.join("/")}function f(e){return n(e,function(e){Array.isArray(e)||(e=[e]);const t=E(e);return e.length>1?[t.code,o.toBuffer(t.code,e[1])]:[t.code]})}function l(e){return n(e,function(e){const t=E(e);return e.length>1?[t.code,o.toString(t.code,e[1])]:[t.code]})}function h(e){return b(t.concat(n(e,function(e){const r=E(e);let n=t.from(a.encode(r.code));return e.length>1&&(n=t.concat([n,e[1]])),n})))}function d(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;{const e=a.decode(t);return e+a.decode.bytes}}function p(e){const t=[];let r=0;for(;re.length)throw S("Invalid address buffer: "+e.toString("hex"));t.push([n,c])}return t}function y(e){const t=p(e),r=l(t);return c(r)}function g(e){e=w(e);const t=u(e),r=f(t);return h(r)}function m(e){return g(e)}function b(e){const r=v(e);if(r)throw r;return t.from(e)}function v(e){try{p(e)}catch(e){return e}}function _(e){return void 0===v(e)}function w(e){return"/"+i(e.trim().split("/")).join("/")}function S(e){return new Error("Error parsing address: "+e)}function E(e){const t=s(e[0]);return t}e.exports={stringToStringTuples:u,stringTuplesToString:c,tuplesToStringTuples:l,stringTuplesToTuples:f,bufferToTuples:p,tuplesToBuffer:h,bufferToString:y,stringToBuffer:g,fromString:m,fromBuffer:b,validateBuffer:v,isValidBuffer:_,cleanPath:w,ParseError:S,protoFromTuple:E,sizeForAddr:d}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(242),i=r(243),o=r(335),s=r(14),a=r(22);function u(e,r){return r instanceof t?u.toString(e,r):u.toBuffer(e,r)}function c(e){if(!e.isValid())throw new Error("invalid ip address");return n.toBuffer(e.address)}function f(e){const r=t.alloc(2);return r.writeUInt16BE(e,0),r}function l(e){return e.readUInt16BE(0)}function h(e){const r=t.from(e),n=t.from(a.encode(r.length));return t.concat([n,r])}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 p(e){const r=t.from(s.decode(e)),n=t.from(a.encode(r.length));return t.concat([n,r])}function y(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 n.toString(r);case 6:case 273:case 33:case 132:return l(r);case 54:case 55:case 56:return d(r);case 421:return y(r);default:return r.toString("hex")}},u.toBuffer=function e(r,n){switch(r=o(r),r.code){case 4:return c(new i.Address4(n));case 41:return c(new i.Address6(n));case 6:case 273:case 33:case 132:return f(parseInt(n,10));case 54:case 55:case 56:return h(n);case 421:return p(n);default:return t.from(n,"hex")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(6),i=r(336).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.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(48).Key,i=r(4),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(`version mismatch: expected v${e}, found v${n}`));t()})}}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(9),i=r(7),o=r(337).asyncFilter,s=r(337).asyncSort,a=r(564);class u{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(new Error("No value")))}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=u},function(e,t,r){"use strict";const n=r(48).Key,i=r(164),o=r(6),s=r(216),a=r(421),u=r(422),c=r(5).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"));let 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)),l],t):l(i,t)}function l(t,r){const n=c.from(JSON.stringify(t,null,2));e.put(f,n,r)}})},function(e,t,r){"use strict";(function(t){const n=r(48).Key,i=r(423),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(48).Key,i=r(5).Buffer,o=new n("api");e.exports=(e=>({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(1167),i=n.ShardingDatastore,o=r(48).Key,s=r(426),a=r(105),u=r(7),c=r(287),f=r(10),l=r(9),h=e=>{const t=new s.Encoder;return new o("/"+t.write(e).finalize(),!1)},d=e=>h(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 y(e){return{query(t,r){l(e.query(t),l.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,(e,n)=>{if(e)return r(e);r(null,new a(n,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),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)}}}e.exports=((e,t,r)=>{p(e,t,(e,t)=>{if(e)return r(e);r(null,y(t))})})},function(e,t,r){"use strict";const n=r(244),i=r(1168),o=r(1170),s=r(1171),a=r(1172),u=r(565);t.KeytransformDatastore=n,t.ShardingDatastore=i,t.MountDatastore=o,t.TieredDatastore=s,t.NamespaceDatastore=a,t.shard=u},function(e,t,r){"use strict";(function(t){const n=r(6),i=r(49),o=r(48).Key,s=r(565),a=r(244),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(43),i=r(425),o=r(9),s=r(48).Key,a=r(48).utils,u=a.asyncFilter,c=a.asyncSort,f=a.replaceStartWith,l=r(244);class h{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=f(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);null!=n?n.datastore.put(n.rest,t,r):r(new Error("No datastore mounted for this key"))}get(e,t){const r=this._lookup(e);null!=r?r.datastore.get(r.rest,t):t(new Error("No datastore mounted for this key"))}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);null!=r?r.datastore.delete(r.rest,t):t(new Error("No datastore mounted for this key"))}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=f(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=>u(e)))),null!=e.orders&&(r=r.concat(e.orders.map(e=>c(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=h},function(e,t,r){"use strict";const n=r(43),i=r(60);class o{constructor(e){this.stores=e.slice()}open(e){n(this.stores,(e,t)=>{e.open(t)},e)}put(e,t,r){n(this.stores,(r,n)=>{r.put(e,t,n)},r)}get(e,t){const r=this.stores.length;let n=!1,o=0;i(()=>!n&&o{const r=this.stores[o++];r.get(e,(e,r)=>{if(null==e)return n=!0,t(null,r);t()})},t)}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)},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=o},function(e,t,r){"use strict";const n=r(48).Key,i=r(244);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";e.exports={lock:"memory",storageBackends:{root:r(245),blocks:r(245),keys:r(245),datastore:r(245)},storageBackendOptions:{root:{extension:""},blocks:{sharding:!1},keys:{sharding:!1}}}},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,r){"use strict";t.preStart=r(1178),t.start=r(1251),t.stop=r(1274),t.isOnline=r(1275),t.version=r(1276),t.id=r(1277),t.repo=r(583),t.init=r(1278),t.bootstrap=r(1280),t.config=r(1281),t.block=r(1282),t.object=r(1283),t.dag=r(1285),t.libp2p=r(1290),t.swarm=r(1544),t.ping=r(1545),t.pingPullStream=r(1546),t.pingReadableStream=r(1547),t.pin=r(1548),t.files=r(1555),t.bitswap=r(670),t.pubsub=r(1590),t.dht=r(1591),t.dns=r(1594),t.key=r(1596),t.stats=r(1597),t.mfs=r(1599)},function(e,t,r){"use strict";const n=r(51),i=r(47),o=r(27),s=r(6),a=r(567),u=r(333),c=r(1250);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);u(e,t._options.config),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(1180),i=r(1184),o=r(86),s=r(1239),a=r(9),u=r(1241),c=r(1242),f=r(1247),l="/pkcs8/",h="/info/",d={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 y(e){return!!e&&(!!u(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(l+e)}function b(e){return new s.Key(h+e)}class v{constructor(e,t){if(!e)throw new Error("store is required");this.store=e;const r={};if(i(r,p,t),!r.passPhrase||r.passPhrase.length<20)throw new Error("passPhrase must be least 20 characters");if(r.dek.keyLengthn})}get cms(){return new f(this)}static generateOptions(){const e=Object.assign({},p),t=3*Math.ceil(d.minSaltLength/3);return e.dek.salt=o.randomBytes(t).toString("base64"),e}static get options(){return p}createKey(e,t,r,n){const i=this;if(!y(e)||"self"===e)return g(n,`Invalid key name '${e}'`);if(!u(t))return g(n,`Invalid key type '${t}'`);if(!c(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};a(this.store.query(r),a.collect((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(!y(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(!y(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(!y(e)||"self"===e)return g(r,`Invalid old key name '${e}'`);if(!y(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 l=n.store.batch();l.put(o,f),l.put(a,JSON.stringify(c)),l.delete(i),l.delete(s),l.commit(e=>{if(e)return g(r,e);r(null,c)})}))})}exportKey(e,t,r){if(!y(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(!y(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(!y(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(!y(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=v},function(e,t,r){"use strict";var n=r(1181),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(1182),i=r(1183);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){var n=r(1185),i=r(1231),o=i(function(e,t,r){n(e,t,r)});e.exports=o},function(e,t,r){var n=r(1186),i=r(570),o=r(1214),s=r(1216),a=r(80),u=r(574),c=r(573);function f(e,t,r,l,h){e!==t&&o(t,function(o,u){if(a(o))h||(h=new n),s(e,t,u,r,f,l,h);else{var d=l?l(c(e,u),o,u+"",e,t,h):void 0;void 0===d&&(d=o),i(e,u,d)}},u)}e.exports=f},function(e,t,r){var n=r(246),i=r(1192),o=r(1193),s=r(1194),a=r(1195),u=r(1196);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){function r(){this.__data__=[],this.size=0}e.exports=r},function(e,t,r){var n=r(247),i=Array.prototype,o=i.splice;function s(e){var t=this.__data__,r=n(t,e);if(r<0)return!1;var i=t.length-1;return r==i?t.pop():o.call(t,r,1),--this.size,!0}e.exports=s},function(e,t,r){var n=r(247);function i(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}e.exports=i},function(e,t,r){var n=r(247);function i(e){return n(this.__data__,e)>-1}e.exports=i},function(e,t,r){var n=r(247);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(246);function i(){this.__data__=new n,this.size=0}e.exports=i},function(e,t){function r(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}e.exports=r},function(e,t){function r(e){return this.__data__.get(e)}e.exports=r},function(e,t){function r(e){return this.__data__.has(e)}e.exports=r},function(e,t,r){var n=r(246),i=r(568),o=r(569),s=200;function a(e,t){var r=this.__data__;if(r instanceof n){var a=r.__data__;if(!i||a.length1?r[o-1]:void 0,a=o>2?r[2]:void 0;for(s=e.length>3&&"function"==typeof s?(o--,s):void 0,a&&i(r[0],r[1],a)&&(s=o<3?void 0:s,o=1),t=Object(t);++n0){if(++t>=r)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}e.exports=o},function(e,t,r){var n=r(248),i=r(93),o=r(413),s=r(80);function a(e,t,r){if(!s(r))return!1;var a=typeof t;return!!("number"==a?i(r)&&o(t,r.length):"string"==a&&t in r)&&n(r[t],e)}e.exports=a},function(e,t,r){"use strict";const n=r(576),i=r(1240),o=r(340),s=r(577);t.Key=n,t.MemoryDatastore=i,t.utils=o,t.Errors=s},function(e,t,r){"use strict";const n=r(9),i=r(7),o=r(340).asyncFilter,s=r(340).asyncSort,a=r(576),u=r(577);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){var n=r(129),i=r(81),o=r(106),s="[object String]";function a(e){return"string"==typeof e||!i(e)&&o(e)&&n(e)==s}e.exports=a},function(e,t,r){var n=r(1243),i=9007199254740991;function o(e){return n(e)&&e>=-i&&e<=i}e.exports=o},function(e,t,r){var n=r(1244);function i(e){return"number"==typeof e&&e==n(e)}e.exports=i},function(e,t,r){var n=r(1245);function i(e){var t=n(e),r=t%1;return t==t?r?t-r:t:0}e.exports=i},function(e,t,r){var n=r(1246),i=1/0,o=1.7976931348623157e308;function s(e){if(!e)return 0===e?e:0;if(e=n(e),e===i||e===-i){var t=e<0?-1:1;return t*o}return e==e?e:0}e.exports=s},function(e,t,r){var n=r(80),i=r(252),o=NaN,s=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,c=/^0o[0-7]+$/i,f=parseInt;function l(e){if("number"==typeof e)return e;if(i(e))return o;if(n(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=n(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(s,"");var r=u.test(e);return r||c.test(e)?f(e.slice(2),r?2:8):a.test(e)?o:+e}e.exports=l},function(e,t,r){"use strict";(function(t){const n=r(1248),i=r(24),o=r(1249);class s{constructor(e){if(!e)throw new Error("keychain is required");this.keychain=e}encrypt(e,r,s){const a=this,u=(e,t)=>n.setImmediate(()=>s(e,t));if(!t.isBuffer(r))return u(new Error("Plain data must be a Buffer"));n.series([t=>a.keychain.findKeyByName(e,t),t=>a.keychain._getPrivateKey(e,t)],(e,n)=>{if(e)return u(e);let c=n[0],f=n[1];try{const n=i.pki.decryptRsaPrivateKey(f,a.keychain._());o.certificateForKey(c,n,(e,n)=>{if(e)return s(e);const o=i.pkcs7.createEnvelopedData();o.addRecipient(n),o.content=i.util.createBuffer(r),o.encrypt();const a=i.asn1.toDer(o.toAsn1()).getBytes();u(null,t.from(a,"binary"))})}catch(e){u(e)}})}decrypt(e,r){const o=(e,t)=>n.setImmediate(()=>r(e,t));if(!t.isBuffer(e))return o(new Error("CMS data is required"));const s=this;let a;try{const t=i.util.createBuffer(e.toString("binary")),r=i.asn1.fromDer(t);a=i.pkcs7.messageFromAsn1(r)}catch(e){return o(new Error("Invalid CMS: "+e.message))}const u=a.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}));n.detect(u,(e,t)=>s.keychain.findKeyById(e.keyId,(e,r)=>t(null,!e&&r)),(e,r)=>{if(e)return o(e);if(!r){const t=u.map(e=>e.keyId);return e=new Error("Decryption needs one of the key(s): "+t.join(", ")),e.missingKeys=t,o(e)}n.waterfall([e=>s.keychain.findKeyById(r.keyId,e),(e,t)=>s.keychain._getPrivateKey(e.name,t)],(e,n)=>{if(e)return o(e);const u=i.pki.decryptRsaPrivateKey(n,s.keychain._());a.decrypt(r.recipient,u),o(null,t.from(a.content.getBytes(),"binary"))})})}}e.exports=s}).call(this,r(0).Buffer)},function(e,t,r){(function(e,r,n){!function(e,r){r(t)}(this,function(t){"use strict";function i(e,t){t|=0;for(var r=Math.max(e.length-t,0),n=Array(r),i=0;i-1&&e%1==0&&e<=q}function z(e){return null!=e&&H(e.length)&&!K(e)}var V={};function G(){}function W(e){return function(){if(null!==e){var t=e;e=null,t.apply(this,arguments)}}}var $="function"==typeof Symbol&&Symbol.iterator,Y=function(e){return $&&e[$]&&e[$]()};function J(e,t){for(var r=-1,n=Array(e);++r-1&&e%1==0&&e2&&(n=i(arguments,1)),t){var o={};Tt(s,function(e,t){o[t]=e}),o[e]=n,u=!0,c=Object.create(null),r(t,o)}else s[e]=n,g(e)});a++;var o=v(t[t.length-1]);t.length>1?o(s,n):o(n)}}function b(){for(var e,t=0;l.length;)e=l.pop(),t++,At(_(e),function(e){0==--h[e]&&l.push(e)});if(t!==o)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}function _(t){var r=[];return Tt(e,function(e,n){ie(e)&&Pt(e,t,0)>=0&&r.push(n)}),r}Tt(e,function(t,r){if(!ie(t))return d(r,[t]),void l.push(r);var n=t.slice(0,t.length-1),i=n.length;if(0===i)return d(r,t),void l.push(r);h[r]=i,At(n,function(o){if(!e[o])throw new Error("async.auto task `"+r+"` has a non-existent dependency `"+o+"` in "+n.join(", "));y(o,function(){i--,0===i&&d(r,t)})})}),b(),p()};function Nt(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++ri?0:i+t),r=r>i?i:r,r<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(i);++n=n?e:Kt(e,t,r)}function Ht(e,t){for(var r=e.length;r--&&Pt(t,e[r],0)>-1;);return r}function zt(e,t){for(var r=-1,n=e.length;++r-1;);return r}function Vt(e){return e.split("")}var Gt="\\ud800-\\udfff",Wt="\\u0300-\\u036f",$t="\\ufe20-\\ufe2f",Yt="\\u20d0-\\u20ff",Jt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Xt="\\ufe0e\\ufe0f",Zt="\\u200d",Qt=RegExp("["+Zt+Gt+Jt+Xt+"]");function er(e){return Qt.test(e)}var tr="\\ud800-\\udfff",rr="\\u0300-\\u036f",nr="\\ufe20-\\ufe2f",ir="\\u20d0-\\u20ff",or="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",sr="\\ufe0e\\ufe0f",ar="[\\ud800-\\udfff]",ur="["+or+"]",cr="\\ud83c[\\udffb-\\udfff]",fr="(?:"+ur+"|"+cr+")",lr="[^\\ud800-\\udfff]",hr="(?:\\ud83c[\\udde6-\\uddff]){2}",dr="[\\ud800-\\udbff][\\udc00-\\udfff]",pr="\\u200d",yr=fr+"?",gr="[\\ufe0e\\ufe0f]?",mr="(?:\\u200d(?:"+[lr,hr,dr].join("|")+")"+gr+yr+")*",br=gr+yr+mr,vr="(?:"+[lr+ur+"?",ur,hr,dr,ar].join("|")+")",_r=RegExp(cr+"(?="+cr+")|"+vr+br,"g");function wr(e){return e.match(_r)||[]}function Sr(e){return er(e)?wr(e):Vt(e)}function Er(e){return null==e?"":Ft(e)}var kr=/^\s+|\s+$/g;function Ar(e,t,r){if(e=Er(e),e&&(r||void 0===t))return e.replace(kr,"");if(!e||!(t=Ft(t)))return e;var n=Sr(e),i=Sr(t),o=zt(n,i),s=Ht(n,i)+1;return qt(n,o,s).join("")}var xr=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,Cr=/,/,Tr=/(=.+)?(\s*)$/,Ir=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function Br(e){return e=e.toString().replace(Ir,""),e=e.match(xr)[2].replace(" ",""),e=e?e.split(Cr):[],e=e.map(function(e){return Ar(e.replace(Tr,""))}),e}function Or(e,t){var r={};Tt(e,function(e,t){var n,i=b(e),o=!i&&1===e.length||i&&0===e.length;if(ie(e))n=e.slice(0,-1),e=e[e.length-1],r[t]=n.concat(n.length>0?s:e);else if(o)r[t]=e;else{if(n=Br(e),0===e.length&&!i&&0===n.length)throw new Error("autoInject task functions require explicit parameters.");i||n.pop(),r[t]=n.concat(s)}function s(t,r){var i=Nt(n,function(e){return t[e]});i.push(r),v(e).apply(null,i)}}),Rt(r,t)}function Pr(){this.head=this.tail=null,this.length=0}function Rr(e,t){e.length=1,e.head=e.tail=t}function Nr(e,t,r){if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var n=v(e),i=0,o=[],s=!1;function a(e,t,r){if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");if(f.started=!0,ie(e)||(e=[e]),0===e.length&&f.idle())return d(function(){f.drain()});for(var n=0,i=e.length;n0&&o.splice(a,1),s.callback.apply(s,arguments),null!=t&&f.error(t,s.data)}i<=f.concurrency-f.buffer&&f.unsaturated(),f.idle()&&f.drain(),f.process()}}var c=!1,f={_tasks:new Pr,concurrency:t,payload:r,saturated:G,unsaturated:G,buffer:t/4,empty:G,drain:G,error:G,started:!1,paused:!1,push:function(e,t){a(e,!1,t)},kill:function(){f.drain=G,f._tasks.empty()},unshift:function(e,t){a(e,!0,t)},remove:function(e){f._tasks.remove(e)},process:function(){if(!c){for(c=!0;!f.paused&&i2&&(o=i(arguments,1)),n[t]=o,r(e)})},function(e){r(e,n)})}function Rn(e,t){Pn(gt,e,t)}function Nn(e,t,r){Pn(lt(t),e,r)}var jn=function(e,t){var r=v(e);return Nr(function(e,t){r(e[0],t)},t,1)},Ln=function(e,t){var r=jn(e,t);return r.push=function(e,t,n){if(null==n&&(n=G),"function"!=typeof n)throw new Error("task callback must be a function");if(r.started=!0,ie(e)||(e=[e]),0===e.length)return d(function(){r.drain()});t=t||0;for(var i=r._tasks.head;i&&t>=i.priority;)i=i.next;for(var o=0,s=e.length;on?1:0}vt(e,function(e,t){n(e,function(r,n){if(r)return t(r);t(null,{value:e,criteria:n})})},function(e,t){if(e)return r(e);r(null,Nt(t.sort(i),dn("value")))})}function Qn(e,t,r){var n=v(e);return s(function(i,o){var s=!1,a;function u(){var t=e.name||"anonymous",n=new Error('Callback function "'+t+'" timed out.');n.code="ETIMEDOUT",r&&(n.info=r),s=!0,o(n)}i.push(function(){s||(o.apply(null,arguments),clearTimeout(a))}),a=setTimeout(u,t),n.apply(null,i)})}var ei=Math.ceil,ti=Math.max;function ri(e,t,r,n){for(var i=-1,o=ti(ei((t-e)/(r||1)),0),s=Array(o);o--;)s[n?o:++i]=e,e+=r;return s}function ni(e,t,r,n){var i=v(r);St(ri(0,e,1),t,i,n)}var ii=dt(ni,1/0),oi=dt(ni,1);function si(e,t,r,n){arguments.length<=3&&(n=r,r=t,t=ie(e)?[]:{}),n=W(n||G);var i=v(r);gt(e,function(e,r,n){i(t,e,r,n)},function(e){n(e,t)})}function ai(e,t){var r=null,n;t=t||G,an(e,function(e,t){v(e)(function(e,o){n=arguments.length>2?i(arguments,1):o,r=e,t(!e)})},function(){t(r,n)})}function ui(e){return function(){return(e.unmemoized||e).apply(null,arguments)}}function ci(e,t,r){r=ft(r||G);var n=v(t);if(!e())return r(null);var o=function(t){if(t)return r(t);if(e())return n(o);var s=i(arguments,1);r.apply(null,[null].concat(s))};n(o)}function fi(e,t,r){ci(function(){return!e.apply(this,arguments)},t,r)}var li=function(e,t){if(t=W(t||G),!ie(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var r=0;function n(t){var n=v(e[r++]);t.push(ft(o)),n.apply(null,t)}function o(o){if(o||r===e.length)return t.apply(null,arguments);n(i(arguments,1))}n([])},hi={apply:o,applyEach:_t,applyEachSeries:kt,asyncify:p,auto:Rt,autoInject:Or,cargo:jr,compose:Ur,concat:qr,concatLimit:Kr,concatSeries:Hr,constant:zr,detect:$r,detectLimit:Yr,detectSeries:Jr,dir:Zr,doDuring:Qr,doUntil:tn,doWhilst:en,during:rn,each:on,eachLimit:sn,eachOf:gt,eachOfLimit:ht,eachOfSeries:Lr,eachSeries:an,ensureAsync:un,every:fn,everyLimit:ln,everySeries:hn,filter:mn,filterLimit:bn,filterSeries:vn,forever:_n,groupBy:Sn,groupByLimit:wn,groupBySeries:En,log:kn,map:vt,mapLimit:St,mapSeries:Et,mapValues:xn,mapValuesLimit:An,mapValuesSeries:Cn,memoize:Bn,nextTick:On,parallel:Rn,parallelLimit:Nn,priorityQueue:Ln,queue:jn,race:Mn,reduce:Mr,reduceRight:Dn,reflect:Un,reflectAll:Fn,reject:qn,rejectLimit:Hn,rejectSeries:zn,retry:Gn,retryable:Wn,seq:Dr,series:$n,setImmediate:d,some:Yn,someLimit:Jn,someSeries:Xn,sortBy:Zn,timeout:Qn,times:ii,timesLimit:ni,timesSeries:oi,transform:si,tryEach:ai,unmemoize:ui,until:fi,waterfall:li,whilst:ci,all:fn,allLimit:ln,allSeries:hn,any:Yn,anyLimit:Jn,anySeries:Xn,find:$r,findLimit:Yr,findSeries:Jr,forEach:on,forEachSeries:an,forEachLimit:sn,forEachOf:gt,forEachOfSeries:Lr,forEachOfLimit:ht,inject:Mr,foldl:Mr,foldr:Dn,select:mn,selectLimit:bn,selectSeries:vn,wrapSync:p};t.default=hi,t.apply=o,t.applyEach=_t,t.applyEachSeries=kt,t.asyncify=p,t.auto=Rt,t.autoInject=Or,t.cargo=jr,t.compose=Ur,t.concat=qr,t.concatLimit=Kr,t.concatSeries=Hr,t.constant=zr,t.detect=$r,t.detectLimit=Yr,t.detectSeries=Jr,t.dir=Zr,t.doDuring=Qr,t.doUntil=tn,t.doWhilst=en,t.during=rn,t.each=on,t.eachLimit=sn,t.eachOf=gt,t.eachOfLimit=ht,t.eachOfSeries=Lr,t.eachSeries=an,t.ensureAsync=un,t.every=fn,t.everyLimit=ln,t.everySeries=hn,t.filter=mn,t.filterLimit=bn,t.filterSeries=vn,t.forever=_n,t.groupBy=Sn,t.groupByLimit=wn,t.groupBySeries=En,t.log=kn,t.map=vt,t.mapLimit=St,t.mapSeries=Et,t.mapValues=xn,t.mapValuesLimit=An,t.mapValuesSeries=Cn,t.memoize=Bn,t.nextTick=On,t.parallel=Rn,t.parallelLimit=Nn,t.priorityQueue=Ln,t.queue=jn,t.race=Mn,t.reduce=Mr,t.reduceRight=Dn,t.reflect=Un,t.reflectAll=Fn,t.reject=qn,t.rejectLimit=Hn,t.rejectSeries=zn,t.retry=Gn,t.retryable=Wn,t.seq=Dr,t.series=$n,t.setImmediate=d,t.some=Yn,t.someLimit=Jn,t.someSeries=Xn,t.sortBy=Zn,t.timeout=Qn,t.times=ii,t.timesLimit=ni,t.timesSeries=oi,t.transform=si,t.tryEach=ai,t.unmemoize=ui,t.until=fi,t.waterfall=li,t.whilst=ci,t.all=fn,t.allLimit=ln,t.allSeries=hn,t.any=Yn,t.anyLimit=Jn,t.anySeries=Xn,t.find=$r,t.findLimit=Yr,t.findSeries=Jr,t.forEach=on,t.forEachSeries=an,t.forEachLimit=sn,t.forEachOf=gt,t.forEachOfSeries=Lr,t.forEachOfLimit=ht,t.inject=Mr,t.foldl=Mr,t.foldr=Dn,t.select=mn,t.selectLimit=bn,t.selectSeries=vn,t.wrapSync=p,Object.defineProperty(t,"__esModule",{value:!0})})}).call(this,r(3),r(8),r(32)(e))},function(e,t,r){"use strict";const n=r(24),i=n.pki;t=e.exports,t.certificateForKey=((e,t,r)=>{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(42),i=r(1252),o=r(7),s=r(2);e.exports=(e=>s(t=>{const r=r=>{if(r)return o(()=>e.emit("error",r)),t(r);e.state.started(),o(()=>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.libp2p.start(t),t=>{e._bitswap=new i(e._libp2pNode,e._repo.blocks,{statsEnabled:!0}),e._bitswap.start(),e._blockService.setExchange(e._bitswap),e._preload.start(),e._mfsPreload.start(t)}],r)}))},function(e,t,r){"use strict";const n=r(6),i=r(287),o=r(43),s=r(42),a=r(83),u=r(1253),c=r(1261),f=r(1265),l=r(1271),h=r(141).logger,d=r(1272),p={statsEnabled:!1,statsComputeThrottleTimeout:1e3,statsComputeThrottleMaxQueueSize:1e3},y=["blocksReceived","dataReceived","dupBlksReceived","dupDataReceived","blocksSent","dataSent","providesBufferLength","wantListLength","peerCount"];class g{constructor(e,t,r){this._libp2p=e,this._log=h(this.peerInfo.id),this._options=Object.assign({},p,r),this._stats=new d(y,{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 u(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 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 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=g},function(e,t,r){"use strict";const n=r(7),i=r(253),o=r(254),s=r(341),a=r(1260),u=r(141).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]",l="[object Date]",h="[object Error]",d="[object Function]",p="[object GeneratorFunction]",y="[object Map]",g="[object Number]",m="[object Object]",b="[object Promise]",v="[object RegExp]",_="[object Set]",w="[object String]",S="[object Symbol]",E="[object WeakMap]",k="[object ArrayBuffer]",A="[object DataView]",x="[object Float32Array]",C="[object Float64Array]",T="[object Int8Array]",I="[object Int16Array]",B="[object Int32Array]",O="[object Uint8Array]",P="[object Uint8ClampedArray]",R="[object Uint16Array]",N="[object Uint32Array]",j=/[\\^$.*+?()[\]{}|]/g,L=/^\[object .+?Constructor\]$/,M=/^(?:0|[1-9]\d*)$/,D={};D[x]=D[C]=D[T]=D[I]=D[B]=D[O]=D[P]=D[R]=D[N]=!0,D[u]=D[c]=D[k]=D[f]=D[A]=D[l]=D[h]=D[d]=D[y]=D[g]=D[m]=D[v]=D[_]=D[w]=D[E]=!1;var U="object"==typeof e&&e&&e.Object===Object&&e,F="object"==typeof self&&self&&self.Object===Object&&self,K=U||F||Function("return this")(),q="object"==typeof t&&t&&!t.nodeType&&t,H=q&&"object"==typeof r&&r&&!r.nodeType&&r,z=H&&H.exports===q,V=z&&U.process,G=function(){try{return V&&V.binding("util")}catch(e){}}(),W=G&&G.isTypedArray;function $(e,t){for(var r=-1,n=e?e.length:0;++r-1}function Ke(e,t){var r=this.__data__,n=it(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function qe(e){var t=-1,r=e?e.length:0;for(this.clear();++tc))return!1;var l=a.get(e);if(l&&a.get(t))return l==t;var h=-1,d=!0,p=i&o?new $e:void 0;for(a.set(e,t),a.set(t,e);++h-1&&e%1==0&&e-1&&e%1==0&&e<=a}function Bt(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ot(e){return!!e&&"object"==typeof e}var Pt=W?J(W):ct;function Rt(e){return At(e)?nt(e):ft(e)}r.exports=Ct}).call(this,r(8),r(32)(e))},function(e,t,r){"use strict";(function(t){const n=r(22);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(254).Entry,i=r(10),o=r(20);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){(function(e,r){var n=200,i="Expected a function",o="__lodash_hash_undefined__",s=1,a=2,u=1/0,c=9007199254740991,f="[object Arguments]",l="[object Array]",h="[object Boolean]",d="[object Date]",p="[object Error]",y="[object Function]",g="[object GeneratorFunction]",m="[object Map]",b="[object Number]",v="[object Object]",_="[object Promise]",w="[object RegExp]",S="[object Set]",E="[object String]",k="[object Symbol]",A="[object WeakMap]",x="[object ArrayBuffer]",C="[object DataView]",T="[object Float32Array]",I="[object Float64Array]",B="[object Int8Array]",O="[object Int16Array]",P="[object Int32Array]",R="[object Uint8Array]",N="[object Uint8ClampedArray]",j="[object Uint16Array]",L="[object Uint32Array]",M=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,D=/^\w*$/,U=/^\./,F=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,K=/[\\^$.*+?()[\]{}|]/g,q=/\\(\\)?/g,H=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,V={};V[T]=V[I]=V[B]=V[O]=V[P]=V[R]=V[N]=V[j]=V[L]=!0,V[f]=V[l]=V[x]=V[h]=V[C]=V[d]=V[p]=V[y]=V[m]=V[b]=V[v]=V[w]=V[S]=V[E]=V[A]=!1;var G="object"==typeof e&&e&&e.Object===Object&&e,W="object"==typeof self&&self&&self.Object===Object&&self,$=G||W||Function("return this")(),Y="object"==typeof t&&t&&!t.nodeType&&t,J=Y&&"object"==typeof r&&r&&!r.nodeType&&r,X=J&&J.exports===Y,Z=X&&G.process,Q=function(){try{return Z&&Z.binding("util")}catch(e){}}(),ee=Q&&Q.isTypedArray;function te(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 re(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r-1}function rt(e,t){var r=this.__data__,n=vt(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function nt(e){var t=-1,r=e?e.length:0;for(this.clear();++t0&&r(a)?t>1?wt(a,t-1,r,n,i):ne(i,a):n||(i[i.length]=a)}return i}var St=Vt();function Et(e,t){return e&&St(e,t,Tr)}function kt(e,t){t=nr(t,e)?[t]:Kt(t);for(var r=0,n=t.length;null!=e&&rt||o&&s&&u&&!a&&!c||n&&s&&u||!r&&u||!i)return 1;if(!n&&!o&&!c&&e=a)return u;var c=r[n];return u*("desc"==c?-1:1)}}return e.index-t.index}function zt(e,t){return function(r,n){if(null==r)return r;if(!mr(r))return e(r,n);for(var i=r.length,o=t?i:-1,s=Object(r);(t?o--:++oc))return!1;var l=o.get(e);if(l&&o.get(t))return l==t;var h=-1,d=!0,p=i&s?new ct:void 0;for(o.set(e,t),o.set(t,e);++h-1&&e%1==0&&e1&&rr(e,t[0],t[1])?t=[]:r>2&&rr(t[0],t[1],t[2])&&(t=[t[0]]),Mt(e,wt(t,1),[])});function dr(e,t){if("function"!=typeof e||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),s};return r.cache=new(dr.Cache||nt),r}function pr(e,t){return e===t||e!=e&&t!=t}function yr(e){return br(e)&&we.call(e,"callee")&&(!xe.call(e,"callee")||Se.call(e)==f)}dr.Cache=nt;var gr=Array.isArray;function mr(e){return null!=e&&_r(e.length)&&!vr(e)}function br(e){return Sr(e)&&mr(e)}function vr(e){var t=wr(e)?Se.call(e):"";return t==y||t==g}function _r(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function wr(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Sr(e){return!!e&&"object"==typeof e}function Er(e){return"symbol"==typeof e||Sr(e)&&Se.call(e)==k}var kr=ee?ue(ee):Ot;function Ar(e){return null==e?"":Ft(e)}function xr(e,t,r){var n=null==e?void 0:kt(e,t);return void 0===n?r:n}function Cr(e,t){return null!=e&&Qt(e,t,xt)}function Tr(e){return mr(e)?bt(e):Rt(e)}function Ir(e){return e}function Br(e){return nr(e)?oe(fr(e)):Dt(e)}r.exports=hr}).call(this,r(8),r(32)(e))},function(e,t,r){"use strict";const n=r(20),i=r(10);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(578),i=r(253),o=r(141).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(58),i=r(9),o=r(6),s=r(43),a=r(7),u=r(253),c=r(341),f=r(141).logger,l="/ipfs/bitswap/1.0.0",h="/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(l,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(l),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,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,c.providerRequestTimeout,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 l:s=t.serializeToBitswap100();break;case h: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,h,(r,n)=>{r?this.libp2p.dialProtocol(e,l,(e,r)=>{if(e)return t(e);t(null,r,l)}):t(null,n,h)})}_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(5).Buffer;e.exports=o;const i=10240;function o(e){e=Object.assign({fixed:!1},e||{});const t=r(22);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(22),i=r(579),o=r(5).Buffer,s=r(52);t.decode=f,t.decodeFromReader=l;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(){h(t,e,(e,t)=>{if(e)return r.end(e);r.push(t),i()})}return t(n),i(),r}}function l(e,t,r){"function"==typeof t&&(r=t,t={}),h(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 h(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+"!"));y(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+"!"));y(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(a--,s.push(t),o+=t.data.byteLength,o>=b||0===a){o=0;const t=s.slice();s=[],this._sendSafeBlocks(e,t,e=>{e&&this._log("sendblock error: %s",e.message),r()})}else r()},r)}_sendSafeBlocks(e,t,r){const n=new p(!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=c(r,(e,t)=>e.equals(t)),s=h(e,e=>e.target.toB58String());o([e=>a(i,(e,t)=>{this.blockstore.get(e,t)},e),(e,t)=>n(l(s),(t,n)=>{const i=t[0].target,o=r.map(t=>f(e,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()})})],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.toB58String(),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 r();if(t.full&&(n.wantlist=new y),this._processBlocks(t.blocks,n),0===t.wantlist.size)return 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();d(this._tasks,r,(e,t)=>{const r=e.target.toB58String()===n,i=e.entry.cid.equals(t.cid);return r&&i})}_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 g(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=v},function(e,t,r){(function(t){var r=200,n="__lodash_hash_undefined__",i=1/0,o="[object Function]",s="[object GeneratorFunction]",a=/[\\^$.*+?()[\]{}|]/g,u=/^\[object .+?Constructor\]$/,c="object"==typeof t&&t&&t.Object===Object&&t,f="object"==typeof self&&self&&self.Object===Object&&self,l=c||f||Function("return this")();function h(e,t){var r=e?e.length:0;return!!r&&y(e,t,0)>-1}function d(e,t,r){for(var n=-1,i=e?e.length:0;++n-1}function G(e,t){var r=this.__data__,n=re(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function W(e){var t=-1,r=e?e.length:0;for(this.clear();++t=r){var f=t?null:oe(e);if(f)return _(f);a=!1,o=m,c=new Q}else c=t?[]:u;e:for(;++i-1&&e%1==0&&e-1&&e%1==0&&e<=r}function x(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function C(e){return!!e&&"object"==typeof e}function T(e){return S(e)?g(e):m(e)}function I(e){return e?c(e,T(e)):[]}e.exports=I},function(e,t,r){(function(e,r){var n=200,i="Expected a function",o="__lodash_hash_undefined__",s=1,a=2,u=1/0,c=9007199254740991,f="[object Arguments]",l="[object Array]",h="[object Boolean]",d="[object Date]",p="[object Error]",y="[object Function]",g="[object GeneratorFunction]",m="[object Map]",b="[object Number]",v="[object Object]",_="[object Promise]",w="[object RegExp]",S="[object Set]",E="[object String]",k="[object Symbol]",A="[object WeakMap]",x="[object ArrayBuffer]",C="[object DataView]",T="[object Float32Array]",I="[object Float64Array]",B="[object Int8Array]",O="[object Int16Array]",P="[object Int32Array]",R="[object Uint8Array]",N="[object Uint8ClampedArray]",j="[object Uint16Array]",L="[object Uint32Array]",M=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,D=/^\w*$/,U=/^\./,F=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,K=/[\\^$.*+?()[\]{}|]/g,q=/\\(\\)?/g,H=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,V={};V[T]=V[I]=V[B]=V[O]=V[P]=V[R]=V[N]=V[j]=V[L]=!0,V[f]=V[l]=V[x]=V[h]=V[C]=V[d]=V[p]=V[y]=V[m]=V[b]=V[v]=V[w]=V[S]=V[E]=V[A]=!1;var G="object"==typeof e&&e&&e.Object===Object&&e,W="object"==typeof self&&self&&self.Object===Object&&self,$=G||W||Function("return this")(),Y="object"==typeof t&&t&&!t.nodeType&&t,J=Y&&"object"==typeof r&&r&&!r.nodeType&&r,X=J&&J.exports===Y,Z=X&&G.process,Q=function(){try{return Z&&Z.binding("util")}catch(e){}}(),ee=Q&&Q.isTypedArray;function te(e,t,r,n){for(var i=-1,o=e?e.length:0;++i-1}function Xe(e,t){var r=this.__data__,n=pt(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 l=o.get(e);if(l&&o.get(t))return l==t;var h=-1,d=!0,p=i&s?new it:void 0;for(o.set(e,t),o.set(t,e);++h-1&&e%1==0&&e-1&&e%1==0&&e<=c}function fr(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function lr(e){return!!e&&"object"==typeof e}function hr(e){return"symbol"==typeof e||lr(e)&&ve.call(e)==k}var dr=ee?oe(ee):xt;function pr(e){return null==e?"":Pt(e)}function yr(e,t,r){var n=null==e?void 0:vt(e,t);return void 0===n?r:n}function gr(e,t){return null!=e&&zt(e,t,wt)}function mr(e){return sr(e)?dt(e):Tt(e)}function br(e){return e}function vr(e){return Gt(e)?ne(Qt(e)):Ot(e)}r.exports=tr}).call(this,r(8),r(32)(e))},function(e,t){function r(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r-1;)d!==e&&c.call(d,p,1),c.call(e,p,1);return e}function l(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r`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(11),i=r(1273),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(11),i=r(63),o=r(581);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){"use strict";const n=r(42),i=r(2);e.exports=(e=>i(t=>{if(t=t||function e(){},e.log("stop"),"stopped"===e.state.state())return t(new Error("Already stopped"));if("running"!==e.state.state())return t(new Error("Not able to stop from state: "+e.state.state()));const r=r=>{if(r)return e.emit("error",r),t(r);e.state.stopped(),e.emit("stop"),t()};e.state.stop(),e._blockService.unsetExchange(),e._bitswap.stop(),e._preload.stop(),n([t=>e._mfsPreload.stop(t),t=>e.libp2p.stop(t),t=>e._repo.close(t)],r)}))},function(e,t,r){"use strict";e.exports=function e(t){return()=>Boolean(t._bitswap&&t._libp2pNode&&t._libp2pNode.isStarted())}},function(e,t,r){"use strict";const n=r(582),i=r(2);e.exports=function e(t){return i((e,r)=>{"function"==typeof e&&(r=e,e={}),t.repo.version((e,t)=>{e&&r(e),r(null,{version:n.version,repo:t,commit:""})})})}},function(e,t,r){"use strict";const n=r(2),i=r(7),o=r(582).version;e.exports=function e(t){return n((e,r)=>{"function"==typeof e&&(r=e,e={}),i(()=>r(null,{id:t._peerInfo.id.toB58String(),publicKey:t._peerInfo.id.pubKey.bytes.toString("base64"),addresses:t._peerInfo.multiaddrs.toArray().map(e=>e.toString()).filter(e=>e.indexOf("ipfs")>=0).sort(),agentVersion:`js-ipfs/${o}`,protocolVersion:"9000"}))})}},function(e,t,r){"use strict";const n=r(51),i=r(6),o=r(49),s=r(2),a=r(584),u=r(567),c=r(1279);e.exports=function e(t){return s((e,r)=>{"function"==typeof e&&(r=e,e={});const s=(e,n)=>{if(e)return t.emit("error",e),r(e);t.preStart(e=>{if(e)return t.emit("error",e),r(e);t.state.initialized(),t.emit("init"),r(null,n)})};if("uninitialized"!==t.state.state())return s(new Error("Not able to init from state: "+t.state.state()));if(t.state.init(),t.log("init"),e.repo)return t._repo=e.repo,s(null,!0);e.emptyRepo=e.emptyRepo||!1,e.bits=Number(e.bits)||2048,e.log=e.log||function(){};const f=a();let l;i([e=>t._repo.exists(e),(r,i)=>{if(t.log("repo exists?",r),!0===r)return i(new Error("repo already exists"));e.log(`generating ${e.bits}-bit RSA keypair...`,!1),t.log("generating peer id: %s bits",e.bits),n.create({bits:e.bits},i)},(r,n)=>{t.log("identity generated"),f.Identity={PeerID:r.toB58String(),PrivKey:r.privKey.bytes.toString("base64")},e.pass&&(l=r.privKey,f.Keychain=u.generateOptions()),e.log("done"),e.log("peer identity: "+f.Identity.PeerID),t._repo.init(f,n)},(e,r)=>t._repo.open(r),r=>{if(t.log("repo opened"),e.pass){t.log("creating keychain");const n=Object.assign({passPhrase:e.pass},f.Keychain);t._keychain=new u(t._repo.keys,n),t._keychain.importPeer("self",{privKey:l},r)}else r(null,!0)},(r,n)=>{if(e.emptyRepo)return n(null,!0);const i=[e=>t.object.new("unixfs-dir",e)];"function"==typeof c&&i.push(r=>c(t,e.log,r)),t.log("adding assets"),o(i,e=>{e?n(e):n(null,!0)})}],s)})}},function(e,t){},function(e,t,r){"use strict";const n=r(584),i=r(89).IPFS.matches,o=r(2);function s(e){try{return i(e)}catch(e){return!1}}function a(e){return new Error(`${e} is not a valid Multiaddr`)}e.exports=function e(t){return{list:o(e=>{t._repo.config.get((t,r)=>{if(t)return e(t);e(null,{Peers:r.Bootstrap})})}),add:o((e,r,i)=>{if("function"==typeof r&&(i=r,r={default:!1}),e&&!s(e))return setImmediate(()=>i(a(e)));t._repo.config.get((o,s)=>{if(o)return i(o);r.default?s.Bootstrap=n().Bootstrap:e&&-1===s.Bootstrap.indexOf(e)&&s.Bootstrap.push(e),t._repo.config.set(s,t=>{if(t)return i(t);i(null,{Peers:r.default?n().Bootstrap:[e]})})})}),rm:o((e,r,n)=>{if("function"==typeof r&&(n=r,r={all:!1}),e&&!s(e))return setImmediate(()=>n(a(e)));t._repo.config.get((i,o)=>{if(i)return n(i);r.all?o.Bootstrap=[]:o.Bootstrap=o.Bootstrap.filter(t=>t!==e),t._repo.config.set(o,t=>{if(t)return n(t);const i=[];!r.all&&e&&i.push(e),n(null,{Peers:i})})})})}}},function(e,t,r){"use strict";const n=r(2);e.exports=function e(t){return{get:n((e,r)=>("function"==typeof e&&(r=e,e=void 0),t._repo.config.get(e,r))),set:n((e,r,n)=>{t._repo.config.set(e,r,n)}),replace:n((e,r)=>{t._repo.config.set(e,r)})}}},function(e,t,r){"use strict";const n=r(105),i=r(18),o=r(33),s=r(10),a=r(6),u=r(7),c=r(2),f=r(71);function l(e){return s.isCID(e)?e:new s(e)}e.exports=function e(t){return{get:c((e,r,n)=>{"function"==typeof r&&(n=r,r={}),r=r||{};try{e=l(e)}catch(e){return u(()=>n(f(e,"ERR_INVALID_CID")))}!1!==r.preload&&t._preload(e),t._blockService.get(e,n)}),put:c((e,r,i)=>{if(i=i||function e(){},"function"==typeof r&&(i=r,r={}),Array.isArray(e))return i(new Error("Array is not supported"));a([t=>{if(n.isBlock(e))return t(null,e);if(r.cid&&s.isCID(r.cid))return t(null,new n(e,r.cid));const i=r.mhtype||"sha2-256",a=r.format||"dag-pb",u=r.version||0;o(e,i,(r,i)=>{if(r)return t(r);t(null,new n(e,new s(u,a,i)))})},(e,n)=>t._blockService.put(e,i=>{if(i)return n(i);!1!==r.preload&&t._preload(e.cid),n(null,e)})],i)}),rm:c((e,r)=>{try{e=l(e)}catch(e){return u(()=>r(f(e,"ERR_INVALID_CID")))}t._blockService.delete(e,r)}),stat:c((e,r,n)=>{"function"==typeof r&&(n=r,r={});try{e=l(e)}catch(e){return u(()=>n(f(e,"ERR_INVALID_CID")))}!1!==r.preload&&t._preload(e),t._blockService.get(e,(t,r)=>{if(t)return n(t);n(null,{key:i.toB58String(e.multihash),size:r.data.length})})})}}},function(e,t,r){"use strict";(function(t){const n=r(6),i=r(7),o=r(2),s=r(30),a=s.DAGNode,u=s.DAGLink,c=r(10),f=r(18),l=r(40),h=r(71);function d(e,r){if("string"==typeof e)return"base58"!==r&&r?t.from(e,r):e;if(t.isBuffer(e))return e;throw new Error("unsupported multihash")}function p(e,t,r){switch(t){case"json":return y(e,r);case"protobuf":return g(e,r);default:r(new Error(`unkown encoding: ${t}`))}}function y(e,r){let n,i;try{const o=JSON.parse(e.toString());i=(o.Links||[]).map(e=>new u(e.Name||e.name,e.Size||e.size,f.fromB58String(e.Hash||e.hash||e.multihash))),n=t.from(o.Data)}catch(e){return r(new Error("failed to parse JSON: "+e))}a.create(n,i,r)}function g(e,t){s.util.deserialize(e,t)}e.exports=function e(r){function f(e){return(t,i,o)=>{"function"==typeof i&&(o=i,i={}),n([e=>{r.object.get(t,i,e)},(t,n)=>{e(t,(e,t)=>{if(e)return n(e);const o=new c(t.multihash);r._ipld.put(t,{cid:o},e=>{if(e)return n(e);!1!==i.preload&&r._preload(o),n(null,t)})})}],o)}}return{new:o((e,n,o)=>{let s;if("function"==typeof e&&(o=e,e=void 0,n={}),"function"==typeof n&&(o=n,n={}),n=n||{},e){if("unixfs-dir"!==e)return i(()=>o(new Error("unknown template")));s=new l("directory").marshal()}else s=t.alloc(0);a.create(s,(e,t)=>{if(e)return o(e);const i=new c(t.multihash);r._ipld.put(t,{cid:i},e=>{if(e)return o(e);!1!==n.preload&&r._preload(i),o(null,t)})})}),put:o((e,n,o)=>{"function"==typeof n&&(o=n,n={});const s=n.enc;let u;if(t.isBuffer(e))s?p(e,s,(e,t)=>{if(e)return o(e);u=t,f()}):a.create(e,(e,t)=>{if(e)return o(e);u=t,f()});else if(e.multihash)u=e,f();else{if("object"!=typeof e)return o(new Error("obj not recognized"));a.create(e.Data,e.Links,(e,t)=>{if(e)return o(e);u=t,f()})}function f(){let e;try{e=new c(u.multihash)}catch(e){return i(()=>o(h(e,"ERR_INVALID_CID")))}r._ipld.put(u,{cid:e},t=>{if(t)return o(t);!1!==n.preload&&r._preload(e),r.object.get(u.multihash,o)})}}),get:o((e,t,n)=>{let o,s;"function"==typeof t&&(n=t,t={});try{o=d(e,t.enc)}catch(e){return i(()=>n(h(e,"ERR_INVALID_MULTIHASH")))}try{s=new c(o)}catch(e){return i(()=>n(h(e,"ERR_INVALID_CID")))}1===t.cidVersion&&(s=s.toV1()),!1!==t.preload&&r._preload(s),r._ipld.get(s,(e,t)=>{if(e)return n(e);const r=t.value;n(null,r)})}),data:o((e,t,n)=>{"function"==typeof t&&(n=t,t={}),r.object.get(e,t,(e,t)=>{if(e)return n(e);n(null,t.data)})}),links:o((e,t,n)=>{"function"==typeof t&&(n=t,t={}),r.object.get(e,t,(e,t)=>{if(e)return n(e);n(null,t.links)})}),stat:o((e,t,n)=>{"function"==typeof t&&(n=t,t={}),r.object.get(e,t,(e,t)=>{if(e)return n(e);s.util.serialize(t,(e,r)=>{if(e)return n(e);const i=r.length,o=t.links.reduce((e,t)=>e+t.size,0),s=t.toJSON();n(null,{Hash:s.multihash,NumLinks:t.links.length,BlockSize:i,LinksSize:i-t.data.length,DataSize:t.data.length,CumulativeSize:i+o})})})}),patch:o({addLink(e,t,r,n){f((e,r)=>{a.addLink(e,t,r)})(e,r,n)},rmLink(e,t,r,n){f((e,r)=>{u.isDAGLink(t)?t=t._name:t&&t.name&&(t=t.name),a.rmLink(e,t,r)})(e,r,n)},appendData(e,r,n,i){f((e,n)=>{const i=t.concat([e.data,r]);a.create(i,e.links,n)})(e,n,i)},setData(e,t,r,n){f((e,r)=>{a.create(t,e.links,r)})(e,r,n)}})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports="message Data {\n enum DataType {\n Raw = 0;\n Directory = 1;\n File = 2;\n Metadata = 3;\n Symlink = 4;\n HAMTShard = 5;\n }\n\n required DataType Type = 1;\n optional bytes Data = 2;\n optional uint64 filesize = 3;\n repeated uint64 blocksizes = 4;\n\n optional uint64 hashType = 5;\n optional uint64 fanout = 6;\n}\n\nmessage Metadata {\n optional string MimeType = 1;\n}"},function(e,t,r){"use strict";(function(t){const n=r(2),i=r(10),o=r(9),s=r(83),a=r(7),u=r(1286),c=r(71);e.exports=function e(r){return{put:n((e,t,n)=>{if("function"==typeof t)n=t,t={};else{if(t&&t.cid&&(t.format||t.hashAlg))return n(new Error("Can't put dag node. Please provide either `cid` OR `format` and `hashAlg` options."));if(t&&(t.format&&!t.hashAlg||!t.format&&t.hashAlg))return n(new Error("Can't put dag node. Please provide `format` AND `hashAlg` options."))}t=t||{};const i={format:"dag-cbor",hashAlg:"sha2-256"};t=t.cid?t:Object.assign({},i,t),r._ipld.put(e,t,(e,i)=>{if(e)return n(e);!1!==t.preload&&r._preload(i),n(null,i)})}),get:n((e,n,o,s)=>{if("function"==typeof n&&(s=n,n=void 0),"function"==typeof o&&(s=o,o={}),o=o||{},"string"==typeof e){const t=e.split("/");try{e=new i(t[0])}catch(e){return a(()=>s(c(e,"ERR_INVALID_CID")))}t.shift(),n=t.length>0?t.join("/"):"/"}else if(t.isBuffer(e))try{e=new i(e)}catch(e){return a(()=>s(c(e,"ERR_INVALID_CID")))}!1!==o.preload&&r._preload(e),r._ipld.get(e,n,o,s)}),tree:n((e,t,n,s)=>{if("object"==typeof t&&(s=n,n=t,t=void 0),"function"==typeof t&&(s=t,t=void 0),"function"==typeof n&&(s=n,n={}),n=n||{},"string"==typeof e){const r=e.split("/");try{e=new i(r[0])}catch(e){return a(()=>s(c(e,"ERR_INVALID_CID")))}r.shift(),t=r.length>0?r.join("/"):void 0}!1!==n.preload&&r._preload(e),o(r._ipld.treeStream(e,t,n),o.collect(s))}),_getRecursive:n((e,t,n)=>{let o;"function"==typeof t&&(n=t,t={}),t=t||{};try{o=new i(e)}catch(e){return a(()=>n(c(e,"ERR_INVALID_CID")))}r.dag.get(o,"",t,(e,t)=>{if(e)return n(e);s(t.value.links,(e,t)=>{r.dag._getRecursive(e.multihash,t)},(e,r)=>{if(e)return n(e);n(null,u([t.value,r]))})})})}}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(1287),i=1/0;function o(e){var t=null==e?0:e.length;return t?n(e,i):[]}e.exports=o},function(e,t,r){var n=r(1288),i=r(1289);function o(e,t,r,s,a){var u=-1,c=e.length;for(r||(r=i),a||(a=[]);++u0&&r(f)?t>1?o(f,t-1,r,s,a):n(a,f):s||(a[a.length]=f)}return a}e.exports=o},function(e,t){function r(e,t){for(var r=-1,n=t.length,i=e.length;++r{function r(r,i){if(r)return e(r);const a={peerInfo:t._peerInfo,peerBook:t._peerInfoBook,config:{peerDiscovery:{mdns:{enabled:o(t._options,"config.Discovery.MDNS.Enabled",o(i,"Discovery.MDNS.Enabled",!0))},webRTCStar:{enabled:o(t._options,"config.Discovery.webRTCStar.Enabled",o(i,"Discovery.webRTCStar.Enabled",!0))},bootstrap:{list:o(t._options,"config.Bootstrap",o(i,"Bootstrap",[]))}},relay:{enabled:o(t._options,"relay.enabled",o(i,"relay.enabled",!1)),hop:{enabled:o(t._options,"relay.hop.enabled",o(i,"relay.hop.enabled",!1)),active:o(t._options,"relay.hop.active",o(i,"relay.hop.active",!1))}},EXPERIMENTAL:{dht:o(t._options,"EXPERIMENTAL.dht",!1),pubsub:o(t._options,"EXPERIMENTAL.pubsub",!1)}},connectionManager:o(t._options,"connectionManager",o(i,"connectionManager",{}))},u=s(o(t._options,"libp2p",{}),a);t._libp2pNode=new n(u),t._libp2pNode.on("peer:discovery",e=>{const r=()=>{t._peerInfoBook.put(e),t._libp2pNode.dial(e,()=>{})};t.isOnline()?r():t._libp2pNode.once("start",r)}),t._libp2pNode.on("peer:connect",e=>{t._peerInfoBook.put(e)}),t._libp2pNode.start(r=>{if(r)return e(r);t._libp2pNode.peerInfo.multiaddrs.forEach(e=>{console.log("Swarm listening on",e.toString())}),e()})}t.config.get(r)}),stop:i(e=>{t._libp2pNode.stop(e)})}}},function(e,t,r){"use strict";const n=r(585),i=r(1305),o=r(1340),s=r(1369),a=r(1385),u=r(1431),c=r(1435),f=r(666);class l extends c{constructor(e){const t=new i({id:e.peerInfo.id}),r=new o({id:e.peerInfo.id}),c={modules:{transport:[n,t,r],streamMuxer:[s],connEncryption:[a],peerDiscovery:[t.discovery,r.discovery,u]},config:{peerDiscovery:{bootstrap:{enabled:!0},webRTCStar:{enabled:!0},websocketStar:{enabled:!0}},EXPERIMENTAL:{dht:!1,pubsub:!1}}};super(f(e,c))}}e.exports=l},function(e,t,r){"use strict";var n=r(1293),i=r(1295),o=r(1299);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(1294):WebSocket},function(e,t){},function(e,t,r){var n=r(1296),i=r(1297);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(5).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(1298),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(3))},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 n=r(1300),i={http:"ws",https:"wss"},o="ws";e.exports=function(e,t){return n(e,t,i,o)}},function(e,t,r){var n=r(35);e.exports=function(e,t,r,i){r=r||{};var e=n.parse(e,!1,!0),o;return e.protocol?o=e.protocol:(o=t.protocol?t.protocol.replace(/:$/,""):"http",o=(r[o]||i||o)+":"),e.host&&":"===e.host[0]&&(e.host=null),e.hostname?n.format({protocol:o,slashes:!0,hostname:e.hostname,port:e.port,pathname:e.pathname,search:e.search}):(e.host=t.host,e.port?n.format({protocol:o,slashes:!0,host:t.hostname+":"+e.port,port:e.port,pathname:e.pathname,search:e.search}):e.pathname?n.format({protocol:o,slashes:!0,host:e.host,pathname:e.pathname,search:e.search}):(e.pathname=t.pathname,e.search?n.format({protocol:o,slashes:!0,host:e.host,pathname:e.pathname,search:e.search}):(e.search=t.search,e.format(e))))}},function(e,t){var r=1/0,n=9007199254740991,i=1.7976931348623157e308,o=NaN,s="[object Arguments]",a="[object Function]",u="[object GeneratorFunction]",c="[object String]",f="[object Symbol]",l=/^\s+|\s+$/g,h=/^[-+]0x[0-9a-f]+$/i,d=/^0b[01]+$/i,p=/^0o[0-7]+$/i,y=/^(?:0|[1-9]\d*)$/,g=parseInt;function m(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r-1&&e%1==0&&e-1:!!i&&v(e,t,r)>-1}function j(e){return D(e)&&A.call(e,"callee")&&(!C.call(e,"callee")||x.call(e)==s)}var L=Array.isArray;function M(e){return null!=e&&F(e.length)&&!U(e)}function D(e){return q(e)&&M(e)}function U(e){var t=K(e)?x.call(e):"";return t==a||t==u}function F(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}function K(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function q(e){return!!e&&"object"==typeof e}function H(e){return"string"==typeof e||!L(e)&&q(e)&&x.call(e)==c}function z(e){return"symbol"==typeof e||q(e)&&x.call(e)==f}function V(e){if(!e)return 0===e?e:0;if(e=W(e),e===r||e===-r){var t=e<0?-1:1;return t*i}return e==e?e:0}function G(e){var t=V(e),r=t%1;return t==t?r?t-r:t:0}function W(e){if("number"==typeof e)return e;if(z(e))return o;if(K(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=K(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(l,"");var r=d.test(e);return r||p.test(e)?g(e.slice(2),r?2:8):h.test(e)?o:+e}function $(e){return M(e)?B(e):O(e)}function Y(e){return e?S(e,$(e)):[]}e.exports=N},function(e,t,r){"use strict";const n=r(448);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";const n=r(4),i=n("libp2p:websockets:dialer");function o(e){const t=e.toString().split("/");let r,n;try{r=e.protoNames().filter(e=>"ws"===e||"wss"===e)[0]}catch(e){throw i(e),new Error("Not a valid websocket address",e)}try{n=e.stringTuples().filter(t=>{if(t[0]===e.protos().filter(e=>"tcp"===e.name)[0].code)return!0})[0][1]}catch(e){i("No port, skipping")}let o=`${r}://${t[2]}${!n||80===n&&443===n?"":`:${n}`}`;return o}e.exports=o},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(1306),i=n("libp2p:webrtc-star"),o=r(27),s=r(89),a=r(41),u=r(586),c=r(11).EventEmitter,f=r(259),l=r(1336),h=r(47),d=r(53).Connection,p=r(69),y=r(26),g=r(7),m=r(1338),b=r(1339),v=b.cleanUrlSIO,_=b.cleanMultiaddr,w=y(()=>{}),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=>{g(e)}),this.discovery.stop=(e=>{g(e)}),this.listenersRefs={},this._peerDiscovered=this._peerDiscovered.bind(this)}dial(e,t,r){"function"==typeof t&&(r=t,t={}),r=r?y(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?y(n):w,!m.support&&!this.wrtc)return g(()=>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?y(e):w,r.io.emit("ss-leave"),g(()=>{r.emit("close"),e()})}),r.getAddrs=(e=>{g(()=>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=l.createFromB58String(r),s=new h(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){(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(1307)(t);const{formatters:f}=e.exports;f.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,r(3))},function(e,t,r){function n(e){function t(e){let t=0;for(let r=0;r{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){var n=r(587),i=r(255)("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(1312),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(3))},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(588),i=r(589),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 l(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(344),f.transports=r(591),f.parser=r(143),f.prototype.createTransport=function(e){o('creating transport "%s"',e);var t=l(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"),h(),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,h(),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 l(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),n.removeListener("close",c),n.removeListener("upgrading",l)}f.priorWebsocketSuccess=!1,t.once("open",i),t.once("error",a),t.once("close",u),this.once("close",c),this.once("upgrading",l),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;si&&(u=i),c>i&&(c=i),f=a,l=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(y(e));break;case"message":t.messages.push(l(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:l(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}},l=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")},h=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}},y=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=g(e),r.options[t.name]=t.value}throw new Error("No closing tag for enum")},g=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=m(e));break;default:throw new Error("Unexpected token in option: "+e[0])}}},m=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=m(e)),r[i]=o,";"===e[0]&&e.shift();break;case"{":if(e.shift(),o=m(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")},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 r=g(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=g(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(846),i=r(848),o=r(849),s=r(850),a=r(22),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={},l=function(e,t){e.enums&&e.enums.forEach(function(e){e.id=t+(t?".":"")+e.name,c[e.id]=e,l(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}}),l(n,n.id)})};l(e,"");var h=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 h(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(22),i=r(847),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,l;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},l=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,l.bytes=t-r,o},s(2,f,l,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(22),i=r(288).defined;function o(e,t,r){for(var o=[],u={},c=[],f=[],l=0;l-1&&delete r[u[f]];if(e.message){var l=n.decode(i,o);o+=n.decode.bytes;var h=e.decode(i,o,o+l);t.map?(r[a]=r[a]||{},r[a][h.key]=h.value):t.repeated?(r[a]=r[a]||[],r[a].push(h)):r[a]=h}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(l,h,d){if(null==h&&(h=0),null==d&&(d=l.length),!(d<=l.length&&h<=l.length))throw new Error("Decoded message is not valid");for(var p=h,g={},m;;){if(d<=h){var b="",v=0,_,w;for(v=0;v-1){S=!0;break}S||(_?m.repeated?g[b]=[]:(w=w&&_[w]?_[w].value:_[Object.keys(_)[0]].value,g[b]=parseInt(w||0,10)):g[b]=a(m,w))}return t.bytes=h-p,g}var A=n.decode(l,h);h+=n.decode.bytes;var x=A>>3,C=u[x];if(null!=C){var T=r[C];if(m=e.fields[C],m.packed){var I=n.decode(l,h);for(h+=n.decode.bytes,I+=h;h-1){if(b)throw new Error("only one of the properties defined in oneof "+v+" can be set");b=!0}}for(m=0;me.name!==r);else{if(!t.isBuffer(r))return n(new Error("second arg needs to be a name or multihash"),null);u=u.filter(e=>!e.multihash.equals(r))}s(a,u,n)}e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";t.Diagnose=r(858),t.Decoder=r(447),t.Encoder=r(860),t.Simple=r(448),t.Tagged=r(449),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(447),i=r(289);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 l=r.pushFloatSingle;var h=r.pushFloatDouble;var d=r.pushTrue;var p=r.pushFalse;var y=r.pushUndefined;var g=r.pushNull;var m=r.pushInfinity;var b=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 A=r.pushObjectStart;var x=r.pushObjectStartFixed;var C=r.pushObjectStartFixed32;var T=r.pushObjectStartFixed64;var I=r.pushByteString;var B=r.pushByteStringStart;var O=r.pushUtf8String;var P=r.pushUtf8StringStart;var R=r.pushSimpleUnassigned;var N=r.pushTagStart;var j=r.pushTagStart4;var L=r.pushTagStart8;var M=r.pushTagUnassigned;var D=r.pushBreak;var U=t.Math.pow;var F=0;var K=0;var q=0;function H(e){e=e|0;F=0;K=e;while((F|0)<(K|0)){q=Ze[i[F]&255](i[F]|0)|0;if((q|0)>0){break}}return q|0}function z(e){e=e|0;if(((F|0)+(e|0)|0)<(K|0)){return 0}return 1}function V(e){e=e|0;return i[e|0]<<8|i[e+1|0]|0}function G(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 W(e){e=e|0;o(e|0);F=F+1|0;return 0}function $(e){e=e|0;if(z(1)|0){return 1}o(i[F+1|0]|0);F=F+2|0;return 0}function Y(e){e=e|0;if(z(2)|0){return 1}o(V(F+1|0)|0);F=F+3|0;return 0}function J(e){e=e|0;if(z(4)|0){return 1}s(V(F+1|0)|0,V(F+3|0)|0);F=F+5|0;return 0}function Z(e){e=e|0;if(z(8)|0){return 1}u(V(F+1|0)|0,V(F+3|0)|0,V(F+5|0)|0,V(F+7|0)|0);F=F+9|0;return 0}function X(e){e=e|0;o(-1-(e-32|0)|0);F=F+1|0;return 0}function Q(e){e=e|0;if(z(1)|0){return 1}o(-1-(i[F+1|0]|0)|0);F=F+2|0;return 0}function ee(e){e=e|0;var t=0;if(z(2)|0){return 1}t=V(F+1|0)|0;o(-1-(t|0)|0);F=F+3|0;return 0}function te(e){e=e|0;if(z(4)|0){return 1}a(V(F+1|0)|0,V(F+3|0)|0);F=F+5|0;return 0}function re(e){e=e|0;if(z(8)|0){return 1}c(V(F+1|0)|0,V(F+3|0)|0,V(F+5|0)|0,V(F+7|0)|0);F=F+9|0;return 0}function ne(e){e=e|0;var t=0;var r=0;var n=0;n=e-64|0;if(z(n|0)|0){return 1}t=F+1|0;r=(F+1|0)+(n|0)|0;I(t|0,r|0);F=r|0;return 0}function ie(e){e=e|0;var t=0;var r=0;var n=0;if(z(1)|0){return 1}n=i[F+1|0]|0;t=F+2|0;r=(F+2|0)+(n|0)|0;if(z(n+1|0)|0){return 1}I(t|0,r|0);F=r|0;return 0}function oe(e){e=e|0;var t=0;var r=0;var n=0;if(z(2)|0){return 1}n=V(F+1|0)|0;t=F+3|0;r=(F+3|0)+(n|0)|0;if(z(n+2|0)|0){return 1}I(t|0,r|0);F=r|0;return 0}function se(e){e=e|0;var t=0;var r=0;var n=0;if(z(4)|0){return 1}n=G(F+1|0)|0;t=F+5|0;r=(F+5|0)+(n|0)|0;if(z(n+4|0)|0){return 1}I(t|0,r|0);F=r|0;return 0}function ae(e){e=e|0;return 1}function ue(e){e=e|0;B();F=F+1|0;return 0}function ce(e){e=e|0;var t=0;var r=0;var n=0;n=e-96|0;if(z(n|0)|0){return 1}t=F+1|0;r=(F+1|0)+(n|0)|0;O(t|0,r|0);F=r|0;return 0}function fe(e){e=e|0;var t=0;var r=0;var n=0;if(z(1)|0){return 1}n=i[F+1|0]|0;t=F+2|0;r=(F+2|0)+(n|0)|0;if(z(n+1|0)|0){return 1}O(t|0,r|0);F=r|0;return 0}function le(e){e=e|0;var t=0;var r=0;var n=0;if(z(2)|0){return 1}n=V(F+1|0)|0;t=F+3|0;r=(F+3|0)+(n|0)|0;if(z(n+2|0)|0){return 1}O(t|0,r|0);F=r|0;return 0}function he(e){e=e|0;var t=0;var r=0;var n=0;if(z(4)|0){return 1}n=G(F+1|0)|0;t=F+5|0;r=(F+5|0)+(n|0)|0;if(z(n+4|0)|0){return 1}O(t|0,r|0);F=r|0;return 0}function de(e){e=e|0;return 1}function pe(e){e=e|0;P();F=F+1|0;return 0}function ye(e){e=e|0;S(e-128|0);F=F+1|0;return 0}function ge(e){e=e|0;if(z(1)|0){return 1}S(i[F+1|0]|0);F=F+2|0;return 0}function me(e){e=e|0;if(z(2)|0){return 1}S(V(F+1|0)|0);F=F+3|0;return 0}function be(e){e=e|0;if(z(4)|0){return 1}E(V(F+1|0)|0,V(F+3|0)|0);F=F+5|0;return 0}function ve(e){e=e|0;if(z(8)|0){return 1}k(V(F+1|0)|0,V(F+3|0)|0,V(F+5|0)|0,V(F+7|0)|0);F=F+9|0;return 0}function _e(e){e=e|0;w();F=F+1|0;return 0}function we(e){e=e|0;var t=0;t=e-160|0;if(z(t|0)|0){return 1}x(t|0);F=F+1|0;return 0}function Se(e){e=e|0;if(z(1)|0){return 1}x(i[F+1|0]|0);F=F+2|0;return 0}function Ee(e){e=e|0;if(z(2)|0){return 1}x(V(F+1|0)|0);F=F+3|0;return 0}function ke(e){e=e|0;if(z(4)|0){return 1}C(V(F+1|0)|0,V(F+3|0)|0);F=F+5|0;return 0}function Ae(e){e=e|0;if(z(8)|0){return 1}T(V(F+1|0)|0,V(F+3|0)|0,V(F+5|0)|0,V(F+7|0)|0);F=F+9|0;return 0}function xe(e){e=e|0;A();F=F+1|0;return 0}function Ce(e){e=e|0;N(e-192|0|0);F=F+1|0;return 0}function Te(e){e=e|0;N(e|0);F=F+1|0;return 0}function Ie(e){e=e|0;N(e|0);F=F+1|0;return 0}function Be(e){e=e|0;N(e|0);F=F+1|0;return 0}function Oe(e){e=e|0;N(e|0);F=F+1|0;return 0}function Pe(e){e=e|0;N(e-192|0|0);F=F+1|0;return 0}function Re(e){e=e|0;N(e|0);F=F+1|0;return 0}function Ne(e){e=e|0;N(e|0);F=F+1|0;return 0}function je(e){e=e|0;N(e|0);F=F+1|0;return 0}function Le(e){e=e|0;if(z(1)|0){return 1}N(i[F+1|0]|0);F=F+2|0;return 0}function Me(e){e=e|0;if(z(2)|0){return 1}N(V(F+1|0)|0);F=F+3|0;return 0}function De(e){e=e|0;if(z(4)|0){return 1}j(V(F+1|0)|0,V(F+3|0)|0);F=F+5|0;return 0}function Ue(e){e=e|0;if(z(8)|0){return 1}L(V(F+1|0)|0,V(F+3|0)|0,V(F+5|0)|0,V(F+7|0)|0);F=F+9|0;return 0}function Fe(e){e=e|0;R((e|0)-224|0);F=F+1|0;return 0}function Ke(e){e=e|0;p();F=F+1|0;return 0}function qe(e){e=e|0;d();F=F+1|0;return 0}function He(e){e=e|0;g();F=F+1|0;return 0}function ze(e){e=e|0;y();F=F+1|0;return 0}function Ve(e){e=e|0;if(z(1)|0){return 1}R(i[F+1|0]|0);F=F+2|0;return 0}function Ge(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(z(2)|0){return 1}t=i[F+1|0]|0;r=i[F+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{m()}}else{if(+s>0.0){_()}else{b()}}}else{f(+(+n*U(+2,+(+o-25.0))*+(1024.0+s)))}F=F+3|0;return 0}function We(e){e=e|0;if(z(4)|0){return 1}l(i[F+1|0]|0,i[F+2|0]|0,i[F+3|0]|0,i[F+4|0]|0);F=F+5|0;return 0}function $e(e){e=e|0;if(z(8)|0){return 1}h(i[F+1|0]|0,i[F+2|0]|0,i[F+3|0]|0,i[F+4|0]|0,i[F+5|0]|0,i[F+6|0]|0,i[F+7|0]|0,i[F+8|0]|0);F=F+9|0;return 0}function Ye(e){e=e|0;return 1}function Je(e){e=e|0;D();F=F+1|0;return 0}var Ze=[W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,$,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,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,le,he,de,Ye,Ye,Ye,pe,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ge,me,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,Se,Ee,ke,Ae,Ye,Ye,Ye,xe,Ce,Ce,Ce,Ce,Ce,Ce,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Le,Me,De,Ue,Ye,Ye,Ye,Ye,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Fe,Ke,qe,He,ze,Ve,Ge,We,$e,Ye,Ye,Ye,Je];return{parse:H}}},function(e,t,r){"use strict";(function(t){const n=r(36),i=r(218),o=r(289),s=r(219),a=s.MT,u=s.NUMBYTES,c=s.SHIFT32,f=s.SYMS,l=s.TAG,h=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,y=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.TRUE,g=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.FALSE,m=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"),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.Url,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;rt.length)throw new Error(r.INVALID_TARGET_OFFSET)}function c(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}t.ERRORS=r,t.checkEncoding=n,t.isFiniteInteger=i,t.checkLengthValue=s,t.checkOffsetValue=a,t.checkTargetOffset=u}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(7),o=r(221).SmartBuffer,s=r(220);t=e.exports,t.serialize=((e,t)=>{let r=[];r.push("tree "+s.cidToSha(e.tree["/"]).toString("hex")),e.parents.forEach(e=>{r.push("parent "+s.cidToSha(e["/"]).toString("hex"))}),r.push("author "+s.serializePersonLine(e.author)),r.push("committer "+s.serializePersonLine(e.committer)),e.encoding&&r.push("encoding "+e.encoding),e.mergetag&&e.mergetag.forEach(e=>{r.push("mergetag object "+s.cidToSha(e.object["/"]).toString("hex")),r.push(e.text)}),e.signature&&(r.push("gpgsig -----BEGIN PGP SIGNATURE-----"),r.push(e.signature.text)),r.push(""),r.push(e.message);let n=r.join("\n"),a=new o;a.writeString("commit "),a.writeString(n.length.toString()),a.writeUInt8(0),a.writeString(n),i(()=>t(null,a.toBuffer()))}),t.deserialize=((e,t)=>{let r=e.toString().split("\n"),o={gitType:"commit",parents:[]};for(let e=0;et(new Error("Invalid commit line "+e))),o.message=r.slice(e+1).join("\n");break}let u=a[1],c=a[2];switch(u){case"tree":o.tree={"/":s.shaToCid(n.from(c,"hex"))};break;case"committer":o.committer=s.parsePersonLine(c);break;case"author":o.author=s.parsePersonLine(c);break;case"parent":o.parents.push({"/":s.shaToCid(n.from(c,"hex"))});break;case"gpgsig":{"-----BEGIN PGP SIGNATURE-----"!==c&&i(()=>t(new Error("Invalid commit line "+e))),o.signature={};let n=e;for(;et(new Error("Invalid commit line "+e)));let u={object:{"/":s.shaToCid(n.from(a[1],"hex"))}},f=e;for(;et(null,o))})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(7),o=r(221).SmartBuffer,s=r(220);t=e.exports,t.serialize=((e,t)=>{let r=[];r.push("object "+s.cidToSha(e.object["/"]).toString("hex")),r.push("type "+e.type),r.push("tag "+e.tag),null!==e.tagger&&r.push("tagger "+s.serializePersonLine(e.tagger)),r.push(""),r.push(e.message);let n=r.join("\n"),a=new o;a.writeString("tag "),a.writeString(n.length.toString()),a.writeUInt8(0),a.writeString(n),i(()=>t(null,a.toBuffer()))}),t.deserialize=((e,t)=>{let r=e.toString().split("\n"),o={gitType:"tag"};for(let e=0;et(new Error("Invalid tag line "+e))),o.message=r.slice(e+1).join("\n");break}let u=a[1],c=a[2];switch(u){case"object":o.object={"/":s.shaToCid(n.from(c,"hex"))};break;case"tagger":o.tagger=s.parsePersonLine(c);break;case"tag":o.tag=c;break;case"type":o.type=c;break;default:o[u]=c}}i(()=>t(null,o))})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(7),i=r(221).SmartBuffer,o=r(220);t=e.exports,t.serialize=((e,t)=>{let r=[];Object.keys(e).forEach(t=>{r.push([t,e[t]])}),r.sort((e,t)=>e[0]>t[0]?1:-1);let s=new i;r.forEach(e=>{s.writeStringNT(e[1].mode+" "+e[0]),s.writeBuffer(o.cidToSha(e[1].hash["/"]))});let a=new i;a.writeString("tree "),a.writeString(s.length.toString()),a.writeUInt8(0),a.writeBuffer(s.toBuffer()),n(()=>t(null,a.toBuffer()))}),t.deserialize=((e,t)=>{let r={},s=i.fromBuffer(e,"utf8");for(;;){let e=s.readStringNT();if(""===e)break;let i=s.readBuffer(o.SHA1_LENGTH),a=e.match(/^(\d+) (.+)$/);a||n(()=>t(new Error("invalid file mode/name"))),r[a[2]]&&n(()=>t(new Error("duplicate file in tree"))),r[a[2]]={mode:a[1],hash:{"/":o.shaToCid(i)}}}n(()=>t(null,r))})},function(e,t,r){"use strict";t.resolver=r(290),t.util=r(454)},function(e,t,r){const n=r(23);e.exports={Block:r(905),ECPair:r(467),Transaction:r(296),TransactionBuilder:r(909),address:r(469),bip32:r(934),crypto:r(94),networks:r(64),opcodes:r(29),payments:r(298),script:n}},function(e,t){},function(e){e.exports={_from:"elliptic@^6.4.0",_id:"elliptic@6.4.1",_inBundle:!1,_integrity:"sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==",_location:"/elliptic",_phantomChildren:{},_requested:{type:"range",registry:!0,raw:"elliptic@^6.4.0",name:"elliptic",escapedName:"elliptic",rawSpec:"^6.4.0",saveSpec:null,fetchSpec:"^6.4.0"},_requiredBy:["/@trust/keyto","/@trust/webcrypto","/browserify-sign","/create-ecdh","/secp256k1","/tiny-secp256k1"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz",_shasum:"c2d0b7776911b86722c632c3c06c60f2f819939a",_spec:"elliptic@^6.4.0",_where:"/Users/mitra/git/dweb-transports/node_modules/@trust/webcrypto",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},bundleDependencies:!1,dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0",inherits:"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"},deprecated:!1,description:"EC cryptography",devDependencies:{brfs:"^1.4.3",coveralls:"^2.11.3",grunt:"^0.4.5","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2",istanbul:"^0.4.2",jscs:"^2.9.0",jshint:"^2.6.0",mocha:"^2.1.0"},files:["lib"],homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.4.1"}},function(e,t,r){"use strict";var n=t,i=r(31),o=r(49),s=r(455);function a(e,t){for(var r=[],n=1<=0;){var o;if(i.isOdd()){var s=i.andln(n-1);o=s>(n>>1)-1?(n>>1)-s:s,i.isubn(o)}else o=0;r.push(o);for(var a=0!==i.cmpn(0)&&0===i.andln(n-1)?t+1:1,u=1;u0||t.cmpn(-i)>0;){var o=e.andln(3)+n&3,s=t.andln(3)+i&3,a,u;if(3===o&&(o=-1),3===s&&(s=-1),0==(1&o))a=0;else{var c=e.andln(7)+n&7;a=3!==c&&5!==c||2!==s?o:-o}if(r[0].push(a),0==(1&s))u=0;else{var c=t.andln(7)+i&7;u=3!==c&&5!==c||2!==o?s:-s}r[1].push(u),2*n===a+1&&(n=1-n),2*i===u+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r}function c(e,t,r){var n="_"+t;e.prototype[t]=function e(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}}function f(e){return"string"==typeof e?n.toArray(e,"hex"):e}function l(e){return new i(e,"hex","le")}n.assert=o,n.toArray=s.toArray,n.zero2=s.zero2,n.toHex=s.toHex,n.encode=s.encode,n.getNAF=a,n.getJSF=u,n.cachedProperty=c,n.parseBytes=f,n.intFromLE=l},function(e,t,r){var n;function i(e){this.rand=e}if(e.exports=function e(t){return n||(n=new i(null)),n.generate(t)},e.exports.Rand=i,i.prototype.generate=function e(t){return this._rand(t)},i.prototype._rand=function e(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var r=new Uint8Array(t),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function f(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=c,c.prototype.point=function e(){throw new Error("Not implemented")},c.prototype.validate=function e(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function e(t,r){u(t.precomputed);var n=t._getDoubles(),i=s(r,1),o=(1<=c;r--)f=(f<<1)+i[r];a.push(f)}for(var l=this.jpoint(null,null,null),h=this.jpoint(null,null,null),d=o;d>0;d--){for(var c=0;c=0;f--){for(var r=0;f>=0&&0===a[f];f--)r++;if(f>=0&&r++,c=c.dblp(r),f<0)break;var l=a[f];u(0!==l),c="affine"===t.type?l>0?c.mixedAdd(o[l-1>>1]):c.mixedAdd(o[-l-1>>1].neg()):l>0?c.add(o[l-1>>1]):c.add(o[-l-1>>1].neg())}return"affine"===t.type?c.toP():c},c.prototype._wnafMulAdd=function e(t,r,n,i,o){for(var u=this._wnafT1,c=this._wnafT2,f=this._wnafT3,l=0,h=0;h=1;h-=2){var y=h-1,g=h;if(1===u[y]&&1===u[g]){var m=[r[y],null,null,r[g]];0===r[y].y.cmp(r[g].y)?(m[1]=r[y].add(r[g]),m[2]=r[y].toJ().mixedAdd(r[g].neg())):0===r[y].y.cmp(r[g].y.redNeg())?(m[1]=r[y].toJ().mixedAdd(r[g]),m[2]=r[y].add(r[g].neg())):(m[1]=r[y].toJ().mixedAdd(r[g]),m[2]=r[y].toJ().mixedAdd(r[g].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],v=a(n[y],n[g]);l=Math.max(v[0].length,l),f[y]=new Array(l),f[g]=new Array(l);for(var _=0;_=0;h--){for(var A=0;h>=0;){for(var x=!0,_=0;_=0&&A++,E=E.dblp(A),h<0)break;for(var _=0;_0?d=c[_][C-1>>1]:C<0&&(d=c[_][-C-1>>1].neg()),E="affine"===d.type?E.mixedAdd(d):E.add(d))}}for(var h=0;h=Math.ceil((t.bitLength()+1)/r.step)},f.prototype._getDoubles=function e(t,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,o=0;o=0&&(p=f,y=l),h.negative&&(h=h.neg(),d=d.neg()),p.negative&&(p=p.neg(),y=y.neg()),[{a:h,b:d},{a:p,b:y}]},c.prototype._endoSplit=function e(t){var r=this.endo.basis,n=r[0],i=r[1],o=i.b.mul(t).divRound(this.n),s=n.b.neg().mul(t).divRound(this.n),a=o.mul(n.a),u=s.mul(i.a),c=o.mul(n.b),f=s.mul(i.b),l=t.sub(a).sub(u),h=c.add(f).neg();return{k1:l,k2:h}},c.prototype.pointFromX=function e(t,r){t=new o(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(0!==i.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(t,i)},c.prototype.validate=function e(t){if(t.inf)return!0;var r=t.x,n=t.y,i=this.a.redMul(r),o=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return 0===n.redSqr().redISub(o).cmpn(0)},c.prototype._endoWnafMulAdd=function e(t,r,n){for(var i=this._endoWnafT1,o=this._endoWnafT2,s=0;s":""},f.prototype.isInfinity=function e(){return this.inf},f.prototype.add=function e(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var r=this.y.redSub(t.y);0!==r.cmpn(0)&&(r=r.redMul(this.x.redSub(t.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(t.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},f.prototype.dbl=function e(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=t.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),s=o.redSqr().redISub(this.x.redAdd(this.x)),a=o.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,a)},f.prototype.getX=function e(){return this.x.fromRed()},f.prototype.getY=function e(){return this.y.fromRed()},f.prototype.mul=function e(t){return t=new o(t,16),this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function e(t,r,n){var i=[this,r],o=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o):this.curve._wnafMulAdd(1,i,o,2)},f.prototype.jmulAdd=function e(t,r,n){var i=[this,r],o=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o,!0):this.curve._wnafMulAdd(1,i,o,2,!0)},f.prototype.eq=function e(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},f.prototype.neg=function e(t){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,i=function(e){return e.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},f.prototype.toJ=function e(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t},s(l,a.BasePoint),c.prototype.jpoint=function e(t,r,n){return new l(this,t,r,n)},l.prototype.toP=function e(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),r=t.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(t);return this.curve.point(n,i)},l.prototype.neg=function e(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function e(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var r=t.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),o=t.x.redMul(n),s=this.y.redMul(r.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),u=i.redSub(o),c=s.redSub(a);if(0===u.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=u.redSqr(),l=f.redMul(u),h=i.redMul(f),d=c.redSqr().redIAdd(l).redISub(h).redISub(h),p=c.redMul(h.redISub(d)).redISub(s.redMul(l)),y=this.z.redMul(t.z).redMul(u);return this.curve.jpoint(d,p,y)},l.prototype.mixedAdd=function e(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=t.x.redMul(r),o=this.y,s=t.y.redMul(r).redMul(this.z),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),f=c.redMul(a),l=n.redMul(c),h=u.redSqr().redIAdd(f).redISub(l).redISub(l),d=u.redMul(l.redISub(h)).redISub(o.redMul(f)),p=this.z.redMul(a);return this.curve.jpoint(h,d,p)},l.prototype.dblp=function e(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var r=this,n=0;n=0)return!1;if(n.redIAdd(o),0===this.x.cmp(n))return!0}},l.prototype.inspect=function e(){return this.isInfinity()?"":""},l.prototype.isInfinity=function e(){return 0===this.z.cmpn(0)}},function(e,t,r){"use strict";var n=r(222),i=r(31),o=r(1),s=n.base,a=r(57),u=a.utils;function c(e){s.call(this,"mont",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function f(e,t,r){s.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(t,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(c,s),e.exports=c,c.prototype.validate=function e(t){var r=t.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),o=i.redSqrt();return 0===o.redSqr().cmp(i)},o(f,s.BasePoint),c.prototype.decodePoint=function e(t,r){return this.point(u.toArray(t,r),1)},c.prototype.point=function e(t,r){return new f(this,t,r)},c.prototype.pointFromJSON=function e(t){return f.fromJSON(this,t)},f.prototype.precompute=function e(){},f.prototype._encode=function e(){return this.getX().toArray("be",this.curve.p.byteLength())},f.fromJSON=function e(t,r){return new f(t,r[0],r[1]||t.one)},f.prototype.inspect=function e(){return this.isInfinity()?"":""},f.prototype.isInfinity=function e(){return 0===this.z.cmpn(0)},f.prototype.dbl=function e(){var t=this.x.redAdd(this.z),r=t.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),o=r.redSub(i),s=r.redMul(i),a=o.redMul(i.redAdd(this.curve.a24.redMul(o)));return this.curve.point(s,a)},f.prototype.add=function e(){throw new Error("Not supported on Montgomery curve")},f.prototype.diffAdd=function e(t,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),o=t.x.redAdd(t.z),s=t.x.redSub(t.z),a=s.redMul(n),u=o.redMul(i),c=r.z.redMul(a.redAdd(u).redSqr()),f=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(c,f)},f.prototype.mul=function e(t){for(var r=t.clone(),n=this,i=this.curve.point(null,null),o=this,s=[];0!==r.cmpn(0);r.iushrn(1))s.push(r.andln(1));for(var a=s.length-1;a>=0;a--)0===s[a]?(n=n.diffAdd(i,o),i=i.dbl()):(i=n.diffAdd(i,o),n=n.dbl());return i},f.prototype.mulAdd=function e(){throw new Error("Not supported on Montgomery curve")},f.prototype.jumlAdd=function e(){throw new Error("Not supported on Montgomery curve")},f.prototype.eq=function e(t){return 0===this.getX().cmp(t.getX())},f.prototype.normalize=function e(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},f.prototype.getX=function e(){return this.normalize(),this.x.fromRed()}},function(e,t,r){"use strict";var n=r(222),i=r(57),o=r(31),s=r(1),a=n.base,u=i.utils.assert;function c(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,a.call(this,"edwards",e),this.a=new o(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new o(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new o(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),u(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function f(e,t,r,n,i){a.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new o(t,16),this.y=new o(r,16),this.z=n?new o(n,16):this.curve.one,this.t=i&&new o(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}s(c,a),e.exports=c,c.prototype._mulA=function e(t){return this.mOneA?t.redNeg():this.a.redMul(t)},c.prototype._mulC=function e(t){return this.oneC?t:this.c.redMul(t)},c.prototype.jpoint=function e(t,r,n,i){return this.point(t,r,n,i)},c.prototype.pointFromX=function e(t,r){t=new o(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),a=i.redMul(s.redInvm()),u=a.redSqrt();if(0!==u.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");var c=u.fromRed().isOdd();return(r&&!c||!r&&c)&&(u=u.redNeg()),this.point(t,u)},c.prototype.pointFromY=function e(t,r){t=new o(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),a=i.redMul(s.redInvm());if(0===a.cmp(this.zero)){if(r)throw new Error("invalid point");return this.point(this.zero,t)}var u=a.redSqrt();if(0!==u.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");return u.fromRed().isOdd()!==r&&(u=u.redNeg()),this.point(u,t)},c.prototype.validate=function e(t){if(t.isInfinity())return!0;t.normalize();var r=t.x.redSqr(),n=t.y.redSqr(),i=r.redMul(this.a).redAdd(n),o=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return 0===i.cmp(o)},s(f,a.BasePoint),c.prototype.pointFromJSON=function e(t){return f.fromJSON(this,t)},c.prototype.point=function e(t,r,n,i){return new f(this,t,r,n,i)},f.fromJSON=function e(t,r){return new f(t,r[0],r[1],r[2])},f.prototype.inspect=function e(){return this.isInfinity()?"":""},f.prototype.isInfinity=function e(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},f.prototype._extDbl=function e(){var t=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(t),o=this.x.redAdd(this.y).redSqr().redISub(t).redISub(r),s=i.redAdd(r),a=s.redSub(n),u=i.redSub(r),c=o.redMul(a),f=s.redMul(u),l=o.redMul(u),h=a.redMul(s);return this.curve.point(c,f,h,l)},f.prototype._projDbl=function e(){var t=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,o,s;if(this.curve.twisted){var a=this.curve._mulA(r),u=a.redAdd(n);if(this.zOne)i=t.redSub(r).redSub(n).redMul(u.redSub(this.curve.two)),o=u.redMul(a.redSub(n)),s=u.redSqr().redSub(u).redSub(u);else{var c=this.z.redSqr(),f=u.redSub(c).redISub(c);i=t.redSub(r).redISub(n).redMul(f),o=u.redMul(a.redSub(n)),s=u.redMul(f)}}else{var a=r.redAdd(n),c=this.curve._mulC(this.z).redSqr(),f=a.redSub(c).redSub(c);i=this.curve._mulC(t.redISub(a)).redMul(f),o=this.curve._mulC(a).redMul(r.redISub(n)),s=a.redMul(f)}return this.curve.point(i,o,s)},f.prototype.dbl=function e(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},f.prototype._extAdd=function e(t){var r=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),o=this.z.redMul(t.z.redAdd(t.z)),s=n.redSub(r),a=o.redSub(i),u=o.redAdd(i),c=n.redAdd(r),f=s.redMul(a),l=u.redMul(c),h=s.redMul(c),d=a.redMul(u);return this.curve.point(f,l,d,h)},f.prototype._projAdd=function e(t){var r=this.z.redMul(t.z),n=r.redSqr(),i=this.x.redMul(t.x),o=this.y.redMul(t.y),s=this.curve.d.redMul(i).redMul(o),a=n.redSub(s),u=n.redAdd(s),c=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(i).redISub(o),f=r.redMul(a).redMul(c),l,h;return this.curve.twisted?(l=r.redMul(u).redMul(o.redSub(this.curve._mulA(i))),h=a.redMul(u)):(l=r.redMul(u).redMul(o.redSub(i)),h=this.curve._mulC(a).redMul(u)),this.curve.point(f,l,h)},f.prototype.add=function e(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},f.prototype.mul=function e(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function e(t,r,n){return this.curve._wnafMulAdd(1,[this,r],[t,n],2,!1)},f.prototype.jmulAdd=function e(t,r,n){return this.curve._wnafMulAdd(1,[this,r],[t,n],2,!0)},f.prototype.normalize=function e(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},f.prototype.neg=function e(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},f.prototype.getX=function e(){return this.normalize(),this.x.fromRed()},f.prototype.getY=function e(){return this.normalize(),this.y.fromRed()},f.prototype.eq=function e(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},f.prototype.eqXToP=function e(t){var r=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(r))return!0;for(var n=t.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},f.prototype.toP=f.prototype.normalize,f.prototype.mixedAdd=f.prototype.add},function(e,t,r){"use strict";var n=t,i=r(292),o=r(57),s=o.utils.assert,a;function u(e){"short"===e.type?this.curve=new o.curve.short(e):"edwards"===e.type?this.curve=new o.curve.edwards(e):this.curve=new o.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new u(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=u,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:i.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:i.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:i.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:i.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:i.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{a=r(886)}catch(e){a=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:i.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})},function(e,t,r){"use strict";t.sha1=r(881),t.sha224=r(882),t.sha256=r(457),t.sha384=r(883),t.sha512=r(458)},function(e,t,r){"use strict";var n=r(73),i=r(164),o=r(456),s=n.rotl32,a=n.sum32,u=n.sum32_5,c=o.ft_1,f=i.BlockHash,l=[1518500249,1859775393,2400959708,3395469782];function h(){if(!(this instanceof h))return new h;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(h,f),e.exports=h,h.blockSize=512,h.outSize=160,h.hmacStrength=80,h.padLength=64,h.prototype._update=function e(t,r){for(var n=this.W,i=0;i<16;i++)n[i]=t[r+i];for(;ithis.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var r=t.length;r0))return u.iaddn(1),this.keyFromPrivate(u)}},f.prototype._truncateToN=function e(t,r){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!r&&t.cmp(this.n)>=0?t.sub(this.n):t},f.prototype.sign=function e(t,r,o,s){"object"==typeof o&&(s=o,o=null),s||(s={}),r=this.keyFromPrivate(r,o),t=this._truncateToN(new n(t,16));for(var a=this.n.byteLength(),u=r.getPrivate().toArray("be",a),f=t.toArray("be",a),l=new i({hash:this.hash,entropy:u,nonce:f,pers:s.pers,persEnc:s.persEnc||"utf8"}),h=this.n.sub(new n(1)),d=0;;d++){var p=s.k?s.k(d):new n(l.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(h)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var g=y.getX(),m=g.umod(this.n);if(0!==m.cmpn(0)){var b=p.invm(this.n).mul(m.mul(r.getPrivate()).iadd(t));if(b=b.umod(this.n),0!==b.cmpn(0)){var v=(y.getY().isOdd()?1:0)|(0!==g.cmp(m)?2:0);return s.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),v^=1),new c({r:m,s:b,recoveryParam:v})}}}}}},f.prototype.verify=function e(t,r,i,o){t=this._truncateToN(new n(t,16)),i=this.keyFromPublic(i,o),r=new c(r,"hex");var s=r.r,a=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),f=u.mul(t).umod(this.n),l=u.mul(s).umod(this.n);if(!this.curve._maxwellTrick){var h=this.g.mulAdd(f,i.getPublic(),l);return!h.isInfinity()&&0===h.getX().umod(this.n).cmp(s)}var h=this.g.jmulAdd(f,i.getPublic(),l);return!h.isInfinity()&&h.eqXToP(s)},f.prototype.recoverPubKey=function(e,t,r,i){a((3&r)===r,"The recovery param is more than two bits"),t=new c(t,i);var o=this.n,s=new n(e),u=t.r,f=t.s,l=1&r,h=r>>1;if(u.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");u=h?this.curve.pointFromX(u.add(this.curve.n),l):this.curve.pointFromX(u,l);var d=t.r.invm(o),p=o.sub(s).mul(d).umod(o),y=f.mul(d).umod(o);return this.g.mulAdd(p,u,y)},f.prototype.getKeyRecoveryParam=function(e,t,r,n){if(t=new c(t,n),null!==t.recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},function(e,t,r){"use strict";var n=r(292),i=r(455),o=r(49);function s(e){if(!(this instanceof s))return new s(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=i.toArray(e.entropy,e.entropyEnc||"hex"),r=i.toArray(e.nonce,e.nonceEnc||"hex"),n=i.toArray(e.pers,e.persEnc||"hex");o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}e.exports=s,s.prototype._init=function e(t,r,n){var i=t.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},s.prototype.generate=function e(t,r,n,o){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof r&&(o=n,n=r,r=null),n&&(n=i.toArray(n,o||"hex"),this._update(n));for(var s=[];s.length"}},function(e,t,r){"use strict";var n=r(31),i=r(57),o=i.utils,s=o.assert;function a(e,t){if(e instanceof a)return e;this._importDER(e,t)||(s(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function u(){this.place=0}function c(e,t){var r=e[t.place++];if(!(128&r))return r;for(var n=15&r,i=0,o=0,s=t.place;o>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}e.exports=a,a.prototype._importDER=function e(t,r){t=o.toArray(t,r);var i=new u;if(48!==t[i.place++])return!1;var s=c(t,i);if(s+i.place!==t.length)return!1;if(2!==t[i.place++])return!1;var a=c(t,i),f=t.slice(i.place,a+i.place);if(i.place+=a,2!==t[i.place++])return!1;var l=c(t,i);if(t.length!==l+i.place)return!1;var h=t.slice(i.place,l+i.place);return 0===f[0]&&128&f[1]&&(f=f.slice(1)),0===h[0]&&128&h[1]&&(h=h.slice(1)),this.r=new n(f),this.s=new n(h),this.recoveryParam=null,!0},a.prototype.toDER=function e(t){var r=this.r.toArray(),n=this.s.toArray();for(128&r[0]&&(r=[0].concat(r)),128&n[0]&&(n=[0].concat(n)),r=f(r),n=f(n);!(n[0]||128&n[1]);)n=n.slice(1);var i=[2];l(i,r.length),i=i.concat(r),i.push(2),l(i,n.length);var s=i.concat(n),a=[48];return l(a,s.length),a=a.concat(s),o.encode(a,t)}},function(e,t,r){"use strict";var n=r(292),i=r(57),o=i.utils,s=o.assert,a=o.parseBytes,u=r(892),c=r(893);function f(e){if(s("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof f))return new f(e);var e=i.curves[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}e.exports=f,f.prototype.sign=function e(t,r){t=a(t);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),t),o=this.g.mul(i),s=this.encodePoint(o),u=this.hashInt(s,n.pubBytes(),t).mul(n.priv()),c=i.add(u).umod(this.curve.n);return this.makeSignature({R:o,S:c,Rencoded:s})},f.prototype.verify=function e(t,r,n){t=a(t),r=this.makeSignature(r);var i=this.keyFromPublic(n),o=this.hashInt(r.Rencoded(),i.pubBytes(),t),s=this.g.mul(r.S()),u=r.R().add(i.pub().mul(o));return u.eq(s)},f.prototype.hashInt=function e(){for(var t=this.hash(),r=0;ra?t=e(t):t.length>>27}function f(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]=t[u-3]^t[u-8]^t[u-14]^t[u-16];for(var h=0;h<80;++h){var d=~~(h/20),p=c(r)+l(d,n,i,o)+a+t[h]+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(130),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 l(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]=c(t[u-3]^t[u-8]^t[u-14]^t[u-16]);for(var d=0;d<80;++d){var p=~~(d/20),y=f(r)+h(p,n,i,o)+a+t[d]+s[p]|0;a=o,o=i,i=l(n),n=r,r=y}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(462),o=r(130),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(463),o=r(130),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){var n=r(29);function i(e){return ee.length)return null;i=e.readUInt8(t+1),o=2}else if(r===n.OP_PUSHDATA2){if(t+3>e.length)return null;i=e.readUInt16LE(t+1),o=3}else{if(t+5>e.length)return null;if(r!==n.OP_PUSHDATA4)throw new Error("Unexpected opcode");i=e.readUInt32LE(t+1),o=5}return{opcode:r,number:i,size:o}}e.exports={encodingLength:i,encode:o,decode:s}},function(e,t,r){(function(t){var n=r(295),i=r(464);function o(e){return t.isBuffer(e)}function s(e){return"string"==typeof e&&/^([0-9a-f]{2})+$/i.test(e)}function a(e,t){var r=e.toJSON();function n(n){if(!e(n))return!1;if(n.length===t)return!0;throw i.tfCustomError(r+"(Length: "+t+")",r+"(Length: "+n.length+")")}return n.toJSON=function(){return r},n}var u=a.bind(null,n.Array),c=a.bind(null,o),f=a.bind(null,s),l=a.bind(null,n.String);function h(e,t,r){function i(n,i){return r(n,i)&&n>e&&n>24===e}function g(e){return e<<16>>16===e}function m(e){return(0|e)===e}function b(e){return"number"==typeof e&&e>=-d&&e<=d&&Math.floor(e)===e}function v(e){return(255&e)===e}function _(e){return(65535&e)===e}function w(e){return e>>>0===e}function S(e){return"number"==typeof e&&e>=0&&e<=d&&Math.floor(e)===e}var E={ArrayN:u,Buffer:o,BufferN:c,Finite:p,Hex:s,HexN:f,Int8:y,Int16:g,Int32:m,Int53:b,Range:h,StringN:l,UInt8:v,UInt16:_,UInt32:w,UInt53:S};for(var k in E)E[k].toJSON=function(e){return e}.bind(null,k);e.exports=E}).call(this,r(0).Buffer)},function(e,t,r){var n=r(29),i={};for(var o in n){var s=n[o];i[s]=o}e.exports=i},function(e,t,r){const n=r(291),i=r(4).Buffer,o=r(35),s=r(74),a=i.alloc(1,0);function u(e){let t=0;for(;0===e[t];)++t;return t===e.length?a:(e=e.slice(t),128&e[0]?i.concat([a,e],1+e.length):e)}function c(e){0===e[0]&&(e=e.slice(1));const t=i.alloc(32,0),r=Math.max(0,32-e.length);return e.copy(t,r),t}function f(e){const t=e.readUInt8(e.length-1),r=-129&t;if(r<=0||r>=4)throw new Error("Invalid hashType "+t);const o=n.decode(e.slice(0,-1)),s=c(o.r),a=c(o.s);return{signature:i.concat([s,a],64),hashType:t}}function l(e,t){o({signature:s.BufferN(64),hashType:s.UInt8},{signature:e,hashType:t});const r=-129&t;if(r<=0||r>=4)throw new Error("Invalid hashType "+t);const a=i.allocUnsafe(1);a.writeUInt8(t,0);const c=u(e.slice(0,32)),f=u(e.slice(32,64));return i.concat([n.encode(c,f),a])}e.exports={decode:f,encode:l}},function(e,t,r){const n=r(4).Buffer,i=r(94),o=r(906),s=r(35),a=r(74),u=r(466),c=r(296);function f(){this.version=1,this.prevHash=null,this.merkleRoot=null,this.timestamp=0,this.bits=0,this.nonce=0}f.fromBuffer=function(e){if(e.length<80)throw new Error("Buffer too small (< 80 bytes)");let t=0;function r(r){return t+=r,e.slice(t-r,t)}function n(){const r=e.readUInt32LE(t);return t+=4,r}function i(){const r=e.readInt32LE(t);return t+=4,r}const o=new f;if(o.version=i(),o.prevHash=r(32),o.merkleRoot=r(32),o.timestamp=n(),o.bits=n(),o.nonce=n(),80===e.length)return o;function s(){const r=u.decode(e,t);return t+=u.decode.bytes,r}function a(){const r=c.fromBuffer(e.slice(t),!0);return t+=r.byteLength(),r}const l=s();o.transactions=[];for(var h=0;h>24)-3,r=8388607&e,i=n.alloc(32,0);return i.writeUInt32BE(r,28-t),i},f.calculateMerkleRoot=function(e){if(s([{getHash:a.Function}],e),0===e.length)throw TypeError("Cannot compute merkle root for zero transactions");const t=e.map(function(e){return e.getHash()});return o(t,i.hash256)},f.prototype.checkMerkleRoot=function(){if(!this.transactions)return!1;const e=f.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(e)},f.prototype.checkProofOfWork=function(){const e=this.getHash().reverse(),t=f.calculateTarget(this.bits);return e.compare(t)<=0},e.exports=f},function(e,t,r){(function(t){e.exports=function e(r,n){if(!Array.isArray(r))throw TypeError("Expected values Array");if("function"!=typeof n)throw TypeError("Expected digest Function");for(var i=r.length,o=r.concat();i>1;){for(var s=0,a=0;at)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}function n(e,t){const n=e.readUInt32LE(t);let i=e.readUInt32LE(t+4);return i*=4294967296,r(i+n,9007199254740991),i+n}function i(e,t,n){return r(t,9007199254740991),e.writeInt32LE(-1&t,n),e.writeUInt32LE(Math.floor(t/4294967296),n+4),n+8}e.exports={readUInt64LE:n,writeUInt64LE:i}},function(e,t,r){"use strict";var n=r(14),i=r(4).Buffer;e.exports=function(e){function t(t){var r=e(t);return n.encode(i.concat([t,r],t.length+4))}function r(t){var r=t.slice(0,-4),n=t.slice(-4),i=e(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}function o(e){var t=n.decodeUnsafe(e);if(t)return r(t)}function s(t){var i=n.decode(t),o=r(i,e);if(!o)throw new Error("Invalid checksum");return o}return{encode:t,decode:s,decodeUnsafe:o}}},function(e,t,r){const n=r(4).Buffer,i=r(469),o=r(94),s=r(23),a=r(64),u=r(29),c=r(298),f=r(35),l=r(74),h=r(917),d=h.types,p=r(467),y=r(296);function g(e,t,r,n){if(0===e.length&&0===t.length)return{};if(!r){let n=h.input(e,!0),i=h.witness(t,!0);n===d.NONSTANDARD&&(n=void 0),i===d.NONSTANDARD&&(i=void 0),r=n||i}switch(r){case d.P2WPKH:{const{output:e,pubkey:r,signature:n}=c.p2wpkh({witness:t});return{prevOutScript:e,prevOutType:d.P2WPKH,pubkeys:[r],signatures:[n]}}case d.P2PKH:{const{output:t,pubkey:r,signature:n}=c.p2pkh({input:e});return{prevOutScript:t,prevOutType:d.P2PKH,pubkeys:[r],signatures:[n]}}case d.P2PK:{const{signature:t}=c.p2pk({input:e});return{prevOutType:d.P2PK,pubkeys:[void 0],signatures:[t]}}case d.MULTISIG:{const{pubkeys:t,signatures:r}=c.p2ms({input:e,output:n},{allowIncomplete:!0});return{prevOutType:d.MULTISIG,pubkeys:t,signatures:r}}}if(r===d.P2SH){const{output:r,redeem:n}=c.p2sh({input:e,witness:t}),i=h.output(n.output),o=g(n.input,n.witness,i,n.output);return o.prevOutType?{prevOutScript:r,prevOutType:d.P2SH,redeemScript:n.output,redeemScriptType:o.prevOutType,witnessScript:o.witnessScript,witnessScriptType:o.witnessScriptType,pubkeys:o.pubkeys,signatures:o.signatures}:{}}if(r===d.P2WSH){const{output:r,redeem:n}=c.p2wsh({input:e,witness:t}),i=h.output(n.output);let o;return o=i===d.P2WPKH?g(n.input,n.witness,i):g(s.compile(n.witness),[],i,n.output),o.prevOutType?{prevOutScript:r,prevOutType:d.P2WSH,witnessScript:n.output,witnessScriptType:o.prevOutType,pubkeys:o.pubkeys,signatures:o.signatures}:{}}return{prevOutType:d.NONSTANDARD,prevOutScript:e}}function m(e,t,r){if(e.redeemScriptType!==d.MULTISIG||!e.redeemScript)return;if(e.pubkeys.length===e.signatures.length)return;const n=e.signatures.concat();e.signatures=e.pubkeys.map(function(i){const o=p.fromPublicKey(i);let a;return n.some(function(i,u){if(!i)return!1;const c=s.signature.decode(i),f=t.hashForSignature(r,e.redeemScript,c.hashType);return!!o.verify(f,c.signature)&&(n[u]=void 0,a=i,!0)}),a})}function b(e,t){f(l.Buffer,e);const r=h.output(e);switch(r){case d.P2PKH:{if(!t)return{type:r};const n=c.p2pkh({output:e}).hash,i=o.hash160(t);return n.equals(i)?{type:r,pubkeys:[t],signatures:[void 0]}:{type:r}}case d.P2WPKH:{if(!t)return{type:r};const n=c.p2wpkh({output:e}).hash,i=o.hash160(t);return n.equals(i)?{type:r,pubkeys:[t],signatures:[void 0]}:{type:r}}case d.P2PK:{const t=c.p2pk({output:e});return{type:r,pubkeys:[t.pubkey],signatures:[void 0]}}case d.MULTISIG:{const t=c.p2ms({output:e});return{type:r,pubkeys:t.pubkeys,signatures:t.pubkeys.map(()=>void 0)}}}return{type:r}}function v(e,t,r,n,i){if(r&&i){const n=c.p2wsh({redeem:{output:i}}),o=c.p2wsh({output:r}),a=c.p2sh({redeem:{output:r}}),u=c.p2sh({redeem:n});if(!n.hash.equals(o.hash))throw new Error("Witness script inconsistent with prevOutScript");if(!a.hash.equals(u.hash))throw new Error("Redeem script inconsistent with prevOutScript");const f=b(n.redeem.output,t);if(!f.pubkeys)throw new Error(f.type+" not supported as witnessScript ("+s.toASM(i)+")");e.signatures&&e.signatures.some(e=>e)&&(f.signatures=e.signatures);let l=i;if(f.type===d.P2WPKH)throw new Error("P2SH(P2WSH(P2WPKH)) is a consensus failure");return{redeemScript:r,redeemScriptType:d.P2WSH,witnessScript:i,witnessScriptType:f.type,prevOutType:d.P2SH,prevOutScript:a.output,hasWitness:!0,signScript:l,signType:f.type,pubkeys:f.pubkeys,signatures:f.signatures}}if(r){const n=c.p2sh({redeem:{output:r}});if(e.prevOutScript){let t;try{t=c.p2sh({output:e.prevOutScript})}catch(e){throw new Error("PrevOutScript must be P2SH")}if(!n.hash.equals(t.hash))throw new Error("Redeem script inconsistent with prevOutScript")}const i=b(n.redeem.output,t);if(!i.pubkeys)throw new Error(i.type+" not supported as redeemScript ("+s.toASM(r)+")");e.signatures&&e.signatures.some(e=>e)&&(i.signatures=e.signatures);let o=r;return i.type===d.P2WPKH&&(o=c.p2pkh({pubkey:i.pubkeys[0]}).output),{redeemScript:r,redeemScriptType:i.type,prevOutType:d.P2SH,prevOutScript:n.output,hasWitness:i.type===d.P2WPKH,signScript:o,signType:i.type,pubkeys:i.pubkeys,signatures:i.signatures}}if(i){const r=c.p2wsh({redeem:{output:i}});if(e.prevOutScript){const t=c.p2wsh({output:e.prevOutScript});if(!r.hash.equals(t.hash))throw new Error("Witness script inconsistent with prevOutScript")}const n=b(r.redeem.output,t);if(!n.pubkeys)throw new Error(n.type+" not supported as witnessScript ("+s.toASM(i)+")");e.signatures&&e.signatures.some(e=>e)&&(n.signatures=e.signatures);let o=i;if(n.type===d.P2WPKH)throw new Error("P2WSH(P2WPKH) is a consensus failure");return{witnessScript:i,witnessScriptType:n.type,prevOutType:d.P2WSH,prevOutScript:r.output,hasWitness:!0,signScript:o,signType:n.type,pubkeys:n.pubkeys,signatures:n.signatures}}if(e.prevOutType&&e.prevOutScript){if(e.prevOutType===d.P2SH)throw new Error("PrevOutScript is "+e.prevOutType+", requires redeemScript");if(e.prevOutType===d.P2WSH)throw new Error("PrevOutScript is "+e.prevOutType+", requires witnessScript");if(!e.prevOutScript)throw new Error("PrevOutScript is missing");const r=b(e.prevOutScript,t);if(!r.pubkeys)throw new Error(r.type+" not supported ("+s.toASM(e.prevOutScript)+")");e.signatures&&e.signatures.some(e=>e)&&(r.signatures=e.signatures);let n=e.prevOutScript;return r.type===d.P2WPKH&&(n=c.p2pkh({pubkey:r.pubkeys[0]}).output),{prevOutType:r.type,prevOutScript:e.prevOutScript,hasWitness:r.type===d.P2WPKH,signScript:n,signType:r.type,pubkeys:r.pubkeys,signatures:r.signatures}}const o=c.p2pkh({pubkey:t}).output;return{prevOutType:d.P2PKH,prevOutScript:o,hasWitness:!1,signScript:o,signType:d.P2PKH,pubkeys:[t],signatures:[void 0]}}function _(e,t,r){const n=t.pubkeys||[];let i=t.signatures||[];switch(e){case d.P2PKH:if(0===n.length)break;if(0===i.length)break;return c.p2pkh({pubkey:n[0],signature:i[0]});case d.P2WPKH:if(0===n.length)break;if(0===i.length)break;return c.p2wpkh({pubkey:n[0],signature:i[0]});case d.P2PK:if(0===n.length)break;if(0===i.length)break;return c.p2pk({signature:i[0]});case d.MULTISIG:return i=r?i.map(e=>e||u.OP_0):i.filter(e=>e),c.p2ms({signatures:i},{allowIncomplete:r});case d.P2SH:{const e=_(t.redeemScriptType,t,r);if(!e)return;return c.p2sh({redeem:{output:e.output||t.redeemScript,input:e.input,witness:e.witness}})}case d.P2WSH:{const e=_(t.witnessScriptType,t,r);if(!e)return;return c.p2wsh({redeem:{output:t.witnessScript,input:e.input,witness:e.witness}})}}}function w(e,t){this.__prevTxSet={},this.network=e||a.bitcoin,this.maximumFeeRate=t||2500,this.__inputs=[],this.__tx=new y,this.__tx.version=2}function S(e){return void 0!==e.signScript&&void 0!==e.signType&&void 0!==e.pubkeys&&void 0!==e.signatures&&e.signatures.length===e.pubkeys.length&&e.pubkeys.length>0&&(!1===e.hasWitness||void 0!==e.value)}function E(e){return e.readUInt8(e.length-1)}w.prototype.setLockTime=function(e){if(f(l.UInt32,e),this.__inputs.some(function(e){return!!e.signatures&&e.signatures.some(function(e){return e})}))throw new Error("No, this would invalidate signatures");this.__tx.locktime=e},w.prototype.setVersion=function(e){f(l.UInt32,e),this.__tx.version=e},w.fromTransaction=function(e,t){const r=new w(t);return r.setVersion(e.version),r.setLockTime(e.locktime),e.outs.forEach(function(e){r.addOutput(e.script,e.value)}),e.ins.forEach(function(e){r.__addInputUnsafe(e.hash,e.index,{sequence:e.sequence,script:e.script,witness:e.witness})}),r.__inputs.forEach(function(t,r){m(t,e,r)}),r},w.prototype.addInput=function(e,t,r,i){if(!this.__canModifyInputs())throw new Error("No, this would invalidate signatures");let o;if("string"==typeof e)e=n.from(e,"hex").reverse();else if(e instanceof y){const r=e.outs[t];i=r.script,o=r.value,e=e.getHash()}return this.__addInputUnsafe(e,t,{sequence:r,prevOutScript:i,value:o})},w.prototype.__addInputUnsafe=function(e,t,r){if(y.isCoinbaseHash(e))throw new Error("coinbase inputs not supported");const n=e.toString("hex")+":"+t;if(void 0!==this.__prevTxSet[n])throw new Error("Duplicate TxOut: "+n);let i={};if(void 0!==r.script&&(i=g(r.script,r.witness||[])),void 0!==r.value&&(i.value=r.value),!i.prevOutScript&&r.prevOutScript){let e;if(!i.pubkeys&&!i.signatures){const t=b(r.prevOutScript);t.pubkeys&&(i.pubkeys=t.pubkeys,i.signatures=t.signatures),e=t.type}i.prevOutScript=r.prevOutScript,i.prevOutType=e||h.output(r.prevOutScript)}const o=this.__tx.addInput(e,t,r.sequence,r.scriptSig);return this.__inputs[o]=i,this.__prevTxSet[n]=!0,o},w.prototype.addOutput=function(e,t){if(!this.__canModifyOutputs())throw new Error("No, this would invalidate signatures");return"string"==typeof e&&(e=i.toOutputScript(e,this.network)),this.__tx.addOutput(e,t)},w.prototype.build=function(){return this.__build(!1)},w.prototype.buildIncomplete=function(){return this.__build(!0)},w.prototype.__build=function(e){if(!e){if(!this.__tx.ins.length)throw new Error("Transaction has no inputs");if(!this.__tx.outs.length)throw new Error("Transaction has no outputs")}const t=this.__tx.clone();if(this.__inputs.forEach(function(r,n){if(!r.prevOutType&&!e)throw new Error("Transaction is not complete");const i=_(r.prevOutType,r,e);if(i)t.setInputScript(n,i.input),t.setWitness(n,i.witness);else{if(!e&&r.prevOutType===d.NONSTANDARD)throw new Error("Unknown input type");if(!e)throw new Error("Not enough information")}}),!e&&this.__overMaximumFees(t.virtualSize()))throw new Error("Transaction has absurd fees");return t},w.prototype.sign=function(e,t,r,n,i,o){if(t.network&&t.network!==this.network)throw new TypeError("Inconsistent network");if(!this.__inputs[e])throw new Error("No input at index: "+e);n=n||y.SIGHASH_ALL;const a=this.__inputs[e];if(void 0!==a.redeemScript&&r&&!a.redeemScript.equals(r))throw new Error("Inconsistent redeemScript");const u=t.publicKey||t.getPublicKey();if(!S(a)){if(void 0!==i){if(void 0!==a.value&&a.value!==i)throw new Error("Input didn't match witnessValue");f(l.Satoshi,i),a.value=i}if(!S(a)){const e=v(a,u,r,i,o);Object.assign(a,e)}if(!S(a))throw Error(a.prevOutType+" not supported")}let c;c=a.hasWitness?this.__tx.hashForWitnessV0(e,a.signScript,a.value,n):this.__tx.hashForSignature(e,a.signScript,n);const h=a.pubkeys.some(function(e,r){if(!u.equals(e))return!1;if(a.signatures[r])throw new Error("Signature already exists");if(33!==u.length&&a.hasWitness)throw new Error("BIP143 rejects uncompressed public keys in P2WPKH or P2WSH");const i=t.sign(c);return a.signatures[r]=s.signature.encode(i,n),!0});if(!h)throw new Error("Key pair cannot sign for this input")},w.prototype.__canModifyInputs=function(){return this.__inputs.every(function(e){return void 0===e.signatures||e.signatures.every(function(e){if(!e)return!0;const t=E(e);return t&y.SIGHASH_ANYONECANPAY})})},w.prototype.__canModifyOutputs=function(){const e=this.__tx.ins.length,t=this.__tx.outs.length;return this.__inputs.every(function(r){return void 0===r.signatures||r.signatures.every(function(r){if(!r)return!0;const n=E(r),i=31&n;return i===y.SIGHASH_NONE||(i===y.SIGHASH_SINGLE?e<=t:void 0)})})},w.prototype.__overMaximumFees=function(e){const t=this.__inputs.reduce(function(e,t){return e+(t.value>>>0)},0),r=this.__tx.outs.reduce(function(e,t){return e+t.value},0),n=t-r,i=n/e;return i>this.maximumFeeRate},e.exports=w},function(e,t,r){const n=r(114),i=r(35),o=r(29),s=r(23),a=r(64).bitcoin;function u(e,t){return e.length===t.length&&e.every(function(e,r){return e.equals(t[r])})}function c(e,t){if(!e.data&&!e.output)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),i({network:i.maybe(i.Object),output:i.maybe(i.Buffer),data:i.maybe(i.arrayOf(i.Buffer))},e);const r=e.network||a,c={network:r};if(n.prop(c,"output",function(){if(e.data)return s.compile([o.OP_RETURN].concat(e.data))}),n.prop(c,"data",function(){if(e.output)return s.decompile(e.output).slice(1)}),t.validate&&e.output){const t=s.decompile(e.output);if(t[0]!==o.OP_RETURN)throw new TypeError("Output is invalid");if(!t.slice(1).every(i.Buffer))throw new TypeError("Output is invalid");if(e.data&&!u(e.data,c.data))throw new TypeError("Data mismatch")}return Object.assign(c,e)}e.exports=c},function(e,t,r){const n=r(114),i=r(35),o=r(29),s=r(112),a=r(23),u=r(64).bitcoin,c=o.OP_RESERVED;function f(e,t){return e.length===t.length&&e.every(function(e,r){return e.equals(t[r])})}function l(e,t){if(!(e.input||e.output||e.pubkeys&&void 0!==e.m||e.signatures))throw new TypeError("Not enough data");function r(e){return a.isCanonicalScriptSignature(e)||t.allowIncomplete&&e===o.OP_0}t=Object.assign({validate:!0},t||{}),i({network:i.maybe(i.Object),m:i.maybe(i.Number),n:i.maybe(i.Number),output:i.maybe(i.Buffer),pubkeys:i.maybe(i.arrayOf(s.isPoint)),signatures:i.maybe(i.arrayOf(r)),input:i.maybe(i.Buffer)},e);const l=e.network||u,h={network:l};let d,p=!1;function y(e){p||(p=!0,d=a.decompile(e),h.m=d[0]-c,h.n=d[d.length-2]-c,h.pubkeys=d.slice(1,-2))}if(n.prop(h,"output",function(){if(e.m&&h.n&&e.pubkeys)return a.compile([].concat(c+e.m,e.pubkeys,c+h.n,o.OP_CHECKMULTISIG))}),n.prop(h,"m",function(){if(h.output)return y(h.output),h.m}),n.prop(h,"n",function(){if(h.pubkeys)return h.pubkeys.length}),n.prop(h,"pubkeys",function(){if(e.output)return y(e.output),h.pubkeys}),n.prop(h,"signatures",function(){if(e.input)return a.decompile(e.input).slice(1)}),n.prop(h,"input",function(){if(e.signatures)return a.compile([o.OP_0].concat(e.signatures))}),n.prop(h,"witness",function(){if(h.input)return[]}),t.validate){if(e.output){if(y(e.output),!i.Number(d[0]))throw new TypeError("Output is invalid");if(!i.Number(d[d.length-2]))throw new TypeError("Output is invalid");if(d[d.length-1]!==o.OP_CHECKMULTISIG)throw new TypeError("Output is invalid");if(h.m<=0||h.n>16||h.m>h.n||h.n!==d.length-3)throw new TypeError("Output is invalid");if(!h.pubkeys.every(e=>s.isPoint(e)))throw new TypeError("Output is invalid");if(void 0!==e.m&&e.m!==h.m)throw new TypeError("m mismatch");if(void 0!==e.n&&e.n!==h.n)throw new TypeError("n mismatch");if(e.pubkeys&&!f(e.pubkeys,h.pubkeys))throw new TypeError("Pubkeys mismatch")}if(e.pubkeys){if(void 0!==e.n&&e.n!==e.pubkeys.length)throw new TypeError("Pubkey count mismatch");if(h.n=e.pubkeys.length,h.nh.m)throw new TypeError("Too many signatures provided")}if(e.input){if(e.input[0]!==o.OP_0)throw new TypeError("Input is invalid");if(0===h.signatures.length||!h.signatures.every(r))throw new TypeError("Input has invalid signature(s)");if(e.signatures&&!f(e.signatures.equals(h.signatures)))throw new TypeError("Signature mismatch");if(void 0!==e.m&&e.m!==e.signatures.length)throw new TypeError("Signature count mismatch")}}return Object.assign(h,e)}e.exports=l},function(e,t,r){const n=r(114),i=r(35),o=r(29),s=r(112),a=r(23),u=r(64).bitcoin;function c(e,t){if(!(e.input||e.output||e.pubkey||e.input||e.signature))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),i({network:i.maybe(i.Object),output:i.maybe(i.Buffer),pubkey:i.maybe(s.isPoint),signature:i.maybe(a.isCanonicalScriptSignature),input:i.maybe(i.Buffer)},e);const r=n.value(function(){return a.decompile(e.input)}),c=e.network||u,f={network:c};if(n.prop(f,"output",function(){if(e.pubkey)return a.compile([e.pubkey,o.OP_CHECKSIG])}),n.prop(f,"pubkey",function(){if(e.output)return e.output.slice(1,-1)}),n.prop(f,"signature",function(){if(e.input)return r()[0]}),n.prop(f,"input",function(){if(e.signature)return a.compile([e.signature])}),n.prop(f,"witness",function(){if(f.input)return[]}),t.validate){if(e.output){if(e.output[e.output.length-1]!==o.OP_CHECKSIG)throw new TypeError("Output is invalid");if(!s.isPoint(f.pubkey))throw new TypeError("Output pubkey is invalid");if(e.pubkey&&!e.pubkey.equals(f.pubkey))throw new TypeError("Pubkey mismatch")}if(e.signature&&e.input&&!e.input.equals(f.input))throw new TypeError("Signature mismatch");if(e.input){if(1!==r().length)throw new TypeError("Input is invalid");if(!a.isCanonicalScriptSignature(f.signature))throw new TypeError("Input has invalid signature")}}return Object.assign(f,e)}e.exports=c},function(e,t,r){(function(t){const n=r(114),i=r(35),o=r(29),s=r(112),a=r(94),u=r(23),c=r(64).bitcoin,f=r(165);function l(e,r){if(!(e.address||e.hash||e.output||e.pubkey||e.input))throw new TypeError("Not enough data");r=Object.assign({validate:!0},r||{}),i({network:i.maybe(i.Object),address:i.maybe(i.String),hash:i.maybe(i.BufferN(20)),output:i.maybe(i.BufferN(25)),pubkey:i.maybe(s.isPoint),signature:i.maybe(u.isCanonicalScriptSignature),input:i.maybe(i.Buffer)},e);const l=n.value(function(){const t=f.decode(e.address),r=t.readUInt8(0),n=t.slice(1);return{version:r,hash:n}}),h=n.value(function(){return u.decompile(e.input)}),d=e.network||c,p={network:d};if(n.prop(p,"address",function(){if(!p.hash)return;const e=t.allocUnsafe(21);return e.writeUInt8(d.pubKeyHash,0),p.hash.copy(e,1),f.encode(e)}),n.prop(p,"hash",function(){return e.output?e.output.slice(3,23):e.address?l().hash:e.pubkey||p.pubkey?a.hash160(e.pubkey||p.pubkey):void 0}),n.prop(p,"output",function(){if(p.hash)return u.compile([o.OP_DUP,o.OP_HASH160,p.hash,o.OP_EQUALVERIFY,o.OP_CHECKSIG])}),n.prop(p,"pubkey",function(){if(e.input)return h()[1]}),n.prop(p,"signature",function(){if(e.input)return h()[0]}),n.prop(p,"input",function(){if(e.pubkey&&e.signature)return u.compile([e.signature,e.pubkey])}),n.prop(p,"witness",function(){if(p.input)return[]}),r.validate){let t;if(e.address){if(l().version!==d.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(20!==l().hash.length)throw new TypeError("Invalid address");t=l().hash}if(e.hash){if(t&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(25!==e.output.length||e.output[0]!==o.OP_DUP||e.output[1]!==o.OP_HASH160||20!==e.output[2]||e.output[23]!==o.OP_EQUALVERIFY||e.output[24]!==o.OP_CHECKSIG)throw new TypeError("Output is invalid");const r=e.output.slice(3,23);if(t&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.pubkey){const r=a.hash160(e.pubkey);if(t&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.input){const r=h();if(2!==r.length)throw new TypeError("Input is invalid");if(!u.isCanonicalScriptSignature(r[0]))throw new TypeError("Input has invalid signature");if(!s.isPoint(r[1]))throw new TypeError("Input has invalid pubkey");if(e.signature&&!e.signature.equals(r[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(r[1]))throw new TypeError("Pubkey mismatch");const n=a.hash160(r[1]);if(t&&!t.equals(n))throw new TypeError("Hash mismatch")}}return Object.assign(p,e)}e.exports=l}).call(this,r(0).Buffer)},function(e,t,r){(function(t){const n=r(114),i=r(35),o=r(29),s=r(94),a=r(23),u=r(64).bitcoin,c=r(165);function f(e,t){return e.length===t.length&&e.every(function(e,r){return e.equals(t[r])})}function l(e,r){if(!(e.address||e.hash||e.output||e.redeem||e.input))throw new TypeError("Not enough data");r=Object.assign({validate:!0},r||{}),i({network:i.maybe(i.Object),address:i.maybe(i.String),hash:i.maybe(i.BufferN(20)),output:i.maybe(i.BufferN(23)),redeem:i.maybe({network:i.maybe(i.Object),output:i.maybe(i.Buffer),input:i.maybe(i.Buffer),witness:i.maybe(i.arrayOf(i.Buffer))}),input:i.maybe(i.Buffer),witness:i.maybe(i.arrayOf(i.Buffer))},e);const l=e.network||u,h={network:l},d=n.value(function(){const t=c.decode(e.address),r=t.readUInt8(0),n=t.slice(1);return{version:r,hash:n}}),p=n.value(function(){return a.decompile(e.input)}),y=n.value(function(){const t=p();return{network:l,output:t[t.length-1],input:a.compile(t.slice(0,-1)),witness:e.witness||[]}});if(n.prop(h,"address",function(){if(!h.hash)return;const e=t.allocUnsafe(21);return e.writeUInt8(l.scriptHash,0),h.hash.copy(e,1),c.encode(e)}),n.prop(h,"hash",function(){return e.output?e.output.slice(2,22):e.address?d().hash:h.redeem&&h.redeem.output?s.hash160(h.redeem.output):void 0}),n.prop(h,"output",function(){if(h.hash)return a.compile([o.OP_HASH160,h.hash,o.OP_EQUAL])}),n.prop(h,"redeem",function(){if(e.input)return y()}),n.prop(h,"input",function(){if(e.redeem&&e.redeem.input&&e.redeem.output)return a.compile([].concat(a.decompile(e.redeem.input),e.redeem.output))}),n.prop(h,"witness",function(){return h.redeem&&h.redeem.witness?h.redeem.witness:h.input?[]:void 0}),r.validate){let r;if(e.address){if(d().version!==l.scriptHash)throw new TypeError("Invalid version or Network mismatch");if(20!==d().hash.length)throw new TypeError("Invalid address");r=d().hash}if(e.hash){if(r&&!r.equals(e.hash))throw new TypeError("Hash mismatch");r=e.hash}if(e.output){if(23!==e.output.length||e.output[0]!==o.OP_HASH160||20!==e.output[1]||e.output[22]!==o.OP_EQUAL)throw new TypeError("Output is invalid");const t=e.output.slice(2,22);if(r&&!r.equals(t))throw new TypeError("Hash mismatch");r=t}const n=function(e){if(e.output){const t=a.decompile(e.output);if(!t||t.length<1)throw new TypeError("Redeem.output too short");const n=s.hash160(e.output);if(r&&!r.equals(n))throw new TypeError("Hash mismatch");r=n}if(e.input){const t=e.input.length>0,r=e.witness&&e.witness.length>0;if(!t&&!r)throw new TypeError("Empty input");if(t&&r)throw new TypeError("Input and witness provided");if(t){const t=a.decompile(e.input);if(!a.isPushOnly(t))throw new TypeError("Non push-only scriptSig")}}};if(e.input){const e=p();if(!e||e.length<1)throw new TypeError("Input too short");if(!t.isBuffer(y().output))throw new TypeError("Input is invalid");n(y())}if(e.redeem){if(e.redeem.network&&e.redeem.network!==l)throw new TypeError("Network mismatch");if(e.input){const t=y();if(e.redeem.output&&!e.redeem.output.equals(t.output))throw new TypeError("Redeem.output mismatch");if(e.redeem.input&&!e.redeem.input.equals(t.input))throw new TypeError("Redeem.input mismatch")}n(e.redeem)}if(e.witness&&e.redeem&&e.redeem.witness&&!f(e.redeem.witness,e.witness))throw new TypeError("Witness and redeem.witness mismatch")}return Object.assign(h,e)}e.exports=l}).call(this,r(0).Buffer)},function(e,t,r){(function(t){const n=r(114),i=r(35),o=r(29),s=r(112),a=r(94),u=r(297),c=r(23),f=r(64).bitcoin,l=t.alloc(0);function h(e,r){if(!(e.address||e.hash||e.output||e.pubkey||e.witness))throw new TypeError("Not enough data");r=Object.assign({validate:!0},r||{}),i({address:i.maybe(i.String),hash:i.maybe(i.BufferN(20)),input:i.maybe(i.BufferN(0)),network:i.maybe(i.Object),output:i.maybe(i.BufferN(22)),pubkey:i.maybe(s.isPoint),signature:i.maybe(c.isCanonicalScriptSignature),witness:i.maybe(i.arrayOf(i.Buffer))},e);const h=n.value(function(){const r=u.decode(e.address),n=r.words.shift(),i=u.fromWords(r.words);return{version:n,prefix:r.prefix,data:t.from(i)}}),d=e.network||f,p={network:d};if(n.prop(p,"address",function(){if(!p.hash)return;const e=u.toWords(p.hash);return e.unshift(0),u.encode(d.bech32,e)}),n.prop(p,"hash",function(){return e.output?e.output.slice(2,22):e.address?h().data:e.pubkey||p.pubkey?a.hash160(e.pubkey||p.pubkey):void 0}),n.prop(p,"output",function(){if(p.hash)return c.compile([o.OP_0,p.hash])}),n.prop(p,"pubkey",function(){return e.pubkey?e.pubkey:e.witness?e.witness[1]:void 0}),n.prop(p,"signature",function(){if(e.witness)return e.witness[0]}),n.prop(p,"input",function(){if(p.witness)return l}),n.prop(p,"witness",function(){if(e.pubkey&&e.signature)return[e.signature,e.pubkey]}),r.validate){let t;if(e.address){if(d&&d.bech32!==h().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(0!==h().version)throw new TypeError("Invalid address version");if(20!==h().data.length)throw new TypeError("Invalid address data");t=h().data}if(e.hash){if(t&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(22!==e.output.length||e.output[0]!==o.OP_0||20!==e.output[1])throw new TypeError("Output is invalid");if(t&&!t.equals(e.output.slice(2)))throw new TypeError("Hash mismatch");t=e.output.slice(2)}if(e.pubkey){const r=a.hash160(e.pubkey);if(t&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.witness){if(2!==e.witness.length)throw new TypeError("Witness is invalid");if(!c.isCanonicalScriptSignature(e.witness[0]))throw new TypeError("Witness has invalid signature");if(!s.isPoint(e.witness[1]))throw new TypeError("Witness has invalid pubkey");if(e.signature&&!e.signature.equals(e.witness[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(e.witness[1]))throw new TypeError("Pubkey mismatch");const r=a.hash160(e.witness[1]);if(t&&!t.equals(r))throw new TypeError("Hash mismatch")}}return Object.assign(p,e)}e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){(function(t){const n=r(114),i=r(35),o=r(29),s=r(297),a=r(94),u=r(23),c=r(64).bitcoin,f=t.alloc(0);function l(e,t){return e.length===t.length&&e.every(function(e,r){return e.equals(t[r])})}function h(e,r){if(!(e.address||e.hash||e.output||e.redeem||e.witness))throw new TypeError("Not enough data");r=Object.assign({validate:!0},r||{}),i({network:i.maybe(i.Object),address:i.maybe(i.String),hash:i.maybe(i.BufferN(32)),output:i.maybe(i.BufferN(34)),redeem:i.maybe({input:i.maybe(i.Buffer),network:i.maybe(i.Object),output:i.maybe(i.Buffer),witness:i.maybe(i.arrayOf(i.Buffer))}),input:i.maybe(i.BufferN(0)),witness:i.maybe(i.arrayOf(i.Buffer))},e);const h=n.value(function(){const r=s.decode(e.address),n=r.words.shift(),i=s.fromWords(r.words);return{version:n,prefix:r.prefix,data:t.from(i)}}),d=n.value(function(){return u.decompile(e.redeem.input)}),p=e.network||c,y={network:p};if(n.prop(y,"address",function(){if(!y.hash)return;const e=s.toWords(y.hash);return e.unshift(0),s.encode(p.bech32,e)}),n.prop(y,"hash",function(){return e.output?e.output.slice(2):e.address?h().data:y.redeem&&y.redeem.output?a.sha256(y.redeem.output):void 0}),n.prop(y,"output",function(){if(y.hash)return u.compile([o.OP_0,y.hash])}),n.prop(y,"redeem",function(){if(e.witness)return{output:e.witness[e.witness.length-1],input:f,witness:e.witness.slice(0,-1)}}),n.prop(y,"input",function(){if(y.witness)return f}),n.prop(y,"witness",function(){if(e.redeem&&e.redeem.input&&e.redeem.input.length>0&&e.redeem.output&&e.redeem.output.length>0){const t=u.toStack(d());return y.redeem=Object.assign({witness:t},e.redeem),y.redeem.input=f,[].concat(t,e.redeem.output)}if(e.redeem&&e.redeem.output&&e.redeem.witness)return[].concat(e.redeem.witness,e.redeem.output)}),r.validate){let t;if(e.address){if(h().prefix!==p.bech32)throw new TypeError("Invalid prefix or Network mismatch");if(0!==h().version)throw new TypeError("Invalid address version");if(32!==h().data.length)throw new TypeError("Invalid address data");t=h().data}if(e.hash){if(t&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(34!==e.output.length||e.output[0]!==o.OP_0||32!==e.output[1])throw new TypeError("Output is invalid");const r=e.output.slice(2);if(t&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.redeem){if(e.redeem.network&&e.redeem.network!==p)throw new TypeError("Network mismatch");if(e.redeem.input&&e.redeem.input.length>0&&e.redeem.witness&&e.redeem.witness.length>0)throw new TypeError("Ambiguous witness source");if(e.redeem.output){if(0===u.decompile(e.redeem.output).length)throw new TypeError("Redeem.output is invalid");const r=a.sha256(e.redeem.output);if(t&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.redeem.input&&!u.isPushOnly(d()))throw new TypeError("Non push-only scriptSig");if(e.witness&&e.redeem.witness&&!l(e.witness,e.redeem.witness))throw new TypeError("Witness and redeem.witness mismatch")}if(e.witness&&e.redeem&&e.redeem.output&&!e.redeem.output.equals(e.witness[e.witness.length-1]))throw new TypeError("Witness and redeem.output mismatch")}return Object.assign(y,e)}e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){const n=r(23).decompile,i=r(299),o=r(920),s=r(300),a=r(301),u=r(925),c=r(928),f=r(930),l=r(932),h={MULTISIG:"multisig",NONSTANDARD:"nonstandard",NULLDATA:"nulldata",P2PK:"pubkey",P2PKH:"pubkeyhash",P2SH:"scripthash",P2WPKH:"witnesspubkeyhash",P2WSH:"witnessscripthash",WITNESS_COMMITMENT:"witnesscommitment"};function d(e){if(c.output.check(e))return h.P2WPKH;if(f.output.check(e))return h.P2WSH;if(a.output.check(e))return h.P2PKH;if(u.output.check(e))return h.P2SH;const t=n(e);if(!t)throw new TypeError("Invalid script");return i.output.check(t)?h.MULTISIG:s.output.check(t)?h.P2PK:l.output.check(t)?h.WITNESS_COMMITMENT:o.output.check(t)?h.NULLDATA:h.NONSTANDARD}function p(e,t){const r=n(e);if(!r)throw new TypeError("Invalid script");return a.input.check(r)?h.P2PKH:u.input.check(r,t)?h.P2SH:i.input.check(r,t)?h.MULTISIG:s.input.check(r)?h.P2PK:h.NONSTANDARD}function y(e,t){const r=n(e);if(!r)throw new TypeError("Invalid script");return c.input.check(r)?h.P2WPKH:f.input.check(r,t)?h.P2WSH:h.NONSTANDARD}e.exports={input:p,output:d,witness:y,types:h}},function(e,t,r){const n=r(23),i=r(29);function o(e){return e===i.OP_0||n.isCanonicalScriptSignature(e)}function s(e,t){const r=n.decompile(e);return!(r.length<2)&&(r[0]===i.OP_0&&(t?r.slice(1).every(o):r.slice(1).every(n.isCanonicalScriptSignature)))}s.toJSON=function(){return"multisig input"},e.exports={check:s}},function(e,t,r){const n=r(23),i=r(74),o=r(29),s=o.OP_RESERVED;function a(e,t){const r=n.decompile(e);if(r.length<4)return!1;if(r[r.length-1]!==o.OP_CHECKMULTISIG)return!1;if(!i.Number(r[0]))return!1;if(!i.Number(r[r.length-2]))return!1;const a=r[0]-s,u=r[r.length-2]-s;if(a<=0)return!1;if(u>16)return!1;if(a>u)return!1;if(u!==r.length-3)return!1;if(t)return!0;const c=r.slice(1,-2);return c.every(n.isCanonicalPubKey)}a.toJSON=function(){return"multi-sig output"},e.exports={check:a}},function(e,t,r){const n=r(23),i=r(29);function o(e){const t=n.compile(e);return t.length>1&&t[0]===i.OP_RETURN}o.toJSON=function(){return"null data output"},e.exports={output:{check:o}}},function(e,t,r){const n=r(23);function i(e){const t=n.decompile(e);return 1===t.length&&n.isCanonicalScriptSignature(t[0])}i.toJSON=function(){return"pubKey input"},e.exports={check:i}},function(e,t,r){const n=r(23),i=r(29);function o(e){const t=n.decompile(e);return 2===t.length&&n.isCanonicalPubKey(t[0])&&t[1]===i.OP_CHECKSIG}o.toJSON=function(){return"pubKey output"},e.exports={check:o}},function(e,t,r){const n=r(23);function i(e){const t=n.decompile(e);return 2===t.length&&n.isCanonicalScriptSignature(t[0])&&n.isCanonicalPubKey(t[1])}i.toJSON=function(){return"pubKeyHash input"},e.exports={check:i}},function(e,t,r){const n=r(23),i=r(29);function o(e){const t=n.compile(e);return 25===t.length&&t[0]===i.OP_DUP&&t[1]===i.OP_HASH160&&20===t[2]&&t[23]===i.OP_EQUALVERIFY&&t[24]===i.OP_CHECKSIG}o.toJSON=function(){return"pubKeyHash output"},e.exports={check:o}},function(e,t,r){e.exports={input:r(926),output:r(927)}},function(e,t,r){const n=r(4).Buffer,i=r(23),o=r(299),s=r(300),a=r(301),u=r(470),c=r(471);function f(e,t){const r=i.decompile(e);if(r.length<1)return!1;const f=r[r.length-1];if(!n.isBuffer(f))return!1;const l=i.decompile(i.compile(r.slice(0,-1))),h=i.decompile(f);return!!h&&(!!i.isPushOnly(l)&&(1===r.length?c.check(h)||u.check(h):!(!a.input.check(l)||!a.output.check(h))||(!(!o.input.check(l,t)||!o.output.check(h))||!(!s.input.check(l)||!s.output.check(h)))))}f.toJSON=function(){return"scriptHash input"},e.exports={check:f}},function(e,t,r){const n=r(23),i=r(29);function o(e){const t=n.compile(e);return 23===t.length&&t[0]===i.OP_HASH160&&20===t[1]&&t[22]===i.OP_EQUAL}o.toJSON=function(){return"scriptHash output"},e.exports={check:o}},function(e,t,r){e.exports={input:r(929),output:r(470)}},function(e,t,r){const n=r(23);function i(e){return n.isCanonicalPubKey(e)&&33===e.length}function o(e){const t=n.decompile(e);return 2===t.length&&n.isCanonicalScriptSignature(t[0])&&i(t[1])}o.toJSON=function(){return"witnessPubKeyHash input"},e.exports={check:o}},function(e,t,r){e.exports={input:r(931),output:r(471)}},function(e,t,r){(function(t){const n=r(23),i=r(74),o=r(35),s=r(299),a=r(300),u=r(301);function c(e,r){if(o(i.Array,e),e.length<1)return!1;const c=e[e.length-1];if(!t.isBuffer(c))return!1;const f=n.decompile(c);if(!f||0===f.length)return!1;const l=n.compile(e.slice(0,-1));return!(!u.input.check(l)||!u.output.check(f))||(!(!s.input.check(l,r)||!s.output.check(f))||!(!a.input.check(l)||!a.output.check(f)))}c.toJSON=function(){return"witnessScriptHash input"},e.exports={check:c}}).call(this,r(0).Buffer)},function(e,t,r){e.exports={output:r(933)}},function(e,t,r){const n=r(4).Buffer,i=r(23),o=r(74),s=r(35),a=r(29),u=n.from("aa21a9ed","hex");function c(e){const t=i.compile(e);return t.length>37&&t[0]===a.OP_RETURN&&36===t[1]&&t.slice(2,6).equals(u)}function f(e){s(o.Hash256bit,e);const t=n.allocUnsafe(36);return u.copy(t,0),e.copy(t,4),i.compile([a.OP_RETURN,t])}function l(e){return s(c,e),i.decompile(e)[1].slice(4,36)}c.toJSON=function(){return"Witness commitment output"},e.exports={check:c,decode:l,encode:f}},function(e,t,r){let n=r(4).Buffer,i=r(165),o=r(935),s=r(112),a=r(35),u=r(468),c=a.BufferN(32),f=a.compile({wif:a.UInt8,bip32:{public:a.UInt32,private:a.UInt32}}),l={wif:128,bip32:{public:76067358,private:76066276}};function h(e,t,r,n){a(f,n),this.__d=e||null,this.__Q=t||null,this.chainCode=r,this.depth=0,this.index=0,this.network=n,this.parentFingerprint=0}Object.defineProperty(h.prototype,"identifier",{get:function(){return o.hash160(this.publicKey)}}),Object.defineProperty(h.prototype,"fingerprint",{get:function(){return this.identifier.slice(0,4)}}),Object.defineProperty(h.prototype,"privateKey",{enumerable:!1,get:function(){return this.__d}}),Object.defineProperty(h.prototype,"publicKey",{get:function(){return this.__Q||(this.__Q=s.pointFromScalar(this.__d,this.compressed)),this.__Q}}),h.prototype.isNeutered=function(){return null===this.__d},h.prototype.neutered=function(){let e=v(this.publicKey,this.chainCode,this.network);return e.depth=this.depth,e.index=this.index,e.parentFingerprint=this.parentFingerprint,e},h.prototype.toBase58=function(){let e=this.network,t=this.isNeutered()?e.bip32.public:e.bip32.private,r=n.allocUnsafe(78);return r.writeUInt32BE(t,0),r.writeUInt8(this.depth,4),r.writeUInt32BE(this.parentFingerprint,5),r.writeUInt32BE(this.index,9),this.chainCode.copy(r,13),this.isNeutered()?this.publicKey.copy(r,45):(r.writeUInt8(0,45),this.privateKey.copy(r,46)),i.encode(r)},h.prototype.toWIF=function(){if(!this.privateKey)throw new TypeError("Missing private key");return u.encode(this.network.wif,this.privateKey,!0)};let d=2147483648;h.prototype.derive=function(e){a(a.UInt32,e);let t=e>=2147483648,r=n.allocUnsafe(37);if(t){if(this.isNeutered())throw new TypeError("Missing private key for hardened child key");r[0]=0,this.privateKey.copy(r,1),r.writeUInt32BE(e,33)}else this.publicKey.copy(r,0),r.writeUInt32BE(e,33);let i=o.hmacSHA512(this.chainCode,r),u=i.slice(0,32),c=i.slice(32),f;if(!s.isPrivate(u))return this.derive(e+1);if(this.isNeutered()){let t=s.pointAddScalar(this.publicKey,u,!0);if(null===t)return this.derive(e+1);f=v(t,c,this.network)}else{let t=s.privateAdd(this.privateKey,u);if(null==t)return this.derive(e+1);f=b(t,c,this.network)}return f.depth=this.depth+1,f.index=e,f.parentFingerprint=this.fingerprint.readUInt32BE(0),f};let p=Math.pow(2,31)-1;function y(e){return a.UInt32(e)&&e<=p}function g(e){return a.String(e)&&e.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}function m(e,t){let r=i.decode(e);if(78!==r.length)throw new TypeError("Invalid buffer length");t=t||l;let n=r.readUInt32BE(0);if(n!==t.bip32.private&&n!==t.bip32.public)throw new TypeError("Invalid network version");let o=r[4],s=r.readUInt32BE(5);if(0===o&&0!==s)throw new TypeError("Invalid parent fingerprint");let a=r.readUInt32BE(9);if(0===o&&0!==a)throw new TypeError("Invalid index");let u=r.slice(13,45),c;if(n===t.bip32.private){if(0!==r.readUInt8(45))throw new TypeError("Invalid private key");let e=r.slice(46,78);c=b(e,u,t)}else{let e=r.slice(45,78);c=v(e,u,t)}return c.depth=o,c.index=a,c.parentFingerprint=s,c}function b(e,t,r){if(a({privateKey:c,chainCode:c},{privateKey:e,chainCode:t}),r=r||l,!s.isPrivate(e))throw new TypeError("Private key not in range [1, n)");return new h(e,null,t,r)}function v(e,t,r){if(a({publicKey:a.BufferN(33),chainCode:c},{publicKey:e,chainCode:t}),r=r||l,!s.isPoint(e))throw new TypeError("Point is not on the curve");return new h(null,e,t,r)}function _(e,t){if(a(a.Buffer,e),e.length<16)throw new TypeError("Seed should be at least 128 bits");if(e.length>64)throw new TypeError("Seed should be at most 512 bits");t=t||l;let r=o.hmacSHA512("Bitcoin seed",e),n=r.slice(0,32),i=r.slice(32);return b(n,i,t)}h.prototype.deriveHardened=function(e){return a(y,e),this.derive(e+2147483648)},h.prototype.derivePath=function(e){a(g,e);let t=e.split("/");if("m"===t[0]){if(this.parentFingerprint)throw new TypeError("Expected master, got child");t=t.slice(1)}return t.reduce(function(e,t){let r;return"'"===t.slice(-1)?(r=parseInt(t.slice(0,-1),10),e.deriveHardened(r)):(r=parseInt(t,10),e.derive(r))},this)},h.prototype.sign=function(e){return s.sign(e,this.privateKey)},h.prototype.verify=function(e,t){return s.verify(e,this.publicKey,t)},e.exports={fromBase58:m,fromPrivateKey:b,fromPublicKey:v,fromSeed:_}},function(e,t,r){let n=r(131),i=r(293);function o(e){return n("rmd160").update(n("sha256").update(e).digest()).digest()}function s(e,t){return i("sha512",e).update(t).digest()}e.exports={hash160:o,hmacSHA512:s}},function(e,t,r){const n=r(223),i=r(166),o=r(4).Buffer;var s=e.exports=function(e){var t=[{name:"nonce",default:o.alloc(0)},{name:"balance",default:o.alloc(0)},{name:"stateRoot",length:32,default:n.SHA3_RLP},{name:"codeHash",length:32,default:n.SHA3_NULL}];n.defineProperties(this,t,e)};s.prototype.serialize=function(){return i.encode(this.raw)},s.prototype.isContract=function(){return this.codeHash.toString("hex")!==n.SHA3_NULL_S},s.prototype.getCode=function(e,t){this.isContract()?e.getRaw(this.codeHash,t):t(null,o.alloc(0))},s.prototype.setCode=function(e,t,r){var i=this;this.codeHash=n.sha3(t),this.codeHash.toString("hex")!==n.SHA3_NULL_S?e.putRaw(this.codeHash,t,function(e){r(e,i.codeHash)}):r(null,o.alloc(0))},s.prototype.getStorage=function(e,t,r){var n=e.copy();n.root=this.stateRoot,n.get(t,r)},s.prototype.setStorage=function(e,t,r,n){var i=this,o=e.copy();o.root=i.stateRoot,o.put(t,r,function(e){if(e)return n();i.stateRoot=o.root,n()})},s.prototype.isEmpty=function(){return""===this.balance.toString("hex")&&""===this.nonce.toString("hex")&&this.stateRoot.toString("hex")===n.SHA3_RLP_S&&this.codeHash.toString("hex")===n.SHA3_NULL_S}},function(e,t,r){"use strict";e.exports=r(938)(r(941))},function(e,t,r){"use strict";var n=r(939),i=r(940);e.exports=function(e){var t=n(e),r=i(e);return function(e,n){var i="string"==typeof e?e.toLowerCase():e;switch(i){case"keccak224":return new t(1152,448,null,224,n);case"keccak256":return new t(1088,512,null,256,n);case"keccak384":return new t(832,768,null,384,n);case"keccak512":return new t(576,1024,null,512,n);case"sha3-224":return new t(1152,448,6,224,n);case"sha3-256":return new t(1088,512,6,256,n);case"sha3-384":return new t(832,768,6,384,n);case"sha3-512":return new t(576,1024,6,512,n);case"shake128":return new r(1344,256,31,n);case"shake256":return new r(1088,512,31,n);default:throw new Error("Invald algorithm: "+e)}}}},function(e,t,r){"use strict";var n=r(4).Buffer,i=r(93).Transform,o=r(1);e.exports=function(e){function t(t,r,n,o,s){i.call(this,s),this._rate=t,this._capacity=r,this._delimitedSuffix=n,this._hashBitLength=o,this._options=s,this._state=new e,this._state.initialize(t,r),this._finalized=!1}return o(t,i),t.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(e){n=e}r(n)},t.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},t.prototype.update=function(e,t){if(!n.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return n.isBuffer(e)||(e=n.from(e,t)),this._state.absorb(e),this},t.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);var t=this._state.squeeze(this._hashBitLength/8);return void 0!==e&&(t=t.toString(e)),this._resetState(),t},t.prototype._resetState=function(){return this._state.initialize(this._rate,this._capacity),this},t.prototype._clone=function(){var e=new t(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e},t}},function(e,t,r){"use strict";var n=r(4).Buffer,i=r(93).Transform,o=r(1);e.exports=function(e){function t(t,r,n,o){i.call(this,o),this._rate=t,this._capacity=r,this._delimitedSuffix=n,this._options=o,this._state=new e,this._state.initialize(t,r),this._finalized=!1}return o(t,i),t.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(e){n=e}r(n)},t.prototype._flush=function(){},t.prototype._read=function(e){this.push(this.squeeze(e))},t.prototype.update=function(e,t){if(!n.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return n.isBuffer(e)||(e=n.from(e,t)),this._state.absorb(e),this},t.prototype.squeeze=function(e,t){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));var r=this._state.squeeze(e);return void 0!==t&&(r=r.toString(t)),r},t.prototype._resetState=function(){return this._state.initialize(this._rate,this._capacity),this},t.prototype._clone=function(){var e=new t(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e},t}},function(e,t,r){"use strict";var n=r(4).Buffer,i=r(942);function o(){this.state=[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],this.blockSize=null,this.count=0,this.squeezing=!1}o.prototype.initialize=function(e,t){for(var r=0;r<50;++r)this.state[r]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1},o.prototype.absorb=function(e){for(var t=0;t>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(i.p1600(this.state),this.count=0);return t},o.prototype.copy=function(e){for(var t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing},e.exports=o},function(e,t,r){"use strict";var n=[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];t.p1600=function(e){for(var t=0;t<24;++t){var r=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],a=e[4]^e[14]^e[24]^e[34]^e[44],u=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],l=e[8]^e[18]^e[28]^e[38]^e[48],h=e[9]^e[19]^e[29]^e[39]^e[49],d=l^(o<<1|s>>>31),p=h^(s<<1|o>>>31),y=e[0]^d,g=e[1]^p,m=e[10]^d,b=e[11]^p,v=e[20]^d,_=e[21]^p,w=e[30]^d,S=e[31]^p,E=e[40]^d,k=e[41]^p;d=r^(a<<1|u>>>31),p=i^(u<<1|a>>>31);var A=e[2]^d,x=e[3]^p,C=e[12]^d,T=e[13]^p,I=e[22]^d,B=e[23]^p,O=e[32]^d,P=e[33]^p,R=e[42]^d,N=e[43]^p;d=o^(c<<1|f>>>31),p=s^(f<<1|c>>>31);var j=e[4]^d,L=e[5]^p,M=e[14]^d,D=e[15]^p,U=e[24]^d,F=e[25]^p,K=e[34]^d,q=e[35]^p,H=e[44]^d,z=e[45]^p;d=a^(l<<1|h>>>31),p=u^(h<<1|l>>>31);var V=e[6]^d,G=e[7]^p,W=e[16]^d,$=e[17]^p,Y=e[26]^d,J=e[27]^p,Z=e[36]^d,X=e[37]^p,Q=e[46]^d,ee=e[47]^p;d=c^(r<<1|i>>>31),p=f^(i<<1|r>>>31);var te=e[8]^d,re=e[9]^p,ne=e[18]^d,ie=e[19]^p,oe=e[28]^d,se=e[29]^p,ae=e[38]^d,ue=e[39]^p,ce=e[48]^d,fe=e[49]^p,le=y,he=g,de=b<<4|m>>>28,pe=m<<4|b>>>28,ye=v<<3|_>>>29,ge=_<<3|v>>>29,me=S<<9|w>>>23,be=w<<9|S>>>23,ve=E<<18|k>>>14,_e=k<<18|E>>>14,we=A<<1|x>>>31,Se=x<<1|A>>>31,Ee=T<<12|C>>>20,ke=C<<12|T>>>20,Ae=I<<10|B>>>22,xe=B<<10|I>>>22,Ce=P<<13|O>>>19,Te=O<<13|P>>>19,Ie=R<<2|N>>>30,Be=N<<2|R>>>30,Oe=L<<30|j>>>2,Pe=j<<30|L>>>2,Re=M<<6|D>>>26,Ne=D<<6|M>>>26,je=F<<11|U>>>21,Le=U<<11|F>>>21,Me=K<<15|q>>>17,De=q<<15|K>>>17,Ue=z<<29|H>>>3,Fe=H<<29|z>>>3,Ke=V<<28|G>>>4,qe=G<<28|V>>>4,He=$<<23|W>>>9,ze=W<<23|$>>>9,Ve=Y<<25|J>>>7,Ge=J<<25|Y>>>7,We=Z<<21|X>>>11,$e=X<<21|Z>>>11,Ye=ee<<24|Q>>>8,Je=Q<<24|ee>>>8,Ze=te<<27|re>>>5,Xe=re<<27|te>>>5,Qe=ne<<20|ie>>>12,et=ie<<20|ne>>>12,tt=se<<7|oe>>>25,rt=oe<<7|se>>>25,nt=ae<<8|ue>>>24,it=ue<<8|ae>>>24,ot=ce<<14|fe>>>18,st=fe<<14|ce>>>18;e[0]=le^~Ee&je,e[1]=he^~ke&Le,e[10]=Ke^~Qe&ye,e[11]=qe^~et&ge,e[20]=we^~Re&Ve,e[21]=Se^~Ne&Ge,e[30]=Ze^~de&Ae,e[31]=Xe^~pe&xe,e[40]=Oe^~He&tt,e[41]=Pe^~ze&rt,e[2]=Ee^~je&We,e[3]=ke^~Le&$e,e[12]=Qe^~ye&Ce,e[13]=et^~ge&Te,e[22]=Re^~Ve&nt,e[23]=Ne^~Ge&it,e[32]=de^~Ae&Me,e[33]=pe^~xe&De,e[42]=He^~tt&me,e[43]=ze^~rt&be,e[4]=je^~We&ot,e[5]=Le^~$e&st,e[14]=ye^~Ce&Ue,e[15]=ge^~Te&Fe,e[24]=Ve^~nt&ve,e[25]=Ge^~it&_e,e[34]=Ae^~Me&Ye,e[35]=xe^~De&Je,e[44]=tt^~me&Ie,e[45]=rt^~be&Be,e[6]=We^~ot&le,e[7]=$e^~st&he,e[16]=Ce^~Ue&Ke,e[17]=Te^~Fe&qe,e[26]=nt^~ve&we,e[27]=it^~_e&Se,e[36]=Me^~Ye&Ze,e[37]=De^~Je&Xe,e[46]=me^~Ie&Oe,e[47]=be^~Be&Pe,e[8]=ot^~le&Ee,e[9]=st^~he&ke,e[18]=Ue^~Ke&Qe,e[19]=Fe^~qe&et,e[28]=ve^~we&Re,e[29]=_e^~Se&Ne,e[38]=Ye^~Ze&de,e[39]=Je^~Xe&pe,e[48]=Ie^~Oe&He,e[49]=Be^~Pe&ze,e[0]^=n[2*t],e[1]^=n[2*t+1]}}},function(e,t,r){"use strict";e.exports=r(473)(r(946))},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(291),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 l=e.slice(u,u+a);for(l.copy(t,32-l.length);c>0&&0===e[f];c-=1,f+=1);if(!(c>32)){var h=e.slice(f,f+c);return h.copy(r,32-h.length),{r:t,s:r}}}}}}}}}},function(e,t,r){"use strict";var n=r(4).Buffer,i=r(131),o=r(31),s=r(57).ec,a=r(302),u=new s("secp256k1"),c=u.curve;function f(e,t){var r=new o(t);if(r.cmp(c.p)>=0)return null;r=r.toRed(c.red);var n=r.redSqr().redIMul(r).redIAdd(c.b).redSqrt();return 3===e!==n.isOdd()&&(n=n.redNeg()),u.keyPair({pub:{x:r,y:n}})}function l(e,t,r){var n=new o(t),i=new o(r);if(n.cmp(c.p)>=0||i.cmp(c.p)>=0)return null;if(n=n.toRed(c.red),i=i.toRed(c.red),(6===e||7===e)&&i.isOdd()!==(7===e))return null;var s=n.redSqr().redIMul(n);return i.redSqr().redISub(s.redIAdd(c.b)).isZero()?u.keyPair({pub:{x:n,y:i}}):null}function h(e){var t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:f(t,e.slice(1,33));case 4:case 6:case 7:return 65!==e.length?null:l(t,e.slice(1,33),e.slice(33,65));default:return null}}t.privateKeyVerify=function(e){var t=new o(e);return t.cmp(c.n)<0&&!t.isZero()},t.privateKeyExport=function(e,t){var r=new o(e);if(r.cmp(c.n)>=0||r.isZero())throw new Error(a.EC_PRIVATE_KEY_EXPORT_DER_FAIL);return n.from(u.keyFromPrivate(e).getPublic(t,!0))},t.privateKeyNegate=function(e){var t=new o(e);return t.isZero()?n.alloc(32):c.n.sub(t).umod(c.n).toArrayLike(n,"be",32)},t.privateKeyModInverse=function(e){var t=new o(e);if(t.cmp(c.n)>=0||t.isZero())throw new Error(a.EC_PRIVATE_KEY_RANGE_INVALID);return t.invm(c.n).toArrayLike(n,"be",32)},t.privateKeyTweakAdd=function(e,t){var r=new o(t);if(r.cmp(c.n)>=0)throw new Error(a.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);if(r.iadd(new o(e)),r.cmp(c.n)>=0&&r.isub(c.n),r.isZero())throw new Error(a.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);return r.toArrayLike(n,"be",32)},t.privateKeyTweakMul=function(e,t){var r=new o(t);if(r.cmp(c.n)>=0||r.isZero())throw new Error(a.EC_PRIVATE_KEY_TWEAK_MUL_FAIL);return r.imul(new o(e)),r.cmp(c.n)&&(r=r.umod(c.n)),r.toArrayLike(n,"be",32)},t.publicKeyCreate=function(e,t){var r=new o(e);if(r.cmp(c.n)>=0||r.isZero())throw new Error(a.EC_PUBLIC_KEY_CREATE_FAIL);return n.from(u.keyFromPrivate(e).getPublic(t,!0))},t.publicKeyConvert=function(e,t){var r=h(e);if(null===r)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);return n.from(r.getPublic(t,!0))},t.publicKeyVerify=function(e){return null!==h(e)},t.publicKeyTweakAdd=function(e,t,r){var i=h(e);if(null===i)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);if(t=new o(t),t.cmp(c.n)>=0)throw new Error(a.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);return n.from(c.g.mul(t).add(i.pub).encode(!0,r))},t.publicKeyTweakMul=function(e,t,r){var i=h(e);if(null===i)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);if(t=new o(t),t.cmp(c.n)>=0||t.isZero())throw new Error(a.EC_PUBLIC_KEY_TWEAK_MUL_FAIL);return n.from(i.pub.mul(t).encode(!0,r))},t.publicKeyCombine=function(e,t){for(var r=new Array(e.length),i=0;i=0||r.cmp(c.n)>=0)throw new Error(a.ECDSA_SIGNATURE_PARSE_FAIL);var i=n.from(e);return 1===r.cmp(u.nh)&&c.n.sub(r).toArrayLike(n,"be",32).copy(i,32),i},t.signatureExport=function(e){var t=e.slice(0,32),r=e.slice(32,64);if(new o(t).cmp(c.n)>=0||new o(r).cmp(c.n)>=0)throw new Error(a.ECDSA_SIGNATURE_PARSE_FAIL);return{r:t,s:r}},t.signatureImport=function(e){var t=new o(e.r);t.cmp(c.n)>=0&&(t=new o(0));var r=new o(e.s);return r.cmp(c.n)>=0&&(r=new o(0)),n.concat([t.toArrayLike(n,"be",32),r.toArrayLike(n,"be",32)])},t.sign=function(e,t,r,i){if("function"==typeof r){var s=r;r=function(r){var u=s(e,t,null,i,r);if(!n.isBuffer(u)||32!==u.length)throw new Error(a.ECDSA_SIGN_FAIL);return new o(u)}}var f=new o(t);if(f.cmp(c.n)>=0||f.isZero())throw new Error(a.ECDSA_SIGN_FAIL);var l=u.sign(e,t,{canonical:!0,k:r,pers:i});return{signature:n.concat([l.r.toArrayLike(n,"be",32),l.s.toArrayLike(n,"be",32)]),recovery:l.recoveryParam}},t.verify=function(e,t,r){var n={r:t.slice(0,32),s:t.slice(32,64)},i=new o(n.r),s=new o(n.s);if(i.cmp(c.n)>=0||s.cmp(c.n)>=0)throw new Error(a.ECDSA_SIGNATURE_PARSE_FAIL);if(1===s.cmp(u.nh)||i.isZero()||s.isZero())return!1;var f=h(r);if(null===f)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);return u.verify(e,n,{x:f.pub.x,y:f.pub.y})},t.recover=function(e,t,r,i){var s={r:t.slice(0,32),s:t.slice(32,64)},f=new o(s.r),l=new o(s.s);if(f.cmp(c.n)>=0||l.cmp(c.n)>=0)throw new Error(a.ECDSA_SIGNATURE_PARSE_FAIL);try{if(f.isZero()||l.isZero())throw new Error;var h=u.recoverPubKey(e,s,r);return n.from(h.encode(!0,i))}catch(e){throw new Error(a.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 i=h(e);if(null===i)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);var s=new o(t);if(s.cmp(c.n)>=0||s.isZero())throw new Error(a.ECDH_FAIL);return n.from(i.pub.mul(s).encode(!0,r))}},function(e,t,r){"use strict";(function(t){var n=r(474),i=r(948);function o(e){var t=e;if("string"!=typeof t)throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof t+", while padToEven.");return t.length%2&&(t="0"+t),t}function s(e){var t=e.toString(16);return"0x"+t}function a(e){var r=s(e);return new t(o(r.slice(2)),"hex")}function u(e){if("string"!=typeof e)throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof e+"'.");return t.byteLength(e,"utf8")}function c(e,t,r){if(!0!==Array.isArray(e))throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof e+"'");if(!0!==Array.isArray(t))throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof t+"'");return t[Boolean(r)?"some":"every"](function(t){return e.indexOf(t)>=0})}function f(e){var r=new t(o(i(e).replace(/^0+|0+$/g,"")),"hex");return r.toString("utf8")}function l(e){var t="",r=0,n=e.length;for("0x"===e.substring(0,2)&&(r=2);r0))return!0;for(let t of this._supportedHardforks)if(e===t)return!0;return!1}param(e,t,r){let n;r=this._chooseHardfork(r);for(let o of i){if(!o[1][e])throw new Error(`Topic ${e} not defined`);if(void 0!==o[1][e][t]&&(n=o[1][e][t].v),o[0]===r)break}if(void 0===n)throw new Error(`${e} value for ${t} not found`);return n}paramByBlock(e,t,r){let n=this.activeHardforks(r),i=n[n.length-1].name;return this.param(e,t,i)}hardforkIsActiveOnBlock(e,t,r){r=void 0!==r?r:[];let n=void 0!==r.onlySupported&&r.onlySupported;e=this._chooseHardfork(e,n);let i=this.hardforkBlock(e);return null!==i&&t>=i}activeOnBlock(e,t){return this.hardforkIsActiveOnBlock(null,e,t)}hardforkGteHardfork(e,t,r){r=void 0!==r?r:[];let n=void 0!==r.onlyActive&&r.onlyActive,i,o,s;e=this._chooseHardfork(e,r.onlySupported),i=n?this.activeHardforks(null,r):this.hardforks();let a=0;for(let r of i)r.name===e&&(o=a),r.name===t&&(s=a),a+=1;return o>=s}gteHardfork(e,t){return this.hardforkGteHardfork(null,e,t)}hardforkIsActiveOnChain(e,t){t=void 0!==t?t:[];let r=void 0!==t.onlySupported&&t.onlySupported;e=this._chooseHardfork(e,r);for(let t of this.hardforks())if(t.name===e&&null!==t.block)return!0;return!1}activeHardforks(e,t){t=void 0!==t?t:[];let r=[],n=this.hardforks();for(let i of n)if(null!==i.block){if(void 0!==e&&null!==e&&e0)return r[r.length-1].name;throw new Error("No (supported) active hardfork found")}hardforkBlock(e){return e=this._chooseHardfork(e,!1),this._getHardfork(e).block}isHardforkBlock(e,t){return t=this._chooseHardfork(t,!1),this.hardforkBlock(t)===e}consensus(e){return e=this._chooseHardfork(e),this._getHardfork(e).consensus}finality(e){return e=this._chooseHardfork(e),this._getHardfork(e).finality}genesis(){return this._chainParams.genesis}hardforks(){return this._chainParams.hardforks}bootstrapNodes(){return this._chainParams.bootstrapNodes}hardfork(){return this._hardfork}chainId(){return this._chainParams.chainId}chainName(){return n.names[this.chainId()]||this._chainParams.name}networkId(){return this._chainParams.networkId}}e.exports=o},function(e,t,r){var n={names:{}};n.names[1]="mainnet",n.names[3]="ropsten",n.names[4]="rinkeby",n.names[42]="kovan",n.names[6284]="goerli",n.mainnet=r(952),n.ropsten=r(953),n.rinkeby=r(954),n.kovan=r(955),n.goerli=r(956),e.exports=n},function(e){e.exports={name:"mainnet",chainId:1,networkId:1,comment:"The Ethereum main chain",url:"https://ethstats.net/",genesis:{hash:"0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",timestamp:null,gasLimit:5e3,difficulty:17179869184,nonce:"0x0000000000000042",extraData:"0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",stateRoot:"0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544"},hardforks:[{name:"chainstart",block:0,consensus:"pow",finality:null},{name:"homestead",block:115e4,consensus:"pow",finality:null},{name:"dao",block:192e4,consensus:"pow",finality:null},{name:"tangerineWhistle",block:2463e3,consensus:"pow",finality:null},{name:"spuriousDragon",block:2675e3,consensus:"pow",finality:null},{name:"byzantium",block:437e4,consensus:"pow",finality:null},{name:"constantinople",block:null,consensus:"pow",finality:null},{name:"hybridCasper",block:null,consensus:"pow",finality:"pos"}],bootstrapNodes:[{ip:"13.93.211.84",port:30303,id:"3f1d12044546b76342d59d4a05532c14b85aa669704bfe1f864fe079415aa2c02d743e03218e57a33fb94523adb54032871a6c51b2cc5514cb7c7e35b3ed0a99",location:"US-WEST",comment:"Go Bootnode"},{ip:"191.235.84.50",port:30303,id:"78de8a0916848093c73790ead81d1928bec737d565119932b98c6b100d944b7a95e94f847f689fc723399d2e31129d182f7ef3863f2b4c820abbf3ab2722344d",location:"BR",comment:"Go Bootnode"},{ip:"13.75.154.138",port:30303,id:"158f8aab45f6d19c6cbf4a089c2670541a8da11978a2f90dbf6a502a4a3bab80d288afdbeb7ec0ef6d92de563767f3b1ea9e8e334ca711e9f8e2df5a0385e8e6",location:"AU",comment:"Go Bootnode"},{ip:"52.74.57.123",port:30303,id:"1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082",location:"SG",comment:"Go Bootnode"}]}},function(e){e.exports={name:"ropsten",chainId:3,networkId:3,comment:"PoW test network",url:"https://github.com/ethereum/ropsten",genesis:{hash:"0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d",timestamp:null,gasLimit:16777216,difficulty:1048576,nonce:"0x0000000000000042",extraData:"0x3535353535353535353535353535353535353535353535353535353535353535",stateRoot:"0x217b0bbcfb72e2d57e28f33cb361b9983513177755dc3f33ce3e7022ed62b77b"},hardforks:[{name:"chainstart",block:0,consensus:"pow",finality:null},{name:"homestead",block:0,consensus:"pow",finality:null},{name:"dao",block:null,consensus:"pow",finality:null},{name:"tangerineWhistle",block:0,consensus:"pow",finality:null},{name:"spuriousDragon",block:10,consensus:"pow",finality:null},{name:"byzantium",block:17e5,consensus:"pow",finality:null},{name:"constantinople",block:null,consensus:"pow",finality:null},{name:"hybridCasper",block:null,consensus:"pow",finality:"pos"}],bootstrapNodes:[{ip:"52.176.7.10",port:"30303",id:"30b7ab30a01c124a6cceca36863ece12c4f5fa68e3ba9b0b51407ccc002eeed3b3102d20a88f1c1d3c3154e2449317b8ef95090e77b312d5cc39354f86d5d606",network:"Ropsten",chainId:3,location:"US",comment:"US-Azure geth"},{ip:"52.176.100.77",port:"30303",id:"865a63255b3bb68023b6bffd5095118fcc13e79dcf014fe4e47e065c350c7cc72af2e53eff895f11ba1bbb6a2b33271c1116ee870f266618eadfc2e78aa7349c",network:"Ropsten",chainId:3,location:"US",comment:"US-Azure parity"},{ip:"52.232.243.152",port:"30303",id:"6332792c4a00e3e4ee0926ed89e0d27ef985424d97b6a45bf0f23e51f0dcb5e66b875777506458aea7af6f9e4ffb69f43f3778ee73c81ed9d34c51c4b16b0b0f",network:"Ropsten",chainId:3,location:"US",comment:"Parity"},{ip:"192.81.208.223",port:"30303",id:"94c15d1b9e2fe7ce56e458b9a3b672ef11894ddedd0c6f247e0f1d3487f52b66208fb4aeb8179fce6e3a749ea93ed147c37976d67af557508d199d9594c35f09",network:"Ropsten",chainId:3,location:"US",comment:"@gpip"}]}},function(e){e.exports={name:"rinkeby",chainId:4,networkId:4,comment:"PoA test network",url:"https://www.rinkeby.io",genesis:{hash:"0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177",timestamp:"0x58ee40ba",gasLimit:47e5,difficulty:1,nonce:"0x0000000000000000",extraData:"0x52657370656374206d7920617574686f7269746168207e452e436172746d616e42eb768f2244c8811c63729a21a3569731535f067ffc57839b00206d1ad20c69a1981b489f772031b279182d99e65703f0076e4812653aab85fca0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",stateRoot:"0x53580584816f617295ea26c0e17641e0120cab2f0a8ffb53a866fd53aa8e8c2d"},hardforks:[{name:"chainstart",block:0,consensus:"poa",finality:null},{name:"homestead",block:1,consensus:"poa",finality:null},{name:"dao",block:null,consensus:"poa",finality:null},{name:"tangerineWhistle",block:2,consensus:"poa",finality:null},{name:"spuriousDragon",block:3,consensus:"poa",finality:null},{name:"byzantium",block:1035301,consensus:"poa",finality:null},{name:"constantinople",block:null,consensus:"poa",finality:null},{name:"hybridCasper",block:null,consensus:"poa",finality:"pos"}],bootstrapNodes:[{ip:"52.169.42.101",port:30303,id:"a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf",location:"IE",comment:""},{ip:"52.3.158.184",port:30303,id:"343149e4feefa15d882d9fe4ac7d88f885bd05ebb735e547f12e12080a9fa07c8014ca6fd7f373123488102fe5e34111f8509cf0b7de3f5b44339c9f25e87cb8",location:"",comment:"INFURA"}]}},function(e){e.exports={name:"kovan",chainId:42,networkId:42,comment:"Parity PoA test network",url:"https://kovan-testnet.github.io/website/",genesis:{hash:"0xa3c565fc15c7478862d50ccd6561e3c06b24cc509bf388941c25ea985ce32cb9",timestamp:null,gasLimit:6e6,difficulty:131072,nonce:"0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",extraData:"0x",stateRoot:"0x2480155b48a1cea17d67dbfdfaafe821c1d19cdd478c5358e8ec56dec24502b2"},hardforks:[],bootstrapNodes:[{ip:"40.71.221.215",port:30303,id:"56abaf065581a5985b8c5f4f88bd202526482761ba10be9bfdcd14846dd01f652ec33fde0f8c0fd1db19b59a4c04465681fcef50e11380ca88d25996191c52de",location:"",comment:"Parity Bootnode"},{ip:"52.166.117.77",port:30303,id:"d07827483dc47b368eaf88454fb04b41b7452cf454e194e2bd4c14f98a3278fed5d819dbecd0d010407fc7688d941ee1e58d4f9c6354d3da3be92f55c17d7ce3",location:"",comment:"Parity Bootnode"},{ip:"52.165.239.18",port:30303,id:"8fa162563a8e5a05eef3e1cd5abc5828c71344f7277bb788a395cce4a0e30baf2b34b92fe0b2dbbba2313ee40236bae2aab3c9811941b9f5a7e8e90aaa27ecba",location:"",comment:"Parity Bootnode"},{ip:"52.243.47.56",port:30303,id:"7e2e7f00784f516939f94e22bdc6cf96153603ca2b5df1c7cc0f90a38e7a2f218ffb1c05b156835e8b49086d11fdd1b3e2965be16baa55204167aa9bf536a4d9",location:"",comment:"Parity Bootnode"},{ip:"40.68.248.100",port:30303,id:"0518a3d35d4a7b3e8c433e7ffd2355d84a1304ceb5ef349787b556197f0c87fad09daed760635b97d52179d645d3e6d16a37d2cc0a9945c2ddf585684beb39ac",location:"",comment:"Parity Bootnode"}]}},function(e){e.exports={name:"goerli",chainId:6284,networkId:6284,comment:"Cross-client PoA test network",url:"https://github.com/goerli/testnet",genesis:{hash:"0xfa57319d09fd8a32faaf18d338c8a925a5a7975285bf29ecd024e083cba8abb1",timestamp:"0x5bdda800",gasLimit:10485760,difficulty:1,nonce:"0x0000000000000000",extraData:"0x2249276d20646f6e652077616974696e672e2e2e20666f7220626c6f636b2066696e616c69747922202d2049676779270000000001fa1804c408085d9c57eeb167ce953c99b6cb1e20794Fd02933F303FbA550bd1fe2f0649E3576eB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",stateRoot:"0x0f410b6a6eae3d3156eccd966ac842a4c545c47921b9fe36386de18152cfddcf"},hardforks:[{name:"chainstart",block:0,consensus:"poa",finality:null},{name:"homestead",block:0,consensus:"poa",finality:null},{name:"dao",block:null,consensus:"poa",finality:null},{name:"tangerineWhistle",block:0,consensus:"poa",finality:null},{name:"spuriousDragon",block:0,consensus:"poa",finality:null},{name:"byzantium",block:0,consensus:"poa",finality:null},{name:"constantinople",block:0,consensus:"poa",finality:null},{name:"hybridCasper",block:null,consensus:"poa",finality:"pos"}],bootstrapNodes:[{ip:"40.70.214.166",port:40303,id:"04fb7acb86f47b64298374b5ccb3c2959f1e5e9362158e50e0793c261518ffe83759d8295ca4a88091d4726d5f85e6276d53ae9ef4f35b8c4c0cc6b99c8c0537",location:"",comment:""},{ip:"213.186.16.82",port:1345,id:"17de5580bbc1620081a21f82954731c7854305463630a0d677ed991487609829a6bf1ffcb8fb8ef269eff4829690625db176b498c629b9b13cb39b73b6e7b08b",location:"",comment:""},{ip:"85.7.110.224",port:30303,id:"22da3ef3707626a92a32b0527d0846f88228daa0536c62d83c9ac7e96660bc8e4ac70a9aa8f8cedf71b580cd41449ad46c6e5a06ecf138b142f38a9d1b2b856a",location:"",comment:""},{ip:"54.88.169.219",port:30303,id:"3897b1a5786948f643d9755df92dc56d0b2284f36730dc198ef371aebf191b24b5cbe8162c2032b09b2f14ba73460bfc3f7d4ef1e26bcc59297d4f235dc5cdc5",location:"",comment:""},{ip:"40.70.214.166",port:30405,id:"3d197d65ed92af6d0adf280ce486714fb641ef9f9f38f0bdd5ddd552666fc1132f033eb249a87f7f30086902c131f30f054f872ae80ac83eea6bd3760a7bbce2",location:"",comment:""},{ip:"188.166.20.30",port:30303,id:"3d8d6698d2d4d730d896c7c1e3602ff845343f71bacbf8cb614b0e94fcb3b10e1a49ac2a5063c76617182a1c5928a4a63d4be897e54ae1cb858a1b94d0d275b8",location:"",comment:""},{ip:"94.237.54.114",port:30313,id:"46add44b9f13965f7b9875ac6b85f016f341012d84f975377573800a863526f4da19ae2c620ec73d11591fa9510e992ecc03ad0751f53cc02f7c7ed6d55c7291",location:"",comment:""},{ip:"13.113.211.0",port:30303,id:"5065d5221b507764771a8b74abc69df0351217eae09b96ec0df4275576a8b2bbba9986ce3037e6fb3c933b5b301364e18030c1ada8cec4ae00f1fa4dfff32eb8",location:"",comment:""},{ip:"52.56.136.200",port:30303,id:"573b6607cd59f241e30e4c4943fd50e99e2b6f42f9bd5ca111659d309c06741247f4f1e93843ad3e8c8c18b6e2d94c161b7ef67479b3938780a97134b618b5ce",location:"",comment:""},{ip:"213.186.16.82",port:30303,id:"57f58f16fccdd9fb6f587565ac09af4b3b4b33d0fbd14252cc61d29a65b0d83c08419e67ac5292b9342090053526b847f2487278e609f4b4cd1dbf0f48105b2b",location:"",comment:""},{ip:"13.78.10.94",port:30405,id:"5d9b1cba03738dfd23e12e4efb99b72623474fece2cc582c95e3ba7d481d519dea0029901f1f844116bab806044e8552f0431b21cf8d96010fc351b483330faa",location:"",comment:""}]}},function(e,t,r){const n=[["chainstart",r(958)],["homestead",r(959)],["dao",r(960)],["tangerineWhistle",r(961)],["spuriousDragon",r(962)],["byzantium",r(963)],["constantinople",r(964)],["hybridCasper",r(965)]];e.exports=n},function(e){e.exports={name:"chainstart",comment:"Start of the Ethereum main chain",eip:{url:"",status:""},status:"",gasConfig:{minGasLimit:{v:5e3,d:"Minimum the gas limit may ever be"},gasLimitBoundDivisor:{v:1024,d:"The bound divisor of the gas limit, used in update calculations"}},gasPrices:{tierStep:{v:[0,2,3,5,8,10,20],d:"Once per operation, for a selection of them"},exp:{v:10,d:"Once per EXP instuction"},expByte:{v:10,d:"Times ceil(log256(exponent)) for the EXP instruction"},sha3:{v:30,d:"Once per SHA3 operation"},sha3Word:{v:6,d:"Once per word of the SHA3 operation's data"},sload:{v:50,d:"Once per SLOAD operation"},sstoreSet:{v:2e4,d:"Once per SSTORE operation if the zeroness changes from zero"},sstoreReset:{v:5e3,d:"Once per SSTORE operation if the zeroness does not change from zero"},sstoreRefund:{v:15e3,d:"Once per SSTORE operation if the zeroness changes to zero"},jumpdest:{v:1,d:"Refunded gas, once per SSTORE operation if the zeroness changes to zero"},log:{v:375,d:"Per LOG* operation"},logData:{v:8,d:"Per byte in a LOG* operation's data"},logTopic:{v:375,d:"Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas"},create:{v:32e3,d:"Once per CREATE operation & contract-creation transaction"},call:{v:40,d:"Once per CALL operation & message call transaction"},callStipend:{v:2300,d:"Free gas given at beginning of call"},callValueTransfer:{v:9e3,d:"Paid for CALL when the value transfor is non-zero"},callNewAccount:{v:25e3,d:"Paid for CALL when the destination address didn't exist prior"},selfdestructRefund:{v:24e3,d:"Refunded following a selfdestruct operation"},memory:{v:3,d:"Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL"},quadCoeffDiv:{v:512,d:"Divisor for the quadratic particle of the memory cost equation"},createData:{v:200,d:""},tx:{v:21e3,d:"Per transaction. NOTE: Not payable on data of calls between transactions"},txCreation:{v:32e3,d:"The cost of creating a contract via tx"},txDataZero:{v:4,d:"Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions"},txDataNonZero:{v:68,d:"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions"},copy:{v:3,d:"Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added"},ecRecover:{v:3e3,d:""},sha256:{v:60,d:""},sha256Word:{v:12,d:""},ripemd160:{v:600,d:""},ripemd160Word:{v:120,d:""},identity:{v:15,d:""},identityWord:{v:3,d:""}},vm:{stackLimit:{v:1024,d:"Maximum size of VM stack allowed"},callCreateDepth:{v:1024,d:"Maximum depth of call/create stack"},maxExtraDataSize:{v:32,d:"Maximum size extra data may be after Genesis"}},pow:{minimumDifficulty:{v:131072,d:"The minimum that the difficulty may ever be"},difficultyBoundDivisor:{v:2048,d:"The bound divisor of the difficulty, used in the update calculations"},durationLimit:{v:13,d:"The decision boundary on the blocktime duration used to determine whether difficulty should go up or not"},epochDuration:{v:3e4,d:"Duration between proof-of-work epochs"},timebombPeriod:{v:1e5,d:"Exponential difficulty timebomb period"},minerReward:{v:"5000000000000000000",d:"the amount a miner get rewarded for mining a block"}},casper:{},sharding:{}}},function(e){e.exports={name:"homestead",comment:"Homestead hardfork with protocol and network changes",eip:{url:"https://eips.ethereum.org/EIPS/eip-606",status:"Final"},gasConfig:{},gasPrices:{},vm:{},pow:{},casper:{},sharding:{}}},function(e){e.exports={name:"dao",comment:"DAO rescue hardfork",eip:{url:"https://eips.ethereum.org/EIPS/eip-779",status:"Final"},gasConfig:{},gasPrices:{},vm:{},pow:{},casper:{},sharding:{}}},function(e){e.exports={name:"tangerineWhistle",comment:"Hardfork with gas cost changes for IO-heavy operations",eip:{url:"https://eips.ethereum.org/EIPS/eip-608",status:"Final"},gasConfig:{},gasPrices:{sload:{v:200,d:"Once per SLOAD operation"},call:{v:700,d:"Once per CALL operation & message call transaction"}},vm:{},pow:{},casper:{},sharding:{}}},function(e){e.exports={name:"spuriousDragon",comment:"HF with EIPs for simple replay attack protection, EXP cost increase, state trie clearing, contract code size limit",eip:{url:"https://eips.ethereum.org/EIPS/eip-607",status:"Final"},gasConfig:{},gasPrices:{expByte:{v:50,d:"Times ceil(log256(exponent)) for the EXP instruction"}},vm:{maxCodeSize:{v:24576,d:"Maximum length of contract code"}},pow:{},casper:{},sharding:{}}},function(e){e.exports={name:"byzantium",comment:"Hardfork with new precompiles, instructions and other protocol changes",eip:{url:"https://eips.ethereum.org/EIPS/eip-609",status:"Final"},gasConfig:{},gasPrices:{modexpGquaddivisor:{v:20,d:"Gquaddivisor from modexp precompile for gas calculation"},ecAdd:{v:500,d:"Gas costs for curve addition precompile"},ecMul:{v:4e4,d:"Gas costs for curve multiplication precompile"},ecPairing:{v:1e5,d:"Base gas costs for curve pairing precompile"},ecPairingWord:{v:8e4,d:"Gas costs regarding curve pairing precompile input length"}},vm:{},pow:{minerReward:{v:"3000000000000000000",d:"the amount a miner get rewarded for mining a block"}},casper:{},sharding:{}}},function(e){e.exports={name:"constantinople",comment:"Hardfork with new instructions and protocol changes",eip:{url:"https://eips.ethereum.org/EIPS/eip-1013",status:"Draft"},gasConfig:{},gasPrices:{netSstoreNoopGas:{v:200,d:"Once per SSTORE operation if the value doesn't change"},netSstoreInitGas:{v:2e4,d:"Once per SSTORE operation from clean zero"},netSstoreCleanGas:{v:5e3,d:"Once per SSTORE operation from clean non-zero"},netSstoreDirtyGas:{v:200,d:"Once per SSTORE operation from dirty"},netSstoreClearRefund:{v:15e3,d:"Once per SSTORE operation for clearing an originally existing storage slot"},netSstoreResetRefund:{v:4800,d:"Once per SSTORE operation for resetting to the original non-zero value"},netSstoreResetClearRefund:{v:19800,d:"Once per SSTORE operation for resetting to the original zero value"}},vm:{},pow:{minerReward:{v:"2000000000000000000",d:"The amount a miner gets rewarded for mining a block"}},casper:{},sharding:{}}},function(e){e.exports={name:"hybridCasper",comment:"Future hardfork to move to hybrid proof-of-stake",eip:{url:"https://eips.ethereum.org/EIPS/eip-1011",status:"Draft"},gasConfig:{},gasPrices:{},vm:{},pow:{minerReward:{v:"600000000000000000",d:"the amount a miner get rewarded for mining a block"}},casper:{casperBalance:{v:"1000000000000000000000000",d:"Balance of the Casper contract, 1e24 wei"},epochLength:{v:50,d:"Number of blocks between epochs"},withdrawalDelay:{v:15e3,d:"Number of epochs a withdrawal of deposited funds is delayed"},dynastyLogoutDelay:{v:700,d:"Number of dynasties a logout is delayed"},baseInterestFactor:{v:.007,d:"Base interest factor for validator earnings, 7e-3"},basePenaltyFactor:{v:2e-7,d:"Base penalty factor for validators getting offline, 2e-7"},minDepositSize:{v:"1500000000000000000000",d:"Minimum size of a deposit, 1.5e21 wei"}},sharding:{}}},function(e,t,r){"use strict";const n=r(6),i=r(43),o=r(205),s=r(166),a=r(479),u=r(33),c=r(167),f=r(478).resolver,l=r(168),h=l("eth-block-list",void 0,p),d=h.util;function p(e,t,r){let n=[];n.push({path:"count",value:e.length}),i(e,(t,r)=>{const i=e.indexOf(t),o=i.toString();n.push({path:o,value:t}),f._mapFromEthObject(t,{},(e,t)=>{if(e)return r(e);t.forEach(e=>e.path=o+"/"+e.path),n=n.concat(t),r()})},e=>{if(e)return r(e);r(null,n)})}d.serialize=o(e=>{const t=e.map(e=>e.raw);return s.encode(t)}),d.deserialize=o(e=>{const t=s.decode(e);return t.map(e=>new a(e))}),d.cid=((e,t,r)=>{"function"==typeof t&&(r=t,t={}),t=t||{};const i=t.hashAlg||"keccak-256",s=void 0===t.version?1:t.version;n([t=>d.serialize(e,t),(e,t)=>u.digest(e,i,t),o(e=>c("eth-block-list",e,t))],r)}),e.exports=h},function(e,t,r){"use strict";const n=r(472),i=r(303),o=i("eth-state-trie",n);e.exports=o},function(e,t,r){(function(t){const n=r(166),i=r(223);function o(e,t,r){if(Array.isArray(e))this.parseNode(e);else if(this.type=e,"branch"===e){var n=t;this.raw=Array.apply(null,Array(17)),n&&n.forEach(function(e){this.set.apply(this,e)})}else this.raw=Array(2),this.setValue(r),this.setKey(t)}function s(e,t){return e.length%2?e.unshift(1):(e.unshift(0),e.unshift(0)),t&&(e[0]+=2),e}function a(e){return e=e[0]%2?e.slice(1):e.slice(2),e}function u(e){return e[0]>1}function c(e){for(var r=new t(e),n=[],i=0;i>4,++o,n[o]=r[i]%16}return n}function f(e){for(var r=new t(e.length/2),n=0;n0){var n=this.raw.slice();this.v=this._chainId,this.r=0,this.s=0,r=this.raw,this.raw=n}else r=this.raw.slice(0,6);return i.rlphash(r)},e.prototype.getChainId=function e(){return this._chainId},e.prototype.getSenderAddress=function e(){if(this._from)return this._from;var t=this.getSenderPublicKey();return this._from=i.publicToAddress(t),this._from},e.prototype.getSenderPublicKey=function e(){if(!(this._senderPubKey&&this._senderPubKey.length||this.verifySignature()))throw new Error("Invalid Signature");return this._senderPubKey},e.prototype.verifySignature=function e(){var t=this.hash(!1);if(this._homestead&&1===new s(this.s).cmp(a))return!1;try{var r=i.bufferToInt(this.v);this._chainId>0&&(r-=2*this._chainId+8),this._senderPubKey=i.ecrecover(t,r,this.r,this.s)}catch(e){return!1}return!!this._senderPubKey},e.prototype.sign=function e(t){var r=this.hash(!1),n=i.ecsign(r,t);this._chainId>0&&(n.v+=2*this._chainId+8),Object.assign(this,n)},e.prototype.getDataFee=function e(){for(var t=this.raw[5],r=new s(0),n=0;n0&&r.push(["gas limit is too low. Need at least "+this.getBaseFee()]),void 0===t||!1===t?0===r.length:r.join(" ")},e}();e.exports=u}).call(this,r(0).Buffer)},function(e){e.exports={genesisGasLimit:{v:5e3,d:"Gas limit of the Genesis block."},genesisDifficulty:{v:17179869184,d:"Difficulty of the Genesis block."},genesisNonce:{v:"0x0000000000000042",d:"the geneis nonce"},genesisExtraData:{v:"0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",d:"extra data "},genesisHash:{v:"0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",d:"genesis hash"},genesisStateRoot:{v:"0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544",d:"the genesis state root"},minGasLimit:{v:5e3,d:"Minimum the gas limit may ever be."},gasLimitBoundDivisor:{v:1024,d:"The bound divisor of the gas limit, used in update calculations."},minimumDifficulty:{v:131072,d:"The minimum that the difficulty may ever be."},difficultyBoundDivisor:{v:2048,d:"The bound divisor of the difficulty, used in the update calculations."},durationLimit:{v:13,d:"The decision boundary on the blocktime duration used to determine whether difficulty should go up or not."},maximumExtraDataSize:{v:32,d:"Maximum size extra data may be after Genesis."},epochDuration:{v:3e4,d:"Duration between proof-of-work epochs."},stackLimit:{v:1024,d:"Maximum size of VM stack allowed."},callCreateDepth:{v:1024,d:"Maximum depth of call/create stack."},tierStepGas:{v:[0,2,3,5,8,10,20],d:"Once per operation, for a selection of them."},expGas:{v:10,d:"Once per EXP instuction."},expByteGas:{v:10,d:"Times ceil(log256(exponent)) for the EXP instruction."},sha3Gas:{v:30,d:"Once per SHA3 operation."},sha3WordGas:{v:6,d:"Once per word of the SHA3 operation's data."},sloadGas:{v:50,d:"Once per SLOAD operation."},sstoreSetGas:{v:2e4,d:"Once per SSTORE operation if the zeroness changes from zero."},sstoreResetGas:{v:5e3,d:"Once per SSTORE operation if the zeroness does not change from zero."},sstoreRefundGas:{v:15e3,d:"Once per SSTORE operation if the zeroness changes to zero."},jumpdestGas:{v:1,d:"Refunded gas, once per SSTORE operation if the zeroness changes to zero."},logGas:{v:375,d:"Per LOG* operation."},logDataGas:{v:8,d:"Per byte in a LOG* operation's data."},logTopicGas:{v:375,d:"Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas."},createGas:{v:32e3,d:"Once per CREATE operation & contract-creation transaction."},callGas:{v:40,d:"Once per CALL operation & message call transaction."},callStipend:{v:2300,d:"Free gas given at beginning of call."},callValueTransferGas:{v:9e3,d:"Paid for CALL when the value transfor is non-zero."},callNewAccountGas:{v:25e3,d:"Paid for CALL when the destination address didn't exist prior."},suicideRefundGas:{v:24e3,d:"Refunded following a suicide operation."},memoryGas:{v:3,d:"Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL."},quadCoeffDiv:{v:512,d:"Divisor for the quadratic particle of the memory cost equation."},createDataGas:{v:200,d:""},txGas:{v:21e3,d:"Per transaction. NOTE: Not payable on data of calls between transactions."},txCreation:{v:32e3,d:"the cost of creating a contract via tx"},txDataZeroGas:{v:4,d:"Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions."},txDataNonZeroGas:{v:68,d:"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions."},copyGas:{v:3,d:"Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added."},ecrecoverGas:{v:3e3,d:""},sha256Gas:{v:60,d:""},sha256WordGas:{v:12,d:""},ripemd160Gas:{v:600,d:""},ripemd160WordGas:{v:120,d:""},identityGas:{v:15,d:""},identityWordGas:{v:3,d:""},minerReward:{v:"5000000000000000000",d:"the amount a miner get rewarded for mining a block"},ommerReward:{v:"625000000000000000",d:"The amount of wei a miner of an uncle block gets for being inculded in the blockchain"},niblingReward:{v:"156250000000000000",d:"the amount a miner gets for inculding a uncle"},homeSteadForkNumber:{v:115e4,d:"the block that the Homestead fork started at"},homesteadRepriceForkNumber:{v:2463e3,d:"the block that the Homestead Reprice (EIP150) fork started at"},timebombPeriod:{v:1e5,d:"Exponential difficulty timebomb period"},freeBlockPeriod:{v:2}}},function(e,t,r){"use strict";const n=r(480),i=r(303),o=i("eth-tx-trie",n);e.exports=o},function(e,t,r){"use strict";const n=r(9),i=r(33);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){"use strict";t.resolver=r(304),t.util=r(481)},function(e,t,r){"use strict";(function(t,n){var i=e.exports;i.version="v"+r(977).version,i.versionGuard=function(e){if(void 0!==e)var t="More than one instance of zcash-bitcore-lib found. Please make sure to require zcash-bitcore-lib and check that submodules do not also include their own zcash-bitcore-lib dependency."},i.versionGuard(t._bitcore),t._bitcore=i.version,i.crypto={},i.crypto.BN=r(39),i.crypto.ECDSA=r(482),i.crypto.Hash=r(45),i.crypto.Random=r(228),i.crypto.Point=r(133),i.crypto.Signature=r(66),i.encoding={},i.encoding.Base58=r(226),i.encoding.Base58Check=r(169),i.encoding.BufferReader=r(95),i.encoding.BufferWriter=r(61),i.encoding.Varint=r(1005),i.util={},i.util.buffer=r(25),i.util.js=r(34),i.util.preconditions=r(21),i.errors=r(65),i.Address=r(118),i.Block=r(1006),i.MerkleBlock=r(486),i.BlockHeader=r(229),i.HDPrivateKey=r(487),i.HDPublicKey=r(488),i.Networks=r(117),i.Opcode=r(305),i.PrivateKey=r(225),i.PublicKey=r(76),i.Script=r(67),i.Transaction=r(227),i.URI=r(1008),i.Unit=r(308),i.deps={},i.deps.bnjs=r(83),i.deps.bs58=r(483),i.deps.Buffer=n,i.deps.elliptic=r(75),i.deps._=r(15),i._HDKeyCache=r(309),i.Transaction.sighash=r(96)}).call(this,r(10),r(0).Buffer)},function(e){e.exports={_from:"zcash-bitcore-lib@~0.13.20-rc3",_id:"zcash-bitcore-lib@0.13.20-rc3",_inBundle:!1,_integrity:"sha1-gToPVtz4t2vBQplRvqbRI2xQcAg=",_location:"/zcash-bitcore-lib",_phantomChildren:{},_requested:{type:"range",registry:!0,raw:"zcash-bitcore-lib@~0.13.20-rc3",name:"zcash-bitcore-lib",escapedName:"zcash-bitcore-lib",rawSpec:"~0.13.20-rc3",saveSpec:null,fetchSpec:"~0.13.20-rc3"},_requiredBy:["/ipld-zcash"],_resolved:"https://registry.npmjs.org/zcash-bitcore-lib/-/zcash-bitcore-lib-0.13.20-rc3.tgz",_shasum:"813a0f56dcf8b76bc1429951bea6d1236c507008",_shrinkwrap:{name:"bitcore",version:"0.13.19",dependencies:{"bn.js":{version:"2.0.4",from:"bn.js@=2.0.4",resolved:"https://registry.npmjs.org/bn.js/-/bn.js-2.0.4.tgz"},bs58:{version:"2.0.0",from:"bs58@=2.0.0",resolved:"https://registry.npmjs.org/bs58/-/bs58-2.0.0.tgz"},"buffer-compare":{version:"1.0.0",from:"buffer-compare@=1.0.0",resolved:"https://registry.npmjs.org/buffer-compare/-/buffer-compare-1.0.0.tgz"},elliptic:{version:"3.0.3",from:"elliptic@=3.0.3",resolved:"https://registry.npmjs.org/elliptic/-/elliptic-3.0.3.tgz",dependencies:{brorand:{version:"1.0.5",from:"brorand@^1.0.1",resolved:"https://registry.npmjs.org/brorand/-/brorand-1.0.5.tgz"},"hash.js":{version:"1.0.3",from:"hash.js@=1.0.3",resolved:"https://registry.npmjs.org/hash.js/-/hash.js-1.0.3.tgz"}}},inherits:{version:"2.0.1",from:"inherits@=2.0.1",resolved:"https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"},lodash:{version:"3.10.1",from:"lodash@=3.10.1",resolved:"https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz"}}},_spec:"zcash-bitcore-lib@~0.13.20-rc3",_where:"/Users/mitra/git/dweb-transports/node_modules/ipld-zcash",author:{name:"BitPay",email:"dev@bitpay.com"},browser:{request:"browser-request"},bugs:{url:"https://github.com/bitmex/zcash-bitcore-lib/issues"},bundleDependencies:!1,contributors:[{name:"Daniel Cousens",email:"bitcoin@dcousens.com"},{name:"Esteban Ordano",email:"eordano@gmail.com"},{name:"Gordon Hall",email:"gordon@bitpay.com"},{name:"Jeff Garzik",email:"jgarzik@bitpay.com"},{name:"Kyle Drake",email:"kyle@kyledrake.net"},{name:"Manuel Araoz",email:"manuelaraoz@gmail.com"},{name:"Matias Alejo Garcia",email:"ematiu@gmail.com"},{name:"Ryan X. Charles",email:"ryanxcharles@gmail.com"},{name:"Stefan Thomas",email:"moon@justmoon.net"},{name:"Stephen Pair",email:"stephen@bitpay.com"},{name:"Wei Lu",email:"luwei.here@gmail.com"},{name:"Jack Grigg",email:"jack@z.cash"}],dependencies:{"bn.js":"=2.0.4",bs58:"=2.0.0","buffer-compare":"=1.0.0",elliptic:"=3.0.3",inherits:"=2.0.1",lodash:"=3.10.1"},deprecated:!1,description:"A pure and powerful JavaScript Zcash library.",devDependencies:{brfs:"^1.2.0",chai:"^1.10.0",gulp:"^3.8.10",sinon:"^1.13.0","zcash-bitcore-build":"^0.5.4"},homepage:"https://github.com/bitmex/zcash-bitcore-lib#readme",keywords:["zcash","transaction","address","p2p","ecies","cryptocurrency","blockchain","payment","bip21","bip32","bip37","bip69","bip70","multisig"],license:"MIT",main:"index.js",name:"zcash-bitcore-lib",repository:{type:"git",url:"git+https://github.com/bitmex/zcash-bitcore-lib.git"},scripts:{build:"gulp",coverage:"gulp coverage",lint:"gulp lint",test:"gulp test"},version:"0.13.20-rc3"}},function(e,t,r){"use strict";var n="http://bitcore.io/";e.exports=[{name:"InvalidB58Char",message:"Invalid Base58 character: {0} in {1}"},{name:"InvalidB58Checksum",message:"Invalid Base58 checksum for {0}"},{name:"InvalidNetwork",message:"Invalid version for network: got {0}"},{name:"InvalidState",message:"Invalid state: {0}"},{name:"NotImplemented",message:"Function {0} was not implemented yet"},{name:"InvalidNetworkArgument",message:'Invalid network: must be "livenet" or "testnet", got {0}'},{name:"InvalidArgument",message:function(){return"Invalid Argument"+(arguments[0]?": "+arguments[0]:"")+(arguments[1]?" Documentation: "+n+arguments[1]:"")}},{name:"AbstractMethodInvoked",message:"Abstract Method Invocation: {0}"},{name:"InvalidArgumentType",message:function(){return"Invalid Argument for "+arguments[2]+", expected "+arguments[1]+" but got "+typeof arguments[0]}},{name:"Unit",message:"Internal Error on Unit {0}",errors:[{name:"UnknownCode",message:"Unrecognized unit code: {0}"},{name:"InvalidRate",message:"Invalid exchange rate: {0}"}]},{name:"Transaction",message:"Internal Error on Transaction {0}",errors:[{name:"Input",message:"Internal Error on Input {0}",errors:[{name:"MissingScript",message:"Need a script to create an input"},{name:"UnsupportedScript",message:"Unsupported input script type: {0}"},{name:"MissingPreviousOutput",message:"No previous output information."}]},{name:"NeedMoreInfo",message:"{0}"},{name:"InvalidSorting",message:"The sorting function provided did not return the change output as one of the array elements"},{name:"InvalidOutputAmountSum",message:"{0}"},{name:"MissingSignatures",message:"Some inputs have not been fully signed"},{name:"InvalidIndex",message:"Invalid index: {0} is not between 0, {1}"},{name:"UnableToVerifySignature",message:"Unable to verify signature: {0}"},{name:"DustOutputs",message:"Dust amount detected in one output"},{name:"InvalidSatoshis",message:"Output satoshis are invalid"},{name:"FeeError",message:"Internal Error on Fee {0}",errors:[{name:"TooSmall",message:"Fee is too small: {0}"},{name:"TooLarge",message:"Fee is too large: {0}"},{name:"Different",message:"Unspent value is different from specified fee: {0}"}]},{name:"ChangeAddressMissing",message:"Change address is missing"},{name:"BlockHeightTooHigh",message:"Block Height can be at most 2^32 -1"},{name:"NLockTimeOutOfRange",message:"Block Height can only be between 0 and 499 999 999"},{name:"LockTimeTooEarly",message:"Lock Time can't be earlier than UNIX date 500 000 000"}]},{name:"Script",message:"Internal Error on Script {0}",errors:[{name:"UnrecognizedAddress",message:"Expected argument {0} to be an address"},{name:"CantDeriveAddress",message:"Can't derive address associated with script {0}, needs to be p2pkh in, p2pkh out, p2sh in, or p2sh out."},{name:"InvalidBuffer",message:"Invalid script buffer: can't parse valid script from given buffer {0}"}]},{name:"HDPrivateKey",message:"Internal Error on HDPrivateKey {0}",errors:[{name:"InvalidDerivationArgument",message:"Invalid derivation argument {0}, expected string, or number and boolean"},{name:"InvalidEntropyArgument",message:"Invalid entropy: must be an hexa string or binary buffer, got {0}",errors:[{name:"TooMuchEntropy",message:'Invalid entropy: more than 512 bits is non standard, got "{0}"'},{name:"NotEnoughEntropy",message:'Invalid entropy: at least 128 bits needed, got "{0}"'}]},{name:"InvalidLength",message:"Invalid length for xprivkey string in {0}"},{name:"InvalidPath",message:"Invalid derivation path: {0}"},{name:"UnrecognizedArgument",message:'Invalid argument: creating a HDPrivateKey requires a string, buffer, json or object, got "{0}"'}]},{name:"HDPublicKey",message:"Internal Error on HDPublicKey {0}",errors:[{name:"ArgumentIsPrivateExtended",message:"Argument is an extended private key: {0}"},{name:"InvalidDerivationArgument",message:"Invalid derivation argument: got {0}"},{name:"InvalidLength",message:'Invalid length for xpubkey: got "{0}"'},{name:"InvalidPath",message:'Invalid derivation path, it should look like: "m/1/100", got "{0}"'},{name:"InvalidIndexCantDeriveHardened",message:"Invalid argument: creating a hardened path requires an HDPrivateKey"},{name:"MustSupplyArgument",message:"Must supply an argument to create a HDPublicKey"},{name:"UnrecognizedArgument",message:"Invalid argument for creation, must be string, json, buffer, or object"}]}]},function(e){e.exports={_from:"elliptic@=3.0.3",_id:"elliptic@3.0.3",_inBundle:!1,_integrity:"sha1-hlybQgv75VAGuflp+XoNLESWZZU=",_location:"/zcash-bitcore-lib/elliptic",_phantomChildren:{inherits:"2.0.1"},_requested:{type:"version",registry:!0,raw:"elliptic@3.0.3",name:"elliptic",escapedName:"elliptic",rawSpec:"3.0.3",saveSpec:null,fetchSpec:"3.0.3"},_requiredBy:["/zcash-bitcore-lib"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-3.0.3.tgz",_shasum:"865c9b420bfbe55006b9f969f97a0d2c44966595",_spec:"elliptic@3.0.3",_where:"/Users/mitra/git/dweb-transports/node_modules/zcash-bitcore-lib",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},bundleDependencies:!1,dependencies:{"bn.js":"^2.0.0",brorand:"^1.0.1","hash.js":"^1.0.0",inherits:"^2.0.1"},deprecated:!1,description:"EC cryptography",devDependencies:{browserify:"^3.44.2",jscs:"^1.11.3",jshint:"^2.6.0",mocha:"^2.1.0","uglify-js":"^2.4.13"},homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{test:"make lint && mocha --reporter=spec test/*-test.js"},version:"3.0.3"}},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=0;){var o;if(i.isOdd()){var s=i.andln(n-1);o=s>(n>>1)-1?(n>>1)-s:s,i.isubn(o)}else o=0;r.push(o);for(var a=0!==i.cmpn(0)&&0===i.andln(n-1)?t+1:1,u=1;u0||t.cmpn(-i)>0;){var o=e.andln(3)+n&3,s=t.andln(3)+i&3,a,u;if(3===o&&(o=-1),3===s&&(s=-1),0==(1&o))a=0;else{var c=e.andln(7)+n&7;a=3!==c&&5!==c||2!==s?o:-o}if(r[0].push(a),0==(1&s))u=0;else{var c=t.andln(7)+i&7;u=3!==c&&5!==c||2!==o?s:-s}r[1].push(u),2*n===a+1&&(n=1-n),2*i===u+1&&(i=1-i),e.ishrn(1),t.ishrn(1)}return r}n.assert=function e(t,r){if(!t)throw new Error(r||"Assertion failed")},n.toArray=i,n.zero2=o,n.toHex=s,n.encode=function e(t,r){return"hex"===r?s(t):t},n.getNAF=a,n.getJSF=u},function(e,t,r){var n;function i(e){this.rand=e}if(e.exports=function e(t){return n||(n=new i(null)),n.generate(t)},e.exports.Rand=i,i.prototype.generate=function e(t){return this._rand(t)},"object"==typeof window)window.crypto&&window.crypto.getRandomValues?i.prototype._rand=function e(t){var r=new Uint8Array(t);return window.crypto.getRandomValues(r),r}:window.msCrypto&&window.msCrypto.getRandomValues?i.prototype._rand=function e(t){var r=new Uint8Array(t);return window.msCrypto.getRandomValues(r),r}:i.prototype._rand=function(){throw new Error("Not implemented yet")};else try{var o=r(116);i.prototype._rand=function e(t){return o.randomBytes(t)}}catch(e){i.prototype._rand=function e(t){for(var r=new Uint8Array(t),n=0;n=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}e.exports=a,a.prototype._init=function e(t,r,n){var i=t.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this.reseed=1},a.prototype.generate=function e(t,r,n,i){if(this.reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof r&&(i=n,n=r,r=null),n&&(n=o.toArray(n,i),this._update(n));for(var s=[];s.length>8,s=255&i;o?r.push(o,s):r.push(s)}else for(var n=0;n>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24;return t>>>0}function u(e,t){for(var r="",n=0;n>>0}return o}function h(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 d(e,t){return e>>>t|e<<32-t}function p(e,t){return e<>>32-t}function y(e,t){return e+t>>>0}function g(e,t,r){return e+t+r>>>0}function m(e,t,r,n){return e+t+r+n>>>0}function b(e,t,r,n,i){return e+t+r+n+i>>>0}function v(e,t){if(!e)throw new Error(t||"Assertion failed")}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 A(e,t,r,n,i,o,s,a,u,c){var f=0,l=t;l=l+n>>>0,f+=l>>0,f+=l>>0,f+=l>>0,f+=l>>0}function x(e,t,r,n,i,o,s,a,u,c){var f=t+n+o+a+c;return f>>>0}function C(e,t,r){var n=t<<32-r|e>>>r;return n>>>0}function T(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}function I(e,t,r){return e>>>r}function B(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}n.toArray=o,n.toHex=s,n.htonl=a,n.toHex32=u,n.zero2=c,n.zero8=f,n.join32=l,n.split32=h,n.rotr32=d,n.rotl32=p,n.sum32=y,n.sum32_3=g,n.sum32_4=m,n.sum32_5=b,n.assert=v,n.inherits=i,t.sum64=_,t.sum64_hi=w,t.sum64_lo=S,t.sum64_4_hi=E,t.sum64_4_lo=k,t.sum64_5_hi=A,t.sum64_5_lo=x,t.rotr64_hi=C,t.rotr64_lo=T,t.shr64_hi=I,t.shr64_lo=B},function(e,t,r){var n=r(134),i=n.utils,o=i.assert;function s(){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=s,s.prototype.update=function e(t,r){if(t=i.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 n=t.length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=i.join32(t,0,t.length-n,this.endian);for(var o=0;o>>24&255,i[o++]=t>>>16&255,i[o++]=t>>>8&255,i[o++]=255&t}else{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;for(var s=8;s>>3}function M(e){return s(e,17)^s(e,19)^e>>>10}function D(e,t,r,n){return 0===e?O(t,r,n):1===e||3===e?R(t,r,n):2===e?P(t,r,n):void 0}function U(e,t,r,n,i,o){var s=e&r^~e&i;return s<0&&(s+=4294967296),s}function F(e,t,r,n,i,o){var s=t&n^~t&o;return s<0&&(s+=4294967296),s}function K(e,t,r,n,i,o){var s=e&r^e&i^r&i;return s<0&&(s+=4294967296),s}function q(e,t,r,n,i,o){var s=t&n^t&o^n&o;return s<0&&(s+=4294967296),s}function H(e,t){var r=l(e,t,28),n=l(t,e,2),i=l(t,e,7),o=r^n^i;return o<0&&(o+=4294967296),o}function z(e,t){var r=h(e,t,28),n=h(t,e,2),i=h(t,e,7),o=r^n^i;return o<0&&(o+=4294967296),o}function V(e,t){var r=l(e,t,14),n=l(e,t,18),i=l(t,e,9),o=r^n^i;return o<0&&(o+=4294967296),o}function G(e,t){var r=h(e,t,14),n=h(e,t,18),i=h(t,e,9),o=r^n^i;return o<0&&(o+=4294967296),o}function W(e,t){var r=l(e,t,1),n=l(e,t,8),i=d(e,t,7),o=r^n^i;return o<0&&(o+=4294967296),o}function $(e,t){var r=h(e,t,1),n=h(e,t,8),i=p(e,t,7),o=r^n^i;return o<0&&(o+=4294967296),o}function Y(e,t){var r=l(e,t,19),n=l(t,e,29),i=d(e,t,6),o=r^n^i;return o<0&&(o+=4294967296),o}function J(e,t){var r=h(e,t,19),n=h(t,e,29),i=p(e,t,6),o=r^n^i;return o<0&&(o+=4294967296),o}i.inherits(x,S),t.sha256=x,x.blockSize=512,x.outSize=256,x.hmacStrength=192,x.padLength=64,x.prototype._update=function e(t,r){for(var n=this.W,i=0;i<16;i++)n[i]=t[r+i];for(;ithis.blockSize&&(t=(new this.Hash).update(t).digest()),s(t.length<=this.blockSize);for(var r=t.length;r=u;r--)c=(c<<1)+i[r];a.push(c)}for(var f=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=s;h>0;h--){for(var u=0;u=0;f--){for(var r=0;f>=0&&0===u[f];f--)r++;if(f>=0&&r++,c=c.dblp(r),f<0)break;var l=u[f];a(0!==l),c="affine"===t.type?l>0?c.mixedAdd(s[l-1>>1]):c.mixedAdd(s[-l-1>>1].neg()):l>0?c.add(s[l-1>>1]):c.add(s[-l-1>>1].neg())}return"affine"===t.type?c.toP():c},u.prototype._wnafMulAdd=function e(t,r,n,i){for(var a=this._wnafT1,u=this._wnafT2,c=this._wnafT3,f=0,l=0;l=1;l-=2){var p=l-1,y=l;if(1===a[p]&&1===a[y]){var g=[r[p],null,null,r[y]];0===r[p].y.cmp(r[y].y)?(g[1]=r[p].add(r[y]),g[2]=r[p].toJ().mixedAdd(r[y].neg())):0===r[p].y.cmp(r[y].y.redNeg())?(g[1]=r[p].toJ().mixedAdd(r[y]),g[2]=r[p].add(r[y].neg())):(g[1]=r[p].toJ().mixedAdd(r[y]),g[2]=r[p].toJ().mixedAdd(r[y].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],b=s(n[p],n[y]);f=Math.max(b[0].length,f),c[p]=new Array(f),c[y]=new Array(f);for(var v=0;v=0;l--){for(var k=0;l>=0;){for(var A=!0,v=0;v=0&&k++,S=S.dblp(k),l<0)break;for(var v=0;v0?h=u[v][x-1>>1]:x<0&&(h=u[v][-x-1>>1].neg()),S="affine"===h.type?S.mixedAdd(h):S.add(h))}}for(var l=0;l=0&&(p=f,y=l),h.sign&&(h=h.neg(),d=d.neg()),p.sign&&(p=p.neg(),y=y.neg()),[{a:h,b:d},{a:p,b:y}]},c.prototype._endoSplit=function e(t){var r=this.endo.basis,n=r[0],i=r[1],o=i.b.mul(t).divRound(this.n),s=n.b.neg().mul(t).divRound(this.n),a=o.mul(n.a),u=s.mul(i.a),c=o.mul(n.b),f=s.mul(i.b),l=t.sub(a).sub(u),h=c.add(f).neg();return{k1:l,k2:h}},c.prototype.pointFromX=function e(t,r){r=new o(r,16),r.red||(r=r.toRed(this.red));var n=r.redSqr().redMul(r).redIAdd(r.redMul(this.a)).redIAdd(this.b),i=n.redSqrt(),s=i.fromRed().isOdd();return(t&&!s||!t&&s)&&(i=i.redNeg()),this.point(r,i)},c.prototype.validate=function e(t){if(t.inf)return!0;var r=t.x,n=t.y,i=this.a.redMul(r),o=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return 0===n.redSqr().redISub(o).cmpn(0)},c.prototype._endoWnafMulAdd=function e(t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},f.prototype.isInfinity=function e(){return this.inf},f.prototype.add=function e(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var r=this.y.redSub(t.y);0!==r.cmpn(0)&&(r=r.redMul(this.x.redSub(t.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(t.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},f.prototype.dbl=function e(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=t.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),s=o.redSqr().redISub(this.x.redAdd(this.x)),a=o.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,a)},f.prototype.getX=function e(){return this.x.fromRed()},f.prototype.getY=function e(){return this.y.fromRed()},f.prototype.mul=function e(t){return t=new o(t,16),this.precomputed&&this.precomputed.doubles?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function e(t,r,n){var i=[this,r],o=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o):this.curve._wnafMulAdd(1,i,o,2)},f.prototype.eq=function e(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},f.prototype.neg=function e(t){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,i=function(e){return e.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},f.prototype.toJ=function e(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t},s(l,a.BasePoint),c.prototype.jpoint=function e(t,r,n){return new l(this,t,r,n)},l.prototype.toP=function e(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),r=t.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(t);return this.curve.point(n,i)},l.prototype.neg=function e(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function e(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var r=t.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),o=t.x.redMul(n),s=this.y.redMul(r.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),u=i.redSub(o),c=s.redSub(a);if(0===u.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=u.redSqr(),l=f.redMul(u),h=i.redMul(f),d=c.redSqr().redIAdd(l).redISub(h).redISub(h),p=c.redMul(h.redISub(d)).redISub(s.redMul(l)),y=this.z.redMul(t.z).redMul(u);return this.curve.jpoint(d,p,y)},l.prototype.mixedAdd=function e(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=t.x.redMul(r),o=this.y,s=t.y.redMul(r).redMul(this.z),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),f=c.redMul(a),l=n.redMul(c),h=u.redSqr().redIAdd(f).redISub(l).redISub(l),d=u.redMul(l.redISub(h)).redISub(o.redMul(f)),p=this.z.redMul(a);return this.curve.jpoint(h,d,p)},l.prototype.dblp=function e(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var r=this,n=0;n":""},l.prototype.isInfinity=function e(){return 0===this.z.cmpn(0)}},function(e,t,r){"use strict";var n=r(224),i=r(83),o=r(84),s=n.base;function a(e){s.call(this,"mont",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(e,t,r){s.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(t,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(a,s),e.exports=a,a.prototype.validate=function e(t){var r=t.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),o=i.redSqrt();return 0===o.redSqr().cmp(i)},o(u,s.BasePoint),a.prototype.point=function e(t,r){return new u(this,t,r)},a.prototype.pointFromJSON=function e(t){return u.fromJSON(this,t)},u.prototype.precompute=function e(){},u.fromJSON=function e(t,r){return new u(t,r[0],r[1]||t.one)},u.prototype.inspect=function e(){return this.isInfinity()?"":""},u.prototype.isInfinity=function e(){return 0===this.z.cmpn(0)},u.prototype.dbl=function e(){var t=this.x.redAdd(this.z),r=t.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),o=r.redSub(i),s=r.redMul(i),a=o.redMul(i.redAdd(this.curve.a24.redMul(o)));return this.curve.point(s,a)},u.prototype.add=function e(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function e(t,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),o=t.x.redAdd(t.z),s=t.x.redSub(t.z),a=s.redMul(n),u=o.redMul(i),c=r.z.redMul(a.redAdd(u).redSqr()),f=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(c,f)},u.prototype.mul=function e(t){for(var r=t.clone(),n=this,i=this.curve.point(null,null),o=this,s=[];0!==r.cmpn(0);r.ishrn(1))s.push(r.andln(1));for(var a=s.length-1;a>=0;a--)0===s[a]?(n=n.diffAdd(i,o),i=i.dbl()):(i=n.diffAdd(i,o),n=n.dbl());return i},u.prototype.mulAdd=function e(){throw new Error("Not supported on Montgomery curve")},u.prototype.normalize=function e(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function e(){return this.normalize(),this.x.fromRed()}},function(e,t,r){"use strict";var n=r(224),i=r(75),o=r(83),s=r(84),a=n.base,u=i.utils.assert;function c(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,a.call(this,"edwards",e),this.a=new o(e.a,16).mod(this.red.m).toRed(this.red),this.c=new o(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new o(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),u(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function f(e,t,r,n,i){a.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new o(t,16),this.y=new o(r,16),this.z=n?new o(n,16):this.curve.one,this.t=i&&new o(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}s(c,a),e.exports=c,c.prototype._mulA=function e(t){return this.mOneA?t.redNeg():this.a.redMul(t)},c.prototype._mulC=function e(t){return this.oneC?t:this.c.redMul(t)},c.prototype.jpoint=function e(t,r,n,i){return this.point(t,r,n,i)},c.prototype.pointFromX=function e(t,r){r=new o(r,16),r.red||(r=r.toRed(this.red));var i=r.redSqr(),s=this.c2.redSub(this.a.redMul(i)),a=this.one.redSub(this.c2.redMul(this.d).redMul(i)),u=s.redMul(a.redInvm()).redSqrt(),c=u.fromRed().isOdd();return(t&&!c||!t&&c)&&(u=u.redNeg()),this.point(r,u,n.one)},c.prototype.validate=function e(t){if(t.isInfinity())return!0;t.normalize();var r=t.x.redSqr(),n=t.y.redSqr(),i=r.redMul(this.a).redAdd(n),o=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return 0===i.cmp(o)},s(f,a.BasePoint),c.prototype.pointFromJSON=function e(t){return f.fromJSON(this,t)},c.prototype.point=function e(t,r,n,i){return new f(this,t,r,n,i)},f.fromJSON=function e(t,r){return new f(t,r[0],r[1],r[2])},f.prototype.inspect=function e(){return this.isInfinity()?"":""},f.prototype.isInfinity=function e(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},f.prototype._extDbl=function e(){var t=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(t),o=this.x.redAdd(this.y).redSqr().redISub(t).redISub(r),s=i.redAdd(r),a=s.redSub(n),u=i.redSub(r),c=o.redMul(a),f=s.redMul(u),l=o.redMul(u),h=a.redMul(s);return this.curve.point(c,f,h,l)},f.prototype._projDbl=function e(){var t=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,o,s;if(this.curve.twisted){var a=this.curve._mulA(r),u=a.redAdd(n);if(this.zOne)i=t.redSub(r).redSub(n).redMul(u.redSub(this.curve.two)),o=u.redMul(a.redSub(n)),s=u.redSqr().redSub(u).redSub(u);else{var c=this.z.redSqr(),f=u.redSub(c).redISub(c);i=t.redSub(r).redISub(n).redMul(f),o=u.redMul(a.redSub(n)),s=u.redMul(f)}}else{var a=r.redAdd(n),c=this.curve._mulC(this.c.redMul(this.z)).redSqr(),f=a.redSub(c).redSub(c);i=this.curve._mulC(t.redISub(a)).redMul(f),o=this.curve._mulC(a).redMul(r.redISub(n)),s=a.redMul(f)}return this.curve.point(i,o,s)},f.prototype.dbl=function e(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},f.prototype._extAdd=function e(t){var r=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),o=this.z.redMul(t.z.redAdd(t.z)),s=n.redSub(r),a=o.redSub(i),u=o.redAdd(i),c=n.redAdd(r),f=s.redMul(a),l=u.redMul(c),h=s.redMul(c),d=a.redMul(u);return this.curve.point(f,l,d,h)},f.prototype._projAdd=function e(t){var r=this.z.redMul(t.z),n=r.redSqr(),i=this.x.redMul(t.x),o=this.y.redMul(t.y),s=this.curve.d.redMul(i).redMul(o),a=n.redSub(s),u=n.redAdd(s),c=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(i).redISub(o),f=r.redMul(a).redMul(c),l,h;return this.curve.twisted?(l=r.redMul(u).redMul(o.redSub(this.curve._mulA(i))),h=a.redMul(u)):(l=r.redMul(u).redMul(o.redSub(i)),h=this.curve._mulC(a).redMul(u)),this.curve.point(f,l,h)},f.prototype.add=function e(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},f.prototype.mul=function e(t){return this.precomputed&&this.precomputed.doubles?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function e(t,r,n){return this.curve._wnafMulAdd(1,[this,r],[t,n],2)},f.prototype.normalize=function e(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},f.prototype.neg=function e(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},f.prototype.getX=function e(){return this.normalize(),this.x.fromRed()},f.prototype.getY=function e(){return this.normalize(),this.y.fromRed()},f.prototype.toP=f.prototype.normalize,f.prototype.mixedAdd=f.prototype.add},function(e,t,r){"use strict";var n=t,i=r(134),o=r(75),s=o.utils.assert,a;function u(e){"short"===e.type?this.curve=new o.curve.short(e):"edwards"===e.type?this.curve=new o.curve.edwards(e):this.curve=new o.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new u(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=u,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:i.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:i.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:i.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"0",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{a=r(993)}catch(e){a=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:i.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})},function(e,t){e.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},function(e,t,r){"use strict";var n=r(83),i=r(75),o=i.utils,s=o.assert,a=r(995),u=r(996);function c(e){if(!(this instanceof c))return new c(e);"string"==typeof e&&(s(i.curves.hasOwnProperty(e),"Unknown curve "+e),e=i.curves[e]),e instanceof i.curves.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.shrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=c,c.prototype.keyPair=function e(t){return new a(this,t)},c.prototype.keyFromPrivate=function e(t,r){return a.fromPrivate(this,t,r)},c.prototype.keyFromPublic=function e(t,r){return a.fromPublic(this,t,r)},c.prototype.genKeyPair=function e(t){t||(t={});for(var r=new i.hmacDRBG({hash:this.hash,pers:t.pers,entropy:t.entropy||i.rand(this.hash.hmacStrength),nonce:this.n.toArray()}),o=this.n.byteLength(),s=this.n.sub(new n(2));;){var a=new n(r.generate(o));if(!(a.cmp(s)>0))return a.iaddn(1),this.keyFromPrivate(a)}},c.prototype._truncateToN=function e(t,r){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.shrn(n)),!r&&t.cmp(this.n)>=0?t.sub(this.n):t},c.prototype.sign=function e(t,r,o,s){"object"==typeof o&&(s=o,o=null),s||(s={}),r=this.keyFromPrivate(r,o),t=this._truncateToN(new n(t,16));for(var a=this.n.byteLength(),c=r.getPrivate().toArray(),f=c.length;f<21;f++)c.unshift(0);for(var l=t.toArray(),f=l.length;f=0)){var y=this.g.mul(p);if(!y.isInfinity()){var g=y.getX().mod(this.n);if(0!==g.cmpn(0)){var m=p.invm(this.n).mul(g.mul(r.getPrivate()).iadd(t)).mod(this.n);if(0!==m.cmpn(0))return s.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m)),new u({r:g,s:m})}}}}},c.prototype.verify=function e(t,r,i,o){t=this._truncateToN(new n(t,16)),i=this.keyFromPublic(i,o),r=new u(r,"hex");var s=r.r,a=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var c=a.invm(this.n),f=c.mul(t).mod(this.n),l=c.mul(s).mod(this.n),h=this.g.mulAdd(f,i.getPublic(),l);return!h.isInfinity()&&0===h.getX().mod(this.n).cmp(s)}},function(e,t,r){"use strict";var n=r(83),i=r(75),o=i.utils;function s(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=s,s.fromPublic=function e(t,r,n){return r instanceof s?r:new s(t,{pub:r,pubEnc:n})},s.fromPrivate=function e(t,r,n){return r instanceof s?r:new s(t,{priv:r,privEnc:n})},s.prototype.validate=function e(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},s.prototype.getPublic=function e(t,r){if(this.pub||(this.pub=this.ec.g.mul(this.priv)),"string"==typeof t&&(r=t,t=null),!r)return this.pub;for(var n=this.ec.curve.p.byteLength(),i=this.pub.getX().toArray(),s=i.length,a;s"}},function(e,t,r){"use strict";var n=r(83),i=r(75),o=i.utils,s=o.assert;function a(e,t){if(e instanceof a)return e;this._importDER(e,t)||(s(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16))}e.exports=a,a.prototype._importDER=function e(t,r){if(t=o.toArray(t,r),t.length<6||48!==t[0]||2!==t[2])return!1;var i=t[1];if(1+i>t.length)return!1;var s=t[3];if(s>=128)return!1;if(4+s+2>=t.length)return!1;if(2!==t[4+s])return!1;var a=t[5+s];return!(a>=128)&&(!(4+s+2+a>t.length)&&(this.r=new n(t.slice(4,4+s)),this.s=new n(t.slice(4+s+2,4+s+2+a)),!0))},a.prototype.toDER=function e(t){var r=this.r.toArray(),n=this.s.toArray();128&r[0]&&(r=[0].concat(r)),128&n[0]&&(n=[0].concat(n));var i=r.length+n.length+4,s=[48,i,2,r.length];return s=s.concat(r,[2,n.length],n),o.encode(s,t)}},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(484),o=r(305),s=r(39),a=r(45),u=r(66),c=r(76),f=function e(t){if(!(this instanceof e))return new e(t);t?(this.initialize(),this.set(t)):this.initialize()};f.prototype.verify=function(e,t,o,s,a){var u=r(227),c;if(n.isUndefined(o)&&(o=new u),n.isUndefined(s)&&(s=0),n.isUndefined(a)&&(a=0),this.set({script:e,tx:o,nin:s,flags:a}),0!=(a&f.SCRIPT_VERIFY_SIGPUSHONLY)&&!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(!this.evaluate())return!1;a&f.SCRIPT_VERIFY_P2SH&&(c=this.stack.slice());var l=this.stack;if(this.initialize(),this.set({script:t,stack:l,tx:o,nin:s,flags:a}),!this.evaluate())return!1;if(0===this.stack.length)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_RESULT",!1;var h=this.stack[this.stack.length-1];if(!f.castToBool(h))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_STACK",!1;if(a&f.SCRIPT_VERIFY_P2SH&&t.isScriptHashOut()){if(!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(0===c.length)throw new Error("internal error - stack copy empty");var d=c[c.length-1],p=i.fromBuffer(d);return c.pop(),this.initialize(),this.set({script:p,stack:c,tx:o,nin:s,flags:a}),!!this.evaluate()&&(0===c.length?(this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK",!1):!!f.castToBool(c[c.length-1])||(this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK",!1))}return!0},e.exports=f,f.prototype.initialize=function(e){this.stack=[],this.altstack=[],this.pc=0,this.pbegincodehash=0,this.nOpCount=0,this.vfExec=[],this.errstr="",this.flags=0},f.prototype.set=function(e){this.script=e.script||this.script,this.tx=e.tx||this.tx,this.nin=void 0!==e.nin?e.nin:this.nin,this.stack=e.stack||this.stack,this.altstack=e.altack||this.altstack,this.pc=void 0!==e.pc?e.pc:this.pc,this.pbegincodehash=void 0!==e.pbegincodehash?e.pbegincodehash:this.pbegincodehash,this.nOpCount=void 0!==e.nOpCount?e.nOpCount:this.nOpCount,this.vfExec=e.vfExec||this.vfExec,this.errstr=e.errstr||this.errstr,this.flags=void 0!==e.flags?e.flags:this.flags},f.true=new t([1]),f.false=new t([]),f.MAX_SCRIPT_ELEMENT_SIZE=520,f.LOCKTIME_THRESHOLD=5e8,f.LOCKTIME_THRESHOLD_BN=new s(f.LOCKTIME_THRESHOLD),f.SCRIPT_VERIFY_NONE=0,f.SCRIPT_VERIFY_P2SH=1,f.SCRIPT_VERIFY_STRICTENC=2,f.SCRIPT_VERIFY_DERSIG=4,f.SCRIPT_VERIFY_LOW_S=8,f.SCRIPT_VERIFY_NULLDUMMY=16,f.SCRIPT_VERIFY_SIGPUSHONLY=32,f.SCRIPT_VERIFY_MINIMALDATA=64,f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS=128,f.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY=512,f.castToBool=function(e){for(var t=0;t1e4)return this.errstr="SCRIPT_ERR_SCRIPT_SIZE",!1;try{for(;this.pc1e3)return this.errstr="SCRIPT_ERR_STACK_SIZE",!1}catch(e){return this.errstr="SCRIPT_ERR_UNKNOWN_ERROR: "+e,!1}return!(this.vfExec.length>0)||(this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1)},f.prototype.checkLockTime=function(e){return!!(this.tx.nLockTime=f.LOCKTIME_THRESHOLD&&e.gte(f.LOCKTIME_THRESHOLD_BN))&&(!e.gt(new s(this.tx.nLockTime))&&!!this.tx.inputs[this.nin].isFinal())},f.prototype.step=function(){var e=0!=(this.flags&f.SCRIPT_VERIFY_MINIMALDATA),t=-1===this.vfExec.indexOf(!1),r,l,h,d,p,y,g,m,b,v,_,w,S,E,k,A,x,C=this.script.chunks[this.pc];this.pc++;var T=C.opcodenum;if(n.isUndefined(T))return this.errstr="SCRIPT_ERR_UNDEFINED_OPCODE",!1;if(C.buf&&C.buf.length>f.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;if(T>o.OP_16&&++this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;if(T===o.OP_CAT||T===o.OP_SUBSTR||T===o.OP_LEFT||T===o.OP_RIGHT||T===o.OP_INVERT||T===o.OP_AND||T===o.OP_OR||T===o.OP_XOR||T===o.OP_2MUL||T===o.OP_2DIV||T===o.OP_MUL||T===o.OP_DIV||T===o.OP_MOD||T===o.OP_LSHIFT||T===o.OP_RSHIFT)return this.errstr="SCRIPT_ERR_DISABLED_OPCODE",!1;if(t&&0<=T&&T<=o.OP_PUSHDATA4){if(e&&!this.script.checkMinimalPush(this.pc-1))return this.errstr="SCRIPT_ERR_MINIMALDATA",!1;if(C.buf){if(C.len!==C.buf.length)throw new Error("Length of push value not equal to length of data");this.stack.push(C.buf)}else this.stack.push(f.false)}else if(t||o.OP_IF<=T&&T<=o.OP_ENDIF)switch(T){case o.OP_1NEGATE:case o.OP_1:case o.OP_2:case o.OP_3:case o.OP_4:case o.OP_5:case o.OP_6:case o.OP_7:case o.OP_8:case o.OP_9:case o.OP_10:case o.OP_11:case o.OP_12:case o.OP_13:case o.OP_14:case o.OP_15:case o.OP_16:p=T-(o.OP_1-1),r=new s(p).toScriptNumBuffer(),this.stack.push(r);break;case o.OP_NOP:break;case o.OP_NOP2:case o.OP_CHECKLOCKTIMEVERIFY:if(!(this.flags&f.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)){if(this.flags&f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var I=s.fromScriptNumBuffer(this.stack[this.stack.length-1],e,5);if(I.lt(new s(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(!this.checkLockTime(I))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case o.OP_NOP1:case o.OP_NOP3:case o.OP_NOP4:case o.OP_NOP5:case o.OP_NOP6:case o.OP_NOP7:case o.OP_NOP8:case o.OP_NOP9:case o.OP_NOP10:if(this.flags&f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break;case o.OP_IF:case o.OP_NOTIF:if(A=!1,t){if(this.stack.length<1)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;r=this.stack.pop(),A=f.castToBool(r),T===o.OP_NOTIF&&(A=!A)}this.vfExec.push(A);break;case o.OP_ELSE:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec[this.vfExec.length-1]=!this.vfExec[this.vfExec.length-1];break;case o.OP_ENDIF:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec.pop();break;case o.OP_VERIFY:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(r=this.stack[this.stack.length-1],A=f.castToBool(r),!A)return this.errstr="SCRIPT_ERR_VERIFY",!1;this.stack.pop();break;case o.OP_RETURN:return this.errstr="SCRIPT_ERR_OP_RETURN",!1;case o.OP_TOALTSTACK:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.altstack.push(this.stack.pop());break;case o.OP_FROMALTSTACK:if(this.altstack.length<1)return this.errstr="SCRIPT_ERR_INVALID_ALTSTACK_OPERATION",!1;this.stack.push(this.altstack.pop());break;case o.OP_2DROP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop(),this.stack.pop();break;case o.OP_2DUP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=this.stack[this.stack.length-2],h=this.stack[this.stack.length-1],this.stack.push(l),this.stack.push(h);break;case o.OP_3DUP:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=this.stack[this.stack.length-3],h=this.stack[this.stack.length-2];var B=this.stack[this.stack.length-1];this.stack.push(l),this.stack.push(h),this.stack.push(B);break;case o.OP_2OVER:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=this.stack[this.stack.length-4],h=this.stack[this.stack.length-3],this.stack.push(l),this.stack.push(h);break;case o.OP_2ROT:if(this.stack.length<6)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;d=this.stack.splice(this.stack.length-6,2),this.stack.push(d[0]),this.stack.push(d[1]);break;case o.OP_2SWAP:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;d=this.stack.splice(this.stack.length-4,2),this.stack.push(d[0]),this.stack.push(d[1]);break;case o.OP_IFDUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;r=this.stack[this.stack.length-1],A=f.castToBool(r),A&&this.stack.push(r);break;case o.OP_DEPTH:r=new s(this.stack.length).toScriptNumBuffer(),this.stack.push(r);break;case o.OP_DROP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop();break;case o.OP_DUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-1]);break;case o.OP_NIP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,1);break;case o.OP_OVER:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-2]);break;case o.OP_PICK:case o.OP_ROLL:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(r=this.stack[this.stack.length-1],m=s.fromScriptNumBuffer(r,e),p=m.toNumber(),this.stack.pop(),p<0||p>=this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;r=this.stack[this.stack.length-p-1],T===o.OP_ROLL&&this.stack.splice(this.stack.length-p-1,1),this.stack.push(r);break;case o.OP_ROT:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;y=this.stack[this.stack.length-3],g=this.stack[this.stack.length-2];var O=this.stack[this.stack.length-1];this.stack[this.stack.length-3]=g,this.stack[this.stack.length-2]=O,this.stack[this.stack.length-1]=y;break;case o.OP_SWAP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;y=this.stack[this.stack.length-2],g=this.stack[this.stack.length-1],this.stack[this.stack.length-2]=g,this.stack[this.stack.length-1]=y;break;case o.OP_TUCK:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,0,this.stack[this.stack.length-1]);break;case o.OP_SIZE:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;m=new s(this.stack[this.stack.length-1].length),this.stack.push(m.toScriptNumBuffer());break;case o.OP_EQUAL:case o.OP_EQUALVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=this.stack[this.stack.length-2],h=this.stack[this.stack.length-1];var P=l.toString("hex")===h.toString("hex");if(this.stack.pop(),this.stack.pop(),this.stack.push(P?f.true:f.false),T===o.OP_EQUALVERIFY){if(!P)return this.errstr="SCRIPT_ERR_EQUALVERIFY",!1;this.stack.pop()}break;case o.OP_1ADD:case o.OP_1SUB:case o.OP_NEGATE:case o.OP_ABS:case o.OP_NOT:case o.OP_0NOTEQUAL:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(r=this.stack[this.stack.length-1],m=s.fromScriptNumBuffer(r,e),T){case o.OP_1ADD:m=m.add(s.One);break;case o.OP_1SUB:m=m.sub(s.One);break;case o.OP_NEGATE:m=m.neg();break;case o.OP_ABS:m.cmp(s.Zero)<0&&(m=m.neg());break;case o.OP_NOT:m=new s((0===m.cmp(s.Zero))+0);break;case o.OP_0NOTEQUAL:m=new s((0!==m.cmp(s.Zero))+0)}this.stack.pop(),this.stack.push(m.toScriptNumBuffer());break;case o.OP_ADD:case o.OP_SUB:case o.OP_BOOLAND:case o.OP_BOOLOR:case o.OP_NUMEQUAL:case o.OP_NUMEQUALVERIFY:case o.OP_NUMNOTEQUAL:case o.OP_LESSTHAN:case o.OP_GREATERTHAN:case o.OP_LESSTHANOREQUAL:case o.OP_GREATERTHANOREQUAL:case o.OP_MIN:case o.OP_MAX:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(b=s.fromScriptNumBuffer(this.stack[this.stack.length-2],e),v=s.fromScriptNumBuffer(this.stack[this.stack.length-1],e),m=new s(0),T){case o.OP_ADD:m=b.add(v);break;case o.OP_SUB:m=b.sub(v);break;case o.OP_BOOLAND:m=new s((0!==b.cmp(s.Zero)&&0!==v.cmp(s.Zero))+0);break;case o.OP_BOOLOR:m=new s((0!==b.cmp(s.Zero)||0!==v.cmp(s.Zero))+0);break;case o.OP_NUMEQUAL:case o.OP_NUMEQUALVERIFY:m=new s((0===b.cmp(v))+0);break;case o.OP_NUMNOTEQUAL:m=new s((0!==b.cmp(v))+0);break;case o.OP_LESSTHAN:m=new s((b.cmp(v)<0)+0);break;case o.OP_GREATERTHAN:m=new s((b.cmp(v)>0)+0);break;case o.OP_LESSTHANOREQUAL:m=new s((b.cmp(v)<=0)+0);break;case o.OP_GREATERTHANOREQUAL:m=new s((b.cmp(v)>=0)+0);break;case o.OP_MIN:m=b.cmp(v)<0?b:v;break;case o.OP_MAX:m=b.cmp(v)>0?b:v}if(this.stack.pop(),this.stack.pop(),this.stack.push(m.toScriptNumBuffer()),T===o.OP_NUMEQUALVERIFY){if(!f.castToBool(this.stack[this.stack.length-1]))return this.errstr="SCRIPT_ERR_NUMEQUALVERIFY",!1;this.stack.pop()}break;case o.OP_WITHIN:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;b=s.fromScriptNumBuffer(this.stack[this.stack.length-3],e),v=s.fromScriptNumBuffer(this.stack[this.stack.length-2],e);var R=s.fromScriptNumBuffer(this.stack[this.stack.length-1],e);A=v.cmp(b)<=0&&b.cmp(R)<0,this.stack.pop(),this.stack.pop(),this.stack.pop(),this.stack.push(A?f.true:f.false);break;case o.OP_RIPEMD160:case o.OP_SHA1:case o.OP_SHA256:case o.OP_HASH160:case o.OP_HASH256:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var N;r=this.stack[this.stack.length-1],T===o.OP_RIPEMD160?N=a.ripemd160(r):T===o.OP_SHA1?N=a.sha1(r):T===o.OP_SHA256?N=a.sha256(r):T===o.OP_HASH160?N=a.sha256ripemd160(r):T===o.OP_HASH256&&(N=a.sha256sha256(r)),this.stack.pop(),this.stack.push(N);break;case o.OP_CODESEPARATOR:this.pbegincodehash=this.pc;break;case o.OP_CHECKSIG:case o.OP_CHECKSIGVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;_=this.stack[this.stack.length-2],w=this.stack[this.stack.length-1],S=(new i).set({chunks:this.script.chunks.slice(this.pbegincodehash)});var j=(new i).add(_);if(S.findAndDelete(j),!this.checkSignatureEncoding(_)||!this.checkPubkeyEncoding(w))return!1;try{E=u.fromTxFormat(_),k=c.fromBuffer(w,!1),x=this.tx.verifySignature(E,k,this.nin,S)}catch(e){x=!1}if(this.stack.pop(),this.stack.pop(),this.stack.push(x?f.true:f.false),T===o.OP_CHECKSIGVERIFY){if(!x)return this.errstr="SCRIPT_ERR_CHECKSIGVERIFY",!1;this.stack.pop()}break;case o.OP_CHECKMULTISIG:case o.OP_CHECKMULTISIGVERIFY:var L=1;if(this.stack.length20)return this.errstr="SCRIPT_ERR_PUBKEY_COUNT",!1;if(this.nOpCount+=M,this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;var D=++L;if(L+=M,this.stack.lengthM)return this.errstr="SCRIPT_ERR_SIG_COUNT",!1;var F=++L;if(L+=U,this.stack.length0;){if(_=this.stack[this.stack.length-F],w=this.stack[this.stack.length-D],!this.checkSignatureEncoding(_)||!this.checkPubkeyEncoding(w))return!1;var q;try{E=u.fromTxFormat(_),k=c.fromBuffer(w,!1),q=this.tx.verifySignature(E,k,this.nin,S)}catch(e){q=!1}q&&(F++,U--),D++,M--,U>M&&(x=!1)}for(;L-- >1;)this.stack.pop();if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(this.flags&f.SCRIPT_VERIFY_NULLDUMMY&&this.stack[this.stack.length-1].length)return this.errstr="SCRIPT_ERR_SIG_NULLDUMMY",!1;if(this.stack.pop(),this.stack.push(x?f.true:f.false),T===o.OP_CHECKMULTISIGVERIFY){if(!x)return this.errstr="SCRIPT_ERR_CHECKMULTISIGVERIFY",!1;this.stack.pop()}break;default:return this.errstr="SCRIPT_ERR_BAD_OPCODE",!1}return!0}}).call(this,r(0).Buffer)},function(e,t){e.exports=function(e,t){for(var r=0,n=0;nt[n]?1:0,0==r);++n);return 0==r&&(t.length>e.length?r=-1:e.length>t.length&&(r=1)),r}},function(e,t,r){"use strict";var n=r(84),i=r(21),o=r(25),s=r(170),a=r(97),u=r(96),c=r(67),f=r(66),l=r(171);function h(){s.apply(this,arguments)}n(h,s),h.prototype.getSignatures=function(e,t,r,n){i.checkState(this.output instanceof a),n=n||f.SIGHASH_ALL;var o=t.toPublicKey();return o.toString()===this.output.script.getPublicKey().toString("hex")?[new l({publicKey:o,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:u.sign(e,t,n,r,this.output.script),sigtype:n})]:[]},h.prototype.addSignature=function(e,t){return i.checkState(this.isValidSignature(e,t),"Signature is invalid"),this.setScript(c.buildPublicKeyIn(t.signature.toDER(),t.sigtype)),this},h.prototype.clearSignatures=function(){return this.setScript(c.empty()),this},h.prototype.isFullySigned=function(){return this.script.isPublicKeyIn()},h.SCRIPT_MAX_SIZE=73,h.prototype._estimateSize=function(){return h.SCRIPT_MAX_SIZE},e.exports=h},function(e,t,r){"use strict";var n=r(84),i=r(21),o=r(25),s=r(45),a=r(170),u=r(97),c=r(96),f=r(67),l=r(66),h=r(171);function d(){a.apply(this,arguments)}n(d,a),d.prototype.getSignatures=function(e,t,r,n,a){return i.checkState(this.output instanceof u),a=a||s.sha256ripemd160(t.publicKey.toBuffer()),n=n||l.SIGHASH_ALL,o.equals(a,this.output.script.getPublicKeyHash())?[new h({publicKey:t.publicKey,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:c.sign(e,t,n,r,this.output.script),sigtype:n})]:[]},d.prototype.addSignature=function(e,t){return i.checkState(this.isValidSignature(e,t),"Signature is invalid"),this.setScript(f.buildPublicKeyHashIn(t.publicKey,t.signature.toDER(),t.sigtype)),this},d.prototype.clearSignatures=function(){return this.setScript(f.empty()),this},d.prototype.isFullySigned=function(){return this.script.isPublicKeyHashIn()},d.SCRIPT_MAX_SIZE=107,d.prototype._estimateSize=function(){return d.SCRIPT_MAX_SIZE},e.exports=d},function(e,t,r){"use strict";var n=r(15),i=r(84),o=r(306),s=r(170),a=r(97),u=r(21),c=r(67),f=r(66),l=r(96),h=r(76),d=r(25),p=r(171);function y(e,t,r,i){s.apply(this,arguments);var o=this;t=t||e.publicKeys,r=r||e.threshold,i=i||e.signatures,this.publicKeys=n.sortBy(t,function(e){return e.toString("hex")}),u.checkState(c.buildMultisigOut(this.publicKeys,r).equals(this.output.script),"Provided public keys don't match to the provided output script"),this.publicKeyIndex={},n.each(this.publicKeys,function(e,t){o.publicKeyIndex[e.toString()]=t}),this.threshold=r,this.signatures=i?this._deserializeSignatures(i):new Array(this.publicKeys.length)}i(y,s),y.prototype.toObject=function(){var e=s.prototype.toObject.apply(this,arguments);return e.threshold=this.threshold,e.publicKeys=n.map(this.publicKeys,function(e){return e.toString()}),e.signatures=this._serializeSignatures(),e},y.prototype._deserializeSignatures=function(e){return n.map(e,function(e){if(e)return new p(e)})},y.prototype._serializeSignatures=function(){return n.map(this.signatures,function(e){if(e)return e.toObject()})},y.prototype.getSignatures=function(e,t,r,i){u.checkState(this.output instanceof a),i=i||f.SIGHASH_ALL;var o=this,s=[];return n.each(this.publicKeys,function(n){n.toString()===t.publicKey.toString()&&s.push(new p({publicKey:t.publicKey,prevTxId:o.prevTxId,outputIndex:o.outputIndex,inputIndex:r,signature:l.sign(e,t,i,r,o.output.script),sigtype:i}))}),s},y.prototype.addSignature=function(e,t){return u.checkState(!this.isFullySigned(),"All needed signatures have already been added"),u.checkArgument(!n.isUndefined(this.publicKeyIndex[t.publicKey.toString()]),"Signature has no matching public key"),u.checkState(this.isValidSignature(e,t)),this.signatures[this.publicKeyIndex[t.publicKey.toString()]]=t,this._updateScript(),this},y.prototype._updateScript=function(){return this.setScript(c.buildMultisigIn(this.publicKeys,this.threshold,this._createSignatures())),this},y.prototype._createSignatures=function(){return n.map(n.filter(this.signatures,function(e){return!n.isUndefined(e)}),function(e){return d.concat([e.signature.toDER(),d.integerAsSingleByteBuffer(e.sigtype)])})},y.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},y.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},y.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},y.prototype.countSignatures=function(){return n.reduce(this.signatures,function(e,t){return e+!!t},0)},y.prototype.publicKeysWithoutSignature=function(){var e=this;return n.filter(this.publicKeys,function(t){return!e.signatures[e.publicKeyIndex[t.toString()]]})},y.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,l.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script)},y.normalizeSignatures=function(e,t,r,n,i){return i.map(function(i){var o=null;return n=n.filter(function(n){if(o)return!0;var s=new p({signature:f.fromTxFormat(n),publicKey:i,prevTxId:t.prevTxId,outputIndex:t.outputIndex,inputIndex:r,sigtype:f.SIGHASH_ALL});s.signature.nhashtype=s.sigtype;var a=l.verify(e,s.signature,s.publicKey,s.inputIndex,t.output.script);return!a||(o=s,!1)}),o||null})},y.OPCODES_SIZE=1,y.SIGNATURE_SIZE=73,y.prototype._estimateSize=function(){return y.OPCODES_SIZE+this.threshold*y.SIGNATURE_SIZE},e.exports=y},function(e,t,r){"use strict";var n=r(15),i=r(84),o=r(170),s=r(97),a=r(21),u=r(67),c=r(66),f=r(96),l=r(76),h=r(25),d=r(171);function p(e,t,r,i){o.apply(this,arguments);var s=this;t=t||e.publicKeys,r=r||e.threshold,i=i||e.signatures,this.publicKeys=n.sortBy(t,function(e){return e.toString("hex")}),this.redeemScript=u.buildMultisigOut(this.publicKeys,r),a.checkState(u.buildScriptHashOut(this.redeemScript).equals(this.output.script),"Provided public keys don't hash to the provided output"),this.publicKeyIndex={},n.each(this.publicKeys,function(e,t){s.publicKeyIndex[e.toString()]=t}),this.threshold=r,this.signatures=i?this._deserializeSignatures(i):new Array(this.publicKeys.length)}i(p,o),p.prototype.toObject=function(){var e=o.prototype.toObject.apply(this,arguments);return e.threshold=this.threshold,e.publicKeys=n.map(this.publicKeys,function(e){return e.toString()}),e.signatures=this._serializeSignatures(),e},p.prototype._deserializeSignatures=function(e){return n.map(e,function(e){if(e)return new d(e)})},p.prototype._serializeSignatures=function(){return n.map(this.signatures,function(e){if(e)return e.toObject()})},p.prototype.getSignatures=function(e,t,r,i){a.checkState(this.output instanceof s),i=i||c.SIGHASH_ALL;var o=this,u=[];return n.each(this.publicKeys,function(n){n.toString()===t.publicKey.toString()&&u.push(new d({publicKey:t.publicKey,prevTxId:o.prevTxId,outputIndex:o.outputIndex,inputIndex:r,signature:f.sign(e,t,i,r,o.redeemScript),sigtype:i}))}),u},p.prototype.addSignature=function(e,t){return a.checkState(!this.isFullySigned(),"All needed signatures have already been added"),a.checkArgument(!n.isUndefined(this.publicKeyIndex[t.publicKey.toString()]),"Signature has no matching public key"),a.checkState(this.isValidSignature(e,t)),this.signatures[this.publicKeyIndex[t.publicKey.toString()]]=t,this._updateScript(),this},p.prototype._updateScript=function(){return this.setScript(u.buildP2SHMultisigIn(this.publicKeys,this.threshold,this._createSignatures(),{cachedMultisig:this.redeemScript})),this},p.prototype._createSignatures=function(){return n.map(n.filter(this.signatures,function(e){return!n.isUndefined(e)}),function(e){return h.concat([e.signature.toDER(),h.integerAsSingleByteBuffer(e.sigtype)])})},p.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},p.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},p.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},p.prototype.countSignatures=function(){return n.reduce(this.signatures,function(e,t){return e+!!t},0)},p.prototype.publicKeysWithoutSignature=function(){var e=this;return n.filter(this.publicKeys,function(t){return!e.signatures[e.publicKeyIndex[t.toString()]]})},p.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,f.verify(e,t.signature,t.publicKey,t.inputIndex,this.redeemScript)},p.OPCODES_SIZE=7,p.SIGNATURE_SIZE=74,p.PUBKEY_SIZE=34,p.prototype._estimateSize=function(){return p.OPCODES_SIZE+this.threshold*p.SIGNATURE_SIZE+this.publicKeys.length*p.PUBKEY_SIZE},e.exports=p},function(e,t,r){"use strict";var n=r(15),i=r(21),o=r(39),s=r(0),a=r(61),u=r(25),c=r(34),f=r(1004),l=2,h=2,d=601;function p(e){return this instanceof p?(this.nullifiers=[],this.commitments=[],this.ciphertexts=[],this.macs=[],e?this._fromObject(e):void 0):new p(e)}Object.defineProperty(p.prototype,"vpub_old",{configurable:!1,enumerable:!0,get:function(){return this._vpub_old},set:function(e){e instanceof o?(this._vpub_oldBN=e,this._vpub_old=e.toNumber()):n.isString(e)?(this._vpub_old=parseInt(e),this._vpub_oldBN=o.fromNumber(this._vpub_old)):(i.checkArgument(c.isNaturalNumber(e),"vpub_old is not a natural number"),this._vpub_oldBN=o.fromNumber(e),this._vpub_old=e),i.checkState(c.isNaturalNumber(this._vpub_old),"vpub_old is not a natural number")}}),Object.defineProperty(p.prototype,"vpub_new",{configurable:!1,enumerable:!0,get:function(){return this._vpub_new},set:function(e){e instanceof o?(this._vpub_newBN=e,this._vpub_new=e.toNumber()):n.isString(e)?(this._vpub_new=parseInt(e),this._vpub_newBN=o.fromNumber(this._vpub_new)):(i.checkArgument(c.isNaturalNumber(e),"vpub_new is not a natural number"),this._vpub_newBN=o.fromNumber(e),this._vpub_new=e),i.checkState(c.isNaturalNumber(this._vpub_new),"vpub_new is not a natural number")}}),p.fromObject=function(e){i.checkArgument(n.isObject(e));var t=new p;return t._fromObject(e)},p.prototype._fromObject=function(e){var t=[];n.each(e.nullifiers,function(e){t.push(u.reverse(new s.Buffer(e,"hex")))});var r=[];n.each(e.commitments,function(e){r.push(u.reverse(new s.Buffer(e,"hex")))});var i=[];n.each(e.ciphertexts,function(e){i.push(new s.Buffer(e,"hex"))});var o=[];return n.each(e.macs,function(e){o.push(u.reverse(new s.Buffer(e,"hex")))}),this.vpub_old=e.vpub_old,this.vpub_new=e.vpub_new,this.anchor=u.reverse(new s.Buffer(e.anchor,"hex")),this.nullifiers=t,this.commitments=r,this.ephemeralKey=u.reverse(new s.Buffer(e.ephemeralKey,"hex")),this.ciphertexts=i,this.randomSeed=u.reverse(new s.Buffer(e.randomSeed,"hex")),this.macs=o,this.proof=f.fromObject(e.proof),this},p.prototype.toObject=p.prototype.toJSON=function e(){var t=[];n.each(this.nullifiers,function(e){t.push(u.reverse(e).toString("hex"))});var r=[];n.each(this.commitments,function(e){r.push(u.reverse(e).toString("hex"))});var i=[];n.each(this.ciphertexts,function(e){i.push(e.toString("hex"))});var o=[];n.each(this.macs,function(e){o.push(u.reverse(e).toString("hex"))});var s={vpub_old:this.vpub_old,vpub_new:this.vpub_new,anchor:u.reverse(this.anchor).toString("hex"),nullifiers:t,commitments:r,ephemeralKey:u.reverse(this.ephemeralKey).toString("hex"),ciphertexts:i,randomSeed:u.reverse(this.randomSeed).toString("hex"),macs:o,proof:this.proof.toObject()};return s},p.fromBufferReader=function(e){var t,r=new p;for(r.vpub_old=e.readUInt64LEBN(),r.vpub_new=e.readUInt64LEBN(),r.anchor=e.read(32),t=0;t<2;t++)r.nullifiers.push(e.read(32));for(t=0;t<2;t++)r.commitments.push(e.read(32));for(r.ephemeralKey=e.read(32),r.randomSeed=e.read(32),t=0;t<2;t++)r.macs.push(e.read(32));for(r.proof=f.fromBufferReader(e),t=0;t<2;t++)r.ciphertexts.push(e.read(601));return r},p.prototype.toBufferWriter=function(e){var t;for(e||(e=new a),e.writeUInt64LEBN(this._vpub_oldBN),e.writeUInt64LEBN(this._vpub_newBN),e.write(this.anchor),t=0;t<2;t++)e.write(this.nullifiers[t]);for(t=0;t<2;t++)e.write(this.commitments[t]);for(e.write(this.ephemeralKey),e.write(this.randomSeed),t=0;t<2;t++)e.write(this.macs[t]);for(this.proof.toBufferWriter(e),t=0;t<2;t++)e.write(this.ciphertexts[t]);return e},e.exports=p},function(e,t,r){"use strict";var n=r(21),i=r(0),o=r(61),s=2,a=10;function u(e){return this instanceof u?e?this._fromObject(e):void 0:new u(e)}function c(e){return this instanceof c?e?this._fromObject(e):void 0:new c(e)}function f(e){return this instanceof f?e?this._fromObject(e):void 0:new f(e)}u.fromObject=function(e){n.checkArgument(_.isObject(e));var t=new u;return t._fromObject(e)},u.prototype._fromObject=function(e){return this.y_lsb=e.y_lsb,this.x=new i.Buffer(e.x,"hex"),this},u.prototype.toObject=u.prototype.toJSON=function e(){var t={y_lsb:this.y_lsb,x:this.x.toString("hex")};return t},u.fromBufferReader=function(e){var t=new u,r=e.readUInt8();return t.y_lsb=1&r,t.x=e.read(32),t},u.prototype.toBufferWriter=function(e){return e||(e=new o),e.writeUInt8(2|this.y_lsb),e.write(this.x),e},c.fromObject=function(e){n.checkArgument(_.isObject(e));var t=new c;return t._fromObject(e)},c.prototype._fromObject=function(e){return this.y_gt=e.y_gt,this.x=new i.Buffer(e.x,"hex"),this},c.prototype.toObject=c.prototype.toJSON=function e(){var t={y_gt:this.y_gt,x:this.x.toString("hex")};return t},c.fromBufferReader=function(e){var t=new c,r=e.readUInt8();return t.y_gt=1&r,t.x=e.read(64),t},c.prototype.toBufferWriter=function(e){return e||(e=new o),e.writeUInt8(10|this.y_gt),e.write(this.x),e},f.fromObject=function(e){n.checkArgument(_.isObject(e));var t=new f;return t._fromObject(e)},f.prototype._fromObject=function(e){return this.g_A=u.fromObject(e.g_A),this.g_A_prime=u.fromObject(e.g_A_prime),this.g_B=c.fromObject(e.g_B),this.g_B_prime=u.fromObject(e.g_B_prime),this.g_C=u.fromObject(e.g_C),this.g_C_prime=u.fromObject(e.g_C_prime),this.g_K=u.fromObject(e.g_K),this.g_H=u.fromObject(e.g_H),this},f.prototype.toObject=f.prototype.toJSON=function e(){var t={g_A:this.g_A.toObject(),g_A_prime:this.g_A_prime.toObject(),g_B:this.g_B.toObject(),g_B_prime:this.g_B_prime.toObject(),g_C:this.g_C.toObject(),g_C_prime:this.g_C_prime.toObject(),g_K:this.g_K.toObject(),g_H:this.g_H.toObject()};return t},f.fromBufferReader=function(e){var t=new f;return t.g_A=u.fromBufferReader(e),t.g_A_prime=u.fromBufferReader(e),t.g_B=c.fromBufferReader(e),t.g_B_prime=u.fromBufferReader(e),t.g_C=u.fromBufferReader(e),t.g_C_prime=u.fromBufferReader(e),t.g_K=u.fromBufferReader(e),t.g_H=u.fromBufferReader(e),t},f.prototype.toBufferWriter=function(e){return e||(e=new o),this.g_A.toBufferWriter(e),this.g_A_prime.toBufferWriter(e),this.g_B.toBufferWriter(e),this.g_B_prime.toBufferWriter(e),this.g_C.toBufferWriter(e),this.g_C_prime.toBufferWriter(e),this.g_K.toBufferWriter(e),this.g_H.toBufferWriter(e),e},e.exports=f},function(e,t,r){"use strict";(function(t){var n=r(61),i=r(95),o=r(39),s=function e(r){if(!(this instanceof e))return new e(r);if(t.isBuffer(r))this.buf=r;else if("number"==typeof r){var n=r;this.fromNumber(n)}else if(r instanceof o){var i=r;this.fromBN(i)}else if(r){var s=r;this.set(s)}};s.prototype.set=function(e){return this.buf=e.buf||this.buf,this},s.prototype.fromString=function(e){return this.set({buf:new t(e,"hex")}),this},s.prototype.toString=function(){return this.buf.toString("hex")},s.prototype.fromBuffer=function(e){return this.buf=e,this},s.prototype.fromBufferReader=function(e){return this.buf=e.readVarintBuf(),this},s.prototype.fromBN=function(e){return this.buf=n().writeVarintBN(e).concat(),this},s.prototype.fromNumber=function(e){return this.buf=n().writeVarintNum(e).concat(),this},s.prototype.toBuffer=function(){return this.buf},s.prototype.toBN=function(){return i(this.buf).readVarintBN()},s.prototype.toNumber=function(){return i(this.buf).readVarintNum()},e.exports=s}).call(this,r(0).Buffer)},function(e,t,r){e.exports=r(1007),e.exports.BlockHeader=r(229),e.exports.MerkleBlock=r(486)},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(229),o=r(39),s=r(25),a=r(95),u=r(61),c=r(45),f=r(227),l=r(21);function h(e){return this instanceof h?(n.extend(this,h._from(e)),this):new h(e)}h.MAX_BLOCK_SIZE=1e6,h._from=function e(t){var r={};if(s.isBuffer(t))r=h._fromBufferReader(a(t));else{if(!n.isObject(t))throw new TypeError("Unrecognized argument for Block");r=h._fromObject(t)}return r},h._fromObject=function e(t){var r=[];t.transactions.forEach(function(e){e instanceof f?r.push(e):r.push(f().fromObject(e))});var n={header:i.fromObject(t.header),transactions:r};return n},h.fromObject=function e(t){var r=h._fromObject(t);return new h(r)},h._fromBufferReader=function e(t){var r={};l.checkState(!t.finished(),"No block data received"),r.header=i.fromBufferReader(t);var n=t.readVarintNum();r.transactions=[];for(var o=0;o1;i=Math.floor((i+1)/2)){for(var o=0;o"},h.Values={START_OF_BLOCK:8,NULL_HASH:new t("0000000000000000000000000000000000000000000000000000000000000000","hex")},e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(15),i=r(36),o=r(118),s=r(308),a=function(e,t){if(!(this instanceof a))return new a(e,t);if(this.extras={},this.knownParams=t||[],this.address=this.network=this.amount=this.message=null,"string"==typeof e){var r=a.parse(e);r.amount&&(r.amount=this._parseAmount(r.amount)),this._fromObject(r)}else{if("object"!=typeof e)throw new TypeError("Unrecognized data format.");this._fromObject(e)}};a.fromString=function e(t){if("string"!=typeof t)throw new TypeError("Expected a string");return new a(t)},a.fromObject=function e(t){return new a(t)},a.isValid=function(e,t){try{new a(e,t)}catch(e){return!1}return!0},a.parse=function(e){var t=i.parse(e,!0);if("zcash:"!==t.protocol)throw new TypeError("Invalid zcash URI");var r=/[^:]*:\/?\/?([^?]*)/.exec(e);return t.query.address=r&&r[1]||void 0,t.query},a.Members=["address","amount","message","label","r"],a.prototype._fromObject=function(e){if(!o.isValid(e.address))throw new TypeError("Invalid zcash address");for(var t in this.address=new o(e.address),this.network=this.address.network,this.amount=e.amount,e)if("address"!==t&&"amount"!==t){if(/^req-/.exec(t)&&-1===this.knownParams.indexOf(t))throw Error("Unknown required argument "+t);var r=a.Members.indexOf(t)>-1?this:this.extras;r[t]=e[t]}},a.prototype._parseAmount=function(e){if(e=Number(e),isNaN(e))throw new TypeError("Invalid amount");return s.fromBTC(e).toSatoshis()},a.prototype.toObject=a.prototype.toJSON=function e(){for(var t={},r=0;r"},e.exports=a},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(1011),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(99);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){var n=r(490),i=r(494),o=r(4).Buffer,s=r(495),a=r(113),u=r(230),c=r(496),f=r(1);function l(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(l,a),l.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 h=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 l(a.module,t,r)}function y(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)}l.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")},l.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(494),i=r(4).Buffer,o=r(490),s=r(495),a=r(113),u=r(230),c=r(496),f=r(1);function l(e,t,r){a.call(this),this._cache=new h,this._last=void 0,this._cipher=new u.AES(t),this._prev=i.from(r),this._mode=e,this._autopadding=!0}function h(){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},h.prototype.flush=function(){if(this.cache.length)return this.cache},t.createDecipher=y,t.createDecipheriv=p},function(e,t,r){"use strict";(function(n){const i=r(17),o=i(r(312)),s=r(24);t=e.exports;const a={rsa:r(1031),ed25519:r(1044),secp256k1:r(101)(o,r(525))};function u(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=o,t.keyStretcher=r(1057),t.generateEphemeralKeyPair=r(1058),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){(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 l=new RegExp(".{1,"+r+"}","g");n=n.match(l).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(;l>0;)u.push(255&l),l>>=8}for(var h=0;e[h]===a&&h=i.Versions.TLS_1_1.minor&&u.output.putBytes(s),u.update(e.fragment),u.finish(a)&&(e.fragment=u.output,e.length=e.fragment.length(),r=!0),r}function a(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function u(e,t,r){var n=!0;if(r){for(var i=t.length(),o=t.last(),s=i-1-o;s=a?(e.fragment=s.output.getBytes(h-a),f=s.output.getBytes(a)):e.fragment=s.output.getBytes(),e.fragment=n.util.createBuffer(e.fragment),e.length=e.fragment.length();var d=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=l(t.macKey,f,d)&&r,r}function l(e,t,r){var i=n.hmac.create();return i.start("SHA1",e),i.update(t),t=i.digest().getBytes(),i.start(null,null),i.update(r),r=i.digest().getBytes(),t===r}},function(e,t,r){var n=r(13);r(509),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},function(e,t,r){(function(t){var n=r(13);if(r(233),r(68),r(511),r(16),void 0===i)var i=n.jsbn.BigInteger;var o=n.util.ByteBuffer,s=void 0===t?Uint8Array:t;n.pki=n.pki||{},e.exports=n.pki.ed25519=n.ed25519=n.ed25519||{};var a=n.ed25519;function u(e){var r=e.message;if(r instanceof Uint8Array)return r;var n=e.encoding;if(void 0===r){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');r=e.md.digest().getBytes(),n="binary"}if("string"==typeof r&&!n)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof r){if(void 0!==t)return new t(r,n);r=new o(r,n)}else if(!(r instanceof o))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var i=new s(r.length()),a=0;a=0};var c=F(),f=F([1]),l=F([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),h=F([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),d=F([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),p=F([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),y=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]),g=F([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function m(e,r){var i=n.md.sha512.create(),u=new o(e);i.update(u.getBytes(r),"binary");var c=i.digest().getBytes();if(void 0!==t)return new t(c,"binary");for(var f=new s(a.constants.HASH_BYTE_LENGTH),l=0;l<64;++l)f[l]=c.charCodeAt(l);return f}function b(e,t){var r=[F(),F(),F(),F()],n,i=m(t,32);for(i[0]&=248,i[31]&=127,i[31]|=64,j(r,i),A(e,r),n=0;n<32;++n)t[n+32]=e[n];return 0}function v(e,t,r,n){var i,o,s=new Float64Array(64),a=[F(),F(),F(),F()],u=m(n,32);u[0]&=248,u[31]&=127,u[31]|=64;var c=r+64;for(i=0;i=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)*y[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;++i)t[i]-=r*y[i];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function S(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;w(e,t)}function E(e,t){var r=F(),n=F(),i=F(),o=F(),s=F(),a=F(),u=F(),c=F(),f=F();q(r,e[1],e[0]),q(f,t[1],t[0]),z(r,r,f),K(n,e[0],e[1]),K(f,t[0],t[1]),z(n,n,f),z(i,e[3],t[3]),z(i,i,h),z(o,e[2],t[2]),K(o,o,o),q(s,n,r),q(a,o,i),K(u,o,i),K(c,n,r),z(e[0],s,a),z(e[1],c,u),z(e[2],u,a),z(e[3],s,c)}function k(e,t,r){for(var n=0;n<4;++n)U(e[n],t[n],r)}function A(e,t){var r=F(),n=F(),i=F();M(i,t[2]),z(r,t[0],i),z(n,t[1],i),x(e,n),e[31]^=R(r)<<7}function x(e,t){var r,n,i,o=F(),s=F();for(r=0;r<16;++r)s[r]=t[r];for(D(s),D(s),D(s),n=0;n<2;++n){for(o[0]=s[0]-65517,r=1;r<15;++r)o[r]=s[r]-65535-(o[r-1]>>16&1),o[r-1]&=65535;o[15]=s[15]-32767-(o[14]>>16&1),i=o[15]>>16&1,o[14]&=65535,U(s,o,1-i)}for(r=0;r<16;r++)e[2*r]=255&s[r],e[2*r+1]=s[r]>>8}function C(e,t){var r=F(),n=F(),i=F(),o=F(),s=F(),a=F(),u=F();return L(e[2],f),T(e[1],t),H(i,e[1]),z(o,i,l),q(i,i,e[2]),K(o,e[2],o),H(s,o),H(a,s),z(u,a,s),z(r,u,i),z(r,r,o),I(r,r),z(r,r,i),z(r,r,o),z(r,r,o),z(e[0],r,o),H(n,e[0]),z(n,n,o),B(n,i)&&z(e[0],e[0],g),H(n,e[0]),z(n,n,o),B(n,i)?-1:(R(e[0])===t[31]>>7&&q(e[0],c,e[0]),z(e[3],e[0],e[1]),0)}function T(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function I(e,t){var r=F(),n;for(n=0;n<16;++n)r[n]=t[n];for(n=250;n>=0;--n)H(r,r),1!==n&&z(r,r,t);for(n=0;n<16;++n)e[n]=r[n]}function B(e,t){var r=new s(32),n=new s(32);return x(r,e),x(n,t),O(r,0,n,0)}function O(e,t,r,n){return P(e,t,r,n,32)}function P(e,t,r,n,i){var o,s=0;for(o=0;o>>8)-1}function R(e){var t=new s(32);return x(t,e),1&t[0]}function N(e,t,r){var n,i;for(L(e[0],c),L(e[1],f),L(e[2],f),L(e[3],c),i=255;i>=0;--i)n=r[i/8|0]>>(7&i)&1,k(e,t,n),E(t,e),E(e,e),k(e,t,n)}function j(e,t){var r=[F(),F(),F(),F()];L(r[0],d),L(r[1],p),L(r[2],f),z(r[3],d,p),N(e,r,t)}function L(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function M(e,t){var r=F(),n;for(n=0;n<16;++n)r[n]=t[n];for(n=253;n>=0;--n)H(r,r),2!==n&&4!==n&&z(r,r,t);for(n=0;n<16;++n)e[n]=r[n]}function D(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 U(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 F(e){var t,r=new Float64Array(16);if(e)for(t=0;t0&&(a=n.util.fillString(String.fromCharCode(0),u)+a);var c=t.encrypt(a,"NONE"),f=e.generate(a,o);return{encapsulation:c,key:f}},decrypt:function(t,r,n){var i=t.decrypt(r,"NONE");return e.generate(i,n)}};return o},n.kem.kdf1=function(e,t){o(this,e,0,t||e.digestLength)},n.kem.kdf2=function(e,t){o(this,e,1,t||e.digestLength)}},function(e,t,r){e.exports=r(87),r(314),r(174),r(502),r(511)},function(e,t,r){var n=r(13);r(119),r(86),r(231),r(120),r(135),r(508),r(68),r(16),r(316);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,l=0;l="8"&&(r="00"+r);var i=n.util.hexToBytes(r);e.putInt32(i.length),e.putBytes(i)}function s(e,t){e.putInt32(t.length),e.putString(t)}function a(){for(var e=n.md.sha1.create(),t=arguments.length,r=0;r0&&(this.state=x[this.state].block)},C.prototype.unblock=function(e){return e=void 0===e?1:e,this.blocks-=e,0===this.blocks&&this.state!==g&&(this.state=d,I(this,0)),this.blocks},C.prototype.sleep=function(e){e=void 0===e?0:e,this.state=x[this.state].sleep;var t=this;this.timeoutId=setTimeout(function(){t.timeoutId=null,t.state=d,I(t,0)},e)},C.prototype.wait=function(e){e.wait(this)},C.prototype.wakeup=function(){this.state===y&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state=d,I(this,0))},C.prototype.cancel=function(){this.state=x[this.state].cancel,this.permitsNeeded=0,null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null),this.subtasks=[]},C.prototype.fail=function(e){if(this.error=!0,B(this,!0),e)e.error=this.error,e.swapTime=this.swapTime,e.userData=this.userData,I(e,0);else{if(null!==this.parent){for(var t=this.parent;null!==t.parent;)t.error=this.error,t.swapTime=this.swapTime,t.userData=this.userData,t=t.parent;B(t,!0)}this.failureCallback&&this.failureCallback(this)}};var T=function(e){e.error=!1,e.state=x[e.state].start,setTimeout(function(){e.state===d&&(e.swapTime=+new Date,e.run(e),I(e,0))},0)},I=function(e,t){var r=t>30||+new Date-e.swapTime>20,n=function(t){if(t++,e.state===d)if(r&&(e.swapTime=+new Date),e.subtasks.length>0){var n=e.subtasks.shift();n.error=e.error,n.swapTime=e.swapTime,n.userData=e.userData,n.run(n),n.error||I(n,t)}else B(e),e.error||null!==e.parent&&(e.parent.error=e.error,e.parent.swapTime=e.swapTime,e.parent.userData=e.userData,I(e.parent,t))};r?setTimeout(n,0):n(t)},B=function(e,t){e.state=g,delete s[e.id],null===e.parent&&(e.type in u?0===u[e.type].length?n.log.error(i,"[%s][%s] task queue empty [%s]",e.id,e.name,e.type):u[e.type][0]!==e?n.log.error(i,"[%s][%s] task not first in queue [%s]",e.id,e.name,e.type):(u[e.type].shift(),0===u[e.type].length?delete u[e.type]:u[e.type][0].start()):n.log.error(i,"[%s][%s] task queue missing [%s]",e.id,e.name,e.type),t||(e.error&&e.failureCallback?e.failureCallback(e):!e.error&&e.successCallback&&e.successCallback(e)))};e.exports=n.task=n.task||{},n.task.start=function(e){var t=new C({run:e.run,name:e.name||"?"});t.type=e.type,t.successCallback=e.success||null,t.failureCallback=e.failure||null,t.type in u?u[e.type].push(t):(u[t.type]=[t],T(t))},n.task.cancel=function(e){e in u&&(u[e]=[u[e][0]])},n.task.createCondition=function(){var e={tasks:{},wait:function(t){t.id in e.tasks||(t.block(),e.tasks[t.id]=t)},notify:function(){var t=e.tasks;for(var r in e.tasks={},t)t[r].unblock()}};return e}},function(e,t,r){"use strict";const n=r(513),i=r(17),o=r(14),s=r(515),a=i(r(312)),u=r(24),c=r(7);class f{constructor(e){this._key=e}verify(e,t,r){g(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return s.utils.jwkToPkix(this._key)}get bytes(){return a.PublicKey.encode({Type:a.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),n(this.bytes,"sha2-256",e)}}class l{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return s.getRandomValues(new Uint8Array(16))}sign(e,t){g(t),s.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){s.decrypt(this._key,e,t)}marshal(){return s.utils.jwkToPkcs1(this._key)}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(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"),g(r),c(()=>{let n=null,i=null;try{const r=new u.util.ByteBuffer(this.marshal()),o=u.asn1.fromDer(r),s=u.pki.privateKeyFromAsn1(o);if("pkcs-8"===e){const e={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};i=u.pki.encryptRsaPrivateKey(s,t,e)}else n=new Error(`Unknown export format '${e}'`)}catch(e){n=e}r(n,i)})}}function h(e,t){const r=s.utils.pkcs1ToJwk(e);s.unmarshalPrivateKey(r,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function d(e){const t=s.utils.pkixToJwk(e);return new f(t)}function p(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function y(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function g(e){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:d,unmarshalRsaPrivateKey:h,generateKeyPair:y,fromJwk:p}},function(e,t,r){"use strict";(function(t){const n=r(107),i=r(108),o=r(514),s=r(1033),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(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(1034),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(109),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");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){"use strict";(function(t){const n=r(110),i=r(514).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";const n=r(136),i=r(520),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,r){"use strict";const n=r(136),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(121).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(e,t,r){"use strict";const n=r(1);function i(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function o(e,t){this.path=e,this.rethrow(t)}t.Reporter=i,i.prototype.isError=function e(t){return t instanceof o},i.prototype.save=function e(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},i.prototype.restore=function e(t){const r=this._reporterState;r.obj=t.obj,r.path=r.path.slice(0,t.pathLen)},i.prototype.enterKey=function e(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function e(t){const r=this._reporterState;r.path=r.path.slice(0,t-1)},i.prototype.leaveKey=function e(t,r,n){const i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[r]=n)},i.prototype.path=function e(){return this._reporterState.path.join("/")},i.prototype.enterObject=function e(){const t=this._reporterState,r=t.obj;return t.obj={},r},i.prototype.leaveObject=function e(t){const r=this._reporterState,n=r.obj;return r.obj=t,n},i.prototype.error=function e(t){let r;const n=this._reporterState,i=t instanceof o;if(r=i?t:new o(n.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),t.message||t,t.stack),!n.options.partial)throw r;return i||n.errors.push(r),r},i.prototype.wrapResult=function e(t){const r=this._reporterState;return r.options.partial?{result:this.isError(t)?null:t,errors:r.errors}:t},n(o,Error),o.prototype.rethrow=function e(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},function(e,t,r){"use strict";const n=r(175).Reporter,i=r(175).EncoderBuffer,o=r(175).DecoderBuffer,s=r(49),a=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(a),c=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function f(e,t){const r={};this._baseState=r,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}e.exports=f;const l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];f.prototype.clone=function e(){const t=this._baseState,r={};l.forEach(function(e){r[e]=t[e]});const n=new this.constructor(r.parent);return n._baseState=r,n},f.prototype._wrap=function e(){const t=this._baseState;u.forEach(function(e){this[e]=function r(){const n=new this.constructor(this);return t.children.push(n),n[e].apply(n,arguments)}},this)},f.prototype._init=function e(t){const r=this._baseState;s(null===r.parent),t.call(this),r.children=r.children.filter(function(e){return e._baseState.parent===this},this),s.equal(r.children.length,1,"Root node can have only one child")},f.prototype._useArgs=function e(t){const r=this._baseState,n=t.filter(function(e){return e instanceof this.constructor},this);t=t.filter(function(e){return!(e instanceof this.constructor)},this),0!==n.length&&(s(null===r.children),r.children=n,n.forEach(function(e){e._baseState.parent=this},this)),0!==t.length&&(s(null===r.args),r.args=t,r.reverseArgs=t.map(function(e){if("object"!=typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach(function(r){r==(0|r)&&(r|=0);const n=e[r];t[n]=r}),t}))},c.forEach(function(e){f.prototype[e]=function t(){const r=this._baseState;throw new Error(e+" not implemented for encoding: "+r.enc)}}),a.forEach(function(e){f.prototype[e]=function t(){const r=this._baseState,n=Array.prototype.slice.call(arguments);return s(null===r.tag),r.tag=e,this._useArgs(n),this}}),f.prototype.use=function e(t){s(t);const r=this._baseState;return s(null===r.use),r.use=t,this},f.prototype.optional=function e(){const t=this._baseState;return t.optional=!0,this},f.prototype.def=function e(t){const r=this._baseState;return s(null===r.default),r.default=t,r.optional=!0,this},f.prototype.explicit=function e(t){const r=this._baseState;return s(null===r.explicit&&null===r.implicit),r.explicit=t,this},f.prototype.implicit=function e(t){const r=this._baseState;return s(null===r.explicit&&null===r.implicit),r.implicit=t,this},f.prototype.obj=function e(){const t=this._baseState,r=Array.prototype.slice.call(arguments);return t.obj=!0,0!==r.length&&this._useArgs(r),this},f.prototype.key=function e(t){const r=this._baseState;return s(null===r.key),r.key=t,this},f.prototype.any=function e(){const t=this._baseState;return t.any=!0,this},f.prototype.choice=function e(t){const r=this._baseState;return s(null===r.choice),r.choice=t,this._useArgs(Object.keys(t).map(function(e){return t[e]})),this},f.prototype.contains=function e(t){const r=this._baseState;return s(null===r.use),r.contains=t,this},f.prototype._decode=function e(t,r){const n=this._baseState;if(null===n.parent)return t.wrapResult(n.children[0]._decode(t,r));let i=n.default,s=!0,a=null,u;if(null!==n.key&&(a=t.enterKey(n.key)),n.optional){let e=null;if(null!==n.explicit?e=n.explicit:null!==n.implicit?e=n.implicit:null!==n.tag&&(e=n.tag),null!==e||n.any){if(s=this._peekTag(t,e,n.any),t.isError(s))return s}else{const e=t.save();try{null===n.choice?this._decodeGeneric(n.tag,t,r):this._decodeChoice(t,r),s=!0}catch(e){s=!1}t.restore(e)}}if(n.obj&&s&&(u=t.enterObject()),s){if(null!==n.explicit){const e=this._decodeTag(t,n.explicit);if(t.isError(e))return e;t=e}const e=t.offset;if(null===n.use&&null===n.choice){let e;n.any&&(e=t.save());const r=this._decodeTag(t,null!==n.implicit?n.implicit:n.tag,n.any);if(t.isError(r))return r;n.any?i=t.raw(e):t=r}if(r&&r.track&&null!==n.tag&&r.track(t.path(),e,t.length,"tagged"),r&&r.track&&null!==n.tag&&r.track(t.path(),t.offset,t.length,"content"),n.any||(i=null===n.choice?this._decodeGeneric(n.tag,t,r):this._decodeChoice(t,r)),t.isError(i))return i;if(n.any||null!==n.choice||null===n.children||n.children.forEach(function e(n){n._decode(t,r)}),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){const e=new o(i);i=this._getUse(n.contains,t._reporterState.obj)._decode(e,r)}}return n.obj&&s&&(i=t.leaveObject(u)),null===n.key||null===i&&!0!==s?null!==a&&t.exitKey(a):t.leaveKey(a,n.key,i),i},f.prototype._decodeGeneric=function e(t,r,n){const i=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(r,t,i.args[0],n):/str$/.test(t)?this._decodeStr(r,t,n):"objid"===t&&i.args?this._decodeObjid(r,i.args[0],i.args[1],n):"objid"===t?this._decodeObjid(r,null,null,n):"gentime"===t||"utctime"===t?this._decodeTime(r,t,n):"null_"===t?this._decodeNull(r,n):"bool"===t?this._decodeBool(r,n):"objDesc"===t?this._decodeStr(r,t,n):"int"===t||"enum"===t?this._decodeInt(r,i.args&&i.args[0],n):null!==i.use?this._getUse(i.use,r._reporterState.obj)._decode(r,n):r.error("unknown tag: "+t)},f.prototype._getUse=function e(t,r){const n=this._baseState;return n.useDecoder=this._use(t,r),s(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},f.prototype._decodeChoice=function e(t,r){const n=this._baseState;let i=null,o=!1;return Object.keys(n.choice).some(function(e){const s=t.save(),a=n.choice[e];try{const n=a._decode(t,r);if(t.isError(n))return!1;i={type:e,value:n},o=!0}catch(e){return t.restore(s),!1}return!0},this),o?i:t.error("Choice not matched")},f.prototype._createEncoderBuffer=function e(t){return new i(t,this.reporter)},f.prototype._encode=function e(t,r,n){const i=this._baseState;if(null!==i.default&&i.default===t)return;const o=this._encodeValue(t,r,n);return void 0===o||this._skipDefault(o,r,n)?void 0:o},f.prototype._encodeValue=function e(t,r,i){const o=this._baseState;if(null===o.parent)return o.children[0]._encode(t,r||new n);let s=null;if(this.reporter=r,o.optional&&void 0===t){if(null===o.default)return;t=o.default}let a=null,u=!1;if(o.any)s=this._createEncoderBuffer(t);else if(o.choice)s=this._encodeChoice(t,r);else if(o.contains)a=this._getUse(o.contains,i)._encode(t,r),u=!0;else if(o.children)a=o.children.map(function(e){if("null_"===e._baseState.tag)return e._encode(null,r,t);if(null===e._baseState.key)return r.error("Child should have a key");const n=r.enterKey(e._baseState.key);if("object"!=typeof t)return r.error("Child expected, but input is not object");const i=e._encode(t[e._baseState.key],r,t);return r.leaveKey(n),i},this).filter(function(e){return e}),a=this._createEncoderBuffer(a);else if("seqof"===o.tag||"setof"===o.tag){if(!o.args||1!==o.args.length)return r.error("Too many args for : "+o.tag);if(!Array.isArray(t))return r.error("seqof/setof, but data is not Array");const e=this.clone();e._baseState.implicit=null,a=this._createEncoderBuffer(t.map(function(e){const n=this._baseState;return this._getUse(n.args[0],t)._encode(e,r)},e))}else null!==o.use?s=this._getUse(o.use,i)._encode(t,r):(a=this._encodePrimitive(o.tag,t),u=!0);if(!o.any&&null===o.choice){const e=null!==o.implicit?o.implicit:o.tag,t=null===o.implicit?"universal":"context";null===e?null===o.use&&r.error("Tag could be omitted only for .use()"):null===o.use&&(s=this._encodeComposite(e,u,t,a))}return null!==o.explicit&&(s=this._encodeComposite(o.explicit,!1,"context",s)),s},f.prototype._encodeChoice=function e(t,r){const n=this._baseState,i=n.choice[t.type];return i||s(!1,t.type+" not found in "+JSON.stringify(Object.keys(n.choice))),i._encode(t.value,r)},f.prototype._encodePrimitive=function e(t,r){const n=this._baseState;if(/str$/.test(t))return this._encodeStr(r,t);if("objid"===t&&n.args)return this._encodeObjid(r,n.reverseArgs[0],n.args[1]);if("objid"===t)return this._encodeObjid(r,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(r,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(r,n.args&&n.reverseArgs[0]);if("bool"===t)return this._encodeBool(r);if("objDesc"===t)return this._encodeStr(r,t);throw new Error("Unsupported tag: "+t)},f.prototype._isNumstr=function e(t){return/^[0-9 ]*$/.test(t)},f.prototype._isPrintstr=function e(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},function(e,t,r){"use strict";const n=r(517);t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=n._reverse(t.tagClass),t.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},t.tagByName=n._reverse(t.tag)},function(e,t,r){"use strict";const n=t;n.der=r(518),n.pem=r(1041)},function(e,t,r){"use strict";const n=r(1),i=r(0).Buffer,o=r(518);function s(e){o.call(this,e),this.enc="pem"}n(s,o),e.exports=s,s.prototype.decode=function e(t,r){const n=t.toString().split(/[\r\n]+/g),s=r.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/;let u=-1,c=-1;for(let e=0;e{if(t)return e(t);e(null,o.encode(r))})}}function f(e,t){try{e=y(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 l(e){return e=y(e,s.publicKeyLength),new u(e)}function h(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 y(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:l,generateKeyPair:h,generateKeyPairFromSeed:d}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(100),i=r(7);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){},function(e,t,r){"use strict";(function(t){const n=r(107),i=r(108),o=r(522),s=r(1048),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(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(1049),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(109),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");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){"use strict";(function(t){const n=r(110),i=r(522).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";const n=r(1051),i=r(521),o=r(7),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 l(e){if(!n.privateKeyVerify(e))throw new Error("Invalid private key")}function h(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key")}function d(e){return l(e),n.publicKeyCreate(e)}return{generateKey:r,privateKeyLength:32,hashAndSign:a,hashAndVerify:u,compressPublicKey:c,decompressPublicKey:f,validatePrivateKey:l,validatePublicKey:h,computePublicKey:d}})},function(e,t,r){"use strict";e.exports=r(473)(r(1052))},function(e,t,r){"use strict";var n=r(4).Buffer,i=r(131),o=r(1053),s=r(302),a=r(234),u=r(523),c=r(1056);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);return c.mul(t).add(n).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 l=o;if(r>>1){if(l.ucmp(a.psn)>=0)break;l=o.add(a.n)}var h=n.concat([n.from([2+(1&r)]),l.toBuffer()]),d=u.fromPublicKey(h);if(null===d)break;var p=o.uinvm(),y=a.n.sub(a.fromBuffer(e)).umul(p).ureduce(),g=f.umul(p).ureduce(),m=u.fromECJPoint(c.mulAdd(y,d,g));return m.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){"use strict";(function(t){var n=r(293),i=r(1054),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.length>>13,d=0|n[1],p=8191&d,y=d>>>13,g=0|n[2],m=8191&g,b=g>>>13,v=0|n[3],_=8191&v,w=v>>>13,S=0|n[4],E=8191&S,k=S>>>13,A=0|n[5],x=8191&A,C=A>>>13,T=0|n[6],I=8191&T,B=T>>>13,O=0|n[7],P=8191&O,R=O>>>13,N=0|n[8],j=8191&N,L=N>>>13,M=0|n[9],D=8191&M,U=M>>>13,F=0|i[0],K=8191&F,q=F>>>13,H=0|i[1],z=8191&H,V=H>>>13,G=0|i[2],W=8191&G,$=G>>>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],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],le=8191&fe,he=fe>>>13,de=0|i[9],pe=8191&de,ye=de>>>13;r.length=19,a=Math.imul(l,K),u=Math.imul(l,q),u+=Math.imul(h,K),c=Math.imul(h,q);var ge=s+a+((8191&u)<<13);s=c+(u>>>13)+(ge>>>26),ge&=67108863,a=Math.imul(p,K),u=Math.imul(p,q),u+=Math.imul(y,K),c=Math.imul(y,q),a+=Math.imul(l,z),u+=Math.imul(l,V),u+=Math.imul(h,z),c+=Math.imul(h,V);var me=s+a+((8191&u)<<13);s=c+(u>>>13)+(me>>>26),me&=67108863,a=Math.imul(m,K),u=Math.imul(m,q),u+=Math.imul(b,K),c=Math.imul(b,q),a+=Math.imul(p,z),u+=Math.imul(p,V),u+=Math.imul(y,z),c+=Math.imul(y,V),a+=Math.imul(l,W),u+=Math.imul(l,$),u+=Math.imul(h,W),c+=Math.imul(h,$);var be=s+a+((8191&u)<<13);s=c+(u>>>13)+(be>>>26),be&=67108863,a=Math.imul(_,K),u=Math.imul(_,q),u+=Math.imul(w,K),c=Math.imul(w,q),a+=Math.imul(m,z),u+=Math.imul(m,V),u+=Math.imul(b,z),c+=Math.imul(b,V),a+=Math.imul(p,W),u+=Math.imul(p,$),u+=Math.imul(y,W),c+=Math.imul(y,$),a+=Math.imul(l,J),u+=Math.imul(l,Z),u+=Math.imul(h,J),c+=Math.imul(h,Z);var ve=s+a+((8191&u)<<13);s=c+(u>>>13)+(ve>>>26),ve&=67108863,a=Math.imul(E,K),u=Math.imul(E,q),u+=Math.imul(k,K),c=Math.imul(k,q),a+=Math.imul(_,z),u+=Math.imul(_,V),u+=Math.imul(w,z),c+=Math.imul(w,V),a+=Math.imul(m,W),u+=Math.imul(m,$),u+=Math.imul(b,W),c+=Math.imul(b,$),a+=Math.imul(p,J),u+=Math.imul(p,Z),u+=Math.imul(y,J),c+=Math.imul(y,Z),a+=Math.imul(l,Q),u+=Math.imul(l,ee),u+=Math.imul(h,Q),c+=Math.imul(h,ee);var _e=s+a+((8191&u)<<13);s=c+(u>>>13)+(_e>>>26),_e&=67108863,a=Math.imul(x,K),u=Math.imul(x,q),u+=Math.imul(C,K),c=Math.imul(C,q),a+=Math.imul(E,z),u+=Math.imul(E,V),u+=Math.imul(k,z),c+=Math.imul(k,V),a+=Math.imul(_,W),u+=Math.imul(_,$),u+=Math.imul(w,W),c+=Math.imul(w,$),a+=Math.imul(m,J),u+=Math.imul(m,Z),u+=Math.imul(b,J),c+=Math.imul(b,Z),a+=Math.imul(p,Q),u+=Math.imul(p,ee),u+=Math.imul(y,Q),c+=Math.imul(y,ee),a+=Math.imul(l,re),u+=Math.imul(l,ne),u+=Math.imul(h,re),c+=Math.imul(h,ne);var we=s+a+((8191&u)<<13);s=c+(u>>>13)+(we>>>26),we&=67108863,a=Math.imul(I,K),u=Math.imul(I,q),u+=Math.imul(B,K),c=Math.imul(B,q),a+=Math.imul(x,z),u+=Math.imul(x,V),u+=Math.imul(C,z),c+=Math.imul(C,V),a+=Math.imul(E,W),u+=Math.imul(E,$),u+=Math.imul(k,W),c+=Math.imul(k,$),a+=Math.imul(_,J),u+=Math.imul(_,Z),u+=Math.imul(w,J),c+=Math.imul(w,Z),a+=Math.imul(m,Q),u+=Math.imul(m,ee),u+=Math.imul(b,Q),c+=Math.imul(b,ee),a+=Math.imul(p,re),u+=Math.imul(p,ne),u+=Math.imul(y,re),c+=Math.imul(y,ne),a+=Math.imul(l,oe),u+=Math.imul(l,se),u+=Math.imul(h,oe),c+=Math.imul(h,se);var Se=s+a+((8191&u)<<13);s=c+(u>>>13)+(Se>>>26),Se&=67108863,a=Math.imul(P,K),u=Math.imul(P,q),u+=Math.imul(R,K),c=Math.imul(R,q),a+=Math.imul(I,z),u+=Math.imul(I,V),u+=Math.imul(B,z),c+=Math.imul(B,V),a+=Math.imul(x,W),u+=Math.imul(x,$),u+=Math.imul(C,W),c+=Math.imul(C,$),a+=Math.imul(E,J),u+=Math.imul(E,Z),u+=Math.imul(k,J),c+=Math.imul(k,Z),a+=Math.imul(_,Q),u+=Math.imul(_,ee),u+=Math.imul(w,Q),c+=Math.imul(w,ee),a+=Math.imul(m,re),u+=Math.imul(m,ne),u+=Math.imul(b,re),c+=Math.imul(b,ne),a+=Math.imul(p,oe),u+=Math.imul(p,se),u+=Math.imul(y,oe),c+=Math.imul(y,se),a+=Math.imul(l,ue),u+=Math.imul(l,ce),u+=Math.imul(h,ue),c+=Math.imul(h,ce);var Ee=s+a+((8191&u)<<13);s=c+(u>>>13)+(Ee>>>26),Ee&=67108863,a=Math.imul(j,K),u=Math.imul(j,q),u+=Math.imul(L,K),c=Math.imul(L,q),a+=Math.imul(P,z),u+=Math.imul(P,V),u+=Math.imul(R,z),c+=Math.imul(R,V),a+=Math.imul(I,W),u+=Math.imul(I,$),u+=Math.imul(B,W),c+=Math.imul(B,$),a+=Math.imul(x,J),u+=Math.imul(x,Z),u+=Math.imul(C,J),c+=Math.imul(C,Z),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(m,oe),u+=Math.imul(m,se),u+=Math.imul(b,oe),c+=Math.imul(b,se),a+=Math.imul(p,ue),u+=Math.imul(p,ce),u+=Math.imul(y,ue),c+=Math.imul(y,ce),a+=Math.imul(l,le),u+=Math.imul(l,he),u+=Math.imul(h,le),c+=Math.imul(h,he);var ke=s+a+((8191&u)<<13);s=c+(u>>>13)+(ke>>>26),ke&=67108863,a=Math.imul(D,K),u=Math.imul(D,q),u+=Math.imul(U,K),c=Math.imul(U,q),a+=Math.imul(j,z),u+=Math.imul(j,V),u+=Math.imul(L,z),c+=Math.imul(L,V),a+=Math.imul(P,W),u+=Math.imul(P,$),u+=Math.imul(R,W),c+=Math.imul(R,$),a+=Math.imul(I,J),u+=Math.imul(I,Z),u+=Math.imul(B,J),c+=Math.imul(B,Z),a+=Math.imul(x,Q),u+=Math.imul(x,ee),u+=Math.imul(C,Q),c+=Math.imul(C,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(m,ue),u+=Math.imul(m,ce),u+=Math.imul(b,ue),c+=Math.imul(b,ce),a+=Math.imul(p,le),u+=Math.imul(p,he),u+=Math.imul(y,le),c+=Math.imul(y,he),a+=Math.imul(l,pe),u+=Math.imul(l,ye),u+=Math.imul(h,pe),c+=Math.imul(h,ye);var Ae=s+a+((8191&u)<<13);s=c+(u>>>13)+(Ae>>>26),Ae&=67108863,a=Math.imul(D,z),u=Math.imul(D,V),u+=Math.imul(U,z),c=Math.imul(U,V),a+=Math.imul(j,W),u+=Math.imul(j,$),u+=Math.imul(L,W),c+=Math.imul(L,$),a+=Math.imul(P,J),u+=Math.imul(P,Z),u+=Math.imul(R,J),c+=Math.imul(R,Z),a+=Math.imul(I,Q),u+=Math.imul(I,ee),u+=Math.imul(B,Q),c+=Math.imul(B,ee),a+=Math.imul(x,re),u+=Math.imul(x,ne),u+=Math.imul(C,re),c+=Math.imul(C,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(m,le),u+=Math.imul(m,he),u+=Math.imul(b,le),c+=Math.imul(b,he),a+=Math.imul(p,pe),u+=Math.imul(p,ye),u+=Math.imul(y,pe),c+=Math.imul(y,ye);var xe=s+a+((8191&u)<<13);s=c+(u>>>13)+(xe>>>26),xe&=67108863,a=Math.imul(D,W),u=Math.imul(D,$),u+=Math.imul(U,W),c=Math.imul(U,$),a+=Math.imul(j,J),u+=Math.imul(j,Z),u+=Math.imul(L,J),c+=Math.imul(L,Z),a+=Math.imul(P,Q),u+=Math.imul(P,ee),u+=Math.imul(R,Q),c+=Math.imul(R,ee),a+=Math.imul(I,re),u+=Math.imul(I,ne),u+=Math.imul(B,re),c+=Math.imul(B,ne),a+=Math.imul(x,oe),u+=Math.imul(x,se),u+=Math.imul(C,oe),c+=Math.imul(C,se),a+=Math.imul(E,ue),u+=Math.imul(E,ce),u+=Math.imul(k,ue),c+=Math.imul(k,ce),a+=Math.imul(_,le),u+=Math.imul(_,he),u+=Math.imul(w,le),c+=Math.imul(w,he),a+=Math.imul(m,pe),u+=Math.imul(m,ye),u+=Math.imul(b,pe),c+=Math.imul(b,ye);var Ce=s+a+((8191&u)<<13);s=c+(u>>>13)+(Ce>>>26),Ce&=67108863,a=Math.imul(D,J),u=Math.imul(D,Z),u+=Math.imul(U,J),c=Math.imul(U,Z),a+=Math.imul(j,Q),u+=Math.imul(j,ee),u+=Math.imul(L,Q),c+=Math.imul(L,ee),a+=Math.imul(P,re),u+=Math.imul(P,ne),u+=Math.imul(R,re),c+=Math.imul(R,ne),a+=Math.imul(I,oe),u+=Math.imul(I,se),u+=Math.imul(B,oe),c+=Math.imul(B,se),a+=Math.imul(x,ue),u+=Math.imul(x,ce),u+=Math.imul(C,ue),c+=Math.imul(C,ce),a+=Math.imul(E,le),u+=Math.imul(E,he),u+=Math.imul(k,le),c+=Math.imul(k,he),a+=Math.imul(_,pe),u+=Math.imul(_,ye),u+=Math.imul(w,pe),c+=Math.imul(w,ye);var Te=s+a+((8191&u)<<13);s=c+(u>>>13)+(Te>>>26),Te&=67108863,a=Math.imul(D,Q),u=Math.imul(D,ee),u+=Math.imul(U,Q),c=Math.imul(U,ee),a+=Math.imul(j,re),u+=Math.imul(j,ne),u+=Math.imul(L,re),c+=Math.imul(L,ne),a+=Math.imul(P,oe),u+=Math.imul(P,se),u+=Math.imul(R,oe),c+=Math.imul(R,se),a+=Math.imul(I,ue),u+=Math.imul(I,ce),u+=Math.imul(B,ue),c+=Math.imul(B,ce),a+=Math.imul(x,le),u+=Math.imul(x,he),u+=Math.imul(C,le),c+=Math.imul(C,he),a+=Math.imul(E,pe),u+=Math.imul(E,ye),u+=Math.imul(k,pe),c+=Math.imul(k,ye);var Ie=s+a+((8191&u)<<13);s=c+(u>>>13)+(Ie>>>26),Ie&=67108863,a=Math.imul(D,re),u=Math.imul(D,ne),u+=Math.imul(U,re),c=Math.imul(U,ne),a+=Math.imul(j,oe),u+=Math.imul(j,se),u+=Math.imul(L,oe),c+=Math.imul(L,se),a+=Math.imul(P,ue),u+=Math.imul(P,ce),u+=Math.imul(R,ue),c+=Math.imul(R,ce),a+=Math.imul(I,le),u+=Math.imul(I,he),u+=Math.imul(B,le),c+=Math.imul(B,he),a+=Math.imul(x,pe),u+=Math.imul(x,ye),u+=Math.imul(C,pe),c+=Math.imul(C,ye);var Be=s+a+((8191&u)<<13);s=c+(u>>>13)+(Be>>>26),Be&=67108863,a=Math.imul(D,oe),u=Math.imul(D,se),u+=Math.imul(U,oe),c=Math.imul(U,se),a+=Math.imul(j,ue),u+=Math.imul(j,ce),u+=Math.imul(L,ue),c+=Math.imul(L,ce),a+=Math.imul(P,le),u+=Math.imul(P,he),u+=Math.imul(R,le),c+=Math.imul(R,he),a+=Math.imul(I,pe),u+=Math.imul(I,ye),u+=Math.imul(B,pe),c+=Math.imul(B,ye);var Oe=s+a+((8191&u)<<13);s=c+(u>>>13)+(Oe>>>26),Oe&=67108863,a=Math.imul(D,ue),u=Math.imul(D,ce),u+=Math.imul(U,ue),c=Math.imul(U,ce),a+=Math.imul(j,le),u+=Math.imul(j,he),u+=Math.imul(L,le),c+=Math.imul(L,he),a+=Math.imul(P,pe),u+=Math.imul(P,ye),u+=Math.imul(R,pe),c+=Math.imul(R,ye);var Pe=s+a+((8191&u)<<13);s=c+(u>>>13)+(Pe>>>26),Pe&=67108863,a=Math.imul(D,le),u=Math.imul(D,he),u+=Math.imul(U,le),c=Math.imul(U,he),a+=Math.imul(j,pe),u+=Math.imul(j,ye),u+=Math.imul(L,pe),c+=Math.imul(L,ye);var Re=s+a+((8191&u)<<13);s=c+(u>>>13)+(Re>>>26),Re&=67108863,a=Math.imul(D,pe),u=Math.imul(D,ye),u+=Math.imul(U,pe),c=Math.imul(U,ye);var Ne=s+a+((8191&u)<<13);return s=c+(u>>>13)+(Ne>>>26),Ne&=67108863,o[0]=ge,o[1]=me,o[2]=be,o[3]=ve,o[4]=_e,o[5]=we,o[6]=Se,o[7]=Ee,o[8]=ke,o[9]=Ae,o[10]=xe,o[11]=Ce,o[12]=Te,o[13]=Ie,o[14]=Be,o[15]=Oe,o[16]=Pe,o[17]=Re,o[18]=Ne,0!==s&&(o[19]=s,r.length++),r}},function(e,t,r){"use strict";var n=r(4).Buffer,i=r(234),o=r(523),s=r(524);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;l--)f=(f<<1)+i[l];u.push(f)}for(var h=new s(null,null,null),d=new s(null,null,null),p=a;p>0;p--){for(var y=0;y=0;f--){for(var l=0;f>=0&&(c[0]=0|a[0][f],c[1]=0|a[1][f],0===c[0]&&0===c[1]);++l,--f);if(f>=0&&(l+=1),u=u.dblp(l),f<0)break;for(var h=0;h<2;h++){var d=c[h],p;0!==d&&(d>0?p=o[h][d>>1]:d<0&&(p=o[h][-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(60),i=r(489),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,l=20,h=t.from("key expansion"),d=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(h,(e,i)=>{if(e)return a(e);let o=[],s=0;function u(e){r.digest(t.concat([i,h]),(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 l(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(311)(),i=r(310),o=r(136).bignum,s=r(520),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",h(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:l(e),genSharedKey:o}))}),r)};const f={"P-256":32,"P-384":48,"P-521":66};function l(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 h(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=h(e,t.public);return r.d=a(new o(t.private)),r}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(24),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function o(e,t,r,o,s){const a=i[s];if(!a)throw new Error(`Hash '${s}' is unknown or not supported`);const u=n.pkcs5.pbkdf2(e,t,r,o,a);return n.util.encode64(u)}e.exports=o},function(e,t,r){"use strict";(function(n){const i=r(18),o=r(1062),s=r(20),a=r(6);class u{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.keys.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return o.keys.marshalPrivateKey(this.privKey)}toPrint(){return this.toJSON()}toJSON(){return{id:this.toB58String(),privKey:c(this.marshalPrivKey()),pubKey:c(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"))}}function c(e){if(e)return e.toString("base64")}t=e.exports=u,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.keys.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 u(r,n))})},t.createFromHexString=function(e){return new u(i.fromHexString(e))},t.createFromBytes=function(e){return new u(e)},t.createFromB58String=function(e){return new u(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.keys.unmarshalPublicKey(i)}catch(e){return t(e)}r.hash((e,n)=>{if(e)return t(e);t(null,new u(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.keys.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 u(r,n,n.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r,s,c,f;try{r=i.fromB58String(e.id),s=e.privKey&&n.from(e.privKey,"base64"),c=e.pubKey&&n.from(e.pubKey,"base64"),f=c&&o.keys.unmarshalPublicKey(c)}catch(e){return t(e)}s?a([e=>o.keys.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)}),(e,t,r)=>{f?f.hash((n,i)=>{r(n,e,t,i)}):r(null,e,t)}],(e,n,i,o)=>e?t(e):f&&!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 u(r,i,f))):t(null,new u(r,null,f))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(526),i=r(1064),o=r(1066);t=e.exports,t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(535),t.pbkdf2=r(1085)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(1065),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(99);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(17),o=i(r(321)),s=r(24);t=e.exports;const a={rsa:r(1067),ed25519:r(1080),secp256k1:r(101)(o,r(535))};function u(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=o,t.keyStretcher=r(1082),t.generateEphemeralKeyPair=r(1083),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){"use strict";const n=r(527),i=r(17),o=r(14),s=r(529),a=i(r(321)),u=r(24),c=r(7);class f{constructor(e){this._key=e}verify(e,t,r){g(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return s.utils.jwkToPkix(this._key)}get bytes(){return a.PublicKey.encode({Type:a.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),n(this.bytes,"sha2-256",e)}}class l{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return s.getRandomValues(new Uint8Array(16))}sign(e,t){g(t),s.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){s.decrypt(this._key,e,t)}marshal(){return s.utils.jwkToPkcs1(this._key)}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(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"),g(r),c(()=>{let n=null,i=null;try{const r=new u.util.ByteBuffer(this.marshal()),o=u.asn1.fromDer(r),s=u.pki.privateKeyFromAsn1(o);if("pkcs-8"===e){const e={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};i=u.pki.encryptRsaPrivateKey(s,t,e)}else n=new Error(`Unknown export format '${e}'`)}catch(e){n=e}r(n,i)})}}function h(e,t){const r=s.utils.pkcs1ToJwk(e);s.unmarshalPrivateKey(r,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function d(e){const t=s.utils.pkixToJwk(e);return new f(t)}function p(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function y(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function g(e){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:d,unmarshalRsaPrivateKey:h,generateKeyPair:y,fromJwk:p}},function(e,t,r){"use strict";(function(t){const n=r(107),i=r(108),o=r(528),s=r(1069),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(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(1070),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(109),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");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){"use strict";(function(t){const n=r(110),i=r(528).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";const n=r(137),i=r(534),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,r){"use strict";const n=r(137),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(121).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(e,t,r){"use strict";const n=r(1);function i(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function o(e,t){this.path=e,this.rethrow(t)}t.Reporter=i,i.prototype.isError=function e(t){return t instanceof o},i.prototype.save=function e(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},i.prototype.restore=function e(t){const r=this._reporterState;r.obj=t.obj,r.path=r.path.slice(0,t.pathLen)},i.prototype.enterKey=function e(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function e(t){const r=this._reporterState;r.path=r.path.slice(0,t-1)},i.prototype.leaveKey=function e(t,r,n){const i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[r]=n)},i.prototype.path=function e(){return this._reporterState.path.join("/")},i.prototype.enterObject=function e(){const t=this._reporterState,r=t.obj;return t.obj={},r},i.prototype.leaveObject=function e(t){const r=this._reporterState,n=r.obj;return r.obj=t,n},i.prototype.error=function e(t){let r;const n=this._reporterState,i=t instanceof o;if(r=i?t:new o(n.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),t.message||t,t.stack),!n.options.partial)throw r;return i||n.errors.push(r),r},i.prototype.wrapResult=function e(t){const r=this._reporterState;return r.options.partial?{result:this.isError(t)?null:t,errors:r.errors}:t},n(o,Error),o.prototype.rethrow=function e(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},function(e,t,r){"use strict";const n=r(176).Reporter,i=r(176).EncoderBuffer,o=r(176).DecoderBuffer,s=r(49),a=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(a),c=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function f(e,t){const r={};this._baseState=r,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}e.exports=f;const l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];f.prototype.clone=function e(){const t=this._baseState,r={};l.forEach(function(e){r[e]=t[e]});const n=new this.constructor(r.parent);return n._baseState=r,n},f.prototype._wrap=function e(){const t=this._baseState;u.forEach(function(e){this[e]=function r(){const n=new this.constructor(this);return t.children.push(n),n[e].apply(n,arguments)}},this)},f.prototype._init=function e(t){const r=this._baseState;s(null===r.parent),t.call(this),r.children=r.children.filter(function(e){return e._baseState.parent===this},this),s.equal(r.children.length,1,"Root node can have only one child")},f.prototype._useArgs=function e(t){const r=this._baseState,n=t.filter(function(e){return e instanceof this.constructor},this);t=t.filter(function(e){return!(e instanceof this.constructor)},this),0!==n.length&&(s(null===r.children),r.children=n,n.forEach(function(e){e._baseState.parent=this},this)),0!==t.length&&(s(null===r.args),r.args=t,r.reverseArgs=t.map(function(e){if("object"!=typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach(function(r){r==(0|r)&&(r|=0);const n=e[r];t[n]=r}),t}))},c.forEach(function(e){f.prototype[e]=function t(){const r=this._baseState;throw new Error(e+" not implemented for encoding: "+r.enc)}}),a.forEach(function(e){f.prototype[e]=function t(){const r=this._baseState,n=Array.prototype.slice.call(arguments);return s(null===r.tag),r.tag=e,this._useArgs(n),this}}),f.prototype.use=function e(t){s(t);const r=this._baseState;return s(null===r.use),r.use=t,this},f.prototype.optional=function e(){const t=this._baseState;return t.optional=!0,this},f.prototype.def=function e(t){const r=this._baseState;return s(null===r.default),r.default=t,r.optional=!0,this},f.prototype.explicit=function e(t){const r=this._baseState;return s(null===r.explicit&&null===r.implicit),r.explicit=t,this},f.prototype.implicit=function e(t){const r=this._baseState;return s(null===r.explicit&&null===r.implicit),r.implicit=t,this},f.prototype.obj=function e(){const t=this._baseState,r=Array.prototype.slice.call(arguments);return t.obj=!0,0!==r.length&&this._useArgs(r),this},f.prototype.key=function e(t){const r=this._baseState;return s(null===r.key),r.key=t,this},f.prototype.any=function e(){const t=this._baseState;return t.any=!0,this},f.prototype.choice=function e(t){const r=this._baseState;return s(null===r.choice),r.choice=t,this._useArgs(Object.keys(t).map(function(e){return t[e]})),this},f.prototype.contains=function e(t){const r=this._baseState;return s(null===r.use),r.contains=t,this},f.prototype._decode=function e(t,r){const n=this._baseState;if(null===n.parent)return t.wrapResult(n.children[0]._decode(t,r));let i=n.default,s=!0,a=null,u;if(null!==n.key&&(a=t.enterKey(n.key)),n.optional){let e=null;if(null!==n.explicit?e=n.explicit:null!==n.implicit?e=n.implicit:null!==n.tag&&(e=n.tag),null!==e||n.any){if(s=this._peekTag(t,e,n.any),t.isError(s))return s}else{const e=t.save();try{null===n.choice?this._decodeGeneric(n.tag,t,r):this._decodeChoice(t,r),s=!0}catch(e){s=!1}t.restore(e)}}if(n.obj&&s&&(u=t.enterObject()),s){if(null!==n.explicit){const e=this._decodeTag(t,n.explicit);if(t.isError(e))return e;t=e}const e=t.offset;if(null===n.use&&null===n.choice){let e;n.any&&(e=t.save());const r=this._decodeTag(t,null!==n.implicit?n.implicit:n.tag,n.any);if(t.isError(r))return r;n.any?i=t.raw(e):t=r}if(r&&r.track&&null!==n.tag&&r.track(t.path(),e,t.length,"tagged"),r&&r.track&&null!==n.tag&&r.track(t.path(),t.offset,t.length,"content"),n.any||(i=null===n.choice?this._decodeGeneric(n.tag,t,r):this._decodeChoice(t,r)),t.isError(i))return i;if(n.any||null!==n.choice||null===n.children||n.children.forEach(function e(n){n._decode(t,r)}),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){const e=new o(i);i=this._getUse(n.contains,t._reporterState.obj)._decode(e,r)}}return n.obj&&s&&(i=t.leaveObject(u)),null===n.key||null===i&&!0!==s?null!==a&&t.exitKey(a):t.leaveKey(a,n.key,i),i},f.prototype._decodeGeneric=function e(t,r,n){const i=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(r,t,i.args[0],n):/str$/.test(t)?this._decodeStr(r,t,n):"objid"===t&&i.args?this._decodeObjid(r,i.args[0],i.args[1],n):"objid"===t?this._decodeObjid(r,null,null,n):"gentime"===t||"utctime"===t?this._decodeTime(r,t,n):"null_"===t?this._decodeNull(r,n):"bool"===t?this._decodeBool(r,n):"objDesc"===t?this._decodeStr(r,t,n):"int"===t||"enum"===t?this._decodeInt(r,i.args&&i.args[0],n):null!==i.use?this._getUse(i.use,r._reporterState.obj)._decode(r,n):r.error("unknown tag: "+t)},f.prototype._getUse=function e(t,r){const n=this._baseState;return n.useDecoder=this._use(t,r),s(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},f.prototype._decodeChoice=function e(t,r){const n=this._baseState;let i=null,o=!1;return Object.keys(n.choice).some(function(e){const s=t.save(),a=n.choice[e];try{const n=a._decode(t,r);if(t.isError(n))return!1;i={type:e,value:n},o=!0}catch(e){return t.restore(s),!1}return!0},this),o?i:t.error("Choice not matched")},f.prototype._createEncoderBuffer=function e(t){return new i(t,this.reporter)},f.prototype._encode=function e(t,r,n){const i=this._baseState;if(null!==i.default&&i.default===t)return;const o=this._encodeValue(t,r,n);return void 0===o||this._skipDefault(o,r,n)?void 0:o},f.prototype._encodeValue=function e(t,r,i){const o=this._baseState;if(null===o.parent)return o.children[0]._encode(t,r||new n);let s=null;if(this.reporter=r,o.optional&&void 0===t){if(null===o.default)return;t=o.default}let a=null,u=!1;if(o.any)s=this._createEncoderBuffer(t);else if(o.choice)s=this._encodeChoice(t,r);else if(o.contains)a=this._getUse(o.contains,i)._encode(t,r),u=!0;else if(o.children)a=o.children.map(function(e){if("null_"===e._baseState.tag)return e._encode(null,r,t);if(null===e._baseState.key)return r.error("Child should have a key");const n=r.enterKey(e._baseState.key);if("object"!=typeof t)return r.error("Child expected, but input is not object");const i=e._encode(t[e._baseState.key],r,t);return r.leaveKey(n),i},this).filter(function(e){return e}),a=this._createEncoderBuffer(a);else if("seqof"===o.tag||"setof"===o.tag){if(!o.args||1!==o.args.length)return r.error("Too many args for : "+o.tag);if(!Array.isArray(t))return r.error("seqof/setof, but data is not Array");const e=this.clone();e._baseState.implicit=null,a=this._createEncoderBuffer(t.map(function(e){const n=this._baseState;return this._getUse(n.args[0],t)._encode(e,r)},e))}else null!==o.use?s=this._getUse(o.use,i)._encode(t,r):(a=this._encodePrimitive(o.tag,t),u=!0);if(!o.any&&null===o.choice){const e=null!==o.implicit?o.implicit:o.tag,t=null===o.implicit?"universal":"context";null===e?null===o.use&&r.error("Tag could be omitted only for .use()"):null===o.use&&(s=this._encodeComposite(e,u,t,a))}return null!==o.explicit&&(s=this._encodeComposite(o.explicit,!1,"context",s)),s},f.prototype._encodeChoice=function e(t,r){const n=this._baseState,i=n.choice[t.type];return i||s(!1,t.type+" not found in "+JSON.stringify(Object.keys(n.choice))),i._encode(t.value,r)},f.prototype._encodePrimitive=function e(t,r){const n=this._baseState;if(/str$/.test(t))return this._encodeStr(r,t);if("objid"===t&&n.args)return this._encodeObjid(r,n.reverseArgs[0],n.args[1]);if("objid"===t)return this._encodeObjid(r,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(r,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(r,n.args&&n.reverseArgs[0]);if("bool"===t)return this._encodeBool(r);if("objDesc"===t)return this._encodeStr(r,t);throw new Error("Unsupported tag: "+t)},f.prototype._isNumstr=function e(t){return/^[0-9 ]*$/.test(t)},f.prototype._isPrintstr=function e(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},function(e,t,r){"use strict";const n=r(531);t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=n._reverse(t.tagClass),t.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},t.tagByName=n._reverse(t.tag)},function(e,t,r){"use strict";const n=t;n.der=r(532),n.pem=r(1077)},function(e,t,r){"use strict";const n=r(1),i=r(0).Buffer,o=r(532);function s(e){o.call(this,e),this.enc="pem"}n(s,o),e.exports=s,s.prototype.decode=function e(t,r){const n=t.toString().split(/[\r\n]+/g),s=r.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/;let u=-1,c=-1;for(let e=0;e{if(t)return e(t);e(null,o.encode(r))})}}function f(e,t){try{e=y(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 l(e){return e=y(e,s.publicKeyLength),new u(e)}function h(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 y(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:l,generateKeyPair:h,generateKeyPairFromSeed:d}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(100),i=r(7);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){"use strict";(function(t){const n=r(60),i=r(526),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,l=20,h=t.from("key expansion"),d=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(h,(e,i)=>{if(e)return a(e);let o=[],s=0;function u(e){r.digest(t.concat([i,h]),(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 l(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(320)(),i=r(319),o=r(137).bignum,s=r(534),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",h(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:l(e),genSharedKey:o}))}),r)};const f={"P-256":32,"P-384":48,"P-521":66};function l(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 h(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=h(e,t.public);return r.d=a(new o(t.private)),r}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(24),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function o(e,t,r,o,s){const a=i[s];if(!a)throw new Error(`Hash '${s}' is unknown or not supported`);const u=n.pkcs5.pbkdf2(e,t,r,o,a);return n.util.encode64(u)}e.exports=o},function(e,t,r){"use strict";(function(n){const i=r(62),o=r(28),s=r(1087),a=r(324),u=r(22),c=r(14),f=r(41),l=new Error("Sorry, Not Implemented Yet."),h=f.proto(function(e){if(!(this instanceof h))return new h(e);if(null==e&&(e=""),e instanceof n)this.buffer=s.fromBuffer(e);else if("string"==typeof e||e instanceof String)this.buffer=s.fromString(e);else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=s.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});h.prototype.toString=function e(){return s.bufferToString(this.buffer)},h.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},h.prototype.inspect=function e(){return""},h.prototype.protos=function e(){return i(this.protoCodes(),function(e){return o(a(e))})},h.prototype.protoCodes=function e(){const t=[],r=this.buffer;let n=0;for(;n{if(e[0]===a.names.ipfs.code)return!0})[0][1],c.decode(t)}catch(e){t=null}return t},h.prototype.equals=function e(t){return this.buffer.equals(t.buffer)},h.prototype.nodeAddress=function e(){if(!this.isThinWaistAddress())throw new Error('Multiaddr must be "thin waist" address for nodeAddress.');const t=this.protoCodes(),r=this.toString().split("/").slice(1);return{family:41===t[0]?"IPv6":"IPv4",address:r[1],port:r[3]}},h.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 h("/"+[n,t.address,r,t.port].join("/"))},h.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||17===r[1].code))},h.prototype.fromStupidString=function e(t){throw l},h.protocols=a,h.isName=function e(t){return!!h.isMultiaddr(t)&&t.protos().some(e=>e.resolvable)},h.resolve=function e(t,r){return h.isMultiaddr(t)&&h.isName(t)?r(new Error("not implemented yet")):r(new Error("not a valid name"))},t=e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(62),i=r(235),o=r(1088),s=r(324),a=r(22);function u(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n=r.length)throw S("invalid address: "+e);t.push([i,r[n]])}else t.push([i])}return t}function c(e){const t=[];return n(e,function(e){const r=E(e);t.push(r.name),e.length>1&&t.push(e[1])}),"/"+t.join("/")}function f(e){return n(e,function(e){Array.isArray(e)||(e=[e]);const t=E(e);return e.length>1?[t.code,o.toBuffer(t.code,e[1])]:[t.code]})}function l(e){return n(e,function(e){const t=E(e);return e.length>1?[t.code,o.toString(t.code,e[1])]:[t.code]})}function h(e){return b(t.concat(n(e,function(e){const r=E(e);let n=t.from(a.encode(r.code));return e.length>1&&(n=t.concat([n,e[1]])),n})))}function d(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;{const e=a.decode(t);return e+a.decode.bytes}}function p(e){const t=[];let r=0;for(;re.length)throw S("Invalid address buffer: "+e.toString("hex"));t.push([n,c])}return t}function y(e){const t=p(e),r=l(t);return c(r)}function g(e){e=w(e);const t=u(e),r=f(t);return h(r)}function m(e){return g(e)}function b(e){const r=v(e);if(r)throw r;return t.from(e)}function v(e){try{p(e)}catch(e){return e}}function _(e){return void 0===v(e)}function w(e){return"/"+i(e.trim().split("/")).join("/")}function S(e){return new Error("Error parsing address: "+e)}function E(e){const t=s(e[0]);return t}e.exports={stringToStringTuples:u,stringTuplesToString:c,tuplesToStringTuples:l,stringTuplesToTuples:f,bufferToTuples:p,tuplesToBuffer:h,bufferToString:y,stringToBuffer:g,fromString:m,fromBuffer:b,validateBuffer:v,isValidBuffer:_,cleanPath:w,ParseError:S,protoFromTuple:E,sizeForAddr:d}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(236),i=r(237),o=r(324),s=r(14),a=r(22);function u(e,r){return r instanceof t?u.toString(e,r):u.toBuffer(e,r)}function c(e){if(!e.isValid())throw new Error("invalid ip address");return n.toBuffer(e.address)}function f(e){const r=t.alloc(2);return r.writeUInt16BE(e,0),r}function l(e){return e.readUInt16BE(0)}function h(e){const r=t.from(e),n=t.from(a.encode(r.length));return t.concat([n,r])}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 p(e){const r=t.from(s.decode(e)),n=t.from(a.encode(r.length));return t.concat([n,r])}function y(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 n.toString(r);case 6:case 17:case 33:case 132:return l(r);case 54:case 55:case 56:return d(r);case 421:return y(r);default:return r.toString("hex")}},u.toBuffer=function e(r,n){switch(r=o(r),r.code){case 4:return c(new i.Address4(n));case 41:return c(new i.Address6(n));case 6:case 17:case 33:case 132:return f(parseInt(n,10));case 54:case 55:case 56:return h(n);case 421:return p(n);default:return t.from(n,"hex")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(538).BigInteger,i=r(542),o=r(1090),s=r(1091),a=r(540),u=r(541),c=r(177).sprintf,f=r(322),l=r(323),h=r(537);function d(e){for(var t=/(\d+)(\d{3})/;t.test(e);)e=e.replace(t,"$1,$2");return e}function p(e){return e=e.replace(/^(0{1,})([1-9]+)$/,'$1$2'),e=e.replace(/^(0{1,})(0)$/,'$1$2'),e}function y(e,t){this.groups=void 0===t?l.GROUPS:t,this.v4=!1,this.subnet="/128",this.subnetMask=128,this.zone="",this.address=e;var r=l.RE_SUBNET_STRING.exec(e);if(r){if(this.parsedSubnet=r[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet="/"+this.subnetMask,isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>l.BITS)return this.valid=!1,void(this.error="Invalid subnet mask.");e=e.replace(l.RE_SUBNET_STRING,"")}else if(/\//.test(e))return this.valid=!1,void(this.error="Invalid subnet mask.");var n=l.RE_ZONE_STRING.exec(e);n&&(this.zone=n[0],e=e.replace(l.RE_ZONE_STRING,"")),this.addressMinusSuffix=e,this.parsedAddress=this.parse(this.addressMinusSuffix)}function g(e,t){var r=[],n=[],i;for(i=0;it[1]&&n.push(e[i]);return r.concat(["compact"]).concat(n)}function m(e){return c("%04x",parseInt(e,16))}function b(e){return 255&e}s(y.prototype,r(1092)),s(y.prototype,r(1093)),s(y.prototype,r(1094)),y.fromBigInteger=function(e){var t=a(e.toString(16),32,"0"),r=[],n;for(n=0;n65536)&&(r=null)):r=null,{address:new y(t),port:r}},y.fromAddress4=function(e){var e=new h(e),t=l.BITS-(f.BITS-e.subnetMask);return new y("::ffff:"+e.correctForm()+"/"+t)},y.fromArpa=function(e){var t=e.replace(/(\.ip6\.arpa)?\.$/,""),r=7;if(63!==t.length)return t={error:"Not Valid 'ip6.arpa' form",address:null},t;t=t.split(".").reverse();for(var n=7;n>0;n--){var i=4*n;t.splice(i,0,":")}return t=t.join(""),new y(t)},y.prototype.microsoftTranscription=function(){return c("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))},y.prototype.mask=function(e){return void 0===e&&(e=this.subnetMask),this.getBitsBase2(0,e)},y.prototype.possibleSubnets=function(e){void 0===e&&(e=128);var t=l.BITS-this.subnetMask,r=Math.abs(e-l.BITS),i=t-r;return i<0?"0":d(new n("2",10).pow(i).toString(10))},y.prototype.startAddress=function(){var e=new n(this.mask()+u(0,l.BITS-this.subnetMask),2);return y.fromBigInteger(e)},y.prototype.endAddress=function(){var e=new n(this.mask()+u(1,l.BITS-this.subnetMask),2);return y.fromBigInteger(e)},y.prototype.getScope=function(){var e=l.SCOPES[this.getBits(12,16)];return"Global unicast"===this.getType()&&"Link local"!==e&&(e="Global"),e},y.prototype.getType=function(){var e=this;function t(t,r){return e.isInSubnet(new y(r))}return i(l.TYPES,t)||"Global unicast"},y.prototype.getBits=function(e,t){return new n(this.getBitsBase2(e,t),2)},y.prototype.getBitsBase2=function(e,t){return this.binaryZeroPad().slice(e,t)},y.prototype.getBitsBase16=function(e,t){var r=t-e;return r%4!=0?null:a(this.getBits(e,t).toString(16),r/4,"0")},y.prototype.getBitsPastSubnet=function(){return this.getBitsBase2(this.subnetMask,l.BITS)},y.prototype.reverseForm=function(e){e||(e={});var t=Math.floor(this.subnetMask/4),r=this.canonicalForm().replace(/:/g,"").split("").slice(0,t).reverse().join(".");return t>0?e.omitSuffix?r:c("%s.ip6.arpa.",r):e.omitSuffix?"":"ip6.arpa."},y.prototype.correctForm=function(){if(!this.parsedAddress)return null;var e,t=[],r=0,n=[];for(e=0;e0&&(r>1&&n.push([e-r,e-1]),r=0)}r>1&&n.push([this.parsedAddress.length-r,this.parsedAddress.length-1]);var s=n.map(function(e){return e[1]-e[0]+1});if(n.length>0){var a=s.indexOf(o(s));t=g(this.parsedAddress,n[a])}else t=this.parsedAddress;for(e=0;e1?"s":"",t.join("")),this.parseError=e.replace(l.RE_BAD_CHARACTERS,'$1'),null;var r=e.match(l.RE_BAD_ADDRESS);if(r)return this.valid=!1,this.error=c("Address failed regex: %s",r.join("")),this.parseError=e.replace(l.RE_BAD_ADDRESS,'$1'),null;var n=[],i=e.split("::");if(2===i.length){var o=i[0].split(":"),s=i[1].split(":");1===o.length&&""===o[0]&&(o=[]),1===s.length&&""===s[0]&&(s=[]);var a=this.groups-(o.length+s.length);if(!a)return this.valid=!1,this.error="Error parsing groups",null;this.elidedGroups=a,this.elisionBegin=o.length,this.elisionEnd=o.length+this.elidedGroups,o.forEach(function(e){n.push(e)});for(var u=0;u=0;o--)r=r.add(i.multiply(new n(e[o].toString(10),10))),i=i.multiply(t);return y.fromBigInteger(r)},e.exports=y},function(e,t){var r="[object Symbol]",n=Object.prototype,i=n.toString;function o(e,t,r){for(var n=-1,i=e.length;++nt}function a(e){return!!e&&"object"==typeof e}function u(e){return"symbol"==typeof e||a(e)&&i.call(e)==r}function c(e){return e}function f(e){return e&&e.length?o(e,c,s):void 0}e.exports=f},function(e,t,r){(function(e,r){var n=200,i="__lodash_hash_undefined__",o=800,s=16,a=9007199254740991,u="[object Arguments]",c="[object Array]",f="[object AsyncFunction]",l="[object Boolean]",h="[object Date]",d="[object Error]",p="[object Function]",y="[object GeneratorFunction]",g="[object Map]",m="[object Number]",b="[object Null]",v="[object Object]",_="[object Proxy]",w="[object RegExp]",S="[object Set]",E="[object String]",k="[object Undefined]",A="[object WeakMap]",x="[object ArrayBuffer]",C="[object DataView]",T="[object Float32Array]",I="[object Float64Array]",B="[object Int8Array]",O="[object Int16Array]",P="[object Int32Array]",R="[object Uint8Array]",N="[object Uint8ClampedArray]",j="[object Uint16Array]",L="[object Uint32Array]",M=/[\\^$.*+?()[\]{}|]/g,D=/^\[object .+?Constructor\]$/,U=/^(?:0|[1-9]\d*)$/,F={};F[T]=F[I]=F[B]=F[O]=F[P]=F[R]=F[N]=F[j]=F[L]=!0,F[u]=F[c]=F[x]=F[l]=F[C]=F[h]=F[d]=F[p]=F[g]=F[m]=F[v]=F[w]=F[S]=F[E]=F[A]=!1;var K="object"==typeof e&&e&&e.Object===Object&&e,q="object"==typeof self&&self&&self.Object===Object&&self,H=K||q||Function("return this")(),z=t&&!t.nodeType&&t,V=z&&"object"==typeof r&&r&&!r.nodeType&&r,G=V&&V.exports===z,W=G&&K.process,$=function(){try{return W&&W.binding&&W.binding("util")}catch(e){}}(),Y=$&&$.isTypedArray;function J(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 Z(e,t){for(var r=-1,n=Array(e);++r-1}function Fe(e,t){var r=this.__data__,n=rt(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function Ke(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t1?r[i-1]:void 0,s=i>2?r[2]:void 0;for(o=e.length>3&&"function"==typeof o?(i--,o):void 0,s&&xt(r[0],r[1],s)&&(o=i<3?void 0:o,i=1),t=Object(t);++n-1&&e%1==0&&e0){if(++t>=o)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function jt(e){if(null!=e){try{return se.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Lt(e,t){return e===t||e!=e&&t!=t}var Mt=st(function(){return arguments}())?st:function(e){return Vt(e)&&ae.call(e,"callee")&&!ve.call(e,"callee")},Dt=Array.isArray;function Ut(e){return null!=e&&Ht(e.length)&&!qt(e)}function Ft(e){return Vt(e)&&Ut(e)}var Kt=Ee||Qt;function qt(e){if(!zt(e))return!1;var t=ot(e);return t==p||t==y||t==f||t==_}function Ht(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=a}function zt(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Vt(e){return null!=e&&"object"==typeof e}function Gt(e){if(!Vt(e)||ot(e)!=v)return!1;var t=me(e);if(null===t)return!0;var r=ae.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&se.call(r)==le}var Wt=Y?X(Y):ut;function $t(e){return bt(e,Yt(e))}function Yt(e){return Ut(e)?Qe(e,!0):ct(e)}var Jt=vt(function(e,t,r){ft(e,t,r)});function Zt(e){return function(){return e}}function Xt(e){return e}function Qt(){return!1}r.exports=Jt}).call(this,r(10),r(32)(e))},function(e,t,r){"use strict";var n=r(539),i=r(323);t.isValid=function(){return this.valid},t.isInSubnet=n.isInSubnet,t.isCorrect=n.isCorrect(i.BITS),t.isCanonical=n.falseIfInvalid(function(){return this.addressMinusSuffix===this.canonicalForm()}),t.isLinkLocal=n.falseIfInvalid(function(){return"1111111010000000000000000000000000000000000000000000000000000000"===this.getBitsBase2(0,64)}),t.isMulticast=n.falseIfInvalid(function(){return"Multicast"===this.getType()}),t.is4=n.falseIfInvalid(function(){return this.v4}),t.isTeredo=n.falseIfInvalid(function(){return this.isInSubnet(new this.constructor("2001::/32"))}),t.is6to4=n.falseIfInvalid(function(){return this.isInSubnet(new this.constructor("2002::/16"))}),t.isLoopback=n.falseIfInvalid(function(){return"Loopback"===this.getType()})},function(e,t,r){"use strict";var n=r(322),i=r(543),o=r(177).sprintf;t.href=function(e){return e=void 0===e?"":o(":%s",e),o("http://[%s]%s/",this.correctForm(),e)},t.link=function(e){e||(e={}),void 0===e.className&&(e.className=""),void 0===e.prefix&&(e.prefix="/#address="),void 0===e.v4&&(e.v4=!1);var t=this.correctForm;return e.v4&&(t=this.to4in6),e.className?o('%2$s',e.prefix,t.call(this),e.className):o('%2$s',e.prefix,t.call(this))},t.group=function(){var e=this.address.match(n.RE_ADDRESS),t;if(e){var r=e[0].split(".");this.address=this.address.replace(n.RE_ADDRESS,o('%s.%s',r.slice(0,2).join("."),r.slice(2,4).join(".")))}if(0===this.elidedGroups)return i.simpleGroup(this.address);var s=[],a=this.address.split("::");a[0].length?s.push(i.simpleGroup(a[0])):s.push("");var u=["hover-group"];for(t=this.elisionBegin;t',u.join(" "))),a[1].length?s.push(i.simpleGroup(a[1],this.elisionEnd)):s.push(""),s.join(":")}},function(e,t,r){"use strict";var n=r(177).sprintf,i=r(323);function o(e){return n("(%s)",e.join("|"))}function s(e){return e.length<4?n("0{0,%d}%s",4-e.length,e):e}function a(e){var t=[];e.forEach(function(e,r){var n=parseInt(e,16);0===n&&t.push(r)});var r=t.map(function(t){return e.map(function(e,r){if(r===t){var n=0===r||r===i.GROUPS-1?":":"";return o([s(e),n])}return s(e)}).join(":")});return r.push(e.map(s).join(":")),o(r)}function u(e,t,r){var i=t?"":":",s=r?"":":",a=[];t||r||a.push("::"),t&&r&&a.push(""),(r&&!t||!r&&t)&&a.push(":"),a.push(n("%s(:0{1,4}){1,%d}",i,e-1)),a.push(n("(0{1,4}:){1,%d}%s",e-1,s)),a.push(n("(0{1,4}:){%d}0{1,4}",e-1));for(var u=1;u{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){(function(e,r){var n=200,i="Expected a function",o="__lodash_hash_undefined__",s=1,a=2,u=1/0,c=9007199254740991,f="[object Arguments]",l="[object Array]",h="[object Boolean]",d="[object Date]",p="[object Error]",y="[object Function]",g="[object GeneratorFunction]",m="[object Map]",b="[object Number]",v="[object Object]",_="[object Promise]",w="[object RegExp]",S="[object Set]",E="[object String]",k="[object Symbol]",A="[object WeakMap]",x="[object ArrayBuffer]",C="[object DataView]",T="[object Float32Array]",I="[object Float64Array]",B="[object Int8Array]",O="[object Int16Array]",P="[object Int32Array]",R="[object Uint8Array]",N="[object Uint8ClampedArray]",j="[object Uint16Array]",L="[object Uint32Array]",M=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,D=/^\w*$/,U=/^\./,F=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,K=/[\\^$.*+?()[\]{}|]/g,q=/\\(\\)?/g,H=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,V={};V[T]=V[I]=V[B]=V[O]=V[P]=V[R]=V[N]=V[j]=V[L]=!0,V[f]=V[l]=V[x]=V[h]=V[C]=V[d]=V[p]=V[y]=V[m]=V[b]=V[v]=V[w]=V[S]=V[E]=V[A]=!1;var G="object"==typeof e&&e&&e.Object===Object&&e,W="object"==typeof self&&self&&self.Object===Object&&self,$=G||W||Function("return this")(),Y=t&&!t.nodeType&&t,J=Y&&"object"==typeof r&&r&&!r.nodeType&&r,Z=J&&J.exports===Y,X=Z&&G.process,Q=function(){try{return X&&X.binding("util")}catch(e){}}(),ee=Q&&Q.isTypedArray;function te(e,t){var r=e?e.length:0;return!!r&&oe(e,t,0)>-1}function re(e,t,r){for(var n=-1,i=e?e.length:0;++n-1}function rt(e,t){var r=this.__data__,n=vt(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function nt(e){var t=-1,r=e?e.length:0;for(this.clear();++t=n){var f=t?null:Lt(e);if(f)return ye(f);a=!1,o=fe,c=new ct}else c=t?[]:u;e:for(;++ic))return!1;var l=o.get(e);if(l&&o.get(t))return l==t;var h=-1,d=!0,p=i&s?new ct:void 0;for(o.set(e,t),o.set(t,e);++h-1&&e%1==0&&e-1&&e%1==0&&e<=c}function fr(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function lr(e){return!!e&&"object"==typeof e}function hr(e){return"symbol"==typeof e||lr(e)&&ke.call(e)==k}var dr=ee?ce(ee):Ct;function pr(e){return null==e?"":Rt(e)}function yr(e,t,r){var n=null==e?void 0:_t(e,t);return void 0===n?r:n}function gr(e,t){return null!=e&&zt(e,t,St)}function mr(e){return sr(e)?bt(e):It(e)}function br(e){return e}function vr(){}function _r(e){return Gt(e)?ae(Qt(e)):Pt(e)}r.exports=tr}).call(this,r(10),r(32)(e))},function(e,t,r){"use strict";(function(t){const n=r(62),i=r(235),o=r(1098),s=r(325),a=r(22);function u(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n=r.length)throw S("invalid address: "+e);t.push([i,r[n]])}else t.push([i])}return t}function c(e){const t=[];return n(e,function(e){const r=E(e);t.push(r.name),e.length>1&&t.push(e[1])}),"/"+t.join("/")}function f(e){return n(e,function(e){Array.isArray(e)||(e=[e]);const t=E(e);return e.length>1?[t.code,o.toBuffer(t.code,e[1])]:[t.code]})}function l(e){return n(e,function(e){const t=E(e);return e.length>1?[t.code,o.toString(t.code,e[1])]:[t.code]})}function h(e){return b(t.concat(n(e,function(e){const r=E(e);let n=t.from(a.encode(r.code));return e.length>1&&(n=t.concat([n,e[1]])),n})))}function d(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;{const e=a.decode(t);return e+a.decode.bytes}}function p(e){const t=[];let r=0;for(;re.length)throw S("Invalid address buffer: "+e.toString("hex"));t.push([n,c])}return t}function y(e){const t=p(e),r=l(t);return c(r)}function g(e){e=w(e);const t=u(e),r=f(t);return h(r)}function m(e){return g(e)}function b(e){const r=v(e);if(r)throw r;return t.from(e)}function v(e){try{p(e)}catch(e){return e}}function _(e){return void 0===v(e)}function w(e){return"/"+i(e.trim().split("/")).join("/")}function S(e){return new Error("Error parsing address: "+e)}function E(e){const t=s(e[0]);return t}e.exports={stringToStringTuples:u,stringTuplesToString:c,tuplesToStringTuples:l,stringTuplesToTuples:f,bufferToTuples:p,tuplesToBuffer:h,bufferToString:y,stringToBuffer:g,fromString:m,fromBuffer:b,validateBuffer:v,isValidBuffer:_,cleanPath:w,ParseError:S,protoFromTuple:E,sizeForAddr:d}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(236),i=r(237),o=r(325),s=r(14),a=r(22);function u(e,r){return r instanceof t?u.toString(e,r):u.toBuffer(e,r)}function c(e){if(!e.isValid())throw new Error("invalid ip address");return n.toBuffer(e.address)}function f(e){const r=t.alloc(2);return r.writeUInt16BE(e,0),r}function l(e){return e.readUInt16BE(0)}function h(e){const r=t.from(e),n=t.from(a.encode(r.length));return t.concat([n,r])}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 p(e){const r=t.from(s.decode(e)),n=t.from(a.encode(r.length));return t.concat([n,r])}function y(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 n.toString(r);case 6:case 17:case 33:case 132:return l(r);case 54:case 55:case 56:return d(r);case 421:return y(r);default:return r.toString("hex")}},u.toBuffer=function e(r,n){switch(r=o(r),r.code){case 4:return c(new i.Address4(n));case 41:return c(new i.Address6(n));case 6:case 17:case 33:case 132:return f(parseInt(n,10));case 54:case 55:case 56:return h(n);case 421:return p(n);default:return t.from(n,"hex")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(18),o=r(1100),s=r(20),a=r(6);class u{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.keys.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return o.keys.marshalPrivateKey(this.privKey)}toPrint(){return this.toJSON()}toJSON(){return{id:this.toB58String(),privKey:c(this.marshalPrivKey()),pubKey:c(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"))}}function c(e){if(e)return e.toString("base64")}t=e.exports=u,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.keys.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 u(r,n))})},t.createFromHexString=function(e){return new u(i.fromHexString(e))},t.createFromBytes=function(e){return new u(e)},t.createFromB58String=function(e){return new u(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.keys.unmarshalPublicKey(i)}catch(e){return t(e)}r.hash((e,n)=>{if(e)return t(e);t(null,new u(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.keys.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 u(r,n,n.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r,s,c,f;try{r=i.fromB58String(e.id),s=e.privKey&&n.from(e.privKey,"base64"),c=e.pubKey&&n.from(e.pubKey,"base64"),f=c&&o.keys.unmarshalPublicKey(c)}catch(e){return t(e)}s?a([e=>o.keys.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)}),(e,t,r)=>{f?f.hash((n,i)=>{r(n,e,t,i)}):r(null,e,t)}],(e,n,i,o)=>e?t(e):f&&!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 u(r,i,f))):t(null,new u(r,null,f))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(545),i=r(1102),o=r(1104);t=e.exports,t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(554),t.pbkdf2=r(1123)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(1103),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(99);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(17),o=i(r(328)),s=r(24);t=e.exports;const a={rsa:r(1105),ed25519:r(1118),secp256k1:r(101)(o,r(554))};function u(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=o,t.keyStretcher=r(1120),t.generateEphemeralKeyPair=r(1121),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){"use strict";const n=r(546),i=r(17),o=r(14),s=r(548),a=i(r(328)),u=r(24),c=r(7);class f{constructor(e){this._key=e}verify(e,t,r){g(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return s.utils.jwkToPkix(this._key)}get bytes(){return a.PublicKey.encode({Type:a.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),n(this.bytes,"sha2-256",e)}}class l{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return s.getRandomValues(new Uint8Array(16))}sign(e,t){g(t),s.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){s.decrypt(this._key,e,t)}marshal(){return s.utils.jwkToPkcs1(this._key)}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(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"),g(r),c(()=>{let n=null,i=null;try{const r=new u.util.ByteBuffer(this.marshal()),o=u.asn1.fromDer(r),s=u.pki.privateKeyFromAsn1(o);if("pkcs-8"===e){const e={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};i=u.pki.encryptRsaPrivateKey(s,t,e)}else n=new Error(`Unknown export format '${e}'`)}catch(e){n=e}r(n,i)})}}function h(e,t){const r=s.utils.pkcs1ToJwk(e);s.unmarshalPrivateKey(r,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function d(e){const t=s.utils.pkixToJwk(e);return new f(t)}function p(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function y(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function g(e){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:d,unmarshalRsaPrivateKey:h,generateKeyPair:y,fromJwk:p}},function(e,t,r){"use strict";(function(t){const n=r(107),i=r(108),o=r(547),s=r(1107),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(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(1108),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(109),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");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){"use strict";(function(t){const n=r(110),i=r(547).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";const n=r(138),i=r(553),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,r){"use strict";const n=r(138),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(121).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(e,t,r){"use strict";const n=r(1);function i(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function o(e,t){this.path=e,this.rethrow(t)}t.Reporter=i,i.prototype.isError=function e(t){return t instanceof o},i.prototype.save=function e(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},i.prototype.restore=function e(t){const r=this._reporterState;r.obj=t.obj,r.path=r.path.slice(0,t.pathLen)},i.prototype.enterKey=function e(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function e(t){const r=this._reporterState;r.path=r.path.slice(0,t-1)},i.prototype.leaveKey=function e(t,r,n){const i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[r]=n)},i.prototype.path=function e(){return this._reporterState.path.join("/")},i.prototype.enterObject=function e(){const t=this._reporterState,r=t.obj;return t.obj={},r},i.prototype.leaveObject=function e(t){const r=this._reporterState,n=r.obj;return r.obj=t,n},i.prototype.error=function e(t){let r;const n=this._reporterState,i=t instanceof o;if(r=i?t:new o(n.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),t.message||t,t.stack),!n.options.partial)throw r;return i||n.errors.push(r),r},i.prototype.wrapResult=function e(t){const r=this._reporterState;return r.options.partial?{result:this.isError(t)?null:t,errors:r.errors}:t},n(o,Error),o.prototype.rethrow=function e(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},function(e,t,r){"use strict";const n=r(178).Reporter,i=r(178).EncoderBuffer,o=r(178).DecoderBuffer,s=r(49),a=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(a),c=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function f(e,t){const r={};this._baseState=r,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}e.exports=f;const l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];f.prototype.clone=function e(){const t=this._baseState,r={};l.forEach(function(e){r[e]=t[e]});const n=new this.constructor(r.parent);return n._baseState=r,n},f.prototype._wrap=function e(){const t=this._baseState;u.forEach(function(e){this[e]=function r(){const n=new this.constructor(this);return t.children.push(n),n[e].apply(n,arguments)}},this)},f.prototype._init=function e(t){const r=this._baseState;s(null===r.parent),t.call(this),r.children=r.children.filter(function(e){return e._baseState.parent===this},this),s.equal(r.children.length,1,"Root node can have only one child")},f.prototype._useArgs=function e(t){const r=this._baseState,n=t.filter(function(e){return e instanceof this.constructor},this);t=t.filter(function(e){return!(e instanceof this.constructor)},this),0!==n.length&&(s(null===r.children),r.children=n,n.forEach(function(e){e._baseState.parent=this},this)),0!==t.length&&(s(null===r.args),r.args=t,r.reverseArgs=t.map(function(e){if("object"!=typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach(function(r){r==(0|r)&&(r|=0);const n=e[r];t[n]=r}),t}))},c.forEach(function(e){f.prototype[e]=function t(){const r=this._baseState;throw new Error(e+" not implemented for encoding: "+r.enc)}}),a.forEach(function(e){f.prototype[e]=function t(){const r=this._baseState,n=Array.prototype.slice.call(arguments);return s(null===r.tag),r.tag=e,this._useArgs(n),this}}),f.prototype.use=function e(t){s(t);const r=this._baseState;return s(null===r.use),r.use=t,this},f.prototype.optional=function e(){const t=this._baseState;return t.optional=!0,this},f.prototype.def=function e(t){const r=this._baseState;return s(null===r.default),r.default=t,r.optional=!0,this},f.prototype.explicit=function e(t){const r=this._baseState;return s(null===r.explicit&&null===r.implicit),r.explicit=t,this},f.prototype.implicit=function e(t){const r=this._baseState;return s(null===r.explicit&&null===r.implicit),r.implicit=t,this},f.prototype.obj=function e(){const t=this._baseState,r=Array.prototype.slice.call(arguments);return t.obj=!0,0!==r.length&&this._useArgs(r),this},f.prototype.key=function e(t){const r=this._baseState;return s(null===r.key),r.key=t,this},f.prototype.any=function e(){const t=this._baseState;return t.any=!0,this},f.prototype.choice=function e(t){const r=this._baseState;return s(null===r.choice),r.choice=t,this._useArgs(Object.keys(t).map(function(e){return t[e]})),this},f.prototype.contains=function e(t){const r=this._baseState;return s(null===r.use),r.contains=t,this},f.prototype._decode=function e(t,r){const n=this._baseState;if(null===n.parent)return t.wrapResult(n.children[0]._decode(t,r));let i=n.default,s=!0,a=null,u;if(null!==n.key&&(a=t.enterKey(n.key)),n.optional){let e=null;if(null!==n.explicit?e=n.explicit:null!==n.implicit?e=n.implicit:null!==n.tag&&(e=n.tag),null!==e||n.any){if(s=this._peekTag(t,e,n.any),t.isError(s))return s}else{const e=t.save();try{null===n.choice?this._decodeGeneric(n.tag,t,r):this._decodeChoice(t,r),s=!0}catch(e){s=!1}t.restore(e)}}if(n.obj&&s&&(u=t.enterObject()),s){if(null!==n.explicit){const e=this._decodeTag(t,n.explicit);if(t.isError(e))return e;t=e}const e=t.offset;if(null===n.use&&null===n.choice){let e;n.any&&(e=t.save());const r=this._decodeTag(t,null!==n.implicit?n.implicit:n.tag,n.any);if(t.isError(r))return r;n.any?i=t.raw(e):t=r}if(r&&r.track&&null!==n.tag&&r.track(t.path(),e,t.length,"tagged"),r&&r.track&&null!==n.tag&&r.track(t.path(),t.offset,t.length,"content"),n.any||(i=null===n.choice?this._decodeGeneric(n.tag,t,r):this._decodeChoice(t,r)),t.isError(i))return i;if(n.any||null!==n.choice||null===n.children||n.children.forEach(function e(n){n._decode(t,r)}),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){const e=new o(i);i=this._getUse(n.contains,t._reporterState.obj)._decode(e,r)}}return n.obj&&s&&(i=t.leaveObject(u)),null===n.key||null===i&&!0!==s?null!==a&&t.exitKey(a):t.leaveKey(a,n.key,i),i},f.prototype._decodeGeneric=function e(t,r,n){const i=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(r,t,i.args[0],n):/str$/.test(t)?this._decodeStr(r,t,n):"objid"===t&&i.args?this._decodeObjid(r,i.args[0],i.args[1],n):"objid"===t?this._decodeObjid(r,null,null,n):"gentime"===t||"utctime"===t?this._decodeTime(r,t,n):"null_"===t?this._decodeNull(r,n):"bool"===t?this._decodeBool(r,n):"objDesc"===t?this._decodeStr(r,t,n):"int"===t||"enum"===t?this._decodeInt(r,i.args&&i.args[0],n):null!==i.use?this._getUse(i.use,r._reporterState.obj)._decode(r,n):r.error("unknown tag: "+t)},f.prototype._getUse=function e(t,r){const n=this._baseState;return n.useDecoder=this._use(t,r),s(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},f.prototype._decodeChoice=function e(t,r){const n=this._baseState;let i=null,o=!1;return Object.keys(n.choice).some(function(e){const s=t.save(),a=n.choice[e];try{const n=a._decode(t,r);if(t.isError(n))return!1;i={type:e,value:n},o=!0}catch(e){return t.restore(s),!1}return!0},this),o?i:t.error("Choice not matched")},f.prototype._createEncoderBuffer=function e(t){return new i(t,this.reporter)},f.prototype._encode=function e(t,r,n){const i=this._baseState;if(null!==i.default&&i.default===t)return;const o=this._encodeValue(t,r,n);return void 0===o||this._skipDefault(o,r,n)?void 0:o},f.prototype._encodeValue=function e(t,r,i){const o=this._baseState;if(null===o.parent)return o.children[0]._encode(t,r||new n);let s=null;if(this.reporter=r,o.optional&&void 0===t){if(null===o.default)return;t=o.default}let a=null,u=!1;if(o.any)s=this._createEncoderBuffer(t);else if(o.choice)s=this._encodeChoice(t,r);else if(o.contains)a=this._getUse(o.contains,i)._encode(t,r),u=!0;else if(o.children)a=o.children.map(function(e){if("null_"===e._baseState.tag)return e._encode(null,r,t);if(null===e._baseState.key)return r.error("Child should have a key");const n=r.enterKey(e._baseState.key);if("object"!=typeof t)return r.error("Child expected, but input is not object");const i=e._encode(t[e._baseState.key],r,t);return r.leaveKey(n),i},this).filter(function(e){return e}),a=this._createEncoderBuffer(a);else if("seqof"===o.tag||"setof"===o.tag){if(!o.args||1!==o.args.length)return r.error("Too many args for : "+o.tag);if(!Array.isArray(t))return r.error("seqof/setof, but data is not Array");const e=this.clone();e._baseState.implicit=null,a=this._createEncoderBuffer(t.map(function(e){const n=this._baseState;return this._getUse(n.args[0],t)._encode(e,r)},e))}else null!==o.use?s=this._getUse(o.use,i)._encode(t,r):(a=this._encodePrimitive(o.tag,t),u=!0);if(!o.any&&null===o.choice){const e=null!==o.implicit?o.implicit:o.tag,t=null===o.implicit?"universal":"context";null===e?null===o.use&&r.error("Tag could be omitted only for .use()"):null===o.use&&(s=this._encodeComposite(e,u,t,a))}return null!==o.explicit&&(s=this._encodeComposite(o.explicit,!1,"context",s)),s},f.prototype._encodeChoice=function e(t,r){const n=this._baseState,i=n.choice[t.type];return i||s(!1,t.type+" not found in "+JSON.stringify(Object.keys(n.choice))),i._encode(t.value,r)},f.prototype._encodePrimitive=function e(t,r){const n=this._baseState;if(/str$/.test(t))return this._encodeStr(r,t);if("objid"===t&&n.args)return this._encodeObjid(r,n.reverseArgs[0],n.args[1]);if("objid"===t)return this._encodeObjid(r,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(r,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(r,n.args&&n.reverseArgs[0]);if("bool"===t)return this._encodeBool(r);if("objDesc"===t)return this._encodeStr(r,t);throw new Error("Unsupported tag: "+t)},f.prototype._isNumstr=function e(t){return/^[0-9 ]*$/.test(t)},f.prototype._isPrintstr=function e(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},function(e,t,r){"use strict";const n=r(550);t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=n._reverse(t.tagClass),t.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},t.tagByName=n._reverse(t.tag)},function(e,t,r){"use strict";const n=t;n.der=r(551),n.pem=r(1115)},function(e,t,r){"use strict";const n=r(1),i=r(0).Buffer,o=r(551);function s(e){o.call(this,e),this.enc="pem"}n(s,o),e.exports=s,s.prototype.decode=function e(t,r){const n=t.toString().split(/[\r\n]+/g),s=r.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/;let u=-1,c=-1;for(let e=0;e{if(t)return e(t);e(null,o.encode(r))})}}function f(e,t){try{e=y(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 l(e){return e=y(e,s.publicKeyLength),new u(e)}function h(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 y(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:l,generateKeyPair:h,generateKeyPairFromSeed:d}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(100),i=r(7);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){"use strict";(function(t){const n=r(60),i=r(545),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,l=20,h=t.from("key expansion"),d=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(h,(e,i)=>{if(e)return a(e);let o=[],s=0;function u(e){r.digest(t.concat([i,h]),(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 l(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(327)(),i=r(326),o=r(138).bignum,s=r(553),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",h(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:l(e),genSharedKey:o}))}),r)};const f={"P-256":32,"P-384":48,"P-521":66};function l(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 h(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=h(e,t.public);return r.d=a(new o(t.private)),r}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(24),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function o(e,t,r,o,s){const a=i[s];if(!a)throw new Error(`Hash '${s}' is unknown or not supported`);const u=n.pkcs5.pbkdf2(e,t,r,o,a);return n.util.encode64(u)}e.exports=o},function(e,t,r){"use strict";(function(n){const i=r(1125);t=e.exports=s,t.encode=a,t.decode=u,t.isEncoded=c;const o=new Error("Unsupported encoding");function s(e,t){if(!t)throw new Error("requires an encoded buffer");const r=l(e),i=n.from(r.code),o=r.name;return f(o,t),n.concat([i,t])}function a(e,t){const r=l(e),i=r.name;return s(i,n.from(r.encode(t)))}function u(e){n.isBuffer(e)&&(e=e.toString());const t=e.substring(0,1);e=e.substring(1,e.length),"string"==typeof e&&(e=n.from(e));const r=l(t),i={base:r.name,data:n.from(r.decode(e.toString()))};return i.data}function c(e){n.isBuffer(e)&&(e=e.toString());const t=e.substring(0,1);try{const e=l(t);return e.name}catch(e){return!1}}function f(e,t){const r=l(e);r.decode(t.toString())}function l(e){let t;if(i.names[e])t=i.names[e];else{if(!i.codes[e])throw o;t=i.codes[e]}if(!t.isImplemented())throw new Error("Base "+e+" is not implemented yet");return t}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1126),i=r(203),o=r(1127),s=r(1128),a=r(1129),u=[["base1","1","","1"],["base2","0",i,"01"],["base8","7",i,"01234567"],["base10","9",i,"0123456789"],["base16","f",o,"0123456789abcdef"],["base32","b",s,"abcdefghijklmnopqrstuvwxyz234567"],["base32pad","c",s,"abcdefghijklmnopqrstuvwxyz234567="],["base32hex","v",s,"0123456789abcdefghijklmnopqrstuv"],["base32hexpad","t",s,"0123456789abcdefghijklmnopqrstuv="],["base32z","h",s,"ybndrfg8ejkmcpqxot1uwisza345h769"],["base58flickr","Z",i,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base58btc","z",i,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base64","m",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],c=u.reduce((e,t)=>(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("+","-"),r=r.replace("/","_"));const o=r.indexOf("=");return o>0&&!n&&(r=r.substring(0,o)),r},decode(e){i&&(e=e.replace("+","-"),e=e.replace("/","_"));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";const n=r(555).extend(r(1131)),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}))}).allow(null),init:n.alternatives().try(n.boolean(),n.object().keys({bits:n.number().integer()})).allow(null),start: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(),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.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(1132),i=r(88);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";(function(n){const i=r(62),o=r(28),s=r(1133),a=r(330),u=r(22),c=r(14),f=r(41),l=new Error("Sorry, Not Implemented Yet."),h=f.proto(function(e){if(!(this instanceof h))return new h(e);if(null==e&&(e=""),e instanceof n)this.buffer=s.fromBuffer(e);else if("string"==typeof e||e instanceof String)this.buffer=s.fromString(e);else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=s.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});h.prototype.toString=function e(){return s.bufferToString(this.buffer)},h.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},h.prototype.inspect=function e(){return""},h.prototype.protos=function e(){return i(this.protoCodes(),function(e){return o(a(e))})},h.prototype.protoCodes=function e(){const t=[],r=this.buffer;let n=0;for(;n{if(e[0]===a.names.ipfs.code)return!0})[0][1],c.decode(t)}catch(e){t=null}return t},h.prototype.equals=function e(t){return this.buffer.equals(t.buffer)},h.prototype.nodeAddress=function e(){if(!this.isThinWaistAddress())throw new Error('Multiaddr must be "thin waist" address for nodeAddress.');const t=this.protoCodes(),r=this.toString().split("/").slice(1);return{family:41===t[0]?"IPv6":"IPv4",address:r[1],port:r[3]}},h.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 h("/"+[n,t.address,r,t.port].join("/"))},h.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||17===r[1].code))},h.prototype.fromStupidString=function e(t){throw l},h.protocols=a,h.isName=function e(t){return!!h.isMultiaddr(t)&&t.protos().some(e=>e.resolvable)},h.resolve=function e(t,r){return h.isMultiaddr(t)&&h.isName(t)?r(new Error("not implemented yet")):r(new Error("not a valid name"))},t=e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(62),i=r(235),o=r(1134),s=r(330),a=r(22);function u(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n=r.length)throw S("invalid address: "+e);t.push([i,r[n]])}else t.push([i])}return t}function c(e){const t=[];return n(e,function(e){const r=E(e);t.push(r.name),e.length>1&&t.push(e[1])}),"/"+t.join("/")}function f(e){return n(e,function(e){Array.isArray(e)||(e=[e]);const t=E(e);return e.length>1?[t.code,o.toBuffer(t.code,e[1])]:[t.code]})}function l(e){return n(e,function(e){const t=E(e);return e.length>1?[t.code,o.toString(t.code,e[1])]:[t.code]})}function h(e){return b(t.concat(n(e,function(e){const r=E(e);let n=t.from(a.encode(r.code));return e.length>1&&(n=t.concat([n,e[1]])),n})))}function d(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;{const e=a.decode(t);return e+a.decode.bytes}}function p(e){const t=[];let r=0;for(;re.length)throw S("Invalid address buffer: "+e.toString("hex"));t.push([n,c])}return t}function y(e){const t=p(e),r=l(t);return c(r)}function g(e){e=w(e);const t=u(e),r=f(t);return h(r)}function m(e){return g(e)}function b(e){const r=v(e);if(r)throw r;return t.from(e)}function v(e){try{p(e)}catch(e){return e}}function _(e){return void 0===v(e)}function w(e){return"/"+i(e.trim().split("/")).join("/")}function S(e){return new Error("Error parsing address: "+e)}function E(e){const t=s(e[0]);return t}e.exports={stringToStringTuples:u,stringTuplesToString:c,tuplesToStringTuples:l,stringTuplesToTuples:f,bufferToTuples:p,tuplesToBuffer:h,bufferToString:y,stringToBuffer:g,fromString:m,fromBuffer:b,validateBuffer:v,isValidBuffer:_,cleanPath:w,ParseError:S,protoFromTuple:E,sizeForAddr:d}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(236),i=r(237),o=r(330),s=r(14),a=r(22);function u(e,r){return r instanceof t?u.toString(e,r):u.toBuffer(e,r)}function c(e){if(!e.isValid())throw new Error("invalid ip address");return n.toBuffer(e.address)}function f(e){const r=t.alloc(2);return r.writeUInt16BE(e,0),r}function l(e){return e.readUInt16BE(0)}function h(e){const r=t.from(e),n=t.from(a.encode(r.length));return t.concat([n,r])}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 p(e){const r=t.from(s.decode(e)),n=t.from(a.encode(r.length));return t.concat([n,r])}function y(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 n.toString(r);case 6:case 17:case 33:case 132:return l(r);case 54:case 55:case 56:return d(r);case 421:return y(r);default:return r.toString("hex")}},u.toBuffer=function e(r,n){switch(r=o(r),r.code){case 4:return c(new i.Address4(n));case 41:return c(new i.Address6(n));case 6:case 17:case 33:case 132:return f(parseInt(n,10));case 54:case 55:case 56:return h(n);case 421:return p(n);default:return t.from(n,"hex")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(62),o=r(28),s=r(1136),a=r(331),u=r(22),c=r(14),f=r(41),l=new Error("Sorry, Not Implemented Yet."),h=f.proto(function(e){if(!(this instanceof h))return new h(e);if(null==e&&(e=""),e instanceof n)this.buffer=s.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=s.fromString(e)}else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=s.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});h.prototype.toString=function e(){return s.bufferToString(this.buffer)},h.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},h.prototype.inspect=function e(){return""},h.prototype.protos=function e(){return i(this.protoCodes(),function(e){return o(a(e))})},h.prototype.protoCodes=function e(){const t=[],r=this.buffer;let n=0;for(;n{if(e[0]===a.names.ipfs.code)return!0})[0][1],c.decode(t)}catch(e){t=null}return t},h.prototype.equals=function e(t){return this.buffer.equals(t.buffer)},h.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]}},h.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 h("/"+[n,t.address,r,t.port].join("/"))},h.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))},h.prototype.fromStupidString=function e(t){throw l},h.protocols=a,h.isName=function e(t){return!!h.isMultiaddr(t)&&t.protos().some(e=>e.resolvable)},h.resolve=function e(t,r){return h.isMultiaddr(t)&&h.isName(t)?r(new Error("not implemented yet")):r(new Error("not a valid name"))},t=e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(62),i=r(235),o=r(1137),s=r(331),a=r(22);function u(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n=r.length)throw S("invalid address: "+e);t.push([i,r[n]])}else t.push([i])}return t}function c(e){const t=[];return n(e,function(e){const r=E(e);t.push(r.name),e.length>1&&t.push(e[1])}),"/"+t.join("/")}function f(e){return n(e,function(e){Array.isArray(e)||(e=[e]);const t=E(e);return e.length>1?[t.code,o.toBuffer(t.code,e[1])]:[t.code]})}function l(e){return n(e,function(e){const t=E(e);return e.length>1?[t.code,o.toString(t.code,e[1])]:[t.code]})}function h(e){return b(t.concat(n(e,function(e){const r=E(e);let n=t.from(a.encode(r.code));return e.length>1&&(n=t.concat([n,e[1]])),n})))}function d(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;{const e=a.decode(t);return e+a.decode.bytes}}function p(e){const t=[];let r=0;for(;re.length)throw S("Invalid address buffer: "+e.toString("hex"));t.push([n,c])}return t}function y(e){const t=p(e),r=l(t);return c(r)}function g(e){e=w(e);const t=u(e),r=f(t);return h(r)}function m(e){return g(e)}function b(e){const r=v(e);if(r)throw r;return t.from(e)}function v(e){try{p(e)}catch(e){return e}}function _(e){return void 0===v(e)}function w(e){return"/"+i(e.trim().split("/")).join("/")}function S(e){return new Error("Error parsing address: "+e)}function E(e){const t=s(e[0]);return t}e.exports={stringToStringTuples:u,stringTuplesToString:c,tuplesToStringTuples:l,stringTuplesToTuples:f,bufferToTuples:p,tuplesToBuffer:h,bufferToString:y,stringToBuffer:g,fromString:m,fromBuffer:b,validateBuffer:v,isValidBuffer:_,cleanPath:w,ParseError:S,protoFromTuple:E,sizeForAddr:d}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(236),i=r(237),o=r(331),s=r(14),a=r(22);function u(e,r){return r instanceof t?u.toString(e,r):u.toBuffer(e,r)}function c(e){if(!e.isValid())throw new Error("invalid ip address");return n.toBuffer(e.address)}function f(e){const r=t.alloc(2);return r.writeUInt16BE(e,0),r}function l(e){return e.readUInt16BE(0)}function h(e){const r=t.from(e),n=t.from(a.encode(r.length));return t.concat([n,r])}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 p(e){const r=t.from(s.decode(e)),n=t.from(a.encode(r.length));return t.concat([n,r])}function y(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 n.toString(r);case 6:case 273:case 33:case 132:return l(r);case 54:case 55:case 56:return d(r);case 421:return y(r);default:return r.toString("hex")}},u.toBuffer=function e(r,n){switch(r=o(r),r.code){case 4:return c(new i.Address4(n));case 41:return c(new i.Address6(n));case 6:case 273:case 33:case 132:return f(parseInt(n,10));case 54:case 55:case 56:return h(n);case 421:return p(n);default:return t.from(n,"hex")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(6),i=r(332).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.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(47).Key,i=r(5),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(`version mismatch: expected v${e}, found v${n}`));t()})}}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(8),i=r(7),o=r(333).asyncFilter,s=r(333).asyncSort,a=r(556);class u{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(new Error("No value")))}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=u},function(e,t,r){"use strict";const n=r(47).Key,i=r(162),o=r(6),s=r(211),a=r(416),u=r(417),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"));let 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)),l],t):l(i,t)}function l(t,r){const n=c.from(JSON.stringify(t,null,2));e.put(f,n,r)}})},function(e,t,r){"use strict";(function(t){const n=r(47).Key,i=r(418),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(47).Key,i=r(4).Buffer,o=new n("api");e.exports=(e=>({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(1146),i=n.ShardingDatastore,o=r(47).Key,s=r(421),a=r(104),u=r(7),c=r(283),f=r(9),l=r(8),h=e=>{const t=new s.Encoder;return new o("/"+t.write(e).finalize(),!1)},d=e=>h(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 y(e){return{query(t,r){l(e.query(t),l.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,(e,n)=>{if(e)return r(e);r(null,new a(n,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),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)}}}e.exports=((e,t,r)=>{p(e,t,(e,t)=>{if(e)return r(e);r(null,y(t))})})},function(e,t,r){"use strict";const n=r(238),i=r(1147),o=r(1149),s=r(1150),a=r(1151),u=r(557);t.KeytransformDatastore=n,t.ShardingDatastore=i,t.MountDatastore=o,t.TieredDatastore=s,t.NamespaceDatastore=a,t.shard=u},function(e,t,r){"use strict";(function(t){const n=r(6),i=r(48),o=r(47).Key,s=r(557),a=r(238),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(43),i=r(420),o=r(8),s=r(47).Key,a=r(47).utils,u=a.asyncFilter,c=a.asyncSort,f=a.replaceStartWith,l=r(238);class h{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=f(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);null!=n?n.datastore.put(n.rest,t,r):r(new Error("No datastore mounted for this key"))}get(e,t){const r=this._lookup(e);null!=r?r.datastore.get(r.rest,t):t(new Error("No datastore mounted for this key"))}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);null!=r?r.datastore.delete(r.rest,t):t(new Error("No datastore mounted for this key"))}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=f(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=>u(e)))),null!=e.orders&&(r=r.concat(e.orders.map(e=>c(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=h},function(e,t,r){"use strict";const n=r(43),i=r(60);class o{constructor(e){this.stores=e.slice()}open(e){n(this.stores,(e,t)=>{e.open(t)},e)}put(e,t,r){n(this.stores,(r,n)=>{r.put(e,t,n)},r)}get(e,t){const r=this.stores.length;let n=!1,o=0;i(()=>!n&&o{const r=this.stores[o++];r.get(e,(e,r)=>{if(null==e)return n=!0,t(null,r);t()})},t)}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)},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=o},function(e,t,r){"use strict";const n=r(47).Key,i=r(238);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";e.exports={lock:"memory",storageBackends:{root:r(239),blocks:r(239),keys:r(239),datastore:r(239)},storageBackendOptions:{root:{extension:""},blocks:{sharding:!1},keys:{sharding:!1}}}},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,r){"use strict";t.preStart=r(1157),t.start=r(1230),t.stop=r(1253),t.isOnline=r(1254),t.version=r(1255),t.id=r(1256),t.repo=r(575),t.init=r(1257),t.bootstrap=r(1259),t.config=r(1260),t.block=r(1261),t.object=r(1262),t.dag=r(1264),t.libp2p=r(1269),t.swarm=r(1523),t.ping=r(1524),t.pingPullStream=r(1525),t.pingReadableStream=r(1526),t.pin=r(1527),t.files=r(1534),t.bitswap=r(661),t.pubsub=r(1569),t.dht=r(1570),t.dns=r(1573),t.key=r(1575),t.stats=r(1576),t.mfs=r(1578)},function(e,t,r){"use strict";const n=r(50),i=r(46),o=r(27),s=r(6),a=r(559),u=r(329),c=r(1229);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);u(e,t._options.config),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(1159),i=r(1163),o=r(85),s=r(1218),a=r(8),u=r(1220),c=r(1221),f=r(1226),l="/pkcs8/",h="/info/",d={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 y(e){return!!e&&(!!u(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(l+e)}function b(e){return new s.Key(h+e)}class v{constructor(e,t){if(!e)throw new Error("store is required");this.store=e;const r={};if(i(r,p,t),!r.passPhrase||r.passPhrase.length<20)throw new Error("passPhrase must be least 20 characters");if(r.dek.keyLengthn})}get cms(){return new f(this)}static generateOptions(){const e=Object.assign({},p),t=3*Math.ceil(d.minSaltLength/3);return e.dek.salt=o.randomBytes(t).toString("base64"),e}static get options(){return p}createKey(e,t,r,n){const i=this;if(!y(e)||"self"===e)return g(n,`Invalid key name '${e}'`);if(!u(t))return g(n,`Invalid key type '${t}'`);if(!c(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};a(this.store.query(r),a.collect((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(!y(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(!y(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(!y(e)||"self"===e)return g(r,`Invalid old key name '${e}'`);if(!y(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 l=n.store.batch();l.put(o,f),l.put(a,JSON.stringify(c)),l.delete(i),l.delete(s),l.commit(e=>{if(e)return g(r,e);r(null,c)})}))})}exportKey(e,t,r){if(!y(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(!y(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(!y(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(!y(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=v},function(e,t,r){"use strict";var n=r(1160),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(1161),i=r(1162);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){var n=r(1164),i=r(1210),o=i(function(e,t,r){n(e,t,r)});e.exports=o},function(e,t,r){var n=r(1165),i=r(562),o=r(1193),s=r(1195),a=r(80),u=r(566),c=r(565);function f(e,t,r,l,h){e!==t&&o(t,function(o,u){if(a(o))h||(h=new n),s(e,t,u,r,f,l,h);else{var d=l?l(c(e,u),o,u+"",e,t,h):void 0;void 0===d&&(d=o),i(e,u,d)}},u)}e.exports=f},function(e,t,r){var n=r(240),i=r(1171),o=r(1172),s=r(1173),a=r(1174),u=r(1175);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){function r(){this.__data__=[],this.size=0}e.exports=r},function(e,t,r){var n=r(241),i=Array.prototype,o=i.splice;function s(e){var t=this.__data__,r=n(t,e);if(r<0)return!1;var i=t.length-1;return r==i?t.pop():o.call(t,r,1),--this.size,!0}e.exports=s},function(e,t,r){var n=r(241);function i(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}e.exports=i},function(e,t,r){var n=r(241);function i(e){return n(this.__data__,e)>-1}e.exports=i},function(e,t,r){var n=r(241);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(240);function i(){this.__data__=new n,this.size=0}e.exports=i},function(e,t){function r(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}e.exports=r},function(e,t){function r(e){return this.__data__.get(e)}e.exports=r},function(e,t){function r(e){return this.__data__.has(e)}e.exports=r},function(e,t,r){var n=r(240),i=r(560),o=r(561),s=200;function a(e,t){var r=this.__data__;if(r instanceof n){var a=r.__data__;if(!i||a.length1?r[o-1]:void 0,a=o>2?r[2]:void 0;for(s=e.length>3&&"function"==typeof s?(o--,s):void 0,a&&i(r[0],r[1],a)&&(s=o<3?void 0:s,o=1),t=Object(t);++n0){if(++t>=r)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}e.exports=o},function(e,t,r){var n=r(242),i=r(92),o=r(408),s=r(80);function a(e,t,r){if(!s(r))return!1;var a=typeof t;return!!("number"==a?i(r)&&o(t,r.length):"string"==a&&t in r)&&n(r[t],e)}e.exports=a},function(e,t,r){"use strict";const n=r(568),i=r(1219),o=r(336),s=r(569);t.Key=n,t.MemoryDatastore=i,t.utils=o,t.Errors=s},function(e,t,r){"use strict";const n=r(8),i=r(7),o=r(336).asyncFilter,s=r(336).asyncSort,a=r(568),u=r(569);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){var n=r(127),i=r(81),o=r(105),s="[object String]";function a(e){return"string"==typeof e||!i(e)&&o(e)&&n(e)==s}e.exports=a},function(e,t,r){var n=r(1222),i=9007199254740991;function o(e){return n(e)&&e>=-i&&e<=i}e.exports=o},function(e,t,r){var n=r(1223);function i(e){return"number"==typeof e&&e==n(e)}e.exports=i},function(e,t,r){var n=r(1224);function i(e){var t=n(e),r=t%1;return t==t?r?t-r:t:0}e.exports=i},function(e,t,r){var n=r(1225),i=1/0,o=1.7976931348623157e308;function s(e){if(!e)return 0===e?e:0;if(e=n(e),e===i||e===-i){var t=e<0?-1:1;return t*o}return e==e?e:0}e.exports=s},function(e,t,r){var n=r(80),i=r(246),o=NaN,s=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,c=/^0o[0-7]+$/i,f=parseInt;function l(e){if("number"==typeof e)return e;if(i(e))return o;if(n(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=n(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(s,"");var r=u.test(e);return r||c.test(e)?f(e.slice(2),r?2:8):a.test(e)?o:+e}e.exports=l},function(e,t,r){"use strict";(function(t){const n=r(1227),i=r(24),o=r(1228);class s{constructor(e){if(!e)throw new Error("keychain is required");this.keychain=e}encrypt(e,r,s){const a=this,u=(e,t)=>n.setImmediate(()=>s(e,t));if(!t.isBuffer(r))return u(new Error("Plain data must be a Buffer"));n.series([t=>a.keychain.findKeyByName(e,t),t=>a.keychain._getPrivateKey(e,t)],(e,n)=>{if(e)return u(e);let c=n[0],f=n[1];try{const n=i.pki.decryptRsaPrivateKey(f,a.keychain._());o.certificateForKey(c,n,(e,n)=>{if(e)return s(e);const o=i.pkcs7.createEnvelopedData();o.addRecipient(n),o.content=i.util.createBuffer(r),o.encrypt();const a=i.asn1.toDer(o.toAsn1()).getBytes();u(null,t.from(a,"binary"))})}catch(e){u(e)}})}decrypt(e,r){const o=(e,t)=>n.setImmediate(()=>r(e,t));if(!t.isBuffer(e))return o(new Error("CMS data is required"));const s=this;let a;try{const t=i.util.createBuffer(e.toString("binary")),r=i.asn1.fromDer(t);a=i.pkcs7.messageFromAsn1(r)}catch(e){return o(new Error("Invalid CMS: "+e.message))}const u=a.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}));n.detect(u,(e,t)=>s.keychain.findKeyById(e.keyId,(e,r)=>t(null,!e&&r)),(e,r)=>{if(e)return o(e);if(!r){const t=u.map(e=>e.keyId);return e=new Error("Decryption needs one of the key(s): "+t.join(", ")),e.missingKeys=t,o(e)}n.waterfall([e=>s.keychain.findKeyById(r.keyId,e),(e,t)=>s.keychain._getPrivateKey(e.name,t)],(e,n)=>{if(e)return o(e);const u=i.pki.decryptRsaPrivateKey(n,s.keychain._());a.decrypt(r.recipient,u),o(null,t.from(a.content.getBytes(),"binary"))})})}}e.exports=s}).call(this,r(0).Buffer)},function(e,t,r){(function(e,r,n){!function(e,r){r(t)}(this,function(t){"use strict";function i(e,t){t|=0;for(var r=Math.max(e.length-t,0),n=Array(r),i=0;i-1&&e%1==0&&e<=q}function z(e){return null!=e&&H(e.length)&&!K(e)}var V={};function G(){}function W(e){return function(){if(null!==e){var t=e;e=null,t.apply(this,arguments)}}}var $="function"==typeof Symbol&&Symbol.iterator,Y=function(e){return $&&e[$]&&e[$]()};function J(e,t){for(var r=-1,n=Array(e);++r-1&&e%1==0&&e2&&(n=i(arguments,1)),t){var o={};Tt(s,function(e,t){o[t]=e}),o[e]=n,u=!0,c=Object.create(null),r(t,o)}else s[e]=n,g(e)});a++;var o=v(t[t.length-1]);t.length>1?o(s,n):o(n)}}function b(){for(var e,t=0;l.length;)e=l.pop(),t++,At(_(e),function(e){0==--h[e]&&l.push(e)});if(t!==o)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}function _(t){var r=[];return Tt(e,function(e,n){ie(e)&&Pt(e,t,0)>=0&&r.push(n)}),r}Tt(e,function(t,r){if(!ie(t))return d(r,[t]),void l.push(r);var n=t.slice(0,t.length-1),i=n.length;if(0===i)return d(r,t),void l.push(r);h[r]=i,At(n,function(o){if(!e[o])throw new Error("async.auto task `"+r+"` has a non-existent dependency `"+o+"` in "+n.join(", "));y(o,function(){i--,0===i&&d(r,t)})})}),b(),p()};function Nt(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++ri?0:i+t),r=r>i?i:r,r<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(i);++n=n?e:Kt(e,t,r)}function Ht(e,t){for(var r=e.length;r--&&Pt(t,e[r],0)>-1;);return r}function zt(e,t){for(var r=-1,n=e.length;++r-1;);return r}function Vt(e){return e.split("")}var Gt="\\ud800-\\udfff",Wt="\\u0300-\\u036f",$t="\\ufe20-\\ufe2f",Yt="\\u20d0-\\u20ff",Jt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Zt="\\ufe0e\\ufe0f",Xt="\\u200d",Qt=RegExp("["+Xt+Gt+Jt+Zt+"]");function er(e){return Qt.test(e)}var tr="\\ud800-\\udfff",rr="\\u0300-\\u036f",nr="\\ufe20-\\ufe2f",ir="\\u20d0-\\u20ff",or="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",sr="\\ufe0e\\ufe0f",ar="[\\ud800-\\udfff]",ur="["+or+"]",cr="\\ud83c[\\udffb-\\udfff]",fr="(?:"+ur+"|"+cr+")",lr="[^\\ud800-\\udfff]",hr="(?:\\ud83c[\\udde6-\\uddff]){2}",dr="[\\ud800-\\udbff][\\udc00-\\udfff]",pr="\\u200d",yr=fr+"?",gr="[\\ufe0e\\ufe0f]?",mr="(?:\\u200d(?:"+[lr,hr,dr].join("|")+")"+gr+yr+")*",br=gr+yr+mr,vr="(?:"+[lr+ur+"?",ur,hr,dr,ar].join("|")+")",_r=RegExp(cr+"(?="+cr+")|"+vr+br,"g");function wr(e){return e.match(_r)||[]}function Sr(e){return er(e)?wr(e):Vt(e)}function Er(e){return null==e?"":Ft(e)}var kr=/^\s+|\s+$/g;function Ar(e,t,r){if(e=Er(e),e&&(r||void 0===t))return e.replace(kr,"");if(!e||!(t=Ft(t)))return e;var n=Sr(e),i=Sr(t),o=zt(n,i),s=Ht(n,i)+1;return qt(n,o,s).join("")}var xr=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,Cr=/,/,Tr=/(=.+)?(\s*)$/,Ir=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function Br(e){return e=e.toString().replace(Ir,""),e=e.match(xr)[2].replace(" ",""),e=e?e.split(Cr):[],e=e.map(function(e){return Ar(e.replace(Tr,""))}),e}function Or(e,t){var r={};Tt(e,function(e,t){var n,i=b(e),o=!i&&1===e.length||i&&0===e.length;if(ie(e))n=e.slice(0,-1),e=e[e.length-1],r[t]=n.concat(n.length>0?s:e);else if(o)r[t]=e;else{if(n=Br(e),0===e.length&&!i&&0===n.length)throw new Error("autoInject task functions require explicit parameters.");i||n.pop(),r[t]=n.concat(s)}function s(t,r){var i=Nt(n,function(e){return t[e]});i.push(r),v(e).apply(null,i)}}),Rt(r,t)}function Pr(){this.head=this.tail=null,this.length=0}function Rr(e,t){e.length=1,e.head=e.tail=t}function Nr(e,t,r){if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var n=v(e),i=0,o=[],s=!1;function a(e,t,r){if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");if(f.started=!0,ie(e)||(e=[e]),0===e.length&&f.idle())return d(function(){f.drain()});for(var n=0,i=e.length;n0&&o.splice(a,1),s.callback.apply(s,arguments),null!=t&&f.error(t,s.data)}i<=f.concurrency-f.buffer&&f.unsaturated(),f.idle()&&f.drain(),f.process()}}var c=!1,f={_tasks:new Pr,concurrency:t,payload:r,saturated:G,unsaturated:G,buffer:t/4,empty:G,drain:G,error:G,started:!1,paused:!1,push:function(e,t){a(e,!1,t)},kill:function(){f.drain=G,f._tasks.empty()},unshift:function(e,t){a(e,!0,t)},remove:function(e){f._tasks.remove(e)},process:function(){if(!c){for(c=!0;!f.paused&&i2&&(o=i(arguments,1)),n[t]=o,r(e)})},function(e){r(e,n)})}function Rn(e,t){Pn(gt,e,t)}function Nn(e,t,r){Pn(lt(t),e,r)}var jn=function(e,t){var r=v(e);return Nr(function(e,t){r(e[0],t)},t,1)},Ln=function(e,t){var r=jn(e,t);return r.push=function(e,t,n){if(null==n&&(n=G),"function"!=typeof n)throw new Error("task callback must be a function");if(r.started=!0,ie(e)||(e=[e]),0===e.length)return d(function(){r.drain()});t=t||0;for(var i=r._tasks.head;i&&t>=i.priority;)i=i.next;for(var o=0,s=e.length;on?1:0}vt(e,function(e,t){n(e,function(r,n){if(r)return t(r);t(null,{value:e,criteria:n})})},function(e,t){if(e)return r(e);r(null,Nt(t.sort(i),dn("value")))})}function Qn(e,t,r){var n=v(e);return s(function(i,o){var s=!1,a;function u(){var t=e.name||"anonymous",n=new Error('Callback function "'+t+'" timed out.');n.code="ETIMEDOUT",r&&(n.info=r),s=!0,o(n)}i.push(function(){s||(o.apply(null,arguments),clearTimeout(a))}),a=setTimeout(u,t),n.apply(null,i)})}var ei=Math.ceil,ti=Math.max;function ri(e,t,r,n){for(var i=-1,o=ti(ei((t-e)/(r||1)),0),s=Array(o);o--;)s[n?o:++i]=e,e+=r;return s}function ni(e,t,r,n){var i=v(r);St(ri(0,e,1),t,i,n)}var ii=dt(ni,1/0),oi=dt(ni,1);function si(e,t,r,n){arguments.length<=3&&(n=r,r=t,t=ie(e)?[]:{}),n=W(n||G);var i=v(r);gt(e,function(e,r,n){i(t,e,r,n)},function(e){n(e,t)})}function ai(e,t){var r=null,n;t=t||G,an(e,function(e,t){v(e)(function(e,o){n=arguments.length>2?i(arguments,1):o,r=e,t(!e)})},function(){t(r,n)})}function ui(e){return function(){return(e.unmemoized||e).apply(null,arguments)}}function ci(e,t,r){r=ft(r||G);var n=v(t);if(!e())return r(null);var o=function(t){if(t)return r(t);if(e())return n(o);var s=i(arguments,1);r.apply(null,[null].concat(s))};n(o)}function fi(e,t,r){ci(function(){return!e.apply(this,arguments)},t,r)}var li=function(e,t){if(t=W(t||G),!ie(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var r=0;function n(t){var n=v(e[r++]);t.push(ft(o)),n.apply(null,t)}function o(o){if(o||r===e.length)return t.apply(null,arguments);n(i(arguments,1))}n([])},hi={apply:o,applyEach:_t,applyEachSeries:kt,asyncify:p,auto:Rt,autoInject:Or,cargo:jr,compose:Ur,concat:qr,concatLimit:Kr,concatSeries:Hr,constant:zr,detect:$r,detectLimit:Yr,detectSeries:Jr,dir:Xr,doDuring:Qr,doUntil:tn,doWhilst:en,during:rn,each:on,eachLimit:sn,eachOf:gt,eachOfLimit:ht,eachOfSeries:Lr,eachSeries:an,ensureAsync:un,every:fn,everyLimit:ln,everySeries:hn,filter:mn,filterLimit:bn,filterSeries:vn,forever:_n,groupBy:Sn,groupByLimit:wn,groupBySeries:En,log:kn,map:vt,mapLimit:St,mapSeries:Et,mapValues:xn,mapValuesLimit:An,mapValuesSeries:Cn,memoize:Bn,nextTick:On,parallel:Rn,parallelLimit:Nn,priorityQueue:Ln,queue:jn,race:Mn,reduce:Mr,reduceRight:Dn,reflect:Un,reflectAll:Fn,reject:qn,rejectLimit:Hn,rejectSeries:zn,retry:Gn,retryable:Wn,seq:Dr,series:$n,setImmediate:d,some:Yn,someLimit:Jn,someSeries:Zn,sortBy:Xn,timeout:Qn,times:ii,timesLimit:ni,timesSeries:oi,transform:si,tryEach:ai,unmemoize:ui,until:fi,waterfall:li,whilst:ci,all:fn,allLimit:ln,allSeries:hn,any:Yn,anyLimit:Jn,anySeries:Zn,find:$r,findLimit:Yr,findSeries:Jr,forEach:on,forEachSeries:an,forEachLimit:sn,forEachOf:gt,forEachOfSeries:Lr,forEachOfLimit:ht,inject:Mr,foldl:Mr,foldr:Dn,select:mn,selectLimit:bn,selectSeries:vn,wrapSync:p};t.default=hi,t.apply=o,t.applyEach=_t,t.applyEachSeries=kt,t.asyncify=p,t.auto=Rt,t.autoInject=Or,t.cargo=jr,t.compose=Ur,t.concat=qr,t.concatLimit=Kr,t.concatSeries=Hr,t.constant=zr,t.detect=$r,t.detectLimit=Yr,t.detectSeries=Jr,t.dir=Xr,t.doDuring=Qr,t.doUntil=tn,t.doWhilst=en,t.during=rn,t.each=on,t.eachLimit=sn,t.eachOf=gt,t.eachOfLimit=ht,t.eachOfSeries=Lr,t.eachSeries=an,t.ensureAsync=un,t.every=fn,t.everyLimit=ln,t.everySeries=hn,t.filter=mn,t.filterLimit=bn,t.filterSeries=vn,t.forever=_n,t.groupBy=Sn,t.groupByLimit=wn,t.groupBySeries=En,t.log=kn,t.map=vt,t.mapLimit=St,t.mapSeries=Et,t.mapValues=xn,t.mapValuesLimit=An,t.mapValuesSeries=Cn,t.memoize=Bn,t.nextTick=On,t.parallel=Rn,t.parallelLimit=Nn,t.priorityQueue=Ln,t.queue=jn,t.race=Mn,t.reduce=Mr,t.reduceRight=Dn,t.reflect=Un,t.reflectAll=Fn,t.reject=qn,t.rejectLimit=Hn,t.rejectSeries=zn,t.retry=Gn,t.retryable=Wn,t.seq=Dr,t.series=$n,t.setImmediate=d,t.some=Yn,t.someLimit=Jn,t.someSeries=Zn,t.sortBy=Xn,t.timeout=Qn,t.times=ii,t.timesLimit=ni,t.timesSeries=oi,t.transform=si,t.tryEach=ai,t.unmemoize=ui,t.until=fi,t.waterfall=li,t.whilst=ci,t.all=fn,t.allLimit=ln,t.allSeries=hn,t.any=Yn,t.anyLimit=Jn,t.anySeries=Zn,t.find=$r,t.findLimit=Yr,t.findSeries=Jr,t.forEach=on,t.forEachSeries=an,t.forEachLimit=sn,t.forEachOf=gt,t.forEachOfSeries=Lr,t.forEachOfLimit=ht,t.inject=Mr,t.foldl=Mr,t.foldr=Dn,t.select=mn,t.selectLimit=bn,t.selectSeries=vn,t.wrapSync=p,Object.defineProperty(t,"__esModule",{value:!0})})}).call(this,r(3),r(10),r(32)(e))},function(e,t,r){"use strict";const n=r(24),i=n.pki;t=e.exports,t.certificateForKey=((e,t,r)=>{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(42),i=r(1231),o=r(7),s=r(2);e.exports=(e=>s(t=>{const r=r=>{if(r)return o(()=>e.emit("error",r)),t(r);e.state.started(),o(()=>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.libp2p.start(t),t=>{e._bitswap=new i(e._libp2pNode,e._repo.blocks,{statsEnabled:!0}),e._bitswap.start(),e._blockService.setExchange(e._bitswap),e._preload.start(),e._mfsPreload.start(t)}],r)}))},function(e,t,r){"use strict";const n=r(6),i=r(283),o=r(43),s=r(42),a=r(82),u=r(1232),c=r(1240),f=r(1244),l=r(1250),h=r(139).logger,d=r(1251),p={statsEnabled:!1,statsComputeThrottleTimeout:1e3,statsComputeThrottleMaxQueueSize:1e3},y=["blocksReceived","dataReceived","dupBlksReceived","dupDataReceived","blocksSent","dataSent","providesBufferLength","wantListLength","peerCount"];class g{constructor(e,t,r){this._libp2p=e,this._log=h(this.peerInfo.id),this._options=Object.assign({},p,r),this._stats=new d(y,{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 u(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 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 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=g},function(e,t,r){"use strict";const n=r(7),i=r(247),o=r(248),s=r(337),a=r(1239),u=r(139).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]",l="[object Date]",h="[object Error]",d="[object Function]",p="[object GeneratorFunction]",y="[object Map]",g="[object Number]",m="[object Object]",b="[object Promise]",v="[object RegExp]",_="[object Set]",w="[object String]",S="[object Symbol]",E="[object WeakMap]",k="[object ArrayBuffer]",A="[object DataView]",x="[object Float32Array]",C="[object Float64Array]",T="[object Int8Array]",I="[object Int16Array]",B="[object Int32Array]",O="[object Uint8Array]",P="[object Uint8ClampedArray]",R="[object Uint16Array]",N="[object Uint32Array]",j=/[\\^$.*+?()[\]{}|]/g,L=/^\[object .+?Constructor\]$/,M=/^(?:0|[1-9]\d*)$/,D={};D[x]=D[C]=D[T]=D[I]=D[B]=D[O]=D[P]=D[R]=D[N]=!0,D[u]=D[c]=D[k]=D[f]=D[A]=D[l]=D[h]=D[d]=D[y]=D[g]=D[m]=D[v]=D[_]=D[w]=D[E]=!1;var U="object"==typeof e&&e&&e.Object===Object&&e,F="object"==typeof self&&self&&self.Object===Object&&self,K=U||F||Function("return this")(),q=t&&!t.nodeType&&t,H=q&&"object"==typeof r&&r&&!r.nodeType&&r,z=H&&H.exports===q,V=z&&U.process,G=function(){try{return V&&V.binding("util")}catch(e){}}(),W=G&&G.isTypedArray;function $(e,t){for(var r=-1,n=e?e.length:0;++r-1}function Ke(e,t){var r=this.__data__,n=it(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function qe(e){var t=-1,r=e?e.length:0;for(this.clear();++tc))return!1;var l=a.get(e);if(l&&a.get(t))return l==t;var h=-1,d=!0,p=i&o?new $e:void 0;for(a.set(e,t),a.set(t,e);++h-1&&e%1==0&&e-1&&e%1==0&&e<=a}function Bt(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ot(e){return!!e&&"object"==typeof e}var Pt=W?J(W):ct;function Rt(e){return At(e)?nt(e):ft(e)}r.exports=Ct}).call(this,r(10),r(32)(e))},function(e,t,r){"use strict";(function(t){const n=r(22);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(248).Entry,i=r(9),o=r(20);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){(function(e,r){var n=200,i="Expected a function",o="__lodash_hash_undefined__",s=1,a=2,u=1/0,c=9007199254740991,f="[object Arguments]",l="[object Array]",h="[object Boolean]",d="[object Date]",p="[object Error]",y="[object Function]",g="[object GeneratorFunction]",m="[object Map]",b="[object Number]",v="[object Object]",_="[object Promise]",w="[object RegExp]",S="[object Set]",E="[object String]",k="[object Symbol]",A="[object WeakMap]",x="[object ArrayBuffer]",C="[object DataView]",T="[object Float32Array]",I="[object Float64Array]",B="[object Int8Array]",O="[object Int16Array]",P="[object Int32Array]",R="[object Uint8Array]",N="[object Uint8ClampedArray]",j="[object Uint16Array]",L="[object Uint32Array]",M=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,D=/^\w*$/,U=/^\./,F=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,K=/[\\^$.*+?()[\]{}|]/g,q=/\\(\\)?/g,H=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,V={};V[T]=V[I]=V[B]=V[O]=V[P]=V[R]=V[N]=V[j]=V[L]=!0,V[f]=V[l]=V[x]=V[h]=V[C]=V[d]=V[p]=V[y]=V[m]=V[b]=V[v]=V[w]=V[S]=V[E]=V[A]=!1;var G="object"==typeof e&&e&&e.Object===Object&&e,W="object"==typeof self&&self&&self.Object===Object&&self,$=G||W||Function("return this")(),Y=t&&!t.nodeType&&t,J=Y&&"object"==typeof r&&r&&!r.nodeType&&r,Z=J&&J.exports===Y,X=Z&&G.process,Q=function(){try{return X&&X.binding("util")}catch(e){}}(),ee=Q&&Q.isTypedArray;function te(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 re(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r-1}function rt(e,t){var r=this.__data__,n=vt(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function nt(e){var t=-1,r=e?e.length:0;for(this.clear();++t0&&r(a)?t>1?wt(a,t-1,r,n,i):ne(i,a):n||(i[i.length]=a)}return i}var St=Vt();function Et(e,t){return e&&St(e,t,Tr)}function kt(e,t){t=nr(t,e)?[t]:Kt(t);for(var r=0,n=t.length;null!=e&&rt||o&&s&&u&&!a&&!c||n&&s&&u||!r&&u||!i)return 1;if(!n&&!o&&!c&&e=a)return u;var c=r[n];return u*("desc"==c?-1:1)}}return e.index-t.index}function zt(e,t){return function(r,n){if(null==r)return r;if(!mr(r))return e(r,n);for(var i=r.length,o=t?i:-1,s=Object(r);(t?o--:++oc))return!1;var l=o.get(e);if(l&&o.get(t))return l==t;var h=-1,d=!0,p=i&s?new ct:void 0;for(o.set(e,t),o.set(t,e);++h-1&&e%1==0&&e1&&rr(e,t[0],t[1])?t=[]:r>2&&rr(t[0],t[1],t[2])&&(t=[t[0]]),Mt(e,wt(t,1),[])});function dr(e,t){if("function"!=typeof e||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),s};return r.cache=new(dr.Cache||nt),r}function pr(e,t){return e===t||e!=e&&t!=t}function yr(e){return br(e)&&we.call(e,"callee")&&(!xe.call(e,"callee")||Se.call(e)==f)}dr.Cache=nt;var gr=Array.isArray;function mr(e){return null!=e&&_r(e.length)&&!vr(e)}function br(e){return Sr(e)&&mr(e)}function vr(e){var t=wr(e)?Se.call(e):"";return t==y||t==g}function _r(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function wr(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Sr(e){return!!e&&"object"==typeof e}function Er(e){return"symbol"==typeof e||Sr(e)&&Se.call(e)==k}var kr=ee?ue(ee):Ot;function Ar(e){return null==e?"":Ft(e)}function xr(e,t,r){var n=null==e?void 0:kt(e,t);return void 0===n?r:n}function Cr(e,t){return null!=e&&Qt(e,t,xt)}function Tr(e){return mr(e)?bt(e):Rt(e)}function Ir(e){return e}function Br(e){return nr(e)?oe(fr(e)):Dt(e)}r.exports=hr}).call(this,r(10),r(32)(e))},function(e,t,r){"use strict";const n=r(20),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(570),i=r(247),o=r(139).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(58),i=r(8),o=r(6),s=r(43),a=r(7),u=r(247),c=r(337),f=r(139).logger,l="/ipfs/bitswap/1.0.0",h="/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(l,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(l),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,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,c.providerRequestTimeout,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 l:s=t.serializeToBitswap100();break;case h: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,h,(r,n)=>{r?this.libp2p.dialProtocol(e,l,(e,r)=>{if(e)return t(e);t(null,r,l)}):t(null,n,h)})}_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(22);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(22),i=r(571),o=r(4).Buffer,s=r(51);t.decode=f,t.decodeFromReader=l;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(){h(t,e,(e,t)=>{if(e)return r.end(e);r.push(t),i()})}return t(n),i(),r}}function l(e,t,r){"function"==typeof t&&(r=t,t={}),h(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 h(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+"!"));y(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+"!"));y(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(a--,s.push(t),o+=t.data.byteLength,o>=b||0===a){o=0;const t=s.slice();s=[],this._sendSafeBlocks(e,t,e=>{e&&this._log("sendblock error: %s",e.message),r()})}else r()},r)}_sendSafeBlocks(e,t,r){const n=new p(!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=c(r,(e,t)=>e.equals(t)),s=h(e,e=>e.target.toB58String());o([e=>a(i,(e,t)=>{this.blockstore.get(e,t)},e),(e,t)=>n(l(s),(t,n)=>{const i=t[0].target,o=r.map(t=>f(e,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()})})],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.toB58String(),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 r();if(t.full&&(n.wantlist=new y),this._processBlocks(t.blocks,n),0===t.wantlist.size)return 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();d(this._tasks,r,(e,t)=>{const r=e.target.toB58String()===n,i=e.entry.cid.equals(t.cid);return r&&i})}_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 g(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=v},function(e,t,r){(function(t){var r=200,n="__lodash_hash_undefined__",i=1/0,o="[object Function]",s="[object GeneratorFunction]",a=/[\\^$.*+?()[\]{}|]/g,u=/^\[object .+?Constructor\]$/,c="object"==typeof t&&t&&t.Object===Object&&t,f="object"==typeof self&&self&&self.Object===Object&&self,l=c||f||Function("return this")();function h(e,t){var r=e?e.length:0;return!!r&&y(e,t,0)>-1}function d(e,t,r){for(var n=-1,i=e?e.length:0;++n-1}function G(e,t){var r=this.__data__,n=re(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function W(e){var t=-1,r=e?e.length:0;for(this.clear();++t=r){var f=t?null:oe(e);if(f)return _(f);a=!1,o=m,c=new Q}else c=t?[]:u;e:for(;++i-1&&e%1==0&&e-1&&e%1==0&&e<=r}function x(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function C(e){return!!e&&"object"==typeof e}function T(e){return S(e)?g(e):m(e)}function I(e){return e?c(e,T(e)):[]}e.exports=I},function(e,t,r){(function(e,r){var n=200,i="Expected a function",o="__lodash_hash_undefined__",s=1,a=2,u=1/0,c=9007199254740991,f="[object Arguments]",l="[object Array]",h="[object Boolean]",d="[object Date]",p="[object Error]",y="[object Function]",g="[object GeneratorFunction]",m="[object Map]",b="[object Number]",v="[object Object]",_="[object Promise]",w="[object RegExp]",S="[object Set]",E="[object String]",k="[object Symbol]",A="[object WeakMap]",x="[object ArrayBuffer]",C="[object DataView]",T="[object Float32Array]",I="[object Float64Array]",B="[object Int8Array]",O="[object Int16Array]",P="[object Int32Array]",R="[object Uint8Array]",N="[object Uint8ClampedArray]",j="[object Uint16Array]",L="[object Uint32Array]",M=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,D=/^\w*$/,U=/^\./,F=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,K=/[\\^$.*+?()[\]{}|]/g,q=/\\(\\)?/g,H=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,V={};V[T]=V[I]=V[B]=V[O]=V[P]=V[R]=V[N]=V[j]=V[L]=!0,V[f]=V[l]=V[x]=V[h]=V[C]=V[d]=V[p]=V[y]=V[m]=V[b]=V[v]=V[w]=V[S]=V[E]=V[A]=!1;var G="object"==typeof e&&e&&e.Object===Object&&e,W="object"==typeof self&&self&&self.Object===Object&&self,$=G||W||Function("return this")(),Y=t&&!t.nodeType&&t,J=Y&&"object"==typeof r&&r&&!r.nodeType&&r,Z=J&&J.exports===Y,X=Z&&G.process,Q=function(){try{return X&&X.binding("util")}catch(e){}}(),ee=Q&&Q.isTypedArray;function te(e,t,r,n){for(var i=-1,o=e?e.length:0;++i-1}function Ze(e,t){var r=this.__data__,n=pt(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function Xe(e){var t=-1,r=e?e.length:0;for(this.clear();++tc))return!1;var l=o.get(e);if(l&&o.get(t))return l==t;var h=-1,d=!0,p=i&s?new it:void 0;for(o.set(e,t),o.set(t,e);++h-1&&e%1==0&&e-1&&e%1==0&&e<=c}function fr(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function lr(e){return!!e&&"object"==typeof e}function hr(e){return"symbol"==typeof e||lr(e)&&ve.call(e)==k}var dr=ee?oe(ee):xt;function pr(e){return null==e?"":Pt(e)}function yr(e,t,r){var n=null==e?void 0:vt(e,t);return void 0===n?r:n}function gr(e,t){return null!=e&&zt(e,t,wt)}function mr(e){return sr(e)?dt(e):Tt(e)}function br(e){return e}function vr(e){return Gt(e)?ne(Qt(e)):Ot(e)}r.exports=tr}).call(this,r(10),r(32)(e))},function(e,t){function r(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r-1;)d!==e&&c.call(d,p,1),c.call(e,p,1);return e}function l(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r`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(11),i=r(1252),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(11),i=r(63),o=r(573);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){"use strict";const n=r(42),i=r(2);e.exports=(e=>i(t=>{if(t=t||function e(){},e.log("stop"),"stopped"===e.state.state())return t(new Error("Already stopped"));if("running"!==e.state.state())return t(new Error("Not able to stop from state: "+e.state.state()));const r=r=>{if(r)return e.emit("error",r),t(r);e.state.stopped(),e.emit("stop"),t()};e.state.stop(),e._blockService.unsetExchange(),e._bitswap.stop(),e._preload.stop(),n([t=>e._mfsPreload.stop(t),t=>e.libp2p.stop(t),t=>e._repo.close(t)],r)}))},function(e,t,r){"use strict";e.exports=function e(t){return()=>Boolean(t._bitswap&&t._libp2pNode&&t._libp2pNode.isStarted())}},function(e,t,r){"use strict";const n=r(574),i=r(2);e.exports=function e(t){return i((e,r)=>{"function"==typeof e&&(r=e,e={}),t.repo.version((e,t)=>{e&&r(e),r(null,{version:n.version,repo:t,commit:""})})})}},function(e,t,r){"use strict";const n=r(2),i=r(7),o=r(574).version;e.exports=function e(t){return n((e,r)=>{"function"==typeof e&&(r=e,e={}),i(()=>r(null,{id:t._peerInfo.id.toB58String(),publicKey:t._peerInfo.id.pubKey.bytes.toString("base64"),addresses:t._peerInfo.multiaddrs.toArray().map(e=>e.toString()).filter(e=>e.indexOf("ipfs")>=0).sort(),agentVersion:`js-ipfs/${o}`,protocolVersion:"9000"}))})}},function(e,t,r){"use strict";const n=r(50),i=r(6),o=r(48),s=r(2),a=r(576),u=r(559),c=r(1258);e.exports=function e(t){return s((e,r)=>{"function"==typeof e&&(r=e,e={});const s=(e,n)=>{if(e)return t.emit("error",e),r(e);t.preStart(e=>{if(e)return t.emit("error",e),r(e);t.state.initialized(),t.emit("init"),r(null,n)})};if("uninitialized"!==t.state.state())return s(new Error("Not able to init from state: "+t.state.state()));if(t.state.init(),t.log("init"),e.repo)return t._repo=e.repo,s(null,!0);e.emptyRepo=e.emptyRepo||!1,e.bits=Number(e.bits)||2048,e.log=e.log||function(){};const f=a();let l;i([e=>t._repo.exists(e),(r,i)=>{if(t.log("repo exists?",r),!0===r)return i(new Error("repo already exists"));e.log(`generating ${e.bits}-bit RSA keypair...`,!1),t.log("generating peer id: %s bits",e.bits),n.create({bits:e.bits},i)},(r,n)=>{t.log("identity generated"),f.Identity={PeerID:r.toB58String(),PrivKey:r.privKey.bytes.toString("base64")},e.pass&&(l=r.privKey,f.Keychain=u.generateOptions()),e.log("done"),e.log("peer identity: "+f.Identity.PeerID),t._repo.init(f,n)},(e,r)=>t._repo.open(r),r=>{if(t.log("repo opened"),e.pass){t.log("creating keychain");const n=Object.assign({passPhrase:e.pass},f.Keychain);t._keychain=new u(t._repo.keys,n),t._keychain.importPeer("self",{privKey:l},r)}else r(null,!0)},(r,n)=>{if(e.emptyRepo)return n(null,!0);const i=[e=>t.object.new("unixfs-dir",e)];"function"==typeof c&&i.push(r=>c(t,e.log,r)),t.log("adding assets"),o(i,e=>{e?n(e):n(null,!0)})}],s)})}},function(e,t){},function(e,t,r){"use strict";const n=r(576),i=r(88).IPFS.matches,o=r(2);function s(e){try{return i(e)}catch(e){return!1}}function a(e){return new Error(`${e} is not a valid Multiaddr`)}e.exports=function e(t){return{list:o(e=>{t._repo.config.get((t,r)=>{if(t)return e(t);e(null,{Peers:r.Bootstrap})})}),add:o((e,r,i)=>{if("function"==typeof r&&(i=r,r={default:!1}),e&&!s(e))return setImmediate(()=>i(a(e)));t._repo.config.get((o,s)=>{if(o)return i(o);r.default?s.Bootstrap=n().Bootstrap:e&&-1===s.Bootstrap.indexOf(e)&&s.Bootstrap.push(e),t._repo.config.set(s,t=>{if(t)return i(t);i(null,{Peers:r.default?n().Bootstrap:[e]})})})}),rm:o((e,r,n)=>{if("function"==typeof r&&(n=r,r={all:!1}),e&&!s(e))return setImmediate(()=>n(a(e)));t._repo.config.get((i,o)=>{if(i)return n(i);r.all?o.Bootstrap=[]:o.Bootstrap=o.Bootstrap.filter(t=>t!==e),t._repo.config.set(o,t=>{if(t)return n(t);const i=[];!r.all&&e&&i.push(e),n(null,{Peers:i})})})})}}},function(e,t,r){"use strict";const n=r(2);e.exports=function e(t){return{get:n((e,r)=>("function"==typeof e&&(r=e,e=void 0),t._repo.config.get(e,r))),set:n((e,r,n)=>{t._repo.config.set(e,r,n)}),replace:n((e,r)=>{t._repo.config.set(e,r)})}}},function(e,t,r){"use strict";const n=r(104),i=r(18),o=r(33),s=r(9),a=r(6),u=r(7),c=r(2),f=r(71);function l(e){return s.isCID(e)?e:new s(e)}e.exports=function e(t){return{get:c((e,r,n)=>{"function"==typeof r&&(n=r,r={}),r=r||{};try{e=l(e)}catch(e){return u(()=>n(f(e,"ERR_INVALID_CID")))}!1!==r.preload&&t._preload(e),t._blockService.get(e,n)}),put:c((e,r,i)=>{if(i=i||function e(){},"function"==typeof r&&(i=r,r={}),Array.isArray(e))return i(new Error("Array is not supported"));a([t=>{if(n.isBlock(e))return t(null,e);if(r.cid&&s.isCID(r.cid))return t(null,new n(e,r.cid));const i=r.mhtype||"sha2-256",a=r.format||"dag-pb",u=r.version||0;o(e,i,(r,i)=>{if(r)return t(r);t(null,new n(e,new s(u,a,i)))})},(e,n)=>t._blockService.put(e,i=>{if(i)return n(i);!1!==r.preload&&t._preload(e.cid),n(null,e)})],i)}),rm:c((e,r)=>{try{e=l(e)}catch(e){return u(()=>r(f(e,"ERR_INVALID_CID")))}t._blockService.delete(e,r)}),stat:c((e,r,n)=>{"function"==typeof r&&(n=r,r={});try{e=l(e)}catch(e){return u(()=>n(f(e,"ERR_INVALID_CID")))}!1!==r.preload&&t._preload(e),t._blockService.get(e,(t,r)=>{if(t)return n(t);n(null,{key:i.toB58String(e.multihash),size:r.data.length})})})}}},function(e,t,r){"use strict";(function(t){const n=r(6),i=r(7),o=r(2),s=r(30),a=s.DAGNode,u=s.DAGLink,c=r(9),f=r(18),l=r(40),h=r(71);function d(e,r){if("string"==typeof e)return"base58"!==r&&r?t.from(e,r):e;if(t.isBuffer(e))return e;throw new Error("unsupported multihash")}function p(e,t,r){switch(t){case"json":return y(e,r);case"protobuf":return g(e,r);default:r(new Error(`unkown encoding: ${t}`))}}function y(e,r){let n,i;try{const o=JSON.parse(e.toString());i=(o.Links||[]).map(e=>new u(e.Name||e.name,e.Size||e.size,f.fromB58String(e.Hash||e.hash||e.multihash))),n=t.from(o.Data)}catch(e){return r(new Error("failed to parse JSON: "+e))}a.create(n,i,r)}function g(e,t){s.util.deserialize(e,t)}e.exports=function e(r){function f(e){return(t,i,o)=>{"function"==typeof i&&(o=i,i={}),n([e=>{r.object.get(t,i,e)},(t,n)=>{e(t,(e,t)=>{if(e)return n(e);const o=new c(t.multihash);r._ipld.put(t,{cid:o},e=>{if(e)return n(e);!1!==i.preload&&r._preload(o),n(null,t)})})}],o)}}return{new:o((e,n,o)=>{let s;if("function"==typeof e&&(o=e,e=void 0,n={}),"function"==typeof n&&(o=n,n={}),n=n||{},e){if("unixfs-dir"!==e)return i(()=>o(new Error("unknown template")));s=new l("directory").marshal()}else s=t.alloc(0);a.create(s,(e,t)=>{if(e)return o(e);const i=new c(t.multihash);r._ipld.put(t,{cid:i},e=>{if(e)return o(e);!1!==n.preload&&r._preload(i),o(null,t)})})}),put:o((e,n,o)=>{"function"==typeof n&&(o=n,n={});const s=n.enc;let u;if(t.isBuffer(e))s?p(e,s,(e,t)=>{if(e)return o(e);u=t,f()}):a.create(e,(e,t)=>{if(e)return o(e);u=t,f()});else if(e.multihash)u=e,f();else{if("object"!=typeof e)return o(new Error("obj not recognized"));a.create(e.Data,e.Links,(e,t)=>{if(e)return o(e);u=t,f()})}function f(){let e;try{e=new c(u.multihash)}catch(e){return i(()=>o(h(e,"ERR_INVALID_CID")))}r._ipld.put(u,{cid:e},t=>{if(t)return o(t);!1!==n.preload&&r._preload(e),r.object.get(u.multihash,o)})}}),get:o((e,t,n)=>{let o,s;"function"==typeof t&&(n=t,t={});try{o=d(e,t.enc)}catch(e){return i(()=>n(h(e,"ERR_INVALID_MULTIHASH")))}try{s=new c(o)}catch(e){return i(()=>n(h(e,"ERR_INVALID_CID")))}1===t.cidVersion&&(s=s.toV1()),!1!==t.preload&&r._preload(s),r._ipld.get(s,(e,t)=>{if(e)return n(e);const r=t.value;n(null,r)})}),data:o((e,t,n)=>{"function"==typeof t&&(n=t,t={}),r.object.get(e,t,(e,t)=>{if(e)return n(e);n(null,t.data)})}),links:o((e,t,n)=>{"function"==typeof t&&(n=t,t={}),r.object.get(e,t,(e,t)=>{if(e)return n(e);n(null,t.links)})}),stat:o((e,t,n)=>{"function"==typeof t&&(n=t,t={}),r.object.get(e,t,(e,t)=>{if(e)return n(e);s.util.serialize(t,(e,r)=>{if(e)return n(e);const i=r.length,o=t.links.reduce((e,t)=>e+t.size,0),s=t.toJSON();n(null,{Hash:s.multihash,NumLinks:t.links.length,BlockSize:i,LinksSize:i-t.data.length,DataSize:t.data.length,CumulativeSize:i+o})})})}),patch:o({addLink(e,t,r,n){f((e,r)=>{a.addLink(e,t,r)})(e,r,n)},rmLink(e,t,r,n){f((e,r)=>{u.isDAGLink(t)?t=t._name:t&&t.name&&(t=t.name),a.rmLink(e,t,r)})(e,r,n)},appendData(e,r,n,i){f((e,n)=>{const i=t.concat([e.data,r]);a.create(i,e.links,n)})(e,n,i)},setData(e,t,r,n){f((e,r)=>{a.create(t,e.links,r)})(e,r,n)}})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports="message Data {\n enum DataType {\n Raw = 0;\n Directory = 1;\n File = 2;\n Metadata = 3;\n Symlink = 4;\n HAMTShard = 5;\n }\n\n required DataType Type = 1;\n optional bytes Data = 2;\n optional uint64 filesize = 3;\n repeated uint64 blocksizes = 4;\n\n optional uint64 hashType = 5;\n optional uint64 fanout = 6;\n}\n\nmessage Metadata {\n optional string MimeType = 1;\n}"},function(e,t,r){"use strict";(function(t){const n=r(2),i=r(9),o=r(8),s=r(82),a=r(7),u=r(1265),c=r(71);e.exports=function e(r){return{put:n((e,t,n)=>{if("function"==typeof t)n=t,t={};else{if(t&&t.cid&&(t.format||t.hashAlg))return n(new Error("Can't put dag node. Please provide either `cid` OR `format` and `hashAlg` options."));if(t&&(t.format&&!t.hashAlg||!t.format&&t.hashAlg))return n(new Error("Can't put dag node. Please provide `format` AND `hashAlg` options."))}t=t||{};const i={format:"dag-cbor",hashAlg:"sha2-256"};t=t.cid?t:Object.assign({},i,t),r._ipld.put(e,t,(e,i)=>{if(e)return n(e);!1!==t.preload&&r._preload(i),n(null,i)})}),get:n((e,n,o,s)=>{if("function"==typeof n&&(s=n,n=void 0),"function"==typeof o&&(s=o,o={}),o=o||{},"string"==typeof e){const t=e.split("/");try{e=new i(t[0])}catch(e){return a(()=>s(c(e,"ERR_INVALID_CID")))}t.shift(),n=t.length>0?t.join("/"):"/"}else if(t.isBuffer(e))try{e=new i(e)}catch(e){return a(()=>s(c(e,"ERR_INVALID_CID")))}!1!==o.preload&&r._preload(e),r._ipld.get(e,n,o,s)}),tree:n((e,t,n,s)=>{if("object"==typeof t&&(s=n,n=t,t=void 0),"function"==typeof t&&(s=t,t=void 0),"function"==typeof n&&(s=n,n={}),n=n||{},"string"==typeof e){const r=e.split("/");try{e=new i(r[0])}catch(e){return a(()=>s(c(e,"ERR_INVALID_CID")))}r.shift(),t=r.length>0?r.join("/"):void 0}!1!==n.preload&&r._preload(e),o(r._ipld.treeStream(e,t,n),o.collect(s))}),_getRecursive:n((e,t,n)=>{let o;"function"==typeof t&&(n=t,t={}),t=t||{};try{o=new i(e)}catch(e){return a(()=>n(c(e,"ERR_INVALID_CID")))}r.dag.get(o,"",t,(e,t)=>{if(e)return n(e);s(t.value.links,(e,t)=>{r.dag._getRecursive(e.multihash,t)},(e,r)=>{if(e)return n(e);n(null,u([t.value,r]))})})})}}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(1266),i=1/0;function o(e){var t=null==e?0:e.length;return t?n(e,i):[]}e.exports=o},function(e,t,r){var n=r(1267),i=r(1268);function o(e,t,r,s,a){var u=-1,c=e.length;for(r||(r=i),a||(a=[]);++u0&&r(f)?t>1?o(f,t-1,r,s,a):n(a,f):s||(a[a.length]=f)}return a}e.exports=o},function(e,t){function r(e,t){for(var r=-1,n=t.length,i=e.length;++r{function r(r,i){if(r)return e(r);const a={peerInfo:t._peerInfo,peerBook:t._peerInfoBook,config:{peerDiscovery:{mdns:{enabled:o(t._options,"config.Discovery.MDNS.Enabled",o(i,"Discovery.MDNS.Enabled",!0))},webRTCStar:{enabled:o(t._options,"config.Discovery.webRTCStar.Enabled",o(i,"Discovery.webRTCStar.Enabled",!0))},bootstrap:{list:o(t._options,"config.Bootstrap",o(i,"Bootstrap",[]))}},relay:{enabled:o(t._options,"relay.enabled",o(i,"relay.enabled",!1)),hop:{enabled:o(t._options,"relay.hop.enabled",o(i,"relay.hop.enabled",!1)),active:o(t._options,"relay.hop.active",o(i,"relay.hop.active",!1))}},EXPERIMENTAL:{dht:o(t._options,"EXPERIMENTAL.dht",!1),pubsub:o(t._options,"EXPERIMENTAL.pubsub",!1)}},connectionManager:o(t._options,"connectionManager",o(i,"connectionManager",{}))},u=s(o(t._options,"libp2p",{}),a);t._libp2pNode=new n(u),t._libp2pNode.on("peer:discovery",e=>{const r=()=>{t._peerInfoBook.put(e),t._libp2pNode.dial(e,()=>{})};t.isOnline()?r():t._libp2pNode.once("start",r)}),t._libp2pNode.on("peer:connect",e=>{t._peerInfoBook.put(e)}),t._libp2pNode.start(r=>{if(r)return e(r);t._libp2pNode.peerInfo.multiaddrs.forEach(e=>{console.log("Swarm listening on",e.toString())}),e()})}t.config.get(r)}),stop:i(e=>{t._libp2pNode.stop(e)})}}},function(e,t,r){"use strict";const n=r(577),i=r(1284),o=r(1319),s=r(1348),a=r(1364),u=r(1410),c=r(1414),f=r(657);class l extends c{constructor(e){const t=new i({id:e.peerInfo.id}),r=new o({id:e.peerInfo.id}),c={modules:{transport:[n,t,r],streamMuxer:[s],connEncryption:[a],peerDiscovery:[t.discovery,r.discovery,u]},config:{peerDiscovery:{bootstrap:{enabled:!0},webRTCStar:{enabled:!0},websocketStar:{enabled:!0}},EXPERIMENTAL:{dht:!1,pubsub:!1}}};super(f(e,c))}}e.exports=l},function(e,t,r){"use strict";var n=r(1272),i=r(1274),o=r(1278);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(1273):WebSocket},function(e,t){},function(e,t,r){var n=r(1275),i=r(1276);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(1277),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(3))},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 n=r(1279),i={http:"ws",https:"wss"},o="ws";e.exports=function(e,t){return n(e,t,i,o)}},function(e,t,r){var n=r(36);e.exports=function(e,t,r,i){r=r||{};var e=n.parse(e,!1,!0),o;return e.protocol?o=e.protocol:(o=t.protocol?t.protocol.replace(/:$/,""):"http",o=(r[o]||i||o)+":"),e.host&&":"===e.host[0]&&(e.host=null),e.hostname?n.format({protocol:o,slashes:!0,hostname:e.hostname,port:e.port,pathname:e.pathname,search:e.search}):(e.host=t.host,e.port?n.format({protocol:o,slashes:!0,host:t.hostname+":"+e.port,port:e.port,pathname:e.pathname,search:e.search}):e.pathname?n.format({protocol:o,slashes:!0,host:e.host,pathname:e.pathname,search:e.search}):(e.pathname=t.pathname,e.search?n.format({protocol:o,slashes:!0,host:e.host,pathname:e.pathname,search:e.search}):(e.search=t.search,e.format(e))))}},function(e,t){var r=1/0,n=9007199254740991,i=1.7976931348623157e308,o=NaN,s="[object Arguments]",a="[object Function]",u="[object GeneratorFunction]",c="[object String]",f="[object Symbol]",l=/^\s+|\s+$/g,h=/^[-+]0x[0-9a-f]+$/i,d=/^0b[01]+$/i,p=/^0o[0-7]+$/i,y=/^(?:0|[1-9]\d*)$/,g=parseInt;function m(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r-1&&e%1==0&&e-1:!!i&&v(e,t,r)>-1}function j(e){return D(e)&&A.call(e,"callee")&&(!C.call(e,"callee")||x.call(e)==s)}var L=Array.isArray;function M(e){return null!=e&&F(e.length)&&!U(e)}function D(e){return q(e)&&M(e)}function U(e){var t=K(e)?x.call(e):"";return t==a||t==u}function F(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}function K(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function q(e){return!!e&&"object"==typeof e}function H(e){return"string"==typeof e||!L(e)&&q(e)&&x.call(e)==c}function z(e){return"symbol"==typeof e||q(e)&&x.call(e)==f}function V(e){if(!e)return 0===e?e:0;if(e=W(e),e===r||e===-r){var t=e<0?-1:1;return t*i}return e==e?e:0}function G(e){var t=V(e),r=t%1;return t==t?r?t-r:t:0}function W(e){if("number"==typeof e)return e;if(z(e))return o;if(K(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=K(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(l,"");var r=d.test(e);return r||p.test(e)?g(e.slice(2),r?2:8):h.test(e)?o:+e}function $(e){return M(e)?B(e):O(e)}function Y(e){return e?S(e,$(e)):[]}e.exports=N},function(e,t,r){"use strict";const n=r(440);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";const n=r(5),i=n("libp2p:websockets:dialer");function o(e){const t=e.toString().split("/");let r,n;try{r=e.protoNames().filter(e=>"ws"===e||"wss"===e)[0]}catch(e){throw i(e),new Error("Not a valid websocket address",e)}try{n=e.stringTuples().filter(t=>{if(t[0]===e.protos().filter(e=>"tcp"===e.name)[0].code)return!0})[0][1]}catch(e){i("No port, skipping")}let o=`${r}://${t[2]}${!n||80===n&&443===n?"":`:${n}`}`;return o}e.exports=o},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(1285),i=n("libp2p:webrtc-star"),o=r(27),s=r(88),a=r(41),u=r(578),c=r(11).EventEmitter,f=r(253),l=r(1315),h=r(46),d=r(52).Connection,p=r(69),y=r(26),g=r(7),m=r(1317),b=r(1318),v=b.cleanUrlSIO,_=b.cleanMultiaddr,w=y(()=>{}),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=>{g(e)}),this.discovery.stop=(e=>{g(e)}),this.listenersRefs={},this._peerDiscovered=this._peerDiscovered.bind(this)}dial(e,t,r){"function"==typeof t&&(r=t,t={}),r=r?y(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?y(n):w,!m.support&&!this.wrtc)return g(()=>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?y(e):w,r.io.emit("ss-leave"),g(()=>{r.emit("close"),e()})}),r.getAddrs=(e=>{g(()=>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=l.createFromB58String(r),s=new h(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){(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(1286)(t);const{formatters:f}=e.exports;f.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,r(3))},function(e,t,r){function n(e){function t(e){let t=0;for(let r=0;r{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){var n=r(579),i=r(249)("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(1291),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(3))},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(580),i=r(581),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 l(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(340),f.transports=r(583),f.parser=r(141),f.prototype.createTransport=function(e){o('creating transport "%s"',e);var t=l(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"),h(),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,h(),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 l(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),n.removeListener("close",c),n.removeListener("upgrading",l)}f.priorWebsocketSuccess=!1,t.once("open",i),t.once("error",a),t.once("close",u),this.once("close",c),this.once("upgrading",l),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;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 l(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=h(),c=(31&t)<<6|r,c>=128)return c;throw Error("Invalid continuation byte")}if(224==(240&t)){if(r=h(),s=h(),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=h(),s=h(),a=h(),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:l,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),l=new Uint8Array(f);for(i=0;i>4,l[o++]=(15&a)<<4|u>>2,l[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(592),i=r(257);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='